Re: font selection, particularly for the Identify and About windows
"Greg A. Woods" <[email protected]> Wed, 06 Nov 2024 04:57:55 -0800
| Newsgroups | gmane.comp.window-managers.ctwm |
|---|---|
| Organization | Planix, Inc. |
| Message-ID | <[email protected]> |
--pgp-sign-Multipart_Wed_Nov__6_04:57:45_2024-1
Content-Type: text/plain; charset=US-ASCII
Oops, I forgot to fix the ultimate culprit that would still cause
problems. Here's the new diff for util.c. It wildcards the family name
and drops back to iso8859-1, so it'll match the first scalable monospace
font in the most basic usable encoding, and if a system doesn't have one
of those then you really can't make anything work anyway, so sayonara,
goodbye, adieu. There's no point to adding a full wildcard at the end
-- that'll just create an unreadable result that'll probably be bold and
italic looking like tiny pin-pricks on any modern hi-res display so it
still won't really work. Just don't ever wildcard a FontSet! (Also
don't wild-card the weight and don't expect "bold" either!)
diff --git a/util.c b/util.c
index 3cc91503..b9e35f73 100644
--- a/util.c
+++ b/util.c
@@ -313,7 +313,7 @@ UpdateFont(MyFont *font, int height)
static void
GetFont(MyFont *font)
{
- char *deffontname = "fixed,*";
+ const char *deffontname = "-*-*-medium-r-normal--0-100-%d-%d-m-*-iso8859-1";
char **missing_charset_list_return;
int missing_charset_count_return;
char *def_string_return;
@@ -338,15 +338,20 @@ GetFont(MyFont *font)
XFreeFontSet(dpy, font->font_set);
}
- asprintf(&basename2, "%s,*", font->basename);
+ /* xxx eliminate the VERY bad ",*" hack but keep the asprintf() for now */
+ asprintf(&basename2, "%s", font->basename);
if((font->font_set = XCreateFontSet(dpy, basename2,
&missing_charset_list_return,
&missing_charset_count_return,
&def_string_return)) == NULL) {
- fprintf(stderr, "Failed to get fontset %s\n", basename2);
+ fprintf(stderr, "Failed to get fontset \"%s\"\n", basename2);
+ free(basename2);
if(Scr->DefaultFont.basename) {
- deffontname = Scr->DefaultFont.basename;
+ asprintf(&basename2, "%s", Scr->DefaultFont.basename);
+ } else {
+ asprintf(&basename2, deffontname, Scr->xres, Scr->yres);
}
+ fprintf(stderr, "trying default fontset \"%s\"\n", basename2);
if((font->font_set = XCreateFontSet(dpy, deffontname,
&missing_charset_list_return,
&missing_charset_count_return,
@@ -356,7 +361,16 @@ GetFont(MyFont *font)
exit(1);
}
}
- free(basename2);
+ if (missing_charset_count_return) {
+ fprintf(stderr, "%d charsets are missing from fontset \"%s\"\n",
+ missing_charset_count_return, basename2);
+ for (i = 0; i < missing_charset_count_return; i++) {
+ fprintf(stderr, "font for charset %s is lacking.\n",
+ missing_charset_list_return[i]);
+ }
+ XFreeStringList(missing_charset_list_return);
+ }
+
font_extents = XExtentsOfFontSet(font->font_set);
fnum = XFontsOfFontSet(font->font_set, &xfonts, &font_names);
@@ -373,6 +387,12 @@ GetFont(MyFont *font)
font->avg_height = 0;
font->avg_fheight = 0.0;
font->avg_count = 0;
+ if(CLarg.PrintErrorMessages) { /* xxx overload, but kinda like old twm */
+ fprintf(stderr, "created fontset with %d fonts (%d missing) for \"%s\"\n",
+ fnum, missing_charset_count_return,
+ basename2);
+ }
+ free(basename2);
}
--
Greg A. Woods <[email protected]>
Kelowna, BC +1 250 762-7675 RoboHack <[email protected]>
Planix, Inc. <[email protected]> Avoncote Farms <[email protected]>
--pgp-sign-Multipart_Wed_Nov__6_04:57:45_2024-1
Content-Type: application/pgp-signature
Content-Transfer-Encoding: 7bit
Content-Description: OpenPGP Digital Signature
-----BEGIN PGP SIGNATURE-----
iF0EABECAB0WIQRuK6dmwVAucmRxuh9mfXG3eL/0fwUCZytnzAAKCRBmfXG3eL/0
f3UDAJ9h9tbJ1nN4m9oLF4bqa1rper8cYwCfV20cYUJRg3ZIP12ymbqf6MWZW3A=
=w3wt
-----END PGP SIGNATURE-----
--pgp-sign-Multipart_Wed_Nov__6_04:57:45_2024-1--