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

I’m pretty sure that this was discussed briefly, but cannot find it in the dev archives.

Sometime recently (past couple months), I’ve ended up without any default font for GRASS in versions I compile, and have to set a font before I have any text with barscales, legends, and the like.

The new TrueType font capabilities are great and much nicer than the old default stroke fonts, but we should have something set as a default font when GRASS starts up. This is a problem on Mac and Windows builds but may not be showing up on Linux builds.

I can build something into the GUI’s to set a default font on startup. But it seems that this should be done in init.sh so as not to depend on the GUI and, IMHO, would be even better as a GRASS variable that lives in .grassrc6–so that whatever is set as a default font during a user session stays there into future sessions.

In any case, we need something so that people don’t fire up GRASS and wonder why legends have no text.

Michael


Michael Barton, Professor of Anthropology
Director of Graduate Studies
School of Human Evolution & Social Change
Center for Social Dynamics & Complexity
Arizona State University

phone: 480-965-6213
fax: 480-965-7671
www: http://www.public.asu.edu/~cmbarton

On Sat, 24 Nov 2007, Michael Barton wrote:

I'm pretty sure that this was discussed briefly, but cannot find it in the
dev archives.

Sometime recently (past couple months), I've ended up without any default
font for GRASS in versions I compile, and have to set a font before I have
any text with barscales, legends, and the like.

The new TrueType font capabilities are great and much nicer than the old
default stroke fonts, but we should have *something* set as a default font
when GRASS starts up. This is a problem on Mac and Windows builds but may
not be showing up on Linux builds.

Does the problem go away if the fontcap file is regenerated:
g.mkfontcap -o
?
If so, this would be an issue with the install procedure not generating the fontcap file to match the local system and the installation location of GRASS. But I think there is more to it than that. I seem to remember someone said was the problem was *not* that romans wasn't being set as the default, but that there wasn't a properly matching entry for it in the fontcap file. What does
d.font -L | grep romans
say?

In general for actually using the fonts, if the path to the stroke fonts given in fontcap is wrong, it doesn't matter, as the library code currently ignores it and reconstructs the path based on the current GISBASE. However, the code that scans the fontcap checks the path given for each font there to see if it exists, and skips it if not, so I suspect that might be where the problem is. If so, re-running g.mkfontcap to generate the proper paths should fix it. As should the following patch (untested) but that is a bit of a hack and I would prefer the issue to be resolved by making sure the fontcap is current.

Paul

Index: lib/driver/parse_ftcap.c

RCS file: /grassrepository/grass6/lib/driver/parse_ftcap.c,v
retrieving revision 1.5
diff -u -r1.5 parse_ftcap.c
--- lib/driver/parse_ftcap.c 11 May 2007 14:22:07 -0000 1.5
+++ lib/driver/parse_ftcap.c 25 Nov 2007 11:47:21 -0000
@@ -56,7 +56,9 @@
                                   != 6)
                                 continue;

