Flutter Engine
minikin Namespace Reference

Classes

class  CmapCoverage
 
struct  FakedFont
 
struct  Font
 
class  FontCollection
 
class  FontFakery
 
class  FontFamily
 
struct  FontLanguage
 
class  FontLanguageListCache
 
class  FontLanguages
 
class  FontStyle
 
struct  FontVariation
 
class  GraphemeBreak
 
class  HbBlob
 
class  Hyphenator
 
class  HyphenEdit
 
class  ICUTestBase
 
class  Layout
 
struct  LayoutGlyph
 
class  LineBreaker
 
class  LineWidths
 
class  MinikinFont
 
class  MinikinFontForTest
 
struct  MinikinPaint
 
struct  MinikinRect
 
class  SparseBitSet
 
class  WordBreaker
 

Typedefs

typedef uint32_t AxisTag
 
typedef void(* MinikinDestroyFunc) (void *data)
 

Enumerations

enum  FontVariant {
  VARIANT_DEFAULT = 0,
  VARIANT_COMPACT = 1,
  VARIANT_ELEGANT = 2
}
 
enum  HyphenationType : uint8_t {
  HyphenationType::DONT_BREAK = 0,
  HyphenationType::BREAK_AND_INSERT_HYPHEN = 1,
  HyphenationType::BREAK_AND_INSERT_ARMENIAN_HYPHEN = 2,
  HyphenationType::BREAK_AND_INSERT_MAQAF = 3,
  HyphenationType::BREAK_AND_INSERT_UCAS_HYPHEN = 4,
  HyphenationType::BREAK_AND_DONT_INSERT_HYPHEN = 5,
  HyphenationType::BREAK_AND_REPLACE_WITH_HYPHEN = 6,
  HyphenationType::BREAK_AND_INSERT_HYPHEN_AT_NEXT_LINE = 7,
  HyphenationType::BREAK_AND_INSERT_HYPHEN_AND_ZWJ = 8
}
 
enum  {
  kBidi_LTR = 0,
  kBidi_RTL = 1,
  kBidi_Default_LTR = 2,
  kBidi_Default_RTL = 3,
  kBidi_Force_LTR = 4,
  kBidi_Force_RTL = 5,
  kBidi_Mask = 0x7
}
 
enum  BreakStrategy {
  kBreakStrategy_Greedy = 0,
  kBreakStrategy_HighQuality = 1,
  kBreakStrategy_Balanced = 2
}
 
enum  HyphenationFrequency {
  kHyphenationFrequency_None = 0,
  kHyphenationFrequency_Normal = 1,
  kHyphenationFrequency_Full = 2
}
 
enum  MinikinPaintFlags { LinearTextFlag = 0x40 }
 

Functions

bool isEmoji (uint32_t c)
 
bool isEmojiBase (uint32_t c)
 
bool isEmojiModifier (uint32_t c)
 
UCharDirection emojiBidiOverride (const void *context, UChar32 c)
 
android::hash_t hash_type (const FontStyle &style)
 
bool analyzeStyle (const uint8_t *os2_data, size_t os2_size, int *weight, bool *italic)
 
void analyzeAxes (const uint8_t *fvar_data, size_t fvar_size, std::unordered_set< uint32_t > *axes)
 
void purgeHbFontCacheLocked ()
 
void purgeHbFontLocked (const MinikinFont *minikinFont)
 
hb_font_t * getHbFontLocked (const MinikinFont *minikinFont)
 
bool isWordSpace (uint16_t code_unit)
 
size_t getPrevWordBreakForCache (const uint16_t *chars, size_t offset, size_t len)
 
size_t getNextWordBreakForCache (const uint16_t *chars, size_t offset, size_t len)
 
bool isLineEndSpace (uint16_t c)
 
float getRunAdvance (const float *advances, const uint16_t *buf, size_t start, size_t count, size_t offset)
 
size_t getOffsetForAdvance (const float *advances, const uint16_t *buf, size_t start, size_t count, float advance)
 
void assertMinikinLocked ()
 
hb_blob_t * getFontTable (const MinikinFont *minikinFont, uint32_t tag)
 
std::vector< std::shared_ptr< FontFamily > > getFontFamilies (const char *fontDir, const char *fontXml)
 
std::shared_ptr< FontCollectiongetFontCollection (const char *fontDir, const char *fontXml)
 
void ParseUnicode (uint16_t *buf, size_t buf_size, const char *src, size_t *result_size, size_t *offset)
 
