< prev index next >

src/java.desktop/share/native/libfontmanager/harfbuzz/hb-ot-var-avar-table.hh

Print this page

        

*** 25,35 **** */ #ifndef HB_OT_VAR_AVAR_TABLE_HH #define HB_OT_VAR_AVAR_TABLE_HH ! #include "hb-open-type-private.hh" /* * avar -- Axis Variations * https://docs.microsoft.com/en-us/typography/opentype/spec/avar */ --- 25,35 ---- */ #ifndef HB_OT_VAR_AVAR_TABLE_HH #define HB_OT_VAR_AVAR_TABLE_HH ! #include "hb-open-type.hh" /* * avar -- Axis Variations * https://docs.microsoft.com/en-us/typography/opentype/spec/avar */
*** 40,50 **** namespace OT { struct AxisValueMap { ! inline bool sanitize (hb_sanitize_context_t *c) const { TRACE_SANITIZE (this); return_trace (c->check_struct (this)); } --- 40,50 ---- namespace OT { struct AxisValueMap { ! bool sanitize (hb_sanitize_context_t *c) const { TRACE_SANITIZE (this); return_trace (c->check_struct (this)); }
*** 57,67 **** DEFINE_SIZE_STATIC (4); }; struct SegmentMaps : ArrayOf<AxisValueMap> { ! inline int map (int value) const { /* The following special-cases are not part of OpenType, which requires * that at least -1, 0, and +1 must be mapped. But we include these as * part of a better error recovery scheme. */ --- 57,67 ---- DEFINE_SIZE_STATIC (4); }; struct SegmentMaps : ArrayOf<AxisValueMap> { ! int map (int value) const { /* The following special-cases are not part of OpenType, which requires * that at least -1, 0, and +1 must be mapped. But we include these as * part of a better error recovery scheme. */
*** 91,116 **** return arrayZ[i-1].toCoord + ((arrayZ[i].toCoord - arrayZ[i-1].toCoord) * (value - arrayZ[i-1].fromCoord) + denom/2) / denom; } ! DEFINE_SIZE_ARRAY (2, arrayZ); }; struct avar { ! static const hb_tag_t tableTag = HB_OT_TAG_avar; ! inline bool sanitize (hb_sanitize_context_t *c) const { TRACE_SANITIZE (this); if (unlikely (!(version.sanitize (c) && version.major == 1 && c->check_struct (this)))) return_trace (false); ! const SegmentMaps *map = axisSegmentMapsZ; unsigned int count = axisCount; for (unsigned int i = 0; i < count; i++) { if (unlikely (!map->sanitize (c))) return_trace (false); --- 91,117 ---- return arrayZ[i-1].toCoord + ((arrayZ[i].toCoord - arrayZ[i-1].toCoord) * (value - arrayZ[i-1].fromCoord) + denom/2) / denom; } ! public: ! DEFINE_SIZE_ARRAY (2, *this); }; struct avar { ! static constexpr hb_tag_t tableTag = HB_OT_TAG_avar; ! bool sanitize (hb_sanitize_context_t *c) const { TRACE_SANITIZE (this); if (unlikely (!(version.sanitize (c) && version.major == 1 && c->check_struct (this)))) return_trace (false); ! const SegmentMaps *map = &firstAxisSegmentMaps; unsigned int count = axisCount; for (unsigned int i = 0; i < count; i++) { if (unlikely (!map->sanitize (c))) return_trace (false);
*** 118,132 **** } return_trace (true); } ! inline void map_coords (int *coords, unsigned int coords_length) const { unsigned int count = MIN<unsigned int> (coords_length, axisCount); ! const SegmentMaps *map = axisSegmentMapsZ; for (unsigned int i = 0; i < count; i++) { coords[i] = map->map (coords[i]); map = &StructAfter<SegmentMaps> (*map); } --- 119,133 ---- } return_trace (true); } ! void map_coords (int *coords, unsigned int coords_length) const { unsigned int count = MIN<unsigned int> (coords_length, axisCount); ! const SegmentMaps *map = &firstAxisSegmentMaps; for (unsigned int i = 0; i < count; i++) { coords[i] = map->map (coords[i]); map = &StructAfter<SegmentMaps> (*map); }
*** 137,147 **** * initially set to 0x00010000u */ HBUINT16 reserved; /* This field is permanently reserved. Set to 0. */ HBUINT16 axisCount; /* The number of variation axes in the font. This * must be the same number as axisCount in the * 'fvar' table. */ ! SegmentMaps axisSegmentMapsZ[VAR]; public: DEFINE_SIZE_MIN (8); }; --- 138,148 ---- * initially set to 0x00010000u */ HBUINT16 reserved; /* This field is permanently reserved. Set to 0. */ HBUINT16 axisCount; /* The number of variation axes in the font. This * must be the same number as axisCount in the * 'fvar' table. */ ! SegmentMaps firstAxisSegmentMaps; public: DEFINE_SIZE_MIN (8); };
< prev index next >