## FreeType Utility Functions

FreeType Utility Functions — FreeType utility functions

## Functions

GQuark | font_manager_freetype_error_quark ()
glong | font_manager_get_face_count ()
gfloat | font_manager_get_font_revision ()
JsonObject * | font_manager_get_metadata ()
gchar * | font_manager_get_suggested_filename ()
GFile * | font_manager_get_installation_target ()

## Types and Values

#define | FONT_MANAGER_FREETYPE_ERROR
enum | FontManagerFreetypeError

## Includes

    #include <font-manager-freetype.h>

## Description

Functions used to gather information from font files using the FreeType library.

## Functions

### font_manager_freetype_error_quark ()

    GQuark
    font_manager_freetype_error_quark ();

### font_manager_get_face_count ()

    glong
    font_manager_get_face_count (const gchar *filepath,
                                 GError **error);

This function never fails. In case of an error this function returns 1. Any valid font file should contain at least one variation.

#### Parameters

filepath | full path to font file to examine |
error | GError or `NULL` to ignore errors |

#### Returns

the number of variations contained in filepath

### font_manager_get_font_revision ()

    gfloat
    font_manager_get_font_revision (const gchar *filepath);

#### Parameters

filepath | full path to font file to examine |

#### Returns

The version number as a float. This function never fails and returns 1.0 as a default value if no version is set or if an error occurs.

### font_manager_get_metadata ()

    JsonObject *
    font_manager_get_metadata (const gchar *filepath,
                               gint index,
                               GError **error);

See FontManagerFontInfo for a description of the JsonObject returned by this function.

#### Parameters

filepath | full path to font file to examine |
index | face index to examine |
error | GError or `NULL` to ignore errors |

#### Returns

A newly created JsonObject or `NULL` if there was an error. Free the returned object using json_object_unref when no longer needed.

[transfer full][nullable]

### font_manager_get_suggested_filename ()

    gchar *
    font_manager_get_suggested_filename (JsonObject *metadata);

#### Parameters

metadata | JsonObject returned by `font_manager_get_metadata()` |

#### Returns

A newly allocated string. Free the result using g_free.

[transfer full]

### font_manager_get_installation_target ()

    GFile *
    font_manager_get_installation_target (GFile *font_file,
                                          GFile *target_dir,
                                          gboolean create_directories,
                                          GError **error);

The GFile returned by this function is the suggested output file based on the metadata present in `font_file` .

If `create_directories` is `FALSE` the parent directory for the returned GFile may not exist and should be created prior to use.

#### Parameters

font_file | GFile |
target_dir | GFile |
create_directories | whether to create suggested directories or not |
error | GError or `NULL` to ignore errors |

#### Returns

A newly-created GFile or `NULL` if there was an error. Free the returned object using ``g_object_unref()``.

[transfer full][nullable]

## Types and Values

### FONT_MANAGER_FREETYPE_ERROR

    #define FONT_MANAGER_FREETYPE_ERROR font_manager_freetype_error_quark()

### enum FontManagerFreetypeError

#### Members

FONT_MANAGER_FREETYPE_ERROR_FAILED | Call to Freetype library failed |

## See Also

FontManagerFontInfo