mirror of
https://github.com/storytold/harfbuzz.git
synced 2026-11-25 08:51:07 +01:00
[subset/loca] Rewrite loop faster
This commit is contained in:
1 parent
8dab444102
commit
b0d0babb2e
1 file changed
+7
-6
@@ -21,27 +21,28 @@ _write_loca (IteratorIn&& it,
|
||||
TypeOut *dest,
|
||||
unsigned num_offsets)
|
||||
{
|
||||
unsigned num_glyphs = num_offsets - 1;
|
||||
unsigned right_shift = short_offsets ? 1 : 0;
|
||||
unsigned offset = 0;
|
||||
TypeOut value;
|
||||
value = 0;
|
||||
*dest++ = value;
|
||||
for (hb_codepoint_t i = 0, j = 0; i < num_glyphs; i++)
|
||||
hb_codepoint_t last = 0;
|
||||
for (auto _ : new_to_old_gid_list)
|
||||
{
|
||||
if (i != new_to_old_gid_list[j].first)
|
||||
hb_codepoint_t gid = _.first;
|
||||
for (; last < gid; last++)
|
||||
{
|
||||
DEBUG_MSG (SUBSET, nullptr, "loca entry empty offset %u", offset);
|
||||
*dest++ = value;
|
||||
continue;
|
||||
}
|
||||
|
||||
j++;
|
||||
unsigned padded_size = *it++;
|
||||
offset += padded_size;
|
||||
DEBUG_MSG (SUBSET, nullptr, "loca entry offset %u padded-size %u", offset, padded_size);
|
||||
DEBUG_MSG (SUBSET, nullptr, "loca entry gid %u offset %u padded-size %u", gid, offset, padded_size);
|
||||
value = offset >> right_shift;
|
||||
*dest++ = value;
|
||||
|
||||
last++; // Skip over gid
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user