Fonts

Fonts

Functions

Types and Values

  GdkFont
enum GdkFontType
typedef GdkWChar

Includes

#include <gdk/gdk.h>

Description

Functions

gdk_font_load ()

GdkFont *
gdk_font_load (const gchar *font_name);

gdk_font_load is deprecated and should not be used in newly-written code.

Loads a font.

The font may be newly loaded or looked up the font in a cache. You should make no assumptions about the initial reference count.

Parameters

font_name

a XLFD describing the font to load.

 

Returns

a GdkFont, or NULL if the font could not be loaded.


gdk_font_load_for_display ()

GdkFont *
gdk_font_load_for_display (GdkDisplay *display,
                           const gchar *font_name);

gdk_font_load_for_display is deprecated and should not be used in newly-written code.

Loads a font for use on display .

The font may be newly loaded or looked up the font in a cache. You should make no assumptions about the initial reference count.

Parameters

display

a GdkDisplay

 

font_name

a XLFD describing the font to load.

 

returns

a GdkFont, or NULL if the font could not be loaded.

 

Since: 2.2


gdk_fontset_load ()

GdkFont *
gdk_fontset_load (const gchar *fontset_name);

gdk_fontset_load is deprecated and should not be used in newly-written code.

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.

Parameters

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.


gdk_fontset_load_for_display ()

GdkFont *
gdk_fontset_load_for_display (GdkDisplay *display,
                              const gchar *fontset_name);

gdk_fontset_load_for_display is deprecated and should not be used in newly-written code.

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.

Parameters

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.

 

Since: 2.2


gdk_font_from_description ()

GdkFont *
gdk_font_from_description (PangoFontDescription *font_desc);

gdk_font_from_description is deprecated and should not be used in newly-written code.

Load a GdkFont based on a Pango font description. This font will only be an approximation of the Pango font, and internationalization will not be handled correctly. This function should only be used for legacy code that cannot be easily converted to use Pango. Using Pango directly will produce better results.

Parameters

font_desc

a PangoFontDescription.

 

Returns

the newly loaded font, or NULL if the font cannot be loaded.


gdk_font_from_description_for_display ()

GdkFont *
gdk_font_from_description_for_display (GdkDisplay *display,
                                       PangoFontDescription *font_desc);

gdk_font_from_description_for_display is deprecated and should not be used in newly-written code.

Loads a GdkFont based on a Pango font description for use on display . This font will only be an approximation of the Pango font, and internationalization will not be handled correctly. This function should only be used for legacy code that cannot be easily converted to use Pango. Using Pango directly will produce better results.

Parameters

display

a GdkDisplay

 

font_desc

a PangoFontDescription.

 

Returns

the newly loaded font, or NULL if the font cannot be loaded.

Since: 2.2


gdk_font_get_display ()

GdkDisplay *
gdk_font_get_display (GdkFont *font);

gdk_font_get_display is deprecated and should not be used in newly-written code.

Returns the GdkDisplay for font .

Parameters

font

the GdkFont.

 

Returns

the corresponding GdkDisplay.

Since: 2.2


gdk_font_ref ()

GdkFont *
gdk_font_ref (GdkFont *font);

gdk_font_ref is deprecated and should not be used in newly-written code.

Increases the reference count of a font by one.

Parameters

font

a GdkFont

 

Returns

font


gdk_font_unref ()

void
gdk_font_unref (GdkFont *font);

gdk_font_unref is deprecated and should not be used in newly-written code.

Decreases the reference count of a font by one. If the result is zero, destroys the font.

Parameters

font

a GdkFont

 

gdk_font_id ()

gint
gdk_font_id (const GdkFont *font);

gdk_font_id is deprecated and should not be used in newly-written code.

Returns the X Font ID for the given font.

Parameters

font

a GdkFont.

 

Returns

the numeric X Font ID


gdk_font_equal ()

gboolean
gdk_font_equal (const GdkFont *fonta,
                const GdkFont *fontb);

gdk_font_equal is deprecated and should not be used in newly-written code.

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.

Parameters

fonta

a GdkFont.

 

fontb

another GdkFont.

 

