| 1565 | } |
| 1566 | |
| 1567 | void ImDrawList::AddText(const ImFont* font, float font_size, const ImVec2& pos, ImU32 col, const char* text_begin, const char* text_end, float wrap_width, const ImVec4* cpu_fine_clip_rect) |
| 1568 | { |
| 1569 | if ((col & IM_COL32_A_MASK) == 0) |
| 1570 | return; |
| 1571 | |
| 1572 | if (text_end == NULL) |
| 1573 | text_end = text_begin + strlen(text_begin); |
| 1574 | if (text_begin == text_end) |
| 1575 | return; |
| 1576 | |
| 1577 | // Pull default font/size from the shared ImDrawListSharedData instance |
| 1578 | if (font == NULL) |
| 1579 | font = _Data->Font; |
| 1580 | if (font_size == 0.0f) |
| 1581 | font_size = _Data->FontSize; |
| 1582 | |
| 1583 | IM_ASSERT(font->ContainerAtlas->TexID == _CmdHeader.TextureId); // Use high-level ImGui::PushFont() or low-level ImDrawList::PushTextureId() to change font. |
| 1584 | |
| 1585 | ImVec4 clip_rect = _CmdHeader.ClipRect; |
| 1586 | if (cpu_fine_clip_rect) |
| 1587 | { |
| 1588 | clip_rect.x = ImMax(clip_rect.x, cpu_fine_clip_rect->x); |
| 1589 | clip_rect.y = ImMax(clip_rect.y, cpu_fine_clip_rect->y); |
| 1590 | clip_rect.z = ImMin(clip_rect.z, cpu_fine_clip_rect->z); |
| 1591 | clip_rect.w = ImMin(clip_rect.w, cpu_fine_clip_rect->w); |
| 1592 | } |
| 1593 | font->RenderText(this, font_size, pos, col, clip_rect, text_begin, text_end, wrap_width, cpu_fine_clip_rect != NULL); |
| 1594 | } |
| 1595 | |
| 1596 | void ImDrawList::AddText(const ImVec2& pos, ImU32 col, const char* text_begin, const char* text_end) |
| 1597 | { |
no test coverage detected