the objective of libttf is to be a simple and portable library to render .ttf
font
orignaly written for the stanix operating system libttf is hopping to one day become a viable concurrent to libfreetype
start by launching the configure script
./configure
Note
you can use the options --prefix
and --host
then run make
make
and finally install
make install
Note
this might require root permission if installing globally
you can get started with
#include <stdio.h>
#include <ttf.h>
int main(){
//open a ttf file
ttf_file *font = ttf_open("DejaVuSans.ttf");
if(!font){
printf("libttf : %s\n",ttf_error());
return 1;
}
ttf_close(font);
return 0;
}
and then compile with
gcc test.c -lttf
ttf_file *ttf_open(const char *path)
void ttf_close(ttf_file *font)
const char *ttf_error()
uint32_t ttf_char2glyf(ttf_file *font,wchar_t c)
ttf_glyph *ttf_getglyph(ttf_file *font,wchar_t c)
void ttf_freeglyph(ttf_glyph *glyph)
currently libttf support only font of type truetype outline with a unicode endoding of format 12