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

Behdad Esfahbod behdad at kemper.freedesktop.org
Wed Mar 14 11:01:37 UTC 2018


 CMakeLists.txt               |   23 ++++++++++++++++++-----
 configure.ac                 |    9 ++++++++-
 src/gen-def.py               |    2 +-
 src/hb-directwrite.cc        |   37 +++++++++++++++++++++----------------
 src/hb-ot-color-svg-table.hh |   24 ++++++++++++++++--------
 src/hb-private.hh            |   13 +++++++++++++
 test/api/CMakeLists.txt      |    7 ++++++-
 test/api/hb-subset-test.h    |   17 +++++++++++++++--
 test/api/test-subset-cmap.c  |    8 ++++----
 test/api/test-subset-glyf.c  |   23 ++++++++++++++---------
 test/api/test-subset-hdmx.c  |    8 ++++----
 test/api/test-subset-hmtx.c  |   17 ++++++++++-------
 test/api/test-subset-os2.c   |    4 ++--
 test/fuzzing/CMakeLists.txt  |    2 +-
 test/shaping/CMakeLists.txt  |    4 ++--
 test/subset/CMakeLists.txt   |    2 +-
 16 files changed, 136 insertions(+), 64 deletions(-)

New commits:
commit d4907e83ef8e0d03acb701957cc1ee9acacb0a19
Author: Ebrahim Byagowi <ebrahim at gnu.org>
Date:   Wed Mar 14 11:04:28 2018 +0330

    [dwrite] GCC/mingw/msys2 compatibility (#884)

diff --git a/src/hb-directwrite.cc b/src/hb-directwrite.cc
index 69a8aa20..40e9e39b 100644
--- a/src/hb-directwrite.cc
+++ b/src/hb-directwrite.cc
@@ -1,5 +1,5 @@
 /*
- * Copyright © 2015-2016  Ebrahim Byagowi
+ * Copyright © 2015-2018  Ebrahim Byagowi
  *
  *  This is part of HarfBuzz, a text shaping library.
  *
@@ -48,7 +48,8 @@ class DWriteFontFileLoader : public IDWriteFontFileLoader
 private:
   IDWriteFontFileStream *mFontFileStream;
 public:
-  DWriteFontFileLoader (IDWriteFontFileStream *fontFileStream) {
+  void init (IDWriteFontFileStream *fontFileStream)
+  {
     mFontFileStream = fontFileStream;
   }
 
@@ -73,7 +74,7 @@ private:
   uint8_t *mData;
   uint32_t mSize;
 public:
-  DWriteFontFileStream(uint8_t *aData, uint32_t aSize)
+  void init (uint8_t *aData, uint32_t aSize)
   {
     mData = aData;
     mSize = aSize;
@@ -150,10 +151,14 @@ _hb_directwrite_shaper_face_data_create(hb_face_t *face)
 
   HRESULT hr;
   hb_blob_t *blob = hb_face_reference_blob (face);
-  IDWriteFontFileStream *fontFileStream = new DWriteFontFileStream (
-    (uint8_t*) hb_blob_get_data (blob, nullptr), hb_blob_get_length (blob));
-
-  IDWriteFontFileLoader *fontFileLoader = new DWriteFontFileLoader (fontFileStream);
+  DWriteFontFileStream *fontFileStream = (DWriteFontFileStream*)
+    malloc (sizeof (DWriteFontFileStream));
+  fontFileStream->init ((uint8_t*) hb_blob_get_data (blob, nullptr),
+    hb_blob_get_length (blob));
+
+  DWriteFontFileLoader *fontFileLoader = (DWriteFontFileLoader*)
+    malloc (sizeof (DWriteFontFileLoader));
+  fontFileLoader->init (fontFileStream);
   dwriteFactory->RegisterFontFileLoader (fontFileLoader);
 
   IDWriteFontFile *fontFile;
@@ -164,12 +169,12 @@ _hb_directwrite_shaper_face_data_create(hb_face_t *face)
 #define FAIL(...) \
   HB_STMT_START { \
     DEBUG_MSG (DIRECTWRITE, nullptr, __VA_ARGS__); \
-    return false; \
+    return nullptr; \
   } HB_STMT_END;
 
   if (FAILED (hr)) {
     FAIL ("Failed to load font file from data!");
-    return false;
+    return nullptr;
   }
 
   BOOL isSupported;
@@ -179,7 +184,7 @@ _hb_directwrite_shaper_face_data_create(hb_face_t *face)
   hr = fontFile->Analyze (&isSupported, &fileType, &faceType, &numberOfFaces);
   if (FAILED (hr) || !isSupported) {
     FAIL ("Font file is not supported.");
-    return false;
+    return nullptr;
   }
 
 #undef FAIL
@@ -211,9 +216,9 @@ _hb_directwrite_shaper_face_data_destroy(hb_directwrite_shaper_face_data_t *data
     data->dwriteFactory->Release ();
   }
   if (data->fontFileLoader)
-    delete data->fontFileLoader;
+    free (data->fontFileLoader);
   if (data->fontFileStream)
-    delete data->fontFileStream;
+    free (data->fontFileStream);
   if (data->faceBlob)
     hb_blob_destroy (data->faceBlob);
   if (data)
@@ -280,14 +285,14 @@ public:
   IFACEMETHOD_(ULONG, AddRef)() { return 1; }
   IFACEMETHOD_(ULONG, Release)() { return 1; }
 
-  // A single contiguous run of characters containing the same analysis 
+  // A single contiguous run of characters containing the same analysis
   // results.
   struct Run
   {
     uint32_t mTextStart;   // starting text position of this run
     uint32_t mTextLength;  // number of contiguous code units covered
     uint32_t mGlyphStart;  // starting glyph in the glyphs array
-    uint32_t mGlyphCount;  // number of glyphs associated with this run of 
+    uint32_t mGlyphCount;  // number of glyphs associated with this run
     // text
     DWRITE_SCRIPT_ANALYSIS mScript;
     uint8_t mBidiLevel;
@@ -604,7 +609,7 @@ _hb_directwrite_shape_full(hb_shape_plan_t    *shape_plan,
 
   // TODO: Handle TEST_DISABLE_OPTIONAL_LIGATURES
 
-  DWRITE_READING_DIRECTION readingDirection = buffer->props.direction ? 
+  DWRITE_READING_DIRECTION readingDirection = buffer->props.direction ?
     DWRITE_READING_DIRECTION_RIGHT_TO_LEFT :
     DWRITE_READING_DIRECTION_LEFT_TO_RIGHT;
 
@@ -919,7 +924,7 @@ hb_directwrite_shape_experimental_width(hb_font_t          *font,
   unsigned int        num_features,
   float               width)
 {
-  static char *shapers = "directwrite";
+  static char *shapers = (char *) "directwrite";
   hb_shape_plan_t *shape_plan = hb_shape_plan_create_cached (font->face,
     &buffer->props, features, num_features, &shapers);
   hb_bool_t res = _hb_directwrite_shape_full (shape_plan, font, buffer,
commit 93f8f89dedd2f8cf5eb40165a20d009de24c5eda
Author: Ebrahim Byagowi <ebrahim at gnu.org>
Date:   Wed Mar 14 09:56:31 2018 +0330

    [ci] Trying to fix gen-def issue on appveyor (#885)

diff --git a/src/gen-def.py b/src/gen-def.py
index 1673537c..74507e46 100755
--- a/src/gen-def.py
+++ b/src/gen-def.py
@@ -7,7 +7,7 @@ import io, os, re, sys
 headers_content = []
 for h in os.environ["headers"].split (' '):
 	if h.endswith (".h"):
-		with io.open(h, encoding='utf8') as f: headers_content.append (f.read ())
+		with io.open (h, encoding='ISO-8859-1') as f: headers_content.append (f.read ())
 
 result = """EXPORTS
 %s
commit a12dd6f75d85cf29ed78182ac97a12ebbcf77375
Merge: 28f25f32 7c43adab
Author: Ebrahim Byagowi <ebrahim at gnu.org>
Date:   Wed Mar 14 02:54:07 2018 +0330

    Merge pull request #877 from fanc999/master.msvc
    
    Fix CMake builds on Windows, MSVC in particular

commit 7c43adab6deb9302a24cc857c4aaa9b6b62215d2
Author: Chun-wei Fan <fanchunwei at src.gnome.org>
Date:   Mon Mar 12 16:43:53 2018 +0800

    CMake: Fix utility program installation
    
    Put in the utility program that was missed in installation by replacing
    the one that was duplicated.

diff --git a/CMakeLists.txt b/CMakeLists.txt
index dca71ed0..53e89740 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -762,7 +762,7 @@ if (NOT SKIP_INSTALL_LIBRARIES AND NOT SKIP_INSTALL_ALL)
     install(TARGETS hb-view
       RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
     )
-    install(TARGETS hb-view
+    install(TARGETS hb-subset
       RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
     )
 
commit e9b8002a6024d7a9b6de204897345ae77bb50881
Author: Chun-wei Fan <fanchunwei at src.gnome.org>
Date:   Mon Mar 12 16:23:57 2018 +0800

    CMake: Fix introspection on Windows
    
    The list of source files to pass to g-ir-scanner is becoming too
    long for Windows, as Windows imposes a 8192-character limit for command
    lines, so we need to first transform that list into a listings file, and
    then use the --filelist option for g-ir-scanner to build the
    introspection files.

diff --git a/CMakeLists.txt b/CMakeLists.txt
index 62e79450..dca71ed0 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -646,6 +646,11 @@ if (HB_HAVE_INTROSPECTION)
     endif ()
   endforeach ()
 
+  file(REMOVE ${CMAKE_CURRENT_BINARY_DIR}/src/hb_gir_list)
+  foreach (s ${introspected_sources})
+    file(APPEND ${CMAKE_CURRENT_BINARY_DIR}/src/hb_gir_list "${s}\n")
+  endforeach ()
+
   # Finally, build the introspection files...
   add_custom_command(
     TARGET harfbuzz-gobject
@@ -675,9 +680,9 @@ if (HB_HAVE_INTROSPECTION)
       --library=harfbuzz
       -L${hb_libpath}
       ${extra_libs}
-      ${introspected_sources}
+      --filelist ${CMAKE_CURRENT_BINARY_DIR}/src/hb_gir_list
       -o ${hb_libpath}/HarfBuzz-0.0.gir
-    DEPENDS harfbuzz-gobject harfbuzz
+    DEPENDS harfbuzz-gobject harfbuzz ${CMAKE_CURRENT_BINARY_DIR}/src/hb_gir_list
   )
 
   add_custom_command(
commit 831d4a2dab1f229811c3a90b791f2a19c88fc1b5
Author: Chun-wei Fan <fanchunwei at src.gnome.org>
Date:   Mon Mar 12 13:48:55 2018 +0800

    test/api: Fix building subset tests
    
    Include stdbool.h in hb-setset-test.h instead of in the individual
    sources, if it is found; otherwise use a simplistic fallback for it if
    it is not found.
    
    Also declare variables at the top of the block, to build on pre-C99
    compiliers.

diff --git a/test/api/hb-subset-test.h b/test/api/hb-subset-test.h
index f8386b16..49c3fddb 100644
--- a/test/api/hb-subset-test.h
+++ b/test/api/hb-subset-test.h
@@ -32,6 +32,18 @@
 #include "hb-test.h"
 #include "hb-subset.h"
 
+#ifdef HAVE_STDBOOL_H
+# include <stdbool.h>
+#else
+typedef short bool;
+# ifndef true
+#  define true 1
+# endif
+# ifndef false
+#  define false 0
+# endif
+#endif
+
 
 HB_BEGIN_DECLS
 
@@ -122,9 +134,10 @@ hb_subset_test_check (hb_face_t *expected,
                       hb_face_t *actual,
                       hb_tag_t   table)
 {
+  hb_blob_t *expected_blob, *actual_blob;
   fprintf(stderr, "compare %c%c%c%c\n", HB_UNTAG(table));
-  hb_blob_t *expected_blob = hb_face_reference_table (expected, table);
-  hb_blob_t *actual_blob = hb_face_reference_table (actual, table);
+  expected_blob = hb_face_reference_table (expected, table);
+  actual_blob = hb_face_reference_table (actual, table);
   hb_test_assert_blobs_equal (expected_blob, actual_blob);
   hb_blob_destroy (expected_blob);
   hb_blob_destroy (actual_blob);
diff --git a/test/api/test-subset-cmap.c b/test/api/test-subset-cmap.c
index 07715791..618b7259 100644
--- a/test/api/test-subset-cmap.c
+++ b/test/api/test-subset-cmap.c
@@ -24,8 +24,6 @@
  * Google Author(s): Roderick Sheeter
  */
 
-#include <stdbool.h>
-
 #include "hb-test.h"
 #include "hb-subset-test.h"
 
@@ -38,9 +36,10 @@ test_subset_cmap (void)
   hb_face_t *face_ac = hb_subset_test_open_font ("fonts/Roboto-Regular.ac.cmap-format12-only.ttf");
 
   hb_set_t *codepoints = hb_set_create ();
+  hb_face_t *face_abc_subset;
   hb_set_add (codepoints, 97);
   hb_set_add (codepoints, 99);
-  hb_face_t *face_abc_subset = hb_subset_test_create_subset (face_abc, hb_subset_test_create_input (codepoints));
+  face_abc_subset = hb_subset_test_create_subset (face_abc, hb_subset_test_create_input (codepoints));
   hb_set_destroy (codepoints);
 
   hb_subset_test_check (face_ac, face_abc_subset, HB_TAG ('c','m','a','p'));
@@ -56,10 +55,11 @@ test_subset_cmap_noop (void)
   hb_face_t *face_abc = hb_subset_test_open_font("fonts/Roboto-Regular.abc.cmap-format12-only.ttf");
 
   hb_set_t *codepoints = hb_set_create();
+  hb_face_t *face_abc_subset;
   hb_set_add (codepoints, 97);
   hb_set_add (codepoints, 98);
   hb_set_add (codepoints, 99);
-  hb_face_t *face_abc_subset = hb_subset_test_create_subset (face_abc, hb_subset_test_create_input (codepoints));
+  face_abc_subset = hb_subset_test_create_subset (face_abc, hb_subset_test_create_input (codepoints));
   hb_set_destroy (codepoints);
 
   hb_subset_test_check (face_abc, face_abc_subset, HB_TAG ('c','m','a','p'));
diff --git a/test/api/test-subset-glyf.c b/test/api/test-subset-glyf.c
index 8e17e8d5..e72086a3 100644
--- a/test/api/test-subset-glyf.c
+++ b/test/api/test-subset-glyf.c
@@ -24,8 +24,6 @@
  * Google Author(s): Garret Rieger
  */
 
-#include <stdbool.h>
-
 #include "hb-test.h"
 #include "hb-subset-test.h"
 
@@ -66,9 +64,10 @@ test_subset_glyf (void)
   hb_face_t *face_ac = hb_subset_test_open_font ("fonts/Roboto-Regular.ac.ttf");
 
   hb_set_t *codepoints = hb_set_create();
+  hb_face_t *face_abc_subset;
   hb_set_add (codepoints, 97);
   hb_set_add (codepoints, 99);
-  hb_face_t *face_abc_subset = hb_subset_test_create_subset (face_abc, hb_subset_test_create_input (codepoints));
+  face_abc_subset = hb_subset_test_create_subset (face_abc, hb_subset_test_create_input (codepoints));
   hb_set_destroy (codepoints);
 
   hb_subset_test_check (face_ac, face_abc_subset, HB_TAG ('g','l','y','f'));
@@ -87,8 +86,9 @@ test_subset_glyf_with_components (void)
   hb_face_t *face_subset = hb_subset_test_open_font ("fonts/Roboto-Regular.components.subset.ttf");
 
   hb_set_t *codepoints = hb_set_create();
+  hb_face_t *face_generated_subset;
   hb_set_add (codepoints, 0x1fc);
-  hb_face_t *face_generated_subset = hb_subset_test_create_subset (face_components, hb_subset_test_create_input (codepoints));
+  face_generated_subset = hb_subset_test_create_subset (face_components, hb_subset_test_create_input (codepoints));
   hb_set_destroy (codepoints);
 
   hb_subset_test_check (face_subset, face_generated_subset, HB_TAG ('g','l','y','f'));
@@ -106,10 +106,11 @@ test_subset_glyf_noop (void)
   hb_face_t *face_abc = hb_subset_test_open_font("fonts/Roboto-Regular.abc.ttf");
 
   hb_set_t *codepoints = hb_set_create();
+  hb_face_t *face_abc_subset;
   hb_set_add (codepoints, 97);
   hb_set_add (codepoints, 98);
   hb_set_add (codepoints, 99);
-  hb_face_t *face_abc_subset = hb_subset_test_create_subset (face_abc, hb_subset_test_create_input (codepoints));
+  face_abc_subset = hb_subset_test_create_subset (face_abc, hb_subset_test_create_input (codepoints));
   hb_set_destroy (codepoints);
 
   hb_subset_test_check (face_abc, face_abc_subset, HB_TAG ('g','l','y','f'));
@@ -127,11 +128,13 @@ test_subset_glyf_strip_hints_simple (void)
   hb_face_t *face_ac = hb_subset_test_open_font ("fonts/Roboto-Regular.ac.nohints.ttf");
 
   hb_set_t *codepoints = hb_set_create();
+  hb_subset_input_t *input;
+  hb_face_t *face_abc_subset;
   hb_set_add (codepoints, 'a');
   hb_set_add (codepoints, 'c');
-  hb_subset_input_t *input = hb_subset_test_create_input (codepoints);
+  input = hb_subset_test_create_input (codepoints);
   *hb_subset_input_drop_hints(input) = true;
-  hb_face_t *face_abc_subset = hb_subset_test_create_subset (face_abc, input);
+  face_abc_subset = hb_subset_test_create_subset (face_abc, input);
   hb_set_destroy (codepoints);
 
   hb_subset_test_check (face_ac, face_abc_subset, HB_TAG ('l','o','c', 'a'));
@@ -150,11 +153,13 @@ test_subset_glyf_strip_hints_composite (void)
   hb_face_t *face_subset = hb_subset_test_open_font ("fonts/Roboto-Regular.components.1fc.nohints.ttf");
 
   hb_set_t *codepoints = hb_set_create();
+  hb_subset_input_t *input;
+  hb_face_t *face_generated_subset;
   hb_set_add (codepoints, 0x1fc);
-  hb_subset_input_t *input = hb_subset_test_create_input (codepoints);
+  input = hb_subset_test_create_input (codepoints);
   *hb_subset_input_drop_hints(input) = true;
 
-  hb_face_t *face_generated_subset = hb_subset_test_create_subset (face_components, input);
+  face_generated_subset = hb_subset_test_create_subset (face_components, input);
   hb_set_destroy (codepoints);
 
   hb_subset_test_check (face_subset, face_generated_subset, HB_TAG ('g','l','y','f'));
diff --git a/test/api/test-subset-hdmx.c b/test/api/test-subset-hdmx.c
index 5211dbc4..609ee061 100644
--- a/test/api/test-subset-hdmx.c
+++ b/test/api/test-subset-hdmx.c
@@ -24,8 +24,6 @@
  * Google Author(s): Garret Rieger
  */
 
-#include <stdbool.h>
-
 #include "hb-test.h"
 #include "hb-subset-test.h"
 
@@ -39,9 +37,10 @@ test_subset_hdmx_simple_subset (void)
   hb_face_t *face_ac = hb_subset_test_open_font ("fonts/Roboto-Regular.ac.ttf");
 
   hb_set_t *codepoints = hb_set_create ();
+  hb_face_t *face_abc_subset;
   hb_set_add (codepoints, 'a');
   hb_set_add (codepoints, 'c');
-  hb_face_t *face_abc_subset = hb_subset_test_create_subset (face_abc, hb_subset_test_create_input (codepoints));
+  face_abc_subset = hb_subset_test_create_subset (face_abc, hb_subset_test_create_input (codepoints));
   hb_set_destroy (codepoints);
 
   hb_subset_test_check (face_ac, face_abc_subset, HB_TAG ('h','d','m','x'));
@@ -57,10 +56,11 @@ test_subset_hdmx_noop (void)
   hb_face_t *face_abc = hb_subset_test_open_font("fonts/Roboto-Regular.abc.ttf");
 
   hb_set_t *codepoints = hb_set_create();
+  hb_face_t *face_abc_subset;
   hb_set_add (codepoints, 'a');
   hb_set_add (codepoints, 'b');
   hb_set_add (codepoints, 'c');
-  hb_face_t *face_abc_subset = hb_subset_test_create_subset (face_abc, hb_subset_test_create_input (codepoints));
+  face_abc_subset = hb_subset_test_create_subset (face_abc, hb_subset_test_create_input (codepoints));
   hb_set_destroy (codepoints);
 
   hb_subset_test_check (face_abc, face_abc_subset, HB_TAG ('h','d','m','x'));
diff --git a/test/api/test-subset-hmtx.c b/test/api/test-subset-hmtx.c
index 2b764526..fc57718a 100644
--- a/test/api/test-subset-hmtx.c
+++ b/test/api/test-subset-hmtx.c
@@ -24,8 +24,6 @@
  * Google Author(s): Roderick Sheeter
  */
 
-#include <stdbool.h>
-
 #include "hb-test.h"
 #include "hb-subset-test.h"
 
@@ -53,9 +51,10 @@ test_subset_hmtx_simple_subset (void)
   hb_face_t *face_ac = hb_subset_test_open_font ("fonts/Roboto-Regular.ac.ttf");
 
   hb_set_t *codepoints = hb_set_create ();
+  hb_face_t *face_abc_subset;
   hb_set_add (codepoints, 'a');
   hb_set_add (codepoints, 'c');
-  hb_face_t *face_abc_subset = hb_subset_test_create_subset (face_abc, hb_subset_test_create_input (codepoints));
+  face_abc_subset = hb_subset_test_create_subset (face_abc, hb_subset_test_create_input (codepoints));
   hb_set_destroy (codepoints);
 
   check_num_hmetrics(face_abc_subset, 3); /* nothing has same width */
@@ -74,9 +73,10 @@ test_subset_hmtx_monospace (void)
   hb_face_t *face_ac = hb_subset_test_open_font ("fonts/Inconsolata-Regular.ac.ttf");
 
   hb_set_t *codepoints = hb_set_create ();
+  hb_face_t *face_abc_subset;
   hb_set_add (codepoints, 'a');
   hb_set_add (codepoints, 'c');
-  hb_face_t *face_abc_subset = hb_subset_test_create_subset (face_abc, hb_subset_test_create_input (codepoints));
+  face_abc_subset = hb_subset_test_create_subset (face_abc, hb_subset_test_create_input (codepoints));
   hb_set_destroy (codepoints);
 
   check_num_hmetrics(face_abc_subset, 1); /* everything has same width */
@@ -95,9 +95,10 @@ test_subset_hmtx_keep_num_metrics (void)
   hb_face_t *face_ac = hb_subset_test_open_font ("fonts/Inconsolata-Regular.ac.widerc.ttf");
 
   hb_set_t *codepoints = hb_set_create ();
+  hb_face_t *face_abc_subset;
   hb_set_add (codepoints, 'a');
   hb_set_add (codepoints, 'c');
-  hb_face_t *face_abc_subset = hb_subset_test_create_subset (face_abc, hb_subset_test_create_input (codepoints));
+  face_abc_subset = hb_subset_test_create_subset (face_abc, hb_subset_test_create_input (codepoints));
   hb_set_destroy (codepoints);
 
   check_num_hmetrics(face_abc_subset, 3); /* c is wider */
@@ -115,9 +116,10 @@ test_subset_hmtx_decrease_num_metrics (void)
   hb_face_t *face_ab = hb_subset_test_open_font ("fonts/Inconsolata-Regular.ab.ttf");
 
   hb_set_t *codepoints = hb_set_create ();
+  hb_face_t *face_abc_subset;
   hb_set_add (codepoints, 'a');
   hb_set_add (codepoints, 'b');
-  hb_face_t *face_abc_subset = hb_subset_test_create_subset (face_abc, hb_subset_test_create_input (codepoints));
+  face_abc_subset = hb_subset_test_create_subset (face_abc, hb_subset_test_create_input (codepoints));
   hb_set_destroy (codepoints);
 
   check_num_hmetrics(face_abc_subset, 1); /* everything left has same width */
@@ -134,10 +136,11 @@ test_subset_hmtx_noop (void)
   hb_face_t *face_abc = hb_subset_test_open_font("fonts/Roboto-Regular.abc.ttf");
 
   hb_set_t *codepoints = hb_set_create();
+  hb_face_t *face_abc_subset;
   hb_set_add (codepoints, 'a');
   hb_set_add (codepoints, 'b');
   hb_set_add (codepoints, 'c');
-  hb_face_t *face_abc_subset = hb_subset_test_create_subset (face_abc, hb_subset_test_create_input (codepoints));
+  face_abc_subset = hb_subset_test_create_subset (face_abc, hb_subset_test_create_input (codepoints));
   hb_set_destroy (codepoints);
 
   check_num_hmetrics(face_abc_subset, 4); /* nothing has same width */
diff --git a/test/api/test-subset-os2.c b/test/api/test-subset-os2.c
index e9db9bed..de63a3fd 100644
--- a/test/api/test-subset-os2.c
+++ b/test/api/test-subset-os2.c
@@ -24,7 +24,6 @@
  * Google Author(s): Garret Rieger
  */
 
-#include <stdbool.h>
 
 #include "hb-test.h"
 #include "hb-subset-test.h"
@@ -36,8 +35,9 @@ test_subset_os2 (void)
   hb_face_t *face_b = hb_subset_test_open_font("fonts/Roboto-Regular.b.ttf");
 
   hb_set_t *codepoints = hb_set_create();
+  hb_face_t *face_abc_subset;
   hb_set_add (codepoints, 98);
-  hb_face_t *face_abc_subset = hb_subset_test_create_subset (face_abc, hb_subset_test_create_input (codepoints));
+  face_abc_subset = hb_subset_test_create_subset (face_abc, hb_subset_test_create_input (codepoints));
   hb_set_destroy (codepoints);
 
   hb_subset_test_check (face_b, face_abc_subset, HB_TAG ('O','S','/','2'));
commit eda6a5ea807ba8a4e7fa20ad0273b394ed72d106
Author: Chun-wei Fan <fanchunwei at src.gnome.org>
Date:   Mon Mar 12 13:38:01 2018 +0800

    CMake: Fix running tests on Windows
    
    For the API tests, output the test programs at $(TOP_BUILDDIR) so that
    the freshly-built DLLs will be available for the test programs.  For
    those that are run through the Python wrapper scripts, use
    ${PYTHON_EXECUTABLE} instead of plain 'python' in case the Python
    interpreter is not in the PATH.

diff --git a/test/api/CMakeLists.txt b/test/api/CMakeLists.txt
index f1a2300f..b540eb50 100644
--- a/test/api/CMakeLists.txt
+++ b/test/api/CMakeLists.txt
@@ -21,7 +21,12 @@ if (HB_HAVE_GLIB)
       message (FATAL_ERROR "No source file found for test ${test_name}")
     endif ()
     target_link_libraries (${test_name} harfbuzz harfbuzz-subset)
-    add_test (${test_name} ${test_name})
+    if (WIN32)
+      set_property (TARGET ${test_name} PROPERTY RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR})
+      add_test (NAME ${test_name} COMMAND ${test_name})
+    else (WIN32)
+      add_test (${test_name} ${test_name})
+    endif (WIN32)
   endforeach ()
   set_tests_properties (${TEST_PROGS} PROPERTIES ENVIRONMENT
     "G_TEST_SRCDIR=${CMAKE_CURRENT_SOURCE_DIR};G_TEST_BUILDDIR=${CMAKE_CURRENT_BINARY_DIR}"
diff --git a/test/fuzzing/CMakeLists.txt b/test/fuzzing/CMakeLists.txt
index e31c7442..fe4cf790 100644
--- a/test/fuzzing/CMakeLists.txt
+++ b/test/fuzzing/CMakeLists.txt
@@ -13,6 +13,6 @@ if (HB_CHECK)
 
   target_compile_definitions(hb-fuzzer PUBLIC ${FUZZING_CPPFLAGS})
   add_test (NAME hb-fuzzer
-    COMMAND python run-fuzzer-tests.py $<TARGET_FILE:hb-fuzzer>
+    COMMAND "${PYTHON_EXECUTABLE}" run-fuzzer-tests.py $<TARGET_FILE:hb-fuzzer>
     WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR})
 endif ()
