diff options
Diffstat (limited to 'src/Text.cpp')
-rw-r--r-- | src/Text.cpp | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/src/Text.cpp b/src/Text.cpp index 50db0ee..28247e6 100644 --- a/src/Text.cpp +++ b/src/Text.cpp @@ -785,6 +785,7 @@ namespace QuickMedia mgl::vec2f glyphPos; uint32_t prevCodePoint = 0; + bool text_contains_images = false; // TODO: Only do this if dirtyText (then the Text object shouldn't be reset in Body. There should be a cleanup function in text instead) for(int textElementIndex = 0; textElementIndex < (int)textElements.size(); ++textElementIndex) { @@ -807,6 +808,7 @@ namespace QuickMedia if(!text_format_stack.empty()) text_format_stack.pop(); } else if(textElement.type == TextElement::Type::IMAGE) { + text_contains_images = true; vertices_index = FONT_INDEX_IMAGE; mgl::Color image_color(255, 255, 255, text_element_color.a); int vertexStart = vertices[vertices_index].size(); @@ -1118,7 +1120,8 @@ namespace QuickMedia } } vertices_linear_done:; - move_vertex_lines_by_largest_items(vertices_linear_index); + if(text_contains_images) + move_vertex_lines_by_largest_items(vertices_linear_index); // TODO: Optimize for(TextElement &textElement : textElements) { |