[VarC/subset] Support subsetting VarComposites
By renumbering components.
This commit is contained in:
parent
15d0a1dcfd
commit
f2d21425a3
|
@ -46,19 +46,30 @@ struct SubsetGlyph
|
||||||
|
|
||||||
if (unlikely (!dest_glyph.length)) return_trace (true);
|
if (unlikely (!dest_glyph.length)) return_trace (true);
|
||||||
|
|
||||||
/* update components gids. TODO: VarComposite. */
|
/* update components gids. */
|
||||||
for (auto &_ : Glyph (dest_glyph).get_composite_iterator ())
|
for (auto &_ : Glyph (dest_glyph).get_composite_iterator ())
|
||||||
{
|
{
|
||||||
hb_codepoint_t new_gid;
|
hb_codepoint_t new_gid;
|
||||||
if (plan->new_gid_for_old_gid (_.get_gid(), &new_gid))
|
if (plan->new_gid_for_old_gid (_.get_gid(), &new_gid))
|
||||||
const_cast<CompositeGlyphRecord &> (_).set_gid (new_gid);
|
const_cast<CompositeGlyphRecord &> (_).set_gid (new_gid);
|
||||||
}
|
}
|
||||||
|
#ifndef HB_NO_VAR_COMPOSITES
|
||||||
|
for (auto &_ : Glyph (dest_glyph).get_var_composite_iterator ())
|
||||||
|
{
|
||||||
|
hb_codepoint_t new_gid;
|
||||||
|
if (plan->new_gid_for_old_gid (_.get_gid(), &new_gid))
|
||||||
|
const_cast<VarCompositeGlyphRecord &> (_).set_gid (new_gid);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifndef HB_NO_BEYOND_64K
|
#ifndef HB_NO_BEYOND_64K
|
||||||
auto it = Glyph (dest_glyph).get_composite_iterator ();
|
auto it = Glyph (dest_glyph).get_composite_iterator ();
|
||||||
if (it)
|
if (it)
|
||||||
{
|
{
|
||||||
/* lower GID24 to GID16 in components if possible. TODO: VarComposite. */
|
/* lower GID24 to GID16 in components if possible.
|
||||||
|
*
|
||||||
|
* TODO: VarComposite. Not as critical, since VarComposite supports
|
||||||
|
* gid24 from the first version. */
|
||||||
char *p = it ? (char *) &*it : nullptr;
|
char *p = it ? (char *) &*it : nullptr;
|
||||||
char *q = p;
|
char *q = p;
|
||||||
const char *end = dest_glyph.arrayZ + dest_glyph.length;
|
const char *end = dest_glyph.arrayZ + dest_glyph.length;
|
||||||
|
|
|
@ -71,6 +71,14 @@ struct VarCompositeGlyphRecord
|
||||||
return StructAfter<const HBGlyphID16> (numAxes);
|
return StructAfter<const HBGlyphID16> (numAxes);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void set_gid (hb_codepoint_t gid)
|
||||||
|
{
|
||||||
|
if (flags & GID_IS_24BIT)
|
||||||
|
StructAfter<HBGlyphID24> (numAxes) = gid;
|
||||||
|
else
|
||||||
|
StructAfter<HBGlyphID16> (numAxes) = gid;
|
||||||
|
}
|
||||||
|
|
||||||
unsigned get_numAxes () const
|
unsigned get_numAxes () const
|
||||||
{
|
{
|
||||||
return numAxes;
|
return numAxes;
|
||||||
|
|
Loading…
Reference in New Issue