FlatUI
An open source project by FPL.
 All Classes Namespaces Files Functions Variables Enumerations Groups Pages
Font Manager

Classes and methods for handling fonts. More...

Detailed Description

Classes and methods for handling fonts.

Classes

struct  flatui::FontFamily
 A class holding font family information. The class provides various ways to support fonts such as a font collection (multiple fonts in a file), referencing a font by a famly name etc. More...
 
class  flatui::FontBufferParameters
 This class that includes font buffer parameters. It is used as a key in the unordered_map to look up FontBuffer. More...
 
struct  flatui::LinkInfo
 HTML link href, and the location of the link text in FontBuffer. More...
 
class  flatui::FontMetrics
 This class has additional properties for font metrics. More...
 
struct  flatui::FontVertex
 This struct holds all the font vertex data. More...
 
class  flatui::FontBufferAttributes
 A structure holding attribute information of texts in a FontBuffer. More...
 
class  flatui::FontBufferContext
 Temporary buffers used while generating FontBuffer. Word boundary information. This information is used only with a typography layout with a justification. More...
 
struct  flatui::GlyphInfo
 This struct holds the glyph information that is used when re-creating a FontBuffer. More...
 
class  flatui::FontBuffer
 this is used with the texture atlas rendering. More...
 
class  flatui::FontManager
 FontManager manages font rendering with OpenGL utilizing freetype and harfbuzz as a glyph rendering and layout back end. More...
 
struct  flatui::ScriptInfo
 This struct holds the script information used for a text layout. More...
 

Enumerations

enum  flatui::TextLayoutDirection { kTextLayoutDirectionLTR = 0, kTextLayoutDirectionRTL = 1, kTextLayoutDirectionTTB = 2 }
 Specify how to layout texts. Default value is TextLayoutDirectionLTR.
 
enum  flatui::TextAlignment {
  kTextAlignmentLeft = 0, kTextAlignmentRight = 1, kTextAlignmentCenter = 2, kTextAlignmentJustify = 4,
  kTextAlignmentLeftJustify = kTextAlignmentJustify, kTextAlignmentRightJustify = kTextAlignmentJustify | kTextAlignmentRight, kTextAlignmentCenterJustify = kTextAlignmentJustify | kTextAlignmentCenter
}
 Alignment of the text. More...
 
enum  flatui::FontBufferStatus { kFontBufferStatusReady = 0, kFontBufferStatusNeedReconstruct = 1, kFontBufferStatusNeedCacheUpdate = 2 }
 A status of FontBuffer correspoinding current glyph cache contents. Enumerations: More...
 
enum  flatui::EllipsisMode { kEllipsisModeTruncateCharacter = 0, kEllipsisModeTruncateWord = 1 }
 A flag controlling appending behavior of the ellipsis. Enumerations: More...
 

Variables

const int32_t flatui::kFreeTypeUnit = 64
 Constant to convert FreeType unit to pixel unit. More...
 
const float flatui::kLineHeightDefault = 1.2f
 Default value for a line height factor. More...
 
const float flatui::kKerningScaleDefault = 1.0f
 Default value for a kerning scale factor. More...
 
const mathfu::vec2i flatui::kCaretPositionInvalid = mathfu::vec2i(-1, -1)
 A sentinel value representing an invalid caret position.
 
const int32_t flatui::kIndexInvalid = -1
 
const uint32_t flatui::kDefaultColor = 0xffffffff
 
const int32_t flatui::kVerticesPerGlyph = 4
 
const int32_t flatui::kIndicesPerGlyph = 6
 The number of vertices/indices per a glyph entry.
 
const int32_t flatui::kGlyphCacheWidth = 1024
 The default size of the glyph cache width.
 
const int32_t flatui::kGlyphCacheHeight = 1024
 The default size of the glyph cache height.
 
const int32_t flatui::kGlyphCacheMaxSlices = 4
 The default size of the max glyph cache slices. The number of cache slices grows up to the value.
 
const char *const flatui::kDefaultLanguage = "en"
 The default language used for a line break.
 
const char *const flatui::kSystemFont = ".SystemFont"
 A constant to spefify loading a system font. Used with OpenFont() and SelectFont() API Currently the system font is supported on iOS/macOS and Android only.
 
static const HashedId flatui::kSystemFontId = HashId(kSystemFont)
 

Enumeration Type Documentation

A flag controlling appending behavior of the ellipsis. Enumerations:

  • kEllipsisModeTruncateCharacter - Truncate characters to make a space.
  • kEllipsisModeTruncateWord - Truncate whole word to make a space.

A status of FontBuffer correspoinding current glyph cache contents. Enumerations:

  • kFontBufferStatusReady - The font buffer is ready to use.
  • kFontBufferStatusNeedReconstruct - The glyph cache has been flushed.
  • The font buffer needs to be reconstructed.
  • kFontBufferStatusNeedCacheUpdate - The glyph cache texture needs to be
  • uploaded.

Alignment of the text.

Note
: Used for a typographic alignment in a label. The enumeration is different from flatui::Alignment as it supports justification setting. Note that in RTL layout direction mode, the setting is flipped. (e.g. kTextAlignmentLeft becomes kTextAlignmentRight) kTextAlignLeft/Right/CenterJustify variants specify how the last line is flushed left, right or centered.

Enumerations:

  • kTextAlignmentLeft - Text is aligned to the left of the given area. Default setting.
  • kTextAlignmentRight - Text is aligned to the right of the given area.
  • kTextAlignmentCenter - Text is aligned to the center of the given area.
  • kTextAlignmentJustify - Text is 'justified'. Spaces between words are stretched to align both the left and right ends of each line of text.
  • kTextAlignmentLeftJustify - An alias of kTextAlignmentJustify. The last line of a paragraph is aligned to the left.
  • kTextAlignmentRightJustify - Text is 'justified'. The last line of a paragraph is aligned to the right.
  • kTextAlignmentCenterJustify - Text is 'justified'. The last line of a paragraph is aligned to the center.

For more detail of each settings, refer: https://en.wikipedia.org/wiki/Typographic_alignment

Variable Documentation

flatui::kFreeTypeUnit = 64

Constant to convert FreeType unit to pixel unit.

In FreeType & Harfbuzz, the position value unit is 1/64 px whereas configurable in FlatUI. The constant is used to convert FreeType unit to px.

flatui::kKerningScaleDefault = 1.0f

Default value for a kerning scale factor.

The kerning value is derived as the factor * kerning value retrieved from harfbuzz. To change the kerning scale, use SetKerningScale() API.

flatui::kLineHeightDefault = 1.2f

Default value for a line height factor.

The line height is derived as the factor * a font height. To change the line height, use SetLineHeightScale() API.