mirror of
https://github.com/storytold/harfbuzz.git
synced 2026-11-22 07:21:06 +01:00
[shape] Use a buffer scratch flag for continuations (#5586)
Use it in form_clusters instead of ascii flag, for speedup.
This commit is contained in:
1 parent
52eb959535
commit
62ec647087
4 files changed
+11
-8
No files matched your search
@@ -52,6 +52,7 @@ enum hb_buffer_scratch_flags_t {
|
||||
HB_BUFFER_SCRATCH_FLAG_HAS_CGJ = 0x00000010u,
|
||||
HB_BUFFER_SCRATCH_FLAG_HAS_BROKEN_SYLLABLE = 0x00000020u,
|
||||
HB_BUFFER_SCRATCH_FLAG_HAS_VARIATION_SELECTOR_FALLBACK= 0x00000040u,
|
||||
HB_BUFFER_SCRATCH_FLAG_HAS_CONTINUATIONS = 0x00000080u,
|
||||
|
||||
/* Reserved for shapers' internal use. */
|
||||
HB_BUFFER_SCRATCH_FLAG_SHAPER0 = 0x01000000u,
|
||||
|
||||
+3
-1
@@ -247,6 +247,7 @@ _hb_glyph_info_set_unicode_props (hb_glyph_info_t *info, hb_buffer_t *buffer)
|
||||
|
||||
if (unlikely (HB_UNICODE_GENERAL_CATEGORY_IS_MARK (gen_cat)))
|
||||
{
|
||||
buffer->scratch_flags |= HB_BUFFER_SCRATCH_FLAG_HAS_CONTINUATIONS;
|
||||
props |= UPROPS_MASK_CONTINUATION;
|
||||
props |= unicode->modified_combining_class (u)<<8;
|
||||
}
|
||||
@@ -361,8 +362,9 @@ _hb_glyph_info_unhide (hb_glyph_info_t *info)
|
||||
}
|
||||
|
||||
static inline void
|
||||
_hb_glyph_info_set_continuation (hb_glyph_info_t *info)
|
||||
_hb_glyph_info_set_continuation (hb_glyph_info_t *info, hb_buffer_t *buffer)
|
||||
{
|
||||
buffer->scratch_flags |= HB_BUFFER_SCRATCH_FLAG_HAS_CONTINUATIONS;
|
||||
info->unicode_props() |= UPROPS_MASK_CONTINUATION;
|
||||
}
|
||||
static inline void
|
||||
|
||||
+6
-6
@@ -501,7 +501,7 @@ hb_set_unicode_props (hb_buffer_t *buffer)
|
||||
if (unlikely (gen_cat == HB_UNICODE_GENERAL_CATEGORY_MODIFIER_SYMBOL &&
|
||||
hb_in_range<hb_codepoint_t> (info[i].codepoint, 0x1F3FBu, 0x1F3FFu)))
|
||||
{
|
||||
_hb_glyph_info_set_continuation (&info[i]);
|
||||
_hb_glyph_info_set_continuation (&info[i], buffer);
|
||||
}
|
||||
/* Regional_Indicators are hairy as hell...
|
||||
* https://github.com/harfbuzz/harfbuzz/issues/2265 */
|
||||
@@ -509,18 +509,18 @@ hb_set_unicode_props (hb_buffer_t *buffer)
|
||||
{
|
||||
if (_hb_codepoint_is_regional_indicator (info[i - 1].codepoint) &&
|
||||
!_hb_glyph_info_is_continuation (&info[i - 1]))
|
||||
_hb_glyph_info_set_continuation (&info[i]);
|
||||
_hb_glyph_info_set_continuation (&info[i], buffer);
|
||||
}
|
||||
#ifndef HB_NO_EMOJI_SEQUENCES
|
||||
else if (unlikely (_hb_glyph_info_is_zwj (&info[i])))
|
||||
{
|
||||
_hb_glyph_info_set_continuation (&info[i]);
|
||||
_hb_glyph_info_set_continuation (&info[i], buffer);
|
||||
if (i + 1 < count &&
|
||||
_hb_unicode_is_emoji_Extended_Pictographic (info[i + 1].codepoint))
|
||||
{
|
||||
i++;
|
||||
_hb_glyph_info_set_unicode_props (&info[i], buffer);
|
||||
_hb_glyph_info_set_continuation (&info[i]);
|
||||
_hb_glyph_info_set_continuation (&info[i], buffer);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
@@ -539,7 +539,7 @@ hb_set_unicode_props (hb_buffer_t *buffer)
|
||||
* https://github.com/harfbuzz/harfbuzz/issues/3844
|
||||
*/
|
||||
else if (unlikely (hb_in_ranges<hb_codepoint_t> (info[i].codepoint, 0xFF9Eu, 0xFF9Fu, 0xE0020u, 0xE007Fu)))
|
||||
_hb_glyph_info_set_continuation (&info[i]);
|
||||
_hb_glyph_info_set_continuation (&info[i], buffer);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -575,7 +575,7 @@ hb_insert_dotted_circle (hb_buffer_t *buffer, hb_font_t *font)
|
||||
static void
|
||||
hb_form_clusters (hb_buffer_t *buffer)
|
||||
{
|
||||
if (!(buffer->scratch_flags & HB_BUFFER_SCRATCH_FLAG_HAS_NON_ASCII))
|
||||
if (!(buffer->scratch_flags & HB_BUFFER_SCRATCH_FLAG_HAS_CONTINUATIONS))
|
||||
return;
|
||||
|
||||
if (HB_BUFFER_CLUSTER_LEVEL_IS_GRAPHEMES (buffer->cluster_level))
|
||||
|
||||
@@ -334,7 +334,7 @@ preprocess_text_thai (const hb_ot_shape_plan_t *plan,
|
||||
|
||||
/* Is SARA AM. Decompose and reorder. */
|
||||
(void) buffer->output_glyph (NIKHAHIT_FROM_SARA_AM (u));
|
||||
_hb_glyph_info_set_continuation (&buffer->prev());
|
||||
_hb_glyph_info_set_continuation (&buffer->prev(), buffer);
|
||||
if (unlikely (!buffer->replace_glyph (SARA_AA_FROM_SARA_AM (u)))) break;
|
||||
|
||||
/* Make Nikhahit be recognized as a ccc=0 mark when zeroing widths. */
|
||||
|
||||
Reference in new issue
Block a user