Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(779)

Unified Diff: src/utils/SkWhitelistTypefaces.cpp

Issue 2030683002: Update typeface serialization style. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Rebase Created 4 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/ports/SkTypeface_win_dw.cpp ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/utils/SkWhitelistTypefaces.cpp
diff --git a/src/utils/SkWhitelistTypefaces.cpp b/src/utils/SkWhitelistTypefaces.cpp
index bc454bfe1d4544f40200de7202d7f92f3de9b83e..2912fe2501788f6567d38d8fa8786827e9b44a98 100644
--- a/src/utils/SkWhitelistTypefaces.cpp
+++ b/src/utils/SkWhitelistTypefaces.cpp
@@ -83,12 +83,13 @@ static uint32_t compute_checksum(const SkTypeface* tf) {
return SkChecksum::Murmur3(data.begin(), length);
}
-static void serialize_sub(const char* fontName, SkTypeface::Style style, SkWStream* wstream) {
- SkFontDescriptor desc(style);
+static void serialize_sub(const char* fontName, SkFontStyle style, SkWStream* wstream) {
+ SkFontDescriptor desc;
SkString subName(SUBNAME_PREFIX);
subName.append(fontName);
const char* familyName = subName.c_str();
desc.setFamilyName(familyName);
+ desc.setStyle(style);
desc.serialize(wstream);
#if WHITELIST_DEBUG
for (int i = 0; i < whitelistCount; ++i) {
@@ -105,14 +106,14 @@ static void serialize_sub(const char* fontName, SkTypeface::Style style, SkWStre
static bool is_local(const SkTypeface* tf) {
bool isLocal = false;
- SkFontDescriptor desc(tf->style());
+ SkFontDescriptor desc;
tf->getFontDescriptor(&desc, &isLocal);
return isLocal;
}
static void serialize_full(const SkTypeface* tf, SkWStream* wstream) {
bool isLocal = false;
- SkFontDescriptor desc(tf->style());
+ SkFontDescriptor desc;
tf->getFontDescriptor(&desc, &isLocal);
// Embed font data if it's a local font.
@@ -124,7 +125,7 @@ static void serialize_full(const SkTypeface* tf, SkWStream* wstream) {
static void serialize_name_only(const SkTypeface* tf, SkWStream* wstream) {
bool isLocal = false;
- SkFontDescriptor desc(tf->style());
+ SkFontDescriptor desc;
tf->getFontDescriptor(&desc, &isLocal);
SkASSERT(!isLocal);
#if WHITELIST_DEBUG
@@ -180,7 +181,7 @@ void WhitelistSerializeTypeface(const SkTypeface* tf, SkWStream* wstream) {
#endif
whitelist[whitelistIndex].fChecksum = checksum;
}
- serialize_sub(fontName, tf->style(), wstream);
+ serialize_sub(fontName, tf->fontStyle(), wstream);
}
sk_sp<SkTypeface> WhitelistDeserializeTypeface(SkStream* stream) {
@@ -200,7 +201,7 @@ sk_sp<SkTypeface> WhitelistDeserializeTypeface(SkStream* stream) {
if (!strncmp(SUBNAME_PREFIX, familyName, sizeof(SUBNAME_PREFIX) - 1)) {
familyName += sizeof(SUBNAME_PREFIX) - 1;
}
- return SkTypeface::MakeFromName(familyName, SkFontStyle::FromOldStyle(desc.getStyle()));
+ return SkTypeface::MakeFromName(familyName, desc.getStyle());
}
bool CheckChecksums() {
« no previous file with comments | « src/ports/SkTypeface_win_dw.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698