1
+ ---
2
+ file_format : mystnb
3
+ ---
4
+
1
5
# Supported Fonts
2
6
3
7
PyGMT supports the 35 standard PostScript fonts. The table below lists them with their
@@ -7,25 +11,104 @@ either `"Helvetica"` or `"0"`. For the special fonts "Symbol" (**12**) and
7
11
"ZapfDingbats" (** 34** ), see the {doc}` /techref/encodings ` for the character set.
8
12
The image below the table shows a visual sample for each font.
9
13
10
- | Font No. | Font Name | Font No. | Font Name |
11
- | ----------| ------------------------| ----------| ------------------------------|
12
- | 0 | Helvetica | 17 | Bookman-Demi |
13
- | 1 | Helvetica-Bold | 18 | Bookman-DemiItalic |
14
- | 2 | Helvetica-Oblique | 19 | Bookman-Light |
15
- | 3 | Helvetica-BoldOblique | 20 | Bookman-LightItalic |
16
- | 4 | Times-Roman | 21 | Helvetica-Narrow |
17
- | 5 | Times-Bold | 22 | Helvetica-Narrow-Bold |
18
- | 6 | Times-Italic | 23 | Helvetica-Narrow-Oblique |
19
- | 7 | Times-BoldItalic | 24 | Helvetica-Narrow-BoldOblique |
20
- | 8 | Courier | 25 | NewCenturySchlbk-Roman |
21
- | 9 | Courier-Bold | 26 | NewCenturySchlbk-Italic |
22
- | 10 | Courier-Oblique | 27 | NewCenturySchlbk-Bold |
23
- | 11 | Courier-BoldOblique | 28 | NewCenturySchlbk-BoldItalic |
24
- | 12 | Symbol | 29 | Palatino-Roman |
25
- | 13 | AvantGarde-Book | 30 | Palatino-Italic |
26
- | 14 | AvantGarde-BookOblique | 31 | Palatino-Bold |
27
- | 15 | AvantGarde-Demi | 32 | Palatino-BoldItalic |
28
- | 16 | AvantGarde-DemiOblique | 33 | ZapfChancery-MediumItalic |
29
- | | | 34 | ZapfDingbats |
30
-
31
- ![ Standard PostScript Fonts] ( https://docs.generic-mapping-tools.org/dev/_images/GMT_App_G.png ) {width="67.5%"}
14
+ ``` {code-cell}
15
+ ---
16
+ tags: [remove-input]
17
+ ---
18
+ from IPython.display import display, Markdown
19
+
20
+ fonts = [
21
+ "Helvetica",
22
+ "Helvetica-Bold",
23
+ "Helvetica-Oblique",
24
+ "Helvetica-BoldOblique",
25
+ "Times-Roman",
26
+ "Times-Bold",
27
+ "Times-Italic",
28
+ "Times-BoldItalic",
29
+ "Courier",
30
+ "Courier-Bold",
31
+ "Courier-Oblique",
32
+ "Courier-BoldOblique",
33
+ "Symbol",
34
+ "AvantGarde-Book",
35
+ "AvantGarde-BookOblique",
36
+ "AvantGarde-Demi",
37
+ "AvantGarde-DemiOblique",
38
+ "Bookman-Demi",
39
+ "Bookman-DemiItalic",
40
+ "Bookman-Light",
41
+ "Bookman-LightItalic",
42
+ "Helvetica-Narrow",
43
+ "Helvetica-Narrow-Bold",
44
+ "Helvetica-Narrow-Oblique",
45
+ "Helvetica-Narrow-BoldOblique",
46
+ "NewCenturySchlbk-Roman",
47
+ "NewCenturySchlbk-Italic",
48
+ "NewCenturySchlbk-Bold",
49
+ "NewCenturySchlbk-BoldItalic",
50
+ "Palatino-Roman",
51
+ "Palatino-Italic",
52
+ "Palatino-Bold",
53
+ "Palatino-BoldItalic",
54
+ "ZapfChancery-MediumItalic",
55
+ "ZapfDingbats",
56
+ ]
57
+
58
+ text = "| Font No. | Font Name | Font No. | Font Name |\n"
59
+ text += "|:---:|:---|:---:|:---|\n"
60
+ for i in range(17):
61
+ j = i + 17
62
+ text += f"| {i} | {fonts[i]} | {j} | {fonts[j]} |\n"
63
+ text += f"| | | 34 | {fonts[34]} |\n"
64
+
65
+ display(Markdown(text))
66
+ ```
67
+
68
+ ``` {code-cell}
69
+ ---
70
+ tags: [remove-input]
71
+ ---
72
+ """
73
+ Script to generate visual samples of the fonts.
74
+ """
75
+ import pygmt
76
+
77
+ x1, x2, dx = 0, 7, 0.75
78
+
79
+ fig = pygmt.Figure()
80
+ # Draw the table
81
+ fig.basemap(region=[-0.5, 14, -1.5, 18], projection="X14c/-10c", frame=0)
82
+ fig.plot(x=[-0.5, 14], y=[-0.5, -0.5])
83
+ for x in (0.5, 6.5, 7.5):
84
+ fig.plot(x=[x, x], y=[-1.5, 18])
85
+ # Table header
86
+ fig.text(
87
+ x=[x1, x1 + dx, x2, x2 + dx],
88
+ y=[-1] * 4,
89
+ text=["#", "Font Name"] * 2,
90
+ justify=["MC", "ML"] * 2,
91
+ font="Helvetica-Bold",
92
+ )
93
+ # Fonts
94
+ for i, font in enumerate(fonts):
95
+ x0 = x1 if i < 17 else x2
96
+ y0 = i % 17
97
+ font_no, font_name = i, font
98
+
99
+ # Deal with special cases
100
+ if font in ["Symbol", "ZapfDingbats"]:
101
+ font_name = f"{font} @%0%({font})@%%"
102
+ if font == "ZapfDingbats":
103
+ font_no = "@%0%34@%%"
104
+ y0 = 17
105
+
106
+ fig.text(
107
+ x=[x0, x0 + dx],
108
+ y=[y0] * 2,
109
+ text=[font_no, font_name],
110
+ justify=["MC", "ML"],
111
+ font=font,
112
+ )
113
+ fig.show(width=600)
114
+ ```
0 commit comments