summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatthias Clasen <mclasen@redhat.com>2021-08-09 01:29:36 -0400
committerMatthias Clasen <mclasen@redhat.com>2021-08-09 01:29:36 -0400
commit2606e8e02580894a483beb2f2a282b37cdf05631 (patch)
tree185248260832095e436d34fa5f28c01c31196e40
parent2cad08ac322c5601d3f86e0fd676abdfcd23aea8 (diff)
downloadpango-2606e8e02580894a483beb2f2a282b37cdf05631.tar.gz
docs: Add an example for split cursors
Show how weak and strong cursors look in practice. Fixes: #77
-rw-r--r--docs/meson.build3
-rw-r--r--docs/pango.toml.in2
-rw-r--r--docs/split-cursor-dark.pngbin0 -> 10603 bytes
-rw-r--r--docs/split-cursor-light.pngbin0 -> 10248 bytes
-rw-r--r--docs/split-cursor.pngbin0 -> 10944 bytes
-rw-r--r--pango/pango-layout.c16
6 files changed, 20 insertions, 1 deletions
diff --git a/docs/meson.build b/docs/meson.build
index 37a2a9b3..6bdfc1f7 100644
--- a/docs/meson.build
+++ b/docs/meson.build
@@ -31,6 +31,9 @@ pango_content_files = [
'bidi-input-dark.png',
'bidi-annotate-light.png',
'bidi-annotate-dark.png',
+ 'split-cursor.png',
+ 'split-cursor-light.png',
+ 'split-cursor-dark.png'
]
doc_conf = configuration_data()
diff --git a/docs/pango.toml.in b/docs/pango.toml.in
index 4317adf4..f5e58194 100644
--- a/docs/pango.toml.in
+++ b/docs/pango.toml.in
@@ -90,4 +90,6 @@ content_images = [
"bidi-input-dark.png",
"bidi-annotate-light.png",
"bidi-annotate-dark.png",
+ "split-cursor-light.png",
+ "split-cursor-dark.png",
]
diff --git a/docs/split-cursor-dark.png b/docs/split-cursor-dark.png
new file mode 100644
index 00000000..141d818c
--- /dev/null
+++ b/docs/split-cursor-dark.png
Binary files differ
diff --git a/docs/split-cursor-light.png b/docs/split-cursor-light.png
new file mode 100644
index 00000000..2ace0c18
--- /dev/null
+++ b/docs/split-cursor-light.png
Binary files differ
diff --git a/docs/split-cursor.png b/docs/split-cursor.png
new file mode 100644
index 00000000..b2be8021
--- /dev/null
+++ b/docs/split-cursor.png
Binary files differ
diff --git a/pango/pango-layout.c b/pango/pango-layout.c
index 557f16f5..fa13ad59 100644
--- a/pango/pango-layout.c
+++ b/pango/pango-layout.c
@@ -2431,11 +2431,25 @@ pango_layout_get_direction (PangoLayout *layout,
* Given an index within a layout, determines the positions that of the
* strong and weak cursors if the insertion point is at that index.
*
- * The position of each cursor is stored as a zero-width rectangle.
+ * The position of each cursor is stored as a zero-width rectangle
+ * with the height of the run extents.
+ *
* The strong cursor location is the location where characters of the
* directionality equal to the base direction of the layout are inserted.
* The weak cursor location is the location where characters of the
* directionality opposite to the base direction of the layout are inserted.
+ *
+ * The following example shows text with both a strong and a weak cursor.
+ *
+ * <picture>
+ * <source srcset="split-cursor-dark.png" media="(prefers-color-scheme: dark)">
+ * <img alt="strong and weak cursors" src="split-cursor-light.png">
+ * </picture>
+ *
+ * The strong cursor has a little arrow pointing to the right, the weak
+ * cursor to the left. Typing a 'c' in this situation will insert the
+ * character after the 'b', and typing another Hebrew character, like 'ג',
+ * will insert it at the end.
*/
void
pango_layout_get_cursor_pos (PangoLayout *layout,