16 #include "include/private/base/SkTo.h" 
   17 #include "include/private/base/SkTypeTraits.h" 
   21 #include <type_traits> 
  114     bool isSubpixel()
 const { 
return SkToBool(fFlags & kSubpixel_PrivFlag); }
 
  127     bool isEmbolden()
 const { 
return SkToBool(fFlags & kEmbolden_PrivFlag); }
 
  134     bool isBaselineSnap()
 const { 
return SkToBool(fFlags & kBaselineSnap_PrivFlag); }
 
  296                      SkGlyphID glyphs[], 
int maxGlyphCount) 
const;
 
  320         return this->textToGlyphs(text, byteLength, encoding, 
nullptr, 0);
 
  333                          SkRect* bounds = 
nullptr)
 const {
 
  334         return this->measureText(text, byteLength, encoding, bounds, 
nullptr);
 
  363         this->getWidthsBounds(glyphs, count, widths, bounds, 
nullptr);
 
  368         this->getWidths(glyphs, count, widths);
 
  381         this->getWidthsBounds(glyphs, count, widths, 
nullptr, 
nullptr);
 
  410         this->getWidthsBounds(glyphs, count, 
nullptr, bounds, paint);
 
  421     void getPos(
const SkGlyphID glyphs[], 
int count, SkPoint pos[], SkPoint origin = {0, 0}) 
const;
 
  445                                         const SkPaint* = 
nullptr) 
const;
 
  466                   void (*glyphPathProc)(
const SkPath* pathOrNull, 
const SkMatrix& mx, 
void* ctx),
 
  501         kForceAutoHinting_PrivFlag      = 1 << 0,
 
  502         kEmbeddedBitmaps_PrivFlag       = 1 << 1,
 
  503         kSubpixel_PrivFlag              = 1 << 2,
 
  504         kLinearMetrics_PrivFlag         = 1 << 3,
 
  505         kEmbolden_PrivFlag              = 1 << 4,
 
  506         kBaselineSnap_PrivFlag          = 1 << 5,
 
  509     static constexpr 
unsigned kAllFlags = kForceAutoHinting_PrivFlag
 
  510                                         | kEmbeddedBitmaps_PrivFlag
 
  512                                         | kLinearMetrics_PrivFlag
 
  514                                         | kBaselineSnap_PrivFlag;
 
  524     static_assert(::sk_is_trivially_relocatable<decltype(fTypeface)>::value);
 
  527     bool hasSomeAntiAliasing() 
const;
 
  529     friend class SkFontPriv;
 
  530     friend class SkGlyphRunListPainterCPU;
 
  531     friend class SkStrikeSpec;
 
  532     friend class SkRemoteGlyphCacheTest;
 
SkFontHinting
Definition: SkFontTypes.h:18
 
SkTextEncoding
Definition: SkFontTypes.h:11
 
float SkScalar
Definition: SkScalar.h:14
 
int32_t SkUnichar
32 bit integer to hold a unicode value
Definition: SkTypes.h:167
 
uint16_t SkGlyphID
16 bit unsigned integer to hold a glyph index
Definition: SkTypes.h:171
 
SkFont controls options applied when drawing and measuring text.
Definition: SkFont.h:36
 
bool isBaselineSnap() const
Returns true if baselines will be snapped to pixel positions when the current transformation matrix i...
Definition: SkFont.h:134
 
void getBounds(const SkGlyphID glyphs[], int count, SkRect bounds[], const SkPaint *paint) const
Retrieves the bounds for each glyph in glyphs.
Definition: SkFont.h:408
 
void setSubpixel(bool subpixel)
Requests, but does not require, that glyphs respect sub-pixel positioning.
 
bool isEmbolden() const
Returns true if bold is approximated by increasing the stroke width when creating glyph bitmaps from ...
Definition: SkFont.h:127
 
void getXPos(const SkGlyphID glyphs[], int count, SkScalar xpos[], SkScalar origin=0) const
Retrieves the x-positions for each glyph, beginning at the specified origin.
 
bool getPath(SkGlyphID glyphID, SkPath *path) const
Modifies path to be the outline of the glyph.
 
bool operator!=(const SkFont &font) const
Compares SkFont and font, and returns true if they are not equivalent.
Definition: SkFont.h:95
 
void setScaleX(SkScalar scaleX)
Sets text scale on x-axis.
 
bool operator==(const SkFont &font) const
Compares SkFont and font, and returns true if they are equivalent.
 
void setLinearMetrics(bool linearMetrics)
Requests, but does not require, linearly scalable font and glyph metrics.
 
Edging getEdging() const
Whether edge pixels draw opaque or with partial transparency.
Definition: SkFont.h:181
 
void setTypeface(sk_sp< SkTypeface > tf)
Sets SkTypeface to typeface, decreasing SkRefCnt of the previous SkTypeface.
Definition: SkFont.h:244
 
void getWidths(const SkGlyphID glyphs[], int count, SkScalar widths[], SkRect bounds[]) const
DEPRECATED Retrieves the advance and bounds for each glyph in glyphs.
Definition: SkFont.h:362
 
SkScalar getSize() const
Returns text size in points.
Definition: SkFont.h:216
 
SkScalar measureText(const void *text, size_t byteLength, SkTextEncoding encoding, SkRect *bounds=nullptr) const
Returns the advance width of text.
Definition: SkFont.h:332
 
void getWidths(const SkGlyphID glyphs[], int count, SkScalar widths[], std::nullptr_t) const
Definition: SkFont.h:367
 
