diff options
-rw-r--r-- | NEWS | 2 | ||||
-rw-r--r-- | docs/meson.build | 3 | ||||
-rw-r--r-- | docs/pango.toml.in | 2 | ||||
-rw-r--r-- | docs/split-cursor-dark.png | bin | 0 -> 10603 bytes | |||
-rw-r--r-- | docs/split-cursor-light.png | bin | 0 -> 10248 bytes | |||
-rw-r--r-- | docs/split-cursor.png | bin | 0 -> 10944 bytes | |||
-rw-r--r-- | pango/pango-layout.c | 21 | ||||
-rw-r--r-- | pango/pango-markup.c | 2 | ||||
-rw-r--r-- | pango/pangowin32-fontmap.c | 22 | ||||
-rw-r--r-- | pango/shape.c | 12 | ||||
-rw-r--r-- | tests/testmisc.c | 7 |
11 files changed, 63 insertions, 8 deletions
@@ -12,6 +12,8 @@ Overview of changes * markup: Allow specifying size and rise in points (#67) * markup: Allow specifying size as percentage (#23) * Rewrite pango_layout_move_cursor_visually (#157, #585, #587) +* Add a line-height attribute and make logical + line extents respect it Overview of changes in 1.48.7 ============================= 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 Binary files differnew file mode 100644 index 00000000..141d818c --- /dev/null +++ b/docs/split-cursor-dark.png diff --git a/docs/split-cursor-light.png b/docs/split-cursor-light.png Binary files differnew file mode 100644 index 00000000..2ace0c18 --- /dev/null +++ b/docs/split-cursor-light.png diff --git a/docs/split-cursor.png b/docs/split-cursor.png Binary files differnew file mode 100644 index 00000000..b2be8021 --- /dev/null +++ b/docs/split-cursor.png diff --git a/pango/pango-layout.c b/pango/pango-layout.c index bf9be496..fa13ad59 100644 --- a/pango/pango-layout.c +++ b/pango/pango-layout.c @@ -2001,9 +2001,8 @@ pango_layout_line_get_cursors (PangoLayoutLine *line, * of a run. * * Motion here is in cursor positions, not in characters, so a single - * call to [method@Pango.Layout.move_cursor_visually] may move the cursor - * over multiple characters when multiple characters combine to form a - * single grapheme. + * call to this function may move the cursor over multiple characters + * when multiple characters combine to form a single grapheme. */ void pango_layout_move_cursor_visually (PangoLayout *layout, @@ -2432,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, diff --git a/pango/pango-markup.c b/pango/pango-markup.c index 00b16943..91def193 100644 --- a/pango/pango-markup.c +++ b/pango/pango-markup.c @@ -1671,7 +1671,7 @@ span_parse_func (MarkupData *md G_GNUC_UNUSED, if (!span_parse_float ("line_height", line_height, &f, line_number, error)) goto error; - if (f > 1024.0 && strchr (line_height, ".") == 0) + if (f > 1024.0 && strchr (line_height, '.') == 0) add_attribute (tag, pango_attr_line_height_new_absolute ((int)f)); else add_attribute (tag, pango_attr_line_height_new (f)); diff --git a/pango/pangowin32-fontmap.c b/pango/pangowin32-fontmap.c index b6341f52..200ea9ce 100644 --- a/pango/pangowin32-fontmap.c +++ b/pango/pangowin32-fontmap.c @@ -1037,19 +1037,35 @@ pango_win32_font_map_load_font (PangoFontMap *fontmap, win32family = g_hash_table_lookup (win32fontmap->families, families[i]); if (win32family) { + PangoFontDescription *new_desc; + PangoFontDescription *best_desc = NULL; + PING (("got win32family")); tmp_list = win32family->faces; + while (tmp_list) { PangoWin32Face *face = tmp_list->data; + new_desc = pango_font_face_describe (PANGO_FONT_FACE (face)); + pango_font_description_set_gravity (new_desc, + pango_font_description_get_gravity (description)); if (pango_font_description_better_match (description, - best_match ? best_match->description : NULL, - face->description)) - best_match = face; + best_desc, + new_desc)) + { + pango_font_description_free (best_desc); + best_desc = new_desc; + best_match = face; + } + else + pango_font_description_free (new_desc); tmp_list = tmp_list->next; } + + if (best_desc != NULL) + pango_font_description_free (best_desc); } } diff --git a/pango/shape.c b/pango/shape.c index f8ac3691..aed028b7 100644 --- a/pango/shape.c +++ b/pango/shape.c @@ -341,5 +341,17 @@ pango_shape_with_flags (const gchar *item_text, #undef HINT } } + else + { + for (i = 0; i < glyphs->num_glyphs; i++) + { + glyphs->glyphs[i].geometry.width = + PANGO_UNITS_ROUND (glyphs->glyphs[i].geometry.width); + glyphs->glyphs[i].geometry.x_offset = + PANGO_UNITS_ROUND (glyphs->glyphs[i].geometry.x_offset); + glyphs->glyphs[i].geometry.y_offset = + PANGO_UNITS_ROUND (glyphs->glyphs[i].geometry.y_offset); + } + } } } diff --git a/tests/testmisc.c b/tests/testmisc.c index 54566f78..d8275aad 100644 --- a/tests/testmisc.c +++ b/tests/testmisc.c @@ -22,7 +22,10 @@ #include "config.h" #include <glib.h> #include <pango/pangocairo.h> + +#ifdef HAVE_CAIRO_FREETYPE #include <pango/pango-ot.h> +#endif /* test that we don't crash in shape_tab when the layout * is such that we don't have effective attributes @@ -245,6 +248,7 @@ test_gravity_for_script (void) } } +#ifdef HAVE_CAIRO_FREETYPE G_GNUC_BEGIN_IGNORE_DEPRECATIONS static void @@ -264,6 +268,7 @@ test_language_to_tag (void) } G_GNUC_END_IGNORE_DEPRECATIONS +#endif static void test_fallback_shape (void) @@ -383,7 +388,9 @@ main (int argc, char *argv[]) g_test_add_func ("/gravity/from-matrix", test_gravity_from_matrix); g_test_add_func ("/gravity/for-script", test_gravity_for_script); g_test_add_func ("/layout/fallback-shape", test_fallback_shape); +#ifdef HAVE_CAIRO_FREETYPE g_test_add_func ("/language/to-tag", test_language_to_tag); +#endif g_test_add_func ("/bidi/get-cursor-crash", test_get_cursor_crash); g_test_add_func ("/bidi/get-cursor", test_get_cursor); |