shithub: freetype+ttf2subf

Download patch

ref: 14032290bf9f22afe4cb1cbbc8cfa2ee85a44aee
parent: 8f09eb5ce0260aa17f93b2ccefb4bae347ca79fc
author: Werner Lemberg <[email protected]>
date: Fri Jul 20 02:44:13 EDT 2018

[cff] Avoid left-shift of negative numbers (#54322).

* src/cff/cffgload.c (cff_slot_load): Use multiplication.

git/fs: mount .git/fs: mount/attach disallowed
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2018-07-20  Werner Lemberg  <[email protected]>
+
+	[cff] Avoid left-shift of negative numbers (#54322).
+
+	* src/cff/cffgload.c (cff_slot_load): Use multiplication.
+
 2018-07-17  Werner Lemberg  <[email protected]>
 
 	Allow FT_ENCODING_NONE for `FT_Select_Charmap'.
--- a/src/cff/cffgload.c
+++ b/src/cff/cffgload.c
@@ -280,16 +280,16 @@
           glyph->root.outline.n_points   = 0;
           glyph->root.outline.n_contours = 0;
 
-          glyph->root.metrics.width  = (FT_Pos)metrics.width  << 6;
-          glyph->root.metrics.height = (FT_Pos)metrics.height << 6;
+          glyph->root.metrics.width  = (FT_Pos)metrics.width  * 64;
+          glyph->root.metrics.height = (FT_Pos)metrics.height * 64;
 
-          glyph->root.metrics.horiBearingX = (FT_Pos)metrics.horiBearingX << 6;
-          glyph->root.metrics.horiBearingY = (FT_Pos)metrics.horiBearingY << 6;
-          glyph->root.metrics.horiAdvance  = (FT_Pos)metrics.horiAdvance  << 6;
+          glyph->root.metrics.horiBearingX = (FT_Pos)metrics.horiBearingX * 64;
+          glyph->root.metrics.horiBearingY = (FT_Pos)metrics.horiBearingY * 64;
+          glyph->root.metrics.horiAdvance  = (FT_Pos)metrics.horiAdvance  * 64;
 
-          glyph->root.metrics.vertBearingX = (FT_Pos)metrics.vertBearingX << 6;
-          glyph->root.metrics.vertBearingY = (FT_Pos)metrics.vertBearingY << 6;
-          glyph->root.metrics.vertAdvance  = (FT_Pos)metrics.vertAdvance  << 6;
+          glyph->root.metrics.vertBearingX = (FT_Pos)metrics.vertBearingX * 64;
+          glyph->root.metrics.vertBearingY = (FT_Pos)metrics.vertBearingY * 64;
+          glyph->root.metrics.vertAdvance  = (FT_Pos)metrics.vertAdvance  * 64;
 
           glyph->root.format = FT_GLYPH_FORMAT_BITMAP;