- if (!font_exists(path))
+ /* Don't check the path for stroke fonts as we reconstruct it
+ * from $GISBASE and don't need it to be correct here */
+ if (type != GFONT_STROKE && !font_exists(path))
                                 continue;

                         fonts = (struct GFONT_CAP *)G_realloc(fonts,

Paul,

You've ID'ed the proximate cause of the problem. See below.

On 11/25/07 4:47 AM, "Paul Kelly" <paul-grass@stjohnspoint.co.uk> wrote:

On Sat, 24 Nov 2007, Michael Barton wrote:

I'm pretty sure that this was discussed briefly, but cannot find it in the
dev archives.

Sometime recently (past couple months), I've ended up without any default
font for GRASS in versions I compile, and have to set a font before I have
any text with barscales, legends, and the like.

The new TrueType font capabilities are great and much nicer than the old
default stroke fonts, but we should have *something* set as a default font
when GRASS starts up. This is a problem on Mac and Windows builds but may
not be showing up on Linux builds.

Does the problem go away if the fontcap file is regenerated:
g.mkfontcap -o
?

Yes

If so, this would be an issue with the install procedure not generating
the fontcap file to match the local system and the installation location
of GRASS. But I think there is more to it than that. I seem to remember
someone said was the problem was *not* that romans wasn't being set as the
default, but that there wasn't a properly matching entry for it in the
fontcap file. What does
d.font -L | grep romans
say?

Prior to re-running g.mkfontcap, it comes up blank.

In general for actually using the fonts, if the path to the stroke fonts
given in fontcap is wrong, it doesn't matter, as the library code
currently ignores it and reconstructs the path based on the current
GISBASE. However, the code that scans the fontcap checks the path given
for each font there to see if it exists, and skips it if not, so I suspect
that might be where the problem is. If so, re-running g.mkfontcap to
generate the proper paths should fix it. As should the following patch
(untested) but that is a bit of a hack and I would prefer the issue to be
resolved by making sure the fontcap is current.

What is the best way to do this?

Also, where is the GRASS default font set to Romans?

Now that we have a system-wide fontcap, that normally would include nice
TrueType fonts, wouldn't it be better to first try to default to a TrueType
font and drop back to Romans only if that font couldn't be found?

e.g., whatever sets the default font first looks to see if a GRASS_FONT
variable is set in .grassrc6. If not, it scans fontcap for Helvetica, Vera
sans, Ariel, or some such nice san-serif TrueType font. If a font on a
restricted list of likely fonts is not found, it then defaults to the Romans
stroke font.

Michael

Paul

Index: lib/driver/parse_ftcap.c

RCS file: /grassrepository/grass6/lib/driver/parse_ftcap.c,v
retrieving revision 1.5
diff -u -r1.5 parse_ftcap.c
--- lib/driver/parse_ftcap.c 11 May 2007 14:22:07 -0000 1.5
+++ lib/driver/parse_ftcap.c 25 Nov 2007 11:47:21 -0000
@@ -56,7 +56,9 @@
                                   != 6)
                                 continue;

