Fontasy.c 756 Bytes
Newer Older
Peter Kovář's avatar
Peter Kovář committed
1 2 3 4 5
#include <math.h>
#include <float.h>
#include <stdlib.h>
#include <string.h>
#include "Fontasy.h"
Peter Kovář's avatar
WIP  
Peter Kovář committed
6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48

#include <ft2build.h>
#include FT_IMAGE_H
#include FT_TYPES_H

int fontasy_line (raqm_t **rq, char* text, uint length, char *language, FT_Face font)
{
  raqm_t *line;
  bool result;

  line = raqm_create ();
  if (line == NULL)
  {
    return -1;
  }

  result = raqm_set_text_utf8 (line, text, length);
  if (result == false)
  {
    return -2;
  }

  result = raqm_set_language (line, language, 0, length);
  if (result == false)
  {
    return -3;
  }

  result = raqm_set_freetype_face (line, font);
  if (result == false)
  {
    return -4;
  }

  result = raqm_layout (line);
  if (result == false)
  {
    return -5;
  }

  *rq = line;
  return 0;
}