std::vector< uint16_t > parseUnicodeStringWithOffset (const std::string &in, size_t *offset)
 
std::vector< uint16_t > parseUnicodeString (const std::string &in)
 
std::vector< uint16_t > utf8ToUtf16 (const std::string &text)
 

Variables

const size_t FONT_LANGUAGES_LIMIT = 12
 
const uint16_t INVALID_CODE = 0x7fff
 
std::recursive_mutex gMinikinLock
 
constexpr uint32_t MAX_UNICODE_CODE_POINT = 0x10FFFF
 

Detailed Description

A wrapper around ICU's line break iterator, that gives customized line break opportunities, as well as identifying words for the purpose of hyphenation.

Typedef Documentation

◆ AxisTag

typedef uint32_t minikin::AxisTag

Definition at line 112 of file FontFamily.h.

◆ MinikinDestroyFunc

typedef void(* minikin::MinikinDestroyFunc) (void *data)

Definition at line 89 of file MinikinFont.h.

Enumeration Type Documentation

◆ anonymous enum

anonymous enum
Enumerator
kBidi_LTR 
kBidi_RTL 
kBidi_Default_LTR 
kBidi_Default_RTL 
kBidi_Force_LTR 
kBidi_Force_RTL 
kBidi_Mask 

Definition at line 49 of file Layout.h.

◆ BreakStrategy

Enumerator
kBreakStrategy_Greedy 
kBreakStrategy_HighQuality 
kBreakStrategy_Balanced 

Definition at line 40 of file LineBreaker.h.

◆ FontVariant

Enumerator
VARIANT_DEFAULT 
VARIANT_COMPACT 
VARIANT_ELEGANT 

Definition at line 81 of file FontFamily.h.

◆ HyphenationFrequency

Enumerator
kHyphenationFrequency_None 
kHyphenationFrequency_Normal 
kHyphenationFrequency_Full 

Definition at line 46 of file LineBreaker.h.

◆ HyphenationType

enum minikin::HyphenationType : uint8_t
strong
Enumerator
DONT_BREAK 
BREAK_AND_INSERT_HYPHEN 
BREAK_AND_INSERT_ARMENIAN_HYPHEN 
BREAK_AND_INSERT_MAQAF 
BREAK_AND_INSERT_UCAS_HYPHEN 
BREAK_AND_DONT_INSERT_HYPHEN 
BREAK_AND_REPLACE_WITH_HYPHEN 
BREAK_AND_INSERT_HYPHEN_AT_NEXT_LINE 
BREAK_AND_INSERT_HYPHEN_AND_ZWJ 

Definition at line 35 of file Hyphenator.h.

35  : uint8_t {
36  // Note: There are implicit assumptions scattered in the code that DONT_BREAK
37  // is 0.
38 
39  // Do not break.
40  DONT_BREAK = 0,
41  // Break the line and insert a normal hyphen.
43  // Break the line and insert an Armenian hyphen (U+058A).
45  // Break the line and insert a maqaf (Hebrew hyphen, U+05BE).
47  // Break the line and insert a Canadian Syllabics hyphen (U+1400).
49  // Break the line, but don't insert a hyphen. Used for cases when there is
50  // already a hyphen
51  // present or the script does not use a hyphen (e.g. in Malayalam).
53  // Break and replace the last code unit with hyphen. Used for Catalan "l·l"
54  // which hyphenates
55  // as "l-/l".
57  // Break the line, and repeat the hyphen (which is the last character) at the
58  // beginning of the
59  // next line. Used in Polish, where "czerwono-niebieska" should hyphenate as
60  // "czerwono-/-niebieska".
62  // Break the line, insert a ZWJ and hyphen at the first line, and a ZWJ at the
63  // second line.
64  // This is used in Arabic script, mostly for writing systems of Central Asia.
65  // It's our default
66  // behavior when a soft hyphen is used in Arabic script.
68 };

◆ MinikinPaintFlags

Enumerator
LinearTextFlag 

Definition at line 65 of file MinikinFont.h.

65  {
66  LinearTextFlag = 0x40,
67 };

Function Documentation

◆ analyzeAxes()

void minikin::analyzeAxes ( const uint8_t *  fvar_data,
size_t  fvar_size,
std::unordered_set< uint32_t > *  axes 
)

◆ analyzeStyle()

