This package provides high-level, system-independent handling of fonts. It supercedes the old Gdk.Font package, which should no longer be used.
Fonts are defined through several attributes, like their family, weight, size, style, ...
The Pango_Font_Description objects created by this package can either be used directly to draw text through Pango.Layout.Pango_Layout objects (and the associated Gdk.Drawable.Draw_Layout procedure), or by converting them to a Gdk_Font. The first method is the preferred one, and provides high-level handling of multi-line texts or tabs, when you have to handle this yourself in the second case.
Types |
---|
type Pango_Font_Description is new Glib.C_Proxy; | |
| |
type Pango_Font_Metrics is new Glib.C_Proxy; | |
| |
type Pango_Language is new Glib.C_Proxy; | |
| |
type Property_Font_Description is new Desc_Properties.Property; | |
|
Subprograms |
---|
function Get_Type return Glib.GType; | ||
Return the internal gtk+ type associated with font descriptions.
| ||
function Copy (Desc : Pango_Font_Description) return Pango_Font_Description; | ||
Return a newly allocated font description. | ||
function Equal (Desc1 : Pango_Font_Description; Desc2 : Pango_Font_Description) return Boolean; | ||
Return True if the two font descriptions are identical. | ||
procedure Free (Desc : in out Pango_Font_Description); | ||
Deallocate the given font description.
| ||
function From_String (Str : String) return Pango_Font_Description; | ||
Create a new font description from the given string representation
| ||
function To_Font_Description (Family_Name : String := ""; Style : Pango.Enums.Style := Pango.Enums.Pango_Style_Normal; Variant : Pango.Enums.Variant := Pango.Enums.Pango_Variant_Normal; Weight : Pango.Enums.Weight := Pango.Enums.Pango_Weight_Normal; Stretch : Pango.Enums.Stretch := Pango.Enums.Pango_Stretch_Normal; Size : Gint := 0) return Pango_Font_Description; | ||
Create a new font decription from the given parameters.
| ||
function To_String (Desc : Pango_Font_Description) return String; | ||
Create a string representation of a font description. The format | ||
function To_Filename (Desc : Pango_Font_Description) return String; | ||
Create a filename representation of a font description. The filename | ||
function Get_Family (Desc : Pango_Font_Description) return String; | ||
Return the Family_Name of the given Pango_Font_Description. This is
| ||
procedure Set_Family (Desc : Pango_Font_Description; Name : String); | ||
Set the Family_Name of the given Pango_Font_Description.
| ||
function Get_Size (Desc : Pango_Font_Description) return Gint; | ||
Return value: the size for the font description in pango units. | ||
procedure Set_Size (Desc : Pango_Font_Description; Size : Gint); | ||
Set the size for the font description in pango units. (PANGO_SCALE | ||
Languages | ||
The following section provides types and subprograms to identify a | ||
function Pango_Language_Get_Typereturn Glib.GType; | ||
Return the internal value used to identify a Pango_Language
| ||
function From_String (Language : String) return Pango_Language; | ||
Take a RFC-3066 format language tag as a string and convert it to a This function first canonicalizes the string by converting it to lowercase, mapping '_' to '-', and stripping all characters other than letters and '-'.
The returned value need not be freed, it is stored internally by gtk+ in
a hash-table.
| ||
Metrics | ||
The following subprograms can be used to retrieve the metrics associated | ||
function Get_Metrics (Font : access Pango_Font_Record'Class; Language : Pango_Language := null) return Pango_Font_Metrics; | ||
Gets overall metric information for a font. Since the metrics may be The returned value must be Unref'ed by the caller.
Language determines which script to get the metrics for, or null to
indicate the metrics for the entire font.
| ||
procedure Ref (Metrics : Pango_Font_Metrics); | ||
| ||
function Get_Ascent (Metrics : Pango_Font_Metrics) return Gint; | ||
Gets the ascent from a font metrics structure. The ascent is the
The returned value is expressed in pango units, and must be divided by
Pango_Scale to get the value in pixels.
| ||
function Get_Descent (Metrics : Pango_Font_Metrics) return Gint; | ||
Gets the descent from a font metrics structure. The descent is the
The returned value is expressed in pango units, and must be divided by
Pango_Scale to get the value in pixels.
| ||
function Get_Approximate_Char_Width (Metrics : Pango_Font_Metrics) return Gint; | ||
Gets the approximate character width for a font metrics structure. This
The returned value is expressed in pango units, and must be divided by
Pango_Scale to get the value in pixels.
| ||
function Get_Approximate_Digit_Width (Metrics : Pango_Font_Metrics) return Gint; | ||
Gets the approximate digit width for a font metrics structure. This is
The returned value is expressed in pango units, and must be divided by
Pango_Scale to get the value in pixels.
| ||
function Font_Metrics_Get_Type return Glib.GType; | ||
Return the internal value associated with a Pango_Font_Metrics
| ||
Properties | ||
See the package Glib.Properties for more information on how to | ||
function Internal_Copy (F : Pango_Font_Description) return System.Address; | ||
|