commit e1e2517a187f7a867f819c7294e62d93ad32b1ba Author: Richard Pospesel richard@torproject.org Date: Mon Nov 27 15:04:21 2017 -0800
Bug 23970: Printing to a file is broken with Linux content sandboxing enabled
Ported over firefox patch 997c6b961cd0 (Bug 1329835) --- gfx/thebes/gfxFcPlatformFontList.cpp | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-)
diff --git a/gfx/thebes/gfxFcPlatformFontList.cpp b/gfx/thebes/gfxFcPlatformFontList.cpp index 601e7a90cbd6..19471157ba84 100644 --- a/gfx/thebes/gfxFcPlatformFontList.cpp +++ b/gfx/thebes/gfxFcPlatformFontList.cpp @@ -768,18 +768,20 @@ PreparePattern(FcPattern* aPattern, bool aIsPrinterFont) FcPatternAddBool(aPattern, PRINTING_FC_PROPERTY, FcTrue); } else { #ifdef MOZ_WIDGET_GTK - ApplyGdkScreenFontOptions(aPattern); -#endif + ApplyGdkScreenFontOptions(aPattern);
#ifdef MOZ_X11 FcValue value; int lcdfilter; - if (FcPatternGet(aPattern, FC_LCD_FILTER, 0, &value) - == FcResultNoMatch && - GetXftInt(DefaultXDisplay(), "lcdfilter", &lcdfilter)) { - FcPatternAddInteger(aPattern, FC_LCD_FILTER, lcdfilter); + if (FcPatternGet(aPattern, FC_LCD_FILTER, 0, &value) == FcResultNoMatch) { + GdkDisplay* dpy = gdk_display_get_default(); + if (GDK_IS_X11_DISPLAY(dpy) && + GetXftInt(GDK_DISPLAY_XDISPLAY(dpy), "lcdfilter", &lcdfilter)) { + FcPatternAddInteger(aPattern, FC_LCD_FILTER, lcdfilter); + } } -#endif +#endif // MOZ_X11 +#endif // MOZ_WIDGET_GTK }
FcDefaultSubstitute(aPattern);