summaryrefslogtreecommitdiff
path: root/vcl/win/source/gdi/salgdi3.cxx
diff options
context:
space:
mode:
Diffstat (limited to 'vcl/win/source/gdi/salgdi3.cxx')
-rw-r--r--vcl/win/source/gdi/salgdi3.cxx15
1 files changed, 11 insertions, 4 deletions
diff --git a/vcl/win/source/gdi/salgdi3.cxx b/vcl/win/source/gdi/salgdi3.cxx
index d1b5a9cfdeae..01fecec94b2f 100644
--- a/vcl/win/source/gdi/salgdi3.cxx
+++ b/vcl/win/source/gdi/salgdi3.cxx
@@ -1760,8 +1760,11 @@ USHORT WinSalGraphics::SetFont( ImplFontSelectData* pFont, int nFallbackLevel )
// -----------------------------------------------------------------------
-void WinSalGraphics::GetFontMetric( ImplFontMetricData* pMetric )
+void WinSalGraphics::GetFontMetric( ImplFontMetricData* pMetric, int nFallbackLevel )
{
+ // temporarily change the HDC to the font in the fallback level
+ HFONT hOldFont = SelectFont( mhDC, mhFonts[nFallbackLevel] );
+
if ( aSalShlData.mbWNT )
{
wchar_t aFaceName[LF_FACESIZE+60];
@@ -1775,8 +1778,12 @@ void WinSalGraphics::GetFontMetric( ImplFontMetricData* pMetric )
pMetric->maName = ImplSalGetUniString( aFaceName );
}
+ // get the font metric
TEXTMETRICA aWinMetric;
- if( !GetTextMetricsA( mhDC, &aWinMetric ) )
+ const bool bOK = GetTextMetricsA( mhDC, &aWinMetric );
+ // restore the HDC to the font in the base level
+ SelectFont( mhDC, hOldFont );
+ if( !bOK )
return;
// device independent font attributes
@@ -1815,7 +1822,7 @@ void WinSalGraphics::GetFontMetric( ImplFontMetricData* pMetric )
// #107888# improved metric compatibility for Asian fonts...
// TODO: assess workaround below for CWS >= extleading
// TODO: evaluate use of aWinMetric.sTypo* members for CJK
- if( mpWinFontData[0] && mpWinFontData[0]->SupportsCJK() )
+ if( mpWinFontData[nFallbackLevel] && mpWinFontData[nFallbackLevel]->SupportsCJK() )
{
pMetric->mnIntLeading += pMetric->mnExtLeading;
@@ -1836,7 +1843,7 @@ void WinSalGraphics::GetFontMetric( ImplFontMetricData* pMetric )
// #109280# HACK korean only: increase descent for wavelines and impr
if( !aSalShlData.mbWNT )
- if( mpWinFontData[0]->SupportsKorean() )
+ if( mpWinFontData[nFallbackLevel]->SupportsKorean() )
pMetric->mnDescent += pMetric->mnExtLeading;
}