bool minikin::analyzeStyle ( const uint8_t *  os2_data,
size_t  os2_size,
int *  weight,
bool *  italic 
)

◆ assertMinikinLocked()

void minikin::assertMinikinLocked ( )

◆ emojiBidiOverride()

UCharDirection minikin::emojiBidiOverride ( const void *  context,
UChar32  c 
)

◆ getFontCollection()

std::shared_ptr<FontCollection> minikin::getFontCollection ( const char *  fontDir,
const char *  fontXml 
)

Returns FontCollection from installed fonts.

This function reads an XML file and makes font families and collections of them. MinikinFontForTest is used for FontFamily creation.

Caller must unref the returned pointer.

◆ getFontFamilies()

std::vector<std::shared_ptr<FontFamily> > minikin::getFontFamilies ( const char *  fontDir,
const char *  fontXml 
)

Returns list of FontFamily from installed fonts.

This function reads an XML file and makes font families.

Caller must unref the returned pointer.

◆ getFontTable()

hb_blob_t* minikin::getFontTable ( const MinikinFont minikinFont,
uint32_t  tag 
)

◆ getHbFontLocked()

hb_font_t* minikin::getHbFontLocked ( const MinikinFont minikinFont)

◆ getNextWordBreakForCache()

size_t minikin::getNextWordBreakForCache ( const uint16_t *  chars,
size_t  offset,
size_t  len 
)

Return offset of next word break. It is either > offset or == len.

For the purpose of layout, a word break is a boundary with no kerning or complex script processing. This is necessarily a heuristic, but should be accurate most of the time.

◆ getOffsetForAdvance()

size_t minikin::getOffsetForAdvance ( const float *  advances,
const uint16_t *  buf,
size_t  start,
size_t  count,
float  advance 
)

◆ getPrevWordBreakForCache()

size_t minikin::getPrevWordBreakForCache ( const uint16_t *  chars,
size_t  offset,
size_t  len 
)

Return offset of previous word break. It is either < offset or == 0.

For the purpose of layout, a word break is a boundary with no kerning or complex script processing. This is necessarily a heuristic, but should be accurate most of the time.

◆ getRunAdvance()

float minikin::getRunAdvance ( const float *  advances,
const uint16_t *  buf,
size_t  start,
size_t  count,
size_t  offset 
)

◆ hash_type()

android::hash_t minikin::hash_type ( const FontStyle style)
inline

Definition at line 87 of file FontFamily.h.

References minikin::FontStyle::hash().

87  {
88  return style.hash();
89 }

◆ isEmoji()

bool minikin::isEmoji ( uint32_t  c)

◆ isEmojiBase()

bool minikin::isEmojiBase ( uint32_t  c)

◆ isEmojiModifier()

bool minikin::isEmojiModifier ( uint32_t  c)

◆ isLineEndSpace()

bool minikin::isLineEndSpace ( uint16_t  c)

◆ isWordSpace()

bool minikin::isWordSpace ( uint16_t  code_unit)

◆ ParseUnicode()

void minikin::ParseUnicode ( uint16_t *  buf,
size_t  buf_size,
const char *  src,
size_t *  result_size,
size_t *  offset 
)

◆ parseUnicodeString()

std::vector<uint16_t> minikin::parseUnicodeString ( const std::string &  in)

◆ parseUnicodeStringWithOffset()

std::vector<uint16_t> minikin::parseUnicodeStringWithOffset ( const std::string &  in,
size_t *  offset 
)

◆ purgeHbFontCacheLocked()

void minikin::purgeHbFontCacheLocked ( )

◆ purgeHbFontLocked()

void minikin::purgeHbFontLocked ( const MinikinFont minikinFont)

◆ utf8ToUtf16()

std::vector<uint16_t> minikin::utf8ToUtf16 ( const std::string &  text)

Variable Documentation

◆ FONT_LANGUAGES_LIMIT

const size_t minikin::FONT_LANGUAGES_LIMIT = 12

Definition at line 29 of file FontLanguage.h.

◆ gMinikinLock

std::recursive_mutex minikin::gMinikinLock

◆ INVALID_CODE

const uint16_t minikin::INVALID_CODE = 0x7fff

Definition at line 32 of file FontLanguage.h.

Referenced by minikin::FontLanguage::isUnsupported().

◆ MAX_UNICODE_CODE_POINT

constexpr uint32_t minikin::MAX_UNICODE_CODE_POINT = 0x10FFFF

Definition at line 41 of file MinikinInternal.h.