1.6 <PangoFontMap>

Class: <PangoFontMap>

It derives from <GObject>.

A <PangoFontMap> represents the set of fonts available for a particular rendering system.

This is a virtual object with implementations being specific to particular rendering systems.

Fields

parent-instance

Properties

Property: font-map:item-type self

The type of items contained in this list.

Its value is a class, or a GType number.

It is read only.

Property: font-map:n-items self

The number of items contained in this list.

Its value is an unsigned 32-bit integer.

It is read only.

Procedures

Method: font-map:add-font-file? self filename ⇒ %return
Method: add-font-file? self filename ⇒ %return

Loads a font file with one or more fonts into the <PangoFontMap>.

The added fonts will take precedence over preexisting fonts with the same name.

self

Passed: a <PangoFontMap>.

a <PangoFontMap>

filename

Passed: a file name, as a string.

Path to the font file

%return

Returned: a boolean.

True if the font file is successfully loaded into the fontmap, false if an error occurred.

Method: font-map:changed self
Method: changed self

Forces a change in the fontmap, which will cause any <PangoContext> using this fontmap to change.

This function is only useful when implementing a new backend for Pango, something applications won’t do. Backends should call this function if they have attached extra data to the fontmap and such data is changed.

self

Passed: a <PangoFontMap>.

a <PangoFontMap>

Method: font-map:create-context self ⇒ %return
Method: create-context self ⇒ %return

Creates a <PangoContext> connected to self.

This is equivalent to context:new followed by context:set-font-map.

If you are using Pango as part of a higher-level system, that system may have it’s own way of create a <PangoContext>. For instance, the GTK toolkit has, among others, widget:get-pango-context. Use those instead.

self

Passed: a <PangoFontMap>.

a <PangoFontMap>

%return

Returned: a <PangoContext>.

the newly allocated <PangoContext>, which should be freed with object:unref.

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

Gets a font family by name.

self

Passed: a <PangoFontMap>.

a <PangoFontMap>

name

Passed: a string.

a family name

%return

Returned: a <PangoFontFamily>.

the <PangoFontFamily>

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

Returns the current serial number of self.

The serial number is initialized to an small number larger than zero when a new fontmap is created and is increased whenever the fontmap is changed. It may wrap, but will never have the value 0. Since it can wrap, never compare it with "less than", always use "not equals".

The fontmap can only be changed using backend-specific API, like changing fontmap resolution.

This can be used to automatically detect changes to a <PangoFontMap>, like in <PangoContext>.

self

Passed: a <PangoFontMap>.

a <PangoFontMap>

%return

Returned: an unsigned 32-bit integer.

The current serial number of self.

Method: font-map:list-families self ⇒ families
Method: list-families self ⇒ families

List all families for a fontmap.

Note that the returned families are not in any particular order.

<PangoFontMap> also implemented the <GListModel> interface for enumerating families.

self

Passed: a <PangoFontMap>.

a <PangoFontMap>

families

Returned: a vector, each a <PangoFontFamily>.

location to store a pointer to an array of <PangoFontFamily> *. This array should be freed with byte-array:free.

n-families

Not returned: it is the length of families.

location to store the number of elements in families

Method: font-map:load-font self context desc ⇒ %return
Method: load-font self context desc ⇒ %return

Load the font in the fontmap that is the closest match for desc.

self

Passed: a <PangoFontMap>.

a <PangoFontMap>

context

Passed: a <PangoContext>.

the <PangoContext> the font will be used with

desc

Passed: a <PangoFontDescription>.

a <PangoFontDescription> describing the font to load

%return

Returned: a <PangoFont>, or #f.

the newly allocated <PangoFont> loaded, or #f if no font matched.

Method: font-map:load-fontset self context desc language ⇒ %return
Method: load-fontset self context desc language ⇒ %return

Load a set of fonts in the fontmap that can be used to render a font matching desc.

self

Passed: a <PangoFontMap>.

a <PangoFontMap>

context

Passed: a <PangoContext>.

