[GRASS-dev] [GRASS GIS] #1338: Text doesn't display for d.legend and d.barscale

#1338: Text doesn't display for d.legend and d.barscale
----------------------------+-----------------------------------------------
Reporter: snorfalorpagus | Owner: grass-dev@…
     Type: defect | Status: new
Priority: normal | Milestone: 7.0.0
Component: Display | Version: svn-trunk
Keywords: | Platform: MacOSX
      Cpu: OSX/Intel |
----------------------------+-----------------------------------------------
The legend and barscale display, but the associated text (5km, etc) does
not. Running GRASS 7.0 (svn-trunk) compiled myself (see configure
attached). I don't have this issue with the binaries for 6.4.1. Text added
with the 'add text' option displays normally. See attached screenshot. No
error text is reported (the ... in the console in the screenshot was from
previous commands).

--
Ticket URL: <http://trac.osgeo.org/grass/ticket/1338&gt;
GRASS GIS <http://grass.osgeo.org>

#1338: Text doesn't display for d.legend and d.barscale
----------------------------+-----------------------------------------------
Reporter: snorfalorpagus | Owner: grass-dev@…
     Type: defect | Status: new
Priority: critical | Milestone: 7.0.0
Component: Display | Version: svn-trunk
Keywords: cairo | Platform: MacOSX
      Cpu: OSX/Intel |
----------------------------+-----------------------------------------------
Changes (by martinl):

  * keywords: => cairo
  * priority: normal => critical

Comment:

I guess you are using cairo driver, so it will be bug in cairo display
driver.

--
Ticket URL: <http://trac.osgeo.org/grass/ticket/1338#comment:1&gt;
GRASS GIS <http://grass.osgeo.org>

#1338: Text doesn't display for d.legend and d.barscale
----------------------------+-----------------------------------------------
Reporter: snorfalorpagus | Owner: grass-dev@…
     Type: defect | Status: new
Priority: critical | Milestone: 7.0.0
Component: Display | Version: svn-trunk
Keywords: cairo | Platform: MacOSX
      Cpu: OSX/Intel |
----------------------------+-----------------------------------------------

Comment(by snorfalorpagus):

The cairo library I have installed (for which GRASS was compiled against)
is the binary from:

http://www.kyngchaos.com/software/frameworks

"v1.10.2-1"

--
Ticket URL: <https://trac.osgeo.org/grass/ticket/1338#comment:2&gt;
GRASS GIS <http://grass.osgeo.org>

#1338: Text doesn't display for d.legend and d.barscale
----------------------------+-----------------------------------------------
Reporter: snorfalorpagus | Owner: grass-dev@…
     Type: defect | Status: new
Priority: critical | Milestone: 7.0.0
Component: Display | Version: svn-trunk
Keywords: cairo | Platform: MacOSX
      Cpu: OSX/Intel |
----------------------------+-----------------------------------------------

Comment(by glynn):

Replying to [comment:1 martinl]:
> I guess you are using cairo driver, so it will be bug in cairo display
driver.

FWIW, it works from the command line on Linux.

My first guess would be something related to the font, e.g. the font
hasn't been set, or is set to a font which doesn't exist. If GRASS_FONT is
set (at all), it overrides the default "romans" stroke font.

--
Ticket URL: <https://trac.osgeo.org/grass/ticket/1338#comment:3&gt;
GRASS GIS <http://grass.osgeo.org>

#1338: Text doesn't display for d.legend and d.barscale
----------------------------+-----------------------------------------------
Reporter: snorfalorpagus | Owner: grass-dev@…
     Type: defect | Status: new
Priority: critical | Milestone: 7.0.0
Component: Display | Version: svn-trunk
Keywords: cairo | Platform: MacOSX
      Cpu: OSX/Intel |
----------------------------+-----------------------------------------------

Comment(by snorfalorpagus):

GRASS_FONT is not set. The romans font does appear to be installed:

/Applications/GRASS-7.0.app/Contents/MacOS/fonts/romans.hmp

I tried setting it to italicc, but no change.

When I start GRASS, I get these warnings. I'm not sure if it's related. It
happens right when the GUI starts. Everything else seems to function OK.

