From 26bd8b06e69b3c0d9115656058187a0df016046e Mon Sep 17 00:00:00 2001 From: eknauel Date: Sun, 16 Nov 2003 08:33:50 +0000 Subject: [PATCH] Some fixes for Xft > 1 --- c/libs/xft.c | 28 +++++++++++++++++++++++++++- c/libs/xft.h | 4 ++++ 2 files changed, 31 insertions(+), 1 deletion(-) diff --git a/c/libs/xft.c b/c/libs/xft.c index 44465c6..94de5cb 100644 --- a/c/libs/xft.c +++ b/c/libs/xft.c @@ -263,7 +263,7 @@ s48_value scx_XftDrawDisplay(s48_value sxd) s48_value scx_XftDrawDrawable(s48_value sxd) { #if SCX_XFT_VERSION > 1 - return scx_enter_drawable(XftDrawDrawabale(scx_extract_xftdraw(sxd))); + return scx_enter_drawable(XftDrawDrawable(scx_extract_xftdraw(sxd))); #else return S48_FALSE; #endif @@ -381,17 +381,26 @@ s48_value scx_XftListFontsPatternObjects(s48_value sdpy, s48_value sscreenno, S48_DECLARE_GC_PROTECT(4); S48_GC_PROTECT_4(sdpy, sscreenno, sxp, sxo); +#if XFT_VERSION > 1 + fs = FcFontList(global_fcconfig, scx_extract_xftpattern(sxp), + scx_extract_xftobjectset(sxo)); +#else fs = XftListFontsPatternObjects(scx_extract_display(sdpy), s48_extract_integer(sscreenno), scx_extract_xftpattern(sxp), scx_extract_xftobjectset(sxo)); +#endif S48_GC_UNPROTECT(); return scx_enter_xftfontset(fs); } s48_value scx_XftFontSetCreate(void) { +#if XFT_VERSION > 1 + return scx_enter_xftfontset(FcFontSetCreate()); +#else return scx_enter_xftfontset(XftFontSetCreate()); +#endif } s48_value scx_XftFontSetDestroy(s48_value sxfs) @@ -406,8 +415,13 @@ s48_value scx_XftFontSetAdd(s48_value sxfs, s48_value sxp) S48_DECLARE_GC_PROTECT(2); S48_GC_PROTECT_2(sxfs, sxp); +#if XFT_VERSION > 1 + b = FcFontSetAdd(scx_extract_xftfontset(sxfs), + scx_extract_xftpattern(sxp)); +#else b = XftFontSetAdd(scx_extract_xftfontset(sxfs), scx_extract_xftpattern(sxp)); +#endif S48_GC_UNPROTECT(); return b ? S48_TRUE : S48_FALSE; } @@ -465,13 +479,21 @@ s48_value scx_XftColorFree(s48_value sdpy, s48_value svisual, s48_value scx_XftPatternPrint(s48_value sxp) { +#if XFT_VERSION > 1 + FcPatternPrint(scx_extract_xftpattern(sxp)); +#else XftPatternPrint(scx_extract_xftpattern(sxp)); +#endif return S48_UNSPECIFIC; } s48_value scx_XftFontSetPrint(s48_value sxfs) { +#if XFT_VERSION > 1 + FcFontSetPrint(scx_extract_xftfontset(sxfs)); +#else XftFontSetPrint(scx_extract_xftfontset(sxfs)); +#endif return S48_UNSPECIFIC; } @@ -530,6 +552,10 @@ s48_value scx_xftfontset_pattern_ref(s48_value sxfs, s48_value index) void scx_xft_init(void) { +#if XFT_VERSION > 1 + global_fcconfig = FcInitLoadConfig(); +#endif + XFT_GC_PROTECT_IMPORT_BINDING(scx_xftpattern_record_type, "xft-pattern"); XFT_GC_PROTECT_IMPORT_BINDING(scx_xftfont_record_type, "xft-font"); XFT_GC_PROTECT_IMPORT_BINDING(scx_xftdraw_record_type, "xft-draw"); diff --git a/c/libs/xft.h b/c/libs/xft.h index bbcb069..54f6487 100644 --- a/c/libs/xft.h +++ b/c/libs/xft.h @@ -38,6 +38,10 @@ #define SCX_XFT_CHAR_WIDTH 22 /* Int */ #define SCX_XFT_CHAR_HEIGHT 23 /* Int */ +#if XFT_VERSION > 1 +static FcConfig *global_fcconfig; +#endif + enum xft_pattern_get_return_type { SCX_XFT_INVALID, SCX_XFT_UNIMPLEMENTED,