From 80e68f09c5daef0c3dfef4fb44ebfbd22899bf8a Mon Sep 17 00:00:00 2001 From: Behdad Esfahbod Date: Mon, 19 Dec 2022 19:15:44 -0700 Subject: [PATCH] [VarC] Change rotation/skew representation Fixes https://github.com/harfbuzz/boring-expansion-spec/issues/77 --- src/OT/glyf/VarCompositeGlyph.hh | 12 ++++++------ src/hb-open-type.hh | 3 +-- 2 files changed, 7 insertions(+), 8 deletions(-) diff --git a/src/OT/glyf/VarCompositeGlyph.hh b/src/OT/glyf/VarCompositeGlyph.hh index 5f2304e7c..a2c7e5bb0 100644 --- a/src/OT/glyf/VarCompositeGlyph.hh +++ b/src/OT/glyf/VarCompositeGlyph.hh @@ -197,11 +197,11 @@ struct VarCompositeGlyphRecord if (flags & HAVE_TRANSLATE_X) translateX = * (const FWORD *) p++; if (flags & HAVE_TRANSLATE_Y) translateY = * (const FWORD *) p++; - if (flags & HAVE_ROTATION) rotation = * (const F2DOT14 *) p++; + if (flags & HAVE_ROTATION) rotation = * (const F4DOT12 *) p++; if (flags & HAVE_SCALE_X) scaleX = * (const F6DOT10 *) p++; if (flags & HAVE_SCALE_Y) scaleY = * (const F6DOT10 *) p++; - if (flags & HAVE_SKEW_X) skewX = * (const F2DOT14 *) p++; - if (flags & HAVE_SKEW_Y) skewY = * (const F2DOT14 *) p++; + if (flags & HAVE_SKEW_X) skewX = * (const F4DOT12 *) p++; + if (flags & HAVE_SKEW_Y) skewY = * (const F4DOT12 *) p++; if (flags & HAVE_TCENTER_X) tCenterX = * (const FWORD *) p++; if (flags & HAVE_TCENTER_Y) tCenterY = * (const FWORD *) p++; @@ -270,7 +270,7 @@ struct VarCompositeGlyphRecord } if (flags & HAVE_ROTATION) { - rotation = rec_points[0].x / (1 << 14); + rotation = rec_points[0].x / (1 << 12); rec_points++; } if (flags & (HAVE_SCALE_X | HAVE_SCALE_Y)) @@ -281,8 +281,8 @@ struct VarCompositeGlyphRecord } if (flags & (HAVE_SKEW_X | HAVE_SKEW_Y)) { - skewX = rec_points[0].x / (1 << 14); - skewY = rec_points[0].y / (1 << 14); + skewX = rec_points[0].x / (1 << 12); + skewY = rec_points[0].y / (1 << 12); rec_points++; } if (flags & (HAVE_TCENTER_X | HAVE_TCENTER_Y)) diff --git a/src/hb-open-type.hh b/src/hb-open-type.hh index cf538fb30..a4eaa1fe2 100644 --- a/src/hb-open-type.hh +++ b/src/hb-open-type.hh @@ -156,8 +156,7 @@ struct HBFixed : Type /* 16-bit signed fixed number with the low 14 bits of fraction (2.14). */ using F2DOT14 = HBFixed; - -/* 16-bit signed fixed number with the low 10 bits of fraction (6.10). */ +using F4DOT12 = HBFixed; using F6DOT10 = HBFixed; /* 32-bit signed fixed-point number (16.16). */