aboutsummaryrefslogtreecommitdiffhomepage
path: root/src
diff options
context:
space:
mode:
authorGravatar jcgregorio <jcgregorio@google.com>2015-04-17 13:30:35 -0700
committerGravatar Commit bot <commit-bot@chromium.org>2015-04-17 13:30:35 -0700
commit21d3ed52e5eecc41f0ed05acdd3c5ff1189fed75 (patch)
treece73e016c48cbdc1cae10fdce94cbf8d28ca3e71 /src
parenta8448bc3dfe0f2e768838b4416fb3ebf823b694e (diff)
Revert of Respect declared font style on Android. (patchset #6 id:100001 of https://codereview.chromium.org/1092093002/)
Reason for revert: Failed on the compile bots. Original issue's description: > Respect declared font style on Android. > > Previously the normal/italic style bit was obtained from scanning the > font file. With the new format the style may be stated explicitly, and > this explicit value in the configuration file should override any > information obtained from the font data itself. > > This change allows the font element's style attribute to override the > font's style, but retains the default 'auto' setting for backwards > compatibility. Repecting the style bit may become more important with > variation fonts, because it will be up to the configuration writer to > determine what values of the 'slnt' variation should be considered > 'normal' or 'italic'. > > DOCS_PREVIEW= https://skia.org/?cl=1092093002 > > Committed: https://skia.googlesource.com/skia/+/673e902c9b9982a167f54f1cc175d8d9cab8bcaf TBR=mtklein@google.com,tomhudson@google.com,scroggo@google.com,bungeman@google.com NOPRESUBMIT=true NOTREECHECKS=true NOTRY=true Review URL: https://codereview.chromium.org/1082173004
Diffstat (limited to 'src')
-rw-r--r--src/ports/SkFontConfigParser_android.cpp7
-rw-r--r--src/ports/SkFontConfigParser_android.h3
-rw-r--r--src/ports/SkFontMgr_android.cpp10
3 files changed, 3 insertions, 17 deletions
diff --git a/src/ports/SkFontConfigParser_android.cpp b/src/ports/SkFontConfigParser_android.cpp
index 9bab84556b..ffc60427f4 100644
--- a/src/ports/SkFontConfigParser_android.cpp
+++ b/src/ports/SkFontConfigParser_android.cpp
@@ -159,13 +159,6 @@ static void font_element_handler(FamilyData* self, FontFileInfo* file, const cha
if (!parse_non_negative_integer(value, &file->fWeight)) {
SkDebugf("---- Font weight %s (INVALID)", value);
}
- } else if (MEMEQ("style", name, nameLen)) {
- size_t valueLen = strlen(value);
- if (MEMEQ("normal", value, valueLen)) {
- file->fStyle = FontFileInfo::Style::kNormal;
- } else if (MEMEQ("italic", value, valueLen)) {
- file->fStyle = FontFileInfo::Style::kItalic;
- }
} else if (MEMEQ("index", name, nameLen)) {
if (!parse_non_negative_integer(value, &file->fIndex)) {
SkDebugf("---- Font index %s (INVALID)", value);
diff --git a/src/ports/SkFontConfigParser_android.h b/src/ports/SkFontConfigParser_android.h
index dd856bf733..6dbf383590 100644
--- a/src/ports/SkFontConfigParser_android.h
+++ b/src/ports/SkFontConfigParser_android.h
@@ -62,12 +62,11 @@ typedef uint32_t FontVariant;
// Must remain trivially movable (can be memmoved).
struct FontFileInfo {
- FontFileInfo() : fIndex(0), fWeight(0), fStyle(Style::kAuto) { }
+ FontFileInfo() : fIndex(0), fWeight(0) { }
SkString fFileName;
int fIndex;
int fWeight;
- enum class Style { kAuto, kNormal, kItalic } fStyle;
};
/**
diff --git a/src/ports/SkFontMgr_android.cpp b/src/ports/SkFontMgr_android.cpp
index d7db09bde2..61f990c738 100644
--- a/src/ports/SkFontMgr_android.cpp
+++ b/src/ports/SkFontMgr_android.cpp
@@ -143,15 +143,9 @@ public:
continue;
}
- int weight = fontFile.fWeight != 0 ? fontFile.fWeight : style.weight();
- SkFontStyle::Slant slant;
- switch (fontFile.fStyle) {
- case FontFileInfo::Style::kAuto: slant = style.slant(); break;
- case FontFileInfo::Style::kNormal: slant = SkFontStyle::kUpright_Slant; break;
- case FontFileInfo::Style::kItalic: slant = SkFontStyle::kItalic_Slant; break;
- default: SkASSERT(false); break;
+ if (fontFile.fWeight != 0) {
+ style = SkFontStyle(fontFile.fWeight, style.width(), style.slant());
}
- style = SkFontStyle(weight, style.width(), slant);
const SkLanguage& lang = family.fLanguage;
uint32_t variant = family.fVariant;