{{{
Launching 'wxpython' GUI in the background, please wait...
GRASS 7.0.svn (hydro52021):~ > Tue Mar 29 18:46:08 Snorfalorpagus-
MBP-15.local Python[1091] <Error>: kCGErrorIllegalArgument:
CGSGetWindowBounds: NULL window
Tue Mar 29 18:46:08 Snorfalorpagus-MBP-15.local Python[1091] <Error>:
kCGErrorFailure: Set a breakpoint @ CGErrorBreakpoint() to catch errors as
they are logged.
Tue Mar 29 18:46:08 Snorfalorpagus-MBP-15.local Python[1091] <Error>:
CGContextRestoreGState: invalid context 0x0
Tue Mar 29 18:46:08 Snorfalorpagus-MBP-15.local Python[1091] <Error>:
CGContextRestoreGState: invalid context 0x0
Tue Mar 29 18:46:08 Snorfalorpagus-MBP-15.local Python[1091] <Error>:
CGContextRestoreGState: invalid context 0x0
Tue Mar 29 18:46:08 Snorfalorpagus-MBP-15.local Python[1091] <Error>:
CGContextRestoreGState: invalid context 0x0
Tue Mar 29 18:46:08 Snorfalorpagus-MBP-15.local Python[1091] <Error>:
CGContextRestoreGState: invalid context 0x0
}}}

--
Ticket URL: <https://trac.osgeo.org/grass/ticket/1338#comment:4&gt;
GRASS GIS <http://grass.osgeo.org>

#1338: Text doesn't display for d.legend and d.barscale
----------------------------+-----------------------------------------------
Reporter: snorfalorpagus | Owner: grass-dev@…
     Type: defect | Status: new
Priority: critical | Milestone: 7.0.0
Component: Display | Version: svn-trunk
Keywords: cairo, fonts | Platform: MacOSX
      Cpu: OSX/Intel |
----------------------------+-----------------------------------------------
Changes (by hamish):

  * keywords: cairo => cairo, fonts

Comment:

For me in grass7 on linux, by default GRASS_FONT (shell enviro variable)
is not set by default, but text does display using what I guess would be
cairo's fat/smoothed version of GRASS's romans.

setting the font manually with `export GRASS_FONT="Times New Roman:Bold
Italic"` on the command line successfully changes the font. (viewing with
`qiv -eT map.png&`)

