libacfutils
A general purpose library of utility functions designed to make it easier to develop addons for the X-Plane flight simulator.
Loading...
Searching...
No Matches
Macros | Functions
font_utils.h File Reference
#include <cairo.h>
#include <cairo-ft.h>
#include <ft2build.h>
#include <FT_FREETYPE_H>
#include "types.h"
Include dependency graph for font_utils.h:

Go to the source code of this file.

Macros

#define ft_err2str   font_utils_ft_err2str
 
#define try_load_font   font_utils_try_load_font
 

Functions

const char * font_utils_ft_err2str (FT_Error err)
 
bool_t font_utils_try_load_font (const char *fontdir, const char *fontfile, FT_Library ft, FT_Face *font, cairo_font_face_t **cr_font)
 

Detailed Description

This file contains support utilities to help with font handling and Cairo font operations.

Definition in file font_utils.h.

Macro Definition Documentation

◆ ft_err2str

#define ft_err2str   font_utils_ft_err2str

For backwards compatibility with older code

Definition at line 46 of file font_utils.h.

◆ try_load_font

#define try_load_font   font_utils_try_load_font

For backwards compatibility with older code

Definition at line 53 of file font_utils.h.

Function Documentation

◆ font_utils_ft_err2str()

const char * font_utils_ft_err2str ( FT_Error  err)

Translates an FT_Error error code into a human-readable string.

◆ font_utils_try_load_font()

bool_t font_utils_try_load_font ( const char *  fontdir,
const char *  fontfile,
FT_Library  ft,
FT_Face *  font,
cairo_font_face_t **  cr_font 
)

Simple font loading front-end.

Parameters
fontdirA path to the directory from which to load the font.
fontfileA font file name. This is concatenated onto the fontdir with a path separator. If you only want to provide one string with a full path to the font file, pass that in fontdir and set fontfile = NULL.
ftFreeType library handle.
fontReturn FreeType font face object pointer. Release this after the cairo font face object using FT_DoneFace.
cr_fontReturn cairo font face object pointer. Release this before the freetype font face using cairo_font_face_destroy.
Returns
B_TRUE if loading the font was successfull, B_FALSE otherwise. In case of error, the reason is logged using logMsg.