[os2] Minor rename/shuffle
This commit is contained in:
parent
7a1ab0464d
commit
1dc601b04a
|
@ -13,7 +13,7 @@ import sys
|
||||||
reload(sys)
|
reload(sys)
|
||||||
sys.setdefaultencoding('utf-8')
|
sys.setdefaultencoding('utf-8')
|
||||||
|
|
||||||
print ("""static Range os2UnicodeRangesSorted[] =
|
print ("""static OS2Range _hb_os2_unicode_ranges[] =
|
||||||
{""")
|
{""")
|
||||||
|
|
||||||
args = sys.argv[1:]
|
args = sys.argv[1:]
|
|
@ -31,14 +31,29 @@
|
||||||
|
|
||||||
namespace OT {
|
namespace OT {
|
||||||
|
|
||||||
struct Range {
|
struct OS2Range
|
||||||
|
{
|
||||||
|
static int
|
||||||
|
cmp (const void *_key, const void *_item, void *_arg)
|
||||||
|
{
|
||||||
|
hb_codepoint_t cp = *((hb_codepoint_t *) _key);
|
||||||
|
const OS2Range *range = (OS2Range *) _item;
|
||||||
|
|
||||||
|
if (cp < range->start)
|
||||||
|
return -1;
|
||||||
|
else if (cp <= range->end)
|
||||||
|
return 0;
|
||||||
|
else
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
hb_codepoint_t start;
|
hb_codepoint_t start;
|
||||||
hb_codepoint_t end;
|
hb_codepoint_t end;
|
||||||
unsigned int bit;
|
unsigned int bit;
|
||||||
};
|
};
|
||||||
|
|
||||||
/* Note: The contents of this array was generated using src/gen-unicode-ranges.py. */
|
/* Note: The contents of this array was generated using gen-os2-unicode-ranges.py. */
|
||||||
static Range os2UnicodeRangesSorted[] =
|
static OS2Range _hb_os2_unicode_ranges[] =
|
||||||
{
|
{
|
||||||
{ 0x0, 0x7F, 0}, // Basic Latin
|
{ 0x0, 0x7F, 0}, // Basic Latin
|
||||||
{ 0x80, 0xFF, 1}, // Latin-1 Supplement
|
{ 0x80, 0xFF, 1}, // Latin-1 Supplement
|
||||||
|
@ -211,31 +226,17 @@ static Range os2UnicodeRangesSorted[] =
|
||||||
{0x100000, 0x10FFFD, 90}, // Private Use (plane 16)
|
{0x100000, 0x10FFFD, 90}, // Private Use (plane 16)
|
||||||
};
|
};
|
||||||
|
|
||||||
static int
|
|
||||||
_compare_range (const void *_key, const void *_item, void *_arg)
|
|
||||||
{
|
|
||||||
hb_codepoint_t cp = *((hb_codepoint_t *) _key);
|
|
||||||
const Range *range = (Range *) _item;
|
|
||||||
|
|
||||||
if (cp < range->start)
|
|
||||||
return -1;
|
|
||||||
else if (cp <= range->end)
|
|
||||||
return 0;
|
|
||||||
else
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* hb_get_unicode_range_bit:
|
* hb_get_unicode_range_bit:
|
||||||
* Returns the bit to be set in os/2 ulUnicodeRange for a given codepoint.
|
* Returns the bit to be set in os/2 ulUnicodeOS2Range for a given codepoint.
|
||||||
**/
|
**/
|
||||||
static unsigned int
|
static unsigned int
|
||||||
hb_get_unicode_range_bit (hb_codepoint_t cp)
|
hb_get_unicode_range_bit (hb_codepoint_t cp)
|
||||||
{
|
{
|
||||||
Range *range = (Range*) hb_bsearch_r (&cp, os2UnicodeRangesSorted,
|
OS2Range *range = (OS2Range*) hb_bsearch_r (&cp, _hb_os2_unicode_ranges,
|
||||||
sizeof (os2UnicodeRangesSorted) / sizeof(Range),
|
ARRAY_LENGTH (_hb_os2_unicode_ranges),
|
||||||
sizeof(Range),
|
sizeof (OS2Range),
|
||||||
_compare_range, nullptr);
|
OS2Range::cmp, nullptr);
|
||||||
if (range != nullptr)
|
if (range != nullptr)
|
||||||
return range->bit;
|
return range->bit;
|
||||||
return -1;
|
return -1;
|
||||||
|
|
Loading…
Reference in New Issue