mirror of
https://gitlab.gnome.org/GNOME/gtk.git
synced 2024-12-24 12:41:16 +00:00
Remove deprecated GdkFont
Fixes https://bugzilla.gnome.org/show_bug.cgi?id=604196 Signed-off-by: Javier Jardón <jjardon@gnome.org>
This commit is contained in:
parent
34573b53f3
commit
655dcff096
@ -74,7 +74,6 @@ gdk_extension_mode_get_type
|
||||
gdk_fill_get_type
|
||||
gdk_fill_rule_get_type
|
||||
gdk_filter_return_get_type
|
||||
gdk_font_type_get_type
|
||||
gdk_function_get_type
|
||||
gdk_gc_values_mask_get_type
|
||||
gdk_grab_ownership_get_type
|
||||
@ -394,28 +393,6 @@ gdk_colormap_get_type
|
||||
gdk_color_get_type
|
||||
</SECTION>
|
||||
|
||||
<SECTION>
|
||||
<TITLE>Fonts</TITLE>
|
||||
<FILE>fonts</FILE>
|
||||
GdkFont
|
||||
GdkFontType
|
||||
gdk_font_load
|
||||
gdk_fontset_load
|
||||
gdk_fontset_load_for_display
|
||||
gdk_font_get_display
|
||||
gdk_font_ref
|
||||
gdk_font_unref
|
||||
gdk_font_id
|
||||
gdk_font_equal
|
||||
|
||||
<SUBSECTION Standard>
|
||||
GDK_TYPE_FONT
|
||||
GDK_TYPE_FONT_TYPE
|
||||
|
||||
<SUBSECTION Private>
|
||||
gdk_font_get_type
|
||||
</SECTION>
|
||||
|
||||
<SECTION>
|
||||
<TITLE>Drawing Primitives</TITLE>
|
||||
<FILE>drawing</FILE>
|
||||
|
@ -1,334 +0,0 @@
|
||||
<!-- ##### SECTION Title ##### -->
|
||||
Fonts
|
||||
|
||||
<!-- ##### SECTION Short_Description ##### -->
|
||||
Loading and manipulating fonts
|
||||
|
||||
<!-- ##### SECTION Long_Description ##### -->
|
||||
<para>
|
||||
The #GdkFont data type represents a font for drawing on
|
||||
the screen. These functions provide support for
|
||||
loading fonts, and also for determining the dimensions
|
||||
of characters and strings when drawn with a particular
|
||||
font.
|
||||
</para>
|
||||
|
||||
<para>
|
||||
Fonts in X are specified by a
|
||||
<firstterm>X Logical Font Description</firstterm>.
|
||||
The following description is considerably simplified.
|
||||
For definitive information about XLFD's see the
|
||||
X reference documentation. A X Logical Font Description (XLFD)
|
||||
consists of a sequence of fields separated (and surrounded by) '-'
|
||||
characters. For example, Adobe Helvetica Bold 12 pt, has the
|
||||
full description:
|
||||
<informalexample><programlisting>
|
||||
"-adobe-helvetica-bold-r-normal--12-120-75-75-p-70-iso8859-1"
|
||||
</programlisting></informalexample>
|
||||
</para>
|
||||
|
||||
<para>
|
||||
The fields in the XLFD are:
|
||||
|
||||
<informaltable pgwide="1" frame="none">
|
||||
<tgroup cols="2"><colspec colwidth="2*"/><colspec colwidth="8*"/>
|
||||
<tbody>
|
||||
|
||||
<row>
|
||||
<entry>Foundry</entry>
|
||||
<entry>the company or organization where the font originated.</entry>
|
||||
</row>
|
||||
|
||||
<row>
|
||||
<entry>Family</entry>
|
||||
<entry>the font family (a group of related font designs).</entry>
|
||||
</row>
|
||||
|
||||
<row>
|
||||
<entry>Weight</entry>
|
||||
<entry>A name for the font's typographic weight
|
||||
For example, 'bold' or 'medium').</entry>
|
||||
</row>
|
||||
|
||||
<row>
|
||||
<entry>Slant</entry>
|
||||
<entry>The slant of the font. Common values are 'R' for Roman,
|
||||
'I' for italoc, and 'O' for oblique.</entry>
|
||||
</row>
|
||||
|
||||
<row>
|
||||
<entry>Set Width</entry>
|
||||
<entry>A name for the width of the font. For example,
|
||||
'normal' or 'condensed'.</entry>
|
||||
</row>
|
||||
|
||||
<row>
|
||||
<entry>Add Style</entry>
|
||||
<entry>Additional information to distinguish a font from
|
||||
other fonts of the same family.</entry>
|
||||
</row>
|
||||
|
||||
<row>
|
||||
<entry>Pixel Size</entry>
|
||||
<entry>The body size of the font in pixels.</entry>
|
||||
</row>
|
||||
|
||||
<row>
|
||||
<entry>Point Size</entry>
|
||||
<entry>The body size of the font in 10ths of a point.
|
||||
(A <firstterm>point</firstterm> is 1/72.27 inch) </entry>
|
||||
</row>
|
||||
|
||||
<row>
|
||||
<entry>Resolution X</entry>
|
||||
<entry>The horizontal resolution that the font was designed for.</entry>
|
||||
</row>
|
||||
|
||||
<row>
|
||||
<entry>Resolution Y</entry>
|
||||
<entry>The vertical resolution that the font was designed for .</entry>
|
||||
</row>
|
||||
|
||||
<row>
|
||||
<entry>Spacing</entry>
|
||||
<entry>The type of spacing for the font - can be 'p' for proportional,
|
||||
'm' for monospaced or 'c' for charcell.</entry>
|
||||
</row>
|
||||
|
||||
<row>
|
||||
<entry>Average Width</entry>
|
||||
<entry>The average width of a glyph in the font. For monospaced
|
||||
and charcell fonts, all glyphs in the font have this width</entry>
|
||||
</row>
|
||||
|
||||
<row>
|
||||
<entry>Charset Registry</entry>
|
||||
<entry>The registration authority that owns the encoding for
|
||||
the font. Together with the Charset Encoding field, this
|
||||
defines the character set for the font.</entry>
|
||||
</row>
|
||||
|
||||
<row>
|
||||
<entry>Charset Encoding</entry>
|
||||
<entry>An identifier for the particular character set encoding.</entry>
|
||||
</row>
|
||||
|
||||
</tbody></tgroup></informaltable>
|
||||
</para>
|
||||
|
||||
<para>
|
||||
When specifying a font via a X logical Font Description,
|
||||
'*' can be used as a wildcard to match any portion of
|
||||
the XLFD. For instance, the above example could
|
||||
also be specified as
|
||||
<informalexample><programlisting>
|
||||
"-*-helvetica-bold-r-normal--*-120-*-*-*-*-iso8859-1"
|
||||
</programlisting></informalexample>
|
||||
|
||||
It is generally a good idea to use wildcards for any
|
||||
portion of the XLFD that your program does not care
|
||||
about specifically, since that will improve the
|
||||
chances of finding a matching font.
|
||||
</para>
|
||||
|
||||
<para>
|
||||
A <firstterm>fontset</firstterm> is a list of fonts
|
||||
that is used for drawing international text that may
|
||||
contain characters from a number of different character
|
||||
sets. It is represented by a list of XLFD's.
|
||||
</para>
|
||||
|
||||
<para>
|
||||
The font for a given character set is determined by going
|
||||
through the list of XLFD's in order. For each one, if
|
||||
the registry and and encoding fields match the desired
|
||||
character set, then that font is used, otherwise if
|
||||
the XLFD contains wild-cards for the registry and encoding
|
||||
fields, the registry and encoding for the desired character
|
||||
set are substituted in and a lookup is done. If a match is found
|
||||
that font is used. Otherwise, processing continues
|
||||
on to the next font in the list.
|
||||
</para>
|
||||
|
||||
<para>
|
||||
The functions for determining the metrics of a string
|
||||
come in several varieties that can take a number
|
||||
of forms of string input:
|
||||
|
||||
<variablelist>
|
||||
<varlistentry>
|
||||
<term>8-bit string</term>
|
||||
<listitem><para>
|
||||
When using functions like gdk_string_width() that
|
||||
take a <type>gchar *</type>, if the font is of type
|
||||
%GDK_FONT_FONT and is an 8-bit font, then each
|
||||
<type>gchar</type> indexes the glyphs in the font directly.
|
||||
</para></listitem>
|
||||
</varlistentry>
|
||||
<varlistentry>
|
||||
<term>16-bit string</term>
|
||||
<listitem><para>
|
||||
For functions taking a <type>gchar *</type>, if the
|
||||
font is of type %GDK_FONT_FONT, and is a 16-bit
|
||||
font, then the <type>gchar *</type> argument is
|
||||
interpreted as a <type>guint16 *</type> cast to
|
||||
a <type>gchar *</type> and each <type>guint16</type>
|
||||
indexes the glyphs in the font directly.
|
||||
</para></listitem>
|
||||
</varlistentry>
|
||||
<varlistentry>
|
||||
<term>Multibyte string</term>
|
||||
<listitem><para>
|
||||
For functions taking a <type>gchar *</type>, if the
|
||||
font is of type %GDK_FONT_FONTSET, then the input
|
||||
string is interpreted as a <firstterm>multibyte</firstterm>
|
||||
encoded according to the current locale. (A multibyte
|
||||
string is one in which each character may consist
|
||||
of one or more bytes, with different lengths for different
|
||||
characters in the string). The string will
|
||||
be rendered using one or more different fonts from
|
||||
the fontset.
|
||||
</para></listitem>
|
||||
</varlistentry>
|
||||
</variablelist>
|
||||
</para>
|
||||
|
||||
<para>
|
||||
GDK provides functions to determine a number of different
|
||||
measurements (metrics) for a given string. (Need diagram
|
||||
here).
|
||||
|
||||
<variablelist>
|
||||
<varlistentry>
|
||||
<term>ascent</term>
|
||||
<listitem><para>
|
||||
The vertical distance from the origin of the drawing
|
||||
opereration to the top of the drawn character.
|
||||
</para></listitem>
|
||||
</varlistentry>
|
||||
<varlistentry>
|
||||
<term>descent</term>
|
||||
<listitem><para>
|
||||
The vertical distance from the origin of the drawing
|
||||
opereration to the bottom of the drawn character.
|
||||
</para></listitem>
|
||||
</varlistentry>
|
||||
<varlistentry>
|
||||
<term>left bearing</term>
|
||||
<listitem><para>
|
||||
The horizontal distance from the origin of the drawing
|
||||
operation to the left-most part of the drawn character.
|
||||
</para></listitem>
|
||||
</varlistentry>
|
||||
<varlistentry>
|
||||
<term>right bearing</term>
|
||||
<listitem><para>
|
||||
The horizontal distance from the origin of the drawing
|
||||
operation to the right-most part of the drawn character.
|
||||
</para></listitem>
|
||||
</varlistentry>
|
||||
<varlistentry>
|
||||
<term>width bearing</term>
|
||||
<listitem><para>
|
||||
The horizontal distance from the origin of the drawing
|
||||
operation to the correct origin for drawing another
|
||||
string to follow the current one. Depending on the
|
||||
font, this could be greater than or less than the
|
||||
right bearing.
|
||||
</para></listitem>
|
||||
</varlistentry>
|
||||
</variablelist>
|
||||
</para>
|
||||
|
||||
<!-- ##### SECTION See_Also ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
<!-- ##### SECTION Stability_Level ##### -->
|
||||
|
||||
|
||||
<!-- ##### SECTION Image ##### -->
|
||||
|
||||
|
||||
<!-- ##### STRUCT GdkFont ##### -->
|
||||
<para>
|
||||
The <structname>GdkFont</structname> structure represents a font or fontset. It
|
||||
contains the following public fields. A new <structname>GdkFont</structname>
|
||||
structure is returned by gdk_font_load() or gdk_fontset_load(),
|
||||
and is reference counted with gdk_font_ref() and gdk_font_unref()
|
||||
</para>
|
||||
|
||||
@type: a value of type #GdkFontType which indicates
|
||||
whether this font is a single font or a fontset.
|
||||
@ascent: the maximum distance that the font, when drawn,
|
||||
ascends above the baseline.
|
||||
@descent: the maximum distance that the font, when drawn,
|
||||
descends below the baseline.
|
||||
|
||||
<!-- ##### ENUM GdkFontType ##### -->
|
||||
<para>
|
||||
Indicates the type of a font. The possible values
|
||||
are currently:
|
||||
</para>
|
||||
|
||||
@GDK_FONT_FONT: the font is a single font.
|
||||
@GDK_FONT_FONTSET: the font is a fontset.
|
||||
|
||||
<!-- ##### FUNCTION gdk_fontset_load ##### -->
|
||||
<para>
|
||||
</para>
|
||||
|
||||
@fontset_name:
|
||||
@Returns:
|
||||
|
||||
|
||||
<!-- ##### FUNCTION gdk_fontset_load_for_display ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
@display:
|
||||
@fontset_name:
|
||||
@Returns:
|
||||
|
||||
|
||||
<!-- ##### FUNCTION gdk_font_get_display ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
@font:
|
||||
@Returns:
|
||||
|
||||
|
||||
<!-- ##### FUNCTION gdk_font_ref ##### -->
|
||||
<para>
|
||||
</para>
|
||||
|
||||
@font:
|
||||
@Returns:
|
||||
|
||||
|
||||
<!-- ##### FUNCTION gdk_font_unref ##### -->
|
||||
<para>
|
||||
</para>
|
||||
|
||||
@font:
|
||||
|
||||
|
||||
<!-- ##### FUNCTION gdk_font_id ##### -->
|
||||
<para>
|
||||
</para>
|
||||
|
||||
@font:
|
||||
@Returns:
|
||||
|
||||
|
||||
<!-- ##### FUNCTION gdk_font_equal ##### -->
|
||||
<para>
|
||||
</para>
|
||||
|
||||
@fonta:
|
||||
@fontb:
|
||||
@Returns:
|
@ -82,7 +82,6 @@ gdk_public_h_sources = \
|
||||
gdkdnd.h \
|
||||
gdkdrawable.h \
|
||||
gdkevents.h \
|
||||
gdkfont.h \
|
||||
gdkgc.h \
|
||||
gdkimage.h \
|
||||
gdkinput.h \
|
||||
@ -130,7 +129,6 @@ gdk_c_sources = \
|
||||
gdkdnd.c \
|
||||
gdkdraw.c \
|
||||
gdkevents.c \
|
||||
gdkfont.c \
|
||||
gdkgc.c \
|
||||
gdkglobals.c \
|
||||
gdkimage.c \
|
||||
|
@ -27,7 +27,6 @@ libgdk_directfb_la_SOURCES = \
|
||||
gdkdisplay-directfb.h \
|
||||
gdkdrawable-directfb.c \
|
||||
gdkevents-directfb.c \
|
||||
gdkfont-directfb.c \
|
||||
gdkgc-directfb.c \
|
||||
gdkgeometry-directfb.c \
|
||||
gdkglobals-directfb.c \
|
||||
|
@ -31,7 +31,6 @@ gdkdisplay-directfb.c
|
||||
gdkdnd-directfb.c
|
||||
gdkdrawable-directfb.c
|
||||
gdkevents-directfb.c
|
||||
gdkfont-directfb.c
|
||||
gdkgc-directfb.c
|
||||
gdkgeometry-directfb.c
|
||||
gdkglobals-directfb.c
|
||||
|
@ -1,176 +0,0 @@
|
||||
/* GDK - The GIMP Drawing Kit
|
||||
* Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the
|
||||
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
||||
* Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
|
||||
/*
|
||||
* Modified by the GTK+ Team and others 1997-2000. See the AUTHORS
|
||||
* file for a list of people on the GTK+ Team.
|
||||
*/
|
||||
|
||||
/*
|
||||
* GTK+ DirectFB backend
|
||||
* Copyright (C) 2001-2002 convergence integrated media GmbH
|
||||
* Copyright (C) 2002-2004 convergence GmbH
|
||||
* Written by Denis Oliver Kropp <dok@convergence.de> and
|
||||
* Sven Neumann <sven@convergence.de>
|
||||
*/
|
||||
|
||||
#undef GDK_DISABLE_DEPRECATED
|
||||
|
||||
#include "config.h"
|
||||
#include "gdk.h"
|
||||
|
||||
#include <string.h>
|
||||
|
||||
#include "gdkdirectfb.h"
|
||||
#include "gdkprivate-directfb.h"
|
||||
|
||||
#include "gdkinternals.h"
|
||||
|
||||
#include "gdkfont.h"
|
||||
#include "gdkalias.h"
|
||||
|
||||
|
||||
typedef struct _GdkFontDirectFB GdkFontDirectFB;
|
||||
|
||||
struct _GdkFontDirectFB
|
||||
{
|
||||
GdkFontPrivate base;
|
||||
gint size;
|
||||
IDirectFBFont *dfbfont;
|
||||
};
|
||||
|
||||
|
||||
static GdkFont *
|
||||
gdk_directfb_bogus_font (gint height)
|
||||
{
|
||||
GdkFont *font;
|
||||
GdkFontDirectFB *private;
|
||||
|
||||
private = g_new0 (GdkFontDirectFB, 1);
|
||||
font = (GdkFont *)private;
|
||||
|
||||
font->type = GDK_FONT_FONT;
|
||||
font->ascent = height*3/4;
|
||||
font->descent = height/4;
|
||||
private->size = height;
|
||||
private->base.ref_count = 1;
|
||||
return font;
|
||||
}
|
||||
|
||||
|
||||
/* ********************* */
|
||||
|
||||
GdkFont*
|
||||
gdk_fontset_load (const gchar *fontset_name)
|
||||
{
|
||||
return gdk_directfb_bogus_font (10);
|
||||
}
|
||||
|
||||
GdkFont *
|
||||
gdk_fontset_load_for_display (GdkDisplay *display,const gchar *font_name) {
|
||||
return gdk_directfb_bogus_font (10);
|
||||
}
|
||||
|
||||
void
|
||||
_gdk_font_destroy (GdkFont *font)
|
||||
{
|
||||
switch (font->type)
|
||||
{
|
||||
case GDK_FONT_FONT:
|
||||
break;
|
||||
case GDK_FONT_FONTSET:
|
||||
break;
|
||||
default:
|
||||
g_error ("unknown font type.");
|
||||
break;
|
||||
}
|
||||
|
||||
g_free (font);
|
||||
}
|
||||
|
||||
gint
|
||||
_gdk_font_strlen (GdkFont *font,
|
||||
const gchar *str)
|
||||
{
|
||||
GdkFontDirectFB *font_private;
|
||||
gint length = 0;
|
||||
|
||||
g_return_val_if_fail (font != NULL, -1);
|
||||
g_return_val_if_fail (str != NULL, -1);
|
||||
|
||||
font_private = (GdkFontDirectFB*) font;
|
||||
|
||||
if (font->type == GDK_FONT_FONT)
|
||||
{
|
||||
guint16 *string_2b = (guint16 *)str;
|
||||
|
||||
while (*(string_2b++))
|
||||
length++;
|
||||
}
|
||||
else if (font->type == GDK_FONT_FONTSET)
|
||||
{
|
||||
length = strlen (str);
|
||||
}
|
||||
else
|
||||
g_error("undefined font type\n");
|
||||
|
||||
return length;
|
||||
}
|
||||
|
||||
gint
|
||||
gdk_font_id (const GdkFont *font)
|
||||
{
|
||||
const GdkFontDirectFB *font_private;
|
||||
|
||||
g_return_val_if_fail (font != NULL, 0);
|
||||
|
||||
font_private = (const GdkFontDirectFB*) font;
|
||||
|
||||
if (font->type == GDK_FONT_FONT)
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
else
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
gint
|
||||
gdk_font_equal (const GdkFont *fonta,
|
||||
const GdkFont *fontb)
|
||||
{
|
||||
const GdkFontDirectFB *privatea;
|
||||
const GdkFontDirectFB *privateb;
|
||||
|
||||
g_return_val_if_fail (fonta != NULL, FALSE);
|
||||
g_return_val_if_fail (fontb != NULL, FALSE);
|
||||
|
||||
privatea = (const GdkFontDirectFB*) fonta;
|
||||
privateb = (const GdkFontDirectFB*) fontb;
|
||||
|
||||
if(fonta == fontb)
|
||||
return TRUE;
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
|
||||
#define __GDK_FONT_X11_C__
|
||||
#include "gdkaliasdef.c"
|
@ -41,7 +41,6 @@
|
||||
#include <gdk/gdkdrawable.h>
|
||||
#include <gdk/gdkenumtypes.h>
|
||||
#include <gdk/gdkevents.h>
|
||||
#include <gdk/gdkfont.h>
|
||||
#include <gdk/gdkgc.h>
|
||||
#include <gdk/gdkimage.h>
|
||||
#include <gdk/gdkinput.h>
|
||||
|
@ -279,7 +279,6 @@ gdk_subwindow_mode_get_type G_GNUC_CONST
|
||||
gdk_visibility_state_get_type G_GNUC_CONST
|
||||
gdk_wm_decoration_get_type G_GNUC_CONST
|
||||
gdk_wm_function_get_type G_GNUC_CONST
|
||||
gdk_font_type_get_type G_GNUC_CONST
|
||||
gdk_cursor_type_get_type G_GNUC_CONST
|
||||
gdk_drag_action_get_type G_GNUC_CONST
|
||||
gdk_gc_values_mask_get_type G_GNUC_CONST
|
||||
@ -295,26 +294,6 @@ gdk_visual_type_get_type G_GNUC_CONST
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if IN_HEADER(__GDK_FONT_H__)
|
||||
#if IN_FILE(__GDK_FONT_C__)
|
||||
gdk_font_get_type G_GNUC_CONST
|
||||
gdk_font_ref
|
||||
gdk_font_unref
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if IN_HEADER(__GDK_FONT_H__)
|
||||
#if IN_FILE(__GDK_FONT_X11_C__)
|
||||
#ifndef GDK_DISABLE_DEPRECATED
|
||||
gdk_font_get_display
|
||||
gdk_fontset_load
|
||||
#endif
|
||||
gdk_font_id
|
||||
gdk_font_equal
|
||||
gdk_fontset_load_for_display
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if IN_HEADER(__GDK_CAIRO_H__)
|
||||
#if IN_FILE(__GDK_CAIRO_C__)
|
||||
gdk_cairo_create
|
||||
|
@ -1,90 +0,0 @@
|
||||
/* GDK - The GIMP Drawing Kit
|
||||
* Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the
|
||||
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
||||
* Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
|
||||
/*
|
||||
* Modified by the GTK+ Team and others 1997-2000. See the AUTHORS
|
||||
* file for a list of people on the GTK+ Team. See the ChangeLog
|
||||
* files for a list of changes. These files are distributed with
|
||||
* GTK+ at ftp://ftp.gtk.org/pub/gtk/.
|
||||
*/
|
||||
|
||||
#undef GDK_DISABLE_DEPRECATED
|
||||
|
||||
#include "config.h"
|
||||
#include "gdkdisplay.h"
|
||||
#include "gdkfont.h"
|
||||
#include "gdkinternals.h"
|
||||
#include "gdkalias.h"
|
||||
|
||||
GType
|
||||
gdk_font_get_type (void)
|
||||
{
|
||||
static GType our_type = 0;
|
||||
|
||||
if (our_type == 0)
|
||||
our_type = g_boxed_type_register_static (g_intern_static_string ("GdkFont"),
|
||||
(GBoxedCopyFunc)gdk_font_ref,
|
||||
(GBoxedFreeFunc)gdk_font_unref);
|
||||
return our_type;
|
||||
}
|
||||
|
||||
/**
|
||||
* gdk_font_ref:
|
||||
* @font: a #GdkFont
|
||||
*
|
||||
* Increases the reference count of a font by one.
|
||||
*
|
||||
* Return value: @font
|
||||
**/
|
||||
GdkFont*
|
||||
gdk_font_ref (GdkFont *font)
|
||||
{
|
||||
GdkFontPrivate *private;
|
||||
|
||||
g_return_val_if_fail (font != NULL, NULL);
|
||||
|
||||
private = (GdkFontPrivate*) font;
|
||||
private->ref_count += 1;
|
||||
return font;
|
||||
}
|
||||
|
||||
/**
|
||||
* gdk_font_unref:
|
||||
* @font: a #GdkFont
|
||||
*
|
||||
* Decreases the reference count of a font by one.
|
||||
* If the result is zero, destroys the font.
|
||||
**/
|
||||
void
|
||||
gdk_font_unref (GdkFont *font)
|
||||
{
|
||||
GdkFontPrivate *private;
|
||||
private = (GdkFontPrivate*) font;
|
||||
|
||||
g_return_if_fail (font != NULL);
|
||||
g_return_if_fail (private->ref_count > 0);
|
||||
|
||||
private->ref_count -= 1;
|
||||
if (private->ref_count == 0)
|
||||
_gdk_font_destroy (font);
|
||||
}
|
||||
|
||||
|
||||
#define __GDK_FONT_C__
|
||||
#include "gdkaliasdef.c"
|
@ -1,81 +0,0 @@
|
||||
/* GDK - The GIMP Drawing Kit
|
||||
* Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the
|
||||
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
||||
* Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
|
||||
/*
|
||||
* Modified by the GTK+ Team and others 1997-2000. See the AUTHORS
|
||||
* file for a list of people on the GTK+ Team. See the ChangeLog
|
||||
* files for a list of changes. These files are distributed with
|
||||
* GTK+ at ftp://ftp.gtk.org/pub/gtk/.
|
||||
*/
|
||||
|
||||
#if !defined(GDK_DISABLE_DEPRECATED) || defined(GDK_COMPILATION) || defined(GTK_COMPILATION)
|
||||
|
||||
#ifndef __GDK_FONT_H__
|
||||
#define __GDK_FONT_H__
|
||||
|
||||
#include <gdk/gdktypes.h>
|
||||
#include <pango/pango.h>
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
#define GDK_TYPE_FONT gdk_font_get_type ()
|
||||
|
||||
/* Types of font.
|
||||
* GDK_FONT_FONT: the font is an XFontStruct.
|
||||
* GDK_FONT_FONTSET: the font is an XFontSet used for I18N.
|
||||
*/
|
||||
typedef enum
|
||||
{
|
||||
GDK_FONT_FONT,
|
||||
GDK_FONT_FONTSET
|
||||
} GdkFontType;
|
||||
|
||||
struct _GdkFont
|
||||
{
|
||||
GdkFontType type;
|
||||
gint ascent;
|
||||
gint descent;
|
||||
};
|
||||
|
||||
GType gdk_font_get_type (void) G_GNUC_CONST;
|
||||
|
||||
GdkFont* gdk_font_ref (GdkFont *font);
|
||||
void gdk_font_unref (GdkFont *font);
|
||||
gint gdk_font_id (const GdkFont *font);
|
||||
gboolean gdk_font_equal (const GdkFont *fonta,
|
||||
const GdkFont *fontb);
|
||||
|
||||
GdkFont *gdk_fontset_load_for_display (GdkDisplay *display,
|
||||
const gchar *fontset_name);
|
||||
|
||||
#ifndef GDK_DISABLE_DEPRECATED
|
||||
|
||||
#ifndef GDK_MULTIHEAD_SAFE
|
||||
GdkFont* gdk_fontset_load (const gchar *fontset_name);
|
||||
#endif
|
||||
|
||||
GdkDisplay * gdk_font_get_display (GdkFont *font);
|
||||
|
||||
#endif /* GDK_DISABLE_DEPRECATED */
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
#endif /* __GDK_FONT_H__ */
|
||||
|
||||
#endif /* !GDK_DISABLE_DEPRECATED || GDK_COMPILATION || GTK_COMPILATION */
|
@ -89,18 +89,6 @@ typedef enum {
|
||||
GDK_DEBUG_EVENTLOOP = 1 <<15
|
||||
} GdkDebugFlag;
|
||||
|
||||
#ifndef GDK_DISABLE_DEPRECATED
|
||||
|
||||
typedef struct _GdkFontPrivate GdkFontPrivate;
|
||||
|
||||
struct _GdkFontPrivate
|
||||
{
|
||||
GdkFont font;
|
||||
guint ref_count;
|
||||
};
|
||||
|
||||
#endif /* GDK_DISABLE_DEPRECATED */
|
||||
|
||||
extern GList *_gdk_default_filters;
|
||||
extern GdkWindow *_gdk_parent_root;
|
||||
extern gint _gdk_error_code;
|
||||
@ -452,8 +440,6 @@ void _gdk_drawable_end_direct_draw (gpointer priv_data);
|
||||
*****************************************/
|
||||
|
||||
/* Font/string functions implemented in module-specific code */
|
||||
gint _gdk_font_strlen (GdkFont *font, const char *str);
|
||||
void _gdk_font_destroy (GdkFont *font);
|
||||
|
||||
void _gdk_colormap_real_destroy (GdkColormap *colormap);
|
||||
|
||||
|
@ -102,7 +102,6 @@ typedef guint32 GdkNativeWindow;
|
||||
typedef struct _GdkColor GdkColor;
|
||||
typedef struct _GdkColormap GdkColormap;
|
||||
typedef struct _GdkCursor GdkCursor;
|
||||
typedef struct _GdkFont GdkFont;
|
||||
typedef struct _GdkGC GdkGC;
|
||||
typedef struct _GdkImage GdkImage;
|
||||
typedef struct _GdkRegion GdkRegion;
|
||||
|
@ -75,7 +75,6 @@ gdk_OBJECTS = \
|
||||
gdkdraw.obj \
|
||||
gdkenumtypes.obj \
|
||||
gdkevents.obj \
|
||||
gdkfont.obj \
|
||||
gdkgc.obj \
|
||||
gdkglobals.obj \
|
||||
gdkimage.obj \
|
||||
@ -105,7 +104,6 @@ gdk_public_h_sources = \
|
||||
gdkdnd.h \
|
||||
gdkdrawable.h \
|
||||
gdkevents.h \
|
||||
gdkfont.h \
|
||||
gdkgc.h \
|
||||
gdkkeysyms.h \
|
||||
gdkimage.h \
|
||||
|
@ -32,7 +32,6 @@ libgdk_quartz_la_SOURCES = \
|
||||
gdkdrawable-quartz.h \
|
||||
gdkevents-quartz.c \
|
||||
gdkeventloop-quartz.c \
|
||||
gdkfont-quartz.c \
|
||||
gdkgc-quartz.c \
|
||||
gdkgeometry-quartz.c \
|
||||
gdkglobals-quartz.c \
|
||||
|
@ -1,74 +0,0 @@
|
||||
/* gdkwindow-quartz.c
|
||||
*
|
||||
* Copyright (C) 2005 Imendio AB
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the
|
||||
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
||||
* Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
|
||||
|
||||
#include "config.h"
|
||||
|
||||
#include "gdkfont.h"
|
||||
|
||||
|
||||
GdkFont *
|
||||
gdk_fontset_load_for_display (GdkDisplay *display,
|
||||
const gchar *fontset_name)
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
|
||||
GdkFont*
|
||||
gdk_fontset_load (const gchar *fontset_name)
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
|
||||
void
|
||||
_gdk_font_destroy (GdkFont *font)
|
||||
{
|
||||
/* FIXME: Implement */
|
||||
}
|
||||
|
||||
gint
|
||||
_gdk_font_strlen (GdkFont *font,
|
||||
const gchar *str)
|
||||
{
|
||||
/* FIXME: Implement */
|
||||
return -1;
|
||||
}
|
||||
|
||||
gint
|
||||
gdk_font_id (const GdkFont *font)
|
||||
{
|
||||
/* FIXME: Implement */
|
||||
return 0;
|
||||
}
|
||||
|
||||
gboolean
|
||||
gdk_font_equal (const GdkFont *fonta,
|
||||
const GdkFont *fontb)
|
||||
{
|
||||
/* FIXME: Implement */
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
GdkDisplay*
|
||||
gdk_font_get_display (GdkFont* font)
|
||||
{
|
||||
/* FIXME: Implement */
|
||||
return NULL;
|
||||
}
|
@ -40,7 +40,6 @@ libgdk_win32_la_SOURCES = \
|
||||
gdkdrawable-win32.c \
|
||||
gdkdrawable-win32.h \
|
||||
gdkevents-win32.c \
|
||||
gdkfont-win32.c \
|
||||
gdkgc-win32.c \
|
||||
gdkgeometry-win32.c \
|
||||
gdkglobals-win32.c \
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -120,7 +120,6 @@ GdkScreen *GDK_WINDOW_SCREEN(GObject *win);
|
||||
typedef struct _GdkColormapPrivateWin32 GdkColormapPrivateWin32;
|
||||
typedef struct _GdkCursorPrivate GdkCursorPrivate;
|
||||
typedef struct _GdkWin32SingleFont GdkWin32SingleFont;
|
||||
typedef struct _GdkFontPrivateWin32 GdkFontPrivateWin32;
|
||||
typedef struct _GdkGCWin32 GdkGCWin32;
|
||||
typedef struct _GdkGCWin32Class GdkGCWin32Class;
|
||||
|
||||
@ -138,17 +137,6 @@ struct _GdkWin32SingleFont
|
||||
FONTSIGNATURE fs;
|
||||
};
|
||||
|
||||
#ifndef GDK_DISABLE_DEPRECATED
|
||||
|
||||
struct _GdkFontPrivateWin32
|
||||
{
|
||||
GdkFontPrivate base;
|
||||
GSList *fonts; /* List of GdkWin32SingleFonts */
|
||||
GSList *names;
|
||||
};
|
||||
|
||||
#endif /* GDK_DISABLE_DEPRECATED */
|
||||
|
||||
struct _GdkVisualClass
|
||||
{
|
||||
GObjectClass parent_class;
|
||||
@ -292,15 +280,6 @@ void _gdk_selection_property_delete (GdkWindow *);
|
||||
|
||||
void _gdk_dropfiles_store (gchar *data);
|
||||
|
||||
void _gdk_wchar_text_handle (GdkFont *font,
|
||||
const wchar_t *wcstr,
|
||||
int wclen,
|
||||
void (*handler)(GdkWin32SingleFont *,
|
||||
const wchar_t *,
|
||||
int,
|
||||
void *),
|
||||
void *arg);
|
||||
|
||||
void _gdk_push_modal_window (GdkWindow *window);
|
||||
void _gdk_remove_modal_window (GdkWindow *window);
|
||||
GdkWindow *_gdk_modal_current (void);
|
||||
|
@ -38,7 +38,6 @@ gdk_win32_OBJECTS = \
|
||||
gdkdisplay-win32.obj \
|
||||
gdkdrawable-win32.obj \
|
||||
gdkevents-win32.obj \
|
||||
gdkfont-win32.obj \
|
||||
gdkgc-win32.obj \
|
||||
gdkgeometry-win32.obj \
|
||||
gdkglobals-win32.obj \
|
||||
|
@ -37,7 +37,6 @@ libgdk_x11_la_SOURCES = \
|
||||
gdkeventsource.h \
|
||||
gdkeventtranslator.c \
|
||||
gdkeventtranslator.h \
|
||||
gdkfont-x11.c \
|
||||
gdkgc-x11.c \
|
||||
gdkgeometry-x11.c \
|
||||
gdkglobals-x11.c \
|
||||
|
@ -1,407 +0,0 @@
|
||||
/* GDK - The GIMP Drawing Kit
|
||||
* Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the
|
||||
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
||||
* Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
|
||||
/*
|
||||
* Modified by the GTK+ Team and others 1997-2000. See the AUTHORS
|
||||
* file for a list of people on the GTK+ Team. See the ChangeLog
|
||||
* files for a list of changes. These files are distributed with
|
||||
* GTK+ at ftp://ftp.gtk.org/pub/gtk/.
|
||||
*/
|
||||
|
||||
#undef GDK_DISABLE_DEPRECATED
|
||||
|
||||
#include "config.h"
|
||||
#include <X11/Xlib.h>
|
||||
#include <X11/Xos.h>
|
||||
#include <locale.h>
|
||||
|
||||
#include "gdkx.h"
|
||||
#include "gdkfont.h"
|
||||
#include "gdkprivate-x11.h"
|
||||
#include "gdkinternals.h"
|
||||
#include "gdkdisplay-x11.h"
|
||||
#include "gdkscreen-x11.h"
|
||||
#include "gdkalias.h"
|
||||
|
||||
typedef struct _GdkFontPrivateX GdkFontPrivateX;
|
||||
|
||||
struct _GdkFontPrivateX
|
||||
{
|
||||
GdkFontPrivate base;
|
||||
/* XFontStruct *xfont; */
|
||||
/* generic pointer point to XFontStruct or XFontSet */
|
||||
gpointer xfont;
|
||||
GdkDisplay *display;
|
||||
|
||||
GSList *names;
|
||||
XID xid;
|
||||
};
|
||||
|
||||
static GHashTable *
|
||||
gdk_font_name_hash_get (GdkDisplay *display)
|
||||
{
|
||||
GHashTable *result;
|
||||
static GQuark font_name_quark = 0;
|
||||
|
||||
if (!font_name_quark)
|
||||
font_name_quark = g_quark_from_static_string ("gdk-font-hash");
|
||||
|
||||
result = g_object_get_qdata (G_OBJECT (display), font_name_quark);
|
||||
|
||||
if (!result)
|
||||
{
|
||||
result = g_hash_table_new (g_str_hash, g_str_equal);
|
||||
g_object_set_qdata_full (G_OBJECT (display),
|
||||
font_name_quark, result, (GDestroyNotify) g_hash_table_destroy);
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
static GHashTable *
|
||||
gdk_fontset_name_hash_get (GdkDisplay *display)
|
||||
{
|
||||
GHashTable *result;
|
||||
static GQuark fontset_name_quark = 0;
|
||||
|
||||
if (!fontset_name_quark)
|
||||
fontset_name_quark = g_quark_from_static_string ("gdk-fontset-hash");
|
||||
|
||||
result = g_object_get_qdata (G_OBJECT (display), fontset_name_quark);
|
||||
|
||||
if (!result)
|
||||
{
|
||||
result = g_hash_table_new (g_str_hash, g_str_equal);
|
||||
g_object_set_qdata_full (G_OBJECT (display),
|
||||
fontset_name_quark, result, (GDestroyNotify) g_hash_table_destroy);
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* gdk_font_get_display:
|
||||
* @font: the #GdkFont.
|
||||
*
|
||||
* Returns the #GdkDisplay for @font.
|
||||
*
|
||||
* Returns: the corresponding #GdkDisplay.
|
||||
*
|
||||
* Since: 2.2
|
||||
**/
|
||||
GdkDisplay*
|
||||
gdk_font_get_display (GdkFont* font)
|
||||
{
|
||||
return ((GdkFontPrivateX *)font)->display;
|
||||
}
|
||||
|
||||
static void
|
||||
gdk_font_hash_insert (GdkFontType type,
|
||||
GdkFont *font,
|
||||
const gchar *font_name)
|
||||
{
|
||||
GdkFontPrivateX *private = (GdkFontPrivateX *)font;
|
||||
GHashTable *hash = (type == GDK_FONT_FONT) ?
|
||||
gdk_font_name_hash_get (private->display) : gdk_fontset_name_hash_get (private->display);
|
||||
|
||||
private->names = g_slist_prepend (private->names, g_strdup (font_name));
|
||||
g_hash_table_insert (hash, private->names->data, font);
|
||||
}
|
||||
|
||||
static void
|
||||
gdk_font_hash_remove (GdkFontType type,
|
||||
GdkFont *font)
|
||||
{
|
||||
GdkFontPrivateX *private = (GdkFontPrivateX *)font;
|
||||
GSList *tmp_list;
|
||||
GHashTable *hash = (type == GDK_FONT_FONT) ?
|
||||
gdk_font_name_hash_get (private->display) : gdk_fontset_name_hash_get (private->display);
|
||||
|
||||
tmp_list = private->names;
|
||||
while (tmp_list)
|
||||
{
|
||||
g_hash_table_remove (hash, tmp_list->data);
|
||||
g_free (tmp_list->data);
|
||||
|
||||
tmp_list = tmp_list->next;
|
||||
}
|
||||
|
||||
g_slist_free (private->names);
|
||||
private->names = NULL;
|
||||
}
|
||||
|
||||
static GdkFont *
|
||||
gdk_font_hash_lookup (GdkDisplay *display,
|
||||
GdkFontType type,
|
||||
const gchar *font_name)
|
||||
{
|
||||
GdkFont *result;
|
||||
GHashTable *hash;
|
||||
g_return_val_if_fail (GDK_IS_DISPLAY (display), NULL);
|
||||
|
||||
hash = (type == GDK_FONT_FONT) ? gdk_font_name_hash_get (display) :
|
||||
gdk_fontset_name_hash_get (display);
|
||||
if (!hash)
|
||||
return NULL;
|
||||
else
|
||||
{
|
||||
result = g_hash_table_lookup (hash, font_name);
|
||||
if (result)
|
||||
gdk_font_ref (result);
|
||||
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* gdk_fontset_load_for_display:
|
||||
* @display: a #GdkDisplay
|
||||
* @fontset_name: a comma-separated list of XLFDs describing
|
||||
* the component fonts of the fontset to load.
|
||||
* @returns: a #GdkFont, or %NULL if the fontset could not be loaded.
|
||||
*
|
||||
* Loads a fontset for use on @display.
|
||||
*
|
||||
* The fontset may be newly loaded or looked up in a cache.
|
||||
* You should make no assumptions about the initial reference count.
|
||||
*
|
||||
* Since: 2.2
|
||||
*/
|
||||
GdkFont *
|
||||
gdk_fontset_load_for_display (GdkDisplay *display,
|
||||
const gchar *fontset_name)
|
||||
{
|
||||
GdkFont *font;
|
||||
GdkFontPrivateX *private;
|
||||
XFontSet fontset;
|
||||
gint missing_charset_count;
|
||||
gchar **missing_charset_list;
|
||||
gchar *def_string;
|
||||
|
||||
g_return_val_if_fail (GDK_IS_DISPLAY (display), NULL);
|
||||
|
||||
font = gdk_font_hash_lookup (display, GDK_FONT_FONTSET, fontset_name);
|
||||
if (font)
|
||||
return font;
|
||||
|
||||
private = g_new (GdkFontPrivateX, 1);
|
||||
font = (GdkFont*) private;
|
||||
|
||||
private->display = display;
|
||||
fontset = XCreateFontSet (GDK_DISPLAY_XDISPLAY (display), fontset_name,
|
||||
&missing_charset_list, &missing_charset_count,
|
||||
&def_string);
|
||||
|
||||
if (missing_charset_count)
|
||||
{
|
||||
gint i;
|
||||
g_printerr ("The font \"%s\" does not support all the required character sets for the current locale \"%s\"\n",
|
||||
fontset_name, setlocale (LC_ALL, NULL));
|
||||
for (i=0;i<missing_charset_count;i++)
|
||||
g_printerr (" (Missing character set \"%s\")\n",
|
||||
missing_charset_list[i]);
|
||||
XFreeStringList (missing_charset_list);
|
||||
}
|
||||
|
||||
private->base.ref_count = 1;
|
||||
|
||||
if (!fontset)
|
||||
{
|
||||
g_free (font);
|
||||
return NULL;
|
||||
}
|
||||
else
|
||||
{
|
||||
gint num_fonts;
|
||||
gint i;
|
||||
XFontStruct **font_structs;
|
||||
gchar **font_names;
|
||||
|
||||
private->xfont = fontset;
|
||||
font->type = GDK_FONT_FONTSET;
|
||||
num_fonts = XFontsOfFontSet (fontset, &font_structs, &font_names);
|
||||
|
||||
font->ascent = font->descent = 0;
|
||||
|
||||
for (i = 0; i < num_fonts; i++)
|
||||
{
|
||||
font->ascent = MAX (font->ascent, font_structs[i]->ascent);
|
||||
font->descent = MAX (font->descent, font_structs[i]->descent);
|
||||
}
|
||||
|
||||
private->names = NULL;
|
||||
gdk_font_hash_insert (GDK_FONT_FONTSET, font, fontset_name);
|
||||
|
||||
return font;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* gdk_fontset_load:
|
||||
* @fontset_name: a comma-separated list of XLFDs describing
|
||||
* the component fonts of the fontset to load.
|
||||
*
|
||||
* Loads a fontset.
|
||||
*
|
||||
* The fontset may be newly loaded or looked up in a cache.
|
||||
* You should make no assumptions about the initial reference count.
|
||||
*
|
||||
* Return value: a #GdkFont, or %NULL if the fontset could not be loaded.
|
||||
**/
|
||||
GdkFont*
|
||||
gdk_fontset_load (const gchar *fontset_name)
|
||||
{
|
||||
return gdk_fontset_load_for_display (gdk_display_get_default (), fontset_name);
|
||||
}
|
||||
|
||||
void
|
||||
_gdk_font_destroy (GdkFont *font)
|
||||
{
|
||||
GdkFontPrivateX *private = (GdkFontPrivateX *)font;
|
||||
|
||||
gdk_font_hash_remove (font->type, font);
|
||||
|
||||
switch (font->type)
|
||||
{
|
||||
case GDK_FONT_FONT:
|
||||
_gdk_xid_table_remove (private->display, private->xid);
|
||||
XFreeFont (GDK_DISPLAY_XDISPLAY (private->display),
|
||||
(XFontStruct *) private->xfont);
|
||||
break;
|
||||
case GDK_FONT_FONTSET:
|
||||
XFreeFontSet (GDK_DISPLAY_XDISPLAY (private->display),
|
||||
(XFontSet) private->xfont);
|
||||
break;
|
||||
default:
|
||||
g_error ("unknown font type.");
|
||||
break;
|
||||
}
|
||||
g_free (font);
|
||||
}
|
||||
|
||||
gint
|
||||
_gdk_font_strlen (GdkFont *font,
|
||||
const gchar *str)
|
||||
{
|
||||
GdkFontPrivateX *font_private;
|
||||
gint length = 0;
|
||||
|
||||
g_return_val_if_fail (font != NULL, -1);
|
||||
g_return_val_if_fail (str != NULL, -1);
|
||||
|
||||
font_private = (GdkFontPrivateX*) font;
|
||||
|
||||
if (font->type == GDK_FONT_FONT)
|
||||
{
|
||||
XFontStruct *xfont = (XFontStruct *) font_private->xfont;
|
||||
if ((xfont->min_byte1 == 0) && (xfont->max_byte1 == 0))
|
||||
{
|
||||
length = strlen (str);
|
||||
}
|
||||
else
|
||||
{
|
||||
guint16 *string_2b = (guint16 *)str;
|
||||
|
||||
while (*(string_2b++))
|
||||
length++;
|
||||
}
|
||||
}
|
||||
else if (font->type == GDK_FONT_FONTSET)
|
||||
{
|
||||
length = strlen (str);
|
||||
}
|
||||
else
|
||||
g_error("undefined font type\n");
|
||||
|
||||
return length;
|
||||
}
|
||||
|
||||
/**
|
||||
* gdk_font_id:
|
||||
* @font: a #GdkFont.
|
||||
*
|
||||
* Returns the X Font ID for the given font.
|
||||
*
|
||||
* Return value: the numeric X Font ID
|
||||
**/
|
||||
gint
|
||||
gdk_font_id (const GdkFont *font)
|
||||
{
|
||||
const GdkFontPrivateX *font_private;
|
||||
|
||||
g_return_val_if_fail (font != NULL, 0);
|
||||
|
||||
font_private = (const GdkFontPrivateX*) font;
|
||||
|
||||
if (font->type == GDK_FONT_FONT)
|
||||
{
|
||||
return ((XFontStruct *) font_private->xfont)->fid;
|
||||
}
|
||||
else
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* gdk_font_equal:
|
||||
* @fonta: a #GdkFont.
|
||||
* @fontb: another #GdkFont.
|
||||
*
|
||||
* Compares two fonts for equality. Single fonts compare equal
|
||||
* if they have the same X font ID. This operation does
|
||||
* not currently work correctly for fontsets.
|
||||
*
|
||||
* Return value: %TRUE if the fonts are equal.
|
||||
**/
|
||||
gboolean
|
||||
gdk_font_equal (const GdkFont *fonta,
|
||||
const GdkFont *fontb)
|
||||
{
|
||||
const GdkFontPrivateX *privatea;
|
||||
const GdkFontPrivateX *privateb;
|
||||
|
||||
g_return_val_if_fail (fonta != NULL, FALSE);
|
||||
g_return_val_if_fail (fontb != NULL, FALSE);
|
||||
|
||||
privatea = (const GdkFontPrivateX*) fonta;
|
||||
privateb = (const GdkFontPrivateX*) fontb;
|
||||
|
||||
if (fonta->type == GDK_FONT_FONT && fontb->type == GDK_FONT_FONT)
|
||||
{
|
||||
return (((XFontStruct *) privatea->xfont)->fid ==
|
||||
((XFontStruct *) privateb->xfont)->fid);
|
||||
}
|
||||
else if (fonta->type == GDK_FONT_FONTSET && fontb->type == GDK_FONT_FONTSET)
|
||||
{
|
||||
gchar *namea, *nameb;
|
||||
|
||||
namea = XBaseFontNameListOfFontSet((XFontSet) privatea->xfont);
|
||||
nameb = XBaseFontNameListOfFontSet((XFontSet) privateb->xfont);
|
||||
|
||||
return (strcmp(namea, nameb) == 0);
|
||||
}
|
||||
else
|
||||
/* fontset != font */
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
|
||||
#define __GDK_FONT_X11_C__
|
||||
#include "gdkaliasdef.c"
|
@ -85,7 +85,7 @@ _gdk_xid_table_remove (GdkDisplay *display,
|
||||
* Returns the GDK object associated with the given X id.
|
||||
*
|
||||
* Return value: the associated Gdk object, which may be a #GdkPixmap,
|
||||
* a #GdkWindow or a #GdkFont or %NULL if no object is associated
|
||||
* a #GdkWindow or %NULL if no object is associated
|
||||
* with the X id.
|
||||
*
|
||||
* Since: 2.2
|
||||
@ -116,7 +116,7 @@ gdk_xid_table_lookup_for_display (GdkDisplay *display,
|
||||
* display.
|
||||
*
|
||||
* Return value: the associated Gdk object, which may be a #GdkPixmap,
|
||||
* a #GdkWindow or a #GdkFont or %NULL if no object is associated
|
||||
* a #GdkWindow or %NULL if no object is associated
|
||||
* with the X id.
|
||||
*/
|
||||
gpointer
|
||||
|
Loading…
Reference in New Issue
Block a user