diff options
author | Mark Hung <marklh9@gmail.com> | 2017-11-14 02:35:32 +0800 |
---|---|---|
committer | Mark Hung <marklh9@gmail.com> | 2017-11-17 10:02:21 +0100 |
commit | b843db1a8e3f50bc88e4278cd330bba86a62a206 (patch) | |
tree | 8423f9e86d839d90b03a106d2bdbd0ccc90da167 /vcl/source/font | |
parent | c2ea797abf377c4a6a1d01de93a638aa5f068183 (diff) |
vcl: clean ImplFontMetricData::ImplInitTextLineSize a little bit.
Move initialization of FullstopCenteredFlag out
of ImplFontMetricData::ImplInitTextLineSize since it has
nothing to do with text lines.
Change-Id: I1c2e383d980514c8727d736a3158325c1e0ccfda
Reviewed-on: https://gerrit.libreoffice.org/44712
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Mark Hung <marklh9@gmail.com>
Diffstat (limited to 'vcl/source/font')
-rw-r--r-- | vcl/source/font/fontmetric.cxx | 33 |
1 files changed, 18 insertions, 15 deletions
diff --git a/vcl/source/font/fontmetric.cxx b/vcl/source/font/fontmetric.cxx index d2de3917604e..cd23756f0f97 100644 --- a/vcl/source/font/fontmetric.cxx +++ b/vcl/source/font/fontmetric.cxx @@ -320,21 +320,6 @@ void ImplFontMetricData::ImplInitTextLineSize( const OutputDevice* pDev ) mnDStrikeoutOffset1 = nStrikeoutOffset - n2LineDY2 - n2LineHeight; mnDStrikeoutOffset2 = mnDStrikeoutOffset1 + n2LineDY + n2LineHeight; - const vcl::Font& rFont ( pDev->GetFont() ); - bool bCentered = true; - if (MsLangId::isCJK(rFont.GetLanguage())) - { - const OUString sFullstop( u'\x3001' ); // Fullwidth fullstop - tools::Rectangle aRect; - pDev->GetTextBoundRect( aRect, sFullstop ); - const sal_uInt16 nH = rFont.GetFontSize().Height(); - const sal_uInt16 nB = aRect.Left(); - // Use 18.75% as a threshold to define a centered fullwidth fullstop. - // In general, nB/nH < 5% for most Japanese fonts. - bCentered = nB > (((nH >> 1)+nH)>>3); - } - SetFullstopCenteredFlag( bCentered ); - mnBulletOffset = ( pDev->GetTextWidth( OUString( u' ' ) ) - pDev->GetTextWidth( OUString( u'\x00b7' ) ) ) >> 1 ; } @@ -390,6 +375,24 @@ void ImplFontMetricData::ImplInitAboveTextLineSize() mnAboveWUnderlineOffset = nCeiling + (nIntLeading + 1) / 2; } +void ImplFontMetricData::ImplInitFlags( const OutputDevice* pDev ) +{ + const vcl::Font& rFont ( pDev->GetFont() ); + bool bCentered = true; + if (MsLangId::isCJK(rFont.GetLanguage())) + { + const OUString sFullstop( u'\x3001' ); // Fullwidth fullstop + tools::Rectangle aRect; + pDev->GetTextBoundRect( aRect, sFullstop ); + const sal_uInt16 nH = rFont.GetFontSize().Height(); + const sal_uInt16 nB = aRect.Left(); + // Use 18.75% as a threshold to define a centered fullwidth fullstop. + // In general, nB/nH < 5% for most Japanese fonts. + bCentered = nB > (((nH >> 1)+nH)>>3); + } + SetFullstopCenteredFlag( bCentered ); +} + /* * Calculate line spacing: * |