I decided to make some changes to my api, including the name change. It's more
in step with other libs, here is the main header.
My biggest beef against the current implementation is that suppose I added
XFont support. As it is now the user would have to have both freetype and Xlib
installed for things to compile. It would be better to modularize the main
library like I had originally. What do you think?
/*
The libFNT API
*/
#ifndef _GGI_FNT_H
#define _GGI_FNT_H
#include <ggi/ggi.h>
#include "fnt_types.h"
__BEGIN_DECLS
/*
library management
*/
int fntInit(void);
int fntExit(void);
int fntAttach(ggi_visual_t vis);
int fntDetach(ggi_visual_t vis);
/* General */
/* create a font type */
fnt_font_t fntInitFTFont(FT_Face ftface);
#define fntRemoveFont(font) font->remove_font(font)
#define fntClearFontCache(font) font->clear_font_cache(font)
#define fntFontRenderMode(font) font->render_mode(font)
#define fntCacheGlyph(font, index) font->cache_glyph(font, index)
/* Printing */
/* This gets the proper pixel values for use in the Print functions. */
ggi_pixel* fntAlphaMap(ggi_visual_t vis, ggi_color* fg, ggi_color* bg);
int fntPrintChar(ggi_visual_t vis, fnt_font_t font, uint32 char_code, sint32 x, sint32
y,const ggi_pixel* pix);
int fntPrintGlyph(ggi_visual_t vis, fnt_font_t font, uint32 index, sint32 x, sint32 y,
const ggi_pixel* pix);
int fntPrintCharS(ggi_visual_t vis, fnt_font_t font, const char* string, sint32 x,
sint32 y, const ggi_pixel* pix);
int fntPrintGlyphS(ggi_visual_t vis, fnt_font_t font, const uint32* indices, size_t
num, sint32 x, sint32 y, const ggi_pixel* pix);
/* Dimensions */
/* You can fit glyphs into a box. This gives the dimensions. Useful for
bl
#define fntCharDim(font, char_code, dim) font->char_dim(font, char_code, dim)
#define fntGlyphDim(font, index, dim) font->glyph_dim(font, index, dim)
#define fntCharSDim(font,string, dim) font->chars_dim(font, string, dim)
#definefntGlyphSDim(font, indices, n, dim) font->glyphs_dim(font,indices,
n, dim)
/* Bitmaps */
/* Raw output from font engine. Good for alpha blending */
#define fntCharBitmap(font, char_code, buf) font->char_bitmap(font,
char_code, buf)
#define fntGlyphBitmap(font, index, buf) font->glyph_bitmap(font,
index, buf)
#define fntCharSBitmap(font, string, buf) font->chars_bitmap(font,
string, buf)
#define fntGlyphSBitmap(font, indices, n, buf) font->glyphs_bitmap(font, indices, n,
buf)
/* Advances */
/* How far forward the pen went */
#define fntCharAdv(font, char_code, adv) font->char_adv(font,
char_code, adv)
#define fntGlyphAdv(font, index, adv) font->glyph_adv(font, index,
adv)
#define fntCharSAdv(font, string, adv) font->chars_adv(font, string,
adv)
#define fntGlyphSAdv(font, indices, n, adv) font->glyphs_adv(font,
indices, n, adv)
__END_DECLS
#endif
-
Lee Brown Jr.
[EMAIL PROTECTED]