blob: 4535d1b1bf8e642747cf2930d1748927d77cc969 [file] [log] [blame]
Behdad Esfahbodc62b5032009-08-01 19:54:49 -04001/*
2 * Copyright (C) 2009 Red Hat, Inc.
3 *
4 * This is part of HarfBuzz, an OpenType Layout engine library.
5 *
6 * Permission is hereby granted, without written agreement and without
7 * license or royalty fees, to use, copy, modify, and distribute this
8 * software and its documentation for any purpose, provided that the
9 * above copyright notice and the following two paragraphs appear in
10 * all copies of this software.
11 *
12 * IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE TO ANY PARTY FOR
13 * DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES
14 * ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN
15 * IF THE COPYRIGHT HOLDER HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH
16 * DAMAGE.
17 *
18 * THE COPYRIGHT HOLDER SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING,
19 * BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
20 * FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS
21 * ON AN "AS IS" BASIS, AND THE COPYRIGHT HOLDER HAS NO OBLIGATION TO
22 * PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
23 *
24 * Red Hat Author(s): Behdad Esfahbod
25 */
26
27#ifndef HB_FONT_H
28#define HB_FONT_H
29
30#include "hb-common.h"
Behdad Esfahbod0cc7bc52009-08-01 21:38:39 -040031#include "hb-blob.h"
Behdad Esfahbod5c441882009-08-10 20:05:16 -040032#include "hb-unicode.h"
Behdad Esfahbodc62b5032009-08-01 19:54:49 -040033
34HB_BEGIN_DECLS
35
Behdad Esfahbodc62b5032009-08-01 19:54:49 -040036
37/*
38 * hb_face_t
39 */
40
Behdad Esfahbod5c441882009-08-10 20:05:16 -040041typedef struct _hb_face_t hb_face_t;
42
Behdad Esfahbodc62b5032009-08-01 19:54:49 -040043hb_face_t *
44hb_face_create_for_data (hb_blob_t *blob,
45 unsigned int index);
46
Behdad Esfahbod5c441882009-08-10 20:05:16 -040047typedef hb_blob_t * (*hb_get_table_func_t) (hb_tag_t tag, void *user_data);
48
Behdad Esfahbodc62b5032009-08-01 19:54:49 -040049/* calls destory() when not needing user_data anymore */
50hb_face_t *
51hb_face_create_for_tables (hb_get_table_func_t get_table,
52 hb_destroy_func_t destroy,
53 void *user_data);
54
55hb_face_t *
56hb_face_reference (hb_face_t *face);
57
Behdad Esfahboda12dd322009-08-01 21:36:15 -040058unsigned int
59hb_face_get_reference_count (hb_face_t *face);
60
Behdad Esfahbodc62b5032009-08-01 19:54:49 -040061void
62hb_face_destroy (hb_face_t *face);
63
64void
Behdad Esfahbod5c441882009-08-10 20:05:16 -040065hb_face_set_unicode_funcs (hb_face_t *face,
66 hb_unicode_funcs_t *unicode_funcs);
Behdad Esfahbodc62b5032009-08-01 19:54:49 -040067
Behdad Esfahbod23c86aa2009-08-03 21:40:20 -040068hb_blob_t *
69hb_face_get_table (hb_face_t *face,
Behdad Esfahbod5c441882009-08-10 20:05:16 -040070 hb_tag_t tag);
71
72
73/*
74 * hb_font_funcs_t
75 */
76
77typedef struct _hb_font_funcs_t hb_font_funcs_t;
78
79hb_font_funcs_t *
80hb_font_funcs_create (void);
81
82hb_font_funcs_t *
83hb_font_funcs_reference (hb_font_funcs_t *ffuncs);
84
85unsigned int
86hb_font_funcs_get_reference_count (hb_font_funcs_t *ffuncs);
87
88void
89hb_font_funcs_destroy (hb_font_funcs_t *ffuncs);
90
91hb_font_funcs_t *
92hb_font_funcs_copy (hb_font_funcs_t *ffuncs);
93
94/*
95
96void
97hb_font_funcs_set_glyph_func (hb_font_funcs_t *ffuncs,
98 hb_font_get_glyph_func_t glyph_func);
99
100void
101hb_font_funcs_set_contour_point_func (hb_font_funcs_t *ffuncs,
102 hb_font_get_contour_point_func_t contour_point_func);
103
104void
105hb_font_funcs_set_glyph_metrics_func (hb_font_funcs_t *ffuncs,
106 hb_font_get_glyph_metrics_func_t glyph_metrics_func);
107
108void
109hb_font_funcs_set_kerning_func (hb_font_funcs_t *ffuncs,
110 hb_font_get_kerning_func_t kerning_func);
111
112*/
Behdad Esfahbodc62b5032009-08-01 19:54:49 -0400113
114
115/*
116 * hb_font_t
117 */
118
119/* Fonts are very light-weight objects */
120
Behdad Esfahbod5c441882009-08-10 20:05:16 -0400121typedef struct _hb_font_t hb_font_t;
122
Behdad Esfahbodc62b5032009-08-01 19:54:49 -0400123hb_font_t *
Behdad Esfahbod5c441882009-08-10 20:05:16 -0400124hb_font_create (void);
Behdad Esfahbodc62b5032009-08-01 19:54:49 -0400125
126hb_font_t *
127hb_font_reference (hb_font_t *font);
128
Behdad Esfahboda12dd322009-08-01 21:36:15 -0400129unsigned int
130hb_font_get_reference_count (hb_font_t *font);
131
Behdad Esfahbodc62b5032009-08-01 19:54:49 -0400132void
133hb_font_destroy (hb_font_t *font);
134
Behdad Esfahbod5c441882009-08-10 20:05:16 -0400135void
136hb_font_set_funcs (hb_font_t *font,
137 hb_font_funcs_t *klass);
Behdad Esfahbod0ead4812009-08-02 17:41:36 -0400138
Behdad Esfahbodc62b5032009-08-01 19:54:49 -0400139/*
140 * XXX
141 * should we decompose this to units_per_EM and font-size?
142 * units_per_EM setting then can go into the face, or better,
143 * read from the 'head' table.
144 *
145 * Then we either need size+shape like freetype does, or a full
146 * matrix.
147 */
148void
149hb_font_set_scale (hb_font_t *font,
150 hb_16dot16_t x_scale,
151 hb_16dot16_t y_scale);
152
153/*
154 * A zero value means "no hinting in that direction"
155 */
156void
157hb_font_set_ppem (hb_font_t *font,
158 unsigned int x_ppem,
159 unsigned int y_ppem);
160
161
162HB_END_DECLS
163
164#endif /* HB_FONT_H */