1
0
mirror of https://github.com/gryf/wmaker.git synced 2026-01-06 13:54:12 +01:00

Added Xft support in WINGs (for drawing antialiased fonts with transparency)

Details in WINGs/ChangeLog and WINGs/NEWS
This commit is contained in:
dan
2002-10-09 05:14:28 +00:00
parent a2b404b5b3
commit 17f26077b0
18 changed files with 412 additions and 142 deletions

View File

@@ -16,6 +16,8 @@ Changes since version 0.80.1:
- Removed obsoleted acconfig.h and implemented its functionality using
AC_DEFINE and AC_DEFINE_UNQUOTED as autoconf 2.5x recommends.
This will definitely enforce the need to use autoconf 2.5x
- Added Xft support to WINGs, for rendering antialiased fonts with
transparency. Details in WINGs/ChangeLog.
Changes since version 0.80.0:

View File

@@ -10,6 +10,12 @@ Changes since wmaker 0.80.1:
- Added alpha channel to WMColor. 2 new functions also:
WMCreateRGBAColor() and WMSetColorAlpha()
- Miscelaneous code cleanups in wtext.c
- Added Xft support in WINGs (for drawing antialiased fonts with transparency).
- Added a new function: WMCreateAAFont() to create a font which will be
drawn antialiased using Xft (if available, else function returns NULL)
- New options in WMGLOBAL: AntialiasedText, AASystemFont and AABoldSystemFont.
Check NEWS for details.
- Fixed some improper calls to snprintf in wfont.c
Changes since wmaker 0.80.0:

View File

@@ -7,7 +7,7 @@ noinst_PROGRAMS = connect server fontl puzzle
LDADD= $(top_builddir)/WINGs/libWINGs.a $(top_builddir)/wrlib/libwraster.la \
@INTLIBS@
@XFTLIBS@ @INTLIBS@
fontl_DEPENDENCIES = $(top_builddir)/WINGs/libWINGs.a

View File

@@ -27,7 +27,7 @@ INCLUDES = -I$(top_srcdir)/wrlib -I$(top_srcdir)/WINGs \
-DRESOURCE_PATH=\"$(datadir)/WINGs\" @HEADER_SEARCH_PATH@ -DDEBUG
LDADD= $(top_builddir)/WINGs/libWINGs.a $(top_builddir)/wrlib/libwraster.la \
@INTLIBS@
@XFTLIBS@ @INTLIBS@
test_LDADD = wtableview.o wtabledelegates.o $(LDADD)

View File

@@ -1,3 +1,47 @@
*** Wed Oct 9 07:10:04 EEST 2002 - Dan
Xft support in WINGs
--------------------
If Xft is detected when configure it is run, support for drawing antialiased
fonts with transparency will be compiled into WINGs.
You need at least Xfree86 version 4.0.x for this but at least 4.1.x is
recommended.
For Xft support there is a new function to create a font that will render
using antialiasing and transparency: WMCreateAAFont().
Passing such a font to WMDrawString() or WMDrawImageString() will result
in antialiased text displayed on screen. Modifying the alpha value for the
WMColor passed to WMDrawString() or WMDrawImageString() will result in text
being displayed with the appropriate transparency.
To control antialiased font behavior, there are 3 new options that go into
WMGLOBAL. Two of them are to set the system font used when an antialiased
font is required. They operate in a similar way as SystemFont and
BoldSystemFont, just they are used when antialiased fonts are requested.
They are named AASystemFont respectively AABoldSystemFont. They are kept
separate from SystemFont and BoldSystemFont because the same fonts don't
render well as both normal and antialiased if they are not TrueType fonts.
Even though you can specify any font in the XLFD format for these new
options, it is recomended to use TrueType fonts for the antialiased case
since other fonts (standard X fonts) don't render well and give ugly
results.
The third option is an option that globally controls if WINGs uses or not
antialiased fonts. It is named AntialiasedText and it has a boolean Yes/No
value. If set to Yes, WINGs will try to use antialiased fonts (if support
was compiled in, and antialiased fonts can be found) then revert to normal
fonts if not possible. Note that this applies if WMCreateFont(),
WMSystemFont(), WMSystemFontOfSize(), WMBoldSystemFont() or
WMBoldSystemFontOFize() are used. If any of the direct creation functions
are used, such as WMCreateAAFont() or WMCreateNormalFont(), then that kind
of font is returned independently of the value of AntialiasedText.
(However note that an antialiased font cannot be created if Xft support was
no compiled into WINGs, even if you call WMCreateAAFont() directly. In this
case WMCreateAAFont() will always return NULL)
*** Mon Sep 09 06:58:30 EEST 2002 - Dan
New delegate for the WMConnection class

View File

