Add font type to AAPT2
Test: make libaapt2_tests AaptTestAppOne Change-Id: I8fbf01675a218cc3c0b59598b6b1ec173851e946
This commit is contained in:
@@ -577,8 +577,11 @@ package android {
|
||||
field public static final int focusable = 16842970; // 0x10100da
|
||||
field public static final int focusableInTouchMode = 16842971; // 0x10100db
|
||||
field public static final deprecated int focusedMonthDateColor = 16843587; // 0x1010343
|
||||
field public static final int font = 16844082; // 0x1010532
|
||||
field public static final int fontFamily = 16843692; // 0x10103ac
|
||||
field public static final int fontFeatureSettings = 16843959; // 0x10104b7
|
||||
field public static final int fontStyle = 16844081; // 0x1010531
|
||||
field public static final int fontWeight = 16844083; // 0x1010533
|
||||
field public static final int footerDividersEnabled = 16843311; // 0x101022f
|
||||
field public static final int forceHasOverlappingRendering = 16844065; // 0x1010521
|
||||
field public static final int foreground = 16843017; // 0x1010109
|
||||
|
||||
@@ -683,8 +683,11 @@ package android {
|
||||
field public static final int focusable = 16842970; // 0x10100da
|
||||
field public static final int focusableInTouchMode = 16842971; // 0x10100db
|
||||
field public static final deprecated int focusedMonthDateColor = 16843587; // 0x1010343
|
||||
field public static final int font = 16844082; // 0x1010532
|
||||
field public static final int fontFamily = 16843692; // 0x10103ac
|
||||
field public static final int fontFeatureSettings = 16843959; // 0x10104b7
|
||||
field public static final int fontStyle = 16844081; // 0x1010531
|
||||
field public static final int fontWeight = 16844083; // 0x1010533
|
||||
field public static final int footerDividersEnabled = 16843311; // 0x101022f
|
||||
field public static final int forceHasOverlappingRendering = 16844065; // 0x1010521
|
||||
field public static final int foreground = 16843017; // 0x1010109
|
||||
|
||||
@@ -577,8 +577,11 @@ package android {
|
||||
field public static final int focusable = 16842970; // 0x10100da
|
||||
field public static final int focusableInTouchMode = 16842971; // 0x10100db
|
||||
field public static final deprecated int focusedMonthDateColor = 16843587; // 0x1010343
|
||||
field public static final int font = 16844082; // 0x1010532
|
||||
field public static final int fontFamily = 16843692; // 0x10103ac
|
||||
field public static final int fontFeatureSettings = 16843959; // 0x10104b7
|
||||
field public static final int fontStyle = 16844081; // 0x1010531
|
||||
field public static final int fontWeight = 16844083; // 0x1010533
|
||||
field public static final int footerDividersEnabled = 16843311; // 0x101022f
|
||||
field public static final int forceHasOverlappingRendering = 16844065; // 0x1010521
|
||||
field public static final int foreground = 16843017; // 0x1010109
|
||||
|
||||
@@ -8335,4 +8335,15 @@ i
|
||||
<declare-styleable name="ShortcutCategories">
|
||||
<attr name="name" />
|
||||
</declare-styleable>
|
||||
|
||||
<!-- Attributes that are read when parsing a <font> tag, which is a child of
|
||||
<font-family>. -->
|
||||
<declare-styleable name="FontFamilyFont">
|
||||
<attr name="fontStyle">
|
||||
<enum name="normal" value="0" />
|
||||
<enum name="italic" value="1" />
|
||||
</attr>
|
||||
<attr name="font" format="reference" />
|
||||
<attr name="fontWeight" format="integer" />
|
||||
</declare-styleable>
|
||||
</resources>
|
||||
|
||||
@@ -2756,6 +2756,9 @@
|
||||
<eat-comment />
|
||||
|
||||
<public-group type="attr" first-id="0x01010531">
|
||||
<public name="fontStyle" />
|
||||
<public name="font" />
|
||||
<public name="fontWeight" />
|
||||
</public-group>
|
||||
|
||||
<public-group type="style" first-id="0x010302e0">
|
||||
|
||||
@@ -25,7 +25,7 @@ namespace aapt {
|
||||
static const char* sMajorVersion = "2";
|
||||
|
||||
// Update minor version whenever a feature or flag is added.
|
||||
static const char* sMinorVersion = "2";
|
||||
static const char* sMinorVersion = "3";
|
||||
|
||||
int PrintVersion() {
|
||||
std::cerr << "Android Asset Packaging Tool (aapt) " << sMajorVersion << "."
|
||||
|
||||
@@ -41,6 +41,8 @@ StringPiece ToString(ResourceType type) {
|
||||
return "dimen";
|
||||
case ResourceType::kDrawable:
|
||||
return "drawable";
|
||||
case ResourceType::kFont:
|
||||
return "font";
|
||||
case ResourceType::kFraction:
|
||||
return "fraction";
|
||||
case ResourceType::kId:
|
||||
@@ -83,6 +85,7 @@ static const std::map<StringPiece, ResourceType> sResourceTypeMap{
|
||||
{"color", ResourceType::kColor},
|
||||
{"dimen", ResourceType::kDimen},
|
||||
{"drawable", ResourceType::kDrawable},
|
||||
{"font", ResourceType::kFont},
|
||||
{"fraction", ResourceType::kFraction},
|
||||
{"id", ResourceType::kId},
|
||||
{"integer", ResourceType::kInteger},
|
||||
|
||||
@@ -46,6 +46,7 @@ enum class ResourceType {
|
||||
kColor,
|
||||
kDimen,
|
||||
kDrawable,
|
||||
kFont,
|
||||
kFraction,
|
||||
kId,
|
||||
kInteger,
|
||||
|
||||
@@ -57,6 +57,10 @@ TEST(ResourceTypeTest, ParseResourceTypes) {
|
||||
ASSERT_NE(type, nullptr);
|
||||
EXPECT_EQ(*type, ResourceType::kDrawable);
|
||||
|
||||
type = ParseResourceType("font");
|
||||
ASSERT_NE(type, nullptr);
|
||||
EXPECT_EQ(*type, ResourceType::kFont);
|
||||
|
||||
type = ParseResourceType("fraction");
|
||||
ASSERT_NE(type, nullptr);
|
||||
EXPECT_EQ(*type, ResourceType::kFraction);
|
||||
|
||||
5
tools/aapt2/integration-tests/AppOne/res/font/myfont.xml
Normal file
5
tools/aapt2/integration-tests/AppOne/res/font/myfont.xml
Normal file
@@ -0,0 +1,5 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<font-family xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<font android:fontStyle="normal" android:fontWeight="400" android:font="@font/myfont-normal" />
|
||||
<font android:fontStyle="italic" android:fontWeight="400" android:font="@font/myfont-italic" />
|
||||
</font-family>
|
||||
@@ -1,5 +1,9 @@
|
||||
# Android Asset Packaging Tool 2.0 (AAPT2) release notes
|
||||
|
||||
## Version 2.3
|
||||
### `aapt2`
|
||||
- Support new `font` resource type.
|
||||
|
||||
## Version 2.2
|
||||
### `aapt2 compile ...`
|
||||
- Added support for inline complex XML resources. See
|
||||
|
||||
Reference in New Issue
Block a user