Opened 10 years ago

Closed 10 years ago

#908 closed defect (fixed)

No Font Definition File, windows xp

Reported by: voncasec Owned by: grass-dev@…
Priority: critical Milestone: 6.4.0
Component: Installation Version: svn-releasebranch64
Keywords: v.label.sa, g.mkfontcap, wingrass Cc:
CPU: Unspecified Platform: MSWindows XP

Description

C:/Program Files/GRASS-64-SVN/etc/fontcap: No font definition file

The installed version includes a file called fontcap.tmpl under the appropriate directory however the v.labels.sa program does not recognize it.

Attachments (2)

install_run_gmkfontcap.g65.patch (1.9 KB) - added by hellik 10 years ago.
Grass65_WinInstaller_Run_Gmkfontcap.patch (2.9 KB) - added by hellik 10 years ago.

Download all attachments as: .zip

Change History (25)

comment:1 Changed 10 years ago by hamish

Component: defaultInstallation
Keywords: g.mkfontcap wingrass added
Priority: normalcritical
Summary: v.label.sa - No Font Definition File, windows xpNo Font Definition File, windows xp

'd.font -l' and 'd.font -L' also fail.

-> g.mkfontcap needs to be run as part of the WinGrass installer, or upon the first time you run grass.

Init.sh:

  if [ ! -e "$GISBASE/etc/fontcap" ] ; do
      g.mkfontcap
  fi

??

Hamish

comment:2 Changed 10 years ago by hamish

... but for be benefit of users without admin rights on the system it should probably happen as part of the installer.

maybe for GRASS 7 we should first check for it in ~/.grass7/fontcap, and if not found there look for it in $(ETC)/fontcap?

Hamish

comment:3 in reply to:  2 Changed 10 years ago by glynn

Replying to hamish:

maybe for GRASS 7 we should first check for it in ~/.grass7/fontcap, and if not found there look for it in $(ETC)/fontcap?

The code which reads the file uses $GRASS_FONT_CAP if it is set and the file can be read, otherwise $GISBASE/etc/fontcap.

If g.mkfontcap is run without the -s flag, the data will be written to $GRASS_FONT_CAP if it is set, otherwise to $GISBASE/etc/fontcap. If $GRASS_FONT_CAP is set but the file cannot be written, it fails.

comment:4 in reply to:  2 ; Changed 10 years ago by hellik

Replying to hamish:

... but for be benefit of users without admin rights on the system it should probably happen as part of the installer.

[...]

Hamish

Replying to hamish:

... but for be benefit of users without admin rights on the system it should probably happen as part of the installer.

maybe for GRASS 7 we should first check for it in ~/.grass7/fontcap, and if not found there look for it in $(ETC)/fontcap?

Hamish

