aboutsummaryrefslogtreecommitdiffhomepage
path: root/samplecode
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 /samplecode
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 'samplecode')
-rw-r--r--samplecode/ClockFaceView.cpp3
-rw-r--r--samplecode/SampleAll.cpp3
-rw-r--r--samplecode/SampleFilterFuzz.cpp4
-rw-r--r--samplecode/SampleFontScalerTest.cpp5
-rw-r--r--samplecode/SampleSlides.cpp3
-rw-r--r--samplecode/SampleXfermodesBlur.cpp4
6 files changed, 13 insertions, 9 deletions
diff --git a/samplecode/ClockFaceView.cpp b/samplecode/ClockFaceView.cpp
index 7c6158ada3..ef0fec7577 100644
--- a/samplecode/ClockFaceView.cpp
+++ b/samplecode/ClockFaceView.cpp
@@ -221,7 +221,8 @@ protected:
paint.setAntiAlias(true);
paint.setTextSize(SkIntToScalar(240));
- paint.setTypeface(SkTypeface::MakeFromName("sans-serif", SkTypeface::kBold));
+ paint.setTypeface(SkTypeface::MakeFromName("sans-serif",
+ SkFontStyle::FromOldStyle(SkTypeface::kBold)));
SkString str("9");
diff --git a/samplecode/SampleAll.cpp b/samplecode/SampleAll.cpp
index 738b34e3ae..29b5c66c74 100644
--- a/samplecode/SampleAll.cpp
+++ b/samplecode/SampleAll.cpp
@@ -527,7 +527,8 @@ protected:
paint.setAntiAlias(true);
paint.setTextSize(SkIntToScalar(48));
- paint.setTypeface(SkTypeface::MakeFromName("sans-serif", SkTypeface::kBold));
+ paint.setTypeface(SkTypeface::MakeFromName("sans-serif",
+ SkFontStyle::FromOldStyle(SkTypeface::kBold)));
SkString str("GOOGLE");
diff --git a/samplecode/SampleFilterFuzz.cpp b/samplecode/SampleFilterFuzz.cpp
index 88372414ca..78bc67386f 100644
--- a/samplecode/SampleFilterFuzz.cpp
+++ b/samplecode/SampleFilterFuzz.cpp
@@ -198,8 +198,8 @@ static SkFilterQuality make_filter_quality() {
return static_cast<SkFilterQuality>(R(kHigh_SkFilterQuality+1));
}
-static SkTypeface::Style make_typeface_style() {
- return static_cast<SkTypeface::Style>(R(SkTypeface::kBoldItalic+1));
+static SkFontStyle make_typeface_style() {
+ return SkFontStyle::FromOldStyle(SkTypeface::kBoldItalic+1);
}
static SkPath1DPathEffect::Style make_path_1d_path_effect_style() {
diff --git a/samplecode/SampleFontScalerTest.cpp b/samplecode/SampleFontScalerTest.cpp
index 72371ed807..bd9309790e 100644
--- a/samplecode/SampleFontScalerTest.cpp
+++ b/samplecode/SampleFontScalerTest.cpp
@@ -41,7 +41,8 @@ class FontScalerTestView : public SampleView {
public:
FontScalerTestView() {
for (int i = 0; i < gFaceCount; i++) {
- fFaces[i] = SkTypeface::MakeFromName(gFaces[i].fName, gFaces[i].fStyle);
+ fFaces[i] = SkTypeface::MakeFromName(
+ gFaces[i].fName, SkFontStyle::FromOldStyle(gFaces[i].fStyle));
}
// this->setBGColor(0xFFDDDDDD);
}
@@ -85,7 +86,7 @@ protected:
// paint.setSubpixelText(true);
paint.setAntiAlias(true);
paint.setLCDRenderText(true);
- paint.setTypeface(SkTypeface::MakeFromName("Times Roman", SkTypeface::kNormal));
+ paint.setTypeface(SkTypeface::MakeFromName("Times Roman", SkFontStyle()));
// const char* text = "abcdefghijklmnopqrstuvwxyz";
const char* text = "Hamburgefons ooo mmm";
diff --git a/samplecode/SampleSlides.cpp b/samplecode/SampleSlides.cpp
index edc2dd77a2..5858d2674e 100644
--- a/samplecode/SampleSlides.cpp
+++ b/samplecode/SampleSlides.cpp
@@ -625,7 +625,8 @@ static void texteffect_slide(SkCanvas* canvas) {
SkScalar x = 20;
SkScalar y = 80;
SkPaint paint;
- paint.setTypeface(SkTypeface::MakeFromName("Georgia", SkTypeface::kItalic));
+ paint.setTypeface(SkTypeface::MakeFromName("Georgia",
+ SkFontStyle::FromOldStyle(SkTypeface::kItalic)));
paint.setTextSize(75);
paint.setAntiAlias(true);
paint.setColor(SK_ColorBLUE);
diff --git a/samplecode/SampleXfermodesBlur.cpp b/samplecode/SampleXfermodesBlur.cpp
index 8a69f000f8..ef25114cf0 100644
--- a/samplecode/SampleXfermodesBlur.cpp
+++ b/samplecode/SampleXfermodesBlur.cpp
@@ -28,7 +28,7 @@
#include "SkBlurMaskFilter.h"
static void setNamedTypeface(SkPaint* paint, const char name[]) {
- paint->setTypeface(SkTypeface::MakeFromName(name, SkTypeface::kNormal));
+ paint->setTypeface(SkTypeface::MakeFromName(name, SkFontStyle()));
}
static uint16_t gBG[] = { 0xFFFF, 0xCCCF, 0xCCCF, 0xFFFF };
@@ -90,7 +90,7 @@ protected:
SkPaint paint;
paint.setAntiAlias(true);
paint.setTextSize(50);
- paint.setTypeface(SkTypeface::MakeFromName("Arial Unicode MS", SkTypeface::kNormal));
+ paint.setTypeface(SkTypeface::MakeFromName("Arial Unicode MS", SkFontStyle()));
char buffer[10];
size_t len = SkUTF8_FromUnichar(0x8500, buffer);
canvas->drawText(buffer, len, 40, 40, paint);