[GRASS-dev] discussion: replacing ps.map
Glynn Clements
glynn at gclements.plus.com
Fri Apr 6 09:54:15 EDT 2007
Jachym Cepicky wrote:
> hi,
> tahanks for you answer
>
> 2007/4/6, Glynn Clements <glynn at gclements.plus.com>:
> >
> > J-Báchym Čepický wrote:-A
> >
> > > the PS driver works nice, thanks!
> > >
> > > What about d.text.freetype ? I wonder how complicated it would be to
> > > implement too..?
> >
> > Huh?
> >
> > d.text.freetype should work with the PS driver, although it will
> > rasterise the bitmaps at a resolution of 1 point, then embed the
> > bitmaps.
>
> d.mon PS
> d.text.freetype font=luximr text="hallo, world" at=10,10
> d.mon stop=PS
>
> gv map.ps
>
> document is not opend
Oops. There are a couple of bugs in the bitmap code.
The first is in the prolog; the string is allocated with one byte per
pixel, when it should be one bit, causing too much data to be read.
Index: lib/psdriver/psdriver.ps
===================================================================
RCS file: /grassrepository/grass6/lib/psdriver/psdriver.ps,v
retrieving revision 1.2
diff -u -r1.2 psdriver.ps
--- lib/psdriver/psdriver.ps 30 Mar 2007 06:29:35 -0000 1.2
+++ lib/psdriver/psdriver.ps 6 Apr 2007 13:48:00 -0000
@@ -39,7 +39,7 @@
/BITMAP {
gsave
4 2 roll translate
- 1 index string /tmpstr exch def
+ 1 index 7 add 8 idiv string /tmpstr exch def
true [1 0 0 1 0 0] {currentfile tmpstr readhexstring pop} imagemask
grestore
} bind def
If you make this change to the map.ps file, the file should display,
but you'll notice the second bug; the accumulator wasn't being
cleared, resulting in "echoes":
Index: lib/psdriver/Draw_bitmap.c
===================================================================
RCS file: /grassrepository/grass6/lib/psdriver/Draw_bitmap.c,v
retrieving revision 1.1
diff -u -r1.1 Draw_bitmap.c
--- lib/psdriver/Draw_bitmap.c 30 Mar 2007 04:51:23 -0000 1.1
+++ lib/psdriver/Draw_bitmap.c 6 Apr 2007 13:48:00 -0000
@@ -25,6 +25,7 @@
{
output("%02X", acc);
bit = 0x80;
+ acc = 0;
}
}
Both of these are fixed in CVS, and it appears to work.
> same for d.font && d.text
>
> What am I missing?
That I said "should work" rather than "does work" ;)
This time, I have actually tested it.
--
Glynn Clements <glynn at gclements.plus.com>
More information about the grass-dev
mailing list