Flutter Engine
The Flutter Engine
Loading...
Searching...
No Matches
Private Member Functions | Friends | List of all members
SkUserTypeface Class Referencefinal
Inheritance diagram for SkUserTypeface:
SkTypeface SkWeakRefCnt SkRefCnt SkRefCntBase

Private Member Functions

std::unique_ptr< SkScalerContextonCreateScalerContext (const SkScalerContextEffects &, const SkDescriptor *desc) const override
 
void onFilterRec (SkScalerContextRec *rec) const override
 
void getGlyphToUnicodeMap (SkUnichar *glyphToUnicode) const override
 
std::unique_ptr< SkAdvancedTypefaceMetricsonGetAdvancedMetrics () const override
 
void onGetFontDescriptor (SkFontDescriptor *desc, bool *isLocal) const override
 
void onCharsToGlyphs (const SkUnichar *chars, int count, SkGlyphID glyphs[]) const override
 
void onGetFamilyName (SkString *familyName) const override
 
bool onGetPostScriptName (SkString *) const override
 
SkTypeface::LocalizedStringsonCreateFamilyNameIterator () const override
 
std::unique_ptr< SkStreamAssetonOpenStream (int *) const override
 
std::unique_ptr< SkStreamAssetonOpenExistingStream (int *) const override
 
sk_sp< SkTypefaceonMakeClone (const SkFontArguments &args) const override
 
int onCountGlyphs () const override
 
int onGetUPEM () const override
 
bool onComputeBounds (SkRect *bounds) const override
 
void getPostScriptGlyphNames (SkString *) const override
 
bool onGlyphMaskNeedsCurrentColor () const override
 
int onGetVariationDesignPosition (SkFontArguments::VariationPosition::Coordinate[], int) const override
 
int onGetVariationDesignParameters (SkFontParameters::Variation::Axis[], int) const override
 
int onGetTableTags (SkFontTableTag tags[]) const override
 
size_t onGetTableData (SkFontTableTag, size_t, size_t, void *) const override
 

Friends

class SkCustomTypefaceBuilder
 
class SkUserScalerContext
 

Additional Inherited Members

- Public Types inherited from SkTypeface
enum class  SerializeBehavior { kDoIncludeData , kDontIncludeData , kIncludeDataIfLocal }
 
using FactoryId = SkFourByteTag
 
- Public Member Functions inherited from SkTypeface
SkFontStyle fontStyle () const
 
bool isBold () const
 
bool isItalic () const
 
bool isFixedPitch () const
 
int getVariationDesignPosition (SkFontArguments::VariationPosition::Coordinate coordinates[], int coordinateCount) const
 
int getVariationDesignParameters (SkFontParameters::Variation::Axis parameters[], int parameterCount) const
 
SkTypefaceID uniqueID () const
 
sk_sp< SkTypefacemakeClone (const SkFontArguments &) const
 
void serialize (SkWStream *, SerializeBehavior=SerializeBehavior::kIncludeDataIfLocal) const
 
sk_sp< SkDataserialize (SerializeBehavior=SerializeBehavior::kIncludeDataIfLocal) const
 
void unicharsToGlyphs (const SkUnichar uni[], int count, SkGlyphID glyphs[]) const
 
int textToGlyphs (const void *text, size_t byteLength, SkTextEncoding encoding, SkGlyphID glyphs[], int maxGlyphCount) const
 
SkGlyphID unicharToGlyph (SkUnichar unichar) const
 
int countGlyphs () const
 
int countTables () const
 
int getTableTags (SkFontTableTag tags[]) const
 
size_t getTableSize (SkFontTableTag) const
 
size_t getTableData (SkFontTableTag tag, size_t offset, size_t length, void *data) const
 
sk_sp< SkDatacopyTableData (SkFontTableTag tag) const
 
int getUnitsPerEm () const
 
bool getKerningPairAdjustments (const SkGlyphID glyphs[], int count, int32_t adjustments[]) const
 
LocalizedStringscreateFamilyNameIterator () const
 
void getFamilyName (SkString *name) const
 
