Some fixes for Xft > 1

This commit is contained in:
eknauel 2003-11-16 08:33:50 +00:00
parent db62ff412d
commit 26bd8b06e6
2 changed files with 31 additions and 1 deletions

View File

@ -263,7 +263,7 @@ s48_value scx_XftDrawDisplay(s48_value sxd)
s48_value scx_XftDrawDrawable(s48_value sxd) s48_value scx_XftDrawDrawable(s48_value sxd)
{ {
#if SCX_XFT_VERSION > 1 #if SCX_XFT_VERSION > 1
return scx_enter_drawable(XftDrawDrawabale(scx_extract_xftdraw(sxd))); return scx_enter_drawable(XftDrawDrawable(scx_extract_xftdraw(sxd)));
#else #else
return S48_FALSE; return S48_FALSE;
#endif #endif
@ -381,17 +381,26 @@ s48_value scx_XftListFontsPatternObjects(s48_value sdpy, s48_value sscreenno,
S48_DECLARE_GC_PROTECT(4); S48_DECLARE_GC_PROTECT(4);
S48_GC_PROTECT_4(sdpy, sscreenno, sxp, sxo); 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), fs = XftListFontsPatternObjects(scx_extract_display(sdpy),
s48_extract_integer(sscreenno), s48_extract_integer(sscreenno),
scx_extract_xftpattern(sxp), scx_extract_xftpattern(sxp),
scx_extract_xftobjectset(sxo)); scx_extract_xftobjectset(sxo));
#endif
S48_GC_UNPROTECT(); S48_GC_UNPROTECT();
return scx_enter_xftfontset(fs); return scx_enter_xftfontset(fs);
} }
s48_value scx_XftFontSetCreate(void) s48_value scx_XftFontSetCreate(void)
{ {
#if XFT_VERSION > 1
return scx_enter_xftfontset(FcFontSetCreate());
#else
return scx_enter_xftfontset(XftFontSetCreate()); return scx_enter_xftfontset(XftFontSetCreate());
#endif
} }
s48_value scx_XftFontSetDestroy(s48_value sxfs) 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_DECLARE_GC_PROTECT(2);
S48_GC_PROTECT_2(sxfs, sxp); 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), b = XftFontSetAdd(scx_extract_xftfontset(sxfs),
scx_extract_xftpattern(sxp)); scx_extract_xftpattern(sxp));
#endif
S48_GC_UNPROTECT(); S48_GC_UNPROTECT();
return b ? S48_TRUE : S48_FALSE; 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) s48_value scx_XftPatternPrint(s48_value sxp)
{ {
#if XFT_VERSION > 1
FcPatternPrint(scx_extract_xftpattern(sxp));
#else
XftPatternPrint(scx_extract_xftpattern(sxp)); XftPatternPrint(scx_extract_xftpattern(sxp));
#endif
return S48_UNSPECIFIC; return S48_UNSPECIFIC;
} }
s48_value scx_XftFontSetPrint(s48_value sxfs) s48_value scx_XftFontSetPrint(s48_value sxfs)
{ {
#if XFT_VERSION > 1
FcFontSetPrint(scx_extract_xftfontset(sxfs));
#else
XftFontSetPrint(scx_extract_xftfontset(sxfs)); XftFontSetPrint(scx_extract_xftfontset(sxfs));
#endif
return S48_UNSPECIFIC; return S48_UNSPECIFIC;
} }
@ -530,6 +552,10 @@ s48_value scx_xftfontset_pattern_ref(s48_value sxfs, s48_value index)
void scx_xft_init(void) 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_xftpattern_record_type, "xft-pattern");
XFT_GC_PROTECT_IMPORT_BINDING(scx_xftfont_record_type, "xft-font"); XFT_GC_PROTECT_IMPORT_BINDING(scx_xftfont_record_type, "xft-font");
XFT_GC_PROTECT_IMPORT_BINDING(scx_xftdraw_record_type, "xft-draw"); XFT_GC_PROTECT_IMPORT_BINDING(scx_xftdraw_record_type, "xft-draw");

View File

@ -38,6 +38,10 @@
#define SCX_XFT_CHAR_WIDTH 22 /* Int */ #define SCX_XFT_CHAR_WIDTH 22 /* Int */
#define SCX_XFT_CHAR_HEIGHT 23 /* Int */ #define SCX_XFT_CHAR_HEIGHT 23 /* Int */
#if XFT_VERSION > 1
static FcConfig *global_fcconfig;
#endif
enum xft_pattern_get_return_type { enum xft_pattern_get_return_type {
SCX_XFT_INVALID, SCX_XFT_INVALID,
SCX_XFT_UNIMPLEMENTED, SCX_XFT_UNIMPLEMENTED,