If I set the font to something not on the `d.fontlist` list (e.g. "Times
New Roman" instead of "Times_New_Roman", no text is drawn and I get this
warning:

{{{
WARNING: Unable to open font map
          '/usr/local/src/grass/svn/trunk/dist.x86_64-unknown-linux-
gnu/fonts/.hmp':
          No such file or directory. Try running 'g.mkfontcap -o'
}}}

(path to stroke fonts, but there is no (null).hmp file)

... I assume that's just the last test-for-font code it gets to, but the
main point of this comment is that this warning message or the font tests
could be improved.

n.b. d.font erases the map.png, but I guess that's just because I haven't
set GRASS_PNG_READ etc.

Hamish

--
Ticket URL: <https://trac.osgeo.org/grass/ticket/1338#comment:5&gt;
GRASS GIS <http://grass.osgeo.org>

#1338: Text doesn't display for d.legend and d.barscale
----------------------------+-----------------------------------------------
Reporter: snorfalorpagus | Owner: grass-dev@…
     Type: defect | Status: new
Priority: critical | Milestone: 7.0.0
Component: Display | Version: svn-trunk
Keywords: cairo, fonts | Platform: MacOSX
      Cpu: OSX/Intel |
----------------------------+-----------------------------------------------

Comment(by snorfalorpagus):

Confirmed this is an issue with cairo, or at least GRASS' use of it. If I
compile --without-cairo, it falls back on... I don't know what... but the
legend/scalebar display OK.

--
Ticket URL: <http://trac.osgeo.org/grass/ticket/1338#comment:6&gt;
GRASS GIS <http://grass.osgeo.org>

#1338: Text doesn't display for d.legend and d.barscale
----------------------------+-----------------------------------------------
Reporter: snorfalorpagus | Owner: grass-dev@…
     Type: defect | Status: new
Priority: critical | Milestone: 7.0.0
Component: Display | Version: svn-trunk
Keywords: cairo, fonts | Platform: MacOSX
      Cpu: OSX/Intel |
----------------------------+-----------------------------------------------

Comment(by glynn):

Replying to [comment:6 snorfalorpagus]:
> Confirmed this is an issue with cairo, or at least GRASS' use of it. If
I compile --without-cairo, it falls back on... I don't know what... but
the legend/scalebar display OK.

The default display driver is cairo if GRASS was built --with-cairo, and
the PNG driver otherwise. You can force the use of a specific driver with
e.g.:
{{{
export GRASS_RENDER_IMMEDIATE=PNG
}}}

The cairo driver uses cairo's text rendering and, where available,
!FontConfig for font selection. If !FontConfig isn't available, the only
non-stroke fonts which the cairo driver supports are "sans", "serif" and
"mono" (plus bold and/or italic variants). Unlike the PNG driver, the
cairo driver cannot use !FreeType directly (i.e. without going through
!FontConfig).

--
Ticket URL: <http://trac.osgeo.org/grass/ticket/1338#comment:7&gt;
GRASS GIS <http://grass.osgeo.org>

#1338: Text doesn't display for d.legend and d.barscale
----------------------------+-----------------------------------------------
Reporter: snorfalorpagus | Owner: grass-dev@…
     Type: defect | Status: new
Priority: critical | Milestone: 7.0.0
Component: Display | Version: svn-trunk
Keywords: cairo, fonts | Platform: MacOSX
      Cpu: OSX/Intel |
----------------------------+-----------------------------------------------

Comment(by snorfalorpagus):

I have tried compiling with both --with-freetype and --without-freetype,
but can see no difference (in cairo or PNG).

Using the cairo display driver, text does not display on the scalebar or
legend.
Using the PNG display driver, text displays as expected.

For both drivers, text in a text layer displays correctly (and smoothed –
even in PNG).

I've also noticed that I cannot get vector labels to display with either
driver. Not sure if this is related.

I have tried compiling against both the libraries provided by kyngchaos,
and by those available through fink – no difference.

I have also tried compiling grass7svn on my linux machine (2.6.36, gentoo,
gnome). The same problem exists (screenshot attached as
grass_text_bug_linux.png).

In addition, I'm not convinced that ./configure is listening to the
options I pass it (despite the summary it gives making sense). Even if I
pass --without-tcltk I can still start the tcltk GUI. Same goes for the
wxgui. Is this normal?

--
Ticket URL: <http://trac.osgeo.org/grass/ticket/1338#comment:8&gt;
GRASS GIS <http://grass.osgeo.org>

#1338: Text doesn't display for d.legend and d.barscale
----------------------------+-----------------------------------------------
Reporter: snorfalorpagus | Owner: grass-dev@…
     Type: defect | Status: new
Priority: critical | Milestone: 7.0.0
Component: Display | Version: svn-trunk
Keywords: cairo, fonts | Platform: MacOSX
      Cpu: OSX/Intel |
----------------------------+-----------------------------------------------

Comment(by glynn):

Replying to [comment:8 snorfalorpagus]:
> I have tried compiling with both --with-freetype and --without-freetype,
but can see no difference (in cairo or PNG).

The cairo driver is unaffected by --with-freetype, as cairo provides its
own font and text handling. If the cairo library was built with
!FontConfig support, the cairo driver will use !FontConfig and cairo's
support for it. The cairo driver itself doesn't use !FreeType.

> In addition, I'm not convinced that ./configure is listening to the
options I pass it (despite the summary it gives making sense). Even if I
pass --without-tcltk I can still start the tcltk GUI. Same goes for the
wxgui. Is this normal?

Yes.

The configure options only control which tests are performed, which in
turn affects the setting of certain Makefile variables which are used in
compilation. Code which doesn't require compilation isn't affected. E.g.
using --without-tcltk will result in NVIZ not being compiled, but the
!Tcl/Tk GUI will still be installed.

--
Ticket URL: <http://trac.osgeo.org/grass/ticket/1338#comment:9&gt;
GRASS GIS <http://grass.osgeo.org>

#1338: Text doesn't display for d.legend and d.barscale
----------------------------+-----------------------------------------------
Reporter: snorfalorpagus | Owner: grass-dev@…
     Type: defect | Status: new
Priority: critical | Milestone: 7.0.0
Component: Display | Version: svn-trunk
Keywords: cairo, fonts | Platform: MacOSX
      Cpu: OSX/Intel |
----------------------------+-----------------------------------------------

Comment(by snorfalorpagus):

Still having this issue with r46963.

I've noticed that if I turn on labels (display=shape,attr), select an
attribute (attrcolumn=whatever) and change the label background/border
colours, the boxes for the labels appear in a size proportional to the
text, but the text does not display. When I leave the d.vect dialogue
(pressing OK) and go back into it, the attrcolumn is removed from the
command at the bottom and in the input box. If GRASS then tries to redraw
the labels (pressing Apply), the console outputs the following:

{{{
Traceback (most recent call last):
   File "/Applications/GRASS-7.0.app/Contents/MacOS/etc/gui/w
xpython/gui_modules/layertree.py", line 233, in OnIdle

self.mapdisplay.MapWindow.UpdateMap(render = True)
   File "/Applications/GRASS-7.0.app/Contents/MacOS/etc/gui/w
xpython/gui_modules/mapdisp_window.py", line 667, in
UpdateMap

windres = windres)
   File "/Applications/GRASS-7.0.app/Contents/MacOS/etc/gui/w
xpython/gui_modules/render.py", line 868, in Render

self._renderLayers(force, mapWindow, maps, masks, opacities)
   File "/Applications/GRASS-7.0.app/Contents/MacOS/etc/gui/w
xpython/gui_modules/render.py", line 812, in _renderLayers

if not layer.Render():
   File "/Applications/GRASS-7.0.app/Contents/MacOS/etc/gui/w
xpython/gui_modules/render.py", line 158, in Render

**self.cmd[1])
TypeError
:
'NoneType' object is not iterable
Traceback (most recent call last):
   File "/Applications/GRASS-7.0.app/Contents/MacOS/etc/gui/w
xpython/gui_modules/layertree.py", line 233, in OnIdle

self.mapdisplay.MapWindow.UpdateMap(render = True)
   File "/Applications/GRASS-7.0.app/Contents/MacOS/etc/gui/w
xpython/gui_modules/mapdisp_window.py", line 667, in
UpdateMap

windres = windres)
   File "/Applications/GRASS-7.0.app/Contents/MacOS/etc/gui/w
xpython/gui_modules/render.py", line 868, in Render

self._renderLayers(force, mapWindow, maps, masks, opacities)
   File "/Applications/GRASS-7.0.app/Contents/MacOS/etc/gui/w
xpython/gui_modules/render.py", line 812, in _renderLayers

if not layer.Render():
   File "/Applications/GRASS-7.0.app/Contents/MacOS/etc/gui/w
xpython/gui_modules/render.py", line 158, in Render

**self.cmd[1])
TypeError
:
'NoneType' object is not iterable
}}}

