From d2c62958dcb3744f273264b0ba5b71b77a89a1c0 Mon Sep 17 00:00:00 2001 From: Behdad Esfahbod Date: Fri, 31 Mar 2006 01:42:54 +0000 Subject: Hook up pango-utils.h into the documentation, as we are installing it 2006-03-30 Behdad Esfahbod Hook up pango-utils.h into the documentation, as we are installing it anyway. Move some internal stuff to pango-impl-utils.h and make source files include that instead. --- ChangeLog | 6 ++ docs/Makefile.am | 4 +- docs/pango-docs.sgml | 2 + docs/pango-sections.txt | 23 +++++ docs/tmpl/utils.sgml | 204 +++++++++++++++++++++++++++++++++++++++++++ pango/fonts.c | 3 +- pango/glyphstring.c | 2 +- pango/modules.c | 1 - pango/pango-attributes.c | 2 +- pango/pango-color.c | 2 +- pango/pango-context.c | 2 +- pango/pango-fontmap.c | 2 +- pango/pango-fontset.c | 1 - pango/pango-impl-utils.h | 8 ++ pango/pango-item.c | 2 +- pango/pango-layout.c | 2 +- pango/pango-markup.c | 2 +- pango/pango-ot-info.c | 2 +- pango/pango-ot-ruleset.c | 2 +- pango/pango-tabs.c | 2 +- pango/pango-utils.c | 53 +++++++---- pango/pango-utils.h | 9 +- pango/pangoatsui-fontmap.c | 2 +- pango/pangocairo-fcfont.c | 2 +- pango/pangocairo-font.c | 3 +- pango/pangocairo-fontmap.c | 2 +- pango/pangocairo-win32font.c | 2 +- pango/pangofc-font.c | 2 +- pango/pangofc-fontmap.c | 2 +- pango/pangoft2-fontmap.c | 2 +- pango/pangowin32-fontmap.c | 2 +- pango/pangowin32.c | 2 +- pango/pangox-fontmap.c | 2 +- pango/pangox.c | 2 +- pango/querymodules.c | 2 +- pango/testfonts.c | 2 +- 36 files changed, 309 insertions(+), 56 deletions(-) create mode 100644 docs/tmpl/utils.sgml diff --git a/ChangeLog b/ChangeLog index 824ccb42..d714f61b 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2006-03-30 Behdad Esfahbod + + Hook up pango-utils.h into the documentation, as we are installing + it anyway. Move some internal stuff to pango-impl-utils.h and make + source files include that instead. + 2006-03-30 Tor Lillqvist Fix blurred underlines on Win32 (#332656): diff --git a/docs/Makefile.am b/docs/Makefile.am index 775d303c..560939a3 100644 --- a/docs/Makefile.am +++ b/docs/Makefile.am @@ -19,9 +19,8 @@ CFILE_GLOB=$(top_srcdir)/pango/*.c # Headers to ignore IGNORE_HFILES= \ mini-fribidi \ - mini-xft \ - module-defs.h \ opentype \ + module-defs.h \ modules.h \ pangocairo-private.h \ pangocairo-fc.h \ @@ -33,7 +32,6 @@ IGNORE_HFILES= \ pango-glyph-item-private.h \ pango-layout-private.h \ pango-script-table.h \ - pango-utils.h \ pangofc-private.h \ pangoft2-private.h \ pangowin32-private.h \ diff --git a/docs/pango-docs.sgml b/docs/pango-docs.sgml index 9623b20c..7dbbc10d 100644 --- a/docs/pango-docs.sgml +++ b/docs/pango-docs.sgml @@ -23,6 +23,7 @@ + @@ -66,6 +67,7 @@ &PangoEngineLang; &PangoEngineShape; &pango-Modules; + &pango-Misc-Utils; diff --git a/docs/pango-sections.txt b/docs/pango-sections.txt index 72799bcb..cffccd68 100644 --- a/docs/pango-sections.txt +++ b/docs/pango-sections.txt @@ -923,3 +923,26 @@ pango_ot_ruleset_substitute pango_ot_ruleset_position +
+Miscellaneous Utilities +utils +pango_split_file_list +pango_trim_string +pango_read_line +pango_skip_space +pango_scan_word +pango_scan_string +pango_scan_int +pango_config_key_get +pango_lookup_aliases +pango_parse_style +pango_parse_variant +pango_parse_weight +pango_parse_stretch +pango_get_sysconf_subdirectory +pango_get_lib_subdirectory +pango_log2vis_get_embedding_levels +pango_language_get_sample_string +pango_is_zero_width +pango_quantize_line_geometry +
diff --git a/docs/tmpl/utils.sgml b/docs/tmpl/utils.sgml new file mode 100644 index 00000000..48a03c3f --- /dev/null +++ b/docs/tmpl/utils.sgml @@ -0,0 +1,204 @@ + +Miscellaneous Utilities + + +Various convenience and utility functions + + + +The functions and utilities in this section are mostly used from Pango +backends and modules, but may be useful for other purposes too. + + + + + + + + + + + + +@str: +@style: +@warn: +@Returns: + + + + + + + +@str: +@weight: +@warn: +@Returns: + + + + + + + +@ch: +@Returns: + + + + + + + +@pos: +@out: +@Returns: + + + + + + + +@Returns: + + + + + + + +@thickness: +@position: + + + + + + + +@language: +@Returns: + + + + + + + +@pos: +@Returns: + + + + + + + +@str: +@variant: +@warn: +@Returns: + + + + + + + +@pos: +@out: +@Returns: + + + + + + + +@stream: +@str: +@Returns: + + + + + + + +@key: +@Returns: + + + + + + + +@pos: +@out: +@Returns: + + + + + + + +@Returns: + + + + + + + +@str: +@Returns: + + + + + + + +@text: +@length: +@pbase_dir: +@Returns: + +@str: +@bytelen: + + + + + + + +@str: +@stretch: +@warn: +@Returns: + + + + + + + +@fontname: +@families: +@n_families: + + + + + + + +@str: +@Returns: + + diff --git a/pango/fonts.c b/pango/fonts.c index c9ae0555..8c14d717 100644 --- a/pango/fonts.c +++ b/pango/fonts.c @@ -24,11 +24,10 @@ #include #include -#include "pango-impl-utils.h" #include "pango-types.h" #include "pango-font.h" #include "pango-fontmap.h" -#include "pango-utils.h" +#include "pango-impl-utils.h" struct _PangoFontDescription { diff --git a/pango/glyphstring.c b/pango/glyphstring.c index e28abbd0..541e9002 100644 --- a/pango/glyphstring.c +++ b/pango/glyphstring.c @@ -23,7 +23,7 @@ #include #include #include -#include +#include /** * pango_glyph_string_new: diff --git a/pango/modules.c b/pango/modules.c index df928690..4c272098 100644 --- a/pango/modules.c +++ b/pango/modules.c @@ -30,7 +30,6 @@ #include "pango-enum-types.h" #include "pango-modules.h" -#include "pango-utils.h" #include "pango-impl-utils.h" typedef struct _PangoModule PangoModule; diff --git a/pango/pango-attributes.c b/pango/pango-attributes.c index 05d50528..06bc75f7 100644 --- a/pango/pango-attributes.c +++ b/pango/pango-attributes.c @@ -24,7 +24,7 @@ #include #include "pango-attributes.h" -#include "pango-utils.h" +#include "pango-impl-utils.h" struct _PangoAttrList { diff --git a/pango/pango-color.c b/pango/pango-color.c index 8bb4aef8..a471b4ce 100644 --- a/pango/pango-color.c +++ b/pango/pango-color.c @@ -25,7 +25,7 @@ #include #include "pango-attributes.h" -#include "pango-utils.h" +#include "pango-impl-utils.h" GType pango_color_get_type (void) diff --git a/pango/pango-context.c b/pango/pango-context.c index 0e3fb1e5..f2fd921c 100644 --- a/pango/pango-context.c +++ b/pango/pango-context.c @@ -24,7 +24,7 @@ #include #include "pango/pango-context.h" -#include "pango/pango-utils.h" +#include "pango/pango-impl-utils.h" #include "pango-engine.h" #include "pango-engine-private.h" diff --git a/pango/pango-fontmap.c b/pango/pango-fontmap.c index 409da2f9..b0498d30 100644 --- a/pango/pango-fontmap.c +++ b/pango/pango-fontmap.c @@ -21,7 +21,7 @@ #include #include "pango-fontmap.h" -#include "pango-utils.h" +#include "pango-impl-utils.h" #include static PangoFontset *pango_font_map_real_load_fontset (PangoFontMap *fontmap, diff --git a/pango/pango-fontset.c b/pango/pango-fontset.c index dee12de4..b437e14a 100644 --- a/pango/pango-fontset.c +++ b/pango/pango-fontset.c @@ -29,7 +29,6 @@ #include "pango-font.h" #include "pango-fontset.h" #include "pango-impl-utils.h" -#include "pango-utils.h" static PangoFontMetrics *pango_fontset_real_get_metrics (PangoFontset *fontset); diff --git a/pango/pango-impl-utils.h b/pango/pango-impl-utils.h index 7e1d3136..ebc4406d 100644 --- a/pango/pango-impl-utils.h +++ b/pango/pango-impl-utils.h @@ -21,8 +21,10 @@ */ #ifndef __PANGO_IMPL_UTILS_H__ +#define __PANGO_IMPL_UTILS_H__ #include +#include G_BEGIN_DECLS @@ -74,6 +76,7 @@ prefix ## _get_type (void) \ +/* Warning history. Used to not spew some warnings more than once. */ typedef struct _PangoWarningHistory PangoWarningHistory; struct _PangoWarningHistory { @@ -84,6 +87,11 @@ struct _PangoWarningHistory { extern PangoWarningHistory _pango_warning_history; + +/* String interning for static strings */ +#define I_(string) g_intern_static_string (string) + + G_END_DECLS #endif /* __PANGO_IMPL_UTILS_H__ */ diff --git a/pango/pango-item.c b/pango/pango-item.c index 844cd098..c6f1715a 100644 --- a/pango/pango-item.c +++ b/pango/pango-item.c @@ -22,7 +22,7 @@ #include #include #include -#include +#include /** * pango_item_new: diff --git a/pango/pango-layout.c b/pango/pango-layout.c index ab0b9fb3..a1592354 100644 --- a/pango/pango-layout.c +++ b/pango/pango-layout.c @@ -24,7 +24,7 @@ #include #include #include -#include +#include #include #include "pango-layout-private.h" diff --git a/pango/pango-markup.c b/pango/pango-markup.c index 73e980bb..b640c60f 100644 --- a/pango/pango-markup.c +++ b/pango/pango-markup.c @@ -26,7 +26,7 @@ #include #include -#include +#include /* FIXME */ #define _(x) x diff --git a/pango/pango-ot-info.c b/pango/pango-ot-info.c index 8d3841a1..d17ed569 100644 --- a/pango/pango-ot-info.c +++ b/pango/pango-ot-info.c @@ -22,7 +22,7 @@ #include #include "pango-ot-private.h" -#include "pango-utils.h" +#include "pango-impl-utils.h" #include FT_MODULE_H static void pango_ot_info_class_init (GObjectClass *object_class); diff --git a/pango/pango-ot-ruleset.c b/pango/pango-ot-ruleset.c index e50b2a1e..03bcaf56 100644 --- a/pango/pango-ot-ruleset.c +++ b/pango/pango-ot-ruleset.c @@ -22,7 +22,7 @@ #include #include "pango-ot-private.h" -#include "pango-utils.h" +#include "pango-impl-utils.h" typedef struct _PangoOTRule PangoOTRule; diff --git a/pango/pango-tabs.c b/pango/pango-tabs.c index d2821b5b..2f3a49b6 100644 --- a/pango/pango-tabs.c +++ b/pango/pango-tabs.c @@ -21,7 +21,7 @@ #include #include "pango-tabs.h" -#include "pango-utils.h" +#include "pango-impl-utils.h" #include typedef struct _PangoTab PangoTab; diff --git a/pango/pango-utils.c b/pango/pango-utils.c index 5f7a206f..c344507b 100644 --- a/pango/pango-utils.c +++ b/pango/pango-utils.c @@ -25,9 +25,8 @@ #include #include -#include "pango-impl-utils.h" -#include "pango-utils.h" #include "pango-font.h" +#include "pango-impl-utils.h" #include @@ -694,7 +693,7 @@ pango_parse_style (const char *str, /** * pango_parse_variant: * @str: a string to parse. - * @style: a #PangoVariant to store the result in. + * @variant: a #PangoVariant to store the result in. * @warn: if %TRUE, issue a g_warning() on bad input. * * Parses a font variant. The allowed values are "normal" @@ -740,7 +739,7 @@ pango_parse_variant (const char *str, /** * pango_parse_weight: * @str: a string to parse. - * @style: a #PangoWeight to store the result in. + * @weight: a #PangoWeight to store the result in. * @warn: if %TRUE, issue a g_warning() on bad input. * * Parses a font weight. The allowed values are "heavy", @@ -836,7 +835,7 @@ pango_parse_weight (const char *str, /** * pango_parse_stretch: * @str: a string to parse. - * @style: a #PangoStretch to store the result in. + * @stretch: a #PangoStretch to store the result in. * @warn: if %TRUE, issue a g_warning() on bad input. * * Parses a font stretch. The allowed values are @@ -1401,9 +1400,29 @@ pango_language_get_sample_string (PangoLanguage *language) return result; } +/** + * pango_log2vis_get_embedding_levels: + * @text: the text to itemize. + * @length: the number of bytes (not characters) to process, or -1 + * if @text is nul-terminated and the legnth should be calculated. + * @pbase_dir: input base direction, and output resolved direction. + * + * This will return the bidirectional embedding levels of the input paragraph + * as defined by the Unicode Bidirectional Algorithm available at: + * + * http://www.unicode.org/reports/tr9/ + * + * If the input base direction is a weak direction, the direction of the + * characters in the text will determine the final resolved direction. + * + * Return value: a newly allocated array of embedding levels, one item per + * character (not byte), that should be freed using g_free. + * + * Since: 1.4 + */ guint8 * -pango_log2vis_get_embedding_levels (const gchar *str, - int bytelen, +pango_log2vis_get_embedding_levels (const gchar *text, + int length, PangoDirection *pbase_dir) { FriBidiCharType fribidi_base_dir; @@ -1433,15 +1452,15 @@ pango_log2vis_get_embedding_levels (const gchar *str, #ifdef FRIBIDI_HAVE_UTF8 { - if (bytelen < 0) - bytelen = strlen (str); - embedding_levels_list = fribidi_log2vis_get_embedding_levels_new_utf8 (str, bytelen, &fribidi_base_dir); + if (length < 0) + length = strlen (text); + embedding_levels_list = fribidi_log2vis_get_embedding_levels_new_utf8 (text, length, &fribidi_base_dir); } #else { gunichar *text_ucs4; int n_chars; - text_ucs4 = g_utf8_to_ucs4_fast (str, bytelen, &n_chars); + text_ucs4 = g_utf8_to_ucs4_fast (text, length, &n_chars); embedding_levels_list = g_new (guint8, n_chars); fribidi_log2vis_get_embedding_levels ((FriBidiChar*)text_ucs4, n_chars, &fribidi_base_dir, @@ -1698,13 +1717,11 @@ pango_load_aliases (void) * @fontname: an ascii string * @families: will be set to an array of font family names. * this array is owned by pango and should not be freed. + * @n_families: will be set to the length of the @families array. * - * Look up all user defined aliases for the alias #fontname. - * The resulting font family names will be stored in #families, - * and the number of families will be returned. - * - * Return value: the number of font famillies stored in the #families argument. - * This value is owned by Pango and must not be freed. + * Look up all user defined aliases for the alias @fontname. + * The resulting font family names will be stored in @families, + * and the number of families in @n_families. **/ void pango_lookup_aliases (const char *fontname, @@ -1814,7 +1831,7 @@ pango_is_zero_width (gunichar ch) * * Quantizes the thickness and position of a line, typically an * underline or strikethrough, to whole device pixels, that is - * multiplies of PANGO_SCALE. The purpose of this function is to avoid + * multiplies of %PANGO_SCALE. The purpose of this function is to avoid * such lines looking blurry. * * Since: 1.12 diff --git a/pango/pango-utils.h b/pango/pango-utils.h index bc130532..13df824c 100644 --- a/pango/pango-utils.h +++ b/pango/pango-utils.h @@ -88,8 +88,8 @@ G_CONST_RETURN char * pango_get_lib_subdirectory (void); /* A routine from fribidi that we either wrap or provide ourselves. */ -guint8 * pango_log2vis_get_embedding_levels (const gchar *str, - int bytelen, +guint8 * pango_log2vis_get_embedding_levels (const gchar *text, + int length, PangoDirection *pbase_dir); G_CONST_RETURN char *pango_language_get_sample_string (PangoLanguage *language); @@ -99,9 +99,8 @@ G_CONST_RETURN char *pango_language_get_sample_string (PangoLanguage *language); */ gboolean pango_is_zero_width (gunichar ch) G_GNUC_CONST; -/* String interning for static strings */ -#define I_(string) g_intern_static_string (string) - +/* Hint line position and thickness. + */ void pango_quantize_line_geometry (int *thickness, int *position); diff --git a/pango/pangoatsui-fontmap.c b/pango/pangoatsui-fontmap.c index 340334a3..c69fe005 100644 --- a/pango/pangoatsui-fontmap.c +++ b/pango/pangoatsui-fontmap.c @@ -24,7 +24,7 @@ #include "pango-fontmap.h" #include "pangoatsui-private.h" -#include "pango-utils.h" +#include "pango-impl-utils.h" #include "modules.h" #import diff --git a/pango/pangocairo-fcfont.c b/pango/pangocairo-fcfont.c index 31a91afb..e37766bd 100644 --- a/pango/pangocairo-fcfont.c +++ b/pango/pangocairo-fcfont.c @@ -30,7 +30,7 @@ #include "pangocairo-private.h" #include "pangocairo-fc.h" #include "pangofc-private.h" -#include "pango-utils.h" +#include "pango-impl-utils.h" #define PANGO_TYPE_CAIRO_FC_FONT (pango_cairo_fc_font_get_type ()) #define PANGO_CAIRO_FC_FONT(object) (G_TYPE_CHECK_INSTANCE_CAST ((object), PANGO_TYPE_CAIRO_FC_FONT, PangoCairoFcFont)) diff --git a/pango/pangocairo-font.c b/pango/pangocairo-font.c index cba260fd..8c68922c 100644 --- a/pango/pangocairo-font.c +++ b/pango/pangocairo-font.c @@ -23,10 +23,9 @@ #include -#include "pango-impl-utils.h" #include "pangocairo.h" #include "pangocairo-private.h" -#include "pango-utils.h" +#include "pango-impl-utils.h" PangoCairoWarningHistory _pango_cairo_warning_history = { FALSE }; diff --git a/pango/pangocairo-fontmap.c b/pango/pangocairo-fontmap.c index b7525b1a..1fc665e1 100644 --- a/pango/pangocairo-fontmap.c +++ b/pango/pangocairo-fontmap.c @@ -23,7 +23,7 @@ #include "pangocairo.h" #include "pangocairo-private.h" -#include "pango-utils.h" +#include "pango-impl-utils.h" #if defined (HAVE_CAIRO_ATSUI) # include "pangocairo-atsui.h" diff --git a/pango/pangocairo-win32font.c b/pango/pangocairo-win32font.c index 67c71202..4de0d2b4 100644 --- a/pango/pangocairo-win32font.c +++ b/pango/pangocairo-win32font.c @@ -26,7 +26,7 @@ #include #include "pango-fontmap.h" -#include "pango-utils.h" +#include "pango-impl-utils.h" #include "pangocairo-private.h" #include "pangocairo-win32.h" diff --git a/pango/pangofc-font.c b/pango/pangofc-font.c index 1724f12f..e3585acf 100644 --- a/pango/pangofc-font.c +++ b/pango/pangofc-font.c @@ -26,7 +26,7 @@ #include "pangofc-private.h" #include "pango-layout.h" #include "pango-modules.h" -#include "pango-utils.h" +#include "pango-impl-utils.h" #include diff --git a/pango/pangofc-fontmap.c b/pango/pangofc-fontmap.c index 654edbe2..8871866b 100644 --- a/pango/pangofc-fontmap.c +++ b/pango/pangofc-fontmap.c @@ -28,7 +28,7 @@ #include "pango-context.h" #include "pangofc-fontmap.h" #include "pangofc-private.h" -#include "pango-utils.h" +#include "pango-impl-utils.h" #include "modules.h" typedef struct _PangoFcCoverageKey PangoFcCoverageKey; diff --git a/pango/pangoft2-fontmap.c b/pango/pangoft2-fontmap.c index c0da2992..aee61af1 100644 --- a/pango/pangoft2-fontmap.c +++ b/pango/pangoft2-fontmap.c @@ -30,7 +30,7 @@ #include -#include "pango-utils.h" +#include "pango-impl-utils.h" #include "pangoft2-private.h" #include "pangofc-fontmap.h" diff --git a/pango/pangowin32-fontmap.c b/pango/pangowin32-fontmap.c index 8949a54a..dd4e8d32 100644 --- a/pango/pangowin32-fontmap.c +++ b/pango/pangowin32-fontmap.c @@ -30,7 +30,7 @@ #include #include "pango-fontmap.h" -#include "pango-utils.h" +#include "pango-impl-utils.h" #include "pangowin32-private.h" #include "modules.h" diff --git a/pango/pangowin32.c b/pango/pangowin32.c index a04c4553..8e43f01b 100644 --- a/pango/pangowin32.c +++ b/pango/pangowin32.c @@ -27,7 +27,7 @@ #include #include -#include "pango-utils.h" +#include "pango-impl-utils.h" #include "pangowin32.h" #include "pangowin32-private.h" diff --git a/pango/pangox-fontmap.c b/pango/pangox-fontmap.c index e5bdb9c0..5f86585c 100644 --- a/pango/pangox-fontmap.c +++ b/pango/pangox-fontmap.c @@ -33,7 +33,7 @@ #include "pango-engine-private.h" #include "pango-fontmap.h" -#include "pango-utils.h" +#include "pango-impl-utils.h" #undef PANGO_DISABLE_DEPRECATED diff --git a/pango/pangox.c b/pango/pangox.c index d382df0c..841c51e3 100644 --- a/pango/pangox.c +++ b/pango/pangox.c @@ -25,7 +25,7 @@ #include #include -#include "pango-utils.h" +#include "pango-impl-utils.h" #include "modules.h" #undef PANGO_DISABLE_DEPRECATED diff --git a/pango/querymodules.c b/pango/querymodules.c index 72dd2183..63939006 100644 --- a/pango/querymodules.c +++ b/pango/querymodules.c @@ -26,7 +26,7 @@ #include #include "pango-break.h" #include "pango-context.h" -#include "pango-utils.h" +#include "pango-impl-utils.h" #include "pango-engine.h" #include "pango-enum-types.h" diff --git a/pango/testfonts.c b/pango/testfonts.c index 63f2a223..a3674a03 100644 --- a/pango/testfonts.c +++ b/pango/testfonts.c @@ -26,7 +26,7 @@ #include #include #include "pango.h" -#include "pango-utils.h" +#include "pango-impl-utils.h" #include "pangowin32.h" -- cgit v1.2.1