fix examples with vertical text
a few examples used vertical text for
illustrations; fix them. The vertical
text examples broke the bookmaker
housekeeper bot.
NOTRY=true
TBR=reed@google.com
Docs-Preview: https://skia.org/?cl=164901
Bug: skia:
Change-Id: I13e59025eda7777cdd47b9db9e26a882595e7534
Reviewed-on: https://skia-review.googlesource.com/c/164901
Commit-Queue: Cary Clark <caryclark@skia.org>
Auto-Submit: Cary Clark <caryclark@skia.org>
Reviewed-by: Cary Clark <caryclark@skia.org>
diff --git a/docs/SkImageInfo_Reference.bmh b/docs/SkImageInfo_Reference.bmh
index 460d9e6..76749b0 100644
--- a/docs/SkImageInfo_Reference.bmh
+++ b/docs/SkImageInfo_Reference.bmh
@@ -1473,9 +1473,8 @@
SkImageInfo imageInfo = source.info();
SkPaint paint;
paint.setTextAlign(SkPaint::kCenter_Align);
- paint.setVerticalText(true);
canvas->drawLine(imageInfo.width() + 10, 0, imageInfo.width() + 10, imageInfo.height(), paint);
- canvas->drawString("height", imageInfo.width() + 25, imageInfo.height() / 2, paint);
+ canvas->drawString("height", imageInfo.width() + 34, imageInfo.height() / 2, paint);
##
#SeeAlso width SkBitmap::height SkPixelRef::height SkImage::height SkSurface::height
diff --git a/docs/SkImage_Reference.bmh b/docs/SkImage_Reference.bmh
index 7ca584a..99e4cc3 100644
--- a/docs/SkImage_Reference.bmh
+++ b/docs/SkImage_Reference.bmh
@@ -1001,9 +1001,8 @@
canvas->translate(image->width(), 0);
SkPaint paint;
paint.setTextAlign(SkPaint::kCenter_Align);
- paint.setVerticalText(true);
canvas->drawLine(10, 0, 10, image->height(), paint);
- canvas->drawString("height", 25, image->height() / 2, paint);
+ canvas->drawString("height", 34, image->height() / 2, paint);
##
#SeeAlso dimensions() width()
diff --git a/docs/SkPaint_Reference.bmh b/docs/SkPaint_Reference.bmh
index 9762899..878251d 100644
--- a/docs/SkPaint_Reference.bmh
+++ b/docs/SkPaint_Reference.bmh
@@ -4613,27 +4613,28 @@
#Description
Text intercepts draw on either side of, but not inside, Glyphs in a run.
##
- void draw(SkCanvas* canvas) {
- SkPaint paint;
- paint.setTextSize(120);
- paint.setVerticalText(true);
- SkPoint textPos[] = {{ 60, 40 }, { 60, 140 }};
- SkScalar bounds[] = { 56, 64 };
- const char str[] = "A-";
- int len = sizeof(str) - 1;
- int count = paint.getPosTextIntercepts(str, len, textPos, bounds, nullptr);
- std::vector<SkScalar> intervals;
- intervals.resize(count);
- (void) paint.getPosTextIntercepts(str, len, textPos, bounds, &intervals.front());
- canvas->drawPosText(str, len, textPos, paint);
- paint.setColor(SK_ColorRED);
- SkScalar y = textPos[0].fY;
- for (int i = 0; i < count; i+= 2) {
- canvas->drawRect({bounds[0], y, bounds[1], intervals[i]}, paint);
- y = intervals[i + 1];
- }
- canvas->drawRect({bounds[0], intervals[count - 1], bounds[1], 240}, paint);
+ void draw(SkCanvas* canvas) {
+ SkPaint paint;
+ paint.setTextSize(120);
+ SkPoint textPos[] = {{ 60, 90 }, { 120, 90 }};
+ SkScalar bounds[] = { 40, 70 };
+ const char str[] = "A+";
+ int len = sizeof(str) - 1;
+ int count = paint.getPosTextIntercepts(str, len, textPos, bounds, nullptr);
+ std::vector<SkScalar> intervals;
+ intervals.resize(count);
+ (void) paint.getPosTextIntercepts(str, len, textPos, bounds, &intervals.front());
+ canvas->drawPosText(str, len, textPos, paint);
+ paint.setColor(SK_ColorRED);
+ SkScalar x = textPos[0].fX;
+ for (int i = 0; i < count; i+= 2) {
+ canvas->drawRect({x, bounds[0], intervals[i], bounds[1]}, paint);
+ x = intervals[i + 1];
}
+ if (count) {
+ canvas->drawRect({intervals[count - 1], bounds[0], 180, bounds[1]}, paint);
+ }
+ }
##
##
diff --git a/site/user/api/SkImageInfo_Reference.md b/site/user/api/SkImageInfo_Reference.md
index eed2243..f154a86 100644
--- a/site/user/api/SkImageInfo_Reference.md
+++ b/site/user/api/SkImageInfo_Reference.md
@@ -1351,7 +1351,7 @@
### Example
-<div><fiddle-embed name="1719751fef7fd6040447619d4e66d416"></fiddle-embed></div>
+<div><fiddle-embed name="b79ea956d4cb89a483bfa48bba09df85"></fiddle-embed></div>
### See Also
diff --git a/site/user/api/SkImage_Reference.md b/site/user/api/SkImage_Reference.md
index da98800..ccd48cb 100644
--- a/site/user/api/SkImage_Reference.md
+++ b/site/user/api/SkImage_Reference.md
@@ -1261,7 +1261,7 @@
### Example
-<div><fiddle-embed name="6e563cb8351d34bd8af555a51bcd7a96"></fiddle-embed></div>
+<div><fiddle-embed name="60a063a2b210915f38401c83d4dba9e6"></fiddle-embed></div>
### See Also
diff --git a/site/user/api/SkPaint_Reference.md b/site/user/api/SkPaint_Reference.md
index 0c6835d..249a95c 100644
--- a/site/user/api/SkPaint_Reference.md
+++ b/site/user/api/SkPaint_Reference.md
@@ -5034,7 +5034,7 @@
### Example
-<div><fiddle-embed name="98b2dfc552d0540a7c041fe7a2839bd7"><div><a href='undocumented#Text'>Text</a> intercepts draw on either side of, but not inside, <a href='undocumented#Glyph'>Glyphs</a> in a run.
+<div><fiddle-embed name="5b5754fdb90b44c245d72567854eca04"><div><a href='undocumented#Text'>Text</a> intercepts draw on either side of, but not inside, <a href='undocumented#Glyph'>Glyphs</a> in a run.
</div></fiddle-embed></div>
<a name='SkPaint_getPosTextHIntercepts'></a>
diff --git a/site/user/api/catalog.htm b/site/user/api/catalog.htm
index 8c9460d..e1d8c8f 100644
--- a/site/user/api/catalog.htm
+++ b/site/user/api/catalog.htm
@@ -5971,10 +5971,10 @@
"name": "SkImageInfo::gammaCloseToSRGB"
},
"SkImageInfo_height": {
- "code": "void draw(SkCanvas* canvas) {\n canvas->translate(10, 20);\n canvas->drawBitmap(source, 0, 0);\n SkImageInfo imageInfo = source.info();\n SkPaint paint;\n paint.setTextAlign(SkPaint::kCenter_Align);\n paint.setVerticalText(true);\n canvas->drawLine(imageInfo.width() + 10, 0, imageInfo.width() + 10, imageInfo.height(), paint);\n canvas->drawString(\"height\", imageInfo.width() + 25, imageInfo.height() / 2, paint);\n}",
+ "code": "void draw(SkCanvas* canvas) {\n canvas->translate(10, 20);\n canvas->drawBitmap(source, 0, 0);\n SkImageInfo imageInfo = source.info();\n SkPaint paint;\n paint.setTextAlign(SkPaint::kCenter_Align);\n canvas->drawLine(imageInfo.width() + 10, 0, imageInfo.width() + 10, imageInfo.height(), paint);\n canvas->drawString(\"height\", imageInfo.width() + 34, imageInfo.height() / 2, paint);\n}",
"width": 256,
"height": 96,
- "hash": "1719751fef7fd6040447619d4e66d416",
+ "hash": "b79ea956d4cb89a483bfa48bba09df85",
"file": "SkImageInfo_Reference",
"name": "SkImageInfo::height()"
},
@@ -6179,10 +6179,10 @@
"name": "SkImage::getBackendTexture"
},
"SkImage_height": {
- "code": "void draw(SkCanvas* canvas) {\n canvas->translate(10, 10);\n canvas->drawImage(image, 0, 0);\n canvas->translate(image->width(), 0);\n SkPaint paint;\n paint.setTextAlign(SkPaint::kCenter_Align);\n paint.setVerticalText(true);\n canvas->drawLine(10, 0, 10, image->height(), paint);\n canvas->drawString(\"height\", 25, image->height() / 2, paint);\n}",
+ "code": "void draw(SkCanvas* canvas) {\n canvas->translate(10, 10);\n canvas->drawImage(image, 0, 0);\n canvas->translate(image->width(), 0);\n SkPaint paint;\n paint.setTextAlign(SkPaint::kCenter_Align);\n canvas->drawLine(10, 0, 10, image->height(), paint);\n canvas->drawString(\"height\", 34, image->height() / 2, paint);\n}",
"width": 256,
"height": 96,
- "hash": "6e563cb8351d34bd8af555a51bcd7a96",
+ "hash": "60a063a2b210915f38401c83d4dba9e6",
"file": "SkImage_Reference",
"name": "SkImage::height()"
},
@@ -7155,10 +7155,10 @@
"name": "SkPaint::getPosTextHIntercepts"
},
"SkPaint_getPosTextIntercepts": {
- "code": "void draw(SkCanvas* canvas) {\n SkPaint paint;\n paint.setTextSize(120);\n paint.setVerticalText(true);\n SkPoint textPos[] = {{ 60, 40 }, { 60, 140 }};\n SkScalar bounds[] = { 56, 64 };\n const char str[] = \"A-\";\n int len = sizeof(str) - 1;\n int count = paint.getPosTextIntercepts(str, len, textPos, bounds, nullptr);\n std::vector<SkScalar> intervals;\n intervals.resize(count);\n (void) paint.getPosTextIntercepts(str, len, textPos, bounds, &intervals.front());\n canvas->drawPosText(str, len, textPos, paint);\n paint.setColor(SK_ColorRED);\n SkScalar y = textPos[0].fY;\n for (int i = 0; i < count; i+= 2) {\n canvas->drawRect({bounds[0], y, bounds[1], intervals[i]}, paint);\n y = intervals[i + 1];\n }\n canvas->drawRect({bounds[0], intervals[count - 1], bounds[1], 240}, paint);\n}\n",
+ "code": "void draw(SkCanvas* canvas) {\n SkPaint paint;\n paint.setTextSize(120);\n SkPoint textPos[] = {{ 60, 90 }, { 120, 90 }};\n SkScalar bounds[] = { 40, 70 };\n const char str[] = \"A+\";\n int len = sizeof(str) - 1;\n int count = paint.getPosTextIntercepts(str, len, textPos, bounds, nullptr);\n std::vector<SkScalar> intervals;\n intervals.resize(count);\n (void) paint.getPosTextIntercepts(str, len, textPos, bounds, &intervals.front());\n canvas->drawPosText(str, len, textPos, paint);\n paint.setColor(SK_ColorRED);\n SkScalar x = textPos[0].fX;\n for (int i = 0; i < count; i+= 2) {\n canvas->drawRect({x, bounds[0], intervals[i], bounds[1]}, paint);\n x = intervals[i + 1];\n }\n if (count) {\n canvas->drawRect({intervals[count - 1], bounds[0], 180, bounds[1]}, paint);\n }\n}\n",
"width": 256,
"height": 256,
- "hash": "98b2dfc552d0540a7c041fe7a2839bd7",
+ "hash": "5b5754fdb90b44c245d72567854eca04",
"file": "SkPaint_Reference",
"name": "SkPaint::getPosTextIntercepts"
},