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

Behdad Esfahbod behdad at kemper.freedesktop.org
Tue Jan 28 08:15:14 PST 2014


 configure.ac                   |    6 ++++++
 src/Makefile.am                |    5 ++++-
 src/hb-ot-layout-gpos-table.hh |   28 +++++++++++++++++-----------
 src/hb-shaper-list.hh          |    2 ++
 4 files changed, 29 insertions(+), 12 deletions(-)

New commits:
commit 083225916a19f6d67017523af87386933bd9ecdc
Author: Konstantin Ritt <ritt.ks at gmail.com>
Date:   Wed Jan 22 20:31:30 2014 +0200

    Micro optimizations

diff --git a/src/hb-ot-layout-gpos-table.hh b/src/hb-ot-layout-gpos-table.hh
index 5e4326e..7c0a4ea 100644
--- a/src/hb-ot-layout-gpos-table.hh
+++ b/src/hb-ot-layout-gpos-table.hh
@@ -109,11 +109,13 @@ struct ValueFormat : USHORT
     if (format & xPlacement) glyph_pos.x_offset  += font->em_scale_x (get_short (values++));
     if (format & yPlacement) glyph_pos.y_offset  += font->em_scale_y (get_short (values++));
     if (format & xAdvance) {
-      if (likely (horizontal)) glyph_pos.x_advance += font->em_scale_x (get_short (values++)); else values++;
+      if (likely (horizontal)) glyph_pos.x_advance += font->em_scale_x (get_short (values));
+      values++;
     }
     /* y_advance values grow downward but font-space grows upward, hence negation */
     if (format & yAdvance) {
-      if (unlikely (!horizontal)) glyph_pos.y_advance -= font->em_scale_y (get_short (values++)); else values++;
+      if (unlikely (!horizontal)) glyph_pos.y_advance -= font->em_scale_y (get_short (values));
+      values++;
     }
 
     if (!has_device ()) return;
@@ -125,17 +127,21 @@ struct ValueFormat : USHORT
 
     /* pixel -> fractional pixel */
     if (format & xPlaDevice) {
-      if (x_ppem) glyph_pos.x_offset  += (base + get_device (values++)).get_x_delta (font); else values++;
+      if (x_ppem) glyph_pos.x_offset  += (base + get_device (values)).get_x_delta (font);
+      values++;
     }
     if (format & yPlaDevice) {
-      if (y_ppem) glyph_pos.y_offset  += (base + get_device (values++)).get_y_delta (font); else values++;
+      if (y_ppem) glyph_pos.y_offset  += (base + get_device (values)).get_y_delta (font);
+      values++;
     }
     if (format & xAdvDevice) {
-      if (horizontal && x_ppem) glyph_pos.x_advance += (base + get_device (values++)).get_x_delta (font); else values++;
+      if (horizontal && x_ppem) glyph_pos.x_advance += (base + get_device (values)).get_x_delta (font);
+      values++;
     }
     if (format & yAdvDevice) {
       /* y_advance values grow downward but font-space grows upward, hence negation */
-      if (!horizontal && y_ppem) glyph_pos.y_advance -= (base + get_device (values++)).get_y_delta (font); else values++;
+      if (!horizontal && y_ppem) glyph_pos.y_advance -= (base + get_device (values)).get_y_delta (font);
+      values++;
     }
   }
 
@@ -240,12 +246,12 @@ struct AnchorFormat2
       unsigned int x_ppem = font->x_ppem;
       unsigned int y_ppem = font->y_ppem;
       hb_position_t cx, cy;
-      hb_bool_t ret = false;
+      hb_bool_t ret;
 
-      if (x_ppem || y_ppem)
-	ret = font->get_glyph_contour_point_for_origin (glyph_id, anchorPoint, HB_DIRECTION_LTR, &cx, &cy);
-      *x = x_ppem && ret ? cx : font->em_scale_x (xCoordinate);
-      *y = y_ppem && ret ? cy : font->em_scale_y (yCoordinate);
+      ret = (x_ppem || y_ppem) &&
+             font->get_glyph_contour_point_for_origin (glyph_id, anchorPoint, HB_DIRECTION_LTR, &cx, &cy);
+      *x = ret && x_ppem ? cx : font->em_scale_x (xCoordinate);
+      *y = ret && y_ppem ? cy : font->em_scale_y (yCoordinate);
   }
 
   inline bool sanitize (hb_sanitize_context_t *c) {
commit c9522de2335e4ef5fe65a72745c10943827a8da2
Author: Konstantin Ritt <ritt.ks at gmail.com>
Date:   Wed Jan 22 21:07:13 2014 +0200

    Make it possible to disable the fallback shaper at configure time
    
    The OT shaper supersedes the fallback shaper in every case
    and the latter become an extra weight for 99.9% of users.

diff --git a/configure.ac b/configure.ac
index 5c52c89..517b8df 100644
--- a/configure.ac
+++ b/configure.ac
@@ -127,6 +127,12 @@ if $have_ot; then
 fi
 AM_CONDITIONAL(HAVE_OT, $have_ot)
 
+have_fallback=true
+if $have_fallback; then
+	AC_DEFINE(HAVE_FALLBACK, 1, [Have simple TrueType Layout backend])
+fi
+AM_CONDITIONAL(HAVE_FALLBACK, $have_fallback)
+
 dnl ===========================================================================
 
 AC_ARG_WITH(glib,
diff --git a/src/Makefile.am b/src/Makefile.am
index c650b11..e2790a0 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -27,7 +27,6 @@ HBSOURCES =  \
 	hb-buffer.cc \
 	hb-cache-private.hh \
 	hb-common.cc \
-	hb-fallback-shape.cc \
 	hb-face-private.hh \
 	hb-face.cc \
 	hb-font-private.hh \
@@ -119,6 +118,10 @@ HBHEADERS += \
 	$(NULL)
 endif
 
+if HAVE_FALLBACK
+HBSOURCES += hb-fallback-shape.cc
+endif
+
 if HAVE_PTHREAD
 HBCFLAGS += $(PTHREAD_CFLAGS)
 HBLIBS   += $(PTHREAD_LIBS)
diff --git a/src/hb-shaper-list.hh b/src/hb-shaper-list.hh
index b9c029e..da6d8e0 100644
--- a/src/hb-shaper-list.hh
+++ b/src/hb-shaper-list.hh
@@ -52,4 +52,6 @@ HB_SHAPER_IMPLEMENT (uniscribe)
 HB_SHAPER_IMPLEMENT (coretext)
 #endif
 
+#ifdef HAVE_FALLBACK
 HB_SHAPER_IMPLEMENT (fallback) /* <--- This should be last. */
+#endif


More information about the HarfBuzz mailing list