ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/deliantra/Deliantra-Client/pangoopengl.h
Revision: 1.2
Committed: Tue Jul 4 23:44:23 2006 UTC (17 years, 10 months ago) by root
Content type: text/plain
Branch: MAIN
CVS Tags: rel-0_2
Changes since 1.1: +5 -0 lines
Log Message:
small fixed, ported to the language called microsoft c, which
superficially looks like ISO-C and is similar enough so you can write
programs in their common subset.

File Contents

# User Rev Content
1 root 1.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     /* Calls for applications */
49    
50     void
51     pango_opengl_render_layout_subpixel (PangoLayout *layout,
52     int x, int y,
53     float r, float g, float b, float a);
54    
55     void
56     pango_opengl_render_layout (PangoLayout *layout,
57     int x, int y,
58     float r, float g, float b, float a);
59    
60     GType pango_opengl_font_map_get_type (void);
61    
62     PangoFontMap *pango_opengl_font_map_new (void);
63     void pango_opengl_font_map_set_default_substitute (PangoOpenGLFontMap *fontmap,
64     PangoOpenGLSubstituteFunc func,
65     gpointer data,
66     GDestroyNotify notify);
67     void pango_opengl_font_map_substitute_changed (PangoOpenGLFontMap *fontmap);
68     PangoContext *pango_opengl_font_map_create_context (PangoOpenGLFontMap *fontmap);
69    
70     struct _PangoOpenGLFont
71     {
72     PangoFcFont font;
73    
74     FT_Face face;
75     int load_flags;
76    
77     int size;
78    
79     GSList *metrics_by_lang;
80    
81     GHashTable *glyph_info;
82     GDestroyNotify glyph_cache_destroy;
83     };
84    
85     struct _PangoOpenGLGlyphInfo
86     {
87     PangoRectangle logical_rect;
88     PangoRectangle ink_rect;
89     void *cached_glyph;
90     };
91    
92     #define PANGO_TYPE_OPENGL_FONT (pango_opengl_font_get_type ())
93     #define PANGO_OPENGL_FONT(object) (G_TYPE_CHECK_INSTANCE_CAST ((object), PANGO_TYPE_OPENGL_FONT, PangoOpenGLFont))
94     #define PANGO_OPENGL_IS_FONT(object) (G_TYPE_CHECK_INSTANCE_TYPE ((object), PANGO_TYPE_OPENGL_FONT))
95    
96     #define PANGO_SCALE_26_6 (PANGO_SCALE / (1<<6))
97     #define PANGO_PIXELS_26_6(d) \
98     (((d) >= 0) ? \
99     ((d) + PANGO_SCALE_26_6 / 2) / PANGO_SCALE_26_6 : \
100     ((d) - PANGO_SCALE_26_6 / 2) / PANGO_SCALE_26_6)
101     #define PANGO_UNITS_26_6(d) (PANGO_SCALE_26_6 * (d))
102    
103     GType pango_opengl_font_get_type (void);
104    
105     PangoOpenGLFont *_pango_opengl_font_new (PangoOpenGLFontMap *fontmap, FcPattern *pattern);
106     FT_Library _pango_opengl_font_map_get_library (PangoFontMap *fontmap);
107    
108     void *_pango_opengl_font_get_cache_glyph_data (PangoFont *font, int glyph_index);
109     void _pango_opengl_font_set_cache_glyph_data (PangoFont *font, int glyph_index, void *cached_glyph);
110     void _pango_opengl_font_set_glyph_cache_destroy (PangoFont *font, GDestroyNotify destroy_notify);
111    
112     #define PANGO_TYPE_OPENGL_RENDERER (pango_opengl_renderer_get_type())
113     #define PANGO_OPENGL_RENDERER(object) (G_TYPE_CHECK_INSTANCE_CAST ((object), PANGO_TYPE_OPENGL_RENDERER, PangoOpenGLRenderer))
114     #define PANGO_IS_OPENGL_RENDERER(object) (G_TYPE_CHECK_INSTANCE_TYPE ((object), PANGO_TYPE_OPENGL_RENDERER))
115    
116     GType pango_opengl_renderer_get_type (void);
117    
118     PangoRenderer *_pango_opengl_font_map_get_renderer (PangoOpenGLFontMap *fontmap);
119    
120 root 1.2 // ERROR/TODO: this is not public. this means we have to reimplement
121     // not just all of pangoft2, but all of pangofc. Whats the point
122     // of adding 3 layers of abstractions if you can't extend it in any way?
123     void pango_fc_font_get_raw_extents (PangoFcFont *font, FT_Int32 load_flags, PangoGlyph glyph, PangoRectangle *ink_rect, PangoRectangle *logical_rect);
124    
125 root 1.1 G_END_DECLS
126    
127     #endif