Flutter Engine
The Flutter Engine
Public Member Functions | List of all members
SkLanguage Class Reference

#include <SkFontMgr_android_parser.h>

Public Member Functions

 SkLanguage ()
 
 SkLanguage (const SkString &tag)
 
 SkLanguage (const char *tag)
 
 SkLanguage (const char *tag, size_t len)
 
 SkLanguage (const SkLanguage &)=default
 
SkLanguageoperator= (const SkLanguage &)=default
 
const SkStringgetTag () const
 
SkLanguage getParent () const
 
bool operator== (const SkLanguage &b) const
 
bool operator!= (const SkLanguage &b) const
 

Detailed Description

The SkLanguage class represents a human written language, and is used by text draw operations to determine which glyph to draw when drawing characters with variants (ie Han-derived characters).

Definition at line 28 of file SkFontMgr_android_parser.h.

Constructor & Destructor Documentation

◆ SkLanguage() [1/5]

SkLanguage::SkLanguage ( )
inline

Definition at line 30 of file SkFontMgr_android_parser.h.

30{ }

◆ SkLanguage() [2/5]

SkLanguage::SkLanguage ( const SkString tag)
inline

Definition at line 31 of file SkFontMgr_android_parser.h.

31: fTag(tag) { }

◆ SkLanguage() [3/5]

SkLanguage::SkLanguage ( const char *  tag)
inline

Definition at line 32 of file SkFontMgr_android_parser.h.

32: fTag(tag) { }

◆ SkLanguage() [4/5]

SkLanguage::SkLanguage ( const char *  tag,
size_t  len 
)
inline

Definition at line 33 of file SkFontMgr_android_parser.h.

33: fTag(tag, len) { }

◆ SkLanguage() [5/5]

SkLanguage::SkLanguage ( const SkLanguage )
default

Member Function Documentation

◆ getParent()

SkLanguage SkLanguage::getParent ( ) const

Performs BCP 47 fallback to return an SkLanguage one step more general.

Returns
an SkLanguage one step more general

Definition at line 837 of file SkFontMgr_android_parser.cpp.

837 {
838 SkASSERT(!fTag.isEmpty());
839 const char* tag = fTag.c_str();
840
841 // strip off the rightmost "-.*"
842 const char* parentTagEnd = strrchr(tag, '-');
843 if (parentTagEnd == nullptr) {
844 return SkLanguage();
845 }
846 size_t parentTagLen = parentTagEnd - tag;
847 return SkLanguage(tag, parentTagLen);
848}
#define SkASSERT(cond)
Definition: SkAssert.h:116
bool isEmpty() const
Definition: SkString.h:130
const char * c_str() const
Definition: SkString.h:133

◆ getTag()

const SkString & SkLanguage::getTag ( ) const
inline

Gets a BCP 47 language identifier for this SkLanguage.

Returns
a BCP 47 language identifier representing this language

Definition at line 40 of file SkFontMgr_android_parser.h.

40{ return fTag; }

◆ operator!=()

bool SkLanguage::operator!= ( const SkLanguage b) const
inline

Definition at line 50 of file SkFontMgr_android_parser.h.

50 {
51 return fTag != b.fTag;
52 }
static bool b

◆ operator=()

SkLanguage & SkLanguage::operator= ( const SkLanguage )
default

◆ operator==()

bool SkLanguage::operator== ( const SkLanguage b) const
inline

Definition at line 47 of file SkFontMgr_android_parser.h.

47 {
48 return fTag == b.fTag;
49 }

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