28 #ifndef HB_OT_COLOR_SBIX_TABLE_HH
29 #define HB_OT_COLOR_SBIX_TABLE_HH
39 #define HB_OT_TAG_sbix HB_TAG('s','b','i','x')
57 data.copy (
c, data_length);
83 static unsigned int get_size (
unsigned num_glyphs)
84 {
return min_size + num_glyphs * HBUINT32::static_size; }
98 unsigned int num_glyphs,
99 unsigned int *strike_ppem)
const
103 unsigned int retry_count = 8;
104 unsigned int sbix_len = sbix_blob->
length;
105 unsigned int strike_offset = (
const char *)
this - (
const char *) sbix_blob->
data;
106 assert (strike_offset < sbix_len);
109 if (
unlikely (glyph_id >= num_glyphs ||
112 (
unsigned int)
imageOffsetsZ[glyph_id + 1] > sbix_len - strike_offset))
115 unsigned int glyph_offset = strike_offset + (
unsigned int)
imageOffsetsZ[glyph_id] + SBIXGlyph::min_size;
122 if (glyph_length >= 2)
134 if (strike_ppem) *strike_ppem =
ppem;
135 if (x_offset) *x_offset = glyph->
xOffset;
136 if (y_offset) *y_offset = glyph->
yOffset;
143 unsigned int num_output_glyphs =
c->plan->num_output_glyphs ();
147 auto snap =
c->serializer->snapshot ();
154 bool has_glyphs =
false;
155 for (
unsigned new_gid = 0; new_gid < num_output_glyphs; new_gid++)
158 if (!
c->plan->old_gid_for_new_gid (new_gid, &old_gid) ||
165 out->imageOffsetsZ[new_gid] =
head;
170 unsigned int glyph_data_length = delta - SBIXGlyph::min_size;
171 if (!(
this+
imageOffsetsZ[old_gid]).copy (
c->serializer, glyph_data_length))
173 out->imageOffsetsZ[new_gid] =
head;
177 out->imageOffsetsZ[num_output_glyphs] =
head;
179 c->serializer->revert (snap);
208 num_glyphs =
face->get_num_glyphs ();
219 return get_png_extents (
font, glyph, extents);
226 unsigned int *available_ppem)
const
231 num_glyphs, available_ppem);
242 unsigned int requested_ppem = hb_max (
font->x_ppem,
font->y_ppem);
244 requested_ppem = 1<<30;
246 unsigned int best_i = 0;
247 unsigned int best_ppem =
table->get_strike (0).ppem;
249 for (
unsigned int i = 1;
i <
count;
i++)
251 unsigned int ppem = (
table->get_strike (
i)).ppem;
252 if ((requested_ppem <= ppem && ppem < best_ppem) ||
253 (requested_ppem > best_ppem && ppem > best_ppem))
260 return table->get_strike (best_i);
295 int x_offset = 0, y_offset = 0;
296 unsigned int strike_ppem = 0;
299 const PNGHeader &
png = *blob->
as<PNGHeader>();
309 float scale =
font->face->get_upem () / (float) strike_ppem;
331 unsigned int num_glyphs;
363 auto*
o =
out->serialize_append (
c->serializer);
366 auto snap =
c->serializer->snapshot ();
367 c->serializer->push ();
371 c->serializer->pop_discard ();
373 c->serializer->revert (snap);
377 objidxs.
push (
c->serializer->pop_pack ());
378 new_strikes.
push (
o);
381 for (
unsigned int i = 0;
i < new_strikes.
length; ++
i)
382 c->serializer->add_link (*new_strikes[
i], objidxs[new_strikes.
length - 1 -
i]);
391 sbix *sbix_prime =
c->serializer->start_embed<
sbix> ();
small capitals from c petite p scientific i
[1]
hb_blob_t * hb_blob_get_empty()
hb_blob_t * hb_blob_create_sub_blob(hb_blob_t *parent, unsigned int offset, unsigned int length)
void hb_blob_destroy(hb_blob_t *blob)
#define TRACE_SERIALIZE(this)
#define TRACE_SANITIZE(this)
#define return_trace(RET)
#define TRACE_SUBSET(this)
#define DEFINE_SIZE_STATIC(size)
IntType< uint8_t > HBUINT8
IntType< uint32_t > HBUINT32
GLenum GLuint GLenum GLsizei length
GLint GLsizei GLsizei height
GLenum GLenum GLsizei count
GLint GLsizei GLsizei GLenum GLenum GLsizei void * data
GLenum GLenum GLenum GLenum GLenum scale
GLenum GLenum GLsizei void * table
#define HB_TAG(c1, c2, c3, c4)
QTextStream out(stdout)
[7]
QHttpRequestHeader header("GET", QUrl::toPercentEncoding("/index.html"))
[1]
SBIXGlyph * copy(hb_serialize_context_t *c, unsigned int data_length) const
DEFINE_SIZE_ARRAY(8, data)
UnsizedArrayOf< HBUINT8 > data
bool subset(hb_subset_context_t *c, unsigned int available_len) const
static unsigned int get_size(unsigned num_glyphs)
UnsizedArrayOf< Offset32To< SBIXGlyph > > imageOffsetsZ
hb_blob_t * get_glyph_blob(unsigned int glyph_id, hb_blob_t *sbix_blob, hb_tag_t file_type, int *x_offset, int *y_offset, unsigned int num_glyphs, unsigned int *strike_ppem) const
bool sanitize(hb_sanitize_context_t *c) const
DEFINE_SIZE_ARRAY(4, imageOffsetsZ)
bool get_extents(hb_font_t *font, hb_codepoint_t glyph, hb_glyph_extents_t *extents) const
accelerator_t(hb_face_t *face)
hb_blob_t * reference_png(hb_font_t *font, hb_codepoint_t glyph_id, int *x_offset, int *y_offset, unsigned int *available_ppem) const
sbix_accelerator_t(hb_face_t *face)
static constexpr hb_tag_t tableTag
bool add_strike(hb_subset_context_t *c, unsigned i) const
bool sanitize(hb_sanitize_context_t *c) const
DEFINE_SIZE_ARRAY(8, strikes)
Array32OfOffset32To< SBIXStrike > strikes
const SBIXStrike & get_strike(unsigned int i) const
bool subset(hb_subset_context_t *c) const
bool serialize_strike_offsets(hb_subset_context_t *c) const