diff --git a/test/shaping/CMakeLists.txt b/test/shaping/CMakeLists.txt
index 4bdc5c9e..7c2c9990 100644
--- a/test/shaping/CMakeLists.txt
+++ b/test/shaping/CMakeLists.txt
@@ -3,7 +3,7 @@ if (HB_BUILD_UTILS)
   extract_make_variable (TESTS ${INHOUSE})
   foreach (test IN ITEMS ${TESTS})
     add_test (NAME ${test}
-      COMMAND python run-tests.py $<TARGET_FILE:hb-shape> "data/in-house/${test}"
+      COMMAND "${PYTHON_EXECUTABLE}" run-tests.py $<TARGET_FILE:hb-shape> "data/in-house/${test}"
       WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR})
   endforeach ()
 
@@ -11,7 +11,7 @@ if (HB_BUILD_UTILS)
   extract_make_variable (TESTS ${TEXTRENDERING})
   foreach (test IN ITEMS ${TESTS})
     add_test (NAME ${test}
-      COMMAND python run-tests.py $<TARGET_FILE:hb-shape> "data/text-rendering-tests/${test}"
+      COMMAND "${PYTHON_EXECUTABLE}" run-tests.py $<TARGET_FILE:hb-shape> "data/text-rendering-tests/${test}"
       WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR})
   endforeach ()
 endif ()
