Closed run4flat closed 10 years ago
Hi David,
Sorry but I can't see (or understand, even) what is the error you're referring to.
As for the character placement, this is a generic problem not specific to PS or even Prima that manifests itself when you try to render text using another font - all character placements become shifted according to the other font's kerning. One can fight it by forcing the kerning of the original font, but Prima's PS code doesn't do it. Probably having such an option can make some sense, I don't know.
I also don't quite get the trouble with the scaling factor .. suppose we have window height 500px, multipled by your constant that gets 326pt, or 4.5in and that is written verbatim in the .eps file. The rest is up to the postscript interpreter, and you can always check the real display PPI with a ruler :)
/dk
PS - also, re-kerning the text is not a guarantee that it will look right, the PS interpreter may substitute the font or have another version of the same font.
When I run perl ps-subcanvas-font-dimensions.pl 500
, I get this printed to the screen:
Subroutine Prima::PS::Drawable::text_out redefined at ps-subcanvas-font-dimensions.pl line 37.
Just before text out operation, font width is 261, and font width divisor is 260.664961636829
and I get this postscript output:
When I run perl ps-subcanvas-font-dimensions.pl 500 subcanvas
, I get this printed to the screen:
Subroutine Prima::PS::Drawable::text_out redefined at ps-subcanvas-font-dimensions.pl line 37.
Just before text out operation, font width is 21.1664451744237, and font width divisor is 212.848588537211
and I get this postscript output:
The key difference is indicated in the printout: the font width divisors differ slightly (261 vs 213) but the font widths themselves differ substantially (261 vs 21.1).
When I run perl postscript-subcanvas-test.pl 500
, I get this printed to the screen:
Subroutine Prima::PS::Drawable::text_out redefined at postscript-subcanvas-test.pl line 37.
Just before text out operation, font width is 258, and font width divisor is 257.657289002558
and this postscript output:
When I run perl postscript-subcanvas-test.pl 500 subcanvas
, I get this printed to the screen:
Subroutine Prima::PS::Drawable::text_out redefined at postscript-subcanvas-test.pl line 37.
Just before text out operation, font width is 25.7114090220402, and font width divisor is 257.657289002558
and this postscript figure:
thank you!
Yes!! That fixes it! Thanks!
Summary
There appears to be an error in the calculation of gui font scaling for GUI -> Postscript font that manifests itself for larger fonts. Basically, the postscript font with is far, far too small for big fonts. Even when using a Postscript font (Helvetica), there are also subtle discrepancies in the placement of individual characters. The spacing between the two
o
characters is wider on the Postscript than it is on the Window.Additionally, it seems that a canvas size scaling factor of
65.25 / 100
gives identical postscript dimensions, not72.27 / 100
. This may simply be over-tweaking on my part, or it may have to do with what my screen thinks an inch is. Is there a way in Prima for me to query the number of pixels in an inch so that I can correctly set the canvas size?Usage
The following script demonstrates the problem. You can modify the behavior of the script by calling it with various arguments.
\d+
gives the size of the window you want to produce. The font size is scaled to be 1/3 the window size. This makes it easy to try different font sizes.subcanvas
causes the script to usepaint_with_widgets
; default behavior just passes the postscript canvas to the window'spaint
notificationhelvetica
causes the window to use the Helvetica font, side-stepping the GUI -> Postscrip font conversion issue. There are still subtle differences in the placement of the font elementsFor example, to call the script with a 500x500 window that uses gui fonts and subcanvas, you would say
perl postscript-subcanvas-test.pl 500 subcanvas
.Script