mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-25 05:41:12 +00:00
Bug 1279785 - check for Xft lcdfilter resource when creating fontconfig fonts. r=karlt
This commit is contained in:
parent
cf08cc2a13
commit
84787f181a
@ -32,6 +32,10 @@
|
||||
#include "gfxPlatformGtk.h"
|
||||
#endif
|
||||
|
||||
#ifdef MOZ_X11
|
||||
#include "mozilla/X11Util.h"
|
||||
#endif
|
||||
|
||||
using namespace mozilla;
|
||||
using namespace mozilla::unicode;
|
||||
|
||||
@ -717,6 +721,29 @@ gfxFontconfigFontEntry::CreateScaledFont(FcPattern* aRenderPattern,
|
||||
static void ApplyGdkScreenFontOptions(FcPattern *aPattern);
|
||||
#endif
|
||||
|
||||
#ifdef MOZ_X11
|
||||
static bool
|
||||
GetXftInt(Display* aDisplay, const char* aName, int* aResult)
|
||||
{
|
||||
if (!aDisplay) {
|
||||
return false;
|
||||
}
|
||||
char* value = XGetDefault(aDisplay, "Xft", aName);
|
||||
if (!value) {
|
||||
return false;
|
||||
}
|
||||
if (FcNameConstant(ToFcChar8Ptr(value), aResult)) {
|
||||
return true;
|
||||
}
|
||||
char* end;
|
||||
*aResult = strtol(value, &end, 0);
|
||||
if (end != value) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
#endif
|
||||
|
||||
static void
|
||||
PreparePattern(FcPattern* aPattern, bool aIsPrinterFont)
|
||||
{
|
||||
@ -745,6 +772,16 @@ PreparePattern(FcPattern* aPattern, bool aIsPrinterFont)
|
||||
#ifdef MOZ_WIDGET_GTK
|
||||
ApplyGdkScreenFontOptions(aPattern);
|
||||
#endif
|
||||
|
||||
#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);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
FcDefaultSubstitute(aPattern);
|
||||
|
Loading…
Reference in New Issue
Block a user