shithub: freetype+ttf2subf

Download patch

ref: 4f13a43ab32ba77793d8528d4b4c057c6f76b835
parent: bed960d9484df1a0c9547ba6855f457d6629ffb5
author: Werner Lemberg <wl@gnu.org>
date: Thu Sep 24 05:35:24 EDT 2020

* src/cff/cffgload.c (cff_slot_load): Scale `vertBearingY`.

Towards the end of the the function there is a call to
`FT_Outline_Get_CBox` that retrieves the glyph bbox in scaled units.
That sets `horiBearing{X,Y}` and `vertBearingX` but `vertBearingY`
is left alone, and is not scaled.

Patch from Eric Muller <emuller@amazon.com>.

git/fs: mount .git/fs: mount/attach disallowed
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,16 @@
 2020-09-24  Werner Lemberg  <wl@gnu.org>
 
+	* src/cff/cffgload.c (cff_slot_load): Scale `vertBearingY`.
+
+	Towards the end of the the function there is a call to
+	`FT_Outline_Get_CBox` that retrieves the glyph bbox in scaled units.
+	That sets `horiBearing{X,Y}` and `vertBearingX` but `vertBearingY`
+	is left alone, and is not scaled.
+
+	Patch from Eric Muller <emuller@amazon.com>.
+
+2020-09-24  Werner Lemberg  <wl@gnu.org>
+
 	* src/base/ftobjs.c (FT_Load_Glyph): Trace glyph metrics.
 
 2020-09-22  Werner Lemberg  <wl@gnu.org>
--- a/src/cff/cffgload.c
+++ b/src/cff/cffgload.c
@@ -206,8 +206,8 @@
     PSAux_Service            psaux         = (PSAux_Service)face->psaux;
     const CFF_Decoder_Funcs  decoder_funcs = psaux->cff_decoder_funcs;
 
-    FT_Matrix    font_matrix;
-    FT_Vector    font_offset;
+    FT_Matrix  font_matrix;
+    FT_Vector  font_offset;
 
 
     force_scaling = FALSE;
@@ -363,7 +363,6 @@
       top_upm = (FT_Long)cff->top_font.font_dict.units_per_em;
       sub_upm = (FT_Long)cff->subfonts[fd_index]->font_dict.units_per_em;
 
-
       font_matrix = cff->subfonts[fd_index]->font_dict.font_matrix;
       font_offset = cff->subfonts[fd_index]->font_dict.font_offset;
 
@@ -398,7 +397,6 @@
       PS_Driver  driver = (PS_Driver)FT_FACE_DRIVER( face );
 #endif
 
-
       FT_Byte*  charstring;
       FT_ULong  charstring_len;
 
@@ -664,8 +662,12 @@
         metrics->horiBearingY = cbox.yMax;
 
         if ( has_vertical_info )
+        {
           metrics->vertBearingX = metrics->horiBearingX -
                                     metrics->horiAdvance / 2;
+          metrics->vertBearingY = FT_MulFix( metrics->vertBearingY,
+                                             glyph->y_scale );
+        }
         else
         {
           if ( load_flags & FT_LOAD_VERTICAL_LAYOUT )