From 6771e79bcc2166b5c03ca615d271c8508d692416 Mon Sep 17 00:00:00 2001 From: Ebrahim Byagowi Date: Tue, 17 Apr 2018 09:36:52 +0430 Subject: [PATCH] Add pre-opentype font pages detection code (#986) As Khaled's finding on #981 this is the way Uniscribe detects those fonts. This is its detection part. --- src/hb-ot-os2-table.hh | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/src/hb-ot-os2-table.hh b/src/hb-ot-os2-table.hh index 84dce2fb8..dfb87dc0a 100644 --- a/src/hb-ot-os2-table.hh +++ b/src/hb-ot-os2-table.hh @@ -125,6 +125,24 @@ struct os2 *max_cp = max; } + enum font_page_t { + HEBREW_FONT_PAGE = 0xB100, // Hebrew Windows 3.1 font page + SIMP_ARABIC_FONT_PAGE = 0xB200, // Simplified Arabic Windows 3.1 font page + TRAD_ARABIC_FONT_PAGE = 0xB300, // Traditional Arabic Windows 3.1 font page + OEM_ARABIC_FONT_PAGE = 0xB400, // OEM Arabic Windows 3.1 font page + SIMP_FARSI_FONT_PAGE = 0xBA00, // Simplified Farsi Windows 3.1 font page + TRAD_FARSI_FONT_PAGE = 0xBB00, // Traditional Farsi Windows 3.1 font page + THAI_FONT_PAGE = 0xDE00 // Thai Windows 3.1 font page + }; + + // https://github.com/Microsoft/Font-Validator/blob/520aaae/OTFontFileVal/val_OS2.cs#L644-L681 + inline font_page_t get_font_page () const + { + if (version != 0) + return (font_page_t) 0; + return (font_page_t) (fsSelection & 0xFF00); + } + public: HBUINT16 version;