SkFont(sk_sp< SkTypeface > typeface, SkScalar size, SkScalar scaleX, SkScalar skewX)
Constructs SkFont with default values with SkTypeface and size in points, horizontal scale,...
 
SkTypeface * getTypeface() const
Returns SkTypeface if set, or nullptr.
Definition: SkFont.h:210
 
void setBaselineSnap(bool baselineSnap)
Requests that baselines be snapped to pixels when the current transformation matrix is axis aligned.
 
void getPos(const SkGlyphID glyphs[], int count, SkPoint pos[], SkPoint origin={0, 0}) const
Retrieves the positions for each glyph, beginning at the specified origin.
 
void setEdging(Edging edging)
Requests, but does not require, that edge pixels draw opaque or with partial transparency.
 
SkFont(sk_sp< SkTypeface > typeface)
Constructs SkFont with default values with SkTypeface.
 
SkFontHinting getHinting() const
Returns level of glyph outline adjustment.
Definition: SkFont.h:195
 
void setSize(SkScalar textSize)
Sets text size in points.
 
bool isForceAutoHinting() const
If true, instructs the font manager to always hint glyphs.
Definition: SkFont.h:102
 
bool isLinearMetrics() const
Returns true if font and glyph metrics are requested to be linearly scalable.
Definition: SkFont.h:120
 
void dump() const
Dumps fields of the font to SkDebugf.
 
bool isEmbeddedBitmaps() const
Returns true if font engine may return glyphs from font bitmaps instead of from outlines.
Definition: SkFont.h:108
 
void getPaths(const SkGlyphID glyphIDs[], int count, void(*glyphPathProc)(const SkPath *pathOrNull, const SkMatrix &mx, void *ctx), void *ctx) const
Returns path corresponding to glyph array.
 
std::vector< SkScalar > getIntercepts(const SkGlyphID glyphs[], int count, const SkPoint pos[], SkScalar top, SkScalar bottom, const SkPaint *=nullptr) const
Returns intervals [start, end] describing lines parallel to the advance that intersect with the glyph...
 
SkFont(sk_sp< SkTypeface > typeface, SkScalar size)
Constructs SkFont with default values with SkTypeface and size in points.
 
sk_sp< SkTypeface > refTypeface() const
Increases SkTypeface SkRefCnt by one.
Definition: SkFont.h:236
 
int countText(const void *text, size_t byteLength, SkTextEncoding encoding) const
Returns number of glyphs represented by text.
Definition: SkFont.h:319
 
SkScalar getScaleX() const
Returns text scale on x-axis.
Definition: SkFont.h:223
 
SkScalar getSkewX() const
Returns text skew on x-axis.
Definition: SkFont.h:230
 
void setSkewX(SkScalar skewX)
Sets text skew on x-axis.
 
bool isSubpixel() const
Returns true if glyphs may be drawn at sub-pixel offsets.
Definition: SkFont.h:114
 
void setForceAutoHinting(bool forceAutoHinting)
Sets whether to always hint glyphs.
 
SkGlyphID unicharToGlyph(SkUnichar uni) const
Returns glyph index for Unicode character.
 
SkScalar getMetrics(SkFontMetrics *metrics) const
Returns SkFontMetrics associated with SkTypeface.
 
SkScalar measureText(const void *text, size_t byteLength, SkTextEncoding encoding, SkRect *bounds, const SkPaint *paint) const
Returns the advance width of text.
 
int textToGlyphs(const void *text, size_t byteLength, SkTextEncoding encoding, SkGlyphID glyphs[], int maxGlyphCount) const
Converts text into glyph indices.
 
void unicharsToGlyphs(const SkUnichar uni[], int count, SkGlyphID glyphs[]) const
 
SkFont makeWithSize(SkScalar size) const
Returns a font with the same attributes of this font, but with the specified size.
 
void setHinting(SkFontHinting hintingLevel)
Sets level of glyph outline adjustment.
 
Edging
Whether edge pixels draw opaque or with partial transparency.
Definition: SkFont.h:40
 
SkScalar getSpacing() const
Returns the recommended spacing between lines: the sum of metrics descent, ascent,...
Definition: SkFont.h:490
 
void setEmbolden(bool embolden)
Increases stroke width when creating glyph bitmaps to approximate a bold typeface.
 
std::true_type sk_is_trivially_relocatable
Definition: SkFont.h:497
 
SkFont()
Constructs SkFont with default values.
 
void setEmbeddedBitmaps(bool embeddedBitmaps)
Requests, but does not require, to use bitmaps in fonts instead of outlines.
 
void getWidthsBounds(const SkGlyphID glyphs[], int count, SkScalar widths[], SkRect bounds[], const SkPaint *paint) const
Retrieves the advance and bounds for each glyph in glyphs.
 
void getWidths(const SkGlyphID glyphs[], int count, SkScalar widths[]) const
Retrieves the advance and bounds for each glyph in glyphs.
Definition: SkFont.h:380
 
SkMatrix holds a 3x3 matrix for transforming coordinates.
Definition: SkMatrix.h:53
 
SkPaint controls options applied when drawing.
Definition: SkPaint.h:44
 
SkPath contain geometry.
Definition: SkPath.h:58
 
The SkTypeface class specifies the typeface and intrinsic style of a font.
Definition: SkTypeface.h:52
 
The metrics of an SkFont.
Definition: SkFontMetrics.h:18
 
SkRect holds four float coordinates describing the upper and lower bounds of a rectangle.
Definition: SkRect.h:582