vcl/win/gdi/salfont.cxx | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-)
New commits: commit db146ea596c8056ef7a75d7d6c58d9293161d5da Author: Khaled Hosny <khaledho...@eglug.org> Date: Thu Jan 12 22:52:08 2017 +0200 tdf#105015: Donât ignore all printer fonts For whatever reason we query printer output device for fonts and for whatever reason GDI will only report fonts from the printer which often in formats we want to ignore. This results in aborting the application when we reject all fonts on the printer! Just special case printer output devices and hope for the best. I think this commit is partially blamed as it is evidenced now that there was a good reason to only abort for window output devices, but Iâm leaving this as it is for now: commit ea7102c93c33884a68d4dba0de7d52f8ed4f4579 Author: Chris Sherlock <chris.sherloc...@gmail.com> Date: Tue Mar 25 21:54:20 2014 +1100 fdo#74702 OutputDevice::ImplInitFontList() fails if no fonts on device It makes no sense that ImplInitFontList() only fails for Window instances. I have carefully checked all the functions that use this function, and there are no good cases when no fonts won't cause problems. In fact, we have a number of functions that specifically rely on the fact that ImplInitFontList will populate OutputDevice::mpFontCollection with at least one font. Therefore, I'm making this abort if it can't populate the collection, regardless of whether it is a Window, Printer or VirtualDevice. I have also refactored GetDefaultDevice - I now check the default pOutDev parameter to see if it is NULL (the default), in which case it is referring to the default window, so I call on Application::GetDefaultDevice() instead of going straight to the pimpl data structure used by the Application class. Reviewed-on: https://gerrit.libreoffice.org/33014 Tested-by: Jenkins <c...@libreoffice.org> Reviewed-by: Caolán McNamara <caol...@redhat.com> Tested-by: Caolán McNamara <caol...@redhat.com> (cherry picked from commit 88d6675a40034fa786efd75cf14175f3c0c83e2e) Change-Id: I3f34ba0cea9f88966ace3a5ef7fac868972ea5ac Reviewed-on: https://gerrit.libreoffice.org/33087 Tested-by: Jenkins <c...@libreoffice.org> Reviewed-by: Khaled Hosny <khaledho...@eglug.org> diff --git a/vcl/win/gdi/salfont.cxx b/vcl/win/gdi/salfont.cxx index d1332ae8..5c4d834 100644 --- a/vcl/win/gdi/salfont.cxx +++ b/vcl/win/gdi/salfont.cxx @@ -336,6 +336,7 @@ struct ImplEnumInfo PhysicalFontCollection* mpList; OUString* mpName; LOGFONTW* mpLogFont; + bool mbPrinter; int mnFontCount; }; @@ -1057,10 +1058,19 @@ int CALLBACK SalEnumFontsProcExW( const LOGFONTW* lpelfe, } else { + // Ignore non-device fonts on printers. + if (pInfo->mbPrinter) + { + if ((nFontType & RASTER_FONTTYPE) && !(nFontType & DEVICE_FONTTYPE)) + { + SAL_INFO("vcl.gdi", "Unsupported printer font ignored: " << OUString(pLogFont->elfLogFont.lfFaceName)); + return 1; + } + } // Only SFNT fonts are supported, ignore anything else. - if (!(nFontType & TRUETYPE_FONTTYPE) && - !(pMetric->ntmTm.ntmFlags & NTM_PS_OPENTYPE) && - !(pMetric->ntmTm.ntmFlags & NTM_TT_OPENTYPE)) + else if (!(nFontType & TRUETYPE_FONTTYPE) && + !(pMetric->ntmTm.ntmFlags & NTM_PS_OPENTYPE) && + !(pMetric->ntmTm.ntmFlags & NTM_TT_OPENTYPE)) { SAL_INFO("vcl.gdi", "Unsupported font ignored: " << OUString(pLogFont->elfLogFont.lfFaceName)); return 1; @@ -1323,6 +1333,7 @@ void WinSalGraphics::GetDevFontList( PhysicalFontCollection* pFontCollection ) aInfo.mhDC = getHDC(); aInfo.mpList = pFontCollection; aInfo.mpName = nullptr; + aInfo.mbPrinter = mbPrinter; aInfo.mnFontCount = 0; LOGFONTW aLogFont;
_______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits