Skip to content

Commit 0e0de18

Browse files
committed
DOC: Add What's New entry for complex text layout
1 parent 94eecab commit 0e0de18

File tree

1 file changed

+42
-0
lines changed

1 file changed

+42
-0
lines changed

doc/users/next_whats_new/libraqm.rst

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
Complex text layout with libraqm
2+
--------------------------------
3+
4+
Text support has been extended to include complex text layout. This support includes:
5+
6+
1. Languages that require advanced layout, such as Arabic or Hebrew.
7+
2. Text that mixes left-to-right and right-to-left languages.
8+
9+
.. plot::
10+
:show-source-link: False
11+
12+
text = 'Here is some رَقْم in اَلْعَرَبِيَّةُ'
13+
fig = plt.figure(figsize=(6, 1))
14+
fig.text(0.5, 0.5, text, size=32, ha='center', va='center')
15+
16+
3. Ligatures that combine several adjacent characters for improved legibility.
17+
18+
.. plot::
19+
:show-source-link: False
20+
21+
text = 'f\N{Hair Space}f\N{Hair Space}i \N{Rightwards Arrow} ffi'
22+
fig = plt.figure(figsize=(3, 1))
23+
fig.text(0.5, 0.5, text, size=32, ha='center', va='center')
24+
25+
4. Combining multiple or double-width diacritics.
26+
27+
.. plot::
28+
:show-source-link: False
29+
30+
text = (
31+
'a\N{Combining Circumflex Accent}\N{Combining Double Tilde}'
32+
'c\N{Combining Diaeresis}')
33+
text = ' + '.join(
34+
c if c in 'ac' else f'\N{Dotted Circle}{c}'
35+
for c in text) + f' \N{Rightwards Arrow} {text}'
36+
fig = plt.figure(figsize=(6, 1))
37+
fig.text(0.5, 0.5, text, size=32, ha='center', va='center',
38+
# Builtin DejaVu Sans doesn't support multiple diacritics.
39+
family=['Noto Sans', 'DejaVu Sans'])
40+
41+
Note, all advanced features require corresponding font support, and may require
42+
additional fonts over the builtin DejaVu Sans.

0 commit comments

Comments
 (0)