summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSeigo Nonaka <nona@google.com>2021-05-13 18:52:00 -0700
committerSeigo Nonaka <nona@google.com>2021-05-13 18:52:00 -0700
commit2deb0c865fea3f7133b0403b9b33afb5261534c0 (patch)
tree881644c8702cbb78ee8bd13bf7b14f9b0740fa6f
parent31aebbf1bcc3a01dfe8f7a6ba1c93c5afafc5aa2 (diff)
downloadminikin-2deb0c865fea3f7133b0403b9b33afb5261534c0.tar.gz
Add test case for overriding flag sequence
Bug: 187358499 Test: minikin_tests Change-Id: I99cfc5b69c9edf0c91cece6cf8bd50ea4941f35a
-rw-r--r--tests/data/EmojiBase.ttfbin1292 -> 1428 bytes
-rw-r--r--tests/data/EmojiBase.ttx52
-rw-r--r--tests/data/OverrideEmoji.ttfbin1088 -> 1200 bytes
-rw-r--r--tests/data/OverrideEmoji.ttx51
-rw-r--r--tests/unittest/FontCollectionItemizeTest.cpp8
5 files changed, 111 insertions, 0 deletions
diff --git a/tests/data/EmojiBase.ttf b/tests/data/EmojiBase.ttf
index 2e464f7..659226d 100644
--- a/tests/data/EmojiBase.ttf
+++ b/tests/data/EmojiBase.ttf
Binary files differ
diff --git a/tests/data/EmojiBase.ttx b/tests/data/EmojiBase.ttx
index d33a2c0..e6e3da8 100644
--- a/tests/data/EmojiBase.ttx
+++ b/tests/data/EmojiBase.ttx
@@ -46,6 +46,12 @@
<GlyphID id="18" name="LigaForm3"/>
<GlyphID id="19" name="LigaForm4"/>
<GlyphID id="20" name="LigaForm5"/>
+ <GlyphID id="21" name="LigaForm6"/>
+ <GlyphID id="22" name="LigaForm7"/>
+
+ <!-- Regional Indicators -->
+ <GlyphID id="23" name="U+1F1E6"/>
+ <GlyphID id="24" name="U+1F1E7"/>
</GlyphOrder>
@@ -165,6 +171,8 @@
<hmtx>
<mtx name=".notdef" width="500" lsb="93"/>
<mtx name="U+200D" width="500" lsb="93"/>
+ <mtx name="U+1F1E6" width="500" lsb="93"/>
+ <mtx name="U+1F1E7" width="500" lsb="93"/>
<mtx name="U+1F3FB" width="500" lsb="93"/>
<mtx name="U+1F3FC" width="500" lsb="93"/>
<mtx name="U+1F9B0" width="500" lsb="93"/>
@@ -184,12 +192,16 @@
<mtx name="LigaForm3" width="500" lsb="93"/>
<mtx name="LigaForm4" width="500" lsb="93"/>
<mtx name="LigaForm5" width="500" lsb="93"/>
+ <mtx name="LigaForm6" width="500" lsb="93"/>
+ <mtx name="LigaForm7" width="500" lsb="93"/>
</hmtx>
<cmap>
<tableVersion version="0"/>
<cmap_format_12 format="12" reserved="0" length="3" nGroups="6" platformID="3" platEncID="1" language="0">
<map code="0x200D" name="U+200D" />
+ <map code="0x1F1E6" name="U+1F1E6" />
+ <map code="0x1F1E7" name="U+1F1E7" />
<map code="0x1F3FB" name="U+1F3FB" />
<map code="0x1F3FC" name="U+1F3FC" />
<map code="0x1F9B0" name="U+1F9B0" />
@@ -234,6 +246,24 @@
</contour>
<instructions><assembly></assembly></instructions>
</TTGlyph>
+ <TTGlyph name="U+1F1E6" xMin="0" yMin="0" xMax="100" yMax="100">
+ <contour>
+ <pt x="0" y="0" on="1" />
+ <pt x="100" y="0" on="1" />
+ <pt x="100" y="100" on="1" />
+ <pt x="0" y="100" on="1" />
+ </contour>
+ <instructions><assembly></assembly></instructions>
+ </TTGlyph>
+ <TTGlyph name="U+1F1E7" xMin="0" yMin="0" xMax="100" yMax="100">
+ <contour>
+ <pt x="0" y="0" on="1" />
+ <pt x="100" y="0" on="1" />
+ <pt x="100" y="100" on="1" />
+ <pt x="0" y="100" on="1" />
+ </contour>
+ <instructions><assembly></assembly></instructions>
+ </TTGlyph>
<TTGlyph name="U+1F3FB" xMin="0" yMin="0" xMax="100" yMax="100">
<contour>
<pt x="0" y="0" on="1" />
@@ -405,6 +435,24 @@
</contour>
<instructions><assembly></assembly></instructions>
</TTGlyph>
+ <TTGlyph name="LigaForm6" xMin="0" yMin="0" xMax="100" yMax="100">
+ <contour>
+ <pt x="0" y="0" on="1" />
+ <pt x="100" y="0" on="1" />
+ <pt x="100" y="100" on="1" />
+ <pt x="0" y="100" on="1" />
+ </contour>
+ <instructions><assembly></assembly></instructions>
+ </TTGlyph>
+ <TTGlyph name="LigaForm7" xMin="0" yMin="0" xMax="100" yMax="100">
+ <contour>
+ <pt x="0" y="0" on="1" />
+ <pt x="100" y="0" on="1" />
+ <pt x="100" y="100" on="1" />
+ <pt x="0" y="100" on="1" />
+ </contour>
+ <instructions><assembly></assembly></instructions>
+ </TTGlyph>
</glyf>
<name>
@@ -478,6 +526,10 @@
<!-- U+1F9B6 U+1F3FB -> LigaForm3 -->
<Ligature components="U+1F3FB" glyph="LigaForm3"/>
</LigatureSet>
+ <LigatureSet glyph="U+1F1E6">
+ <Ligature components="U+1F1E6" glyph="LigaForm6"/>
+ <Ligature components="U+1F1E7" glyph="LigaForm7"/>
+ </LigatureSet>
</LigatureSubst>
</Lookup>
</LookupList>
diff --git a/tests/data/OverrideEmoji.ttf b/tests/data/OverrideEmoji.ttf
index 06bb8ca..890796b 100644
--- a/tests/data/OverrideEmoji.ttf
+++ b/tests/data/OverrideEmoji.ttf
Binary files differ
diff --git a/tests/data/OverrideEmoji.ttx b/tests/data/OverrideEmoji.ttx
index b484369..d5d4091 100644
--- a/tests/data/OverrideEmoji.ttx
+++ b/tests/data/OverrideEmoji.ttx
@@ -55,7 +55,14 @@
<GlyphID id="19" name="LigaForm4"/>
<GlyphID id="20" name="LigaForm5"/>
-->
+ <GlyphID id="21" name="LigaForm6"/>
+ <!--
+ Following glyph is removed from EmojiBase.ttf for verifying fallback.
+ <GlyphID id="22" name="LigaForm7"/>
+ -->
+ <GlyphID id="23" name="U+1F1E6"/>
+ <GlyphID id="24" name="U+1F1E7"/>
</GlyphOrder>
<head>
@@ -174,6 +181,8 @@
<hmtx>
<mtx name=".notdef" width="500" lsb="93"/>
<mtx name="U+200D" width="500" lsb="93"/>
+ <mtx name="U+1F1E6" width="500" lsb="93"/>
+ <mtx name="U+1F1E7" width="500" lsb="93"/>
<mtx name="U+1F3FB" width="500" lsb="93"/>
<mtx name="U+1F3FC" width="500" lsb="93"/>
<mtx name="U+1F9B0" width="500" lsb="93"/>
@@ -203,12 +212,19 @@
<mtx name="LigaForm4" width="500" lsb="93"/>
<mtx name="LigaForm5" width="500" lsb="93"/>
-->
+ <mtx name="LigaForm6" width="500" lsb="93"/>
+ <!--
+ Following glyph is removed from EmojiBase.ttf for verifying fallback.
+ <mtx name="LigaForm7" width="500" lsb="93"/>
+ -->
</hmtx>
<cmap>
<tableVersion version="0"/>
<cmap_format_12 format="12" reserved="0" length="3" nGroups="6" platformID="3" platEncID="1" language="0">
<map code="0x200D" name="U+200D" />
+ <map code="0x1F1E6" name="U+1F1E6" />
+ <map code="0x1F1E7" name="U+1F1E7" />
<map code="0x1F3FB" name="U+1F3FB" />
<map code="0x1F3FC" name="U+1F3FC" />
<map code="0x1F9B0" name="U+1F9B0" />
@@ -259,6 +275,24 @@
</contour>
<instructions><assembly></assembly></instructions>
</TTGlyph>
+ <TTGlyph name="U+1F1E6" xMin="0" yMin="0" xMax="100" yMax="100">
+ <contour>
+ <pt x="0" y="0" on="1" />
+ <pt x="100" y="0" on="1" />
+ <pt x="100" y="100" on="1" />
+ <pt x="0" y="100" on="1" />
+ </contour>
+ <instructions><assembly></assembly></instructions>
+ </TTGlyph>
+ <TTGlyph name="U+1F1E7" xMin="0" yMin="0" xMax="100" yMax="100">
+ <contour>
+ <pt x="0" y="0" on="1" />
+ <pt x="100" y="0" on="1" />
+ <pt x="100" y="100" on="1" />
+ <pt x="0" y="100" on="1" />
+ </contour>
+ <instructions><assembly></assembly></instructions>
+ </TTGlyph>
<TTGlyph name="U+1F3FB" xMin="0" yMin="0" xMax="100" yMax="100">
<contour>
<pt x="0" y="0" on="1" />
@@ -383,6 +417,19 @@
<TTGlyph name="LigaForm4">
<TTGlyph name="LigaForm5">
-->
+ <TTGlyph name="LigaForm6" xMin="0" yMin="0" xMax="100" yMax="100">
+ <contour>
+ <pt x="0" y="0" on="1" />
+ <pt x="100" y="0" on="1" />
+ <pt x="100" y="100" on="1" />
+ <pt x="0" y="100" on="1" />
+ </contour>
+ <instructions><assembly></assembly></instructions>
+ </TTGlyph>
+ <!--
+ Following glyph is removed from EmojiBase.ttf for verifying fallback.
+ <TTGlyph name="LigaForm7">
+ -->
</glyf>
<name>
@@ -463,6 +510,10 @@
<Ligature components="U+1F3FB" glyph="LigaForm3"/>
</LigatureSet>
-->
+ <LigatureSet glyph="U+1F1E6">
+ <Ligature components="U+1F1E6" glyph="LigaForm6"/>
+ <Ligature components="U+1F1E7" glyph=".notdef"/>
+ </LigatureSet>
</LigatureSubst>
</Lookup>
</LookupList>
diff --git a/tests/unittest/FontCollectionItemizeTest.cpp b/tests/unittest/FontCollectionItemizeTest.cpp
index 96589c9..6f1e194 100644
--- a/tests/unittest/FontCollectionItemizeTest.cpp
+++ b/tests/unittest/FontCollectionItemizeTest.cpp
@@ -1670,4 +1670,12 @@ TEST(FontCollectionItemizeTest, emojiFallback) {
itemizeEmojiAndFontPostScriptName("U+1F9B2 U+200D U+1F9B3 U+200D U+1F9B4"));
}
+TEST(FontCollectionItemizeTest, emojiFlagFallback) {
+ // If the OverrideEmojiFont supports U+1F1E6 U+1F1E6, use that font.
+ EXPECT_EQ("OverrideEmojiFont", itemizeEmojiAndFontPostScriptName("U+1F1E6 U+1F1E6"));
+
+ // Even if the OverrideEmojiFont directs to .notdef (i.e. Tofu glyph) for the sequence, use it.
+ EXPECT_EQ("OverrideEmojiFont", itemizeEmojiAndFontPostScriptName("U+1F1E6 U+1F1E7"));
+}
+
} // namespace minikin