diff --git a/core/api/system-current.txt b/core/api/system-current.txt
index f7b4cdccee6cb..73fe76448df91 100644
--- a/core/api/system-current.txt
+++ b/core/api/system-current.txt
@@ -14122,6 +14122,7 @@ package android.text {
method @NonNull public java.io.File getFile();
method @Nullable public String getFontFamilyName();
method @NonNull public String getFontVariationSettings();
+ method @NonNull public String getPostScriptName();
method @NonNull public android.graphics.fonts.FontStyle getStyle();
method public int getTtcIndex();
method public void writeToParcel(@NonNull android.os.Parcel, int);
diff --git a/core/api/test-current.txt b/core/api/test-current.txt
index 0e1b24a200183..c2af526fd0958 100644
--- a/core/api/test-current.txt
+++ b/core/api/test-current.txt
@@ -2489,6 +2489,7 @@ package android.text {
method @NonNull public java.io.File getFile();
method @Nullable public String getFontFamilyName();
method @NonNull public String getFontVariationSettings();
+ method @NonNull public String getPostScriptName();
method @NonNull public android.graphics.fonts.FontStyle getStyle();
method public int getTtcIndex();
method public void writeToParcel(@NonNull android.os.Parcel, int);
diff --git a/core/java/android/text/FontConfig.java b/core/java/android/text/FontConfig.java
index 33b7c757f1e81..2f7fb2f0ab9d1 100644
--- a/core/java/android/text/FontConfig.java
+++ b/core/java/android/text/FontConfig.java
@@ -194,6 +194,7 @@ public final class FontConfig implements Parcelable {
public static final class Font implements Parcelable {
private final @NonNull File mFile;
private final @Nullable File mOriginalFile;
+ private final @NonNull String mPostScriptName;
private final @NonNull FontStyle mStyle;
private final @IntRange(from = 0) int mIndex;
private final @NonNull String mFontVariationSettings;
@@ -204,11 +205,12 @@ public final class FontConfig implements Parcelable {
*
* @hide Only system server can create this instance and passed via IPC.
*/
- public Font(@NonNull File file, @Nullable File originalFile, @NonNull FontStyle style,
- @IntRange(from = 0) int index, @NonNull String fontVariationSettings,
- @Nullable String fontFamilyName) {
+ public Font(@NonNull File file, @Nullable File originalFile, @NonNull String postScriptName,
+ @NonNull FontStyle style, @IntRange(from = 0) int index,
+ @NonNull String fontVariationSettings, @Nullable String fontFamilyName) {
mFile = file;
mOriginalFile = originalFile;
+ mPostScriptName = postScriptName;
mStyle = style;
mIndex = index;
mFontVariationSettings = fontVariationSettings;
@@ -224,6 +226,7 @@ public final class FontConfig implements Parcelable {
public void writeToParcel(@NonNull Parcel dest, int flags) {
dest.writeString8(mFile.getAbsolutePath());
dest.writeString8(mOriginalFile == null ? null : mOriginalFile.getAbsolutePath());
+ dest.writeString8(mPostScriptName);
dest.writeInt(mStyle.getWeight());
dest.writeInt(mStyle.getSlant());
dest.writeInt(mIndex);
@@ -238,14 +241,15 @@ public final class FontConfig implements Parcelable {
File path = new File(source.readString8());
String originalPathStr = source.readString8();
File originalPath = originalPathStr == null ? null : new File(originalPathStr);
+ String postScriptName = source.readString8();
int weight = source.readInt();
int slant = source.readInt();
int index = source.readInt();
String varSettings = source.readString8();
String fallback = source.readString8();
- return new Font(path, originalPath, new FontStyle(weight, slant), index,
- varSettings, fallback);
+ return new Font(path, originalPath, postScriptName, new FontStyle(weight, slant),
+ index, varSettings, fallback);
}
@Override
@@ -313,6 +317,13 @@ public final class FontConfig implements Parcelable {
return mIndex;
}
+ /**
+ * Returns the PostScript name of this font.
+ */
+ public @NonNull String getPostScriptName() {
+ return mPostScriptName;
+ }
+
/**
* Returns the list of axes associated to this font.
* @deprecated Use getFontVariationSettings
diff --git a/core/tests/coretests/src/android/graphics/FontListParserTest.java b/core/tests/coretests/src/android/graphics/FontListParserTest.java
index bef1a4e7010fa..b2df98dc63748 100644
--- a/core/tests/coretests/src/android/graphics/FontListParserTest.java
+++ b/core/tests/coretests/src/android/graphics/FontListParserTest.java
@@ -59,7 +59,7 @@ public final class FontListParserTest {
+ "";
FontConfig.FontFamily expected = new FontConfig.FontFamily(
Arrays.asList(
- new FontConfig.Font(new File("test.ttf"), null,
+ new FontConfig.Font(new File("test.ttf"), null, "test",
new FontStyle(FONT_WEIGHT_NORMAL, FONT_SLANT_UPRIGHT),
0, "", null)),
"sans-serif", LocaleList.getEmptyLocaleList(), VARIANT_DEFAULT);
@@ -77,10 +77,10 @@ public final class FontListParserTest {
+ "";
FontConfig.FontFamily expected = new FontConfig.FontFamily(
Arrays.asList(
- new FontConfig.Font(new File("test.ttf"), null,
+ new FontConfig.Font(new File("test.ttf"), null, "test",
new FontStyle(FONT_WEIGHT_NORMAL, FONT_SLANT_UPRIGHT),
0, "", null),
- new FontConfig.Font(new File("test.ttf"), null,
+ new FontConfig.Font(new File("test.ttf"), null, "test",
new FontStyle(FONT_WEIGHT_NORMAL, FONT_SLANT_UPRIGHT),
0, "", "serif")),
null, LocaleList.forLanguageTags("en"), VARIANT_DEFAULT);
@@ -97,7 +97,7 @@ public final class FontListParserTest {
+ "";
FontConfig.FontFamily expected = new FontConfig.FontFamily(
Arrays.asList(
- new FontConfig.Font(new File("test.ttf"), null,
+ new FontConfig.Font(new File("test.ttf"), null, "test",
new FontStyle(FONT_WEIGHT_NORMAL, FONT_SLANT_UPRIGHT),
0, "", null)),
null, LocaleList.forLanguageTags("en"), VARIANT_COMPACT);
@@ -114,7 +114,7 @@ public final class FontListParserTest {
+ "";
FontConfig.FontFamily expected = new FontConfig.FontFamily(
Arrays.asList(
- new FontConfig.Font(new File("test.ttf"), null,
+ new FontConfig.Font(new File("test.ttf"), null, "test",
new FontStyle(FONT_WEIGHT_NORMAL, FONT_SLANT_UPRIGHT),
0, "", null)),
null, LocaleList.forLanguageTags("en"), VARIANT_ELEGANT);
@@ -133,13 +133,13 @@ public final class FontListParserTest {
+ "";
FontConfig.FontFamily expected = new FontConfig.FontFamily(
Arrays.asList(
- new FontConfig.Font(new File("normal.ttf"), null,
+ new FontConfig.Font(new File("normal.ttf"), null, "test",
new FontStyle(FONT_WEIGHT_NORMAL, FONT_SLANT_UPRIGHT),
0, "", null),
- new FontConfig.Font(new File("weight.ttf"), null,
+ new FontConfig.Font(new File("weight.ttf"), null, "test",
new FontStyle(100, FONT_SLANT_UPRIGHT),
0, "", null),
- new FontConfig.Font(new File("italic.ttf"), null,
+ new FontConfig.Font(new File("italic.ttf"), null, "test",
new FontStyle(FONT_WEIGHT_NORMAL, FONT_SLANT_ITALIC),
0, "", null)),
"sans-serif", LocaleList.getEmptyLocaleList(), VARIANT_DEFAULT);
@@ -162,10 +162,10 @@ public final class FontListParserTest {
+ "";
FontConfig.FontFamily expected = new FontConfig.FontFamily(
Arrays.asList(
- new FontConfig.Font(new File("test-VF.ttf"), null,
+ new FontConfig.Font(new File("test-VF.ttf"), null, "test",
new FontStyle(FONT_WEIGHT_NORMAL, FONT_SLANT_UPRIGHT),
0, "'wdth' 100.0,'wght' 200.0", null),
- new FontConfig.Font(new File("test-VF.ttf"), null,
+ new FontConfig.Font(new File("test-VF.ttf"), null, "test",
new FontStyle(FONT_WEIGHT_NORMAL, FONT_SLANT_UPRIGHT),
0, "'wdth' 400.0,'wght' 700.0", null)),
"sans-serif", LocaleList.getEmptyLocaleList(), VARIANT_DEFAULT);
@@ -182,10 +182,30 @@ public final class FontListParserTest {
+ "";
FontConfig.FontFamily expected = new FontConfig.FontFamily(
Arrays.asList(
- new FontConfig.Font(new File("test.ttc"), null,
+ new FontConfig.Font(new File("test.ttc"), null, "test",
new FontStyle(FONT_WEIGHT_NORMAL, FONT_SLANT_UPRIGHT),
0, "", null),
- new FontConfig.Font(new File("test.ttc"), null,
+ new FontConfig.Font(new File("test.ttc"), null, "test",
+ new FontStyle(FONT_WEIGHT_NORMAL, FONT_SLANT_UPRIGHT),
+ 1, "", null)),
+ "sans-serif", LocaleList.getEmptyLocaleList(), VARIANT_DEFAULT);
+ FontConfig.FontFamily family = readFamily(xml);
+ assertThat(family).isEqualTo(expected);
+ }
+
+ @Test
+ public void psName() throws Exception {
+ String xml = ""
+ + ""
+ + " test.ttc"
+ + " test.ttc"
+ + "";
+ FontConfig.FontFamily expected = new FontConfig.FontFamily(
+ Arrays.asList(
+ new FontConfig.Font(new File("test.ttc"), null, "foo",
+ new FontStyle(FONT_WEIGHT_NORMAL, FONT_SLANT_UPRIGHT),
+ 0, "", null),
+ new FontConfig.Font(new File("test.ttc"), null, "test",
new FontStyle(FONT_WEIGHT_NORMAL, FONT_SLANT_UPRIGHT),
1, "", null)),
"sans-serif", LocaleList.getEmptyLocaleList(), VARIANT_DEFAULT);
diff --git a/data/fonts/fonts.xml b/data/fonts/fonts.xml
index 2db4c5d6bf2ac..11635366a2224 100644
--- a/data/fonts/fonts.xml
+++ b/data/fonts/fonts.xml
@@ -223,7 +223,7 @@
- NotoSerif-Regular.ttf
+ NotoSerif-Regular.ttf
NotoSerif-Bold.ttf
NotoSerif-Italic.ttf
NotoSerif-BoldItalic.ttf
@@ -245,7 +245,7 @@
- CutiveMono.ttf
+ CutiveMono.ttf
@@ -255,7 +255,8 @@
- DancingScript-Regular.ttf
+ DancingScript-Regular.ttf
+
DancingScript-Bold.ttf
@@ -271,148 +272,195 @@
SourceSansPro-Bold.ttf
SourceSansPro-BoldItalic.ttf
-
+
- NotoNaskhArabic-Regular.ttf
+
+ NotoNaskhArabic-Regular.ttf
+
NotoNaskhArabic-Bold.ttf
- NotoNaskhArabicUI-Regular.ttf
+
+ NotoNaskhArabicUI-Regular.ttf
+
NotoNaskhArabicUI-Bold.ttf
- NotoSansEthiopic-VF.ttf
-
-
- NotoSansEthiopic-VF.ttf
-
-
- NotoSansEthiopic-VF.ttf
-
-
- NotoSansEthiopic-VF.ttf
-
-
- NotoSerifEthiopic-VF.ttf
-
-
- NotoSerifEthiopic-VF.ttf
-
-
- NotoSerifEthiopic-VF.ttf
-
-
- NotoSerifEthiopic-VF.ttf
-
-
+
+ NotoSansEthiopic-VF.ttf
+
+
+
+ NotoSansEthiopic-VF.ttf
+
+
+
+ NotoSansEthiopic-VF.ttf
+
+
+
+ NotoSansEthiopic-VF.ttf
+
+
+ NotoSerifEthiopic-VF.ttf
+
+
+ NotoSerifEthiopic-VF.ttf
+
+
+ NotoSerifEthiopic-VF.ttf
+
+
+ NotoSerifEthiopic-VF.ttf
+
+
- NotoSansHebrew-Regular.ttf
+
+ NotoSansHebrew-Regular.ttf
+
NotoSansHebrew-Bold.ttf
NotoSerifHebrew-Regular.ttf
NotoSerifHebrew-Bold.ttf
- NotoSansThai-Regular.ttf
+ NotoSansThai-Regular.ttf
+
NotoSansThai-Bold.ttf
- NotoSerifThai-Regular.ttf
+
+ NotoSerifThai-Regular.ttf
+
NotoSerifThai-Bold.ttf
- NotoSansThaiUI-Regular.ttf
+
+ NotoSansThaiUI-Regular.ttf
+
NotoSansThaiUI-Bold.ttf
- NotoSansArmenian-VF.ttf
+
+ NotoSansArmenian-VF.ttf
- NotoSansArmenian-VF.ttf
+
+ NotoSansArmenian-VF.ttf
- NotoSansArmenian-VF.ttf
+
+ NotoSansArmenian-VF.ttf
- NotoSansArmenian-VF.ttf
+
+ NotoSansArmenian-VF.ttf
- NotoSerifArmenian-VF.ttf
+ NotoSerifArmenian-VF.ttf
- NotoSerifArmenian-VF.ttf
+ NotoSerifArmenian-VF.ttf
- NotoSerifArmenian-VF.ttf
+ NotoSerifArmenian-VF.ttf
- NotoSerifArmenian-VF.ttf
+ NotoSerifArmenian-VF.ttf
- NotoSansGeorgian-VF.ttf
+
+ NotoSansGeorgian-VF.ttf
- NotoSansGeorgian-VF.ttf
+
+ NotoSansGeorgian-VF.ttf
- NotoSansGeorgian-VF.ttf
+
+ NotoSansGeorgian-VF.ttf
- NotoSansGeorgian-VF.ttf
+
+ NotoSansGeorgian-VF.ttf
- NotoSerifGeorgian-VF.ttf
+ NotoSerifGeorgian-VF.ttf
- NotoSerifGeorgian-VF.ttf
+ NotoSerifGeorgian-VF.ttf
- NotoSerifGeorgian-VF.ttf
+ NotoSerifGeorgian-VF.ttf
- NotoSerifGeorgian-VF.ttf
+ NotoSerifGeorgian-VF.ttf
- NotoSansDevanagari-VF.ttf
+
+ NotoSansDevanagari-VF.ttf
- NotoSansDevanagari-VF.ttf
+
+ NotoSansDevanagari-VF.ttf
- NotoSansDevanagari-VF.ttf
+
+ NotoSansDevanagari-VF.ttf
- NotoSansDevanagari-VF.ttf
+
+ NotoSansDevanagari-VF.ttf
- NotoSerifDevanagari-VF.ttf
+ NotoSerifDevanagari-VF.ttf
- NotoSerifDevanagari-VF.ttf
+ NotoSerifDevanagari-VF.ttf
- NotoSerifDevanagari-VF.ttf
+ NotoSerifDevanagari-VF.ttf
- NotoSerifDevanagari-VF.ttf
+ NotoSerifDevanagari-VF.ttf
- NotoSansDevanagariUI-VF.ttf
+
+ NotoSansDevanagariUI-VF.ttf
- NotoSansDevanagariUI-VF.ttf
+
+ NotoSansDevanagariUI-VF.ttf
- NotoSansDevanagariUI-VF.ttf
+
+ NotoSansDevanagariUI-VF.ttf
- NotoSansDevanagariUI-VF.ttf
+
+ NotoSansDevanagariUI-VF.ttf
@@ -421,347 +469,451 @@
danda characters.
-->
- NotoSansGujarati-Regular.ttf
+
+ NotoSansGujarati-Regular.ttf
+
NotoSansGujarati-Bold.ttf
- NotoSerifGujarati-VF.ttf
+ NotoSerifGujarati-VF.ttf
- NotoSerifGujarati-VF.ttf
+ NotoSerifGujarati-VF.ttf
- NotoSerifGujarati-VF.ttf
+ NotoSerifGujarati-VF.ttf
- NotoSerifGujarati-VF.ttf
+ NotoSerifGujarati-VF.ttf
- NotoSansGujaratiUI-Regular.ttf
+
+ NotoSansGujaratiUI-Regular.ttf
+
NotoSansGujaratiUI-Bold.ttf
- NotoSansGurmukhi-VF.ttf
+
+ NotoSansGurmukhi-VF.ttf
- NotoSansGurmukhi-VF.ttf
+
+ NotoSansGurmukhi-VF.ttf
- NotoSansGurmukhi-VF.ttf
+
+ NotoSansGurmukhi-VF.ttf
- NotoSansGurmukhi-VF.ttf
+
+ NotoSansGurmukhi-VF.ttf
- NotoSerifGurmukhi-VF.ttf
+ NotoSerifGurmukhi-VF.ttf
- NotoSerifGurmukhi-VF.ttf
+ NotoSerifGurmukhi-VF.ttf
- NotoSerifGurmukhi-VF.ttf
+ NotoSerifGurmukhi-VF.ttf
- NotoSerifGurmukhi-VF.ttf
+ NotoSerifGurmukhi-VF.ttf
- NotoSansGurmukhiUI-VF.ttf
+
+ NotoSansGurmukhiUI-VF.ttf
- NotoSansGurmukhiUI-VF.ttf
+
+ NotoSansGurmukhiUI-VF.ttf
- NotoSansGurmukhiUI-VF.ttf
+
+ NotoSansGurmukhiUI-VF.ttf
- NotoSansGurmukhiUI-VF.ttf
+
+ NotoSansGurmukhiUI-VF.ttf
- NotoSansTamil-VF.ttf
+
+ NotoSansTamil-VF.ttf
- NotoSansTamil-VF.ttf
+
+ NotoSansTamil-VF.ttf
- NotoSansTamil-VF.ttf
+
+ NotoSansTamil-VF.ttf
- NotoSansTamil-VF.ttf
+
+ NotoSansTamil-VF.ttf
- NotoSerifTamil-VF.ttf
+ NotoSerifTamil-VF.ttf
- NotoSerifTamil-VF.ttf
+ NotoSerifTamil-VF.ttf
- NotoSerifTamil-VF.ttf
+ NotoSerifTamil-VF.ttf
- NotoSerifTamil-VF.ttf
+ NotoSerifTamil-VF.ttf
- NotoSansTamilUI-VF.ttf
+
+ NotoSansTamilUI-VF.ttf
- NotoSansTamilUI-VF.ttf
+
+ NotoSansTamilUI-VF.ttf
- NotoSansTamilUI-VF.ttf
+
+ NotoSansTamilUI-VF.ttf
- NotoSansTamilUI-VF.ttf
+
+ NotoSansTamilUI-VF.ttf
- NotoSansMalayalam-VF.ttf
+
+ NotoSansMalayalam-VF.ttf
- NotoSansMalayalam-VF.ttf
+
+ NotoSansMalayalam-VF.ttf
- NotoSansMalayalam-VF.ttf
+
+ NotoSansMalayalam-VF.ttf
- NotoSansMalayalam-VF.ttf
+
+ NotoSansMalayalam-VF.ttf
- NotoSerifMalayalam-VF.ttf
+ NotoSerifMalayalam-VF.ttf
- NotoSerifMalayalam-VF.ttf
+ NotoSerifMalayalam-VF.ttf
- NotoSerifMalayalam-VF.ttf
+ NotoSerifMalayalam-VF.ttf
- NotoSerifMalayalam-VF.ttf
+ NotoSerifMalayalam-VF.ttf
- NotoSansMalayalamUI-VF.ttf
+
+ NotoSansMalayalamUI-VF.ttf
- NotoSansMalayalamUI-VF.ttf
+
+ NotoSansMalayalamUI-VF.ttf
- NotoSansMalayalamUI-VF.ttf
+
+ NotoSansMalayalamUI-VF.ttf
- NotoSansMalayalamUI-VF.ttf
+
+ NotoSansMalayalamUI-VF.ttf
- NotoSansBengali-VF.ttf
+
+ NotoSansBengali-VF.ttf
- NotoSansBengali-VF.ttf
+
+ NotoSansBengali-VF.ttf
- NotoSansBengali-VF.ttf
+
+ NotoSansBengali-VF.ttf
- NotoSansBengali-VF.ttf
+
+ NotoSansBengali-VF.ttf
- NotoSerifBengali-VF.ttf
+ NotoSerifBengali-VF.ttf
- NotoSerifBengali-VF.ttf
+ NotoSerifBengali-VF.ttf
- NotoSerifBengali-VF.ttf
+ NotoSerifBengali-VF.ttf
- NotoSerifBengali-VF.ttf
+ NotoSerifBengali-VF.ttf
- NotoSansBengaliUI-VF.ttf
+
+ NotoSansBengaliUI-VF.ttf
- NotoSansBengaliUI-VF.ttf
+
+ NotoSansBengaliUI-VF.ttf
- NotoSansBengaliUI-VF.ttf
+
+ NotoSansBengaliUI-VF.ttf
- NotoSansBengaliUI-VF.ttf
+
+ NotoSansBengaliUI-VF.ttf
- NotoSansTelugu-VF.ttf
+
+ NotoSansTelugu-VF.ttf
- NotoSansTelugu-VF.ttf
+
+ NotoSansTelugu-VF.ttf
- NotoSansTelugu-VF.ttf
+
+ NotoSansTelugu-VF.ttf
- NotoSansTelugu-VF.ttf
+
+ NotoSansTelugu-VF.ttf
- NotoSerifTelugu-VF.ttf
+ NotoSerifTelugu-VF.ttf
- NotoSerifTelugu-VF.ttf
+ NotoSerifTelugu-VF.ttf
- NotoSerifTelugu-VF.ttf
+ NotoSerifTelugu-VF.ttf
- NotoSerifTelugu-VF.ttf
+ NotoSerifTelugu-VF.ttf
- NotoSansTeluguUI-VF.ttf
+
+ NotoSansTeluguUI-VF.ttf
- NotoSansTeluguUI-VF.ttf
+
+ NotoSansTeluguUI-VF.ttf
- NotoSansTeluguUI-VF.ttf
+
+ NotoSansTeluguUI-VF.ttf
- NotoSansTeluguUI-VF.ttf
+
+ NotoSansTeluguUI-VF.ttf
- NotoSansKannada-VF.ttf
+
+ NotoSansKannada-VF.ttf
- NotoSansKannada-VF.ttf
+
+ NotoSansKannada-VF.ttf
- NotoSansKannada-VF.ttf
+
+ NotoSansKannada-VF.ttf
- NotoSansKannada-VF.ttf
+
+ NotoSansKannada-VF.ttf
- NotoSerifKannada-VF.ttf
+ NotoSerifKannada-VF.ttf
- NotoSerifKannada-VF.ttf
+ NotoSerifKannada-VF.ttf
- NotoSerifKannada-VF.ttf
+ NotoSerifKannada-VF.ttf
- NotoSerifKannada-VF.ttf
+ NotoSerifKannada-VF.ttf
- NotoSansKannadaUI-VF.ttf
+
+ NotoSansKannadaUI-VF.ttf
- NotoSansKannadaUI-VF.ttf
+
+ NotoSansKannadaUI-VF.ttf
- NotoSansKannadaUI-VF.ttf
+
+ NotoSansKannadaUI-VF.ttf
- NotoSansKannadaUI-VF.ttf
+
+ NotoSansKannadaUI-VF.ttf
- NotoSansOriya-Regular.ttf
+ NotoSansOriya-Regular.ttf
+
NotoSansOriya-Bold.ttf
- NotoSansOriyaUI-Regular.ttf
+
+ NotoSansOriyaUI-Regular.ttf
+
NotoSansOriyaUI-Bold.ttf
- NotoSansSinhala-VF.ttf
+
+ NotoSansSinhala-VF.ttf
- NotoSansSinhala-VF.ttf
+
+ NotoSansSinhala-VF.ttf
- NotoSansSinhala-VF.ttf
+
+ NotoSansSinhala-VF.ttf
- NotoSansSinhala-VF.ttf
+
+ NotoSansSinhala-VF.ttf
- NotoSerifSinhala-VF.ttf
+ NotoSerifSinhala-VF.ttf
- NotoSerifSinhala-VF.ttf
+ NotoSerifSinhala-VF.ttf
- NotoSerifSinhala-VF.ttf
+ NotoSerifSinhala-VF.ttf
- NotoSerifSinhala-VF.ttf
+ NotoSerifSinhala-VF.ttf
- NotoSansSinhalaUI-VF.ttf
+
+ NotoSansSinhalaUI-VF.ttf
- NotoSansSinhalaUI-VF.ttf
+
+ NotoSansSinhalaUI-VF.ttf
- NotoSansSinhalaUI-VF.ttf
+
+ NotoSansSinhalaUI-VF.ttf
- NotoSansSinhalaUI-VF.ttf
+
+ NotoSansSinhalaUI-VF.ttf
- NotoSansKhmer-VF.ttf
+
+ NotoSansKhmer-VF.ttf
- NotoSansKhmer-VF.ttf
+
+ NotoSansKhmer-VF.ttf
- NotoSansKhmer-VF.ttf
+
+ NotoSansKhmer-VF.ttf
- NotoSansKhmer-VF.ttf
+
+ NotoSansKhmer-VF.ttf
- NotoSansKhmer-VF.ttf
+
+ NotoSansKhmer-VF.ttf
- NotoSansKhmer-VF.ttf
+
+ NotoSansKhmer-VF.ttf
- NotoSansKhmer-VF.ttf
+
+ NotoSansKhmer-VF.ttf
- NotoSansKhmer-VF.ttf
+
+ NotoSansKhmer-VF.ttf
- NotoSansKhmer-VF.ttf
+
+ NotoSansKhmer-VF.ttf
@@ -769,17 +921,23 @@
NotoSerifKhmer-Bold.otf
- NotoSansKhmerUI-Regular.ttf
+
+ NotoSansKhmerUI-Regular.ttf
+
NotoSansKhmerUI-Bold.ttf
- NotoSansLao-Regular.ttf
+ NotoSansLao-Regular.ttf
+
NotoSansLao-Bold.ttf
- NotoSerifLao-Regular.ttf
+
+ NotoSerifLao-Regular.ttf
+
NotoSerifLao-Bold.ttf
- NotoSansLaoUI-Regular.ttf
+ NotoSansLaoUI-Regular.ttf
+
NotoSansLaoUI-Bold.ttf
@@ -795,56 +953,78 @@
NotoSansMyanmarUI-Bold.otf
- NotoSansThaana-Regular.ttf
+
+ NotoSansThaana-Regular.ttf
+
NotoSansThaana-Bold.ttf
- NotoSansCham-Regular.ttf
+ NotoSansCham-Regular.ttf
+
NotoSansCham-Bold.ttf
NotoSansAhom-Regular.otf
- NotoSansAdlam-VF.ttf
+
+ NotoSansAdlam-VF.ttf
- NotoSansAdlam-VF.ttf
+
+ NotoSansAdlam-VF.ttf
- NotoSansAdlam-VF.ttf
+
+ NotoSansAdlam-VF.ttf
- NotoSansAdlam-VF.ttf
+
+ NotoSansAdlam-VF.ttf
- NotoSansAvestan-Regular.ttf
+
+ NotoSansAvestan-Regular.ttf
+
- NotoSansBalinese-Regular.ttf
+
+ NotoSansBalinese-Regular.ttf
+
- NotoSansBamum-Regular.ttf
+ NotoSansBamum-Regular.ttf
+
- NotoSansBatak-Regular.ttf
+ NotoSansBatak-Regular.ttf
+
- NotoSansBrahmi-Regular.ttf
+
+ NotoSansBrahmi-Regular.ttf
+
- NotoSansBuginese-Regular.ttf
+
+ NotoSansBuginese-Regular.ttf
+
- NotoSansBuhid-Regular.ttf
+ NotoSansBuhid-Regular.ttf
+
- NotoSansCanadianAboriginal-Regular.ttf
+
+ NotoSansCanadianAboriginal-Regular.ttf
+
- NotoSansCarian-Regular.ttf
+
+ NotoSansCarian-Regular.ttf
+
NotoSansChakma-Regular.otf
@@ -853,164 +1033,255 @@
NotoSansCherokee-Regular.ttf
- NotoSansCoptic-Regular.ttf
+
+ NotoSansCoptic-Regular.ttf
+
- NotoSansCuneiform-Regular.ttf
+
+ NotoSansCuneiform-Regular.ttf
+
- NotoSansCypriot-Regular.ttf
+
+ NotoSansCypriot-Regular.ttf
+
- NotoSansDeseret-Regular.ttf
+
+ NotoSansDeseret-Regular.ttf
+
- NotoSansEgyptianHieroglyphs-Regular.ttf
+
+ NotoSansEgyptianHieroglyphs-Regular.ttf
+
NotoSansElbasan-Regular.otf
- NotoSansGlagolitic-Regular.ttf
+
+ NotoSansGlagolitic-Regular.ttf
+
- NotoSansGothic-Regular.ttf
+
+ NotoSansGothic-Regular.ttf
+
- NotoSansHanunoo-Regular.ttf
+
+ NotoSansHanunoo-Regular.ttf
+
- NotoSansImperialAramaic-Regular.ttf
+
+ NotoSansImperialAramaic-Regular.ttf
+
- NotoSansInscriptionalPahlavi-Regular.ttf
+
+ NotoSansInscriptionalPahlavi-Regular.ttf
+
- NotoSansInscriptionalParthian-Regular.ttf
+
+ NotoSansInscriptionalParthian-Regular.ttf
+
NotoSansJavanese-Regular.otf
- NotoSansKaithi-Regular.ttf
+
+ NotoSansKaithi-Regular.ttf
+
- NotoSansKayahLi-Regular.ttf
+
+ NotoSansKayahLi-Regular.ttf
+
- NotoSansKharoshthi-Regular.ttf
+
+ NotoSansKharoshthi-Regular.ttf
+
- NotoSansLepcha-Regular.ttf
+
+ NotoSansLepcha-Regular.ttf
+
- NotoSansLimbu-Regular.ttf
+ NotoSansLimbu-Regular.ttf
+
- NotoSansLinearB-Regular.ttf
+
+ NotoSansLinearB-Regular.ttf
+
- NotoSansLisu-Regular.ttf
+ NotoSansLisu-Regular.ttf
+
- NotoSansLycian-Regular.ttf
+
+ NotoSansLycian-Regular.ttf
+
- NotoSansLydian-Regular.ttf
+
+ NotoSansLydian-Regular.ttf
+
- NotoSansMandaic-Regular.ttf
+
+ NotoSansMandaic-Regular.ttf
+
- NotoSansMeeteiMayek-Regular.ttf
+
+ NotoSansMeeteiMayek-Regular.ttf
+
- NotoSansNewTaiLue-Regular.ttf
+
+ NotoSansNewTaiLue-Regular.ttf
+
- NotoSansNKo-Regular.ttf
+ NotoSansNKo-Regular.ttf
+
- NotoSansOgham-Regular.ttf
+ NotoSansOgham-Regular.ttf
+
- NotoSansOlChiki-Regular.ttf
+
+ NotoSansOlChiki-Regular.ttf
+
- NotoSansOldItalic-Regular.ttf
+
+ NotoSansOldItalic-Regular.ttf
+
- NotoSansOldPersian-Regular.ttf
+
+ NotoSansOldPersian-Regular.ttf
+
- NotoSansOldSouthArabian-Regular.ttf
+
+ NotoSansOldSouthArabian-Regular.ttf
+
- NotoSansOldTurkic-Regular.ttf
+
+ NotoSansOldTurkic-Regular.ttf
+
NotoSansOsage-Regular.ttf
- NotoSansOsmanya-Regular.ttf
+
+ NotoSansOsmanya-Regular.ttf
+
- NotoSansPhoenician-Regular.ttf
+
+ NotoSansPhoenician-Regular.ttf
+
- NotoSansRejang-Regular.ttf
+
+ NotoSansRejang-Regular.ttf
+
- NotoSansRunic-Regular.ttf
+ NotoSansRunic-Regular.ttf
+
- NotoSansSamaritan-Regular.ttf
+
+ NotoSansSamaritan-Regular.ttf
+
- NotoSansSaurashtra-Regular.ttf
+
+ NotoSansSaurashtra-Regular.ttf
+
- NotoSansShavian-Regular.ttf
+
+ NotoSansShavian-Regular.ttf
+
- NotoSansSundanese-Regular.ttf
+
+ NotoSansSundanese-Regular.ttf
+
- NotoSansSylotiNagri-Regular.ttf
+
+ NotoSansSylotiNagri-Regular.ttf
+
- NotoSansSyriacEstrangela-Regular.ttf
+
+ NotoSansSyriacEstrangela-Regular.ttf
+
- NotoSansSyriacEastern-Regular.ttf
+
+ NotoSansSyriacEastern-Regular.ttf
+
- NotoSansSyriacWestern-Regular.ttf
+
+ NotoSansSyriacWestern-Regular.ttf
+
- NotoSansTagalog-Regular.ttf
+
+ NotoSansTagalog-Regular.ttf
+
- NotoSansTagbanwa-Regular.ttf
+
+ NotoSansTagbanwa-Regular.ttf
+
- NotoSansTaiTham-Regular.ttf
+
+ NotoSansTaiTham-Regular.ttf
+
- NotoSansTaiViet-Regular.ttf
+
+ NotoSansTaiViet-Regular.ttf
+
- NotoSerifTibetan-VF.ttf
+
+ NotoSerifTibetan-VF.ttf
- NotoSerifTibetan-VF.ttf
+
+ NotoSerifTibetan-VF.ttf
- NotoSerifTibetan-VF.ttf
+
+ NotoSerifTibetan-VF.ttf
- NotoSerifTibetan-VF.ttf
+
+ NotoSerifTibetan-VF.ttf
@@ -1018,29 +1289,48 @@
NotoSansTifinagh-Regular.otf
- NotoSansUgaritic-Regular.ttf
+
+ NotoSansUgaritic-Regular.ttf
+
- NotoSansVai-Regular.ttf
+ NotoSansVai-Regular.ttf
+
NotoSansSymbols-Regular-Subsetted.ttf
- NotoSansCJK-Regular.ttc
- NotoSerifCJK-Regular.ttc
+
+ NotoSansCJK-Regular.ttc
+
+ NotoSerifCJK-Regular.ttc
+
- NotoSansCJK-Regular.ttc
- NotoSerifCJK-Regular.ttc
+
+ NotoSansCJK-Regular.ttc
+
+ NotoSerifCJK-Regular.ttc
+
- NotoSansCJK-Regular.ttc
- NotoSerifCJK-Regular.ttc
+
+ NotoSansCJK-Regular.ttc
+
+ NotoSerifCJK-Regular.ttc
+
- NotoSansCJK-Regular.ttc
- NotoSerifCJK-Regular.ttc
+
+ NotoSansCJK-Regular.ttc
+
+ NotoSerifCJK-Regular.ttc
+
NotoColorEmoji.ttf
@@ -1053,16 +1343,21 @@
override the East Asian punctuation for Chinese.
-->
- NotoSansTaiLe-Regular.ttf
+ NotoSansTaiLe-Regular.ttf
+
- NotoSansYi-Regular.ttf
+ NotoSansYi-Regular.ttf
- NotoSansMongolian-Regular.ttf
+
+ NotoSansMongolian-Regular.ttf
+
- NotoSansPhagsPa-Regular.ttf
+
+ NotoSansPhagsPa-Regular.ttf
+
NotoSansAnatolianHieroglyphs-Regular.otf
@@ -1152,72 +1447,92 @@
NotoSerifDogra-Regular.ttf
- NotoSansMedefaidrin-VF.ttf
+
+ NotoSansMedefaidrin-VF.ttf
- NotoSansMedefaidrin-VF.ttf
+
+ NotoSansMedefaidrin-VF.ttf
- NotoSansMedefaidrin-VF.ttf
+
+ NotoSansMedefaidrin-VF.ttf
- NotoSansMedefaidrin-VF.ttf
+
+ NotoSansMedefaidrin-VF.ttf
- NotoSansSoyombo-VF.ttf
+
+ NotoSansSoyombo-VF.ttf
- NotoSansSoyombo-VF.ttf
+
+ NotoSansSoyombo-VF.ttf
- NotoSansSoyombo-VF.ttf
+
+ NotoSansSoyombo-VF.ttf
- NotoSansSoyombo-VF.ttf
+
+ NotoSansSoyombo-VF.ttf
- NotoSansTakri-VF.ttf
+
+ NotoSansTakri-VF.ttf
- NotoSansTakri-VF.ttf
+
+ NotoSansTakri-VF.ttf
- NotoSansTakri-VF.ttf
+
+ NotoSansTakri-VF.ttf
- NotoSansTakri-VF.ttf
+
+ NotoSansTakri-VF.ttf
- NotoSerifNyiakengPuachueHmong-VF.ttf
+
+ NotoSerifNyiakengPuachueHmong-VF.ttf
- NotoSerifNyiakengPuachueHmong-VF.ttf
+
+ NotoSerifNyiakengPuachueHmong-VF.ttf
- NotoSerifNyiakengPuachueHmong-VF.ttf
+
+ NotoSerifNyiakengPuachueHmong-VF.ttf
- NotoSerifNyiakengPuachueHmong-VF.ttf
+
+ NotoSerifNyiakengPuachueHmong-VF.ttf
- NotoSerifYezidi-VF.ttf
+
+ NotoSerifYezidi-VF.ttf
- NotoSerifYezidi-VF.ttf
+
+ NotoSerifYezidi-VF.ttf
- NotoSerifYezidi-VF.ttf
+
+ NotoSerifYezidi-VF.ttf
- NotoSerifYezidi-VF.ttf
+
+ NotoSerifYezidi-VF.ttf
diff --git a/graphics/java/android/graphics/FontListParser.java b/graphics/java/android/graphics/FontListParser.java
index 6fdf5526edf57..13e2692ff8003 100644
--- a/graphics/java/android/graphics/FontListParser.java
+++ b/graphics/java/android/graphics/FontListParser.java
@@ -56,6 +56,7 @@ public class FontListParser {
// XML constants for Font.
public static final String ATTR_INDEX = "index";
public static final String ATTR_WEIGHT = "weight";
+ public static final String ATTR_POSTSCRIPT_NAME = "postScriptName";
public static final String ATTR_STYLE = "style";
public static final String ATTR_FALLBACK_FOR = "fallbackFor";
public static final String STYLE_ITALIC = "italic";
@@ -209,6 +210,7 @@ public class FontListParser {
int weight = weightStr == null ? FontStyle.FONT_WEIGHT_NORMAL : Integer.parseInt(weightStr);
boolean isItalic = STYLE_ITALIC.equals(parser.getAttributeValue(null, ATTR_STYLE));
String fallbackFor = parser.getAttributeValue(null, ATTR_FALLBACK_FOR);
+ String postScriptName = parser.getAttributeValue(null, ATTR_POSTSCRIPT_NAME);
StringBuilder filename = new StringBuilder();
while (keepReading(parser)) {
if (parser.getEventType() == XmlPullParser.TEXT) {
@@ -242,8 +244,18 @@ public class FontListParser {
axes.toArray(new FontVariationAxis[0]));
}
- return new FontConfig.Font(new File(filePath),
+ File file = new File(filePath);
+
+ if (postScriptName == null) {
+ // If post script name was not provided, assume the file name is same to PostScript
+ // name.
+ String name = file.getName();
+ postScriptName = name.substring(0, name.length() - 4);
+ }
+
+ return new FontConfig.Font(file,
originalPath == null ? null : new File(originalPath),
+ postScriptName,
new FontStyle(
weight,
isItalic ? FontStyle.FONT_SLANT_ITALIC : FontStyle.FONT_SLANT_UPRIGHT
diff --git a/services/core/java/com/android/server/graphics/fonts/UpdatableFontDir.java b/services/core/java/com/android/server/graphics/fonts/UpdatableFontDir.java
index fb14fbd49fdea..c0ab09319a060 100644
--- a/services/core/java/com/android/server/graphics/fonts/UpdatableFontDir.java
+++ b/services/core/java/com/android/server/graphics/fonts/UpdatableFontDir.java
@@ -502,8 +502,8 @@ final class UpdatableFontDir {
Slog.e(TAG, "Failed to lookup font file that has " + font.getPostScriptName());
return null;
}
- resolvedFonts.add(new FontConfig.Font(info.mFile, null, font.getFontStyle(),
- font.getIndex(), font.getFontVariationSettings(), null));
+ resolvedFonts.add(new FontConfig.Font(info.mFile, null, info.getPostScriptName(),
+ font.getFontStyle(), font.getIndex(), font.getFontVariationSettings(), null));
}
return new FontConfig.FontFamily(resolvedFonts, fontFamily.getName(),
null, FontConfig.FontFamily.VARIANT_DEFAULT);
diff --git a/tools/fonts/fontchain_linter.py b/tools/fonts/fontchain_linter.py
index f0b759547a937..1d308df00ef75 100755
--- a/tools/fonts/fontchain_linter.py
+++ b/tools/fonts/fontchain_linter.py
@@ -4,6 +4,7 @@ import collections
import copy
import glob
from os import path
+import re
import sys
from xml.etree import ElementTree
@@ -199,8 +200,9 @@ def check_hyphens(hyphens_dir):
class FontRecord(object):
- def __init__(self, name, scripts, variant, weight, style, fallback_for, font):
+ def __init__(self, name, psName, scripts, variant, weight, style, fallback_for, font):
self.name = name
+ self.psName = psName
self.scripts = scripts
self.variant = variant
self.weight = weight
@@ -236,6 +238,7 @@ def parse_fonts_xml(fonts_xml_path):
assert variant in {None, 'elegant', 'compact'}, (
'Unexpected value for variant: %s' % variant)
+ trim_re = re.compile(r"^[ \n\r\t]*(.+)[ \n\r\t]*$")
for family in families:
name = family.get('name')
variant = family.get('variant')
@@ -251,6 +254,10 @@ def parse_fonts_xml(fonts_xml_path):
assert child.tag == 'font', (
'Unknown tag <%s>' % child.tag)
font_file = child.text.rstrip()
+
+ m = trim_re.match(font_file)
+ font_file = m.group(1)
+
weight = int(child.get('weight'))
assert weight % 100 == 0, (
'Font weight "%d" is not a multiple of 100.' % weight)
@@ -270,11 +277,12 @@ def parse_fonts_xml(fonts_xml_path):
if index:
index = int(index)
- if not path.exists(path.join(_fonts_dir, font_file)):
+ if not path.exists(path.join(_fonts_dir, m.group(1))):
continue # Missing font is a valid case. Just ignore the missing font files.
record = FontRecord(
name,
+ child.get('postScriptName'),
frozenset(scripts),
variant,
weight,
@@ -664,6 +672,37 @@ def check_cjk_punctuation():
break
assert_font_supports_none_of_chars(record.font, cjk_punctuation, name)
+def getPostScriptName(font):
+ font_file, index = font
+ font_path = path.join(_fonts_dir, font_file)
+ if index is not None:
+ # Use the first font file in the collection for resolving post script name.
+ ttf = ttLib.TTFont(font_path, fontNumber=0)
+ else:
+ ttf = ttLib.TTFont(font_path)
+
+ nameTable = ttf['name']
+ for name in nameTable.names:
+ if (name.nameID == 6 and name.platformID == 3 and name.platEncID == 1
+ and name.langID == 0x0409):
+ return str(name)
+
+def check_canonical_name():
+ for record in _all_fonts:
+ file_name, index = record.font
+
+ psName = getPostScriptName(record.font)
+ if record.psName:
+ # If fonts element has postScriptName attribute, it should match with the PostScript
+ # name in the name table.
+ assert psName == record.psName, ('postScriptName attribute %s should match with %s' % (
+ record.psName, psName))
+ else:
+ # If fonts element doesn't have postScriptName attribute, the file name should match
+ # with the PostScript name in the name table.
+ assert psName == file_name[:-4], ('file name %s should match with %s' % (
+ file_name, psName))
+
def main():
global _fonts_dir
@@ -682,6 +721,8 @@ def main():
check_cjk_punctuation()
+ check_canonical_name()
+
check_emoji = sys.argv[2]
if check_emoji == 'true':
ucd_path = sys.argv[3]