18 #ifndef ION_TEXT_FONT_H_
19 #define ION_TEXT_FONT_H_
56 bool IsZeroSize()
const;
75 const std::string&
GetName()
const {
return name_; }
91 const GlyphGrid& GetGlyphGrid(
GlyphIndex glyph_index)
const;
94 void FilterGlyphs(
GlyphSet* glyph_set);
117 virtual const Layout BuildLayout(
const std::string&
text,
124 void CacheSdfGrids(
const GlyphSet& glyph_set);
130 virtual void AddFallbackFont(
const FontPtr& fallback) = 0;
137 Font(
const std::string&
name,
size_t size_in_pixels,
size_t sdf_padding);
152 virtual bool LoadGlyphGrid(
GlyphIndex glyph_index,
173 const std::string name_;
175 const size_t sdf_padding_;
184 DISALLOW_IMPLICIT_CONSTRUCTORS(
Font);
190 #endif // ION_TEXT_FONT_H_
size_t GetSdfPadding() const
Returns the padding value used when generating SDF glyphs from the font.
const size_t size_in_pixels_
Size in pixels.
base::AllocMap< GlyphIndex, GlyphGrid > GlyphMap
Convenience typedef for the map storing GlyphGrid instances.
float line_advance_height
Nominal font-wide line-advance height, in pixels.
bool is_sdf
When a Font is set up for rendering, the pixels are replaced with a signed-distance field (SDF)...
uint32 CharIndex
Typedef for a Unicode index of a character.
size_t GetSizeInPixels() const
Returns the size of the font in pixels.
This struct defines parameters affecting layout of a single text string when passed to BuildLayout()...
Thread-safe abstract base class.
FontMetrics()
The default constructor initializes everything to 0.
base::ReferentPtr< Font >::Type FontPtr
const FontMetrics & GetFontMetrics() const
Returns the FontMetrics for the font.
base::Array2< double > pixels
A Layout instance specifies how glyphs are arranged to form text.
const std::string & GetName() const
Returns the name of the font.
port::Mutex mutex_
Protects shared access to the Allocator and FT_Library.
A grid representing a rendered glyph, with each grid pixel representing pixel coverage in the range (...
A SharedPtr is a smart shared pointer to an instance of some class that implements reference counting...
This struct represents the cumulative metrics for the font.
A Mutex is used to ensure that only one thread or process can access a block of code at one time...
Font is a base class for implementation-specific representations of fonts.