groff
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Groff] Doubly slanted Greek in PDF


From: Werner LEMBERG
Subject: Re: [Groff] Doubly slanted Greek in PDF
Date: Thu, 10 Apr 2003 17:28:44 +0200 (CEST)

> >Though I'm guessing that 7.05 has the problem with ZDR which Werner
> >drew our attention to.  BTW, just tried pstill on the same file,
> >and it also places the \(rh glyph in the wrong place.  Can anyone
> >try out Acrobat on Werner's file?
>
> Yes, it has the problem.

Do you mean that you've run Acrobat Distiller on groff's PS result?

> I think the problem is in the actual postscript programs used to
> create both synthetic fonts, as Tadziu Hoffman has already pointed
> out elsewhere, JawsPDF exhibits similar problems, and it is 95%
> compatible with Adobe Distiller 4.  That's the reason I made the
> GroffDingbats font ;-)

Today I've investigated the problem a bit more deeply.  gs 8 seems to
be broken in many ways (I really wonder how this version could be ever
released) -- for example, you can't get unencoded PDF: `ps2pdf
-dUseFlateCompression=false foo.ps' doesn't work.  Sigh.

The offset problems are simply bugs in gs.  Consider the following
example input:

  a\[lh][\rh]b

ps2pdf of gs 6.51 produces the following

  6 0 obj
  <</Length 7 0 R>>
  stream
  0.1 0 0 0.1 0 0 cm
  q
  /R4 gs
  q 10 0 0 10 0 0 cm BT
  /R9 10 Tf
  1 0 0 1 72 829.89 Tm
  (a)Tj
  /R12 10 Tf
  -1 0 0 1 76.44 829.89 Tm
  (+)Tj
  /R14 10 Tf
  1 0 0 1 85.83 829.89 Tm
  (+)Tj
  /R9 10 Tf
  9.38999 0 Td
  (b)Tj
  ET Q
  Q
  endstream

  ...

  12 0 obj
  <</Subtype/Type1/BaseFont/WEPMHE+ZapfDingbats-Reverse/Type/Font
    /Name/R12/FontDescriptor 11 0 R/FirstChar 32/LastChar 254/Widths[
    -278 -974 -961 -974 -980 -719 -789 -790
    -791 -690 -960 -939 -549 -855 -911 -933
    ...

/R12 is ZapfDingbats-Reverse, /R13 is ZapfDingbats.  The line

  -1 0 0 1 76.44 829.89 Tm

changes the transformation matrix to write from right to left, but
since the advance widths in object 12 are all negative, it writes
from left to right.

The /Metrics dictionary in zapfdr.pfa not only contains advance widhts
but horizontal bearing values also.  And here I believe is the bug in
gs: The /Widths array in a PDF file doesn't contain bearing values; as
soon as bearings are negative, gs has to compensate this by shifting
the transformation matrix horizontally.  If you change the above line
to, say, 

  -1 0 0 1 85.44 829.89 Tm

the resulting PDF file looks perfect.

> BTW, I have a type 1 version of the BBDing METAFONT at CTAN, very
> similar to Zapf Dingbats, that already contains both the \(rh and
> \(lh symbols, among others. I have uploaded it to my home page, see
> http://dradul.tripod.com/.  It´d make me happy donating it to the
> project.  The license terms are identical to the UWR++ fonts
> included with GNU GS and teTeX. Werner?

I'll first contact the gs team (hopefully getting a response).  See
below for a PS solution which works fine if run with ps2pdf.

> >Another thought.  Instead of artifically slanting the S font, why
> >not use the true Greek Times italic font which comes with most
> >Linux systems?  (On my RH system, it is at
> >/usr/share/fonts/ISO8859-7/Type1/grktimi.pfb).  This would of
> >course avoid any problems with ghostscript.  If it is thought to be
> >a good idea, I am happy to provide the pfb and a grops metric for
> >the font (the font is GPL'ed).
>
> That's probably a good idea. Or creating a slanted version of the
> URW++ GPLed Standard Sym L font to be included with groff.

Again, I will contact the gs people first.  Providing a PS solution
here is not really possible (except doing some really ugly hacks) --
groff has to know the metrics (especially the left and right italic
correction values) for proper math typesetting.


    Werner

======================================================================

.de ps-defs
  ps: mdef 3

  % <string> <size> <height> <slant> <font> groff-mirror -
  /groff-mirror {
    findfont
    4 1 roll                        % <string> font <size> <height> <slant>
    exch u
    % replace zero <height> with <size>
    dup 0 eq { pop 1 index u } if   % <string> font <size> <slant> <height>
    % compute matrix element `c'
    exch dup sin exch cos div
    1 index mul neg                 % <string> font <size> <height> c
    % build matrix; element `a' is <size>, element `d' is <height>
    [ 4 -1 roll u                   % <string> font <height> c [ a
    0 4 -1 roll                     % <string> font <height> [ a 0 c
    5 -1 roll neg 0 0 ] makefont    % <string> font'
    currentfont exch setfont
    exch
    dup
    stringwidth
    rmoveto
    matrix currentmatrix
    dup [ -1 0 0 1 0 0 ] exch matrix concatmatrix setmatrix
    exch show
    setmatrix
    setfont
  } bind def
..
.
.char \[lh] \
\X'ps: exec \
   (\\\\053) \\n[.ps] \\n[.height] \\n[.slant] /ZapfDingbats groff-mirror'\
\h'\w'\[rh]'u'


.ps 12.57
\Y[ps-defs]\c
foo\c
\S'20'\H'30'\c
foo\[lh]bar



foo\[rh]bar

reply via email to

[Prev in Thread] Current Thread [Next in Thread]