summaryrefslogtreecommitdiff
path: root/vcl/quartz/ctlayout.cxx
diff options
context:
space:
mode:
authorNorbert Thiebaud <nthiebaud@gmail.com>2014-08-14 18:08:38 +0200
committerNorbert Thiebaud <nthiebaud@gmail.com>2014-08-14 22:42:16 +0200
commit32a92502fdbabe7615330e668357568cc4812e54 (patch)
treefb8de242f7985e683d1978ea43f3944cdb2bf28d /vcl/quartz/ctlayout.cxx
parent8e8383612e2cf860acfc0fd3f5620da55d4ef35a (diff)
GetTextBreak takes a DeviceCoordinate as width
Change-Id: Ie03732a0966eedf6c0226beed83356ae4886a016
Diffstat (limited to 'vcl/quartz/ctlayout.cxx')
-rw-r--r--vcl/quartz/ctlayout.cxx14
1 files changed, 10 insertions, 4 deletions
diff --git a/vcl/quartz/ctlayout.cxx b/vcl/quartz/ctlayout.cxx
index 7c851d3f22e2..659d89b7c3ee 100644
--- a/vcl/quartz/ctlayout.cxx
+++ b/vcl/quartz/ctlayout.cxx
@@ -44,7 +44,7 @@ public:
virtual long GetTextWidth() const SAL_OVERRIDE;
virtual DeviceCoordinate FillDXArray( DeviceCoordinate* pDXArray ) const SAL_OVERRIDE;
- virtual sal_Int32 GetTextBreak(long nMaxWidth, long nCharExtra, int nFactor) const SAL_OVERRIDE;
+ virtual sal_Int32 GetTextBreak(DeviceCoordinate nMaxWidth, long nCharExtra, int nFactor) const SAL_OVERRIDE;
virtual void GetCaretPositions( int nArraySize, long* pCaretXArray ) const SAL_OVERRIDE;
virtual bool GetBoundRect( SalGraphics&, Rectangle& ) const SAL_OVERRIDE;
@@ -762,13 +762,16 @@ DeviceCoordinate CTLayout::FillDXArray( DeviceCoordinate* pDXArray ) const
return nPixWidth;
}
-sal_Int32 CTLayout::GetTextBreak( long nMaxWidth, long nCharExtra, int nFactor ) const
+sal_Int32 CTLayout::GetTextBreak( DeviceCoordinate nMaxWidth, long nCharExtra, int nFactor ) const
{
if( !mpCTLine )
+ {
+ SAL_INFO("vcl.ct", "GetTextBreak mpCTLine == NULL");
return -1;
-
+ }
CTTypesetterRef aCTTypeSetter = CTTypesetterCreateWithAttributedString( mpAttrString );
CFIndex nBestGuess = (nCharExtra >= 0) ? 0 : mnCharCount;
+ SAL_INFO("vcl.ct", "GetTextBreak nMaxWidth:" << nMaxWidth << " nBestGuess:" << nBestGuess << " nCharExtra:" << nCharExtra << " nFactor:" << nFactor);
for( int i = 1; i <= mnCharCount; i *= 2 )
{
// guess the target width considering char-extra expansion/condensation
@@ -776,7 +779,9 @@ sal_Int32 CTLayout::GetTextBreak( long nMaxWidth, long nCharExtra, int nFactor )
const double fCTMaxWidth = nTargetWidth / nFactor;
// calculate the breaking index for the guessed target width
const CFIndex nNewIndex = CTTypesetterSuggestClusterBreak( aCTTypeSetter, 0, fCTMaxWidth );
- if( nNewIndex >= mnCharCount ) {
+ SAL_INFO("vcl.ct", "GetTextBreak nTargetWidth:" << nTargetWidth << " fCTMaxWidth:" << fCTMaxWidth << " nNewIndex:" << nNewIndex);
+ if( nNewIndex >= mnCharCount )
+ {
CFRelease( aCTTypeSetter );
return -1;
}
@@ -795,6 +800,7 @@ sal_Int32 CTLayout::GetTextBreak( long nMaxWidth, long nCharExtra, int nFactor )
// suggest the best fitting cluster break as breaking position
CFRelease( aCTTypeSetter );
const int nIndex = nBestGuess + mnMinCharPos;
+ SAL_INFO("vcl.ct", "GetTextBreak nIndex:" << nIndex);
return nIndex;
}