diff --git a/modules/juce_graphics/fonts/juce_TextLayout.cpp b/modules/juce_graphics/fonts/juce_TextLayout.cpp index 5b53e9ae8d..de1232c5ca 100644 --- a/modules/juce_graphics/fonts/juce_TextLayout.cpp +++ b/modules/juce_graphics/fonts/juce_TextLayout.cpp @@ -307,7 +307,7 @@ namespace TextLayoutHelpers Array newGlyphs; Array xOffsets; - t.font.getGlyphPositions (t.text.trimEnd(), newGlyphs, xOffsets); + t.font.getGlyphPositions (getTrimmedEndIfNotAllWhitespace (t.text), newGlyphs, xOffsets); if (currentRun == nullptr) currentRun = new TextLayout::Run(); if (currentLine == nullptr) currentLine = new TextLayout::Line(); @@ -543,6 +543,15 @@ namespace TextLayoutHelpers } } + static String getTrimmedEndIfNotAllWhitespace (const String& s) + { + String trimmed (s.trimEnd()); + if (trimmed.isEmpty() && ! s.isEmpty()) + trimmed = s; + + return trimmed; + } + OwnedArray tokens; int totalLines; diff --git a/modules/juce_graphics/native/juce_mac_CoreGraphicsContext.mm b/modules/juce_graphics/native/juce_mac_CoreGraphicsContext.mm index e96de5f14f..13d43bc0bd 100644 --- a/modules/juce_graphics/native/juce_mac_CoreGraphicsContext.mm +++ b/modules/juce_graphics/native/juce_mac_CoreGraphicsContext.mm @@ -619,6 +619,7 @@ bool CoreGraphicsContext::drawTextLayout (const AttributedString& text, const Re CoreTextTypeLayout::drawToCGContext (text, area, context, flipHeight); return true; #else + (void) text; (void) area; return false; #endif } diff --git a/modules/juce_graphics/native/juce_mac_Fonts.mm b/modules/juce_graphics/native/juce_mac_Fonts.mm index 6aa44d66f6..f793de1142 100644 --- a/modules/juce_graphics/native/juce_mac_Fonts.mm +++ b/modules/juce_graphics/native/juce_mac_Fonts.mm @@ -1008,11 +1008,11 @@ private: class CharToGlyphMapper { public: - CharToGlyphMapper (CGFontRef fontRef) + CharToGlyphMapper (CGFontRef cgFontRef) : segCount (0), endCode (0), startCode (0), idDelta (0), idRangeOffset (0), glyphIndexes (0) { - CFDataRef cmapTable = CGFontCopyTableForTag (fontRef, 'cmap'); + CFDataRef cmapTable = CGFontCopyTableForTag (cgFontRef, 'cmap'); if (cmapTable != 0) {