the NSIS-installer is able to run g.mkfontcap (http://nsis.sourceforge.net/Docs/Chapter4.html#4.9.1.2)

Exec '"$INSTDIR\someprogram.exe"'
Exec '"$INSTDIR\someprogram.exe" some parameters'

is there any other information needed by g.mkfontcap (beside the ouput destination GRASS_FONT_CAP)?

Helmut

comment:5 in reply to:  4 Changed 10 years ago by glynn

Replying to hellik:

is there any other information needed by g.mkfontcap (beside the ouput destination GRASS_FONT_CAP)?

No. Running it without arguments should be fine in this case. It automatically scans ${WINDIR}/Fonts.

comment:6 Changed 10 years ago by hamish

it uses G_no_gisinit(), but from outside of grass (ie in the installer) it still needs to have ligbis and the freetype lib found somewhere in the %PATH%, right?

comment:7 in reply to:  6 Changed 10 years ago by hellik

Replying to hamish:

it uses G_no_gisinit(), but from outside of grass (ie in the installer) it still needs to have ligbis and the freetype lib found somewhere in the %PATH%, right?

for testing, I've tried g.mkfontcap.exe in a MS-cmd outside a grass-session, so there is an error "libfreetype-6.dll couldn't be found".

Helmut

comment:8 in reply to:  6 ; Changed 10 years ago by glynn

Replying to hamish:

it uses G_no_gisinit(), but from outside of grass (ie in the installer) it still needs to have ligbis and the freetype lib found somewhere in the %PATH%, right?

Right.

It also needs $GISBASE to be set so that it can find the stroke fonts in $GISBASE/fonts.

And it needs $GISRC to be set (and valid) because G_parser() uses G__getenv("OVERWRITE") as well as getenv("GRASS_OVERWRITE"). It checks these regardless of whether there are any options with "new" in the gisprompt field (the overwrite field in the GModule structure is set according to whether overwrite is enabled so that modules can perform their own checks).

AFAICT, the simplest fix is to add:

    G_set_gisrc_mode(G_GISRC_MODE_MEMORY);

to G_no_gisinit().

Fixed in r40854 (6.5) and r40855 (7.0). Suggest back-port to 6.4 after testing.

comment:9 in reply to:  8 ; Changed 10 years ago by glynn

Replying to glynn:

AFAICT, the simplest fix is to add:

    G_set_gisrc_mode(G_GISRC_MODE_MEMORY);

to G_no_gisinit().

Oops. It took me all of two minutes to realise that isn't going to work (it breaks g.proj and g.gisenv). I've moved the code into g.mkfontcap and g.dirseps in r40856 (7.0) and r40857 (6.5).

comment:10 in reply to:  9 ; Changed 10 years ago by hellik

Replying to glynn:

Replying to glynn:

AFAICT, the simplest fix is to add:

    G_set_gisrc_mode(G_GISRC_MODE_MEMORY);

to G_no_gisinit().

Oops. It took me all of two minutes to realise that isn't going to work (it breaks >g.proj and g.gisenv). I've moved the code into g.mkfontcap and g.dirseps in r40856 >(7.0) and r40857 (6.5).

what does this mean for running g.mkfontcap outside a Grass-session (and accordingly for the NSIS-installer)? which parameters have to be set for working g.mkfontcap outside a Grass-session?

Helmut

comment:11 in reply to:  10 ; Changed 10 years ago by glynn

Replying to hellik:

what does this mean for running g.mkfontcap outside a Grass-session (and accordingly for the NSIS-installer)? which parameters have to be set for working g.mkfontcap outside a Grass-session?

GISRC should no longer have to be set. GISBASE must still be set (this eliminates the need for the installer to set GRASS_FONT_CAP, as the default of $GISBASE/etc/fontcap will work).

comment:12 in reply to:  11 ; Changed 10 years ago by hellik

Replying to glynn:

Replying to hellik:

what does this mean for running g.mkfontcap outside a Grass-session (and accordingly for the NSIS-installer)? which parameters have to be set for working g.mkfontcap outside a Grass-session?

GISRC should no longer have to be set. GISBASE must still be set (this eliminates the need for the installer to set GRASS_FONT_CAP, as the default of $GISBASE/etc/fontcap will work).

i've tested g.mkfontcap with grass65 running outside a grass-session. it's working, fontcap is built.

I attach a patch for the NSIS-installer script to write a little cmd-file to set all dependecies and then run g.mkfontcap outside a grass session.

the cmd is working by right click with "run as admin" on C:\Program Files\GRASS-65-SVN\etc\install_run_gmkfontcap.cmd but if it's started by the installer itself, there seems that install_run_gmkfontcap.cmd isn't allowed to write fontcap in C:\Program Files\GRASS-65-SVN\etc\.

Helmut

comment:13 in reply to:  12 ; Changed 10 years ago by hellik

Replying to hellik:

I attach a patch for the NSIS-installer script to write a little cmd-file to set all dependecies and then run g.mkfontcap outside a grass session.

there was a typo, i change the patch, but it doesn't help to run the g.mkfontcap by the installer.

Helmut

Changed 10 years ago by hellik

comment:14 in reply to:  13 ; Changed 10 years ago by hellik

Replying to hellik:

Replying to hellik:

I attach a patch for the NSIS-installer script to write a little cmd-file to set all dependecies and then run g.mkfontcap outside a grass session.

there was a typo, i change the patch, but it doesn't help to run the g.mkfontcap by the installer.

Helmut

the little helper script install_run_gmkfontcap.cmd itself included in the NSIS-script (Line 418 - 441 in https://trac.osgeo.org/grass/attachment/ticket/908/install_run_gmkfontcap.g65.patch) is working, that means g.mkfontcap (grass65-version) is working (thanks to Glynn's fixes in r40857 ) outside a Grass-session.

but I'm lost at the moment by invoking install_run_gmkfontcap.cmd by the NSIS-installer (Line 443 - 444 in https://trac.osgeo.org/grass/attachment/ticket/908/install_run_gmkfontcap.g65.patch) and getting writing permission in c:\Program Files\.

any suggestions?

Helmut

comment:15 in reply to:  14 ; Changed 10 years ago by hellik

Replying to hellik:

but I'm lost at the moment by invoking install_run_gmkfontcap.cmd by the NSIS-installer (Line 443 - 444 in https://trac.osgeo.org/grass/attachment/ticket/908/install_run_gmkfontcap.g65.patch) and getting writing permission in c:\Program Files\.

any suggestions?

Helmut

the added patch for the NSIS-installer-script is now working, that means g.mkfontcap is now invoked by the WinGrass-installer and writes succesfully the fontcap-file in c:\Program Files\Grass65-SVN\etc.

the only thing at the moment is, g.mkfontcap works longer (searching for fonts) than the WinGrass-installer installs WinGrass, so after closing the WinGrass-installer the Windows-command-box is still opened.

maybe is there a possibility to run the run_gmkfontcap.cmd-script in the background without opening Windows-command-box?

Helmut

p.s. how can I delete an old attachment in track?

comment:16 in reply to:  15 ; Changed 10 years ago by glynn

Replying to hellik:

the only thing at the moment is, g.mkfontcap works longer (searching for fonts) than the WinGrass-installer installs WinGrass, so after closing the WinGrass-installer the Windows-command-box is still opened.

maybe is there a possibility to run the run_gmkfontcap.cmd-script in the background without opening Windows-command-box?

It depends upon what's opening the console Window. If it's NSIS, there might be an option within NSIS to do it. Otherwise, "start /b ..." might work.

p.s. how can I delete an old attachment in track?

I don't think that you can, although you can replace an attachment with an updated version.

comment:17 in reply to:  16 ; Changed 10 years ago by hellik

Replying to glynn:

Replying to hellik:

the only thing at the moment is, g.mkfontcap works longer (searching for fonts) than the WinGrass-installer installs WinGrass, so after closing the WinGrass-installer the Windows-command-box is still opened.

maybe is there a possibility to run the run_gmkfontcap.cmd-script in the background without opening Windows-command-box?

It depends upon what's opening the console Window. If it's NSIS, there might be an option within NSIS to do it. Otherwise, "start /b ..." might work.

there would be an option with a second bat starting run_gmkfontcap.bat minimized:

@echo off
rem #########################################################################
rem #run run_gmkfontcap.bat minimized
rem #########################################################################
start /MIN "C:\Program Files\GRASS-65-SVN\etc\run_gmkfontcap.bat"
exit

I've tried this by invoking the above script by the installer, a minimized console is started, but run_gmkfontcap.bat isn't running/started.

run_gmkfontcap.bat itself invoked by the installer is working.

I couldn't find anything on NSIS-side.

Helmut

Changed 10 years ago by hellik

comment:18 in reply to:  17 ; Changed 10 years ago by hellik

Replying to hellik:

I couldn't find anything on NSIS-side.

this seems to be the clue: with ExecWait? the installer continues after run_gmkfontcap.bat has finished.

ExecWait '"$INSTALL_DIR\etc\run_gmkfontcap.bat"' 

tested locally. patch for submit to Grass65 for testing by the nightly builds?

Helmut

comment:19 in reply to:  9 Changed 10 years ago by hellik

Replying to glynn:

Replying to glynn:

AFAICT, the simplest fix is to add:

    G_set_gisrc_mode(G_GISRC_MODE_MEMORY);

to G_no_gisinit().

Oops. It took me all of two minutes to realise that isn't going to work (it breaks g.proj and g.gisenv). I've moved the code into g.mkfontcap and g.dirseps in r40856 (7.0) and r40857 (6.5).

after intensive testing backported to 6.4 by r41333

comment:20 in reply to:  18 ; Changed 10 years ago by hellik

Replying to hellik:

Replying to hellik:

I couldn't find anything on NSIS-side.

this seems to be the clue: with ExecWait? the installer continues after run_gmkfontcap.bat has finished.

ExecWait '"$INSTALL_DIR\etc\run_gmkfontcap.bat"' 

tested locally. patch for submit to Grass65 for testing by the nightly builds?

Helmut

see also https://trac.osgeo.org/grass/ticket/986

submitted to 6.4 r41333 , 6.5 r41321 , 7.0 r41329

comment:21 in reply to:  20 Changed 10 years ago by hellik

Replying to hellik:

Replying to hellik:

Replying to hellik:

I couldn't find anything on NSIS-side.

this seems to be the clue: with ExecWait? the installer continues after run_gmkfontcap.bat has finished.

ExecWait '"$INSTALL_DIR\etc\run_gmkfontcap.bat"' 

tested locally. patch for submit to Grass65 for testing by the nightly builds?

Helmut

see also https://trac.osgeo.org/grass/ticket/986

submitted to 6.4 r41333 , 6.5 r41321 , 7.0 r41329

can this be closed now?

Helmut

comment:22 Changed 10 years ago by hamish

Helmut:

can this be closed now?

sure.

Config -> Prefs -> Display -> Set Font now gives you a choice of lots and lots of fonts.

Hamish

comment:23 Changed 10 years ago by hamish

Resolution: fixed
Status: newclosed
Note: See TracTickets for help on using tickets.