[GRASS-dev] 6.3.0 release - need to set default font

Glynn Clements glynn at gclements.plus.com
Mon Nov 26 05:18:22 EST 2007


Michael Barton wrote:

> >> Currently, the only way to default to a nice font in all GRASS sessions is
> >> to edit the .profile file--manually of course and from outside GRASS.
> >> GRASS_FONT doesn't even register if put into the .grass.bash file.
> > 
> > Typo? Or are you actually editing the wrong file?
> 
> Nope. I was quite surprised when it had no effects. So I tried it a couple
> of times--comparing effects between .profile and .grass.bashrc with exactly
> the same syntax and checking in the manual to make sure it was the right
> file. Works with .profile and doesn't with .grass.bashrc

It works for me. Do the lines appear in the .bashrc file in the mapset
directory?

> In any case, the user still has to manually edit this file, which is
> difficult in a non-Linux environment.
> 
> Most text editors on the Mac do not see files that begin with a "." and they
> do not show up in the finder. (I think this degree of "protecting" a user is
> silly, but that's the way it is).

Using a different filename is easy enough, if that is considered
desirable.

But ultimately, none of this is specific to the default font. There
are a large number of GRASS_* environment variables which reflect user
preferences, and the same issues apply to all of them.

> Also, is this even a possibility with the native Windows GRASS?

The native version uses batch files rather than shell scripts. 
grass63.bat and init.bat don't read any additional files, although
grass63.bat has a number of comments suggesting possible variable
settings. The Explorer context menu for .bat files includes an "Edit"
option which will open the file in Notepad.

Having a per-user batch file would be preferable, and probably not
hard to implement.

> >> IMHO, it
> >> would be good to set this GRASS behavior preference from inside GRASS, using
> >> GRASS tools. It would certainly be more accessible to a wider group of GRASS
> >> users in this way.
> > 
> > $GISRC isn't for user preferences, it's for session state.
> 
> Specifying a directory to serve as GISDBASE? Specifying GUI preference? I
> suppose it's a matter of opinion, but I see selecting the default font as
> being similar.

GRASS_GUI is an exception, but the rest are session state.

Preferences don't normally change from one session to the next. Once
you've chosen an HTML browser or a text pager or a default font,
you're likely to stick with it.

$GISRC is for things which typically change between sessions or even
within a session, but not from one command to the next. It exists so
that you don't have to specify gisdbase=/location=/mapset= options for
every command (as well as monitor= for every d.* command).

The notion of a persistent current font is specific to the monitor
mechanism. If it is to remain in 7.x, the current font (and encoding)
would need to be a GRASS variable, as there won't be any persistent
monitors to retain this information internally.

It's debatable whether it should remain in 7.x. It doesn't fit with
the GUI, where layers are rendered independently and in arbitrary
order. Also, any commands which set the font for themselves (e.g. 
d.text) have the side-effect of setting it for subsequent commands.

Most of this is just an implementation artifact. For the same reason,
if a module sets the text rotation (and doesn't explicitly revert it),
any subsequent text will be rotated.

-- 
Glynn Clements <glynn at gclements.plus.com>


More information about the grass-dev mailing list