1.3 <PangoFont>

Class: <PangoFont>

It derives from <GObject>.

A <PangoFont> is used to represent a font in a rendering-system-independent manner.

Fields

parent-instance

Procedures

Method: font:describe self ⇒ %return
Method: describe self ⇒ %return

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

Use font:describe-with-absolute-size if you want the font size in device units.

self

Passed: a <PangoFont>.

a <PangoFont>

%return

Returned: a <PangoFontDescription>.

a newly-allocated <PangoFontDescription> object.

Method: font:describe-with-absolute-size self ⇒ %return
Method: describe-with-absolute-size self ⇒ %return

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

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

self

Passed: a <PangoFont>.

a <PangoFont>

%return

Returned: a <PangoFontDescription>.

a newly-allocated <PangoFontDescription> object.

Procedure: font:descriptions-free descs

Frees an array of font descriptions.

descs

Passed: a list or vector, each a <PangoFontDescription>, or #f.

a pointer to an array of <PangoFontDescription>, may be #f

n-descs

Not passed: guile-gi gives the length of descs.

number of font descriptions in descs

Procedure: font:deserialize context bytes ⇒ %return

Loads data previously created via font:serialize.

For a discussion of the supported format, see that function.

Note: to verify that the returned font is identical to the one that was serialized, you can compare bytes to the result of serializing the font again.

context

Passed: a <PangoContext>.

a <PangoContext>

bytes

Passed: a <GBytes>.

the bytes containing the data

%return

Returned: a <PangoFont>, or #f.

a new <PangoFont>

Method: font:get-coverage self language ⇒ %return
Method: get-coverage self language ⇒ %return

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

self

Passed: a <PangoFont>.

a <PangoFont>

language

Passed: a <PangoLanguage>.

the language tag

%return

Returned: a <PangoCoverage>.

a newly-allocated <PangoCoverage> object.

Method: font:get-face self ⇒ %return
Method: get-face self ⇒ %return

Gets the <PangoFontFace> to which self belongs.

Note that this function can return NULL in cases where the font outlives its font map.

self

Passed: a <PangoFont>.

a <PangoFont>

%return

Returned: a <PangoFontFace>, or #f.

the <PangoFontFace>

Method: font:get-features! self features num-features ⇒ features num-features
Method: get-features! self features num-features ⇒ features num-features

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.

self

Passed: a <PangoFont>.

a <PangoFont>

features

Passed: a list or vector, each a <hb_feature_t>. It is filled in, and returned: a vector, each a <hb_feature_t>.

Array to features in

num-features

Passed, and returned: an unsigned 32-bit integer.

the number of used items in features

len

Not returned: it is the length of features.

the length of features

Method: font:get-font-map self ⇒ %return
Method: get-font-map self ⇒ %return

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 #f.

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 <PangoContext> holds a reference to the font map.

self

Passed: a <PangoFont>.

a <PangoFont>

%return

Returned: a <PangoFontMap>, or #f.

the <PangoFontMap> for the font

Method: font:get-glyph-extents! self glyph ink-rect logical-rect ⇒ ink-rect logical-rect
Method: get-glyph-extents! self glyph ink-rect logical-rect ⇒ ink-rect logical-rect

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 self is #f, this function gracefully sets some sane values in the output variables and returns.

self

Passed: a <PangoFont>.

a <PangoFont>

glyph

Passed: an unsigned 32-bit integer.

the glyph index

ink-rect

Passed, filled in, and returned: a <PangoRectangle>.

rectangle used to store the extents of the glyph as drawn

logical-rect

Passed, filled in, and returned: a <PangoRectangle>.

rectangle used to store the logical extents of the glyph

Method: font:get-languages self ⇒ %return
Method: get-languages self ⇒ %return

Returns the languages that are supported by self.

If the font backend does not provide this information, #f 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.

self

Passed: a <PangoFont>.

a <PangoFont>

%return

Returned: a vector, each a <PangoLanguage>, or #f.

an array of <PangoLanguage>

Method: font:get-metrics self [language] ⇒ %return
Method: get-metrics self [language] ⇒ %return

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 self is #f, this function gracefully sets some sane values in the output variables and returns.

self

Passed: a <PangoFont>.

a <PangoFont>

language

Passed, or left out: a <PangoLanguage>, or #f.

language tag used to determine which script to get the metrics for, or #f to indicate to get the metrics for the entire font.

%return

Returned: a <PangoFontMetrics>.

a <PangoFontMetrics> object. The caller must call font-metrics:unref when finished using the object.

Method: font:has-char? self wc ⇒ %return
Method: has-char? self wc ⇒ %return

Returns whether the font provides a glyph for this character.

self

Passed: a <PangoFont>.

a <PangoFont>

wc

Passed: a character.

a Unicode character

%return

Returned: a boolean.

TRUE if self can render wc

Method: font:serialize self ⇒ %return
Method: serialize self ⇒ %return

