[C++11] Remove IntType::set() in favor of operator=
This commit is contained in:
parent
58ad357951
commit
b986c6a321
@ -272,11 +272,11 @@ struct UnsizedByteStr : UnsizedArrayOf <HBUINT8>
|
|||||||
|
|
||||||
HBUINT8 *p = c->allocate_size<HBUINT8> (1);
|
HBUINT8 *p = c->allocate_size<HBUINT8> (1);
|
||||||
if (unlikely (p == nullptr)) return_trace (false);
|
if (unlikely (p == nullptr)) return_trace (false);
|
||||||
p->set (intOp);
|
*p = intOp;
|
||||||
|
|
||||||
INTTYPE *ip = c->allocate_size<INTTYPE> (INTTYPE::static_size);
|
INTTYPE *ip = c->allocate_size<INTTYPE> (INTTYPE::static_size);
|
||||||
if (unlikely (ip == nullptr)) return_trace (false);
|
if (unlikely (ip == nullptr)) return_trace (false);
|
||||||
ip->set ((unsigned int)value);
|
*ip = (unsigned int) value;
|
||||||
|
|
||||||
return_trace (true);
|
return_trace (true);
|
||||||
}
|
}
|
||||||
|
@ -96,7 +96,7 @@ _hb_ft_font_create (FT_Face ft_face, bool symbol, bool unref)
|
|||||||
|
|
||||||
ft_font->load_flags = FT_LOAD_DEFAULT | FT_LOAD_NO_HINTING;
|
ft_font->load_flags = FT_LOAD_DEFAULT | FT_LOAD_NO_HINTING;
|
||||||
|
|
||||||
ft_font->cached_x_scale.set (0);
|
ft_font->cached_x_scale.set_relaxed (0);
|
||||||
ft_font->advance_cache.init ();
|
ft_font->advance_cache.init ();
|
||||||
|
|
||||||
return ft_font;
|
return ft_font;
|
||||||
|
@ -83,12 +83,6 @@ struct hb_static_size
|
|||||||
template <typename T, typename V, typename B>
|
template <typename T, typename V, typename B>
|
||||||
struct _hb_assign
|
struct _hb_assign
|
||||||
{ static inline void value (T &o, const V v) { o = v; } };
|
{ static inline void value (T &o, const V v) { o = v; } };
|
||||||
template <typename T, typename V>
|
|
||||||
struct _hb_assign<T, V, hb_bool_tt<true || sizeof (T::min_size)> >
|
|
||||||
{ static inline void value (T &o, const V v) { o.set (v); } };
|
|
||||||
template <typename T>
|
|
||||||
struct _hb_assign<T, T, hb_bool_tt<true || sizeof (T::min_size)> >
|
|
||||||
{ static inline void value (T &o, const T v) { o = v; } };
|
|
||||||
|
|
||||||
template <typename T, typename V>
|
template <typename T, typename V>
|
||||||
static inline void hb_assign (T &o, const V v)
|
static inline void hb_assign (T &o, const V v)
|
||||||
|
@ -106,7 +106,7 @@ typedef struct OffsetTable
|
|||||||
bool find_table_index (hb_tag_t tag, unsigned int *table_index) const
|
bool find_table_index (hb_tag_t tag, unsigned int *table_index) const
|
||||||
{
|
{
|
||||||
Tag t;
|
Tag t;
|
||||||
t.set (tag);
|
t = tag;
|
||||||
return tables.bfind (t, table_index, HB_BFIND_NOT_FOUND_STORE, Index::NOT_FOUND_INDEX);
|
return tables.bfind (t, table_index, HB_BFIND_NOT_FOUND_STORE, Index::NOT_FOUND_INDEX);
|
||||||
}
|
}
|
||||||
const TableRecord& get_table_by_tag (hb_tag_t tag) const
|
const TableRecord& get_table_by_tag (hb_tag_t tag) const
|
||||||
@ -127,7 +127,7 @@ typedef struct OffsetTable
|
|||||||
/* Alloc 12 for the OTHeader. */
|
/* Alloc 12 for the OTHeader. */
|
||||||
if (unlikely (!c->extend_min (*this))) return_trace (false);
|
if (unlikely (!c->extend_min (*this))) return_trace (false);
|
||||||
/* Write sfntVersion (bytes 0..3). */
|
/* Write sfntVersion (bytes 0..3). */
|
||||||
sfnt_version.set (sfnt_tag);
|
sfnt_version = sfnt_tag;
|
||||||
/* Take space for numTables, searchRange, entrySelector, RangeShift
|
/* Take space for numTables, searchRange, entrySelector, RangeShift
|
||||||
* and the TableRecords themselves. */
|
* and the TableRecords themselves. */
|
||||||
if (unlikely (!tables.serialize (c, items.length))) return_trace (false);
|
if (unlikely (!tables.serialize (c, items.length))) return_trace (false);
|
||||||
@ -140,8 +140,8 @@ typedef struct OffsetTable
|
|||||||
{
|
{
|
||||||
TableRecord &rec = tables.arrayZ[i];
|
TableRecord &rec = tables.arrayZ[i];
|
||||||
hb_blob_t *blob = items[i].blob;
|
hb_blob_t *blob = items[i].blob;
|
||||||
rec.tag.set (items[i].tag);
|
rec.tag = items[i].tag;
|
||||||
rec.length.set (hb_blob_get_length (blob));
|
rec.length = hb_blob_get_length (blob);
|
||||||
rec.offset.serialize (c, this);
|
rec.offset.serialize (c, this);
|
||||||
|
|
||||||
/* Allocate room for the table and copy it. */
|
/* Allocate room for the table and copy it. */
|
||||||
@ -159,7 +159,7 @@ typedef struct OffsetTable
|
|||||||
{
|
{
|
||||||
head *h = (head *) start;
|
head *h = (head *) start;
|
||||||
checksum_adjustment = &h->checkSumAdjustment;
|
checksum_adjustment = &h->checkSumAdjustment;
|
||||||
checksum_adjustment->set (0);
|
*checksum_adjustment = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
rec.checkSum.set_for_data (start, end - start);
|
rec.checkSum.set_for_data (start, end - start);
|
||||||
@ -177,10 +177,10 @@ typedef struct OffsetTable
|
|||||||
for (unsigned int i = 0; i < items.length; i++)
|
for (unsigned int i = 0; i < items.length; i++)
|
||||||
{
|
{
|
||||||
TableRecord &rec = tables.arrayZ[i];
|
TableRecord &rec = tables.arrayZ[i];
|
||||||
checksum.set (checksum + rec.checkSum);
|
checksum = checksum + rec.checkSum;
|
||||||
}
|
}
|
||||||
|
|
||||||
checksum_adjustment->set (0xB1B0AFBAu - checksum);
|
*checksum_adjustment = 0xB1B0AFBAu - checksum;
|
||||||
}
|
}
|
||||||
|
|
||||||
return_trace (true);
|
return_trace (true);
|
||||||
|
@ -60,7 +60,6 @@ struct IntType
|
|||||||
typedef typename hb_signedness_int (hb_is_signed (Type)) wide_type;
|
typedef typename hb_signedness_int (hb_is_signed (Type)) wide_type;
|
||||||
|
|
||||||
IntType<Type, Size>& operator = (wide_type i) { v = i; return *this; }
|
IntType<Type, Size>& operator = (wide_type i) { v = i; return *this; }
|
||||||
void set (wide_type i) { v = i; }
|
|
||||||
operator wide_type () const { return v; }
|
operator wide_type () const { return v; }
|
||||||
bool operator == (const IntType<Type,Size> &o) const { return (Type) v == (Type) o.v; }
|
bool operator == (const IntType<Type,Size> &o) const { return (Type) v == (Type) o.v; }
|
||||||
bool operator != (const IntType<Type,Size> &o) const { return !(*this == o); }
|
bool operator != (const IntType<Type,Size> &o) const { return !(*this == o); }
|
||||||
@ -107,6 +106,7 @@ typedef HBUINT16 UFWORD;
|
|||||||
/* 16-bit signed fixed number with the low 14 bits of fraction (2.14). */
|
/* 16-bit signed fixed number with the low 14 bits of fraction (2.14). */
|
||||||
struct F2DOT14 : HBINT16
|
struct F2DOT14 : HBINT16
|
||||||
{
|
{
|
||||||
|
F2DOT14& operator = (uint16_t i ) { HBINT16::operator= (i); return *this; }
|
||||||
// 16384 means 1<<14
|
// 16384 means 1<<14
|
||||||
float to_float () const { return ((int32_t) v) / 16384.f; }
|
float to_float () const { return ((int32_t) v) / 16384.f; }
|
||||||
void set_float (float f) { v = round (f * 16384.f); }
|
void set_float (float f) { v = round (f * 16384.f); }
|
||||||
@ -117,6 +117,7 @@ struct F2DOT14 : HBINT16
|
|||||||
/* 32-bit signed fixed-point number (16.16). */
|
/* 32-bit signed fixed-point number (16.16). */
|
||||||
struct Fixed : HBINT32
|
struct Fixed : HBINT32
|
||||||
{
|
{
|
||||||
|
Fixed& operator = (uint32_t i) { HBINT32::operator= (i); return *this; }
|
||||||
// 65536 means 1<<16
|
// 65536 means 1<<16
|
||||||
float to_float () const { return ((int32_t) v) / 65536.f; }
|
float to_float () const { return ((int32_t) v) / 65536.f; }
|
||||||
void set_float (float f) { v = round (f * 65536.f); }
|
void set_float (float f) { v = round (f * 65536.f); }
|
||||||
@ -144,6 +145,7 @@ struct LONGDATETIME
|
|||||||
* system, feature, or baseline */
|
* system, feature, or baseline */
|
||||||
struct Tag : HBUINT32
|
struct Tag : HBUINT32
|
||||||
{
|
{
|
||||||
|
Tag& operator = (uint32_t i) { HBUINT32::operator= (i); return *this; }
|
||||||
/* What the char* converters return is NOT nul-terminated. Print using "%.4s" */
|
/* What the char* converters return is NOT nul-terminated. Print using "%.4s" */
|
||||||
operator const char* () const { return reinterpret_cast<const char *> (&this->v); }
|
operator const char* () const { return reinterpret_cast<const char *> (&this->v); }
|
||||||
operator char* () { return reinterpret_cast<char *> (&this->v); }
|
operator char* () { return reinterpret_cast<char *> (&this->v); }
|
||||||
@ -152,11 +154,15 @@ struct Tag : HBUINT32
|
|||||||
};
|
};
|
||||||
|
|
||||||
/* Glyph index number, same as uint16 (length = 16 bits) */
|
/* Glyph index number, same as uint16 (length = 16 bits) */
|
||||||
struct GlyphID : HBUINT16 {};
|
struct GlyphID : HBUINT16
|
||||||
|
{
|
||||||
|
GlyphID& operator = (uint16_t i) { HBUINT16::operator= (i); return *this; }
|
||||||
|
};
|
||||||
|
|
||||||
/* Script/language-system/feature index */
|
/* Script/language-system/feature index */
|
||||||
struct Index : HBUINT16 {
|
struct Index : HBUINT16 {
|
||||||
static constexpr unsigned NOT_FOUND_INDEX = 0xFFFFu;
|
static constexpr unsigned NOT_FOUND_INDEX = 0xFFFFu;
|
||||||
|
Index& operator = (uint16_t i) { HBUINT16::operator= (i); return *this; }
|
||||||
};
|
};
|
||||||
DECLARE_NULL_NAMESPACE_BYTES (OT, Index);
|
DECLARE_NULL_NAMESPACE_BYTES (OT, Index);
|
||||||
|
|
||||||
@ -166,6 +172,8 @@ typedef Index NameID;
|
|||||||
template <typename Type, bool has_null=true>
|
template <typename Type, bool has_null=true>
|
||||||
struct Offset : Type
|
struct Offset : Type
|
||||||
{
|
{
|
||||||
|
Offset& operator = (typename Type::type i) { Type::operator= (i); return *this; }
|
||||||
|
|
||||||
typedef Type type;
|
typedef Type type;
|
||||||
|
|
||||||
bool is_null () const { return has_null && 0 == *this; }
|
bool is_null () const { return has_null && 0 == *this; }
|
||||||
@ -173,7 +181,7 @@ struct Offset : Type
|
|||||||
void *serialize (hb_serialize_context_t *c, const void *base)
|
void *serialize (hb_serialize_context_t *c, const void *base)
|
||||||
{
|
{
|
||||||
void *t = c->start_embed<void> ();
|
void *t = c->start_embed<void> ();
|
||||||
this->set ((char *) t - (char *) base); /* TODO(serialize) Overflow? */
|
*this = (char *) t - (char *) base; /* TODO(serialize) Overflow? */
|
||||||
return t;
|
return t;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -188,6 +196,8 @@ typedef Offset<HBUINT32> Offset32;
|
|||||||
/* CheckSum */
|
/* CheckSum */
|
||||||
struct CheckSum : HBUINT32
|
struct CheckSum : HBUINT32
|
||||||
{
|
{
|
||||||
|
CheckSum& operator = (uint32_t i) { HBUINT32::operator= (i); return *this; }
|
||||||
|
|
||||||
/* This is reference implementation from the spec. */
|
/* This is reference implementation from the spec. */
|
||||||
static uint32_t CalcTableChecksum (const HBUINT32 *Table, uint32_t Length)
|
static uint32_t CalcTableChecksum (const HBUINT32 *Table, uint32_t Length)
|
||||||
{
|
{
|
||||||
@ -202,7 +212,7 @@ struct CheckSum : HBUINT32
|
|||||||
|
|
||||||
/* Note: data should be 4byte aligned and have 4byte padding at the end. */
|
/* Note: data should be 4byte aligned and have 4byte padding at the end. */
|
||||||
void set_for_data (const void *data, unsigned int length)
|
void set_for_data (const void *data, unsigned int length)
|
||||||
{ set (CalcTableChecksum ((const HBUINT32 *) data, length)); }
|
{ *this = CalcTableChecksum ((const HBUINT32 *) data, length); }
|
||||||
|
|
||||||
public:
|
public:
|
||||||
DEFINE_SIZE_STATIC (4);
|
DEFINE_SIZE_STATIC (4);
|
||||||
@ -252,6 +262,8 @@ struct _hb_has_null<Type, true>
|
|||||||
template <typename Type, typename OffsetType=HBUINT16, bool has_null=true>
|
template <typename Type, typename OffsetType=HBUINT16, bool has_null=true>
|
||||||
struct OffsetTo : Offset<OffsetType, has_null>
|
struct OffsetTo : Offset<OffsetType, has_null>
|
||||||
{
|
{
|
||||||
|
OffsetTo& operator = (typename OffsetType::type i) { OffsetType::operator= (i); return *this; }
|
||||||
|
|
||||||
const Type& operator () (const void *base) const
|
const Type& operator () (const void *base) const
|
||||||
{
|
{
|
||||||
if (unlikely (this->is_null ())) return *_hb_has_null<Type, has_null>::get_null ();
|
if (unlikely (this->is_null ())) return *_hb_has_null<Type, has_null>::get_null ();
|
||||||
@ -273,12 +285,12 @@ struct OffsetTo : Offset<OffsetType, has_null>
|
|||||||
{
|
{
|
||||||
if (&src == &Null (T))
|
if (&src == &Null (T))
|
||||||
{
|
{
|
||||||
this->set (0);
|
*this = 0;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
serialize (c->serializer, base);
|
serialize (c->serializer, base);
|
||||||
if (!src.subset (c))
|
if (!src.subset (c))
|
||||||
this->set (0);
|
*this = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool sanitize_shallow (hb_sanitize_context_t *c, const void *base) const
|
bool sanitize_shallow (hb_sanitize_context_t *c, const void *base) const
|
||||||
@ -558,7 +570,7 @@ struct ArrayOf
|
|||||||
{
|
{
|
||||||
TRACE_SERIALIZE (this);
|
TRACE_SERIALIZE (this);
|
||||||
if (unlikely (!c->extend_min (*this))) return_trace (false);
|
if (unlikely (!c->extend_min (*this))) return_trace (false);
|
||||||
len.set (items_len); /* TODO(serialize) Overflow? */
|
len = items_len; /* TODO(serialize) Overflow? */
|
||||||
if (unlikely (!c->extend (*this))) return_trace (false);
|
if (unlikely (!c->extend (*this))) return_trace (false);
|
||||||
return_trace (true);
|
return_trace (true);
|
||||||
}
|
}
|
||||||
@ -717,7 +729,7 @@ struct HeadlessArrayOf
|
|||||||
{
|
{
|
||||||
TRACE_SERIALIZE (this);
|
TRACE_SERIALIZE (this);
|
||||||
if (unlikely (!c->extend_min (*this))) return_trace (false);
|
if (unlikely (!c->extend_min (*this))) return_trace (false);
|
||||||
lenP1.set (items.length + 1); /* TODO(serialize) Overflow? */
|
lenP1 = items.length + 1; /* TODO(serialize) Overflow? */
|
||||||
if (unlikely (!c->extend (*this))) return_trace (false);
|
if (unlikely (!c->extend (*this))) return_trace (false);
|
||||||
for (unsigned int i = 0; i < items.length; i++)
|
for (unsigned int i = 0; i < items.length; i++)
|
||||||
arrayZ[i] = items[i];
|
arrayZ[i] = items[i];
|
||||||
@ -872,15 +884,16 @@ struct BinSearchHeader
|
|||||||
return_trace (c->check_struct (this));
|
return_trace (c->check_struct (this));
|
||||||
}
|
}
|
||||||
|
|
||||||
void set (unsigned int v)
|
BinSearchHeader& operator = (unsigned int v)
|
||||||
{
|
{
|
||||||
len.set (v);
|
len = v;
|
||||||
assert (len == v);
|
assert (len == v);
|
||||||
entrySelector.set (MAX (1u, hb_bit_storage (v)) - 1);
|
entrySelector = MAX (1u, hb_bit_storage (v)) - 1;
|
||||||
searchRange.set (16 * (1u << entrySelector));
|
searchRange = 16 * (1u << entrySelector);
|
||||||
rangeShift.set (v * 16 > searchRange
|
rangeShift = v * 16 > searchRange
|
||||||
? 16 * v - searchRange
|
? 16 * v - searchRange
|
||||||
: 0);
|
: 0;
|
||||||
|
return *this;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
@ -124,14 +124,14 @@ struct CFFIndex
|
|||||||
{
|
{
|
||||||
COUNT *dest = c->allocate_min<COUNT> ();
|
COUNT *dest = c->allocate_min<COUNT> ();
|
||||||
if (unlikely (dest == nullptr)) return_trace (false);
|
if (unlikely (dest == nullptr)) return_trace (false);
|
||||||
dest->set (0);
|
*dest = 0;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
/* serialize CFFIndex header */
|
/* serialize CFFIndex header */
|
||||||
if (unlikely (!c->extend_min (*this))) return_trace (false);
|
if (unlikely (!c->extend_min (*this))) return_trace (false);
|
||||||
this->count.set (byteArray.length);
|
this->count = byteArray.length;
|
||||||
this->offSize.set (offSize_);
|
this->offSize = offSize_;
|
||||||
if (!unlikely (c->allocate_size<HBUINT8> (offSize_ * (byteArray.length + 1))))
|
if (!unlikely (c->allocate_size<HBUINT8> (offSize_ * (byteArray.length + 1))))
|
||||||
return_trace (false);
|
return_trace (false);
|
||||||
|
|
||||||
@ -181,7 +181,7 @@ struct CFFIndex
|
|||||||
for (; size; size--)
|
for (; size; size--)
|
||||||
{
|
{
|
||||||
--p;
|
--p;
|
||||||
p->set (offset & 0xFF);
|
*p = offset & 0xFF;
|
||||||
offset >>= 8;
|
offset >>= 8;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -275,8 +275,8 @@ struct CFFIndexOf : CFFIndex<COUNT>
|
|||||||
TRACE_SERIALIZE (this);
|
TRACE_SERIALIZE (this);
|
||||||
/* serialize CFFIndex header */
|
/* serialize CFFIndex header */
|
||||||
if (unlikely (!c->extend_min (*this))) return_trace (false);
|
if (unlikely (!c->extend_min (*this))) return_trace (false);
|
||||||
this->count.set (dataArrayLen);
|
this->count = dataArrayLen;
|
||||||
this->offSize.set (offSize_);
|
this->offSize = offSize_;
|
||||||
if (!unlikely (c->allocate_size<HBUINT8> (offSize_ * (dataArrayLen + 1))))
|
if (!unlikely (c->allocate_size<HBUINT8> (offSize_ * (dataArrayLen + 1))))
|
||||||
return_trace (false);
|
return_trace (false);
|
||||||
|
|
||||||
@ -376,11 +376,11 @@ struct Dict : UnsizedByteStr
|
|||||||
if (unlikely (p == nullptr)) return_trace (false);
|
if (unlikely (p == nullptr)) return_trace (false);
|
||||||
if (Is_OpCode_ESC (op))
|
if (Is_OpCode_ESC (op))
|
||||||
{
|
{
|
||||||
p->set (OpCode_escape);
|
*p = OpCode_escape;
|
||||||
op = Unmake_OpCode_ESC (op);
|
op = Unmake_OpCode_ESC (op);
|
||||||
p++;
|
p++;
|
||||||
}
|
}
|
||||||
p->set (op);
|
*p = op;
|
||||||
return_trace (true);
|
return_trace (true);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -477,8 +477,8 @@ struct FDArray : CFFIndexOf<COUNT, FontDict>
|
|||||||
{
|
{
|
||||||
TRACE_SERIALIZE (this);
|
TRACE_SERIALIZE (this);
|
||||||
if (unlikely (!c->extend_min (*this))) return_trace (false);
|
if (unlikely (!c->extend_min (*this))) return_trace (false);
|
||||||
this->count.set (fontDicts.length);
|
this->count = fontDicts.length;
|
||||||
this->offSize.set (offSize_);
|
this->offSize = offSize_;
|
||||||
if (!unlikely (c->allocate_size<HBUINT8> (offSize_ * (fontDicts.length + 1))))
|
if (!unlikely (c->allocate_size<HBUINT8> (offSize_ * (fontDicts.length + 1))))
|
||||||
return_trace (false);
|
return_trace (false);
|
||||||
|
|
||||||
@ -514,8 +514,8 @@ struct FDArray : CFFIndexOf<COUNT, FontDict>
|
|||||||
{
|
{
|
||||||
TRACE_SERIALIZE (this);
|
TRACE_SERIALIZE (this);
|
||||||
if (unlikely (!c->extend_min (*this))) return_trace (false);
|
if (unlikely (!c->extend_min (*this))) return_trace (false);
|
||||||
this->count.set (fdCount);
|
this->count = fdCount;
|
||||||
this->offSize.set (offSize_);
|
this->offSize = offSize_;
|
||||||
if (!unlikely (c->allocate_size<HBUINT8> (offSize_ * (fdCount + 1))))
|
if (!unlikely (c->allocate_size<HBUINT8> (offSize_ * (fdCount + 1))))
|
||||||
return_trace (false);
|
return_trace (false);
|
||||||
|
|
||||||
|
@ -196,18 +196,18 @@ struct Encoding {
|
|||||||
TRACE_SERIALIZE (this);
|
TRACE_SERIALIZE (this);
|
||||||
Encoding *dest = c->extend_min (*this);
|
Encoding *dest = c->extend_min (*this);
|
||||||
if (unlikely (dest == nullptr)) return_trace (false);
|
if (unlikely (dest == nullptr)) return_trace (false);
|
||||||
dest->format.set (format | ((supp_codes.length > 0)? 0x80: 0));
|
dest->format = format | ((supp_codes.length > 0)? 0x80: 0);
|
||||||
if (format == 0)
|
if (format == 0)
|
||||||
{
|
{
|
||||||
Encoding0 *fmt0 = c->allocate_size<Encoding0> (Encoding0::min_size + HBUINT8::static_size * enc_count);
|
Encoding0 *fmt0 = c->allocate_size<Encoding0> (Encoding0::min_size + HBUINT8::static_size * enc_count);
|
||||||
if (unlikely (fmt0 == nullptr)) return_trace (false);
|
if (unlikely (fmt0 == nullptr)) return_trace (false);
|
||||||
fmt0->nCodes ().set (enc_count);
|
fmt0->nCodes () = enc_count;
|
||||||
unsigned int glyph = 0;
|
unsigned int glyph = 0;
|
||||||
for (unsigned int i = 0; i < code_ranges.length; i++)
|
for (unsigned int i = 0; i < code_ranges.length; i++)
|
||||||
{
|
{
|
||||||
hb_codepoint_t code = code_ranges[i].code;
|
hb_codepoint_t code = code_ranges[i].code;
|
||||||
for (int left = (int)code_ranges[i].glyph; left >= 0; left--)
|
for (int left = (int)code_ranges[i].glyph; left >= 0; left--)
|
||||||
fmt0->codes[glyph++].set (code++);
|
fmt0->codes[glyph++] = code++;
|
||||||
if (unlikely (!((glyph <= 0x100) && (code <= 0x100))))
|
if (unlikely (!((glyph <= 0x100) && (code <= 0x100))))
|
||||||
return_trace (false);
|
return_trace (false);
|
||||||
}
|
}
|
||||||
@ -216,24 +216,24 @@ struct Encoding {
|
|||||||
{
|
{
|
||||||
Encoding1 *fmt1 = c->allocate_size<Encoding1> (Encoding1::min_size + Encoding1_Range::static_size * code_ranges.length);
|
Encoding1 *fmt1 = c->allocate_size<Encoding1> (Encoding1::min_size + Encoding1_Range::static_size * code_ranges.length);
|
||||||
if (unlikely (fmt1 == nullptr)) return_trace (false);
|
if (unlikely (fmt1 == nullptr)) return_trace (false);
|
||||||
fmt1->nRanges ().set (code_ranges.length);
|
fmt1->nRanges () = code_ranges.length;
|
||||||
for (unsigned int i = 0; i < code_ranges.length; i++)
|
for (unsigned int i = 0; i < code_ranges.length; i++)
|
||||||
{
|
{
|
||||||
if (unlikely (!((code_ranges[i].code <= 0xFF) && (code_ranges[i].glyph <= 0xFF))))
|
if (unlikely (!((code_ranges[i].code <= 0xFF) && (code_ranges[i].glyph <= 0xFF))))
|
||||||
return_trace (false);
|
return_trace (false);
|
||||||
fmt1->ranges[i].first.set (code_ranges[i].code);
|
fmt1->ranges[i].first = code_ranges[i].code;
|
||||||
fmt1->ranges[i].nLeft.set (code_ranges[i].glyph);
|
fmt1->ranges[i].nLeft = code_ranges[i].glyph;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (supp_codes.length > 0)
|
if (supp_codes.length > 0)
|
||||||
{
|
{
|
||||||
CFF1SuppEncData *suppData = c->allocate_size<CFF1SuppEncData> (CFF1SuppEncData::min_size + SuppEncoding::static_size * supp_codes.length);
|
CFF1SuppEncData *suppData = c->allocate_size<CFF1SuppEncData> (CFF1SuppEncData::min_size + SuppEncoding::static_size * supp_codes.length);
|
||||||
if (unlikely (suppData == nullptr)) return_trace (false);
|
if (unlikely (suppData == nullptr)) return_trace (false);
|
||||||
suppData->nSups ().set (supp_codes.length);
|
suppData->nSups () = supp_codes.length;
|
||||||
for (unsigned int i = 0; i < supp_codes.length; i++)
|
for (unsigned int i = 0; i < supp_codes.length; i++)
|
||||||
{
|
{
|
||||||
suppData->supps[i].code.set (supp_codes[i].code);
|
suppData->supps[i].code = supp_codes[i].code;
|
||||||
suppData->supps[i].glyph.set (supp_codes[i].glyph); /* actually SID */
|
suppData->supps[i].glyph = supp_codes[i].glyph; /* actually SID */
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return_trace (true);
|
return_trace (true);
|
||||||
@ -469,7 +469,7 @@ struct Charset {
|
|||||||
TRACE_SERIALIZE (this);
|
TRACE_SERIALIZE (this);
|
||||||
Charset *dest = c->extend_min (*this);
|
Charset *dest = c->extend_min (*this);
|
||||||
if (unlikely (dest == nullptr)) return_trace (false);
|
if (unlikely (dest == nullptr)) return_trace (false);
|
||||||
dest->format.set (format);
|
dest->format = format;
|
||||||
if (format == 0)
|
if (format == 0)
|
||||||
{
|
{
|
||||||
Charset0 *fmt0 = c->allocate_size<Charset0> (Charset0::min_size + HBUINT16::static_size * (num_glyphs - 1));
|
Charset0 *fmt0 = c->allocate_size<Charset0> (Charset0::min_size + HBUINT16::static_size * (num_glyphs - 1));
|
||||||
@ -479,7 +479,7 @@ struct Charset {
|
|||||||
{
|
{
|
||||||
hb_codepoint_t sid = sid_ranges[i].code;
|
hb_codepoint_t sid = sid_ranges[i].code;
|
||||||
for (int left = (int)sid_ranges[i].glyph; left >= 0; left--)
|
for (int left = (int)sid_ranges[i].glyph; left >= 0; left--)
|
||||||
fmt0->sids[glyph++].set (sid++);
|
fmt0->sids[glyph++] = sid++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (format == 1)
|
else if (format == 1)
|
||||||
@ -490,8 +490,8 @@ struct Charset {
|
|||||||
{
|
{
|
||||||
if (unlikely (!(sid_ranges[i].glyph <= 0xFF)))
|
if (unlikely (!(sid_ranges[i].glyph <= 0xFF)))
|
||||||
return_trace (false);
|
return_trace (false);
|
||||||
fmt1->ranges[i].first.set (sid_ranges[i].code);
|
fmt1->ranges[i].first = sid_ranges[i].code;
|
||||||
fmt1->ranges[i].nLeft.set (sid_ranges[i].glyph);
|
fmt1->ranges[i].nLeft = sid_ranges[i].glyph;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else /* format 2 */
|
else /* format 2 */
|
||||||
@ -502,8 +502,8 @@ struct Charset {
|
|||||||
{
|
{
|
||||||
if (unlikely (!(sid_ranges[i].glyph <= 0xFFFF)))
|
if (unlikely (!(sid_ranges[i].glyph <= 0xFFFF)))
|
||||||
return_trace (false);
|
return_trace (false);
|
||||||
fmt2->ranges[i].first.set (sid_ranges[i].code);
|
fmt2->ranges[i].first = sid_ranges[i].code;
|
||||||
fmt2->ranges[i].nLeft.set (sid_ranges[i].glyph);
|
fmt2->ranges[i].nLeft = sid_ranges[i].glyph;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return_trace (true);
|
return_trace (true);
|
||||||
@ -577,7 +577,7 @@ struct CFF1StringIndex : CFF1Index
|
|||||||
{
|
{
|
||||||
if (!unlikely (c->extend_min (this->count)))
|
if (!unlikely (c->extend_min (this->count)))
|
||||||
return_trace (false);
|
return_trace (false);
|
||||||
count.set (0);
|
count = 0;
|
||||||
return_trace (true);
|
return_trace (true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -89,15 +89,15 @@ struct CmapSubtableFormat4
|
|||||||
|
|
||||||
if (unlikely (!c->extend_min (*this))) return_trace (false);
|
if (unlikely (!c->extend_min (*this))) return_trace (false);
|
||||||
|
|
||||||
this->format.set (4);
|
this->format = 4;
|
||||||
this->length.set (get_sub_table_size (segments));
|
this->length = get_sub_table_size (segments);
|
||||||
|
|
||||||
this->segCountX2.set (segments.length * 2);
|
this->segCountX2 = segments.length * 2;
|
||||||
this->entrySelector.set (MAX (1u, hb_bit_storage (segments.length)) - 1);
|
this->entrySelector = MAX (1u, hb_bit_storage (segments.length)) - 1;
|
||||||
this->searchRange.set (2 * (1u << this->entrySelector));
|
this->searchRange = 2 * (1u << this->entrySelector);
|
||||||
this->rangeShift.set (segments.length * 2 > this->searchRange
|
this->rangeShift = segments.length * 2 > this->searchRange
|
||||||
? 2 * segments.length - this->searchRange
|
? 2 * segments.length - this->searchRange
|
||||||
: 0);
|
: 0;
|
||||||
|
|
||||||
HBUINT16 *end_count = c->allocate_size<HBUINT16> (HBUINT16::static_size * segments.length);
|
HBUINT16 *end_count = c->allocate_size<HBUINT16> (HBUINT16::static_size * segments.length);
|
||||||
c->allocate_size<HBUINT16> (HBUINT16::static_size); // 2 bytes of padding.
|
c->allocate_size<HBUINT16> (HBUINT16::static_size); // 2 bytes of padding.
|
||||||
@ -110,17 +110,17 @@ struct CmapSubtableFormat4
|
|||||||
|
|
||||||
for (unsigned int i = 0; i < segments.length; i++)
|
for (unsigned int i = 0; i < segments.length; i++)
|
||||||
{
|
{
|
||||||
end_count[i].set (segments[i].end_code);
|
end_count[i] = segments[i].end_code;
|
||||||
start_count[i].set (segments[i].start_code);
|
start_count[i] = segments[i].start_code;
|
||||||
if (segments[i].use_delta)
|
if (segments[i].use_delta)
|
||||||
{
|
{
|
||||||
hb_codepoint_t cp = segments[i].start_code;
|
hb_codepoint_t cp = segments[i].start_code;
|
||||||
hb_codepoint_t start_gid = 0;
|
hb_codepoint_t start_gid = 0;
|
||||||
if (unlikely (!plan->new_gid_for_codepoint (cp, &start_gid) && cp != 0xFFFF))
|
if (unlikely (!plan->new_gid_for_codepoint (cp, &start_gid) && cp != 0xFFFF))
|
||||||
return_trace (false);
|
return_trace (false);
|
||||||
id_delta[i].set (start_gid - segments[i].start_code);
|
id_delta[i] = start_gid - segments[i].start_code;
|
||||||
} else {
|
} else {
|
||||||
id_delta[i].set (0);
|
id_delta[i] = 0;
|
||||||
unsigned int num_codepoints = segments[i].end_code - segments[i].start_code + 1;
|
unsigned int num_codepoints = segments[i].end_code - segments[i].start_code + 1;
|
||||||
HBUINT16 *glyph_id_array = c->allocate_size<HBUINT16> (HBUINT16::static_size * num_codepoints);
|
HBUINT16 *glyph_id_array = c->allocate_size<HBUINT16> (HBUINT16::static_size * num_codepoints);
|
||||||
if (glyph_id_array == nullptr)
|
if (glyph_id_array == nullptr)
|
||||||
@ -138,15 +138,14 @@ struct CmapSubtableFormat4
|
|||||||
// id_range_offset[i]
|
// id_range_offset[i]
|
||||||
// =
|
// =
|
||||||
// 2 * (glyph_id_array - id_range_offset - i)
|
// 2 * (glyph_id_array - id_range_offset - i)
|
||||||
id_range_offset[i].set (2 * (
|
id_range_offset[i] = 2 * (glyph_id_array - id_range_offset - i);
|
||||||
glyph_id_array - id_range_offset - i));
|
|
||||||
for (unsigned int j = 0; j < num_codepoints; j++)
|
for (unsigned int j = 0; j < num_codepoints; j++)
|
||||||
{
|
{
|
||||||
hb_codepoint_t cp = segments[i].start_code + j;
|
hb_codepoint_t cp = segments[i].start_code + j;
|
||||||
hb_codepoint_t new_gid;
|
hb_codepoint_t new_gid;
|
||||||
if (unlikely (!plan->new_gid_for_codepoint (cp, &new_gid)))
|
if (unlikely (!plan->new_gid_for_codepoint (cp, &new_gid)))
|
||||||
return_trace (false);
|
return_trace (false);
|
||||||
glyph_id_array[j].set (new_gid);
|
glyph_id_array[j] = new_gid;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -198,11 +197,11 @@ struct CmapSubtableFormat4
|
|||||||
cp != segment->end_code + 1u)
|
cp != segment->end_code + 1u)
|
||||||
{
|
{
|
||||||
segment = segments->push ();
|
segment = segments->push ();
|
||||||
segment->start_code.set (cp);
|
segment->start_code = cp;
|
||||||
segment->end_code.set (cp);
|
segment->end_code = cp;
|
||||||
segment->use_delta = true;
|
segment->use_delta = true;
|
||||||
} else {
|
} else {
|
||||||
segment->end_code.set (cp);
|
segment->end_code = cp;
|
||||||
if (last_gid + 1u != new_gid)
|
if (last_gid + 1u != new_gid)
|
||||||
// gid's are not consecutive in this segment so delta
|
// gid's are not consecutive in this segment so delta
|
||||||
// cannot be used.
|
// cannot be used.
|
||||||
@ -216,8 +215,8 @@ struct CmapSubtableFormat4
|
|||||||
if (segment == nullptr || segment->end_code != 0xFFFF)
|
if (segment == nullptr || segment->end_code != 0xFFFF)
|
||||||
{
|
{
|
||||||
segment = segments->push ();
|
segment = segments->push ();
|
||||||
segment->start_code.set (0xFFFF);
|
segment->start_code = 0xFFFF;
|
||||||
segment->end_code.set (0xFFFF);
|
segment->end_code = 0xFFFF;
|
||||||
segment->use_delta = true;
|
segment->use_delta = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -523,9 +522,9 @@ struct CmapSubtableFormat12 : CmapSubtableLongSegmented<CmapSubtableFormat12>
|
|||||||
{
|
{
|
||||||
if (unlikely (!c->extend_min (*this))) return false;
|
if (unlikely (!c->extend_min (*this))) return false;
|
||||||
|
|
||||||
this->format.set (12);
|
this->format = 12;
|
||||||
this->reserved.set (0);
|
this->reserved = 0;
|
||||||
this->length.set (get_sub_table_size (groups));
|
this->length = get_sub_table_size (groups);
|
||||||
|
|
||||||
return CmapSubtableLongSegmented<CmapSubtableFormat12>::serialize (c, groups);
|
return CmapSubtableLongSegmented<CmapSubtableFormat12>::serialize (c, groups);
|
||||||
}
|
}
|
||||||
@ -552,11 +551,11 @@ struct CmapSubtableFormat12 : CmapSubtableLongSegmented<CmapSubtableFormat12>
|
|||||||
if (!group || !_is_gid_consecutive (group, cp, new_gid))
|
if (!group || !_is_gid_consecutive (group, cp, new_gid))
|
||||||
{
|
{
|
||||||
group = groups->push ();
|
group = groups->push ();
|
||||||
group->startCharCode.set (cp);
|
group->startCharCode = cp;
|
||||||
group->endCharCode.set (cp);
|
group->endCharCode = cp;
|
||||||
group->glyphID.set (new_gid);
|
group->glyphID = new_gid;
|
||||||
}
|
}
|
||||||
else group->endCharCode.set (cp);
|
else group->endCharCode = cp;
|
||||||
}
|
}
|
||||||
|
|
||||||
DEBUG_MSG(SUBSET, nullptr, "cmap");
|
DEBUG_MSG(SUBSET, nullptr, "cmap");
|
||||||
@ -879,7 +878,7 @@ struct cmap
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
table->version.set (0);
|
table->version = 0;
|
||||||
|
|
||||||
if (unlikely (!table->encodingRecord.serialize (&c, /* numTables */ 3)))
|
if (unlikely (!table->encodingRecord.serialize (&c, /* numTables */ 3)))
|
||||||
return false;
|
return false;
|
||||||
@ -888,24 +887,24 @@ struct cmap
|
|||||||
|
|
||||||
// Format 4, Plat 0 Encoding Record
|
// Format 4, Plat 0 Encoding Record
|
||||||
EncodingRecord &format4_plat0_rec = table->encodingRecord[0];
|
EncodingRecord &format4_plat0_rec = table->encodingRecord[0];
|
||||||
format4_plat0_rec.platformID.set (0); // Unicode
|
format4_plat0_rec.platformID = 0; // Unicode
|
||||||
format4_plat0_rec.encodingID.set (3);
|
format4_plat0_rec.encodingID = 3;
|
||||||
|
|
||||||
// Format 4, Plat 3 Encoding Record
|
// Format 4, Plat 3 Encoding Record
|
||||||
EncodingRecord &format4_plat3_rec = table->encodingRecord[1];
|
EncodingRecord &format4_plat3_rec = table->encodingRecord[1];
|
||||||
format4_plat3_rec.platformID.set (3); // Windows
|
format4_plat3_rec.platformID = 3; // Windows
|
||||||
format4_plat3_rec.encodingID.set (1); // Unicode BMP
|
format4_plat3_rec.encodingID = 1; // Unicode BMP
|
||||||
|
|
||||||
// Format 12 Encoding Record
|
// Format 12 Encoding Record
|
||||||
EncodingRecord &format12_rec = table->encodingRecord[2];
|
EncodingRecord &format12_rec = table->encodingRecord[2];
|
||||||
format12_rec.platformID.set (3); // Windows
|
format12_rec.platformID = 3; // Windows
|
||||||
format12_rec.encodingID.set (10); // Unicode UCS-4
|
format12_rec.encodingID = 10; // Unicode UCS-4
|
||||||
|
|
||||||
// Write out format 4 sub table
|
// Write out format 4 sub table
|
||||||
{
|
{
|
||||||
CmapSubtable &subtable = format4_plat0_rec.subtable.serialize (&c, table);
|
CmapSubtable &subtable = format4_plat0_rec.subtable.serialize (&c, table);
|
||||||
format4_plat3_rec.subtable.set (format4_plat0_rec.subtable);
|
format4_plat3_rec.subtable = format4_plat0_rec.subtable;
|
||||||
subtable.u.format.set (4);
|
subtable.u.format = 4;
|
||||||
|
|
||||||
CmapSubtableFormat4 &format4 = subtable.u.format4;
|
CmapSubtableFormat4 &format4 = subtable.u.format4;
|
||||||
if (unlikely (!format4.serialize (&c, plan, cmap_subset_plan.format4_segments)))
|
if (unlikely (!format4.serialize (&c, plan, cmap_subset_plan.format4_segments)))
|
||||||
@ -915,7 +914,7 @@ struct cmap
|
|||||||
// Write out format 12 sub table.
|
// Write out format 12 sub table.
|
||||||
{
|
{
|
||||||
CmapSubtable &subtable = format12_rec.subtable.serialize (&c, table);
|
CmapSubtable &subtable = format12_rec.subtable.serialize (&c, table);
|
||||||
subtable.u.format.set (12);
|
subtable.u.format = 12;
|
||||||
|
|
||||||
CmapSubtableFormat12 &format12 = subtable.u.format12;
|
CmapSubtableFormat12 &format12 = subtable.u.format12;
|
||||||
if (unlikely (!format12.serialize (&c, cmap_subset_plan.format12_groups)))
|
if (unlikely (!format12.serialize (&c, cmap_subset_plan.format12_groups)))
|
||||||
@ -1144,8 +1143,8 @@ struct cmap
|
|||||||
unsigned int encoding_id) const
|
unsigned int encoding_id) const
|
||||||
{
|
{
|
||||||
EncodingRecord key;
|
EncodingRecord key;
|
||||||
key.platformID.set (platform_id);
|
key.platformID = platform_id;
|
||||||
key.encodingID.set (encoding_id);
|
key.encodingID = encoding_id;
|
||||||
|
|
||||||
const EncodingRecord &result = encodingRecord.bsearch (key);
|
const EncodingRecord &result = encodingRecord.bsearch (key);
|
||||||
if (!result.subtable)
|
if (!result.subtable)
|
||||||
|
@ -112,7 +112,7 @@ struct glyf
|
|||||||
return false;
|
return false;
|
||||||
|
|
||||||
head *head_prime = (head *) hb_blob_get_data_writable (head_prime_blob, nullptr);
|
head *head_prime = (head *) hb_blob_get_data_writable (head_prime_blob, nullptr);
|
||||||
head_prime->indexToLocFormat.set (use_short_loca ? 0 : 1);
|
head_prime->indexToLocFormat = use_short_loca ? 0 : 1;
|
||||||
bool success = plan->add_table (HB_OT_TAG_head, head_prime_blob);
|
bool success = plan->add_table (HB_OT_TAG_head, head_prime_blob);
|
||||||
|
|
||||||
hb_blob_destroy (head_prime_blob);
|
hb_blob_destroy (head_prime_blob);
|
||||||
|
@ -88,8 +88,8 @@ struct DeviceRecord
|
|||||||
return_trace (false);
|
return_trace (false);
|
||||||
}
|
}
|
||||||
|
|
||||||
this->pixelSize.set (subset_view.source_device_record->pixelSize);
|
this->pixelSize = subset_view.source_device_record->pixelSize;
|
||||||
this->maxWidth.set (subset_view.source_device_record->maxWidth);
|
this->maxWidth = subset_view.source_device_record->maxWidth;
|
||||||
|
|
||||||
for (unsigned int i = 0; i < subset_view.len (); i++)
|
for (unsigned int i = 0; i < subset_view.len (); i++)
|
||||||
{
|
{
|
||||||
@ -99,7 +99,7 @@ struct DeviceRecord
|
|||||||
DEBUG_MSG(SUBSET, nullptr, "HDMX width for new gid %d is missing.", i);
|
DEBUG_MSG(SUBSET, nullptr, "HDMX width for new gid %d is missing.", i);
|
||||||
return_trace (false);
|
return_trace (false);
|
||||||
}
|
}
|
||||||
widthsZ[i].set (*width);
|
widthsZ[i] = *width;
|
||||||
}
|
}
|
||||||
|
|
||||||
return_trace (true);
|
return_trace (true);
|
||||||
@ -141,9 +141,9 @@ struct hdmx
|
|||||||
|
|
||||||
if (unlikely (!c->extend_min ((*this)))) return_trace (false);
|
if (unlikely (!c->extend_min ((*this)))) return_trace (false);
|
||||||
|
|
||||||
this->version.set (source_hdmx->version);
|
this->version = source_hdmx->version;
|
||||||
this->numRecords.set (source_hdmx->numRecords);
|
this->numRecords = source_hdmx->numRecords;
|
||||||
this->sizeDeviceRecord.set (DeviceRecord::get_size (plan->num_output_glyphs ()));
|
this->sizeDeviceRecord = DeviceRecord::get_size (plan->num_output_glyphs ());
|
||||||
|
|
||||||
for (unsigned int i = 0; i < source_hdmx->numRecords; i++)
|
for (unsigned int i = 0; i < source_hdmx->numRecords; i++)
|
||||||
{
|
{
|
||||||
|
@ -78,7 +78,7 @@ struct hmtxvmtx
|
|||||||
|
|
||||||
unsigned int length;
|
unsigned int length;
|
||||||
H *table = (H *) hb_blob_get_data (dest_blob, &length);
|
H *table = (H *) hb_blob_get_data (dest_blob, &length);
|
||||||
table->numberOfLongMetrics.set (num_hmetrics);
|
table->numberOfLongMetrics = num_hmetrics;
|
||||||
|
|
||||||
bool result = plan->add_table (H::tableTag, dest_blob);
|
bool result = plan->add_table (H::tableTag, dest_blob);
|
||||||
hb_blob_destroy (dest_blob);
|
hb_blob_destroy (dest_blob);
|
||||||
@ -128,12 +128,12 @@ struct hmtxvmtx
|
|||||||
bool has_advance = i < num_advances;
|
bool has_advance = i < num_advances;
|
||||||
if (has_advance)
|
if (has_advance)
|
||||||
{
|
{
|
||||||
((LongMetric *) dest_pos)->advance.set (advance);
|
((LongMetric *) dest_pos)->advance = advance;
|
||||||
((LongMetric *) dest_pos)->sb.set (side_bearing);
|
((LongMetric *) dest_pos)->sb = side_bearing;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
((FWORD *) dest_pos)->set (side_bearing);
|
*((FWORD *) dest_pos) = side_bearing;
|
||||||
}
|
}
|
||||||
dest_pos += (has_advance ? 4 : 2);
|
dest_pos += (has_advance ? 4 : 2);
|
||||||
}
|
}
|
||||||
|
@ -561,7 +561,7 @@ struct Feature
|
|||||||
TRACE_SUBSET (this);
|
TRACE_SUBSET (this);
|
||||||
struct Feature *out = c->serializer->embed (*this);
|
struct Feature *out = c->serializer->embed (*this);
|
||||||
if (unlikely (!out)) return_trace (false);
|
if (unlikely (!out)) return_trace (false);
|
||||||
out->featureParams.set (0); /* TODO(subset) FeatureParams. */
|
out->featureParams = 0; /* TODO(subset) FeatureParams. */
|
||||||
return_trace (true);
|
return_trace (true);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -599,7 +599,7 @@ struct Feature
|
|||||||
|
|
||||||
OffsetTo<FeatureParams> new_offset;
|
OffsetTo<FeatureParams> new_offset;
|
||||||
/* Check that it did not overflow. */
|
/* Check that it did not overflow. */
|
||||||
new_offset.set (new_offset_int);
|
new_offset = new_offset_int;
|
||||||
if (new_offset == new_offset_int &&
|
if (new_offset == new_offset_int &&
|
||||||
c->try_set (&featureParams, new_offset) &&
|
c->try_set (&featureParams, new_offset) &&
|
||||||
!featureParams.sanitize (c, this, closure ? closure->tag : HB_TAG_NONE))
|
!featureParams.sanitize (c, this, closure ? closure->tag : HB_TAG_NONE))
|
||||||
@ -703,14 +703,14 @@ struct Lookup
|
|||||||
{
|
{
|
||||||
TRACE_SERIALIZE (this);
|
TRACE_SERIALIZE (this);
|
||||||
if (unlikely (!c->extend_min (*this))) return_trace (false);
|
if (unlikely (!c->extend_min (*this))) return_trace (false);
|
||||||
lookupType.set (lookup_type);
|
lookupType = lookup_type;
|
||||||
lookupFlag.set (lookup_props & 0xFFFFu);
|
lookupFlag = lookup_props & 0xFFFFu;
|
||||||
if (unlikely (!subTable.serialize (c, num_subtables))) return_trace (false);
|
if (unlikely (!subTable.serialize (c, num_subtables))) return_trace (false);
|
||||||
if (lookupFlag & LookupFlag::UseMarkFilteringSet)
|
if (lookupFlag & LookupFlag::UseMarkFilteringSet)
|
||||||
{
|
{
|
||||||
if (unlikely (!c->extend (*this))) return_trace (false);
|
if (unlikely (!c->extend (*this))) return_trace (false);
|
||||||
HBUINT16 &markFilteringSet = StructAfter<HBUINT16> (subTable);
|
HBUINT16 &markFilteringSet = StructAfter<HBUINT16> (subTable);
|
||||||
markFilteringSet.set (lookup_props >> 16);
|
markFilteringSet = lookup_props >> 16;
|
||||||
}
|
}
|
||||||
return_trace (true);
|
return_trace (true);
|
||||||
}
|
}
|
||||||
@ -901,7 +901,7 @@ struct CoverageFormat2
|
|||||||
|
|
||||||
if (unlikely (!glyphs))
|
if (unlikely (!glyphs))
|
||||||
{
|
{
|
||||||
rangeRecord.len.set (0);
|
rangeRecord.len = 0;
|
||||||
return_trace (true);
|
return_trace (true);
|
||||||
}
|
}
|
||||||
/* TODO(iter) Port to non-random-access iterator interface. */
|
/* TODO(iter) Port to non-random-access iterator interface. */
|
||||||
@ -911,19 +911,19 @@ struct CoverageFormat2
|
|||||||
for (unsigned int i = 1; i < count; i++)
|
for (unsigned int i = 1; i < count; i++)
|
||||||
if (glyphs[i - 1] + 1 != glyphs[i])
|
if (glyphs[i - 1] + 1 != glyphs[i])
|
||||||
num_ranges++;
|
num_ranges++;
|
||||||
rangeRecord.len.set (num_ranges);
|
rangeRecord.len = num_ranges;
|
||||||
if (unlikely (!c->extend (rangeRecord))) return_trace (false);
|
if (unlikely (!c->extend (rangeRecord))) return_trace (false);
|
||||||
|
|
||||||
unsigned int range = 0;
|
unsigned int range = 0;
|
||||||
rangeRecord[range].start = glyphs[0];
|
rangeRecord[range].start = glyphs[0];
|
||||||
rangeRecord[range].value.set (0);
|
rangeRecord[range].value = 0;
|
||||||
for (unsigned int i = 1; i < count; i++)
|
for (unsigned int i = 1; i < count; i++)
|
||||||
{
|
{
|
||||||
if (glyphs[i - 1] + 1 != glyphs[i])
|
if (glyphs[i - 1] + 1 != glyphs[i])
|
||||||
{
|
{
|
||||||
range++;
|
range++;
|
||||||
rangeRecord[range].start = glyphs[i];
|
rangeRecord[range].start = glyphs[i];
|
||||||
rangeRecord[range].value.set (i);
|
rangeRecord[range].value = i;
|
||||||
}
|
}
|
||||||
rangeRecord[range].end = glyphs[i];
|
rangeRecord[range].end = glyphs[i];
|
||||||
}
|
}
|
||||||
@ -1066,7 +1066,7 @@ struct Coverage
|
|||||||
for (unsigned int i = 1; i < count; i++)
|
for (unsigned int i = 1; i < count; i++)
|
||||||
if (glyphs[i - 1] + 1 != glyphs[i])
|
if (glyphs[i - 1] + 1 != glyphs[i])
|
||||||
num_ranges++;
|
num_ranges++;
|
||||||
u.format.set (count * 2 < num_ranges * 3 ? 1 : 2);
|
u.format = count * 2 < num_ranges * 3 ? 1 : 2;
|
||||||
|
|
||||||
switch (u.format)
|
switch (u.format)
|
||||||
{
|
{
|
||||||
@ -1212,16 +1212,16 @@ struct ClassDefFormat1
|
|||||||
|
|
||||||
if (unlikely (!glyphs))
|
if (unlikely (!glyphs))
|
||||||
{
|
{
|
||||||
startGlyph.set (0);
|
startGlyph = 0;
|
||||||
classValue.len.set (0);
|
classValue.len = 0;
|
||||||
return_trace (true);
|
return_trace (true);
|
||||||
}
|
}
|
||||||
|
|
||||||
hb_codepoint_t glyph_min = glyphs[0];
|
hb_codepoint_t glyph_min = glyphs[0];
|
||||||
hb_codepoint_t glyph_max = glyphs[glyphs.length - 1];
|
hb_codepoint_t glyph_max = glyphs[glyphs.length - 1];
|
||||||
|
|
||||||
startGlyph.set (glyph_min);
|
startGlyph = glyph_min;
|
||||||
classValue.len.set (glyph_max - glyph_min + 1);
|
classValue.len = glyph_max - glyph_min + 1;
|
||||||
if (unlikely (!c->extend (classValue))) return_trace (false);
|
if (unlikely (!c->extend (classValue))) return_trace (false);
|
||||||
|
|
||||||
for (unsigned int i = 0; i < glyphs.length; i++)
|
for (unsigned int i = 0; i < glyphs.length; i++)
|
||||||
@ -1245,8 +1245,8 @@ struct ClassDefFormat1
|
|||||||
if (!glyphset.has (g)) continue;
|
if (!glyphset.has (g)) continue;
|
||||||
unsigned int value = classValue[g - start];
|
unsigned int value = classValue[g - start];
|
||||||
if (!value) continue;
|
if (!value) continue;
|
||||||
glyphs.push()->set (glyph_map[g]);
|
glyphs.push(glyph_map[g]);
|
||||||
klasses.push()->set (value);
|
klasses.push(value);
|
||||||
}
|
}
|
||||||
c->serializer->propagate_error (glyphs, klasses);
|
c->serializer->propagate_error (glyphs, klasses);
|
||||||
ClassDef_serialize (c->serializer, glyphs, klasses);
|
ClassDef_serialize (c->serializer, glyphs, klasses);
|
||||||
@ -1348,7 +1348,7 @@ struct ClassDefFormat2
|
|||||||
|
|
||||||
if (unlikely (!glyphs))
|
if (unlikely (!glyphs))
|
||||||
{
|
{
|
||||||
rangeRecord.len.set (0);
|
rangeRecord.len = 0;
|
||||||
return_trace (true);
|
return_trace (true);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1357,12 +1357,12 @@ struct ClassDefFormat2
|
|||||||
if (glyphs[i - 1] + 1 != glyphs[i] ||
|
if (glyphs[i - 1] + 1 != glyphs[i] ||
|
||||||
klasses[i - 1] != klasses[i])
|
klasses[i - 1] != klasses[i])
|
||||||
num_ranges++;
|
num_ranges++;
|
||||||
rangeRecord.len.set (num_ranges);
|
rangeRecord.len = num_ranges;
|
||||||
if (unlikely (!c->extend (rangeRecord))) return_trace (false);
|
if (unlikely (!c->extend (rangeRecord))) return_trace (false);
|
||||||
|
|
||||||
unsigned int range = 0;
|
unsigned int range = 0;
|
||||||
rangeRecord[range].start = glyphs[0];
|
rangeRecord[range].start = glyphs[0];
|
||||||
rangeRecord[range].value.set (klasses[0]);
|
rangeRecord[range].value = klasses[0];
|
||||||
for (unsigned int i = 1; i < glyphs.length; i++)
|
for (unsigned int i = 1; i < glyphs.length; i++)
|
||||||
{
|
{
|
||||||
if (glyphs[i - 1] + 1 != glyphs[i] ||
|
if (glyphs[i - 1] + 1 != glyphs[i] ||
|
||||||
@ -1395,8 +1395,8 @@ struct ClassDefFormat2
|
|||||||
for (hb_codepoint_t g = start; g < end; g++)
|
for (hb_codepoint_t g = start; g < end; g++)
|
||||||
{
|
{
|
||||||
if (!glyphset.has (g)) continue;
|
if (!glyphset.has (g)) continue;
|
||||||
glyphs.push ()->set (glyph_map[g]);
|
glyphs.push (glyph_map[g]);
|
||||||
klasses.push ()->set (value);
|
klasses.push (value);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
c->serializer->propagate_error (glyphs, klasses);
|
c->serializer->propagate_error (glyphs, klasses);
|
||||||
@ -1519,7 +1519,7 @@ struct ClassDef
|
|||||||
if (1 + (glyph_max - glyph_min + 1) < num_ranges * 3)
|
if (1 + (glyph_max - glyph_min + 1) < num_ranges * 3)
|
||||||
format = 1;
|
format = 1;
|
||||||
}
|
}
|
||||||
u.format.set (format);
|
u.format = format;
|
||||||
|
|
||||||
switch (u.format)
|
switch (u.format)
|
||||||
{
|
{
|
||||||
|
@ -443,15 +443,15 @@ struct GDEF
|
|||||||
if (unlikely (!out)) return_trace (false);
|
if (unlikely (!out)) return_trace (false);
|
||||||
|
|
||||||
out->glyphClassDef.serialize_subset (c, this+glyphClassDef, out);
|
out->glyphClassDef.serialize_subset (c, this+glyphClassDef, out);
|
||||||
out->attachList.set (0);//TODO(subset) serialize_subset (c, this+attachList, out);
|
out->attachList = 0;//TODO(subset) serialize_subset (c, this+attachList, out);
|
||||||
out->ligCaretList.set (0);//TODO(subset) serialize_subset (c, this+ligCaretList, out);
|
out->ligCaretList = 0;//TODO(subset) serialize_subset (c, this+ligCaretList, out);
|
||||||
out->markAttachClassDef.serialize_subset (c, this+markAttachClassDef, out);
|
out->markAttachClassDef.serialize_subset (c, this+markAttachClassDef, out);
|
||||||
|
|
||||||
if (version.to_int () >= 0x00010002u)
|
if (version.to_int () >= 0x00010002u)
|
||||||
out->markGlyphSetsDef.set (0);// TODO(subset) serialize_subset (c, this+markGlyphSetsDef, out);
|
out->markGlyphSetsDef = 0;// TODO(subset) serialize_subset (c, this+markGlyphSetsDef, out);
|
||||||
|
|
||||||
if (version.to_int () >= 0x00010003u)
|
if (version.to_int () >= 0x00010003u)
|
||||||
out->varStore.set (0);// TODO(subset) serialize_subset (c, this+varStore, out);
|
out->varStore = 0;// TODO(subset) serialize_subset (c, this+varStore, out);
|
||||||
|
|
||||||
return_trace (true);
|
return_trace (true);
|
||||||
}
|
}
|
||||||
|
@ -88,7 +88,7 @@ struct SingleSubstFormat1
|
|||||||
TRACE_SERIALIZE (this);
|
TRACE_SERIALIZE (this);
|
||||||
if (unlikely (!c->extend_min (*this))) return_trace (false);
|
if (unlikely (!c->extend_min (*this))) return_trace (false);
|
||||||
if (unlikely (!coverage.serialize (c, this).serialize (c, glyphs))) return_trace (false);
|
if (unlikely (!coverage.serialize (c, this).serialize (c, glyphs))) return_trace (false);
|
||||||
deltaGlyphID.set (delta); /* TODO(serialize) overflow? */
|
deltaGlyphID = delta; /* TODO(serialize) overflow? */
|
||||||
return_trace (true);
|
return_trace (true);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -103,8 +103,8 @@ struct SingleSubstFormat1
|
|||||||
for (auto it = hb_iter (this+coverage)
|
for (auto it = hb_iter (this+coverage)
|
||||||
| hb_filter (glyphset); it; ++it)
|
| hb_filter (glyphset); it; ++it)
|
||||||
{
|
{
|
||||||
from.push ()->set (glyph_map[*it]);
|
from.push (glyph_map[*it]);
|
||||||
to.push ()->set (glyph_map[(*it + delta) & 0xFFFF]);
|
to.push (glyph_map[(*it + delta) & 0xFFFF]);
|
||||||
}
|
}
|
||||||
c->serializer->propagate_error (from, to);
|
c->serializer->propagate_error (from, to);
|
||||||
SingleSubst_serialize (c->serializer, from, to);
|
SingleSubst_serialize (c->serializer, from, to);
|
||||||
@ -193,8 +193,8 @@ struct SingleSubstFormat2
|
|||||||
for (auto it = hb_zip (this+coverage, substitute)
|
for (auto it = hb_zip (this+coverage, substitute)
|
||||||
| hb_filter (glyphset, hb_first); it; ++it)
|
| hb_filter (glyphset, hb_first); it; ++it)
|
||||||
{
|
{
|
||||||
from.push ()->set (glyph_map[(*it).first]);
|
from.push (glyph_map[(*it).first]);
|
||||||
to.push ()->set (glyph_map[(*it).second]);
|
to.push (glyph_map[(*it).second]);
|
||||||
}
|
}
|
||||||
c->serializer->propagate_error (from, to);
|
c->serializer->propagate_error (from, to);
|
||||||
SingleSubst_serialize (c->serializer, from, to);
|
SingleSubst_serialize (c->serializer, from, to);
|
||||||
@ -240,7 +240,7 @@ struct SingleSubst
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
u.format.set (format);
|
u.format = format;
|
||||||
switch (u.format) {
|
switch (u.format) {
|
||||||
case 1: return_trace (u.format1.serialize (c, glyphs, delta));
|
case 1: return_trace (u.format1.serialize (c, glyphs, delta));
|
||||||
case 2: return_trace (u.format2.serialize (c, glyphs, substitutes));
|
case 2: return_trace (u.format2.serialize (c, glyphs, substitutes));
|
||||||
@ -433,7 +433,7 @@ struct MultipleSubst
|
|||||||
TRACE_SERIALIZE (this);
|
TRACE_SERIALIZE (this);
|
||||||
if (unlikely (!c->extend_min (u.format))) return_trace (false);
|
if (unlikely (!c->extend_min (u.format))) return_trace (false);
|
||||||
unsigned int format = 1;
|
unsigned int format = 1;
|
||||||
u.format.set (format);
|
u.format = format;
|
||||||
switch (u.format) {
|
switch (u.format) {
|
||||||
case 1: return_trace (u.format1.serialize (c, glyphs, substitute_len_list, substitute_glyphs_list));
|
case 1: return_trace (u.format1.serialize (c, glyphs, substitute_len_list, substitute_glyphs_list));
|
||||||
default:return_trace (false);
|
default:return_trace (false);
|
||||||
@ -610,7 +610,7 @@ struct AlternateSubst
|
|||||||
TRACE_SERIALIZE (this);
|
TRACE_SERIALIZE (this);
|
||||||
if (unlikely (!c->extend_min (u.format))) return_trace (false);
|
if (unlikely (!c->extend_min (u.format))) return_trace (false);
|
||||||
unsigned int format = 1;
|
unsigned int format = 1;
|
||||||
u.format.set (format);
|
u.format = format;
|
||||||
switch (u.format) {
|
switch (u.format) {
|
||||||
case 1: return_trace (u.format1.serialize (c, glyphs, alternate_len_list, alternate_glyphs_list));
|
case 1: return_trace (u.format1.serialize (c, glyphs, alternate_len_list, alternate_glyphs_list));
|
||||||
default:return_trace (false);
|
default:return_trace (false);
|
||||||
@ -942,7 +942,7 @@ struct LigatureSubst
|
|||||||
TRACE_SERIALIZE (this);
|
TRACE_SERIALIZE (this);
|
||||||
if (unlikely (!c->extend_min (u.format))) return_trace (false);
|
if (unlikely (!c->extend_min (u.format))) return_trace (false);
|
||||||
unsigned int format = 1;
|
unsigned int format = 1;
|
||||||
u.format.set (format);
|
u.format = format;
|
||||||
switch (u.format) {
|
switch (u.format) {
|
||||||
case 1: return_trace (u.format1.serialize (c,
|
case 1: return_trace (u.format1.serialize (c,
|
||||||
first_glyphs,
|
first_glyphs,
|
||||||
|
@ -77,7 +77,7 @@ struct maxp
|
|||||||
|
|
||||||
void set_num_glyphs (unsigned int count)
|
void set_num_glyphs (unsigned int count)
|
||||||
{
|
{
|
||||||
numGlyphs.set (count);
|
numGlyphs = count;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool sanitize (hb_sanitize_context_t *c) const
|
bool sanitize (hb_sanitize_context_t *c) const
|
||||||
@ -119,13 +119,13 @@ struct maxp
|
|||||||
if (maxp_prime->version.major == 1)
|
if (maxp_prime->version.major == 1)
|
||||||
{
|
{
|
||||||
maxpV1Tail &v1 = StructAfter<maxpV1Tail> (*maxp_prime);
|
maxpV1Tail &v1 = StructAfter<maxpV1Tail> (*maxp_prime);
|
||||||
v1.maxZones.set (1);
|
v1.maxZones = 1;
|
||||||
v1.maxTwilightPoints.set (0);
|
v1.maxTwilightPoints = 0;
|
||||||
v1.maxStorage.set (0);
|
v1.maxStorage = 0;
|
||||||
v1.maxFunctionDefs.set (0);
|
v1.maxFunctionDefs = 0;
|
||||||
v1.maxInstructionDefs.set (0);
|
v1.maxInstructionDefs = 0;
|
||||||
v1.maxStackElements.set (0);
|
v1.maxStackElements = 0;
|
||||||
v1.maxSizeOfInstructions.set (0);
|
v1.maxSizeOfInstructions = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -160,8 +160,8 @@ struct OS2
|
|||||||
|
|
||||||
uint16_t min_cp, max_cp;
|
uint16_t min_cp, max_cp;
|
||||||
find_min_and_max_codepoint (plan->unicodes, &min_cp, &max_cp);
|
find_min_and_max_codepoint (plan->unicodes, &min_cp, &max_cp);
|
||||||
os2_prime->usFirstCharIndex.set (min_cp);
|
os2_prime->usFirstCharIndex = min_cp;
|
||||||
os2_prime->usLastCharIndex.set (max_cp);
|
os2_prime->usLastCharIndex = max_cp;
|
||||||
|
|
||||||
_update_unicode_ranges (plan->unicodes, os2_prime->ulUnicodeRange);
|
_update_unicode_ranges (plan->unicodes, os2_prime->ulUnicodeRange);
|
||||||
bool result = plan->add_table (HB_OT_TAG_OS2, os2_prime_blob);
|
bool result = plan->add_table (HB_OT_TAG_OS2, os2_prime_blob);
|
||||||
@ -174,7 +174,7 @@ struct OS2
|
|||||||
HBUINT32 ulUnicodeRange[4]) const
|
HBUINT32 ulUnicodeRange[4]) const
|
||||||
{
|
{
|
||||||
for (unsigned int i = 0; i < 4; i++)
|
for (unsigned int i = 0; i < 4; i++)
|
||||||
ulUnicodeRange[i].set (0);
|
ulUnicodeRange[i] = 0;
|
||||||
|
|
||||||
hb_codepoint_t cp = HB_SET_VALUE_INVALID;
|
hb_codepoint_t cp = HB_SET_VALUE_INVALID;
|
||||||
while (codepoints->next (&cp)) {
|
while (codepoints->next (&cp)) {
|
||||||
@ -184,14 +184,14 @@ struct OS2
|
|||||||
unsigned int block = bit / 32;
|
unsigned int block = bit / 32;
|
||||||
unsigned int bit_in_block = bit % 32;
|
unsigned int bit_in_block = bit % 32;
|
||||||
unsigned int mask = 1 << bit_in_block;
|
unsigned int mask = 1 << bit_in_block;
|
||||||
ulUnicodeRange[block].set (ulUnicodeRange[block] | mask);
|
ulUnicodeRange[block] = ulUnicodeRange[block] | mask;
|
||||||
}
|
}
|
||||||
if (cp >= 0x10000 && cp <= 0x110000)
|
if (cp >= 0x10000 && cp <= 0x110000)
|
||||||
{
|
{
|
||||||
/* the spec says that bit 57 ("Non Plane 0") implies that there's
|
/* the spec says that bit 57 ("Non Plane 0") implies that there's
|
||||||
at least one codepoint beyond the BMP; so I also include all
|
at least one codepoint beyond the BMP; so I also include all
|
||||||
the non-BMP codepoints here */
|
the non-BMP codepoints here */
|
||||||
ulUnicodeRange[1].set (ulUnicodeRange[1] | (1 << 25));
|
ulUnicodeRange[1] = ulUnicodeRange[1] | (1 << 25);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -88,7 +88,7 @@ struct post
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
post_prime->version.major.set (3); // Version 3 does not have any glyph names.
|
post_prime->version.major = 3; // Version 3 does not have any glyph names.
|
||||||
bool result = plan->add_table (HB_OT_TAG_post, post_prime_blob);
|
bool result = plan->add_table (HB_OT_TAG_post, post_prime_blob);
|
||||||
hb_blob_destroy (post_prime_blob);
|
hb_blob_destroy (post_prime_blob);
|
||||||
|
|
||||||
|
@ -66,8 +66,8 @@ arabic_fallback_synthesize_lookup_single (const hb_ot_shape_plan_t *plan HB_UNUS
|
|||||||
u_glyph > 0xFFFFu || s_glyph > 0xFFFFu)
|
u_glyph > 0xFFFFu || s_glyph > 0xFFFFu)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
glyphs[num_glyphs].set (u_glyph);
|
glyphs[num_glyphs] = u_glyph;
|
||||||
substitutes[num_glyphs].set (s_glyph);
|
substitutes[num_glyphs] = s_glyph;
|
||||||
|
|
||||||
num_glyphs++;
|
num_glyphs++;
|
||||||
}
|
}
|
||||||
@ -120,7 +120,7 @@ arabic_fallback_synthesize_lookup_ligature (const hb_ot_shape_plan_t *plan HB_UN
|
|||||||
hb_codepoint_t first_glyph;
|
hb_codepoint_t first_glyph;
|
||||||
if (!hb_font_get_glyph (font, first_u, 0, &first_glyph))
|
if (!hb_font_get_glyph (font, first_u, 0, &first_glyph))
|
||||||
continue;
|
continue;
|
||||||
first_glyphs[num_first_glyphs].set (first_glyph);
|
first_glyphs[num_first_glyphs] = first_glyph;
|
||||||
ligature_per_first_glyph_count_list[num_first_glyphs] = 0;
|
ligature_per_first_glyph_count_list[num_first_glyphs] = 0;
|
||||||
first_glyphs_indirection[num_first_glyphs] = first_glyph_idx;
|
first_glyphs_indirection[num_first_glyphs] = first_glyph_idx;
|
||||||
num_first_glyphs++;
|
num_first_glyphs++;
|
||||||
@ -146,9 +146,9 @@ arabic_fallback_synthesize_lookup_ligature (const hb_ot_shape_plan_t *plan HB_UN
|
|||||||
|
|
||||||
ligature_per_first_glyph_count_list[i]++;
|
ligature_per_first_glyph_count_list[i]++;
|
||||||
|
|
||||||
ligature_list[num_ligatures].set (ligature_glyph);
|
ligature_list[num_ligatures] = ligature_glyph;
|
||||||
component_count_list[num_ligatures] = 2;
|
component_count_list[num_ligatures] = 2;
|
||||||
component_list[num_ligatures].set (second_glyph);
|
component_list[num_ligatures] = second_glyph;
|
||||||
num_ligatures++;
|
num_ligatures++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -81,11 +81,11 @@ struct VORG
|
|||||||
if (unlikely (!c.extend_min (*subset_table)))
|
if (unlikely (!c.extend_min (*subset_table)))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
subset_table->version.major.set (1);
|
subset_table->version.major = 1;
|
||||||
subset_table->version.minor.set (0);
|
subset_table->version.minor = 0;
|
||||||
|
|
||||||
subset_table->defaultVertOriginY.set (vorg_table->defaultVertOriginY);
|
subset_table->defaultVertOriginY = vorg_table->defaultVertOriginY;
|
||||||
subset_table->vertYOrigins.len.set (subset_metrics.length);
|
subset_table->vertYOrigins.len = subset_metrics.length;
|
||||||
|
|
||||||
bool success = true;
|
bool success = true;
|
||||||
if (subset_metrics.length > 0)
|
if (subset_metrics.length > 0)
|
||||||
@ -130,8 +130,8 @@ struct VORG
|
|||||||
if (plan->new_gid_for_old_gid (old_glyph, &new_glyph))
|
if (plan->new_gid_for_old_gid (old_glyph, &new_glyph))
|
||||||
{
|
{
|
||||||
VertOriginMetric *metrics = subset_metrics.push ();
|
VertOriginMetric *metrics = subset_metrics.push ();
|
||||||
metrics->glyph.set (new_glyph);
|
metrics->glyph = new_glyph;
|
||||||
metrics->vertOriginY.set (vertYOrigins[i].vertOriginY);
|
metrics->vertOriginY = vertYOrigins[i].vertOriginY;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -160,13 +160,13 @@ serialize_fdselect_3_4 (hb_serialize_context_t *c,
|
|||||||
TRACE_SERIALIZE (this);
|
TRACE_SERIALIZE (this);
|
||||||
FDSELECT3_4 *p = c->allocate_size<FDSELECT3_4> (size);
|
FDSELECT3_4 *p = c->allocate_size<FDSELECT3_4> (size);
|
||||||
if (unlikely (p == nullptr)) return_trace (false);
|
if (unlikely (p == nullptr)) return_trace (false);
|
||||||
p->nRanges ().set (fdselect_ranges.length);
|
p->nRanges () = fdselect_ranges.length;
|
||||||
for (unsigned int i = 0; i < fdselect_ranges.length; i++)
|
for (unsigned int i = 0; i < fdselect_ranges.length; i++)
|
||||||
{
|
{
|
||||||
p->ranges[i].first.set (fdselect_ranges[i].glyph);
|
p->ranges[i].first = fdselect_ranges[i].glyph;
|
||||||
p->ranges[i].fd.set (fdselect_ranges[i].code);
|
p->ranges[i].fd = fdselect_ranges[i].code;
|
||||||
}
|
}
|
||||||
p->sentinel().set (num_glyphs);
|
p->sentinel() = num_glyphs;
|
||||||
return_trace (true);
|
return_trace (true);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -186,7 +186,7 @@ hb_serialize_cff_fdselect (hb_serialize_context_t *c,
|
|||||||
TRACE_SERIALIZE (this);
|
TRACE_SERIALIZE (this);
|
||||||
FDSelect *p = c->allocate_min<FDSelect> ();
|
FDSelect *p = c->allocate_min<FDSelect> ();
|
||||||
if (unlikely (p == nullptr)) return_trace (false);
|
if (unlikely (p == nullptr)) return_trace (false);
|
||||||
p->format.set (fdselect_format);
|
p->format = fdselect_format;
|
||||||
size -= FDSelect::min_size;
|
size -= FDSelect::min_size;
|
||||||
|
|
||||||
switch (fdselect_format)
|
switch (fdselect_format)
|
||||||
@ -205,7 +205,7 @@ hb_serialize_cff_fdselect (hb_serialize_context_t *c,
|
|||||||
{
|
{
|
||||||
fd = fdselect_ranges[range_index++].code;
|
fd = fdselect_ranges[range_index++].code;
|
||||||
}
|
}
|
||||||
p->fds[i].set (fd);
|
p->fds[i] = fd;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -209,7 +209,7 @@ struct cff_font_dict_op_serializer_t : op_serializer_t
|
|||||||
/* serialize the opcode */
|
/* serialize the opcode */
|
||||||
HBUINT8 *p = c->allocate_size<HBUINT8> (1);
|
HBUINT8 *p = c->allocate_size<HBUINT8> (1);
|
||||||
if (unlikely (p == nullptr)) return_trace (false);
|
if (unlikely (p == nullptr)) return_trace (false);
|
||||||
p->set (OpCode_Private);
|
*p = OpCode_Private;
|
||||||
|
|
||||||
return_trace (true);
|
return_trace (true);
|
||||||
}
|
}
|
||||||
|
@ -147,7 +147,7 @@ struct cff1_top_dict_op_serializer_t : cff_top_dict_op_serializer_t<cff1_top_dic
|
|||||||
return_trace (false);
|
return_trace (false);
|
||||||
HBUINT8 *p = c->allocate_size<HBUINT8> (1);
|
HBUINT8 *p = c->allocate_size<HBUINT8> (1);
|
||||||
if (unlikely (p == nullptr)) return_trace (false);
|
if (unlikely (p == nullptr)) return_trace (false);
|
||||||
p->set (OpCode_Private);
|
*p = OpCode_Private;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
@ -892,10 +892,10 @@ static inline bool _write_cff1 (const cff_subset_plan &plan,
|
|||||||
return false;
|
return false;
|
||||||
|
|
||||||
/* header */
|
/* header */
|
||||||
cff->version.major.set (0x01);
|
cff->version.major = 0x01;
|
||||||
cff->version.minor.set (0x00);
|
cff->version.minor = 0x00;
|
||||||
cff->nameIndex.set (cff->min_size);
|
cff->nameIndex = cff->min_size;
|
||||||
cff->offSize.set (4); /* unused? */
|
cff->offSize = 4; /* unused? */
|
||||||
|
|
||||||
/* name INDEX */
|
/* name INDEX */
|
||||||
{
|
{
|
||||||
|
@ -451,14 +451,14 @@ static inline bool _write_cff2 (const cff2_subset_plan &plan,
|
|||||||
return false;
|
return false;
|
||||||
|
|
||||||
/* header */
|
/* header */
|
||||||
cff2->version.major.set (0x02);
|
cff2->version.major = 0x02;
|
||||||
cff2->version.minor.set (0x00);
|
cff2->version.minor = 0x00;
|
||||||
cff2->topDict.set (OT::cff2::static_size);
|
cff2->topDict = OT::cff2::static_size;
|
||||||
|
|
||||||
/* top dict */
|
/* top dict */
|
||||||
{
|
{
|
||||||
assert (cff2->topDict == (unsigned) (c.head - c.start));
|
assert (cff2->topDict == (unsigned) (c.head - c.start));
|
||||||
cff2->topDictSize.set (plan.offsets.topDictInfo.size);
|
cff2->topDictSize = plan.offsets.topDictInfo.size;
|
||||||
TopDict &dict = cff2 + cff2->topDict;
|
TopDict &dict = cff2 + cff2->topDict;
|
||||||
cff2_top_dict_op_serializer_t topSzr;
|
cff2_top_dict_op_serializer_t topSzr;
|
||||||
if (unlikely (!dict.serialize (&c, acc.topDict, topSzr, plan.offsets)))
|
if (unlikely (!dict.serialize (&c, acc.topDict, topSzr, plan.offsets)))
|
||||||
|
@ -43,9 +43,9 @@ struct loca_data_t
|
|||||||
if ((id + 1) * entry_size <= size)
|
if ((id + 1) * entry_size <= size)
|
||||||
{
|
{
|
||||||
if (is_short) {
|
if (is_short) {
|
||||||
((OT::HBUINT16*) data) [id].set (offset / 2);
|
((OT::HBUINT16*) data) [id] = offset / 2;
|
||||||
} else {
|
} else {
|
||||||
((OT::HBUINT32*) data) [id].set (offset);
|
((OT::HBUINT32*) data) [id] = offset;
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@ -164,7 +164,7 @@ _update_components (const hb_subset_plan_t *plan,
|
|||||||
&new_gid))
|
&new_gid))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
((OT::glyf::CompositeGlyphHeader *) iterator.current)->glyphIndex.set (new_gid);
|
((OT::glyf::CompositeGlyphHeader *) iterator.current)->glyphIndex = new_gid;
|
||||||
} while (iterator.move_to_next ());
|
} while (iterator.move_to_next ());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -178,7 +178,7 @@ static bool _remove_composite_instruction_flag (char *glyf_prime, unsigned int l
|
|||||||
do {
|
do {
|
||||||
glyph = composite_it.current;
|
glyph = composite_it.current;
|
||||||
OT::HBUINT16 *flags = const_cast<OT::HBUINT16 *> (&glyph->flags);
|
OT::HBUINT16 *flags = const_cast<OT::HBUINT16 *> (&glyph->flags);
|
||||||
flags->set ( (uint16_t) *flags & ~OT::glyf::CompositeGlyphHeader::WE_HAVE_INSTRUCTIONS);
|
*flags = (uint16_t) *flags & ~OT::glyf::CompositeGlyphHeader::WE_HAVE_INSTRUCTIONS;
|
||||||
} while (composite_it.move_to_next ());
|
} while (composite_it.move_to_next ());
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -396,18 +396,18 @@ _hb_rename_font (hb_blob_t *blob, wchar_t *new_name)
|
|||||||
memcpy(new_sfnt_data, orig_sfnt_data, length);
|
memcpy(new_sfnt_data, orig_sfnt_data, length);
|
||||||
|
|
||||||
OT::name &name = StructAtOffset<OT::name> (new_sfnt_data, name_table_offset);
|
OT::name &name = StructAtOffset<OT::name> (new_sfnt_data, name_table_offset);
|
||||||
name.format.set (0);
|
name.format = 0;
|
||||||
name.count.set (ARRAY_LENGTH (name_IDs));
|
name.count = ARRAY_LENGTH (name_IDs);
|
||||||
name.stringOffset.set (name.get_size ());
|
name.stringOffset = name.get_size ();
|
||||||
for (unsigned int i = 0; i < ARRAY_LENGTH (name_IDs); i++)
|
for (unsigned int i = 0; i < ARRAY_LENGTH (name_IDs); i++)
|
||||||
{
|
{
|
||||||
OT::NameRecord &record = name.nameRecordZ[i];
|
OT::NameRecord &record = name.nameRecordZ[i];
|
||||||
record.platformID.set (3);
|
record.platformID = 3;
|
||||||
record.encodingID.set (1);
|
record.encodingID = 1;
|
||||||
record.languageID.set (0x0409u); /* English */
|
record.languageID = 0x0409u; /* English */
|
||||||
record.nameID.set (name_IDs[i]);
|
record.nameID = name_IDs[i];
|
||||||
record.length.set (name_str_len * 2);
|
record.length = name_str_len * 2;
|
||||||
record.offset.set (0);
|
record.offset = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Copy string data from new_name, converting wchar_t to UTF16BE. */
|
/* Copy string data from new_name, converting wchar_t to UTF16BE. */
|
||||||
@ -431,8 +431,8 @@ _hb_rename_font (hb_blob_t *blob, wchar_t *new_name)
|
|||||||
{
|
{
|
||||||
OT::TableRecord &record = const_cast<OT::TableRecord &> (face.get_table (index));
|
OT::TableRecord &record = const_cast<OT::TableRecord &> (face.get_table (index));
|
||||||
record.checkSum.set_for_data (&name, padded_name_table_length);
|
record.checkSum.set_for_data (&name, padded_name_table_length);
|
||||||
record.offset.set (name_table_offset);
|
record.offset = name_table_offset;
|
||||||
record.length.set (name_table_length);
|
record.length = name_table_length;
|
||||||
}
|
}
|
||||||
else if (face_index == 0) /* Fail if first face doesn't have 'name' table. */
|
else if (face_index == 0) /* Fail if first face doesn't have 'name' table. */
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user