[subset] remove unsed table_entry struct.

This commit is contained in:
Garret Rieger 2021-08-04 16:42:49 -07:00 committed by Behdad Esfahbod
parent dea0fe5717
commit c2ee1fdd40
942 changed files with 21 additions and 32 deletions

View File

@ -624,22 +624,23 @@ hb_face_collect_variation_unicodes (hb_face_t *face,
struct hb_face_builder_data_t struct hb_face_builder_data_t
{ {
struct table_entry_t
{
int cmp (hb_tag_t t) const
{
if (t < tag) return -1;
if (t > tag) return -1;
return 0;
}
hb_tag_t tag;
hb_blob_t *blob;
};
hb_hashmap_t<hb_tag_t, hb_blob_t*, (unsigned)-1, nullptr> tables; hb_hashmap_t<hb_tag_t, hb_blob_t*, (unsigned)-1, nullptr> tables;
}; };
static int compare_entries (const void* a, const void* b)
{
hb_pair_t <hb_tag_t, hb_blob_t*>* pair_a = (hb_pair_t <hb_tag_t, hb_blob_t*>*) a;
hb_pair_t <hb_tag_t, hb_blob_t*>* pair_b = (hb_pair_t <hb_tag_t, hb_blob_t*>*) b;
// Order by blob size first (smallest to largest) and then table tag.
if (hb_blob_get_length (pair_a->second) < hb_blob_get_length (pair_b->second)) return -1;
if (hb_blob_get_length (pair_a->second) > hb_blob_get_length (pair_b->second)) return 1;
if (pair_a->first < pair_b->first) return -1;
if (pair_a->first > pair_b->first) return 1;
return 0;
}
static hb_face_builder_data_t * static hb_face_builder_data_t *
_hb_face_builder_data_create () _hb_face_builder_data_create ()
{ {
@ -688,18 +689,10 @@ _hb_face_builder_data_reference_blob (hb_face_builder_data_t *data)
hb_tag_t sfnt_tag = is_cff ? OT::OpenTypeFontFile::CFFTag : OT::OpenTypeFontFile::TrueTypeTag; hb_tag_t sfnt_tag = is_cff ? OT::OpenTypeFontFile::CFFTag : OT::OpenTypeFontFile::TrueTypeTag;
// Sort the tags so that produced face is deterministic. // Sort the tags so that produced face is deterministic.
hb_set_t tags; hb_vector_t<hb_pair_t <hb_tag_t, hb_blob_t*>> sorted_entries;
+ data->tables.keys() data->tables.iter () | hb_sink (sorted_entries);
| hb_sink (tags) sorted_entries.qsort (compare_entries);
; bool ret = f->serialize_single (&c, sfnt_tag, + sorted_entries.iter());
auto it =
+ tags.iter()
| hb_map ([&] (hb_tag_t _) {
return hb_pair (_, data->tables[_]);
})
;
bool ret = f->serialize_single (&c, sfnt_tag, it);
c.end_serialize (); c.end_serialize ();
@ -720,10 +713,7 @@ _hb_face_builder_reference_table (hb_face_t *face HB_UNUSED, hb_tag_t tag, void
if (!tag) if (!tag)
return _hb_face_builder_data_reference_blob (data); return _hb_face_builder_data_reference_blob (data);
if (data->tables.has (tag)) return hb_blob_reference (data->tables[tag]);
return hb_blob_reference (data->tables[tag]);
return nullptr;
} }

View File

@ -35,7 +35,6 @@
namespace OT { namespace OT {
/* /*
* *
* The OpenType Font File * The OpenType Font File
@ -119,7 +118,7 @@ typedef struct OpenTypeOffsetTable
public: public:
template <typename Iterator> template <typename Iterator, hb_requires (hb_is_iterator(Iterator))>
bool serialize (hb_serialize_context_t *c, bool serialize (hb_serialize_context_t *c,
hb_tag_t sfnt_tag, hb_tag_t sfnt_tag,
Iterator it) Iterator it)
@ -492,7 +491,7 @@ struct OpenTypeFontFile
} }
} }
template <typename Iterator> template <typename Iterator, hb_requires (hb_is_iterator (Iterator))>
bool serialize_single (hb_serialize_context_t *c, bool serialize_single (hb_serialize_context_t *c,
hb_tag_t sfnt_tag, hb_tag_t sfnt_tag,
Iterator items) Iterator items)

Some files were not shown because too many files have changed in this diff Show More