Bookmaker to work on Linux.

This also updates one fiddle example which used SkTypeface::kBold, which
is now private.

Change-Id: I799b64bfaa377d02f0a045d2f077410d4f38413d
Reviewed-on: https://skia-review.googlesource.com/68902
Reviewed-by: Cary Clark <caryclark@google.com>
Commit-Queue: Ben Wagner <bungeman@google.com>
This commit is contained in:
Ben Wagner 2017-11-08 15:37:22 -05:00 committed by Skia Commit-Bot
parent f8e2502819
commit 700ff17125
3 changed files with 8 additions and 5 deletions

View File

@ -3247,7 +3247,7 @@ implementation.
#Height 100
void draw(SkCanvas* canvas) {
SkPaint paint;
paint.setTypeface(SkTypeface::MakeDefault(SkTypeface::kBold));
paint.setTypeface(SkTypeface::MakeFromName(nullptr, SkFontStyle()));
paint.setAntiAlias(true);
paint.setTextSize(36);
canvas->drawString("A Big Hello!", 10, 40, paint);

View File

@ -3250,7 +3250,7 @@ implementation.
### Example
<div><fiddle-embed name="c18b1696b8c1649bebf7eb1f8b89e0b0"></fiddle-embed></div>
<div><fiddle-embed name="1a7a5062725139760962582f599f1b97"></fiddle-embed></div>
<a name="SkPaint_getTypeface"></a>
## getTypeface

View File

@ -308,9 +308,12 @@ bool Definition::exampleToScript(string* result, ExampleOptions exampleOptions)
code += "}";
}
string example = "\"" + normalizedName + "\": {\n";
size_t nameStart = fFileName.find("\\", 0);
SkASSERT(string::npos != nameStart);
string baseFile = fFileName.substr(nameStart + 1, fFileName.length() - nameStart - 5);
string baseFile = [this]() {
string baseNameExt = fFileName.substr(fFileName.find_last_of("/\\") + 1);
size_t p = baseNameExt.find_last_of('.');
return (p > 0 && p != string::npos) ? baseNameExt.substr(0, p) : baseNameExt;
}();
if (ExampleOptions::kText == exampleOptions) {
example += " \"code\": \"" + code + "\",\n";
example += " \"hash\": \"" + fHash + "\",\n";