// Sort the tags so that produced face is deterministic.
hb_vector_t<hb_pair_t <hb_tag_t, face_table_info_t>> sorted_entries;
data->tables.iter () | hb_sink (sorted_entries); if (unlikely (sorted_entries.in_error ()))
{
hb_free (buf); return nullptr;
}
unsigned population = data->tables.get_population ();
if (!table_count) return population;
if (unlikely (start_offset >= population))
{ if (table_count)
*table_count = 0; return population;
}
// Sort the tags.
hb_vector_t<hb_tag_t> sorted_tags;
data->tables.keys () | hb_sink (sorted_tags); if (unlikely (sorted_tags.in_error ()))
{ // Not much to do...
}
sorted_tags.qsort ([] (constvoid* a, constvoid* b) { return * (hb_tag_t *) a < * (hb_tag_t *) b ? -1 :
* (hb_tag_t *) a == * (hb_tag_t *) b ? 0 :
+1;
});
auto array = sorted_tags.as_array ().sub_array (start_offset, table_count); auto out = hb_array (table_tags, *table_count);
+ array.iter ()
| hb_sink (out)
;
return population;
}
/** * hb_face_builder_create: * * Creates a #hb_face_t that can be used with hb_face_builder_add_table(). * After tables are added to the face, it can be compiled to a binary * font file by calling hb_face_reference_blob(). * * Return value: (transfer full): New face. * * Since: 1.9.0
**/
hb_face_t *
hb_face_builder_create ()
{
hb_face_builder_data_t *data = _hb_face_builder_data_create (); if (unlikely (!data)) return hb_face_get_empty ();
/** * hb_face_builder_add_table: * @face: A face object created with hb_face_builder_create() * @tag: The #hb_tag_t of the table to add * @blob: The blob containing the table data to add * * Add table for @tag with data provided by @blob to the face. @face must * be created using hb_face_builder_create(). * * Since: 1.9.0
**/
hb_bool_t
hb_face_builder_add_table (hb_face_t *face, hb_tag_t tag, hb_blob_t *blob)
{ if (unlikely (face->destroy != (hb_destroy_func_t) _hb_face_builder_data_destroy)) returnfalse;
/** * hb_face_builder_sort_tables: * @face: A face object created with hb_face_builder_create() * @tags: (array zero-terminated=1): ordered list of table tags terminated by * %HB_TAG_NONE * * Set the ordering of tables for serialization. Any tables not * specified in the tags list will be ordered after the tables in * tags, ordered by the default sort ordering. * * Since: 5.3.0
**/ void
hb_face_builder_sort_tables (hb_face_t *face, const hb_tag_t *tags)
{ if (unlikely (face->destroy != (hb_destroy_func_t) _hb_face_builder_data_destroy)) return;
// Sort all unspecified tables after any specified tables. for (auto& info : data->tables.values_ref())
info.order = (unsigned) -1;
signed order = 0; for (const hb_tag_t* tag = tags;
*tag;
tag++)
{
face_table_info_t* info; if (!data->tables.has (*tag, &info)) continue;
info->order = order++;
}
}
Messung V0.5
¤ Dauer der Verarbeitung: 0.12 Sekunden
(vorverarbeitet)
¤
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.