28#define BITMAP_FONT_USE_SPANS
33#include "bitmap_font_img.c"
34#include "bitmap_font_desc.c"
38#ifdef BITMAP_FONT_USE_SPANS
44 return codepoint < span.
end;
47 if( ptr !=
end && ptr->start <= aCodepoint )
49 unsigned int index = aCodepoint - ptr->start + ptr->cumulative;
57 return &bitmap_chars[codepoint];
80 const float roundAdjust = ( aGlyph.
maxy - aGlyph.
miny ) - box.
h;
82 box.
y = roundAdjust + topAdjust;
92 return x ? x->
advance * 0.74 : 0.0;
101 float commonOffset = std::numeric_limits<float>::max();
103 int overbarDepth = -1;
104 int braceNesting = 0;
108 if( *chIt ==
'~' && overbarDepth == -1 )
112 if( ++lookahead !=
end && *lookahead ==
'{' )
115 overbarDepth = braceNesting;
120 else if( *chIt ==
'{' )
124 else if( *chIt ==
'}' )
126 if( braceNesting > 0 )
129 if( braceNesting == overbarDepth )
139 || *chIt ==
'-' || *chIt ==
'_' )
141 glyph = defaultGlyph;
145 textSize.
x += glyph->advance;
148 textSize.
y = std::max<float>( textSize.
y, charHeight );
150 textSize.
y -= commonOffset;
152 return std::make_pair( textSize, commonOffset );
uni_iter is a non-mutating iterator that walks through unicode code points in the UTF8 encoded string...
An 8 bit string that is assuredly encoded in UTF8, and supplies special conversion support to and fro...
uni_iter uend() const
Return a uni_iter initialized to the end of "this" UTF8 byte sequence.
uni_iter ubegin() const
Returns a uni_iter initialized to the start of "this" UTF8 byte sequence.
unsigned int GlyphCount()
The number of glyphs in the font, starting at LookupGlyph( '!
std::pair< VECTOR2D, float > ComputeBitmapTextSize(const UTF8 &aText)
Size of a line of text in atlas units, and how far its glyphs sit above their lowest point.
double SpaceAdvance()
How far a space moves the pen.
const FONT_GLYPH_TYPE * LookupGlyph(unsigned int aCodepoint)
FONT_SPAN_TYPE font_codepoint_spans[]
FONT_INFO_TYPE font_information
FONT_GLYPH_TYPE font_codepoint_infos[]
GLYPH_BOX ComputeGlyphBox(const FONT_GLYPH_TYPE &aGlyph)
The Cairo implementation of the graphics abstraction layer.
Where a glyph's quad sits and what it samples, in font units, which are also atlas texels.
float h
size of the quad and of its cell in the atlas
float atlasY
corner of the cell in the atlas, inside its smoothing border
float y
corner of the quad from the pen position
VECTOR2< double > VECTOR2D