From e2f9b657758cda3708c0a9db971c467ca59d5c19 Mon Sep 17 00:00:00 2001 From: Behdad Esfahbod Date: Tue, 23 Oct 2018 21:19:56 -0700 Subject: [PATCH] [name] Start adding language support --- src/hb-ot-name-table.hh | 25 ++++++++++++++++++++++++- 1 file changed, 24 insertions(+), 1 deletion(-) diff --git a/src/hb-ot-name-table.hh b/src/hb-ot-name-table.hh index c1e89a997..c6b7796e8 100644 --- a/src/hb-ot-name-table.hh +++ b/src/hb-ot-name-table.hh @@ -47,6 +47,29 @@ namespace OT { struct NameRecord { + inline hb_language_t language (void) const + { + unsigned int p = platformID; + unsigned int l = languageID; + + if (p == 3) + { + switch (l) + { + case 0x0409: return hb_language_from_string ("en", -1); + } + } + else if (p == 1) + { + switch (l) + { + case 0: return hb_language_from_string ("en", -1); + } + } + + return HB_LANGUAGE_INVALID; + } + inline uint16_t score (void) const { /* Same order as in cmap::find_best_subtable(). */ @@ -177,7 +200,7 @@ struct name hb_ot_name_entry_t *entry = this->names.push (); entry->name_id = all_names[i].nameID; - entry->language = HB_LANGUAGE_INVALID; /* XXX */ + entry->language = all_names[i].language (); entry->entry_score = all_names[i].score (); entry->entry_index = i; }