[HarfBuzz] harfbuzz: Branch 'master' - 2 commits

Behdad Esfahbod behdad at kemper.freedesktop.org
Fri Nov 23 15:58:52 UTC 2018


 .circleci/config.yml                               |   46 +++++++++++++--------
 src/hb.hh                                          |    8 +--
 test/shaping/CMakeLists.txt                        |    2 
 test/shaping/data/in-house/Makefile.sources        |    1 
 test/shaping/data/in-house/tests/macos-10.12.tests |   10 ++++
 test/shaping/run-tests.py                          |   38 ++++++++++++++---
 6 files changed, 77 insertions(+), 28 deletions(-)

New commits:
commit 3d2b98ef14af29acd74f01647bef60cd410825fb
Author: Behdad Esfahbod <behdad at behdad.org>
Date:   Fri Nov 23 10:45:44 2018 -0500

    Minor

diff --git a/src/hb.hh b/src/hb.hh
index be8b2148..bc322a81 100644
--- a/src/hb.hh
+++ b/src/hb.hh
@@ -446,11 +446,11 @@ typedef uint64_t hb_vector_size_impl_t;
  * For example, for testing "x ∈ {x1, x2, x3}" use:
  * (FLAG_UNSAFE(x) & (FLAG(x1) | FLAG(x2) | FLAG(x3)))
  */
-#define FLAG(x) (ASSERT_STATIC_EXPR_ZERO ((unsigned)(x) < 32) + (1U << (unsigned)(x)))
-#define FLAG_UNSAFE(x) ((unsigned)(x) < 32 ? (1U << (unsigned)(x)) : 0)
+#define FLAG(x) (ASSERT_STATIC_EXPR_ZERO ((unsigned)(x) < 32) + (((uint32_t) 1U) << (unsigned)(x)))
+#define FLAG_UNSAFE(x) ((unsigned)(x) < 32 ? (((uint32_t) 1U) << (unsigned)(x)) : 0)
 #define FLAG_RANGE(x,y) (ASSERT_STATIC_EXPR_ZERO ((x) < (y)) + FLAG(y+1) - FLAG(x))
-#define FLAG64(x) (ASSERT_STATIC_EXPR_ZERO ((unsigned)(x) < 64) + (1ULL << (unsigned)(x)))
-#define FLAG64_UNSAFE(x) ((unsigned)(x) < 64 ? (1ULL << (unsigned)(x)) : 0)
+#define FLAG64(x) (ASSERT_STATIC_EXPR_ZERO ((unsigned)(x) < 64) + (((uint64_t) 1ULL) << (unsigned)(x)))
+#define FLAG64_UNSAFE(x) ((unsigned)(x) < 64 ? (((uint64_t) 1ULL) << (unsigned)(x)) : 0)
 
 
 /* Size signifying variable-sized array */
