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

Behdad Esfahbod behdad at kemper.freedesktop.org
Thu Feb 22 23:41:35 UTC 2018


 src/dev-run.sh   |   40 +++++++++++++++++++++++++++++++---------
 src/hb-subset.cc |    2 +-
 util/options.cc  |   33 ++++++++++++++++++++++++++++-----
 util/options.hh  |    6 ++++++
 4 files changed, 66 insertions(+), 15 deletions(-)

New commits:
commit 4f6f7c3b22ec788f609bdffc7e0893816657b3a0
Author: Ebrahim Byagowi <ebrahim at gnu.org>
Date:   Fri Feb 23 02:54:12 2018 +0330

    [util] Implement ppem/ptem on hb-{shape,view} (#811)

diff --git a/util/options.cc b/util/options.cc
index 6d8064b9..d2444a49 100644
--- a/util/options.cc
+++ b/util/options.cc
@@ -481,6 +481,25 @@ parse_font_size (const char *name G_GNUC_UNUSED,
       return false;
   }
 }
+
+static gboolean
+parse_font_ppem (const char *name G_GNUC_UNUSED,
+		 const char *arg,
+		 gpointer    data,
+		 GError    **error G_GNUC_UNUSED)
+{
+  font_options_t *font_opts = (font_options_t *) data;
+  switch (sscanf (arg, "%d%*[ ,]%d", &font_opts->x_ppem, &font_opts->y_ppem)) {
+    case 1: font_opts->y_ppem = font_opts->x_ppem;
+    case 2: return true;
+    default:
+      g_set_error (error, G_OPTION_ERROR, G_OPTION_ERROR_BAD_VALUE,
+		   "%s argument should be one or two space-separated numbers",
+		   name);
+      return false;
+  }
+}
+
 void
 font_options_t::add_options (option_parser_t *parser)
 {
@@ -513,12 +532,13 @@ font_options_t::add_options (option_parser_t *parser)
 
   GOptionEntry entries[] =
   {
-    {"font-file",	0, 0, G_OPTION_ARG_STRING,	&this->font_file,		"Set font file-name",			"filename"},
-    {"face-index",	0, 0, G_OPTION_ARG_INT,		&this->face_index,		"Set face index (default: 0)",		"index"},
+    {"font-file",	0, 0, G_OPTION_ARG_STRING,	&this->font_file,		"Set font file-name",				"filename"},
+    {"face-index",	0, 0, G_OPTION_ARG_INT,		&this->face_index,		"Set face index (default: 0)",			"index"},
     {"font-size",	0, default_font_size ? 0 : G_OPTION_FLAG_HIDDEN,
-			      G_OPTION_ARG_CALLBACK,	(gpointer) &parse_font_size,	font_size_text,				"1/2 numbers or 'upem'"},
-    /* TODO Add font-ppem / font-ptem. */
-    {"font-funcs",	0, 0, G_OPTION_ARG_STRING,	&this->font_funcs,		text,					"impl"},
+			      G_OPTION_ARG_CALLBACK,	(gpointer) &parse_font_size,	font_size_text,					"1/2 integers or 'upem'"},
+    {"font-ppem",	0, 0, G_OPTION_ARG_CALLBACK,	(gpointer) &parse_font_ppem,	"Set x,y pixels per EM (default: 0; disabled)",	"1/2 integers"},
+    {"font-ptem",	0, 0, G_OPTION_ARG_DOUBLE,	&this->ptem,			"Set font point-size (default: 0; disabled)",	"point-size"},
+    {"font-funcs",	0, 0, G_OPTION_ARG_STRING,	&this->font_funcs,		text,						"impl"},
     {nullptr}
   };
   parser->add_group (entries,
@@ -691,6 +711,9 @@ font_options_t::get_font (void) const
   if (font_size_y == FONT_SIZE_UPEM)
     font_size_y = hb_face_get_upem (face);
 
+  hb_font_set_ppem (font, x_ppem, y_ppem);
+  hb_font_set_ptem (font, ptem);
+
   int scale_x = (int) scalbnf (font_size_x, subpixel_bits);
   int scale_y = (int) scalbnf (font_size_y, subpixel_bits);
   hb_font_set_scale (font, scale_x, scale_y);
diff --git a/util/options.hh b/util/options.hh
index 411165bf..cfbbade2 100644
--- a/util/options.hh
+++ b/util/options.hh
@@ -452,6 +452,9 @@ struct font_options_t : option_group_t
     variations = nullptr;
     num_variations = 0;
     default_font_size = default_font_size_;
+    x_ppem = 0;
+    y_ppem = 0;
+    ptem = .0;
     subpixel_bits = subpixel_bits_;
     font_file = nullptr;
     face_index = 0;
@@ -478,6 +481,9 @@ struct font_options_t : option_group_t
   hb_variation_t *variations;
   unsigned int num_variations;
   int default_font_size;
+  int x_ppem;
+  int y_ppem;
+  double ptem;
   unsigned int subpixel_bits;
   mutable double font_size_x;
   mutable double font_size_y;
commit a6bd6bcee08c9522f9269b5c63f784688abddcff
Author: Ebrahim Byagowi <ebrahim at gnu.org>
Date:   Thu Feb 22 16:52:56 2018 +0330

    [dev-run] minor

diff --git a/src/dev-run.sh b/src/dev-run.sh
index 40f6463c..3b2257b1 100755
--- a/src/dev-run.sh
+++ b/src/dev-run.sh
@@ -48,7 +48,7 @@ d|D )
 	if [[ $CMAKENINJA ]]; then
 		echo "Not supported on cmake builds yet"
 	else
