diff options
author | Norbert Thiebaud <nthiebaud@gmail.com> | 2014-08-14 18:08:38 +0200 |
---|---|---|
committer | Norbert Thiebaud <nthiebaud@gmail.com> | 2014-08-14 22:42:16 +0200 |
commit | 32a92502fdbabe7615330e668357568cc4812e54 (patch) | |
tree | fb8de242f7985e683d1978ea43f3944cdb2bf28d /vcl | |
parent | 8e8383612e2cf860acfc0fd3f5620da55d4ef35a (diff) |
GetTextBreak takes a DeviceCoordinate as width
Change-Id: Ie03732a0966eedf6c0226beed83356ae4886a016
Diffstat (limited to 'vcl')
-rw-r--r-- | vcl/inc/graphite_layout.hxx | 2 | ||||
-rw-r--r-- | vcl/inc/graphite_serverfont.hxx | 2 | ||||
-rw-r--r-- | vcl/inc/sallayout.hxx | 6 | ||||
-rw-r--r-- | vcl/quartz/ctlayout.cxx | 14 | ||||
-rw-r--r-- | vcl/source/gdi/sallayout.cxx | 6 | ||||
-rw-r--r-- | vcl/source/glyphs/graphite_layout.cxx | 4 | ||||
-rw-r--r-- | vcl/win/source/gdi/winlayout.cxx | 13 |
7 files changed, 26 insertions, 21 deletions
diff --git a/vcl/inc/graphite_layout.hxx b/vcl/inc/graphite_layout.hxx index 77bab7e30893..24b668d83e41 100644 --- a/vcl/inc/graphite_layout.hxx +++ b/vcl/inc/graphite_layout.hxx @@ -123,7 +123,7 @@ public: virtual void AdjustLayout( ImplLayoutArgs& ) SAL_OVERRIDE; // adjusting positions // methods using string indexing - virtual sal_Int32 GetTextBreak(long nMaxWidth, long nCharExtra=0, int nFactor=1) const SAL_OVERRIDE; + virtual sal_Int32 GetTextBreak(DeviceCoordinate nMaxWidth, long nCharExtra=0, int nFactor=1) const SAL_OVERRIDE; virtual DeviceCoordinate FillDXArray( DeviceCoordinate* pDXArray ) const SAL_OVERRIDE; virtual void ApplyDXArray(ImplLayoutArgs &rArgs, std::vector<int> & rDeltaWidth); diff --git a/vcl/inc/graphite_serverfont.hxx b/vcl/inc/graphite_serverfont.hxx index ffbcc064c575..50063e4838df 100644 --- a/vcl/inc/graphite_serverfont.hxx +++ b/vcl/inc/graphite_serverfont.hxx @@ -76,7 +76,7 @@ public: { return maImpl.FillDXArray(dxa); } - virtual sal_Int32 GetTextBreak(long mw, long ce, int f) const SAL_OVERRIDE + virtual sal_Int32 GetTextBreak(DeviceCoordinate mw, long ce, int f) const SAL_OVERRIDE { return maImpl.GetTextBreak(mw, ce, f); } diff --git a/vcl/inc/sallayout.hxx b/vcl/inc/sallayout.hxx index 7f307274b35d..d68a364ca8f8 100644 --- a/vcl/inc/sallayout.hxx +++ b/vcl/inc/sallayout.hxx @@ -171,7 +171,7 @@ public: int GetOrientation() const { return mnOrientation; } // methods using string indexing - virtual sal_Int32 GetTextBreak(long nMaxWidth, long nCharExtra=0, int nFactor=1) const = 0; + virtual sal_Int32 GetTextBreak(DeviceCoordinate nMaxWidth, long nCharExtra=0, int nFactor=1) const = 0; virtual DeviceCoordinate FillDXArray( DeviceCoordinate* pDXArray ) const = 0; virtual long GetTextWidth() const { return FillDXArray( NULL ); } virtual void GetCaretPositions( int nArraySize, long* pCaretXArray ) const = 0; @@ -229,7 +229,7 @@ class VCL_PLUGIN_PUBLIC MultiSalLayout : public SalLayout { public: virtual void DrawText( SalGraphics& ) 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 DeviceCoordinate FillDXArray( DeviceCoordinate* pDXArray ) const SAL_OVERRIDE; virtual void GetCaretPositions( int nArraySize, long* pCaretXArray ) const SAL_OVERRIDE; virtual int GetNextGlyphs( int nLen, sal_GlyphId* pGlyphIdxAry, Point& rPos, @@ -331,7 +331,7 @@ public: // used by upper layers 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; // used by display layers 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; } diff --git a/vcl/source/gdi/sallayout.cxx b/vcl/source/gdi/sallayout.cxx index 21ee47f898af..de39d873788c 100644 --- a/vcl/source/gdi/sallayout.cxx +++ b/vcl/source/gdi/sallayout.cxx @@ -1278,14 +1278,14 @@ void GenericSalLayout::GetCaretPositions( int nMaxIndex, long* pCaretXArray ) co } } -sal_Int32 GenericSalLayout::GetTextBreak( long nMaxWidth, long nCharExtra, int nFactor ) const +sal_Int32 GenericSalLayout::GetTextBreak( DeviceCoordinate nMaxWidth, long nCharExtra, int nFactor ) const { int nCharCapacity = mnEndCharPos - mnMinCharPos; DeviceCoordinate* pCharWidths = (DeviceCoordinate*)alloca( nCharCapacity * sizeof(DeviceCoordinate) ); if( !GetCharWidths( pCharWidths ) ) return -1; - long nWidth = 0; + DeviceCoordinate nWidth = 0; for( int i = mnMinCharPos; i < mnEndCharPos; ++i ) { nWidth += pCharWidths[ i - mnMinCharPos ] * nFactor; @@ -1908,7 +1908,7 @@ void MultiSalLayout::DrawText( SalGraphics& rGraphics ) const // NOTE: now the baselevel font is active again } -sal_Int32 MultiSalLayout::GetTextBreak( long nMaxWidth, long nCharExtra, int nFactor ) const +sal_Int32 MultiSalLayout::GetTextBreak( DeviceCoordinate nMaxWidth, long nCharExtra, int nFactor ) const { if( mnLevel <= 0 ) return -1; diff --git a/vcl/source/glyphs/graphite_layout.cxx b/vcl/source/glyphs/graphite_layout.cxx index e5cb5a700e03..12b5ea9e889d 100644 --- a/vcl/source/glyphs/graphite_layout.cxx +++ b/vcl/source/glyphs/graphite_layout.cxx @@ -681,7 +681,7 @@ bool GraphiteLayout::LayoutGlyphs(ImplLayoutArgs& rArgs, gr_segment * pSegment) return true; } -sal_Int32 GraphiteLayout::GetTextBreak(long maxmnWidth, long char_extra, int factor) const +sal_Int32 GraphiteLayout::GetTextBreak(DeviceCoordinate maxmnWidth, long char_extra, int factor) const { #ifdef GRLAYOUT_DEBUG fprintf(grLog(),"Gr::GetTextBreak c[%d-%d) maxWidth %ld char extra %ld factor %d\n", @@ -692,7 +692,7 @@ sal_Int32 GraphiteLayout::GetTextBreak(long maxmnWidth, long char_extra, int fac if (maxmnWidth > mnWidth * factor + char_extra * (mnEndCharPos - mnMinCharPos - 1)) return -1; - long nWidth = mvCharDxs[0] * factor; + DeviceCoordinate nWidth = mvCharDxs[0] * factor; long wLastBreak = 0; int nLastBreak = -1; int nEmergency = -1; diff --git a/vcl/win/source/gdi/winlayout.cxx b/vcl/win/source/gdi/winlayout.cxx index 3eb5c5e154fb..a0a0602b4051 100644 --- a/vcl/win/source/gdi/winlayout.cxx +++ b/vcl/win/source/gdi/winlayout.cxx @@ -146,7 +146,7 @@ public: const PhysicalFontFace** pFallbackFonts = NULL ) const; virtual DeviceCoordinate FillDXArray( DeviceCoordinate* pDXArray ) const; - 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; // for glyph+font+script fallback @@ -644,7 +644,7 @@ DeviceCoordinate SimpleWinLayout::FillDXArray( DeviceCoordinate* pDXArray ) cons return mnWidth; } -sal_Int32 SimpleWinLayout::GetTextBreak( long nMaxWidth, long nCharExtra, int nFactor ) const +sal_Int32 SimpleWinLayout::GetTextBreak( DeviceCoordinate nMaxWidth, long nCharExtra, int nFactor ) const // NOTE: the nFactor is used to prevent rounding errors for small nCharExtra values { if( mnWidth ) @@ -967,7 +967,7 @@ public: const PhysicalFontFace** pFallbackFonts = NULL ) const; virtual DeviceCoordinate FillDXArray( DeviceCoordinate* pDXArray ) const; - 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; virtual bool IsKashidaPosValid ( int nCharPos ) const; @@ -2115,7 +2115,7 @@ DeviceCoordinate UniscribeLayout::FillDXArray( DeviceCoordinate* pDXArray ) cons return nWidth; } -sal_Int32 UniscribeLayout::GetTextBreak( long nMaxWidth, long nCharExtra, int nFactor ) const +sal_Int32 UniscribeLayout::GetTextBreak( DeviceCoordinate nMaxWidth, long nCharExtra, int nFactor ) const { long nWidth = 0; for( int i = mnMinCharPos; i < mnEndCharPos; ++i ) @@ -2640,7 +2640,7 @@ public: virtual void DrawText( SalGraphics& ) const; // methods using string indexing - virtual sal_Int32 GetTextBreak(long nMaxWidth, long nCharExtra=0, int nFactor=1) const SAL_OVERRIDE; + virtual sal_Int32 GetTextBreak(DeviceCoordinate nMaxWidth, long nCharExtra=0, int nFactor=1) const SAL_OVERRIDE; virtual DeviceCoordinate FillDXArray( DeviceCoordinate* pDXArray ) const; virtual void GetCaretPositions( int nArraySize, long* pCaretXArray ) const; @@ -2776,8 +2776,7 @@ void GraphiteWinLayout::DrawText(SalGraphics &sal_graphics) const DeleteFont( SelectFont( aHDC, hOrigFont ) ); } -sal_Int32 GraphiteWinLayout::GetTextBreak( - long nMaxWidth, long nCharExtra, int nFactor) const +sal_Int32 GraphiteWinLayout::GetTextBreak(DeviceCoordinate nMaxWidth, long nCharExtra, int nFactor) const { sal_Int32 nBreak = maImpl.GetTextBreak(nMaxWidth, nCharExtra, nFactor); return nBreak; |