diff options
-rw-r--r-- | pango/fonts.c | 2 | ||||
-rw-r--r-- | pango/meson.build | 48 | ||||
-rw-r--r-- | pango/pango-ot-buffer.c | 14 | ||||
-rw-r--r-- | pango/pango-ot-ruleset.c | 4 | ||||
-rw-r--r-- | pango/pango-ot.h | 10 | ||||
-rw-r--r-- | pango/pangocairo-context.c | 2 | ||||
-rw-r--r-- | pango/pangocairo-font.c | 2 | ||||
-rw-r--r-- | pango/pangocairo.h | 2 | ||||
-rw-r--r-- | pango/pangofc-font.c | 6 | ||||
-rw-r--r-- | pango/pangofc-fontmap.c | 25 | ||||
-rw-r--r-- | pango/pangoft2.c | 13 | ||||
-rw-r--r-- | pango/pangoxft-font.c | 26 | ||||
-rw-r--r-- | tests/test-break.c | 31 | ||||
-rw-r--r-- | tests/test-itemize.c | 32 | ||||
-rw-r--r-- | tests/test-layout.c | 30 | ||||
-rw-r--r-- | utils/meson.build | 2 |
16 files changed, 176 insertions, 73 deletions
diff --git a/pango/fonts.c b/pango/fonts.c index f4244911..e83abbbe 100644 --- a/pango/fonts.c +++ b/pango/fonts.c @@ -2319,7 +2319,7 @@ pango_font_family_real_get_face (PangoFontFamily *family, /** * pango_font_family_get_face: * @family: a #PangoFontFamily - * @name: (optional): the name of a face. If the name is %NULL, + * @name: (nullable): the name of a face. If the name is %NULL, * the family's default face (fontconfig calls it "Regular") * will be returned. * diff --git a/pango/meson.build b/pango/meson.build index b2496373..ad7fb798 100644 --- a/pango/meson.build +++ b/pango/meson.build @@ -160,11 +160,9 @@ endif pkgconfig.generate(libpango, name: 'Pango', description: 'Internationalized text handling', - version: meson.project_version(), requires: pango_pkg_requires, filebase: 'pango', subdirs: pango_api_name, - install_dir: join_paths(pango_libdir, 'pkgconfig'), ) # FreeType @@ -240,8 +238,8 @@ if build_pangoft2 dependencies: [ libpango_dep, pango_gir_dep ], namespace: 'PangoFc', nsversion: pango_api_version, - identifier_prefix: 'PangoFc', - symbol_prefix: 'pango_fc', + identifier_prefix: 'Pango', + symbol_prefix: 'pango', export_packages: 'pangofc', includes: [ pango_gir[0], 'fontconfig-2.0', ], header: 'pango/pangofc-fontmap.h', @@ -258,8 +256,8 @@ if build_pangoft2 dependencies: [ libpango_dep, pango_gir_dep, pangofc_gir_dep ], namespace: 'PangoOT', nsversion: pango_api_version, - identifier_prefix: 'PangoOT', - symbol_prefix: 'pango_ot', + identifier_prefix: 'Pango', + symbol_prefix: 'pango', export_packages: 'pangoot', includes: [ pangofc_gir[0], 'freetype2-2.0', ], header: 'pango/pango-ot.h', @@ -275,8 +273,8 @@ if build_pangoft2 dependencies: [ libpango_dep, pango_gir_dep, pangofc_gir_dep, pangoot_gir_dep ], namespace: 'PangoFT2', nsversion: pango_api_version, - identifier_prefix: 'PangoFT2', - symbol_prefix: 'pango_ft2', + identifier_prefix: 'Pango', + symbol_prefix: 'pango', export_packages: 'pangoft2', includes: [ pangofc_gir[0], 'freetype2-2.0', ], header: 'pango/pangoft2.h', @@ -297,11 +295,27 @@ if build_pangoft2 pkgconfig.generate(libpangoft2, name: 'Pango FT2 and Pango Fc', description: 'Freetype 2.0 and fontconfig font support for Pango', - version: meson.project_version(), filebase: 'pangoft2', subdirs: pango_api_name, requires: [ 'pango', freetype2_pc, fontconfig_pc ], - install_dir: join_paths(pango_libdir, 'pkgconfig'), + ) + + # Since we split the introspection data, we also need a split pkg-config + # file for Vala + pkgconfig.generate( + name: 'Pango OT', + description: 'OpenType font support for Pango (deprecated)', + filebase: 'pangoot', + subdirs: pango_api_name, + requires: [ 'pangoft2' ], + ) + + pkgconfig.generate( + name: 'Pango FC', + description: 'Fontconfig support for Pango', + filebase: 'pangofc', + subdirs: pango_api_name, + requires: [ 'pangoft2' ], ) else # For usage as a subproject @@ -349,8 +363,8 @@ if xft_dep.found() and fontconfig_dep.found() dependencies: [ libpango_dep, libpangoft2_dep, pango_gir_dep, pangoot_gir_dep, pangoft2_gir_dep ], namespace: 'PangoXft', nsversion: pango_api_version, - identifier_prefix: 'PangoXft', - symbol_prefix: 'pango_xft', + identifier_prefix: 'Pango', + symbol_prefix: 'pango', export_packages: 'pangoxft', includes: [ pango_gir[0], pangoot_gir[0], pangoft2_gir[0], 'GObject-2.0', 'xft-2.0', 'xlib-2.0' ], header: 'pango/pangoxft.h', @@ -370,11 +384,9 @@ if xft_dep.found() and fontconfig_dep.found() pkgconfig.generate(libpangoxft, name: 'Pango Xft', description: 'Xft font support for Pango', - version: meson.project_version(), filebase: 'pangoxft', subdirs: pango_api_name, requires: [ 'pangoft2', 'xft' ], - install_dir: join_paths(pango_libdir, 'pkgconfig'), ) else # For usage as a subproject @@ -431,11 +443,9 @@ if host_system == 'windows' pkgconfig.generate(libpangowin32, name: 'Pango Win32', description: 'Win32 GDI font support for Pango', - version: meson.project_version(), filebase: 'pangowin32', subdirs: pango_api_name, requires: 'pango', - install_dir: join_paths(pango_libdir, 'pkgconfig'), ) else # For usage as a subproject @@ -518,8 +528,8 @@ if cairo_dep.found() dependencies: [ pangocairo_deps, pango_gir_dep ], namespace: 'PangoCairo', nsversion: pango_api_version, - identifier_prefix: 'PangoCairo', - symbol_prefix: 'pango_cairo', + identifier_prefix: 'Pango', + symbol_prefix: 'pango', export_packages: 'pangocairo', includes: [ pango_gir[0], 'GObject-2.0', 'cairo-1.0' ], header: 'pango/pangocairo.h', @@ -547,11 +557,9 @@ if cairo_dep.found() pkgconfig.generate(libpangocairo, name: 'Pango Cairo', description: 'Cairo rendering support for Pango', - version: meson.project_version(), filebase: 'pangocairo', subdirs: pango_api_name, requires: pango_cairo_requires, - install_dir: join_paths(pango_libdir, 'pkgconfig'), ) else # For usage as a subproject diff --git a/pango/pango-ot-buffer.c b/pango/pango-ot-buffer.c index 334df746..bec4365a 100644 --- a/pango/pango-ot-buffer.c +++ b/pango/pango-ot-buffer.c @@ -23,6 +23,20 @@ #include "pango-ot-private.h" +static PangoOTBuffer * +pango_ot_buffer_copy (PangoOTBuffer *src) +{ + PangoOTBuffer *dst = g_slice_new (PangoOTBuffer); + + dst->buffer = hb_buffer_reference (src->buffer); + + return dst; +} + +G_DEFINE_BOXED_TYPE (PangoOTBuffer, pango_ot_buffer, + pango_ot_buffer_copy, + pango_ot_buffer_destroy) + /** * pango_ot_buffer_new * @font: a #PangoFcFont diff --git a/pango/pango-ot-ruleset.c b/pango/pango-ot-ruleset.c index 36bf65a2..9df8faef 100644 --- a/pango/pango-ot-ruleset.c +++ b/pango/pango-ot-ruleset.c @@ -364,6 +364,10 @@ pango_ot_ruleset_description_equal (const PangoOTRulesetDescription *desc1, return TRUE; } +G_DEFINE_BOXED_TYPE (PangoOTRulesetDescription, pango_ot_ruleset_description, + pango_ot_ruleset_description_copy, + pango_ot_ruleset_description_free) + /** * pango_ot_ruleset_description_copy: * @desc: ruleset description to copy diff --git a/pango/pango-ot.h b/pango/pango-ot.h index 501ca8b6..2c9f42d5 100644 --- a/pango/pango-ot.h +++ b/pango/pango-ot.h @@ -300,6 +300,11 @@ PangoOTTag *pango_ot_info_list_features (PangoOTInfo *info, guint script_index, guint language_index); +#define PANGO_TYPE_OT_BUFFER (pango_ot_buffer_get_type()) + +PANGO_DEPRECATED +GType pango_ot_buffer_get_type (void) G_GNUC_CONST; + PANGO_DEPRECATED PangoOTBuffer *pango_ot_buffer_new (PangoFcFont *font); PANGO_DEPRECATED @@ -378,6 +383,11 @@ PangoLanguage *pango_ot_tag_to_language (PangoOTTag language_tag) G_GNUC_ PANGO_DEPRECATED PangoOTTag pango_ot_tag_from_language (PangoLanguage *language) G_GNUC_CONST; +#define PANGO_TYPE_OT_RULESET_DESCRIPTION (pango_ot_ruleset_description_get_type()) + +PANGO_DEPRECATED +GType pango_ot_ruleset_description_get_type (void) G_GNUC_CONST; + PANGO_DEPRECATED guint pango_ot_ruleset_description_hash (const PangoOTRulesetDescription *desc) G_GNUC_PURE; diff --git a/pango/pangocairo-context.c b/pango/pangocairo-context.c index 5949c448..d2e66c4b 100644 --- a/pango/pangocairo-context.c +++ b/pango/pangocairo-context.c @@ -374,7 +374,7 @@ pango_cairo_context_set_shape_renderer (PangoContext *context, * attributes of type %PANGO_ATTR_SHAPE as set by * pango_cairo_context_set_shape_renderer(), if any. * - * Return value: (nullable): the shape rendering callback previously + * Return value: (transfer none) (nullable): the shape rendering callback previously * set on the context, or %NULL if no shape rendering callback have * been set. * diff --git a/pango/pangocairo-font.c b/pango/pangocairo-font.c index a49d14d4..1cadd005 100644 --- a/pango/pangocairo-font.c +++ b/pango/pangocairo-font.c @@ -143,7 +143,7 @@ done: * The scaled font can be referenced and kept using * cairo_scaled_font_reference(). * - * Return value: (nullable): the #cairo_scaled_font_t used by @font, + * Return value: (transfer none) (nullable): the #cairo_scaled_font_t used by @font, * or %NULL if @font is %NULL. * * Since: 1.18 diff --git a/pango/pangocairo.h b/pango/pangocairo.h index d15d879b..cd368f8f 100644 --- a/pango/pangocairo.h +++ b/pango/pangocairo.h @@ -64,7 +64,7 @@ typedef struct _PangoCairoFontMap PangoCairoFontMap; * path of @cr and no filling/stroking done. This will be set * to %TRUE when called from pango_cairo_layout_path() and * pango_cairo_layout_line_path() rendering functions. - * @data: user data passed to pango_cairo_context_set_shape_renderer() + * @data: (closure): user data passed to pango_cairo_context_set_shape_renderer() * * Function type for rendering attributes of type %PANGO_ATTR_SHAPE * with Pango's Cairo renderer. diff --git a/pango/pangofc-font.c b/pango/pangofc-font.c index 72b9931d..4b6a34f7 100644 --- a/pango/pangofc-font.c +++ b/pango/pangofc-font.c @@ -533,14 +533,14 @@ pango_fc_font_real_get_glyph (PangoFcFont *font, } /** - * pango_fc_font_lock_face: + * pango_fc_font_lock_face: (skip) * @font: a #PangoFcFont. * - * Gets the FreeType <type>FT_Face</type> associated with a font, + * Gets the FreeType `FT_Face` associated with a font, * This face will be kept around until you call * pango_fc_font_unlock_face(). * - * Return value: the FreeType <type>FT_Face</type> associated with @font. + * Return value: the FreeType `FT_Face` associated with @font. * * Since: 1.4 * Deprecated: 1.44: Use pango_font_get_hb_font() instead diff --git a/pango/pangofc-fontmap.c b/pango/pangofc-fontmap.c index 9ecea09b..b0c8365d 100644 --- a/pango/pangofc-fontmap.c +++ b/pango/pangofc-fontmap.c @@ -2021,9 +2021,9 @@ pango_fc_font_map_config_changed (PangoFcFontMap *fcfontmap) } /** - * pango_fc_font_map_set_config: + * pango_fc_font_map_set_config: (skip) * @fcfontmap: a #PangoFcFontMap - * @fcconfig: (nullable): a #FcConfig, or %NULL + * @fcconfig: (nullable): a `FcConfig`, or %NULL * * Set the FcConfig for this font map to use. The default value * is %NULL, which causes Fontconfig to use its global "current config". @@ -2065,12 +2065,14 @@ pango_fc_font_map_set_config (PangoFcFontMap *fcfontmap, } /** - * pango_fc_font_map_get_config: + * pango_fc_font_map_get_config: (skip) * @fcfontmap: a #PangoFcFontMap * - * Fetches FcConfig attached to a font map. See pango_fc_font_map_set_config(). + * Fetches the `FcConfig` attached to a font map. * - * Returns: (nullable): the #FcConfig object attached to @fcfontmap, which + * See also: pango_fc_font_map_set_config() + * + * Returns: (nullable): the `FcConfig` object attached to @fcfontmap, which * might be %NULL. * * Since: 1.38 @@ -2247,7 +2249,7 @@ _pango_fc_font_map_fc_to_coverage (FcCharSet *charset) * needed for correct operation on the #PangoContext after calling * this function. * - * Return value: a new #PangoContext + * Return value: (transfer full): a new #PangoContext * * Since: 1.4 * @@ -2940,6 +2942,17 @@ pango_fc_family_init (PangoFcFamily *fcfamily) fcfamily->n_faces = -1; } +/** + * pango_fc_font_map_get_hb_face: (skip) + * @fcfontmap: a #PangoFcFontMap + * @fcfont: a #PangoFcFont + * + * Retrieves the `hb_face_t` for the given #PangoFcFont. + * + * Returns: (transfer none) (nullable): the `hb_face_t` for the given Pango font + * + * Since: 1.44 + */ hb_face_t * pango_fc_font_map_get_hb_face (PangoFcFontMap *fcfontmap, PangoFcFont *fcfont) diff --git a/pango/pangoft2.c b/pango/pangoft2.c index b6467981..2fe49171 100644 --- a/pango/pangoft2.c +++ b/pango/pangoft2.c @@ -159,19 +159,18 @@ set_transform (PangoFT2Font *ft2font) } /** - * pango_ft2_font_get_face: + * pango_ft2_font_get_face: (skip) * @font: a #PangoFont * - * Returns the native FreeType2 <type>FT_Face</type> structure used for this #PangoFont. + * Returns the native FreeType2 `FT_Face` structure used for this #PangoFont. * This may be useful if you want to use FreeType2 functions directly. * * Use pango_fc_font_lock_face() instead; when you are done with a * face from pango_fc_font_lock_face() you must call * pango_fc_font_unlock_face(). * - * Return value: (nullable): a pointer to a <type>FT_Face</type> - * structure, with the size set correctly, or %NULL if - * @font is %NULL. + * Return value: (nullable): a pointer to a `FT_Face` structure, with the + * size set correctly, or %NULL if @font is %NULL. **/ FT_Face pango_ft2_font_get_face (PangoFont *font) @@ -476,10 +475,10 @@ pango_ft2_font_finalize (GObject *object) /** * pango_ft2_font_get_coverage: - * @font: a <type>PangoFT2Font</type>. + * @font: a Pango FT2 font * @language: a language tag. * - * Gets the #PangoCoverage for a <type>PangoFT2Font</type>. Use + * Gets the #PangoCoverage for a `PangoFT2Font`. Use * pango_font_get_coverage() instead. * * Return value: (transfer full): a #PangoCoverage. diff --git a/pango/pangoxft-font.c b/pango/pangoxft-font.c index 2526b13d..45418c15 100644 --- a/pango/pangoxft-font.c +++ b/pango/pangoxft-font.c @@ -499,13 +499,13 @@ pango_xft_font_real_shutdown (PangoFcFont *fcfont) } /** - * pango_xft_font_get_font: + * pango_xft_font_get_font: (skip) * @font: (nullable): a #PangoFont. * - * Returns the XftFont of a font. + * Returns the `XftFont` of a font. * - * Return value: (nullable): the XftFont associated to @font, or %NULL - * if @font is %NULL. + * Return value: (nullable): the `XftFont` associated to @font, + * or %NULL if @font is %NULL. **/ XftFont * pango_xft_font_get_font (PangoFont *font) @@ -517,12 +517,12 @@ pango_xft_font_get_font (PangoFont *font) } /** - * pango_xft_font_get_display: + * pango_xft_font_get_display: (skip) * @font: a #PangoFont. * - * Returns the X display of the XftFont of a font. + * Returns the X display of the `XftFont` of a font. * - * Return value: the X display of the XftFont associated to @font. + * Return value: (transfer none): the X display of the XftFont associated to @font. **/ Display * pango_xft_font_get_display (PangoFont *font) @@ -560,16 +560,16 @@ pango_xft_font_get_unknown_glyph (PangoFont *font, } /** - * pango_xft_font_lock_face: + * pango_xft_font_lock_face: (skip) * @font: a #PangoFont. * - * Gets the FreeType <type>FT_Face</type> associated with a font, - * This face will be kept around until you call - * pango_xft_font_unlock_face(). + * Gets the FreeType `FT_Face` associated with a font. + * + * This face will be kept around until you call pango_xft_font_unlock_face(). * * Use pango_fc_font_lock_face() instead. * - * Return value: the FreeType <type>FT_Face</type> associated with @font. + * Return value: the FreeType `FT_Face` associated with @font. * * Since: 1.2 **/ @@ -582,7 +582,7 @@ pango_xft_font_lock_face (PangoFont *font) } /** - * pango_xft_font_unlock_face: + * pango_xft_font_unlock_face: (skip) * @font: a #PangoFont. * * Releases a font previously obtained with diff --git a/tests/test-break.c b/tests/test-break.c index 3258cb98..aec36008 100644 --- a/tests/test-break.c +++ b/tests/test-break.c @@ -241,6 +241,19 @@ test_break (gconstpointer d) GString *dump; gchar *diff; + const char *old_locale = setlocale (LC_ALL, NULL); + setlocale (LC_ALL, "en_US.utf8"); + if (strstr (setlocale (LC_ALL, NULL), "en_US") == NULL) + { + char *msg = g_strdup_printf ("Locale en_US.UTF-8 not available, skipping break %s", filename); + g_test_skip (msg); + g_free (msg); + return; + } + + if (context == NULL) + context = pango_font_map_create_context (pango_cairo_font_map_get_default ()); + expected_file = get_expected_filename (filename); dump = g_string_sized_new (0); @@ -250,11 +263,22 @@ test_break (gconstpointer d) diff = diff_with_file (expected_file, dump->str, dump->len, &error); g_assert_no_error (error); + setlocale (LC_ALL, old_locale); + if (diff && diff[0]) { + char **lines = g_strsplit (diff, "\n", -1); + const char *line; + int i = 0; + g_test_message ("Contents don't match expected contents"); - g_test_message ("%s", diff); + + for (line = lines[0]; line != NULL; line = lines[++i]) + g_test_message ("%s", line); + g_test_fail (); + + g_strfreev (lines); g_free (diff); } @@ -270,13 +294,8 @@ main (int argc, char *argv[]) const gchar *name; gchar *path; - g_setenv ("LC_ALL", "en_US.UTF-8", TRUE); - setlocale (LC_ALL, ""); - g_test_init (&argc, &argv, NULL); - context = pango_font_map_create_context (pango_cairo_font_map_get_default ()); - /* allow to easily generate expected output for new test cases */ if (argc > 1) { diff --git a/tests/test-itemize.c b/tests/test-itemize.c index 167e4e80..3c58e18f 100644 --- a/tests/test-itemize.c +++ b/tests/test-itemize.c @@ -110,7 +110,7 @@ test_file (const gchar *filename, GString *string) gchar *contents; gsize length; GError *error = NULL; - GString *s1, *s2, *s3, *s4, *s5, *s6; + GString *s1, *s2, *s3, *s4, *s5, *s6; char *test; char *text; PangoAttrList *attrs; @@ -237,6 +237,18 @@ test_itemize (gconstpointer d) GString *dump; gchar *diff; + const char *old_locale = setlocale (LC_ALL, NULL); + setlocale (LC_ALL, "en_US.utf8"); + if (strstr (setlocale (LC_ALL, NULL), "en_US") == NULL) + { + char *msg = g_strdup_printf ("Locale en_US.UTF-8 not available, skipping itemization %s", filename); + g_test_skip (msg); + g_free (msg); + return; + } + + context = pango_font_map_create_context (pango_cairo_font_map_get_default ()); + expected_file = get_expected_filename (filename); dump = g_string_sized_new (0); @@ -246,11 +258,22 @@ test_itemize (gconstpointer d) diff = diff_with_file (expected_file, dump->str, dump->len, &error); g_assert_no_error (error); + setlocale (LC_ALL, old_locale); + if (diff && diff[0]) { + char **lines = g_strsplit (diff, "\n", -1); + const char *line; + int i = 0; + g_test_message ("Contents don't match expected contents"); - g_test_message ("%s", diff); + + for (line = lines[0]; line != NULL; line = lines[++i]) + g_test_message ("%s", line); + g_test_fail (); + + g_strfreev (lines); g_free (diff); } @@ -266,13 +289,8 @@ main (int argc, char *argv[]) const gchar *name; gchar *path; - g_setenv ("LC_ALL", "en_US.UTF-8", TRUE); - setlocale (LC_ALL, ""); - g_test_init (&argc, &argv, NULL); - context = pango_font_map_create_context (pango_cairo_font_map_get_default ()); - /* allow to easily generate expected output for new test cases */ if (argc > 1) { diff --git a/tests/test-layout.c b/tests/test-layout.c index 2fc78240..52617ce6 100644 --- a/tests/test-layout.c +++ b/tests/test-layout.c @@ -304,6 +304,19 @@ test_layout (gconstpointer d) GString *dump; gchar *diff; + const char *old_locale = setlocale (LC_ALL, NULL); + setlocale (LC_ALL, "en_US.utf8"); + if (strstr (setlocale (LC_ALL, NULL), "en_US") == NULL) + { + char *msg = g_strdup_printf ("Locale en_US.UTF-8 not available, skipping layout %s", filename); + g_test_skip (msg); + g_free (msg); + return; + } + + if (context == NULL) + context = pango_font_map_create_context (pango_cairo_font_map_get_default ()); + expected_file = get_expected_filename (filename); dump = g_string_sized_new (0); @@ -313,11 +326,21 @@ test_layout (gconstpointer d) diff = diff_with_file (expected_file, dump->str, dump->len, &error); g_assert_no_error (error); + setlocale (LC_ALL, old_locale); + if (diff && diff[0]) { + char **lines = g_strsplit (diff, "\n", -1); + const char *line; + int i = 0; + g_test_message ("Contents don't match expected contents"); - g_test_message ("%s", diff); + + for (line = lines[0]; line != NULL; line = lines[++i]) + g_test_message ("%s", line); + g_test_fail (); + g_strfreev (lines); g_free (diff); } @@ -333,13 +356,8 @@ main (int argc, char *argv[]) const gchar *name; gchar *path; - g_setenv ("LC_ALL", "en_US.UTF-8", TRUE); - setlocale (LC_ALL, ""); - g_test_init (&argc, &argv, NULL); - context = pango_font_map_create_context (pango_cairo_font_map_get_default ()); - /* allow to easily generate expected output for new test cases */ if (argc > 1) { diff --git a/utils/meson.build b/utils/meson.build index 510d1b7e..b71cfe2a 100644 --- a/utils/meson.build +++ b/utils/meson.build @@ -47,7 +47,7 @@ if help2man.found() and not meson.is_cross_build() '--no-info', '--section=1', '--help-option=--help-all', - '--name=Pango text viewer', + '--name="Pango text viewer"', ] custom_target('pango-view.1', |