Returns

TRUE if the fonts are equal.


gdk_string_extents ()

void
gdk_string_extents (GdkFont *font,
                    const gchar *string,
                    gint *lbearing,
                    gint *rbearing,
                    gint *width,
                    gint *ascent,
                    gint *descent);

gdk_string_extents is deprecated and should not be used in newly-written code.

Gets the metrics of a nul-terminated string.

Parameters

font

a GdkFont.

 

string

the nul-terminated string to measure.

 

lbearing

the left bearing of the string.

 

rbearing

the right bearing of the string.

 

width

the width of the string.

 

ascent

the ascent of the string.

 

descent

the descent of the string.

 

gdk_text_extents ()

void
gdk_text_extents (GdkFont *font,
                  const gchar *text,
                  gint text_length,
                  gint *lbearing,
                  gint *rbearing,
                  gint *width,
                  gint *ascent,
                  gint *descent);

gdk_text_extents is deprecated and should not be used in newly-written code.

Gets the metrics of a string.

Parameters

font

a GdkFont

 

text

the text to measure

 

text_length

the length of the text in bytes. (If the font is a 16-bit font, this is twice the length of the text in characters.)

 

lbearing

the left bearing of the string.

 

rbearing

the right bearing of the string.

 

width

the width of the string.

 

ascent

the ascent of the string.

 

descent

the descent of the string.

 

gdk_text_extents_wc ()

void
gdk_text_extents_wc (GdkFont *font,
                     const GdkWChar *text,
                     gint text_length,
                     gint *lbearing,
                     gint *rbearing,
                     gint *width,
                     gint *ascent,
                     gint *descent);

gdk_text_extents_wc is deprecated and should not be used in newly-written code.

Gets the metrics of a string of wide characters.

Parameters

font

a GdkFont

 

text

the text to measure.

 

text_length

the length of the text in character.

 

lbearing

the left bearing of the string.

 

rbearing

the right bearing of the string.

 

width

the width of the string.

 

ascent

the ascent of the string.

 

descent

the descent of the string.

 

gdk_string_width ()

gint
gdk_string_width (GdkFont *font,
                  const gchar *string);

gdk_string_width is deprecated and should not be used in newly-written code.

Determines the width of a nul-terminated string. (The distance from the origin of the string to the point where the next string in a sequence of strings should be drawn)

Parameters

font

a GdkFont

 

string

the nul-terminated string to measure

 

Returns

the width of the string in pixels.


gdk_text_width ()

gint
gdk_text_width (GdkFont *font,
                const gchar *text,
                gint text_length);

gdk_text_width is deprecated and should not be used in newly-written code.

Determines the width of a given string.

Parameters

font

a GdkFont

 

text

the text to measure.

 

text_length

the length of the text in bytes.

 

Returns

the width of the string in pixels.


gdk_text_width_wc ()

gint
gdk_text_width_wc (GdkFont *font,
                   const GdkWChar *text,
                   gint text_length);

gdk_text_width_wc is deprecated and should not be used in newly-written code.

Determines the width of a given wide-character string.

Parameters

font

a GdkFont

 

text

the text to measure.

 

text_length

the length of the text in characters.

 

Returns

the width of the string in pixels.


gdk_char_width ()

gint
gdk_char_width (GdkFont *font,
                gchar character);

gdk_char_width has been deprecated since version 2.2 and should not be used in newly-written code.

Use gdk_text_extents() instead.

Determines the width of a given character.

Parameters

font

a GdkFont

 

character

the character to measure.

 

Returns

the width of the character in pixels.


gdk_char_width_wc ()

gint
gdk_char_width_wc (GdkFont *font,
                   GdkWChar character);

gdk_char_width_wc is deprecated and should not be used in newly-written code.

Determines the width of a given wide character. (Encoded in the wide-character encoding of the current locale).

Parameters

font

a GdkFont

 

character

the character to measure.

 

Returns

the width of the character in pixels.


gdk_string_measure ()

gint
gdk_string_measure (GdkFont *font,
                    const gchar *string);

gdk_string_measure is deprecated and should not be used in newly-written code.