diff --git a/test/subset/CMakeLists.txt b/test/subset/CMakeLists.txt
index ea04105c..af2b41ab 100644
--- a/test/subset/CMakeLists.txt
+++ b/test/subset/CMakeLists.txt
@@ -3,7 +3,7 @@ if (HB_BUILD_UTILS)
   extract_make_variable (TESTS ${SOURCES})
   foreach (test IN ITEMS ${TESTS})
     add_test (NAME ${test}
-      COMMAND python run-tests.py $<TARGET_FILE:hb-subset> "data/${test}"
+      COMMAND "${PYTHON_EXECUTABLE}" run-tests.py $<TARGET_FILE:hb-subset> "data/${test}"
       WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR})
     set_property(TEST ${test} PROPERTY SKIP_RETURN_CODE 77)
   endforeach ()
commit b9dcbb1f8312d8606b230f75594d40b7d4087004
Author: Chun-wei Fan <fanchunwei at src.gnome.org>
Date:   Mon Mar 12 13:33:03 2018 +0800

    hb-private.hh: Add fallback implementation for round()
    
    Add a simplistic round() implementation for our purposes, used when the
    compiler does not support round() directly.

diff --git a/src/hb-private.hh b/src/hb-private.hh
index daa496e9..62a103cf 100644
--- a/src/hb-private.hh
+++ b/src/hb-private.hh
@@ -1070,4 +1070,17 @@ struct hb_string_t
 };
 
 
