diff --git a/.ci/build-freetype.sh b/.ci/build-freetype.sh new file mode 100644 index 000000000..0f09f92e9 --- /dev/null +++ b/.ci/build-freetype.sh @@ -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 diff --git a/.travis.yml b/.travis.yml index afb1b1ae6..681471dc0 100644 --- a/.travis.yml +++ b/.travis.yml @@ -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: diff --git a/src/hb-machinery.hh b/src/hb-machinery.hh index b22c2389c..ffa423d2f 100644 --- a/src/hb-machinery.hh +++ b/src/hb-machinery.hh @@ -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 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 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); diff --git a/src/hb-ot-shape-complex-indic.hh b/src/hb-ot-shape-complex-indic.hh index dcc2a7a6c..136e34991 100644 --- a/src/hb-ot-shape-complex-indic.hh +++ b/src/hb-ot-shape-complex-indic.hh @@ -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 (u, 0x2010u, 0x2011u))) cat = OT_PLACEHOLDER; diff --git a/test/api/fonts/Zycon.ttf b/test/api/fonts/Zycon.ttf new file mode 100644 index 000000000..3a6761b8f Binary files /dev/null and b/test/api/fonts/Zycon.ttf differ diff --git a/test/api/test-ot-face.c b/test/api/test-ot-face.c index f2d2fca4c..9ebcb4e2b 100644 --- a/test/api/test-ot-face.c +++ b/test/api/test-ot-face.c @@ -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(); }