the <PangoContext> the font will be used with

desc

Passed: a <PangoFontDescription>.

a <PangoFontDescription> describing the font to load

language

Passed: a <PangoLanguage>.

a <PangoLanguage> the fonts will be used for

%return

Returned: a <PangoFontset>, or #f.

the newly allocated <PangoFontset> loaded, or #f if no font matched.

Method: font-map:reload-font self font scale [context] [variations] ⇒ %return
Method: reload-font self font scale [context] [variations] ⇒ %return

Returns a new font that is like font, except that it is scaled by scale, its backend-dependent configuration (e.g. cairo font options) is replaced by the one in context, and its variations are replaced by variations.

Note that the scaling here is meant to be linear, so this scaling can be used to render a font on a hi-dpi display without changing its optical size.

self

Passed: a <PangoFontMap>.

a <PangoFontMap>

font

Passed: a <PangoFont>.

a font in self

scale

Passed: a real number.

the scale factor to apply

context

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

a <PangoContext>

variations

Passed, or left out: a string, or #f.

font variations to use

%return

Returned: a <PangoFont>.

the modified font

Virtual methods

Virtual method: font-map:do-changed implementor self

Forces a change in the fontmap, which will cause any <PangoContext> using this fontmap to change.

This function is only useful when implementing a new backend for Pango, something applications won’t do. Backends should call this function if they have attached extra data to the fontmap and such data is changed.

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

implementor

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

self

Passed: a <PangoFontMap>.

a <PangoFontMap>

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

Gets a font family by name.

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

implementor

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

self

Passed: a <PangoFontMap>.

a <PangoFontMap>

name

Passed: a string.

a family name

%return

Returned: a <PangoFontFamily>.

the <PangoFontFamily>

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

Returns the current serial number of self.

The serial number is initialized to an small number larger than zero when a new fontmap is created and is increased whenever the fontmap is changed. It may wrap, but will never have the value 0. Since it can wrap, never compare it with "less than", always use "not equals".

The fontmap can only be changed using backend-specific API, like changing fontmap resolution.

This can be used to automatically detect changes to a <PangoFontMap>, like in <PangoContext>.

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

implementor

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

self

Passed: a <PangoFontMap>.

a <PangoFontMap>

%return

Returned: an unsigned 32-bit integer.

The current serial number of self.

Virtual method: font-map:do-list-families implementor self ⇒ families

List all families for a fontmap.

Note that the returned families are not in any particular order.

<PangoFontMap> also implemented the <GListModel> interface for enumerating families.

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

implementor

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

self

Passed: a <PangoFontMap>.

a <PangoFontMap>

families

Returned: a vector, each a <PangoFontFamily>.

location to store a pointer to an array of <PangoFontFamily> *. This array should be freed with byte-array:free.

n-families

Not returned: it is the length of families.

location to store the number of elements in families

Virtual method: font-map:do-load-font implementor self context desc ⇒ %return

Load the font in the fontmap that is the closest match for desc.

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

implementor

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

self

Passed: a <PangoFontMap>.

a <PangoFontMap>

context

Passed: a <PangoContext>.

the <PangoContext> the font will be used with

desc

Passed: a <PangoFontDescription>.

a <PangoFontDescription> describing the font to load

%return

Returned: a <PangoFont>, or #f.

the newly allocated <PangoFont> loaded, or #f if no font matched.

Virtual method: font-map:do-load-fontset implementor self context desc language ⇒ %return

Load a set of fonts in the fontmap that can be used to render a font matching desc.

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

implementor

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

self

Passed: a <PangoFontMap>.

a <PangoFontMap>

context

Passed: a <PangoContext>.

the <PangoContext> the font will be used with

desc

Passed: a <PangoFontDescription>.

a <PangoFontDescription> describing the font to load

language

Passed: a <PangoLanguage>.

a <PangoLanguage> the fonts will be used for

%return

Returned: a <PangoFontset>, or #f.

the newly allocated <PangoFontset> loaded, or #f if no font matched.