[ot-shape] Rewrite loop without foreach_grapheme()

We were not using the graphemes, and that's costlier than just for().
This commit is contained in:
Behdad Esfahbod 2021-06-26 08:52:53 -06:00
parent eee7b459ee
commit 0969614865
1 changed files with 3 additions and 2 deletions

View File

@ -588,9 +588,10 @@ hb_ensure_native_direction (hb_buffer_t *buffer)
{
bool found_number = false, found_letter = false;
const auto* info = buffer->info;
foreach_grapheme (buffer, start, end)
const auto count = buffer->len;
for (unsigned i = 0; i < count; i++)
{
auto gc = _hb_glyph_info_get_general_category (&info[start]);
auto gc = _hb_glyph_info_get_general_category (&info[i]);
if (gc == HB_UNICODE_GENERAL_CATEGORY_DECIMAL_NUMBER)
found_number = true;
else if (HB_UNICODE_GENERAL_CATEGORY_IS_LETTER (gc))