Opened 8 years ago
Last modified 7 years ago
#3320 new defect
d.text does not show anything with screen position in geographic coordinates or pixels
Reported by: | wenzeslaus | Owned by: | |
---|---|---|---|
Priority: | normal | Milestone: | 7.2.4 |
Component: | Display | Version: | 7.2.0 |
Keywords: | d.text d.graph | Cc: | |
CPU: | Unspecified | Platform: | Unspecified |
Description
G7:d.text works only with the default settings. I get nothing when using the -g
(map/geo coordinates) or -p
(screen pixels). Same in trunk and 7.2 (likely also 7.0).
Relevant flags and option:
-p Screen position in pixels ([0,0] is top left) -g Screen position in geographic coordinates at Screen position at which text will begin to be drawn (percentage, [0,0] is lower left)
How to reproduce:
Workaround with G7:d.graph:
Here is the initialization code in d.text
and in d.graph
:
/* d.text */ D_setup_unity(0); /* d.graph */ if (mapcoords->answer) { mapunits = TRUE; D_setup(0); } else { D_setup2(0, 0, 100, 0, 0, 100); mapunits = FALSE; }
Attachments (2)
Change History (13)
comment:1 by , 8 years ago
comment:3 by , 8 years ago
I fixed d.text, but d.mon still has the same problem. I think this issue is related to d.mon rendering. If I use the cairo or png driver directly, it works fine.
d.mon start=cairo output=cairo.png --o d.text percent size=5 at=70,70 d.text pixel size=5 at=50,50 -p d.text mapcoors size=5 at=-402022,924563 -g # any map coordinates inside the monitor d.mon stop=cairo
If I use the wx0 monitor, only percent (default) works.
follow-up: 6 comment:4 by , 8 years ago
I found the default at=50,50 in DtextController in decorations.py. The default for d.text is actually the upper-left corner. This option is empty in GUI, so at=50,50 is totally unexpected. I think it shouldn't have any hard-coded default. Because of this forced default, we cannot run:
d.text input=text.txt
to display text from the upper-left corner.
comment:5 by , 8 years ago
comment:6 by , 8 years ago
Replying to hcho:
I found the default at=50,50 in DtextController in decorations.py. The default for d.text is actually the upper-left corner. This option is empty in GUI, so at=50,50 is totally unexpected. I think it shouldn't have any hard-coded default. Because of this forced default, we cannot run:
d.text input=text.txtto display text from the upper-left corner.
Positioning in GUI is handled separately, because it needs to be more interactive. The 50,50 is there to make sure the entire text is rendered and not cut off anywhere. Flags -p and -g won't work here easily, the GUI would have to recompute the coordinates. But that should be a separate ticket I think.
comment:7 by , 8 years ago
Not only in GUI, it happens in d.mon wx0 as well (command line monitor). Flags -p and -g don't work both in g.gui GUI and d.mon WX monitors. They only work for direct cairo and png. Would it be difficult to fix -p & -g in GUI & d.mon WX monitors?
Also, I don't understand why forcing the default position at the center (50%,50%) would make sure the entire text is rendered without being cut off. We're losing a lot more space by placing text at the center instead of starting it from the upper-left corner. We also lost the capability of starting from the default upper-left corner because now we have to guess where that would be and type it in the at option. That's not ideal at all.
comment:8 by , 8 years ago
Milestone: | 7.2.1 → 7.2.2 |
---|
comment:11 by , 7 years ago
Milestone: | → 7.2.4 |
---|
I can confirm.
Interestingly in 7.0, -p seems to work, but -g doesn't (it seems to work like -p).
Moritz