提交 0dff25f0 编写于 作者: B Behdad Esfahbod

[HB] Remove get_size()

上级 25c6c9a3
......@@ -151,15 +151,6 @@ ASSERT_SIZE (CaretValueFormat3, 6);
struct CaretValue {
DEFINE_NON_INSTANTIABLE(CaretValue);
unsigned int get_size (void) const {
switch (u.caretValueFormat) {
case 1: return sizeof (u.format1);
case 2: return sizeof (u.format2);
case 3: return sizeof (u.format3);
default:return sizeof (u.caretValueFormat);
}
}
/* XXX we need access to a load-contour-point vfunc here */
int get_caret_value (int ppem) const {
switch (u.caretValueFormat) {
......
......@@ -117,14 +117,6 @@ struct SingleSubst {
private:
unsigned int get_size (void) const {
switch (u.substFormat) {
case 1: return sizeof (u.format1);
case 2: return sizeof (u.format2);
default:return sizeof (u.substFormat);
}
}
inline bool single_substitute (hb_codepoint_t &glyph_id) const {
switch (u.substFormat) {
case 1: return u.format1.single_substitute (glyph_id);
......@@ -259,13 +251,6 @@ struct MultipleSubst {
private:
unsigned int get_size (void) const {
switch (u.substFormat) {
case 1: return sizeof (u.format1);
default:return sizeof (u.substFormat);
}
}
inline bool substitute (SUBTABLE_SUBSTITUTE_ARGS_DEF) const {
switch (u.substFormat) {
case 1: return u.format1.substitute (SUBTABLE_SUBSTITUTE_ARGS);
......@@ -366,13 +351,6 @@ struct AlternateSubst {
private:
unsigned int get_size (void) const {
switch (u.substFormat) {
case 1: return sizeof (u.format1);
default:return sizeof (u.substFormat);
}
}
inline bool substitute (SUBTABLE_SUBSTITUTE_ARGS_DEF) const {
switch (u.substFormat) {
case 1: return u.format1.substitute (SUBTABLE_SUBSTITUTE_ARGS);
......@@ -544,13 +522,6 @@ struct LigatureSubst {
private:
unsigned int get_size (void) const {
switch (u.substFormat) {
case 1: return sizeof (u.format1);
default:return sizeof (u.substFormat);
}
}
inline bool substitute (SUBTABLE_SUBSTITUTE_ARGS_DEF) const {
switch (u.substFormat) {
case 1: return u.format1.substitute (SUBTABLE_SUBSTITUTE_ARGS);
......@@ -769,15 +740,6 @@ struct ContextSubst {
private:
unsigned int get_size (void) const {
switch (u.substFormat) {
case 1: return sizeof (u.format1);
case 2: return sizeof (u.format2);
case 3: return sizeof (u.format3);
default:return sizeof (u.substFormat);
}
}
inline bool substitute (SUBTABLE_SUBSTITUTE_ARGS_DEF) const {
switch (u.substFormat) {
case 1: return u.format1.substitute (SUBTABLE_SUBSTITUTE_ARGS);
......@@ -971,13 +933,6 @@ struct ExtensionSubst {
private:
unsigned int get_size (void) const {
switch (u.substFormat) {
case 1: return sizeof (u.format1);
default:return sizeof (u.substFormat);
}
}
inline unsigned int get_type (void) const {
switch (u.substFormat) {
case 1: return u.format1.get_type ();
......@@ -1046,24 +1001,6 @@ struct SubstLookupSubTable {
friend struct SubstLookup;
unsigned int get_size (unsigned int lookup_type) const {
switch (lookup_type) {
case GSUB_Single: return u.single.get_size ();
case GSUB_Multiple: return u.multiple.get_size ();
case GSUB_Alternate: return u.alternate.get_size ();
case GSUB_Ligature: return u.ligature.get_size ();
case GSUB_Context:
/*
case GSUB_ChainingContext:
*/
case GSUB_Extension: return u.extension.get_size ();
/*
case GSUB_ReverseChainingContextSingle:
*/
default:return sizeof (LookupSubTable);
}
}
inline bool substitute (SUBTABLE_SUBSTITUTE_ARGS_DEF,
unsigned int lookup_type) const {
switch (lookup_type) {
......
......@@ -67,20 +67,12 @@
#define DEFINE_LEN(Type, array, num) \
inline unsigned int get_len(void) const { return num; } \
/* get_size() is a method returning the size in bytes of an array-like object */
#define DEFINE_SIZE(Type, array, num) \
inline unsigned int get_size(void) const { return sizeof (*this) + sizeof (Type) * num; }
#define DEFINE_LEN_AND_SIZE(Type, array, num) \
DEFINE_LEN(Type, array, num) \
DEFINE_SIZE(Type, array, num)
/* An array type is one that contains a variable number of objects
* as its last item. An array object is extended with len() and size()
* methods, as well as overloaded [] operator. */
#define DEFINE_ARRAY_TYPE(Type, array, num) \
DEFINE_INDEX_OPERATOR(Type, array, num) \
DEFINE_LEN_AND_SIZE(Type, array, num)
DEFINE_LEN(Type, array, num)
#define DEFINE_INDEX_OPERATOR(Type, array, num) \
inline const Type& operator[] (unsigned int i) const { \
if (HB_UNLIKELY (i >= num)) return Null##Type; \
......@@ -92,7 +84,7 @@
* object. */
#define DEFINE_OFFSET_ARRAY_TYPE(Type, array, num) \
DEFINE_OFFSET_INDEX_OPERATOR(Type, array, num) \
DEFINE_LEN_AND_SIZE(Offset, array, num)
DEFINE_LEN(Offset, array, num)
#define DEFINE_OFFSET_INDEX_OPERATOR(Type, array, num) \
inline const Type& operator[] (unsigned int i) const { \
if (HB_UNLIKELY (i >= num)) return Null##Type; \
......@@ -105,7 +97,7 @@
* relative to the beginning of the current object. */
#define DEFINE_RECORD_ARRAY_TYPE(Type, array, num) \
DEFINE_RECORD_ACCESSOR(Type, array, num) \
DEFINE_LEN_AND_SIZE(Record, array, num)
DEFINE_LEN(Record, array, num)
#define DEFINE_RECORD_ACCESSOR(Type, array, num) \
inline const Type& operator[] (unsigned int i) const { \
if (HB_UNLIKELY (i >= num)) return Null##Type; \
......@@ -477,7 +469,6 @@ struct OpenTypeFontFile {
return ((char*)this) + table.offset;
}
/* Array interface sans get_size() */
unsigned int get_len (void) const {
switch (tag) {
default: return 0;
......@@ -789,14 +780,6 @@ ASSERT_SIZE (CoverageFormat2, 4);
struct Coverage {
DEFINE_NON_INSTANTIABLE(Coverage);
unsigned int get_size (void) const {
switch (u.coverageFormat) {
case 1: return u.format1.get_size ();
case 2: return u.format2.get_size ();
default:return sizeof (u.coverageFormat);
}
}
unsigned int get_coverage (hb_codepoint_t glyph_id) const {
switch (u.coverageFormat) {
case 1: return u.format1.get_coverage(glyph_id);
......@@ -888,14 +871,6 @@ ASSERT_SIZE (ClassDefFormat2, 4);
struct ClassDef {
DEFINE_NON_INSTANTIABLE(ClassDef);
unsigned int get_size (void) const {
switch (u.classFormat) {
case 1: return u.format1.get_size ();
case 2: return u.format2.get_size ();
default:return sizeof (u.classFormat);
}
}
hb_ot_layout_class_t get_class (hb_codepoint_t glyph_id) const {
switch (u.classFormat) {
case 1: return u.format1.get_class(glyph_id);
......@@ -920,17 +895,6 @@ DEFINE_NULL (ClassDef, 2);
struct Device {
DEFINE_NON_INSTANTIABLE(Device);
unsigned int get_size (void) const {
int count = endSize - startSize + 1;
if (count < 0) count = 0;
switch (deltaFormat) {
case 1: return sizeof (Device) + sizeof (USHORT) * ((count+7)/8);
case 2: return sizeof (Device) + sizeof (USHORT) * ((count+3)/4);
case 3: return sizeof (Device) + sizeof (USHORT) * ((count+1)/2);
default:return sizeof (Device);
}
}
int get_delta (int ppem_size) const {
if (ppem_size >= startSize && ppem_size <= endSize &&
deltaFormat >= 1 && deltaFormat <= 3) {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册