1 /* GDK - The GIMP Drawing Kit
2 * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald
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.
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.
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.
21 * Modified by the GTK+ Team and others 1997-2000. See the AUTHORS
22 * file for a list of people on the GTK+ Team.
26 * GTK+ DirectFB backend
27 * Copyright (C) 2001-2002 convergence integrated media GmbH
28 * Copyright (C) 2002-2004 convergence GmbH
29 * Written by Denis Oliver Kropp <dok@convergence.de> and
30 * Sven Neumann <sven@convergence.de>
33 #undef GDK_DISABLE_DEPRECATED
40 #include "gdkdirectfb.h"
41 #include "gdkprivate-directfb.h"
43 #include "gdkinternals.h"
49 typedef struct _GdkFontDirectFB GdkFontDirectFB;
51 struct _GdkFontDirectFB
55 IDirectFBFont *dfbfont;
60 gdk_directfb_bogus_font (gint height)
63 GdkFontDirectFB *private;
65 private = g_new0 (GdkFontDirectFB, 1);
66 font = (GdkFont *)private;
68 font->type = GDK_FONT_FONT;
69 font->ascent = height*3/4;
70 font->descent = height/4;
71 private->size = height;
72 private->base.ref_count = 1;
77 gdk_font_from_description_for_display (GdkDisplay * display,PangoFontDescription *font_desc)
81 g_return_val_if_fail (font_desc, NULL);
83 size = pango_font_description_get_size (font_desc);
85 return gdk_directfb_bogus_font (PANGO_PIXELS (size));
88 /* ********************* */
91 gdk_fontset_load (const gchar *fontset_name)
93 return gdk_directfb_bogus_font (10);
97 gdk_fontset_load_for_display (GdkDisplay *display,const gchar *font_name) {
98 return gdk_directfb_bogus_font (10);
102 gdk_font_load_for_display (GdkDisplay *display,const gchar *font_name)
104 return gdk_directfb_bogus_font (10);
108 _gdk_font_destroy (GdkFont *font)
114 case GDK_FONT_FONTSET:
117 g_error ("unknown font type.");
125 _gdk_font_strlen (GdkFont *font,
128 GdkFontDirectFB *font_private;
131 g_return_val_if_fail (font != NULL, -1);
132 g_return_val_if_fail (str != NULL, -1);
134 font_private = (GdkFontDirectFB*) font;
136 if (font->type == GDK_FONT_FONT)
138 guint16 *string_2b = (guint16 *)str;
140 while (*(string_2b++))
143 else if (font->type == GDK_FONT_FONTSET)
145 length = strlen (str);
148 g_error("undefined font type\n");
154 gdk_font_id (const GdkFont *font)
156 const GdkFontDirectFB *font_private;
158 g_return_val_if_fail (font != NULL, 0);
160 font_private = (const GdkFontDirectFB*) font;
162 if (font->type == GDK_FONT_FONT)
173 gdk_font_equal (const GdkFont *fonta,
174 const GdkFont *fontb)
176 const GdkFontDirectFB *privatea;
177 const GdkFontDirectFB *privateb;
179 g_return_val_if_fail (fonta != NULL, FALSE);
180 g_return_val_if_fail (fontb != NULL, FALSE);
182 privatea = (const GdkFontDirectFB*) fonta;
183 privateb = (const GdkFontDirectFB*) fontb;
192 gdk_text_width (GdkFont *font,
196 GdkFontDirectFB *private;
198 private = (GdkFontDirectFB*) font;
200 return (text_length * private->size) / 2;
204 gdk_text_width_wc (GdkFont *font,
205 const GdkWChar *text,
212 gdk_text_extents (GdkFont *font,
222 *ascent = font->ascent;
224 *descent = font->descent;
226 *width = gdk_text_width(font, text, text_length);
234 gdk_text_extents_wc (GdkFont *font,
235 const GdkWChar *text,
246 realstr = alloca (text_length + 1);
248 for(i = 0; i < text_length; i++)
249 realstr[i] = text[i];
253 return gdk_text_extents (font,
264 gdk_font_lookup (GdkNativeWindow xid)
266 g_warning(" gdk_font_lookup unimplemented \n");
271 gdk_font_get_display (GdkFont* font)
273 g_warning(" gdk_font_get_display unimplemented \n");
277 #define __GDK_FONT_X11_C__
278 #include "gdkaliasdef.c"