[Docs] Add gtk-doc comments to hb-ft.

This commit is contained in:
Nathan Willis 2019-05-20 17:37:56 +01:00
parent bfa7b0af02
commit 9126a5ff07
1 changed files with 117 additions and 18 deletions

View File

@ -46,8 +46,13 @@
* @short_description: FreeType integration * @short_description: FreeType integration
* @include: hb-ft.h * @include: hb-ft.h
* *
* Functions for using HarfBuzz with the FreeType library to provide face and * Functions for using HarfBuzz with the FreeType library.
*
* HarfBuzz supports using FreeType to provide face and
* font data. * font data.
*
* <note>Note that FreeType is not thread-safe, therefore these
* functions are not thread-safe either.</note>
**/ **/
@ -125,10 +130,13 @@ _hb_ft_font_destroy (void *data)
/** /**
* hb_ft_font_set_load_flags: * hb_ft_font_set_load_flags:
* @font: * @font: #hb_font_t to work upon
* @load_flags: * @load_flags: The FreeType load flags to set
* *
* Sets the FT_Load_Glyph load flags for the specified #hb_font_t.
* *
* For more information, see
* https://www.freetype.org/freetype2/docs/reference/ft2-base_interface.html#ft_load_xxx
* *
* Since: 1.0.5 * Since: 1.0.5
**/ **/
@ -148,11 +156,15 @@ hb_ft_font_set_load_flags (hb_font_t *font, int load_flags)
/** /**
* hb_ft_font_get_load_flags: * hb_ft_font_get_load_flags:
* @font: * @font: #hb_font_t to work upon
* *
* Fetches the FT_Load_Glyph load flags of the specified #hb_font_t.
* *
* For more information, see
* https://www.freetype.org/freetype2/docs/reference/ft2-base_interface.html#ft_load_xxx
*
* Return value: FT_Load_Glyph flags found
* *
* Return value:
* Since: 1.0.5 * Since: 1.0.5
**/ **/
int int
@ -166,6 +178,17 @@ hb_ft_font_get_load_flags (hb_font_t *font)
return ft_font->load_flags; return ft_font->load_flags;
} }
/**
* hb_ft_get_face:
* @font: #hb_font_t to work upon
*
* Fetches the FT_Face associated with the specified #hb_font_t
* font object.
*
* Return value: the FT_Face found
*
* Since: 1.0.5
**/
FT_Face FT_Face
hb_ft_font_get_face (hb_font_t *font) hb_ft_font_get_face (hb_font_t *font)
{ {
@ -570,12 +593,22 @@ reference_table (hb_face_t *face HB_UNUSED, hb_tag_t tag, void *user_data)
/** /**
* hb_ft_face_create: * hb_ft_face_create:
* @ft_face: (destroy destroy) (scope notified): * @ft_face: (destroy destroy) (scope notified): FT_Face to work upon
* @destroy: * @destroy: A callback to call when the face object is not needed anymore
* *
* Creates an #hb_face_t face object from the specified FT_Face.
* *
* This variant of the function does not provide any life-cycle management.
*
* Most client programs should use hb_ft_face_create_referenced()
* (or, perhaps, hb_ft_face_create_cached()) instead.
*
* If you know you have valid reasons not to use hb_ft_face_create_referenced(),
* then it is the client program's responsibility to destroy @ft_face
* after the #hb_face_t face object has been destroyed.
*
* Return value: (transfer full): the new #hb_face_t face object
* *
* Return value: (transfer full):
* Since: 0.9.2 * Since: 0.9.2
**/ **/
hb_face_t * hb_face_t *
@ -605,11 +638,19 @@ hb_ft_face_create (FT_Face ft_face,
/** /**
* hb_ft_face_create_referenced: * hb_ft_face_create_referenced:
* @ft_face: * @ft_face: FT_Face to work upon
* *
* Creates an #hb_face_t face object from the specified FT_Face.
* *
* This is the preferred variant of the hb_ft_face_create*
* function family, because it calls FT_Reference_Face() on @ft_face,
* ensuring that @ft_face remains alive as long as the resulting
* #hb_face_t face object remains alive.
*
* Use this version unless you know you have good reasons not to.
*
* Return value: (transfer full): the new #hb_face_t face object
* *
* Return value: (transfer full):
* Since: 0.9.38 * Since: 0.9.38
**/ **/
hb_face_t * hb_face_t *
@ -627,11 +668,21 @@ hb_ft_face_finalize (FT_Face ft_face)
/** /**
* hb_ft_face_create_cached: * hb_ft_face_create_cached:
* @ft_face: * @ft_face: FT_Face to work upon
* *
* Creates an #hb_face_t face object from the specified FT_Face.
* *
* This variant of the function caches the newly created #hb_face_t
* face object, using the generic pointer of @ft_face. Subsequent function
* calls that are passed the same @ft_face parameter will have the same
* #hb_face_t returned to them, and that #hb_face_t will be correctly
* reference counted.
*
* However, client programs are still responsible for destroying
* @ft_face after the last #hb_face_t face object has been destroyed.
*
* Return value: (transfer full): the new #hb_face_t face object
* *
* Return value: (transfer full):
* Since: 0.9.2 * Since: 0.9.2
**/ **/
hb_face_t * hb_face_t *
@ -649,15 +700,28 @@ hb_ft_face_create_cached (FT_Face ft_face)
return hb_face_reference ((hb_face_t *) ft_face->generic.data); return hb_face_reference ((hb_face_t *) ft_face->generic.data);
} }
/** /**
* hb_ft_font_create: * hb_ft_font_create:
* @ft_face: (destroy destroy) (scope notified): * @ft_face: (destroy destroy) (scope notified): FT_Face to work upon
* @destroy: * @destroy: (optional): A callback to call when the font object is not needed anymore
* *
* Creates an #hb_font_t font object from the specified FT_Face.
* *
* <note>Note: You must set the face size on @ft_face before calling
* hb_ft_font_create() on it. Otherwise, HarfBuzz will not pick up
* the face size.</note>
*
* This variant of the function does not provide any life-cycle management.
*
* Most client programs should use hb_ft_font_create_referenced()
* instead.
*
* If you know you have valid reasons not to use hb_ft_font_create_referenced(),
* then it is the client program's responsibility to destroy @ft_face
* after the #hb_font_t font object has been destroyed.
*
* Return value: (transfer full): the new #hb_font_t font object
* *
* Return value: (transfer full):
* Since: 0.9.2 * Since: 0.9.2
**/ **/
hb_font_t * hb_font_t *
@ -675,6 +739,16 @@ hb_ft_font_create (FT_Face ft_face,
return font; return font;
} }
/**
* hb_ft_font_has_changed:
* @font: #hb_font_t to work upon
*
* Refreshes the state of @font when the underlying FT_Face has changed.
* This function should be called after changing the size or
* variation-axis settings on the FT_Face.
*
* Since: 1.0.5
**/
void void
hb_ft_font_changed (hb_font_t *font) hb_ft_font_changed (hb_font_t *font)
{ {
@ -730,11 +804,23 @@ hb_ft_font_changed (hb_font_t *font)
/** /**
* hb_ft_font_create_referenced: * hb_ft_font_create_referenced:
* @ft_face: * @ft_face: FT_Face to work upon
* *
* Creates an #hb_font_t font object from the specified FT_Face.
* *
* <note>Note: You must set the face size on @ft_face before calling
* hb_ft_font_create_references() on it. Otherwise, HarfBuzz will not pick up
* the face size.</note>
*
* This is the preferred variant of the hb_ft_font_create*
* function family, because it calls FT_Reference_Face() on @ft_face,
* ensuring that @ft_face remains alive as long as the resulting
* #hb_font_t font object remains alive.
*
* Use this version unless you know you have good reasons not to.
*
* Return value: (transfer full): the new #hb_font_t font object
* *
* Return value: (transfer full):
* Since: 0.9.38 * Since: 0.9.38
**/ **/
hb_font_t * hb_font_t *
@ -793,6 +879,19 @@ _release_blob (FT_Face ft_face)
hb_blob_destroy ((hb_blob_t *) ft_face->generic.data); hb_blob_destroy ((hb_blob_t *) ft_face->generic.data);
} }
/**
* hb_ft_font_set_funcs:
* @font: #hb_font_t to work upon
*
* Configures the font-functions structure of the specified
* #hb_font_t font object to use FreeType font functions.
*
* <note>Note: Internally, this function creates an FT_Face.
* You should use this FT_Face when you create an #hb_face_t
* with hb_ft_face_create().</note>
*
* Since: 1.0.5
**/
void void
hb_ft_font_set_funcs (hb_font_t *font) hb_ft_font_set_funcs (hb_font_t *font)
{ {