Skip to content

finite_draw_get_font_extents

The finite_draw_get_font_extents function attempts to get the extents of the current font

cairo_font_extents_t finite_draw_get_font_extents(FiniteShell *shell);
TypeDescription
FiniteShell *shellThe FiniteShellwhere the window is.
#include <finite/draw.h>
finite_draw_set_font(shell, "Kumbh Sans", false, true, 52);
cairo_text_extents_t ext;
FiniteTextGroup parts[3] = {
{1,1,1,1,"Welcome to the "},
{0.964, 0.674, 0.192,1,"Infinite "},
{1,1,1,1,"Level"}
};
cairo_font_extents_t fext = finite_draw_get_font_extents(shell);
printf("Font height: %f\n", fext.height);
finite_draw_text_group(shell, parts, (shell->details->width * 0.03), (shell->details->height * 0.1), 3);

A font must be set prior to calling this function with finite_draw_set_font. Failure to do so will throw an error.

This function must have a valid cairo_t inside the FiniteShell.cr.

This function must have a valid FiniteShell

This function uses Cairo which requires a valid cairo_surface_t in FiniteShell.cairo_surface beforehand.