bool getPostScriptName (SkString *name) const
 
std::unique_ptr< SkStreamAssetopenStream (int *ttcIndex) const
 
std::unique_ptr< SkStreamAssetopenExistingStream (int *ttcIndex) const
 
std::unique_ptr< SkScalerContextcreateScalerContext (const SkScalerContextEffects &, const SkDescriptor *) const
 
SkRect getBounds () const
 
void filterRec (SkScalerContextRec *rec) const
 
void getFontDescriptor (SkFontDescriptor *desc, bool *isLocal) const
 
void * internal_private_getCTFontRef () const
 
- Public Member Functions inherited from SkWeakRefCnt
 SkWeakRefCnt ()
 
 ~SkWeakRefCnt () override
 
bool try_ref () const
 
void weak_ref () const
 
void weak_unref () const
 
bool weak_expired () const
 
- Public Member Functions inherited from SkRefCntBase
 SkRefCntBase ()
 
virtual ~SkRefCntBase ()
 
bool unique () const
 
void ref () const
 
void unref () const
 
- Static Public Member Functions inherited from SkTypeface
static bool Equal (const SkTypeface *facea, const SkTypeface *faceb)
 
static sk_sp< SkTypefaceMakeEmpty ()
 
static sk_sp< SkTypefaceMakeDeserialize (SkStream *, sk_sp< SkFontMgr > lastResortMgr)
 
static void Register (FactoryId id, sk_sp< SkTypeface >(*make)(std::unique_ptr< SkStreamAsset >, const SkFontArguments &))
 
- Protected Member Functions inherited from SkTypeface
 SkTypeface (const SkFontStyle &style, bool isFixedPitch=false)
 
 ~SkTypeface () override
 
void setIsFixedPitch (bool isFixedPitch)
 
void setFontStyle (SkFontStyle style)
 
virtual bool onGetKerningPairAdjustments (const SkGlyphID glyphs[], int count, int32_t adjustments[]) const
 
virtual sk_sp< SkDataonCopyTableData (SkFontTableTag) const
 
virtual void * onGetCTFontRef () const
 
- Protected Member Functions inherited from SkWeakRefCnt
virtual void weak_dispose () const
 

Detailed Description

Definition at line 83 of file SkCustomTypeface.cpp.

Member Function Documentation

◆ getGlyphToUnicodeMap()

void SkUserTypeface::getGlyphToUnicodeMap ( SkUnichar glyphToUnicode) const
overrideprivatevirtual

Implements SkTypeface.

Definition at line 206 of file SkCustomTypeface.cpp.

206 {
207 for (int gid = 0; gid < this->glyphCount(); ++gid) {
208 glyphToUnicode[gid] = SkTo<SkUnichar>(gid);
209 }
210}

◆ getPostScriptGlyphNames()

void SkUserTypeface::getPostScriptGlyphNames ( SkString ) const
inlineoverrideprivatevirtual

Implements SkTypeface.

Definition at line 130 of file SkCustomTypeface.cpp.

130{}

◆ onCharsToGlyphs()

void SkUserTypeface::onCharsToGlyphs ( const SkUnichar chars,
int  count,
SkGlyphID  glyphs[] 
) const
overrideprivatevirtual

Implements SkTypeface.

Definition at line 221 of file SkCustomTypeface.cpp.

221 {
222 for (int i = 0; i < count; ++i) {
223 glyphs[i] = chars[i] < this->glyphCount() ? SkTo<SkGlyphID>(chars[i]) : 0;
224 }
225}
uint16_t glyphs[5]
int count

◆ onComputeBounds()

bool SkUserTypeface::onComputeBounds ( SkRect bounds) const
inlineoverrideprivatevirtual

Reimplemented from SkTypeface.

Definition at line 123 of file SkCustomTypeface.cpp.

