28 #ifndef HB_OT_COLOR_CPAL_TABLE_HH
29 #define HB_OT_COLOR_CPAL_TABLE_HH
40 #define HB_OT_TAG_CPAL HB_TAG('C','P','A','L')
51 unsigned int palette_index,
52 unsigned int palette_count)
const
60 unsigned int palette_index,
61 unsigned int palette_count)
const
68 unsigned int color_index,
69 unsigned int color_count)
const
77 unsigned palette_count,
80 const hb_map_t *color_index_map)
const
86 out->paletteFlagsZ = 0;
90 out->paletteLabelsZ = 0;
98 for (
const auto _ : colorLabels)
100 if (!color_index_map->
has (
_))
continue;
102 new_color_idx = color_index_map->
get (
_);
103 if (!
c->copy<
NameID> (new_color_idx))
109 c->add_link (
out->colorLabelsZ,
c->pop_pack ());
116 unsigned int palette_count,
117 unsigned int color_count)
const
160 {
return v1 ().get_palette_flags (
this, palette_index,
numPalettes); }
163 {
return v1 ().get_palette_name_id (
this, palette_index,
numPalettes); }
166 {
return v1 ().get_color_name_id (
this, color_index,
numColors); }
170 unsigned int *color_count,
175 if (color_count) *color_count = 0;
185 | hb_sink (
hb_array (colors, *color_count))
195 return StructAfter<CPALV1Tail> (*
this);
202 const hb_map_t &color_record_index_map,
203 const hb_set_t &retained_color_record_indices)
const
207 for (
const auto idx : color_record_indices)
210 if (
idx == 0) new_idx = 0;
211 else new_idx = color_record_index_map.
get (
idx);
216 for (
const auto _ : retained_color_record_indices.
iter ())
231 const hb_map_t *color_index_map =
c->plan->colr_palettes;
235 for (
const auto _ : color_index_map->keys ())
237 if (
_ == 0xFFFF)
continue;
238 retained_color_indices.
add (
_);
242 auto *
out =
c->serializer->start_embed (*
this);
251 hb_set_t retained_color_record_indices;
253 unsigned record_count = 0;
254 for (
const auto first_color_record_idx : colorRecordIndices)
256 for (
unsigned retained_color_idx : retained_color_indices.
iter ())
258 unsigned color_record_idx = first_color_record_idx + retained_color_idx;
259 if (color_record_index_map.
has (color_record_idx))
continue;
260 color_record_index_map.
set (color_record_idx, record_count);
261 retained_color_record_indices.
add (color_record_idx);
266 out->numColorRecords = record_count;
268 if (!
out->serialize (
c->serializer, color_records, colorRecordIndices, color_record_index_map, retained_color_record_indices))
hb_array_t< T > hb_array(T *array, unsigned int length)
#define TRACE_SERIALIZE(this)
#define TRACE_SANITIZE(this)
#define return_trace(RET)
#define TRACE_SUBSET(this)
hb_ot_color_palette_flags_t
@ HB_OT_COLOR_PALETTE_FLAG_DEFAULT
HB_EXTERN unsigned int start_offset
unsigned int hb_ot_name_id_t
QTextStream out(stdout)
[7]
hb_ot_color_palette_flags_t get_palette_flags(unsigned int palette_index) const
static constexpr hb_tag_t tableTag
NNOffset32To< UnsizedArrayOf< BGRAColor > > colorRecordsZ
UnsizedArrayOf< HBUINT16 > colorRecordIndicesZ
unsigned int get_color_count() const
hb_ot_name_id_t get_palette_name_id(unsigned int palette_index) const
hb_ot_name_id_t get_color_name_id(unsigned int color_index) const
unsigned int get_palette_count() const
DEFINE_SIZE_ARRAY(12, colorRecordIndicesZ)
bool subset(hb_subset_context_t *c) const
bool serialize(hb_serialize_context_t *c, const hb_array_t< const BGRAColor > &color_records, const hb_array_t< const HBUINT16 > &color_record_indices, const hb_map_t &color_record_index_map, const hb_set_t &retained_color_record_indices) const
unsigned int get_palette_colors(unsigned int palette_index, unsigned int start_offset, unsigned int *color_count, hb_color_t *colors) const
bool sanitize(hb_sanitize_context_t *c) const
unsigned int get_size() const
NNOffset32To< UnsizedArrayOf< NameID > > colorLabelsZ
bool serialize(hb_serialize_context_t *c, unsigned palette_count, unsigned color_count, const void *base, const hb_map_t *color_index_map) const
bool sanitize(hb_sanitize_context_t *c, const void *base, unsigned int palette_count, unsigned int color_count) const
NNOffset32To< UnsizedArrayOf< NameID > > paletteLabelsZ
NNOffset32To< UnsizedArrayOf< HBUINT32 > > paletteFlagsZ
hb_array_t sub_array(unsigned int start_offset=0, unsigned int *seg_count=nullptr) const
bool set(K key, const V &value)
bool has(K k, V *vp=nullptr) const
unsigned int get_population() const
void add(hb_codepoint_t g)