1
<refentry id="gdk-Fonts">
3
<refentrytitle role="top_of_page">Fonts</refentrytitle>
4
<manvolnum>3</manvolnum>
5
<refmiscinfo>GDK Library</refmiscinfo>
9
<refname>Fonts</refname>
10
<refpurpose>Loading and manipulating fonts</refpurpose>
11
<!--[<xref linkend="desc" endterm="desc.title"/>]-->
14
<refsynopsisdiv role="synopsis">
15
<title role="synopsis.title">Synopsis</title>
19
#include <gdk/gdk.h>
22
<link linkend="GdkFont">GdkFont</link>;
23
enum <link linkend="GdkFontType">GdkFontType</link>;
24
<link linkend="GdkFont">GdkFont</link>* <link linkend="gdk-font-load">gdk_font_load</link> (const <link linkend="gchar">gchar</link> *font_name);
25
<link linkend="GdkFont">GdkFont</link>* <link linkend="gdk-font-load-for-display">gdk_font_load_for_display</link> (<link linkend="GdkDisplay">GdkDisplay</link> *display,
26
const <link linkend="gchar">gchar</link> *font_name);
27
<link linkend="GdkFont">GdkFont</link>* <link linkend="gdk-fontset-load">gdk_fontset_load</link> (const <link linkend="gchar">gchar</link> *fontset_name);
28
<link linkend="GdkFont">GdkFont</link>* <link linkend="gdk-fontset-load-for-display">gdk_fontset_load_for_display</link> (<link linkend="GdkDisplay">GdkDisplay</link> *display,
29
const <link linkend="gchar">gchar</link> *fontset_name);
30
<link linkend="GdkFont">GdkFont</link>* <link linkend="gdk-font-from-description">gdk_font_from_description</link> (<link linkend="PangoFontDescription">PangoFontDescription</link> *font_desc);
31
<link linkend="GdkFont">GdkFont</link>* <link linkend="gdk-font-from-description-for-display">gdk_font_from_description_for_display</link>
32
(<link linkend="GdkDisplay">GdkDisplay</link> *display,
33
<link linkend="PangoFontDescription">PangoFontDescription</link> *font_desc);
34
<link linkend="GdkDisplay">GdkDisplay</link>* <link linkend="gdk-font-get-display">gdk_font_get_display</link> (<link linkend="GdkFont">GdkFont</link> *font);
35
<link linkend="GdkFont">GdkFont</link>* <link linkend="gdk-font-ref">gdk_font_ref</link> (<link linkend="GdkFont">GdkFont</link> *font);
36
<link linkend="void">void</link> <link linkend="gdk-font-unref">gdk_font_unref</link> (<link linkend="GdkFont">GdkFont</link> *font);
37
<link linkend="gint">gint</link> <link linkend="gdk-font-id">gdk_font_id</link> (const <link linkend="GdkFont">GdkFont</link> *font);
38
<link linkend="gboolean">gboolean</link> <link linkend="gdk-font-equal">gdk_font_equal</link> (const <link linkend="GdkFont">GdkFont</link> *fonta,
39
const <link linkend="GdkFont">GdkFont</link> *fontb);
41
<link linkend="void">void</link> <link linkend="gdk-string-extents">gdk_string_extents</link> (<link linkend="GdkFont">GdkFont</link> *font,
42
const <link linkend="gchar">gchar</link> *string,
43
<link linkend="gint">gint</link> *lbearing,
44
<link linkend="gint">gint</link> *rbearing,
45
<link linkend="gint">gint</link> *width,
46
<link linkend="gint">gint</link> *ascent,
47
<link linkend="gint">gint</link> *descent);
48
<link linkend="void">void</link> <link linkend="gdk-text-extents">gdk_text_extents</link> (<link linkend="GdkFont">GdkFont</link> *font,
49
const <link linkend="gchar">gchar</link> *text,
50
<link linkend="gint">gint</link> text_length,
51
<link linkend="gint">gint</link> *lbearing,
52
<link linkend="gint">gint</link> *rbearing,
53
<link linkend="gint">gint</link> *width,
54
<link linkend="gint">gint</link> *ascent,
55
<link linkend="gint">gint</link> *descent);
56
<link linkend="void">void</link> <link linkend="gdk-text-extents-wc">gdk_text_extents_wc</link> (<link linkend="GdkFont">GdkFont</link> *font,
57
const <link linkend="GdkWChar">GdkWChar</link> *text,
58
<link linkend="gint">gint</link> text_length,
59
<link linkend="gint">gint</link> *lbearing,
60
<link linkend="gint">gint</link> *rbearing,
61
<link linkend="gint">gint</link> *width,
62
<link linkend="gint">gint</link> *ascent,
63
<link linkend="gint">gint</link> *descent);
64
<link linkend="gint">gint</link> <link linkend="gdk-string-width">gdk_string_width</link> (<link linkend="GdkFont">GdkFont</link> *font,
65
const <link linkend="gchar">gchar</link> *string);
66
<link linkend="gint">gint</link> <link linkend="gdk-text-width">gdk_text_width</link> (<link linkend="GdkFont">GdkFont</link> *font,
67
const <link linkend="gchar">gchar</link> *text,
68
<link linkend="gint">gint</link> text_length);
69
<link linkend="gint">gint</link> <link linkend="gdk-text-width-wc">gdk_text_width_wc</link> (<link linkend="GdkFont">GdkFont</link> *font,
70
const <link linkend="GdkWChar">GdkWChar</link> *text,
71
<link linkend="gint">gint</link> text_length);
72
<link linkend="gint">gint</link> <link linkend="gdk-char-width">gdk_char_width</link> (<link linkend="GdkFont">GdkFont</link> *font,
73
<link linkend="gchar">gchar</link> character);
74
<link linkend="gint">gint</link> <link linkend="gdk-char-width-wc">gdk_char_width_wc</link> (<link linkend="GdkFont">GdkFont</link> *font,
75
<link linkend="GdkWChar">GdkWChar</link> character);
76
<link linkend="gint">gint</link> <link linkend="gdk-string-measure">gdk_string_measure</link> (<link linkend="GdkFont">GdkFont</link> *font,
77
const <link linkend="gchar">gchar</link> *string);
78
<link linkend="gint">gint</link> <link linkend="gdk-text-measure">gdk_text_measure</link> (<link linkend="GdkFont">GdkFont</link> *font,
79
const <link linkend="gchar">gchar</link> *text,
80
<link linkend="gint">gint</link> text_length);
81
<link linkend="gint">gint</link> <link linkend="gdk-char-measure">gdk_char_measure</link> (<link linkend="GdkFont">GdkFont</link> *font,
82
<link linkend="gchar">gchar</link> character);
83
<link linkend="gint">gint</link> <link linkend="gdk-string-height">gdk_string_height</link> (<link linkend="GdkFont">GdkFont</link> *font,
84
const <link linkend="gchar">gchar</link> *string);
85
<link linkend="gint">gint</link> <link linkend="gdk-text-height">gdk_text_height</link> (<link linkend="GdkFont">GdkFont</link> *font,
86
const <link linkend="gchar">gchar</link> *text,
87
<link linkend="gint">gint</link> text_length);
88
<link linkend="gint">gint</link> <link linkend="gdk-char-height">gdk_char_height</link> (<link linkend="GdkFont">GdkFont</link> *font,
89
<link linkend="gchar">gchar</link> character);
91
typedef <link linkend="GdkWChar">GdkWChar</link>;
92
<link linkend="gchar">gchar</link>* <link linkend="gdk-wcstombs">gdk_wcstombs</link> (const <link linkend="GdkWChar">GdkWChar</link> *src);
93
<link linkend="gint">gint</link> <link linkend="gdk-mbstowcs">gdk_mbstowcs</link> (<link linkend="GdkWChar">GdkWChar</link> *dest,
94
const <link linkend="gchar">gchar</link> *src,
95
<link linkend="gint">gint</link> dest_max);
109
<refsect1 role="desc">
110
<title role="desc.title">Description</title>
112
The <link linkend="GdkFont"><type>GdkFont</type></link> data type represents a font for drawing on
113
the screen. These functions provide support for
114
loading fonts, and also for determining the dimensions
115
of characters and strings when drawn with a particular
120
Fonts in X are specified by a
121
<firstterm>X Logical Font Description</firstterm>.
122
The following description is considerably simplified.
123
For definitive information about XLFD's see the
124
X reference documentation. A X Logical Font Description (XLFD)
125
consists of a sequence of fields separated (and surrounded by) '-'
126
characters. For example, Adobe Helvetica Bold 12 pt, has the
128
<informalexample><programlisting>
129
"-adobe-helvetica-bold-r-normal--12-120-75-75-p-70-iso8859-1"
130
</programlisting></informalexample>
134
The fields in the XLFD are:
136
<informaltable pgwide="1" frame="none">
137
<tgroup cols="2"><colspec colwidth="2*"/><colspec colwidth="8*"/>
141
<entry>Foundry</entry>
142
<entry>the company or organization where the font originated.</entry>
146
<entry>Family</entry>
147
<entry>the font family (a group of related font designs).</entry>
151
<entry>Weight</entry>
152
<entry>A name for the font's typographic weight
153
For example, 'bold' or 'medium').</entry>
158
<entry>The slant of the font. Common values are 'R' for Roman,
159
'I' for italoc, and 'O' for oblique.</entry>
163
<entry>Set Width</entry>
164
<entry>A name for the width of the font. For example,
165
'normal' or 'condensed'.</entry>
169
<entry>Add Style</entry>
170
<entry>Additional information to distinguish a font from
171
other fonts of the same family.</entry>
175
<entry>Pixel Size</entry>
176
<entry>The body size of the font in pixels.</entry>
180
<entry>Point Size</entry>
181
<entry>The body size of the font in 10ths of a point.
182
(A <firstterm>point</firstterm> is 1/72.27 inch) </entry>
186
<entry>Resolution X</entry>
187
<entry>The horizontal resolution that the font was designed for.</entry>
191
<entry>Resolution Y</entry>
192
<entry>The vertical resolution that the font was designed for .</entry>
196
<entry>Spacing</entry>
197
<entry>The type of spacing for the font - can be 'p' for proportional,
198
'm' for monospaced or 'c' for charcell.</entry>
202
<entry>Average Width</entry>
203
<entry>The average width of a glyph in the font. For monospaced
204
and charcell fonts, all glyphs in the font have this width</entry>
208
<entry>Charset Registry</entry>
209
<entry>The registration authority that owns the encoding for
210
the font. Together with the Charset Encoding field, this
211
defines the character set for the font.</entry>
215
<entry>Charset Encoding</entry>
216
<entry>An identifier for the particular character set encoding.</entry>
219
</tbody></tgroup></informaltable>
223
When specifying a font via a X logical Font Description,
224
'*' can be used as a wildcard to match any portion of
225
the XLFD. For instance, the above example could
227
<informalexample><programlisting>
228
"-*-helvetica-bold-r-normal--*-120-*-*-*-*-iso8859-1"
229
</programlisting></informalexample>
231
It is generally a good idea to use wildcards for any
232
portion of the XLFD that your program does not care
233
about specifically, since that will improve the
234
chances of finding a matching font.
238
A <firstterm>fontset</firstterm> is a list of fonts
239
that is used for drawing international text that may
240
contain characters from a number of different character
241
sets. It is represented by a list of XLFD's.
245
The font for a given character set is determined by going
246
through the list of XLFD's in order. For each one, if
247
the registry and and encoding fields match the desired
248
character set, then that font is used, otherwise if
249
the XLFD contains wild-cards for the registry and encoding
250
fields, the registry and encoding for the desired character
251
set are substituted in and a lookup is done. If a match is found
252
that font is used. Otherwise, processing continues
253
on to the next font in the list.
257
The functions for determining the metrics of a string
258
come in several varieties that can take a number
259
of forms of string input:
263
<term>8-bit string</term>
265
When using functions like <link linkend="gdk-string-width"><function>gdk_string_width()</function></link> that
266
take a <type>gchar *</type>, if the font is of type
267
<link linkend="GDK-FONT-FONT:CAPS"><literal>GDK_FONT_FONT</literal></link> and is an 8-bit font, then each
268
<type>gchar</type> indexes the glyphs in the font directly.
272
<term>16-bit string</term>
274
For functions taking a <type>gchar *</type>, if the
275
font is of type <link linkend="GDK-FONT-FONT:CAPS"><literal>GDK_FONT_FONT</literal></link>, and is a 16-bit
276
font, then the <type>gchar *</type> argument is
277
interpreted as a <type>guint16 *</type> cast to
278
a <type>gchar *</type> and each <type>guint16</type>
279
indexes the glyphs in the font directly.
283
<term>Multibyte string</term>
285
For functions taking a <type>gchar *</type>, if the
286
font is of type <link linkend="GDK-FONT-FONTSET:CAPS"><literal>GDK_FONT_FONTSET</literal></link>, then the input
287
string is interpreted as a <firstterm>multibyte</firstterm>
288
encoded according to the current locale. (A multibyte
289
string is one in which each character may consist
290
of one or more bytes, with different lengths for different
291
characters in the string). They can be converted to and
292
from wide character strings (see below) using
293
<link linkend="gdk-wcstombs"><function>gdk_wcstombs()</function></link> and <link linkend="gdk-mbstowcs"><function>gdk_mbstowcs()</function></link>.) The string will
294
be rendered using one or more different fonts from
299
<term>Wide character string</term>
301
For a number of the text-measuring functions, GDK
302
provides a variant (such as <link linkend="gdk-text-width-wc"><function>gdk_text_width_wc()</function></link>) which
303
takes a <type>GdkWChar *</type> instead of a
304
<type>gchar *</type>. The input is then taken to
305
be a wide character string in the encoding of the
306
current locale. (A wide character string is a string
307
in which each character consists of several bytes,
308
and the width of each character in the string is
316
GDK provides functions to determine a number of different
317
measurements (metrics) for a given string. (Need diagram
324
The vertical distance from the origin of the drawing
325
opereration to the top of the drawn character.
331
The vertical distance from the origin of the drawing
332
opereration to the bottom of the drawn character.
336
<term>left bearing</term>
338
The horizontal distance from the origin of the drawing
339
operation to the left-most part of the drawn character.
343
<term>right bearing</term>
345
The horizontal distance from the origin of the drawing
346
operation to the right-most part of the drawn character.
350
<term>width bearing</term>
352
The horizontal distance from the origin of the drawing
353
operation to the correct origin for drawing another
354
string to follow the current one. Depending on the
355
font, this could be greater than or less than the
363
<refsect1 role="details">
364
<title role="details.title">Details</title>
366
<title><anchor id="GdkFont" role="struct" condition="deprecated:"/>GdkFont</title>
367
<indexterm role="deprecated"><primary>GdkFont</primary></indexterm><programlisting>typedef struct {
373
<warning><para><literal>GdkFont</literal> is deprecated and should not be used in newly-written code.</para></warning>
375
The <structname>GdkFont</structname> structure represents a font or fontset. It
376
contains the following public fields. A new <structname>GdkFont</structname>
377
structure is returned by <link linkend="gdk-font-load"><function>gdk_font_load()</function></link> or <link linkend="gdk-fontset-load"><function>gdk_fontset_load()</function></link>,
378
and is reference counted with <link linkend="gdk-font-ref"><function>gdk_font_ref()</function></link> and <link linkend="gdk-font-unref"><function>gdk_font_unref()</function></link>
379
</para><variablelist role="struct">
381
<term><link linkend="GdkFontType">GdkFontType</link> <structfield>type</structfield>;</term>
382
<listitem><simpara>a value of type <link linkend="GdkFontType"><type>GdkFontType</type></link> which indicates
383
whether this font is a single font or a fontset.
384
</simpara></listitem>
387
<term><link linkend="gint">gint</link> <structfield>ascent</structfield>;</term>
388
<listitem><simpara>the maximum distance that the font, when drawn,
389
ascends above the baseline.
390
</simpara></listitem>
393
<term><link linkend="gint">gint</link> <structfield>descent</structfield>;</term>
394
<listitem><simpara>the maximum distance that the font, when drawn,
395
descends below the baseline.
397
</simpara></listitem>
399
</variablelist></refsect2>
401
<title><anchor id="GdkFontType" role="enum" condition="deprecated:"/>enum GdkFontType</title>
402
<indexterm role="deprecated"><primary>GdkFontType</primary></indexterm><programlisting>typedef enum
408
<warning><para><literal>GdkFontType</literal> is deprecated and should not be used in newly-written code.</para></warning>
410
Indicates the type of a font. The possible values
412
</para><variablelist role="enum">
414
<term><anchor id="GDK-FONT-FONT:CAPS" role="constant"/><literal>GDK_FONT_FONT</literal></term>
415
<listitem><simpara>the font is a single font.
416
</simpara></listitem>
419
<term><anchor id="GDK-FONT-FONTSET:CAPS" role="constant"/><literal>GDK_FONT_FONTSET</literal></term>
420
<listitem><simpara>the font is a fontset.
422
</simpara></listitem>
424
</variablelist></refsect2>
426
<title><anchor id="gdk-font-load" role="function" condition="deprecated:"/>gdk_font_load ()</title>
427
<indexterm role="deprecated"><primary>gdk_font_load</primary></indexterm><programlisting><link linkend="GdkFont">GdkFont</link>* gdk_font_load (const <link linkend="gchar">gchar</link> *font_name);</programlisting>
428
<warning><para><literal>gdk_font_load</literal> is deprecated and should not be used in newly-written code.</para></warning>
433
The font may be newly loaded or looked up the font in a cache.
434
You should make no assumptions about the initial reference count.</para>
436
</para><variablelist role="params">
437
<varlistentry><term><parameter>font_name</parameter> :</term>
438
<listitem><simpara> a XLFD describing the font to load.
439
</simpara></listitem></varlistentry>
440
<varlistentry><term><emphasis>Returns</emphasis> :</term><listitem><simpara> a <link linkend="GdkFont"><type>GdkFont</type></link>, or <link linkend="NULL:CAPS"><literal>NULL</literal></link> if the font could not be loaded.
441
</simpara></listitem></varlistentry>
442
</variablelist></refsect2>
444
<title><anchor id="gdk-font-load-for-display" role="function" condition="deprecated:|since:2.2"/>gdk_font_load_for_display ()</title>
445
<indexterm role="deprecated"><primary>gdk_font_load_for_display</primary></indexterm><indexterm role="2.2"><primary>gdk_font_load_for_display</primary></indexterm><programlisting><link linkend="GdkFont">GdkFont</link>* gdk_font_load_for_display (<link linkend="GdkDisplay">GdkDisplay</link> *display,
446
const <link linkend="gchar">gchar</link> *font_name);</programlisting>
447
<warning><para><literal>gdk_font_load_for_display</literal> is deprecated and should not be used in newly-written code.</para></warning>
449
Loads a font for use on <parameter>display</parameter>.
452
The font may be newly loaded or looked up the font in a cache.
453
You should make no assumptions about the initial reference count.</para>
456
</para><variablelist role="params">
457
<varlistentry><term><parameter>display</parameter> :</term>
458
<listitem><simpara> a <link linkend="GdkDisplay"><type>GdkDisplay</type></link>
459
</simpara></listitem></varlistentry>
460
<varlistentry><term><parameter>font_name</parameter> :</term>
461
<listitem><simpara> a XLFD describing the font to load.
462
</simpara></listitem></varlistentry>
463
<varlistentry><term><emphasis>Returns</emphasis> :</term><listitem><simpara> a <link linkend="GdkFont"><type>GdkFont</type></link>, or <link linkend="NULL:CAPS"><literal>NULL</literal></link> if the font could not be loaded.
464
</simpara></listitem></varlistentry>
465
</variablelist><para role="since">Since 2.2
468
<title><anchor id="gdk-fontset-load" role="function" condition="deprecated:"/>gdk_fontset_load ()</title>
469
<indexterm role="deprecated"><primary>gdk_fontset_load</primary></indexterm><programlisting><link linkend="GdkFont">GdkFont</link>* gdk_fontset_load (const <link linkend="gchar">gchar</link> *fontset_name);</programlisting>
470
<warning><para><literal>gdk_fontset_load</literal> is deprecated and should not be used in newly-written code.</para></warning>
475
The fontset may be newly loaded or looked up in a cache.
476
You should make no assumptions about the initial reference count.</para>
478
</para><variablelist role="params">
479
<varlistentry><term><parameter>fontset_name</parameter> :</term>
480
<listitem><simpara> a comma-separated list of XLFDs describing
481
the component fonts of the fontset to load.
482
</simpara></listitem></varlistentry>
483
<varlistentry><term><emphasis>Returns</emphasis> :</term><listitem><simpara> a <link linkend="GdkFont"><type>GdkFont</type></link>, or <link linkend="NULL:CAPS"><literal>NULL</literal></link> if the fontset could not be loaded.
484
</simpara></listitem></varlistentry>
485
</variablelist></refsect2>
487
<title><anchor id="gdk-fontset-load-for-display" role="function" condition="deprecated:|since:2.2"/>gdk_fontset_load_for_display ()</title>
488
<indexterm role="deprecated"><primary>gdk_fontset_load_for_display</primary></indexterm><indexterm role="2.2"><primary>gdk_fontset_load_for_display</primary></indexterm><programlisting><link linkend="GdkFont">GdkFont</link>* gdk_fontset_load_for_display (<link linkend="GdkDisplay">GdkDisplay</link> *display,
489
const <link linkend="gchar">gchar</link> *fontset_name);</programlisting>
490
<warning><para><literal>gdk_fontset_load_for_display</literal> is deprecated and should not be used in newly-written code.</para></warning>
492
Loads a fontset for use on <parameter>display</parameter>.
495
The fontset may be newly loaded or looked up in a cache.
496
You should make no assumptions about the initial reference count.</para>
499
</para><variablelist role="params">
500
<varlistentry><term><parameter>display</parameter> :</term>
501
<listitem><simpara> a <link linkend="GdkDisplay"><type>GdkDisplay</type></link>
502
</simpara></listitem></varlistentry>
503
<varlistentry><term><parameter>fontset_name</parameter> :</term>
504
<listitem><simpara> a comma-separated list of XLFDs describing
505
the component fonts of the fontset to load.
506
</simpara></listitem></varlistentry>
507
<varlistentry><term><emphasis>Returns</emphasis> :</term><listitem><simpara> a <link linkend="GdkFont"><type>GdkFont</type></link>, or <link linkend="NULL:CAPS"><literal>NULL</literal></link> if the fontset could not be loaded.
508
</simpara></listitem></varlistentry>
509
</variablelist><para role="since">Since 2.2
512
<title><anchor id="gdk-font-from-description" role="function" condition="deprecated:"/>gdk_font_from_description ()</title>
513
<indexterm role="deprecated"><primary>gdk_font_from_description</primary></indexterm><programlisting><link linkend="GdkFont">GdkFont</link>* gdk_font_from_description (<link linkend="PangoFontDescription">PangoFontDescription</link> *font_desc);</programlisting>
514
<warning><para><literal>gdk_font_from_description</literal> is deprecated and should not be used in newly-written code.</para></warning>
516
Load a <link linkend="GdkFont"><type>GdkFont</type></link> based on a Pango font description. This font will
517
only be an approximation of the Pango font, and
518
internationalization will not be handled correctly. This function
519
should only be used for legacy code that cannot be easily converted
520
to use Pango. Using Pango directly will produce better results.</para>
523
</para><variablelist role="params">
524
<varlistentry><term><parameter>font_desc</parameter> :</term>
525
<listitem><simpara> a <link linkend="PangoFontDescription"><type>PangoFontDescription</type></link>.
526
</simpara></listitem></varlistentry>
527
<varlistentry><term><emphasis>Returns</emphasis> :</term><listitem><simpara> the newly loaded font, or <link linkend="NULL:CAPS"><literal>NULL</literal></link> if the font
529
</simpara></listitem></varlistentry>
530
</variablelist></refsect2>
532
<title><anchor id="gdk-font-from-description-for-display" role="function" condition="deprecated:|since:2.2"/>gdk_font_from_description_for_display ()</title>
533
<indexterm role="deprecated"><primary>gdk_font_from_description_for_display</primary></indexterm><indexterm role="2.2"><primary>gdk_font_from_description_for_display</primary></indexterm><programlisting><link linkend="GdkFont">GdkFont</link>* gdk_font_from_description_for_display
534
(<link linkend="GdkDisplay">GdkDisplay</link> *display,
535
<link linkend="PangoFontDescription">PangoFontDescription</link> *font_desc);</programlisting>
536
<warning><para><literal>gdk_font_from_description_for_display</literal> is deprecated and should not be used in newly-written code.</para></warning>
538
Loads a <link linkend="GdkFont"><type>GdkFont</type></link> based on a Pango font description for use on <parameter>display</parameter>.
539
This font will only be an approximation of the Pango font, and
540
internationalization will not be handled correctly. This function
541
should only be used for legacy code that cannot be easily converted
542
to use Pango. Using Pango directly will produce better results.</para>
545
</para><variablelist role="params">
546
<varlistentry><term><parameter>display</parameter> :</term>
547
<listitem><simpara> a <link linkend="GdkDisplay"><type>GdkDisplay</type></link>
548
</simpara></listitem></varlistentry>
549
<varlistentry><term><parameter>font_desc</parameter> :</term>
550
<listitem><simpara> a <link linkend="PangoFontDescription"><type>PangoFontDescription</type></link>.
551
</simpara></listitem></varlistentry>
552
<varlistentry><term><emphasis>Returns</emphasis> :</term><listitem><simpara> the newly loaded font, or <link linkend="NULL:CAPS"><literal>NULL</literal></link> if the font
555
</simpara></listitem></varlistentry>
556
</variablelist><para role="since">Since 2.2
559
<title><anchor id="gdk-font-get-display" role="function" condition="deprecated:|since:2.2"/>gdk_font_get_display ()</title>
560
<indexterm role="deprecated"><primary>gdk_font_get_display</primary></indexterm><indexterm role="2.2"><primary>gdk_font_get_display</primary></indexterm><programlisting><link linkend="GdkDisplay">GdkDisplay</link>* gdk_font_get_display (<link linkend="GdkFont">GdkFont</link> *font);</programlisting>
561
<warning><para><literal>gdk_font_get_display</literal> is deprecated and should not be used in newly-written code.</para></warning>
563
Returns the <link linkend="GdkDisplay"><type>GdkDisplay</type></link> for <parameter>font</parameter>.</para>
566
</para><variablelist role="params">
567
<varlistentry><term><parameter>font</parameter> :</term>
568
<listitem><simpara> the <link linkend="GdkFont"><type>GdkFont</type></link>.
569
</simpara></listitem></varlistentry>
570
<varlistentry><term><emphasis>Returns</emphasis> :</term><listitem><simpara> the corresponding <link linkend="GdkDisplay"><type>GdkDisplay</type></link>.
572
</simpara></listitem></varlistentry>
573
</variablelist><para role="since">Since 2.2
576
<title><anchor id="gdk-font-ref" role="function" condition="deprecated:"/>gdk_font_ref ()</title>
577
<indexterm role="deprecated"><primary>gdk_font_ref</primary></indexterm><programlisting><link linkend="GdkFont">GdkFont</link>* gdk_font_ref (<link linkend="GdkFont">GdkFont</link> *font);</programlisting>
578
<warning><para><literal>gdk_font_ref</literal> is deprecated and should not be used in newly-written code.</para></warning>
580
Increases the reference count of a font by one.</para>
582
</para><variablelist role="params">
583
<varlistentry><term><parameter>font</parameter> :</term>
584
<listitem><simpara> a <link linkend="GdkFont"><type>GdkFont</type></link>
585
</simpara></listitem></varlistentry>
586
<varlistentry><term><emphasis>Returns</emphasis> :</term><listitem><simpara> <parameter>font</parameter>
587
</simpara></listitem></varlistentry>
588
</variablelist></refsect2>
590
<title><anchor id="gdk-font-unref" role="function" condition="deprecated:"/>gdk_font_unref ()</title>
591
<indexterm role="deprecated"><primary>gdk_font_unref</primary></indexterm><programlisting><link linkend="void">void</link> gdk_font_unref (<link linkend="GdkFont">GdkFont</link> *font);</programlisting>
592
<warning><para><literal>gdk_font_unref</literal> is deprecated and should not be used in newly-written code.</para></warning>
594
Decreases the reference count of a font by one.
595
If the result is zero, destroys the font.</para>
597
</para><variablelist role="params">
598
<varlistentry><term><parameter>font</parameter> :</term>
599
<listitem><simpara> a <link linkend="GdkFont"><type>GdkFont</type></link>
600
</simpara></listitem></varlistentry>
601
</variablelist></refsect2>
603
<title><anchor id="gdk-font-id" role="function" condition="deprecated:"/>gdk_font_id ()</title>
604
<indexterm role="deprecated"><primary>gdk_font_id</primary></indexterm><programlisting><link linkend="gint">gint</link> gdk_font_id (const <link linkend="GdkFont">GdkFont</link> *font);</programlisting>
605
<warning><para><literal>gdk_font_id</literal> is deprecated and should not be used in newly-written code.</para></warning>
607
Returns the X Font ID for the given font.</para>
609
</para><variablelist role="params">
610
<varlistentry><term><parameter>font</parameter> :</term>
611
<listitem><simpara> a <link linkend="GdkFont"><type>GdkFont</type></link>.
612
</simpara></listitem></varlistentry>
613
<varlistentry><term><emphasis>Returns</emphasis> :</term><listitem><simpara> the numeric X Font ID
614
</simpara></listitem></varlistentry>
615
</variablelist></refsect2>
617
<title><anchor id="gdk-font-equal" role="function" condition="deprecated:"/>gdk_font_equal ()</title>
618
<indexterm role="deprecated"><primary>gdk_font_equal</primary></indexterm><programlisting><link linkend="gboolean">gboolean</link> gdk_font_equal (const <link linkend="GdkFont">GdkFont</link> *fonta,
619
const <link linkend="GdkFont">GdkFont</link> *fontb);</programlisting>
620
<warning><para><literal>gdk_font_equal</literal> is deprecated and should not be used in newly-written code.</para></warning>
622
Compares two fonts for equality. Single fonts compare equal
623
if they have the same X font ID. This operation does
624
not currently work correctly for fontsets.</para>
626
</para><variablelist role="params">
627
<varlistentry><term><parameter>fonta</parameter> :</term>
628
<listitem><simpara> a <link linkend="GdkFont"><type>GdkFont</type></link>.
629
</simpara></listitem></varlistentry>
630
<varlistentry><term><parameter>fontb</parameter> :</term>
631
<listitem><simpara> another <link linkend="GdkFont"><type>GdkFont</type></link>.
632
</simpara></listitem></varlistentry>
633
<varlistentry><term><emphasis>Returns</emphasis> :</term><listitem><simpara> <link linkend="TRUE:CAPS"><literal>TRUE</literal></link> if the fonts are equal.
634
</simpara></listitem></varlistentry>
635
</variablelist></refsect2>
637
<title><anchor id="gdk-string-extents" role="function" condition="deprecated:"/>gdk_string_extents ()</title>
638
<indexterm role="deprecated"><primary>gdk_string_extents</primary></indexterm><programlisting><link linkend="void">void</link> gdk_string_extents (<link linkend="GdkFont">GdkFont</link> *font,
639
const <link linkend="gchar">gchar</link> *string,
640
<link linkend="gint">gint</link> *lbearing,
641
<link linkend="gint">gint</link> *rbearing,
642
<link linkend="gint">gint</link> *width,
643
<link linkend="gint">gint</link> *ascent,
644
<link linkend="gint">gint</link> *descent);</programlisting>
645
<warning><para><literal>gdk_string_extents</literal> is deprecated and should not be used in newly-written code.</para></warning>
647
Gets the metrics of a nul-terminated string.</para>
649
</para><variablelist role="params">
650
<varlistentry><term><parameter>font</parameter> :</term>
651
<listitem><simpara> a <link linkend="GdkFont"><type>GdkFont</type></link>.
652
</simpara></listitem></varlistentry>
653
<varlistentry><term><parameter>string</parameter> :</term>
654
<listitem><simpara> the nul-terminated string to measure.
655
</simpara></listitem></varlistentry>
656
<varlistentry><term><parameter>lbearing</parameter> :</term>
657
<listitem><simpara> the left bearing of the string.
658
</simpara></listitem></varlistentry>
659
<varlistentry><term><parameter>rbearing</parameter> :</term>
660
<listitem><simpara> the right bearing of the string.
661
</simpara></listitem></varlistentry>
662
<varlistentry><term><parameter>width</parameter> :</term>
663
<listitem><simpara> the width of the string.
664
</simpara></listitem></varlistentry>
665
<varlistentry><term><parameter>ascent</parameter> :</term>
666
<listitem><simpara> the ascent of the string.
667
</simpara></listitem></varlistentry>
668
<varlistentry><term><parameter>descent</parameter> :</term>
669
<listitem><simpara> the descent of the string.
670
</simpara></listitem></varlistentry>
671
</variablelist></refsect2>
673
<title><anchor id="gdk-text-extents" role="function" condition="deprecated:"/>gdk_text_extents ()</title>
674
<indexterm role="deprecated"><primary>gdk_text_extents</primary></indexterm><programlisting><link linkend="void">void</link> gdk_text_extents (<link linkend="GdkFont">GdkFont</link> *font,
675
const <link linkend="gchar">gchar</link> *text,
676
<link linkend="gint">gint</link> text_length,
677
<link linkend="gint">gint</link> *lbearing,
678
<link linkend="gint">gint</link> *rbearing,
679
<link linkend="gint">gint</link> *width,
680
<link linkend="gint">gint</link> *ascent,
681
<link linkend="gint">gint</link> *descent);</programlisting>
682
<warning><para><literal>gdk_text_extents</literal> is deprecated and should not be used in newly-written code.</para></warning>
684
Gets the metrics of a string.</para>
686
</para><variablelist role="params">
687
<varlistentry><term><parameter>font</parameter> :</term>
688
<listitem><simpara> a <link linkend="GdkFont"><type>GdkFont</type></link>
689
</simpara></listitem></varlistentry>
690
<varlistentry><term><parameter>text</parameter> :</term>
691
<listitem><simpara> the text to measure
692
</simpara></listitem></varlistentry>
693
<varlistentry><term><parameter>text_length</parameter> :</term>
694
<listitem><simpara> the length of the text in bytes. (If the
695
font is a 16-bit font, this is twice the length
696
of the text in characters.)
697
</simpara></listitem></varlistentry>
698
<varlistentry><term><parameter>lbearing</parameter> :</term>
699
<listitem><simpara> the left bearing of the string.
700
</simpara></listitem></varlistentry>
701
<varlistentry><term><parameter>rbearing</parameter> :</term>
702
<listitem><simpara> the right bearing of the string.
703
</simpara></listitem></varlistentry>
704
<varlistentry><term><parameter>width</parameter> :</term>
705
<listitem><simpara> the width of the string.
706
</simpara></listitem></varlistentry>
707
<varlistentry><term><parameter>ascent</parameter> :</term>
708
<listitem><simpara> the ascent of the string.
709
</simpara></listitem></varlistentry>
710
<varlistentry><term><parameter>descent</parameter> :</term>
711
<listitem><simpara> the descent of the string.
712
</simpara></listitem></varlistentry>
713
</variablelist></refsect2>
715
<title><anchor id="gdk-text-extents-wc" role="function" condition="deprecated:"/>gdk_text_extents_wc ()</title>
716
<indexterm role="deprecated"><primary>gdk_text_extents_wc</primary></indexterm><programlisting><link linkend="void">void</link> gdk_text_extents_wc (<link linkend="GdkFont">GdkFont</link> *font,
717
const <link linkend="GdkWChar">GdkWChar</link> *text,
718
<link linkend="gint">gint</link> text_length,
719
<link linkend="gint">gint</link> *lbearing,
720
<link linkend="gint">gint</link> *rbearing,
721
<link linkend="gint">gint</link> *width,
722
<link linkend="gint">gint</link> *ascent,
723
<link linkend="gint">gint</link> *descent);</programlisting>
724
<warning><para><literal>gdk_text_extents_wc</literal> is deprecated and should not be used in newly-written code.</para></warning>
726
Gets the metrics of a string of wide characters.</para>
728
</para><variablelist role="params">
729
<varlistentry><term><parameter>font</parameter> :</term>
730
<listitem><simpara> a <link linkend="GdkFont"><type>GdkFont</type></link>
731
</simpara></listitem></varlistentry>
732
<varlistentry><term><parameter>text</parameter> :</term>
733
<listitem><simpara> the text to measure.
734
</simpara></listitem></varlistentry>
735
<varlistentry><term><parameter>text_length</parameter> :</term>
736
<listitem><simpara> the length of the text in character.
737
</simpara></listitem></varlistentry>
738
<varlistentry><term><parameter>lbearing</parameter> :</term>
739
<listitem><simpara> the left bearing of the string.
740
</simpara></listitem></varlistentry>
741
<varlistentry><term><parameter>rbearing</parameter> :</term>
742
<listitem><simpara> the right bearing of the string.
743
</simpara></listitem></varlistentry>
744
<varlistentry><term><parameter>width</parameter> :</term>
745
<listitem><simpara> the width of the string.
746
</simpara></listitem></varlistentry>
747
<varlistentry><term><parameter>ascent</parameter> :</term>
748
<listitem><simpara> the ascent of the string.
749
</simpara></listitem></varlistentry>
750
<varlistentry><term><parameter>descent</parameter> :</term>
751
<listitem><simpara> the descent of the string.
752
</simpara></listitem></varlistentry>
753
</variablelist></refsect2>
755
<title><anchor id="gdk-string-width" role="function" condition="deprecated:"/>gdk_string_width ()</title>
756
<indexterm role="deprecated"><primary>gdk_string_width</primary></indexterm><programlisting><link linkend="gint">gint</link> gdk_string_width (<link linkend="GdkFont">GdkFont</link> *font,
757
const <link linkend="gchar">gchar</link> *string);</programlisting>
758
<warning><para><literal>gdk_string_width</literal> is deprecated and should not be used in newly-written code.</para></warning>
760
Determines the width of a nul-terminated string.
761
(The distance from the origin of the string to the
762
point where the next string in a sequence of strings
763
should be drawn)</para>
765
</para><variablelist role="params">
766
<varlistentry><term><parameter>font</parameter> :</term>
767
<listitem><simpara> a <link linkend="GdkFont"><type>GdkFont</type></link>
768
</simpara></listitem></varlistentry>
769
<varlistentry><term><parameter>string</parameter> :</term>
770
<listitem><simpara> the nul-terminated string to measure
771
</simpara></listitem></varlistentry>
772
<varlistentry><term><emphasis>Returns</emphasis> :</term><listitem><simpara> the width of the string in pixels.
773
</simpara></listitem></varlistentry>
774
</variablelist></refsect2>
776
<title><anchor id="gdk-text-width" role="function" condition="deprecated:"/>gdk_text_width ()</title>
777
<indexterm role="deprecated"><primary>gdk_text_width</primary></indexterm><programlisting><link linkend="gint">gint</link> gdk_text_width (<link linkend="GdkFont">GdkFont</link> *font,
778
const <link linkend="gchar">gchar</link> *text,
779
<link linkend="gint">gint</link> text_length);</programlisting>
780
<warning><para><literal>gdk_text_width</literal> is deprecated and should not be used in newly-written code.</para></warning>
782
Determines the width of a given string.</para>
784
</para><variablelist role="params">
785
<varlistentry><term><parameter>font</parameter> :</term>
786
<listitem><simpara> a <link linkend="GdkFont"><type>GdkFont</type></link>
787
</simpara></listitem></varlistentry>
788
<varlistentry><term><parameter>text</parameter> :</term>
789
<listitem><simpara> the text to measure.
790
</simpara></listitem></varlistentry>
791
<varlistentry><term><parameter>text_length</parameter> :</term>
792
<listitem><simpara> the length of the text in bytes.
793
</simpara></listitem></varlistentry>
794
<varlistentry><term><emphasis>Returns</emphasis> :</term><listitem><simpara> the width of the string in pixels.
795
</simpara></listitem></varlistentry>
796
</variablelist></refsect2>
798
<title><anchor id="gdk-text-width-wc" role="function" condition="deprecated:"/>gdk_text_width_wc ()</title>
799
<indexterm role="deprecated"><primary>gdk_text_width_wc</primary></indexterm><programlisting><link linkend="gint">gint</link> gdk_text_width_wc (<link linkend="GdkFont">GdkFont</link> *font,
800
const <link linkend="GdkWChar">GdkWChar</link> *text,
801
<link linkend="gint">gint</link> text_length);</programlisting>
802
<warning><para><literal>gdk_text_width_wc</literal> is deprecated and should not be used in newly-written code.</para></warning>
804
Determines the width of a given wide-character string.</para>
806
</para><variablelist role="params">
807
<varlistentry><term><parameter>font</parameter> :</term>
808
<listitem><simpara> a <link linkend="GdkFont"><type>GdkFont</type></link>
809
</simpara></listitem></varlistentry>
810
<varlistentry><term><parameter>text</parameter> :</term>
811
<listitem><simpara> the text to measure.
812
</simpara></listitem></varlistentry>
813
<varlistentry><term><parameter>text_length</parameter> :</term>
814
<listitem><simpara> the length of the text in characters.
815
</simpara></listitem></varlistentry>
816
<varlistentry><term><emphasis>Returns</emphasis> :</term><listitem><simpara> the width of the string in pixels.
817
</simpara></listitem></varlistentry>
818
</variablelist></refsect2>
820
<title><anchor id="gdk-char-width" role="function" condition="deprecated:Use gdk_text_extents() instead."/>gdk_char_width ()</title>
821
<indexterm role="deprecated"><primary>gdk_char_width</primary></indexterm><programlisting><link linkend="gint">gint</link> gdk_char_width (<link linkend="GdkFont">GdkFont</link> *font,
822
<link linkend="gchar">gchar</link> character);</programlisting>
823
<warning><para><literal>gdk_char_width</literal> is deprecated and should not be used in newly-written code. Use <link linkend="gdk-text-extents"><function>gdk_text_extents()</function></link> instead.</para></warning>
825
Determines the width of a given character.</para>
827
</para><variablelist role="params">
828
<varlistentry><term><parameter>font</parameter> :</term>
829
<listitem><simpara> a <link linkend="GdkFont"><type>GdkFont</type></link>
830
</simpara></listitem></varlistentry>
831
<varlistentry><term><parameter>character</parameter> :</term>
832
<listitem><simpara> the character to measure.
833
</simpara></listitem></varlistentry>
834
<varlistentry><term><emphasis>Returns</emphasis> :</term><listitem><simpara> the width of the character in pixels.
836
</simpara></listitem></varlistentry>
837
</variablelist></refsect2>
839
<title><anchor id="gdk-char-width-wc" role="function" condition="deprecated:"/>gdk_char_width_wc ()</title>
840
<indexterm role="deprecated"><primary>gdk_char_width_wc</primary></indexterm><programlisting><link linkend="gint">gint</link> gdk_char_width_wc (<link linkend="GdkFont">GdkFont</link> *font,
841
<link linkend="GdkWChar">GdkWChar</link> character);</programlisting>
842
<warning><para><literal>gdk_char_width_wc</literal> is deprecated and should not be used in newly-written code.</para></warning>
844
Determines the width of a given wide character. (Encoded
845
in the wide-character encoding of the current locale).</para>
847
</para><variablelist role="params">
848
<varlistentry><term><parameter>font</parameter> :</term>
849
<listitem><simpara> a <link linkend="GdkFont"><type>GdkFont</type></link>
850
</simpara></listitem></varlistentry>
851
<varlistentry><term><parameter>character</parameter> :</term>
852
<listitem><simpara> the character to measure.
853
</simpara></listitem></varlistentry>
854
<varlistentry><term><emphasis>Returns</emphasis> :</term><listitem><simpara> the width of the character in pixels.
855
</simpara></listitem></varlistentry>
856
</variablelist></refsect2>
858
<title><anchor id="gdk-string-measure" role="function" condition="deprecated:"/>gdk_string_measure ()</title>
859
<indexterm role="deprecated"><primary>gdk_string_measure</primary></indexterm><programlisting><link linkend="gint">gint</link> gdk_string_measure (<link linkend="GdkFont">GdkFont</link> *font,
860
const <link linkend="gchar">gchar</link> *string);</programlisting>
861
<warning><para><literal>gdk_string_measure</literal> is deprecated and should not be used in newly-written code.</para></warning>
863
Determines the distance from the origin to the rightmost
864
portion of a nul-terminated string when drawn. This is not the
865
correct value for determining the origin of the next
866
portion when drawing text in multiple pieces.
867
See <link linkend="gdk-string-width"><function>gdk_string_width()</function></link>.</para>
869
</para><variablelist role="params">
870
<varlistentry><term><parameter>font</parameter> :</term>
871
<listitem><simpara> a <link linkend="GdkFont"><type>GdkFont</type></link>
872
</simpara></listitem></varlistentry>
873
<varlistentry><term><parameter>string</parameter> :</term>
874
<listitem><simpara> the nul-terminated string to measure.
875
</simpara></listitem></varlistentry>
876
<varlistentry><term><emphasis>Returns</emphasis> :</term><listitem><simpara> the right bearing of the string in pixels.
877
</simpara></listitem></varlistentry>
878
</variablelist></refsect2>
880
<title><anchor id="gdk-text-measure" role="function" condition="deprecated:"/>gdk_text_measure ()</title>
881
<indexterm role="deprecated"><primary>gdk_text_measure</primary></indexterm><programlisting><link linkend="gint">gint</link> gdk_text_measure (<link linkend="GdkFont">GdkFont</link> *font,
882
const <link linkend="gchar">gchar</link> *text,
883
<link linkend="gint">gint</link> text_length);</programlisting>
884
<warning><para><literal>gdk_text_measure</literal> is deprecated and should not be used in newly-written code.</para></warning>
886
Determines the distance from the origin to the rightmost
887
portion of a string when drawn. This is not the
888
correct value for determining the origin of the next
889
portion when drawing text in multiple pieces.
890
See <link linkend="gdk-text-width"><function>gdk_text_width()</function></link>.</para>
892
</para><variablelist role="params">
893
<varlistentry><term><parameter>font</parameter> :</term>
894
<listitem><simpara> a <link linkend="GdkFont"><type>GdkFont</type></link>
895
</simpara></listitem></varlistentry>
896
<varlistentry><term><parameter>text</parameter> :</term>
897
<listitem><simpara> the text to measure.
898
</simpara></listitem></varlistentry>
899
<varlistentry><term><parameter>text_length</parameter> :</term>
900
<listitem><simpara> the length of the text in bytes.
901
</simpara></listitem></varlistentry>
902
<varlistentry><term><emphasis>Returns</emphasis> :</term><listitem><simpara> the right bearing of the string in pixels.
903
</simpara></listitem></varlistentry>
904
</variablelist></refsect2>
906
<title><anchor id="gdk-char-measure" role="function" condition="deprecated:"/>gdk_char_measure ()</title>
907
<indexterm role="deprecated"><primary>gdk_char_measure</primary></indexterm><programlisting><link linkend="gint">gint</link> gdk_char_measure (<link linkend="GdkFont">GdkFont</link> *font,
908
<link linkend="gchar">gchar</link> character);</programlisting>
909
<warning><para><literal>gdk_char_measure</literal> is deprecated and should not be used in newly-written code.</para></warning>
911
Determines the distance from the origin to the rightmost
912
portion of a character when drawn. This is not the
913
correct value for determining the origin of the next
914
portion when drawing text in multiple pieces.</para>
916
</para><variablelist role="params">
917
<varlistentry><term><parameter>font</parameter> :</term>
918
<listitem><simpara> a <link linkend="GdkFont"><type>GdkFont</type></link>
919
</simpara></listitem></varlistentry>
920
<varlistentry><term><parameter>character</parameter> :</term>
921
<listitem><simpara> the character to measure.
922
</simpara></listitem></varlistentry>
923
<varlistentry><term><emphasis>Returns</emphasis> :</term><listitem><simpara> the right bearing of the character in pixels.
924
</simpara></listitem></varlistentry>
925
</variablelist></refsect2>
927
<title><anchor id="gdk-string-height" role="function" condition="deprecated:"/>gdk_string_height ()</title>
928
<indexterm role="deprecated"><primary>gdk_string_height</primary></indexterm><programlisting><link linkend="gint">gint</link> gdk_string_height (<link linkend="GdkFont">GdkFont</link> *font,
929
const <link linkend="gchar">gchar</link> *string);</programlisting>
930
<warning><para><literal>gdk_string_height</literal> is deprecated and should not be used in newly-written code.</para></warning>
932
Determines the total height of a given nul-terminated
933
string. This value is not generally useful, because you
934
cannot determine how this total height will be drawn in
935
relation to the baseline. See <link linkend="gdk-string-extents"><function>gdk_string_extents()</function></link>.</para>
937
</para><variablelist role="params">
938
<varlistentry><term><parameter>font</parameter> :</term>
939
<listitem><simpara> a <link linkend="GdkFont"><type>GdkFont</type></link>
940
</simpara></listitem></varlistentry>
941
<varlistentry><term><parameter>string</parameter> :</term>
942
<listitem><simpara> the nul-terminated string to measure.
943
</simpara></listitem></varlistentry>
944
<varlistentry><term><emphasis>Returns</emphasis> :</term><listitem><simpara> the height of the string in pixels.
945
</simpara></listitem></varlistentry>
946
</variablelist></refsect2>
948
<title><anchor id="gdk-text-height" role="function" condition="deprecated:"/>gdk_text_height ()</title>
949
<indexterm role="deprecated"><primary>gdk_text_height</primary></indexterm><programlisting><link linkend="gint">gint</link> gdk_text_height (<link linkend="GdkFont">GdkFont</link> *font,
950
const <link linkend="gchar">gchar</link> *text,
951
<link linkend="gint">gint</link> text_length);</programlisting>
952
<warning><para><literal>gdk_text_height</literal> is deprecated and should not be used in newly-written code.</para></warning>
954
Determines the total height of a given string.
955
This value is not generally useful, because you cannot
956
determine how this total height will be drawn in
957
relation to the baseline. See <link linkend="gdk-text-extents"><function>gdk_text_extents()</function></link>.</para>
959
</para><variablelist role="params">
960
<varlistentry><term><parameter>font</parameter> :</term>
961
<listitem><simpara> a <link linkend="GdkFont"><type>GdkFont</type></link>
962
</simpara></listitem></varlistentry>
963
<varlistentry><term><parameter>text</parameter> :</term>
964
<listitem><simpara> the text to measure.
965
</simpara></listitem></varlistentry>
966
<varlistentry><term><parameter>text_length</parameter> :</term>
967
<listitem><simpara> the length of the text in bytes.
968
</simpara></listitem></varlistentry>
969
<varlistentry><term><emphasis>Returns</emphasis> :</term><listitem><simpara> the height of the string in pixels.
970
</simpara></listitem></varlistentry>
971
</variablelist></refsect2>
973
<title><anchor id="gdk-char-height" role="function" condition="deprecated:Use gdk_text_extents() instead."/>gdk_char_height ()</title>
974
<indexterm role="deprecated"><primary>gdk_char_height</primary></indexterm><programlisting><link linkend="gint">gint</link> gdk_char_height (<link linkend="GdkFont">GdkFont</link> *font,
975
<link linkend="gchar">gchar</link> character);</programlisting>
976
<warning><para><literal>gdk_char_height</literal> is deprecated and should not be used in newly-written code. Use <link linkend="gdk-text-extents"><function>gdk_text_extents()</function></link> instead.</para></warning>
978
Determines the total height of a given character.
979
This value is not generally useful, because you cannot
980
determine how this total height will be drawn in
981
relation to the baseline. See <link linkend="gdk-text-extents"><function>gdk_text_extents()</function></link>.</para>
983
</para><variablelist role="params">
984
<varlistentry><term><parameter>font</parameter> :</term>
985
<listitem><simpara> a <link linkend="GdkFont"><type>GdkFont</type></link>
986
</simpara></listitem></varlistentry>
987
<varlistentry><term><parameter>character</parameter> :</term>
988
<listitem><simpara> the character to measure.
989
</simpara></listitem></varlistentry>
990
<varlistentry><term><emphasis>Returns</emphasis> :</term><listitem><simpara> the height of the character in pixels.
992
</simpara></listitem></varlistentry>
993
</variablelist></refsect2>
995
<title><anchor id="GdkWChar" role="typedef"/>GdkWChar</title>
996
<indexterm><primary>GdkWChar</primary></indexterm><programlisting>typedef guint32 GdkWChar;
999
Specifies a wide character type, used to represent character codes.
1000
This is needed since some native languages have character sets which have
1001
more than 256 characters (Japanese and Chinese, for example).
1004
Wide character values between 0 and 127 are always identical in meaning to
1005
the ASCII character codes. The wide character value 0 is often used to
1006
terminate strings of wide characters in a similar way to normal strings
1007
using the char type.
1010
An alternative to wide characters is multi-byte characters, which extend
1011
normal char strings to cope with larger character sets. As the name suggests,
1012
multi-byte characters use a different number of bytes to store different
1013
character codes. For example codes 0-127 (i.e. the ASCII codes) often
1014
use just one byte of memory, while other codes may use 2, 3 or even 4 bytes.
1015
Multi-byte characters have the advantage that they can often be used in an
1016
application with little change, since strings are still represented as arrays
1017
of char values. However multi-byte strings are much easier to manipulate since
1018
the character are all of the same size.
1021
Applications typically use wide characters to represent character codes
1022
internally, and multi-byte strings when saving the characters to a file.
1023
The <link linkend="gdk-wcstombs"><function>gdk_wcstombs()</function></link> and <link linkend="gdk-mbstowcs"><function>gdk_mbstowcs()</function></link> functions can be used to convert from
1024
one representation to the other.
1027
See the 'Extended Characters' section of the GNU C Library Reference Manual
1028
for more detailed information on wide and multi-byte characters.
1031
<title><anchor id="gdk-wcstombs" role="function" condition="deprecated:"/>gdk_wcstombs ()</title>
1032
<indexterm role="deprecated"><primary>gdk_wcstombs</primary></indexterm><programlisting><link linkend="gchar">gchar</link>* gdk_wcstombs (const <link linkend="GdkWChar">GdkWChar</link> *src);</programlisting>
1033
<warning><para><literal>gdk_wcstombs</literal> is deprecated and should not be used in newly-written code.</para></warning>
1035
Converts a wide character string to a multi-byte string.
1036
(The function name comes from an acronym of 'Wide Character String TO
1037
Multi-Byte String').</para>
1039
</para><variablelist role="params">
1040
<varlistentry><term><parameter>src</parameter> :</term>
1041
<listitem><simpara> a wide character string.
1042
</simpara></listitem></varlistentry>
1043
<varlistentry><term><emphasis>Returns</emphasis> :</term><listitem><simpara> the multi-byte string corresponding to <parameter>src</parameter>, or <link linkend="NULL:CAPS"><literal>NULL</literal></link> if the
1044
conversion failed. The returned string should be freed with <link linkend="g-free"><function>g_free()</function></link> when no
1046
</simpara></listitem></varlistentry>
1047
</variablelist></refsect2>
1049
<title><anchor id="gdk-mbstowcs" role="function" condition="deprecated:"/>gdk_mbstowcs ()</title>
1050
<indexterm role="deprecated"><primary>gdk_mbstowcs</primary></indexterm><programlisting><link linkend="gint">gint</link> gdk_mbstowcs (<link linkend="GdkWChar">GdkWChar</link> *dest,
1051
const <link linkend="gchar">gchar</link> *src,
1052
<link linkend="gint">gint</link> dest_max);</programlisting>
1053
<warning><para><literal>gdk_mbstowcs</literal> is deprecated and should not be used in newly-written code.</para></warning>
1055
Converts a multi-byte string to a wide character string.
1056
(The function name comes from an acronym of 'Multi-Byte String TO Wide
1057
Character String').</para>
1059
</para><variablelist role="params">
1060
<varlistentry><term><parameter>dest</parameter> :</term>
1061
<listitem><simpara> the space to place the converted wide character string into.
1062
</simpara></listitem></varlistentry>
1063
<varlistentry><term><parameter>src</parameter> :</term>
1064
<listitem><simpara> the multi-byte string to convert, which must be nul-terminated.
1065
</simpara></listitem></varlistentry>
1066
<varlistentry><term><parameter>dest_max</parameter> :</term>
1067
<listitem><simpara> the maximum number of wide characters to place in <parameter>dest</parameter>.
1068
</simpara></listitem></varlistentry>
1069
<varlistentry><term><emphasis>Returns</emphasis> :</term><listitem><simpara> the number of wide characters written into <parameter>dest</parameter>, or -1 if
1070
the conversion failed.
1071
</simpara></listitem></varlistentry>
1072
</variablelist></refsect2>