I guess this is due to the automatic removal of the attrcolumn.

I'm not sure where else to go with this.

--
Ticket URL: <http://trac.osgeo.org/grass/ticket/1338#comment:10&gt;
GRASS GIS <http://grass.osgeo.org>

#1338: Text doesn't display for d.legend and d.barscale
----------------------------+-----------------------------------------------
Reporter: snorfalorpagus | Owner: grass-dev@…
     Type: defect | Status: new
Priority: critical | Milestone: 7.0.0
Component: Display | Version: svn-trunk
Keywords: cairo, fonts | Platform: MacOSX
      Cpu: OSX/Intel |
----------------------------+-----------------------------------------------

Comment(by mlennert):

No activity on this ticket for 2 years. Can anyone still reproduce this on
Mac OSX ?

Moritz

--
Ticket URL: <https://trac.osgeo.org/grass/ticket/1338#comment:11&gt;
GRASS GIS <http://grass.osgeo.org>

#1338: Text doesn't display for d.legend and d.barscale
----------------------------+-----------------------------------------------
Reporter: snorfalorpagus | Owner: grass-dev@…
     Type: defect | Status: new
Priority: critical | Milestone: 7.0.0
Component: Display | Version: svn-trunk
Keywords: cairo, fonts | Platform: MacOSX
      Cpu: OSX/Intel |
----------------------------+-----------------------------------------------

Comment(by cmbarton):

I have not had any problem on this. There are other, different issues with
drawing north arrows and other rendering in latlon regions in a separate
report.

Michael

--
Ticket URL: <https://trac.osgeo.org/grass/ticket/1338#comment:12&gt;
GRASS GIS <http://grass.osgeo.org>

#1338: Text doesn't display for d.legend and d.barscale
-----------------------------+----------------------------------------------
  Reporter: snorfalorpagus | Owner: grass-dev@…
      Type: defect | Status: closed
  Priority: critical | Milestone: 7.0.0
Component: Display | Version: svn-trunk
Resolution: worksforme | Keywords: cairo, fonts
  Platform: MacOSX | Cpu: OSX/Intel
-----------------------------+----------------------------------------------
Changes (by mlennert):

  * status: new => closed
  * resolution: => worksforme

Comment:

Replying to [comment:12 cmbarton]:
> I have not had any problem on this. There are other, different issues
with drawing north arrows and other rendering in latlon regions in a
separate report.

Ok, so closing it as worksforme.

Moritz

--
Ticket URL: <https://trac.osgeo.org/grass/ticket/1338#comment:13&gt;
GRASS GIS <http://grass.osgeo.org>