[hmtx] Rename advance functions for clarity
This commit is contained in:
parent
6b82d4faa1
commit
35c00c1216
|
@ -114,10 +114,10 @@ struct Glyph
|
||||||
0
|
0
|
||||||
#endif
|
#endif
|
||||||
;
|
;
|
||||||
unsigned h_adv = glyf_accelerator.hmtx->get_advance (gid);
|
unsigned h_adv = glyf_accelerator.hmtx->get_advance_without_var_unscaled (gid);
|
||||||
unsigned v_adv =
|
unsigned v_adv =
|
||||||
#ifndef HB_NO_VERTICAL
|
#ifndef HB_NO_VERTICAL
|
||||||
glyf_accelerator.vmtx->get_advance (gid)
|
glyf_accelerator.vmtx->get_advance_without_var_unscaled (gid)
|
||||||
#else
|
#else
|
||||||
- font->face->get_upem ()
|
- font->face->get_upem ()
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -271,9 +271,9 @@ struct glyf_accelerator_t
|
||||||
if (unlikely (!success))
|
if (unlikely (!success))
|
||||||
return
|
return
|
||||||
#ifndef HB_NO_VERTICAL
|
#ifndef HB_NO_VERTICAL
|
||||||
is_vertical ? vmtx->get_advance (gid) :
|
is_vertical ? vmtx->get_advance_without_var_unscaled (gid) :
|
||||||
#endif
|
#endif
|
||||||
hmtx->get_advance (gid);
|
hmtx->get_advance_without_var_unscaled (gid);
|
||||||
|
|
||||||
float result = is_vertical
|
float result = is_vertical
|
||||||
? phantoms[glyf_impl::PHANTOM_TOP].y - phantoms[glyf_impl::PHANTOM_BOTTOM].y
|
? phantoms[glyf_impl::PHANTOM_TOP].y - phantoms[glyf_impl::PHANTOM_BOTTOM].y
|
||||||
|
|
|
@ -190,7 +190,7 @@ hb_ot_get_glyph_h_advances (hb_font_t* font, void* font_data,
|
||||||
{
|
{
|
||||||
for (unsigned int i = 0; i < count; i++)
|
for (unsigned int i = 0; i < count; i++)
|
||||||
{
|
{
|
||||||
*first_advance = font->em_scale_x (hmtx.get_advance (*first_glyph, font, varStore_cache));
|
*first_advance = font->em_scale_x (hmtx.get_advance_with_var_unscaled (*first_glyph, font, varStore_cache));
|
||||||
first_glyph = &StructAtOffsetUnaligned<hb_codepoint_t> (first_glyph, glyph_stride);
|
first_glyph = &StructAtOffsetUnaligned<hb_codepoint_t> (first_glyph, glyph_stride);
|
||||||
first_advance = &StructAtOffsetUnaligned<hb_position_t> (first_advance, advance_stride);
|
first_advance = &StructAtOffsetUnaligned<hb_position_t> (first_advance, advance_stride);
|
||||||
}
|
}
|
||||||
|
@ -211,7 +211,7 @@ hb_ot_get_glyph_h_advances (hb_font_t* font, void* font_data,
|
||||||
v = cv;
|
v = cv;
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
v = hmtx.get_advance (*first_glyph, font, varStore_cache);
|
v = hmtx.get_advance_with_var_unscaled (*first_glyph, font, varStore_cache);
|
||||||
ot_font->advance_cache->set (*first_glyph, v);
|
ot_font->advance_cache->set (*first_glyph, v);
|
||||||
}
|
}
|
||||||
*first_advance = font->em_scale_x (v);
|
*first_advance = font->em_scale_x (v);
|
||||||
|
@ -251,7 +251,7 @@ hb_ot_get_glyph_v_advances (hb_font_t* font, void* font_data,
|
||||||
|
|
||||||
for (unsigned int i = 0; i < count; i++)
|
for (unsigned int i = 0; i < count; i++)
|
||||||
{
|
{
|
||||||
*first_advance = font->em_scale_y (-(int) vmtx.get_advance (*first_glyph, font, varStore_cache));
|
*first_advance = font->em_scale_y (-(int) vmtx.get_advance_with_var_unscaled (*first_glyph, font, varStore_cache));
|
||||||
first_glyph = &StructAtOffsetUnaligned<hb_codepoint_t> (first_glyph, glyph_stride);
|
first_glyph = &StructAtOffsetUnaligned<hb_codepoint_t> (first_glyph, glyph_stride);
|
||||||
first_advance = &StructAtOffsetUnaligned<hb_position_t> (first_advance, advance_stride);
|
first_advance = &StructAtOffsetUnaligned<hb_position_t> (first_advance, advance_stride);
|
||||||
}
|
}
|
||||||
|
|
|
@ -135,9 +135,9 @@ struct hmtxvmtx
|
||||||
auto& plan = c->plan;
|
auto& plan = c->plan;
|
||||||
num_long_metrics = plan->num_output_glyphs ();
|
num_long_metrics = plan->num_output_glyphs ();
|
||||||
hb_codepoint_t old_gid = 0;
|
hb_codepoint_t old_gid = 0;
|
||||||
unsigned int last_advance = plan->old_gid_for_new_gid (num_long_metrics - 1, &old_gid) ? _mtx.get_advance (old_gid) : 0;
|
unsigned int last_advance = plan->old_gid_for_new_gid (num_long_metrics - 1, &old_gid) ? _mtx.get_advance_without_var_unscaled (old_gid) : 0;
|
||||||
while (num_long_metrics > 1 &&
|
while (num_long_metrics > 1 &&
|
||||||
last_advance == (plan->old_gid_for_new_gid (num_long_metrics - 2, &old_gid) ? _mtx.get_advance (old_gid) : 0))
|
last_advance == (plan->old_gid_for_new_gid (num_long_metrics - 2, &old_gid) ? _mtx.get_advance_without_var_unscaled (old_gid) : 0))
|
||||||
{
|
{
|
||||||
num_long_metrics--;
|
num_long_metrics--;
|
||||||
}
|
}
|
||||||
|
@ -150,7 +150,7 @@ struct hmtxvmtx
|
||||||
hb_codepoint_t old_gid;
|
hb_codepoint_t old_gid;
|
||||||
if (!c->plan->old_gid_for_new_gid (_, &old_gid))
|
if (!c->plan->old_gid_for_new_gid (_, &old_gid))
|
||||||
return hb_pair (0u, 0);
|
return hb_pair (0u, 0);
|
||||||
return hb_pair (_mtx.get_advance (old_gid), _mtx.get_side_bearing (old_gid));
|
return hb_pair (_mtx.get_advance_without_var_unscaled (old_gid), _mtx.get_side_bearing (old_gid));
|
||||||
})
|
})
|
||||||
;
|
;
|
||||||
|
|
||||||
|
@ -251,7 +251,7 @@ struct hmtxvmtx
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
unsigned int get_advance (hb_codepoint_t glyph) const
|
unsigned int get_advance_without_var_unscaled (hb_codepoint_t glyph) const
|
||||||
{
|
{
|
||||||
/* OpenType case. */
|
/* OpenType case. */
|
||||||
if (glyph < num_bearings)
|
if (glyph < num_bearings)
|
||||||
|
@ -276,7 +276,7 @@ struct hmtxvmtx
|
||||||
/* TODO Optimize */
|
/* TODO Optimize */
|
||||||
|
|
||||||
if (num_bearings == num_advances)
|
if (num_bearings == num_advances)
|
||||||
return get_advance (num_bearings - 1);
|
return get_advance_without_var_unscaled (num_bearings - 1);
|
||||||
|
|
||||||
const FWORD *bearings = (const FWORD *) &table->longMetricZ[num_long_metrics];
|
const FWORD *bearings = (const FWORD *) &table->longMetricZ[num_long_metrics];
|
||||||
const UFWORD *advances = (const UFWORD *) &bearings[num_bearings - num_long_metrics];
|
const UFWORD *advances = (const UFWORD *) &bearings[num_bearings - num_long_metrics];
|
||||||
|
@ -284,11 +284,11 @@ struct hmtxvmtx
|
||||||
return advances[hb_min (glyph - num_bearings, num_advances - num_bearings - 1)];
|
return advances[hb_min (glyph - num_bearings, num_advances - num_bearings - 1)];
|
||||||
}
|
}
|
||||||
|
|
||||||
unsigned get_advance (hb_codepoint_t glyph,
|
unsigned get_advance_with_var_unscaled (hb_codepoint_t glyph,
|
||||||
hb_font_t *font,
|
hb_font_t *font,
|
||||||
VariationStore::cache_t *store_cache = nullptr) const
|
VariationStore::cache_t *store_cache = nullptr) const
|
||||||
{
|
{
|
||||||
unsigned int advance = get_advance (glyph);
|
unsigned int advance = get_advance_without_var_unscaled (glyph);
|
||||||
|
|
||||||
#ifndef HB_NO_VAR
|
#ifndef HB_NO_VAR
|
||||||
if (unlikely (glyph >= num_bearings) || !font->num_coords)
|
if (unlikely (glyph >= num_bearings) || !font->num_coords)
|
||||||
|
|
Loading…
Reference in New Issue