/* Disable FDSelect format 0 for compatibility with fonttools which doesn't seem choose it.
* Rarely any/much smaller than format 3 anyway. */ #define CFF_SERIALIZE_FDSELECT_0 0
usingnamespace CFF;
/* Determine an optimal FDSelect format according to a provided plan. * * Return value: FDSelect format, size, and ranges for the most compact subset FDSelect * along with a font index remapping table
*/
bool
hb_plan_subset_cff_fdselect (const hb_subset_plan_t *plan, unsignedint fdCount, const FDSelect &src, /* IN */ unsignedint &subset_fd_count /* OUT */, unsignedint &subset_fdselect_size /* OUT */, unsignedint &subset_fdselect_format /* OUT */,
hb_vector_t<code_pair_t> &fdselect_ranges /* OUT */,
hb_inc_bimap_t &fdmap /* OUT */)
{
subset_fd_count = 0;
subset_fdselect_size = 0;
subset_fdselect_format = 0; unsignedint num_ranges = 0;
unsignedint subset_num_glyphs = plan->num_output_glyphs (); if (subset_num_glyphs == 0) returntrue;
{ /* use hb_set to determine the subset of font dicts */
hb_set_t set;
hb_codepoint_t prev_fd = CFF_UNDEF_CODE;
hb_pair_t<unsigned, hb_codepoint_t> last_range {0, 0}; auto it = hb_iter (plan->new_to_old_gid_list); auto _ = *it; for (hb_codepoint_t gid = 0; gid < subset_num_glyphs; gid++)
{
hb_codepoint_t old_glyph; if (gid == _.first)
{
old_glyph = _.second;
_ = *++it;
} else
{ /* fonttools retains FDSelect & font dicts for missing glyphs. do the same */
old_glyph = gid;
} if (old_glyph >= last_range.second)
last_range = src.get_fd_range (old_glyph); unsigned fd = last_range.first;
subset_fd_count = set.get_population (); if (subset_fd_count == fdCount)
{ /* all font dicts belong to the subset. no need to subset FDSelect & FDArray */
fdmap.identity (fdCount);
} else
{ /* create a fdmap */
fdmap.reset ();
hb_codepoint_t fd = CFF_UNDEF_CODE; while (set.next (&fd))
fdmap.add (fd); if (unlikely (fdmap.get_population () != subset_fd_count)) returnfalse;
}
/* update each font dict index stored as "code" in fdselect_ranges */ for (unsignedint i = 0; i < fdselect_ranges.length; i++)
fdselect_ranges[i].code = fdmap[fdselect_ranges[i].code];
}
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.