Skip to content

Commit 5a55bf7

Browse files
committed
docs: Enhance font documentation and add new font families
- Added a new section for "Fonts" in the documentation, including an overview and quick start guide. - Introduced detailed documentation for 9 font families, including usage examples and visual previews. - Implemented font utility functions for size and weight adjustments, enhancing typography management. - Generated high-resolution images for each font family and utility demonstration. - Updated the main documentation index to include links to the new font resources.
1 parent 4e12608 commit 5a55bf7

19 files changed

+1203
-123
lines changed

docs/conf.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,7 @@
6868
{"title": "Installation", "url": "installation/index"},
6969
{"title": "Usage Guide", "url": "usage_guide/index"},
7070
{"title": "Color System", "url": "color_system/index"},
71+
{"title": "Fonts", "url": "fonts/index"},
7172
{"title": "Examples Gallery", "url": "examples_gallery/index"},
7273
{"title": "API Reference", "url": "api/index"},
7374
]

docs/fonts/families.md

Lines changed: 270 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,270 @@
1+
# Font Families
2+
3+
dartwork-mpl bundles 9 professional font families with a total of 130 font
4+
variants. Each family is optimized for different use cases in data visualization.
5+
6+
## Roboto (Default)
7+
8+
:::{figure} images/font_roboto.png
9+
:alt: Roboto font family preview
10+
:width: 100%
11+
:::
12+
13+
Google's flagship sans-serif typeface and the **default font in dartwork-mpl**.
14+
Roboto features friendly, open curves while maintaining a mechanical skeleton,
15+
making it highly legible at all sizes.
16+
17+
**Variants:** 15 (Thin, Light, Regular, Medium, Bold, Black + Italics)
18+
19+
**Best For:**
20+
- General-purpose body text
21+
- Axis labels and tick marks
22+
- Legends and annotations
23+
24+
**Usage:**
25+
```python
26+
import matplotlib.pyplot as plt
27+
plt.rcParams['font.family'] = 'Roboto'
28+
plt.rcParams['font.weight'] = 300 # Light weight (dartwork default)
29+
```
30+
31+
---
32+
33+
## Inter
34+
35+
:::{figure} images/font_inter.png
36+
:alt: Inter font family preview
37+
:width: 100%
38+
:::
39+
40+
A modern sans-serif typeface designed specifically for computer screens. Inter
41+
features a tall x-height for improved readability at small sizes and includes
42+
many OpenType features.
43+
44+
**Variants:** 20 (Thin through Black, with Italics)
45+
46+
**Best For:**
47+
- UI-style visualizations
48+
- Presentations and slides
49+
- Screen-first publications
50+
51+
**Usage:**
52+
```python
53+
plt.rcParams['font.family'] = 'Inter'
54+
```
55+
56+
---
57+
58+
## InterDisplay
59+
60+
:::{figure} images/font_interdisplay.png
61+
:alt: InterDisplay font family preview
62+
:width: 100%
63+
:::
64+
65+
The display variant of Inter, optimized for larger sizes. Features tighter
66+
letter-spacing and refined details that shine at headline sizes.
67+
68+
**Variants:** 20 (Thin through Black, with Italics)
69+
70+
**Best For:**
71+
- Figure titles
72+
- Section headings
73+
- Large callout text
74+
75+
**Usage:**
76+
```python
77+
ax.set_title("Main Title", fontfamily='Inter Display', fontsize=24)
78+
```
79+
80+
---
81+
82+
## Noto Sans
83+
84+
:::{figure} images/font_notosans.png
85+
:alt: Noto Sans font family preview
86+
:width: 100%
87+
:::
88+
89+
Google's Noto Sans provides harmonious typography across hundreds of languages.
90+
The name "Noto" comes from "No Tofu"—the goal of eliminating the blank boxes
91+
(tofu) that appear when a font lacks a glyph.
92+
93+
**Variants:** 15 (ExtraLight through Black, with Italics)
94+
95+
**Best For:**
96+
- Multi-language documents
97+
- International publications
98+
- Unicode-heavy content
99+
100+
**Usage:**
101+
```python
102+
plt.rcParams['font.family'] = 'Noto Sans'
103+
```
104+
105+
---
106+
107+
## Noto Sans Condensed
108+
109+
:::{figure} images/font_notosans_condensed.png
110+
:alt: Noto Sans Condensed font family preview
111+
:width: 100%
112+
:::
113+
114+
The condensed variant of Noto Sans, providing the same excellent character
115+
coverage in a narrower form factor.
116+
117+
**Variants:** 20 (Thin through Black, with Italics)
118+
119+
**Best For:**
120+
- Tables with many columns
121+
- Dense data visualizations
122+
- Space-constrained layouts
123+
124+
**Usage:**
125+
```python
126+
plt.rcParams['font.family'] = 'Noto Sans Condensed'
127+
```
128+
129+
---
130+
131+
## Noto Sans SemiCondensed
132+
133+
:::{figure} images/font_notosans_semicondensed.png
134+
:alt: Noto Sans SemiCondensed font family preview
135+
:width: 100%
136+
:::
137+
138+
A middle ground between regular Noto Sans and the fully condensed variant.
139+
Offers good space efficiency while maintaining excellent readability.
140+
141+
**Variants:** 20 (Thin through Black, with Italics)
142+
143+
**Best For:**
144+
- Legends with many entries
145+
- Compact labels
146+
- Moderate space savings
147+
148+
**Usage:**
149+
```python
150+
plt.rcParams['font.family'] = 'Noto Sans SemiCondensed'
151+
```
152+
153+
---
154+
155+
## Noto Sans ExtraCondensed
156+
157+
:::{figure} images/font_notosans_extracondensed.png
158+
:alt: Noto Sans ExtraCondensed font family preview
159+
:width: 100%
160+
:::
161+
162+
The most condensed variant in the Noto Sans family. Use when space is at an
163+
absolute premium.
164+
165+
**Variants:** 20 (Thin through Black, with Italics)
166+
167+
**Best For:**
168+
- Very tight axis labels
169+
- Narrow figure margins
170+
- Maximum information density
171+
172+
**Usage:**
173+
```python
174+
plt.rcParams['font.family'] = 'Noto Sans ExtraCondensed'
175+
```
176+
177+
---
178+
179+
## Noto Sans Math
180+
181+
:::{figure} images/font_notosansmath.png
182+
:alt: Noto Sans Math font preview
183+
:width: 100%
184+
:::
185+
186+
A dedicated font for mathematical typesetting. Noto Sans Math provides
187+
comprehensive coverage of mathematical symbols, operators, and special
188+
characters used in scientific notation.
189+
190+
**Variants:** 1 (Regular only)
191+
192+
**Best For:**
193+
- Scientific equations
194+
- Mathematical notation
195+
- Greek letters and symbols
196+
197+
**Usage in dartwork-mpl:**
198+
199+
Noto Sans Math is automatically configured for mathtext rendering:
200+
201+
```python
202+
# These settings are applied by dartwork-mpl styles
203+
plt.rcParams['mathtext.fontset'] = 'custom'
204+
plt.rcParams['mathtext.rm'] = 'Noto Sans Math'
205+
plt.rcParams['mathtext.it'] = 'Noto Sans Math:italic'
206+
plt.rcParams['mathtext.bf'] = 'Noto Sans Math:bold'
207+
```
208+
209+
**Example:**
210+
```python
211+
ax.set_xlabel(r'$\alpha = \frac{\Delta x}{\Delta t}$')
212+
ax.set_ylabel(r'$\sum_{i=1}^{n} x_i^2$')
213+
```
214+
215+
---
216+
217+
## Paperlogy
218+
219+
:::{figure} images/font_paperlogy.png
220+
:alt: Paperlogy font family preview
221+
:width: 100%
222+
:::
223+
224+
A clean, professional typeface designed specifically for documents and papers.
225+
Paperlogy offers excellent readability in dense text environments typical of
226+
academic and business publications.
227+
228+
**Variants:** 9 (Light through Black)
229+
230+
**Best For:**
231+
- Academic papers
232+
- Technical reports
233+
- Professional documents
234+
235+
**Usage:**
236+
```python
237+
plt.rcParams['font.family'] = 'Paperlogy'
238+
```
239+
240+
---
241+
242+
## Font Weight Reference
243+
244+
All font families (except Noto Sans Math) include multiple weights:
245+
246+
| Weight Name | Numeric Value | Description |
247+
|-------------|---------------|-------------|
248+
| Thin | 100 | Extremely light |
249+
| ExtraLight | 200 | Very light |
250+
| Light | 300 | Light (dartwork default) |
251+
| Regular | 400 | Normal |
252+
| Medium | 500 | Slightly bold |
253+
| SemiBold | 600 | Semi-bold |
254+
| Bold | 700 | Bold |
255+
| ExtraBold | 800 | Extra bold |
256+
| Black | 900 | Maximum weight |
257+
258+
:::{figure} images/font_weights.png
259+
:alt: Font weight comparison
260+
:width: 100%
261+
:::
262+
263+
**Using Weights:**
264+
```python
265+
# Direct weight specification
266+
ax.set_title("Title", fontweight=700)
267+
268+
# Or use the fw() helper for relative weights
269+
ax.set_title("Title", fontweight=dm.fw(2)) # base + 200
270+
```

0 commit comments

Comments
 (0)