Flutter Engine
txt::FontSkia Class Reference

#include <font_skia.h>

Inheritance diagram for txt::FontSkia:
minikin::MinikinFont

Public Member Functions

 FontSkia (sk_sp< SkTypeface > typeface)
 
 ~FontSkia ()
 
float GetHorizontalAdvance (uint32_t glyph_id, const minikin::MinikinPaint &paint) const override
 
void GetBounds (minikin::MinikinRect *bounds, uint32_t glyph_id, const minikin::MinikinPaint &paint) const override
 
hb_face_t * CreateHarfBuzzFace () const override
 
const std::vector< minikin::FontVariation > & GetAxes () const override
 
const sk_sp< SkTypeface > & GetSkTypeface () const
 
- Public Member Functions inherited from minikin::MinikinFont
 MinikinFont (int32_t uniqueId)
 
virtual ~MinikinFont ()
 
virtual std::shared_ptr< MinikinFontcreateFontWithVariation (const std::vector< FontVariation > &) const
 
int32_t GetUniqueId () const
 

Additional Inherited Members

- Static Public Member Functions inherited from minikin::MinikinFont
static uint32_t MakeTag (char c1, char c2, char c3, char c4)
 

Detailed Description

Definition at line 25 of file font_skia.h.

Constructor & Destructor Documentation

◆ FontSkia()

txt::FontSkia::FontSkia ( sk_sp< SkTypeface >  typeface)
explicit

Definition at line 47 of file font_skia.cc.

References ~FontSkia().

48  : MinikinFont(typeface->uniqueID()), typeface_(std::move(typeface)) {}
MinikinFont(int32_t uniqueId)
Definition: MinikinFont.h:93

◆ ~FontSkia()

txt::FontSkia::~FontSkia ( )
default

Referenced by FontSkia().

Member Function Documentation

◆ CreateHarfBuzzFace()

hb_face_t * txt::FontSkia::CreateHarfBuzzFace ( ) const
overridevirtual

Reimplemented from minikin::MinikinFont.

Definition at line 85 of file font_skia.cc.

85  {
86  return hb_face_create_for_tables(GetTable, typeface_.get(), 0);
87 }

◆ GetAxes()

const std::vector< minikin::FontVariation > & txt::FontSkia::GetAxes ( ) const
overridevirtual

Implements minikin::MinikinFont.

Definition at line 89 of file font_skia.cc.

89  {
90  return variations_;
91 }

◆ GetBounds()

void txt::FontSkia::GetBounds ( minikin::MinikinRect bounds,
uint32_t  glyph_id,
const minikin::MinikinPaint paint 
) const
overridevirtual

Implements minikin::MinikinFont.

Definition at line 71 of file font_skia.cc.

References txt::FontSkia_SetSkiaFont(), minikin::MinikinRect::mBottom, minikin::MinikinRect::mLeft, minikin::MinikinRect::mRight, and minikin::MinikinRect::mTop.

73  {
74  SkFont skFont;
75  uint16_t glyph16 = glyph_id;
76  SkRect skBounds;
77  FontSkia_SetSkiaFont(typeface_, &skFont, paint);
78  skFont.getWidths(&glyph16, 1, NULL, &skBounds);
79  bounds->mLeft = skBounds.fLeft;
80  bounds->mTop = skBounds.fTop;
81  bounds->mRight = skBounds.fRight;
82  bounds->mBottom = skBounds.fBottom;
83 }
static void FontSkia_SetSkiaFont(sk_sp< SkTypeface > typeface, SkFont *skFont, const minikin::MinikinPaint &paint)
Definition: font_skia.cc:52

◆ GetHorizontalAdvance()

float txt::FontSkia::GetHorizontalAdvance ( uint32_t  glyph_id,
const minikin::MinikinPaint paint 
) const
overridevirtual

Implements minikin::MinikinFont.

Definition at line 61 of file font_skia.cc.

References txt::FontSkia_SetSkiaFont().

62  {
63  SkFont skFont;
64  uint16_t glyph16 = glyph_id;
65  SkScalar skWidth;
66  FontSkia_SetSkiaFont(typeface_, &skFont, paint);
67  skFont.getWidths(&glyph16, 1, &skWidth);
68  return skWidth;
69 }
static void FontSkia_SetSkiaFont(sk_sp< SkTypeface > typeface, SkFont *skFont, const minikin::MinikinPaint &paint)
Definition: font_skia.cc:52

◆ GetSkTypeface()

const sk_sp< SkTypeface > & txt::FontSkia::GetSkTypeface ( ) const

Definition at line 93 of file font_skia.cc.

93  {
94  return typeface_;
95 }

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