+/* fallback for round() */
+#if !defined (HAVE_ROUND) && !defined (HAVE_DECL_ROUND)
+static inline double
+round (double x)
+{
+  if (x >= 0)
+    return floor (x + 0.5);
+  else
+    return ceil (x - 0.5);
+}
+#endif
+
+
 #endif /* HB_PRIVATE_HH */
commit 89dbabff65a39dfb0d9ad036516d5b96c37739de
Author: Chun-wei Fan <fanchunwei at src.gnome.org>
Date:   Mon Mar 12 13:27:38 2018 +0800

    configure.ac/CMake: Check for round() and stdbool.h
    
    Not all the compilers that HarfBuzz is buildable on supports round() and
    has the header stdbool.h, so we check for them and define HAVE_ROUND and
    HAVE_STDBOOL_H repsectively in our CFLAGS so that we include them only
    when they are found, or use fallback implementations when necessary.
    
    Also include FindPythonInterp earlier as we need PYTHON_EXECUTABLE to be
    set for running the tests.

diff --git a/CMakeLists.txt b/CMakeLists.txt
index defd5d6c..62e79450 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -90,6 +90,8 @@ include_directories(AFTER
 add_definitions(-DHAVE_OT)
 add_definitions(-DHAVE_FALLBACK)
 
+# We need PYTHON_EXECUTABLE to be set for running the tests...
+include (FindPythonInterp)
 
 ## Functions and headers
 include (CheckFunctionExists)
@@ -103,7 +105,10 @@ macro (check_funcs) # Similar to AC_CHECK_FUNCS of autotools
     endif ()
   endforeach ()
 endmacro ()
-check_funcs(atexit mprotect sysconf getpagesize mmap isatty newlocale strtod_l)
+if (UNIX)
+  list(APPEND CMAKE_REQUIRED_LIBRARIES m)
+endif ()
+check_funcs(atexit mprotect sysconf getpagesize mmap isatty newlocale strtod_l round)
 check_include_file(unistd.h HAVE_UNISTD_H)
 if (${HAVE_UNISTD_H})
   add_definitions(-DHAVE_UNISTD_H)
@@ -116,6 +121,10 @@ check_include_file(xlocale.h HAVE_XLOCALE_H)
 if (${HAVE_XLOCALE_H})
   add_definitions(-DHAVE_XLOCALE_H)
 endif ()
+check_include_file(stdbool.h HAVE_STDBOOL_H)
+if (${HAVE_STDBOOL_H})
+  add_definitions(-DHAVE_STDBOOL_H)
+endif ()
 
 
 if (MSVC)
@@ -385,7 +394,6 @@ if (WIN32 AND HB_HAVE_DIRECTWRITE)
 endif ()
 
 if (HB_HAVE_GOBJECT)
-  include (FindPythonInterp)
   include (FindPerl)
 
   # Use the hints from glib-2.0.pc to find glib-mkenums
diff --git a/configure.ac b/configure.ac
index 1fb8a10a..031be4a7 100644
--- a/configure.ac
+++ b/configure.ac
@@ -78,8 +78,15 @@ GTK_DOC_CHECK([1.15],[--flavour no-tmpl])
 ])
 
 # Functions, and headers
