Glyph KeeperLatest version: 0.32 (February 6, 2007)
[an error occurred while processing this directive]
|
[an error occurred while processing this directive]
|
[an error occurred while processing this directive]
|
[an error occurred while processing this directive]
|
[an error occurred while processing this directive]
|
[an error occurred while processing this directive]
|
[an error occurred while processing this directive]
|
[an error occurred while processing this directive]
|
[an error occurred while processing this directive]
|
[an error occurred while processing this directive]
|
[an error occurred while processing this directive]
IntroductionGlyph Keeper is a library for text rendering. It is written in C and can be used by C or C++ code. Glyph Keeper helps your program to load a font, render character glyphs and write them to the target surface. Right now only Allegro and SDL targets are supported, but there will be more in future. Glyph Keeper uses FreeType as a font engine. Glyph Keeper is open source and free software. Glyph Keeper features:
Hello, World!
This is an example of using Glyph Keeper with Allegro. #include <allegro.h>
#include "glyph.h"
int main()
{
GLYPH_FACE *face;
GLYPH_REND *rend;
allegro_init();
set_color_depth(32);
set_gfx_mode(GFX_AUTODETECT,800,600,0,0);
clear_to_color(screen,makecol(255,255,255));
install_keyboard();
face = gk_load_face_from_file("arial.ttf",0);
if (!face) { allegro_message("Can't load font!"); exit(1); }
rend = gk_create_renderer(face,0);
if (!rend) { allegro_message("Can't create renderer!"); exit(1); }
gk_rend_set_size_pixels(rend,32,32);
gk_rend_set_text_color(rend,29,102,185);
gk_render_line_utf8(screen,rend,"Hello, World!",50,50);
readkey();
return 0;
}
END_OF_MAIN()
If your system has GCC and if Allegro and FreeType libraries are installed, then this example can be compiled by the following command (assuming it is in the file 'hello.c' located in the same directory with Glyph Keeper source files):
gcc -DGLYPH_TARGET=GLYPH_TARGET_ALLEGRO -o hello.exe hello.c glyph.c -lalleg -lft
This is the most simple way of using Glyph Keeper - this code does not make use of glyph caching, transparent or angled text rendering or any other cool features of Glyph Keeper. But anyway you can get some idea how it looks like. Please look here for more complex examples.
|