diff options
Diffstat (limited to 'src/3rdparty/harfbuzz-ng/src/hb-common.cc')
-rw-r--r-- | src/3rdparty/harfbuzz-ng/src/hb-common.cc | 161 |
1 files changed, 152 insertions, 9 deletions
diff --git a/src/3rdparty/harfbuzz-ng/src/hb-common.cc b/src/3rdparty/harfbuzz-ng/src/hb-common.cc index 7c6d26290d..0fd790bc04 100644 --- a/src/3rdparty/harfbuzz-ng/src/hb-common.cc +++ b/src/3rdparty/harfbuzz-ng/src/hb-common.cc @@ -28,8 +28,6 @@ #include "hb-private.hh" -#include "hb-version.h" - #include "hb-mutex-private.hh" #include "hb-object-private.hh" @@ -57,25 +55,45 @@ _hb_options_init (void) /* hb_tag_t */ +/** + * hb_tag_from_string: + * @str: (array length=len): + * @len: + * + * + * + * Return value: + * + * Since: 1.0 + **/ hb_tag_t -hb_tag_from_string (const char *s, int len) +hb_tag_from_string (const char *str, int len) { char tag[4]; unsigned int i; - if (!s || !len || !*s) + if (!str || !len || !*str) return HB_TAG_NONE; if (len < 0 || len > 4) len = 4; - for (i = 0; i < (unsigned) len && s[i]; i++) - tag[i] = s[i]; + for (i = 0; i < (unsigned) len && str[i]; i++) + tag[i] = str[i]; for (; i < 4; i++) tag[i] = ' '; return HB_TAG_CHAR4 (tag); } +/** + * hb_tag_to_string: + * @tag: + * @buf: (array fixed-size=4): + * + * + * + * Since: 1.0 + **/ void hb_tag_to_string (hb_tag_t tag, char *buf) { @@ -95,6 +113,17 @@ const char direction_strings[][4] = { "btt" }; +/** + * hb_direction_from_string: + * @str: (array length=len): + * @len: + * + * + * + * Return value: + * + * Since: 1.0 + **/ hb_direction_t hb_direction_from_string (const char *str, int len) { @@ -112,6 +141,16 @@ hb_direction_from_string (const char *str, int len) return HB_DIRECTION_INVALID; } +/** + * hb_direction_to_string: + * @direction: + * + * + * + * Return value: (transfer none): + * + * Since: 1.0 + **/ const char * hb_direction_to_string (hb_direction_t direction) { @@ -187,7 +226,7 @@ struct hb_language_item_t { return *this; } - void finish (void) { free (lang); } + void finish (void) { free ((void *) lang); } }; @@ -237,14 +276,27 @@ retry: } +/** + * hb_language_from_string: + * @str: (array length=len): + * @len: + * + * + * + * Return value: + * + * Since: 1.0 + **/ hb_language_t hb_language_from_string (const char *str, int len) { + char strbuf[64]; + if (!str || !len || !*str) return HB_LANGUAGE_INVALID; - if (len >= 0) { - char strbuf[64]; + if (len >= 0) + { len = MIN (len, (int) sizeof (strbuf) - 1); str = (char *) memcpy (strbuf, str, len); strbuf[len] = '\0'; @@ -255,6 +307,16 @@ hb_language_from_string (const char *str, int len) return likely (item) ? item->lang : HB_LANGUAGE_INVALID; } +/** + * hb_language_to_string: + * @language: + * + * + * + * Return value: (transfer none): + * + * Since: 1.0 + **/ const char * hb_language_to_string (hb_language_t language) { @@ -262,6 +324,15 @@ hb_language_to_string (hb_language_t language) return language->s; } +/** + * hb_language_get_default: + * + * + * + * Return value: + * + * Since: 1.0 + **/ hb_language_t hb_language_get_default (void) { @@ -279,6 +350,16 @@ hb_language_get_default (void) /* hb_script_t */ +/** + * hb_script_from_iso15924_tag: + * @tag: + * + * + * + * Return value: + * + * Since: 1.0 + **/ hb_script_t hb_script_from_iso15924_tag (hb_tag_t tag) { @@ -313,18 +394,49 @@ hb_script_from_iso15924_tag (hb_tag_t tag) return HB_SCRIPT_UNKNOWN; } +/** + * hb_script_from_string: + * @s: (array length=len): + * @len: + * + * + * + * Return value: + * + * Since: 1.0 + **/ hb_script_t hb_script_from_string (const char *s, int len) { return hb_script_from_iso15924_tag (hb_tag_from_string (s, len)); } +/** + * hb_script_to_iso15924_tag: + * @script: + * + * + * + * Return value: + * + * Since: 1.0 + **/ hb_tag_t hb_script_to_iso15924_tag (hb_script_t script) { return (hb_tag_t) script; } +/** + * hb_script_get_horizontal_direction: + * @script: + * + * + * + * Return value: + * + * Since: 1.0 + **/ hb_direction_t hb_script_get_horizontal_direction (hb_script_t script) { @@ -409,6 +521,16 @@ hb_user_data_array_t::get (hb_user_data_key_t *key) /* hb_version */ +/** + * hb_version: + * @major: (out): Library major version component. + * @minor: (out): Library minor version component. + * @micro: (out): Library micro version component. + * + * Returns library version as three integer components. + * + * Since: 1.0 + **/ void hb_version (unsigned int *major, unsigned int *minor, @@ -419,12 +541,33 @@ hb_version (unsigned int *major, *micro = HB_VERSION_MICRO; } +/** + * hb_version_string: + * + * Returns library version as a string with three components. + * + * Return value: library version string. + * + * Since: 1.0 + **/ const char * hb_version_string (void) { return HB_VERSION_STRING; } +/** + * hb_version_check: + * @major: + * @minor: + * @micro: + * + * + * + * Return value: + * + * Since: 1.0 + **/ hb_bool_t hb_version_check (unsigned int major, unsigned int minor, |