/*
 * DESCRIPTION:
 * TrueType font functions.
*/

#include "font.h"

/* Returns line skip of font. */
s32
font_line_skip_get(Font* self)
{
	return TTF_FontLineSkip(self->ttf);
}

/* Returns height of font. */
s32
font_height_get(Font* self)
{
	return TTF_FontHeight(self->ttf);
}

/* Inits a font. */
bool
font_init(Font* self, const char* path, u32 size)
{
	self->ttf = TTF_OpenFont(path, size);

	if (!self->ttf)
		return false;

	self->size = size;
	self->isInit = true;

	return true;
}

/* Frees a font. */
void
font_free(Font* self)
{
	if (self->isInit)
	{
		TTF_CloseFont(self->ttf);
		self->isInit = false;
	}
}
