summaryrefslogtreecommitdiff
path: root/docs/pango_bidi.md
diff options
context:
space:
mode:
Diffstat (limited to 'docs/pango_bidi.md')
-rw-r--r--docs/pango_bidi.md26
1 files changed, 21 insertions, 5 deletions
diff --git a/docs/pango_bidi.md b/docs/pango_bidi.md
index 1f77c1e0..996e9781 100644
--- a/docs/pango_bidi.md
+++ b/docs/pango_bidi.md
@@ -14,23 +14,39 @@ control over bidirectional setting of text, Pango provides APIs such as
[func@unichar_direction], [func@find_base_dir], [func@get_mirror_char]
or [func@Pango.BidiType.for_unichar].
+Here is an example for mixed-direction text (shown in logical order):
+
+<picture>
+ <source srcset="bidi-input-dark.png" media="(prefers-color-scheme: dark)">
+ <img alt="mixed-direction text, logical order" src="bidi-input-light.png">
+</picture>
+
+Pango reorders the text according to the direction of the runs:
+
+<picture>
+ <source srcset="bidi-annotate-dark.png" media="(prefers-color-scheme: dark)">
+ <img alt="mixed-direction text, visual order" src="bidi-annotate-light.png">
+</picture>
+
# Vertical Text
Pango is not only capable of vertical text layout, it can handle mixed vertical
and non-vertical text correctly. This section describes the types used for setting
vertical text parameters.
-The way this is implemented is through the concept of *gravity*. Gravity of
-normal Latin text is south. A gravity value of east means that glyphs will be
-rotated ninety degrees counterclockwise. So, to render vertical text one needs
+<picture>
+ <source srcset="vertical-dark.png" media="(prefers-color-scheme: dark)">
+ <img alt="gravity west, rotated 90 degrees" align="right" valign="top" src="vertical-light.png">
+</picture>
+The way this is implemented is through the concept of *gravity*. Gravity tells glyphs which way is down, so the gravity of normal Latin text is south. A gravity value of east means that glyphs will be rotated ninety degrees
+counterclockwise. So, to render vertical text one needs
to set the gravity and rotate the layout using the matrix machinery already
in place. This has the huge advantage that most algorithms working on a
[class@Pango.Layout] do not need any change as the assumption that lines run
in the X direction and stack in the Y direction holds even for vertical text
layouts.
-Here is an example for some English text rendered with gravity west, rotated
-90 degrees: ![vertical english](vertical.png)
+Here is an example for some English text rendered with gravity west, rotated 90 degrees:
Applications should only need to set base gravity on [class@Pango.Context] in use,
and let Pango decide the gravity assigned to each run of text. This automatically