MCPcopy Create free account
hub / github.com/WolfireGames/overgrowth / RenderCharacterBitmap

Method RenderCharacterBitmap

Source/Graphics/font_renderer.cpp:176–193  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

174}
175
176FT_GlyphSlot FontRendererImpl::RenderCharacterBitmap(int face_id, uint32_t character, FontRenderer::RCB_Flags flags) {
177 FT_Face face = faces_[face_id].face;
178 // Get index of a glyph
179 int glyph_index = FT_Get_Char_Index(face, character);
180 // Load glyph into slot
181 int error = FT_Load_Glyph(face, glyph_index, FT_LOAD_DEFAULT);
182 if (error) {
183 FatalError("Error", "Failed to load font glyph into slot");
184 }
185 // Render glyph in slot
186 if (flags & FontRenderer::RCB_RENDER) {
187 error = FT_Render_Glyph(face->glyph, FT_RENDER_MODE_NORMAL);
188 if (error) {
189 FatalError("Error", "Failed to render glyph");
190 }
191 }
192 return face->glyph;
193}
194
195void FontRendererImpl::GetKerning(int face_id, char character_a, char character_b, FT_Vector *vec) {
196 FT_Face face = faces_[face_id].face;

Callers 6

RenderCharacterToConsoleFunction · 0.80
RenderTextMethod · 0.80
GetLetterPosXYMethod · 0.80
GetCursorPosMethod · 0.80
PackMethod · 0.80
CreateMethod · 0.80

Calls 4

FT_Get_Char_IndexFunction · 0.85
FT_Load_GlyphFunction · 0.85
FT_Render_GlyphFunction · 0.85
FatalErrorFunction · 0.50

Tested by

no test coverage detected