Ion
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
ion::text Namespace Reference

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 Documentation

Convenience typedef for shared pointer to a BasicBuilder.

Definition at line 81 of file basicbuilder.h.

Convenience typedef for shared pointer to a Builder.

Definition at line 191 of file builder.h.

typedef uint32 ion::text::CharIndex

Typedef for a Unicode index of a character.

Definition at line 35 of file font.h.

Convenience typedef for shared pointer to a CoreTextFont.

Definition at line 69 of file coretextfont.h.

Convenience typedef for shared pointer to a DynamicFontImage.

Definition at line 285 of file fontimage.h.

Convenience typedef for shared pointer to a FontImage.

Definition at line 140 of file fontimage.h.

Convenience typedef for shared pointer to a FontManager.

Definition at line 125 of file fontmanager.h.

Definition at line 38 of file font.h.

Convenience typedef for shared pointer to a FreeTypeFont.

Definition at line 113 of file freetypefont.h.

Definition at line 46 of file layout.h.

Definition at line 47 of file layout.h.

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.

Convenience typedef for shared pointer to an OutlineBuilder.

Definition at line 101 of file outlinebuilder.h.

Convenience typedef for shared pointer to a StaticFontImage.

Definition at line 187 of file fontimage.h.

Enumeration Type Documentation

Alignment enums.

These are used to position text glyphs relative to some point.

Enumerator
kAlignLeft 
kAlignHCenter 
kAlignRight 

Definition at line 54 of file layout.h.

Enumerator
kAlignTop 
kAlignVCenter 
kAlignBaseline 
kAlignBottom 

Definition at line 60 of file layout.h.

Function Documentation

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 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 
)
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 
)
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().