| @@ -307,7 +307,7 @@ namespace TextLayoutHelpers | |||||
| Array <int> newGlyphs; | Array <int> newGlyphs; | ||||
| Array <float> xOffsets; | Array <float> 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 (currentRun == nullptr) currentRun = new TextLayout::Run(); | ||||
| if (currentLine == nullptr) currentLine = new TextLayout::Line(); | 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<Token> tokens; | OwnedArray<Token> tokens; | ||||
| int totalLines; | int totalLines; | ||||
| @@ -619,6 +619,7 @@ bool CoreGraphicsContext::drawTextLayout (const AttributedString& text, const Re | |||||
| CoreTextTypeLayout::drawToCGContext (text, area, context, flipHeight); | CoreTextTypeLayout::drawToCGContext (text, area, context, flipHeight); | ||||
| return true; | return true; | ||||
| #else | #else | ||||
| (void) text; (void) area; | |||||
| return false; | return false; | ||||
| #endif | #endif | ||||
| } | } | ||||
| @@ -1008,11 +1008,11 @@ private: | |||||
| class CharToGlyphMapper | class CharToGlyphMapper | ||||
| { | { | ||||
| public: | public: | ||||
| CharToGlyphMapper (CGFontRef fontRef) | |||||
| CharToGlyphMapper (CGFontRef cgFontRef) | |||||
| : segCount (0), endCode (0), startCode (0), idDelta (0), | : segCount (0), endCode (0), startCode (0), idDelta (0), | ||||
| idRangeOffset (0), glyphIndexes (0) | idRangeOffset (0), glyphIndexes (0) | ||||
| { | { | ||||
| CFDataRef cmapTable = CGFontCopyTableForTag (fontRef, 'cmap'); | |||||
| CFDataRef cmapTable = CGFontCopyTableForTag (cgFontRef, 'cmap'); | |||||
| if (cmapTable != 0) | if (cmapTable != 0) | ||||
| { | { | ||||