[HarfBuzz] harfbuzz: Branch 'master'

Behdad Esfahbod behdad at kemper.freedesktop.org
Wed Oct 24 00:01:50 UTC 2018


 src/hb-ot-hmtx-table.hh |    8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

New commits:
commit 401cdf07922f66c762dabfd8e3d45c35e33de7c0
Author: Behdad Esfahbod <behdad at behdad.org>
Date:   Tue Oct 23 17:00:49 2018 -0700

    [ot-font] Fix sign of ascent/descent
    
    Some fonts, like msmincho, have positive number as descent
    in vhea table.  That's wrong.  Just enforce sign on ascent/descent
    when reading both horizontal and vertical metrics.
    
    Fixes https://github.com/harfbuzz/harfbuzz/issues/1248

diff --git a/src/hb-ot-hmtx-table.hh b/src/hb-ot-hmtx-table.hh
index 5293fdad..935ddd72 100644
--- a/src/hb-ot-hmtx-table.hh
+++ b/src/hb-ot-hmtx-table.hh
@@ -199,8 +199,8 @@ struct hmtxvmtx
 #define USE_TYPO_METRICS (1u<<7)
 	if (0 != (os2_table->fsSelection & USE_TYPO_METRICS))
 	{
-	  ascender = os2_table->sTypoAscender;
-	  descender = os2_table->sTypoDescender;
+	  ascender = abs (os2_table->sTypoAscender);
+	  descender = -abs (os2_table->sTypoDescender);
 	  line_gap = os2_table->sTypoLineGap;
 	  got_font_extents = (ascender | descender) != 0;
 	}
@@ -212,8 +212,8 @@ struct hmtxvmtx
       num_advances = _hea_table->numberOfLongMetrics;
       if (!got_font_extents)
       {
-	ascender = _hea_table->ascender;
-	descender = _hea_table->descender;
+	ascender = abs (_hea_table->ascender);
+	descender = -abs (_hea_table->descender);
 	line_gap = _hea_table->lineGap;
 	got_font_extents = (ascender | descender) != 0;
       }


More information about the HarfBuzz mailing list