[comp.std.unix] Postscript def. eth and thorn

std-unix@longway.TIC.COM (Moderator, John S. Quarterman) (04/28/88)

From: uunet!mcvax!rhi.hi.is!marius (Marius Olafsson)

>From article <167@longway.TIC.COM>, by BROOKS@CSSS-A.PRIME.COM (David Brooks):
> From: BROOKS@CSSS-A.PRIME.COM (David Brooks)
> 
> Nobody, but nobody, knows how to design eth and thorn.  If any
> Icelanders(?) would post a bitmap AND a PostScript definition of these
> four glyphs, many of us would be grateful.

Following is a small PostScript-program that defines a font
containing only the two ISO8859/1 letters 'eth' and 'thorn', both
in upper and lower case, as they should look like in Times-Roman.
The encoding vector puts them at the their places in the ISO 8859/1
character set. After defining the font the program uses it to print
a few copies of the letters in several sizes.  Note that upper case 
'Eth' is defined by using 'D' in the built-in Times-Roman font.

The letters are not typographically perfect, most notably the lower
case 'eth' (which is a very difficult and often badly designed letter),
but should suffice.

All fonts (almost) that Adobe sells, define these letters with the
same names as used below. They are also defined in the built-in fonts
with PostScript 42.2 and later. In that case, all that is needed to use
them is to include them in the 'Encoding'-vector.

--
Marius Olafsson		marius@rhi.hi.is
University of Iceland	..!mcvax!hafro!rhi!marius

%%%%%%%%%%%%%%%%%%%%%%%%%% PostScript begins %%%%%%%%%%%%%%%%%%%%%%%%%%

/BuildCharDict 10 dict def 

/IceFont 7 dict def

IceFont begin

  /FontType 3 def 
  /FontMatrix [.001 0 0 .001 0 0] def 
  /FontBBox [-103 -191 1042 822 ]def 

  /Encoding 256 array def 
  0 1 255 {Encoding exch /.notdef put} for
  Encoding (\320) 0 get /Eth put
  Encoding (\360) 0 get /eth put
  Encoding (\336) 0 get /Thorn put
  Encoding (\376) 0 get /thorn put

  /CharacterDefs 5 dict def
  CharacterDefs begin
   /.notdef {} def
   /Eth    % definition for the upper case 'Eth'. It is implemented
           % as a Times-Roman 'D' with a line through its left side.
    { /Times-Roman findfont 1000 scalefont setfont
      /trD (D) def
      0 0 moveto
      gsave
       trD stringwidth
       trD false charpath flattenpath pathbbox
      grestore
      setcachedevice % width should be like on 'D'

      newpath
        0 0 moveto
        trD show

        13 369 moveto
        313 369 lineto
        313 411 lineto
        13 411 lineto
        13 369 lineto
      fill
    } def
   /eth    % definition for the lower case 'eth'. It should look like
           % an 'o' with a curved ascender from its right side, and
           % a crossline at a 90 degree angle to the ascender. Note that
           % the crossline is not quite right in this case.
    { 522 0 0 -18 540 738 setcachedevice % width should be like on 'o'
      newpath
        0.91 0.91 scale
        261 6 moveto
        50 4 48 445 261 445 curveto
        490 445 490 4 261 4 curveto
        261 -15 moveto
        -44 -15 -44 469 261 469 curveto
        324 469 373 430 403 401 curveto
        420 438 340 563 276 608 curveto
        162 555 lineto
        137.36 582.3 lineto
        248.5 632.3 lineto
        211 666 157 700 110 712 curveto
        130.4 721 lineto
        183.4 710 240.4 681 291.7 651.3 curveto
        404.76 703.3 lineto
        425.4 679 lineto
        323.4 631 lineto
        596 434 543 -15 261 -15 curveto
      eofill
    } def
   /Thorn  % definition for the upper case 'Thorn'. It should look similar
           % to a 'P' but the circle lies lower
    { 594 0 0 0 513 666 setcachedevice % width should be like on 'P'
      newpath
        32 3 moveto
        32 16 lineto
        92 16 129 25 133 65 curveto
        133 600 lineto
        133 639 98 654 32 654 curveto
        32 660 lineto
        307 660 lineto 
        307 654 lineto 
        246 654 211 636 208 600 curveto
        208 540 lineto
        350 540 lineto
        470 537 548 461 548 360 curveto
        548 261 467 175 309 173 curveto
        276 174 242 176 208 180 curveto
        208 65 lineto
        208 34 243 16 307 16 curveto
        307 3 lineto
        31 3 lineto
        208 224 moveto
        208 475 lineto
        208 496 246 501 298 501 curveto
        438 501 478 413 478 351 curveto
        478 264 435 204 285 204 curveto
        258 203 236 217 208 224 curveto
      eofill
    } def
   /thorn  % definition for the lower case 'thorn'. It should look like
           % a 'p' with an ascender as high as the 'l'.
    { 504 0 0 -234 468 702 setcachedevice % width should be like on 'p'
      newpath
        5 -217 moveto
        5 -202 lineto
        57 -202 95 -185 95 -130 curveto
        95 578 lineto
        95 615 55 628 40 628 curveto
        28 628 11 622 5 619 curveto
        5 631 lineto
        158 689 lineto
        158 387 lineto
        213 441 254 466 294 466 curveto
        410 466 470 337 470 237 curveto
        470 135 389 -18 261 -18 curveto
        224 -18 189 -2 158 26 curveto
        158 -136 lineto
        158 -187 182 -204 234 -204 curveto
        234 -217 lineto
        5 -217 lineto
        158 87 moveto
        158 341 lineto
        176 364 216 404 254 404 curveto
        359 404 393 298 393 206 curveto
        393 140 366 24 258 24 curveto
        212 24 178 50 158 87 curveto
      eofill
    } def
  end

  /BuildChar
    { BuildCharDict begin

        /char exch def
        /fontdict exch def

        /charname fontdict /Encoding get
          char get def

        /charproc fontdict /CharacterDefs get
          charname get def

        gsave charproc grestore
      end
    } def
end

/IceTimes-Roman IceFont definefont pop


/IceTimes-Roman findfont 150 scalefont setfont
30 700 moveto
<D0F0DEFE> show

/IceTimes-Roman findfont 200 scalefont setfont
30 520 moveto
<D0F0DEFE> show

/IceTimes-Roman findfont 250 scalefont setfont
30 320 moveto
<D0F0> show

/IceTimes-Roman findfont 250 scalefont setfont
30 100 moveto
<DEFE> show

showpage

%%%%%%%%%%%%%%%%%%%%%%%%%%% PostScript ends %%%%%%%%%%%%%%%%%%%%%%%%%%%


Volume-Number: Volume 14, Number 12