aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/utils/SkWhitelistTypefaces.cpp
diff options
context:
space:
mode:
authorGravatar mboc <mboc@opera.com>2016-05-31 11:42:36 -0700
committerGravatar Commit bot <commit-bot@chromium.org>2016-05-31 11:42:37 -0700
commitee6a9919a362e16c1d84a870ce867d1ad7b8a141 (patch)
tree971189523fe82821c82a936cafaefd59b76338f7 /src/utils/SkWhitelistTypefaces.cpp
parentbfa9275968d11d459b30a485cedcb55c7fecf9d7 (diff)
SkTypeface::MakeFromName to take SkFontStyle.
SkTypeface::MakeFromName currently takes SkTypeface::Style, which is quite limited. This starts the transition to this function taking SkFontStyle instead. GOLD_TRYBOT_URL= https://gold.skia.org/search2?unt=true&query=source_type%3Dgm&master=false&issue=1818043002 TBR=reed He said it sounded like a good idea. Review-Url: https://codereview.chromium.org/1818043002
Diffstat (limited to 'src/utils/SkWhitelistTypefaces.cpp')
-rw-r--r--src/utils/SkWhitelistTypefaces.cpp10
1 files changed, 5 insertions, 5 deletions
diff --git a/src/utils/SkWhitelistTypefaces.cpp b/src/utils/SkWhitelistTypefaces.cpp
index 3368178769..bc454bfe1d 100644
--- a/src/utils/SkWhitelistTypefaces.cpp
+++ b/src/utils/SkWhitelistTypefaces.cpp
@@ -28,7 +28,7 @@ static bool timesNewRomanSerializedNameOnly = false;
#define SUBNAME_PREFIX "sk_"
-static bool font_name_is_local(const char* fontName, SkTypeface::Style style) {
+static bool font_name_is_local(const char* fontName, SkFontStyle style) {
if (!strcmp(fontName, "DejaVu Sans")) {
return true;
}
@@ -162,7 +162,7 @@ void WhitelistSerializeTypeface(const SkTypeface* tf, SkWStream* wstream) {
return;
}
const char* fontName = whitelist[whitelistIndex].fFontName;
- if (!font_name_is_local(fontName, tf->style())) {
+ if (!font_name_is_local(fontName, tf->fontStyle())) {
#if WHITELIST_DEBUG
SkDebugf("name not found locally \"%s\" style=%d\n", fontName, tf->style());
#endif
@@ -200,13 +200,13 @@ sk_sp<SkTypeface> WhitelistDeserializeTypeface(SkStream* stream) {
if (!strncmp(SUBNAME_PREFIX, familyName, sizeof(SUBNAME_PREFIX) - 1)) {
familyName += sizeof(SUBNAME_PREFIX) - 1;
}
- return SkTypeface::MakeFromName(familyName, desc.getStyle());
+ return SkTypeface::MakeFromName(familyName, SkFontStyle::FromOldStyle(desc.getStyle()));
}
bool CheckChecksums() {
for (int i = 0; i < whitelistCount; ++i) {
const char* fontName = whitelist[i].fFontName;
- sk_sp<SkTypeface> tf(SkTypeface::MakeFromName(fontName, SkTypeface::kNormal));
+ sk_sp<SkTypeface> tf(SkTypeface::MakeFromName(fontName, SkFontStyle()));
uint32_t checksum = compute_checksum(tf.get());
if (whitelist[i].fChecksum != checksum) {
return false;
@@ -261,7 +261,7 @@ bool GenerateChecksums() {
sk_fwrite(line.c_str(), line.size(), file);
for (int i = 0; i < whitelistCount; ++i) {
const char* fontName = whitelist[i].fFontName;
- sk_sp<SkTypeface> tf(SkTypeface::MakeFromName(fontName, SkTypeface::kNormal));
+ sk_sp<SkTypeface> tf(SkTypeface::MakeFromName(fontName, SkFontStyle()));
uint32_t checksum = compute_checksum(tf.get());
line.printf(checksumEntry, fontName, checksum);
sk_fwrite(line.c_str(), line.size(), file);