@@ -5,7 +5,7 @@ AUTOMAKE_OPTIONS = no-dependencies
noinst_PROGRAMS = wtest wmquery wmfile testmywidget
LDADD= $(top_builddir)/WINGs/libWINGs.a $(top_builddir)/wrlib/libwraster.la \
@INTLIBS@
@XFTLIBS@ @INTLIBS@
testmywidget_SOURCES = testmywidget.c mywidget.c mywidget.h

View File

@@ -1292,6 +1292,7 @@ main(int argc, char **argv)
testDragAndDrop(scr);
testText(scr);
testFontPanel(scr);
#if 0
testColorPanel(scr);
testScrollView(scr);

View File

@@ -7,7 +7,7 @@
#include <WINGs/WUtil.h>
#include <X11/Xlib.h>
#define WINGS_H_VERSION 20020104
#define WINGS_H_VERSION 20021008
#ifdef __cplusplus
@@ -699,6 +699,8 @@ WMFont* WMCreateFontSet(WMScreen *scrPtr, char *fontName);
WMFont* WMCreateNormalFont(WMScreen *scrPtr, char *fontName);
WMFont* WMCreateAAFont(WMScreen *scrPtr, char *fontName);
WMFont* WMCreateFont(WMScreen *scrPtr, char *fontName);
WMFont* WMRetainFont(WMFont *font);

View File

