Re: Font size



Charles Hopkins wrote:

> How can I change the size if the font used in TkEmc?
> 
> The main window is very hard to read.  I could get a bigger monitor, but
> there must be a font call somewhere.

The fonts are specified as X resources. The EMC install script does this
at some point:

  cp emc/XEmc emc/YEmc emc/TkEmc /usr/X11/lib/X11/app-defaults

which copies these X resource files to the site-wide spot,
/usr/X11/lib/X11/app-defaults/. "XEmc" applies to the xemc, "YEmc" to
the yemc (6-axis version of xemc, for the Stewart Platform thingy we
built), and "TkEmc" to the tkemc.tcl script that replaces those old X
Toolkit ones.

Since emc/TkEmc is copied into /usr/X11/lib/X11/app-defaults, you'll
need to edit that one for changes to have any effect. I myself have the
environment variable XAPPLRESDIR set so that X picks up resource files
in the current directory, e.g.,

(csh)
setenv XAPPLRESDIR ./

or

(bash)
export XAPPLRESDIR="./"

but this is part of my local environment only.

TkEmc looks like this:

---start---
! Set the colors for the main screen
*top*background: blue
*top*foreground: white
*top*highlightColor: white
*top*highlightBackground: blue

! Default font is "variable", aka 12-point Helvetica bold.
! For 640x480 displays, use 10 point font.
! See /usr/X11/lib/X11/fonts/misc/fonts.alias for others.
! *top*font: -*-helvetica-bold-r-normal-*-10-*-*-*-*-*-*-*

! Set the font size specifically for the position digits. Do this after
! setting the global font *top*font, or that will override this.
! For 640x480 displays, use 24 point font, e.g.,
! *top*position*font: -*-courier-bold-r-normal-*-24-*-*-*-*-*-*-*
*top*position*font: -*-courier-bold-r-normal-*-56-*-*-*-*-*-*-*

! set background/foreground for labels that are clickable
! tool offset
*top*settings*tooloffsetsetting*background: gray
*top*settings*tooloffsetsetting*foreground: black
! jog speed
*top*controls*oride*top*value*background: gray
*top*controls*oride*top*value*foreground: black
! feed override
*top*controls*feed*top*value*background: gray
*top*controls*feed*top*value*foreground: black
---end---

The syntax is *widget*resource (or you can use . instead of * for exact
matches), where "widget" is one of the names I gave the labels, etc. in
tkemc.tcl (e.g., "top*position" for the "position" subwidget of the
"top" widget), and "resource" is one of the predefined resources for the
various widgets. This is fully described in Tcl/Tk books, and it takes
quite of bit of explanation.

My advice: use TkEmc as the start, and fiddle with these. For your font
problem, edit *top*position*font for the big numbers. For other numbers,
look in the tkemc.tcl script for the widget that puts up what you want,
using the rare comments in combination with the hints you get from
widget names, and modify the "font" resource for these.

You can override all fonts with something like this:

*font: -*-courier-bold-r-normal-*-56-*-*-*-*-*-*-*

I didn't try this but I have done this before and it works, but is a
one-size-fits all approach.

Font names can be shortened using the names in
/usr/X11/lib/X11/fonts/misc/fonts.alias. You can potter about in the
/usr/X11/lib/X11/fonts directory and see what's available, or use one of
the font viewing tools that comes with Gnome or the KDE.

There is undoubtedly a way to change fonts within an application.
Picture a "Fonts" menu in the tkemc, where you can select font sizes for
various types of widgets: position digits, program window, labels.
Adventuresome Tcl/Tk programmers can start with the widget demo in
/usr/lib/tk8.0/demos/widget and see if anything's there.

--Fred



Date Index | Thread Index | Back to archive index | Back to Mailing List Page

Problems or questions? Contact