-		build/libtool --mode=execute $GDB hb-shape $@
+		build/libtool --mode=execute $GDB build/util/hb-shape $@
 	fi
 ;;
 r|R )
commit fa13a04cf3345311a2434f0d7f6346f967491c45
Author: Ebrahim Byagowi <ebrahim at gnu.org>
Date:   Thu Feb 22 16:48:03 2018 +0330

    [dev-run] Add gdb/lldb shortcuts

diff --git a/src/dev-run.sh b/src/dev-run.sh
index 5a7ae102..40f6463c 100755
--- a/src/dev-run.sh
+++ b/src/dev-run.sh
@@ -13,26 +13,48 @@
 [ $# = 0 ] && echo Usage: "src/dev-run.sh [FONT-FILE] [TEXT]" && exit
 command -v entr >/dev/null 2>&1 || { echo >&2 "This script needs `entr` be installed"; exit 1; }
 
+GDB=gdb
+# if gdb doesn't exist, hopefully lldb exist
+command -v $GDB >/dev/null 2>&1 || export GDB="lldb"
+
 [ -f 'build/build.ninja' ] && CMAKENINJA=TRUE
 # or "fswatch -0 . -e build/ -e .git"
 find src/ | entr printf '\0' | while read -d ""; do
 	clear
+	echo '===================================================='
 	if [[ $CMAKENINJA ]]; then
-		ninja -Cbuild hb-shape hb-view
-		build/hb-shape $@
-		build/hb-view $@
+		ninja -Cbuild hb-shape hb-view && {
+			build/hb-shape $@
+			build/hb-view $@
+		}
 	else
-		make -Cbuild/src -j5 -s lib
-		build/util/hb-shape $@
-		build/util/hb-view $@
+		make -Cbuild/src -j5 -s lib && {
+			build/util/hb-shape $@
+			build/util/hb-view $@
+		}
 	fi
 done
 
-read -n 1 -p "Run the tests (y/n)? " answer
-if [[ "$answer" = "y" ]]; then
+read -n 1 -p "[T]est, [D]ebug, [R]estart, [Q]uit?" answer
+case "$answer" in
+t|T )
 	if [[ $CMAKENINJA ]]; then
 		CTEST_OUTPUT_ON_FAILURE=1 CTEST_PARALLEL_LEVEL=5 ninja -Cbuild test
 	else
 		make -Cbuild -j5 check && .ci/fail.sh
 	fi
-fi
+;;
+d|D )
+	if [[ $CMAKENINJA ]]; then
+		echo "Not supported on cmake builds yet"
+	else
+		build/libtool --mode=execute $GDB hb-shape $@
+	fi
+;;
+r|R )
+	src/dev-run.sh $@
+;;
+* )
+	exit
+;;
+esac
commit 2d0265242bb9a080886d6e0aa653c62e5770a15a
Author: Rod Sheeter <rsheeter at google.com>
Date:   Wed Feb 21 09:42:46 2018 -0800

    [subset] keep the result of _subset

diff --git a/src/hb-subset.cc b/src/hb-subset.cc
index 418e481f..a4794f18 100644
--- a/src/hb-subset.cc
+++ b/src/hb-subset.cc
@@ -264,7 +264,7 @@ _subset_table (hb_subset_plan_t *plan,
       break;
   }
   DEBUG_MSG(SUBSET, nullptr, "subset %c%c%c%c %s", HB_UNTAG(tag), result ? "ok" : "FAILED");
-  return true;
+  return result;
 }
 
 static bool


More information about the HarfBuzz mailing list