From 349d3d423f233a9962e27478c7983db792f74040 Mon Sep 17 00:00:00 2001 From: jules Date: Fri, 11 Oct 2013 21:56:44 +0100 Subject: [PATCH] Fix for software text layout colour of single-character strings. --- modules/juce_graphics/fonts/juce_TextLayout.cpp | 8 +++++--- .../code_editor/juce_CodeEditorComponent.cpp | 2 -- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/modules/juce_graphics/fonts/juce_TextLayout.cpp b/modules/juce_graphics/fonts/juce_TextLayout.cpp index 19abd3ff27..526cac1a9b 100644 --- a/modules/juce_graphics/fonts/juce_TextLayout.cpp +++ b/modules/juce_graphics/fonts/juce_TextLayout.cpp @@ -525,15 +525,17 @@ namespace TextLayoutHelpers } } - if ((i > 0 && newFontAndColour != lastFontAndColour) || i == stringLength - 1) + if (i > 0 && newFontAndColour != lastFontAndColour) { - runAttributes.add (RunAttribute (lastFontAndColour, - Range (rangeStart, (i < stringLength - 1) ? i : (i + 1)))); + runAttributes.add (RunAttribute (lastFontAndColour, Range (rangeStart, i))); rangeStart = i; } lastFontAndColour = newFontAndColour; } + + if (rangeStart < stringLength) + runAttributes.add (RunAttribute (lastFontAndColour, Range (rangeStart, stringLength))); } for (int i = 0; i < runAttributes.size(); ++i) diff --git a/modules/juce_gui_extra/code_editor/juce_CodeEditorComponent.cpp b/modules/juce_gui_extra/code_editor/juce_CodeEditorComponent.cpp index e751d515bf..571957eef5 100644 --- a/modules/juce_gui_extra/code_editor/juce_CodeEditorComponent.cpp +++ b/modules/juce_gui_extra/code_editor/juce_CodeEditorComponent.cpp @@ -91,8 +91,6 @@ public: const float rightClip, const float x, const int y, const int lineH, const float characterWidth) const { - Colour lastColour (0x00000001); - AttributedString as; as.setJustification (Justification::centredLeft);