summaryrefslogtreecommitdiff
path: root/vcl/win
diff options
context:
space:
mode:
authorJan-Marek Glogowski <glogow@fbihome.de>2018-07-09 18:18:14 +0200
committerKhaled Hosny <khaledhosny@eglug.org>2018-07-09 22:12:22 +0200
commitb444422244a2eb8d558499d2ffdb2cca5ddb44f3 (patch)
tree87dbd371591cc4bc14743493e3e496fc6f7ee7d4 /vcl/win
parentfad862e290d727fc9fefe206f6e4b807482c4175 (diff)
WIN GetFontMetric doesn't matter for GetEmbedFontData
so there should always be a valid mpWinFontEntry[nFallbackLevel]. Change-Id: I27f7a5a72c50d10a88538d02f1510f583ae6df35 Reviewed-on: https://gerrit.libreoffice.org/57192 Tested-by: Jenkins Reviewed-by: Khaled Hosny <khaledhosny@eglug.org>
Diffstat (limited to 'vcl/win')
-rw-r--r--vcl/win/gdi/salfont.cxx23
1 files changed, 3 insertions, 20 deletions
diff --git a/vcl/win/gdi/salfont.cxx b/vcl/win/gdi/salfont.cxx
index 5cf7f4354480..e90b25363cd6 100644
--- a/vcl/win/gdi/salfont.cxx
+++ b/vcl/win/gdi/salfont.cxx
@@ -978,11 +978,8 @@ void WinSalGraphics::SetFont( const FontSelectPattern* pFont, int nFallbackLevel
void WinSalGraphics::GetFontMetric( ImplFontMetricDataRef& rxFontMetric, int nFallbackLevel )
{
// temporarily change the HDC to the font in the fallback level
- const HFONT hFallbackFont = mhFonts[nFallbackLevel] ? mhFonts[nFallbackLevel]
- : mpWinFontEntry[nFallbackLevel]->GetHFONT();
- assert((mhFonts[nFallbackLevel] && !mpWinFontEntry[nFallbackLevel]) ||
- (!mhFonts[nFallbackLevel] && mpWinFontEntry[nFallbackLevel]));
- const HFONT hOldFont = SelectFont(getHDC(), hFallbackFont);
+ assert(!mhFonts[nFallbackLevel] && mpWinFontEntry[nFallbackLevel]);
+ const HFONT hOldFont = SelectFont(getHDC(), mpWinFontEntry[nFallbackLevel]->GetHFONT());
wchar_t aFaceName[LF_FACESIZE+60];
if( GetTextFaceW( getHDC(), SAL_N_ELEMENTS(aFaceName), aFaceName ) )
@@ -993,21 +990,7 @@ void WinSalGraphics::GetFontMetric( ImplFontMetricDataRef& rxFontMetric, int nFa
const RawFontData aHheaRawData(getHDC(), nHheaTag);
const RawFontData aOS2RawData(getHDC(), nOS2Tag);
- if (mpWinFontEntry[nFallbackLevel])
- rxFontMetric->SetMinKashida(mpWinFontEntry[nFallbackLevel]->GetKashidaWidth());
- else
- {
- // Calculate Kashida width without mpWinFontEntry for embedded fonts
- WCHAR nKashidaCh = 0x0640;
- WORD nKashidaGid;
- DWORD ret = GetGlyphIndicesW(getHDC(), &nKashidaCh, 1, &nKashidaGid, GGI_MARK_NONEXISTING_GLYPHS);
- if (ret != GDI_ERROR && nKashidaGid != 0xFFFF)
- {
- int nKashidaWidth = 0;
- if (GetCharWidthI(getHDC(), nKashidaGid, 1, nullptr, &nKashidaWidth))
- rxFontMetric->SetMinKashida(static_cast<int>(mfFontScale[nFallbackLevel] * nKashidaWidth));
- }
- }
+ rxFontMetric->SetMinKashida(mpWinFontEntry[nFallbackLevel]->GetKashidaWidth());
// get the font metric
OUTLINETEXTMETRICW aOutlineMetric;