@@ -8,7 +8,7 @@
#include <WINGs/WINGs.h>
#if WINGS_H_VERSION < 20020104
#if WINGS_H_VERSION < 20021008
#error There_is_an_old_WINGs.h_file_somewhere_in_your_system._Please_remove_it.
#endif
@@ -32,11 +32,11 @@ extern "C" {
#define SCROLLER_WIDTH 20
#define XDND_VERSION 4
typedef struct W_Application {
char *applicationName;
int argc;
@@ -50,13 +50,15 @@ typedef struct W_Font {
union {
XFontSet set;
XFontStruct *normal;
XFontStruct *normal;
struct _XftFont *xft;
} font;
short height;
short y;
short refCount;
char *name;
unsigned int notFontSet:1;
unsigned int antialiased:1;
} W_Font;
@@ -197,12 +199,14 @@ typedef struct W_Screen {
WMHashTable *fontSetCache;
Bool useMultiByte;
Bool antialiasedText;
unsigned int ignoredModifierMask; /* modifiers to ignore when typing txt */
struct W_Balloon *balloon;
struct W_Pixmap *checkButtonImageOn;
struct W_Pixmap *checkButtonImageOff;
@@ -404,7 +408,10 @@ typedef struct W_EventHandler {
typedef struct _WINGsConfiguration {
char *systemFont;
char *boldSystemFont;
char *aaSystemFont;
char *aaBoldSystemFont;
int defaultFontSize;
Bool antialiasedText;
Bool useMultiByte;
char *floppyPath;
unsigned doubleClickDelay;
@@ -428,10 +435,10 @@ extern _WINGsConfiguration WINGsConfiguration;
#define W_VIEW_DISPLAY(view) (view)->screen->display
#define W_VIEW_SCREEN(view) (view)->screen
#define W_VIEW_DRAWABLE(view) (view)->window
#define W_VIEW_WIDTH(view) (view)->size.width
#define W_VIEW_HEIGHT(view) (view)->size.height
#define W_PIXEL(c) (c)->color.pixel
@@ -480,7 +487,7 @@ void W_ResizeView(W_View *view, unsigned int width, unsigned int height);
void W_SetViewBackgroundColor(W_View *view, WMColor *color);
void W_SetViewCursor(W_View *view, Cursor cursor);
void W_DrawRelief(W_Screen *scr, Drawable d, int x, int y, unsigned int width,
unsigned int height, WMReliefType relief);

View File

@@ -1,6 +1,7 @@
#include "WINGsP.h"
#include "wconfig.h"
#include <X11/Xlocale.h>
@@ -13,6 +14,10 @@ _WINGsConfiguration WINGsConfiguration;
#define BOLD_SYSTEM_FONT "-*-helvetica-bold-r-normal-*-%d-*-*-*-*-*-*-*,-*-*-bold-r-*-*-%d-*-*-*-*-*-*-*"
#define AASYSTEM_FONT "-*-arial-medium-r-normal-*-%d-*-*-*-*-*-*-*"
#define AABOLD_SYSTEM_FONT "-*-arial-bold-r-normal-*-%d-*-*-*-*-*-*-*"
#define FLOPPY_PATH "/floppy"
@@ -60,6 +65,19 @@ W_ReadConfigurations(void)
WINGsConfiguration.boldSystemFont =
WMGetUDStringForKey(defaults, "BoldSystemFont");
WINGsConfiguration.aaSystemFont =
WMGetUDStringForKey(defaults, "AASystemFont");
WINGsConfiguration.aaBoldSystemFont =
WMGetUDStringForKey(defaults, "AABoldSystemFont");
#ifdef XFT
WINGsConfiguration.antialiasedText =
WMGetUDBoolForKey(defaults, "AntialiasedText");
#else
WINGsConfiguration.antialiasedText = False;
#endif
WINGsConfiguration.useMultiByte = False;
str = WMGetUDStringForKey(defaults, "MultiByteText");
if (str) {
@@ -121,6 +139,12 @@ W_ReadConfigurations(void)
if (!WINGsConfiguration.boldSystemFont) {
WINGsConfiguration.boldSystemFont = BOLD_SYSTEM_FONT;
}
if (!WINGsConfiguration.aaSystemFont) {
WINGsConfiguration.aaSystemFont = AASYSTEM_FONT;
}
if (!WINGsConfiguration.aaBoldSystemFont) {
WINGsConfiguration.aaBoldSystemFont = AABOLD_SYSTEM_FONT;
}
if (!WINGsConfiguration.floppyPath) {
WINGsConfiguration.floppyPath = FLOPPY_PATH;
}

View File

@@ -1,19 +1,25 @@
#include "wconfig.h"
#ifdef XFT
# include <X11/Xft/Xft.h>
#endif
#include "WINGsP.h"
#include "wconfig.h"
#include <wraster.h>
#include <assert.h>
#include <X11/Xlocale.h>
static char *makeFontSetOfSize(char *fontset, int size);
/* XLFD pattern matching */
static char*
xlfd_get_element (const char *xlfd, int index)
getElementFromXLFD(const char *xlfd, int index)
{
const char *p = xlfd;
while (*p != 0) {
@@ -33,15 +39,16 @@ xlfd_get_element (const char *xlfd, int index)
return strdup("*");
}
/* XLFD pattern matching */
static char*
generalize_xlfd (const char *xlfd)
generalizeXLFD(const char *xlfd)
{
char *buf;
int len;
char *weight = xlfd_get_element(xlfd, 3);
char *slant = xlfd_get_element(xlfd, 4);
char *pxlsz = xlfd_get_element(xlfd, 7);
char *weight = getElementFromXLFD(xlfd, 3);
char *slant = getElementFromXLFD(xlfd, 4);
char *pxlsz = getElementFromXLFD(xlfd, 7);
#define Xstrlen(A) ((A)?strlen(A):0)
len = Xstrlen(xlfd)+Xstrlen(weight)+Xstrlen(slant)+Xstrlen(pxlsz)*2+60;
@@ -85,7 +92,7 @@ W_CreateFontSetWithGuess(Display *dpy, char *xlfd, char ***missing,
xlfd = fontnames[0];
}
xlfd = generalize_xlfd (xlfd);
xlfd = generalizeXLFD(xlfd);
if (*nmissing != 0) XFreeStringList(*missing);
if (fs != NULL) XFreeFontSet(dpy, fs);
@@ -96,6 +103,7 @@ W_CreateFontSetWithGuess(Display *dpy, char *xlfd, char ***missing,
return fs;
}
WMFont*
WMCreateFontSet(WMScreen *scrPtr, char *fontName)
{
@@ -118,11 +126,12 @@ WMCreateFontSet(WMScreen *scrPtr, char *fontName)
memset(font, 0, sizeof(WMFont));
font->notFontSet = 0;
font->antialiased = 0;
font->screen = scrPtr;
font->font.set = W_CreateFontSetWithGuess(display, fontName, &missing,
&nmissing, &defaultString);
&nmissing, &defaultString);
if (nmissing > 0 && font->font.set) {
int i;
@@ -185,18 +194,18 @@ WMCreateNormalFont(WMScreen *scrPtr, char *fontName)
return NULL;
}
memset(font, 0, sizeof(WMFont));
font->notFontSet = 1;
font->antialiased = 0;
font->screen = scrPtr;
font->font.normal = XLoadQueryFont(display, fname);
if (!font->font.normal) {
wfree(font);
wfree(font);
wfree(fname);
return NULL;
}
font->height = font->font.normal->ascent+font->font.normal->descent;
font->y = font->font.normal->ascent;
@@ -210,18 +219,86 @@ WMCreateNormalFont(WMScreen *scrPtr, char *fontName)
}
WMFont*
WMCreateAAFont(WMScreen *scrPtr, char *fontName)
{
#ifdef XFT
WMFont *font;
Display *display = scrPtr->display;
char *fname, *ptr;
if ((ptr = strchr(fontName, ','))) {
fname = wmalloc(ptr - fontName + 1);
strncpy(fname, fontName, ptr - fontName);
fname[ptr - fontName] = 0;
} else {
fname = wstrdup(fontName);
}
font = WMHashGet(scrPtr->fontCache, fname);
if (font) {
WMRetainFont(font);
wfree(fname);
return font;
}
font = malloc(sizeof(WMFont));
if (!font) {
wfree(fname);
return NULL;
}
memset(font, 0, sizeof(WMFont));
font->notFontSet = 1;
font->antialiased = 1;
font->screen = scrPtr;
/* // Xft sux */
font->font.normal = XLoadQueryFont(display, fname);
if (!font->font.normal) {
wfree(font);
wfree(fname);
return NULL;
}
XFreeFont(display, font->font.normal);
font->font.xft = XftFontOpenXlfd(display, scrPtr->screen, fname);
if (!font->font.xft) {
wfree(font);
wfree(fname);
return NULL;
}
font->height = font->font.xft->ascent+font->font.xft->descent;
font->y = font->font.xft->ascent;
font->refCount = 1;
font->name = fname;
assert(WMHashInsert(scrPtr->fontCache, font->name, font)==NULL);
return font;
#else
return NULL;
#endif
}
WMFont*
WMCreateFont(WMScreen *scrPtr, char *fontName)
{
if (scrPtr->useMultiByte)
if (scrPtr->useMultiByte) {
return WMCreateFontSet(scrPtr, fontName);
else
return WMCreateNormalFont(scrPtr, fontName);
} else if (scrPtr->antialiasedText) {
/*// should revert to normal if this fails? */
return WMCreateAAFont(scrPtr, fontName);
} else {
return WMCreateNormalFont(scrPtr, fontName);
}
}
WMFont*
WMRetainFont(WMFont *font)
{
@@ -240,9 +317,17 @@ WMReleaseFont(WMFont *font)
font->refCount--;
if (font->refCount < 1) {
if (font->notFontSet)
XFreeFont(font->screen->display, font->font.normal);
else {
if (font->notFontSet) {
if (font->antialiased) {
#ifdef XFT
XftFontClose(font->screen->display, font->font.xft);
#else
assert(False);
#endif
} else {
XFreeFont(font->screen->display, font->font.normal);
}
} else {
XFreeFontSet(font->screen->display, font->font.set);
}
if (font->name) {
@@ -282,75 +367,79 @@ WMDefaultBoldSystemFont(WMScreen *scrPtr)
}
WMFont*
WMSystemFontOfSize(WMScreen *scrPtr, int size)
static WMFont*
makeSystemFontOfSize(WMScreen *scrPtr, int size, Bool bold)
{
WMFont *font;
char *fontSpec;
char *fontSpec, *aaFontSpec;
fontSpec = makeFontSetOfSize(WINGsConfiguration.systemFont, size);
if (bold) {
fontSpec = makeFontSetOfSize(WINGsConfiguration.boldSystemFont, size);
aaFontSpec = makeFontSetOfSize(WINGsConfiguration.aaBoldSystemFont, size);
} else {
fontSpec = makeFontSetOfSize(WINGsConfiguration.systemFont, size);
aaFontSpec = makeFontSetOfSize(WINGsConfiguration.aaSystemFont, size);
}
if (scrPtr->useMultiByte)
font = WMCreateFontSet(scrPtr, fontSpec);
else
font = WMCreateNormalFont(scrPtr, fontSpec);
if (scrPtr->useMultiByte) {
font = WMCreateFontSet(scrPtr, fontSpec);
} else if (scrPtr->antialiasedText) {
font = WMCreateAAFont(scrPtr, aaFontSpec);
} else {
font = WMCreateNormalFont(scrPtr, fontSpec);
}
if (!font) {
if (scrPtr->useMultiByte) {
wwarning(_("could not load font set %s. Trying fixed."), fontSpec);
font = WMCreateFontSet(scrPtr, "fixed");
if (!font) {
font = WMCreateFontSet(scrPtr, "-*-fixed-medium-r-normal-*-14-*-*-*-*-*-*-*");
}
} else {
wwarning(_("could not load font %s. Trying fixed."), fontSpec);
font = WMCreateNormalFont(scrPtr, "fixed");
}
if (!font) {
wwarning(_("could not load fixed font!"));
wfree(fontSpec);
return NULL;
}
if (scrPtr->useMultiByte) {
wwarning(_("could not load font set %s. Trying fixed."), fontSpec);
font = WMCreateFontSet(scrPtr, "fixed");
if (!font) {
font = WMCreateFontSet(scrPtr, "-*-fixed-medium-r-normal-*-14-*-*-*-*-*-*-*");
}
} else if (scrPtr->antialiasedText) {
wwarning(_("could not load font %s. Trying arial."), aaFontSpec);
if (bold) {
font = WMCreateAAFont(scrPtr, "-*-arial-bold-r-normal-*-12-*-*-*-*-*-*-*");
} else {
font = WMCreateAAFont(scrPtr, "-*-arial-medium-r-normal-*-12-*-*-*-*-*-*-*");
}
if (!font) {
wwarning(_("could not load antialiased fonts. Reverting to normal fonts."));
font = WMCreateNormalFont(scrPtr, fontSpec);
if (!font) {
wwarning(_("could not load font %s. Trying fixed."), fontSpec);
font = WMCreateNormalFont(scrPtr, "fixed");
}
}
} else {
wwarning(_("could not load font %s. Trying fixed."), fontSpec);
font = WMCreateNormalFont(scrPtr, "fixed");
}
if (!font) {
wwarning(_("could not load fixed font!"));
wfree(fontSpec);
wfree(aaFontSpec);
return NULL;
}
}
wfree(fontSpec);
wfree(aaFontSpec);
return font;
}
WMFont*
WMSystemFontOfSize(WMScreen *scrPtr, int size)
{
return makeSystemFontOfSize(scrPtr, size, False);
}
WMFont*
WMBoldSystemFontOfSize(WMScreen *scrPtr, int size)
{
WMFont *font;
char *fontSpec;
fontSpec = makeFontSetOfSize(WINGsConfiguration.boldSystemFont, size);
if (scrPtr->useMultiByte)
font = WMCreateFontSet(scrPtr, fontSpec);
else
font = WMCreateNormalFont(scrPtr, fontSpec);
if (!font) {
if (scrPtr->useMultiByte) {
wwarning(_("could not load font set %s. Trying fixed."), fontSpec);
font = WMCreateFontSet(scrPtr, "fixed");
if (!font) {
font = WMCreateFontSet(scrPtr, "-*-fixed-medium-r-normal-*-14-*-*-*-*-*-*-*");
}
} else {
wwarning(_("could not load font %s. Trying fixed."), fontSpec);
font = WMCreateNormalFont(scrPtr, "fixed");
}
if (!font) {
wwarning(_("could not load fixed font!"));
wfree(fontSpec);
return NULL;
}
}
wfree(fontSpec);
return font;
return makeSystemFontOfSize(scrPtr, size, True);
}
@@ -371,10 +460,22 @@ WMWidthOfString(WMFont *font, char *text, int length)
{
wassertrv(font!=NULL, 0);
wassertrv(text!=NULL, 0);
if (font->notFontSet)
return XTextWidth(font->font.normal, text, length);
else {
if (font->notFontSet) {
if (font->antialiased) {
#ifdef XFT
XGlyphInfo extents;
XftTextExtents8(font->screen->display, font->font.xft,
(XftChar8 *)text, length, &extents);
return extents.xOff; /* don't ask :P */
#else
assert(False);
#endif
} else {
return XTextWidth(font->font.normal, text, length);
}
} else {
XRectangle rect;
XRectangle AIXsucks;
@@ -392,12 +493,36 @@ WMDrawString(WMScreen *scr, Drawable d, WMColor *color, WMFont *font,
{
wassertr(font!=NULL);
XSetForeground(scr->display, scr->drawStringGC, W_PIXEL(color));
if (font->notFontSet) {
XSetFont(scr->display, scr->drawStringGC, font->font.normal->fid);
XDrawString(scr->display, d, scr->drawStringGC, x, y + font->y, text,
length);
if (font->antialiased) {
#ifdef XFT
XftColor xftcolor;
XftDraw *xftdraw;
xftcolor.color.red = color->color.red;
xftcolor.color.green = color->color.green;
xftcolor.color.blue = color->color.blue;
xftcolor.color.alpha = color->alpha;;
xftcolor.pixel = W_PIXEL(color);
/* //share if possible */
xftdraw = XftDrawCreate(scr->display, d, scr->visual, scr->colormap);
XftDrawString8(xftdraw, &xftcolor, font->font.xft,
x, y + font->y, text, length);
XftDrawDestroy(xftdraw);
#else
assert(False);
#endif
} else {
XSetFont(scr->display, scr->drawStringGC, font->font.normal->fid);
XSetForeground(scr->display, scr->drawStringGC, W_PIXEL(color));
XDrawString(scr->display, d, scr->drawStringGC, x, y + font->y,
text, length);
}
} else {
XSetForeground(scr->display, scr->drawStringGC, W_PIXEL(color));
XmbDrawString(scr->display, d, font->font.set, scr->drawStringGC,
x, y + font->y, text, length);
}
@@ -410,13 +535,48 @@ WMDrawImageString(WMScreen *scr, Drawable d, WMColor *color, WMColor *background
{
wassertr(font != NULL);
XSetForeground(scr->display, scr->drawImStringGC, W_PIXEL(color));
XSetBackground(scr->display, scr->drawImStringGC, W_PIXEL(background));
if (font->notFontSet) {
XSetFont(scr->display, scr->drawImStringGC, font->font.normal->fid);
XDrawImageString(scr->display, d, scr->drawImStringGC, x, y + font->y,
text, length);
if (font->antialiased) {
#ifdef XFT
XftColor textColor;
XftColor bgColor;
XftDraw *xftdraw;
textColor.color.red = color->color.red;
textColor.color.green = color->color.green;
textColor.color.blue = color->color.blue;
textColor.color.alpha = color->alpha;;
textColor.pixel = W_PIXEL(color);
bgColor.color.red = background->color.red;
bgColor.color.green = background->color.green;
bgColor.color.blue = background->color.blue;
bgColor.color.alpha = background->alpha;;
bgColor.pixel = W_PIXEL(background);
/* //share if possible */
xftdraw = XftDrawCreate(scr->display, d, scr->visual, scr->colormap);
XftDrawRect(xftdraw, &bgColor, x, y,
WMWidthOfString(font, text, length), font->height);
XftDrawString8(xftdraw, &textColor, font->font.xft, x, y + font->y,
text, length);
XftDrawDestroy(xftdraw);
#else
assert(False);
#endif
} else {
XSetForeground(scr->display, scr->drawImStringGC, W_PIXEL(color));
XSetBackground(scr->display, scr->drawImStringGC, W_PIXEL(background));
XSetFont(scr->display, scr->drawImStringGC, font->font.normal->fid);
XDrawImageString(scr->display, d, scr->drawImStringGC,
x, y + font->y, text, length);
}
} else {
XSetForeground(scr->display, scr->drawImStringGC, W_PIXEL(color));
XSetBackground(scr->display, scr->drawImStringGC, W_PIXEL(background));
XmbDrawImageString(scr->display, d, font->font.set, scr->drawImStringGC,
x, y + font->y, text, length);
}
@@ -482,7 +642,7 @@ changeFontProp(char *fname, char *newprop, int which)
char *ptr, *bptr;
int part=0;
if(!fname || !prop)
if (!fname || !prop)
return;
ptr = fname;
@@ -490,9 +650,9 @@ changeFontProp(char *fname, char *newprop, int which)
while (*ptr) {
if(*ptr == '-') {
*bptr = 0;
if(part==which)
if (part==which)
bptr = prop;
else if(part==which+1)
else if (part==which+1)
bptr = after;
*bptr++ = *ptr;
part++;
@@ -512,15 +672,15 @@ WMNormalizeFont(WMScreen *scr, WMFont *font)
WMFont *newfont=NULL;
char fname[256];
if(!scr || !font)
if (!scr || !font)
return NULL;
snprintf(fname, 255, font->name);
snprintf(fname, 255, "%s", font->name);
changeFontProp(fname, "medium", 2);
changeFontProp(fname, "r", 3);
newfont = WMCreateNormalFont(scr, fname);
if(!newfont)
if (!newfont)
return NULL;
return newfont;
@@ -533,14 +693,14 @@ WMStrengthenFont(WMScreen *scr, WMFont *font)
WMFont *newfont=NULL;
char fname[256];
if(!scr || !font)
if (!scr || !font)
return NULL;
snprintf(fname, 255, font->name);
snprintf(fname, 255, "%s", font->name);
changeFontProp(fname, "bold", 2);
newfont = WMCreateNormalFont(scr, fname);
if(!newfont)
if (!newfont)
return NULL;
return newfont;
@@ -553,14 +713,14 @@ WMUnstrengthenFont(WMScreen *scr, WMFont *font)
WMFont *newfont=NULL;
char fname[256];
if(!scr || !font)
if (!scr || !font)
return NULL;
snprintf(fname, 255, font->name);
snprintf(fname, 255, "%s", font->name);
changeFontProp(fname, "medium", 2);
newfont = WMCreateNormalFont(scr, fname);
if(!newfont)
if (!newfont)
return NULL;
return newfont;
@@ -573,14 +733,14 @@ WMEmphasizeFont(WMScreen *scr, WMFont *font)
WMFont *newfont=NULL;
char fname[256];
if(!scr || !font)
if (!scr || !font)
return NULL;
snprintf(fname, 255, font->name);
snprintf(fname, 255, "%s", font->name);
changeFontProp(fname, "o", 3);
newfont = WMCreateNormalFont(scr, fname);
if(!newfont)
if (!newfont)
return NULL;
return newfont;
@@ -593,14 +753,14 @@ WMUnemphasizeFont(WMScreen *scr, WMFont *font)
WMFont *newfont=NULL;
char fname[256];
if(!scr || !font)
if (!scr || !font)
return NULL;
snprintf(fname, 255, font->name);
snprintf(fname, 255, "%s", font->name);
changeFontProp(fname, "r", 3);
newfont = WMCreateNormalFont(scr, fname);
if(!newfont)
if (!newfont)
return NULL;
return newfont;

View File

@@ -749,6 +749,8 @@ WMCreateScreenWithRContext(Display *display, int screen, RContext *context)
scrPtr->useMultiByte = WINGsConfiguration.useMultiByte;
scrPtr->antialiasedText = WINGsConfiguration.antialiasedText;
scrPtr->normalFont = WMSystemFontOfSize(scrPtr,
WINGsConfiguration.defaultFontSize);

View File

@@ -51,5 +51,6 @@ WPrefs_DEPENDENCIES = $(top_builddir)/WINGs/libWINGs.a
WPrefs_LDADD = \
$(top_builddir)/WINGs/libWINGs.a\
$(top_builddir)/wrlib/libwraster.la \
@XFTLIBS@ \
@INTLIBS@

View File

@@ -1,9 +1,12 @@
{
SystemFont = "-*-helvetica-medium-r-normal-*-%d-*-*-*-*-*-*-*,-*-*-medium-r-normal-*-%d-*,-*-*-medium-r-normal-*-*-*";
BoldSystemFont = "-*-helvetica-bold-r-normal-*-%d-*-*-*-*-*-*-*,-*-*-bold-r-normal-*-%d-*,-*-*-medium-r-normal-*-*-*";
AASystemFont = "-*-arial-medium-r-normal-*-%d-*-*-*-*-*-*-*";
AABoldSystemFont = "-*-arial-bold-r-normal-*-%d-*-*-*-*-*-*-*";
DefaultFontSize = 12;
FloppyPath = "/floppy";
AntialiasedText = NO;
MultiByteText = AUTO;
FloppyPath = "/floppy";
DoubleClickTime = 250;
MouseWheelUp = Button4;
MouseWheelDown = Button5;

View File

@@ -85,11 +85,11 @@ dnl
dnl Specify paths to look for libraries and headers
dnl ===============================================
AC_ARG_WITH(libs-from,
[ --with-libs-from pass compiler flags to look for libraries],
[ --with-libs-from pass compiler flags to look for libraries],
[lib_search_path="$withval $lib_search_path"])
AC_ARG_WITH(incs-from,
[ --with-incs-from pass compiler flags to look for header files],
[ --with-incs-from pass compiler flags to look for header files],
[inc_search_path="$withval $inc_search_path"])
@@ -369,7 +369,7 @@ dnl ===============================
AC_ARG_ENABLE(gnome,
[ --enable-gnome enable stuff needed for GNOME ],
[ --enable-gnome enable stuff needed for GNOME ],
[if test x$enableval = xyes; then
AC_DEFINE(GNOME_STUFF, 1, [define if you want GNOME stuff support])
gnome_on=yes
@@ -377,7 +377,7 @@ AC_ARG_ENABLE(gnome,
AC_ARG_ENABLE(kde,
[ --enable-kde enable support for KDE window manager (kwm) hints ],
[ --enable-kde enable support for KDE window manager (kwm) hints ],
[if test x$enableval = xyes; then
AC_DEFINE(KWM_HINTS, 1, [define if you want KDE hint support])
kde_on=yes
@@ -385,7 +385,7 @@ AC_ARG_ENABLE(kde,
AC_ARG_ENABLE(openlook,
[ --enable-openlook enable support for OPEN LOOK(tm) (olwm) hints ],
[ --enable-openlook enable support for OPEN LOOK(tm) (olwm) hints ],
[if test x$enableval = xyes; then
AC_DEFINE(OLWM_HINTS, 1, [define if you want OPEN LOOK(tm) hint support])
openlook_on=yes
@@ -396,7 +396,7 @@ dnl
dnl Disable some stuff that are duplicated in kde
dnl ---------------------------------------------
AC_ARG_ENABLE(lite,
[ --enable-lite disable some stuff (dont use it) ],
[ --enable-lite disable some stuff (dont use it) ],
[if test x$enableval = xyes; then
LITE=yes
AC_DEFINE(LITE, 1, [define if you want the 'lite' version])
@@ -460,7 +460,7 @@ dnl by MANOME Tomonori
dnl ===========================================
use_locale=yes
AC_ARG_ENABLE(locale,
[ --disable-locale disable use of X locale support],
[ --disable-locale disable use of X locale support],
use_locale=no)
if test "$use_locale" = yes; then
@@ -486,7 +486,7 @@ AC_CHECK_LIB(X11, XConvertCase,
dnl XKB keyboard language status
dnl ============================
AC_ARG_ENABLE(modelock,
[ --enable-modelock XKB keyboard language status support],
[ --enable-modelock XKB keyboard language status support],
AC_DEFINE(XKB_MODELOCK, 1, [whether XKB language MODELOCK should be enabled]))
@@ -495,7 +495,7 @@ dnl Shape support
dnl =============
shape=yes
AC_ARG_ENABLE(shape,
[ --disable-shape disable shaped window extension support],
[ --disable-shape disable shaped window extension support],
shape=$enableval, shape=yes)
added_xext=no
@@ -508,11 +508,27 @@ if test "$shape" = yes; then
fi
dnl Xft antialiased font support
dnl ============================
xft=yes
XFTLIBS=""
AC_ARG_ENABLE(xft,
[ --disable-xft disable Xft antialiased font support],
xft=$enableval, xft=yes)
if test "$xft" = yes; then
AC_CHECK_LIB(Xft, XftDrawCreate, [XFTLIBS="-lXft"
AC_SUBST(XFTLIBS)
AC_DEFINE(XFT, 1, [define if you want support for antialiased fonts (set by configure)])],
xft=no, $XLFLAGS $XLIBS)
fi
dnl XINERAMA support
dnl ================
xinerama=no
#AC_ARG_ENABLE(xinerama,
#[ --disable-xinerama disable XInerama extension support],
#[ --disable-xinerama disable XInerama extension support],
# xinerama=$enableval, xinerama=yes)
if test "$xinerama" = yes; then
@@ -568,7 +584,7 @@ dnl XPM Support
dnl ===========
xpm=yes
AC_ARG_ENABLE(xpm,
[ --disable-xpm disable use of XPM pixmaps through libXpm],
[ --disable-xpm disable use of XPM pixmaps through libXpm],
xpm=$enableval, xpm=yes)
if test "$xpm" = yes; then
@@ -604,7 +620,7 @@ dnl PNG Support
dnl ===========
png=yes
AC_ARG_ENABLE(png,
[ --disable-png disable PNG support through libpng],
[ --disable-png disable PNG support through libpng],
png=$enableval, png=yes, png=no)
@@ -627,7 +643,7 @@ dnl ============
jpeg=yes
ljpeg=""
AC_ARG_ENABLE(jpeg,
[ --disable-jpeg disable JPEG support through libjpeg],
[ --disable-jpeg disable JPEG support through libjpeg],
jpeg=$enableval, jpeg=yes, jpeg=no)
if test "$jpeg" = yes; then
@@ -685,7 +701,7 @@ fi
dnl TIFF Support
dnl ============
AC_ARG_ENABLE(tiff,
[ --disable-tiff disable use of TIFF images through libtiff],
[ --disable-tiff disable use of TIFF images through libtiff],
tif=$enableval, tif=yes, tif=no)
#
@@ -906,7 +922,7 @@ cat <<EOF >get-wings-flags
WCFLAGS="$inc_search_path"
WLFLAGS="$lib_search_path"
WLIBS="-lWINGs -lwraster $GFXLIBS $XLIBS -lm $NETLIBS $INTLIBS"
WLIBS="-lWINGs -lwraster $GFXLIBS $XFTLIBS $XLIBS -lm $NETLIBS $INTLIBS"
usage="Usage: get-wings-flags #lp#--cflags#rp# #lp#--ldflags#rp# #lp#--libs#rp#"
@@ -1002,6 +1018,7 @@ echo "Installation path prefix: $prefix"
echo "Installation path prefix for binaries: $_bindir"
echo "Installation path for WPrefs.app: $wprefsdir" | sed -e 's|\$(prefix)|'"$prefix|"
echo "Graphic format libraries: $supported_gfx"
echo "Antialiased font support for WINGs: $xft"
echo "Use assembly routines for wrlib: $asm_support"
echo "Use inline MMX(tm) x86 assembly: $mmx_support"
dnl echo "Sound support: yes"

View File

@@ -116,6 +116,7 @@ wmaker_LDADD = \
$(top_builddir)/WINGs/libWINGs.a\
$(top_builddir)/wrlib/libwraster.la\
@XLIBS@ \
@XFTLIBS@ \
@INTLIBS@ \
@DLLIBS@

View File

@@ -38,17 +38,17 @@ geticonset_LDADD= $(top_builddir)/WINGs/libWUtil.a $(liblist)
wmagnify_LDADD = \
$(top_builddir)/WINGs/libWINGs.a \
$(top_builddir)/wrlib/libwraster.la \
@INTLIBS@ @DLLIBS@
@XFTLIBS@ @INTLIBS@ @DLLIBS@
wmsetup_LDADD = \
$(top_builddir)/WINGs/libWINGs.a \
$(top_builddir)/wrlib/libwraster.la \
@INTLIBS@ @DLLIBS@
@XFTLIBS@ @INTLIBS@ @DLLIBS@
wmsetbg_LDADD = \
$(top_builddir)/WINGs/libWINGs.a \
$(top_builddir)/wrlib/libwraster.la \
@INTLIBS@ @DLLIBS@
@XFTLIBS@ @INTLIBS@ @DLLIBS@
CLEANFILES = wmaker.inst wmchlocale

View File

@@ -79,11 +79,11 @@ extern "C" {
/* standard colormap usage */
#define RC_StandardColormap (1<<7)
/* std colormap usage/creation modes */
enum {
RUseStdColormap, /* default. fallbacks to RIgnore.. if
@@ -91,7 +91,7 @@ enum {
RCreateStdColormap,
RIgnoreStdColormap
};
typedef struct RContextAttributes {