[hmtx] Prepare to fix and minor fixes
This commit is contained in:
parent
6d09b5a8a0
commit
3fd555be54
@ -172,7 +172,6 @@ struct hmtxvmtx
|
||||
void init (hb_face_t *face,
|
||||
unsigned int default_advance_ = 0)
|
||||
{
|
||||
memset (this, 0, sizeof (*this));
|
||||
default_advance = default_advance_ ? default_advance_ : hb_face_get_upem (face);
|
||||
|
||||
num_advances = T::is_horizontal ? face->table.hhea->numberOfLongMetrics : face->table.vhea->numberOfLongMetrics;
|
||||
@ -203,8 +202,6 @@ struct hmtxvmtx
|
||||
var_table.destroy ();
|
||||
}
|
||||
|
||||
bool has_data () const { return table.get () != nullptr; }
|
||||
|
||||
int get_side_bearing (hb_codepoint_t glyph) const
|
||||
{
|
||||
if (glyph < num_advances)
|
||||
@ -220,17 +217,14 @@ struct hmtxvmtx
|
||||
int get_side_bearing (hb_font_t *font, hb_codepoint_t glyph) const
|
||||
{
|
||||
int side_bearing = get_side_bearing (glyph);
|
||||
if (likely (glyph < num_metrics))
|
||||
{
|
||||
if (font->num_coords)
|
||||
{
|
||||
if (var_table.get_blob () != hb_blob_get_empty ())
|
||||
side_bearing += var_table->get_side_bearing_var (glyph, font->coords, font->num_coords); // TODO Optimize?!
|
||||
else
|
||||
side_bearing = get_side_bearing_var_tt (font, glyph, T::tableTag==HB_OT_TAG_vmtx);
|
||||
}
|
||||
}
|
||||
return side_bearing;
|
||||
|
||||
if (unlikely (glyph >= num_metrics) || !font->num_coords)
|
||||
return side_bearing;
|
||||
|
||||
// if (var_table.get_blob () == &Null (hb_blob_t))
|
||||
// return get_side_bearing_var_tt (font, glyph, T::tableTag == HB_OT_TAG_vmtx);
|
||||
|
||||
return side_bearing + var_table->get_side_bearing_var (glyph, font->coords, font->num_coords); // TODO Optimize?!
|
||||
}
|
||||
|
||||
unsigned int get_advance (hb_codepoint_t glyph) const
|
||||
@ -253,17 +247,14 @@ struct hmtxvmtx
|
||||
hb_font_t *font) const
|
||||
{
|
||||
unsigned int advance = get_advance (glyph);
|
||||
if (likely (glyph < num_metrics))
|
||||
{
|
||||
if (font->num_coords)
|
||||
{
|
||||
if (var_table.get_blob () != hb_blob_get_empty ())
|
||||
advance += roundf (var_table->get_advance_var (glyph, font->coords, font->num_coords)); // TODO Optimize?!
|
||||
else
|
||||
advance = get_advance_var_tt (font, glyph, T::tableTag==HB_OT_TAG_vmtx);
|
||||
}
|
||||
}
|
||||
return advance;
|
||||
|
||||
if (unlikely (glyph >= num_metrics) || !font->num_coords)
|
||||
return advance;
|
||||
|
||||
// if (var_table.get_blob () == &Null (hb_blob_t))
|
||||
// return get_advance_var_tt (font, glyph, T::tableTag == HB_OT_TAG_vmtx);
|
||||
|
||||
return advance + roundf (var_table->get_advance_var (glyph, font->coords, font->num_coords)); // TODO Optimize?!
|
||||
}
|
||||
|
||||
unsigned int num_advances_for_subset (const hb_subset_plan_t *plan) const
|
||||
|
@ -63,7 +63,7 @@ struct DeltaSetIndexMap
|
||||
}
|
||||
|
||||
{ /* Repack it. */
|
||||
unsigned int n = get_inner_bit_count ();
|
||||
unsigned int n = get_inner_bitcount ();
|
||||
unsigned int outer = u >> n;
|
||||
unsigned int inner = u & ((1 << n) - 1);
|
||||
u = (outer<<16) | inner;
|
||||
@ -72,9 +72,10 @@ struct DeltaSetIndexMap
|
||||
return u;
|
||||
}
|
||||
|
||||
unsigned int get_map_count () const { return mapCount; }
|
||||
unsigned int get_width () const { return ((format >> 4) & 3) + 1; }
|
||||
unsigned int get_inner_bit_count () const { return (format & 0xF) + 1; }
|
||||
protected:
|
||||
unsigned int get_width () const { return ((format >> 4) & 3) + 1; }
|
||||
|
||||
unsigned int get_inner_bitcount () const { return (format & 0xF) + 1; }
|
||||
|
||||
protected:
|
||||
HBUINT16 format; /* A packed field that describes the compressed
|
||||
|
Loading…
Reference in New Issue
Block a user