lovr/src/data/rasterizer.h

44 lines
889 B
C
Raw Normal View History

#include "data/blob.h"
2017-03-11 10:19:33 +00:00
#include "lib/map/map.h"
2018-01-22 16:28:33 +00:00
#include "util.h"
2017-02-03 23:16:30 +00:00
#include <stdint.h>
2018-01-23 02:49:45 +00:00
#include <stdbool.h>
2017-01-30 02:37:56 +00:00
2017-02-19 09:54:58 +00:00
#pragma once
2017-07-14 16:53:05 +00:00
#define GLYPH_PADDING 1
2017-02-19 09:54:58 +00:00
typedef struct {
2018-01-22 16:28:33 +00:00
Ref ref;
void* ftHandle;
Blob* blob;
2017-02-19 09:54:58 +00:00
int size;
2018-01-23 02:49:45 +00:00
int glyphCount;
2017-02-19 09:54:58 +00:00
int height;
2018-01-23 02:49:45 +00:00
int advance;
2017-03-16 08:12:32 +00:00
int ascent;
int descent;
2018-01-22 16:28:33 +00:00
} Rasterizer;
2017-02-19 09:54:58 +00:00
typedef struct {
int x;
int y;
int w;
int h;
2017-07-14 16:53:05 +00:00
int tw;
int th;
2017-02-19 09:54:58 +00:00
int dx;
int dy;
int advance;
uint8_t* data;
} Glyph;
typedef map_t(Glyph) map_glyph_t;
2018-01-22 16:28:33 +00:00
Rasterizer* lovrRasterizerCreate(Blob* blob, int size);
void lovrRasterizerDestroy(const Ref* ref);
2018-01-23 02:49:45 +00:00
bool lovrRasterizerHasGlyph(Rasterizer* fontData, uint32_t character);
bool lovrRasterizerHasGlyphs(Rasterizer* fontData, const char* str);
2018-01-22 16:28:33 +00:00
void lovrRasterizerLoadGlyph(Rasterizer* fontData, uint32_t character, Glyph* glyph);
int lovrRasterizerGetKerning(Rasterizer* fontData, uint32_t left, uint32_t right);