Prototype glyph flag safe-to-kashida
Fixes https://github.com/harfbuzz/harfbuzz/issues/3721
This commit is contained in:
parent
149b030520
commit
915e12ccbb
|
@ -151,8 +151,9 @@ typedef struct hb_glyph_info_t {
|
||||||
typedef enum { /*< flags >*/
|
typedef enum { /*< flags >*/
|
||||||
HB_GLYPH_FLAG_UNSAFE_TO_BREAK = 0x00000001,
|
HB_GLYPH_FLAG_UNSAFE_TO_BREAK = 0x00000001,
|
||||||
HB_GLYPH_FLAG_UNSAFE_TO_CONCAT = 0x00000002,
|
HB_GLYPH_FLAG_UNSAFE_TO_CONCAT = 0x00000002,
|
||||||
|
HB_GLYPH_FLAG_SAFE_TO_INSERT_KASHIDA = 0x00000004,
|
||||||
|
|
||||||
HB_GLYPH_FLAG_DEFINED = 0x00000003 /* OR of all defined flags */
|
HB_GLYPH_FLAG_DEFINED = 0x00000007 /* OR of all defined flags */
|
||||||
} hb_glyph_flags_t;
|
} hb_glyph_flags_t;
|
||||||
|
|
||||||
HB_EXTERN hb_glyph_flags_t
|
HB_EXTERN hb_glyph_flags_t
|
||||||
|
|
|
@ -462,6 +462,12 @@ struct hb_buffer_t
|
||||||
start, end,
|
start, end,
|
||||||
true);
|
true);
|
||||||
}
|
}
|
||||||
|
void safe_to_insert_kashida (unsigned int start = 0, unsigned int end = -1)
|
||||||
|
{
|
||||||
|
_set_glyph_flags (HB_GLYPH_FLAG_SAFE_TO_INSERT_KASHIDA,
|
||||||
|
start, end,
|
||||||
|
true);
|
||||||
|
}
|
||||||
void unsafe_to_concat (unsigned int start = 0, unsigned int end = -1)
|
void unsafe_to_concat (unsigned int start = 0, unsigned int end = -1)
|
||||||
{
|
{
|
||||||
if (likely ((flags & HB_BUFFER_FLAG_PRODUCE_UNSAFE_TO_CONCAT) == 0))
|
if (likely ((flags & HB_BUFFER_FLAG_PRODUCE_UNSAFE_TO_CONCAT) == 0))
|
||||||
|
|
|
@ -1148,9 +1148,15 @@ hb_propagate_flags (hb_buffer_t *buffer)
|
||||||
unsigned int mask = 0;
|
unsigned int mask = 0;
|
||||||
for (unsigned int i = start; i < end; i++)
|
for (unsigned int i = start; i < end; i++)
|
||||||
mask |= info[i].mask & HB_GLYPH_FLAG_DEFINED;
|
mask |= info[i].mask & HB_GLYPH_FLAG_DEFINED;
|
||||||
|
|
||||||
|
if (mask & HB_GLYPH_FLAG_UNSAFE_TO_BREAK)
|
||||||
|
mask &= ~HB_GLYPH_FLAG_SAFE_TO_INSERT_KASHIDA;
|
||||||
|
if (mask & HB_GLYPH_FLAG_SAFE_TO_INSERT_KASHIDA)
|
||||||
|
mask |= HB_GLYPH_FLAG_UNSAFE_TO_BREAK | HB_GLYPH_FLAG_UNSAFE_TO_CONCAT;
|
||||||
|
|
||||||
if (mask)
|
if (mask)
|
||||||
for (unsigned int i = start; i < end; i++)
|
for (unsigned int i = start; i < end; i++)
|
||||||
info[i].mask |= mask;
|
info[i].mask = mask;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -331,7 +331,7 @@ arabic_joining (hb_buffer_t *buffer)
|
||||||
if (entry->prev_action != NONE && prev != UINT_MAX)
|
if (entry->prev_action != NONE && prev != UINT_MAX)
|
||||||
{
|
{
|
||||||
info[prev].arabic_shaping_action() = entry->prev_action;
|
info[prev].arabic_shaping_action() = entry->prev_action;
|
||||||
buffer->unsafe_to_break (prev, i + 1);
|
buffer->safe_to_insert_kashida (prev, i + 1);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -365,7 +365,7 @@ arabic_joining (hb_buffer_t *buffer)
|
||||||
if (entry->prev_action != NONE && prev != UINT_MAX)
|
if (entry->prev_action != NONE && prev != UINT_MAX)
|
||||||
{
|
{
|
||||||
info[prev].arabic_shaping_action() = entry->prev_action;
|
info[prev].arabic_shaping_action() = entry->prev_action;
|
||||||
buffer->unsafe_to_break (prev, buffer->len);
|
buffer->safe_to_insert_kashida (prev, buffer->len);
|
||||||
}
|
}
|
||||||
else if (2 <= state && state <= 5) /* States that have a possible prev_action. */
|
else if (2 <= state && state <= 5) /* States that have a possible prev_action. */
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue