MCPcopy Create free account
hub / github.com/VictorGordan/opengl-tutorials / RenderChar

Method RenderChar

ImGUI GLFW Tutorial/imgui/imgui_draw.cpp:3495–3507  ·  view source on GitHub ↗

Note: as with every ImDrawList drawing function, this expects that the font atlas texture is bound.

Source from the content-addressed store, hash-verified

3493
3494// Note: as with every ImDrawList drawing function, this expects that the font atlas texture is bound.
3495void ImFont::RenderChar(ImDrawList* draw_list, float size, ImVec2 pos, ImU32 col, ImWchar c) const
3496{
3497 const ImFontGlyph* glyph = FindGlyph(c);
3498 if (!glyph || !glyph->Visible)
3499 return;
3500 if (glyph->Colored)
3501 col |= ~IM_COL32_A_MASK;
3502 float scale = (size >= 0.0f) ? (size / FontSize) : 1.0f;
3503 pos.x = IM_FLOOR(pos.x);
3504 pos.y = IM_FLOOR(pos.y);
3505 draw_list->PrimReserve(6, 4);
3506 draw_list->PrimRectUV(ImVec2(pos.x + glyph->X0 * scale, pos.y + glyph->Y0 * scale), ImVec2(pos.x + glyph->X1 * scale, pos.y + glyph->Y1 * scale), ImVec2(glyph->U0, glyph->V0), ImVec2(glyph->U1, glyph->V1), col);
3507}
3508
3509// Note: as with every ImDrawList drawing function, this expects that the font atlas texture is bound.
3510void ImFont::RenderText(ImDrawList* draw_list, float size, ImVec2 pos, ImU32 col, const ImVec4& clip_rect, const char* text_begin, const char* text_end, float wrap_width, bool cpu_fine_clip) const

Callers 2

RenderTextEllipsisMethod · 0.45
NodeFontFunction · 0.45

Calls 3

ImVec2Function · 0.70
PrimReserveMethod · 0.45
PrimRectUVMethod · 0.45

Tested by

no test coverage detected