1 /* GDK - The GIMP Drawing Kit 2 * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald 3 * 4 * This library is free software; you can redistribute it and/or 5 * modify it under the terms of the GNU Lesser General Public 6 * License as published by the Free Software Foundation; either 7 * version 2 of the License, or (at your option) any later version. 8 * 9 * This library is distributed in the hope that it will be useful, 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 12 * Lesser General Public License for more details. 13 * 14 * You should have received a copy of the GNU Lesser General Public 15 * License along with this library; if not, write to the 16 * Free Software Foundation, Inc., 59 Temple Place - Suite 330, 17 * Boston, MA 02111-1307, USA. 18 */ 19 20 /* 21 * Modified by the GTK+ Team and others 1997-2000. See the AUTHORS 22 * file for a list of people on the GTK+ Team. See the ChangeLog 23 * files for a list of changes. These files are distributed with 24 * GTK+ at ftp://ftp.gtk.org/pub/gtk/. 25 */ 26 27 #if !defined(GDK_DISABLE_DEPRECATED) || defined(GDK_COMPILATION) 28 29 #ifndef __GDK_FONT_H__ 30 #define __GDK_FONT_H__ 31 32 #include <gdk/gdktypes.h> 33 #include <pango/pango.h> 34 35 G_BEGIN_DECLS 36 37 #define GDK_TYPE_FONT gdk_font_get_type () 38 39 /* Types of font. 40 * GDK_FONT_FONT: the font is an XFontStruct. 41 * GDK_FONT_FONTSET: the font is an XFontSet used for I18N. 42 */ 43 typedef enum 44 { 45 GDK_FONT_FONT, 46 GDK_FONT_FONTSET 47 } GdkFontType; 48 49 struct _GdkFont 50 { 51 GdkFontType type; 52 gint ascent; 53 gint descent; 54 }; 55 56 GType gdk_font_get_type (void) G_GNUC_CONST; 57 58 GdkFont* gdk_font_ref (GdkFont *font); 59 void gdk_font_unref (GdkFont *font); 60 gint gdk_font_id (const GdkFont *font); 61 gboolean gdk_font_equal (const GdkFont *fonta, 62 const GdkFont *fontb); 63 64 GdkFont *gdk_font_load_for_display (GdkDisplay *display, 65 const gchar *font_name); 66 GdkFont *gdk_fontset_load_for_display (GdkDisplay *display, 67 const gchar *fontset_name); 68 GdkFont *gdk_font_from_description_for_display (GdkDisplay *display, 69 PangoFontDescription *font_desc); 70 71 #ifndef GDK_DISABLE_DEPRECATED 72 73 #ifndef GDK_MULTIHEAD_SAFE 74 GdkFont* gdk_font_load (const gchar *font_name); 75 GdkFont* gdk_fontset_load (const gchar *fontset_name); 76 GdkFont* gdk_font_from_description (PangoFontDescription *font_desc); 77 #endif 78 79 gint gdk_string_width (GdkFont *font, 80 const gchar *string); 81 gint gdk_text_width (GdkFont *font, 82 const gchar *text, 83 gint text_length); 84 gint gdk_text_width_wc (GdkFont *font, 85 const GdkWChar *text, 86 gint text_length); 87 gint gdk_char_width (GdkFont *font, 88 gchar character); 89 gint gdk_char_width_wc (GdkFont *font, 90 GdkWChar character); 91 gint gdk_string_measure (GdkFont *font, 92 const gchar *string); 93 gint gdk_text_measure (GdkFont *font, 94 const gchar *text, 95 gint text_length); 96 gint gdk_char_measure (GdkFont *font, 97 gchar character); 98 gint gdk_string_height (GdkFont *font, 99 const gchar *string); 100 gint gdk_text_height (GdkFont *font, 101 const gchar *text, 102 gint text_length); 103 gint gdk_char_height (GdkFont *font, 104 gchar character); 105 106 void gdk_text_extents (GdkFont *font, 107 const gchar *text, 108 gint text_length, 109 gint *lbearing, 110 gint *rbearing, 111 gint *width, 112 gint *ascent, 113 gint *descent); 114 void gdk_text_extents_wc (GdkFont *font, 115 const GdkWChar *text, 116 gint text_length, 117 gint *lbearing, 118 gint *rbearing, 119 gint *width, 120 gint *ascent, 121 gint *descent); 122 void gdk_string_extents (GdkFont *font, 123 const gchar *string, 124 gint *lbearing, 125 gint *rbearing, 126 gint *width, 127 gint *ascent, 128 gint *descent); 129 130 GdkDisplay * gdk_font_get_display (GdkFont *font); 131 132 #endif /* GDK_DISABLE_DEPRECATED */ 133 134 G_END_DECLS 135 136 #endif /* __GDK_FONT_H__ */ 137 138 #endif /* !GDK_DISABLE_DEPRECATED || GDK_COMPILATION || GTK_COMPILATION */ 139