diff options
Diffstat (limited to 'pango')
-rw-r--r-- | pango/fonts.c | 2 | ||||
-rw-r--r-- | pango/meson.build | 1 | ||||
-rw-r--r-- | pango/pango-attributes.c | 4 | ||||
-rw-r--r-- | pango/pango-layout.c | 3 | ||||
-rw-r--r-- | pango/pango-renderer.c | 23 | ||||
-rw-r--r-- | pango/pango-renderer.h | 1 | ||||
-rw-r--r-- | pango/pango-trace-private.h | 53 | ||||
-rw-r--r-- | pango/pango-trace.c | 40 | ||||
-rw-r--r-- | pango/pangocairo-fcfontmap.c | 2 | ||||
-rw-r--r-- | pango/pangofc-fontmap.c | 24 | ||||
-rw-r--r-- | pango/pangowin32.c | 2 |
11 files changed, 130 insertions, 25 deletions
diff --git a/pango/fonts.c b/pango/fonts.c index e83abbbe..1695366b 100644 --- a/pango/fonts.c +++ b/pango/fonts.c @@ -1799,7 +1799,7 @@ pango_font_get_glyph_extents (PangoFont *font, } if (logical_rect) { - logical_rect->x = logical_rect->y = 0; + logical_rect->x = 0; logical_rect->y = - PANGO_UNKNOWN_GLYPH_HEIGHT * PANGO_SCALE; logical_rect->height = PANGO_UNKNOWN_GLYPH_HEIGHT * PANGO_SCALE; logical_rect->width = PANGO_UNKNOWN_GLYPH_WIDTH * PANGO_SCALE; diff --git a/pango/meson.build b/pango/meson.build index 11578ddf..4c055f52 100644 --- a/pango/meson.build +++ b/pango/meson.build @@ -177,6 +177,7 @@ if build_pangoft2 'pangofc-font.c', 'pangofc-fontmap.c', 'pangofc-decoder.c', + 'pango-trace.c', ] pangoot_headers = [ diff --git a/pango/pango-attributes.c b/pango/pango-attributes.c index 5f844639..12942043 100644 --- a/pango/pango-attributes.c +++ b/pango/pango-attributes.c @@ -1253,7 +1253,7 @@ pango_attr_show_new (PangoShowFlags flags) * Return value: (transfer full): the newly allocated #PangoAttribute, * which should be freed with pango_attribute_destroy(). * - * Since: 1.45 + * Since: 1.46 **/ PangoAttribute * pango_attr_overline_new (PangoOverline overline) @@ -1281,7 +1281,7 @@ pango_attr_overline_new (PangoOverline overline) * Return value: (transfer full): the newly allocated #PangoAttribute, * which should be freed with pango_attribute_destroy(). * - * Since: 1.45 + * Since: 1.46 **/ PangoAttribute * pango_attr_overline_color_new (guint16 red, diff --git a/pango/pango-layout.c b/pango/pango-layout.c index 92d858b2..7d5b9b10 100644 --- a/pango/pango-layout.c +++ b/pango/pango-layout.c @@ -3609,6 +3609,9 @@ find_hyphen_width (PangoItem *item) hb_font_t *hb_font; hb_codepoint_t glyph; + if (!item->analysis.font) + return 0; + /* This is not technically correct, since * a) we may end up inserting a different hyphen * b) we should reshape the entire run diff --git a/pango/pango-renderer.c b/pango/pango-renderer.c index 07f81a88..432875a4 100644 --- a/pango/pango-renderer.c +++ b/pango/pango-renderer.c @@ -62,6 +62,7 @@ struct _PangoRendererPrivate PangoLayoutLine *line; LineState *line_state; + PangoOverline overline; }; static void pango_renderer_finalize (GObject *gobject); @@ -319,7 +320,7 @@ handle_line_state_change (PangoRenderer *renderer, rect->width = state->logical_rect_end - rect->x; draw_overline (renderer, state); - state->overline = renderer->overline; + state->overline = renderer->priv->overline; rect->x = state->logical_rect_end; rect->width = 0; } @@ -418,14 +419,14 @@ add_overline (PangoRenderer *renderer, new_rect.height = underline_thickness; new_rect.y = base_y; - switch (renderer->overline) + switch (renderer->priv->overline) { case PANGO_OVERLINE_NONE: g_assert_not_reached (); break; case PANGO_OVERLINE_SINGLE: new_rect.y -= ascent; - if (state->overline == renderer->overline) + if (state->overline == renderer->priv->overline) { new_rect.y = MIN (current_rect->y, new_rect.y); new_rect.height = MAX (current_rect->height, new_rect.height); @@ -435,7 +436,7 @@ add_overline (PangoRenderer *renderer, break; } - if (renderer->overline == state->overline && + if (renderer->priv->overline == state->overline && new_rect.y == current_rect->y && new_rect.height == current_rect->height) { @@ -446,7 +447,7 @@ add_overline (PangoRenderer *renderer, draw_overline (renderer, state); *current_rect = new_rect; - state->overline = renderer->overline; + state->overline = renderer->priv->overline; } } @@ -626,7 +627,7 @@ pango_renderer_draw_layout_line (PangoRenderer *renderer, else { if (renderer->underline != PANGO_UNDERLINE_NONE || - renderer->overline != PANGO_OVERLINE_NONE || + renderer->priv->overline != PANGO_OVERLINE_NONE || renderer->strikethrough) { ink = &ink_rect; @@ -684,7 +685,7 @@ pango_renderer_draw_layout_line (PangoRenderer *renderer, } if (renderer->underline != PANGO_UNDERLINE_NONE || - renderer->overline != PANGO_OVERLINE_NONE || + renderer->priv->overline != PANGO_OVERLINE_NONE || renderer->strikethrough) { metrics = pango_font_get_metrics (run->item->analysis.font, @@ -695,7 +696,7 @@ pango_renderer_draw_layout_line (PangoRenderer *renderer, x + x_off, y - rise, ink, logical); - if (renderer->overline != PANGO_OVERLINE_NONE) + if (renderer->priv->overline != PANGO_OVERLINE_NONE) add_overline (renderer, &state,metrics, x + x_off, y - rise, ink, logical); @@ -712,7 +713,7 @@ pango_renderer_draw_layout_line (PangoRenderer *renderer, state.underline != PANGO_UNDERLINE_NONE) draw_underline (renderer, &state); - if (renderer->overline == PANGO_OVERLINE_NONE && + if (renderer->priv->overline == PANGO_OVERLINE_NONE && state.overline != PANGO_OVERLINE_NONE) draw_overline (renderer, &state); @@ -1449,7 +1450,7 @@ pango_renderer_default_prepare_run (PangoRenderer *renderer, GSList *l; renderer->underline = PANGO_UNDERLINE_NONE; - renderer->overline = PANGO_OVERLINE_NONE; + renderer->priv->overline = PANGO_OVERLINE_NONE; renderer->strikethrough = FALSE; for (l = run->item->analysis.extra_attrs; l; l = l->next) @@ -1463,7 +1464,7 @@ pango_renderer_default_prepare_run (PangoRenderer *renderer, break; case PANGO_ATTR_OVERLINE: - renderer->overline = ((PangoAttrInt *)attr)->value; + renderer->priv->overline = ((PangoAttrInt *)attr)->value; break; case PANGO_ATTR_STRIKETHROUGH: diff --git a/pango/pango-renderer.h b/pango/pango-renderer.h index 4dae6a92..89107fd1 100644 --- a/pango/pango-renderer.h +++ b/pango/pango-renderer.h @@ -77,7 +77,6 @@ struct _PangoRenderer GObject parent_instance; PangoUnderline underline; - PangoOverline overline; gboolean strikethrough; int active_count; diff --git a/pango/pango-trace-private.h b/pango/pango-trace-private.h new file mode 100644 index 00000000..5d2a4fdf --- /dev/null +++ b/pango/pango-trace-private.h @@ -0,0 +1,53 @@ +/* Pango + * pango-trace-private.h: + * + * Copyright (C) 2020 Red Hat, Inc + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library. If not, see <http://www.gnu.org/licenses/>. + */ + +#pragma once + + +#ifdef HAVE_SYSPROF +#include <sysprof-capture.h> +#endif + +#include <glib.h> + +G_BEGIN_DECLS + +#ifdef HAVE_SYSPROF +#define PANGO_TRACE_CURRENT_TIME SYSPROF_CAPTURE_CURRENT_TIME +#else +#define PANGO_TRACE_CURRENT_TIME 0 +#endif + +void pango_trace_mark (gint64 begin_time, + const gchar *name, + const gchar *message_format, + ...) G_GNUC_PRINTF (3, 4); + +#ifndef HAVE_SYSPROF +/* Optimise the whole call out */ +#if defined(G_HAVE_ISO_VARARGS) +#define g_trace_mark(b, n, m, ...) +#elif defined(G_HAVE_GNUC_VARARGS) +#define g_trace_mark(b, n, m...) +#else +/* no varargs macro support; the call will have to be optimised out by the compiler */ +#endif +#endif + +G_END_DECLS diff --git a/pango/pango-trace.c b/pango/pango-trace.c new file mode 100644 index 00000000..9f37376d --- /dev/null +++ b/pango/pango-trace.c @@ -0,0 +1,40 @@ +/* Pango + * pango-trace.c: + * + * Copyright (C) 2020 Red Hat, Inc + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library. If not, see <http://www.gnu.org/licenses/>. + */ + +#include "config.h" + +#include "pango-trace-private.h" + +#include <stdarg.h> + +void +(pango_trace_mark) (gint64 begin_time, + const gchar *name, + const gchar *message_format, + ...) +{ +#ifdef HAVE_SYSPROF + gint64 end_time = PANGO_TRACE_CURRENT_TIME; + va_list args; + + va_start (args, message_format); + sysprof_collector_mark_vprintf (begin_time, end_time - begin_time, "Pango", name, message_format, args); + va_end (args); +#endif /* HAVE_SYSPROF */ +} diff --git a/pango/pangocairo-fcfontmap.c b/pango/pangocairo-fcfontmap.c index bd3a8583..015b8170 100644 --- a/pango/pangocairo-fcfontmap.c +++ b/pango/pangocairo-fcfontmap.c @@ -103,7 +103,7 @@ pango_cairo_fc_font_map_fontset_key_substitute (PangoFcFontMap *fcfontmap G_G PangoFcFontsetKey *fontkey, FcPattern *pattern) { - FcConfigSubstitute (NULL, pattern, FcMatchPattern); + FcConfigSubstitute (pango_fc_font_map_get_config (fcfontmap), pattern, FcMatchPattern); if (fontkey) cairo_ft_font_options_substitute (pango_fc_fontset_key_get_context_key (fontkey), diff --git a/pango/pangofc-fontmap.c b/pango/pangofc-fontmap.c index ec504094..4c2aa094 100644 --- a/pango/pangofc-fontmap.c +++ b/pango/pangofc-fontmap.c @@ -848,7 +848,10 @@ filter_fontset_by_format (FcFontSet *fontset) for (i = 0; i < fontset->nfont; i++) { if (pango_fc_is_supported_font_format (fontset->fonts[i])) - FcFontSetAdd (result, FcPatternDuplicate (fontset->fonts[i])); + { + FcPatternReference (fontset->fonts[i]); + FcFontSetAdd (result, fontset->fonts[i]); + } } return result; @@ -873,16 +876,21 @@ pango_fc_patterns_get_font_pattern (PangoFcPatterns *pats, int i, gboolean *prep if (!pats->fontset) { FcResult result; - FcFontSet *fontset; - FcFontSet *filtered; + FcFontSet *filtered[2] = { NULL, }; + int i, n = 0; - fontset = FcFontSort (pats->fontmap->priv->config, pats->pattern, FcFalse, NULL, &result); - filtered = filter_fontset_by_format (fontset); - FcFontSetDestroy (fontset); + for (i = 0; i < 2; i++) + { + FcFontSet *fonts = FcConfigGetFonts (pats->fontmap->priv->config, i); + if (fonts) + filtered[n++] = filter_fontset_by_format (fonts); + } + + pats->fontset = FcFontSetSort (pats->fontmap->priv->config, filtered, n, pats->pattern, FcTrue, NULL, &result); - pats->fontset = FcFontSetSort (pats->fontmap->priv->config, &filtered, 1, pats->pattern, FcTrue, NULL, &result); + for (i = 0; i < n; i++) + FcFontSetDestroy (filtered[i]); - FcFontSetDestroy (filtered); if (pats->match) { diff --git a/pango/pangowin32.c b/pango/pangowin32.c index 8849d4af..213a665e 100644 --- a/pango/pangowin32.c +++ b/pango/pangowin32.c @@ -269,7 +269,7 @@ pango_win32_render (HDC hdc, dX = g_new (INT, glyphs->num_glyphs); /* Render glyphs using one ExtTextOutW() call for each run of glyphs - * that have the same y offset. The big majoroty of glyphs will have + * that have the same y offset. The big majority of glyphs will have * y offset of zero, so in general, the whole glyph string will be * rendered by one call to ExtTextOutW(). * |