Move null pool to hb-private
This commit is contained in:
parent
08e280fd84
commit
abc12f7b81
|
@ -47,7 +47,7 @@
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
|
||||||
#ifndef HB_NO_VISIBILITY
|
#ifndef HB_NO_VISIBILITY
|
||||||
const void * const OT::_hb_NullPool[HB_NULL_POOL_SIZE / sizeof (void *)] = {};
|
const void * const _hb_NullPool[HB_NULL_POOL_SIZE / sizeof (void *)] = {};
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
void cbdt_callback (const uint8_t* data, unsigned int length,
|
void cbdt_callback (const uint8_t* data, unsigned int length,
|
||||||
|
@ -91,7 +91,7 @@ void svg_callback (const uint8_t* data, unsigned int length,
|
||||||
void colr_cpal_rendering (cairo_font_face_t *cairo_face, unsigned int upem, unsigned int num_glyphs,
|
void colr_cpal_rendering (cairo_font_face_t *cairo_face, unsigned int upem, unsigned int num_glyphs,
|
||||||
const OT::COLR *colr, const OT::CPAL *cpal)
|
const OT::COLR *colr, const OT::CPAL *cpal)
|
||||||
{
|
{
|
||||||
for (int i = 0; i < num_glyphs; ++i)
|
for (unsigned int i = 0; i < num_glyphs; ++i)
|
||||||
{
|
{
|
||||||
unsigned int first_layer_index, num_layers;
|
unsigned int first_layer_index, num_layers;
|
||||||
if (colr->get_base_glyph_record (i, &first_layer_index, &num_layers))
|
if (colr->get_base_glyph_record (i, &first_layer_index, &num_layers))
|
||||||
|
@ -171,7 +171,7 @@ void dump_glyphs (cairo_font_face_t *cairo_face, unsigned int upem, unsigned int
|
||||||
{
|
{
|
||||||
// Dump every glyph available on the font
|
// Dump every glyph available on the font
|
||||||
return; // disabled for now
|
return; // disabled for now
|
||||||
for (int i = 0; i < num_glyphs; ++i)
|
for (unsigned int i = 0; i < num_glyphs; ++i)
|
||||||
{
|
{
|
||||||
cairo_text_extents_t extents;
|
cairo_text_extents_t extents;
|
||||||
cairo_glyph_t glyph = {0};
|
cairo_glyph_t glyph = {0};
|
||||||
|
|
|
@ -27,7 +27,7 @@
|
||||||
#include "hb-open-type-private.hh"
|
#include "hb-open-type-private.hh"
|
||||||
|
|
||||||
#ifndef HB_NO_VISIBILITY
|
#ifndef HB_NO_VISIBILITY
|
||||||
const void * const OT::_hb_NullPool[HB_NULL_POOL_SIZE / sizeof (void *)] = {};
|
const void * const _hb_NullPool[HB_NULL_POOL_SIZE / sizeof (void *)] = {};
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
template <typename Type, int Bytes> struct LEInt;
|
template <typename Type, int Bytes> struct LEInt;
|
||||||
|
@ -344,7 +344,7 @@ struct NE_TYPEINFO
|
||||||
{
|
{
|
||||||
const NE_TYPEINFO& next = OT::StructAfter<NE_TYPEINFO> (*this);
|
const NE_TYPEINFO& next = OT::StructAfter<NE_TYPEINFO> (*this);
|
||||||
if (type_id == 0)
|
if (type_id == 0)
|
||||||
return OT::Null (NE_TYPEINFO);
|
return Null (NE_TYPEINFO);
|
||||||
return next;
|
return next;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -352,7 +352,7 @@ struct NE_TYPEINFO
|
||||||
{
|
{
|
||||||
if (idx < count)
|
if (idx < count)
|
||||||
return resources[idx].get_font (base, shift);
|
return resources[idx].get_font (base, shift);
|
||||||
return OT::Null (LE_FONTINFO16);
|
return Null (LE_FONTINFO16);
|
||||||
}
|
}
|
||||||
|
|
||||||
inline unsigned int get_count () const
|
inline unsigned int get_count () const
|
||||||
|
@ -401,7 +401,7 @@ struct NE_RESOURCE_TABLE
|
||||||
return_trace (false);
|
return_trace (false);
|
||||||
|
|
||||||
const NE_TYPEINFO* n = &chain;
|
const NE_TYPEINFO* n = &chain;
|
||||||
while (n != &OT::Null (NE_TYPEINFO) && c->check_struct (n) && n->get_type_id () != 0)
|
while (n != &Null (NE_TYPEINFO) && c->check_struct (n) && n->get_type_id () != 0)
|
||||||
{
|
{
|
||||||
if (n->get_type_id () == NE_TYPEINFO::FONT)
|
if (n->get_type_id () == NE_TYPEINFO::FONT)
|
||||||
return_trace (n->sanitize (c, base, alignmentShiftCount));
|
return_trace (n->sanitize (c, base, alignmentShiftCount));
|
||||||
|
@ -418,13 +418,13 @@ struct NE_RESOURCE_TABLE
|
||||||
inline const NE_TYPEINFO& get_fonts_entry () const
|
inline const NE_TYPEINFO& get_fonts_entry () const
|
||||||
{
|
{
|
||||||
const NE_TYPEINFO* n = &chain;
|
const NE_TYPEINFO* n = &chain;
|
||||||
while (n != &OT::Null (NE_TYPEINFO) && n->get_type_id () != 0)
|
while (n != &Null (NE_TYPEINFO) && n->get_type_id () != 0)
|
||||||
{
|
{
|
||||||
if (n->get_type_id () == NE_TYPEINFO::FONT)
|
if (n->get_type_id () == NE_TYPEINFO::FONT)
|
||||||
return *n;
|
return *n;
|
||||||
n = &n->next();
|
n = &n->next();
|
||||||
}
|
}
|
||||||
return OT::Null (NE_TYPEINFO);
|
return Null (NE_TYPEINFO);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
@ -447,7 +447,7 @@ struct LE_IMAGE_OS2_HEADER
|
||||||
inline const NE_RESOURCE_TABLE& get_resource_table () const
|
inline const NE_RESOURCE_TABLE& get_resource_table () const
|
||||||
{
|
{
|
||||||
if (magic != 0x454E) // Only NE containers are support for now, NE == 0x454E
|
if (magic != 0x454E) // Only NE containers are support for now, NE == 0x454E
|
||||||
return OT::Null (NE_RESOURCE_TABLE);
|
return Null (NE_RESOURCE_TABLE);
|
||||||
return this+rsrctab;
|
return this+rsrctab;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -52,7 +52,7 @@ _get_ankr (hb_face_t *face, hb_blob_t **blob = nullptr)
|
||||||
{
|
{
|
||||||
if (blob)
|
if (blob)
|
||||||
*blob = hb_blob_get_empty ();
|
*blob = hb_blob_get_empty ();
|
||||||
return OT::Null(AAT::ankr);
|
return Null(AAT::ankr);
|
||||||
}
|
}
|
||||||
hb_ot_layout_t * layout = hb_ot_layout_from_face (face);
|
hb_ot_layout_t * layout = hb_ot_layout_from_face (face);
|
||||||
const AAT::ankr& ankr = *(layout->ankr.get ());
|
const AAT::ankr& ankr = *(layout->ankr.get ());
|
||||||
|
@ -68,7 +68,7 @@ _get_kerx (hb_face_t *face, hb_blob_t **blob = nullptr)
|
||||||
{
|
{
|
||||||
if (blob)
|
if (blob)
|
||||||
*blob = hb_blob_get_empty ();
|
*blob = hb_blob_get_empty ();
|
||||||
return OT::Null(AAT::kerx);
|
return Null(AAT::kerx);
|
||||||
}
|
}
|
||||||
hb_ot_layout_t * layout = hb_ot_layout_from_face (face);
|
hb_ot_layout_t * layout = hb_ot_layout_from_face (face);
|
||||||
/* XXX this doesn't call set_num_glyphs on sanitizer. */
|
/* XXX this doesn't call set_num_glyphs on sanitizer. */
|
||||||
|
@ -85,7 +85,7 @@ _get_morx (hb_face_t *face, hb_blob_t **blob = nullptr)
|
||||||
{
|
{
|
||||||
if (blob)
|
if (blob)
|
||||||
*blob = hb_blob_get_empty ();
|
*blob = hb_blob_get_empty ();
|
||||||
return OT::Null(AAT::morx);
|
return Null(AAT::morx);
|
||||||
}
|
}
|
||||||
hb_ot_layout_t * layout = hb_ot_layout_from_face (face);
|
hb_ot_layout_t * layout = hb_ot_layout_from_face (face);
|
||||||
/* XXX this doesn't call set_num_glyphs on sanitizer. */
|
/* XXX this doesn't call set_num_glyphs on sanitizer. */
|
||||||
|
@ -102,7 +102,7 @@ _get_trak (hb_face_t *face, hb_blob_t **blob = nullptr)
|
||||||
{
|
{
|
||||||
if (blob)
|
if (blob)
|
||||||
*blob = hb_blob_get_empty ();
|
*blob = hb_blob_get_empty ();
|
||||||
return OT::Null(AAT::trak);
|
return Null(AAT::trak);
|
||||||
}
|
}
|
||||||
hb_ot_layout_t * layout = hb_ot_layout_from_face (face);
|
hb_ot_layout_t * layout = hb_ot_layout_from_face (face);
|
||||||
const AAT::trak& trak = *(layout->trak.get ());
|
const AAT::trak& trak = *(layout->trak.get ());
|
||||||
|
|
|
@ -126,46 +126,6 @@ static inline Type& StructAfter(TObject &X)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Null objects
|
|
||||||
*/
|
|
||||||
|
|
||||||
/* Global nul-content Null pool. Enlarge as necessary. */
|
|
||||||
|
|
||||||
#define HB_NULL_POOL_SIZE 264
|
|
||||||
static_assert (HB_NULL_POOL_SIZE % sizeof (void *) == 0, "Align HB_NULL_POOL_SIZE.");
|
|
||||||
|
|
||||||
#ifdef HB_NO_VISIBILITY
|
|
||||||
static
|
|
||||||
#else
|
|
||||||
extern HB_INTERNAL
|
|
||||||
#endif
|
|
||||||
const void * const _hb_NullPool[HB_NULL_POOL_SIZE / sizeof (void *)]
|
|
||||||
#ifdef HB_NO_VISIBILITY
|
|
||||||
= {}
|
|
||||||
#endif
|
|
||||||
;
|
|
||||||
|
|
||||||
/* Generic nul-content Null objects. */
|
|
||||||
template <typename Type>
|
|
||||||
static inline const Type& Null (void) {
|
|
||||||
static_assert (sizeof (Type) <= HB_NULL_POOL_SIZE, "Increase HB_NULL_POOL_SIZE.");
|
|
||||||
return *CastP<Type> (_hb_NullPool);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Specializaiton for arbitrary-content arbitrary-sized Null objects. */
|
|
||||||
#define DEFINE_NULL_DATA(Type, data) \
|
|
||||||
static const char _Null##Type[sizeof (Type) + 1] = data; /* +1 is for nul-termination in data */ \
|
|
||||||
template <> \
|
|
||||||
/*static*/ inline const Type& Null<Type> (void) { \
|
|
||||||
return *CastP<Type> (_Null##Type); \
|
|
||||||
} /* The following line really exists such that we end in a place needing semicolon */ \
|
|
||||||
static_assert (Type::min_size + 1 <= sizeof (_Null##Type), "Null pool too small. Enlarge.")
|
|
||||||
|
|
||||||
/* Accessor macro. */
|
|
||||||
#define Null(Type) Null<Type>()
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Dispatch
|
* Dispatch
|
||||||
*/
|
*/
|
||||||
|
@ -726,7 +686,6 @@ struct Tag : HBUINT32
|
||||||
public:
|
public:
|
||||||
DEFINE_SIZE_STATIC (4);
|
DEFINE_SIZE_STATIC (4);
|
||||||
};
|
};
|
||||||
DEFINE_NULL_DATA (Tag, " ");
|
|
||||||
|
|
||||||
/* Glyph index number, same as uint16 (length = 16 bits) */
|
/* Glyph index number, same as uint16 (length = 16 bits) */
|
||||||
typedef HBUINT16 GlyphID;
|
typedef HBUINT16 GlyphID;
|
||||||
|
@ -738,7 +697,6 @@ typedef HBUINT16 NameID;
|
||||||
struct Index : HBUINT16 {
|
struct Index : HBUINT16 {
|
||||||
static const unsigned int NOT_FOUND_INDEX = 0xFFFFu;
|
static const unsigned int NOT_FOUND_INDEX = 0xFFFFu;
|
||||||
};
|
};
|
||||||
DEFINE_NULL_DATA (Index, "\xff\xff");
|
|
||||||
|
|
||||||
/* Offset, Null offset = 0 */
|
/* Offset, Null offset = 0 */
|
||||||
template <typename Type>
|
template <typename Type>
|
||||||
|
@ -1236,7 +1194,7 @@ struct hb_lazy_loader_t
|
||||||
|
|
||||||
inline void fini (void)
|
inline void fini (void)
|
||||||
{
|
{
|
||||||
if (instance && instance != &OT::Null(T))
|
if (instance && instance != &Null(T))
|
||||||
{
|
{
|
||||||
instance->fini();
|
instance->fini();
|
||||||
free (instance);
|
free (instance);
|
||||||
|
@ -1251,12 +1209,12 @@ struct hb_lazy_loader_t
|
||||||
{
|
{
|
||||||
p = (T *) calloc (1, sizeof (T));
|
p = (T *) calloc (1, sizeof (T));
|
||||||
if (unlikely (!p))
|
if (unlikely (!p))
|
||||||
p = const_cast<T *> (&OT::Null(T));
|
p = const_cast<T *> (&Null(T));
|
||||||
else
|
else
|
||||||
p->init (face);
|
p->init (face);
|
||||||
if (unlikely (!hb_atomic_ptr_cmpexch (const_cast<T **>(&instance), nullptr, p)))
|
if (unlikely (!hb_atomic_ptr_cmpexch (const_cast<T **>(&instance), nullptr, p)))
|
||||||
{
|
{
|
||||||
if (p != &OT::Null(T))
|
if (p != &Null(T))
|
||||||
p->fini ();
|
p->fini ();
|
||||||
goto retry;
|
goto retry;
|
||||||
}
|
}
|
||||||
|
|
|
@ -682,7 +682,7 @@ struct cmap
|
||||||
if (subtable) symbol = true;
|
if (subtable) symbol = true;
|
||||||
}
|
}
|
||||||
/* Meh. */
|
/* Meh. */
|
||||||
if (!subtable) subtable = &OT::Null(OT::CmapSubtable);
|
if (!subtable) subtable = &Null(OT::CmapSubtable);
|
||||||
|
|
||||||
/* UVS subtable. */
|
/* UVS subtable. */
|
||||||
if (!subtable_uvs)
|
if (!subtable_uvs)
|
||||||
|
@ -692,7 +692,7 @@ struct cmap
|
||||||
subtable_uvs = &st->u.format14;
|
subtable_uvs = &st->u.format14;
|
||||||
}
|
}
|
||||||
/* Meh. */
|
/* Meh. */
|
||||||
if (!subtable_uvs) subtable_uvs = &OT::Null(OT::CmapSubtableFormat14);
|
if (!subtable_uvs) subtable_uvs = &Null(OT::CmapSubtableFormat14);
|
||||||
|
|
||||||
this->uvs_table = subtable_uvs;
|
this->uvs_table = subtable_uvs;
|
||||||
|
|
||||||
|
|
|
@ -44,7 +44,7 @@ HB_MARK_AS_FLAG_T (hb_ot_color_palette_flags_t)
|
||||||
static inline const OT::COLR&
|
static inline const OT::COLR&
|
||||||
_get_colr (hb_face_t *face)
|
_get_colr (hb_face_t *face)
|
||||||
{
|
{
|
||||||
if (unlikely (!hb_ot_shaper_face_data_ensure (face))) return OT::Null(OT::COLR);
|
if (unlikely (!hb_ot_shaper_face_data_ensure (face))) return Null(OT::COLR);
|
||||||
hb_ot_layout_t * layout = hb_ot_layout_from_face (face);
|
hb_ot_layout_t * layout = hb_ot_layout_from_face (face);
|
||||||
return *(layout->colr.get ());
|
return *(layout->colr.get ());
|
||||||
}
|
}
|
||||||
|
@ -52,7 +52,7 @@ _get_colr (hb_face_t *face)
|
||||||
static inline const OT::CPAL&
|
static inline const OT::CPAL&
|
||||||
_get_cpal (hb_face_t *face)
|
_get_cpal (hb_face_t *face)
|
||||||
{
|
{
|
||||||
if (unlikely (!hb_ot_shaper_face_data_ensure (face))) return OT::Null(OT::CPAL);
|
if (unlikely (!hb_ot_shaper_face_data_ensure (face))) return Null(OT::CPAL);
|
||||||
hb_ot_layout_t * layout = hb_ot_layout_from_face (face);
|
hb_ot_layout_t * layout = hb_ot_layout_from_face (face);
|
||||||
return *(layout->cpal.get ());
|
return *(layout->cpal.get ());
|
||||||
}
|
}
|
||||||
|
|
|
@ -165,7 +165,6 @@ struct RangeRecord
|
||||||
public:
|
public:
|
||||||
DEFINE_SIZE_STATIC (6);
|
DEFINE_SIZE_STATIC (6);
|
||||||
};
|
};
|
||||||
DEFINE_NULL_DATA (RangeRecord, "\000\001");
|
|
||||||
|
|
||||||
|
|
||||||
struct IndexArray : ArrayOf<Index>
|
struct IndexArray : ArrayOf<Index>
|
||||||
|
@ -225,7 +224,6 @@ struct LangSys
|
||||||
public:
|
public:
|
||||||
DEFINE_SIZE_ARRAY (6, featureIndex);
|
DEFINE_SIZE_ARRAY (6, featureIndex);
|
||||||
};
|
};
|
||||||
DEFINE_NULL_DATA (LangSys, "\0\0\xFF\xFF");
|
|
||||||
|
|
||||||
|
|
||||||
struct Script
|
struct Script
|
||||||
|
@ -247,7 +245,16 @@ struct Script
|
||||||
{ return langSys.find_index (tag, index); }
|
{ return langSys.find_index (tag, index); }
|
||||||
|
|
||||||
inline bool has_default_lang_sys (void) const { return defaultLangSys != 0; }
|
inline bool has_default_lang_sys (void) const { return defaultLangSys != 0; }
|
||||||
inline const LangSys& get_default_lang_sys (void) const { return this+defaultLangSys; }
|
inline const LangSys& get_default_lang_sys (void) const
|
||||||
|
{
|
||||||
|
if (!defaultLangSys)
|
||||||
|
{
|
||||||
|
/* This is the ONLY place where our null data is not all zeros.
|
||||||
|
* So, return special data instead of using the null pool. */
|
||||||
|
return *reinterpret_cast<const LangSys *> ("\0\0\xFF\xFF");
|
||||||
|
}
|
||||||
|
return this+defaultLangSys;
|
||||||
|
}
|
||||||
|
|
||||||
inline bool sanitize (hb_sanitize_context_t *c,
|
inline bool sanitize (hb_sanitize_context_t *c,
|
||||||
const Record<Script>::sanitize_closure_t * = nullptr) const
|
const Record<Script>::sanitize_closure_t * = nullptr) const
|
||||||
|
|
|
@ -47,7 +47,7 @@
|
||||||
|
|
||||||
|
|
||||||
#ifndef HB_NO_VISIBILITY
|
#ifndef HB_NO_VISIBILITY
|
||||||
const void * const OT::_hb_NullPool[HB_NULL_POOL_SIZE / sizeof (void *)] = {};
|
const void * const _hb_NullPool[HB_NULL_POOL_SIZE / sizeof (void *)] = {};
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
@ -102,7 +102,7 @@ _hb_ot_layout_create (hb_face_t *face)
|
||||||
* https://lists.freedesktop.org/archives/harfbuzz/2016-February/005489.html
|
* https://lists.freedesktop.org/archives/harfbuzz/2016-February/005489.html
|
||||||
*/
|
*/
|
||||||
if (3 == layout->gdef->get_glyph_class (5))
|
if (3 == layout->gdef->get_glyph_class (5))
|
||||||
layout->gdef = &OT::Null(OT::GDEF);
|
layout->gdef = &Null(OT::GDEF);
|
||||||
}
|
}
|
||||||
else if (0
|
else if (0
|
||||||
/* sha1sum:96eda93f7d33e79962451c6c39a6b51ee893ce8c tahoma.ttf from Windows 8 */
|
/* sha1sum:96eda93f7d33e79962451c6c39a6b51ee893ce8c tahoma.ttf from Windows 8 */
|
||||||
|
@ -174,7 +174,7 @@ _hb_ot_layout_create (hb_face_t *face)
|
||||||
* https://bugzilla.mozilla.org/show_bug.cgi?id=1279693
|
* https://bugzilla.mozilla.org/show_bug.cgi?id=1279693
|
||||||
* https://bugzilla.mozilla.org/show_bug.cgi?id=1279875
|
* https://bugzilla.mozilla.org/show_bug.cgi?id=1279875
|
||||||
*/
|
*/
|
||||||
layout->gdef = &OT::Null(OT::GDEF);
|
layout->gdef = &Null(OT::GDEF);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -226,7 +226,7 @@ _hb_ot_layout_destroy (hb_ot_layout_t *layout)
|
||||||
// static inline const OT::BASE&
|
// static inline const OT::BASE&
|
||||||
// _get_base (hb_face_t *face)
|
// _get_base (hb_face_t *face)
|
||||||
// {
|
// {
|
||||||
// if (unlikely (!hb_ot_shaper_face_data_ensure (face))) return OT::Null(OT::BASE);
|
// if (unlikely (!hb_ot_shaper_face_data_ensure (face))) return Null(OT::BASE);
|
||||||
// hb_ot_layout_t * layout = hb_ot_layout_from_face (face);
|
// hb_ot_layout_t * layout = hb_ot_layout_from_face (face);
|
||||||
// return *(layout->base.get ());
|
// return *(layout->base.get ());
|
||||||
// }
|
// }
|
||||||
|
@ -234,19 +234,19 @@ _hb_ot_layout_destroy (hb_ot_layout_t *layout)
|
||||||
static inline const OT::GDEF&
|
static inline const OT::GDEF&
|
||||||
_get_gdef (hb_face_t *face)
|
_get_gdef (hb_face_t *face)
|
||||||
{
|
{
|
||||||
if (unlikely (!hb_ot_shaper_face_data_ensure (face))) return OT::Null(OT::GDEF);
|
if (unlikely (!hb_ot_shaper_face_data_ensure (face))) return Null(OT::GDEF);
|
||||||
return *hb_ot_layout_from_face (face)->gdef;
|
return *hb_ot_layout_from_face (face)->gdef;
|
||||||
}
|
}
|
||||||
static inline const OT::GSUB&
|
static inline const OT::GSUB&
|
||||||
_get_gsub (hb_face_t *face)
|
_get_gsub (hb_face_t *face)
|
||||||
{
|
{
|
||||||
if (unlikely (!hb_ot_shaper_face_data_ensure (face))) return OT::Null(OT::GSUB);
|
if (unlikely (!hb_ot_shaper_face_data_ensure (face))) return Null(OT::GSUB);
|
||||||
return *hb_ot_layout_from_face (face)->gsub;
|
return *hb_ot_layout_from_face (face)->gsub;
|
||||||
}
|
}
|
||||||
static inline const OT::GPOS&
|
static inline const OT::GPOS&
|
||||||
_get_gpos (hb_face_t *face)
|
_get_gpos (hb_face_t *face)
|
||||||
{
|
{
|
||||||
if (unlikely (!hb_ot_shaper_face_data_ensure (face))) return OT::Null(OT::GPOS);
|
if (unlikely (!hb_ot_shaper_face_data_ensure (face))) return Null(OT::GPOS);
|
||||||
return *hb_ot_layout_from_face (face)->gpos;
|
return *hb_ot_layout_from_face (face)->gpos;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -318,7 +318,7 @@ get_gsubgpos_table (hb_face_t *face,
|
||||||
switch (table_tag) {
|
switch (table_tag) {
|
||||||
case HB_OT_TAG_GSUB: return _get_gsub (face);
|
case HB_OT_TAG_GSUB: return _get_gsub (face);
|
||||||
case HB_OT_TAG_GPOS: return _get_gpos (face);
|
case HB_OT_TAG_GPOS: return _get_gpos (face);
|
||||||
default: return OT::Null(OT::GSUBGPOS);
|
default: return Null(OT::GSUBGPOS);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -898,7 +898,7 @@ hb_ot_layout_feature_with_variations_get_lookups (hb_face_t *face,
|
||||||
hb_bool_t
|
hb_bool_t
|
||||||
hb_ot_layout_has_substitution (hb_face_t *face)
|
hb_ot_layout_has_substitution (hb_face_t *face)
|
||||||
{
|
{
|
||||||
return &_get_gsub (face) != &OT::Null(OT::GSUB);
|
return &_get_gsub (face) != &Null(OT::GSUB);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -962,7 +962,7 @@ hb_ot_layout_lookup_substitute_closure (hb_face_t *face,
|
||||||
hb_bool_t
|
hb_bool_t
|
||||||
hb_ot_layout_has_positioning (hb_face_t *face)
|
hb_ot_layout_has_positioning (hb_face_t *face)
|
||||||
{
|
{
|
||||||
return &_get_gpos (face) != &OT::Null(OT::GPOS);
|
return &_get_gpos (face) != &Null(OT::GPOS);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
@ -1298,5 +1298,5 @@ hb_ot_layout_substitute_lookup (OT::hb_ot_apply_context_t *c,
|
||||||
// hb_bool_t
|
// hb_bool_t
|
||||||
// hb_ot_base_has_data (hb_face_t *face)
|
// hb_ot_base_has_data (hb_face_t *face)
|
||||||
// {
|
// {
|
||||||
// return &_get_base (face) != &OT::Null(OT::BASE);
|
// return &_get_base (face) != &Null(OT::BASE);
|
||||||
// }
|
// }
|
||||||
|
|
|
@ -32,7 +32,7 @@
|
||||||
static inline const OT::MATH&
|
static inline const OT::MATH&
|
||||||
_get_math (hb_face_t *face)
|
_get_math (hb_face_t *face)
|
||||||
{
|
{
|
||||||
if (unlikely (!hb_ot_shaper_face_data_ensure (face))) return OT::Null(OT::MATH);
|
if (unlikely (!hb_ot_shaper_face_data_ensure (face))) return Null(OT::MATH);
|
||||||
hb_ot_layout_t * layout = hb_ot_layout_from_face (face);
|
hb_ot_layout_t * layout = hb_ot_layout_from_face (face);
|
||||||
return *(layout->math.get ());
|
return *(layout->math.get ());
|
||||||
}
|
}
|
||||||
|
@ -55,7 +55,7 @@ _get_math (hb_face_t *face)
|
||||||
hb_bool_t
|
hb_bool_t
|
||||||
hb_ot_math_has_data (hb_face_t *face)
|
hb_ot_math_has_data (hb_face_t *face)
|
||||||
{
|
{
|
||||||
return &_get_math (face) != &OT::Null(OT::MATH);
|
return &_get_math (face) != &Null(OT::MATH);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -39,14 +39,14 @@
|
||||||
static inline const OT::fvar&
|
static inline const OT::fvar&
|
||||||
_get_fvar (hb_face_t *face)
|
_get_fvar (hb_face_t *face)
|
||||||
{
|
{
|
||||||
if (unlikely (!hb_ot_shaper_face_data_ensure (face))) return OT::Null(OT::fvar);
|
if (unlikely (!hb_ot_shaper_face_data_ensure (face))) return Null(OT::fvar);
|
||||||
hb_ot_layout_t * layout = hb_ot_layout_from_face (face);
|
hb_ot_layout_t * layout = hb_ot_layout_from_face (face);
|
||||||
return *(layout->fvar.get ());
|
return *(layout->fvar.get ());
|
||||||
}
|
}
|
||||||
static inline const OT::avar&
|
static inline const OT::avar&
|
||||||
_get_avar (hb_face_t *face)
|
_get_avar (hb_face_t *face)
|
||||||
{
|
{
|
||||||
if (unlikely (!hb_ot_shaper_face_data_ensure (face))) return OT::Null(OT::avar);
|
if (unlikely (!hb_ot_shaper_face_data_ensure (face))) return Null(OT::avar);
|
||||||
hb_ot_layout_t * layout = hb_ot_layout_from_face (face);
|
hb_ot_layout_t * layout = hb_ot_layout_from_face (face);
|
||||||
return *(layout->avar.get ());
|
return *(layout->avar.get ());
|
||||||
}
|
}
|
||||||
|
@ -65,7 +65,7 @@ _get_avar (hb_face_t *face)
|
||||||
hb_bool_t
|
hb_bool_t
|
||||||
hb_ot_var_has_data (hb_face_t *face)
|
hb_ot_var_has_data (hb_face_t *face)
|
||||||
{
|
{
|
||||||
return &_get_fvar (face) != &OT::Null(OT::fvar);
|
return &_get_fvar (face) != &Null(OT::fvar);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -1089,4 +1089,33 @@ round (double x)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Null objects
|
||||||
|
*/
|
||||||
|
|
||||||
|
/* Global nul-content Null pool. Enlarge as necessary. */
|
||||||
|
|
||||||
|
#define HB_NULL_POOL_SIZE 264
|
||||||
|
static_assert (HB_NULL_POOL_SIZE % sizeof (void *) == 0, "Align HB_NULL_POOL_SIZE.");
|
||||||
|
|
||||||
|
#ifdef HB_NO_VISIBILITY
|
||||||
|
static
|
||||||
|
#else
|
||||||
|
extern HB_INTERNAL
|
||||||
|
#endif
|
||||||
|
const void * const _hb_NullPool[HB_NULL_POOL_SIZE / sizeof (void *)]
|
||||||
|
#ifdef HB_NO_VISIBILITY
|
||||||
|
= {}
|
||||||
|
#endif
|
||||||
|
;
|
||||||
|
|
||||||
|
/* Generic nul-content Null objects. */
|
||||||
|
template <typename Type>
|
||||||
|
static inline const Type& Null (void) {
|
||||||
|
static_assert (sizeof (Type) <= HB_NULL_POOL_SIZE, "Increase HB_NULL_POOL_SIZE.");
|
||||||
|
return *reinterpret_cast<const Type *> (_hb_NullPool);
|
||||||
|
}
|
||||||
|
#define Null(Type) Null<Type>()
|
||||||
|
|
||||||
|
|
||||||
#endif /* HB_PRIVATE_HH */
|
#endif /* HB_PRIVATE_HH */
|
||||||
|
|
|
@ -45,7 +45,7 @@
|
||||||
|
|
||||||
|
|
||||||
#if !defined(HB_NO_VISIBILITY) && !defined(HB_SUBSET_BUILTIN)
|
#if !defined(HB_NO_VISIBILITY) && !defined(HB_SUBSET_BUILTIN)
|
||||||
const void * const OT::_hb_NullPool[HB_NULL_POOL_SIZE / sizeof (void *)] = {};
|
const void * const _hb_NullPool[HB_NULL_POOL_SIZE / sizeof (void *)] = {};
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
@ -91,7 +91,7 @@ _subset (hb_subset_plan_t *plan)
|
||||||
|
|
||||||
hb_tag_t tag = TableType::tableTag;
|
hb_tag_t tag = TableType::tableTag;
|
||||||
hb_bool_t result = false;
|
hb_bool_t result = false;
|
||||||
if (table != &OT::Null(TableType))
|
if (table != &Null(TableType))
|
||||||
{
|
{
|
||||||
result = table->subset(plan);
|
result = table->subset(plan);
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -38,7 +38,7 @@
|
||||||
using namespace OT;
|
using namespace OT;
|
||||||
|
|
||||||
#ifndef HB_NO_VISIBILITY
|
#ifndef HB_NO_VISIBILITY
|
||||||
const void * const OT::_hb_NullPool[HB_NULL_POOL_SIZE / sizeof (void *)] = {};
|
const void * const _hb_NullPool[HB_NULL_POOL_SIZE / sizeof (void *)] = {};
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
int
|
int
|
||||||
|
|
Loading…
Reference in New Issue