Index: third_party/harfbuzz-ng/src/hb-common.cc |
diff --git a/third_party/harfbuzz-ng/src/hb-common.cc b/third_party/harfbuzz-ng/src/hb-common.cc |
index 540d252cd735548e007533fb443fccae16ee4dc7..cf24660f79839fcbc9be724455feed8d08e42725 100644 |
--- a/third_party/harfbuzz-ng/src/hb-common.cc |
+++ b/third_party/harfbuzz-ng/src/hb-common.cc |
@@ -57,25 +57,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 +115,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 +143,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 +228,7 @@ struct hb_language_item_t { |
return *this; |
} |
- void finish (void) { free (lang); } |
+ void finish (void) { free ((void *) lang); } |
}; |
@@ -237,14 +278,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; |
- char strbuf[32]; |
- if (len >= 0) { |
+ if (len >= 0) |
+ { |
len = MIN (len, (int) sizeof (strbuf) - 1); |
str = (char *) memcpy (strbuf, str, len); |
strbuf[len] = '\0'; |
@@ -255,6 +309,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 +326,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 +352,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 +396,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 +523,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 +543,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, |