This repository has been archived by the owner on Aug 8, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 5
/
font-model.h
108 lines (86 loc) · 2.79 KB
/
font-model.h
1
2
3
4
5
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
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
/*
* FontView - font viewing app
* Part of the Fontable Project
* Copyright (C) 2006 Alex Roberts
* Copyright (C) 2010-2018 Khaled Hosny, <[email protected]>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston,
* MA 02111-1307 USA
*
*/
#ifndef __FONT_MODEL_H__
#define __FONT_MODEL_H__
#include <glib-object.h>
#include <fontconfig/fontconfig.h>
#include <ft2build.h>
#include FT_FREETYPE_H
#include FT_MULTIPLE_MASTERS_H
typedef struct {
double r, g, b, a;
} Color;
typedef struct {
int gid;
Color *colors;
} ColorLayer;
typedef struct {
int num_layers;
ColorLayer *layers;
} ColorGlyph;
typedef struct {
GHashTable *glyphs;
gint palette;
gint num_palettes;
gchar **palette_names;
} ColorTable;
#define FONT_MODEL_TYPE (font_model_get_type())
#define FONT_MODEL(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), \
FONT_MODEL_TYPE, FontModel))
#define FONT_MODEL_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), \
FONT_MODEL_TYPE, FontModelClass))
#define IS_FONT_MODEL(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), \
FONT_MODEL_TYPE))
#define IS_FONT_MODEL_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), \
FONT_MODEL_TYPE))
#define FONT_MODEL_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), \
FONT_MODEL_TYPE, FontModelClass))
typedef struct _FontModel FontModel;
typedef struct _FontModelClass FontModelClass;
struct _FontModel {
GObject parent;
/* use priv in future */
FT_Face ft_face;
gchar *file;
gchar *family;
gchar *style;
double units_per_em;
double xheight;
double ascender;
double descender;
gchar *version;
gchar *copyright;
gchar *description;
gchar *sample;
FT_MM_Var* mmvar;
FT_Fixed* mmcoords;
FcConfig *config;
ColorTable color;
};
struct _FontModelClass {
GObjectClass parent;
};
GType font_model_get_type (void);
GObject *font_model_new (gchar *font);
gchar* get_font_name (FT_Face face, FT_UInt nameid);
#endif /* __FONT_MODEL_H__ */