- if (!font_exists(path))
+ /* Don't check the path for stroke fonts as we
reconstruct it
+ * from $GISBASE and don't need it to be correct here
*/
+ if (type != GFONT_STROKE && !font_exists(path))
                                 continue;

                         fonts = (struct GFONT_CAP *)G_realloc(fonts,

__________________________________________
Michael Barton, Professor of Anthropology
Director of Graduate Studies
School of Human Evolution & Social Change
Center for Social Dynamics & Complexity
Arizona State University

phone: 480-965-6213
fax: 480-965-7671
www: http://www.public.asu.edu/~cmbarton

Michael Barton wrote:

I'm pretty sure that this was discussed briefly, but cannot find it in the
dev archives.

Sometime recently (past couple months), I've ended up without any default
font for GRASS in versions I compile, and have to set a font before I have
any text with barscales, legends, and the like.

The new TrueType font capabilities are great and much nicer than the old
default stroke fonts, but we should have *something* set as a default font
when GRASS starts up. This is a problem on Mac and Windows builds but may
not be showing up on Linux builds.

I can build something into the GUI's to set a default font on startup. But
it seems that this should be done in init.sh so as not to depend on the GUI
and, IMHO, would be even better as a GRASS variable that lives in
.grassrc6--so that whatever is set as a default font during a user session
stays there into future sessions.

In any case, we need something so that people don't fire up GRASS and wonder
why legends have no text.

mon.select calls R_font(), with the font take from $GRASS_FONT, or
"romans" if undefined.

LOC_init() (the initialisation function for immediate rendering) does
likewise.

I've fixed the case where a named font cannot be found in the fontcap
file (it sets the font to "romans" without using the fontcap file).

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

Michael Barton wrote:

Also, where is the GRASS default font set to Romans?

mon.select (display/d.mon/pgms/select.c) and LOC_init()
(lib/raster/loc_io.c).

Now that we have a system-wide fontcap, that normally would include nice
TrueType fonts, wouldn't it be better to first try to default to a TrueType
font and drop back to Romans only if that font couldn't be found?

e.g., whatever sets the default font first looks to see if a GRASS_FONT
variable is set in .grassrc6. If not, it scans fontcap for Helvetica, Vera
sans, Ariel, or some such nice san-serif TrueType font. If a font on a
restricted list of likely fonts is not found, it then defaults to the Romans
stroke font.

This doesn't belong in the libraries.

The only reason why there *is* a default font is so that there is
(hopefully) always a current font.

The default is a stroke font because both the stroke fonts and the
code which uses them should always be present. A system may not have
any TrueType fonts and GRASS may have been built without FreeType
support.

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

On 11/25/07 12:13 PM, "Glynn Clements" <glynn@gclements.plus.com> wrote:

Michael Barton wrote:

I'm pretty sure that this was discussed briefly, but cannot find it in the
dev archives.

Sometime recently (past couple months), I've ended up without any default
font for GRASS in versions I compile, and have to set a font before I have
any text with barscales, legends, and the like.

The new TrueType font capabilities are great and much nicer than the old
default stroke fonts, but we should have *something* set as a default font
when GRASS starts up. This is a problem on Mac and Windows builds but may
not be showing up on Linux builds.

I can build something into the GUI's to set a default font on startup. But
it seems that this should be done in init.sh so as not to depend on the GUI
and, IMHO, would be even better as a GRASS variable that lives in
.grassrc6--so that whatever is set as a default font during a user session
stays there into future sessions.

In any case, we need something so that people don't fire up GRASS and wonder
why legends have no text.

mon.select calls R_font(), with the font take from $GRASS_FONT, or
"romans" if undefined.

LOC_init() (the initialisation function for immediate rendering) does
likewise.

I've fixed the case where a named font cannot be found in the fontcap
file (it sets the font to "romans" without using the fontcap file).

Thanks Glynn. This solves the immediate problem neatly.

What about making GRASS_FONT a GRASS variable rather than a shell variable?
I assume that it then could be set by g.gisenv (ending up in .grassrc6) and
consequently would then persist across working sessions.

Michael

__________________________________________
Michael Barton, Professor of Anthropology
Director of Graduate Studies
School of Human Evolution & Social Change
Center for Social Dynamics & Complexity
Arizona State University

phone: 480-965-6213
fax: 480-965-7671
www: http://www.public.asu.edu/~cmbarton

On 11/25/07 12:20 PM, "Glynn Clements" <glynn@gclements.plus.com> wrote:

Michael Barton wrote:

Also, where is the GRASS default font set to Romans?

mon.select (display/d.mon/pgms/select.c) and LOC_init()
(lib/raster/loc_io.c).

Now that we have a system-wide fontcap, that normally would include nice
TrueType fonts, wouldn't it be better to first try to default to a TrueType
font and drop back to Romans only if that font couldn't be found?

e.g., whatever sets the default font first looks to see if a GRASS_FONT
variable is set in .grassrc6. If not, it scans fontcap for Helvetica, Vera
sans, Ariel, or some such nice san-serif TrueType font. If a font on a
restricted list of likely fonts is not found, it then defaults to the Romans
stroke font.

This doesn't belong in the libraries.

The only reason why there *is* a default font is so that there is
(hopefully) always a current font.

The default is a stroke font because both the stroke fonts and the
code which uses them should always be present. A system may not have
any TrueType fonts and GRASS may have been built without FreeType
support.

Granted.

But, it would make GRASS output nicer if there was a way to scan for
FreeType support and search for a TrueType font to use before defaulting to
a stroke font.

If this is not feasible, making GRASS_FONT a GRASS variable instead of a
system variable would at least let a user set a nice font once, without
having to do it every time GRASS opens.

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. 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.

Michael

__________________________________________
Michael Barton, Professor of Anthropology
Director of Graduate Studies
School of Human Evolution & Social Change
Center for Social Dynamics & Complexity
Arizona State University

phone: 480-965-6213
fax: 480-965-7671
www: http://www.public.asu.edu/~cmbarton

Michael Barton wrote:

>> Also, where is the GRASS default font set to Romans?
>
> mon.select (display/d.mon/pgms/select.c) and LOC_init()
> (lib/raster/loc_io.c).
>
>> Now that we have a system-wide fontcap, that normally would include nice
>> TrueType fonts, wouldn't it be better to first try to default to a TrueType
>> font and drop back to Romans only if that font couldn't be found?
>>
>> e.g., whatever sets the default font first looks to see if a GRASS_FONT
>> variable is set in .grassrc6. If not, it scans fontcap for Helvetica, Vera
>> sans, Ariel, or some such nice san-serif TrueType font. If a font on a
>> restricted list of likely fonts is not found, it then defaults to the Romans
>> stroke font.
>
> This doesn't belong in the libraries.
>
> The only reason why there *is* a default font is so that there is
> (hopefully) always a current font.
>
> The default is a stroke font because both the stroke fonts and the
> code which uses them should always be present. A system may not have
> any TrueType fonts and GRASS may have been built without FreeType
> support.

Granted.

But, it would make GRASS output nicer if there was a way to scan for
FreeType support and search for a TrueType font to use before defaulting to
a stroke font.

Automatically choosing a font is neither necessary nor desirable. This
is up to the user.

If this is not feasible, making GRASS_FONT a GRASS variable instead of a
system variable would at least let a user set a nice font once, without
having to do it every time GRASS opens.

They can set it in ~/.grass.bashrc.

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?

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.

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

Michael Barton wrote:

What about making GRASS_FONT a GRASS variable rather than a shell variable?
I assume that it then could be set by g.gisenv (ending up in .grassrc6) and
consequently would then persist across working sessions.

It should go into the user's environment, via ~/.grass.bashrc or one
of the standard shell initialisation scripts, like any other user
preference.

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

Michael Barton wrote:
> What about making GRASS_FONT a GRASS variable rather than a shell variable?
> I assume that it then could be set by g.gisenv (ending up in .grassrc6) and
> consequently would then persist across working sessions.

Glynn Clements wrote:

It should go into the user's environment, via ~/.grass.bashrc or one
of the standard shell initialisation scripts, like any other user
preference.

my guess here is that Michael is not seeing the GRASS_FONT set in .grass.bashrc
as he is working in a GIS.m lauched by init.sh *before* the grass terminal
session (and thus .grass.bashrc) is run. If gis.m is run from the grass
terminal prompt it should see it.

If that is the case a previously mooted solution is to have a ~/.grassrc file
which is sourced earlier in the game, before GUI subprocesses are spawned.

If we do add that, an idea of what a possible GRASS 7 ~/.grass/ dir might
contain could help reduce migration issues later.

Hamish

      ____________________________________________________________________________________
Be a better sports nut! Let your teams follow you
with Yahoo Mobile. Try it now. http://mobile.yahoo.com/sports;_ylt=At9_qDKvtAbMuh1G1SQtBI7ntAcJ

On 11/25/07 2:43 PM, "Glynn Clements" <glynn@gclements.plus.com> wrote:

Michael Barton wrote:

Also, where is the GRASS default font set to Romans?

mon.select (display/d.mon/pgms/select.c) and LOC_init()
(lib/raster/loc_io.c).

Now that we have a system-wide fontcap, that normally would include nice
TrueType fonts, wouldn't it be better to first try to default to a TrueType
font and drop back to Romans only if that font couldn't be found?

e.g., whatever sets the default font first looks to see if a GRASS_FONT
variable is set in .grassrc6. If not, it scans fontcap for Helvetica, Vera
sans, Ariel, or some such nice san-serif TrueType font. If a font on a
restricted list of likely fonts is not found, it then defaults to the
Romans
stroke font.

This doesn't belong in the libraries.

The only reason why there *is* a default font is so that there is
(hopefully) always a current font.

The default is a stroke font because both the stroke fonts and the
code which uses them should always be present. A system may not have
any TrueType fonts and GRASS may have been built without FreeType
support.

Granted.

But, it would make GRASS output nicer if there was a way to scan for
FreeType support and search for a TrueType font to use before defaulting to
a stroke font.

Automatically choosing a font is neither necessary nor desirable. This
is up to the user.

If this is not feasible, making GRASS_FONT a GRASS variable instead of a
system variable would at least let a user set a nice font once, without
having to do it every time GRASS opens.

They can set it in ~/.grass.bashrc.

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

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).

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

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.

