r3wp [groups: 83 posts: 189283]
  • Home
  • Script library
  • AltME Archive
  • Mailing list
  • Articles Index
  • Site search
 

World: r3wp

[Postscript] Emitting Postscript from REBOL

Henrik
18-Apr-2006
[738]
isn't there a SIZE-TEXT function?
Graham
18-Apr-2006
[739x2]
dunno
still needs a face
Henrik
18-Apr-2006
[741]
>> size-text make face [text: "hello"]
== 29x15
Graham
18-Apr-2006
[742]
easier :)
Henrik
18-Apr-2006
[743]
throw in a font definition
Graham
18-Apr-2006
[744]
example?
Henrik
18-Apr-2006
[745x4]
well, just the one used in DRAW for the text that needs to be printed
center: func [text width font] [
  width / 2 - second size-text make face compose [
    text: (text)
    font: (font)
  ]
]
that's what it takes
but it only works sometimes.. I don't know why
Graham
18-Apr-2006
[749]
copy
Henrik
18-Apr-2006
[750]
found the bug
Graham
18-Apr-2006
[751]
compose copy [ ]
Henrik
18-Apr-2006
[752]
size-text is the limit of the size of the face as well
Graham
18-Apr-2006
[753]
oh ..
Henrik
18-Apr-2006
[754x9]
center: func [text width font] [
  (width / 2) - (first size-text make face compose copy [
    text: (text)
    font: (font)
    size: (as-pair width 100)
  ])
]
hmm... maybe a different one is better...
center: func [text size font] [
  (size/x / 2) - (first size-text make face compose copy [
    text: (text)
    font: (font)
    size: (size)
  ])
]
center: func [text size font] [
  divide subtract size/x first size-text make face compose copy [
    text: (text)
    font: (font)
    size: (size)
  ] 2
]
getting better :-)
offsets a few pixels to the left, but it seems to center the text
the offset gets bigger when using a larger font.. wonder what causes 
it
anyhoo:


img: draw make image! 297x210 compose [pen red font (make face/font 
[size: 30]) text (as-pair center "BOOM!" 297x210 make face/font [size: 
30] 20) "BOOM!"]
view layout [image img]
I hope this can be done a little prettier...
Henrik
19-Apr-2006
[763]
http://www.hmkdesign.dk/run14.png<--- the offset can be seen at 
the bottom. I haven't tested, but maybe the kerning between the VID 
and DRAW font rendering isn't the same.
Geomol
19-Apr-2006
[764]
That looks like a nice little application! :-) Nice!
Henrik
19-Apr-2006
[765]
been working on that thing for way too long... but hopefully it can 
be completed now
james_nak
19-Apr-2006
[766]
How did you do those lists with the rows and columns? : - )  Just 
kidding, Looks great.
Henrik
19-Apr-2006
[767]
that's current generation LIST-VIEW. no hidden mirrors or anything.
james_nak
19-Apr-2006
[768]
You mean the version that is posted?
Henrik
19-Apr-2006
[769x3]
yes
well, there might actually be one feature missing in 0.0.38: focusing 
and unfocusing of list views
unfocused list views sport a grey selector instead of a green one
Graham
19-Apr-2006
[772]
Henrik, nice .. but I can't see the problem.
Henrik
19-Apr-2006
[773]
the "paper" in the bottom shows "0000". They are slightly aligned 
to the left. They shouldn't be.
Graham
19-Apr-2006
[774x2]
Ahh..
but that's a View preview - presumably the postscript print out is 
centred?
Henrik
19-Apr-2006
[776]
I hope so
Graham
19-Apr-2006
[777x8]
I noticed that viewing pdfs from ps2pdf is not exact.
the vertical height is not right in the pdf.
If you look at my layout examples above, you can see that the font 
size is not the same as the point size used in View.
So, that a fontsize of 20 gives a y: 23
fontsize of 12, gives y: 15
Perhaps they should be equal.
but it may relate to the horizontal displacement problem you're having.
can any view experts explain why the difference?
Henrik
19-Apr-2006
[785]
that's right. the font points are of a smaller dpi than the coordinate 
system it seems
Graham
19-Apr-2006
[786]
I'll submit a rambo ...
Henrik
19-Apr-2006
[787]
I think the font size is bound to the screen resolution