From b60b3de318b4e621518681cc2824b4d9c605ae9e Mon Sep 17 00:00:00 2001 From: lecoanet Date: Wed, 17 Sep 2008 07:07:06 +0000 Subject: Added support for anti aliased font on Linux (Xft). This used the same code as on MacOs. --- generic/Image.c | 23 +++++++++++++---------- 1 file changed, 13 insertions(+), 10 deletions(-) diff --git a/generic/Image.c b/generic/Image.c index 91fca94..051dbde 100644 --- a/generic/Image.c +++ b/generic/Image.c @@ -1128,6 +1128,9 @@ ZnList DeferredGLGlyphs; #include "CharsetISO8859-15.h" #endif +#ifndef PTK_800 +#define AA_FONTS 1 +#endif static void SuckGlyphsFromServer(ZnWInfo *wi, @@ -1135,7 +1138,7 @@ SuckGlyphsFromServer(ZnWInfo *wi, { Pixmap offscreen = 0; XImage *image = NULL; -#ifdef MAC_OSX_TK +#ifdef AA_FONTS XColor *white, *black; unsigned long pixel; #endif @@ -1263,7 +1266,7 @@ SuckGlyphsFromServer(ZnWInfo *wi, if (!txf->teximage) { goto FreeAndReturn; } -#ifndef MAC_OSX_TK +#ifndef AA_FONTS memset(txf->teximage, 0, tex_height * tex_width); #endif @@ -1276,7 +1279,7 @@ SuckGlyphsFromServer(ZnWInfo *wi, glyphsPerGrab = (1 << 12) / (8 * maxSpanLength); } pixwidth = glyphsPerGrab * 8 * maxSpanLength; -#ifdef MAC_OSX_TK +#ifdef AA_FONTS offscreen = Tk_GetPixmap(wi->dpy, RootWindowOfScreen(wi->screen), (int) pixwidth, (int) height, Tk_Depth(wi->win)); #else @@ -1284,7 +1287,7 @@ SuckGlyphsFromServer(ZnWInfo *wi, (int) pixwidth, (int) height, 1); #endif xgc = XCreateGC(wi->dpy, offscreen, 0, NULL); -#ifdef MAC_OSX_TK +#ifdef AA_FONTS white = Tk_GetColor(wi->interp, wi->win, "white"); black = Tk_GetColor(wi->interp, wi->win, "black"); XSetForeground(wi->dpy, xgc, white->pixel); @@ -1294,7 +1297,7 @@ SuckGlyphsFromServer(ZnWInfo *wi, XSetBackground(wi->dpy, xgc, WhitePixelOfScreen(wi->screen)); #endif XFillRectangle(wi->dpy, offscreen, xgc, 0, 0, pixwidth, height); -#ifdef MAC_OSX_TK +#ifdef AA_FONTS XSetForeground(wi->dpy, xgc, black->pixel); #else XSetForeground(wi->dpy, xgc, BlackPixelOfScreen(wi->screen)); @@ -1319,7 +1322,7 @@ SuckGlyphsFromServer(ZnWInfo *wi, } if ((numToGrab >= glyphsPerGrab) || (i == txf->num_glyphs - 1)) { -#ifdef MAC_OSX_TK +#ifdef AA_FONTS image = XGetImage(wi->dpy, offscreen, 0, 0, pixwidth, height, AllPlanes, ZPixmap); #else image = XGetImage(wi->dpy, offscreen, 0, 0, pixwidth, height, 1, XYPixmap); @@ -1342,7 +1345,7 @@ SuckGlyphsFromServer(ZnWInfo *wi, each pixel from the image which is not that efficient. We could either do tighter packing in the pixmap or more efficient extraction from the image. Oh well. */ -#ifdef MAC_OSX_TK +#ifdef AA_FONTS pixel = XGetPixel(image, (int) (j*maxSpanLength*8) + x, y); *to = 255 - (pixel & 0xFF); #else @@ -1359,14 +1362,14 @@ SuckGlyphsFromServer(ZnWInfo *wi, numToGrab = 0; /* do we need to clear the offscreen pixmap to get more? */ if (i < txf->num_glyphs - 1) { -#ifdef MAC_OSX_TK +#ifdef AA_FONTS XSetForeground(wi->dpy, xgc, white->pixel); #else XSetForeground(wi->dpy, xgc, WhitePixelOfScreen(wi->screen)); #endif XFillRectangle(wi->dpy, offscreen, xgc, 0, 0, 8 * maxSpanLength * glyphsPerGrab, height); -#ifdef MAC_OSX_TK +#ifdef AA_FONTS XSetForeground(wi->dpy, xgc, black->pixel); #else XSetForeground(wi->dpy, xgc, BlackPixelOfScreen(wi->screen)); @@ -1378,7 +1381,7 @@ SuckGlyphsFromServer(ZnWInfo *wi, i++; } -#ifdef MAC_OSX_TK +#ifdef AA_FONTS Tk_FreeColor(black); Tk_FreeColor(white); #endif -- cgit v1.1