[Libreoffice-commits] core.git: vcl/source
Mark Hung
marklh9 at gmail.com
Fri Nov 17 21:36:57 UTC 2017
vcl/source/font/fontmetric.cxx | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
New commits:
commit 025b5f75c657ffd54f11209da9bc8a6ebdbcc81e
Author: Mark Hung <marklh9 at gmail.com>
Date: Tue Nov 14 20:26:03 2017 +0800
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 at libreoffice.org>
Reviewed-by: Mark Hung <marklh9 at gmail.com>
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;
More information about the Libreoffice-commits
mailing list