Fix few bugs in SwfdecGtkSocket that made it unusable
[swfdec.git] / swfdec / swfdec_font.h
bloba122a29806c7a5722a096daa42253b8006ad89db
1 /* Swfdec
2 * Copyright (C) 2003-2006 David Schleef <ds@schleef.org>
3 * 2005-2006 Eric Anholt <eric@anholt.net>
4 * 2006-2007 Benjamin Otte <otte@gnome.org>
6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Lesser General Public
8 * License as published by the Free Software Foundation; either
9 * version 2.1 of the License, or (at your option) any later version.
11 * This library is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Lesser General Public License for more details.
16 * You should have received a copy of the GNU Lesser General Public
17 * License along with this library; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin Street, Fifth Floor,
19 * Boston, MA 02110-1301 USA
22 #ifndef _SWFDEC_FONT_H_
23 #define _SWFDEC_FONT_H_
25 #include <pango/pangocairo.h>
26 #include <swfdec/swfdec_types.h>
27 #include <swfdec/swfdec_character.h>
29 G_BEGIN_DECLS
30 //typedef struct _SwfdecFont SwfdecFont;
31 typedef struct _SwfdecFontEntry SwfdecFontEntry;
32 typedef struct _SwfdecFontClass SwfdecFontClass;
34 #define SWFDEC_TEXT_SCALE_FACTOR (1024)
36 typedef enum {
37 SWFDEC_LANGUAGE_NONE = 0,
38 SWFDEC_LANGUAGE_LATIN = 1,
39 SWFDEC_LANGUAGE_JAPANESE = 2,
40 SWFDEC_LANGUAGE_KOREAN = 3,
41 SWFDEC_LANGUAGE_CHINESE = 4,
42 SWFDEC_LANGUAGE_CHINESE_TRADITIONAL = 5
43 } SwfdecLanguage;
45 #define SWFDEC_TYPE_FONT (swfdec_font_get_type())
46 #define SWFDEC_IS_FONT(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), SWFDEC_TYPE_FONT))
47 #define SWFDEC_IS_FONT_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), SWFDEC_TYPE_FONT))
48 #define SWFDEC_FONT(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), SWFDEC_TYPE_FONT, SwfdecFont))
49 #define SWFDEC_FONT_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), SWFDEC_TYPE_FONT, SwfdecFontClass))
51 struct _SwfdecFontEntry {
52 SwfdecDraw * draw; /* drawing operation to do or %NULL if none (ie space character) */
53 gunichar value; /* UCS2 value of glyph */
54 guint advance; /* advance when rendering character */
55 SwfdecRect extents; /* bounding box of the font relative to the scale mode */
58 struct _SwfdecFont
60 SwfdecCharacter character;
62 char * name; /* Flash's name of the font */
63 char * display_name; /* "legal" name of the font - use to display to user */
64 char * copyright; /* copyright of the font */
65 PangoFontDescription *desc;
66 gboolean bold; /* font is bold */
67 gboolean italic; /* font is italic */
68 gboolean small; /* font is rendered at small sizes */
69 GArray * glyphs; /* SwfdecFontEntry */
70 guint scale_factor; /* size of a font in glyph entry */
71 /* used when rendering TextFields */
72 guint ascent; /* font ascent */
73 guint descent; /* font descent */
74 guint leading; /* */
77 struct _SwfdecFontClass
79 SwfdecCharacterClass character_class;
82 GType swfdec_font_get_type (void);
84 SwfdecDraw * swfdec_font_get_glyph (SwfdecFont * font,
85 guint glyph);
87 int tag_func_define_font_info (SwfdecSwfDecoder * s,
88 guint tag);
89 int tag_func_define_font (SwfdecSwfDecoder * s,
90 guint tag);
91 int tag_func_define_font_2 (SwfdecSwfDecoder * s,
92 guint tag);
94 int tag_func_define_font_name (SwfdecSwfDecoder * s,
95 guint tag);
97 G_END_DECLS
98 #endif