4 /* gdkfont.h -- Some global stuff related to fonts and glyphs
5 Copyright (C) 2003 Free Software Foundation, Inc.
7 This file is part of GNU Classpath.
9 GNU Classpath is free software; you can redistribute it and/or modify
10 it under the terms of the GNU General Public License as published by
11 the Free Software Foundation; either version 2, or (at your option)
14 GNU Classpath is distributed in the hope that it will be useful, but
15 WITHOUT ANY WARRANTY; without even the implied warranty of
16 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
17 General Public License for more details.
19 You should have received a copy of the GNU General Public License
20 along with GNU Classpath; see the file COPYING. If not, write to the
21 Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
24 Linking this library statically or dynamically with other modules is
25 making a combined work based on this library. Thus, the terms and
26 conditions of the GNU General Public License cover the whole
29 As a special exception, the copyright holders of this library give you
30 permission to link this library with independent modules to produce an
31 executable, regardless of the license terms of these independent
32 modules, and to copy and distribute the resulting executable under
33 terms of your choice, provided that you also meet, for each linked
34 independent module, the terms and conditions of the license of that
35 module. An independent module is a module which is not derived from
36 or based on this library. If you modify this library, you may extend
37 this exception to your version of the library, but you are not
38 obligated to do so. If you do not wish to do so, delete this
39 exception statement from your version. */
43 #include <pango/pango.h>
44 #include <pango/pango-context.h>
45 #include <pango/pango-fontmap.h>
46 #include <pango/pangoft2.h>
48 extern struct state_table
*cp_gtk_native_font_state_table
;
49 extern struct state_table
*native_glyphvector_state_table
;
50 extern struct state_table
*cp_gtk_native_text_layout_state_table
;
52 #define NSA_FONT_INIT(env, clazz) \
53 cp_gtk_native_font_state_table = cp_gtk_init_state_table (env, clazz)
55 #define NSA_GET_FONT_PTR(env, obj) \
56 cp_gtk_get_state (env, obj, cp_gtk_native_font_state_table)
58 #define NSA_SET_FONT_PTR(env, obj, ptr) \
59 cp_gtk_set_state (env, obj, cp_gtk_native_font_state_table, (void *)ptr)
61 #define NSA_DEL_FONT_PTR(env, obj) \
62 cp_gtk_remove_state_slot (env, obj, cp_gtk_native_font_state_table)
65 #define NSA_GV_INIT(env, clazz) \
66 native_glyphvector_state_table = cp_gtk_init_state_table (env, clazz)
68 #define NSA_GET_GV_PTR(env, obj) \
69 cp_gtk_get_state (env, obj, native_glyphvector_state_table)
71 #define NSA_SET_GV_PTR(env, obj, ptr) \
72 cp_gtk_set_state (env, obj, native_glyphvector_state_table, (void *)ptr)
74 #define NSA_DEL_GV_PTR(env, obj) \
75 cp_gtk_remove_state_slot (env, obj, native_glyphvector_state_table)
78 #define NSA_TEXT_LAYOUT_INIT(env, clazz) \
79 cp_gtk_native_text_layout_state_table = cp_gtk_init_state_table (env, clazz)
81 #define NSA_GET_TEXT_LAYOUT_PTR(env, obj) \
82 cp_gtk_get_state (env, obj, cp_gtk_native_text_layout_state_table)
84 #define NSA_SET_TEXT_LAYOUT_PTR(env, obj, ptr) \
85 cp_gtk_set_state (env, obj, cp_gtk_native_text_layout_state_table, (void *)ptr)
87 #define NSA_DEL_TEXT_LAYOUT_PTR(env, obj) \
88 cp_gtk_remove_state_slot (env, obj, cp_gtk_native_text_layout_state_table)
90 #define FONT_METRICS_ASCENT 0
91 #define FONT_METRICS_MAX_ASCENT 1
92 #define FONT_METRICS_DESCENT 2
93 #define FONT_METRICS_MAX_DESCENT 3
94 #define FONT_METRICS_MAX_ADVANCE 4
95 #define FONT_METRICS_HEIGHT 5
96 #define FONT_METRICS_UNDERLINE_OFFSET 6
97 #define FONT_METRICS_UNDERLINE_THICKNESS 7
98 #define NUM_FONT_METRICS 8
100 #define TEXT_METRICS_X_BEARING 0
101 #define TEXT_METRICS_Y_BEARING 1
102 #define TEXT_METRICS_WIDTH 2
103 #define TEXT_METRICS_HEIGHT 3
104 #define TEXT_METRICS_X_ADVANCE 4
105 #define TEXT_METRICS_Y_ADVANCE 5
106 #define NUM_TEXT_METRICS 6
108 #define NUM_GLYPH_METRICS 10
110 #define GLYPH_LOG_X(i) (NUM_GLYPH_METRICS * (i) )
111 #define GLYPH_LOG_Y(i) (NUM_GLYPH_METRICS * (i) + 1)
112 #define GLYPH_LOG_WIDTH(i) (NUM_GLYPH_METRICS * (i) + 2)
113 #define GLYPH_LOG_HEIGHT(i) (NUM_GLYPH_METRICS * (i) + 3)
115 #define GLYPH_INK_X(i) (NUM_GLYPH_METRICS * (i) + 4)
116 #define GLYPH_INK_Y(i) (NUM_GLYPH_METRICS * (i) + 5)
117 #define GLYPH_INK_WIDTH(i) (NUM_GLYPH_METRICS * (i) + 6)
118 #define GLYPH_INK_HEIGHT(i) (NUM_GLYPH_METRICS * (i) + 7)
120 #define GLYPH_POS_X(i) (NUM_GLYPH_METRICS * (i) + 8)
121 #define GLYPH_POS_Y(i) (NUM_GLYPH_METRICS * (i) + 9)
126 PangoFontDescription
*desc
;
130 * The GdkGraphics2D (using cairo) may store a pointer to a
131 * cairo_font_t here; since we want to work equally well with
132 * the GdkGraphics class (using GDK) we do not explicitly mention
133 * cairo types here; it is up to the higher level driver routine
134 * in GdkClasspathFontPeer.java to decide which backend functions
137 void *graphics_resource
;
142 PangoLayout
*pango_layout
;
145 #endif /* __GDKFONT_H__ */