MCPcopy Create free account
hub / github.com/KebsCS/KBotExt / FreeTypeFont

Class FreeTypeFont

KBotExt/imgui/imgui_freetype.cpp:132–148  ·  view source on GitHub ↗

FreeType glyph rasterizer. NB: No ctor/dtor, explicitly call Init()/Shutdown()

Source from the content-addressed store, hash-verified

130 // FreeType glyph rasterizer.
131 // NB: No ctor/dtor, explicitly call Init()/Shutdown()
132 struct FreeTypeFont
133 {
134 bool InitFont(FT_Library ft_library, const ImFontConfig& cfg, unsigned int extra_user_flags); // Initialize from an external data buffer. Doesn't copy data, and you must ensure it stays valid up to this object lifetime.
135 void CloseFont();
136 void SetPixelHeight(int pixel_height); // Change font pixel size. All following calls to RasterizeGlyph() will use this size
137 const FT_Glyph_Metrics* LoadGlyph(uint32_t in_codepoint);
138 const FT_Bitmap* RenderGlyphAndGetInfo(GlyphInfo* out_glyph_info);
139 void BlitGlyph(const FT_Bitmap* ft_bitmap, uint32_t* dst, uint32_t dst_pitch, unsigned char* multiply_table = NULL);
140 ~FreeTypeFont() { CloseFont(); }
141
142 // [Internals]
143 FontInfo Info; // Font descriptor of the current font.
144 FT_Face Face;
145 unsigned int UserFlags; // = ImFontConfig::RasterizerFlags
146 FT_Int32 LoadFlags;
147 FT_Render_Mode RenderMode;
148 };
149
150 // From SDL_ttf: Handy routines for converting from fixed point
151#define FT_CEIL(X) (((X + 63) & -64) / 64)

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected