diff options
author | Behdad Esfahbod <behdad@gnome.org> | 2006-12-07 03:40:54 +0000 |
---|---|---|
committer | Behdad Esfahbod <behdad@src.gnome.org> | 2006-12-07 03:40:54 +0000 |
commit | d6956a1ad956ad4f5322059fff7baac70ea3c039 (patch) | |
tree | a2fc3a3c05e4753f4ad73893a840ffaa41a4e498 /pango/pango-utils.c | |
parent | 5b6f118ba4b87c2d9ba834620b11c3f44119dce1 (diff) | |
download | pango-d6956a1ad956ad4f5322059fff7baac70ea3c039.tar.gz |
New generated public header file pango-features.h. Currently contains the
2006-12-06 Behdad Esfahbod <behdad@gnome.org>
* configure.in:
* pango/Makefile.am:
New generated public header file pango-features.h. Currently contains
the version information. In the future, can be expanded to define
which backends have been enabled, etc.
* pango/pango.def:
* pango/pango-utils.h:
* pango/pango-utils.c:
New public macros and functions: PANGO_VERSION_ENCODE(),
PANGO_VERSION_MAJOR, PANGO_VERSION_MINOR, PANGO_VERSION_MICRO,
PANGO_VERSION, PANGO_VERSION_STRING, PANGO_VERSION_CHECK(),
pango_version(), pango_version_string(), pango_version_check().
* docs/pango-docs.sgml:
* docs/pango-sections.txt:
* docs/tmpl/pango-version.sgml:
Docs for new symbols, in a new section.
* examples/renderdemo.c (show_version):
If run-time Pango lib version is different than the compile-time one,
show that one too.
* pango/pango.h:
#include <pango-utils.h> as well as almost all other public pango-*.h
headers (though, the other ones were already included indirectly).
The only public pango-*.h header pango.h shouldn't include are
pango-ot.h (which is really misnamed) and pango-modules.h (that should
not be needed by 99.99% users anyway).
* docs/Makefile.am:
* docs/check.docs: Test to check that all symbols are documented and
properly hooked into documentation tree.
* pango/pango.rc.in:
* pango/pangoft2.rc.in:
* pango/pangowin32.rc.in:
Update, reflecting some internal symbol changes.
* pango/check.defs: Improve.
Diffstat (limited to 'pango/pango-utils.c')
-rw-r--r-- | pango/pango-utils.c | 91 |
1 files changed, 90 insertions, 1 deletions
diff --git a/pango/pango-utils.c b/pango/pango-utils.c index d0acc836..cb1a5e58 100644 --- a/pango/pango-utils.c +++ b/pango/pango-utils.c @@ -27,6 +27,7 @@ #include <locale.h> #include "pango-font.h" +#include "pango-features.h" #include "pango-impl-utils.h" #include <glib/gstdio.h> @@ -61,6 +62,93 @@ static GHashTable *pango_aliases_ht = NULL; PangoWarningHistory _pango_warning_history = { FALSE, FALSE, FALSE }; /** + * pango_version: + * + * This is similar to the macro %PANGO_VERSION except that + * it returns the encoded version of Pango available at run-time, + * as opposed to the version available at compile-time. + * + * A version number can be encoded into an integer using + * PANGO_VERSION_ENCODE(). + * + * Returns value: The encoded version of Pango library + * available at run time. + * + * Since: 1.16 + **/ +int +pango_version (void) +{ + return PANGO_VERSION; +} + +/** + * pango_version_string: + * + * This is similar to the macro %PANGO_VERSION_STRING except that + * it returns the version of Pango available at run-time, as opposed to + * the version available at compile-time. + * + * Returns value: A string containing the version of Pango library + * available at run time. + * The returned string is owned by Pango and should not be modified + * or freed. + * + * Since: 1.16 + **/ +const char * +pango_version_string (void) +{ + return PANGO_VERSION_STRING; +} + +/** + * pango_version_check: + * @required_major: the required major version. + * @required_minor: the required minor version. + * @required_micro: the required major version. + * + * Checks that the Pango library in use is compatible with the + * given version. Generally you would pass in the constants + * %PANGO_VERSION_MAJOR, %PANGO_VERSION_MINOR, %PANGO_VERSION_MICRO + * as the three arguments to this function; that produces + * a check that the library in use at run-time is compatible with + * the version of Pango the application or module was compiled against. + * + * Compatibility is defined by two things: first the version + * of the running library is newer than the version + * @required_major.required_minor.@required_micro. Second + * the running library must be binary compatible with the + * version @required_major.required_minor.@required_micro + * (same major version.) + * + * For compile-time version checking use PANGO_VERSION_CHECK(). + * + * Return value: %NULL if the Pango library is compatible with the + * given version, or a string describing the version mismatch. + * The returned string is owned by Pango and should not be modified + * or freed. + * + * Since: 1.16 + **/ +const gchar* +pango_version_check (int required_major, + int required_minor, + int required_micro) +{ + gint pango_effective_micro = 100 * PANGO_VERSION_MINOR + PANGO_VERSION_MICRO; + gint required_effective_micro = 100 * required_minor + required_micro; + + if (required_major < PANGO_VERSION_MAJOR) + return "Pango version too new (major mismatch)"; + if (required_effective_micro < pango_effective_micro - PANGO_BINARY_AGE) + return "Pango version too new (micro mismatch)"; + if (required_effective_micro > pango_effective_micro) + return "Pango version too old (micro mismatch)"; + return NULL; +} + +/** * pango_trim_string: * @str: a string * @@ -1727,7 +1815,7 @@ pango_quantize_line_geometry (int *thickness, * Converts a #PangoGravity value to its rotation value. * * Return value: the rotation value corresponding to @gravity, - * or zero if @gravity is #PANGO_GRAVITY_AUTO + * or zero if @gravity is %PANGO_GRAVITY_AUTO * * Since: 1.16 */ @@ -1747,3 +1835,4 @@ pango_gravity_to_rotation (PangoGravity gravity) return rotation; } + |