2019-06-13 16:24:35 +02:00
|
|
|
#pragma once
|
|
|
|
|
|
2019-07-28 12:09:22 +02:00
|
|
|
#include <stdbool.h>
|
2019-07-29 20:10:55 +02:00
|
|
|
#include <threads.h>
|
|
|
|
|
|
2019-07-30 18:04:28 +02:00
|
|
|
#include <ft2build.h>
|
|
|
|
|
#include FT_FREETYPE_H
|
|
|
|
|
#include FT_LCD_FILTER_H
|
|
|
|
|
#include <cairo.h>
|
2019-06-13 16:24:35 +02:00
|
|
|
|
2019-07-30 18:04:28 +02:00
|
|
|
#include "tllist.h"
|
|
|
|
|
//#include "terminal.h"
|
|
|
|
|
|
|
|
|
|
typedef tll(const char *) font_list_t;
|
|
|
|
|
|
|
|
|
|
struct glyph {
|
|
|
|
|
wchar_t wc;
|
|
|
|
|
|
|
|
|
|
void *data;
|
|
|
|
|
cairo_surface_t *surf;
|
|
|
|
|
int left;
|
|
|
|
|
int top;
|
|
|
|
|
|
|
|
|
|
#if 0
|
|
|
|
|
int format;
|
|
|
|
|
int width;
|
|
|
|
|
int height;
|
|
|
|
|
int stride;
|
|
|
|
|
#endif
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
typedef tll(struct glyph) hash_entry_t;
|
|
|
|
|
|
|
|
|
|
struct font {
|
|
|
|
|
FT_Face face;
|
|
|
|
|
int load_flags;
|
|
|
|
|
int render_flags;
|
|
|
|
|
FT_LcdFilter lcd_filter;
|
|
|
|
|
struct {
|
|
|
|
|
double position;
|
|
|
|
|
double thickness;
|
|
|
|
|
} underline;
|
|
|
|
|
struct {
|
|
|
|
|
double position;
|
|
|
|
|
double thickness;
|
|
|
|
|
} strikeout;
|
|
|
|
|
|
|
|
|
|
bool is_fallback;
|
|
|
|
|
tll(char *) fallbacks;
|
|
|
|
|
|
|
|
|
|
//struct glyph cache[256];
|
|
|
|
|
hash_entry_t **cache;
|
|
|
|
|
mtx_t lock;
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
bool font_from_name(font_list_t names, const char *attributes, struct font *result);
|
|
|
|
|
const struct glyph *font_glyph_for_utf8(struct font *font, const char *utf8);
|
2019-07-28 21:03:38 +02:00
|
|
|
void font_destroy(struct font *font);
|