From 2606e8e02580894a483beb2f2a282b37cdf05631 Mon Sep 17 00:00:00 2001 From: Matthias Clasen Date: Mon, 9 Aug 2021 01:29:36 -0400 Subject: docs: Add an example for split cursors Show how weak and strong cursors look in practice. Fixes: #77 --- docs/meson.build | 3 +++ docs/pango.toml.in | 2 ++ docs/split-cursor-dark.png | Bin 0 -> 10603 bytes docs/split-cursor-light.png | Bin 0 -> 10248 bytes docs/split-cursor.png | Bin 0 -> 10944 bytes pango/pango-layout.c | 16 +++++++++++++++- 6 files changed, 20 insertions(+), 1 deletion(-) create mode 100644 docs/split-cursor-dark.png create mode 100644 docs/split-cursor-light.png create mode 100644 docs/split-cursor.png 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 Binary files /dev/null and b/docs/split-cursor-dark.png differ diff --git a/docs/split-cursor-light.png b/docs/split-cursor-light.png new file mode 100644 index 00000000..2ace0c18 Binary files /dev/null and b/docs/split-cursor-light.png differ diff --git a/docs/split-cursor.png b/docs/split-cursor.png new file mode 100644 index 00000000..b2be8021 Binary files /dev/null and b/docs/split-cursor.png 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. + * + * + * + * strong and weak cursors + * + * + * 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, -- cgit v1.2.1