diff --git a/doc/techref/fonts.md b/doc/techref/fonts.md new file mode 100644 index 00000000000..eaec7768c26 --- /dev/null +++ b/doc/techref/fonts.md @@ -0,0 +1,31 @@ +# Supported Fonts + +PyGMT supports the 35 standard PostScript fonts. The table below lists them with their +font numbers and font names. When specifying fonts in PyGMT, you can either give the +font name or just the font number. For example, to use the font "Helvetica", you can use +either `"Helvetica"` or `"0"`. For the special fonts "Symbol" (**12**) and +"ZapfDingbats" (**34**), see the {doc}`/techref/encodings` for the character set. +The image below the table shows a visual sample for each font. + +| Font No. | Font Name | Font No. | Font Name | +|----------|------------------------|----------|------------------------------| +| 0 | Helvetica | 17 | Bookman-Demi | +| 1 | Helvetica-Bold | 18 | Bookman-DemiItalic | +| 2 | Helvetica-Oblique | 19 | Bookman-Light | +| 3 | Helvetica-BoldOblique | 20 | Bookman-LightItalic | +| 4 | Times-Roman | 21 | Helvetica-Narrow | +| 5 | Times-Bold | 22 | Helvetica-Narrow-Bold | +| 6 | Times-Italic | 23 | Helvetica-Narrow-Oblique | +| 7 | Times-BoldItalic | 24 | Helvetica-Narrow-BoldOblique | +| 8 | Courier | 25 | NewCenturySchlbk-Roman | +| 9 | Courier-Bold | 26 | NewCenturySchlbk-Italic | +| 10 | Courier-Oblique | 27 | NewCenturySchlbk-Bold | +| 11 | Courier-BoldOblique | 28 | NewCenturySchlbk-BoldItalic | +| 12 | Symbol | 29 | Palatino-Roman | +| 13 | AvantGarde-Book | 30 | Palatino-Italic | +| 14 | AvantGarde-BookOblique | 31 | Palatino-Bold | +| 15 | AvantGarde-Demi | 32 | Palatino-BoldItalic | +| 16 | AvantGarde-DemiOblique | 33 | ZapfChancery-MediumItalic | +| | | 34 | ZapfDingbats | + +![Standard PostScript Fonts](https://docs.generic-mapping-tools.org/dev/_images/GMT_App_G.png){width="67.5%"} diff --git a/doc/techref/index.md b/doc/techref/index.md index 8ffd22fd851..dd4c9782a3c 100644 --- a/doc/techref/index.md +++ b/doc/techref/index.md @@ -9,5 +9,6 @@ visit the {gmt-docs}`GMT Technical Reference `. :maxdepth: 1 projections.md +fonts.md encodings.md ``` diff --git a/examples/gallery/symbols/text_symbols.py b/examples/gallery/symbols/text_symbols.py index e7caeabce38..98d92fa6627 100644 --- a/examples/gallery/symbols/text_symbols.py +++ b/examples/gallery/symbols/text_symbols.py @@ -2,22 +2,18 @@ Text symbols ============ -The :meth:`pygmt.Figure.plot` method allows to plot text symbols. Text is -normally placed with the :meth:`pygmt.Figure.text` method but there are times -we wish to treat a character or even a string as a plottable symbol. -A text symbol can be drawn by passing **l**\ *size*\ **+t**\ *string* to -the ``style`` parameter where *size* defines the size of the text symbol -(note: the size is only approximate; no individual scaling is done for -different characters) and *string* can be a letter or a text string -(less than 256 characters). Optionally, you can append -**+f**\ *font,outlinecolor* to select a particular font [Default is -:gmt-term:`FONT_ANNOT_PRIMARY`] and outline color [Default is black] as well -as **+j**\ *justify* to change the justification [Default is CM]. The fill -color of the text symbols can be set with the ``fill`` parameter, and the -outline width can be customized with the ``pen`` parameter. -For all supported octal codes and fonts see the GMT Technical Reference -:gmt-docs:`reference/octal-codes.html` and -:gmt-docs:`reference/postscript-fonts.html`. +The :meth:`pygmt.Figure.plot` method allows to plot text symbols. Text is normally +placed with the :meth:`pygmt.Figure.text` method but there are times we wish to treat a +character or even a string as a plottable symbol. A text symbol can be drawn by passing +**l**\ *size*\ **+t**\ *string* to the ``style`` parameter where *size* defines the size +of the text symbol (note: the size is only approximate; no individual scaling is done +for different characters) and *string* can be a letter or a text string (less than 256 +characters). Optionally, you can append **+f**\ *font,outlinecolor* to select a +particular font [Default is :gmt-term:`FONT_ANNOT_PRIMARY`] and outline color [Default +is black] as well as **+j**\ *justify* to change the justification [Default is CM]. For +all supported fonts see :doc:`/techref/fonts`. The fill color of the text symbols can be +set with the ``fill`` parameter, and the outline width can be customized with the +``pen`` parameter. """ # %% diff --git a/examples/tutorials/basics/text.py b/examples/tutorials/basics/text.py index 37b8cb4dc20..782b27a9f82 100644 --- a/examples/tutorials/basics/text.py +++ b/examples/tutorials/basics/text.py @@ -31,9 +31,9 @@ # There are several optional parameters to adjust the text label: # # * ``font``: Sets the size, family/weight, and color of the font for the text. -# A list of all recognized fonts can be found at -# :gmt-docs:`PostScript Fonts Used by GMT `, -# including details of how to use non-default fonts. +# A list of all recognized fonts can be found at :doc:`/techref/fonts`. +# For details of how to use non-default fonts, refer to +# :gmt-docs:`PostScript Fonts Used by GMT `. # * ``angle``: Specifies the rotation of the text. It is measured counter-clockwise # from the horizontal in degrees. # * ``justify``: Defines the anchor point of the bounding box for the text. It is