18 #ifndef ION_TEXT_FONTIMAGE_H_
19 #define ION_TEXT_FONTIMAGE_H_
103 const auto& iglyphs = image_data.
glyph_set;
105 std::includes(iglyphs.cbegin(), iglyphs.cend(), glyph_set.cbegin(),
136 const size_t max_image_size_;
180 const ImageData InitImageData(
const std::string& texture_name,
183 const ImageData image_data_;
265 size_t FindContainingImageDataIndexPrefiltered(
const GlyphSet& glyph_set);
269 size_t FindImageDataThatFits(
const GlyphSet& glyph_set);
273 size_t AddImageData(
const GlyphSet& glyph_set);
275 std::unique_ptr<Helper> helper_;
278 bool updates_deferred_;
290 #endif // ION_TEXT_FONTIMAGE_H_
bool IsInvalidReference(const T &value)
IsInvalidReference() returns true if a passed const reference of type T has an address of InvalidRefe...
base::ReferentPtr< StaticFontImage >::Type StaticFontImagePtr
Convenience typedef for shared pointer to a StaticFontImage.
gfx::TexturePtr texture
Font glyph texture.
Type GetType() const
Returns the type of an instance.
TexRectMap texture_rectangle_map
~FontImage() override
The destructor is protected because all base::Referent classes must have protected or private destruc...
const ImageData & FindImageData(const GlyphSet &glyph_set) override
Implements this function to find an existing ImageData that already contains all of the glyphs (prese...
base::ReferentPtr< DynamicFontImage >::Type DynamicFontImagePtr
Convenience typedef for shared pointer to a DynamicFontImage.
const ImageData & GetImageData() const
Returns the single ImageData instance.
size_t FindContainingImageDataIndex(const GlyphSet &glyph_set)
Returns the index of an ImageData instance that contains all of the glyphs (present in the Font) in g...
const ImageData & GetImageData(size_t index) const
Returns the indexed ImageData instance, or an invalid reference if the index is out of range...
Range< 2, float > Range2f
StaticFontImage is a derived FontImage that contains a single ImageData instance that is created by t...
virtual const ImageData & FindImageData(const GlyphSet &glyph_set)=0
Returns a reference to an ImageData instance that best contains the requested glyphs.
~DynamicFontImage() override
GlyphSet glyph_set
Set of glyphs in the image.
Thread-safe abstract base class.
static bool HasGlyph(const ImageData &image_data, GlyphIndex glyph_index)
Convenience function that returns true if an ImageData instance contains a glyph with the given index...
A FontImage contains image and texture coordinate information used to render font glyphs...
void ProcessDeferredUpdates()
Updates internal texture data with any deferred updates.
ImageData(const base::AllocatorPtr &allocator)
FontImage::ImageData functions.
size_t FindImageDataIndex(const GlyphSet &glyph_set)
This is the same as FindImageData(), but instead returns the index of the ImageData, or kInvalidIndex if unsuccessful.
static bool GetTextureCoords(const ImageData &image_data, GlyphIndex glyph_index, math::Range2f *rectangle)
Convenience function that sets rectangle to the texture coordinate rectangle to use for the indexed g...
size_t GetMaxImageSize()
Returns the maximum image size passed to the constructor.
float GetImageDataUsedAreaFraction(size_t index) const
Returns the area covered by glyphs in the indexed ImageData, or 0 if the index is out of range...
The ReadWriteLock class defines a non-promotable lock that is very fast when only readers try to obta...
bool AreUpdatesDeferred() const
Returns whether updates are deferred.
~StaticFontImage() override
FontImage(Type type, const FontPtr &font, size_t max_image_size)
The constructor is passed the type of derived class, the Font to use, and the maximum image size (in ...
base::AllocVector< gfx::Texture::SubImage > SubImageVec
Vector of SubImages to set on textures.
base::AllocMap< GlyphIndex, math::Range2f > TexRectMap
Maps glyph index to a texture coordinate rectangle.
base::ReferentPtr< FontImage >::Type FontImagePtr
Convenience typedef for shared pointer to a FontImage.
const FontPtr & GetFont()
Returns the Font passed to the constructor.
static bool HasAllGlyphs(const ImageData &image_data, const GlyphSet &glyph_set)
Convenience function that returns true if an ImageData instance contains all glyphs in glyph_set...
void EnableDeferredUpdates(bool enable)
Sets whether deferred updates are enabled.
StaticFontImage(const FontPtr &font, size_t max_image_size, const GlyphSet &glyph_set)
The constructor sets up the single ImageData instance to contain glyphs for all the requested glyphs...
const ImageData & FindImageData(const GlyphSet &glyph_sets) override
Implements this function to return the single ImageData instance, whether or not it contains all the ...
FontImage::ImageData image_data
The wrapped ImageData instance.
DynamicFontImage(const FontPtr &font, size_t image_size)
The constructor sets up the DynamicFontImage to use the Font.
Data for each image in the FontImage.
size_t GetImageDataCount() const
Returns the current count of ImageData instances.
This class can be used in place of std::vector to allow an Ion Allocator to be used for memory alloca...
DynamicFontImage is a derived FontImage that may contain any number of ImageData instances.