123 {
124 bounds->setLTRB(fMetrics.fXMin, fMetrics.fTop, fMetrics.fXMax, fMetrics.fBottom);
125 return true;
126 }
Optional< SkRect > bounds
Definition SkRecords.h:189
SkScalar fTop
greatest extent above origin of any glyph bounding box, typically negative; deprecated with variable ...
SkScalar fBottom
greatest extent below origin of any glyph bounding box, typically positive; deprecated with variable ...
SkScalar fXMin
greatest extent to left of origin of any glyph bounding box, typically negative; deprecated with vari...
SkScalar fXMax
greatest extent to right of origin of any glyph bounding box, typically positive; deprecated with var...

◆ onCountGlyphs()

int SkUserTypeface::onCountGlyphs ( ) const
inlineoverrideprivatevirtual

Implements SkTypeface.

Definition at line 121 of file SkCustomTypeface.cpp.

121{ return this->glyphCount(); }

◆ onCreateFamilyNameIterator()

SkTypeface::LocalizedStrings * SkUserTypeface::onCreateFamilyNameIterator ( ) const
overrideprivatevirtual

Returns an iterator over the family names in the font.

Implements SkTypeface.

Definition at line 235 of file SkCustomTypeface.cpp.

235 {
236 return nullptr;
237}

◆ onCreateScalerContext()

std::unique_ptr< SkScalerContext > SkUserTypeface::onCreateScalerContext ( const SkScalerContextEffects effects,
const SkDescriptor desc 
) const
overrideprivatevirtual

Implements SkTypeface.

Definition at line 352 of file SkCustomTypeface.cpp.

354{
355 return std::make_unique<SkUserScalerContext>(
356 sk_ref_sp(const_cast<SkUserTypeface*>(this)), effects, desc);
357}
sk_sp< T > sk_ref_sp(T *obj)
Definition SkRefCnt.h:381

◆ onFilterRec()

void SkUserTypeface::onFilterRec ( SkScalerContextRec rec) const
overrideprivatevirtual

Implements SkTypeface.

Definition at line 202 of file SkCustomTypeface.cpp.

202 {
204}
@ kNone
glyph outlines unchanged
void setHinting(SkFontHinting)

◆ onGetAdvancedMetrics()

std::unique_ptr< SkAdvancedTypefaceMetrics > SkUserTypeface::onGetAdvancedMetrics ( ) const
overrideprivatevirtual

Implements SkTypeface.

Definition at line 212 of file SkCustomTypeface.cpp.

212 {
213 return nullptr;
214}

◆ onGetFamilyName()

void SkUserTypeface::onGetFamilyName ( SkString familyName) const
overrideprivatevirtual

Returns the family name of the typeface as known by its font manager. This name may or may not be produced by the family name iterator.

Implements SkTypeface.

Definition at line 227 of file SkCustomTypeface.cpp.

227 {
228 *familyName = "";
229}

◆ onGetFontDescriptor()

void SkUserTypeface::onGetFontDescriptor ( SkFontDescriptor desc,
bool *  isLocal 
) const
overrideprivatevirtual

Implements SkTypeface.

Definition at line 216 of file SkCustomTypeface.cpp.

216 {
218 *isLocal = true;
219}
static constexpr SkTypeface::FactoryId FactoryId

◆ onGetPostScriptName()

bool SkUserTypeface::onGetPostScriptName ( SkString ) const
overrideprivatevirtual

Implements SkTypeface.

Definition at line 231 of file SkCustomTypeface.cpp.

231 {
232 return false;
233}

◆ onGetTableData()

size_t SkUserTypeface::onGetTableData ( SkFontTableTag  ,
size_t  ,
size_t  ,
void *   
) const
inlineoverrideprivatevirtual

Implements SkTypeface.

Definition at line 137 of file SkCustomTypeface.cpp.

137{ return 0; }

◆ onGetTableTags()

int SkUserTypeface::onGetTableTags ( SkFontTableTag  tags[]) const
inlineoverrideprivatevirtual

Implements SkTypeface.

Definition at line 136 of file SkCustomTypeface.cpp.

136{ return 0; }

◆ onGetUPEM()

int SkUserTypeface::onGetUPEM ( ) const
inlineoverrideprivatevirtual

Implements SkTypeface.

