summaryrefslogtreecommitdiff
path: root/vcl/source
diff options
context:
space:
mode:
authorMark Hung <marklh9@gmail.com>2017-11-14 20:26:03 +0800
committerMark Hung <marklh9@gmail.com>2017-11-17 22:36:34 +0100
commit025b5f75c657ffd54f11209da9bc8a6ebdbcc81e (patch)
tree790b76a52b9241aee441c1502806d5a2f3dd7dfd /vcl/source
parent58af692e28146a1ecb4fbeef89e839baa1a1b39d (diff)
tdf#111717 consider CJK vertical writing for underline offset
Textline offset was based on horizontal font metrics. In vertical writing for CJK fonts, use descent as its underline offset so that the line is drawn at the edge of the bounding box to prevent overlap the CJK glyphs. Change-Id: Iaa01bdf3cbb694dcf925975cde3f0f7ba7b97dac Reviewed-on: https://gerrit.libreoffice.org/44720 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Mark Hung <marklh9@gmail.com>
Diffstat (limited to 'vcl/source')
-rw-r--r--vcl/source/font/fontmetric.cxx5
1 files changed, 4 insertions, 1 deletions
diff --git a/vcl/source/font/fontmetric.cxx b/vcl/source/font/fontmetric.cxx
index cd23756f0f97..cd0b9f8557e9 100644
--- a/vcl/source/font/fontmetric.cxx
+++ b/vcl/source/font/fontmetric.cxx
@@ -282,7 +282,9 @@ void ImplFontMetricData::ImplInitTextLineSize( const OutputDevice* pDev )
if ( !n2LineDY2 )
n2LineDY2 = 1;
- long nUnderlineOffset = mnDescent/2 + 1;
+ const vcl::Font& rFont ( pDev->GetFont() );
+ bool bCJKVertical = MsLangId::isCJK(rFont.GetLanguage()) && rFont.IsVertical();
+ long nUnderlineOffset = bCJKVertical ? mnDescent : (mnDescent/2 + 1);
long nStrikeoutOffset = -((mnAscent - mnIntLeading) / 3);
mnUnderlineSize = nLineHeight;
@@ -306,6 +308,7 @@ void ImplFontMetricData::ImplInitTextLineSize( const OutputDevice* pDev )
else
mnWUnderlineSize = ((nWCalcSize*50)+50) / 100;
+
// Don't assume that wavelines are never placed below the descent, because for most fonts the waveline
// is drawn into the text
mnWUnderlineOffset = nUnderlineOffset;