ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/deliantra/Deliantra-Client/pangoopengl.h
Revision: 1.3
Committed: Sun Aug 13 15:14:17 2006 UTC (17 years, 9 months ago) by root
Content type: text/plain
Branch: MAIN
CVS Tags: rel-0_97, rel-0_98, rel-0_52, rel-0_53, rel-0_51, rel-0_5
Changes since 1.2: +7 -2 lines
Log Message:
*** empty log message ***

File Contents

# Content
1 /* Pango
2 * pangoopengl.h: OpenGL/Freetype2 backend
3 *
4 * Copyright (C) 1999 Red Hat Software
5 * Copyright (C) 2000 Tor Lillqvist
6 * Copyright (C) 2006 Marc Lehmann <pcg@goof.com>
7 *
8 * This file is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU Library General Public
10 * License as published by the Free Software Foundation; either
11 * version 2 of the License, or (at your option) any later version.
12 *
13 * This file is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 * Library General Public License for more details.
17 *
18 * You should have received a copy of the GNU Library General Public
19 * License along with this library; if not, write to the
20 * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
21 * Boston, MA 02111-1307, USA.
22 */
23
24 #ifndef PANGOOPENGL_H__
25 #define PANGOOPENGL_H__
26
27 #include <glib-object.h>
28
29 #include <fontconfig/fontconfig.h>
30
31 #include <pango/pango-layout.h>
32 #include <pango/pangofc-font.h>
33
34 G_BEGIN_DECLS
35
36 #define PANGO_TYPE_OPENGL_FONT_MAP (pango_opengl_font_map_get_type ())
37 #define PANGO_OPENGL_FONT_MAP(object) (G_TYPE_CHECK_INSTANCE_CAST ((object), PANGO_TYPE_OPENGL_FONT_MAP, PangoOpenGLFontMap))
38 #define PANGO_OPENGL_IS_FONT_MAP(object) (G_TYPE_CHECK_INSTANCE_TYPE ((object), PANGO_TYPE_OPENGL_FONT_MAP))
39
40 typedef struct _PangoOpenGLFontMap PangoOpenGLFontMap;
41 typedef struct _PangoOpenGLFont PangoOpenGLFont;
42 typedef struct _PangoOpenGLGlyphInfo PangoOpenGLGlyphInfo;
43 typedef struct _PangoOpenGLRenderer PangoOpenGLRenderer;
44 typedef struct _PangoOpenGLFontMapClass PangoOpenGLFontMapClass;
45
46 typedef void (*PangoOpenGLSubstituteFunc) (FcPattern *pattern, gpointer data);
47
48 #define FLAG_INVERSE 1
49 #define FLAG_OUTLINE 2 // not yet implemented
50
51 /* Calls for applications */
52
53 void
54 pango_opengl_render_layout_subpixel (PangoLayout *layout,
55 int x, int y,
56 float r, float g, float b, float a,
57 int flags);
58
59 void
60 pango_opengl_render_layout (PangoLayout *layout,
61 int x, int y,
62 float r, float g, float b, float a,
63 int flags);
64
65 GType pango_opengl_font_map_get_type (void);
66
67 PangoFontMap *pango_opengl_font_map_new (void);
68 void pango_opengl_font_map_set_default_substitute (PangoOpenGLFontMap *fontmap,
69 PangoOpenGLSubstituteFunc func,
70 gpointer data,
71 GDestroyNotify notify);
72 void pango_opengl_font_map_substitute_changed (PangoOpenGLFontMap *fontmap);
73 PangoContext *pango_opengl_font_map_create_context (PangoOpenGLFontMap *fontmap);
74
75 struct _PangoOpenGLFont
76 {
77 PangoFcFont font;
78
79 FT_Face face;
80 int load_flags;
81
82 int size;
83
84 GSList *metrics_by_lang;
85
86 GHashTable *glyph_info;
87 GDestroyNotify glyph_cache_destroy;
88 };
89
90 struct _PangoOpenGLGlyphInfo
91 {
92 PangoRectangle logical_rect;
93 PangoRectangle ink_rect;
94 void *cached_glyph;
95 };
96
97 #define PANGO_TYPE_OPENGL_FONT (pango_opengl_font_get_type ())
98 #define PANGO_OPENGL_FONT(object) (G_TYPE_CHECK_INSTANCE_CAST ((object), PANGO_TYPE_OPENGL_FONT, PangoOpenGLFont))
99 #define PANGO_OPENGL_IS_FONT(object) (G_TYPE_CHECK_INSTANCE_TYPE ((object), PANGO_TYPE_OPENGL_FONT))
100
101 #define PANGO_SCALE_26_6 (PANGO_SCALE / (1<<6))
102 #define PANGO_PIXELS_26_6(d) \
103 (((d) >= 0) ? \
104 ((d) + PANGO_SCALE_26_6 / 2) / PANGO_SCALE_26_6 : \
105 ((d) - PANGO_SCALE_26_6 / 2) / PANGO_SCALE_26_6)
106 #define PANGO_UNITS_26_6(d) (PANGO_SCALE_26_6 * (d))
107
108 GType pango_opengl_font_get_type (void);
109
110 PangoOpenGLFont *_pango_opengl_font_new (PangoOpenGLFontMap *fontmap, FcPattern *pattern);
111 FT_Library _pango_opengl_font_map_get_library (PangoFontMap *fontmap);
112
113 void *_pango_opengl_font_get_cache_glyph_data (PangoFont *font, int glyph_index);
114 void _pango_opengl_font_set_cache_glyph_data (PangoFont *font, int glyph_index, void *cached_glyph);
115 void _pango_opengl_font_set_glyph_cache_destroy (PangoFont *font, GDestroyNotify destroy_notify);
116
117 #define PANGO_TYPE_OPENGL_RENDERER (pango_opengl_renderer_get_type())
118 #define PANGO_OPENGL_RENDERER(object) (G_TYPE_CHECK_INSTANCE_CAST ((object), PANGO_TYPE_OPENGL_RENDERER, PangoOpenGLRenderer))
119 #define PANGO_IS_OPENGL_RENDERER(object) (G_TYPE_CHECK_INSTANCE_TYPE ((object), PANGO_TYPE_OPENGL_RENDERER))
120
121 GType pango_opengl_renderer_get_type (void);
122
123 PangoRenderer *_pango_opengl_font_map_get_renderer (PangoOpenGLFontMap *fontmap);
124
125 // ERROR/TODO: this is not public. this means we have to reimplement
126 // not just all of pangoft2, but all of pangofc. Whats the point
127 // of adding 3 layers of abstractions if you can't extend it in any way?
128 void pango_fc_font_get_raw_extents (PangoFcFont *font, FT_Int32 load_flags, PangoGlyph glyph, PangoRectangle *ink_rect, PangoRectangle *logical_rect);
129
130 G_END_DECLS
131
132 #endif