Merge from mainline (gomp-merge-2005-02-26).
[official-gcc.git] / libjava / jni / gtk-peer / gdkfont.h
blob3370152e4e39f254a3c1435ba277642aa65ebf95
1 #ifndef __GDKFONT_H__
2 #define __GDKFONT_H__
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)
12 any later version.
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., 59 Temple Place, Suite 330, Boston, MA
22 02111-1307 USA.
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
27 combination.
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. */
41 #include "gtkpeer.h"
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 *native_font_state_table;
49 extern struct state_table *native_glyphvector_state_table;
50 extern struct state_table *native_text_layout_state_table;
52 #define NSA_FONT_INIT(env, clazz) \
53 native_font_state_table = init_state_table (env, clazz)
55 #define NSA_GET_FONT_PTR(env, obj) \
56 get_state (env, obj, native_font_state_table)
58 #define NSA_SET_FONT_PTR(env, obj, ptr) \
59 set_state (env, obj, native_font_state_table, (void *)ptr)
61 #define NSA_DEL_FONT_PTR(env, obj) \
62 remove_state_slot (env, obj, native_font_state_table)
65 #define NSA_GV_INIT(env, clazz) \
66 native_glyphvector_state_table = init_state_table (env, clazz)
68 #define NSA_GET_GV_PTR(env, obj) \
69 get_state (env, obj, native_glyphvector_state_table)
71 #define NSA_SET_GV_PTR(env, obj, ptr) \
72 set_state (env, obj, native_glyphvector_state_table, (void *)ptr)
74 #define NSA_DEL_GV_PTR(env, obj) \
75 remove_state_slot (env, obj, native_glyphvector_state_table)
78 #define NSA_TEXT_LAYOUT_INIT(env, clazz) \
79 native_text_layout_state_table = init_state_table (env, clazz)
81 #define NSA_GET_TEXT_LAYOUT_PTR(env, obj) \
82 get_state (env, obj, native_text_layout_state_table)
84 #define NSA_SET_TEXT_LAYOUT_PTR(env, obj, ptr) \
85 set_state (env, obj, native_text_layout_state_table, (void *)ptr)
87 #define NSA_DEL_TEXT_LAYOUT_PTR(env, obj) \
88 remove_state_slot (env, obj, 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 NUM_FONT_METRICS 5
97 #define TEXT_METRICS_X_BEARING 0
98 #define TEXT_METRICS_Y_BEARING 1
99 #define TEXT_METRICS_WIDTH 2
100 #define TEXT_METRICS_HEIGHT 3
101 #define TEXT_METRICS_X_ADVANCE 4
102 #define TEXT_METRICS_Y_ADVANCE 5
103 #define NUM_TEXT_METRICS 6
105 #define NUM_GLYPH_METRICS 10
107 #define GLYPH_LOG_X(i) (NUM_GLYPH_METRICS * (i) )
108 #define GLYPH_LOG_Y(i) (NUM_GLYPH_METRICS * (i) + 1)
109 #define GLYPH_LOG_WIDTH(i) (NUM_GLYPH_METRICS * (i) + 2)
110 #define GLYPH_LOG_HEIGHT(i) (NUM_GLYPH_METRICS * (i) + 3)
112 #define GLYPH_INK_X(i) (NUM_GLYPH_METRICS * (i) + 4)
113 #define GLYPH_INK_Y(i) (NUM_GLYPH_METRICS * (i) + 5)
114 #define GLYPH_INK_WIDTH(i) (NUM_GLYPH_METRICS * (i) + 6)
115 #define GLYPH_INK_HEIGHT(i) (NUM_GLYPH_METRICS * (i) + 7)
117 #define GLYPH_POS_X(i) (NUM_GLYPH_METRICS * (i) + 8)
118 #define GLYPH_POS_Y(i) (NUM_GLYPH_METRICS * (i) + 9)
120 struct peerfont
122 PangoFont *font;
123 PangoFontDescription *desc;
124 PangoContext *ctx;
125 PangoLayout *layout;
127 * The GdkGraphics2D (using cairo) may store a pointer to a
128 * cairo_font_t here; since we want to work equally well with
129 * the GdkGraphics class (using GDK) we do not explicitly mention
130 * cairo types here; it is up to the higher level driver routine
131 * in GdkClasspathFontPeer.java to decide which backend functions
132 * to invoke.
134 void *graphics_resource;
137 struct textlayout
139 PangoLayout *pango_layout;
142 #endif /* __GDKFONT_H__ */