Pango.Font¶
| Subclasses: | None | 
|---|
Methods¶
| Inherited: | GObject.Object (37) | 
|---|---|
| Structs: | GObject.ObjectClass (5) | 
| class | descriptions_free(descs) | 
| describe() | |
| describe_with_absolute_size() | |
| find_shaper(language, ch) | |
| get_coverage(language) | |
| get_face() | |
| get_features(num_features) | |
| get_font_map() | |
| get_glyph_extents(glyph) | |
| get_metrics(language) | |
| has_char(wc) | 
Virtual Methods¶
| Inherited: | GObject.Object (7) | 
|---|
| do_create_hb_font() | |
| do_describe() | |
| do_describe_absolute() | |
| do_get_coverage(language) | |
| do_get_features(num_features) | |
| do_get_font_map() | |
| do_get_glyph_extents(glyph) | |
| do_get_metrics(language) | 
Properties¶
None
Signals¶
| Inherited: | GObject.Object (1) | 
|---|
Class Details¶
- 
class Pango.Font(**kwargs)¶
- Bases: - GObject.Object- Abstract: - Yes - Structure: - Pango.FontClass- The - Pango.Fontstructure is used to represent a font in a rendering-system-independent matter. To create an implementation of a- Pango.Font, the rendering-system specific code should allocate a larger structure that contains a nested- Pango.Font, fill in the klass member of the nested- Pango.Fontwith a pointer to a appropriate- Pango.FontClass, then call pango_font_init() on the structure.- The - Pango.Fontstructure contains one member which the implementation fills in.- 
classmethod descriptions_free(descs)[source]¶
- Parameters: - descs ([ - Pango.FontDescription] or- None) – a pointer to an array of- Pango.FontDescription, may be- None- Frees an array of font descriptions. 
 - 
describe()[source]¶
- Returns: - a newly-allocated - Pango.FontDescriptionobject.- Return type: - 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.
 - 
describe_with_absolute_size()[source]¶
- Returns: - a newly-allocated - Pango.FontDescriptionobject.- Return type: - 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.- New in version 1.14. 
 - 
find_shaper(language, ch)[source]¶
- Parameters: - language (Pango.Language) – the language tag
- ch (int) – a Unicode character.
 - Returns: - the best matching shaper. - Return type: - Finds the best matching shaper for a font for a particular language tag and character point. - Deprecated since version ???: Shape engines are no longer used 
- language (
 - 
get_coverage(language)[source]¶
- Parameters: - language ( - Pango.Language) – the language tag- Returns: - a newly-allocated - Pango.Coverageobject.- Return type: - Pango.Coverage- Computes the coverage map for a given font and language tag. 
 - 
get_face()[source]¶
- Returns: - the - Pango.FontFace- Return type: - Pango.FontFace- Gets the - Pango.FontFaceto which self belongs.- New in version 1.46. 
 - 
get_features(num_features)[source]¶
- Parameters: - num_features ( - int) – the number of used items in features- Returns: - features: - Array to features in - num_features: - the number of used items in features - Return type: - (features: [ - HarfBuzz.feature_t], num_features:- int)- 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. - New in version 1.44. 
 - 
get_font_map()[source]¶
- Returns: - the - Pango.FontMapfor the font, or- Noneif self is- None.- Return type: - Pango.FontMapor- None- 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 - None. 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.Contextholds a reference to the font map.- New in version 1.10. 
 - 
get_glyph_extents(glyph)[source]¶
- Parameters: - glyph ( - int) – the glyph index- Returns: - ink_rect: - rectangle used to store the extents of the glyph as drawn or - Noneto indicate that the result is not needed.- logical_rect: - rectangle used to store the logical extents of the glyph or - Noneto indicate that the result is not needed.- Return type: - (ink_rect: - Pango.Rectangle, logical_rect:- 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.SCALEof a device unit.- If self is - None, this function gracefully sets some sane values in the output variables and returns.
 - 
get_metrics(language)[source]¶
- Parameters: - language ( - Pango.Languageor- None) – language tag used to determine which script to get the metrics for, or- Noneto indicate to get the metrics for the entire font.- Returns: - a - Pango.FontMetricsobject. The caller must call- Pango.FontMetrics.unref() when finished using the object.- Return type: - 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 self is - None, this function gracefully sets some sane values in the output variables and returns.
 - 
has_char(wc)[source]¶
- Parameters: - wc ( - str) – a Unicode character- Return type: - bool- Returns whether the font provides a glyph for this character. - Returns - Trueif self can render wc- New in version 1.44. 
 - 
do_create_hb_font() virtual¶
- Return type: - HarfBuzz.font_t
 - 
do_describe() virtual¶
- Returns: - a newly-allocated - Pango.FontDescriptionobject.- Return type: - 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.
 - 
do_describe_absolute() virtual¶
- Return type: - Pango.FontDescription
 - 
do_get_coverage(language) virtual¶
- Parameters: - language ( - Pango.Language) – the language tag- Returns: - a newly-allocated - Pango.Coverageobject.- Return type: - Pango.Coverage- Computes the coverage map for a given font and language tag. 
 - 
do_get_features(num_features) virtual¶
- Parameters: - num_features ( - int) – the number of used items in features- Returns: - features: - Array to features in - num_features: - the number of used items in features - Return type: - (features: [ - HarfBuzz.feature_t], num_features:- int)- 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. - New in version 1.44. 
 - 
do_get_font_map() virtual¶
- Returns: - the - Pango.FontMapfor the font, or- Noneif font is- None.- Return type: - Pango.FontMapor- None- 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 - None. 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.Contextholds a reference to the font map.- New in version 1.10. 
 - 
do_get_glyph_extents(glyph) virtual¶
- Parameters: - glyph ( - int) – the glyph index- Returns: - ink_rect: - rectangle used to store the extents of the glyph as drawn or - Noneto indicate that the result is not needed.- logical_rect: - rectangle used to store the logical extents of the glyph or - Noneto indicate that the result is not needed.- Return type: - (ink_rect: - Pango.Rectangle, logical_rect:- 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.SCALEof a device unit.- If font is - None, this function gracefully sets some sane values in the output variables and returns.
 - 
do_get_metrics(language) virtual¶
- Parameters: - language ( - Pango.Languageor- None) – language tag used to determine which script to get the metrics for, or- Noneto indicate to get the metrics for the entire font.- Returns: - a - Pango.FontMetricsobject. The caller must call- Pango.FontMetrics.unref() when finished using the object.- Return type: - 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 - None, this function gracefully sets some sane values in the output variables and returns.
 
- 
classmethod