commit 341851efe158599a34d241a97593058a4333852e
Author: Ebrahim Byagowi <ebrahim at gnu.org>
Date:   Fri Nov 23 15:40:05 2018 +0330

    [aat] Add macOS specific tests (#1404)

diff --git a/.circleci/config.yml b/.circleci/config.yml
index 906f4ba8..e56aabb7 100644
--- a/.circleci/config.yml
+++ b/.circleci/config.yml
@@ -2,30 +2,41 @@ version: 2
 
 jobs:
 
-  macos-llvm-gcc-4.2:
+  macos-10.12-aat-fonts:
     macos:
-      xcode: "8.3.3"
+      xcode: "9.2.0"
     steps:
       - checkout
       - run: brew update-reset
       - run: brew install wget pkg-config libtool ragel freetype glib cairo
-      - run: wget https://packages.macports.org/llvm-gcc42/llvm-gcc42-2336.11_3+universal.darwin_15.i386-x86_64.tbz2 && tar zxvf llvm-gcc42-2336.11_3+universal.darwin_15.i386-x86_64.tbz2
-      - run: CC=$PWD/opt/local/bin/llvm-gcc-4.2 CXX=$PWD/opt/local/bin/llvm-g++-4.2 ./autogen.sh --with-freetype --with-glib --with-gobject --with-cairo
-      # Ignoring assembler complains, https://stackoverflow.com/a/39867021
-      - run: make 2>&1 | grep -v -e '^/var/folders/*' -e '^[[:space:]]*\.section' -e '^[[:space:]]*\^[[:space:]]*~*'
+      - run: ./autogen.sh --with-freetype --with-glib --with-gobject --with-cairo
+      - run: make -j4
       - run: make check || .ci/fail.sh
 
-  macos-notest-apple-gcc-i686-4.2:
-    macos:
-      xcode: "8.3.3"
-    steps:
-      - checkout
-      - run: brew update-reset
-      - run: brew install wget pkg-config libtool ragel
-      - run: wget https://packages.macports.org/apple-gcc42/apple-gcc42-5666.3_15+universal.darwin_15.i386-x86_64.tbz2 && tar zxvf apple-gcc42-5666.3_15+universal.darwin_15.i386-x86_64.tbz2
-      - run: CPP=$PWD/opt/local/bin/i686-apple-darwin15-cpp-apple-4.2.1 CC=$PWD/opt/local/bin/i686-apple-darwin15-gcc-apple-4.2.1 CXX=$PWD/opt/local/bin/i686-apple-darwin15-g++-apple-4.2.1 ./autogen.sh
-      # Ignoring assembler complains, https://stackoverflow.com/a/39867021
-      - run: make 2>&1 | grep -v -e '^/var/folders/*' -e '^[[:space:]]*\.section' -e '^[[:space:]]*\^[[:space:]]*~*'
+  # macos-llvm-gcc-4.2:
+  #   macos:
+  #     xcode: "8.3.3"
+  #   steps:
+  #     - checkout
+  #     - run: brew update-reset
+  #     - run: brew install wget pkg-config libtool ragel freetype glib cairo
+  #     - run: wget https://packages.macports.org/llvm-gcc42/llvm-gcc42-2336.11_3+universal.darwin_15.i386-x86_64.tbz2 && tar zxvf llvm-gcc42-2336.11_3+universal.darwin_15.i386-x86_64.tbz2
+  #     - run: CC=$PWD/opt/local/bin/llvm-gcc-4.2 CXX=$PWD/opt/local/bin/llvm-g++-4.2 ./autogen.sh --with-freetype --with-glib --with-gobject --with-cairo
+  #     # Ignoring assembler complains, https://stackoverflow.com/a/39867021
+  #     - run: make 2>&1 | grep -v -e '^/var/folders/*' -e '^[[:space:]]*\.section' -e '^[[:space:]]*\^[[:space:]]*~*'
+  #     - run: make check || .ci/fail.sh
+
+  # macos-notest-apple-gcc-i686-4.2:
+  #   macos:
+  #     xcode: "8.3.3"
+  #   steps:
+  #     - checkout
+  #     - run: brew update-reset
+  #     - run: brew install wget pkg-config libtool ragel
+  #     - run: wget https://packages.macports.org/apple-gcc42/apple-gcc42-5666.3_15+universal.darwin_15.i386-x86_64.tbz2 && tar zxvf apple-gcc42-5666.3_15+universal.darwin_15.i386-x86_64.tbz2
+  #     - run: CPP=$PWD/opt/local/bin/i686-apple-darwin15-cpp-apple-4.2.1 CC=$PWD/opt/local/bin/i686-apple-darwin15-gcc-apple-4.2.1 CXX=$PWD/opt/local/bin/i686-apple-darwin15-g++-apple-4.2.1 ./autogen.sh
+  #     # Ignoring assembler complains, https://stackoverflow.com/a/39867021
+  #     - run: make 2>&1 | grep -v -e '^/var/folders/*' -e '^[[:space:]]*\.section' -e '^[[:space:]]*\^[[:space:]]*~*'
 
   macos-notest-ios:
     macos:
@@ -302,6 +313,7 @@ workflows:
   build:
     jobs:
       # macOS
+      - macos-10.12-aat-fonts
       #- macos-llvm-gcc-4.2
       #- macos-notest-apple-gcc-i686-4.2
       - macos-notest-ios
diff --git a/test/shaping/CMakeLists.txt b/test/shaping/CMakeLists.txt
index 7c2c9990..25f14177 100644
--- a/test/shaping/CMakeLists.txt
+++ b/test/shaping/CMakeLists.txt
@@ -5,6 +5,7 @@ if (HB_BUILD_UTILS)
     add_test (NAME ${test}
       COMMAND "${PYTHON_EXECUTABLE}" run-tests.py $<TARGET_FILE:hb-shape> "data/in-house/${test}"
       WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR})
+    set_property(TEST ${test} PROPERTY SKIP_RETURN_CODE 77)
   endforeach ()
 
   file (READ "${CMAKE_CURRENT_SOURCE_DIR}/data/text-rendering-tests/Makefile.sources" TEXTRENDERING)
@@ -13,5 +14,6 @@ if (HB_BUILD_UTILS)
     add_test (NAME ${test}
       COMMAND "${PYTHON_EXECUTABLE}" run-tests.py $<TARGET_FILE:hb-shape> "data/text-rendering-tests/${test}"
       WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR})
+    set_property(TEST ${test} PROPERTY SKIP_RETURN_CODE 77)
   endforeach ()
 endif ()
