From b444422244a2eb8d558499d2ffdb2cca5ddb44f3 Mon Sep 17 00:00:00 2001 From: Jan-Marek Glogowski Date: Mon, 9 Jul 2018 18:18:14 +0200 Subject: 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 --- vcl/win/gdi/salfont.cxx | 23 +++-------------------- 1 file 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(mfFontScale[nFallbackLevel] * nKashidaWidth)); - } - } + rxFontMetric->SetMinKashida(mpWinFontEntry[nFallbackLevel]->GetKashidaWidth()); // get the font metric OUTLINETEXTMETRICW aOutlineMetric; -- cgit