mirror of
https://github.com/storytold/harfbuzz.git
synced 2026-11-19 05:51:05 +01:00
[shape] Limit syllable length (#6120)
Unbounded syllables can make the USE and Myanmar reordering passes perform quadratic work. Process syllables in configurable chunks of at most 64 glyphs to bound the work performed by each reordering pass. Fixes: https://github.com/harfbuzz/harfbuzz/issues/6118 Assisted-by: Codex <codex@openai.com>
This commit is contained in:
1 parent
c7ed9fe764
commit
12b686dad7
2 files changed
+6
-1
No files matched your search
@@ -58,6 +58,10 @@
|
||||
#define HB_MAX_CONTEXT_LENGTH 64
|
||||
#endif
|
||||
|
||||
#ifndef HB_MAX_SYLLABLE_LENGTH
|
||||
#define HB_MAX_SYLLABLE_LENGTH 64
|
||||
#endif
|
||||
|
||||
#ifndef HB_CLOSURE_MAX_STAGES
|
||||
/*
|
||||
* The maximum number of times a lookup can be applied during shaping.
|
||||
|
||||
+2
-1
@@ -159,7 +159,8 @@ static inline unsigned int
|
||||
_hb_next_syllable (hb_buffer_t *buffer, unsigned int start)
|
||||
{
|
||||
hb_glyph_info_t *info = buffer->info;
|
||||
unsigned int count = buffer->len;
|
||||
unsigned int count = start + hb_min (buffer->len - start,
|
||||
(unsigned) HB_MAX_SYLLABLE_LENGTH);
|
||||
|
||||
unsigned int syllable = info[start].syllable();
|
||||
while (++start < count && syllable == info[start].syllable())
|
||||
|
||||
Reference in new issue
Block a user