Skip to content

Commit

Permalink
remove platform_font_manager()
Browse files Browse the repository at this point in the history
We don't need this name munging since the
native/non-native font bots split.

Change-Id: I0e64feb08441ece8e0e4be0a70b812220aa8385a
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/199300
Reviewed-by: Ben Wagner <bungeman@google.com>
Commit-Queue: Mike Klein <mtklein@google.com>
  • Loading branch information
Mike Klein authored and Skia Commit-Bot committed Mar 8, 2019
1 parent e588d35 commit bea1f94
Show file tree
Hide file tree
Showing 15 changed files with 16 additions and 84 deletions.
4 changes: 1 addition & 3 deletions gm/coloremoji.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -67,9 +67,7 @@ class ColorEmojiGM : public GM {
}

SkString onShortName() override {
SkString name("coloremoji");
name.append(sk_tool_utils::platform_font_manager());
return name;
return SkString("coloremoji");
}

SkISize onISize() override { return SkISize::Make(650, 1200); }
Expand Down
4 changes: 1 addition & 3 deletions gm/coloremoji_blendmodes.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -62,9 +62,7 @@ class ColorEmojiBlendModesGM : public GM {
}

virtual SkString onShortName() override {
SkString name("coloremoji_blendmodes");
name.append(sk_tool_utils::platform_font_manager());
return name;
return SkString("coloremoji_blendmodes");
}

