Merge branch 'master' into cff-subset
This commit is contained in:
commit
1e88b1755c
|
@ -702,6 +702,23 @@ struct Lookup
|
||||||
return_trace (true);
|
return_trace (true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Older compileres need this to NOT be locally defined in a function. */
|
||||||
|
template <typename TSubTable>
|
||||||
|
struct SubTableSubsetWrapper
|
||||||
|
{
|
||||||
|
inline SubTableSubsetWrapper (const TSubTable &subtable_,
|
||||||
|
unsigned int lookup_type_) :
|
||||||
|
subtable (subtable_),
|
||||||
|
lookup_type (lookup_type_) {}
|
||||||
|
|
||||||
|
inline bool subset (hb_subset_context_t *c) const
|
||||||
|
{ return subtable.dispatch (c, lookup_type); }
|
||||||
|
|
||||||
|
private:
|
||||||
|
const TSubTable &subtable;
|
||||||
|
unsigned int lookup_type;
|
||||||
|
};
|
||||||
|
|
||||||
template <typename TSubTable>
|
template <typename TSubTable>
|
||||||
inline bool subset (hb_subset_context_t *c) const
|
inline bool subset (hb_subset_context_t *c) const
|
||||||
{
|
{
|
||||||
|
@ -717,20 +734,7 @@ struct Lookup
|
||||||
unsigned int count = subTable.len;
|
unsigned int count = subTable.len;
|
||||||
for (unsigned int i = 0; i < count; i++)
|
for (unsigned int i = 0; i < count; i++)
|
||||||
{
|
{
|
||||||
struct Wrapper
|
SubTableSubsetWrapper<TSubTable> wrapper (this+subtables[i], get_type ());
|
||||||
{
|
|
||||||
inline Wrapper (const TSubTable &subtable_,
|
|
||||||
unsigned int lookup_type_) :
|
|
||||||
subtable (subtable_),
|
|
||||||
lookup_type (lookup_type_) {}
|
|
||||||
|
|
||||||
inline bool subset (hb_subset_context_t *c) const
|
|
||||||
{ return subtable.dispatch (c, lookup_type); }
|
|
||||||
|
|
||||||
private:
|
|
||||||
const TSubTable &subtable;
|
|
||||||
unsigned int lookup_type;
|
|
||||||
} wrapper (this+subtables[i], get_type ());
|
|
||||||
|
|
||||||
out_subtables[i].serialize_subset (c, wrapper, out);
|
out_subtables[i].serialize_subset (c, wrapper, out);
|
||||||
}
|
}
|
||||||
|
|
|
@ -53,6 +53,9 @@ _plan_estimate_subset_table_size (hb_subset_plan_t *plan,
|
||||||
unsigned int src_glyphs = plan->source->get_num_glyphs ();
|
unsigned int src_glyphs = plan->source->get_num_glyphs ();
|
||||||
unsigned int dst_glyphs = plan->glyphset->get_population ();
|
unsigned int dst_glyphs = plan->glyphset->get_population ();
|
||||||
|
|
||||||
|
if (unlikely (!src_glyphs))
|
||||||
|
return 512 + table_len;
|
||||||
|
|
||||||
return 512 + (unsigned int) (table_len * sqrt ((double) dst_glyphs / src_glyphs));
|
return 512 + (unsigned int) (table_len * sqrt ((double) dst_glyphs / src_glyphs));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue