Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 9069f179 authored by Mihai Popa's avatar Mihai Popa Committed by Android (Google) Code Review
Browse files

Merge "Enable the public TTC index attribute for fonts"

parents 3a88464c e34ad187
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -1442,6 +1442,7 @@ package android {
    field public static final int trimPathEnd = 16843785; // 0x1010409
    field public static final int trimPathOffset = 16843786; // 0x101040a
    field public static final int trimPathStart = 16843784; // 0x1010408
    field public static final int ttcIndex = 16844143; // 0x101056f
    field public static final int tunerCount = 16844061; // 0x101051d
    field public static final int turnScreenOn = 16844138; // 0x101056a
    field public static final int type = 16843169; // 0x10101a1
+1 −0
Original line number Diff line number Diff line
@@ -1580,6 +1580,7 @@ package android {
    field public static final int trimPathEnd = 16843785; // 0x1010409
    field public static final int trimPathOffset = 16843786; // 0x101040a
    field public static final int trimPathStart = 16843784; // 0x1010408
    field public static final int ttcIndex = 16844143; // 0x101056f
    field public static final int tunerCount = 16844061; // 0x101051d
    field public static final int turnScreenOn = 16844138; // 0x101056a
    field public static final int type = 16843169; // 0x10101a1
+1 −0
Original line number Diff line number Diff line
@@ -1442,6 +1442,7 @@ package android {
    field public static final int trimPathEnd = 16843785; // 0x1010409
    field public static final int trimPathOffset = 16843786; // 0x101040a
    field public static final int trimPathStart = 16843784; // 0x1010408
    field public static final int ttcIndex = 16844143; // 0x101056f
    field public static final int tunerCount = 16844061; // 0x101051d
    field public static final int turnScreenOn = 16844138; // 0x101056a
    field public static final int type = 16843169; // 0x10101a1
+12 −3
Original line number Diff line number Diff line
@@ -15,7 +15,6 @@
 */
package android.content.res;

import com.android.internal.R;
import android.annotation.NonNull;
import android.annotation.Nullable;
import android.graphics.Typeface;
@@ -23,6 +22,8 @@ import android.util.AttributeSet;
import android.util.Log;
import android.util.Xml;

import com.android.internal.R;

import org.xmlpull.v1.XmlPullParser;
import org.xmlpull.v1.XmlPullParserException;

@@ -78,12 +79,15 @@ public class FontResourcesParser {
        private final @NonNull String mFileName;
        private int mWeight;
        private int mItalic;
        private int mTtcIndex;
        private int mResourceId;

        public FontFileResourceEntry(@NonNull String fileName, int weight, int italic) {
        public FontFileResourceEntry(@NonNull String fileName, int weight, int italic,
                int ttcIndex) {
            mFileName = fileName;
            mWeight = weight;
            mItalic = italic;
            mTtcIndex = ttcIndex;
        }

        public @NonNull String getFileName() {
@@ -97,6 +101,10 @@ public class FontResourcesParser {
        public int getItalic() {
            return mItalic;
        }

        public int getTtcIndex() {
            return mTtcIndex;
        }
    }

    // A class represents file based font-family element in xml file.
@@ -203,6 +211,7 @@ public class FontResourcesParser {
                Typeface.RESOLVE_BY_FONT_TABLE);
        int italic = array.getInt(R.styleable.FontFamilyFont_fontStyle,
                Typeface.RESOLVE_BY_FONT_TABLE);
        int ttcIndex = array.getInt(R.styleable.FontFamilyFont_ttcIndex, 0);
        String filename = array.getString(R.styleable.FontFamilyFont_font);
        array.recycle();
        while (parser.next() != XmlPullParser.END_TAG) {
@@ -211,7 +220,7 @@ public class FontResourcesParser {
        if (filename == null) {
            return null;
        }
        return new FontFileResourceEntry(filename, weight, italic);
        return new FontFileResourceEntry(filename, weight, italic, ttcIndex);
    }

    private static void skip(XmlPullParser parser) throws XmlPullParserException, IOException {
+3 −0
Original line number Diff line number Diff line
@@ -8670,6 +8670,9 @@
         common values are 400 for regular weight and 700 for bold weight. If unspecified, the value
         in the font's header tables will be used. -->
        <attr name="fontWeight" format="integer" />
        <!-- The index of the font in the tcc font file. If the font file referenced is not in the
         tcc format, this attribute needs not be specified. -->
        <attr name="ttcIndex" format="integer" />
    </declare-styleable>

    <!-- Attributes that are read when parsing a <fontfamily> tag. -->
Loading