[aat] Update glyph properties from GDEF if available when doing a replacement.
This commit is contained in:
parent
5e0ec33b3d
commit
4f1e8d2bf7
|
@ -30,6 +30,9 @@
|
||||||
#include "hb-aat-layout.hh"
|
#include "hb-aat-layout.hh"
|
||||||
#include "hb-open-type.hh"
|
#include "hb-open-type.hh"
|
||||||
|
|
||||||
|
namespace OT {
|
||||||
|
struct GDEF;
|
||||||
|
};
|
||||||
|
|
||||||
namespace AAT {
|
namespace AAT {
|
||||||
|
|
||||||
|
@ -863,6 +866,7 @@ struct hb_aat_apply_context_t :
|
||||||
hb_buffer_t *buffer;
|
hb_buffer_t *buffer;
|
||||||
hb_sanitize_context_t sanitizer;
|
hb_sanitize_context_t sanitizer;
|
||||||
const ankr *ankr_table;
|
const ankr *ankr_table;
|
||||||
|
const OT::GDEF *gdef_table;
|
||||||
|
|
||||||
/* Unused. For debug tracing only. */
|
/* Unused. For debug tracing only. */
|
||||||
unsigned int lookup_index;
|
unsigned int lookup_index;
|
||||||
|
|
|
@ -30,6 +30,7 @@
|
||||||
#include "hb-open-type.hh"
|
#include "hb-open-type.hh"
|
||||||
#include "hb-aat-layout-common.hh"
|
#include "hb-aat-layout-common.hh"
|
||||||
#include "hb-ot-layout-common.hh"
|
#include "hb-ot-layout-common.hh"
|
||||||
|
#include "hb-ot-layout-gdef-table.hh"
|
||||||
#include "hb-aat-map.hh"
|
#include "hb-aat-map.hh"
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -215,7 +216,9 @@ struct ContextualSubtable
|
||||||
hb_aat_apply_context_t *c_) :
|
hb_aat_apply_context_t *c_) :
|
||||||
ret (false),
|
ret (false),
|
||||||
c (c_),
|
c (c_),
|
||||||
|
gdef (*c->gdef_table),
|
||||||
mark_set (false),
|
mark_set (false),
|
||||||
|
has_glyph_classes (gdef.has_glyph_classes ()),
|
||||||
mark (0),
|
mark (0),
|
||||||
table (table_),
|
table (table_),
|
||||||
subs (table+table->substitutionTables) {}
|
subs (table+table->substitutionTables) {}
|
||||||
|
@ -263,6 +266,9 @@ struct ContextualSubtable
|
||||||
{
|
{
|
||||||
buffer->unsafe_to_break (mark, hb_min (buffer->idx + 1, buffer->len));
|
buffer->unsafe_to_break (mark, hb_min (buffer->idx + 1, buffer->len));
|
||||||
buffer->info[mark].codepoint = *replacement;
|
buffer->info[mark].codepoint = *replacement;
|
||||||
|
if (has_glyph_classes)
|
||||||
|
_hb_glyph_info_set_glyph_props (&buffer->info[mark],
|
||||||
|
gdef.get_glyph_props (*replacement));
|
||||||
ret = true;
|
ret = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -287,6 +293,9 @@ struct ContextualSubtable
|
||||||
if (replacement)
|
if (replacement)
|
||||||
{
|
{
|
||||||
buffer->info[idx].codepoint = *replacement;
|
buffer->info[idx].codepoint = *replacement;
|
||||||
|
if (has_glyph_classes)
|
||||||
|
_hb_glyph_info_set_glyph_props (&buffer->info[idx],
|
||||||
|
gdef.get_glyph_props (*replacement));
|
||||||
ret = true;
|
ret = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -301,7 +310,9 @@ struct ContextualSubtable
|
||||||
bool ret;
|
bool ret;
|
||||||
private:
|
private:
|
||||||
hb_aat_apply_context_t *c;
|
hb_aat_apply_context_t *c;
|
||||||
|
const OT::GDEF &gdef;
|
||||||
bool mark_set;
|
bool mark_set;
|
||||||
|
bool has_glyph_classes;
|
||||||
unsigned int mark;
|
unsigned int mark;
|
||||||
const ContextualSubtable *table;
|
const ContextualSubtable *table;
|
||||||
const UnsizedListOfOffset16To<Lookup<HBGlyphID>, HBUINT, false> &subs;
|
const UnsizedListOfOffset16To<Lookup<HBGlyphID>, HBUINT, false> &subs;
|
||||||
|
@ -599,6 +610,9 @@ struct NoncontextualSubtable
|
||||||
{
|
{
|
||||||
TRACE_APPLY (this);
|
TRACE_APPLY (this);
|
||||||
|
|
||||||
|
const OT::GDEF &gdef (*c->gdef_table);
|
||||||
|
bool has_glyph_classes = gdef.has_glyph_classes ();
|
||||||
|
|
||||||
bool ret = false;
|
bool ret = false;
|
||||||
unsigned int num_glyphs = c->face->get_num_glyphs ();
|
unsigned int num_glyphs = c->face->get_num_glyphs ();
|
||||||
|
|
||||||
|
@ -610,6 +624,9 @@ struct NoncontextualSubtable
|
||||||
if (replacement)
|
if (replacement)
|
||||||
{
|
{
|
||||||
info[i].codepoint = *replacement;
|
info[i].codepoint = *replacement;
|
||||||
|
if (has_glyph_classes)
|
||||||
|
_hb_glyph_info_set_glyph_props (&info[i],
|
||||||
|
gdef.get_glyph_props (*replacement));
|
||||||
ret = true;
|
ret = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -55,6 +55,7 @@ AAT::hb_aat_apply_context_t::hb_aat_apply_context_t (const hb_ot_shape_plan_t *p
|
||||||
buffer (buffer_),
|
buffer (buffer_),
|
||||||
sanitizer (),
|
sanitizer (),
|
||||||
ankr_table (&Null (AAT::ankr)),
|
ankr_table (&Null (AAT::ankr)),
|
||||||
|
gdef_table (face->table.GDEF->table),
|
||||||
lookup_index (0)
|
lookup_index (0)
|
||||||
{
|
{
|
||||||
sanitizer.init (blob);
|
sanitizer.init (blob);
|
||||||
|
|
Loading…
Reference in New Issue