mirror of
git://git.sv.gnu.org/emacs.git
synced 2026-01-24 05:22:04 -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;
|
int nrows;
|
||||||
dispatch_queue_t queue;
|
dispatch_queue_t queue;
|
||||||
dispatch_group_t group = NULL;
|
dispatch_group_t group = NULL;
|
||||||
|
int nkeys;
|
||||||
|
|
||||||
if (row != 0)
|
if (row != 0)
|
||||||
{
|
{
|
||||||
|
|
@ -1479,23 +1480,16 @@ macfont_get_glyph_for_character (struct font *font, UTF32Char c)
|
||||||
return glyph;
|
return glyph;
|
||||||
}
|
}
|
||||||
|
|
||||||
queue =
|
nkeys = nkeys_or_perm;
|
||||||
dispatch_get_global_queue (DISPATCH_QUEUE_PRIORITY_DEFAULT, 0);
|
for (key = row * (256 / NGLYPHS_IN_VALUE); ; key++)
|
||||||
group = dispatch_group_create ();
|
if (CFDictionaryContainsKey (dictionary,
|
||||||
dispatch_group_async (group, queue, ^{
|
(const void *) key))
|
||||||
int nkeys;
|
{
|
||||||
uintptr_t key;
|
CFDictionaryRemoveValue (dictionary,
|
||||||
nkeys = nkeys_or_perm;
|
(const void *) key);
|
||||||
for (key = row * (256 / NGLYPHS_IN_VALUE); ; key++)
|
if (--nkeys == 0)
|
||||||
if (CFDictionaryContainsKey (dictionary,
|
break;
|
||||||
(const void *) key))
|
}
|
||||||
{
|
|
||||||
CFDictionaryRemoveValue (dictionary,
|
|
||||||
(const void *) key);
|
|
||||||
if (--nkeys == 0)
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
len = 0;
|
len = 0;
|
||||||
|
|
@ -1535,12 +1529,6 @@ macfont_get_glyph_for_character (struct font *font, UTF32Char c)
|
||||||
sizeof (CGGlyph *) * nrows);
|
sizeof (CGGlyph *) * nrows);
|
||||||
cache->glyph.matrix[nrows - 1] = glyphs;
|
cache->glyph.matrix[nrows - 1] = glyphs;
|
||||||
cache->glyph.nrows = nrows;
|
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];
|
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;
|
struct variation_selector_record *records = uvs->variation_selector_records;
|
||||||
CFIndex i;
|
CFIndex i;
|
||||||
UInt32 ir, nrecords;
|
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);
|
nrecords = BUINT32_VALUE (uvs->num_var_selector_records);
|
||||||
i = 0;
|
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);
|
default_uvs_offset = BUINT32_VALUE (records[ir].default_uvs_offset);
|
||||||
non_default_uvs_offset =
|
non_default_uvs_offset =
|
||||||
BUINT32_VALUE (records[ir].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 =
|
UInt32 mid = (lo + hi) / 2;
|
||||||
(struct default_uvs_table *) ((UInt8 *) uvs
|
|
||||||
+ default_uvs_offset);
|
|
||||||
struct unicode_value_range *ranges =
|
|
||||||
default_uvs->unicode_value_ranges;
|
|
||||||
UInt32 lo, hi;
|
|
||||||
|
|
||||||
lo = 0;
|
if (c < BUINT24_VALUE (ranges[mid].start_unicode_value))
|
||||||
hi = BUINT32_VALUE (default_uvs->num_unicode_value_ranges);
|
hi = mid;
|
||||||
while (lo < hi)
|
else
|
||||||
{
|
lo = mid + 1;
|
||||||
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 (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 =
|
UInt32 mid = (lo + hi) / 2;
|
||||||
(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;
|
if (c < BUINT24_VALUE (mappings[mid].unicode_value))
|
||||||
hi = BUINT32_VALUE (non_default_uvs->num_uvs_mappings);
|
hi = mid;
|
||||||
while (lo < hi)
|
else
|
||||||
{
|
lo = mid + 1;
|
||||||
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 (hi > 0 &&
|
||||||
|
BUINT24_VALUE (mappings[hi - 1].unicode_value) == c)
|
||||||
|
glyphs[i] = BUINT16_VALUE (mappings[hi - 1].glyph_id);
|
||||||
|
}
|
||||||
i++;
|
i++;
|
||||||
ir++;
|
ir++;
|
||||||
}
|
}
|
||||||
while (i < count)
|
while (i < count)
|
||||||
glyphs[i++] = kCGFontIndexInvalid;
|
glyphs[i++] = kCGFontIndexInvalid;
|
||||||
dispatch_group_wait (group, DISPATCH_TIME_FOREVER);
|
|
||||||
dispatch_release (group);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue