Skia
2DGraphicsLibrary
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
SkFont Class Reference
Inheritance diagram for SkFont:
SkRefCnt SkRefCntBase

Public Types

enum  Flags {
  kEnableAutoHints_Flag = 1 << 0, kEnableByteCodeHints_Flag = 1 << 1, kEmbeddedBitmaps_Flag = 1 << 2, kUseNonlinearMetrics_Flag = 1 << 3,
  kVertical_Flag = 1 << 4, kGenA8FromLCD_Flag = 1 << 5, kEmbolden_Flag = 1 << 6, kDevKern_Flag = 1 << 7
}
 
enum  MaskType { kBW_MaskType, kA8_MaskType, kLCD_MaskType }
 

Public Member Functions

sk_sp< SkFontmakeWithSize (SkScalar size) const
 Return a font with the same attributes of this font, but with the specified size. More...
 
sk_sp< SkFontmakeWithFlags (uint32_t newFlags) const
 Return a font with the same attributes of this font, but with the flags.
 
SkTypefacegetTypeface () const
 
SkScalar getSize () const
 
SkScalar getScaleX () const
 
SkScalar getSkewX () const
 
uint32_t getFlags () const
 
MaskType getMaskType () const
 
bool isVertical () const
 
bool isEmbolden () const
 
bool isEnableAutoHints () const
 
bool isEnableByteCodeHints () const
 
bool isUseNonLinearMetrics () const
 
bool isDevKern () const
 
int textToGlyphs (const void *text, size_t byteLength, SkTextEncoding, SkGlyphID glyphs[], int maxGlyphCount) const
 
int countText (const void *text, size_t byteLength, SkTextEncoding encoding)
 
SkScalar measureText (const void *text, size_t byteLength, SkTextEncoding) const
 
- Public Member Functions inherited from SkRefCntBase
 SkRefCntBase ()
 Default construct, initializing the reference count to 1.
 
virtual ~SkRefCntBase ()
 Destruct, asserting that the reference count is 1.
 
int32_t getRefCnt () const
 Return the reference count. More...
 
void validate () const
 
bool unique () const
 May return true if the caller is the only owner. More...
 
void ref () const
 Increment the reference count. More...
 
void unref () const
 Decrement the reference count. More...
 

Static Public Member Functions

static sk_sp< SkFontMake (sk_sp< SkTypeface >, SkScalar size, MaskType, uint32_t flags)
 
static sk_sp< SkFontMake (sk_sp< SkTypeface >, SkScalar size, SkScalar scaleX, SkScalar skewX, MaskType, uint32_t flags)
 
static sk_sp< SkFontTesting_CreateFromPaint (const SkPaint &)
 

Private Types

enum  { kAllFlags = 0xFF }
 

Private Member Functions

 SkFont (sk_sp< SkTypeface >, SkScalar size, SkScalar scaleX, SkScalar skewX, MaskType, uint32_t flags)
 

Private Attributes

sk_sp< SkTypefacefTypeface
 
SkScalar fSize
 
SkScalar fScaleX
 
SkScalar fSkewX
 
uint16_t fFlags
 
uint8_t fMaskType
 

Additional Inherited Members

- Protected Member Functions inherited from SkRefCntBase
void internal_dispose_restore_refcnt_to_1 () const
 Allow subclasses to call this if they've overridden internal_dispose so they can reset fRefCnt before the destructor is called or if they choose not to call the destructor (e.g. More...
 

Member Enumeration Documentation

Enumerator
kEnableAutoHints_Flag 

Use the system's automatic hinting mechanism to hint the typeface.

This is a last resort hinting method applied only if other hinting methods do not apply. TODO: where to put auto-normal vs auto-light?

kEnableByteCodeHints_Flag 

If the typeface contains explicit bytecodes for hinting, use them.

If both bytecode and auto hints are specified, attempt to use the bytecodes first; if that fails (e.g. there are no codes), then attempt to autohint.

kEmbeddedBitmaps_Flag 

If the typeface contains explicit bitmaps for hinting, use them.

If both bytecode and auto hints are also specified, attempt to use the bitmaps first; if that fails (e.g. there are no bitmaps), then attempt to bytecode or autohint.

kUseNonlinearMetrics_Flag 

Use rounded metric values (e.g.

advance). If either auto or bytecode hinting was used, apply those results to the metrics of the glyphs as well. If no hinting was applied, the metrics will just be rounded to the nearest integer.

This applies to calls that return metrics (e.g. measureText) and to drawing the glyphs (see SkCanvas drawText and drawPosText).

Member Function Documentation

sk_sp<SkFont> SkFont::makeWithSize ( SkScalar  size) const

Return a font with the same attributes of this font, but with the specified size.

If size is not supported (e.g. <= 0 or non-finite) NULL will be returned.


The documentation for this class was generated from the following file: