class Pango::Font

Overview

A Pango::Font is used to represent a font in a rendering-system-independent manner.

Defined in:

lib/gi-crystal/src/auto/pango-1.0/font.cr

Constructors

Class Method Summary

Instance Method Summary

Instance methods inherited from class GObject::Object

==(other : self) ==, bind_property(source_property : String, target : GObject::Object, target_property : String, flags : GObject::BindingFlags) : GObject::Binding bind_property, bind_property_full(source_property : String, target : GObject::Object, target_property : String, flags : GObject::BindingFlags, transform_to : GObject::Closure, transform_from : GObject::Closure) : GObject::Binding bind_property_full, data(key : String) : Pointer(Void) | Nil data, finalize finalize, freeze_notify : Nil freeze_notify, getv(names : Enumerable(String), values : Enumerable(_)) : Nil getv, hash(hasher) hash, notify(property_name : String) : Nil notify, notify_by_pspec(pspec : GObject::ParamSpec) : Nil notify_by_pspec, notify_signal notify_signal, property(property_name : String, value : _) : Nil property, qdata(quark : UInt32) : Pointer(Void) | Nil qdata, ref_count : UInt32 ref_count, run_dispose : Nil run_dispose, set_data(key : String, data : Pointer(Void) | Nil) : Nil set_data, set_property(property_name : String, value : _) : Nil set_property, steal_data(key : String) : Pointer(Void) | Nil steal_data, steal_qdata(quark : UInt32) : Pointer(Void) | Nil steal_qdata, thaw_notify : Nil thaw_notify, to_unsafe : Pointer(Void) to_unsafe, watch_closure(closure : GObject::Closure) : Nil watch_closure

Constructor methods inherited from class GObject::Object

cast(obj : GObject::Object) : self cast, new(pointer : Pointer(Void), transfer : GICrystal::Transfer)
new
new
, newv(object_type : UInt64, parameters : Enumerable(GObject::Parameter)) : self newv

Class methods inherited from class GObject::Object

cast?(obj : GObject::Object) : self | Nil cast?, compat_control(what : UInt64, data : Pointer(Void) | Nil) : UInt64 compat_control, g_type : UInt64 g_type, interface_find_property(g_iface : GObject::TypeInterface, property_name : String) : GObject::ParamSpec interface_find_property, interface_list_properties(g_iface : GObject::TypeInterface) : Enumerable(GObject::ParamSpec) interface_list_properties

Constructor Detail

def self.new #

Initialize a new Font.


[View source]

Class Method Detail

def self.descriptions_free(descs : Enumerable(Pango::FontDescription) | Nil) : Nil #

Frees an array of font descriptions.


[View source]
def self.descriptions_free(*descs : Pango::FontDescription) #

[View source]
def self.g_type : UInt64 #

Returns the type id (GType) registered in GLib type system.


[View source]

Instance Method Detail

def ==(other : self) #
Description copied from class Reference

Returns true if this reference is the same as other. Invokes same?.


def coverage(language : Pango::Language) : Pango::Coverage #

Computes the coverage map for a given font and language tag.


[View source]
def describe : Pango::FontDescription #

Returns a description of the font, with font size set in points.

Use Pango::Font#describe_with_absolute_size if you want the font size in device units.


[View source]
def describe_with_absolute_size : Pango::FontDescription #

Returns a description of the font, with absolute font size set in device units.

Use Pango::Font#describe if you want the font size in points.


[View source]
def deserialize(context : Pango::Context, bytes : GLib::Bytes) : Pango::Font | Nil #

[View source]
def face : Pango::FontFace #

Gets the Pango::FontFace to which font belongs.


[View source]
def features(features : Enumerable(HarfBuzz::FeatureT), num_features : UInt32) : Nil #

Obtain the OpenType features that are provided by the font.

These are passed to the rendering system, together with features that have been explicitly set via attributes.

Note that this does not include OpenType features which the rendering system enables by default.


[View source]
def font_map : Pango::FontMap | Nil #

Gets the font map for which the font was created.

Note that the font maintains a weak reference to the font map, so if all references to font map are dropped, the font map will be finalized even if there are fonts created with the font map that are still alive. In that case this function will return nil.

It is the responsibility of the user to ensure that the font map is kept alive. In most uses this is not an issue as a Pango::Context holds a reference to the font map.


[View source]
def glyph_extents(glyph : UInt32) : Pango::Rectangle #

Gets the logical and ink extents of a glyph within a font.

The coordinate system for each rectangle has its origin at the base line and horizontal origin of the character with increasing coordinates extending to the right and down. The macros PANGO_ASCENT(), PANGO_DESCENT(), PANGO_LBEARING(), and PANGO_RBEARING() can be used to convert from the extents rectangle to more traditional font metrics. The units of the rectangles are in 1/PANGO_SCALE of a device unit.

If font is nil, this function gracefully sets some sane values in the output variables and returns.


[View source]
def has_char(wc : Char) : Bool #

Returns whether the font provides a glyph for this character.


[View source]
def hash(hasher) #
Description copied from class Reference

See Object#hash(hasher)


def languages : Enumerable(Pango::Language) | Nil #

Returns the languages that are supported by font.

If the font backend does not provide this information, nil is returned. For the fontconfig backend, this corresponds to the FC_LANG member of the FcPattern.

The returned array is only valid as long as the font and its fontmap are valid.


[View source]
def metrics(language : Pango::Language | Nil) : Pango::FontMetrics #

Gets overall metric information for a font.

Since the metrics may be substantially different for different scripts, a language tag can be provided to indicate that the metrics should be retrieved that correspond to the script(s) used by that language.

If font is nil, this function gracefully sets some sane values in the output variables and returns.


[View source]
def serialize : GLib::Bytes #

Serializes the font in a way that can be uniquely identified.

There are no guarantees about the format of the output across different versions of Pango.

The intended use of this function is testing, benchmarking and debugging. The format is not meant as a permanent storage format.

To recreate a font from its serialized form, use Pango::Font#deserialize.


[View source]