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);Parameters
Section titled “Parameters”| Type | Description |
|---|---|
FiniteShell *shell | The FiniteShellwhere the window is. |
Code Example
Section titled “Code Example”#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);Standard Usage
Section titled “Standard Usage”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.