Michael

__________________________________________
Michael Barton, Professor of Anthropology
Director of Graduate Studies
School of Human Evolution & Social Change
Center for Social Dynamics & Complexity
Arizona State University

phone: 480-965-6213
fax: 480-965-7671
www: http://www.public.asu.edu/~cmbarton

On 11/25/07 3:42 PM, "Hamish" <hamish_nospam@yahoo.com> wrote:

Michael Barton wrote:

What about making GRASS_FONT a GRASS variable rather than a shell variable?
I assume that it then could be set by g.gisenv (ending up in .grassrc6) and
consequently would then persist across working sessions.

Glynn Clements wrote:

It should go into the user's environment, via ~/.grass.bashrc or one
of the standard shell initialisation scripts, like any other user
preference.

my guess here is that Michael is not seeing the GRASS_FONT set in
.grass.bashrc
as he is working in a GIS.m lauched by init.sh *before* the grass terminal
session (and thus .grass.bashrc) is run. If gis.m is run from the grass
terminal prompt it should see it.

This seems to be the case (running TclTk or wxPython). If I quit the GUI and
then restart it from the terminal, I can see the results of setting
GRASS_FONT in .grass.bashrc.

Michael

If that is the case a previously mooted solution is to have a ~/.grassrc file
which is sourced earlier in the game, before GUI subprocesses are spawned.

