2 * GPAC - Multimedia Framework C SDK
\r
4 * Copyright (c) Jean Le Feuvre 2000-2005
\r
5 * All rights reserved
\r
7 * This file is part of GPAC / modules interfaces
\r
9 * GPAC is free software; you can redistribute it and/or modify
\r
10 * it under the terms of the GNU Lesser General Public License as published by
\r
11 * the Free Software Foundation; either version 2, or (at your option)
\r
12 * any later version.
\r
14 * GPAC is distributed in the hope that it will be useful,
\r
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
\r
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
\r
17 * GNU Lesser General Public License for more details.
\r
19 * You should have received a copy of the GNU Lesser General Public
\r
20 * License along with this library; see the file COPYING. If not, write to
\r
21 * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
\r
26 #ifndef _GF_MODULE_FONT_H_
\r
27 #define _GF_MODULE_FONT_H_
\r
33 #include <gpac/path2d.h>
\r
34 #include <gpac/module.h>
\r
35 #include <gpac/user.h>
\r
38 typedef struct _gf_glyph
\r
40 /*glyphs are stored as linked lists*/
\r
41 struct _gf_glyph *next;
\r
42 /*glyph ID as used in *_get_glyphs - this may not match the UTF name*/
\r
44 /*UTF-name of the glyph if any*/
\r
47 /*width of the glyph - !! this can be more than the horizontal advance !! */
\r
49 /*glyph horizontal advance in font EM size*/
\r
51 /*height of the glyph - !! this can be more than the vertical advance !! */
\r
53 /*glyph vertical advance in font EM size*/
\r
61 GF_FONT_OBLIQUE = 1<<1,
\r
62 /*font variant (smallcaps)*/
\r
63 GF_FONT_SMALLCAPS = 1<<2,
\r
65 GF_FONT_UNDERLINED = 1<<3,
\r
66 GF_FONT_STRIKEOUT = 1<<4,
\r
68 /*all font weight modification are placed AFTER 1<<9*/
\r
69 GF_FONT_WEIGHT_100 = 1<<10,
\r
70 GF_FONT_WEIGHT_LIGHTER = 1<<11,
\r
71 GF_FONT_WEIGHT_200 = 1<<12,
\r
72 GF_FONT_WEIGHT_300 = 1<<13,
\r
73 GF_FONT_WEIGHT_400 = 1<<14,
\r
74 GF_FONT_WEIGHT_NORMAL = 1<<15,
\r
75 GF_FONT_WEIGHT_500 = 1<<16,
\r
76 GF_FONT_WEIGHT_600 = 1<<17,
\r
77 GF_FONT_WEIGHT_700 = 1<<18,
\r
78 GF_FONT_WEIGHT_BOLD = 1<<19,
\r
79 GF_FONT_WEIGHT_800 = 1<<20,
\r
80 GF_FONT_WEIGHT_900 = 1<<21,
\r
81 GF_FONT_WEIGHT_BOLDER = 1<<22
\r
83 /*mask for font styles used for CSS2 selection*/
\r
84 #define GF_FONT_STYLE_MASK 0x00000007
\r
85 /*mask for all font weight*/
\r
86 #define GF_FONT_WEIGHT_MASK 0xFFFFFC00
\r
88 /*interface name and version for font engine*/
\r
89 #define GF_FONT_READER_INTERFACE GF_4CC('G','F','T', 0x01)
\r
92 typedef struct _font_reader
\r
94 /* interface declaration*/
\r
95 GF_DECL_MODULE_INTERFACE
\r
97 /*inits font engine.*/
\r
98 GF_Err (*init_font_engine)(struct _font_reader *dr);
\r
99 /*shutdown font engine*/
\r
100 GF_Err (*shutdown_font_engine)(struct _font_reader *dr);
\r
102 /*set active font . @styles indicates font styles (PLAIN, BOLD, ITALIC,
\r
103 BOLDITALIC and UNDERLINED, STRIKEOUT)*/
\r
104 GF_Err (*set_font)(struct _font_reader *dr, const char *fontName, u32 styles);
\r
106 GF_Err (*get_font_info)(struct _font_reader *dr, char **font_name, s32 *em_size, s32 *ascent, s32 *descent, s32 *underline, s32 *line_spacing, s32 *max_advance_h, s32 *max_advance_v);
\r
108 /*translate string to glyph sequence*/
\r
109 GF_Err (*get_glyphs)(struct _font_reader *dr, const char *utf_string, u32 *glyph_id_buffer, u32 *io_glyph_id_buffer_size, const char *xml_lang, Bool *rev_layout);
\r
111 /*loads glyph by name - returns NULL if glyph cannot be found*/
\r
112 GF_Glyph *(*load_glyph)(struct _font_reader *dr, u32 glyph_name);
\r
125 #endif /*_GF_MODULE_FONT_H_*/
\r