add breaktext doc skeleton

copy paragraph from paint, add empty
example to docs. Fixes bot

TBR=reed@google.com

Docs-Preview: https://skia.org/?cl=173771
Bug: skia:
Change-Id: I4a79f7f8f32f860d0390dbce44669e03bb3a281e
Reviewed-on: https://skia-review.googlesource.com/c/173771
Commit-Queue: Cary Clark <caryclark@skia.org>
Auto-Submit: Cary Clark <caryclark@skia.org>
Reviewed-by: Cary Clark <caryclark@skia.org>
This commit is contained in:
Cary Clark 2018-12-03 04:53:21 -05:00 committed by Skia Commit-Bot
parent 28ce5f269f
commit 5b671c300d
4 changed files with 91 additions and 12 deletions

View File

@ -568,6 +568,22 @@ Whether edge pixels draw opaque or with partial transparency.
#Method ##
# ------------------------------------------------------------------------------
#Method size_t breakText(const void* text, size_t length, SkTextEncoding encoding, SkScalar maxWidth,
SkScalar* measuredWidth = nullptr) const
#In incomplete
#Line # incomplete ##
#Populate
#Example
// incomplete
##
#SeeAlso incomplete
#Method ##
# ------------------------------------------------------------------------------
#Method SkScalar measureText(const void* text, size_t byteLength, SkTextEncoding encoding,

View File

