summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTor Lillqvist <tml@collabora.com>2015-11-25 13:24:09 +0200
committerAndras Timar <andras.timar@collabora.com>2015-11-28 14:15:50 +0100
commit578feb2c41f4875de6622d8a43947fddccce5969 (patch)
tree67446fdd72d285f2969bff057d9eabc211f6a584
parent8fb4de6baa9e7eb16e96cfbd63cd1fdf6beb49a9 (diff)
tdf#95783: Don't calculate width of text with glyph fallback as way too wide
The old code in MultiSalLayout::GetTextBreak() only makes sense if the base level character width is zero where a fallback level has a non-zero character width, and vice versa. But this is not the case for Windows, at least not any more now when using UniscribeLayout and not SimpleWinLayout. This simple change fixes that: Only use the width from a fallback level if the width at the base level is zero. Hopefully it does not cause regressions for other documents or on other platforms. (But, I repeat, I find it hard to believe that the intent of the code could really have been to ever add two or more non-zero widths for the same character from different levels of fallback and use that.) Change-Id: Ic66c55db4b7463f9e04fcedec76f1c44f5e62e03 (cherry picked from commit a0d112a53023758a28d180ffd12766b4d325bf52) Reviewed-on: https://gerrit.libreoffice.org/20172 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Caolán McNamara <caolanm@redhat.com> Tested-by: Caolán McNamara <caolanm@redhat.com> (cherry picked from commit b8711f6600216ca482627a928099a33612008734)
-rw-r--r--vcl/source/gdi/sallayout.cxx9
1 files changed, 6 insertions, 3 deletions
diff --git a/vcl/source/gdi/sallayout.cxx b/vcl/source/gdi/sallayout.cxx
index 4bd388d38b4c..7edfc7ff7ce7 100644
--- a/vcl/source/gdi/sallayout.cxx
+++ b/vcl/source/gdi/sallayout.cxx
@@ -1979,9 +1979,12 @@ sal_Int32 MultiSalLayout::GetTextBreak( DeviceCoordinate nMaxWidth, DeviceCoordi
fUnitMul /= rLayout.GetUnitsPerPixel();
for( int i = 0; i < nCharCount; ++i )
{
- DeviceCoordinate w = pCharWidths[ i + nCharCount ];
- w = (DeviceCoordinate)(w * fUnitMul + 0.5);
- pCharWidths[ i ] += w;
+ if( pCharWidths[ i ] == 0 )
+ {
+ DeviceCoordinate w = pCharWidths[ i + nCharCount ];
+ w = (DeviceCoordinate)(w * fUnitMul + 0.5);
+ pCharWidths[ i ] = w;
+ }
}
}