Storage for a bitmap font.
More...
#include <Font.h>
|
| bool | AddFontFromPath (const OsPath &fontPath) |
| |
| bool | SetFontParams (Renderer::Backend::IDevice *device, const std::string &fontName, float size, float strokeWidth, float scale) |
| |
| void | BlendGlyphBitmapToTexture (const FT_Bitmap &bitmap, int targetX, int targetY, std::uint8_t r, std::uint8_t g, std::uint8_t b) |
| |
| void | BlendGlyphBitmapToTextureRGBA (const FT_Bitmap &bitmap, int targetX, int targetY, std::uint8_t r, std::uint8_t g, std::uint8_t b) |
| |
| void | BlendGlyphBitmapToTextureR8 (const FT_Bitmap &bitmap, int targetX, int targetY) |
| |
| std::optional< CVector2D > | GenerateStrokeGlyphBitmap (const FT_Glyph &glyph, std::uint16_t codepoint, FT_Render_Mode renderMode, const float baselineInAtlas) |
| |
| std::optional< CVector2D > | GenerateGlyphBitmap (FT_Glyph &glyph, std::uint16_t codepoint, FT_Render_Mode renderMode, CVector2D offset, const float baselineInAtlas) |
| |
| const GlyphData * | ExtractAndGenerateGlyph (std::uint16_t codepoint) |
| |
| bool | ConstructAtlasTexture (Renderer::Backend::IDevice *device) |
| |
| Renderer::Backend::Sampler::Desc | ChooseTextureFormatAndSampler () |
| |
Storage for a bitmap font.
Loaded by CFontManager.
◆ UniqueFTFace
◆ UniqueFTStroker
◆ CFont()
| CFont::CFont |
( |
FT_Library |
library, |
|
|
const std::array< float, 256 > & |
gammaCorrection |
|
) |
| |
|
inline |
◆ ~CFont()
◆ AddFontFromPath()
| bool CFont::AddFontFromPath |
( |
const OsPath & |
fontPath | ) |
|
|
private |
◆ BlendGlyphBitmapToTexture()
| void CFont::BlendGlyphBitmapToTexture |
( |
const FT_Bitmap & |
bitmap, |
|
|
int |
targetX, |
|
|
int |
targetY, |
|
|
std::uint8_t |
r, |
|
|
std::uint8_t |
g, |
|
|
std::uint8_t |
b |
|
) |
| |
|
private |
◆ BlendGlyphBitmapToTextureR8()
| void CFont::BlendGlyphBitmapToTextureR8 |
( |
const FT_Bitmap & |
bitmap, |
|
|
int |
targetX, |
|
|
int |
targetY |
|
) |
| |
|
private |
◆ BlendGlyphBitmapToTextureRGBA()
| void CFont::BlendGlyphBitmapToTextureRGBA |
( |
const FT_Bitmap & |
bitmap, |
|
|
int |
targetX, |
|
|
int |
targetY, |
|
|
std::uint8_t |
r, |
|
|
std::uint8_t |
g, |
|
|
std::uint8_t |
b |
|
) |
| |
|
private |
◆ CalculateStringSize()
| void CFont::CalculateStringSize |
( |
const wchar_t * |
string, |
|
|
float & |
w, |
|
|
float & |
h |
|
) |
| |
◆ ChooseTextureFormatAndSampler()
◆ ConstructAtlasTexture()
◆ ExtractAndGenerateGlyph()
| const CFont::GlyphData * CFont::ExtractAndGenerateGlyph |
( |
std::uint16_t |
codepoint | ) |
|
|
private |
◆ ftFaceDeleter()
| static void CFont::ftFaceDeleter |
( |
FT_Face |
face | ) |
|
|
inlinestaticprivate |
◆ ftStrokerDeleter()
| static void CFont::ftStrokerDeleter |
( |
FT_Stroker |
stroker | ) |
|
|
inlinestaticprivate |
◆ GenerateGlyphBitmap()
| std::optional< CVector2D > CFont::GenerateGlyphBitmap |
( |
FT_Glyph & |
glyph, |
|
|
std::uint16_t |
codepoint, |
|
|
FT_Render_Mode |
renderMode, |
|
|
CVector2D |
offset, |
|
|
const float |
baselineInAtlas |
|
) |
| |
|
private |
◆ GenerateStrokeGlyphBitmap()
| std::optional< CVector2D > CFont::GenerateStrokeGlyphBitmap |
( |
const FT_Glyph & |
glyph, |
|
|
std::uint16_t |
codepoint, |
|
|
FT_Render_Mode |
renderMode, |
|
|
const float |
baselineInAtlas |
|
) |
| |
|
private |
◆ GetCapHeight()
| float CFont::GetCapHeight |
( |
| ) |
|
In typography, cap height is the height of a capital letter above the baseline for a particular typeface.
It specifically is the height of capital letters that are flat—such as H or I—as opposed to round letters such as O, or pointed letters like A, both of which may display overshoot. The height of the small letters is the x-height. REf: https://en.wikipedia.org/wiki/Cap_height
◆ GetCharacterWidth()
| float CFont::GetCharacterWidth |
( |
wchar_t |
c | ) |
|
◆ GetGlyph()
◆ GetGlyphBounds()
| void CFont::GetGlyphBounds |
( |
float & |
x0, |
|
|
float & |
y0, |
|
|
float & |
x1, |
|
|
float & |
y1 |
|
) |
| const |
|
inline |
◆ GetHeight()
| float CFont::GetHeight |
( |
| ) |
const |
◆ GetStrokeWidth()
| float CFont::GetStrokeWidth |
( |
| ) |
const |
|
inline |
◆ GetTexture()
◆ HasRGB()
| bool CFont::HasRGB |
( |
| ) |
const |
|
inline |
◆ InitalizeAtlasTextureIfNeeded()
◆ MOVABLE()
◆ NONCOPYABLE()
| CFont::NONCOPYABLE |
( |
CFont |
| ) |
|
◆ SetFontParams()
| bool CFont::SetFontParams |
( |
Renderer::Backend::IDevice * |
device, |
|
|
const std::string & |
fontName, |
|
|
float |
size, |
|
|
float |
strokeWidth, |
|
|
float |
scale |
|
) |
| |
|
private |
◆ UploadAtlasTextureToGPU()
◆ CFontManager
◆ m_AtlasHeight
◆ m_AtlasPadding
| int CFont::m_AtlasPadding |
|
private |
◆ m_AtlasSize
| int CFont::m_AtlasSize {0} |
|
private |
◆ m_AtlasWidth
◆ m_AtlasX
◆ m_AtlasY
◆ m_Bounds
◆ m_Faces
◆ m_FontName
| std::string CFont::m_FontName |
|
private |
◆ m_FontsData
| std::vector<std::unique_ptr<std::uint8_t[], AlignedDeleter> > CFont::m_FontsData |
|
private |
◆ m_FontSize
| float CFont::m_FontSize {0.0f} |
|
private |
◆ m_FreeType
| FT_Library CFont::m_FreeType |
|
private |
◆ m_GammaCorrectionLUT
| std::reference_wrapper<const std::array<float, 256> > CFont::m_GammaCorrectionLUT |
|
private |
◆ m_Glyphs
◆ m_HasRGB
| bool CFont::m_HasRGB {true} |
|
private |
◆ m_Height
◆ m_IsDirty
| bool CFont::m_IsDirty {false} |
|
private |
◆ m_IsTextureInitialized
| bool CFont::m_IsTextureInitialized {false} |
|
private |
◆ m_Scale
| float CFont::m_Scale {1.0f} |
|
private |
◆ m_Stroker
◆ m_StrokeWidth
| float CFont::m_StrokeWidth {0.0f} |
|
private |
◆ m_TexData
| std::unique_ptr<std::uint8_t[]> CFont::m_TexData |
|
private |
◆ m_Texture
◆ m_TextureFormat
◆ m_TextureFormatStride
| int CFont::m_TextureFormatStride {4} |
|
private |
◆ MINIMAL_FONT_SIZE_ANTIALIASING
| constexpr float CFont::MINIMAL_FONT_SIZE_ANTIALIASING {12.0f} |
|
staticconstexprprivate |
Some fonts are not rendered well at small sizes, so we set a minimum size.
Because we are using a bitmap blending mode, when a font is using small size, We need to use a different render mode, one with less antialiasing.
The documentation for this class was generated from the following files:
- /home/jenkins/jenkins/workspace/technical-docs/source/graphics/Font.h
- /home/jenkins/jenkins/workspace/technical-docs/source/graphics/Font.cpp