Subversion-Projekte lars-tiefland.php_share

Revision

Details | Letzte Änderung | Log anzeigen | RSS feed

Revision Autor Zeilennr. Zeile
1 lars 1
==== Using True-Type fonts in PostScript (Ghostscript)
2
 
3
Say you want to see fancy "Trebuchet MS" font in generated postscript,
4
 
5
1. First of all, TrueType-compatible Ghostscript is a must.
6
   Most of Ghostscipt distributions are TrueType compatible.
7
   If you're not sure, ask your system administrator. If your GS is not
8
   True-Type compatible, consider building from source using require options
9
 
10
2. Find the file coresponding to "Trebuchet MS". Assuming you're using
11
   some kind of Windows on your home machine, you can do it by opening
12
   "Control Panel -> Fonts" and checking the properties of the chosen
13
   font. At the top of property page you'll see the file name - trebuc.ttf,
14
   in our case.
15
 
16
3. Find font files corresponding to the bold, italic and bold italic
17
   versions of this font.  Probably, it will be:
18
     "Trebuchet MS Bold" - trebucbd.ttf,
19
     "Trebuchet MS Italic" - trebucit.ttf,
20
     "Trebuchet MS Bold Italic" - trebucbi.ttf
21
 
22
4. Copy these files from the windows fonts directory (probably C:\Windows\Fonts)
23
   to the Ghostscript fonts directory (probably C:\gs\fonts).
24
 
25
5. Modify Ghostscript fontmap file (probably C:\gs\gs8.51\lib\Fontmap, assuming
26
   you're using Ghostscript version 8.51), adding the folowing lines:
27
 
28
/TrebuchetMS (trebuc.ttf) ;
29
/TrebuchetMS-Italic (trebucit.ttf) ;
30
/TrebuchetMS-Bold (trebucbd.ttf) ;
31
/TrebuchetMS-Bold-Italic (trebucbi.ttf) ;
32
 
33
   Note you can write almost anything after the / assuming it won't interfere
34
   with other font names. Say:
35
 
36
/MyCoolFont1 (trebuc.ttf) ;
37
/MyCoolFont2 (trebucit.ttf) ;
38
/MyCoolFont3 (trebucbd.ttf) ;
39
/MyCoolFont4 (trebucbi.ttf) ;
40
 
41
6. Register the above font names in the script config file. Add the following
42
   lines to .html2ps.config in the FONT section (between <fonts> and </fonts> tags)
43
 
44
  <family name="Trebuchet MS">
45
    <normal normal="/TrebuchetMS" italic="/TrebuchetMS-Italic" oblique="/TrebuchetMS-Italic"/>
46
    <bold normal="/TrebuchetMS-Bold" italic="/TrebuchetMS-Bold-Italic" oblique="/TrebuchetMS-Bold-Italic"/>
47
  </family>
48
 
49
   Of course, modified file should be uploaded to the server where the working script
50
   reside.
51
 
52
7. Now, the following example should render using Trebuchet MS font:
53
 
54
<BIG style="font-family: 'Trebuchet MS'">ABCDEFGH</BIG><br>
55
<BIG style="font-family: 'Trebuchet MS'; font-weight: bold;">ABCDEFGH</BIG><br>
56
<BIG style="font-family: 'Trebuchet MS'; font-style: italic;">ABCDEFGH</BIG><br>
57
<BIG style="font-family: 'Trebuchet MS'; font-weight: bold; font-style: italic;">ABCDEFGH</BIG><br>
58
 
59
==== Using True-Type fonts in PDF
60
 
61
Take the steps described above with the only difference: all Ghostscript-related directories
62
are on your server where the script resides. Ask your hoster/system administrator regarding
63
the exact location of Ghostscript.