[ot-face] Simplify table access
Yoohoo!
This commit is contained in:
parent
914b595f25
commit
a35c92cbe7
@ -172,88 +172,19 @@ AAT::hb_aat_apply_context_t::set_ankr_table (const AAT::ankr *ankr_table_,
|
||||
* mort/morx/kerx/trak
|
||||
*/
|
||||
|
||||
static inline const AAT::mort&
|
||||
_get_mort (hb_face_t *face, hb_blob_t **blob = nullptr)
|
||||
{
|
||||
if (unlikely (!hb_ot_shaper_face_data_ensure (face)))
|
||||
{
|
||||
if (blob)
|
||||
*blob = hb_blob_get_empty ();
|
||||
return Null(AAT::mort);
|
||||
}
|
||||
const AAT::mort& mort = *(hb_ot_face_data (face)->mort);
|
||||
if (blob)
|
||||
*blob = hb_ot_face_data (face)->mort.get_blob ();
|
||||
return mort;
|
||||
}
|
||||
static inline const AAT::morx&
|
||||
_get_morx (hb_face_t *face, hb_blob_t **blob = nullptr)
|
||||
{
|
||||
if (unlikely (!hb_ot_shaper_face_data_ensure (face)))
|
||||
{
|
||||
if (blob)
|
||||
*blob = hb_blob_get_empty ();
|
||||
return Null(AAT::morx);
|
||||
}
|
||||
const AAT::morx& morx = *(hb_ot_face_data (face)->morx);
|
||||
if (blob)
|
||||
*blob = hb_ot_face_data (face)->morx.get_blob ();
|
||||
return morx;
|
||||
}
|
||||
static inline const AAT::kerx&
|
||||
_get_kerx (hb_face_t *face, hb_blob_t **blob = nullptr)
|
||||
{
|
||||
if (unlikely (!hb_ot_shaper_face_data_ensure (face)))
|
||||
{
|
||||
if (blob)
|
||||
*blob = hb_blob_get_empty ();
|
||||
return Null(AAT::kerx);
|
||||
}
|
||||
const AAT::kerx& kerx = *(hb_ot_face_data (face)->kerx);
|
||||
if (blob)
|
||||
*blob = hb_ot_face_data (face)->kerx.get_blob ();
|
||||
return kerx;
|
||||
}
|
||||
static inline const AAT::ankr&
|
||||
_get_ankr (hb_face_t *face, hb_blob_t **blob = nullptr)
|
||||
{
|
||||
if (unlikely (!hb_ot_shaper_face_data_ensure (face)))
|
||||
{
|
||||
if (blob)
|
||||
*blob = hb_blob_get_empty ();
|
||||
return Null(AAT::ankr);
|
||||
}
|
||||
const AAT::ankr& ankr = *(hb_ot_face_data (face)->ankr);
|
||||
if (blob)
|
||||
*blob = hb_ot_face_data (face)->ankr.get_blob ();
|
||||
return ankr;
|
||||
}
|
||||
static inline const AAT::trak&
|
||||
_get_trak (hb_face_t *face)
|
||||
{
|
||||
if (unlikely (!hb_ot_shaper_face_data_ensure (face))) return Null(AAT::trak);
|
||||
return *(hb_ot_face_data (face)->trak);
|
||||
}
|
||||
static inline const AAT::ltag&
|
||||
_get_ltag (hb_face_t *face)
|
||||
{
|
||||
if (unlikely (!hb_ot_shaper_face_data_ensure (face))) return Null(AAT::ltag);
|
||||
return *(hb_ot_face_data (face)->ltag);
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
hb_aat_layout_compile_map (const hb_aat_map_builder_t *mapper,
|
||||
hb_aat_map_t *map)
|
||||
{
|
||||
const AAT::morx& morx = _get_morx (mapper->face, nullptr);
|
||||
const AAT::morx& morx = *mapper->face->table.morx;
|
||||
if (morx.has_data ())
|
||||
{
|
||||
morx.compile_flags (mapper, map);
|
||||
return;
|
||||
}
|
||||
|
||||
const AAT::mort& mort = _get_mort (mapper->face, nullptr);
|
||||
const AAT::mort& mort = *mapper->face->table.mort;
|
||||
if (mort.has_data ())
|
||||
{
|
||||
mort.compile_flags (mapper, map);
|
||||
@ -265,8 +196,8 @@ hb_aat_layout_compile_map (const hb_aat_map_builder_t *mapper,
|
||||
hb_bool_t
|
||||
hb_aat_layout_has_substitution (hb_face_t *face)
|
||||
{
|
||||
return _get_morx (face).has_data () ||
|
||||
_get_mort (face).has_data ();
|
||||
return face->table.morx->has_data ();
|
||||
face->table.mort->has_data ();
|
||||
}
|
||||
|
||||
void
|
||||
@ -274,20 +205,20 @@ hb_aat_layout_substitute (hb_ot_shape_plan_t *plan,
|
||||
hb_font_t *font,
|
||||
hb_buffer_t *buffer)
|
||||
{
|
||||
hb_blob_t *blob;
|
||||
|
||||
const AAT::morx& morx = _get_morx (font->face, &blob);
|
||||
hb_blob_t *morx_blob = font->face->table.morx.get_blob ();
|
||||
const AAT::morx& morx = *font->face->table.morx;
|
||||
if (morx.has_data ())
|
||||
{
|
||||
AAT::hb_aat_apply_context_t c (plan, font, buffer, blob);
|
||||
AAT::hb_aat_apply_context_t c (plan, font, buffer, morx_blob);
|
||||
morx.apply (&c);
|
||||
return;
|
||||
}
|
||||
|
||||
const AAT::mort& mort = _get_mort (font->face, &blob);
|
||||
hb_blob_t *mort_blob = font->face->table.morx.get_blob ();
|
||||
const AAT::mort& mort = *font->face->table.mort;
|
||||
if (mort.has_data ())
|
||||
{
|
||||
AAT::hb_aat_apply_context_t c (plan, font, buffer, blob);
|
||||
AAT::hb_aat_apply_context_t c (plan, font, buffer, mort_blob);
|
||||
mort.apply (&c);
|
||||
return;
|
||||
}
|
||||
@ -297,7 +228,7 @@ hb_aat_layout_substitute (hb_ot_shape_plan_t *plan,
|
||||
hb_bool_t
|
||||
hb_aat_layout_has_positioning (hb_face_t *face)
|
||||
{
|
||||
return _get_kerx (face).has_data ();
|
||||
return face->table.kerx->has_data ();
|
||||
}
|
||||
|
||||
void
|
||||
@ -305,21 +236,22 @@ hb_aat_layout_position (hb_ot_shape_plan_t *plan,
|
||||
hb_font_t *font,
|
||||
hb_buffer_t *buffer)
|
||||
{
|
||||
hb_blob_t *blob;
|
||||
const AAT::kerx& kerx = _get_kerx (font->face, &blob);
|
||||
hb_blob_t *blob = font->face->table.kerx.get_blob ();
|
||||
const AAT::kerx& kerx = *font->face->table.kerx;
|
||||
|
||||
hb_blob_t *ankr_blob;
|
||||
const AAT::ankr& ankr = _get_ankr (font->face, &ankr_blob);
|
||||
hb_blob_t *ankr_blob = font->face->table.ankr.get_blob ();;
|
||||
const AAT::ankr& ankr = *font->face->table.ankr;
|
||||
|
||||
AAT::hb_aat_apply_context_t c (plan, font, buffer, blob);
|
||||
c.set_ankr_table (&ankr, ankr_blob->data + ankr_blob->length);
|
||||
kerx.apply (&c);
|
||||
}
|
||||
|
||||
|
||||
hb_bool_t
|
||||
hb_aat_layout_has_tracking (hb_face_t *face)
|
||||
{
|
||||
return _get_trak (face).has_data ();
|
||||
return face->table.trak->has_data ();
|
||||
}
|
||||
|
||||
void
|
||||
@ -327,15 +259,16 @@ hb_aat_layout_track (hb_ot_shape_plan_t *plan,
|
||||
hb_font_t *font,
|
||||
hb_buffer_t *buffer)
|
||||
{
|
||||
const AAT::trak& trak = _get_trak (font->face);
|
||||
const AAT::trak& trak = *font->face->table.trak;
|
||||
|
||||
AAT::hb_aat_apply_context_t c (plan, font, buffer);
|
||||
trak.apply (&c);
|
||||
}
|
||||
|
||||
|
||||
hb_language_t
|
||||
_hb_aat_language_get (hb_face_t *face,
|
||||
unsigned int i)
|
||||
{
|
||||
return _get_ltag (face).get_language (i);
|
||||
return face->table.ltag->get_language (i);
|
||||
}
|
||||
|
@ -50,42 +50,6 @@
|
||||
**/
|
||||
|
||||
|
||||
static inline const OT::COLR&
|
||||
_get_colr (hb_face_t *face)
|
||||
{
|
||||
if (unlikely (!hb_ot_shaper_face_data_ensure (face))) return Null(OT::COLR);
|
||||
return *(hb_ot_face_data (face)->COLR);
|
||||
}
|
||||
|
||||
static inline const OT::CBDT_accelerator_t&
|
||||
_get_cbdt (hb_face_t *face)
|
||||
{
|
||||
if (unlikely (!hb_ot_shaper_face_data_ensure (face))) return Null(OT::CBDT_accelerator_t);
|
||||
return *(hb_ot_face_data (face)->CBDT);
|
||||
}
|
||||
|
||||
static inline const OT::CPAL&
|
||||
_get_cpal (hb_face_t *face)
|
||||
{
|
||||
if (unlikely (!hb_ot_shaper_face_data_ensure (face))) return Null(OT::CPAL);
|
||||
return *(hb_ot_face_data (face)->CPAL);
|
||||
}
|
||||
|
||||
static inline const OT::sbix_accelerator_t&
|
||||
_get_sbix (hb_face_t *face)
|
||||
{
|
||||
if (unlikely (!hb_ot_shaper_face_data_ensure (face))) return Null(OT::sbix_accelerator_t);
|
||||
return *(hb_ot_face_data (face)->sbix);
|
||||
}
|
||||
|
||||
static inline const OT::SVG_accelerator_t&
|
||||
_get_svg (hb_face_t *face)
|
||||
{
|
||||
if (unlikely (!hb_ot_shaper_face_data_ensure (face))) return Null(OT::SVG_accelerator_t);
|
||||
return *(hb_ot_face_data (face)->SVG);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* CPAL
|
||||
*/
|
||||
@ -102,7 +66,7 @@ _get_svg (hb_face_t *face)
|
||||
hb_bool_t
|
||||
hb_ot_color_has_palettes (hb_face_t *face)
|
||||
{
|
||||
return _get_cpal (face).has_data ();
|
||||
return face->table.CPAL->has_data ();
|
||||
}
|
||||
|
||||
/**
|
||||
@ -117,7 +81,7 @@ hb_ot_color_has_palettes (hb_face_t *face)
|
||||
unsigned int
|
||||
hb_ot_color_palette_get_count (hb_face_t *face)
|
||||
{
|
||||
return _get_cpal (face).get_palette_count ();
|
||||
return face->table.CPAL->get_palette_count ();
|
||||
}
|
||||
|
||||
/**
|
||||
@ -137,7 +101,7 @@ hb_ot_name_id_t
|
||||
hb_ot_color_palette_get_name_id (hb_face_t *face,
|
||||
unsigned int palette_index)
|
||||
{
|
||||
return _get_cpal (face).get_palette_name_id (palette_index);
|
||||
return face->table.CPAL->get_palette_name_id (palette_index);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -153,7 +117,7 @@ hb_ot_name_id_t
|
||||
hb_ot_color_palette_color_get_name_id (hb_face_t *face,
|
||||
unsigned int color_index)
|
||||
{
|
||||
return _get_cpal (face).get_color_name_id (color_index);
|
||||
return face->table.CPAL->get_color_name_id (color_index);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -169,7 +133,7 @@ hb_ot_color_palette_flags_t
|
||||
hb_ot_color_palette_get_flags (hb_face_t *face,
|
||||
unsigned int palette_index)
|
||||
{
|
||||
return _get_cpal(face).get_palette_flags (palette_index);
|
||||
return face->table.CPAL->get_palette_flags (palette_index);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -203,7 +167,7 @@ hb_ot_color_palette_get_colors (hb_face_t *face,
|
||||
unsigned int *colors_count /* IN/OUT. May be NULL. */,
|
||||
hb_color_t *colors /* OUT. May be NULL. */)
|
||||
{
|
||||
return _get_cpal (face).get_palette_colors (palette_index, start_offset, colors_count, colors);
|
||||
return face->table.CPAL->get_palette_colors (palette_index, start_offset, colors_count, colors);
|
||||
}
|
||||
|
||||
|
||||
@ -222,7 +186,7 @@ hb_ot_color_palette_get_colors (hb_face_t *face,
|
||||
hb_bool_t
|
||||
hb_ot_color_has_layers (hb_face_t *face)
|
||||
{
|
||||
return _get_colr (face).has_data ();
|
||||
return face->table.COLR->has_data ();
|
||||
}
|
||||
|
||||
/**
|
||||
@ -245,7 +209,7 @@ hb_ot_color_glyph_get_layers (hb_face_t *face,
|
||||
unsigned int *count, /* IN/OUT. May be NULL. */
|
||||
hb_ot_color_layer_t *layers /* OUT. May be NULL. */)
|
||||
{
|
||||
return _get_colr (face).get_glyph_layers (glyph, start_offset, count, layers);
|
||||
return face->table.COLR->get_glyph_layers (glyph, start_offset, count, layers);
|
||||
}
|
||||
|
||||
|
||||
@ -266,7 +230,7 @@ hb_ot_color_glyph_get_layers (hb_face_t *face,
|
||||
hb_bool_t
|
||||
hb_ot_color_has_svg (hb_face_t *face)
|
||||
{
|
||||
return _get_svg (face).has_data ();
|
||||
return face->table.SVG->has_data ();
|
||||
}
|
||||
|
||||
/**
|
||||
@ -283,7 +247,7 @@ hb_ot_color_has_svg (hb_face_t *face)
|
||||
hb_blob_t *
|
||||
hb_ot_color_glyph_reference_svg (hb_face_t *face, hb_codepoint_t glyph)
|
||||
{
|
||||
return _get_svg (face).reference_blob_for_glyph (glyph);
|
||||
return face->table.SVG->reference_blob_for_glyph (glyph);
|
||||
}
|
||||
|
||||
|
||||
@ -304,7 +268,7 @@ hb_ot_color_glyph_reference_svg (hb_face_t *face, hb_codepoint_t glyph)
|
||||
hb_bool_t
|
||||
hb_ot_color_has_png (hb_face_t *face)
|
||||
{
|
||||
return _get_cbdt (face).has_data () || _get_sbix (face).has_data ();
|
||||
return face->table.CBDT->has_data () || face->table.sbix->has_data ();
|
||||
}
|
||||
|
||||
/**
|
||||
@ -325,11 +289,11 @@ hb_ot_color_glyph_reference_png (hb_font_t *font, hb_codepoint_t glyph)
|
||||
{
|
||||
hb_blob_t *blob = hb_blob_get_empty ();
|
||||
|
||||
if (_get_sbix (font->face).has_data ())
|
||||
blob = _get_sbix (font->face).reference_png (font, glyph, nullptr, nullptr, nullptr);
|
||||
if (font->face->table.sbix->has_data ())
|
||||
blob = font->face->table.sbix->reference_png (font, glyph, nullptr, nullptr, nullptr);
|
||||
|
||||
if (!blob->length && _get_cbdt (font->face).has_data ())
|
||||
blob = _get_cbdt (font->face).reference_png (font, glyph);
|
||||
if (!blob->length && font->face->table.CBDT->has_data ())
|
||||
blob = font->face->table.CBDT->reference_png (font, glyph);
|
||||
|
||||
return blob;
|
||||
}
|
||||
|
@ -53,20 +53,6 @@
|
||||
**/
|
||||
|
||||
|
||||
static inline const OT::kern&
|
||||
_get_kern (hb_face_t *face, hb_blob_t **blob = nullptr)
|
||||
{
|
||||
if (unlikely (!hb_ot_shaper_face_data_ensure (face)))
|
||||
{
|
||||
if (blob)
|
||||
*blob = hb_blob_get_empty ();
|
||||
return Null(OT::kern);
|
||||
}
|
||||
const OT::kern& kern = *(hb_ot_face_data (face)->kern);
|
||||
if (blob)
|
||||
*blob = hb_ot_face_data (face)->kern.get_blob ();
|
||||
return kern;
|
||||
}
|
||||
const OT::GDEF& _get_gdef (hb_face_t *face)
|
||||
{
|
||||
if (unlikely (!hb_ot_shaper_face_data_ensure (face))) return Null(OT::GDEF);
|
||||
@ -109,7 +95,7 @@ const OT::GPOS& _get_gpos_relaxed (hb_face_t *face)
|
||||
hb_bool_t
|
||||
hb_ot_layout_has_kerning (hb_face_t *face)
|
||||
{
|
||||
return _get_kern (face).has_data ();
|
||||
return face->table.kern->has_data ();
|
||||
}
|
||||
|
||||
void
|
||||
@ -117,8 +103,8 @@ hb_ot_layout_kern (hb_ot_shape_plan_t *plan,
|
||||
hb_font_t *font,
|
||||
hb_buffer_t *buffer)
|
||||
{
|
||||
hb_blob_t *blob;
|
||||
const AAT::kern& kern = _get_kern (font->face, &blob);
|
||||
hb_blob_t *blob = font->face->table.kern.get_blob ();
|
||||
const AAT::kern& kern = *font->face->table.kern;
|
||||
|
||||
AAT::hb_aat_apply_context_t c (plan, font, buffer, blob);
|
||||
|
||||
|
@ -40,13 +40,6 @@
|
||||
**/
|
||||
|
||||
|
||||
static inline const OT::MATH&
|
||||
_get_math (hb_face_t *face)
|
||||
{
|
||||
if (unlikely (!hb_ot_shaper_face_data_ensure (face))) return Null(OT::MATH);
|
||||
return *(hb_ot_face_data (face)->MATH);
|
||||
}
|
||||
|
||||
/*
|
||||
* OT::MATH
|
||||
*/
|
||||
@ -65,7 +58,7 @@ _get_math (hb_face_t *face)
|
||||
hb_bool_t
|
||||
hb_ot_math_has_data (hb_face_t *face)
|
||||
{
|
||||
return _get_math (face).has_data ();
|
||||
return face->table.MATH->has_data ();
|
||||
}
|
||||
|
||||
/**
|
||||
@ -87,8 +80,7 @@ hb_position_t
|
||||
hb_ot_math_get_constant (hb_font_t *font,
|
||||
hb_ot_math_constant_t constant)
|
||||
{
|
||||
const OT::MATH &math = _get_math (font->face);
|
||||
return math.get_constant(constant, font);
|
||||
return font->face->table.MATH->get_constant(constant, font);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -104,8 +96,7 @@ hb_position_t
|
||||
hb_ot_math_get_glyph_italics_correction (hb_font_t *font,
|
||||
hb_codepoint_t glyph)
|
||||
{
|
||||
const OT::MATH &math = _get_math (font->face);
|
||||
return math.get_math_glyph_info().get_italics_correction (glyph, font);
|
||||
return font->face->table.MATH->get_math_glyph_info().get_italics_correction (glyph, font);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -121,8 +112,7 @@ hb_position_t
|
||||
hb_ot_math_get_glyph_top_accent_attachment (hb_font_t *font,
|
||||
hb_codepoint_t glyph)
|
||||
{
|
||||
const OT::MATH &math = _get_math (font->face);
|
||||
return math.get_math_glyph_info().get_top_accent_attachment (glyph, font);
|
||||
return font->face->table.MATH->get_math_glyph_info().get_top_accent_attachment (glyph, font);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -138,8 +128,7 @@ hb_bool_t
|
||||
hb_ot_math_is_glyph_extended_shape (hb_face_t *face,
|
||||
hb_codepoint_t glyph)
|
||||
{
|
||||
const OT::MATH &math = _get_math (face);
|
||||
return math.get_math_glyph_info().is_extended_shape (glyph);
|
||||
return face->table.MATH->get_math_glyph_info().is_extended_shape (glyph);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -165,8 +154,7 @@ hb_ot_math_get_glyph_kerning (hb_font_t *font,
|
||||
hb_ot_math_kern_t kern,
|
||||
hb_position_t correction_height)
|
||||
{
|
||||
const OT::MATH &math = _get_math (font->face);
|
||||
return math.get_math_glyph_info().get_kerning (glyph, kern, correction_height, font);
|
||||
return font->face->table.MATH->get_math_glyph_info().get_kerning (glyph, kern, correction_height, font);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -196,11 +184,10 @@ hb_ot_math_get_glyph_variants (hb_font_t *font,
|
||||
unsigned int *variants_count, /* IN/OUT */
|
||||
hb_ot_math_glyph_variant_t *variants /* OUT */)
|
||||
{
|
||||
const OT::MATH &math = _get_math (font->face);
|
||||
return math.get_math_variants().get_glyph_variants (glyph, direction, font,
|
||||
start_offset,
|
||||
variants_count,
|
||||
variants);
|
||||
return font->face->table.MATH->get_math_variants().get_glyph_variants (glyph, direction, font,
|
||||
start_offset,
|
||||
variants_count,
|
||||
variants);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -221,8 +208,7 @@ hb_position_t
|
||||
hb_ot_math_get_min_connector_overlap (hb_font_t *font,
|
||||
hb_direction_t direction)
|
||||
{
|
||||
const OT::MATH &math = _get_math (font->face);
|
||||
return math.get_math_variants().get_min_connector_overlap (direction, font);
|
||||
return font->face->table.MATH->get_math_variants().get_min_connector_overlap (direction, font);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -254,10 +240,9 @@ hb_ot_math_get_glyph_assembly (hb_font_t *font,
|
||||
hb_ot_math_glyph_part_t *parts, /* OUT */
|
||||
hb_position_t *italics_correction /* OUT */)
|
||||
{
|
||||
const OT::MATH &math = _get_math (font->face);
|
||||
return math.get_math_variants().get_glyph_parts (glyph, direction, font,
|
||||
start_offset,
|
||||
parts_count,
|
||||
parts,
|
||||
italics_correction);
|
||||
return font->face->table.MATH->get_math_variants().get_glyph_parts (glyph, direction, font,
|
||||
start_offset,
|
||||
parts_count,
|
||||
parts,
|
||||
italics_correction);
|
||||
}
|
||||
|
@ -42,13 +42,6 @@
|
||||
**/
|
||||
|
||||
|
||||
static inline const OT::name_accelerator_t&
|
||||
_get_name (hb_face_t *face)
|
||||
{
|
||||
if (unlikely (!hb_ot_shaper_face_data_ensure (face))) return Null(OT::name_accelerator_t);
|
||||
return *(hb_ot_face_data (face)->name);
|
||||
}
|
||||
|
||||
/**
|
||||
* hb_ot_name_list_names:
|
||||
* @face: font face.
|
||||
@ -65,7 +58,7 @@ const hb_ot_name_entry_t *
|
||||
hb_ot_name_list_names (hb_face_t *face,
|
||||
unsigned int *num_entries /* OUT */)
|
||||
{
|
||||
const OT::name_accelerator_t &name = _get_name (face);
|
||||
const OT::name_accelerator_t &name = *face->table.name;
|
||||
if (num_entries) *num_entries = name.names.len;
|
||||
return name.names.arrayZ();
|
||||
}
|
||||
@ -124,7 +117,7 @@ hb_ot_name_get_utf (hb_face_t *face,
|
||||
unsigned int *text_size /* IN/OUT */,
|
||||
typename utf_t::codepoint_t *text /* OUT */)
|
||||
{
|
||||
const OT::name_accelerator_t &name = _get_name (face);
|
||||
const OT::name_accelerator_t &name = *face->table.name;
|
||||
|
||||
if (!language)
|
||||
language = hb_language_from_string ("en", 2);
|
||||
|
@ -47,18 +47,6 @@
|
||||
* fvar/avar
|
||||
*/
|
||||
|
||||
static inline const OT::fvar&
|
||||
_get_fvar (hb_face_t *face)
|
||||
{
|
||||
if (unlikely (!hb_ot_shaper_face_data_ensure (face))) return Null(OT::fvar);
|
||||
return *(hb_ot_face_data (face)->fvar);
|
||||
}
|
||||
static inline const OT::avar&
|
||||
_get_avar (hb_face_t *face)
|
||||
{
|
||||
if (unlikely (!hb_ot_shaper_face_data_ensure (face))) return Null(OT::avar);
|
||||
return *(hb_ot_face_data (face)->avar);
|
||||
}
|
||||
|
||||
/**
|
||||
* hb_ot_var_has_data:
|
||||
@ -74,7 +62,7 @@ _get_avar (hb_face_t *face)
|
||||
hb_bool_t
|
||||
hb_ot_var_has_data (hb_face_t *face)
|
||||
{
|
||||
return _get_fvar (face).has_data ();
|
||||
return face->table.fvar->has_data ();
|
||||
}
|
||||
|
||||
/**
|
||||
@ -85,8 +73,7 @@ hb_ot_var_has_data (hb_face_t *face)
|
||||
unsigned int
|
||||
hb_ot_var_get_axis_count (hb_face_t *face)
|
||||
{
|
||||
const OT::fvar &fvar = _get_fvar (face);
|
||||
return fvar.get_axis_count ();
|
||||
return face->table.fvar->get_axis_count ();
|
||||
}
|
||||
|
||||
/**
|
||||
@ -100,8 +87,7 @@ hb_ot_var_get_axes (hb_face_t *face,
|
||||
unsigned int *axes_count /* IN/OUT */,
|
||||
hb_ot_var_axis_t *axes_array /* OUT */)
|
||||
{
|
||||
const OT::fvar &fvar = _get_fvar (face);
|
||||
return fvar.get_axis_infos (start_offset, axes_count, axes_array);
|
||||
return face->table.fvar->get_axis_infos (start_offset, axes_count, axes_array);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -115,8 +101,7 @@ hb_ot_var_find_axis (hb_face_t *face,
|
||||
unsigned int *axis_index,
|
||||
hb_ot_var_axis_t *axis_info)
|
||||
{
|
||||
const OT::fvar &fvar = _get_fvar (face);
|
||||
return fvar.find_axis (axis_tag, axis_index, axis_info);
|
||||
return face->table.fvar->find_axis (axis_tag, axis_index, axis_info);
|
||||
}
|
||||
|
||||
|
||||
@ -135,7 +120,7 @@ hb_ot_var_normalize_variations (hb_face_t *face,
|
||||
for (unsigned int i = 0; i < coords_length; i++)
|
||||
coords[i] = 0;
|
||||
|
||||
const OT::fvar &fvar = _get_fvar (face);
|
||||
const OT::fvar &fvar = *face->table.fvar;
|
||||
for (unsigned int i = 0; i < variations_length; i++)
|
||||
{
|
||||
unsigned int axis_index;
|
||||
@ -144,8 +129,7 @@ hb_ot_var_normalize_variations (hb_face_t *face,
|
||||
coords[axis_index] = fvar.normalize_axis_value (axis_index, variations[i].value);
|
||||
}
|
||||
|
||||
const OT::avar &avar = _get_avar (face);
|
||||
avar.map_coords (coords, coords_length);
|
||||
face->table.avar->map_coords (coords, coords_length);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -159,10 +143,9 @@ hb_ot_var_normalize_coords (hb_face_t *face,
|
||||
const float *design_coords, /* IN */
|
||||
int *normalized_coords /* OUT */)
|
||||
{
|
||||
const OT::fvar &fvar = _get_fvar (face);
|
||||
const OT::fvar &fvar = *face->table.fvar;
|
||||
for (unsigned int i = 0; i < coords_length; i++)
|
||||
normalized_coords[i] = fvar.normalize_axis_value (i, design_coords[i]);
|
||||
|
||||
const OT::avar &avar = _get_avar (face);
|
||||
avar.map_coords (normalized_coords, coords_length);
|
||||
face->table.avar->map_coords (normalized_coords, coords_length);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user