1 /* 2 * go-font.h : 3 * 4 * Copyright (C) 2003-2004 Jody Goldberg (jody@gnome.org) 5 * 6 * This program is free software; you can redistribute it and/or 7 * modify it under the terms of the GNU General Public License as 8 * published by the Free Software Foundation; either version 2 of the 9 * License, or (at your option) version 3. 10 * 11 * This program is distributed in the hope that it will be useful, 12 * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 * GNU General Public License for more details. 15 * 16 * You should have received a copy of the GNU General Public License 17 * along with this program; if not, write to the Free Software 18 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 19 * USA 20 */ 21 #ifndef GO_FONT_H 22 #define GO_FONT_H 23 24 #include <goffice/goffice.h> 25 26 G_BEGIN_DECLS 27 28 struct _GOFontMetrics { 29 int digit_widths[10]; 30 int min_digit_width; 31 int max_digit_width; 32 int avg_digit_width; 33 int hyphen_width, minus_width, plus_width; 34 int E_width; 35 int hash_width; 36 int space_width; 37 38 /* 39 * A space that is narrower than a regular space, or 0 if no such 40 * character was found. 41 */ 42 gunichar thin_space; 43 int thin_space_width; 44 }; 45 46 struct _GOFont { 47 int ref_count; 48 int font_index; /* each renderer keeps an array for lookup */ 49 50 PangoFontDescription *desc; 51 52 /* Attributes. */ 53 int underline; 54 gboolean strikethrough; 55 GOColor color; 56 }; 57 58 GType go_font_get_type (void); 59 GOFont const *go_font_new_by_desc (PangoFontDescription *desc); 60 GOFont const *go_font_new_by_name (char const *str); 61 GOFont const *go_font_new_by_index (unsigned i); 62 char *go_font_as_str (GOFont const *font); 63 GOFont const *go_font_ref (GOFont const *font); 64 void go_font_unref (GOFont const *font); 65 gboolean go_font_eq (GOFont const *a, GOFont const *b); 66 67 GSList *go_fonts_list_families (PangoContext *context); 68 GSList *go_fonts_list_sizes (void); 69 70 GType go_font_metrics_get_type (void); 71 GOFontMetrics *go_font_metrics_new (PangoContext *context, GOFont const *font); 72 GO_VAR_DECL const GOFontMetrics *go_font_metrics_unit; 73 void go_font_metrics_free (GOFontMetrics *metrics); 74 75 /* cache notification */ 76 void go_font_cache_register (GClosure *callback); 77 void go_font_cache_unregister (GClosure *callback); 78 79 /* private */ 80 void _go_fonts_init (void); 81 void _go_fonts_shutdown (void); 82 83 G_END_DECLS 84 85 #endif /* GO_FONT_H */ 86