If we do add that, an idea of what a possible GRASS 7 ~/.grass/ dir might
contain could help reduce migration issues later.

Hamish

______________________________________________________________________________
______
Be a better sports nut! Let your teams follow you
with Yahoo Mobile. Try it now.
Download Yahoo Sports App | Yahoo Mobile

__________________________________________
Michael Barton, Professor of Anthropology
Director of Graduate Studies
School of Human Evolution & Social Change
Center for Social Dynamics & Complexity
Arizona State University

phone: 480-965-6213
fax: 480-965-7671
www: http://www.public.asu.edu/~cmbarton

Michael Barton wrote:

In any case, the user still has to manually edit this file, which is
difficult in a non-Linux environment.

if you can find a command prompt on mac/linux and you use Bash:
  echo "export GRASS_FONT=Vera" >> ~/.grass.bashrc

I'm not sure what the windows version would look like, something like:
  echo "set GRASS_FONT=Vera" >> %HOME%\.grass.dosrc

(then .grass.dosrc would need to be sourced by init.bat)

Hamish

      ____________________________________________________________________________________
Never miss a thing. Make Yahoo your home page.
http://www.yahoo.com/r/hs

On 11/25/07 7:33 PM, "Hamish" <hamish_nospam@yahoo.com> wrote:

Michael Barton wrote:

In any case, the user still has to manually edit this file, which is
difficult in a non-Linux environment.

if you can find a command prompt on mac/linux and you use Bash:
  echo "export GRASS_FONT=Vera" >> ~/.grass.bashrc

If someone knows enough to open a terminal and do something from the command
prompt, they can also use pico. But most Mac users are not really 'terminal
people'.

I'm not sure what the windows version would look like, something like:
  echo "set GRASS_FONT=Vera" >> %HOME%\.grass.dosrc

(then .grass.dosrc would need to be sourced by init.bat)

Ditto for most Windows users

Michael

Hamish

______________________________________________________________________________
______
Never miss a thing. Make Yahoo your home page.
http://www.yahoo.com/r/hs

__________________________________________
Michael Barton, Professor of Anthropology
Director of Graduate Studies
School of Human Evolution & Social Change
Center for Social Dynamics & Complexity
Arizona State University

phone: 480-965-6213
fax: 480-965-7671
www: http://www.public.asu.edu/~cmbarton

On 25/11/07 12:47, Paul Kelly wrote:

On Sat, 24 Nov 2007, Michael Barton wrote:

I'm pretty sure that this was discussed briefly, but cannot find it in the
dev archives.

Sometime recently (past couple months), I've ended up without any default
font for GRASS in versions I compile, and have to set a font before I have
any text with barscales, legends, and the like.

The new TrueType font capabilities are great and much nicer than the old
default stroke fonts, but we should have *something* set as a default font
when GRASS starts up. This is a problem on Mac and Windows builds but may
not be showing up on Linux builds.

Does the problem go away if the fontcap file is regenerated:
g.mkfontcap -o
?
If so, this would be an issue with the install procedure not generating the fontcap file to match the local system and the installation location of GRASS.

This problem was already identified for windows as well:

