Add hb_array<>() specialization for UnsizedArrayOf
Related https://github.com/harfbuzz/harfbuzz/issues/1301
This commit is contained in:
parent
abfbba1911
commit
8d689f8a7b
|
@ -55,7 +55,7 @@ struct TrackTableEntry
|
||||||
unsigned int index,
|
unsigned int index,
|
||||||
unsigned int nSizes) const
|
unsigned int nSizes) const
|
||||||
{
|
{
|
||||||
return hb_array ((base+valuesZ).arrayZ, nSizes)[index];
|
return hb_array (base+valuesZ, nSizes)[index];
|
||||||
}
|
}
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
|
@ -330,7 +330,7 @@ struct ResourceTypeRecord
|
||||||
inline const ResourceRecord& get_resource_record (unsigned int i,
|
inline const ResourceRecord& get_resource_record (unsigned int i,
|
||||||
const void *type_base) const
|
const void *type_base) const
|
||||||
{
|
{
|
||||||
return hb_array ((type_base+resourcesZ).arrayZ, get_resource_count ())[i];
|
return hb_array (type_base+resourcesZ, get_resource_count ())[i];
|
||||||
}
|
}
|
||||||
|
|
||||||
inline bool sanitize (hb_sanitize_context_t *c,
|
inline bool sanitize (hb_sanitize_context_t *c,
|
||||||
|
|
|
@ -385,6 +385,14 @@ struct UnsizedArrayOf
|
||||||
public:
|
public:
|
||||||
DEFINE_SIZE_ARRAY (0, arrayZ);
|
DEFINE_SIZE_ARRAY (0, arrayZ);
|
||||||
};
|
};
|
||||||
|
} /* namespace OT */
|
||||||
|
template <typename T>
|
||||||
|
hb_array_t<T> hb_array (OT::UnsizedArrayOf<T> &array, unsigned int len)
|
||||||
|
{ return hb_array (array.arrayZ, len); }
|
||||||
|
template <typename T>
|
||||||
|
hb_array_t<const T> hb_array (const OT::UnsizedArrayOf<T> &array, unsigned int len)
|
||||||
|
{ return hb_array (array.arrayZ, len); }
|
||||||
|
namespace OT {
|
||||||
|
|
||||||
/* Unsized array of offset's */
|
/* Unsized array of offset's */
|
||||||
template <typename Type, typename OffsetType, bool has_null=true>
|
template <typename Type, typename OffsetType, bool has_null=true>
|
||||||
|
|
|
@ -55,7 +55,7 @@ struct CPALV1Tail
|
||||||
{
|
{
|
||||||
if (!paletteFlagsZ) return HB_OT_COLOR_PALETTE_FLAG_DEFAULT;
|
if (!paletteFlagsZ) return HB_OT_COLOR_PALETTE_FLAG_DEFAULT;
|
||||||
return (hb_ot_color_palette_flags_t) (uint32_t)
|
return (hb_ot_color_palette_flags_t) (uint32_t)
|
||||||
hb_array ((base+paletteFlagsZ).arrayZ, palette_count)[palette_index];
|
hb_array (base+paletteFlagsZ, palette_count)[palette_index];
|
||||||
}
|
}
|
||||||
|
|
||||||
inline unsigned int
|
inline unsigned int
|
||||||
|
@ -64,7 +64,7 @@ struct CPALV1Tail
|
||||||
unsigned int palette_count) const
|
unsigned int palette_count) const
|
||||||
{
|
{
|
||||||
if (!paletteLabelsZ) return HB_NAME_ID_INVALID;
|
if (!paletteLabelsZ) return HB_NAME_ID_INVALID;
|
||||||
return hb_array ((base+paletteLabelsZ).arrayZ, palette_count)[palette_index];
|
return hb_array (base+paletteLabelsZ, palette_count)[palette_index];
|
||||||
}
|
}
|
||||||
|
|
||||||
inline unsigned int
|
inline unsigned int
|
||||||
|
@ -73,7 +73,7 @@ struct CPALV1Tail
|
||||||
unsigned int color_count) const
|
unsigned int color_count) const
|
||||||
{
|
{
|
||||||
if (!colorLabelsZ) return HB_NAME_ID_INVALID;
|
if (!colorLabelsZ) return HB_NAME_ID_INVALID;
|
||||||
return hb_array ((base+colorLabelsZ).arrayZ, color_count)[color_index];
|
return hb_array (base+colorLabelsZ, color_count)[color_index];
|
||||||
}
|
}
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
Loading…
Reference in New Issue