1 #ifndef __GDKFONT_H__ 2 #define __GDKFONT_H__ 3 4 /* gdkfont.h -- Some global stuff related to fonts and glyphs 5 Copyright (C) 2003 Free Software Foundation, Inc. 6 7 This file is part of GNU Classpath. 8 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. 13 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. 18 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 22 02110-1301 USA. 23 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. 28 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. */ 40 41 #include "gtkpeer.h" 42 43 #define PANGO_ENABLE_ENGINE 44 #include <pango/pango.h> 45 #include <pango/pango-context.h> 46 #include <pango/pango-fontmap.h> 47 #include <pango/pangoft2.h> 48 49 #define FONT_METRICS_ASCENT 0 50 #define FONT_METRICS_MAX_ASCENT 1 51 #define FONT_METRICS_DESCENT 2 52 #define FONT_METRICS_MAX_DESCENT 3 53 #define FONT_METRICS_MAX_ADVANCE 4 54 #define FONT_METRICS_HEIGHT 5 55 #define FONT_METRICS_UNDERLINE_OFFSET 6 56 #define FONT_METRICS_UNDERLINE_THICKNESS 7 57 #define NUM_FONT_METRICS 8 58 59 #define TEXT_METRICS_X_BEARING 0 60 #define TEXT_METRICS_Y_BEARING 1 61 #define TEXT_METRICS_WIDTH 2 62 #define TEXT_METRICS_HEIGHT 3 63 #define TEXT_METRICS_X_ADVANCE 4 64 #define TEXT_METRICS_Y_ADVANCE 5 65 #define NUM_TEXT_METRICS 6 66 67 #define NUM_GLYPH_METRICS 10 68 69 #define GLYPH_LOG_X(i) (NUM_GLYPH_METRICS * (i) ) 70 #define GLYPH_LOG_Y(i) (NUM_GLYPH_METRICS * (i) + 1) 71 #define GLYPH_LOG_WIDTH(i) (NUM_GLYPH_METRICS * (i) + 2) 72 #define GLYPH_LOG_HEIGHT(i) (NUM_GLYPH_METRICS * (i) + 3) 73 74 #define GLYPH_INK_X(i) (NUM_GLYPH_METRICS * (i) + 4) 75 #define GLYPH_INK_Y(i) (NUM_GLYPH_METRICS * (i) + 5) 76 #define GLYPH_INK_WIDTH(i) (NUM_GLYPH_METRICS * (i) + 6) 77 #define GLYPH_INK_HEIGHT(i) (NUM_GLYPH_METRICS * (i) + 7) 78 79 #define GLYPH_POS_X(i) (NUM_GLYPH_METRICS * (i) + 8) 80 #define GLYPH_POS_Y(i) (NUM_GLYPH_METRICS * (i) + 9) 81 82 struct peerfont 83 { 84 PangoFont *font; 85 PangoFontset *set; 86 PangoFontDescription *desc; 87 PangoContext *ctx; 88 PangoLayout *layout; 89 /* 90 * The GdkGraphics2D (using cairo) may store a pointer to a 91 * cairo_font_t here; since we want to work equally well with 92 * the GdkGraphics class (using GDK) we do not explicitly mention 93 * cairo types here; it is up to the higher level driver routine 94 * in GdkClasspathFontPeer.java to decide which backend functions 95 * to invoke. 96 */ 97 void *graphics_resource; 98 }; 99 100 struct textlayout 101 { 102 PangoLayout *pango_layout; 103 }; 104 105 #endif /* __GDKFONT_H__ */ 106