Kaydet (Commit) 4f5a9171 authored tarafından Thorsten Behrens's avatar Thorsten Behrens

Fix fdo#50631 - have GetTextBoundRect() properly rotate bounds

Earlier fixes to AquaSalGraphics::GetGlyphBoundRect() are
ineffective, since this method is not even called from ATSLayout.

Change-Id: I877fe5711167f6e28ac7a8153826878359f8ed42
üst 1bdb0801
......@@ -852,12 +852,39 @@ void ATSLayout::GetCaretPositions( int nMaxIndex, long* pCaretXArray ) const
*
* @return : measurement valid
**/
bool ATSLayout::GetBoundRect( SalGraphics&, Rectangle& rVCLRect ) const
bool ATSLayout::GetBoundRect( SalGraphics& rGraphics, Rectangle& rVCLRect ) const
{
AquaSalGraphics& rAquaGraphics = static_cast<AquaSalGraphics&>(rGraphics);
const Point aPos = GetDrawPosition( Point(mnBaseAdv, 0) );
const Fixed nFixedX = Vcl2Fixed( +aPos.X() );
const Fixed nFixedY = Vcl2Fixed( +aPos.Y() );
// prepare ATSUI drawing attributes
static const ItemCount nMaxControls = 8;
ATSUAttributeTag theTags[ nMaxControls ];
ByteCount theSizes[ nMaxControls];
ATSUAttributeValuePtr theValues[ nMaxControls ];
ItemCount numcontrols = 0;
// Tell ATSUI to use CoreGraphics
theTags[numcontrols] = kATSUCGContextTag;
theSizes[numcontrols] = sizeof( CGContextRef );
theValues[numcontrols++] = &rAquaGraphics.mrContext;
// Rotate if necessary
if( rAquaGraphics.mnATSUIRotation != 0 )
{
Fixed theAngle = rAquaGraphics.mnATSUIRotation;
theTags[numcontrols] = kATSULineRotationTag;
theSizes[numcontrols] = sizeof( Fixed );
theValues[numcontrols++] = &theAngle;
}
DBG_ASSERT( (numcontrols <= nMaxControls), "ATSLayout::GetBoundRect() numcontrols overflow" );
OSStatus theErr = ATSUSetLayoutControls (maATSULayout, numcontrols, theTags, theSizes, theValues);
DBG_ASSERT( (theErr==noErr), "ATSLayout::GetBoundRect ATSUSetLayoutControls failed!\n" );
Rect aMacRect;
OSStatus eStatus = ATSUMeasureTextImage( maATSULayout,
mnMinCharPos, mnCharCount, nFixedX, nFixedY, &aMacRect );
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment