Opened 13 years ago

Closed 11 years ago

#1338 closed defect (worksforme)

Text doesn't display for d.legend and d.barscale

Reported by: snorfalorpagus Owned by: grass-dev@…
Priority: critical Milestone: 7.0.0
Component: Display Version: svn-trunk
Keywords: cairo, fonts Cc:
CPU: OSX/Intel Platform: MacOSX

Description

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

Attachments (3)

Screen-shot-2011-03-28-at-6.15.jpg (148.7 KB ) - added by snorfalorpagus 13 years ago.
Screenshot of problem
grass7build.txt (2.0 KB ) - added by snorfalorpagus 13 years ago.
./configure options
grass_text_bug_linux.png (94.0 KB ) - added by snorfalorpagus 13 years ago.

Download all attachments as: .zip

Change History (16)

by snorfalorpagus, 13 years ago

Screenshot of problem

by snorfalorpagus, 13 years ago

Attachment: grass7build.txt added

./configure options

comment:1 by martinl, 13 years ago

Keywords: cairo added
Priority: normalcritical

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

comment:2 by snorfalorpagus, 13 years ago

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"

in reply to:  1 comment:3 by glynn, 13 years ago

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

comment:4 by snorfalorpagus, 13 years ago

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

comment:5 by hamish, 13 years ago

Keywords: fonts added

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

comment:6 by snorfalorpagus, 13 years ago

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.

in reply to:  6 comment:7 by glynn, 13 years ago

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

comment:8 by snorfalorpagus, 13 years ago

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?

by snorfalorpagus, 13 years ago

Attachment: grass_text_bug_linux.png added

in reply to:  8 comment:9 by glynn, 13 years ago

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

comment:10 by snorfalorpagus, 13 years ago

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.

comment:11 by mlennert, 11 years ago

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

Moritz

comment:12 by cmbarton, 11 years ago

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

in reply to:  12 comment:13 by mlennert, 11 years ago

Resolution: worksforme
Status: newclosed

Replying to 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

Note: See TracTickets for help on using tickets.