+
 AC_CHECK_FUNCS(atexit mprotect sysconf getpagesize mmap isatty newlocale strtod_l setlinebuf)
-AC_CHECK_HEADERS(unistd.h sys/mman.h xlocale.h)
+
+save_libs="$LIBS"
+LIBS="$LIBS -lm"
+AC_CHECK_FUNCS([round], ,[AC_CHECK_DECLS([round], , ,[#include <math.h>])])
+LIBS="$save_libs"
+
+AC_CHECK_HEADERS(unistd.h sys/mman.h xlocale.h stdbool.h)
 
 # Compiler flags
 AC_CANONICAL_HOST
commit 28f25f32fc63c3e1ae0d04b6eb5ea6b729fb2228
Author: Ebrahim Byagowi <ebrahim at gnu.org>
Date:   Mon Mar 12 14:00:11 2018 +0330

    [ot-color/SVG] Minor (#878)

diff --git a/src/hb-ot-color-svg-table.hh b/src/hb-ot-color-svg-table.hh
index 7e5161c9..3dc24e99 100644
--- a/src/hb-ot-color-svg-table.hh
+++ b/src/hb-ot-color-svg-table.hh
@@ -49,10 +49,15 @@ struct SVGDocumentIndexEntry
   }
 
   protected:
-  HBUINT16 startGlyphID;
-  HBUINT16 endGlyphID;
-  LOffsetTo<const uint8_t *> svgDoc;
-  HBUINT32 svgDocLength;
+  HBUINT16 startGlyphID;	/* The first glyph ID in the range described by
+                                 * this index entry. */
+  HBUINT16 endGlyphID;		/* The last glyph ID in the range described by
+                                 * this index entry. Must be >= startGlyphID. */
+  LOffsetTo<const uint8_t *>
+        svgDoc;			/* Offset from the beginning of the SVG Document Index
+                                 * to an SVG document. Must be non-zero. */
+  HBUINT32 svgDocLength;	/* Length of the SVG document.
+                                 * Must be non-zero. */
   public:
   DEFINE_SIZE_STATIC (12);
 };
@@ -81,7 +86,8 @@ struct SVGDocumentIndex
   // }
 
   protected:
-  ArrayOf<SVGDocumentIndexEntry> entries;
+  ArrayOf<SVGDocumentIndexEntry>
+    entries;			/* Array of SVG Document Index Entries. */
   public:
   DEFINE_SIZE_ARRAY (2, entries);
 };
@@ -98,9 +104,11 @@ struct SVG
   }
 
   protected:
-  HBUINT16	version;
-  LOffsetTo<SVGDocumentIndex>	svgDocIndex;
-  HBUINT32	reserved;
+  HBUINT16	version;	/* Table version (starting at 0). */
+  LOffsetTo<SVGDocumentIndex>
+    svgDocIndex;		/* Offset (relative to the start of the SVG table) to the
+				 * SVG Documents Index. Must be non-zero. */
+  HBUINT32	reserved;	/* Set to 0. */
   public:
   DEFINE_SIZE_STATIC (10);
 };


More information about the HarfBuzz mailing list