[VarC] Change rotation/skew representation

Fixes https://github.com/harfbuzz/boring-expansion-spec/issues/77
This commit is contained in:
Behdad Esfahbod 2022-12-19 19:15:44 -07:00
parent 1840b02e6a
commit 80e68f09c5
2 changed files with 7 additions and 8 deletions

View File

@ -197,11 +197,11 @@ struct VarCompositeGlyphRecord
if (flags & HAVE_TRANSLATE_X) translateX = * (const FWORD *) p++; if (flags & HAVE_TRANSLATE_X) translateX = * (const FWORD *) p++;
if (flags & HAVE_TRANSLATE_Y) translateY = * (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_X) scaleX = * (const F6DOT10 *) p++;
if (flags & HAVE_SCALE_Y) scaleY = * (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_X) skewX = * (const F4DOT12 *) p++;
if (flags & HAVE_SKEW_Y) skewY = * (const F2DOT14 *) p++; if (flags & HAVE_SKEW_Y) skewY = * (const F4DOT12 *) p++;
if (flags & HAVE_TCENTER_X) tCenterX = * (const FWORD *) p++; if (flags & HAVE_TCENTER_X) tCenterX = * (const FWORD *) p++;
if (flags & HAVE_TCENTER_Y) tCenterY = * (const FWORD *) p++; if (flags & HAVE_TCENTER_Y) tCenterY = * (const FWORD *) p++;
@ -270,7 +270,7 @@ struct VarCompositeGlyphRecord
} }
if (flags & HAVE_ROTATION) if (flags & HAVE_ROTATION)
{ {
rotation = rec_points[0].x / (1 << 14); rotation = rec_points[0].x / (1 << 12);
rec_points++; rec_points++;
} }
if (flags & (HAVE_SCALE_X | HAVE_SCALE_Y)) if (flags & (HAVE_SCALE_X | HAVE_SCALE_Y))
@ -281,8 +281,8 @@ struct VarCompositeGlyphRecord
} }
if (flags & (HAVE_SKEW_X | HAVE_SKEW_Y)) if (flags & (HAVE_SKEW_X | HAVE_SKEW_Y))
{ {
skewX = rec_points[0].x / (1 << 14); skewX = rec_points[0].x / (1 << 12);
skewY = rec_points[0].y / (1 << 14); skewY = rec_points[0].y / (1 << 12);
rec_points++; rec_points++;
} }
if (flags & (HAVE_TCENTER_X | HAVE_TCENTER_Y)) if (flags & (HAVE_TCENTER_X | HAVE_TCENTER_Y))

View File

@ -156,8 +156,7 @@ struct HBFixed : Type
/* 16-bit signed fixed number with the low 14 bits of fraction (2.14). */ /* 16-bit signed fixed number with the low 14 bits of fraction (2.14). */
using F2DOT14 = HBFixed<HBINT16, 14>; using F2DOT14 = HBFixed<HBINT16, 14>;
using F4DOT12 = HBFixed<HBINT16, 12>;
/* 16-bit signed fixed number with the low 10 bits of fraction (6.10). */
using F6DOT10 = HBFixed<HBINT16, 10>; using F6DOT10 = HBFixed<HBINT16, 10>;
/* 32-bit signed fixed-point number (16.16). */ /* 32-bit signed fixed-point number (16.16). */