diff --git a/test/shaping/data/in-house/Makefile.sources b/test/shaping/data/in-house/Makefile.sources
index e5f105c7..209de079 100644
--- a/test/shaping/data/in-house/Makefile.sources
+++ b/test/shaping/data/in-house/Makefile.sources
@@ -33,6 +33,7 @@ TESTS = \
 	tests/khmer-misc.tests \
 	tests/language-tags.tests \
 	tests/ligature-id.tests \
+	tests/macos-10.12.tests \
 	tests/mark-attachment.tests \
 	tests/mark-filtering-sets.tests \
 	tests/mongolian-variation-selector.tests \
diff --git a/test/shaping/data/in-house/tests/macos-10.12.tests b/test/shaping/data/in-house/tests/macos-10.12.tests
new file mode 100644
index 00000000..770a70ee
--- /dev/null
+++ b/test/shaping/data/in-house/tests/macos-10.12.tests
@@ -0,0 +1,10 @@
+/Library/Fonts/Khmer MN.ttc at 5f5b1072df99b7355d3066ea85fe82969d13c94a::U+17A2,U+1780,U+17D2,U+179F,U+179A,U+1781,U+17D2,U+1798,U+17C2,U+179A:[km_qa=0+1025|km_ka=1+1025|km_sa.sub=1+517|km_ro=4+593|km_vs_ae=5+605|km_kha=5+1025|km_mo.sub=5+0|km_ro=9+593]
+/Library/Fonts/Tamil MN.ttc at 37a2020c3f86ebcc45e02c1de5fdf81e2676989d::U+0BA4,U+0BCA,U+0B95,U+0BC1,U+0B95,U+0BCD,U+0B95,U+0BAA,U+0BCD,U+0BAA,U+0B9F,U+0BCD,U+0B9F,U+0BC1:[tgm_e=0+1702|tgc_ta=0+1598|tgm_aa=0+1074|tgc_ka=2 at -74,0+1518|tgm_u=2+1205|tgc_ka=4+1592|tgm_pulli=4+503|tgc_ka=6+1592|tgc_pa=7+1370|tgm_pulli=7+503|tgc_pa=9+1370|tgc_tta=10+1566|tgm_pulli=10+503|tgc_tta=12+1566|tgm_u=12+1205]
+/System/Library/Fonts/Times.dfont at 39c954614d3f3317b28564db06d5b7b7a6ff0e39::U+0041,U+0066,U+0300,U+0066,U+0069,U+005A:[A=0+1479|f=1+682|gravecmb=1 at -480,588+0|fi=3+1139|Z=5+1251]
+/System/Library/Fonts/LucidaGrande.ttc at d89a9d7e57767bfe3b5a4cfd22bb1e9dbe03a062::U+05E1,U+05B0:[shevahebrew=0 at -7,0+0|samekhhebrew=0+1361]
+/Library/Fonts/Apple Chancery.ttf at 5fc49ae9bce39e2105864323183b68ea34c9e562::U+0054,U+0068,U+0020,U+0074,U+0068,U+0020,U+006C,U+006C,U+0020,U+0074,U+0065,U+0020,U+0074,U+006F,U+0020,U+0074,U+0072,U+0020,U+0066,U+0072,U+0020,U+0066,U+0075,U+0020,U+0066,U+006A:[T_h=0+2308|space=2+569|t_h=3+1687|space=5+569|l_l=6+1108|space=8+569|t_e=9+1408|space=11+569|t_o=12+1531|space=14+569|t_r=15+1385|space=17+569|f_r=18+1432|space=20+569|f_u=21+1733|space=23+569|f_j=24+1073]
+/System/Library/Fonts/GeezaPro.ttc at f43ee7151c2e9f1dddfbc26cfc148609eb5c5820::U+0627,U+0644,U+0623,U+064E,U+0628,U+0652,U+062C,U+064E,U+062F,U+0650,U+064A,U+064E,U+0651,U+0629,U+0640,U+0627,U+0644,U+0639,U+064E,U+0631,U+064E,U+0628,U+0650,U+064A,U+064E,U+0651,U+0629:[u0629.final.tehMarbuta=26+713|u064e_u0651.shaddaFatha=23 at 0,-200+0|u064a.medial.yeh=23+656|u0650.kasra=21 at 80,290+0|u0628.initial.beh=21 at -80,0+576|u064e.fatha=19 at 200,-570+0|u0631.final.reh=19 at -200,0+702|u064e.fatha=17 at 200,-200+0|u0639.medial.ain=17 at -200,0+738|u0644.initial.lam=16+515|u0627.final.alef=15+647|u0640.tatweel=14+449|u0629.final.tehMarbuta=13+713|u064e_u0651.shaddaFatha=10 at 0,-200+0|u064a.initial.yeh=10+656|u0650.kasra=8 at 80,570+0|u062f.final.dal=8 at -80,0+822|u064e.fatha=6 at 290,-160+0|u062c.medial.jeem=6 at -290,0+1069|u0652.sukun=4 at 0,-200+0|u0628.initial.beh=4+656|u064e.fatha=1 at -252,120+0|u0644_u0623.isolated.lamHamzaOnAlef=1 at 120,0+1282|u0627.alef=0+647]
+/System/Library/Fonts/GeezaPro.ttc at f43ee7151c2e9f1dddfbc26cfc148609eb5c5820::U+0628,U+064A,U+064E,U+0651,U+0629:[u0629.final.tehMarbuta=4+713|u064e_u0651.shaddaFatha=1 at 0,-200+0|u064a.medial.yeh=1+656|u0628.initial.beh=0+656]
+/System/Library/Fonts/GeezaPro.ttc at f43ee7151c2e9f1dddfbc26cfc148609eb5c5820::U+0631,U+0628:[u0628.beh=1+1415|u0631.reh=0 at -202,0+700]
+/System/Library/Fonts/GeezaPro.ttc at f43ee7151c2e9f1dddfbc26cfc148609eb5c5820::U+0628,U+064F:[u064f.damma=0 at 250,-250+0|u0628.beh=0 at -250,0+1165]
+/System/Library/Fonts/SFNSDisplay.ttf at 92787c30716672737e9059bc367c15d04fbc1ced::U+0056,U+0041,U+0056,U+0041:[gid265=0+1227|gid4=1 at -65,0+1162|gid265=2 at -65,0+1162|gid4=3 at -65,0+1227]
diff --git a/test/shaping/run-tests.py b/test/shaping/run-tests.py
index abb25ab3..17e203c0 100755
--- a/test/shaping/run-tests.py
+++ b/test/shaping/run-tests.py
@@ -2,7 +2,7 @@
 
 from __future__ import print_function, division, absolute_import
 