@ -295,7 +295,22 @@ public:
*/
bool containsText(const void* text, size_t byteLength, SkTextEncoding encoding) const;
size_t breakText(const void* text, size_t length, SkTextEncoding, SkScalar maxWidth,
/** Returns the bytes of text that fit within maxWidth.
The text fragment fits if its advance width is less than or equal to maxWidth.
Measures only while the advance is less than or equal to maxWidth.
Returns the advance or the text fragment in measuredWidth if it not nullptr.
Uses encoding to decode text, SkTypeface to get the font metrics,
and text size to scale the metrics.
Does not scale the advance or bounds by fake bold.
@param text character codes or glyph indices to be measured
@param length number of bytes of text to measure
@param encoding text encoding
@param maxWidth advance limit; text is measured while advance is less than maxWidth
@param measuredWidth returns the width of the text less than or equal to maxWidth
@return bytes of text that fit, always less than or equal to length
*/
size_t breakText(const void* text, size_t length, SkTextEncoding encoding, SkScalar maxWidth,
SkScalar* measuredWidth = nullptr) const;
/** Returns the advance width of text.

View File

@ -60,7 +60,7 @@ class <a href='SkFont_Reference#SkFont'>SkFont</a> {
uint16_t <a href='#SkFont_unicharToGlyph'>unicharToGlyph</a>(<a href='undocumented#SkUnichar'>SkUnichar</a> uni) const;
int <a href='#SkFont_countText'>countText</a>(const void* <a href='undocumented#Text'>text</a>, size_t byteLength, <a href='undocumented#SkTextEncoding'>SkTextEncoding</a> encoding) const;
bool <a href='#SkFont_containsText'>containsText</a>(const void* <a href='undocumented#Text'>text</a>, size_t byteLength, <a href='undocumented#SkTextEncoding'>SkTextEncoding</a> encoding) const;
size_t breakText(const void* <a href='undocumented#Text'>text</a>, size_t length, <a href='undocumented#SkTextEncoding'>SkTextEncoding</a>, <a href='undocumented#SkScalar'>SkScalar</a> maxWidth,
size_t <a href='#SkFont_breakText'>breakText</a>(const void* <a href='undocumented#Text'>text</a>, size_t length, <a href='undocumented#SkTextEncoding'>SkTextEncoding</a> encoding, <a href='undocumented#SkScalar'>SkScalar</a> maxWidth,
<a href='undocumented#SkScalar'>SkScalar</a>* measuredWidth = nullptr) const;
<a href='undocumented#SkScalar'>SkScalar</a> <a href='#SkFont_measureText'>measureText</a>(const void* <a href='undocumented#Text'>text</a>, size_t byteLength, <a href='undocumented#SkTextEncoding'>SkTextEncoding</a> encoding,
<a href='SkRect_Reference#SkRect'>SkRect</a>* bounds = nullptr) const;
@ -1007,6 +1007,54 @@ true if all <a href='#SkFont_containsText_text'>text</a> corresponds to a non-ze
incomplete
<a name='SkFont_breakText'></a>
---
<pre style="padding: 1em 1em 1em 1em; width: 62.5em;background-color: #f0f0f0">
size_t <a href='#SkFont_breakText'>breakText</a>(const void* <a href='undocumented#Text'>text</a>, size_t length, <a href='undocumented#SkTextEncoding'>SkTextEncoding</a> encoding, <a href='undocumented#SkScalar'>SkScalar</a> maxWidth,
<a href='undocumented#SkScalar'>SkScalar</a>* measuredWidth = nullptr)const
</pre>
Returns the bytes of <a href='#SkFont_breakText_text'>text</a> that fit within <a href='#SkFont_breakText_maxWidth'>maxWidth</a>.
The <a href='#SkFont_breakText_text'>text</a> fragment fits if its advance width is less than or equal to <a href='#SkFont_breakText_maxWidth'>maxWidth</a>.
Measures only while the advance is less than or equal to <a href='#SkFont_breakText_maxWidth'>maxWidth</a>.
Returns the advance or the <a href='#SkFont_breakText_text'>text</a> fragment in <a href='#SkFont_breakText_measuredWidth'>measuredWidth</a> if it not nullptr.
Uses <a href='#SkFont_breakText_encoding'>encoding</a> to decode <a href='#SkFont_breakText_text'>text</a>, <a href='undocumented#SkTypeface'>SkTypeface</a> to get the <a href='SkFont_Reference#Font'>font</a> metrics,
and <a href='#SkFont_breakText_text'>text</a> <a href='undocumented#Size'>size</a> to scale the metrics.
Does not scale the advance or bounds by fake bold.
### Parameters
<table> <tr> <td><a name='SkFont_breakText_text'><code><strong>text</strong></code></a></td>
<td>character codes or <a href='undocumented#Glyph'>glyph</a> indices to be measured</td>
</tr>
<tr> <td><a name='SkFont_breakText_length'><code><strong>length</strong></code></a></td>
<td>number of bytes of <a href='#SkFont_breakText_text'>text</a> to measure</td>
</tr>
<tr> <td><a name='SkFont_breakText_encoding'><code><strong>encoding</strong></code></a></td>
<td><a href='#SkFont_breakText_text'>text</a> <a href='#SkFont_breakText_encoding'>encoding</a></td>
</tr>
<tr> <td><a name='SkFont_breakText_maxWidth'><code><strong>maxWidth</strong></code></a></td>
<td>advance limit; <a href='#SkFont_breakText_text'>text</a> is measured while advance is less than <a href='#SkFont_breakText_maxWidth'>maxWidth</a></td>
</tr>
<tr> <td><a name='SkFont_breakText_measuredWidth'><code><strong>measuredWidth</strong></code></a></td>
<td>returns the width of the <a href='#SkFont_breakText_text'>text</a> less than or equal to <a href='#SkFont_breakText_maxWidth'>maxWidth</a></td>
</tr>
</table>
### Return Value
bytes of <a href='#SkFont_breakText_text'>text</a> that fit, always less than or equal to <a href='#SkFont_breakText_length'>length</a>
### Example
<div><fiddle-embed name="882e8e0103048009a25cfc20400492f7"></fiddle-embed></div>
### See Also
incomplete
<a name='SkFont_measureText'></a>
---

View File

@ -1842,8 +1842,8 @@
"stdout": "paint.isAntiAlias()\\npaint.isDither()\\n"
},
"SkPaint_setHinting": {
"code": "void draw(SkCanvas* canvas) {\n SkPaint paint1, paint2;\n paint2.setHinting(kNormal_SkFontHinting);\n SkDebugf(\"paint1 %c= paint2\\n\", paint1 == paint2 ? '=' : ':');\n}",
"hash": "197268a89c3343f600b9bade61c513ae",
"code": "void draw(SkCanvas* canvas) {\n SkPaint paint1, paint2;\n paint2.setHinting(SkFontHinting::kNormal);\n SkDebugf(\"paint1 %c= paint2\\n\", paint1 == paint2 ? '=' : ':');\n}",
"hash": "bb179ec5698ec1398ff18f3657ab73f7",
"file": "SkPaint_Reference",
"name": "SkPaint::setHinting",
"stdout": "paint1 == paint2\\n"
@ -5794,14 +5794,6 @@
"hash": "882e8e0103048009a25cfc20400492f7",
"file": "SkFont_Reference",
"name": "SkFont::Edging"
},
"SkFont_Hinting": {
"code": "void draw(SkCanvas* canvas) {\n // incomplete\n}",
"width": 256,
"height": 256,
"hash": "882e8e0103048009a25cfc20400492f7",
"file": "SkFont_Reference",
"name": "SkFont::Hinting"
},
"SkFont_SkTypeface_SkScalar": {
"code": "void draw(SkCanvas* canvas) {\n // incomplete\n}",
@ -5818,6 +5810,14 @@
"hash": "882e8e0103048009a25cfc20400492f7",
"file": "SkFont_Reference",
"name": "SkFont::SkFont(sk_sp<SkTypeface> typeface, SkScalar size, SkScalar scaleX, SkScalar skewX)"
},
"SkFont_breakText": {
"code": "void draw(SkCanvas* canvas) {\n // incomplete\n}",
"width": 256,
"height": 256,
"hash": "882e8e0103048009a25cfc20400492f7",
"file": "SkFont_Reference",
"name": "SkFont::breakText"
},
"SkFont_containsText": {
"code": "void draw(SkCanvas* canvas) {\n // incomplete\n}",