From a826a8730f21ae996ae8f4d12c44dc18b9e8e933 Mon Sep 17 00:00:00 2001 From: Behdad Esfahbod Date: Tue, 16 Oct 2018 13:06:56 -0700 Subject: [PATCH] [name] Hide internal details from public API --- src/hb-ot-name-table.hh | 23 +++++++++++++---------- src/hb-ot-name.h | 3 +-- 2 files changed, 14 insertions(+), 12 deletions(-) diff --git a/src/hb-ot-name-table.hh b/src/hb-ot-name-table.hh index 14ac4ef..f0b5a5e 100644 --- a/src/hb-ot-name-table.hh +++ b/src/hb-ot-name-table.hh @@ -33,6 +33,10 @@ namespace OT { +#define entry_score var.u16[0] +#define entry_index var.u16[1] + + /* * name -- Naming * https://docs.microsoft.com/en-us/typography/opentype/spec/name @@ -118,11 +122,11 @@ _hb_ot_name_entry_cmp (const void *pa, const void *pb) if (e) return e; - if (a->score != b->score) - return a->score < b->score ? -1 : +1; + if (a->entry_score != b->entry_score) + return a->entry_score < b->entry_score ? -1 : +1; - if (a->index != b->index) - return a->index < b->index ? -1 : +1; + if (a->entry_index != b->entry_index) + return a->entry_index < b->entry_index ? -1 : +1; return 0; } @@ -174,13 +178,12 @@ struct name for (uint16_t i = 0; i < all_names.len; i++) { - unsigned int name_id = all_names[i].nameID; - uint16_t score = all_names[i].score (); - hb_language_t language = HB_LANGUAGE_INVALID; /* XXX */ - - hb_ot_name_entry_t entry = {name_id, score, i, language}; + hb_ot_name_entry_t *entry = this->names.push (); - this->names.push (entry); + entry->name_id = all_names[i].nameID; + entry->language = HB_LANGUAGE_INVALID; /* XXX */ + entry->entry_score = all_names[i].score (); + entry->entry_index = i; } this->names.qsort (_hb_ot_name_entry_cmp); diff --git a/src/hb-ot-name.h b/src/hb-ot-name.h index 013ce8d..fb49480 100644 --- a/src/hb-ot-name.h +++ b/src/hb-ot-name.h @@ -79,8 +79,7 @@ typedef struct hb_ot_name_entry_t { hb_name_id_t name_id; /*< private >*/ - uint16_t score; - uint16_t index; + hb_var_int_t var; /*< public >*/ hb_language_t language; } hb_ot_name_entry_t; -- 2.7.4