[VarC] Change representation of scale from 4.12 to 6.10

Fixes https://github.com/harfbuzz/boring-expansion-spec/issues/76
pull/3967/head
Behdad Esfahbod 2 years ago
parent 1a51f71afd
commit 03a1685693
  1. 12
      src/OT/glyf/VarCompositeGlyph.hh
  2. 4
      src/hb-open-type.hh

@ -165,8 +165,8 @@ struct VarCompositeGlyphRecord
float translateX = 0.f; float translateX = 0.f;
float translateY = 0.f; float translateY = 0.f;
float rotation = 0.f; float rotation = 0.f;
float scaleX = 1.f * (1 << 12); float scaleX = 1.f * (1 << 10);
float scaleY = 1.f * (1 << 12); float scaleY = 1.f * (1 << 10);
float skewX = 0.f; float skewX = 0.f;
float skewY = 0.f; float skewY = 0.f;
float tCenterX = 0.f; float tCenterX = 0.f;
@ -198,8 +198,8 @@ 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 F2DOT14 *) p++;
if (flags & HAVE_SCALE_X) scaleX = * (const F4DOT12 *) p++; if (flags & HAVE_SCALE_X) scaleX = * (const F6DOT10 *) p++;
if (flags & HAVE_SCALE_Y) scaleY = * (const F4DOT12 *) 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 F2DOT14 *) p++;
if (flags & HAVE_SKEW_Y) skewY = * (const F2DOT14 *) p++; if (flags & HAVE_SKEW_Y) skewY = * (const F2DOT14 *) p++;
if (flags & HAVE_TCENTER_X) tCenterX = * (const FWORD *) p++; if (flags & HAVE_TCENTER_X) tCenterX = * (const FWORD *) p++;
@ -275,8 +275,8 @@ struct VarCompositeGlyphRecord
} }
if (flags & (HAVE_SCALE_X | HAVE_SCALE_Y)) if (flags & (HAVE_SCALE_X | HAVE_SCALE_Y))
{ {
scaleX = rec_points[0].x / (1 << 12); scaleX = rec_points[0].x / (1 << 10);
scaleY = rec_points[0].y / (1 << 12); scaleY = rec_points[0].y / (1 << 10);
rec_points++; rec_points++;
} }
if (flags & (HAVE_SKEW_X | HAVE_SKEW_Y)) if (flags & (HAVE_SKEW_X | HAVE_SKEW_Y))

@ -157,8 +157,8 @@ 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>;
/* 16-bit signed fixed number with the low 12 bits of fraction (4.12). */ /* 16-bit signed fixed number with the low 10 bits of fraction (6.10). */
using F4DOT12 = HBFixed<HBINT16, 12>; using F6DOT10 = HBFixed<HBINT16, 10>;
/* 32-bit signed fixed-point number (16.16). */ /* 32-bit signed fixed-point number (16.16). */
using F16DOT16 = HBFixed<HBINT32, 16>; using F16DOT16 = HBFixed<HBINT32, 16>;

Loading…
Cancel
Save