Definition at line 122 of file SkCustomTypeface.cpp.

122{ return 2048; /* ?? */ }

◆ onGetVariationDesignParameters()

int SkUserTypeface::onGetVariationDesignParameters ( SkFontParameters::Variation::Axis  [],
int   
) const
inlineoverrideprivatevirtual

Implements SkTypeface.

Definition at line 134 of file SkCustomTypeface.cpp.

135 { return 0; }

◆ onGetVariationDesignPosition()

int SkUserTypeface::onGetVariationDesignPosition ( SkFontArguments::VariationPosition::Coordinate  [],
int   
) const
inlineoverrideprivatevirtual

Implements SkTypeface.

Definition at line 132 of file SkCustomTypeface.cpp.

133 { return 0; }

◆ onGlyphMaskNeedsCurrentColor()

bool SkUserTypeface::onGlyphMaskNeedsCurrentColor ( ) const
inlineoverrideprivatevirtual

Implements SkTypeface.

Definition at line 131 of file SkCustomTypeface.cpp.

131{ return false; }

◆ onMakeClone()

sk_sp< SkTypeface > SkUserTypeface::onMakeClone ( const SkFontArguments args) const
inlineoverrideprivatevirtual

Implements SkTypeface.

Definition at line 118 of file SkCustomTypeface.cpp.

118 {
119 return sk_ref_sp(this);
120 }

◆ onOpenExistingStream()

std::unique_ptr< SkStreamAsset > SkUserTypeface::onOpenExistingStream ( int ) const
inlineoverrideprivatevirtual

Reimplemented from SkTypeface.

Definition at line 116 of file SkCustomTypeface.cpp.

116{ return nullptr; }

◆ onOpenStream()

std::unique_ptr< SkStreamAsset > SkUserTypeface::onOpenStream ( int ttcIndex) const
overrideprivatevirtual

Implements SkTypeface.

Definition at line 368 of file SkCustomTypeface.cpp.

368 {
370
372
373 wstream.write(&fMetrics, sizeof(fMetrics));
374
375 SkFontStyle style = this->fontStyle();
376 wstream.write(&style, sizeof(style));
377
378 wstream.write32(this->glyphCount());
379
380 for (const auto& rec : fGlyphRecs) {
381 wstream.write32(rec.isDrawable() ? GlyphType::kDrawable : GlyphType::kPath);
382
383 wstream.writeScalar(rec.fAdvance);
384
385 wstream.write(&rec.fBounds, sizeof(rec.fBounds));
386
387 auto data = rec.isDrawable()
388 ? rec.fDrawable->serialize()
389 : rec.fPath.serialize();
390
391 const size_t sz = data->size();
392 SkASSERT(SkIsAlign4(sz));
393 wstream.write(&sz, sizeof(sz));
394 wstream.write(data->data(), sz);
395 }
396
397 *ttcIndex = 0;
398 return wstream.detachAsStream();
399}
static constexpr bool SkIsAlign4(T x)
Definition SkAlign.h:20
#define SkASSERT(cond)
Definition SkAssert.h:116
static const char gHeaderString[]
static constexpr size_t kHeaderSize
@ kDrawable
std::unique_ptr< SkStreamAsset > detachAsStream()
Definition SkStream.cpp:876
bool write(const void *buffer, size_t size) override
Definition SkStream.cpp:535
SkFontStyle fontStyle() const
Definition SkTypeface.h:55
bool write32(uint32_t v)
Definition SkStream.h:243
bool writeScalar(SkScalar)
Definition SkStream.cpp:109
DEF_SWITCHES_START aot vmservice shared library Name of the *so containing AOT compiled Dart assets for launching the service isolate vm snapshot data
Definition switches.h:41

Friends And Related Symbol Documentation

◆ SkCustomTypefaceBuilder

friend class SkCustomTypefaceBuilder
friend

Definition at line 85 of file SkCustomTypeface.cpp.

◆ SkUserScalerContext

friend class SkUserScalerContext
friend

Definition at line 86 of file SkCustomTypeface.cpp.


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