File tree Expand file tree Collapse file tree 1 file changed +33
-0
lines changed
doc/release/next_whats_new Expand file tree Collapse file tree 1 file changed +33
-0
lines changed Original file line number Diff line number Diff line change 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 = '\U 0000200D'
15+ adult = '\U 0001F9D1'
16+ man = '\U 0001F468'
17+ woman = '\U 0001F469'
18+ science = '\U 0001F52C'
19+ technology = '\U 0001F4BB'
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')
You can’t perform that action at this time.
0 commit comments