[aat] Generate finegrained unsafe-to-break in state-machine!
Neato.
This commit is contained in:
parent
994eb7744c
commit
94644d7ea4
|
@ -57,16 +57,19 @@ struct RearrangementSubtable
|
||||||
unsigned int num_glyphs = c->face->get_num_glyphs ();
|
unsigned int num_glyphs = c->face->get_num_glyphs ();
|
||||||
|
|
||||||
unsigned int state = 0;
|
unsigned int state = 0;
|
||||||
|
unsigned int last_zero = 0;
|
||||||
|
unsigned int last_zero_before_start = 0;
|
||||||
unsigned int start = 0;
|
unsigned int start = 0;
|
||||||
unsigned int end = 0;
|
unsigned int end = 0;
|
||||||
|
|
||||||
hb_glyph_info_t *info = c->buffer->info;
|
hb_glyph_info_t *info = c->buffer->info;
|
||||||
unsigned int count = c->buffer->len;
|
unsigned int count = c->buffer->len;
|
||||||
|
|
||||||
c->buffer->unsafe_to_break (0, count); /* TODO Improve. */
|
|
||||||
|
|
||||||
for (unsigned int i = 0; i < count; i++)
|
for (unsigned int i = 0; i < count; i++)
|
||||||
{
|
{
|
||||||
|
if (!state)
|
||||||
|
last_zero = i;
|
||||||
|
|
||||||
unsigned int klass = machine.get_class (info[i].codepoint, num_glyphs);
|
unsigned int klass = machine.get_class (info[i].codepoint, num_glyphs);
|
||||||
const Entry<void> *entry = machine.get_entry (state, klass);
|
const Entry<void> *entry = machine.get_entry (state, klass);
|
||||||
if (unlikely (!entry))
|
if (unlikely (!entry))
|
||||||
|
@ -75,7 +78,10 @@ struct RearrangementSubtable
|
||||||
unsigned int flags = entry->flags;
|
unsigned int flags = entry->flags;
|
||||||
|
|
||||||
if (flags & MarkFirst)
|
if (flags & MarkFirst)
|
||||||
|
{
|
||||||
start = i;
|
start = i;
|
||||||
|
last_zero_before_start = last_zero;
|
||||||
|
}
|
||||||
|
|
||||||
if (flags & MarkLast)
|
if (flags & MarkLast)
|
||||||
end = i + 1;
|
end = i + 1;
|
||||||
|
@ -114,6 +120,7 @@ struct RearrangementSubtable
|
||||||
|
|
||||||
if (end - start >= l + r)
|
if (end - start >= l + r)
|
||||||
{
|
{
|
||||||
|
c->buffer->unsafe_to_break (last_zero_before_start, i + 1);
|
||||||
c->buffer->merge_clusters (start, end);
|
c->buffer->merge_clusters (start, end);
|
||||||
|
|
||||||
hb_glyph_info_t buf[4];
|
hb_glyph_info_t buf[4];
|
||||||
|
|
Loading…
Reference in New Issue