static int _XftCloseDisplay (Display *dpy, XExtCodes *codes) { XftDisplayInfo *info, **prev; info = _XftDisplayInfoGet (dpy, FcFalse); if (!info) return 0; /* * Get rid of any dangling unreferenced fonts */ info->max_unref_fonts = 0; XftFontManageMemory (dpy); /* * Clean up the default values */ if (info->defaults) FcPatternDestroy (info->defaults); /* * Unhook from the global list */ for (prev = &_XftDisplayInfo; (info = *prev); prev = &(*prev)->next) if (info->display == dpy) break; *prev = info->next; free (info); return 0; }
Bool XftDefaultSet (Display *dpy, XftPattern *defaults) { XftDisplayInfo *info = _XftDisplayInfoGet (dpy); if (!info) return False; if (info->defaults) XftPatternDestroy (info->defaults); info->defaults = defaults; return True; }
Bool XftDefaultHasRender (Display *dpy) { #ifdef FREETYPE2 XftDisplayInfo *info = _XftDisplayInfoGet (dpy); if (!info) return False; return info->hasRender; #else return False; #endif }
static XftResult _XftDefaultGet (Display *dpy, const char *object, int screen, XftValue *v) { XftDisplayInfo *info = _XftDisplayInfoGet (dpy); XftResult r; if (!info) return XftResultNoMatch; if (!info->defaults) { info->defaults = _XftDefaultInit (dpy); if (!info->defaults) return XftResultNoMatch; } r = XftPatternGet (info->defaults, object, screen, v); if (r == XftResultNoId && screen > 0) r = XftPatternGet (info->defaults, object, 0, v); return r; }
XftFontSet * XftDisplayGetFontSet (Display *dpy) { XftDisplayInfo *info = _XftDisplayInfoGet (dpy); if (!info) return 0; if (!info->coreFonts) { info->coreFonts = XftFontSetCreate (); if (info->coreFonts) { if (!XftCoreAddFonts (info->coreFonts, dpy, XftDefaultGetBool (dpy, XFT_SCALABLE, DefaultScreen (dpy), False))) { XftFontSetDestroy (info->coreFonts); info->coreFonts = 0; } } } return info->coreFonts; }