Determines the distance from the origin to the rightmost portion of a nul-terminated string when drawn. This is not the correct value for determining the origin of the next portion when drawing text in multiple pieces. See gdk_string_width().

Parameters

font

a GdkFont

 

string

the nul-terminated string to measure.

 

Returns

the right bearing of the string in pixels.


gdk_text_measure ()

gint
gdk_text_measure (GdkFont *font,
                  const gchar *text,
                  gint text_length);

gdk_text_measure is deprecated and should not be used in newly-written code.

Determines the distance from the origin to the rightmost portion of a string when drawn. This is not the correct value for determining the origin of the next portion when drawing text in multiple pieces. See gdk_text_width().

Parameters

font

a GdkFont

 

text

the text to measure.

 

text_length

the length of the text in bytes.

 

Returns

the right bearing of the string in pixels.


gdk_char_measure ()

gint
gdk_char_measure (GdkFont *font,
                  gchar character);

gdk_char_measure is deprecated and should not be used in newly-written code.

Determines the distance from the origin to the rightmost portion of a character when drawn. This is not the correct value for determining the origin of the next portion when drawing text in multiple pieces.

Parameters

font

a GdkFont

 

character

the character to measure.

 

Returns

the right bearing of the character in pixels.


gdk_string_height ()

gint
gdk_string_height (GdkFont *font,
                   const gchar *string);

gdk_string_height is deprecated and should not be used in newly-written code.

Determines the total height of a given nul-terminated string. This value is not generally useful, because you cannot determine how this total height will be drawn in relation to the baseline. See gdk_string_extents().

Parameters

font

a GdkFont

 

string

the nul-terminated string to measure.

 

Returns

the height of the string in pixels.


gdk_text_height ()

gint
gdk_text_height (GdkFont *font,
                 const gchar *text,
                 gint text_length);

gdk_text_height is deprecated and should not be used in newly-written code.

Determines the total height of a given string. This value is not generally useful, because you cannot determine how this total height will be drawn in relation to the baseline. See gdk_text_extents().

Parameters

font

a GdkFont

 

text

the text to measure.

 

text_length

the length of the text in bytes.

 

Returns

the height of the string in pixels.


gdk_char_height ()

gint
gdk_char_height (GdkFont *font,
                 gchar character);

gdk_char_height has been deprecated since version 2.2 and should not be used in newly-written code.

Use gdk_text_extents() instead.

Determines the total height of a given character. This value is not generally useful, because you cannot determine how this total height will be drawn in relation to the baseline. See gdk_text_extents().

Parameters

font

a GdkFont

 

character

the character to measure.

 

Returns

the height of the character in pixels.


gdk_wcstombs ()

gchar *
gdk_wcstombs (const GdkWChar *src);

gdk_wcstombs is deprecated and should not be used in newly-written code.

Converts a wide character string to a multi-byte string. (The function name comes from an acronym of 'Wide Character String TO Multi-Byte String').

Parameters

src

a wide character string.

 

Returns

the multi-byte string corresponding to src , or NULL if the conversion failed. The returned string should be freed with g_free() when no longer needed.


gdk_mbstowcs ()

gint
gdk_mbstowcs (GdkWChar *dest,
              const gchar *src,
              gint dest_max);

gdk_mbstowcs is deprecated and should not be used in newly-written code.

Converts a multi-byte string to a wide character string. (The function name comes from an acronym of 'Multi-Byte String TO Wide Character String').

Parameters

dest

the space to place the converted wide character string into.

 

src

the multi-byte string to convert, which must be nul-terminated.

 

dest_max

the maximum number of wide characters to place in dest .

 

Returns

the number of wide characters written into dest , or -1 if the conversion failed.

Types and Values

GdkFont

typedef struct {
  GdkFontType type;
  gint ascent;
  gint descent;
} GdkFont;

GdkFont is deprecated and should not be used in newly-written code.


enum GdkFontType

GdkFontType is deprecated and should not be used in newly-written code.

Members

GDK_FONT_FONT

   

GDK_FONT_FONTSET

   

GdkWChar

typedef guint32			    GdkWChar;