/*
	This file is part of Floculate.
	Copyright (C) 2008  Bill Whitacre

	Floculate is free software: you can redistribute it and/or modify
	it under the terms of the GNU General Public License as published by
	the Free Software Foundation, either version 3 of the License, or
	(at your option) any later version.

	Floculate is distributed in the hope that it will be useful,
	but WITHOUT ANY WARRANTY; without even the implied warranty of
	MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
	GNU General Public License for more details.

	You should have received a copy of the GNU General Public License
	along with this program.  If not, see <http://www.gnu.org/licenses/>.
*/

#ifndef FONT_SYSTEM_H
#define FONT_SYSTEM_H

#if defined(_MSC_VER)||defined(__WIN32__)
#	include <windows.h>
#endif

#include <stdlib.h>
#include <stdio.h>

#include <ft2build.h>
#include <freetype/freetype.h>
#include <freetype/ftglyph.h>
#include <freetype/ftoutln.h>
#include <freetype/fttrigon.h>

typedef struct rat_texture_font
{
	float pt,*wids,*bears,*hoss;
	int *qvws,*qvhs;
	float *qtws,*qths;
	unsigned int *textures;
} rat_texture_font;

typedef struct rat_glyph_font
{
	float pt;
	FT_Face face;
} rat_glyph_font;

#ifdef __cplusplus
extern "C" {
#endif

int rat_start_font_system();
void rat_stop_font_system();

rat_glyph_font *rat_glyph_font_load(char *filename,int pt);
rat_texture_font *rat_texture_font_from_glyph_font(rat_glyph_font *font);

void rat_glyph_font_destroy(rat_glyph_font *font);
void rat_texture_font_destroy(rat_texture_font *font);

void rat_set_text_color(float *rgba);
void rat_get_text_color(float *rgba);

float rat_texture_font_height(rat_texture_font *font);
float rat_texture_font_text_length(rat_texture_font *font,char *text);
float rat_texture_font_glyph_length(rat_texture_font *font,char ch);

void rat_texture_font_render_text(rat_texture_font *font,float x,float y,char *text);
void rat_texture_font_render_text_notform(rat_texture_font *font,char *text);

void rat_texture_font_render_glyph_at(rat_texture_font *font,float x,float y,char ch);
void rat_texture_font_render_glyph_centered(rat_texture_font *font,float x,float y,float ang,float sclx,float scly,char ch);

#ifdef __cplusplus
}
#endif

#endif

