From 2eb4b1c0a4cef2a0ad43eb670aea353e2a3769ca Mon Sep 17 00:00:00 2001 From: Chad Brokaw Date: Thu, 20 Jun 2024 12:22:13 -0400 Subject: [PATCH] Support 'true' SFNT version The `Zycon.ttf` test font at https://github.com/unicode-org/text-rendering-tests/tree/main/fonts uses this. --- font-types/src/lib.rs | 2 ++ read-fonts/src/lib.rs | 4 +++- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/font-types/src/lib.rs b/font-types/src/lib.rs index 343dedc6d..b57542e41 100644 --- a/font-types/src/lib.rs +++ b/font-types/src/lib.rs @@ -49,5 +49,7 @@ pub const TTC_HEADER_TAG: Tag = Tag::new(b"ttcf"); /// The SFNT version for fonts containing TrueType outlines. pub const TT_SFNT_VERSION: u32 = 0x00010000; +/// The SFNT version for legacy Apple fonts containing TrueType outlines. +pub const TRUE_SFNT_VERSION: u32 = 0x74727565; /// The SFNT version for fonts containing CFF outlines. pub const CFF_SFTN_VERSION: u32 = 0x4F54544F; diff --git a/read-fonts/src/lib.rs b/read-fonts/src/lib.rs index 5d42ec19d..7f1c63f0f 100644 --- a/read-fonts/src/lib.rs +++ b/read-fonts/src/lib.rs @@ -306,7 +306,9 @@ impl<'a> FontRef<'a> { data: FontData<'a>, table_directory: TableDirectory<'a>, ) -> Result { - if [TT_SFNT_VERSION, CFF_SFTN_VERSION].contains(&table_directory.sfnt_version()) { + if [TT_SFNT_VERSION, CFF_SFTN_VERSION, TRUE_SFNT_VERSION] + .contains(&table_directory.sfnt_version()) + { Ok(FontRef { data, table_directory,