Ion
|
Classes | |
class | BasicBuilder |
BasicBuilder is a derived Builder class that uses a very basic shader to render text. More... | |
class | BinPacker |
This class implements generic 2D bin-packing using a modified version of the Skyline Bottom-Left algorithm available at: http://clb.demon.fi/files/RectangleBinPack. More... | |
class | Builder |
Builder is an abstract base class for building graphics objects used to render text. More... | |
class | CoreTextFont |
This represents a single CoreText font. More... | |
class | Font |
Font is a base class for implementation-specific representations of fonts. More... | |
class | FontImage |
A FontImage contains image and texture coordinate information used to render font glyphs. More... | |
class | StaticFontImage |
StaticFontImage is a derived FontImage that contains a single ImageData instance that is created by the constructor and that cannot be modified afterward. More... | |
class | DynamicFontImage |
DynamicFontImage is a derived FontImage that may contain any number of ImageData instances. More... | |
class | FontManager |
The FontManager provides the main interface for fonts used to create text strings to render. More... | |
class | FreeTypeFont |
This derived Font class represents a FreeType2 font. More... | |
struct | TextSize |
TextSize contains information about the size of multi-line text. More... | |
struct | FreeTypeFontTransformData |
This contains the values needed to transform glyph rectangles into the correct coordinates. More... | |
struct | LayoutOptions |
This struct defines parameters affecting layout of a single text string when passed to BuildLayout(). More... | |
class | Layout |
A Layout instance specifies how glyphs are arranged to form text. More... | |
class | OutlineBuilder |
OutlineBuilder is a derived Builder class that can render text with outlines. More... | |
Typedefs | |
typedef base::ReferentPtr < BasicBuilder >::Type | BasicBuilderPtr |
Convenience typedef for shared pointer to a BasicBuilder. More... | |
typedef base::ReferentPtr < Builder >::Type | BuilderPtr |
Convenience typedef for shared pointer to a Builder. More... | |
typedef base::ReferentPtr < CoreTextFont >::Type | CoreTextFontPtr |
Convenience typedef for shared pointer to a CoreTextFont. More... | |
typedef uint32 | CharIndex |
Typedef for a Unicode index of a character. More... | |
typedef base::ReferentPtr < Font >::Type | FontPtr |
typedef base::ReferentPtr < FontImage >::Type | FontImagePtr |
Convenience typedef for shared pointer to a FontImage. More... | |
typedef base::ReferentPtr < StaticFontImage >::Type | StaticFontImagePtr |
Convenience typedef for shared pointer to a StaticFontImage. More... | |
typedef base::ReferentPtr < DynamicFontImage >::Type | DynamicFontImagePtr |
Convenience typedef for shared pointer to a DynamicFontImage. More... | |
typedef base::ReferentPtr < FontManager >::Type | FontManagerPtr |
Convenience typedef for shared pointer to a FontManager. More... | |
typedef base::ReferentPtr < FreeTypeFont >::Type | FreeTypeFontPtr |
Convenience typedef for shared pointer to a FreeTypeFont. More... | |
typedef std::vector< std::string > | Lines |
Lines of text from a single string (usually split on ' '). More... | |
typedef uint64 | GlyphIndex |
typedef base::AllocSet < GlyphIndex > | GlyphSet |
typedef base::ReferentPtr < OutlineBuilder >::Type | OutlineBuilderPtr |
Convenience typedef for shared pointer to an OutlineBuilder. More... | |
Enumerations | |
enum | HorizontalAlignment { kAlignLeft, kAlignHCenter, kAlignRight } |
Alignment enums. More... | |
enum | VerticalAlignment { kAlignTop, kAlignVCenter, kAlignBaseline, kAlignBottom } |
Functions | |
const TextSize | ComputeTextSize (const FreeTypeFont &font, const LayoutOptions &options, const Lines &lines) |
Computes the size of text and returns it as a TextSize instance. More... | |
const FreeTypeFontTransformData | ComputeTransformData (const Font &font, const LayoutOptions &options, const TextSize &text_size) |
Sets the scale and translation fields of the LayoutData instance with the scale and translation required to transform the glyphs of a text string from canonical glyph coordinates to the correct target size, location, and alignment. More... | |
const Layout | LayOutText (const FreeTypeFont &font, bool use_icu, const Lines &lines, const FreeTypeFontTransformData &transform_data) |
Returns a Layout populated by glyphs representing lines of text. More... | |
std::ostream & | operator<< (std::ostream &out, const Layout::Quad &q) |
Helpers for logging Layouts/Glyphs/Quads. More... | |
std::ostream & | operator<< (std::ostream &out, const Layout::Glyph &g) |
std::ostream & | operator<< (std::ostream &os, const Layout &layout) |
Debugging aids. More... | |
const Grid | ComputeSdfGrid (const Grid &image_grid, size_t padding) |
Public SDF utility functions. More... | |
const base::Array2< double > | ComputeSdfGrid (const base::Array2< double > &image_grid, size_t padding) |
Creates a signed distance field (SDF) grid from a grid representing an antialiased image (such as a font glyph). More... | |
typedef base::ReferentPtr<BasicBuilder>::Type ion::text::BasicBuilderPtr |
Convenience typedef for shared pointer to a BasicBuilder.
Definition at line 81 of file basicbuilder.h.
typedef base::ReferentPtr<Builder>::Type ion::text::BuilderPtr |
typedef uint32 ion::text::CharIndex |
typedef base::ReferentPtr<CoreTextFont>::Type ion::text::CoreTextFontPtr |
Convenience typedef for shared pointer to a CoreTextFont.
Definition at line 69 of file coretextfont.h.
typedef base::ReferentPtr<DynamicFontImage>::Type ion::text::DynamicFontImagePtr |
Convenience typedef for shared pointer to a DynamicFontImage.
Definition at line 285 of file fontimage.h.
typedef base::ReferentPtr<FontImage>::Type ion::text::FontImagePtr |
Convenience typedef for shared pointer to a FontImage.
Definition at line 140 of file fontimage.h.
typedef base::ReferentPtr<FontManager>::Type ion::text::FontManagerPtr |
Convenience typedef for shared pointer to a FontManager.
Definition at line 125 of file fontmanager.h.
typedef base::ReferentPtr<Font>::Type ion::text::FontPtr |
typedef base::ReferentPtr<FreeTypeFont>::Type ion::text::FreeTypeFontPtr |
Convenience typedef for shared pointer to a FreeTypeFont.
Definition at line 113 of file freetypefont.h.
typedef uint64 ion::text::GlyphIndex |
typedef base::AllocSet<GlyphIndex> ion::text::GlyphSet |
typedef std::vector<std::string> ion::text::Lines |
Lines of text from a single string (usually split on '
').
Definition at line 64 of file freetypefontutils.h.
typedef base::ReferentPtr<OutlineBuilder>::Type ion::text::OutlineBuilderPtr |
Convenience typedef for shared pointer to an OutlineBuilder.
Definition at line 101 of file outlinebuilder.h.
typedef base::ReferentPtr<StaticFontImage>::Type ion::text::StaticFontImagePtr |
Convenience typedef for shared pointer to a StaticFontImage.
Definition at line 187 of file fontimage.h.
const base::Array2<double> ion::text::ComputeSdfGrid | ( | const base::Array2< double > & | image_grid, |
size_t | padding | ||
) |
Creates a signed distance field (SDF) grid from a grid representing an antialiased image (such as a font glyph).
The values in the input grid are assumed to be in the range [0,1]. This returns a grid in which each element represents the signed distance from that element to the nearest pixel forming an edge of the image. (Edges are inferred by the algorithm from the antialiased pixel values.) The padding parameter specifies how many pixels are added to the left, right, top, and bottom of the original image so that the distance field can taper off correctly. Output elements are positive outside the foreground of the input image and negative inside it. Output elements have grid-distance as their units, so are bounded in absolute value by sqrt(height^2+width^2) (after padding).
const Grid ion::text::ComputeSdfGrid | ( | const Grid & | image_grid, |
size_t | padding | ||
) |
Public SDF utility functions.
Definition at line 428 of file sdfutils.cc.
Referenced by ion::text::Font::CacheSdfGrids().
const TextSize ion::text::ComputeTextSize | ( | const FreeTypeFont & | font, |
const LayoutOptions & | options, | ||
const Lines & | lines | ||
) |
Computes the size of text and returns it as a TextSize instance.
Widths include spaces at the ends of the text lines, if any.
Definition at line 102 of file freetypefontutils.cc.
References ion::text::FreeTypeFont::GlyphMetrics::bitmap_offset, DCHECK, ion::text::TextSize::first_line_above_baseline, ion::text::FreeTypeFont::GetDefaultGlyphForChar(), ion::text::Font::GetFontMetrics(), ion::text::FreeTypeFont::GetGlyphMetrics(), ion::text::Font::GetSizeInPixels(), ion::base::IsInvalidReference(), ion::base::Utf8Iterator::kInvalidCharIndex, ion::text::Font::FontMetrics::line_advance_height, ion::text::TextSize::line_height_in_pixels, ion::text::LayoutOptions::line_spacing, ion::text::TextSize::line_widths_in_pixels, ion::text::TextSize::rect_size_in_pixels, ion::text::FreeTypeFont::GlyphMetrics::size, ion::text::TextSize::text_height_in_pixels, and width.
Referenced by ion::text::FreeTypeFont::BuildLayout().
const FreeTypeFontTransformData ion::text::ComputeTransformData | ( | const Font & | font, |
const LayoutOptions & | options, | ||
const TextSize & | text_size | ||
) |
Sets the scale and translation fields of the LayoutData instance with the scale and translation required to transform the glyphs of a text string from canonical glyph coordinates to the correct target size, location, and alignment.
Canonical glyph coordinates are in pixels, with the left end of the text baseline at the origin. Transformed coordinates are in the correct locations in the XY-plane. Also sets the line_y_offset field with the canonical translation in y for successive lines of text.
Definition at line 236 of file freetypefontutils.cc.
References DCHECK_GT, ion::text::TextSize::line_height_in_pixels, ion::text::LayoutOptions::line_spacing, ion::text::FreeTypeFontTransformData::line_translations, ion::text::TextSize::line_widths_in_pixels, ion::text::FreeTypeFontTransformData::line_y_offset_in_pixels, ion::text::TextSize::rect_size_in_pixels, ion::text::FreeTypeFontTransformData::scale, and ion::text::LayoutOptions::target_size.
Referenced by ion::text::FreeTypeFont::BuildLayout().
const Layout ion::text::LayOutText | ( | const FreeTypeFont & | font, |
bool | use_icu, | ||
const Lines & | lines, | ||
const FreeTypeFontTransformData & | transform_data | ||
) |
Returns a Layout populated by glyphs representing lines
of text.
Definition at line 578 of file freetypefontutils.cc.
References ion::text::FreeTypeFontTransformData::line_y_offset_in_pixels, ion::text::FreeTypeFontTransformData::scale, and ion::text::Layout::SetLineAdvanceHeight().
Referenced by ion::text::FreeTypeFont::BuildLayout().
std::ostream & ion::text::operator<< | ( | std::ostream & | out, |
const Layout::Quad & | q | ||
) |
Helpers for logging Layouts/Glyphs/Quads.
Definition at line 61 of file layout.cc.
References ion::text::Layout::Quad::points.
std::ostream & ion::text::operator<< | ( | std::ostream & | out, |
const Layout::Glyph & | g | ||
) |
Definition at line 69 of file layout.cc.
References ion::text::Layout::Glyph::glyph_index, and ion::text::Layout::Glyph::quad.
std::ostream & ion::text::operator<< | ( | std::ostream & | os, |
const Layout & | layout | ||
) |
Debugging aids.
Definition at line 73 of file layout.cc.
References ion::text::Layout::GetGlyph(), and ion::text::Layout::GetGlyphCount().