Add fast-path for GPOS too
Shaves another 3% for DejaVu Sans long Latin strings.
This commit is contained in:
parent
993c51915f
commit
4e766ff28d
|
@ -1311,6 +1311,15 @@ struct PosLookupSubTable
|
||||||
inline bool apply (hb_apply_context_t *c, unsigned int lookup_type) const
|
inline bool apply (hb_apply_context_t *c, unsigned int lookup_type) const
|
||||||
{
|
{
|
||||||
TRACE_APPLY ();
|
TRACE_APPLY ();
|
||||||
|
if (likely (lookup_type < Context) ||
|
||||||
|
(hb_in_range<unsigned int> (lookup_type, Context, ChainContext) &&
|
||||||
|
hb_in_range<unsigned int> (u.header.sub_format, 1, 2)))
|
||||||
|
{
|
||||||
|
/* Fast path, for most that have coverage in the same place. */
|
||||||
|
hb_codepoint_t glyph_id = c->buffer->cur().codepoint;
|
||||||
|
unsigned int index = (this+u.header.coverage) (glyph_id);
|
||||||
|
if (likely (index == NOT_COVERED)) return TRACE_RETURN (false);
|
||||||
|
}
|
||||||
switch (lookup_type) {
|
switch (lookup_type) {
|
||||||
case Single: return TRACE_RETURN (u.single.apply (c));
|
case Single: return TRACE_RETURN (u.single.apply (c));
|
||||||
case Pair: return TRACE_RETURN (u.pair.apply (c));
|
case Pair: return TRACE_RETURN (u.pair.apply (c));
|
||||||
|
@ -1343,7 +1352,10 @@ struct PosLookupSubTable
|
||||||
|
|
||||||
private:
|
private:
|
||||||
union {
|
union {
|
||||||
|
struct {
|
||||||
USHORT sub_format;
|
USHORT sub_format;
|
||||||
|
OffsetTo<Coverage> coverage;
|
||||||
|
} header;
|
||||||
SinglePos single;
|
SinglePos single;
|
||||||
PairPos pair;
|
PairPos pair;
|
||||||
CursivePos cursive;
|
CursivePos cursive;
|
||||||
|
@ -1355,7 +1367,7 @@ struct PosLookupSubTable
|
||||||
ExtensionPos extension;
|
ExtensionPos extension;
|
||||||
} u;
|
} u;
|
||||||
public:
|
public:
|
||||||
DEFINE_SIZE_UNION (2, sub_format);
|
DEFINE_SIZE_UNION (2, header.sub_format);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue