calculate hb_string_array length automatically
This commit is contained in:
parent
57da16bc59
commit
a75983690d
@ -35,8 +35,6 @@
|
||||
#undef HB_STRING_ARRAY_LIST
|
||||
#undef HB_STRING_ARRAY_NAME
|
||||
|
||||
#define NUM_FORMAT1_NAMES 258
|
||||
|
||||
/*
|
||||
* post -- PostScript
|
||||
* https://docs.microsoft.com/en-us/typography/opentype/spec/post
|
||||
@ -185,7 +183,7 @@ struct post
|
||||
unsigned int get_glyph_count () const
|
||||
{
|
||||
if (version == 0x00010000)
|
||||
return NUM_FORMAT1_NAMES;
|
||||
return format1_names_length;
|
||||
|
||||
if (version == 0x00020000)
|
||||
return glyphNameIndex->len;
|
||||
@ -213,7 +211,7 @@ struct post
|
||||
{
|
||||
if (version == 0x00010000)
|
||||
{
|
||||
if (glyph >= NUM_FORMAT1_NAMES)
|
||||
if (glyph >= format1_names_length)
|
||||
return hb_bytes_t ();
|
||||
|
||||
return format1_names (glyph);
|
||||
@ -223,9 +221,9 @@ struct post
|
||||
return hb_bytes_t ();
|
||||
|
||||
unsigned int index = glyphNameIndex->arrayZ[glyph];
|
||||
if (index < NUM_FORMAT1_NAMES)
|
||||
if (index < format1_names_length)
|
||||
return format1_names (index);
|
||||
index -= NUM_FORMAT1_NAMES;
|
||||
index -= format1_names_length;
|
||||
|
||||
if (index >= index_to_offset.length)
|
||||
return hb_bytes_t ();
|
||||
|
@ -37,6 +37,7 @@
|
||||
#define HB_STRING_ARRAY_TYPE_NAME HB_PASTE(HB_STRING_ARRAY_NAME, _msgstr_t)
|
||||
#define HB_STRING_ARRAY_POOL_NAME HB_PASTE(HB_STRING_ARRAY_NAME, _msgstr)
|
||||
#define HB_STRING_ARRAY_OFFS_NAME HB_PASTE(HB_STRING_ARRAY_NAME, _msgidx)
|
||||
#define HB_STRING_ARRAY_LENG_NAME HB_PASTE(HB_STRING_ARRAY_NAME, _length)
|
||||
|
||||
static const union HB_STRING_ARRAY_TYPE_NAME {
|
||||
struct {
|
||||
@ -66,6 +67,8 @@ static const unsigned int HB_STRING_ARRAY_OFFS_NAME[] =
|
||||
sizeof (HB_STRING_ARRAY_TYPE_NAME)
|
||||
};
|
||||
|
||||
static const unsigned int HB_STRING_ARRAY_LENG_NAME = ARRAY_LENGTH (HB_STRING_ARRAY_OFFS_NAME) - 1;
|
||||
|
||||
static inline hb_bytes_t
|
||||
HB_STRING_ARRAY_NAME (unsigned int i)
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user