diff options
author | Norbert Thiebaud <nthiebaud@gmail.com> | 2014-07-15 21:45:11 +0200 |
---|---|---|
committer | Norbert Thiebaud <nthiebaud@gmail.com> | 2014-07-15 21:45:11 +0200 |
commit | 7a8fcfca98ee10666c58011ebe0a5f96e008d22d (patch) | |
tree | 9b309898f40cde3f9945c170ec46e628d10d66cf /vcl/quartz | |
parent | 6c8de2b107964cd3d26dba8fcf80c6da77b1d97a (diff) |
fdo#79673 quartz: draw 'bullet' for 'space' directly in one pass
the current implementation of CoreText simply dropped the proper
implementation of DrawTextArray, by ignoring DXArray
this very visibly borked the show-non-displayable character
feature of writer.. the bullet representing the 'spaces'
was quite misplaced.
This solve specifically this problem.
More work is needed to bring proper support of DXArray back to CoreText
Conflicts:
vcl/inc/sallayout.hxx
vcl/source/outdev/text.cxx
Change-Id: Idb2cc90d5ffaa8b83f79241cee2d512112d1c3be
Diffstat (limited to 'vcl/quartz')
-rw-r--r-- | vcl/quartz/ctlayout.cxx | 54 |
1 files changed, 54 insertions, 0 deletions
diff --git a/vcl/quartz/ctlayout.cxx b/vcl/quartz/ctlayout.cxx index cf440990f3e4..ea6d406bddef 100644 --- a/vcl/quartz/ctlayout.cxx +++ b/vcl/quartz/ctlayout.cxx @@ -380,6 +380,60 @@ void CTLayout::drawCTLine(AquaSalGraphics& rAquaGraphics, CTLineRef ctline, cons // draw the text CTLineDraw( ctline, rAquaGraphics.mrContext ); + if(mnLayoutFlags & SAL_LAYOUT_DRAW_BULLET) + { + CFArrayRef runArray = CTLineGetGlyphRuns(ctline); + CFIndex runCount = CFArrayGetCount(runArray); + + CFIndex runIndex = 0; + CTLineRef ctlinebullet = 0; + OUString sBullet((sal_Unicode)0xb7); // centered bullet + + for (; runIndex < runCount; runIndex++) + { + + CTRunRef run = (CTRunRef)CFArrayGetValueAtIndex(runArray, runIndex); + CFIndex runGlyphCount = CTRunGetGlyphCount(run); + + CGPoint position; + CFIndex runGlyphIndex = 0; + CFIndex stringIndice = 0; + + for (; runGlyphIndex < runGlyphCount; runGlyphIndex++) + { + CFRange glyphRange = CFRangeMake(runGlyphIndex, 1); + + CTRunGetStringIndices( run, glyphRange, &stringIndice ); + UniChar curChar = CFStringGetCharacterAtIndex (CFAttributedStringGetString(mpAttrString), stringIndice); + if(curChar == ' ') + { + CTRunGetPositions(run, glyphRange, &position); + // print a dot + if(!ctlinebullet) + { + CFStringRef aCFText = CFStringCreateWithCharactersNoCopy( NULL, + sBullet.getStr(), + 1, + kCFAllocatorNull ); + // CFAttributedStringCreate copies the attribues parameter + CFAttributedStringRef bulletAttrString = CFAttributedStringCreate( NULL, aCFText, mpTextStyle->GetStyleDict() ); + ctlinebullet = CTLineCreateWithAttributedString( bulletAttrString ); + CFRelease( aCFText); + CFRelease( bulletAttrString); + RGBAColor bulletColor(MAKE_SALCOLOR(0x26, 0x8b, 0xd2 )); // NON_PRINTING_CHARACTER_COLOR + CGContextSetFillColor( rAquaGraphics.mrContext, bulletColor.AsArray() ); + } + CGContextSetTextPosition( rAquaGraphics.mrContext, aTextPos.x + position.x, position.y + aTextPos.y ); + CTLineDraw(ctlinebullet, rAquaGraphics.mrContext); + } + } + } + if(ctlinebullet) + { + CFRelease(ctlinebullet); + } + } + // restore the original graphic context transformations SAL_INFO( "vcl.ct", "CGContextRestoreGState(" << rAquaGraphics.mrContext << ")" ); CGContextRestoreGState( rAquaGraphics.mrContext ); |