summaryrefslogtreecommitdiff
path: root/sd
diff options
context:
space:
mode:
authorKhaled Hosny <khaledhosny@eglug.org>2016-11-09 15:22:43 +0200
committerKhaled Hosny <khaledhosny@eglug.org>2016-11-22 15:32:11 +0000
commit34d7602954d4483b3bc9db700e7df2c15348947a (patch)
tree8dcfb93fc29815fd89481a7840d64d6c187534db /sd
parentc855aec445628f96d3d32cfde6efd4e51e4489c9 (diff)
tdf#55469 Consistent line spacing across platforms
We current use platform APIs to calculate line spacing, however different platforms behave differently: * FreeType and Core Text will prefer hhea table over OS/2, and OS/2 Typo metrics over Win ones. * GDI’s TEXTMETRIC only uses OS/2 Win metrics, while NEWTEXTMETRIC seems to use Typo one, but we use only the old TEXTMETRIC. So we get inconsistent line spacing and we have no control which of three competing sets of line spacing metrics we end up using. The current conventional wisdom is that: * hhea metrics should be used, since hhea is a mandatory font table and should always be present. * But if OS/2 is present, it should be used since it is mandatory in Windows. OS/2 has Typo and Win metrics, but the later was meant to control text clipping not line spacing and can be ridiculously large. Unfortunately many Windows application incorrectly use the Win metrics (thanks to GDI’s TEXTMETRIC) and old fonts might be designed with this in mind, so OpenType introduced a flag for fonts to indicate that they really want to use Typo metrics. So for best backward compatibility: * Use Win metrics if available. * Unless USE_TYPO_METRICS flag is set, in which case use Typo metrics. This patch does this by reading the hhea and OS/2 tables directly and implementing the algorithm above. Quick comparison with Microsoft Office 2016 shows similar line spacing as the new line spacing here, so I guess we are improving compatibility as well. Change-Id: I4541e67e3e14508e3529e73083056a09de02e637 Reviewed-on: https://gerrit.libreoffice.org/31053 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Khaled Hosny <khaledhosny@eglug.org>
Diffstat (limited to 'sd')
-rw-r--r--sd/qa/unit/tiledrendering/tiledrendering.cxx1
1 files changed, 1 insertions, 0 deletions
diff --git a/sd/qa/unit/tiledrendering/tiledrendering.cxx b/sd/qa/unit/tiledrendering/tiledrendering.cxx
index 2d2cc99ea2a0..c07f00e8e7f8 100644
--- a/sd/qa/unit/tiledrendering/tiledrendering.cxx
+++ b/sd/qa/unit/tiledrendering/tiledrendering.cxx
@@ -353,6 +353,7 @@ void SdTiledRenderingTest::testPostMouseEvent()
vcl::Cursor* pCursor = rEditView.GetCursor();
Point aPosition = pCursor->GetPos();
aPosition.setX(aPosition.getX() - 1000);
+ aPosition.setY(aPosition.getY() + 1000);
pXImpressDocument->postMouseEvent(LOK_MOUSEEVENT_MOUSEBUTTONDOWN,
convertMm100ToTwip(aPosition.getX()), convertMm100ToTwip(aPosition.getY()),
1, MOUSE_LEFT, 0);