9fans - fans of the OS Plan 9 from Bell Labs
 help / color / mirror / Atom feed
* [9fans] stats font problem fixed
@ 2009-05-12  9:08 prem
  2009-05-12 12:44 ` erik quanstrom
  0 siblings, 1 reply; 2+ messages in thread
From: prem @ 2009-05-12  9:08 UTC (permalink / raw)
  To: 9fans

Hi,
I use ttf2subf'ed fonts on my lcd, only program that doesn't obay the
current rio font settings is stats. I have added the code below which
not only obeys the current rio settings but also addes support for
specifying new font with -F switch.


--- ../../../../../sys/src/cmd/stats.c  2008-07-01 17:13:36.000000000
+0530
+++ stats.c     2009-05-12 12:03:39.000000000 +0530
@@ -197,7 +197,7 @@
 int    ylabels = 0;
 int    oldsystem = 0;
 int    sleeptime = 1000;
-
+char   *fontname=nil;
 char   *procnames[NPROC] = {"main", "mouse"};

 void
@@ -258,9 +258,12 @@
 void
 colinit(void)
 {
-       mediumfont = openfont(display, "/lib/font/bit/pelm/
latin1.8.font");
-       if(mediumfont == nil)
+       if(fontname != nil)
+               mediumfont=openfont(display, fontname);
+       else if (font)
                mediumfont = font;
+       else
+               mediumfont = openfont(display, "/lib/font/bit/pelm/
latin1.8.font");

        /* Peach */
        mkcol(0, 0xFFAAAAFF, 0xFFAAAAFF, 0xBB5D5DFF);
@@ -1265,6 +1268,9 @@

        nargs = 0;
        ARGBEGIN{
+       case 'F':
+               fontname = EARGF(usage());
+               break;
        case 'T':
                secs = atof(EARGF(usage()));
                if(secs > 0)

===============
Thanks
/Prem



^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [9fans] stats font problem fixed
  2009-05-12  9:08 [9fans] stats font problem fixed prem
@ 2009-05-12 12:44 ` erik quanstrom
  0 siblings, 0 replies; 2+ messages in thread
From: erik quanstrom @ 2009-05-12 12:44 UTC (permalink / raw)
  To: 9fans

; grep openfont `{find . | grep '\.[ch]$'} | grep "
> Hi,
> I use ttf2subf'ed fonts on my lcd, only program that doesn't obay the
> current rio font settings is stats. I have added the code below which
> not only obeys the current rio settings but also addes support for
> specifying new font with -F switch.

this looks interesting.  but stats isn't the only program
that picks its own fonts.  some programs like faces and
abaco would suffer if one substituted the users' font.
(abaco does uses a fixed set of fonts.)

; cd /sys/src/cmd; grep openfont `{find . | grep '\.[ch]$'} | grep "
./auth/factotum/fgui.c:	invis = openfont(display, "/lib/font/bit/lucm/passwd.9.font");
./bitsy/keyboard.c:	keyfont = openfont(display, "/lib/font/bit/lucidasans/boldlatin1.6.font");
./bitsy/keyboard.c:	keyctlfont = openfont(display, "/lib/font/bit/lucidasans/unicode.6.font");
./bitsy/prompter.c:	f = openfont(display, "/lib/font/bit/lucidasans/boldlatin1.6.font");
./bitsy/prompter.c:	f = openfont(display, "/lib/font/bit/lucidasans/unicode.6.font");
./faces/main.c:	tinyfont = openfont(display, "/lib/font/bit/misc/ascii.5x7.font");
./faces/main.c:	mediumfont = openfont(display, "/lib/font/bit/pelm/latin1.8.font");
./ip/gping.c:	mediumfont = openfont(display, "/lib/font/bit/pelm/latin1.8.font");
./stats.c:	mediumfont = openfont(display, "/lib/font/bit/pelm/latin1.8.font");
./trace.c:	mediumfont = openfont(display, "/lib/font/bit/lucidasans/unicode.10.font");
./trace.c:	tinyfont = openfont(display, "/lib/font/bit/lucidasans/unicode.7.font");
./abaco/main.c:		error("openfont");

- erik



^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2009-05-12 12:44 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-05-12  9:08 [9fans] stats font problem fixed prem
2009-05-12 12:44 ` erik quanstrom

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).