[docs/introspection] Some more annotations

This commit is contained in:
Behdad Esfahbod 2013-09-06 17:35:57 -04:00
parent 288f289997
commit 70303cf23b
3 changed files with 155 additions and 31 deletions

View File

@ -57,25 +57,45 @@ _hb_options_init (void)
/* hb_tag_t */ /* hb_tag_t */
/**
* hb_tag_from_string:
* @str: (array length=len):
* @len:
*
*
*
* Return value:
*
* Since: 1.0
**/
hb_tag_t hb_tag_t
hb_tag_from_string (const char *s, int len) hb_tag_from_string (const char *str, int len)
{ {
char tag[4]; char tag[4];
unsigned int i; unsigned int i;
if (!s || !len || !*s) if (!str || !len || !*str)
return HB_TAG_NONE; return HB_TAG_NONE;
if (len < 0 || len > 4) if (len < 0 || len > 4)
len = 4; len = 4;
for (i = 0; i < (unsigned) len && s[i]; i++) for (i = 0; i < (unsigned) len && str[i]; i++)
tag[i] = s[i]; tag[i] = str[i];
for (; i < 4; i++) for (; i < 4; i++)
tag[i] = ' '; tag[i] = ' ';
return HB_TAG_CHAR4 (tag); return HB_TAG_CHAR4 (tag);
} }
/**
* hb_tag_to_string:
* @tag:
* @buf: (array fixed-size=4):
*
*
*
* Since: 1.0
**/
void void
hb_tag_to_string (hb_tag_t tag, char *buf) hb_tag_to_string (hb_tag_t tag, char *buf)
{ {
@ -95,6 +115,17 @@ const char direction_strings[][4] = {
"btt" "btt"
}; };
/**
* hb_direction_from_string:
* @str: (array length=len):
* @len:
*
*
*
* Return value:
*
* Since: 1.0
**/
hb_direction_t hb_direction_t
hb_direction_from_string (const char *str, int len) 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; return HB_DIRECTION_INVALID;
} }
/**
* hb_direction_to_string:
* @direction:
*
*
*
* Return value: (transfer none):
*
* Since: 1.0
**/
const char * const char *
hb_direction_to_string (hb_direction_t direction) hb_direction_to_string (hb_direction_t direction)
{ {
@ -237,6 +278,17 @@ retry:
} }
/**
* hb_language_from_string:
* @str: (array length=len):
* @len:
*
*
*
* Return value:
*
* Since: 1.0
**/
hb_language_t hb_language_t
hb_language_from_string (const char *str, int len) hb_language_from_string (const char *str, int len)
{ {
@ -255,6 +307,16 @@ hb_language_from_string (const char *str, int len)
return likely (item) ? item->lang : HB_LANGUAGE_INVALID; return likely (item) ? item->lang : HB_LANGUAGE_INVALID;
} }
/**
* hb_language_to_string:
* @language:
*
*
*
* Return value: (transfer none):
*
* Since: 1.0
**/
const char * const char *
hb_language_to_string (hb_language_t language) hb_language_to_string (hb_language_t language)
{ {
@ -262,6 +324,15 @@ hb_language_to_string (hb_language_t language)
return language->s; return language->s;
} }
/**
* hb_language_get_default:
*
*
*
* Return value:
*
* Since: 1.0
**/
hb_language_t hb_language_t
hb_language_get_default (void) hb_language_get_default (void)
{ {
@ -279,6 +350,16 @@ hb_language_get_default (void)
/* hb_script_t */ /* hb_script_t */
/**
* hb_script_from_iso15924_tag:
* @tag:
*
*
*
* Return value:
*
* Since: 1.0
**/
hb_script_t hb_script_t
hb_script_from_iso15924_tag (hb_tag_t tag) 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; return HB_SCRIPT_UNKNOWN;
} }
/**
* hb_script_from_string:
* @s: (array length=len):
* @len:
*
*
*
* Return value:
*
* Since: 1.0
**/
hb_script_t hb_script_t
hb_script_from_string (const char *s, int len) hb_script_from_string (const char *s, int len)
{ {
return hb_script_from_iso15924_tag (hb_tag_from_string (s, 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_tag_t
hb_script_to_iso15924_tag (hb_script_t script) hb_script_to_iso15924_tag (hb_script_t script)
{ {
return (hb_tag_t) script; return (hb_tag_t) script;
} }
/**
* hb_script_get_horizontal_direction:
* @script:
*
*
*
* Return value:
*
* Since: 1.0
**/
hb_direction_t hb_direction_t
hb_script_get_horizontal_direction (hb_script_t script) 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 */
/**
* 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 void
hb_version (unsigned int *major, hb_version (unsigned int *major,
unsigned int *minor, unsigned int *minor,
@ -419,12 +541,33 @@ hb_version (unsigned int *major,
*micro = HB_VERSION_MICRO; *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 * const char *
hb_version_string (void) hb_version_string (void)
{ {
return HB_VERSION_STRING; return HB_VERSION_STRING;
} }
/**
* hb_version_check:
* @major:
* @minor:
* @micro:
*
*
*
* Return value:
*
* Since: 1.0
**/
hb_bool_t hb_bool_t
hb_version_check (unsigned int major, hb_version_check (unsigned int major,
unsigned int minor, unsigned int minor,

View File

@ -1094,7 +1094,7 @@ hb_font_get_face (hb_font_t *font)
* hb_font_set_funcs: * hb_font_set_funcs:
* @font: a font. * @font: a font.
* @klass: * @klass:
* @user_data: * @font_data:
* @destroy: * @destroy:
* *
* *
@ -1104,12 +1104,12 @@ hb_font_get_face (hb_font_t *font)
void void
hb_font_set_funcs (hb_font_t *font, hb_font_set_funcs (hb_font_t *font,
hb_font_funcs_t *klass, hb_font_funcs_t *klass,
void *user_data, void *font_data,
hb_destroy_func_t destroy) hb_destroy_func_t destroy)
{ {
if (font->immutable) { if (font->immutable) {
if (destroy) if (destroy)
destroy (user_data); destroy (font_data);
return; return;
} }
@ -1122,14 +1122,14 @@ hb_font_set_funcs (hb_font_t *font,
hb_font_funcs_reference (klass); hb_font_funcs_reference (klass);
hb_font_funcs_destroy (font->klass); hb_font_funcs_destroy (font->klass);
font->klass = klass; font->klass = klass;
font->user_data = user_data; font->user_data = font_data;
font->destroy = destroy; font->destroy = destroy;
} }
/** /**
* hb_font_set_funcs_data: * hb_font_set_funcs_data:
* @font: a font. * @font: a font.
* @user_data: * @font_data:
* @destroy: * @destroy:
* *
* *
@ -1138,20 +1138,20 @@ hb_font_set_funcs (hb_font_t *font,
**/ **/
void void
hb_font_set_funcs_data (hb_font_t *font, hb_font_set_funcs_data (hb_font_t *font,
void *user_data, void *font_data,
hb_destroy_func_t destroy) hb_destroy_func_t destroy)
{ {
/* Destroy user_data? */ /* Destroy user_data? */
if (font->immutable) { if (font->immutable) {
if (destroy) if (destroy)
destroy (user_data); destroy (font_data);
return; return;
} }
if (font->destroy) if (font->destroy)
font->destroy (font->user_data); font->destroy (font->user_data);
font->user_data = user_data; font->user_data = font_data;
font->destroy = destroy; font->destroy = destroy;
} }

View File

@ -47,30 +47,11 @@ HB_BEGIN_DECLS
HB_VERSION_MAJOR*10000+HB_VERSION_MINOR*100+HB_VERSION_MICRO) HB_VERSION_MAJOR*10000+HB_VERSION_MINOR*100+HB_VERSION_MICRO)
/**
* 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 void
hb_version (unsigned int *major, hb_version (unsigned int *major,
unsigned int *minor, unsigned int *minor,
unsigned int *micro); unsigned int *micro);
/**
* hb_version_string:
*
* Returns library version as a string with three components.
*
* Return value: library version string.
*
* Since: 1.0
**/
const char * const char *
hb_version_string (void); hb_version_string (void);