pango Constants — the built-in constants of the pango module
The Alignment constants specify how to align the lines of a pango.Layout within the available space. If the pango.Layout is set to justify using the pango.Layout.set_justify() method, then this only has an effect for partial lines.
pango.ALIGN_LEFT | Put all available space on the right |
pango.ALIGN_CENTER | Center the line within the available space |
pango.ALIGN_RIGHT | Put all available space on the left |
The Attribute Type constants specify the type of a pango.Attribute.Along with the predefined values, it is possible to allocate additional values for custom attributes using the pango.attr_type_register() function. The predefined values are given below. The type of structure used to store the attribute is listed in parentheses after the description.
pango.ATTR_LANGUAGE | Specifies a pango.Language. |
pango.ATTR_FAMILY | Specifies a font family name list as a string. |
pango.ATTR_STYLE | Specifies a font slant style. See the pango.AttrStyle() function for more details. |
pango.ATTR_WEIGHT | Specifies a font weight. See the pango.AttrWeight() function for more detail. |
pango.ATTR_VARIANT | Specifies a font variant (normal or small caps). See the pango.AttrVariant() function for more detail. |
pango.ATTR_STRETCH | Specifies a font stretch. See the pango.AttrStretch() function for more details. |
pango.ATTR_SIZE | Specifies a font size in thousandths of a point. |
pango.ATTR_FONT_DESC | Specifies a pango.FontDescription. |
pango.ATTR_FOREGROUND | Specifies a foreground pango.Color. |
pango.ATTR_BACKGROUND | Specifies a background pango.Color. |
pango.ATTR_UNDERLINE | Specifies an underline style. See the pango.AttrUnderline() function for more details. |
pango.ATTR_STRIKETHROUGH | If TRUE the text is struck through. |
pango.ATTR_RISE | Specifies the displacement of the text from the baseline. |
pango.ATTR_SHAPE | Specifies a shape. See the pango.AttrShape() function for more details. |
pango.ATTR_SCALE | Specifies a font size scale factor. |
pango.ATTR_FALLBACK | if TRUE, fallback to other fonts is enabled ( |
pango.COVERAGE_NONE | The character is not representable with the font. |
pango.COVERAGE_FALLBACK | The character is represented in a way that may be comprehensible but is not the correct graphical form. For instance, a Hangul character represented as a a sequence of Jamos, or a Latin transliteration of a Cyrillic word. |
pango.COVERAGE_APPROXIMATE | The character is represented as basically the correct graphical form, but with a stylistic variant inappropriate for the current script. |
pango.COVERAGE_EXACT | The character is represented as the correct graphical form. |
The pango Direction constants specify a direction in the Unicode bidirectional algorithm. Not every value in this enumeration makes sense for every usage of pango Direction.
The pango.DIRECTION_TTB_LTR, pango.DIRECTION_TTB_RTL values come from an earlier interpretation of this enumeration as the writing direction of a block of text and are no longer used; See the Text module of the CSS3 spec for how vertical text is planned to be handled in a future version of Pango. The explanation of why pango.DIRECTION_TTB_LTR is treated as pango.DIRECTION_RTL can be found there as well.
pango.DIRECTION_LTR | A strong left-to-right direction |
pango.DIRECTION_RTL | A strong right-to-left direction |
pango.DIRECTION_TTB_LTR | Deprecated value; treated the same as pango.DIRECTION_RTL. |
pango.DIRECTION_TTB_RTL | Deprecated value; treated the same as pango.DIRECTION_LTR |
pango.DIRECTION_WEAK_LTR | A weak left-to-right direction |
pango.DIRECTION_WEAK_RTL | A weak right-to-left direction |
pango.DIRECTION_NEUTRAL | No direction specified |
The Ellipsize Mode constants specify what sort of (if any) ellipsization should be applied to a line of text. In the ellipsization process characters are removed from the text in order to make it fit to a given width and replaced with an ellipsis (...).
pango.ELLIPSIZE_NONE | No ellipsization. |
pango.ELLIPSIZE_START | Omit characters at the start of the text. |
pango.ELLIPSIZE_MIDDLE | Omit characters in the middle of the text. |
pango.ELLIPSIZE_END | Omit characters at the end of the text. |
The Font Mask flag constants are bit-flags that correspond to fields in a pango.FontDescription that have been set.
pango.FONT_MASK_FAMILY | the font family is specified. |
pango.FONT_MASK_STYLE | the font style is specified. |
pango.FONT_MASK_VARIANT | the font variant is specified. |
pango.FONT_MASK_WEIGHT | the font weight is specified. |
pango.FONT_MASK_STRETCH | the font stretch is specified. |
pango.FONT_MASK_SIZE | the font size is specified. |
pango.SCALE | The pango.SCALE constant represents the scale between dimensions used for Pango distances and device units. (The definition of device units is dependent on the output device; it will typically be pixels for a screen, and points for a printer.) pango.SCALE is currently 1024, but this may be changed in the future. When setting font sizes, device units are always considered to be points (as in "12 point font"), rather than pixels. |
pango.SCALE_XX_SMALL | The scale factor for three shrinking steps (1 / (1.2 * 1.2 * 1.2)). |
pango.SCALE_X_SMALL | he scale factor for two shrinking steps (1 / (1.2 * 1.2)). |
pango.SCALE_SMALL | The scale factor for one shrinking step (1 / 1.2). |
pango.SCALE_MEDIUM | The scale factor for normal size (1.0). |
pango.SCALE_LARGE | The scale factor for one magnification step (1.2). |
pango.SCALE_X_LARGE | he scale factor for two magnification steps (1.2 * 1.2). |
pango.SCALE_XX_LARGE | The scale factor for three magnification steps (1.2 * 1.2 * 1.2). |
The Stretch constants specify the width of the font relative to other designs within a family.
pango.STRETCH_ULTRA_CONDENSED | The most narrow width |
pango.STRETCH_EXTRA_CONDENSED | |
pango.STRETCH_CONDENSED | |
pango.STRETCH_SEMI_CONDENSED | |
pango.STRETCH_NORMAL | The normal width. |
pango.STRETCH_SEMI_EXPANDED | |
pango.STRETCH_EXPANDED | |
pango.STRETCH_EXTRA_EXPANDED | |
pango.STRETCH_ULTRA_EXPANDED | The most expanded width |
The Style constants specify the various slant styles possible for a font.
pango.STYLE_NORMAL | The font is upright. |
pango.STYLE_OBLIQUE | The font is slanted in a roman style. |
pango.STYLE_ITALIC | The font is slanted in an italic style. |
The Tab constants specify where a tab stop appears relative to the text.
pango.TAB_LEFT | the tab stop appears to the left of the text. |
The Underline constants specify he type of underlining (if any) to be used.
pango.UNDERLINE_NONE | No underline should be drawn. |
pango.UNDERLINE_SINGLE | A single underline should be drawn. |
pango.UNDERLINE_DOUBLE | A double underline should be drawn. |
pango.UNDERLINE_LOW | A single underline should be drawn at a position beneath the ink extents of the text being underlined. This should be used only for underlining single characters, such as for keyboard accelerators. pango.UNDERLINE_SINGLE should be used for extended portions of text. |
The Variant constants specify the capitalization variant of the font.
pango.VARIANT_NORMAL | A normal font. |
pango.VARIANT_SMALL_CAPS | A font with the lower case characters replaced by smaller variants of the capital characters. |
The Weight constants specify the weight (boldness) of a font. This is a numerical value ranging from 100 to 900, but there are some predefined values:
pango.WEIGHT_ULTRALIGHT | The ultralight weight (= 200). |
pango.WEIGHT_LIGHT | The light weight (=300). |
pango.WEIGHT_NORMAL | The default weight (= 400). |
pango.WEIGHT_BOLD | The bold weight (= 700). |
pango.WEIGHT_ULTRABOLD | The ultrabold weight (= 800). |
pango.WEIGHT_HEAVY | The heavy weight (= 900). |
The Wrap Mode constants specify how to wrap the lines of a pango.Layout to the desired width.
pango.WRAP_WORD | wrap lines at word boundaries. |
pango.WRAP_CHAR | wrap lines at character boundaries. |
pango.WRAP_WORD_CHAR | wrap lines at word boundaries, but fall back to character boundaries if there is not enough space for a full word. |