Serializes the self 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 font:deserialize.

self

Passed: a <PangoFont>.

a <PangoFont>

%return

Returned: a <GBytes>.

a <GBytes> containing the serialized form of self

Virtual methods

Virtual method: font:do-create-hb-font implementor self ⇒ %return

To override it in a new class, give register-type #:vfuncs `((create-hb-font . ,procedure)). The procedure is called as (procedure self) ⇒ %return.

implementor

Passed: the class whose implementation to call: <PangoFont>, or a class that derives from it, or its GType number.

self

Passed: a <PangoFont>.

%return

Returned: a <hb_font_t>.

Virtual method: font:do-describe implementor self ⇒ %return

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

Use font:describe-with-absolute-size if you want the font size in device units.

To override it in a new class, give register-type #:vfuncs `((describe . ,procedure)). The procedure is called as (procedure self) ⇒ %return.

implementor

Passed: the class whose implementation to call: <PangoFont>, or a class that derives from it, or its GType number.

self

Passed: a <PangoFont>.

a <PangoFont>

%return

Returned: a <PangoFontDescription>.

a newly-allocated <PangoFontDescription> object.

Virtual method: font:do-describe-absolute implementor self ⇒ %return

To override it in a new class, give register-type #:vfuncs `((describe-absolute . ,procedure)). The procedure is called as (procedure self) ⇒ %return.

implementor

Passed: the class whose implementation to call: <PangoFont>, or a class that derives from it, or its GType number.

self

Passed: a <PangoFont>.

%return

Returned: a <PangoFontDescription>.

Virtual method: font:do-get-coverage implementor self language ⇒ %return

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

To override it in a new class, give register-type #:vfuncs `((get-coverage . ,procedure)). The procedure is called as (procedure self language) ⇒ %return.

implementor

Passed: the class whose implementation to call: <PangoFont>, or a class that derives from it, or its GType number.

self

Passed: a <PangoFont>.

a <PangoFont>

language

Passed: a <PangoLanguage>.

the language tag

%return

Returned: a <PangoCoverage>.

a newly-allocated <PangoCoverage> object.

Virtual method: font:do-get-features implementor self features num-features ⇒ features num-features

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.

To override it in a new class, give register-type #:vfuncs `((get-features . ,procedure)). The procedure is called as (procedure self features num-features) ⇒ num-features.

implementor

Passed: the class whose implementation to call: <PangoFont>, or a class that derives from it, or its GType number.

self

Passed: a <PangoFont>.

a <PangoFont>

features

Passed: a list or vector, each a <hb_feature_t>. It is filled in, and returned: a vector, each a <hb_feature_t>.

Array to features in

num-features

Passed, and returned: an unsigned 32-bit integer.

the number of used items in features

len

Not returned: it is the length of features.

the length of features

Virtual method: font:do-get-font-map implementor self ⇒ %return

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 #f.

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 <PangoContext> holds a reference to the font map.

To override it in a new class, give register-type #:vfuncs `((get-font-map . ,procedure)). The procedure is called as (procedure self) ⇒ %return.

implementor

Passed: the class whose implementation to call: <PangoFont>, or a class that derives from it, or its GType number.

self

Passed: a <PangoFont>.

a <PangoFont>

%return

Returned: a <PangoFontMap>, or #f.

the <PangoFontMap> for the font

Virtual method: font:do-get-glyph-extents implementor self glyph ink-rect logical-rect ⇒ ink-rect logical-rect

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 self is #f, this function gracefully sets some sane values in the output variables and returns.

To override it in a new class, give register-type #:vfuncs `((get-glyph-extents . ,procedure)). The procedure is called as (procedure self glyph ink-rect logical-rect).

implementor

Passed: the class whose implementation to call: <PangoFont>, or a class that derives from it, or its GType number.

self

Passed: a <PangoFont>.

a <PangoFont>

glyph

Passed: an unsigned 32-bit integer.

the glyph index

ink-rect

Passed, filled in, and returned: a <PangoRectangle>.

rectangle used to store the extents of the glyph as drawn

logical-rect

Passed, filled in, and returned: a <PangoRectangle>.

rectangle used to store the logical extents of the glyph

Virtual method: font:do-get-metrics implementor self [language] ⇒ %return

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 self is #f, this function gracefully sets some sane values in the output variables and returns.

To override it in a new class, give register-type #:vfuncs `((get-metrics . ,procedure)). The procedure is called as (procedure self language) ⇒ %return.

implementor

Passed: the class whose implementation to call: <PangoFont>, or a class that derives from it, or its GType number.

self

Passed: a <PangoFont>.

a <PangoFont>

language

Passed, or left out: a <PangoLanguage>, or #f.

language tag used to determine which script to get the metrics for, or #f to indicate to get the metrics for the entire font.

%return

Returned: a <PangoFontMetrics>.

a <PangoFontMetrics> object. The caller must call font-metrics:unref when finished using the object.