Register
Login
Resources
Docs Blog Datasets Glossary Case Studies Tutorials & Webinars
Product
Data Engine LLMs Platform Enterprise
Pricing Explore
Connect to our Discord channel

GMT_Appendix_G.tex 5.5 KB

You have to be logged in to leave a comment. Sign In
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
  1. %------------------------------------------
  2. % $Id$
  3. %
  4. % The GMT Documentation Project
  5. % Copyright (c) 2000-2012.
  6. % P. Wessel, W. H. F. Smith, R. Scharroo, and J. Luis
  7. %------------------------------------------
  8. %
  9. \chapter{\PS\ fonts used by \gmt}
  10. \label{app:G}
  11. \index{Font!standard}
  12. \thispagestyle{headings}
  13. \GMT\ uses the standard 35 fonts that come with most \PS\
  14. laserwriters. If your printer does not support some of these
  15. fonts, it will automatically substitute the default font (which is
  16. usually Courier). The following is
  17. a list of the \GMT\ fonts: \\
  18. \GMTfig[h]{GMT_App_G}{The standard 35 \PS\ fonts recognized by \gmt.}
  19. For the special fonts Symbol (12) and ZapfDingbats (34), see the
  20. octal charts in Appendix~\ref{app:F}. When specifying fonts in
  21. \GMT, you can either give the entire font name \emph{or} just the
  22. font number listed in this table. To change the fonts used in
  23. plotting basemap frames, see the man page for
  24. \GMTprog{gmt.conf}. For direct plotting of text-strings, see
  25. the man page for \GMTprog{pstext}.
  26. \section{Using non-default fonts with \GMT}
  27. \label{sec:non-default-fonts}
  28. To add additional fonts that you may have purchased or that are
  29. available freely in the internet or at your institution, see the
  30. instructions in the \filename{CUSTOM\_font\_info.d} under the
  31. \filename{share/pslib} directory and continue reading.
  32. %
  33. \GMT\ does not read or process any font files and thus does not
  34. know anything about installed fonts and their metrics. In order to
  35. use extra fonts in \GMT\ you need to specify the \PS\ name of the
  36. relevant fonts in the file \filename{CUSTOM\_font\_info.d}. You
  37. can either edit the existing file distributed with \GMT\ to make
  38. the changes global or you can create a new file in the current
  39. working directory, e.g.:
  40. %
  41. \begin{verbatim}
  42. LinBiolinumO 0.700 0
  43. LinLibertineOB 0.700 0
  44. \end{verbatim}
  45. %
  46. The format is a space delimited list of the \PS\ font name, the
  47. font height-point size-ratio, and a boolean variable that tells
  48. \GMT\ to re-encode the font (if set to zero). The latter has to be
  49. set to zero as additional fonts will most likely not come in
  50. standard \PS\ encoding. \GMT\ determines how tall typical
  51. annotations might be from the font size ratio so that the vertical
  52. position of labels and titles can be adjusted to a more uniform
  53. typesetting. Now, you can set the \GMT\ font parameters to your
  54. non-standard fonts:
  55. %
  56. \begin{verbatim}
  57. gmtset FONT LinBiolinumO \
  58. FONT_TITLE 28p,LinLibertineOB \
  59. PS_CHAR_ENCODING ISO-8859-1 \
  60. MAP_DEGREE_SYMBOL degree
  61. \end{verbatim}
  62. %
  63. After setting the encoding and the degree symbol, the
  64. configuration part for \GMT\ is finished and you can proceed to
  65. create \GMT-maps as usual. An example script is discussed in
  66. Section~\ref{sec:non-default-fonts-example}.
  67. \subsection{Embedding fonts in PostScript and PDF}
  68. If you have Type 1 fonts in PFA (Printer Font ASCII) format you
  69. can embed them directly by copying them at the very top of your
  70. \PS-file, before even the \%!PS header comment. PFB (Printer Font
  71. Binary), TrueType or OpenType fonts cannot be embedded in \PS\
  72. directly and therefore have to be converted to PFA first.
  73. However, you most likely will have to tell \progname{Ghostscript}
  74. where to find your custom fonts in order to convert your
  75. \GMT-\PS-plot to PDF or an image with \GMTprog{ps2raster}. When
  76. you have used the correct \PS-names of the fonts in
  77. \filename{CUSTOM\_font\_info.d} you only need to point the
  78. \verb#GS_FONTPATH# environment variable to the directory where the
  79. font files can be found and invoke \GMTprog{ps2raster} in the
  80. usual way. Likewise you can specify \progname{Ghostscript}'s
  81. \verb#-sFONTPATH# option on the command line with
  82. \Opt[-sFONTPATH=/path/to/fontdir]{-C}. \progname{Ghostscript},
  83. which is invoked by \GMTprog{ps2raster}, does not depend on file
  84. names. It will automatically find the relevant font files by their
  85. \PS-names and embed and subset them in PDF-files. This is quite
  86. convenient as the document can be displayed and printed even on
  87. other computers when the font is not available locally. There is
  88. no need to convert your fonts as \progname{Ghostscript} can handle
  89. all Type 1, TrueType and OpenType fonts. Note also, that you do
  90. not need to edit \progname{Ghostscript}'s Fontmap.GS.
  91. If you do not want or cannot embed the fonts you can convert them
  92. to outlines (shapes with fills) with \progname{Ghostscript} in the
  93. following way:
  94. \begin{verbatim}
  95. gs -q -dNOCACHE -dSAFER -dNOPAUSE -dBATCH -dNOPLATFONTS \
  96. -sDEVICE=pswrite -sFONTPATH="/path/to/fontdir" \
  97. -sOutputFile=mapWithOutlinedFonts.ps map.ps
  98. \end{verbatim}
  99. Note, that this only works with the \emph{pswrite} device. If you
  100. need outlined fonts in PDF, create the PDF from the converted
  101. \PS-file. Also, \GMTprog{ps2raster} cannot correctly crop
  102. \progname{Ghostscript} converted \PS-files anymore. Use Heiko
  103. Oberdiek's
  104. \htmladdnormallinkfoot{\progname{pdfcrop}}{http://code.google.com/p/pdfcrop2/}
  105. % \GMTprog{pdfcrop}
  106. instead or crop with \GMTprog{ps2raster} \Opt{A} \Opt{Te} before
  107. (See Example~\ref{sec:non-default-fonts-example}).
  108. \subsection{Character encoding}
  109. Since \PS\ itself does not support Unicode fonts, \progname{Ghostscript} will
  110. re-encode the fonts on the fly. You have to make sure to set the
  111. correct \verb#PS_CHAR_ENCODING# with gmtset and save your script
  112. file with the same character encoding. Alternatively, you can
  113. substitute all non ASCII characters with their corresponding octal
  114. codes, e.g., \textbackslash 265 instead of \textmu. Note, that
  115. \PS\ fonts support only a small range of glyphs and you may have
  116. to switch the \verb#PS_CHAR_ENCODING# within your script.
Tip!

Press p or to see the previous file or, n or to see the next file

Comments

Loading...