• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1SkFont Reference
2===
3
4
5<pre style="padding: 1em 1em 1em 1em;width: 62.5em; background-color: #f0f0f0">
6class <a href='SkFont_Reference#SkFont'>SkFont</a> {
7    // <i><a href='SkFont_Reference#SkFont'>SkFont</a> interface</i>
8};
9</pre>
10
11<a name='Advance'></a>
12
13<a name='Engine'></a>
14
15<a name='Size'></a>
16
17<a href='#Font_Size'>Font_Size</a> adjusts the overall <a href='undocumented#Text'>text</a> <a href='undocumented#Size'>size</a> in <a href='SkPoint_Reference#Point'>points</a>.
18<a href='#Font_Size'>Font_Size</a> can be set to any positive value or zero.
19<a href='#Font_Size'>Font_Size</a> defaults to 12.
20<a href='#Font_Size'>Font_Size</a>
21
22<a name='Scale_X'></a>
23
24<a href='#Font_Scale_X'>Font_Scale_X</a> adjusts the <a href='undocumented#Text'>text</a> horizontal scale.
25<a href='undocumented#Text'>Text</a> scaling approximates condensed and expanded type faces when the actual face
26is not available.
27<a href='#Font_Scale_X'>Font_Scale_X</a> can be set to any value.
28<a href='#Font_Scale_X'>Font_Scale_X</a> defaults to 1.
29
30<a name='Skew_X'></a>
31
32<a href='#Font_Skew_X'>Font_Skew_X</a> adjusts the <a href='undocumented#Text'>text</a> horizontal slant.
33<a href='undocumented#Text'>Text</a> skewing approximates italic and oblique type faces when the actual face
34is not available.
35<a href='#Font_Skew_X'>Font_Skew_X</a> can be set to any value.
36<a href='#Font_Skew_X'>Font_Skew_X</a> defaults to 0.
37
38<a name='Embolden'></a>
39
40<a href='#Font_Embolden'>Font_Embolden</a> approximates the bold <a href='SkFont_Reference#Font'>font</a> style accompanying a normal <a href='SkFont_Reference#Font'>font</a> when a bold <a href='SkFont_Reference#Font'>font</a> face
41is not available. Skia does not provide <a href='SkFont_Reference#Font'>font</a> substitution; it is up to the client to find the
42bold <a href='SkFont_Reference#Font'>font</a> face using the platform <a href='#Font_Manager'>Font_Manager</a>.
43
44Use <a href='#Font_Skew_X'>Font_Skew_X</a> to approximate an italic <a href='SkFont_Reference#Font'>font</a> style when the italic <a href='SkFont_Reference#Font'>font</a> face
45is not available.
46
47A FreeType based port may define SK_USE_FREETYPE_EMBOLDEN at compile time to direct
48the  <a href='SkFont_Reference#Font_Engine'>font engine</a> to create the bold <a href='undocumented#Glyph'>Glyphs</a>. Otherwise, the extra bold is computed
49by increasing the stroke width and setting the <a href='SkPaint_Reference#SkPaint'>SkPaint</a>::<a href='#SkPaint_Style'>Style</a> to
50<a href='SkPaint_Reference#SkPaint'>SkPaint</a>::<a href='#SkPaint_kStrokeAndFill_Style'>kStrokeAndFill_Style</a> as needed.
51
52<a href='#Font_Embolden'>Font_Embolden</a> is disabled by default.
53
54<a name='Hinting_Spacing'></a>
55
56If Hinting is set to <a href='undocumented#SkFontHinting'>SkFontHinting</a>::<a href='#SkFontHinting_kFull'>kFull</a>, <a href='#Font_Hinting_Spacing'>Hinting_Spacing</a> adjusts the character
57spacing by the difference of the hinted and unhinted <a href='#Left_Side_Bearing'>Left_Side_Bearing</a> and
58<a href='#Right_Side_Bearing'>Right_Side_Bearing</a>. <a href='#Font_Hinting_Spacing'>Hinting_Spacing</a> only applies to platforms that use
59FreeType as their <a href='#Font_Engine'>Font_Engine</a>.
60
61<a href='#Font_Hinting_Spacing'>Hinting_Spacing</a> is not related to <a href='undocumented#Text'>text</a> kerning, where the space between
62a specific pair of characters is adjusted using <a href='undocumented#Data'>data</a> in the <a href='SkFont_Reference#Font'>font</a> kerning tables.
63
64<a name='Linear'></a>
65
66<a href='#Font_Linear'>Font_Linear</a> selects whether <a href='undocumented#Text'>text</a> is rendered as a <a href='undocumented#Glyph'>Glyph</a> or as a <a href='SkPath_Reference#Path'>Path</a>.
67If <a href='#Font_Linear'>Font_Linear</a> is set, it has the same effect as setting Hinting to <a href='undocumented#SkFontHinting'>SkFontHinting</a>::<a href='#SkFontHinting_kNormal'>kNormal</a>.
68If <a href='#Font_Linear'>Font_Linear</a> is clear, it is the same as setting Hinting to <a href='undocumented#SkFontHinting'>SkFontHinting</a>::<a href='#SkFontHinting_kNone'>kNone</a>.
69
70<a name='Subpixel'></a>
71
72<a href='#Font_Subpixel'>Font_Subpixel</a> uses the <a href='undocumented#Pixel'>pixel</a> transparency to represent a fractional offset.
73As the opaqueness of the <a href='SkColor_Reference#Color'>color</a> increases, the edge of the <a href='undocumented#Glyph'>glyph</a> appears to move
74towards the outside of the <a href='undocumented#Pixel'>pixel</a>.
75
76<a name='Anti_Alias'></a>
77
78When set, <a href='#Paint_Anti_Alias'>Anti_Alias</a> positions <a href='undocumented#Glyph'>glyphs</a> within a <a href='undocumented#Pixel'>pixel</a>, using <a href='SkColor_Reference#Alpha'>alpha</a> and
79possibly RGB striping. It can take advantage of the organization of RGB stripes
80that create a <a href='SkColor_Reference#Color'>color</a>, and relies on the small <a href='undocumented#Size'>size</a> of the stripe and visual perception
81to make the <a href='SkColor_Reference#Color'>color</a> fringing imperceptible.
82
83<a href='#Paint_Anti_Alias'>Anti_Alias</a> can be enabled on devices that orient stripes horizontally
84or vertically, and that order the <a href='SkColor_Reference#Color'>color</a> components as RGB or BGR. Internally, the
85<a href='undocumented#Glyph'>glyph</a> cache may store multiple copies of the same <a href='undocumented#Glyph'>glyph</a> with different <a href='SkFont_Reference#Subpixel'>sub-pixel</a>
86positions, requiring more memory.
87
88<a name='Force_Hinting'></a>
89
90If Hinting is set to <a href='undocumented#SkFontHinting'>SkFontHinting</a>::<a href='#SkFontHinting_kNormal'>kNormal</a> or <a href='undocumented#SkFontHinting'>SkFontHinting</a>::<a href='#SkFontHinting_kFull'>kFull</a>, <a href='#Font_Force_Hinting'>Force_Hinting</a>
91instructs the <a href='#Font_Manager'>Font_Manager</a> to always hint <a href='undocumented#Glyph'>Glyphs</a>.
92<a href='#Font_Force_Hinting'>Force_Hinting</a> has no effect if Hinting is set to <a href='undocumented#SkFontHinting'>SkFontHinting</a>::<a href='#SkFontHinting_kNone'>kNone</a> or
93<a href='undocumented#SkFontHinting'>SkFontHinting</a>::<a href='#SkFontHinting_kSlight'>kSlight</a>.
94
95<a href='#Font_Force_Hinting'>Force_Hinting</a> only affects platforms that use FreeType as the <a href='#Font_Manager'>Font_Manager</a>.
96
97<a name='Embedded_Bitmaps'></a>
98
99<a href='#Font_Embedded_Bitmaps'>Embedded_Bitmaps</a> allows selecting custom sized <a href='SkBitmap_Reference#Bitmap'>bitmap</a> <a href='undocumented#Glyph'>Glyphs</a>.
100<a href='#Font_Embedded_Bitmaps'>Embedded_Bitmaps</a> when set chooses an embedded <a href='SkBitmap_Reference#Bitmap'>bitmap</a> <a href='undocumented#Glyph'>glyph</a> over an outline contained
101in a <a href='SkFont_Reference#Font'>font</a> if the platform supports this option.
102
103FreeType selects the <a href='SkBitmap_Reference#Bitmap'>bitmap</a> <a href='undocumented#Glyph'>glyph</a> if available when <a href='#Font_Embedded_Bitmaps'>Embedded_Bitmaps</a> is set, and selects
104the outline <a href='undocumented#Glyph'>glyph</a> if <a href='#Font_Embedded_Bitmaps'>Embedded_Bitmaps</a> is clear.
105Windows may select the <a href='SkBitmap_Reference#Bitmap'>bitmap</a> <a href='undocumented#Glyph'>glyph</a> but is not required to do so.
106<a href='#OS_X'>OS_X</a> and iOS do not support this option.
107
108<a name='SkFont'></a>
109
110---
111
112<a href='SkFont_Reference#SkFont'>SkFont</a> controls options applied when drawing and measuring <a href='undocumented#Text'>text</a>.
113
114<pre style="padding: 1em 1em 1em 1em;width: 62.5em; background-color: #f0f0f0">
115class <a href='SkFont_Reference#SkFont'>SkFont</a> {
116
117    enum class <a href='#SkFont_Edging'>Edging</a> {
118        kAlias,
119        kAntiAlias,
120        kSubpixelAntiAlias,
121    };
122
123    <a href='#SkFont_empty_constructor'>SkFont()</a>;
124    <a href='#SkFont_SkTypeface_SkScalar'>SkFont</a>(<a href='undocumented#sk_sp'>sk_sp</a><<a href='undocumented#SkTypeface'>SkTypeface</a>> <a href='undocumented#Typeface'>typeface</a>, <a href='undocumented#SkScalar'>SkScalar</a> <a href='undocumented#Size'>size</a>);
125    <a href='#SkFont_SkTypeface_SkScalar_SkScalar_SkScalar'>SkFont</a>(<a href='undocumented#sk_sp'>sk_sp</a><<a href='undocumented#SkTypeface'>SkTypeface</a>> <a href='undocumented#Typeface'>typeface</a>, <a href='undocumented#SkScalar'>SkScalar</a> <a href='undocumented#Size'>size</a>, <a href='undocumented#SkScalar'>SkScalar</a> scaleX, <a href='undocumented#SkScalar'>SkScalar</a> skewX);
126    bool <a href='#SkFont_equal1_operator'>operator==</a>(const <a href='SkFont_Reference#SkFont'>SkFont</a>& <a href='SkFont_Reference#Font'>font</a>) const;
127    bool <a href='#SkFont_isForceAutoHinting'>isForceAutoHinting</a>() const;
128    bool <a href='#SkFont_isEmbeddedBitmaps'>isEmbeddedBitmaps</a>() const;
129    bool <a href='#SkFont_isSubpixel'>isSubpixel</a>() const;
130    bool <a href='#SkFont_isLinearMetrics'>isLinearMetrics</a>() const;
131    bool <a href='#SkFont_isEmbolden'>isEmbolden</a>() const;
132    void <a href='#SkFont_setForceAutoHinting'>setForceAutoHinting</a>(bool forceAutoHinting);
133    void <a href='#SkFont_setEmbeddedBitmaps'>setEmbeddedBitmaps</a>(bool embeddedBitmaps);
134    void <a href='#SkFont_setSubpixel'>setSubpixel</a>(bool subpixel);
135    void <a href='#SkFont_setLinearMetrics'>setLinearMetrics</a>(bool linearMetrics);
136    void <a href='#SkFont_setEmbolden'>setEmbolden</a>(bool embolden);
137    <a href='#SkFont_Edging'>Edging</a> <a href='#SkFont_getEdging'>getEdging</a>() const;
138    void <a href='#SkFont_setEdging'>setEdging</a>(<a href='#SkFont_Edging'>Edging</a> edging);
139    void <a href='#SkFont_setHinting'>setHinting</a>(<a href='undocumented#SkFontHinting'>SkFontHinting</a> hintingLevel);
140    <a href='undocumented#SkFontHinting'>SkFontHinting</a> <a href='#SkFont_getHinting'>getHinting</a>() const;
141    <a href='SkFont_Reference#SkFont'>SkFont</a> <a href='#SkFont_makeWithSize'>makeWithSize</a>(<a href='undocumented#SkScalar'>SkScalar</a> <a href='undocumented#Size'>size</a>) const;
142    <a href='undocumented#SkTypeface'>SkTypeface</a>* <a href='#SkFont_getTypeface'>getTypeface</a>() const;
143    <a href='undocumented#SkScalar'>SkScalar</a> <a href='#SkFont_getSize'>getSize</a>() const;
144    <a href='undocumented#SkScalar'>SkScalar</a> <a href='#SkFont_getScaleX'>getScaleX</a>() const;
145    <a href='undocumented#SkScalar'>SkScalar</a> <a href='#SkFont_getSkewX'>getSkewX</a>() const;
146    <a href='undocumented#sk_sp'>sk_sp</a><<a href='undocumented#SkTypeface'>SkTypeface</a>> <a href='#SkFont_refTypeface'>refTypeface</a>() const;
147    void <a href='#SkFont_setTypeface'>setTypeface</a>(<a href='undocumented#sk_sp'>sk_sp</a><<a href='undocumented#SkTypeface'>SkTypeface</a>> tf);
148    void <a href='#SkFont_setSize'>setSize</a>(<a href='undocumented#SkScalar'>SkScalar</a> textSize);
149    void <a href='#SkFont_setScaleX'>setScaleX</a>(<a href='undocumented#SkScalar'>SkScalar</a> scaleX);
150    void <a href='#SkFont_setSkewX'>setSkewX</a>(<a href='undocumented#SkScalar'>SkScalar</a> skewX);
151    int <a href='#SkFont_textToGlyphs'>textToGlyphs</a>(const void* <a href='undocumented#Text'>text</a>, size_t byteLength, <a href='undocumented#SkTextEncoding'>SkTextEncoding</a> encoding,
152                     <a href='undocumented#SkGlyphID'>SkGlyphID</a> <a href='undocumented#Glyph'>glyphs</a>[], int maxGlyphCount) const;
153    uint16_t <a href='#SkFont_unicharToGlyph'>unicharToGlyph</a>(<a href='undocumented#SkUnichar'>SkUnichar</a> uni) const;
154    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;
155    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;
156    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,
157                     <a href='undocumented#SkScalar'>SkScalar</a>* measuredWidth = nullptr) const;
158    <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,
159                         <a href='SkRect_Reference#SkRect'>SkRect</a>* bounds = nullptr) const;
160    bool <a href='#SkFont_getPath'>getPath</a>(uint16_t glyphID, <a href='SkPath_Reference#SkPath'>SkPath</a>* <a href='SkPath_Reference#Path'>path</a>) const;
161    void <a href='#SkFont_getPaths'>getPaths</a>(const uint16_t glyphIDs[], int count,
162                  void (*glyphPathProc)(const <a href='SkPath_Reference#SkPath'>SkPath</a>* pathOrNull, const <a href='SkMatrix_Reference#SkMatrix'>SkMatrix</a>& mx, void* ctx),
163                  void* ctx) const;
164    <a href='undocumented#SkScalar'>SkScalar</a> <a href='#SkFont_getMetrics'>getMetrics</a>(<a href='undocumented#SkFontMetrics'>SkFontMetrics</a>* metrics) const;
165    <a href='undocumented#SkScalar'>SkScalar</a> <a href='#SkFont_getSpacing'>getSpacing</a>() const;
166};
167
168</pre>
169
170<a name='SkFont_Edging'></a>
171
172---
173
174<pre style="padding: 1em 1em 1em 1em;width: 62.5em; background-color: #f0f0f0">
175    enum class <a href='#SkFont_Edging'>Edging</a> {
176        <a href='#SkFont_Edging_kAlias'>kAlias</a>,
177        <a href='#SkFont_Edging_kAntiAlias'>kAntiAlias</a>,
178        <a href='#SkFont_Edging_kSubpixelAntiAlias'>kSubpixelAntiAlias</a>,
179    };
180
181</pre>
182
183Whether edge pixels draw opaque or with partial transparency.
184
185### Constants
186
187<table style='border-collapse: collapse; width: 62.5em'>
188  <tr><th style='text-align: left; border: 2px solid #dddddd; padding: 8px; '>Const</th>
189<th style='text-align: center; border: 2px solid #dddddd; padding: 8px; '>Value</th>
190<th style='text-align: left; border: 2px solid #dddddd; padding: 8px; '>Description</th></tr>
191  <tr style='background-color: #f0f0f0; '>
192    <td style='text-align: left; border: 2px solid #dddddd; padding: 8px; '><a name='SkFont_Edging_kAlias'><code>SkFont::Edging::kAlias</code></a></td>
193    <td style='text-align: center; border: 2px solid #dddddd; padding: 8px; '></td>
194    <td style='text-align: left; border: 2px solid #dddddd; padding: 8px; '>
195no transparent pixels on glyph edges</td>
196  </tr>
197  <tr>
198    <td style='text-align: left; border: 2px solid #dddddd; padding: 8px; '><a name='SkFont_Edging_kAntiAlias'><code>SkFont::Edging::kAntiAlias</code></a></td>
199    <td style='text-align: center; border: 2px solid #dddddd; padding: 8px; '></td>
200    <td style='text-align: left; border: 2px solid #dddddd; padding: 8px; '>
201may have transparent pixels on glyph edges</td>
202  </tr>
203  <tr style='background-color: #f0f0f0; '>
204    <td style='text-align: left; border: 2px solid #dddddd; padding: 8px; '><a name='SkFont_Edging_kSubpixelAntiAlias'><code>SkFont::Edging::kSubpixelAntiAlias</code></a></td>
205    <td style='text-align: center; border: 2px solid #dddddd; padding: 8px; '></td>
206    <td style='text-align: left; border: 2px solid #dddddd; padding: 8px; '>
207glyph positioned in pixel using transparency</td>
208  </tr>
209</table>
210
211### Example
212
213<div><fiddle-embed name="882e8e0103048009a25cfc20400492f7"></fiddle-embed></div>
214
215### See Also
216
217incomplete
218
219<a name='SkFont_empty_constructor'></a>
220
221---
222
223<pre style="padding: 1em 1em 1em 1em; width: 62.5em;background-color: #f0f0f0">
224<a href='#SkFont_empty_constructor'>SkFont()</a>
225</pre>
226
227Constructs <a href='SkFont_Reference#SkFont'>SkFont</a> with default values.
228
229### Return Value
230
231default initialized <a href='SkFont_Reference#SkFont'>SkFont</a>
232
233### Example
234
235<div><fiddle-embed name="882e8e0103048009a25cfc20400492f7"></fiddle-embed></div>
236
237### See Also
238
239incomplete
240
241<a name='SkFont_SkTypeface_SkScalar'></a>
242
243---
244
245<pre style="padding: 1em 1em 1em 1em; width: 62.5em;background-color: #f0f0f0">
246<a href='SkFont_Reference#SkFont'>SkFont</a>(<a href='undocumented#sk_sp'>sk_sp</a>&lt;<a href='undocumented#SkTypeface'>SkTypeface</a>&gt; <a href='undocumented#Typeface'>typeface</a>, <a href='undocumented#SkScalar'>SkScalar</a> <a href='undocumented#Size'>size</a>)
247</pre>
248
249Constructs <a href='SkFont_Reference#SkFont'>SkFont</a> with default values with <a href='undocumented#SkTypeface'>SkTypeface</a> and <a href='#SkFont_SkTypeface_SkScalar_size'>size</a> in <a href='SkPoint_Reference#Point'>points</a>.
250
251### Parameters
252
253<table>  <tr>    <td><a name='SkFont_SkTypeface_SkScalar_typeface'><code><strong>typeface</strong></code></a></td>
254    <td><a href='SkFont_Reference#Font'>font</a> and style used to draw and measure <a href='undocumented#Text'>text</a></td>
255  </tr>
256  <tr>    <td><a name='SkFont_SkTypeface_SkScalar_size'><code><strong>size</strong></code></a></td>
257    <td>typographic height of <a href='undocumented#Text'>text</a></td>
258  </tr>
259</table>
260
261### Return Value
262
263initialized <a href='SkFont_Reference#SkFont'>SkFont</a>
264
265### Example
266
267<div><fiddle-embed name="882e8e0103048009a25cfc20400492f7"></fiddle-embed></div>
268
269### See Also
270
271incomplete
272
273<a name='SkFont_SkTypeface_SkScalar_SkScalar_SkScalar'></a>
274
275---
276
277<pre style="padding: 1em 1em 1em 1em; width: 62.5em;background-color: #f0f0f0">
278<a href='SkFont_Reference#SkFont'>SkFont</a>(<a href='undocumented#sk_sp'>sk_sp</a>&lt;<a href='undocumented#SkTypeface'>SkTypeface</a>&gt; <a href='undocumented#Typeface'>typeface</a>, <a href='undocumented#SkScalar'>SkScalar</a> <a href='undocumented#Size'>size</a>, <a href='undocumented#SkScalar'>SkScalar</a> scaleX, <a href='undocumented#SkScalar'>SkScalar</a> skewX)
279</pre>
280
281Constructs <a href='SkFont_Reference#SkFont'>SkFont</a> with default values with <a href='undocumented#SkTypeface'>SkTypeface</a> and <a href='#SkFont_SkTypeface_SkScalar_SkScalar_SkScalar_size'>size</a> in <a href='SkPoint_Reference#Point'>points</a>,
282horizontal scale, and horizontal skew. Horizontal scale emulates condensed
283and expanded fonts. Horizontal skew emulates oblique fonts.
284
285### Parameters
286
287<table>  <tr>    <td><a name='SkFont_SkTypeface_SkScalar_SkScalar_SkScalar_typeface'><code><strong>typeface</strong></code></a></td>
288    <td><a href='SkFont_Reference#Font'>font</a> and style used to draw and measure <a href='undocumented#Text'>text</a></td>
289  </tr>
290  <tr>    <td><a name='SkFont_SkTypeface_SkScalar_SkScalar_SkScalar_size'><code><strong>size</strong></code></a></td>
291    <td>typographic height of <a href='undocumented#Text'>text</a></td>
292  </tr>
293  <tr>    <td><a name='SkFont_SkTypeface_SkScalar_SkScalar_SkScalar_scaleX'><code><strong>scaleX</strong></code></a></td>
294    <td><a href='undocumented#Text'>text</a> horizontal scale</td>
295  </tr>
296  <tr>    <td><a name='SkFont_SkTypeface_SkScalar_SkScalar_SkScalar_skewX'><code><strong>skewX</strong></code></a></td>
297    <td>additional shear on x-axis relative to y-axis</td>
298  </tr>
299</table>
300
301### Return Value
302
303initialized <a href='SkFont_Reference#SkFont'>SkFont</a>
304
305### Example
306
307<div><fiddle-embed name="882e8e0103048009a25cfc20400492f7"></fiddle-embed></div>
308
309### See Also
310
311incomplete
312
313<a name='SkFont_equal1_operator'></a>
314
315---
316
317<pre style="padding: 1em 1em 1em 1em; width: 62.5em;background-color: #f0f0f0">
318bool operator==(const <a href='SkFont_Reference#SkFont'>SkFont</a>& <a href='SkFont_Reference#Font'>font</a>)const
319</pre>
320
321Compares <a href='SkFont_Reference#SkFont'>SkFont</a> and <a href='#SkFont_equal1_operator_font'>font</a>, and returns true if they are equivalent.
322May return false if <a href='undocumented#SkTypeface'>SkTypeface</a> has identical contents but different pointers.
323
324### Parameters
325
326<table>  <tr>    <td><a name='SkFont_equal1_operator_font'><code><strong>font</strong></code></a></td>
327    <td><a href='#SkFont_equal1_operator_font'>font</a> to compare</td>
328  </tr>
329</table>
330
331### Return Value
332
333true if <a href='SkFont_Reference#SkFont'>SkFont</a> pair are equivalent
334
335### Example
336
337<div><fiddle-embed name="882e8e0103048009a25cfc20400492f7"></fiddle-embed></div>
338
339### See Also
340
341incomplete
342
343<a name='SkFont_isForceAutoHinting'></a>
344
345---
346
347<pre style="padding: 1em 1em 1em 1em; width: 62.5em;background-color: #f0f0f0">
348bool <a href='#SkFont_isForceAutoHinting'>isForceAutoHinting</a>()const
349</pre>
350
351If true, instructs the <a href='SkFont_Reference#Font'>font</a> manager to always hint <a href='undocumented#Glyph'>glyphs</a>.
352Returned value is only meaningful if platform uses FreeType as the <a href='SkFont_Reference#Font'>font</a> manager.
353
354### Return Value
355
356true if all <a href='undocumented#Glyph'>glyphs</a> are hinted
357
358### Example
359
360<div><fiddle-embed name="882e8e0103048009a25cfc20400492f7"></fiddle-embed></div>
361
362### See Also
363
364incomplete
365
366<a name='SkFont_isEmbeddedBitmaps'></a>
367
368---
369
370<pre style="padding: 1em 1em 1em 1em; width: 62.5em;background-color: #f0f0f0">
371bool <a href='#SkFont_isEmbeddedBitmaps'>isEmbeddedBitmaps</a>()const
372</pre>
373
374Returns true if <a href='SkFont_Reference#Font'>font</a> engine may return <a href='undocumented#Glyph'>glyphs</a> from <a href='SkFont_Reference#Font'>font</a> <a href='SkBitmap_Reference#Bitmap'>bitmaps</a> instead of from outlines.
375
376### Return Value
377
378true if <a href='undocumented#Glyph'>glyphs</a> may be <a href='SkFont_Reference#Font'>font</a> <a href='SkBitmap_Reference#Bitmap'>bitmaps</a>
379
380### Example
381
382<div><fiddle-embed name="882e8e0103048009a25cfc20400492f7"></fiddle-embed></div>
383
384### See Also
385
386incomplete
387
388<a name='SkFont_isSubpixel'></a>
389
390---
391
392<pre style="padding: 1em 1em 1em 1em; width: 62.5em;background-color: #f0f0f0">
393bool <a href='#SkFont_isSubpixel'>isSubpixel</a>()const
394</pre>
395
396Returns true if <a href='undocumented#Glyph'>glyphs</a> at different <a href='SkFont_Reference#Subpixel'>sub-pixel</a> positions may differ on <a href='undocumented#Pixel'>pixel</a> edge coverage.
397
398### Return Value
399
400true if <a href='undocumented#Glyph'>glyph</a> positioned in <a href='undocumented#Pixel'>pixel</a> using transparency
401
402### Example
403
404<div><fiddle-embed name="882e8e0103048009a25cfc20400492f7"></fiddle-embed></div>
405
406### See Also
407
408incomplete
409
410<a name='SkFont_isLinearMetrics'></a>
411
412---
413
414<pre style="padding: 1em 1em 1em 1em; width: 62.5em;background-color: #f0f0f0">
415bool <a href='#SkFont_isLinearMetrics'>isLinearMetrics</a>()const
416</pre>
417
418Returns true if <a href='undocumented#Text'>text</a> is converted to <a href='SkPath_Reference#SkPath'>SkPath</a> before drawing and measuring.
419
420### Return Value
421
422true <a href='undocumented#Glyph'>glyph</a> hints are never applied
423
424### Example
425
426<div><fiddle-embed name="882e8e0103048009a25cfc20400492f7"></fiddle-embed></div>
427
428### See Also
429
430incomplete
431
432<a name='SkFont_isEmbolden'></a>
433
434---
435
436<pre style="padding: 1em 1em 1em 1em; width: 62.5em;background-color: #f0f0f0">
437bool <a href='#SkFont_isEmbolden'>isEmbolden</a>()const
438</pre>
439
440Returns true if bold is approximated by increasing the stroke width when creating <a href='undocumented#Glyph'>glyph</a>
441<a href='SkBitmap_Reference#Bitmap'>bitmaps</a> from outlines.
442
443### Return Value
444
445bold is approximated through stroke width
446
447### Example
448
449<div><fiddle-embed name="882e8e0103048009a25cfc20400492f7"></fiddle-embed></div>
450
451### See Also
452
453incomplete
454
455<a name='SkFont_setForceAutoHinting'></a>
456
457---
458
459<pre style="padding: 1em 1em 1em 1em; width: 62.5em;background-color: #f0f0f0">
460void <a href='#SkFont_setForceAutoHinting'>setForceAutoHinting</a>(bool forceAutoHinting)
461</pre>
462
463Sets whether to always hint <a href='undocumented#Glyph'>glyphs</a>.
464If <a href='#SkFont_setForceAutoHinting_forceAutoHinting'>forceAutoHinting</a> is set, instructs the  <a href='undocumented#Font_Manager'>font manager</a> to always hint <a href='undocumented#Glyph'>glyphs</a>.
465
466Only affects platforms that use FreeType as the  <a href='undocumented#Font_Manager'>font manager</a>.
467
468### Parameters
469
470<table>  <tr>    <td><a name='SkFont_setForceAutoHinting_forceAutoHinting'><code><strong>forceAutoHinting</strong></code></a></td>
471    <td>setting to always hint <a href='undocumented#Glyph'>glyphs</a></td>
472  </tr>
473</table>
474
475### Example
476
477<div><fiddle-embed name="882e8e0103048009a25cfc20400492f7"></fiddle-embed></div>
478
479### See Also
480
481incomplete
482
483<a name='SkFont_setEmbeddedBitmaps'></a>
484
485---
486
487<pre style="padding: 1em 1em 1em 1em; width: 62.5em;background-color: #f0f0f0">
488void <a href='#SkFont_setEmbeddedBitmaps'>setEmbeddedBitmaps</a>(bool embeddedBitmaps)
489</pre>
490
491Requests, but does not require, to use <a href='SkBitmap_Reference#Bitmap'>bitmaps</a> in fonts instead of outlines.
492
493### Parameters
494
495<table>  <tr>    <td><a name='SkFont_setEmbeddedBitmaps_embeddedBitmaps'><code><strong>embeddedBitmaps</strong></code></a></td>
496    <td>setting to use <a href='SkBitmap_Reference#Bitmap'>bitmaps</a> in fonts</td>
497  </tr>
498</table>
499
500### Example
501
502<div><fiddle-embed name="882e8e0103048009a25cfc20400492f7"></fiddle-embed></div>
503
504### See Also
505
506incomplete
507
508<a name='SkFont_setSubpixel'></a>
509
510---
511
512<pre style="padding: 1em 1em 1em 1em; width: 62.5em;background-color: #f0f0f0">
513void <a href='#SkFont_setSubpixel'>setSubpixel</a>(bool subpixel)
514</pre>
515
516Requests, but does not require, that <a href='undocumented#Glyph'>glyphs</a> respect <a href='SkFont_Reference#Subpixel'>sub-pixel</a> positioning.
517
518### Parameters
519
520<table>  <tr>    <td><a name='SkFont_setSubpixel_subpixel'><code><strong>subpixel</strong></code></a></td>
521    <td>setting for <a href='SkFont_Reference#Subpixel'>sub-pixel</a> positioning</td>
522  </tr>
523</table>
524
525### Example
526
527<div><fiddle-embed name="882e8e0103048009a25cfc20400492f7"></fiddle-embed></div>
528
529### See Also
530
531incomplete
532
533<a name='SkFont_setLinearMetrics'></a>
534
535---
536
537<pre style="padding: 1em 1em 1em 1em; width: 62.5em;background-color: #f0f0f0">
538void <a href='#SkFont_setLinearMetrics'>setLinearMetrics</a>(bool linearMetrics)
539</pre>
540
541Requests, but does not require, that <a href='undocumented#Glyph'>glyphs</a> are converted to <a href='SkPath_Reference#SkPath'>SkPath</a>
542before drawing and measuring.
543
544### Parameters
545
546<table>  <tr>    <td><a name='SkFont_setLinearMetrics_linearMetrics'><code><strong>linearMetrics</strong></code></a></td>
547    <td>setting for converting <a href='undocumented#Glyph'>glyphs</a> to <a href='SkPath_Reference#Path'>paths</a></td>
548  </tr>
549</table>
550
551### Example
552
553<div><fiddle-embed name="882e8e0103048009a25cfc20400492f7"></fiddle-embed></div>
554
555### See Also
556
557incomplete
558
559<a name='SkFont_setEmbolden'></a>
560
561---
562
563<pre style="padding: 1em 1em 1em 1em; width: 62.5em;background-color: #f0f0f0">
564void <a href='#SkFont_setEmbolden'>setEmbolden</a>(bool embolden)
565</pre>
566
567Increases stroke width when creating <a href='undocumented#Glyph'>glyph</a> <a href='SkBitmap_Reference#Bitmap'>bitmaps</a> to approximate a bold <a href='undocumented#Typeface'>typeface</a>.
568
569### Parameters
570
571<table>  <tr>    <td><a name='SkFont_setEmbolden_embolden'><code><strong>embolden</strong></code></a></td>
572    <td>setting for bold approximation</td>
573  </tr>
574</table>
575
576### Example
577
578<div><fiddle-embed name="882e8e0103048009a25cfc20400492f7"></fiddle-embed></div>
579
580### See Also
581
582incomplete
583
584<a name='SkFont_getEdging'></a>
585
586---
587
588<pre style="padding: 1em 1em 1em 1em; width: 62.5em;background-color: #f0f0f0">
589<a href='#SkFont_Edging'>Edging</a> <a href='#SkFont_getEdging'>getEdging</a>()const
590</pre>
591
592Whether edge pixels draw opaque or with partial transparency.
593
594### Return Value
595
596one of: <a href='#SkFont_Edging'>Edging</a>::<a href='#SkFont_Edging_kAlias'>kAlias</a>, <a href='#SkFont_Edging'>Edging</a>::<a href='#SkFont_Edging_kAntiAlias'>kAntiAlias</a>, <a href='#SkFont_Edging'>Edging</a>::<a href='#SkFont_Edging_kSubpixelAntiAlias'>kSubpixelAntiAlias</a>
597
598### Example
599
600<div><fiddle-embed name="882e8e0103048009a25cfc20400492f7"></fiddle-embed></div>
601
602### See Also
603
604incomplete
605
606<a name='SkFont_setEdging'></a>
607
608---
609
610<pre style="padding: 1em 1em 1em 1em; width: 62.5em;background-color: #f0f0f0">
611void <a href='#SkFont_setEdging'>setEdging</a>(<a href='#SkFont_Edging'>Edging</a> edging)
612</pre>
613
614Requests, but does not require, that edge pixels draw opaque or with
615partial transparency.
616
617### Parameters
618
619<table>  <tr>    <td><a name='SkFont_setEdging_edging'><code><strong>edging</strong></code></a></td>
620    <td>one of: <a href='#SkFont_Edging'>Edging</a>::<a href='#SkFont_Edging_kAlias'>kAlias</a>, <a href='#SkFont_Edging'>Edging</a>::<a href='#SkFont_Edging_kAntiAlias'>kAntiAlias</a>, <a href='#SkFont_Edging'>Edging</a>::<a href='#SkFont_Edging_kSubpixelAntiAlias'>kSubpixelAntiAlias</a></td>
621  </tr>
622</table>
623
624### Example
625
626<div><fiddle-embed name="882e8e0103048009a25cfc20400492f7"></fiddle-embed></div>
627
628### See Also
629
630incomplete
631
632<a name='SkFont_setHinting'></a>
633
634---
635
636<pre style="padding: 1em 1em 1em 1em; width: 62.5em;background-color: #f0f0f0">
637void <a href='#SkFont_setHinting'>setHinting</a>(<a href='undocumented#SkFontHinting'>SkFontHinting</a> hintingLevel)
638</pre>
639
640Sets level of <a href='undocumented#Glyph'>glyph</a> outline adjustment.
641Does not check for valid values of <a href='#SkFont_setHinting_hintingLevel'>hintingLevel</a>.
642
643### Parameters
644
645<table>  <tr>    <td><a name='SkFont_setHinting_hintingLevel'><code><strong>hintingLevel</strong></code></a></td>
646    <td>one of: <a href='undocumented#SkFontHinting'>SkFontHinting</a>::<a href='#SkFontHinting_kNone'>kNone</a>, <a href='undocumented#SkFontHinting'>SkFontHinting</a>::<a href='#SkFontHinting_kSlight'>kSlight</a>,</td>
647  </tr>
648</table>
649
650<a href='undocumented#SkFontHinting'>SkFontHinting</a>::<a href='#SkFontHinting_kNormal'>kNormal</a>, <a href='undocumented#SkFontHinting'>SkFontHinting</a>::<a href='#SkFontHinting_kFull'>kFull</a>
651
652### Example
653
654<div><fiddle-embed name="882e8e0103048009a25cfc20400492f7"></fiddle-embed></div>
655
656### See Also
657
658incomplete
659
660<a name='SkFont_getHinting'></a>
661
662---
663
664<pre style="padding: 1em 1em 1em 1em; width: 62.5em;background-color: #f0f0f0">
665<a href='undocumented#SkFontHinting'>SkFontHinting</a> <a href='#SkFont_getHinting'>getHinting</a>()const
666</pre>
667
668Returns level of <a href='undocumented#Glyph'>glyph</a> outline adjustment.
669
670### Return Value
671
672one of: <a href='undocumented#SkFontHinting'>SkFontHinting</a>::<a href='#SkFontHinting_kNone'>kNone</a>, <a href='undocumented#SkFontHinting'>SkFontHinting</a>::<a href='#SkFontHinting_kSlight'>kSlight</a>, <a href='undocumented#SkFontHinting'>SkFontHinting</a>::<a href='#SkFontHinting_kNormal'>kNormal</a>,
673
674<a href='undocumented#SkFontHinting'>SkFontHinting</a>::<a href='#SkFontHinting_kFull'>kFull</a>
675
676### Example
677
678<div><fiddle-embed name="882e8e0103048009a25cfc20400492f7"></fiddle-embed></div>
679
680### See Also
681
682incomplete
683
684<a name='SkFont_makeWithSize'></a>
685
686---
687
688<pre style="padding: 1em 1em 1em 1em; width: 62.5em;background-color: #f0f0f0">
689<a href='SkFont_Reference#SkFont'>SkFont</a> <a href='#SkFont_makeWithSize'>makeWithSize</a>(<a href='undocumented#SkScalar'>SkScalar</a> <a href='undocumented#Size'>size</a>)const
690</pre>
691
692Returns a <a href='SkFont_Reference#Font'>font</a> with the same attributes of this <a href='SkFont_Reference#Font'>font</a>, but with the specified <a href='#SkFont_makeWithSize_size'>size</a>.
693Returns nullptr if <a href='#SkFont_makeWithSize_size'>size</a> is less than zero, infinite, or NaN.
694
695### Parameters
696
697<table>  <tr>    <td><a name='SkFont_makeWithSize_size'><code><strong>size</strong></code></a></td>
698    <td>typographic height of <a href='undocumented#Text'>text</a></td>
699  </tr>
700</table>
701
702### Return Value
703
704initialized <a href='SkFont_Reference#SkFont'>SkFont</a>
705
706### Example
707
708<div><fiddle-embed name="882e8e0103048009a25cfc20400492f7"></fiddle-embed></div>
709
710### See Also
711
712incomplete
713
714<a name='SkFont_getTypeface'></a>
715
716---
717
718<pre style="padding: 1em 1em 1em 1em; width: 62.5em;background-color: #f0f0f0">
719<a href='undocumented#SkTypeface'>SkTypeface</a>* <a href='#SkFont_getTypeface'>getTypeface</a>()const
720</pre>
721
722Returns <a href='undocumented#SkTypeface'>SkTypeface</a> if set, or nullptr.
723Does not alter <a href='undocumented#SkTypeface'>SkTypeface</a> <a href='undocumented#SkRefCnt'>SkRefCnt</a>.
724
725### Return Value
726
727<a href='undocumented#SkTypeface'>SkTypeface</a> if previously set, nullptr otherwise
728
729### Example
730
731<div><fiddle-embed name="882e8e0103048009a25cfc20400492f7"></fiddle-embed></div>
732
733### See Also
734
735incomplete
736
737<a name='SkFont_getSize'></a>
738
739---
740
741<pre style="padding: 1em 1em 1em 1em; width: 62.5em;background-color: #f0f0f0">
742<a href='undocumented#SkScalar'>SkScalar</a>    <a href='#SkFont_getSize'>getSize</a>()const
743</pre>
744
745Returns <a href='undocumented#Text'>text</a> <a href='undocumented#Size'>size</a> in <a href='SkPoint_Reference#Point'>points</a>.
746
747### Return Value
748
749typographic height of <a href='undocumented#Text'>text</a>
750
751### Example
752
753<div><fiddle-embed name="882e8e0103048009a25cfc20400492f7"></fiddle-embed></div>
754
755### See Also
756
757incomplete
758
759<a name='SkFont_getScaleX'></a>
760
761---
762
763<pre style="padding: 1em 1em 1em 1em; width: 62.5em;background-color: #f0f0f0">
764<a href='undocumented#SkScalar'>SkScalar</a>    <a href='#SkFont_getScaleX'>getScaleX</a>()const
765</pre>
766
767Returns <a href='undocumented#Text'>text</a> scale on x-axis.
768Default value is 1.
769
770### Return Value
771
772<a href='undocumented#Text'>text</a> horizontal scale
773
774### Example
775
776<div><fiddle-embed name="882e8e0103048009a25cfc20400492f7"></fiddle-embed></div>
777
778### See Also
779
780incomplete
781
782<a name='SkFont_getSkewX'></a>
783
784---
785
786<pre style="padding: 1em 1em 1em 1em; width: 62.5em;background-color: #f0f0f0">
787<a href='undocumented#SkScalar'>SkScalar</a>    <a href='#SkFont_getSkewX'>getSkewX</a>()const
788</pre>
789
790Returns <a href='undocumented#Text'>text</a> skew on x-axis.
791Default value is zero.
792
793### Return Value
794
795additional shear on x-axis relative to y-axis
796
797### Example
798
799<div><fiddle-embed name="882e8e0103048009a25cfc20400492f7"></fiddle-embed></div>
800
801### See Also
802
803incomplete
804
805<a name='SkFont_refTypeface'></a>
806
807---
808
809<pre style="padding: 1em 1em 1em 1em; width: 62.5em;background-color: #f0f0f0">
810<a href='undocumented#sk_sp'>sk_sp</a>&lt;<a href='undocumented#SkTypeface'>SkTypeface</a>&gt; <a href='#SkFont_refTypeface'>refTypeface</a>()const
811</pre>
812
813Increases <a href='undocumented#SkTypeface'>SkTypeface</a> <a href='undocumented#SkRefCnt'>SkRefCnt</a> by one.
814
815### Return Value
816
817<a href='undocumented#SkTypeface'>SkTypeface</a> if previously set, nullptr otherwise
818
819### Example
820
821<div><fiddle-embed name="882e8e0103048009a25cfc20400492f7"></fiddle-embed></div>
822
823### See Also
824
825incomplete
826
827<a name='SkFont_setTypeface'></a>
828
829---
830
831<pre style="padding: 1em 1em 1em 1em; width: 62.5em;background-color: #f0f0f0">
832void <a href='#SkFont_setTypeface'>setTypeface</a>(<a href='undocumented#sk_sp'>sk_sp</a>&lt;<a href='undocumented#SkTypeface'>SkTypeface</a>&gt; tf)
833</pre>
834
835Sets <a href='undocumented#SkTypeface'>SkTypeface</a> to <a href='undocumented#Typeface'>typeface</a>, decreasing <a href='undocumented#SkRefCnt'>SkRefCnt</a> of the previous <a href='undocumented#SkTypeface'>SkTypeface</a>.
836Pass nullptr to clear <a href='undocumented#SkTypeface'>SkTypeface</a> and use the default <a href='undocumented#Typeface'>typeface</a>. Increments
837<a href='#SkFont_setTypeface_tf'>tf</a> <a href='undocumented#SkRefCnt'>SkRefCnt</a> by one.
838
839### Parameters
840
841<table>  <tr>    <td><a name='SkFont_setTypeface_tf'><code><strong>tf</strong></code></a></td>
842    <td><a href='SkFont_Reference#Font'>font</a> and style used to draw <a href='undocumented#Text'>text</a></td>
843  </tr>
844</table>
845
846### Example
847
848<div><fiddle-embed name="882e8e0103048009a25cfc20400492f7"></fiddle-embed></div>
849
850### See Also
851
852incomplete
853
854<a name='SkFont_setSize'></a>
855
856---
857
858<pre style="padding: 1em 1em 1em 1em; width: 62.5em;background-color: #f0f0f0">
859void <a href='#SkFont_setSize'>setSize</a>(<a href='undocumented#SkScalar'>SkScalar</a> textSize)
860</pre>
861
862Sets <a href='undocumented#Text'>text</a> <a href='undocumented#Size'>size</a> in <a href='SkPoint_Reference#Point'>points</a>.
863Has no effect if <a href='#SkFont_setSize_textSize'>textSize</a> is not greater than or equal to zero.
864
865### Parameters
866
867<table>  <tr>    <td><a name='SkFont_setSize_textSize'><code><strong>textSize</strong></code></a></td>
868    <td>typographic height of <a href='undocumented#Text'>text</a></td>
869  </tr>
870</table>
871
872### Example
873
874<div><fiddle-embed name="882e8e0103048009a25cfc20400492f7"></fiddle-embed></div>
875
876### See Also
877
878incomplete
879
880<a name='SkFont_setScaleX'></a>
881
882---
883
884<pre style="padding: 1em 1em 1em 1em; width: 62.5em;background-color: #f0f0f0">
885void <a href='#SkFont_setScaleX'>setScaleX</a>(<a href='undocumented#SkScalar'>SkScalar</a> scaleX)
886</pre>
887
888Sets  <a href='undocumented#Text'>text scale</a> on x-axis.
889Default value is 1.
890
891### Parameters
892
893<table>  <tr>    <td><a name='SkFont_setScaleX_scaleX'><code><strong>scaleX</strong></code></a></td>
894    <td><a href='undocumented#Text'>text</a> horizontal scale</td>
895  </tr>
896</table>
897
898### Example
899
900<div><fiddle-embed name="882e8e0103048009a25cfc20400492f7"></fiddle-embed></div>
901
902### See Also
903
904incomplete
905
906<a name='SkFont_setSkewX'></a>
907
908---
909
910<pre style="padding: 1em 1em 1em 1em; width: 62.5em;background-color: #f0f0f0">
911void <a href='#SkFont_setSkewX'>setSkewX</a>(<a href='undocumented#SkScalar'>SkScalar</a> skewX)
912</pre>
913
914Sets  <a href='undocumented#Text'>text skew</a> on x-axis.
915Default value is zero.
916
917### Parameters
918
919<table>  <tr>    <td><a name='SkFont_setSkewX_skewX'><code><strong>skewX</strong></code></a></td>
920    <td>additional shear on x-axis relative to y-axis</td>
921  </tr>
922</table>
923
924### Example
925
926<div><fiddle-embed name="882e8e0103048009a25cfc20400492f7"></fiddle-embed></div>
927
928### See Also
929
930incomplete
931
932<a name='SkFont_textToGlyphs'></a>
933
934---
935
936<pre style="padding: 1em 1em 1em 1em; width: 62.5em;background-color: #f0f0f0">
937int <a href='#SkFont_textToGlyphs'>textToGlyphs</a>(const void* <a href='undocumented#Text'>text</a>, size_t byteLength, <a href='undocumented#SkTextEncoding'>SkTextEncoding</a> encoding, <a href='undocumented#SkGlyphID'>SkGlyphID</a> <a href='undocumented#Glyph'>glyphs</a>[],
938                 int maxGlyphCount)const
939</pre>
940
941Converts <a href='#SkFont_textToGlyphs_text'>text</a> into <a href='undocumented#Glyph'>glyph</a> indices.
942Returns the number of <a href='undocumented#Glyph'>glyph</a> indices represented by <a href='#SkFont_textToGlyphs_text'>text</a>.
943<a href='undocumented#SkTextEncoding'>SkTextEncoding</a> specifies how <a href='#SkFont_textToGlyphs_text'>text</a> represents characters or <a href='#SkFont_textToGlyphs_glyphs'>glyphs</a>.
944<a href='#SkFont_textToGlyphs_glyphs'>glyphs</a> may be nullptr, to compute the <a href='undocumented#Glyph'>glyph</a> count.
945
946Does not check <a href='#SkFont_textToGlyphs_text'>text</a> for valid character codes or valid <a href='undocumented#Glyph'>glyph</a> indices.
947
948If <a href='#SkFont_textToGlyphs_byteLength'>byteLength</a> equals zero, returns zero.
949If <a href='#SkFont_textToGlyphs_byteLength'>byteLength</a> includes a partial character, the partial character is ignored.
950
951If <a href='#SkFont_textToGlyphs_encoding'>encoding</a> is <a href='undocumented#SkTextEncoding::kUTF8'>SkTextEncoding::kUTF8</a> and <a href='#SkFont_textToGlyphs_text'>text</a> contains an invalid UTF-8 sequence,
952zero is returned.
953
954If <a href='#SkFont_textToGlyphs_maxGlyphCount'>maxGlyphCount</a> is not sufficient to store all the <a href='#SkFont_textToGlyphs_glyphs'>glyphs</a>, no <a href='#SkFont_textToGlyphs_glyphs'>glyphs</a> are copied.
955The total <a href='undocumented#Glyph'>glyph</a> count is returned for subsequent buffer reallocation.
956
957### Parameters
958
959<table>  <tr>    <td><a name='SkFont_textToGlyphs_text'><code><strong>text</strong></code></a></td>
960    <td>character storage encoded with <a href='undocumented#SkTextEncoding'>SkTextEncoding</a></td>
961  </tr>
962  <tr>    <td><a name='SkFont_textToGlyphs_byteLength'><code><strong>byteLength</strong></code></a></td>
963    <td>length of character storage in bytes</td>
964  </tr>
965  <tr>    <td><a name='SkFont_textToGlyphs_encoding'><code><strong>encoding</strong></code></a></td>
966    <td>one of: <a href='undocumented#SkTextEncoding::kUTF8'>SkTextEncoding::kUTF8</a>, <a href='undocumented#SkTextEncoding::kUTF16'>SkTextEncoding::kUTF16</a>,</td>
967  </tr>
968</table>
969
970<a href='undocumented#SkTextEncoding::kUTF32'>SkTextEncoding::kUTF32</a>, <a href='undocumented#SkTextEncoding::kGlyphID'>SkTextEncoding::kGlyphID</a>
971
972### Parameters
973
974<table>  <tr>    <td><a name='SkFont_textToGlyphs_glyphs'><code><strong>glyphs</strong></code></a></td>
975    <td>storage for <a href='undocumented#Glyph'>glyph</a> indices; may be nullptr</td>
976  </tr>
977  <tr>    <td><a name='SkFont_textToGlyphs_maxGlyphCount'><code><strong>maxGlyphCount</strong></code></a></td>
978    <td>storage capacity</td>
979  </tr>
980</table>
981
982### Return Value
983
984number of <a href='#SkFont_textToGlyphs_glyphs'>glyphs</a> represented by <a href='#SkFont_textToGlyphs_text'>text</a> of length <a href='#SkFont_textToGlyphs_byteLength'>byteLength</a>
985
986### Example
987
988<div><fiddle-embed name="882e8e0103048009a25cfc20400492f7"></fiddle-embed></div>
989
990### See Also
991
992incomplete
993
994<a name='SkFont_unicharToGlyph'></a>
995
996---
997
998<pre style="padding: 1em 1em 1em 1em; width: 62.5em;background-color: #f0f0f0">
999uint16_t <a href='#SkFont_unicharToGlyph'>unicharToGlyph</a>(<a href='undocumented#SkUnichar'>SkUnichar</a> uni)const
1000</pre>
1001
1002Returns <a href='undocumented#Glyph'>glyph</a> index for Unicode character.
1003
1004### Parameters
1005
1006<table>  <tr>    <td><a name='SkFont_unicharToGlyph_uni'><code><strong>uni</strong></code></a></td>
1007    <td>Unicode character</td>
1008  </tr>
1009</table>
1010
1011### Return Value
1012
1013<a href='undocumented#Glyph'>glyph</a> index
1014
1015### Example
1016
1017<div><fiddle-embed name="882e8e0103048009a25cfc20400492f7"></fiddle-embed></div>
1018
1019### See Also
1020
1021incomplete
1022
1023<a name='SkFont_countText'></a>
1024
1025---
1026
1027<pre style="padding: 1em 1em 1em 1em; width: 62.5em;background-color: #f0f0f0">
1028int <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
1029</pre>
1030
1031Returns number of <a href='undocumented#Glyph'>glyphs</a> represented by <a href='#SkFont_countText_text'>text</a>.
1032
1033### Parameters
1034
1035<table>  <tr>    <td><a name='SkFont_countText_text'><code><strong>text</strong></code></a></td>
1036    <td>character storage encoded with <a href='undocumented#SkTextEncoding'>SkTextEncoding</a></td>
1037  </tr>
1038  <tr>    <td><a name='SkFont_countText_byteLength'><code><strong>byteLength</strong></code></a></td>
1039    <td>length of character storage in bytes</td>
1040  </tr>
1041  <tr>    <td><a name='SkFont_countText_encoding'><code><strong>encoding</strong></code></a></td>
1042    <td>one of: <a href='undocumented#SkTextEncoding::kUTF8'>SkTextEncoding::kUTF8</a>, <a href='undocumented#SkTextEncoding::kUTF16'>SkTextEncoding::kUTF16</a>,</td>
1043  </tr>
1044</table>
1045
1046<a href='undocumented#SkTextEncoding::kUTF32'>SkTextEncoding::kUTF32</a>, <a href='undocumented#SkTextEncoding::kGlyphID'>SkTextEncoding::kGlyphID</a>
1047
1048### Return Value
1049
1050number of <a href='undocumented#Glyph'>glyphs</a> represented by <a href='#SkFont_countText_text'>text</a> of length <a href='#SkFont_countText_byteLength'>byteLength</a>
1051
1052### Example
1053
1054<div><fiddle-embed name="882e8e0103048009a25cfc20400492f7"></fiddle-embed></div>
1055
1056### See Also
1057
1058incomplete
1059
1060<a name='SkFont_containsText'></a>
1061
1062---
1063
1064<pre style="padding: 1em 1em 1em 1em; width: 62.5em;background-color: #f0f0f0">
1065bool <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
1066</pre>
1067
1068Returns true if all <a href='#SkFont_containsText_text'>text</a> corresponds to a non-zero <a href='undocumented#Glyph'>glyph</a> index.
1069Returns false if any characters in <a href='#SkFont_containsText_text'>text</a> are not supported in
1070<a href='undocumented#SkTypeface'>SkTypeface</a>.
1071
1072If <a href='undocumented#SkTextEncoding'>SkTextEncoding</a> is <a href='undocumented#SkTextEncoding::kGlyphID'>SkTextEncoding::kGlyphID</a>,
1073returns true if all <a href='undocumented#Glyph'>glyph</a> indices in <a href='#SkFont_containsText_text'>text</a> are non-zero;
1074does not check to see if <a href='#SkFont_containsText_text'>text</a> contains valid <a href='undocumented#Glyph'>glyph</a> indices for <a href='undocumented#SkTypeface'>SkTypeface</a>.
1075
1076Returns true if <a href='#SkFont_containsText_byteLength'>byteLength</a> is zero.
1077
1078### Parameters
1079
1080<table>  <tr>    <td><a name='SkFont_containsText_text'><code><strong>text</strong></code></a></td>
1081    <td>array of characters or <a href='undocumented#Glyph'>glyphs</a></td>
1082  </tr>
1083  <tr>    <td><a name='SkFont_containsText_byteLength'><code><strong>byteLength</strong></code></a></td>
1084    <td>number of bytes in <a href='#SkFont_containsText_text'>text</a> array</td>
1085  </tr>
1086  <tr>    <td><a name='SkFont_containsText_encoding'><code><strong>encoding</strong></code></a></td>
1087    <td><a href='undocumented#Text_Encoding'>text encoding</a></td>
1088  </tr>
1089</table>
1090
1091### Return Value
1092
1093true if all <a href='#SkFont_containsText_text'>text</a> corresponds to a non-zero <a href='undocumented#Glyph'>glyph</a> index
1094
1095### Example
1096
1097<div><fiddle-embed name="882e8e0103048009a25cfc20400492f7"></fiddle-embed></div>
1098
1099### See Also
1100
1101incomplete
1102
1103<a name='SkFont_breakText'></a>
1104
1105---
1106
1107<pre style="padding: 1em 1em 1em 1em; width: 62.5em;background-color: #f0f0f0">
1108size_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,
1109                 <a href='undocumented#SkScalar'>SkScalar</a>* measuredWidth = nullptr)const
1110</pre>
1111
1112Returns the bytes of <a href='#SkFont_breakText_text'>text</a> that fit within <a href='#SkFont_breakText_maxWidth'>maxWidth</a>.
1113The <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>.
1114Measures only while the advance is less than or equal to <a href='#SkFont_breakText_maxWidth'>maxWidth</a>.
1115Returns the advance or the <a href='#SkFont_breakText_text'>text</a> fragment in <a href='#SkFont_breakText_measuredWidth'>measuredWidth</a> if it not nullptr.
1116Uses <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='undocumented#Font_Metrics'>font metrics</a>,
1117and <a href='#SkFont_breakText_text'>text</a> <a href='undocumented#Size'>size</a> to scale the metrics.
1118Does not scale the advance or bounds by fake bold.
1119
1120### Parameters
1121
1122<table>  <tr>    <td><a name='SkFont_breakText_text'><code><strong>text</strong></code></a></td>
1123    <td>character codes or <a href='undocumented#Glyph'>glyph</a> indices to be measured</td>
1124  </tr>
1125  <tr>    <td><a name='SkFont_breakText_length'><code><strong>length</strong></code></a></td>
1126    <td>number of bytes of <a href='#SkFont_breakText_text'>text</a> to measure</td>
1127  </tr>
1128  <tr>    <td><a name='SkFont_breakText_encoding'><code><strong>encoding</strong></code></a></td>
1129    <td><a href='undocumented#Text_Encoding'>text encoding</a></td>
1130  </tr>
1131  <tr>    <td><a name='SkFont_breakText_maxWidth'><code><strong>maxWidth</strong></code></a></td>
1132    <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>
1133  </tr>
1134  <tr>    <td><a name='SkFont_breakText_measuredWidth'><code><strong>measuredWidth</strong></code></a></td>
1135    <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>
1136  </tr>
1137</table>
1138
1139### Return Value
1140
1141bytes of <a href='#SkFont_breakText_text'>text</a> that fit, always less than or equal to <a href='#SkFont_breakText_length'>length</a>
1142
1143### Example
1144
1145<div><fiddle-embed name="3cad18678254526be66ef162eecd1d23"><div><a href='undocumented#Line'>Line</a> under "Breakfast" shows desired width, shorter than available characters.
1146<a href='undocumented#Line'>Line</a> under "Bre" shows measured width after breaking <a href='#SkFont_breakText_text'>text</a>.
1147</div></fiddle-embed></div>
1148
1149### See Also
1150
1151incomplete
1152
1153<a name='SkFont_measureText'></a>
1154
1155---
1156
1157<pre style="padding: 1em 1em 1em 1em; width: 62.5em;background-color: #f0f0f0">
1158<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,
1159                     <a href='SkRect_Reference#SkRect'>SkRect</a>* bounds = nullptr)const
1160</pre>
1161
1162Returns the advance width of <a href='#SkFont_measureText_text'>text</a>.
1163The advance is the normal distance to move before drawing additional <a href='#SkFont_measureText_text'>text</a>.
1164Returns the bounding box of <a href='#SkFont_measureText_text'>text</a> if <a href='#SkFont_measureText_bounds'>bounds</a> is not nullptr.
1165
1166### Parameters
1167
1168<table>  <tr>    <td><a name='SkFont_measureText_text'><code><strong>text</strong></code></a></td>
1169    <td>character storage encoded with <a href='undocumented#SkTextEncoding'>SkTextEncoding</a></td>
1170  </tr>
1171  <tr>    <td><a name='SkFont_measureText_byteLength'><code><strong>byteLength</strong></code></a></td>
1172    <td>length of character storage in bytes</td>
1173  </tr>
1174  <tr>    <td><a name='SkFont_measureText_encoding'><code><strong>encoding</strong></code></a></td>
1175    <td>one of: <a href='undocumented#SkTextEncoding::kUTF8'>SkTextEncoding::kUTF8</a>, <a href='undocumented#SkTextEncoding::kUTF16'>SkTextEncoding::kUTF16</a>,</td>
1176  </tr>
1177</table>
1178
1179<a href='undocumented#SkTextEncoding::kUTF32'>SkTextEncoding::kUTF32</a>, <a href='undocumented#SkTextEncoding::kGlyphID'>SkTextEncoding::kGlyphID</a>
1180
1181### Parameters
1182
1183<table>  <tr>    <td><a name='SkFont_measureText_bounds'><code><strong>bounds</strong></code></a></td>
1184    <td>returns bounding box relative to (0, 0) if not nullptr</td>
1185  </tr>
1186</table>
1187
1188### Return Value
1189
1190number of <a href='undocumented#Glyph'>glyphs</a> represented by <a href='#SkFont_measureText_text'>text</a> of length <a href='#SkFont_measureText_byteLength'>byteLength</a>
1191
1192### Example
1193
1194<div><fiddle-embed name="882e8e0103048009a25cfc20400492f7"></fiddle-embed></div>
1195
1196### See Also
1197
1198incomplete
1199
1200<a name='SkFont_getPath'></a>
1201
1202---
1203
1204<pre style="padding: 1em 1em 1em 1em; width: 62.5em;background-color: #f0f0f0">
1205bool <a href='#SkFont_getPath'>getPath</a>(uint16_t glyphID, <a href='SkPath_Reference#SkPath'>SkPath</a>* <a href='SkPath_Reference#Path'>path</a>)const
1206</pre>
1207
1208Returns <a href='#SkFont_getPath_path'>path</a> corresponding to <a href='undocumented#Glyph'>glyph</a> outline.
1209If <a href='undocumented#Glyph'>glyph</a> has an outline, copies outline to <a href='#SkFont_getPath_path'>path</a> and returns true.
1210<a href='#SkFont_getPath_path'>path</a> returned may be empty.
1211If <a href='undocumented#Glyph'>glyph</a> is described by a <a href='SkBitmap_Reference#Bitmap'>bitmap</a>, returns false and ignores <a href='#SkFont_getPath_path'>path</a> parameter.
1212
1213### Parameters
1214
1215<table>  <tr>    <td><a name='SkFont_getPath_glyphID'><code><strong>glyphID</strong></code></a></td>
1216    <td>index of <a href='undocumented#Glyph'>glyph</a></td>
1217  </tr>
1218  <tr>    <td><a name='SkFont_getPath_path'><code><strong>path</strong></code></a></td>
1219    <td>pointer to existing <a href='SkPath_Reference#SkPath'>SkPath</a></td>
1220  </tr>
1221</table>
1222
1223### Return Value
1224
1225true if <a href='#SkFont_getPath_glyphID'>glyphID</a> is described by <a href='#SkFont_getPath_path'>path</a>
1226
1227### Example
1228
1229<div><fiddle-embed name="882e8e0103048009a25cfc20400492f7"></fiddle-embed></div>
1230
1231### See Also
1232
1233incomplete
1234
1235<a name='SkFont_getPaths'></a>
1236
1237---
1238
1239<pre style="padding: 1em 1em 1em 1em; width: 62.5em;background-color: #f0f0f0">
1240void <a href='#SkFont_getPaths'>getPaths</a>(const uint16_t glyphIDs[], int count, void (*glyphPathProc) (const <a href='SkPath_Reference#SkPath'>SkPath</a>* pathOrNull,
1241              const <a href='SkMatrix_Reference#SkMatrix'>SkMatrix</a>& mx, void* ctx) , void* ctx)const
1242</pre>
1243
1244Returns <a href='SkPath_Reference#Path'>path</a> corresponding to <a href='undocumented#Glyph'>glyph</a> array.
1245
1246### Parameters
1247
1248<table>  <tr>    <td><a name='SkFont_getPaths_glyphIDs'><code><strong>glyphIDs</strong></code></a></td>
1249    <td>array of <a href='undocumented#Glyph'>glyph</a> indices</td>
1250  </tr>
1251  <tr>    <td><a name='SkFont_getPaths_count'><code><strong>count</strong></code></a></td>
1252    <td>number of <a href='undocumented#Glyph'>glyphs</a></td>
1253  </tr>
1254  <tr>    <td><a name='SkFont_getPaths_glyphPathProc'><code><strong>glyphPathProc</strong></code></a></td>
1255    <td>function returning one <a href='undocumented#Glyph'>glyph</a> description as <a href='SkPath_Reference#Path'>path</a></td>
1256  </tr>
1257  <tr>    <td><a name='SkFont_getPaths_ctx'><code><strong>ctx</strong></code></a></td>
1258    <td>function context</td>
1259  </tr>
1260</table>
1261
1262### Example
1263
1264<div><fiddle-embed name="882e8e0103048009a25cfc20400492f7"></fiddle-embed></div>
1265
1266### See Also
1267
1268incomplete
1269
1270<a name='SkFont_getMetrics'></a>
1271
1272---
1273
1274<pre style="padding: 1em 1em 1em 1em; width: 62.5em;background-color: #f0f0f0">
1275<a href='undocumented#SkScalar'>SkScalar</a> <a href='#SkFont_getMetrics'>getMetrics</a>(<a href='undocumented#SkFontMetrics'>SkFontMetrics</a>* metrics)const
1276</pre>
1277
1278Returns <a href='undocumented#SkFontMetrics'>SkFontMetrics</a> associated with <a href='undocumented#SkTypeface'>SkTypeface</a>.
1279The return value is the recommended spacing between <a href='undocumented#Line'>lines</a>: the sum of <a href='#SkFont_getMetrics_metrics'>metrics</a>
1280descent, ascent, and leading.
1281If <a href='#SkFont_getMetrics_metrics'>metrics</a> is not nullptr, <a href='undocumented#SkFontMetrics'>SkFontMetrics</a> is copied to <a href='#SkFont_getMetrics_metrics'>metrics</a>.
1282Results are scaled by <a href='undocumented#Text'>text</a> <a href='undocumented#Size'>size</a> but does not take into account
1283dimensions required by  <a href='undocumented#Text'>text scale</a>,  <a href='undocumented#Text'>text skew</a>, fake bold,
1284style stroke, and <a href='undocumented#SkPathEffect'>SkPathEffect</a>.
1285
1286### Parameters
1287
1288<table>  <tr>    <td><a name='SkFont_getMetrics_metrics'><code><strong>metrics</strong></code></a></td>
1289    <td>storage for <a href='undocumented#SkFontMetrics'>SkFontMetrics</a>; may be nullptr</td>
1290  </tr>
1291</table>
1292
1293### Return Value
1294
1295recommended spacing between <a href='undocumented#Line'>lines</a>
1296
1297### Example
1298
1299<div><fiddle-embed name="882e8e0103048009a25cfc20400492f7"></fiddle-embed></div>
1300
1301### See Also
1302
1303incomplete
1304
1305<a name='SkFont_getSpacing'></a>
1306
1307---
1308
1309<pre style="padding: 1em 1em 1em 1em; width: 62.5em;background-color: #f0f0f0">
1310<a href='undocumented#SkScalar'>SkScalar</a> <a href='#SkFont_getSpacing'>getSpacing</a>()const
1311</pre>
1312
1313Returns the recommended spacing between <a href='undocumented#Line'>lines</a>: the sum of metrics
1314descent, ascent, and leading.
1315Result is scaled by <a href='undocumented#Text'>text</a> <a href='undocumented#Size'>size</a> but does not take into account
1316dimensions required by stroking and <a href='undocumented#SkPathEffect'>SkPathEffect</a>.
1317Returns the same result as <a href='#SkFont_getMetrics'>getMetrics</a>().
1318
1319### Return Value
1320
1321recommended spacing between <a href='undocumented#Line'>lines</a>
1322
1323### Example
1324
1325<div><fiddle-embed name="882e8e0103048009a25cfc20400492f7"></fiddle-embed></div>
1326
1327### See Also
1328
1329incomplete
1330
1331