-import sys, os, subprocess
+import sys, os, subprocess, hashlib, tempfile, shutil
 
 def cmd(command):
 	global process
@@ -28,6 +28,7 @@ process = subprocess.Popen ([hb_shape, '--batch'],
 			    stderr=sys.stdout)
 
 fails = 0
+skips = 0
 
 if not len (args):
 	args = ['-']
@@ -46,8 +47,24 @@ for filename in args:
 
 	for line in f:
 		fontfile, options, unicodes, glyphs_expected = line.split (":")
-		cwd = os.path.dirname(filename)
-		fontfile = os.path.normpath (os.path.join (cwd, fontfile))
+		if fontfile.startswith ('/') or fontfile.startswith ('"/'):
+			fontfile, expected_hash = fontfile.split('@')
+
+			try:
+				with open (fontfile, 'rb') as ff:
+					actual_hash = hashlib.sha1 (ff.read()).hexdigest ().strip ()
+					if actual_hash != expected_hash:
+						print ('different versions of the font is found, expected %s hash was %s but got %s, skip' %
+							   (fontfile, expected_hash, actual_hash))
+						skips = skips + 1
+						continue
+			except:
+				print ('%s is not found, skip.' % fontfile)
+				skips = skips + 1
+				continue
+		else:
+			cwd = os.path.dirname(filename)
+			fontfile = os.path.normpath (os.path.join (cwd, fontfile))
 
 		extra_options = ["--shaper=ot"]
 		glyphs_expected = glyphs_expected.strip()
@@ -63,6 +80,12 @@ for filename in args:
 			print ("%s %s %s %s --unicodes %s" %
 					 (hb_shape, fontfile, ' '.join(extra_options), options, unicodes))
 
+		# hack to support fonts with space on run-tests.py, after several other tries...
+		if ' ' in fontfile:
+			new_fontfile = os.path.join (tempfile.gettempdir (), 'tmpfile')
+			shutil.copyfile(fontfile, new_fontfile)
+			fontfile = new_fontfile
+
 		glyphs1 = cmd ([hb_shape, "--font-funcs=ft",
 			fontfile] + extra_options + ["--unicodes",
 			unicodes] + (options.split (' ') if options else []))
@@ -85,11 +108,12 @@ for filename in args:
 			print ("Expected: " + glyphs_expected) # file=sys.stderr
 			fails = fails + 1
 
-if fails != 0:
+if fails != 0 or skips != 0:
 	if not reference:
-		print (str (fails) + " tests failed.") # file=sys.stderr
-	sys.exit (1)
-
+		print ("%d tests are failed and %d tests are skipped." % (fails, skips)) # file=sys.stderr
+	if fails != 0:
+		sys.exit (1)
+	sys.exit (77)
 else:
 	if not reference:
 		print ("All tests passed.")


More information about the HarfBuzz mailing list