virtual SkISize onISize() override {
Expand Down
4 changes: 1 addition & 3 deletions gm/dftext.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,7 @@ class DFTextGM : public skiagm::GM {
}

SkString onShortName() override {
SkString name("dftext");
name.append(sk_tool_utils::platform_font_manager());
return name;
return SkString("dftext");
}

SkISize onISize() override {
Expand Down
4 changes: 1 addition & 3 deletions gm/dftext_blob_persp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,7 @@ class DFTextBlobPerspGM : public skiagm::GM {

protected:
SkString onShortName() override {
SkString name("dftext_blob_persp");
name.append(sk_tool_utils::platform_font_manager());
return name;
return SkString("dftext_blob_persp");
}

SkISize onISize() override { return SkISize::Make(900, 350); }
Expand Down
6 changes: 1 addition & 5 deletions gm/fontmgr.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,6 @@ class FontMgrGM : public skiagm::GM {

fName.set("fontmgr_iter");
fFM = SkFontMgr::RefDefault();
fName.append(sk_tool_utils::platform_font_manager());
}

protected:
Expand Down Expand Up @@ -127,9 +126,7 @@ class FontMgrMatchGM : public skiagm::GM {

protected:
SkString onShortName() override {
SkString name("fontmgr_match");
name.append(sk_tool_utils::platform_font_manager());
return name;
return SkString("fontmgr_match");
}

SkISize onISize() override {
Expand Down Expand Up @@ -215,7 +212,6 @@ class FontMgrBoundsGM : public skiagm::GM {
if (scale != 1 || skew != 0) {
fName.appendf("_%g_%g", scale, skew);
}
fName.append(sk_tool_utils::platform_font_manager());
fFM = SkFontMgr::RefDefault();
}

Expand Down
4 changes: 1 addition & 3 deletions gm/fontscaler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,7 @@ class FontScalerGM : public GM {
protected:

SkString onShortName() override {
SkString name("fontscaler");
name.append(sk_tool_utils::platform_font_manager());
return name;
return SkString("fontscaler");
}

SkISize onISize() override {
Expand Down
4 changes: 1 addition & 3 deletions gm/gammatext.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,7 @@ static sk_sp<SkShader> make_heatGradient(const SkPoint pts[2]) {
class GammaTextGM : public skiagm::GM {
protected:
SkString onShortName() override {
SkString name("gammatext");
name.append(sk_tool_utils::platform_font_manager());
return name;
return SkString("gammatext");
}

SkISize onISize() override {
Expand Down
4 changes: 1 addition & 3 deletions gm/lcdtext.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,7 @@ class LcdTextGM : public skiagm::GM {
protected:

SkString onShortName() {
SkString name("lcdtext");
name.append(sk_tool_utils::platform_font_manager());
return name;
return SkString("lcdtext");
}

SkISize onISize() { return SkISize::Make(640, 480); }
Expand Down
3 changes: 1 addition & 2 deletions gm/mixedtextblobs.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -96,8 +96,7 @@ class MixedTextBlobsGM : public GM {
}

SkString onShortName() override {
return SkStringPrintf("mixedtextblobs%s",
sk_tool_utils::platform_font_manager());
return SkString("mixedtextblobs");
}

SkISize onISize() override {
Expand Down
8 changes: 2 additions & 6 deletions gm/scaledemoji.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -45,9 +45,7 @@ class ScaledEmojiGM : public GM {
}

SkString onShortName() override {
SkString name("scaledemoji");
name.append(sk_tool_utils::platform_font_manager());
return name;
return SkString("scaledemoji");
}

SkISize onISize() override { return SkISize::Make(1200, 1200); }
Expand Down Expand Up @@ -97,9 +95,7 @@ class ScaledEmojiPosGM : public GM {
}

SkString onShortName() override {
SkString name("scaledemojipos");
name.append(sk_tool_utils::platform_font_manager());
return name;
return SkString("scaledemojipos");
}

SkISize onISize() override { return SkISize::Make(1200, 1200); }
Expand Down
4 changes: 1 addition & 3 deletions gm/scaledemoji_rendering.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,7 @@ class ScaledEmojiRenderingGM : public GM {
}

SkString onShortName() override {
SkString name("scaledemoji_rendering");
name.append(sk_tool_utils::platform_font_manager());
return name;
return SkString("scaledemoji_rendering");
}

SkISize onISize() override { return SkISize::Make(1200, 1200); }
Expand Down
3 changes: 1 addition & 2 deletions gm/textblobmixedsizes.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -80,8 +80,7 @@ class TextBlobMixedSizes : public GM {
}

SkString onShortName() override {
return SkStringPrintf("textblobmixedsizes%s%s",
sk_tool_utils::platform_font_manager(),
return SkStringPrintf("textblobmixedsizes%s",
fUseDFT ? "_df" : "");
}

Expand Down
13 changes: 3 additions & 10 deletions gm/typeface.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,6 @@ class TypefaceStylesGM : public skiagm::GM {
if (fApplyKerning) {
name.append("_kerning");
}
name.append(sk_tool_utils::platform_font_manager());
return name;
}

Expand Down Expand Up @@ -350,9 +349,7 @@ static void draw_typeface_rendering_gm(SkCanvas* canvas, sk_sp<SkTypeface> face,
}
}

DEF_SIMPLE_GM_BG_NAME(typefacerendering, canvas, 640, 840, SK_ColorWHITE,
SkStringPrintf("typefacerendering%s",
sk_tool_utils::platform_font_manager())) {
DEF_SIMPLE_GM(typefacerendering, canvas, 640, 840) {
if (sk_sp<SkTypeface> face = MakeResourceAsTypeface("fonts/hintgasp.ttf")) {
draw_typeface_rendering_gm(canvas, std::move(face));
}
Expand All @@ -361,18 +358,14 @@ DEF_SIMPLE_GM_BG_NAME(typefacerendering, canvas, 640, 840, SK_ColorWHITE,
// Type1 fonts don't currently work in Skia on Windows.
#ifndef SK_BUILD_FOR_WIN

DEF_SIMPLE_GM_BG_NAME(typefacerendering_pfa, canvas, 640, 840, SK_ColorWHITE,
SkStringPrintf("typefacerendering_pfa%s",
sk_tool_utils::platform_font_manager())) {
DEF_SIMPLE_GM(typefacerendering_pfa, canvas, 640, 840) {
if (sk_sp<SkTypeface> face = MakeResourceAsTypeface("fonts/Roboto2-Regular.pfa")) {
// This subsetted typeface doesn't have the character 'A'.
draw_typeface_rendering_gm(canvas, std::move(face), 'O');
}
}

DEF_SIMPLE_GM_BG_NAME(typefacerendering_pfb, canvas, 640, 840, SK_ColorWHITE,
SkStringPrintf("typefacerendering_pfb%s",
sk_tool_utils::platform_font_manager())) {
DEF_SIMPLE_GM(typefacerendering_pfb, canvas, 640, 840) {
if (sk_sp<SkTypeface> face = MakeResourceAsTypeface("fonts/Roboto2-Regular.pfb")) {
draw_typeface_rendering_gm(canvas, std::move(face), 'O');
}
Expand Down
30 changes: 0 additions & 30 deletions tools/fonts/sk_tool_utils_font.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -38,36 +38,6 @@ sk_sp<SkTypeface> emoji_typeface() {
const char* emoji_sample_text() {
return "\xF0\x9F\x98\x80" " " "\xE2\x99\xA2"; // 😀 ♢
}

static const char* platform_os_name() {
for (int index = 0; index < FLAGS_key.count(); index += 2) {
if (!strcmp("os", FLAGS_key[index])) {
return FLAGS_key[index + 1];
}
}
return "";
}

static bool extra_config_contains(const char* substring) {
for (int index = 0; index < FLAGS_key.count(); index += 2) {
if (0 == strcmp("extra_config", FLAGS_key[index])
&& strstr(FLAGS_key[index + 1], substring)) {
return true;
}
}
return false;
}

const char* platform_font_manager() {
if (extra_config_contains("GDI")) {
return "GDI";
}
if (extra_config_contains("NativeFonts")){
return platform_os_name();
}
return "";
}

static sk_sp<SkTypeface> create_font(const char* name, SkFontStyle style) {
static sk_sp<SkFontMgr> portableFontMgr = MakePortableFontMgr();
return portableFontMgr->legacyMakeTypeface(name, style);
Expand Down
5 changes: 0 additions & 5 deletions tools/sk_tool_utils.h
Original file line number Diff line number Diff line change
Expand Up @@ -59,11 +59,6 @@ namespace sk_tool_utils {
*/
const char* emoji_sample_text();

/**
* Returns a string describing the platform font manager, if we're using one, otherwise "".
*/
const char* platform_font_manager();

/**
* Returns a platform-independent text renderer.
*/
Expand Down

0 comments on commit bea1f94

Please sign in to comment.