Re: making fonts look same in Ghostscript and X11



On Sat, 17 Jun 2006, Usman Muzaffar wrote:

My application writes text to X11 display and to PostScript output. I
want the rendered output by Ghostscript on that same X11 display to
look *exactly* (identical pixels) like it does in my X11 app.

This is unlikely on a single computer, and a practical impossibility if you want to use a remote display.

But even if I use exactly the same Type 1 font (Times Roman 18,
which on my system maps "Nimbus Roman No 9 L" from URW) for
both X11 and PostScript output, there are noticeable differences,
especially in the spaces between letters and words, but even in
the rendering for individual glyphs.

It's easy to illustrate the discrepancy (this is on Fedora Core 3,
Xorg 6.8.1.902, GNU Ghostscript 7.07, 100dpi display). Compare:

% cat hello.ps
/Times-Roman findfont 18 scalefont setfont
10 10 moveto (The quick brown fox jumps over the lazy dog.) show
% gs -g800x50 -sDEVICE=x11 hello.ps

TO

% xmessage -fn
'-urw-nimbus roman no9 l-medium-r-normal--18-0-0-0-p-0-iso8859-1'
"The quick brown fox jumps over the lazy dog."

On my system, they're not even close. Larger fonts match a bit better,
but it's never anywhere near identical.

On my fc4 system the xmessage rendering is terrible. It has too little space between glyphs and between words. This seems to be a problem for many proportional fonts and few fixed-width fonts.

Questions:

1. Is this to be expected? The same Type 1 font will be rendered with
significant differences by X vs GhostScript? Why? Does the font data
leave a lot of specifics up to the individual rendering engine?

There are many places for 2 rasterizers to diverge:

* different interpretation of the metrics, especially kerning and
spacing.

* different versions of the URW fonts may be used in GS and in X, especially if the X rasterizer is in a different machine.

* each rasterizer may make different tradoffs between accurate location and accurate shapes, anti-aliasing, etc.

2. What are my choices for making Ghostscript and X11 match perfectly
(or as best as possible)? I'm not wedded to Type 1 fonts or even
X11 - my app just needs to manipulate text on a display, and then create
PostScript that when rendered on that display looks the way it did in
my app. Suggestions (short of embeeding Ghostcript in my app)?

Many apps already use GS via IPC to render ps code (ImageMagick display, gsview, ghostview, evince, etc.). If your app creates static text this might be OK, but if you need to interactively massage the text then you need a DPS-style system (GNUstep).

--
George N. White III <aa056@xxxxxxxxxxxxxx>

.



Relevant Pages

  • Re: making fonts look same in Ghostscript and X11
    ... look *exactly* like it does in my X11 app. ... the rendering for individual glyphs. ... Xorg 6.8.1.902, GNU Ghostscript 7.07, 100dpi display). ... X11 - my app just needs to manipulate text on a display, ...
    (comp.lang.postscript)
  • making fonts look same in Ghostscript and X11
    ... My application writes text to X11 display and to PostScript output. ... the rendering for individual glyphs. ... Xorg 6.8.1.902, GNU Ghostscript 7.07, 100dpi display). ...
    (comp.lang.postscript)
  • same font looks different X11 and Ghostscript
    ... My application writes text to X11 display and to PostScript output. ... the rendering for individual glyphs. ... Xorg 6.8.1.902, GNU Ghostscript 7.07, 100dpi display). ...
    (comp.windows.x)
  • Re: Fonts (Firefox/Windows & Firefox/Linux)
    ... should not ask you to choose a font size in pixels. ... I'm not sitting as close to a 42 inch display as I would be to a 20 ... Once you get fonts sort of how you can ... browser rendering software. ...
    (Fedora)
  • Re: Does the font look weird on this site?
    ... markup and stylesheets for the various browsers and OS's installed. ... Author might think, Linux, he had Bitstream fonts. ... It never occured to them that their display was enlarging their fonts, ... Which means things like font rendering in their browser, ...
    (Fedora)