29 #ifndef HB_NO_SUBSET_CFF
37 #define CFF_SERIALIZE_FDSELECT_0 0
52 unsigned int &subset_fd_count ,
53 unsigned int &subset_fdselect_size ,
54 unsigned int &subset_fdselect_format ,
59 subset_fdselect_size = 0;
60 subset_fdselect_format = 0;
61 unsigned int num_ranges = 0;
64 if (subset_num_glyphs == 0)
81 fd =
src.get_fd (glyph);
89 fdselect_ranges.
push (pair);
93 subset_fd_count =
set->get_population ();
94 if (subset_fd_count == fdCount)
106 while (
set->next (&
fd))
114 for (
unsigned int i = 0;
i < fdselect_ranges.
length;
i++)
115 fdselect_ranges[
i].
code = fdmap[fdselect_ranges[
i].
code];
119 if (subset_fd_count > 0xFF)
123 subset_fdselect_format = 4;
124 subset_fdselect_size = FDSelect::min_size + FDSelect4::min_size + FDSelect4_Range::static_size * num_ranges + HBUINT32::static_size;
128 #if CFF_SERIALIZE_FDSELECT_0
129 unsigned int format0_size = FDSelect::min_size + FDSelect0::min_size + HBUINT8::static_size * subset_num_glyphs;
131 unsigned int format3_size = FDSelect::min_size + FDSelect3::min_size + FDSelect3_Range::static_size * num_ranges + HBUINT16::static_size;
133 #if CFF_SERIALIZE_FDSELECT_0
134 if (format0_size <= format3_size)
137 subset_fdselect_size = format0_size;
142 subset_fdselect_format = 3;
143 subset_fdselect_size = format3_size;
150 template <
typename FD
SELECT3_4>
153 const unsigned int num_glyphs,
159 FDSELECT3_4 *
p =
c->allocate_size<FDSELECT3_4> (
size);
161 p->nRanges () = fdselect_ranges.
length;
162 for (
unsigned int i = 0;
i < fdselect_ranges.
length;
i++)
164 p->ranges[
i].first = fdselect_ranges[
i].glyph;
165 p->ranges[
i].fd = fdselect_ranges[
i].code;
167 p->sentinel () = num_glyphs;
174 const unsigned int num_glyphs,
176 unsigned int fd_count,
177 unsigned int fdselect_format,
184 p->format = fdselect_format;
185 size -= FDSelect::min_size;
187 switch (fdselect_format)
189 #if CFF_SERIALIZE_FDSELECT_0
194 unsigned int range_index = 0;
195 unsigned int fd = fdselect_ranges[range_index++].code;
196 for (
unsigned int i = 0;
i < num_glyphs;
i++)
198 if ((range_index < fdselect_ranges.len) &&
199 (
i >= fdselect_ranges[range_index].glyph))
201 fd = fdselect_ranges[range_index++].code;
210 return serialize_fdselect_3_4<FDSelect3> (
c, num_glyphs,
src,
211 size, fdselect_ranges);
214 return serialize_fdselect_3_4<FDSelect4> (
c, num_glyphs,
src,
215 size, fdselect_ranges);
small capitals from c petite p scientific i
[1]
#define TRACE_SERIALIZE(this)
#define return_trace(RET)
hb_set_t * hb_set_create()
void hb_set_destroy(hb_set_t *set)
bool hb_plan_subset_cff_fdselect(const hb_subset_plan_t *plan, unsigned int fdCount, const FDSelect &src, unsigned int &subset_fd_count, unsigned int &subset_fdselect_size, unsigned int &subset_fdselect_format, hb_vector_t< code_pair_t > &fdselect_ranges, hb_inc_bimap_t &fdmap)
bool hb_serialize_cff_fdselect(hb_serialize_context_t *c, const unsigned int num_glyphs, const FDSelect &src, unsigned int fd_count, unsigned int fdselect_format, unsigned int size, const hb_vector_t< code_pair_t > &fdselect_ranges)
GLenum GLuint GLintptr GLsizeiptr size
[1]
QFuture< QSet< QChar > > set
[10]
unsigned int get_population() const
hb_codepoint_t add(hb_codepoint_t lhs)
bool identity(unsigned int size)
bool old_gid_for_new_gid(hb_codepoint_t new_gid, hb_codepoint_t *old_gid) const
unsigned int num_output_glyphs() const