http://lists.osgeo.org/pipermail/grass-dev/2007-October/033784.html

I was planning on implementing the fix Glynn suggests at the end of the thread, but if this problem shows up on other systems, then maybe we need a more universal solution ?

Moritz

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@gclements.plus.com>

Michael Barton wrote:

>> In any case, the user still has to manually edit this file, which is
>> difficult in a non-Linux environment.
>
> if you can find a command prompt on mac/linux and you use Bash:
> echo "export GRASS_FONT=Vera" >> ~/.grass.bashrc

If someone knows enough to open a terminal and do something from the command
prompt, they can also use pico. But most Mac users are not really 'terminal
people'.

They'll need to change that outlook to make significant use of GRASS.
The GUI will only get you so far; e.g. how are you going to get the
equivalent of:

  r.foo in=`g.mlist ...` ...
or:
  for map in ... ; do ...

in the GUI?

As a general principle, GRASS commands don't replicate functionality
which is already provided (usually far better) by the shell.

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

Hamish wrote:

> Michael Barton wrote:
> > What about making GRASS_FONT a GRASS variable rather than a shell variable?
> > I assume that it then could be set by g.gisenv (ending up in .grassrc6) and
> > consequently would then persist across working sessions.

Glynn Clements wrote:
> It should go into the user's environment, via ~/.grass.bashrc or one
> of the standard shell initialisation scripts, like any other user
> preference.

my guess here is that Michael is not seeing the GRASS_FONT set in .grass.bashrc
as he is working in a GIS.m lauched by init.sh *before* the grass terminal
session (and thus .grass.bashrc) is run. If gis.m is run from the grass
terminal prompt it should see it.

That makes sense.

If that is the case a previously mooted solution is to have a ~/.grassrc file
which is sourced earlier in the game, before GUI subprocesses are spawned.

Agreed. Also, such a file only needs to be implemented for Bourne
shell (we don't need csh/zsh versions), as it would be sourced
directly by Init.sh rather than by the spawned shell.

Beyond that, the GUI should be handling fonts itself, both the default
font and command-specific fonts (you can't use d.font for GUI layers).
Similarly for other preferences (e.g. GRASS_PAGER=less may be
appropriate for a shell, but not for commands run from the GUI).

If we do add that, an idea of what a possible GRASS 7 ~/.grass/ dir might
contain could help reduce migration issues later.

A straightforward grassrc file should suffice for all preferences.
grass.bashrc (and grass.cshrc etc) should be reserved for commands
which have to be sourced by the interactive shell. We should really
rename the grassrc6 file; it isn't an "rc" (run commands) file.
grass.save would be more appropriate.

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

Michael Barton wrote:

>>> What about making GRASS_FONT a GRASS variable rather than a shell variable?
>>> I assume that it then could be set by g.gisenv (ending up in .grassrc6) and
>>> consequently would then persist across working sessions.
>
> Glynn Clements wrote:
>> It should go into the user's environment, via ~/.grass.bashrc or one
>> of the standard shell initialisation scripts, like any other user
>> preference.
>
>
> my guess here is that Michael is not seeing the GRASS_FONT set in
> .grass.bashrc
> as he is working in a GIS.m lauched by init.sh *before* the grass terminal
> session (and thus .grass.bashrc) is run. If gis.m is run from the grass
> terminal prompt it should see it.

This seems to be the case (running TclTk or wxPython). If I quit the GUI and
then restart it from the terminal, I can see the results of setting
GRASS_FONT in .grass.bashrc.

Right. ~/.grass.bashrc (and ~/.grass.cshrc) are sourced by the
interactive shell (which is why we have separate bash/csh versions).

Environment settings can go into the "normal" environment
(~/.bash_profile etc). This also makes it easier to run GRASS commands
from outside of a "session".

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

> Glynn Clements wrote:
We should really rename the grassrc6 file; it isn't an "rc" (run commands)

file.

grass.save would be more appropriate.

or grass.session? I would worry that .save would get confused with the GUI
File->Workspace->Save As.. files.

(also the /tmp/grass6-$USER-$PID/gisrc file)

Hamish

      ____________________________________________________________________________________
Never miss a thing. Make Yahoo your home page.
http://www.yahoo.com/r/hs