5 # include <X11/Xft/Xft.h>
13 #include <X11/Xlocale.h>
16 static char *makeFontSetOfSize(char *fontset
, int size
);
20 /* XLFD pattern matching */
22 getElementFromXLFD(const char *xlfd
, int index
)
26 if (*p
== '-' && --index
== 0) {
27 const char *end
= strchr(p
+ 1, '-');
30 if (end
== 0) end
= p
+ strlen(p
);
33 memcpy(buf
, p
+ 1, len
);
43 /* XLFD pattern matching */
45 generalizeXLFD(const char *xlfd
)
49 char *weight
= getElementFromXLFD(xlfd
, 3);
50 char *slant
= getElementFromXLFD(xlfd
, 4);
51 char *pxlsz
= getElementFromXLFD(xlfd
, 7);
53 #define Xstrlen(A) ((A)?strlen(A):0)
54 len
= Xstrlen(xlfd
)+Xstrlen(weight
)+Xstrlen(slant
)+Xstrlen(pxlsz
)*2+60;
57 buf
= wmalloc(len
+ 1);
58 snprintf(buf
, len
+ 1, "%s,-*-*-%s-%s-*-*-%s-*-*-*-*-*-*-*,"
59 "-*-*-*-*-*-*-%s-*-*-*-*-*-*-*,*",
60 xlfd
, weight
, slant
, pxlsz
, pxlsz
);
69 /* XLFD pattern matching */
71 W_CreateFontSetWithGuess(Display
*dpy
, char *xlfd
, char ***missing
,
72 int *nmissing
, char **def_string
)
74 XFontSet fs
= XCreateFontSet(dpy
, xlfd
, missing
, nmissing
, def_string
);
76 if (fs
!= NULL
&& *nmissing
== 0) return fs
;
78 /* for non-iso8859-1 language and iso8859-1 specification
79 (this fontset is only for pattern analysis) */
81 if (*nmissing
!= 0) XFreeStringList(*missing
);
82 setlocale(LC_CTYPE
, "C");
83 fs
= XCreateFontSet(dpy
, xlfd
, missing
, nmissing
, def_string
);
84 setlocale(LC_CTYPE
, "");
87 /* make XLFD font name for pattern analysis */
89 XFontStruct
**fontstructs
;
91 if (XFontsOfFontSet(fs
, &fontstructs
, &fontnames
) > 0)
95 xlfd
= generalizeXLFD(xlfd
);
97 if (*nmissing
!= 0) XFreeStringList(*missing
);
98 if (fs
!= NULL
) XFreeFontSet(dpy
, fs
);
100 fs
= XCreateFontSet(dpy
, xlfd
, missing
, nmissing
, def_string
);
108 xlfdFromFontName(char *fontName
, Bool antialiased
)
110 char *systemFont
, *boldSystemFont
;
115 systemFont
= WINGsConfiguration
.antialiasedSystemFont
;
116 boldSystemFont
= WINGsConfiguration
.antialiasedBoldSystemFont
;
118 systemFont
= WINGsConfiguration
.systemFont
;
119 boldSystemFont
= WINGsConfiguration
.boldSystemFont
;
122 size
= WINGsConfiguration
.defaultFontSize
;
124 if (strcmp(fontName
, "SystemFont")==0) {
126 size
= WINGsConfiguration
.defaultFontSize
;
127 } else if (strncmp(fontName
, "SystemFont-", 11)==0) {
129 if (sscanf(&fontName
[11], "%i", &size
)!=1) {
130 size
= WINGsConfiguration
.defaultFontSize
;
131 wwarning(_("Invalid size specification '%s' in %s. "
132 "Using default %d\n"), &fontName
[11], fontName
, size
);
134 } else if (strcmp(fontName
, "BoldSystemFont")==0) {
135 font
= boldSystemFont
;
136 size
= WINGsConfiguration
.defaultFontSize
;
137 } else if (strncmp(fontName
, "BoldSystemFont-", 15)==0) {
138 font
= boldSystemFont
;
139 if (sscanf(&fontName
[15], "%i", &size
)!=1) {
140 size
= WINGsConfiguration
.defaultFontSize
;
141 wwarning(_("Invalid size specification '%s' in %s. "
142 "Using default %d\n"), &fontName
[15], fontName
, size
);
148 return (font
!=NULL
? makeFontSetOfSize(font
, size
) : wstrdup(fontName
));
153 WMCreateFontSet(WMScreen
*scrPtr
, char *fontName
)
156 Display
*display
= scrPtr
->display
;
161 XFontSetExtents
*extents
;
163 fname
= xlfdFromFontName(fontName
, False
);
165 font
= WMHashGet(scrPtr
->fontSetCache
, fname
);
172 font
= wmalloc(sizeof(WMFont
));
173 memset(font
, 0, sizeof(WMFont
));
175 font
->notFontSet
= 0;
176 font
->antialiased
= 0;
178 font
->screen
= scrPtr
;
180 font
->font
.set
= W_CreateFontSetWithGuess(display
, fname
, &missing
,
181 &nmissing
, &defaultString
);
182 if (nmissing
> 0 && font
->font
.set
) {
185 wwarning(_("the following character sets are missing in %s:"), fname
);
186 for (i
= 0; i
< nmissing
; i
++) {
187 wwarning(missing
[i
]);
189 XFreeStringList(missing
);
191 wwarning(_("the string \"%s\" will be used in place of any characters from those sets."),
194 if (!font
->font
.set
) {
200 extents
= XExtentsOfFontSet(font
->font
.set
);
202 font
->height
= extents
->max_logical_extent
.height
;
203 font
->y
= font
->height
- (font
->height
+ extents
->max_logical_extent
.y
);
209 assert(WMHashInsert(scrPtr
->fontSetCache
, font
->name
, font
)==NULL
);
217 WMCreateNormalFont(WMScreen
*scrPtr
, char *fontName
)
220 Display
*display
= scrPtr
->display
;
223 fontName
= xlfdFromFontName(fontName
, False
);
225 if ((ptr
= strchr(fontName
, ','))) {
226 fname
= wmalloc(ptr
- fontName
+ 1);
227 strncpy(fname
, fontName
, ptr
- fontName
);
228 fname
[ptr
- fontName
] = 0;
230 fname
= wstrdup(fontName
);
235 font
= WMHashGet(scrPtr
->fontCache
, fname
);
242 font
= wmalloc(sizeof(WMFont
));
243 memset(font
, 0, sizeof(WMFont
));
245 font
->notFontSet
= 1;
246 font
->antialiased
= 0;
248 font
->screen
= scrPtr
;
250 font
->font
.normal
= XLoadQueryFont(display
, fname
);
251 if (!font
->font
.normal
) {
256 font
->height
= font
->font
.normal
->ascent
+font
->font
.normal
->descent
;
257 font
->y
= font
->font
.normal
->ascent
;
263 assert(WMHashInsert(scrPtr
->fontCache
, font
->name
, font
)==NULL
);
270 WMCreateAntialiasedFont(WMScreen
*scrPtr
, char *fontName
)
274 Display
*display
= scrPtr
->display
;
277 if (!scrPtr
->hasXftSupport
)
280 fontName
= xlfdFromFontName(fontName
, True
);
282 if ((ptr
= strchr(fontName
, ','))) {
283 fname
= wmalloc(ptr
- fontName
+ 1);
284 strncpy(fname
, fontName
, ptr
- fontName
);
285 fname
[ptr
- fontName
] = 0;
287 fname
= wstrdup(fontName
);
292 font
= WMHashGet(scrPtr
->xftFontCache
, fname
);
299 font
= wmalloc(sizeof(WMFont
));
300 memset(font
, 0, sizeof(WMFont
));
302 font
->notFontSet
= 1;
303 font
->antialiased
= 1;
305 font
->screen
= scrPtr
;
308 /* // Xft sux. Loading a font that doesn't exist will load the default
309 * defined in XftConfig without any warning or error */
310 font
->font
.normal
= XLoadQueryFont(display
, fname
);
311 if (!font
->font
.normal
) {
316 XFreeFont(display
, font
->font
.normal
);
319 font
->font
.xft
= XftFontOpenXlfd(display
, scrPtr
->screen
, fname
);
320 if (!font
->font
.xft
) {
325 font
->height
= font
->font
.xft
->ascent
+font
->font
.xft
->descent
;
326 font
->y
= font
->font
.xft
->ascent
;
332 assert(WMHashInsert(scrPtr
->xftFontCache
, font
->name
, font
)==NULL
);
342 WMCreateAntialiasedFontSet(WMScreen
*scrPtr
, char *fontName
)
346 Display
*display
= scrPtr
->display
;
349 if (!scrPtr
->hasXftSupport
)
352 fontName
= xlfdFromFontName(fontName
, True
);
354 // use the second in list if available, instead of first?
355 if ((ptr
= strchr(fontName
, ','))) {
356 fname
= wmalloc(ptr
- fontName
+ 1);
357 strncpy(fname
, fontName
, ptr
- fontName
);
358 fname
[ptr
- fontName
] = 0;
360 fname
= wstrdup(fontName
);
365 font
= WMHashGet(scrPtr
->xftFontSetCache
, fname
);
372 font
= wmalloc(sizeof(WMFont
));
373 memset(font
, 0, sizeof(WMFont
));
375 font
->notFontSet
= 0;
376 font
->antialiased
= 1;
378 font
->screen
= scrPtr
;
381 /* // Xft sux. Loading a font that doesn't exist will load the default
382 * defined in XftConfig without any warning or error */
383 font
->font
.normal
= XLoadQueryFont(display
, fname
);
384 if (!font
->font
.normal
) {
389 XFreeFont(display
, font
->font
.normal
);
392 font
->font
.xft
= XftFontOpenXlfd(display
, scrPtr
->screen
, fname
);
393 if (!font
->font
.xft
) {
398 font
->height
= font
->font
.xft
->ascent
+font
->font
.xft
->descent
;
399 font
->y
= font
->font
.xft
->ascent
;
405 assert(WMHashInsert(scrPtr
->xftFontSetCache
, font
->name
, font
)==NULL
);
415 WMCreateFont(WMScreen
*scrPtr
, char *fontName
)
417 return WMCreateFontWithFlags(scrPtr
, fontName
, WFDefaultFont
);
422 WMCreateFontWithFlags(WMScreen
*scrPtr
, char *fontName
, WMFontFlags flags
)
424 Bool multiByte
= scrPtr
->useMultiByte
;
425 Bool antialiased
= scrPtr
->antialiasedText
;
428 if (flags
& WFFontSet
) {
430 } else if (flags
& WFNormalFont
) {
433 if (flags
& WFAntialiased
) {
435 } else if (flags
& WFNotAntialiased
) {
439 if (antialiased
&& multiByte
) {
440 font
= WMCreateAntialiasedFontSet(scrPtr
, fontName
);
441 /* If we cannot create an antialiased font set and antialiasing is
442 * not explicitly requested in flags, fallback to standard font sets */
443 if (!font
&& (flags
& WFAntialiased
)==0) {
444 font
= WMCreateFontSet(scrPtr
, fontName
);
446 } else if (antialiased
) {
447 font
= WMCreateAntialiasedFont(scrPtr
, fontName
);
448 /* If we cannot create an antialiased font and antialiasing is
449 * not explicitly requested in flags, fallback to normal font */
450 if (!font
&& (flags
& WFAntialiased
)==0) {
451 font
= WMCreateNormalFont(scrPtr
, fontName
);
453 } else if (multiByte
) {
454 font
= WMCreateFontSet(scrPtr
, fontName
);
456 font
= WMCreateNormalFont(scrPtr
, fontName
);
464 WMRetainFont(WMFont
*font
)
466 wassertrv(font
!=NULL
, NULL
);
475 WMReleaseFont(WMFont
*font
)
477 wassertr(font
!=NULL
);
480 if (font
->refCount
< 1) {
481 if (font
->antialiased
) {
483 XftFontClose(font
->screen
->display
, font
->font
.xft
);
487 } else if (font
->notFontSet
) {
488 XFreeFont(font
->screen
->display
, font
->font
.normal
);
490 XFreeFontSet(font
->screen
->display
, font
->font
.set
);
494 if (font
->antialiased
&& !font
->notFontSet
) {
495 WMHashRemove(font
->screen
->xftFontSetCache
, font
->name
);
496 } else if (font
->antialiased
) {
497 WMHashRemove(font
->screen
->xftFontCache
, font
->name
);
498 } else if (font
->notFontSet
) {
499 WMHashRemove(font
->screen
->fontCache
, font
->name
);
501 WMHashRemove(font
->screen
->fontSetCache
, font
->name
);
511 WMHasAntialiasingSupport(WMScreen
*scrPtr
)
513 return scrPtr
->hasXftSupport
;
518 WMIsAntialiasingEnabled(WMScreen
*scrPtr
)
520 return scrPtr
->antialiasedText
;
525 WMIsAntialiasedFont(WMFont
*font
)
527 return font
->antialiased
;
532 WMFontHeight(WMFont
*font
)
534 wassertrv(font
!=NULL
, 0);
541 WMDefaultSystemFont(WMScreen
*scrPtr
)
543 return WMRetainFont(scrPtr
->normalFont
);
548 WMDefaultBoldSystemFont(WMScreen
*scrPtr
)
550 return WMRetainFont(scrPtr
->boldFont
);
555 makeSystemFontOfSize(WMScreen
*scrPtr
, int size
, Bool bold
)
558 char *fontSpec
, *xftFontSpec
;
560 #define WConf WINGsConfiguration
562 fontSpec
= makeFontSetOfSize(WConf
.boldSystemFont
, size
);
563 xftFontSpec
= makeFontSetOfSize(WConf
.antialiasedBoldSystemFont
, size
);
565 fontSpec
= makeFontSetOfSize(WConf
.systemFont
, size
);
566 xftFontSpec
= makeFontSetOfSize(WConf
.antialiasedSystemFont
, size
);
570 if (scrPtr
->antialiasedText
&& scrPtr
->useMultiByte
) {
571 font
= WMCreateAntialiasedFontSet(scrPtr
, xftFontSpec
);
572 } else if (scrPtr
->antialiasedText
) {
573 font
= WMCreateAntialiasedFont(scrPtr
, xftFontSpec
);
574 } else if (scrPtr
->useMultiByte
) {
575 font
= WMCreateFontSet(scrPtr
, fontSpec
);
577 font
= WMCreateNormalFont(scrPtr
, fontSpec
);
581 if (scrPtr
->antialiasedText
&& scrPtr
->useMultiByte
) {
582 // is arial a good fallback for multibyte?
583 wwarning(_("could not load font %s. Trying arial."), xftFontSpec
);
585 font
= WMCreateAntialiasedFontSet(scrPtr
, "-*-arial-bold-r-normal-*-12-*-*-*-*-*-*-*");
587 font
= WMCreateAntialiasedFontSet(scrPtr
, "-*-arial-medium-r-normal-*-12-*-*-*-*-*-*-*");
590 wwarning(_("could not load antialiased font set. Reverting to standard font sets."));
591 font
= WMCreateFontSet(scrPtr
, fontSpec
);
593 wwarning(_("could not load FontSet %s. Trying fixed."), fontSpec
);
594 font
= WMCreateFontSet(scrPtr
, "fixed");
597 } else if (scrPtr
->antialiasedText
) {
598 wwarning(_("could not load font %s. Trying arial."), xftFontSpec
);
600 font
= WMCreateAntialiasedFont(scrPtr
, "-*-arial-bold-r-normal-*-12-*-*-*-*-*-*-*");
602 font
= WMCreateAntialiasedFont(scrPtr
, "-*-arial-medium-r-normal-*-12-*-*-*-*-*-*-*");
605 wwarning(_("could not load antialiased fonts. Reverting to normal fonts."));
606 font
= WMCreateNormalFont(scrPtr
, fontSpec
);
608 wwarning(_("could not load font %s. Trying fixed."), fontSpec
);
609 font
= WMCreateNormalFont(scrPtr
, "fixed");
612 } else if (scrPtr
->useMultiByte
) {
613 wwarning(_("could not load font set %s. Trying fixed."), fontSpec
);
614 font
= WMCreateFontSet(scrPtr
, "fixed");
616 font
= WMCreateFontSet(scrPtr
, "-*-fixed-medium-r-normal-*-14-*-*-*-*-*-*-*");
619 wwarning(_("could not load font %s. Trying fixed."), fontSpec
);
620 font
= WMCreateNormalFont(scrPtr
, "fixed");
623 wwarning(_("could not load fixed font!"));
637 WMSystemFontOfSize(WMScreen
*scrPtr
, int size
)
639 return makeSystemFontOfSize(scrPtr
, size
, False
);
644 WMBoldSystemFontOfSize(WMScreen
*scrPtr
, int size
)
646 return makeSystemFontOfSize(scrPtr
, size
, True
);
651 WMGetFontFontSet(WMFont
*font
)
653 wassertrv(font
!=NULL
, NULL
);
655 if (!font
->notFontSet
&& !font
->antialiased
)
656 return font
->font
.set
;
663 WMWidthOfString(WMFont
*font
, char *text
, int length
)
665 wassertrv(font
!=NULL
, 0);
666 wassertrv(text
!=NULL
, 0);
668 if (font
->antialiased
) {
672 if (!font
->notFontSet
) {
676 /* Use mtext instead of text, because mbstrtowcs() alters it */
678 wtext
= (wchar_t *)wmalloc(4*length
+4);
679 // pass a real ps instead of NULL below? for multithread safety as
681 if (mbsrtowcs(wtext
, &mtext
, length
, NULL
)==length
) {
682 XftTextExtents32(font
->screen
->display
, font
->font
.xft
,
683 (XftChar32
*)wtext
, length
, &extents
);
685 // - should rather say that conversion to widechar failed?
686 // - use mtext instead of text so that the position of the
687 // invalid sequence is shown?
688 wwarning(_("Invalid multibyte sequence: '%s'\n"), text
);
689 XftTextExtents8(font
->screen
->display
, font
->font
.xft
,
690 (XftChar8
*)text
, length
, &extents
);
694 XftTextExtents8(font
->screen
->display
, font
->font
.xft
,
695 (XftChar8
*)text
, length
, &extents
);
698 return extents
.xOff
; /* don't ask :P */
702 } else if (font
->notFontSet
) {
703 return XTextWidth(font
->font
.normal
, text
, length
);
708 XmbTextExtents(font
->font
.set
, text
, length
, &AIXsucks
, &rect
);
717 WMDrawString(WMScreen
*scr
, Drawable d
, WMColor
*color
, WMFont
*font
,
718 int x
, int y
, char *text
, int length
)
720 wassertr(font
!=NULL
);
722 if (font
->antialiased
) {
726 xftcolor
.color
.red
= color
->color
.red
;
727 xftcolor
.color
.green
= color
->color
.green
;
728 xftcolor
.color
.blue
= color
->color
.blue
;
729 xftcolor
.color
.alpha
= color
->alpha
;;
730 xftcolor
.pixel
= W_PIXEL(color
);
732 XftDrawChange(scr
->xftdraw
, d
);
734 if (!font
->notFontSet
) {
738 /* Use mtext instead of text, because mbstrtowcs() alters it */
740 wtext
= (wchar_t *)wmalloc(4*length
+4);
741 if (mbsrtowcs(wtext
, &mtext
, length
, NULL
)==length
) {
742 XftDrawString32(scr
->xftdraw
, &xftcolor
, font
->font
.xft
,
743 x
, y
+ font
->y
, (XftChar32
*)wtext
, length
);
745 // - should rather say that conversion to widechar failed?
746 // - use mtext instead of text so that the position of the
747 // invalid sequence is shown?
748 wwarning(_("Invalid multibyte sequence: '%s'\n"), text
);
749 XftDrawString8(scr
->xftdraw
, &xftcolor
, font
->font
.xft
,
750 x
, y
+ font
->y
, (XftChar8
*)text
, length
);
754 XftDrawString8(scr
->xftdraw
, &xftcolor
, font
->font
.xft
,
755 x
, y
+ font
->y
, (XftChar8
*)text
, length
);
760 } else if (font
->notFontSet
) {
761 XSetFont(scr
->display
, scr
->drawStringGC
, font
->font
.normal
->fid
);
762 XSetForeground(scr
->display
, scr
->drawStringGC
, W_PIXEL(color
));
763 XDrawString(scr
->display
, d
, scr
->drawStringGC
, x
, y
+ font
->y
,
766 XSetForeground(scr
->display
, scr
->drawStringGC
, W_PIXEL(color
));
767 XmbDrawString(scr
->display
, d
, font
->font
.set
, scr
->drawStringGC
,
768 x
, y
+ font
->y
, text
, length
);
774 WMDrawImageString(WMScreen
*scr
, Drawable d
, WMColor
*color
, WMColor
*background
,
775 WMFont
*font
, int x
, int y
, char *text
, int length
)
777 wassertr(font
!=NULL
);
779 if (font
->antialiased
) {
784 textColor
.color
.red
= color
->color
.red
;
785 textColor
.color
.green
= color
->color
.green
;
786 textColor
.color
.blue
= color
->color
.blue
;
787 textColor
.color
.alpha
= color
->alpha
;;
788 textColor
.pixel
= W_PIXEL(color
);
790 bgColor
.color
.red
= background
->color
.red
;
791 bgColor
.color
.green
= background
->color
.green
;
792 bgColor
.color
.blue
= background
->color
.blue
;
793 bgColor
.color
.alpha
= background
->alpha
;;
794 bgColor
.pixel
= W_PIXEL(background
);
797 XftDrawChange(scr
->xftdraw
, d
);
799 XftDrawRect(scr
->xftdraw
, &bgColor
, x
, y
,
800 WMWidthOfString(font
, text
, length
), font
->height
);
802 if (!font
->notFontSet
) {
806 /* Use mtext instead of text, because mbstrtowcs() alters it */
808 wtext
= (wchar_t *)wmalloc(4*length
+4);
809 if (mbsrtowcs(wtext
, &mtext
, length
, NULL
)==length
) {
810 XftDrawString32(scr
->xftdraw
, &textColor
, font
->font
.xft
,
811 x
, y
+ font
->y
, (XftChar32
*)wtext
, length
);
813 // - should rather say that conversion to widechar failed?
814 // - use mtext instead of text so that the position of the
815 // invalid sequence is shown?
816 wwarning(_("Invalid multibyte sequence: '%s'\n"), text
);
817 XftDrawString8(scr
->xftdraw
, &textColor
, font
->font
.xft
,
818 x
, y
+ font
->y
, (XftChar8
*)text
, length
);
822 XftDrawString8(scr
->xftdraw
, &textColor
, font
->font
.xft
,
823 x
, y
+ font
->y
, (XftChar8
*)text
, length
);
828 } else if (font
->notFontSet
) {
829 XSetForeground(scr
->display
, scr
->drawImStringGC
, W_PIXEL(color
));
830 XSetBackground(scr
->display
, scr
->drawImStringGC
, W_PIXEL(background
));
831 XSetFont(scr
->display
, scr
->drawImStringGC
, font
->font
.normal
->fid
);
832 XDrawImageString(scr
->display
, d
, scr
->drawImStringGC
,
833 x
, y
+ font
->y
, text
, length
);
835 XSetForeground(scr
->display
, scr
->drawImStringGC
, W_PIXEL(color
));
836 XSetBackground(scr
->display
, scr
->drawImStringGC
, W_PIXEL(background
));
837 XmbDrawImageString(scr
->display
, d
, font
->font
.set
, scr
->drawImStringGC
,
838 x
, y
+ font
->y
, text
, length
);
846 makeFontSetOfSize(char *fontset
, int size
)
858 ptr
= strchr(fontset
, ',');
860 int count
= ptr
-fontset
;
863 wwarning(_("font description %s is too large."), fontset
);
865 memcpy(font
, fontset
, count
);
876 tmp
= wmalloc(end
+ strlen(f
) + 8);
878 sprintf(tmp
, "%s,", newfs
);
879 sprintf(tmp
+ end
+ 1, f
, size
);
881 sprintf(tmp
+ end
, f
, size
);
896 changeFontProp(char *fname
, char *newprop
, int which
)
898 char before
[128], prop
[128], after
[128];
912 else if (part
==which
+1)
922 snprintf(fname
, 255, "%s-%s%s", before
, newprop
, after
);
927 WMNormalizeFont(WMScreen
*scr
, WMFont
*font
)
935 snprintf(fname
, 255, "%s", font
->name
);
936 changeFontProp(fname
, "medium", 2);
937 changeFontProp(fname
, "r", 3);
938 flag
= (font
->antialiased
? WFAntialiased
: WFNotAntialiased
);
939 return WMCreateFontWithFlags(scr
, fname
, flag
);
944 WMStrengthenFont(WMScreen
*scr
, WMFont
*font
)
952 snprintf(fname
, 255, "%s", font
->name
);
953 changeFontProp(fname
, "bold", 2);
954 flag
= (font
->antialiased
? WFAntialiased
: WFNotAntialiased
);
955 return WMCreateFontWithFlags(scr
, fname
, flag
);
960 WMUnstrengthenFont(WMScreen
*scr
, WMFont
*font
)
968 snprintf(fname
, 255, "%s", font
->name
);
969 changeFontProp(fname
, "medium", 2);
970 flag
= (font
->antialiased
? WFAntialiased
: WFNotAntialiased
);
971 return WMCreateFontWithFlags(scr
, fname
, flag
);
976 WMEmphasizeFont(WMScreen
*scr
, WMFont
*font
)
984 snprintf(fname
, 255, "%s", font
->name
);
985 if (font
->antialiased
)
986 changeFontProp(fname
, "i", 3);
988 changeFontProp(fname
, "o", 3);
990 flag
= (font
->antialiased
? WFAntialiased
: WFNotAntialiased
);
991 return WMCreateFontWithFlags(scr
, fname
, flag
);
996 WMUnemphasizeFont(WMScreen
*scr
, WMFont
*font
)
1004 snprintf(fname
, 255, "%s", font
->name
);
1005 changeFontProp(fname
, "r", 3);
1006 flag
= (font
->antialiased
? WFAntialiased
: WFNotAntialiased
);
1007 return WMCreateFontWithFlags(scr
, fname
, flag
);