[Libreoffice-commits] core.git: vcl/win

Jan-Marek Glogowski glogow at fbihome.de
Mon Jul 9 20:12:45 UTC 2018


 vcl/win/gdi/salfont.cxx |   23 +++--------------------
 1 file changed, 3 insertions(+), 20 deletions(-)

New commits:
commit b444422244a2eb8d558499d2ffdb2cca5ddb44f3
Author: Jan-Marek Glogowski <glogow at fbihome.de>
Date:   Mon Jul 9 18:18:14 2018 +0200

    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 at eglug.org>

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;


More information about the Libreoffice-commits mailing list