#include <SkFontPriv.h>
|
static SkMatrix | MakeTextMatrix (SkScalar size, SkScalar scaleX, SkScalar skewX) |
|
static SkMatrix | MakeTextMatrix (const SkFont &font) |
|
static void | ScaleFontMetrics (SkFontMetrics *, SkScalar) |
|
static SkRect | GetFontBounds (const SkFont &) |
|
static SkScalar | ApproximateTransformedTextSize (const SkFont &font, const SkMatrix &matrix, const SkPoint &textLocation) |
|
static bool | IsFinite (const SkFont &font) |
|
static int | CountTextElements (const void *text, size_t byteLength, SkTextEncoding) |
|
static void | GlyphsToUnichars (const SkFont &, const uint16_t glyphs[], int count, SkUnichar[]) |
|
static void | Flatten (const SkFont &, SkWriteBuffer &buffer) |
|
static bool | Unflatten (SkFont *, SkReadBuffer &buffer) |
|
static uint8_t | Flags (const SkFont &font) |
|
Definition at line 20 of file SkFontPriv.h.
◆ ApproximateTransformedTextSize()
Return the approximate largest dimension of typical text when transformed by the matrix.
- Parameters
-
matrix | used to transform size |
textLocation | location of the text prior to matrix transformation. Used if the matrix has perspective. |
- Returns
- typical largest dimension
Definition at line 366 of file SkFont.cpp.
367 {
368 if (!
matrix.hasPerspective()) {
370 } else {
371
375 } else {
376 return -
font.getSize();
377 }
378 }
379}
static bool SkIsFinite(T x, Pack... values)
static bool SkScalarNearlyZero(SkScalar x, SkScalar tolerance=SK_ScalarNearlyZero)
static SkScalar DifferentialAreaScale(const SkMatrix &m, const SkPoint &p)
unsigned useCenter Optional< SkMatrix > matrix
font
Font Metadata and Metrics.
◆ CountTextElements()
int SkFontPriv::CountTextElements |
( |
const void * |
text, |
|
|
size_t |
byteLength, |
|
|
SkTextEncoding |
encoding |
|
) |
| |
|
static |
Definition at line 381 of file SkFont.cpp.
381 {
382 switch (encoding) {
388 return byteLength >> 2;
390 return byteLength >> 1;
391 }
393 return 0;
394}
@ kUTF8
uses bytes to represent UTF-8 or ASCII
@ kUTF16
uses two byte words to represent most of Unicode
@ kUTF32
uses four byte words to represent all of Unicode
@ kGlyphID
uses two byte words to represent glyph indices
SK_SPI int CountUTF16(const uint16_t *utf16, size_t byteLength)
SK_SPI int CountUTF8(const char *utf8, size_t byteLength)
◆ Flags()
static uint8_t SkFontPriv::Flags |
( |
const SkFont & |
font | ) |
|
|
inlinestatic |
◆ Flatten()
Definition at line 48 of file SkFont_serial.cpp.
48 {
53
54 uint32_t packed = 0;
58
62 }
63 if (
font.fScaleX != 1) {
65 }
66 if (
font.fSkewX != 0) {
68 }
71 }
72
76 }
79 }
82 }
85 }
86}
static bool scalar_is_byte(SkScalar x)
Type::kYUV Type::kRGBA() int(0.7 *637)
static const uint8_t buffer[]
◆ GetFontBounds()
Returns the union of bounds of all glyphs. Returned dimensions are computed by font manager from font data, ignoring SkPaint::Hinting. Includes font metrics, but not fake bold or SkPathEffect.
If text size is large, text scale is one, and text skew is zero, returns the bounds as: { SkFontMetrics::fXMin, SkFontMetrics::fTop, SkFontMetrics::fXMax, SkFontMetrics::fBottom }.
- Returns
- union of bounds of all glyphs
Definition at line 354 of file SkFont.cpp.
354 {
356 m.setScale(
font.getSize() *
font.getScaleX(),
font.getSize());
357 m.postSkew(
font.getSkewX(), 0);
358
360
364}
Optional< SkRect > bounds
◆ GlyphsToUnichars()
void SkFontPriv::GlyphsToUnichars |
( |
const SkFont & |
font, |
|
|
const uint16_t |
glyphs[], |
|
|
int |
count, |
|
|
SkUnichar |
text[] |
|
) |
| |
|
static |
Definition at line 396 of file SkFont.cpp.
397 {
399 return;
400 }
401
402 auto typeface =
font.getTypeface();
403 const unsigned numGlyphsInTypeface = typeface->countGlyphs();
405 typeface->getGlyphToUnicodeMap(unichars.get());
406
407 for (
int i = 0; i <
count; ++i) {
409 text[i] = (
id < numGlyphsInTypeface) ? unichars[
id] : 0xFFFD;
410 }
411}
◆ IsFinite()
static bool SkFontPriv::IsFinite |
( |
const SkFont & |
font | ) |
|
|
inlinestatic |
◆ MakeTextMatrix() [1/2]
Definition at line 49 of file SkFontPriv.h.
49 {
51 }
static SkMatrix MakeTextMatrix(SkScalar size, SkScalar scaleX, SkScalar skewX)
◆ MakeTextMatrix() [2/2]
Return a matrix that applies the paint's text values: size, scale, skew
Definition at line 41 of file SkFontPriv.h.
41 {
43 if (skewX) {
45 }
47 }
static SkMatrix Scale(SkScalar sx, SkScalar sy)
◆ ScaleFontMetrics()
Definition at line 336 of file SkFont.cpp.
336 {
352}
SkScalar fTop
greatest extent above origin of any glyph bounding box, typically negative; deprecated with variable ...
SkScalar fLeading
distance to add between lines, typically positive or zero
SkScalar fAvgCharWidth
average character width, zero if unknown
SkScalar fStrikeoutPosition
distance from baseline to bottom of stroke, typically negative
SkScalar fStrikeoutThickness
strikeout thickness
SkScalar fMaxCharWidth
maximum character width, zero if unknown
SkScalar fBottom
greatest extent below origin of any glyph bounding box, typically positive; deprecated with variable ...
SkScalar fAscent
distance to reserve above baseline, typically negative
SkScalar fXHeight
height of lower-case 'x', zero if unknown, typically negative
SkScalar fUnderlineThickness
underline thickness
SkScalar fDescent
distance to reserve below baseline, typically positive
SkScalar fCapHeight
height of an upper-case letter, zero if unknown, typically negative
SkScalar fXMin
greatest extent to left of origin of any glyph bounding box, typically negative; deprecated with vari...
SkScalar fUnderlinePosition
distance from baseline to top of stroke, typically positive
SkScalar fXMax
greatest extent to right of origin of any glyph bounding box, typically positive; deprecated with var...
◆ Unflatten()
Definition at line 88 of file SkFont_serial.cpp.
88 {
89 const uint32_t packed =
buffer.read32();
90
93 } else {
95 }
98 }
101 }
104 }
105
107
109
112 edging = 0;
113 }
115
118 hinting = 0;
119 }
121
123}
@ kFull
modifies glyph outlines for maximum constrast
constexpr uint8_t SkToU8(S x)
@ kSubpixelAntiAlias
glyph positioned in pixel using transparency
◆ kCanonicalTextSizeForPaths
constexpr int SkFontPriv::kCanonicalTextSizeForPaths = 64 |
|
inlinestaticconstexpr |
The documentation for this class was generated from the following files: