summaryrefslogtreecommitdiff
path: root/vcl/source
diff options
context:
space:
mode:
authorMark Hung <marklh9@gmail.com>2017-11-14 02:35:32 +0800
committerMark Hung <marklh9@gmail.com>2017-11-17 10:02:21 +0100
commitb843db1a8e3f50bc88e4278cd330bba86a62a206 (patch)
tree8423f9e86d839d90b03a106d2bdbd0ccc90da167 /vcl/source
parentc2ea797abf377c4a6a1d01de93a638aa5f068183 (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')
-rw-r--r--vcl/source/font/fontmetric.cxx33
-rw-r--r--vcl/source/outdev/font.cxx1
2 files changed, 19 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:
*
diff --git a/vcl/source/outdev/font.cxx b/vcl/source/outdev/font.cxx
index 2a5d88852fb2..9a44a10fb469 100644
--- a/vcl/source/outdev/font.cxx
+++ b/vcl/source/outdev/font.cxx
@@ -1078,6 +1078,7 @@ bool OutputDevice::ImplNewFont() const
pFontInstance->mxFontMetric->ImplInitTextLineSize( this );
pFontInstance->mxFontMetric->ImplInitAboveTextLineSize();
+ pFontInstance->mxFontMetric->ImplInitFlags( this );
pFontInstance->mnLineHeight = pFontInstance->mxFontMetric->GetAscent() + pFontInstance->mxFontMetric->GetDescent();