MCPcopy Create free account
hub / github.com/RenderKit/embree / RenderChar

Method RenderChar

tutorials/common/imgui/imgui_draw.cpp:3532–3544  ·  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

3530
3531// Note: as with every ImDrawList drawing function, this expects that the font atlas texture is bound.
3532void ImFont::RenderChar(ImDrawList* draw_list, float size, const ImVec2& pos, ImU32 col, ImWchar c) const
3533{
3534 const ImFontGlyph* glyph = FindGlyph(c);
3535 if (!glyph || !glyph->Visible)
3536 return;
3537 if (glyph->Colored)
3538 col |= ~IM_COL32_A_MASK;
3539 float scale = (size >= 0.0f) ? (size / FontSize) : 1.0f;
3540 float x = IM_FLOOR(pos.x);
3541 float y = IM_FLOOR(pos.y);
3542 draw_list->PrimReserve(6, 4);
3543 draw_list->PrimRectUV(ImVec2(x + glyph->X0 * scale, y + glyph->Y0 * scale), ImVec2(x + glyph->X1 * scale, y + glyph->Y1 * scale), ImVec2(glyph->U0, glyph->V0), ImVec2(glyph->U1, glyph->V1), col);
3544}
3545
3546// Note: as with every ImDrawList drawing function, this expects that the font atlas texture is bound.
3547void ImFont::RenderText(ImDrawList* draw_list, float size, const 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.80
DebugNodeFontMethod · 0.80

Calls 3

ImVec2Function · 0.85
PrimReserveMethod · 0.80
PrimRectUVMethod · 0.80

Tested by

no test coverage detected