Merge branch 'master' into var-subset

This commit is contained in:
Michiharu Ariza 2019-03-15 10:12:19 -07:00
commit 079c386ca8
6 changed files with 64 additions and 27 deletions

17
.ci/build-freetype.sh Normal file
View File

@ -0,0 +1,17 @@
#!/bin/bash
set -x
set -o errexit -o nounset
# 22.0.16 is the libtool version of 2.9.0
if pkg-config --atleast-version 22.0.16 freetype2; then exit; fi
pushd $HOME
wget http://download.savannah.gnu.org/releases/freetype/freetype-2.9.tar.bz2
tar xf freetype-2.9.tar.bz2
pushd freetype-2.9
./autogen.sh
./configure --prefix=$HOME/.local
make -j4 install
popd
popd

View File

@ -16,9 +16,10 @@ matrix:
- os: linux
compiler: gcc
script:
# Remove these two lines when Travis updated its distro
- wget http://download.savannah.gnu.org/releases/freetype/freetype-2.9.tar.bz2 && tar xf freetype-2.9.tar.bz2 && cd freetype-2.9 && ./autogen.sh && ./configure && make -j4 && cd ..
- export LD_LIBRARY_PATH="$PWD/freetype-2.9/objs/.libs"
# Remove the following three lines when Travis updates its distro
- export PKG_CONFIG_PATH="$HOME/.local/lib/pkgconfig"
- export LD_LIBRARY_PATH="$HOME/.local/lib"
- bash .ci/build-freetype.sh
- ./autogen.sh
- ./configure $CONFIGURE_OPTS --enable-gtk-doc --enable-code-coverage
@ -34,9 +35,10 @@ matrix:
- os: linux
compiler: clang
script:
# Remove these two lines when Travis updated its distro
- wget http://download.savannah.gnu.org/releases/freetype/freetype-2.9.tar.bz2 && tar xf freetype-2.9.tar.bz2 && cd freetype-2.9 && ./autogen.sh && ./configure && make -j4 && cd ..
- export LD_LIBRARY_PATH="$PWD/freetype-2.9/objs/.libs"
# Remove the following three lines when Travis updates its distro
- export PKG_CONFIG_PATH="$HOME/.local/lib/pkgconfig"
- export LD_LIBRARY_PATH="$HOME/.local/lib"
- bash .ci/build-freetype.sh
- ./autogen.sh
- ./configure $CONFIGURE_OPTS
@ -46,13 +48,7 @@ matrix:
- os: osx
compiler: clang
install:
- brew update;
# Workaround Travis/brew bug
- brew uninstall libtool && brew install libtool
- brew install ragel freetype glib gobject-introspection cairo graphite2 || true
- brew upgrade icu4c || true
- export PATH="/usr/local/opt/icu4c/sbin:/usr/local/opt/icu4c/bin:$PATH"
- export PKG_CONFIG_PATH="/usr/local/opt/icu4c/lib/pkgconfig"
- brew link --force icu4c
script:
- ./autogen.sh
- ./configure $CONFIGURE_OPTS --with-coretext
@ -63,6 +59,10 @@ notifications:
irc: "irc.freenode.org#harfbuzz"
email: harfbuzz-bots-chatter@googlegroups.com
cache:
directories:
- /home/travis/.local
addons:
apt:
packages:
@ -76,6 +76,14 @@ addons:
- libicu-dev # for extra unicode functions
- libgraphite2-dev # for extra shapers
#- libgirepository1.0-dev # for gobject-introspection
homebrew:
packages:
- cairo
- freetype
- glib
- graphite2
- icu4c
#- gobject-introspection
coverity_scan:
project:

View File

@ -326,27 +326,29 @@ struct hb_sanitize_context_t :
}
bool check_range (const void *base,
unsigned int len) const
unsigned int len) const
{
const char *p = (const char *) base;
bool ok = this->start <= p &&
p <= this->end &&
(unsigned int) (this->end - p) >= len &&
this->max_ops-- > 0;
bool ok = !len ||
(this->start <= p &&
p <= this->end &&
(unsigned int) (this->end - p) >= len &&
this->max_ops-- > 0);
DEBUG_MSG_LEVEL (SANITIZE, p, this->debug_depth+1, 0,
"check_range [%p..%p] (%d bytes) in [%p..%p] -> %s",
p, p + len, len,
this->start, this->end,
ok ? "OK" : "OUT-OF-RANGE");
"check_range [%p..%p]"
" (%d bytes) in [%p..%p] -> %s",
p, p + len, len,
this->start, this->end,
ok ? "OK" : "OUT-OF-RANGE");
return likely (ok);
}
template <typename T>
bool check_range (const T *base,
unsigned int a,
unsigned int b) const
unsigned int a,
unsigned int b) const
{
return !hb_unsigned_mul_overflows (a, b) &&
this->check_range (base, a * b);
@ -354,9 +356,9 @@ struct hb_sanitize_context_t :
template <typename T>
bool check_range (const T *base,
unsigned int a,
unsigned int b,
unsigned int c) const
unsigned int a,
unsigned int b,
unsigned int c) const
{
return !hb_unsigned_mul_overflows (a, b) &&
this->check_range (base, a * b, c);

View File

@ -362,6 +362,7 @@ set_indic_properties (hb_glyph_info_t &info)
else if (unlikely (u == 0x0AFBu)) cat = OT_N; /* https://github.com/harfbuzz/harfbuzz/issues/552 */
else if (unlikely (u == 0x0980u)) cat = OT_PLACEHOLDER; /* https://github.com/harfbuzz/harfbuzz/issues/538 */
else if (unlikely (u == 0x09FCu)) cat = OT_PLACEHOLDER; /* https://github.com/harfbuzz/harfbuzz/pull/1613 */
else if (unlikely (u == 0x0C80u)) cat = OT_PLACEHOLDER; /* https://github.com/harfbuzz/harfbuzz/pull/623 */
else if (unlikely (hb_in_range<hb_codepoint_t> (u, 0x2010u, 0x2011u)))
cat = OT_PLACEHOLDER;

BIN
test/api/fonts/Zycon.ttf Normal file

Binary file not shown.

View File

@ -110,12 +110,21 @@ test_ot_face_empty (void)
test_face (hb_face_get_empty (), 0);
}
static void
test_ot_var_axis_on_zero_named_instance ()
{
hb_face_t *face = hb_test_open_font_file ("fonts/Zycon.ttf");
g_assert (hb_ot_var_get_axis_count (face));
hb_face_destroy (face);
}
int
main (int argc, char **argv)
{
hb_test_init (&argc, &argv);
hb_test_add (test_ot_face_empty);
hb_test_add (test_ot_var_axis_on_zero_named_instance);
return hb_test_run();
}