aboutsummaryrefslogtreecommitdiffhomepage
path: root/experimental
diff options
context:
space:
mode:
authorGravatar Greg Humphreys <humper@google.com>2014-10-08 12:04:20 -0400
committerGravatar Greg Humphreys <humper@google.com>2014-10-08 12:04:20 -0400
commite97d82b6e58f417546c738edba40e7ede4f41ea3 (patch)
tree2553515beb818f825906f7f69ffc8fc0fa103174 /experimental
parentbcf0a52d4f4221b158e68a06ba0c4cc4db011060 (diff)
In the generated fiddle, set the portable fonts flag first.
BUG=skia: TBR=jcgregorio Review URL: https://codereview.chromium.org/635373002
Diffstat (limited to 'experimental')
-rwxr-xr-xexperimental/webtry/build1
-rw-r--r--experimental/webtry/webtry.go7
2 files changed, 5 insertions, 3 deletions
diff --git a/experimental/webtry/build b/experimental/webtry/build
index ace33b1e0b..0dc6b639fb 100755
--- a/experimental/webtry/build
+++ b/experimental/webtry/build
@@ -20,6 +20,7 @@ cd ${SKIA_ROOT}/include
echo "Creating compile template..."
find core effects pathops -maxdepth 1 -name "*.h" | sed "s/.*\///" | sed "s/\(.*\)/#include \"\1\"/" | sort > ${WEBTRY_ROOT}/templates/template.cpp
echo '#include "sk_tool_utils.h"' >> ${WEBTRY_ROOT}/templates/template.cpp
+echo '#include "SkCommandLineFlags.h"' >> ${WEBTRY_ROOT}/templates/template.cpp
echo '' >> ${WEBTRY_ROOT}/templates/template.cpp
echo "SkBitmap source;" >> ${WEBTRY_ROOT}/templates/template.cpp
echo "{{.Code}}" >> ${WEBTRY_ROOT}/templates/template.cpp
diff --git a/experimental/webtry/webtry.go b/experimental/webtry/webtry.go
index 36c7afe5db..947eca7aa0 100644
--- a/experimental/webtry/webtry.go
+++ b/experimental/webtry/webtry.go
@@ -372,11 +372,12 @@ func expandCode(code string, source int) (string, error) {
// TODO(humper): Make this more robust, supporting things like setTypeface
inputCodeLines := strings.Split(code, "\n")
- outputCodeLines := []string{}
+ outputCodeLines := []string{"DECLARE_bool(portableFonts);"}
for _, line := range inputCodeLines {
outputCodeLines = append(outputCodeLines, line)
- if strings.HasPrefix(strings.TrimSpace(line), "SkPaint ") {
- outputCodeLines = append(outputCodeLines, "sk_tool_utils::set_portable_typeface(&p);")
+ if strings.HasPrefix(strings.TrimSpace(line), "SkPaint p") {
+ outputCodeLines = append(outputCodeLines, "FLAGS_portableFonts = true;")
+ outputCodeLines = append(outputCodeLines, "sk_tool_utils::set_portable_typeface(&p, \"Helvetica\", SkTypeface::kNormal);")
}
}