Towards normalization
This commit is contained in:
parent
ad903e66b1
commit
5c6f5982d7
|
@ -28,31 +28,40 @@
|
||||||
|
|
||||||
HB_BEGIN_DECLS
|
HB_BEGIN_DECLS
|
||||||
|
|
||||||
static void
|
static bool
|
||||||
|
get_glyph (hb_ot_shape_context_t *c, unsigned int i)
|
||||||
|
{
|
||||||
|
hb_buffer_t *b = c->buffer;
|
||||||
|
|
||||||
|
return hb_font_get_glyph (c->font, b->info[i].codepoint, 0, &b->info[i].intermittent_glyph());
|
||||||
|
}
|
||||||
|
|
||||||
|
static bool
|
||||||
handle_single_char_cluster (hb_ot_shape_context_t *c,
|
handle_single_char_cluster (hb_ot_shape_context_t *c,
|
||||||
unsigned int i)
|
unsigned int i)
|
||||||
{
|
{
|
||||||
hb_buffer_t *b = c->buffer;
|
if (get_glyph (c, i))
|
||||||
hb_codepoint_t glyph;
|
return FALSE;
|
||||||
|
|
||||||
if (hb_font_get_glyph (c->font, b->info[i].codepoint, 0, &glyph))
|
|
||||||
return;
|
|
||||||
|
|
||||||
/* Decompose */
|
/* Decompose */
|
||||||
|
|
||||||
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static bool
|
||||||
handle_multi_char_cluster (hb_ot_shape_context_t *c,
|
handle_multi_char_cluster (hb_ot_shape_context_t *c,
|
||||||
unsigned int i,
|
unsigned int i,
|
||||||
unsigned int end)
|
unsigned int end)
|
||||||
{
|
{
|
||||||
/* If there's a variation-selector, give-up, it's just too hard. */
|
/* If there's a variation-selector, give-up, it's just too hard. */
|
||||||
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
bool
|
||||||
_hb_normalize (hb_ot_shape_context_t *c)
|
_hb_normalize (hb_ot_shape_context_t *c)
|
||||||
{
|
{
|
||||||
hb_buffer_t *b = c->buffer;
|
hb_buffer_t *b = c->buffer;
|
||||||
|
bool changed = FALSE;
|
||||||
|
|
||||||
unsigned int count = b->len;
|
unsigned int count = b->len;
|
||||||
for (unsigned int i = 0; i < count;) {
|
for (unsigned int i = 0; i < count;) {
|
||||||
|
@ -61,11 +70,13 @@ _hb_normalize (hb_ot_shape_context_t *c)
|
||||||
if (b->info[i].cluster != b->info[end].cluster)
|
if (b->info[i].cluster != b->info[end].cluster)
|
||||||
break;
|
break;
|
||||||
if (i + 1 == end)
|
if (i + 1 == end)
|
||||||
handle_single_char_cluster (c, i);
|
changed |= handle_single_char_cluster (c, i);
|
||||||
else
|
else
|
||||||
handle_multi_char_cluster (c, i, end);
|
changed |= handle_multi_char_cluster (c, i, end);
|
||||||
i = end;
|
i = end;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return changed;
|
||||||
}
|
}
|
||||||
|
|
||||||
HB_END_DECLS
|
HB_END_DECLS
|
||||||
|
|
|
@ -100,8 +100,9 @@ is_variation_selector (hb_codepoint_t unicode)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
HB_INTERNAL void _hb_normalize (hb_ot_shape_context_t *c);
|
HB_INTERNAL bool _hb_normalize (hb_ot_shape_context_t *c);
|
||||||
|
|
||||||
|
#define intermittent_glyph() var2.u32
|
||||||
|
|
||||||
HB_END_DECLS
|
HB_END_DECLS
|
||||||
|
|
||||||
|
|
|
@ -365,7 +365,9 @@ hb_ot_shape_execute_internal (hb_ot_shape_context_t *c)
|
||||||
|
|
||||||
hb_ensure_native_direction (c);
|
hb_ensure_native_direction (c);
|
||||||
|
|
||||||
_hb_normalize (c);
|
if (_hb_normalize (c))
|
||||||
|
/* Buffer contents changed, reset unicode_props */
|
||||||
|
hb_set_unicode_props (c); /* BUFFER: Set general_category and combining_class in var1 */
|
||||||
|
|
||||||
hb_ot_shape_setup_masks (c); /* BUFFER: Clobbers var2 */
|
hb_ot_shape_setup_masks (c); /* BUFFER: Clobbers var2 */
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue