26 #ifndef HB_OT_CFF_COMMON_HH
27 #define HB_OT_CFF_COMMON_HH
39 #define CFF_UNDEF_CODE 0xFFFFFFFF
45 template<
typename Type>
46 static inline const Type& StructAtOffsetOrNull (
const void *
P,
unsigned int offset)
51 unsigned int size = 1;
73 unsigned int size = 0;
75 size += (*
this)[
i].length;
84 template <
typename COUNT>
106 unsigned int size =
src.get_size ();
114 unsigned int offSize_,
118 if (byteArray.
length == 0)
120 COUNT *dest =
c->allocate_min<COUNT> ();
144 for (
unsigned int i = 0;
i < byteArray.
length;
i++)
147 unsigned char *dest =
c->allocate_size<
unsigned char> (bs.
length);
149 memcpy (dest, &bs[0], bs.
length);
156 unsigned int offSize_,
162 for (
unsigned int i = 0;
i < byteArray.
length;
i++)
169 template <
typename Iterator,
177 COUNT *dest =
c->allocate_min<COUNT> ();
184 for (
const auto &
_ : +
it)
192 {
return serialize (
c, + hb_iter (byteArray)); }
198 + hb_iter (buffArray)
204 template <
typename Iterator,
211 unsigned total = +
it | hb_reduce (hb_add, 0);
224 for (
unsigned _ : +
it)
268 unsigned int data_size ()
const {
return HBINT8::static_size; }
281 return count.static_size;
296 unsigned int max = 0;
297 for (
unsigned int i = 0;
i <
count + 1u;
i++)
300 if (off > max) max = off;
315 template <
typename COUNT,
typename TYPE>
325 template <
typename DATA,
typename PARAM1,
typename PARAM2>
327 unsigned int offSize_,
328 const DATA *dataArray,
329 unsigned int dataArrayLen,
331 const PARAM1 ¶m1,
332 const PARAM2 ¶m2)
337 this->
count = dataArrayLen;
345 for (;
i < dataArrayLen;
i++)
353 for (
unsigned int i = 0;
i < dataArrayLen;
i++)
356 if (
unlikely (!dest || !dest->serialize (
c, dataArray[
i], param1, param2)))
366 template <
typename DICTVAL,
typename OP_SERIALIZER,
typename ...Ts>
368 const DICTVAL &dictval,
369 OP_SERIALIZER& opszr,
373 for (
unsigned int i = 0;
i < dictval.get_count ();
i++)
374 if (
unlikely (!opszr.serialize (
c, dictval[
i], std::forward<Ts> (ds)...)))
380 template <
typename T,
typename V>
384 if ( (!serialize_int<T, V> (
c, intOp,
value)))
401 template <
typename V>
405 template <
typename V>
409 template <
typename T,
int int_op>
413 if (
unlikely (!serialize_int_op<T> (
c,
op, 0, int_op)))
return false;
414 c->add_link (ofs, link, whence);
419 {
return serialize_link_op<HBINT32, OpCode_longintdict> (
c,
op, link, whence); }
422 {
return serialize_link_op<HBINT16, OpCode_shortint> (
c,
op, link, whence); }
438 template <
typename COUNT>
441 template <
typename DICTVAL,
typename INFO,
typename Iterator,
typename OP_SERIALIZER>
444 OP_SERIALIZER& opszr)
456 return c->head - (
const char*)dict;
472 if (
unlikely (!(
c->check_struct (
this))))
474 for (
unsigned int i = 0;
i <
c->get_num_glyphs ();
i++)
484 unsigned int get_size (
unsigned int num_glyphs)
const
485 {
return HBUINT8::static_size * num_glyphs; }
492 template <
typename GID_TYPE,
typename FD_TYPE>
507 template <
typename GID_TYPE,
typename FD_TYPE>
511 {
return GID_TYPE::static_size * 2 +
ranges.get_size (); }
516 if (
unlikely (!
c->check_struct (
this) || !
ranges.sanitize (
c,
nullptr, fdcount) ||
559 unsigned int size =
src.get_size (num_glyphs);
566 unsigned int get_size (
unsigned int num_glyphs)
const
570 case 0:
return format.static_size +
u.format0.get_size (num_glyphs);
571 case 3:
return format.static_size +
u.format3.get_size ();
582 case 0:
return u.format0.get_fd (glyph);
583 case 3:
return u.format3.get_fd (glyph);
611 template <
typename COUNT>
small capitals from c petite p scientific i
[1]
#define OpCode_longintdict
#define TRACE_SERIALIZE(this)
#define TRACE_SANITIZE(this)
#define return_trace(RET)
#define hb_is_iterator(Iter)
auto it hb_map(hb_second)) template< typename Type > inline hb_array_t< Type > operator()(hb_array_t< Type > array
static auto hb_requires(hb_is_iterable(Iterable))> static inline auto end(Iterable &&iterable) HB_AUTO_RETURN(hb_iter(iterable).end()) namespace OT
unsigned int calcOffSize(unsigned int dataSize)
unsigned int OpCode_Size(op_code_t op)
hb_vector_t< unsigned char > str_buff_t
FDSelect3_4< HBUINT16, HBUINT8 > FDSelect3
op_code_t Unmake_OpCode_ESC(op_code_t op)
bool Is_OpCode_ESC(op_code_t op)
hb_serialize_context_t::objidx_t objidx_t
FDSelect3_4_Range< HBUINT16, HBUINT8 > FDSelect3_Range
set set set set set set set macro pixldst1 op
EGLOutputLayerEXT EGLint EGLAttrib value
GLenum GLuint GLenum GLsizei length
GLenum GLuint GLintptr GLsizeiptr size
[1]
GLenum GLenum GLsizei count
GLenum GLuint GLintptr offset
GLint GLsizei GLsizei GLenum format
GLuint GLsizei const GLuint const GLintptr * offsets
GLuint GLsizei const GLuint const GLintptr const GLsizeiptr * sizes
QTextStream out(stdout)
[7]
bool serialize(hb_serialize_context_t *c, const str_buff_vec_t &buffArray)
bool serialize(hb_serialize_context_t *c, unsigned int offSize_, const byte_str_array_t &byteArray)
bool serialize(hb_serialize_context_t *c, Iterator it)
bool serialize_header(hb_serialize_context_t *c, Iterator it)
unsigned int offset_at(unsigned int index) const
unsigned int get_size() const
bool serialize(hb_serialize_context_t *c, unsigned int offSize_, const str_buff_vec_t &buffArray)
bool serialize(hb_serialize_context_t *c, const CFFIndex &src)
const unsigned char * data_base() const
byte_str_t operator[](unsigned int index) const
DEFINE_SIZE_ARRAY(COUNT::static_size+HBUINT8::static_size, offsets)
bool sanitize(hb_sanitize_context_t *c) const
unsigned int length_at(unsigned int index) const
void set_offset_at(unsigned int index, unsigned int offset)
CFFIndex * copy(hb_serialize_context_t *c) const
unsigned int offset_array_size() const
static unsigned int calculate_offset_array_size(unsigned int offSize, unsigned int count)
bool serialize(hb_serialize_context_t *c, const byte_str_array_t &byteArray)
unsigned int data_size() const
unsigned int max_offset() const
bool serialize(hb_serialize_context_t *c, unsigned int offSize_, const DATA *dataArray, unsigned int dataArrayLen, const hb_vector_t< unsigned int > &dataSizeArray, const PARAM1 ¶m1, const PARAM2 ¶m2)
const byte_str_t operator[](unsigned int index) const
static bool serialize_int4_op(hb_serialize_context_t *c, op_code_t op, V value)
static bool serialize_link_op(hb_serialize_context_t *c, op_code_t op, objidx_t link, whence_t whence)
static bool serialize_link2_op(hb_serialize_context_t *c, op_code_t op, objidx_t link, whence_t whence=whence_t::Head)
static bool serialize_int_op(hb_serialize_context_t *c, op_code_t op, V value, op_code_t intOp)
static bool serialize_link4_op(hb_serialize_context_t *c, op_code_t op, objidx_t link, whence_t whence=whence_t::Head)
bool serialize(hb_serialize_context_t *c, const DICTVAL &dictval, OP_SERIALIZER &opszr, Ts &&... ds)
static bool serialize_int2_op(hb_serialize_context_t *c, op_code_t op, V value)
bool serialize(hb_serialize_context_t *c, Iterator it, OP_SERIALIZER &opszr)
HBUINT8 fds[HB_VAR_ARRAY]
bool sanitize(hb_sanitize_context_t *c, unsigned int fdcount) const
hb_codepoint_t get_fd(hb_codepoint_t glyph) const
unsigned int get_size(unsigned int num_glyphs) const
DEFINE_SIZE_STATIC(GID_TYPE::static_size+FD_TYPE::static_size)
bool sanitize(hb_sanitize_context_t *c, const void *, unsigned int fdcount) const
unsigned int get_size() const
const GID_TYPE & sentinel() const
hb_codepoint_t get_fd(hb_codepoint_t glyph) const
bool sanitize(hb_sanitize_context_t *c, unsigned int fdcount) const
DEFINE_SIZE_ARRAY(GID_TYPE::static_size, ranges)
ArrayOf< FDSelect3_4_Range< GID_TYPE, FD_TYPE >, GID_TYPE > ranges
unsigned int get_size(unsigned int num_glyphs) const
bool serialize(hb_serialize_context_t *c, const FDSelect &src, unsigned int num_glyphs)
hb_codepoint_t get_fd(hb_codepoint_t glyph) const
union CFF::FDSelect::@145 u
bool sanitize(hb_sanitize_context_t *c, unsigned int fdcount) const
unsigned int total_size() const
unsigned get_size() const