summaryrefslogtreecommitdiff
path: root/vcl
diff options
context:
space:
mode:
authorKhaled Hosny <khaledhosny@eglug.org>2017-01-12 22:52:08 +0200
committerCaolán McNamara <caolanm@redhat.com>2017-01-13 11:40:58 +0000
commit88d6675a40034fa786efd75cf14175f3c0c83e2e (patch)
tree71e0d2818adcd142edf5f3d0b007f19707d93122 /vcl
parent464f109cb6f506b26a500a90eeba32c42432b83d (diff)
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.sherlock79@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. Change-Id: I3f34ba0cea9f88966ace3a5ef7fac868972ea5ac Reviewed-on: https://gerrit.libreoffice.org/33014 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Caolán McNamara <caolanm@redhat.com> Tested-by: Caolán McNamara <caolanm@redhat.com>
Diffstat (limited to 'vcl')
-rw-r--r--vcl/win/gdi/salfont.cxx17
1 files changed, 11 insertions, 6 deletions
diff --git a/vcl/win/gdi/salfont.cxx b/vcl/win/gdi/salfont.cxx
index 9de0541c2797..8c120c00881f 100644
--- a/vcl/win/gdi/salfont.cxx
+++ b/vcl/win/gdi/salfont.cxx
@@ -1406,22 +1406,27 @@ int CALLBACK SalEnumFontsProcExW( const LOGFONTW* lpelfe,
}
else
{
+ // Ignore non-device font on printer.
+ 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 (SalLayout::UseCommonLayout() || OpenGLWrapper::isVCLOpenGLEnabled())
+ else if (SalLayout::UseCommonLayout() || OpenGLWrapper::isVCLOpenGLEnabled())
{
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;
+ return 1;
}
}
- // Ignore non-device font on printer.
- if (pInfo->mbPrinter && !(nFontType & DEVICE_FONTTYPE))
- return 1;
-
WinFontFace* pData = ImplLogMetricToDevFontDataW( pLogFont, &(pMetric->ntmTm), nFontType );
pData->SetFontId( sal_IntPtr( pInfo->mnFontCount++ ) );