mirror of
git://git.sv.gnu.org/emacs.git
synced 2026-01-13 06:50:39 -08:00
Remove ObjC blocks (Bug#23753)
* src/macfont.m (macfont_get_glyph_for_character):
(mac_font_get_glyphs_for_variants): Inline Objective-C blocks.
(cherry picked from commit 4590f1d768)
This commit is contained in:
parent
b0369d0536
commit
45099bb90f
1 changed files with 55 additions and 73 deletions
128
src/macfont.m
128
src/macfont.m
|
|
@ -1443,6 +1443,7 @@ macfont_get_glyph_for_character (struct font *font, UTF32Char c)
|
|||
int nrows;
|
||||
dispatch_queue_t queue;
|
||||
dispatch_group_t group = NULL;
|
||||
int nkeys;
|
||||
|
||||
if (row != 0)
|
||||
{
|
||||
|
|
@ -1479,23 +1480,16 @@ macfont_get_glyph_for_character (struct font *font, UTF32Char c)
|
|||
return glyph;
|
||||
}
|
||||
|
||||
queue =
|
||||
dispatch_get_global_queue (DISPATCH_QUEUE_PRIORITY_DEFAULT, 0);
|
||||
group = dispatch_group_create ();
|
||||
dispatch_group_async (group, queue, ^{
|
||||
int nkeys;
|
||||
uintptr_t key;
|
||||
nkeys = nkeys_or_perm;
|
||||
for (key = row * (256 / NGLYPHS_IN_VALUE); ; key++)
|
||||
if (CFDictionaryContainsKey (dictionary,
|
||||
(const void *) key))
|
||||
{
|
||||
CFDictionaryRemoveValue (dictionary,
|
||||
(const void *) key);
|
||||
if (--nkeys == 0)
|
||||
break;
|
||||
}
|
||||
});
|
||||
nkeys = nkeys_or_perm;
|
||||
for (key = row * (256 / NGLYPHS_IN_VALUE); ; key++)
|
||||
if (CFDictionaryContainsKey (dictionary,
|
||||
(const void *) key))
|
||||
{
|
||||
CFDictionaryRemoveValue (dictionary,
|
||||
(const void *) key);
|
||||
if (--nkeys == 0)
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
len = 0;
|
||||
|
|
@ -1535,12 +1529,6 @@ macfont_get_glyph_for_character (struct font *font, UTF32Char c)
|
|||
sizeof (CGGlyph *) * nrows);
|
||||
cache->glyph.matrix[nrows - 1] = glyphs;
|
||||
cache->glyph.nrows = nrows;
|
||||
|
||||
if (group)
|
||||
{
|
||||
dispatch_group_wait (group, DISPATCH_TIME_FOREVER);
|
||||
dispatch_release (group);
|
||||
}
|
||||
}
|
||||
|
||||
return cache->glyph.matrix[nkeys_or_perm - ROW_PERM_OFFSET][c % 256];
|
||||
|
|
@ -3267,9 +3255,6 @@ mac_font_get_glyphs_for_variants (CFDataRef uvs_table, UTF32Char c,
|
|||
struct variation_selector_record *records = uvs->variation_selector_records;
|
||||
CFIndex i;
|
||||
UInt32 ir, nrecords;
|
||||
dispatch_queue_t queue =
|
||||
dispatch_get_global_queue (DISPATCH_QUEUE_PRIORITY_DEFAULT, 0);
|
||||
dispatch_group_t group = dispatch_group_create ();
|
||||
|
||||
nrecords = BUINT32_VALUE (uvs->num_var_selector_records);
|
||||
i = 0;
|
||||
|
|
@ -3293,66 +3278,63 @@ mac_font_get_glyphs_for_variants (CFDataRef uvs_table, UTF32Char c,
|
|||
default_uvs_offset = BUINT32_VALUE (records[ir].default_uvs_offset);
|
||||
non_default_uvs_offset =
|
||||
BUINT32_VALUE (records[ir].non_default_uvs_offset);
|
||||
dispatch_group_async (group, queue, ^{
|
||||
glyphs[i] = kCGFontIndexInvalid;
|
||||
|
||||
if (default_uvs_offset)
|
||||
glyphs[i] = kCGFontIndexInvalid;
|
||||
|
||||
if (default_uvs_offset)
|
||||
{
|
||||
struct default_uvs_table *default_uvs =
|
||||
(struct default_uvs_table *) ((UInt8 *) uvs
|
||||
+ default_uvs_offset);
|
||||
struct unicode_value_range *ranges =
|
||||
default_uvs->unicode_value_ranges;
|
||||
UInt32 lo, hi;
|
||||
|
||||
lo = 0;
|
||||
hi = BUINT32_VALUE (default_uvs->num_unicode_value_ranges);
|
||||
while (lo < hi)
|
||||
{
|
||||
struct default_uvs_table *default_uvs =
|
||||
(struct default_uvs_table *) ((UInt8 *) uvs
|
||||
+ default_uvs_offset);
|
||||
struct unicode_value_range *ranges =
|
||||
default_uvs->unicode_value_ranges;
|
||||
UInt32 lo, hi;
|
||||
UInt32 mid = (lo + hi) / 2;
|
||||
|
||||
lo = 0;
|
||||
hi = BUINT32_VALUE (default_uvs->num_unicode_value_ranges);
|
||||
while (lo < hi)
|
||||
{
|
||||
UInt32 mid = (lo + hi) / 2;
|
||||
|
||||
if (c < BUINT24_VALUE (ranges[mid].start_unicode_value))
|
||||
hi = mid;
|
||||
else
|
||||
lo = mid + 1;
|
||||
}
|
||||
if (hi > 0
|
||||
&& (c <= (BUINT24_VALUE (ranges[hi - 1].start_unicode_value)
|
||||
+ BUINT8_VALUE (ranges[hi - 1].additional_count))))
|
||||
glyphs[i] = 0;
|
||||
if (c < BUINT24_VALUE (ranges[mid].start_unicode_value))
|
||||
hi = mid;
|
||||
else
|
||||
lo = mid + 1;
|
||||
}
|
||||
if (hi > 0
|
||||
&& (c <= (BUINT24_VALUE (ranges[hi - 1].start_unicode_value)
|
||||
+ BUINT8_VALUE (ranges[hi - 1].additional_count))))
|
||||
glyphs[i] = 0;
|
||||
}
|
||||
|
||||
if (glyphs[i] == kCGFontIndexInvalid && non_default_uvs_offset)
|
||||
if (glyphs[i] == kCGFontIndexInvalid && non_default_uvs_offset)
|
||||
{
|
||||
struct non_default_uvs_table *non_default_uvs =
|
||||
(struct non_default_uvs_table *) ((UInt8 *) uvs
|
||||
+ non_default_uvs_offset);
|
||||
struct uvs_mapping *mappings = non_default_uvs->uvs_mappings;
|
||||
UInt32 lo, hi;
|
||||
|
||||
lo = 0;
|
||||
hi = BUINT32_VALUE (non_default_uvs->num_uvs_mappings);
|
||||
while (lo < hi)
|
||||
{
|
||||
struct non_default_uvs_table *non_default_uvs =
|
||||
(struct non_default_uvs_table *) ((UInt8 *) uvs
|
||||
+ non_default_uvs_offset);
|
||||
struct uvs_mapping *mappings = non_default_uvs->uvs_mappings;
|
||||
UInt32 lo, hi;
|
||||
UInt32 mid = (lo + hi) / 2;
|
||||
|
||||
lo = 0;
|
||||
hi = BUINT32_VALUE (non_default_uvs->num_uvs_mappings);
|
||||
while (lo < hi)
|
||||
{
|
||||
UInt32 mid = (lo + hi) / 2;
|
||||
|
||||
if (c < BUINT24_VALUE (mappings[mid].unicode_value))
|
||||
hi = mid;
|
||||
else
|
||||
lo = mid + 1;
|
||||
}
|
||||
if (hi > 0 &&
|
||||
BUINT24_VALUE (mappings[hi - 1].unicode_value) == c)
|
||||
glyphs[i] = BUINT16_VALUE (mappings[hi - 1].glyph_id);
|
||||
if (c < BUINT24_VALUE (mappings[mid].unicode_value))
|
||||
hi = mid;
|
||||
else
|
||||
lo = mid + 1;
|
||||
}
|
||||
});
|
||||
if (hi > 0 &&
|
||||
BUINT24_VALUE (mappings[hi - 1].unicode_value) == c)
|
||||
glyphs[i] = BUINT16_VALUE (mappings[hi - 1].glyph_id);
|
||||
}
|
||||
i++;
|
||||
ir++;
|
||||
}
|
||||
while (i < count)
|
||||
glyphs[i++] = kCGFontIndexInvalid;
|
||||
dispatch_group_wait (group, DISPATCH_TIME_FOREVER);
|
||||
dispatch_release (group);
|
||||
}
|
||||
|
||||
static int
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue