]>
Commit | Line | Data |
---|---|---|
2579e0dc JR |
1 | Index: configure.ac |
2 | =================================================================== | |
3 | RCS file: /cvsroot/wm/configure.ac,v | |
4 | retrieving revision 1.43 | |
5 | diff -u -r1.43 configure.ac | |
6 | --- configure.ac 2003/08/14 01:39:27 1.43 | |
7 | +++ configure.ac 2004/03/26 13:50:57 | |
8 | @@ -532,14 +532,15 @@ | |
9 | else | |
10 | AC_CHECK_PROG(XFTCONFIG, xft-config, xft-config) | |
11 | fi | |
12 | - AC_MSG_CHECKING([for the Xft2 library]) | |
13 | if test "x$XFTCONFIG" != x; then | |
14 | XFTLIBS=`$XFTCONFIG --libs` | |
15 | XFTFLAGS=`$XFTCONFIG --cflags` | |
16 | + AC_MSG_CHECKING([for the Xft2 library]) | |
17 | AC_MSG_RESULT([found]) | |
18 | + AC_DEFINE(XFT2, 1, [define if you have Xft version 2 (set by configure)]) | |
19 | else | |
20 | - xft=no | |
21 | - AC_MSG_RESULT([not found]) | |
22 | + AC_CHECK_LIB(Xft, XftDrawCreate, [XFTLIBS="-lXft" XFTFLAGS=""], | |
23 | + xft=no, $XLFLAGS $XLIBS) | |
24 | fi | |
25 | if test "$xft" = yes; then | |
26 | AC_SUBST(XFTFLAGS) | |
27 | Index: WINGs/ChangeLog | |
28 | =================================================================== | |
29 | RCS file: /cvsroot/wm/WINGs/ChangeLog,v | |
30 | retrieving revision 1.153 | |
31 | retrieving revision 1.152 | |
32 | diff -u -r1.153 -r1.152 | |
33 | --- WINGs/ChangeLog 2003/08/07 00:26:21 1.153 | |
34 | +++ WINGs/ChangeLog 2003/08/02 21:36:45 1.152 | |
35 | @@ -12,19 +12,30 @@ | |
36 | WMCreateRGBAColor() and WMSetColorAlpha() | |
37 | - Miscelaneous code cleanups in wtext.c | |
38 | - Added Xft support in WINGs (for drawing antialiased fonts with transparency). | |
39 | -- New options in WMGLOBAL: AntialiasedText. Check NEWS for details. | |
40 | +- Added a new function: WMCreateAntialiasedFont() to create a font which will | |
41 | + be drawn antialiased using Xft (if available, else function returns NULL) | |
42 | +- New options in WMGLOBAL: AntialiasedText, AntialiasedSystemFont and | |
43 | + AntialiasedBoldSystemFont. Check NEWS for details. | |
44 | - Fixed some improper calls to snprintf in wfont.c | |
45 | - Added double buffering when drawing a WMFrame title with an antialiased font | |
46 | to avoid flickering. | |
47 | - Added double buffering when drawing WMList items to avoid flickering. | |
48 | Double buffering for list also works for user drawn lists. Read NEWS for | |
49 | details and incompatibilities introduced by this change. | |
50 | +- Added WMIsAntialiasedFont(WMFont *font) to check if a font is antialiased. | |
51 | - Added WMGetColorAlpha(WMColor *color) | |
52 | - Better outline when drawing balloons. | |
53 | -- Added WMCreateFontWithAttributes() | |
54 | +- Added WMCreateFontWithFlags() | |
55 | - You can now pass "SystemFont", "BoldSystemFont", "SystemFont-##" or | |
56 | "BoldSystemFont-##", with ## being the font size to any font creating | |
57 | function to create a font with the (bold) system font font specification. | |
58 | +- Added WMCreateAntialiasedFontSet() (like WMCreateAntialiasedFont() but for | |
59 | + languages with multibyte text). Note however that these specific font | |
60 | + creating functions (as well as WMCreateNormalFont() and WMCreateFontSet()) | |
61 | + are not meant to be called directly except in very special cases. | |
62 | + The more generic WMCreateFont() or WMCreateFontWithFlags() should be used. | |
63 | +- Multibyte languages can now render antialiased text too (only tested on | |
64 | + russian since this is the only multibyte language I can test). | |
65 | - Added WMCopyFontWithChanges(). This is a more generic and powerful function | |
66 | meant to replaces the obsoleted WMEmphasizeFont(), WMNormalizeFont(), | |
67 | WMStrenghtenFont() and the other similar functions. To get the same effect | |
68 | @@ -34,7 +45,7 @@ | |
69 | - Added WMGetWidgetBackgroundColor() | |
70 | - Code cleanup in wtext.c | |
71 | - Fixed a memory leak in wfontpanel.c | |
72 | -??- Added a check that only %d is used in a font specification in WMGLOBAL and at | |
73 | +- Added a check that only %d is used in a font specification in WMGLOBAL and at | |
74 | most once for each font in a fontset (eliminates a possible security exploit) | |
75 | - Fixed WMGetTextDefaultColor() not to retain the returned color. It returns | |
76 | only a reference to the internal color, which you shouldn't release | |
77 | Index: WINGs/Makefile.am | |
78 | =================================================================== | |
79 | RCS file: /cvsroot/wm/WINGs/Makefile.am,v | |
80 | retrieving revision 1.66 | |
81 | retrieving revision 1.65 | |
82 | diff -u -r1.66 -r1.65 | |
83 | --- WINGs/Makefile.am 2004/02/25 21:26:49 1.66 | |
84 | +++ WINGs/Makefile.am 2003/06/10 01:56:28 1.65 | |
85 | @@ -107,7 +107,7 @@ | |
86 | wutil.c | |
87 | ||
88 | ||
89 | -AM_CPPFLAGS = @CPPFLAGS@ -DLOCALEDIR=\"$(NLSDIR)\" | |
90 | +CPPFLAGS = @CPPFLAGS@ -DLOCALEDIR=\"$(NLSDIR)\" | |
91 | ||
92 | INCLUDES = -I$(top_srcdir)/WINGs/WINGs -I$(top_srcdir)/wrlib -I$(top_srcdir)/src \ | |
93 | -DRESOURCE_PATH=\"$(datadir)/WINGs\" @XFTFLAGS@ @HEADER_SEARCH_PATH@ -DDEBUG | |
94 | Index: WINGs/configuration.c | |
95 | =================================================================== | |
96 | RCS file: /cvsroot/wm/WINGs/configuration.c,v | |
97 | retrieving revision 1.16 | |
98 | retrieving revision 1.15 | |
99 | diff -u -r1.16 -r1.15 | |
100 | --- WINGs/configuration.c 2003/08/07 00:26:21 1.16 | |
101 | +++ WINGs/configuration.c 2002/11/30 02:13:37 1.15 | |
102 | @@ -75,6 +75,10 @@ | |
103 | ptr = "system font"; | |
104 | } else if (xlfd == WINGsConfiguration.boldSystemFont) { | |
105 | ptr = "bold system font"; | |
106 | + } else if (xlfd == WINGsConfiguration.antialiasedSystemFont) { | |
107 | + ptr = "antialiased system font"; | |
108 | + } else if (xlfd == WINGsConfiguration.antialiasedBoldSystemFont) { | |
109 | + ptr = "antialiased bold system font"; | |
110 | } else { | |
111 | ptr = "Unknown System Font"; | |
112 | } | |
113 | @@ -106,6 +110,12 @@ | |
114 | WINGsConfiguration.boldSystemFont = | |
115 | WMGetUDStringForKey(defaults, "BoldSystemFont"); | |
116 | ||
117 | + WINGsConfiguration.antialiasedSystemFont = | |
118 | + WMGetUDStringForKey(defaults, "AntialiasedSystemFont"); | |
119 | + | |
120 | + WINGsConfiguration.antialiasedBoldSystemFont = | |
121 | + WMGetUDStringForKey(defaults, "AntialiasedBoldSystemFont"); | |
122 | + | |
123 | #ifdef XFT | |
124 | WINGsConfiguration.antialiasedText = | |
125 | WMGetUDBoolForKey(defaults, "AntialiasedText"); | |
126 | @@ -173,6 +183,12 @@ | |
127 | } | |
128 | if (missingOrInvalidXLFD(WINGsConfiguration.boldSystemFont)) { | |
129 | WINGsConfiguration.boldSystemFont = BOLD_SYSTEM_FONT; | |
130 | + } | |
131 | + if (missingOrInvalidXLFD(WINGsConfiguration.antialiasedSystemFont)) { | |
132 | + WINGsConfiguration.antialiasedSystemFont = XFTSYSTEM_FONT; | |
133 | + } | |
134 | + if (missingOrInvalidXLFD(WINGsConfiguration.antialiasedBoldSystemFont)) { | |
135 | + WINGsConfiguration.antialiasedBoldSystemFont = XFTBOLD_SYSTEM_FONT; | |
136 | } | |
137 | if (!WINGsConfiguration.floppyPath) { | |
138 | WINGsConfiguration.floppyPath = FLOPPY_PATH; | |
139 | Index: WINGs/connection.c | |
140 | =================================================================== | |
141 | RCS file: /cvsroot/wm/WINGs/connection.c,v | |
142 | retrieving revision 1.28 | |
143 | retrieving revision 1.27 | |
144 | diff -u -r1.28 -r1.27 | |
145 | --- WINGs/connection.c 2004/02/25 21:26:49 1.28 | |
146 | +++ WINGs/connection.c 2003/01/16 23:30:46 1.27 | |
147 | @@ -174,8 +174,6 @@ | |
148 | clearOutputQueue(cPtr); | |
149 | cPtr->state = WCTimedOut; | |
150 | cPtr->timeoutState = WCTWhileSending; | |
151 | - // should we close it no matter what (after calling the didTimeout | |
152 | - // delegate)? -Dan | |
153 | if (cPtr->delegate && cPtr->delegate->didTimeout) { | |
154 | (*cPtr->delegate->didTimeout)(cPtr->delegate, cPtr); | |
155 | } else { | |
156 | Index: WINGs/handlers.c | |
157 | =================================================================== | |
158 | RCS file: /cvsroot/wm/WINGs/handlers.c,v | |
159 | retrieving revision 1.7 | |
160 | retrieving revision 1.6 | |
161 | diff -u -r1.7 -r1.6 | |
162 | --- WINGs/handlers.c 2003/08/14 01:39:27 1.7 | |
163 | +++ WINGs/handlers.c 2002/09/09 04:25:52 1.6 | |
164 | @@ -605,7 +605,7 @@ | |
165 | ||
166 | return (count > 0); | |
167 | #else /* not HAVE_SELECT, not HAVE_POLL */ | |
168 | -# error Neither select nor poll. You lose. | |
169 | + Neither select nor poll. You lose. | |
170 | #endif /* HAVE_SELECT */ | |
171 | #endif /* HAVE_POLL */ | |
172 | } | |
173 | Index: WINGs/wfont.c | |
174 | =================================================================== | |
175 | RCS file: /cvsroot/wm/WINGs/wfont.c,v | |
176 | retrieving revision 1.40 | |
177 | retrieving revision 1.34 | |
178 | diff -u -r1.40 -r1.34 | |
179 | --- WINGs/wfont.c 2003/09/03 19:09:24 1.40 | |
180 | +++ WINGs/wfont.c 2003/06/12 21:21:57 1.34 | |
181 | @@ -3,655 +3,18 @@ | |
182 | ||
183 | #ifdef XFT | |
184 | # include <X11/Xft/Xft.h> | |
185 | -# ifdef HAVE_WCHAR_H | |
186 | -# include <wchar.h> | |
187 | -# endif | |
188 | -# include <stdlib.h> | |
189 | #endif | |
190 | ||
191 | #include "WINGsP.h" | |
192 | ||
193 | + | |
194 | #include <wraster.h> | |
195 | #include <assert.h> | |
196 | #include <X11/Xlocale.h> | |
197 | - | |
198 | - | |
199 | -#ifdef XFT | |
200 | - | |
201 | -#if defined(HAVE_MBSNRTOWCS) | |
202 | - | |
203 | -static size_t | |
204 | -wmbsnrtowcs(wchar_t *dest, const char **src, size_t nbytes, size_t len) | |
205 | -{ | |
206 | - mbstate_t ps; | |
207 | - size_t n; | |
208 | - | |
209 | - memset(&ps, 0, sizeof(mbstate_t)); | |
210 | - n = mbsnrtowcs(dest, src, nbytes, len, &ps); | |
211 | - if (n!=(size_t)-1 && *src) { | |
212 | - *src -= ps.__count; | |
213 | - } | |
214 | - | |
215 | - return n; | |
216 | -} | |
217 | - | |
218 | -#elif defined(HAVE_MBRTOWC) | |
219 | - | |
220 | -// This is 8 times slower than the version above. | |
221 | -static size_t | |
222 | -wmbsnrtowcs(wchar_t *dest, const char **src, size_t nbytes, size_t len) | |
223 | -{ | |
224 | - mbstate_t ps; | |
225 | - const char *ptr; | |
226 | - size_t n; | |
227 | - int nb; | |
228 | - | |
229 | - if (nbytes==0) | |
230 | - return 0; | |
231 | - | |
232 | - memset(&ps, 0, sizeof(mbstate_t)); | |
233 | - | |
234 | - if (dest == NULL) { | |
235 | - for (ptr=*src, n=0; nbytes>0; n++) { | |
236 | - nb = mbrtowc(NULL, ptr, nbytes, &ps); | |
237 | - if (nb == -1) { | |
238 | - return ((size_t)-1); | |
239 | - } else if (nb==0 || nb==-2) { | |
240 | - return n; | |
241 | - } | |
242 | - ptr += nb; | |
243 | - nbytes -= nb; | |
244 | - } | |
245 | - } | |
246 | - | |
247 | - for (ptr=*src, n=0; n<len && nbytes>0; n++, dest++) { | |
248 | - nb = mbrtowc(dest, ptr, nbytes, &ps); | |
249 | - if (nb == -2) { | |
250 | - *src = ptr; | |
251 | - return n; | |
252 | - } else if (nb == -1) { | |
253 | - *src = ptr; | |
254 | - return ((size_t)-1); | |
255 | - } else if (nb == 0) { | |
256 | - *src = NULL; | |
257 | - return n; | |
258 | - } | |
259 | - ptr += nb; | |
260 | - nbytes -= nb; | |
261 | - } | |
262 | - | |
263 | - *src = ptr; | |
264 | - return n; | |
265 | -} | |
266 | - | |
267 | -#else | |
268 | - | |
269 | -// Not only 8 times slower than the version based on mbsnrtowcs | |
270 | -// but also this version is not thread safe nor reentrant | |
271 | - | |
272 | -static size_t | |
273 | -wmbsnrtowcs(wchar_t *dest, const char **src, size_t nbytes, size_t len) | |
274 | -{ | |
275 | - const char *ptr; | |
276 | - size_t n; | |
277 | - int nb; | |
278 | - | |
279 | - if (nbytes==0) | |
280 | - return 0; | |
281 | - | |
282 | - mbtowc(NULL, NULL, 0); /* reset shift state */ | |
283 | - | |
284 | - if (dest == NULL) { | |
285 | - for (ptr=*src, n=0; nbytes>0; n++) { | |
286 | - nb = mbtowc(NULL, ptr, nbytes); | |
287 | - if (nb == -1) { | |
288 | - mbtowc(NULL, NULL, 0); | |
289 | - nb = mbtowc(NULL, ptr, strlen(ptr)); | |
290 | - return (nb == -1 ? (size_t)-1 : n); | |
291 | - } else if (nb==0) { | |
292 | - return n; | |
293 | - } | |
294 | - ptr += nb; | |
295 | - nbytes -= nb; | |
296 | - } | |
297 | - } | |
298 | - | |
299 | - for (ptr=*src, n=0; n<len && nbytes>0; n++, dest++) { | |
300 | - nb = mbtowc(dest, ptr, nbytes); | |
301 | - if (nb == -1) { | |
302 | - mbtowc(NULL, NULL, 0); | |
303 | - nb = mbtowc(NULL, ptr, strlen(ptr)); | |
304 | - *src = ptr; | |
305 | - return (nb == -1 ? (size_t)-1 : n); | |
306 | - } else if (nb == 0) { | |
307 | - *src = NULL; | |
308 | - return n; | |
309 | - } | |
310 | - ptr += nb; | |
311 | - nbytes -= nb; | |
312 | - } | |
313 | - | |
314 | - *src = ptr; | |
315 | - return n; | |
316 | -} | |
317 | - | |
318 | -#endif | |
319 | - | |
320 | - | |
321 | -static Bool | |
322 | -alreadyHasStringValue(XftPattern *pattern, const char *object, char *value) | |
323 | -{ | |
324 | - XftResult r; | |
325 | - char *s; | |
326 | - int id; | |
327 | - | |
328 | - if (!value || value[0]==0) | |
329 | - return True; | |
330 | - | |
331 | - id = 0; | |
332 | - while ((r=XftPatternGetString(pattern, object, id, &s))!=XftResultNoId) { | |
333 | - if (r == XftResultMatch && strcasecmp(value, s) == 0) { | |
334 | - return True; | |
335 | - } | |
336 | - id++; | |
337 | - } | |
338 | - | |
339 | - return False; | |
340 | -} | |
341 | - | |
342 | - | |
343 | -// check if to add a fallback size too. -Dan | |
344 | -// also handle an xlfd with %d for size? | |
345 | -static char* | |
346 | -makeFontOfSize(char *font, int size, char *fallback) | |
347 | -{ | |
348 | - XftPattern *pattern; | |
349 | - char *result; | |
350 | - int len; | |
351 | - | |
352 | - len = strlen(font) + 64; | |
353 | - pattern = XftNameParse(font); | |
354 | - XftPatternDel(pattern, "pixelsize"); | |
355 | - XftPatternAddDouble(pattern, "pixelsize", (double)size); | |
356 | - if (fallback) { | |
357 | - if (!alreadyHasStringValue(pattern, "family", fallback)) { | |
358 | - len += strlen(fallback); | |
359 | - XftPatternAddString(pattern, "family", fallback); | |
360 | - } | |
361 | - } | |
362 | - result = wmalloc(len); | |
363 | - XftNameUnparse(pattern, result, len); | |
364 | - XftPatternDestroy(pattern); | |
365 | - | |
366 | - return result; | |
367 | -} | |
368 | - | |
369 | - | |
370 | -WMFont* | |
371 | -WMCreateFont(WMScreen *scrPtr, char *fontName) | |
372 | -{ | |
373 | - WMFont *font; | |
374 | - Display *display = scrPtr->display; | |
375 | - char *fname, *ptr; | |
376 | - | |
377 | - /* This is for back-compat (to allow reading of old xlfd descriptions) */ | |
378 | - if (fontName[0]=='-' && (ptr = strchr(fontName, ','))) { | |
379 | - // warn for deprecation | |
380 | - fname = wmalloc(ptr - fontName + 1); | |
381 | - strncpy(fname, fontName, ptr - fontName); | |
382 | - fname[ptr - fontName] = 0; | |
383 | - } else { | |
384 | - fname = wstrdup(fontName); | |
385 | - } | |
386 | - | |
387 | - font = WMHashGet(scrPtr->fontCache, fname); | |
388 | - if (font) { | |
389 | - WMRetainFont(font); | |
390 | - wfree(fname); | |
391 | - return font; | |
392 | - } | |
393 | - | |
394 | - font = wmalloc(sizeof(WMFont)); | |
395 | - memset(font, 0, sizeof(WMFont)); | |
396 | - | |
397 | - font->screen = scrPtr; | |
398 | - | |
399 | - // remove | |
400 | - printf("%s\n", fname); | |
401 | - | |
402 | - if (fname[0] == '-') { | |
403 | - // Backward compat thing. Remove in a later version | |
404 | - font->font = XftFontOpenXlfd(display, scrPtr->screen, fname); | |
405 | - } else { | |
406 | - font->font = XftFontOpenName(display, scrPtr->screen, fname); | |
407 | - } | |
408 | - if (!font->font) { | |
409 | - wfree(font); | |
410 | - wfree(fname); | |
411 | - return NULL; | |
412 | - } | |
413 | - font->height = font->font->ascent+font->font->descent; | |
414 | - font->y = font->font->ascent; | |
415 | - | |
416 | - font->refCount = 1; | |
417 | - | |
418 | - font->name = fname; | |
419 | - | |
420 | - assert(WMHashInsert(scrPtr->fontCache, font->name, font)==NULL); | |
421 | - | |
422 | - return font; | |
423 | -} | |
424 | - | |
425 | - | |
426 | -WMFont* | |
427 | -WMRetainFont(WMFont *font) | |
428 | -{ | |
429 | - wassertrv(font!=NULL, NULL); | |
430 | - | |
431 | - font->refCount++; | |
432 | - | |
433 | - return font; | |
434 | -} | |
435 | - | |
436 | - | |
437 | -void | |
438 | -WMReleaseFont(WMFont *font) | |
439 | -{ | |
440 | - wassertr(font!=NULL); | |
441 | - | |
442 | - font->refCount--; | |
443 | - if (font->refCount < 1) { | |
444 | - XftFontClose(font->screen->display, font->font); | |
445 | - if (font->name) { | |
446 | - WMHashRemove(font->screen->fontCache, font->name); | |
447 | - wfree(font->name); | |
448 | - } | |
449 | - wfree(font); | |
450 | - } | |
451 | -} | |
452 | - | |
453 | - | |
454 | -Bool | |
455 | -WMIsAntialiasingEnabled(WMScreen *scrPtr) | |
456 | -{ | |
457 | - return scrPtr->antialiasedText; | |
458 | -} | |
459 | - | |
460 | - | |
461 | -unsigned int | |
462 | -WMFontHeight(WMFont *font) | |
463 | -{ | |
464 | - wassertrv(font!=NULL, 0); | |
465 | - | |
466 | - return font->height; | |
467 | -} | |
468 | - | |
469 | - | |
470 | -char* | |
471 | -WMGetFontName(WMFont *font) | |
472 | -{ | |
473 | - wassertrv(font!=NULL, NULL); | |
474 | - | |
475 | - return font->name; | |
476 | -} | |
477 | - | |
478 | - | |
479 | -WMFont* | |
480 | -WMDefaultSystemFont(WMScreen *scrPtr) | |
481 | -{ | |
482 | - return WMRetainFont(scrPtr->normalFont); | |
483 | -} | |
484 | - | |
485 | - | |
486 | -WMFont* | |
487 | -WMDefaultBoldSystemFont(WMScreen *scrPtr) | |
488 | -{ | |
489 | - return WMRetainFont(scrPtr->boldFont); | |
490 | -} | |
491 | - | |
492 | - | |
493 | -WMFont* | |
494 | -WMSystemFontOfSize(WMScreen *scrPtr, int size) | |
495 | -{ | |
496 | - WMFont *font; | |
497 | - char *fontSpec; | |
498 | - | |
499 | - fontSpec = makeFontOfSize(WINGsConfiguration.systemFont, size, "sans"); | |
500 | - | |
501 | - font = WMCreateFont(scrPtr, fontSpec); | |
502 | - | |
503 | - if (!font) { | |
504 | - wwarning(_("could not load font %s."), fontSpec); | |
505 | - } | |
506 | - | |
507 | - wfree(fontSpec); | |
508 | - | |
509 | - return font; | |
510 | -} | |
511 | - | |
512 | - | |
513 | -WMFont* | |
514 | -WMBoldSystemFontOfSize(WMScreen *scrPtr, int size) | |
515 | -{ | |
516 | - WMFont *font; | |
517 | - char *fontSpec; | |
518 | - | |
519 | - fontSpec = makeFontOfSize(WINGsConfiguration.boldSystemFont, size, "sans"); | |
520 | - | |
521 | - font = WMCreateFont(scrPtr, fontSpec); | |
522 | - | |
523 | - if (!font) { | |
524 | - wwarning(_("could not load font %s."), fontSpec); | |
525 | - } | |
526 | - | |
527 | - wfree(fontSpec); | |
528 | - | |
529 | - return font; | |
530 | -} | |
531 | - | |
532 | - | |
533 | -int | |
534 | -WMWidthOfString(WMFont *font, char *text, int length) | |
535 | -{ | |
536 | - XGlyphInfo extents; | |
537 | - | |
538 | - wassertrv(font!=NULL, 0); | |
539 | - wassertrv(text!=NULL, 0); | |
540 | - | |
541 | - if (font->screen->useWideChar) { | |
542 | - wchar_t *wtext; | |
543 | - const char *mtext; | |
544 | - int len; | |
545 | - | |
546 | - wtext = (wchar_t *)wmalloc(sizeof(wchar_t)*(length+1)); | |
547 | - mtext = text; | |
548 | - len = wmbsnrtowcs(wtext, &mtext, length, length); | |
549 | - if (len>0) { | |
550 | - wtext[len] = L'\0'; /* not really necessary here */ | |
551 | - XftTextExtents32(font->screen->display, font->font, | |
552 | - (XftChar32 *)wtext, len, &extents); | |
553 | - } else { | |
554 | - if (len==-1) { | |
555 | - wwarning(_("Conversion to widechar failed (possible " | |
556 | - "invalid multibyte sequence): '%s':(pos %d)\n"), | |
557 | - text, mtext-text+1); | |
558 | - } | |
559 | - extents.xOff = 0; | |
560 | - } | |
561 | - wfree(wtext); | |
562 | - } else { | |
563 | - XftTextExtents8(font->screen->display, font->font, | |
564 | - (XftChar8 *)text, length, &extents); | |
565 | - } | |
566 | - | |
567 | - return extents.xOff; /* don't ask :P */ | |
568 | -} | |
569 | - | |
570 | - | |
571 | - | |
572 | -void | |
573 | -WMDrawString(WMScreen *scr, Drawable d, WMColor *color, WMFont *font, | |
574 | - int x, int y, char *text, int length) | |
575 | -{ | |
576 | - XftColor xftcolor; | |
577 | - | |
578 | - wassertr(font!=NULL); | |
579 | - | |
580 | - xftcolor.color.red = color->color.red; | |
581 | - xftcolor.color.green = color->color.green; | |
582 | - xftcolor.color.blue = color->color.blue; | |
583 | - xftcolor.color.alpha = color->alpha;; | |
584 | - xftcolor.pixel = W_PIXEL(color); | |
585 | - | |
586 | - XftDrawChange(scr->xftdraw, d); | |
587 | - | |
588 | - if (font->screen->useWideChar) { | |
589 | - wchar_t *wtext; | |
590 | - const char *mtext; | |
591 | - int len; | |
592 | - | |
593 | - wtext = (wchar_t *)wmalloc(sizeof(wchar_t)*(length+1)); | |
594 | - mtext = text; | |
595 | - len = wmbsnrtowcs(wtext, &mtext, length, length); | |
596 | - if (len>0) { | |
597 | - XftDrawString32(scr->xftdraw, &xftcolor, font->font, | |
598 | - x, y + font->y, (XftChar32*)wtext, len); | |
599 | - } else if (len==-1) { | |
600 | - wwarning(_("Conversion to widechar failed (possible invalid " | |
601 | - "multibyte sequence): '%s':(pos %d)\n"), | |
602 | - text, mtext-text+1); | |
603 | - /* we can draw normal text, or we can draw as much widechar | |
604 | - * text as was already converted until the error. go figure */ | |
605 | - /*XftDrawString8(scr->xftdraw, &xftcolor, font->font, | |
606 | - x, y + font->y, (XftChar8*)text, length);*/ | |
607 | - } | |
608 | - wfree(wtext); | |
609 | - } else { | |
610 | - XftDrawString8(scr->xftdraw, &xftcolor, font->font, | |
611 | - x, y + font->y, (XftChar8*)text, length); | |
612 | - } | |
613 | -} | |
614 | - | |
615 | - | |
616 | -void | |
617 | -WMDrawImageString(WMScreen *scr, Drawable d, WMColor *color, WMColor *background, | |
618 | - WMFont *font, int x, int y, char *text, int length) | |
619 | -{ | |
620 | - XftColor textColor; | |
621 | - XftColor bgColor; | |
622 | - | |
623 | - wassertr(font!=NULL); | |
624 | - | |
625 | - textColor.color.red = color->color.red; | |
626 | - textColor.color.green = color->color.green; | |
627 | - textColor.color.blue = color->color.blue; | |
628 | - textColor.color.alpha = color->alpha;; | |
629 | - textColor.pixel = W_PIXEL(color); | |
630 | - | |
631 | - bgColor.color.red = background->color.red; | |
632 | - bgColor.color.green = background->color.green; | |
633 | - bgColor.color.blue = background->color.blue; | |
634 | - bgColor.color.alpha = background->alpha;; | |
635 | - bgColor.pixel = W_PIXEL(background); | |
636 | - | |
637 | - XftDrawChange(scr->xftdraw, d); | |
638 | - | |
639 | - XftDrawRect(scr->xftdraw, &bgColor, x, y, | |
640 | - WMWidthOfString(font, text, length), | |
641 | - font->height); | |
642 | - | |
643 | - if (font->screen->useWideChar) { | |
644 | - wchar_t *wtext; | |
645 | - const char *mtext; | |
646 | - int len; | |
647 | - | |
648 | - mtext = text; | |
649 | - wtext = (wchar_t *)wmalloc(sizeof(wchar_t)*(length+1)); | |
650 | - len = wmbsnrtowcs(wtext, &mtext, length, length); | |
651 | - if (len>0) { | |
652 | - XftDrawString32(scr->xftdraw, &textColor, font->font, | |
653 | - x, y + font->y, (XftChar32*)wtext, len); | |
654 | - } else if (len==-1) { | |
655 | - wwarning(_("Conversion to widechar failed (possible invalid " | |
656 | - "multibyte sequence): '%s':(pos %d)\n"), | |
657 | - text, mtext-text+1); | |
658 | - /* we can draw normal text, or we can draw as much widechar | |
659 | - * text as was already converted until the error. go figure */ | |
660 | - /*XftDrawString8(scr->xftdraw, &textColor, font->font, | |
661 | - x, y + font->y, (XftChar8*)text, length);*/ | |
662 | - } | |
663 | - wfree(wtext); | |
664 | - } else { | |
665 | - XftDrawString8(scr->xftdraw, &textColor, font->font, | |
666 | - x, y + font->y, (XftChar8*)text, length); | |
667 | - } | |
668 | -} | |
669 | - | |
670 | - | |
671 | -WMFont* | |
672 | -WMCopyFontWithChanges(WMScreen *scrPtr, WMFont *font, | |
673 | - const WMFontAttributes *changes) | |
674 | -{ | |
675 | - int index[FONT_PROPS], count[FONT_PROPS]; | |
676 | - int totalProps, i, j, carry; | |
677 | - char fname[512]; | |
678 | - WMFontFlags fFlags; | |
679 | - WMBag *props; | |
680 | - WMArray *options; | |
681 | - WMFont *result; | |
682 | - char *prop; | |
683 | - | |
684 | - snprintf(fname, 512, "%s", font->name); | |
685 | - | |
686 | - fFlags = (font->antialiased ? WFAntialiased : WFNotAntialiased); | |
687 | - fFlags |= (font->notFontSet ? WFNormalFont : WFFontSet); | |
688 | - | |
689 | - props = WMCreateBagWithDestructor(1, (WMFreeDataProc*)WMFreeArray); | |
690 | - | |
691 | - totalProps = 0; | |
692 | - for (i=0; i<FONT_PROPS; i++) { | |
693 | - prop = ((W_FontAttributes*)changes)->props[i]; | |
694 | - count[i] = index[i] = 0; | |
695 | - if (!prop) { | |
696 | - /* No change for this property */ | |
697 | - continue; | |
698 | - } else if (strchr(prop, ',')==NULL) { | |
699 | - /* Simple option */ | |
700 | - changeFontProp(fname, prop, i); | |
701 | - } else { | |
702 | - /* Option with fallback alternatives */ | |
703 | - if ((changes==WFAEmphasized || changes==WFABoldEmphasized) && | |
704 | - font->antialiased && strcmp(prop, "o,i")==0) { | |
705 | - options = getOptions("i,o"); | |
706 | - } else { | |
707 | - options = getOptions(prop); | |
708 | - } | |
709 | - WMInsertInBag(props, i, options); | |
710 | - count[i] = WMGetArrayItemCount(options); | |
711 | - if (totalProps==0) | |
712 | - totalProps = 1; | |
713 | - totalProps = totalProps * count[i]; | |
714 | - } | |
715 | - } | |
716 | - | |
717 | - if (totalProps == 0) { | |
718 | - /* No options with fallback alternatives at all */ | |
719 | - WMFreeBag(props); | |
720 | - return WMCreateFontWithFlags(scrPtr, fname, fFlags); | |
721 | - } | |
722 | - | |
723 | - for (i=0; i<totalProps; i++) { | |
724 | - for (j=0; j<FONT_PROPS; j++) { | |
725 | - if (count[j]!=0) { | |
726 | - options = WMGetFromBag(props, j); | |
727 | - prop = WMGetFromArray(options, index[j]); | |
728 | - if (prop) { | |
729 | - changeFontProp(fname, prop, j); | |
730 | - } | |
731 | - } | |
732 | - } | |
733 | - result = WMCreateFontWithFlags(scrPtr, fname, fFlags); | |
734 | - if (result) { | |
735 | - WMFreeBag(props); | |
736 | - return result; | |
737 | - } | |
738 | - for (j=FONT_PROPS-1, carry=1; j>=0; j--) { | |
739 | - if (count[j]!=0) { | |
740 | - index[j] += carry; | |
741 | - carry = (index[j]==count[j]); | |
742 | - index[j] %= count[j]; | |
743 | - } | |
744 | - } | |
745 | - } | |
746 | - | |
747 | - WMFreeBag(props); | |
748 | - | |
749 | - return NULL; | |
750 | -} | |
751 | - | |
752 | - | |
753 | -#if 0 | |
754 | - | |
755 | -#define FONT_PROPS 14 | |
756 | - | |
757 | -typedef struct { | |
758 | - char *props[FONT_PROPS]; | |
759 | -} W_FontAttributes; | |
760 | - | |
761 | - | |
762 | -static void | |
763 | -changeFontProp(char *buf, char *newprop, int position) | |
764 | -{ | |
765 | - char buf2[512]; | |
766 | - char *ptr, *pptr, *rptr; | |
767 | - int count; | |
768 | - | |
769 | - if (buf[0]!='-') { | |
770 | - /* // remove warning later. or maybe not */ | |
771 | - wwarning(_("Invalid font specification: '%s'\n"), buf); | |
772 | - return; | |
773 | - } | |
774 | - | |
775 | - ptr = pptr = rptr = buf; | |
776 | - count = 0; | |
777 | - while (*ptr && *ptr!=',') { | |
778 | - if (*ptr == '-') { | |
779 | - count++; | |
780 | - if (count-1==position+1) { | |
781 | - rptr = ptr; | |
782 | - break; | |
783 | - } | |
784 | - if (count-1==position) { | |
785 | - pptr = ptr+1; | |
786 | - } | |
787 | - } | |
788 | - ptr++; | |
789 | - } | |
790 | - if (position==FONT_PROPS-1) { | |
791 | - rptr = ptr; | |
792 | - } | |
793 | - | |
794 | - *pptr = 0; | |
795 | - snprintf(buf2, 512, "%s%s%s", buf, newprop, rptr); | |
796 | - strcpy(buf, buf2); | |
797 | -} | |
798 | - | |
799 | - | |
800 | -static WMArray* | |
801 | -getOptions(char *options) | |
802 | -{ | |
803 | - char *ptr, *ptr2, *str; | |
804 | - WMArray *result; | |
805 | - int count; | |
806 | - | |
807 | - result = WMCreateArrayWithDestructor(2, (WMFreeDataProc*)wfree); | |
808 | - | |
809 | - ptr = options; | |
810 | - while (1) { | |
811 | - ptr2 = strchr(ptr, ','); | |
812 | - if (!ptr2) { | |
813 | - WMAddToArray(result, wstrdup(ptr)); | |
814 | - break; | |
815 | - } else { | |
816 | - count = ptr2 - ptr; | |
817 | - str = wmalloc(count+1); | |
818 | - memcpy(str, ptr, count); | |
819 | - str[count] = 0; | |
820 | - WMAddToArray(result, str); | |
821 | - ptr = ptr2 + 1; | |
822 | - } | |
823 | - } | |
824 | - | |
825 | - return result; | |
826 | -} | |
827 | - | |
828 | ||
829 | -#endif | |
830 | - | |
831 | +#include <wchar.h> | |
832 | ||
833 | -#else /* No XFT support */ | |
834 | ||
835 | - | |
836 | static char *makeFontSetOfSize(char *fontset, int size); | |
837 | ||
838 | ||
839 | @@ -913,6 +276,9 @@ | |
840 | Display *display = scrPtr->display; | |
841 | char *fname, *ptr; | |
842 | ||
843 | + if (!scrPtr->hasXftSupport) | |
844 | + return NULL; | |
845 | + | |
846 | fontName = xlfdFromFontName(fontName, True); | |
847 | ||
848 | if ((ptr = strchr(fontName, ','))) { | |
849 | @@ -989,6 +355,9 @@ | |
850 | Display *display = scrPtr->display; | |
851 | char *fname, *ptr; | |
852 | ||
853 | + if (!scrPtr->hasXftSupport) | |
854 | + return NULL; | |
855 | + | |
856 | fontName = xlfdFromFontName(fontName, True); | |
857 | ||
858 | if ((ptr = strchr(fontName, ','))) { | |
859 | @@ -1153,6 +522,13 @@ | |
860 | ||
861 | ||
862 | Bool | |
863 | +WMHasAntialiasingSupport(WMScreen *scrPtr) | |
864 | +{ | |
865 | + return scrPtr->hasXftSupport; | |
866 | +} | |
867 | + | |
868 | + | |
869 | +Bool | |
870 | WMIsAntialiasingEnabled(WMScreen *scrPtr) | |
871 | { | |
872 | return scrPtr->antialiasedText; | |
873 | @@ -1704,7 +1080,6 @@ | |
874 | return NULL; | |
875 | } | |
876 | ||
877 | -#endif | |
878 | ||
879 | ||
880 | // should WFANormal also set "normal" or leave it alone? | |
881 | Index: WINGs/wframe.c | |
882 | =================================================================== | |
883 | RCS file: /cvsroot/wm/WINGs/wframe.c,v | |
884 | retrieving revision 1.14 | |
885 | retrieving revision 1.13 | |
886 | diff -u -r1.14 -r1.13 | |
887 | --- WINGs/wframe.c 2003/08/14 01:39:27 1.14 | |
888 | +++ WINGs/wframe.c 2002/11/25 04:46:00 1.13 | |
889 | @@ -198,7 +198,7 @@ | |
890 | if (drawTitle) { | |
891 | /* can't draw AA text over and over again because it gets messed */ | |
892 | /* // TODO create the dbl buffer pixmap when create/set frame title */ | |
893 | - if (scrPtr->antialiasedText) { | |
894 | + if (font->antialiased) { | |
895 | Drawable d; | |
896 | ||
897 | d = XCreatePixmap(display, view->window, tw, th, scrPtr->depth); | |
898 | Index: WINGs/widgets.c | |
899 | =================================================================== | |
900 | RCS file: /cvsroot/wm/WINGs/widgets.c,v | |
901 | retrieving revision 1.52 | |
902 | retrieving revision 1.50 | |
903 | diff -u -r1.52 -r1.50 | |
904 | --- WINGs/widgets.c 2003/08/15 02:58:04 1.52 | |
905 | +++ WINGs/widgets.c 2003/06/10 01:56:28 1.50 | |
906 | @@ -622,7 +622,20 @@ | |
907 | ||
908 | scrPtr->fontCache = WMCreateHashTable(WMStringPointerHashCallbacks); | |
909 | ||
910 | + scrPtr->xftFontCache = WMCreateHashTable(WMStringPointerHashCallbacks); | |
911 | + | |
912 | + scrPtr->fontSetCache = WMCreateHashTable(WMStringPointerHashCallbacks); | |
913 | + | |
914 | + scrPtr->xftFontSetCache = WMCreateHashTable(WMStringPointerHashCallbacks); | |
915 | + | |
916 | #ifdef XFT | |
917 | + | |
918 | +# ifdef XFT2 | |
919 | + scrPtr->hasXftSupport = 1; | |
920 | +# else | |
921 | + scrPtr->hasXftSupport = XftDefaultHasRender(scrPtr->display); | |
922 | +# endif | |
923 | + | |
924 | scrPtr->xftdraw = XftDrawCreate(scrPtr->display, W_DRAWABLE(scrPtr), | |
925 | scrPtr->visual, scrPtr->colormap); | |
926 | #endif | |
927 | @@ -755,9 +768,16 @@ | |
928 | ||
929 | scrPtr->useMultiByte = WINGsConfiguration.useMultiByte; | |
930 | ||
931 | - scrPtr->useWideChar = 1; | |
932 | - | |
933 | - scrPtr->antialiasedText = WINGsConfiguration.antialiasedText; | |
934 | + if (scrPtr->hasXftSupport) { | |
935 | + scrPtr->antialiasedText = WINGsConfiguration.antialiasedText; | |
936 | + } else { | |
937 | + if (WINGsConfiguration.antialiasedText) { | |
938 | + wwarning(_("Text antialiasing is enabled in the configuration but" | |
939 | + " the X server doesn't have the required capabilities " | |
940 | + "(missing RENDER extension). Disabling text antialiasing.")); | |
941 | + } | |
942 | + scrPtr->antialiasedText = False; | |
943 | + } | |
944 | ||
945 | scrPtr->normalFont = WMSystemFontOfSize(scrPtr, | |
946 | WINGsConfiguration.defaultFontSize); | |
947 | @@ -780,16 +800,16 @@ | |
948 | CHECK_BUTTON_ON_HEIGHT, False); | |
949 | ||
950 | scrPtr->checkButtonImageOff = makePixmap(scrPtr, CHECK_BUTTON_OFF, | |
951 | - CHECK_BUTTON_OFF_WIDTH, | |
952 | - CHECK_BUTTON_OFF_HEIGHT, False); | |
953 | + CHECK_BUTTON_OFF_WIDTH, | |
954 | + CHECK_BUTTON_OFF_HEIGHT, False); | |
955 | ||
956 | scrPtr->radioButtonImageOn = makePixmap(scrPtr, RADIO_BUTTON_ON, | |
957 | RADIO_BUTTON_ON_WIDTH, | |
958 | RADIO_BUTTON_ON_HEIGHT, False); | |
959 | ||
960 | scrPtr->radioButtonImageOff = makePixmap(scrPtr, RADIO_BUTTON_OFF, | |
961 | - RADIO_BUTTON_OFF_WIDTH, | |
962 | - RADIO_BUTTON_OFF_HEIGHT, False); | |
963 | + RADIO_BUTTON_OFF_WIDTH, | |
964 | + RADIO_BUTTON_OFF_HEIGHT, False); | |
965 | ||
966 | scrPtr->buttonArrow = makePixmap(scrPtr, BUTTON_ARROW, | |
967 | BUTTON_ARROW_WIDTH, BUTTON_ARROW_HEIGHT, | |
968 | @@ -822,20 +842,20 @@ | |
969 | SCROLLER_ARROW_RIGHT_HEIGHT, True); | |
970 | ||
971 | scrPtr->hiUpArrow = makePixmap(scrPtr, HI_SCROLLER_ARROW_UP, | |
972 | - SCROLLER_ARROW_UP_WIDTH, | |
973 | - SCROLLER_ARROW_UP_HEIGHT, True); | |
974 | + SCROLLER_ARROW_UP_WIDTH, | |
975 | + SCROLLER_ARROW_UP_HEIGHT, True); | |
976 | ||
977 | scrPtr->hiDownArrow = makePixmap(scrPtr, HI_SCROLLER_ARROW_DOWN, | |
978 | - SCROLLER_ARROW_DOWN_WIDTH, | |
979 | - SCROLLER_ARROW_DOWN_HEIGHT, True); | |
980 | + SCROLLER_ARROW_DOWN_WIDTH, | |
981 | + SCROLLER_ARROW_DOWN_HEIGHT, True); | |
982 | ||
983 | scrPtr->hiLeftArrow = makePixmap(scrPtr, HI_SCROLLER_ARROW_LEFT, | |
984 | - SCROLLER_ARROW_LEFT_WIDTH, | |
985 | - SCROLLER_ARROW_LEFT_HEIGHT, True); | |
986 | + SCROLLER_ARROW_LEFT_WIDTH, | |
987 | + SCROLLER_ARROW_LEFT_HEIGHT, True); | |
988 | ||
989 | scrPtr->hiRightArrow = makePixmap(scrPtr, HI_SCROLLER_ARROW_RIGHT, | |
990 | - SCROLLER_ARROW_RIGHT_WIDTH, | |
991 | - SCROLLER_ARROW_RIGHT_HEIGHT, True); | |
992 | + SCROLLER_ARROW_RIGHT_WIDTH, | |
993 | + SCROLLER_ARROW_RIGHT_HEIGHT, True); | |
994 | ||
995 | scrPtr->popUpIndicator = makePixmap(scrPtr, POPUP_INDICATOR, | |
996 | POPUP_INDICATOR_WIDTH, | |
997 | @@ -858,7 +878,7 @@ | |
998 | { | |
999 | XColor bla; | |
1000 | Pixmap blank; | |
1001 | - | |
1002 | + | |
1003 | blank = XCreatePixmap(display, scrPtr->stipple, 1, 1, 1); | |
1004 | XSetForeground(display, scrPtr->monoGC, 0); | |
1005 | XFillRectangle(display, blank, scrPtr->monoGC, 0, 0, 1, 1); | |
1006 | Index: WINGs/WINGs/WINGs.h | |
1007 | =================================================================== | |
1008 | RCS file: /cvsroot/wm/WINGs/WINGs/WINGs.h,v | |
1009 | retrieving revision 1.42 | |
1010 | retrieving revision 1.41 | |
1011 | diff -u -r1.42 -r1.41 | |
1012 | --- WINGs/WINGs/WINGs.h 2003/08/07 00:26:22 1.42 | |
1013 | +++ WINGs/WINGs/WINGs.h 2003/07/16 20:58:50 1.41 | |
1014 | @@ -107,6 +107,22 @@ | |
1015 | }; | |
1016 | ||
1017 | ||
1018 | +/* Font flags */ | |
1019 | +typedef enum { | |
1020 | + WFDefaultFont = 0, | |
1021 | + WFNormalFont = (1<<0), | |
1022 | + WFFontSet = (1<<1), | |
1023 | + WFAntialiased = (1<<2), | |
1024 | + WFNotAntialiased = (1<<3) | |
1025 | +} WMFontFlags; | |
1026 | + | |
1027 | + | |
1028 | +/* Use default system font size in system font name */ | |
1029 | +enum { | |
1030 | + WFDefaultSize = -1 | |
1031 | +}; | |
1032 | + | |
1033 | + | |
1034 | /* frame title positions */ | |
1035 | typedef enum { | |
1036 | WTPNoTitle, | |
1037 | @@ -730,11 +746,18 @@ | |
1038 | ||
1039 | /* ....................................................................... */ | |
1040 | ||
1041 | +WMFont* WMCreateNormalFont(WMScreen *scrPtr, char *fontName); | |
1042 | + | |
1043 | +WMFont* WMCreateFontSet(WMScreen *scrPtr, char *fontName); | |
1044 | + | |
1045 | +WMFont* WMCreateAntialiasedFont(WMScreen *scrPtr, char *fontName); | |
1046 | + | |
1047 | +WMFont* WMCreateAntialiasedFontSet(WMScreen *scrPtr, char *fontName); | |
1048 | + | |
1049 | WMFont* WMCreateFont(WMScreen *scrPtr, char *fontName); | |
1050 | ||
1051 | -//?? | |
1052 | -WMFont* WMCreateFontWithAttributes(WMScreen *scrPtr, char *fontName, | |
1053 | - WMFontAttributes *attribs); | |
1054 | +WMFont* WMCreateFontWithFlags(WMScreen *scrPtr, char *fontName, | |
1055 | + WMFontFlags flags); | |
1056 | ||
1057 | WMFont* WMCopyFontWithChanges(WMScreen *scrPtr, WMFont *font, | |
1058 | const WMFontAttributes *changes); | |
1059 | @@ -747,6 +770,15 @@ | |
1060 | ||
1061 | unsigned int WMFontHeight(WMFont *font); | |
1062 | ||
1063 | +Bool WMIsAntialiasedFont(WMFont *font); | |
1064 | + | |
1065 | +/* | |
1066 | +WMFont* WMUserFontOfSize(WMScreen *scrPtr, int size); | |
1067 | + | |
1068 | +WMFont* WMUserFixedPitchFontOfSize(WMScreen *scrPtr, int size); | |
1069 | +*/ | |
1070 | + | |
1071 | + | |
1072 | void WMSetWidgetDefaultFont(WMScreen *scr, WMFont *font); | |
1073 | ||
1074 | void WMSetWidgetDefaultBoldFont(WMScreen *scr, WMFont *font); | |
1075 | @@ -758,6 +790,8 @@ | |
1076 | WMFont* WMSystemFontOfSize(WMScreen *scrPtr, int size); | |
1077 | ||
1078 | WMFont* WMBoldSystemFontOfSize(WMScreen *scrPtr, int size); | |
1079 | + | |
1080 | +XFontSet WMGetFontFontSet(WMFont *font); | |
1081 | ||
1082 | /* ....................................................................... */ | |
1083 | ||
1084 | Index: WINGs/WINGs/WINGsP.h | |
1085 | =================================================================== | |
1086 | RCS file: /cvsroot/wm/WINGs/WINGs/WINGsP.h,v | |
1087 | retrieving revision 1.19 | |
1088 | retrieving revision 1.16 | |
1089 | diff -u -r1.19 -r1.16 | |
1090 | --- WINGs/WINGs/WINGsP.h 2003/08/15 02:58:04 1.19 | |
1091 | +++ WINGs/WINGs/WINGsP.h 2002/11/25 04:46:02 1.16 | |
1092 | @@ -24,7 +24,7 @@ | |
1093 | ||
1094 | #define DOUBLE_BUFFER | |
1095 | ||
1096 | - | |
1097 | + | |
1098 | ||
1099 | #define WC_UserWidget 128 | |
1100 | ||
1101 | @@ -47,21 +47,18 @@ | |
1102 | ||
1103 | typedef struct W_Font { | |
1104 | struct W_Screen *screen; | |
1105 | - | |
1106 | -#ifdef XFT | |
1107 | - struct _XftFont *font; | |
1108 | -#else | |
1109 | - // pick one | |
1110 | - //XFontSet font; | |
1111 | - XFontStruct *font; | |
1112 | -#endif | |
1113 | ||
1114 | + union { | |
1115 | + XFontSet set; | |
1116 | + XFontStruct *normal; | |
1117 | + struct _XftFont *xft; | |
1118 | + } font; | |
1119 | short height; | |
1120 | short y; | |
1121 | short refCount; | |
1122 | char *name; | |
1123 | - //unsigned int notFontSet:1; | |
1124 | - //unsigned int antialiased:1; | |
1125 | + unsigned int notFontSet:1; | |
1126 | + unsigned int antialiased:1; | |
1127 | } W_Font; | |
1128 | ||
1129 | ||
1130 | @@ -100,7 +97,7 @@ | |
1131 | struct W_DraggingInfo { | |
1132 | Window destinationWindow; | |
1133 | Window sourceWindow; | |
1134 | - | |
1135 | + | |
1136 | WMPoint location; | |
1137 | ||
1138 | unsigned sourceOperation; | |
1139 | @@ -119,7 +116,7 @@ | |
1140 | WMSize mouseOffset; | |
1141 | unsigned finished:1; | |
1142 | }; | |
1143 | - | |
1144 | + | |
1145 | ||
1146 | typedef struct W_Screen { | |
1147 | Display *display; | |
1148 | @@ -142,6 +139,8 @@ | |
1149 | ||
1150 | struct _XftDraw *xftdraw; /* shared XftDraw */ | |
1151 | ||
1152 | + Bool hasXftSupport; /* if it can antialias text */ | |
1153 | + | |
1154 | /* application related */ | |
1155 | ||
1156 | W_FocusInfo *focusInfo; | |
1157 | @@ -201,9 +200,13 @@ | |
1158 | ||
1159 | WMHashTable *fontCache; | |
1160 | ||
1161 | - Bool useMultiByte; | |
1162 | + WMHashTable *xftFontCache; | |
1163 | ||
1164 | - Bool useWideChar; | |
1165 | + WMHashTable *fontSetCache; | |
1166 | + | |
1167 | + WMHashTable *xftFontSetCache; | |
1168 | + | |
1169 | + Bool useMultiByte; | |
1170 | ||
1171 | Bool antialiasedText; | |
1172 | ||
1173 | @@ -413,6 +416,8 @@ | |
1174 | typedef struct _WINGsConfiguration { | |
1175 | char *systemFont; | |
1176 | char *boldSystemFont; | |
1177 | + char *antialiasedSystemFont; | |
1178 | + char *antialiasedBoldSystemFont; | |
1179 | int defaultFontSize; | |
1180 | Bool antialiasedText; | |
1181 | Bool useMultiByte; | |
1182 | Index: WINGs/po/ca.po | |
1183 | =================================================================== | |
1184 | RCS file: /cvsroot/wm/WINGs/po/ca.po,v | |
1185 | retrieving revision 1.2 | |
1186 | retrieving revision 1.1 | |
1187 | diff -u -r1.2 -r1.1 | |
1188 | --- WINGs/po/ca.po 2003/09/16 23:31:30 1.2 | |
1189 | +++ WINGs/po/ca.po 2003/02/23 22:12:21 1.1 | |
1190 | @@ -1,25 +1,25 @@ | |
1191 | # Catalan messages for WINGs. | |
1192 |