Skip to content

Commit 7c7f303

Browse files
committed
DOC: Add a note about colour font support
1 parent 0b27368 commit 7c7f303

File tree

1 file changed

+33
-0
lines changed

1 file changed

+33
-0
lines changed
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
Support for (some) colour fonts
2+
-------------------------------
3+
4+
Various colour fonts (e.g., emoji fonts) are now supported. Note, that certain
5+
newer, more complex fonts are `not yet supported
6+
<https://github.com/matplotlib/matplotlib/issues/31206>`__.
7+
8+
9+
.. plot::
10+
11+
from pathlib import Path
12+
from matplotlib.font_manager import FontProperties
13+
14+
zwj = '\U0000200D'
15+
adult = '\U0001F9D1'
16+
man = '\U0001F468'
17+
woman = '\U0001F469'
18+
science = '\U0001F52C'
19+
technology = '\U0001F4BB'
20+
skin_tones = ['', *(chr(0x1F3FB + i) for i in range(5))]
21+
22+
text = '\n'.join([
23+
''.join(person + tone + zwj + occupation for tone in skin_tones)
24+
for person in [adult, man, woman]
25+
for occupation in [science, technology]
26+
])
27+
28+
path = Path(plt.__file__).parent / 'tests/data/OpenMoji-color-glyf_colr_0-subset.ttf'
29+
30+
fig = plt.figure(figsize=(6.4, 4.8))
31+
fig.text(0.5, 0.5, text,
32+
font=FontProperties(fname=path), fontsize=48, linespacing=0.9,
33+
horizontalalignment='center', verticalalignment='center')

0 commit comments

Comments
 (0)