@react-gnome/gjs-esm-types
Version:
TypeScript module declarations for GJS ESM modules.
1,965 lines (1,937 loc) • 315 kB
TypeScript
/*
* Type Definitions for Gjs (https://gjs.guide/)
*
* These type definitions are automatically generated, do not edit them by hand.
* If you found a bug fix it in ts-for-gir itself or create a bug report on https://github.com/gjsify/ts-for-gjs
*/
import type cairo from "gi://cairo?version=1.0";
import type HarfBuzz from "gi://HarfBuzz?version=0.0";
import type freetype2 from "gi://freetype2?version=2.0";
import type GObject from "gi://GObject?version=2.0";
import type GLib from "gi://GLib?version=2.0";
import type Gio from "gi://Gio?version=2.0";
declare module "gi://Pango?version=1.0" {
/**
* `PangoAlignment` describes how to align the lines of a `PangoLayout`
* within the available space.
*
* If the `PangoLayout` is set to justify using [method`Pango`.Layout.set_justify],
* this only affects partial lines.
*
* See [method`Pango`.Layout.set_auto_dir] for how text direction affects
* the interpretation of `PangoAlignment` values.
*/
enum Alignment {
/**
* Put all available space on the right
*/
LEFT,
/**
* Center the line within the available space
*/
CENTER,
/**
* Put all available space on the left
*/
RIGHT,
}
/**
* The `PangoAttrType` distinguishes between different types of attributes.
*
* Along with the predefined values, it is possible to allocate additional
* values for custom attributes using [func`AttrType`.register]. The predefined
* values are given below. The type of structure used to store the attribute is
* listed in parentheses after the description.
*/
enum AttrType {
/**
* does not happen
*/
INVALID,
/**
* language ([struct`Pango`.AttrLanguage])
*/
LANGUAGE,
/**
* font family name list ([struct`Pango`.AttrString])
*/
FAMILY,
/**
* font slant style ([struct`Pango`.AttrInt])
*/
STYLE,
/**
* font weight ([struct`Pango`.AttrInt])
*/
WEIGHT,
/**
* font variant (normal or small caps) ([struct`Pango`.AttrInt])
*/
VARIANT,
/**
* font stretch ([struct`Pango`.AttrInt])
*/
STRETCH,
/**
* font size in points scaled by %PANGO_SCALE ([struct`Pango`.AttrInt])
*/
SIZE,
/**
* font description ([struct`Pango`.AttrFontDesc])
*/
FONT_DESC,
/**
* foreground color ([struct`Pango`.AttrColor])
*/
FOREGROUND,
/**
* background color ([struct`Pango`.AttrColor])
*/
BACKGROUND,
/**
* whether the text has an underline ([struct`Pango`.AttrInt])
*/
UNDERLINE,
/**
* whether the text is struck-through ([struct`Pango`.AttrInt])
*/
STRIKETHROUGH,
/**
* baseline displacement ([struct`Pango`.AttrInt])
*/
RISE,
/**
* shape ([struct`Pango`.AttrShape])
*/
SHAPE,
/**
* font size scale factor ([struct`Pango`.AttrFloat])
*/
SCALE,
/**
* whether fallback is enabled ([struct`Pango`.AttrInt])
*/
FALLBACK,
/**
* letter spacing ([struct`PangoAttrInt]`)
*/
LETTER_SPACING,
/**
* underline color ([struct`Pango`.AttrColor])
*/
UNDERLINE_COLOR,
/**
* strikethrough color ([struct`Pango`.AttrColor])
*/
STRIKETHROUGH_COLOR,
/**
* font size in pixels scaled by %PANGO_SCALE ([struct`Pango`.AttrInt])
*/
ABSOLUTE_SIZE,
/**
* base text gravity ([struct`Pango`.AttrInt])
*/
GRAVITY,
/**
* gravity hint ([struct`Pango`.AttrInt])
*/
GRAVITY_HINT,
/**
* OpenType font features ([struct`Pango`.AttrFontFeatures]). Since 1.38
*/
FONT_FEATURES,
/**
* foreground alpha ([struct`Pango`.AttrInt]). Since 1.38
*/
FOREGROUND_ALPHA,
/**
* background alpha ([struct`Pango`.AttrInt]). Since 1.38
*/
BACKGROUND_ALPHA,
/**
* whether breaks are allowed ([struct`Pango`.AttrInt]). Since 1.44
*/
ALLOW_BREAKS,
/**
* how to render invisible characters ([struct`Pango`.AttrInt]). Since 1.44
*/
SHOW,
/**
* whether to insert hyphens at intra-word line breaks ([struct`Pango`.AttrInt]). Since 1.44
*/
INSERT_HYPHENS,
/**
* whether the text has an overline ([struct`Pango`.AttrInt]). Since 1.46
*/
OVERLINE,
/**
* overline color ([struct`Pango`.AttrColor]). Since 1.46
*/
OVERLINE_COLOR,
/**
* line height factor ([struct`Pango`.AttrFloat]). Since: 1.50
*/
LINE_HEIGHT,
/**
* line height ([struct`Pango`.AttrInt]). Since: 1.50
*/
ABSOLUTE_LINE_HEIGHT,
TEXT_TRANSFORM,
/**
* override segmentation to classify the range of the attribute as a single word ([struct`Pango`.AttrInt]). Since 1.50
*/
WORD,
/**
* override segmentation to classify the range of the attribute as a single sentence ([struct`Pango`.AttrInt]). Since 1.50
*/
SENTENCE,
/**
* baseline displacement ([struct`Pango`.AttrInt]). Since 1.50
*/
BASELINE_SHIFT,
/**
* font-relative size change ([struct`Pango`.AttrInt]). Since 1.50
*/
FONT_SCALE,
}
/**
* An enumeration that affects baseline shifts between runs.
*/
enum BaselineShift {
/**
* Leave the baseline unchanged
*/
NONE,
/**
* Shift the baseline to the superscript position,
* relative to the previous run
*/
SUPERSCRIPT,
/**
* Shift the baseline to the subscript position,
* relative to the previous run
*/
SUBSCRIPT,
}
/**
* `PangoBidiType` represents the bidirectional character
* type of a Unicode character.
*
* The values in this enumeration are specified by the
* [Unicode bidirectional algorithm](http://www.unicode.org/reports/tr9/).
*/
enum BidiType {
/**
* Left-to-Right
*/
L,
/**
* Left-to-Right Embedding
*/
LRE,
/**
* Left-to-Right Override
*/
LRO,
/**
* Right-to-Left
*/
R,
/**
* Right-to-Left Arabic
*/
AL,
/**
* Right-to-Left Embedding
*/
RLE,
/**
* Right-to-Left Override
*/
RLO,
/**
* Pop Directional Format
*/
PDF,
/**
* European Number
*/
EN,
/**
* European Number Separator
*/
ES,
/**
* European Number Terminator
*/
ET,
/**
* Arabic Number
*/
AN,
/**
* Common Number Separator
*/
CS,
/**
* Nonspacing Mark
*/
NSM,
/**
* Boundary Neutral
*/
BN,
/**
* Paragraph Separator
*/
B,
/**
* Segment Separator
*/
S,
/**
* Whitespace
*/
WS,
/**
* Other Neutrals
*/
ON,
/**
* Left-to-Right isolate. Since 1.48.6
*/
LRI,
/**
* Right-to-Left isolate. Since 1.48.6
*/
RLI,
/**
* First strong isolate. Since 1.48.6
*/
FSI,
/**
* Pop directional isolate. Since 1.48.6
*/
PDI,
}
/**
* `PangoCoverageLevel` is used to indicate how well a font can
* represent a particular Unicode character for a particular script.
*
* Since 1.44, only %PANGO_COVERAGE_NONE and %PANGO_COVERAGE_EXACT
* will be returned.
*/
enum CoverageLevel {
/**
* The character is not representable with
* the font.
*/
NONE,
/**
* 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.
*/
FALLBACK,
/**
* The character is represented as
* basically the correct graphical form, but with a stylistic
* variant inappropriate for the current script.
*/
APPROXIMATE,
/**
* The character is represented as the
* correct graphical form.
*/
EXACT,
}
/**
* `PangoDirection` represents a direction in the Unicode bidirectional
* algorithm.
*
* Not every value in this enumeration makes sense for every usage of
* `PangoDirection`; for example, the return value of [func`unichar_direction]`
* and [func`find_base_dir]` cannot be `PANGO_DIRECTION_WEAK_LTR` or
* `PANGO_DIRECTION_WEAK_RTL`, since every character is either neutral
* or has a strong direction; on the other hand `PANGO_DIRECTION_NEUTRAL`
* doesn't make sense to pass to [func`itemize_with_base_dir]`.
*
* 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 `PangoGravity` for how
* vertical text is handled in Pango.
*
* If you are interested in text direction, you should really use fribidi
* directly. `PangoDirection` is only retained because it is used in some
* public apis.
*/
enum Direction {
/**
* A strong left-to-right direction
*/
LTR,
/**
* A strong right-to-left direction
*/
RTL,
/**
* Deprecated value; treated the
* same as `PANGO_DIRECTION_RTL`.
*/
TTB_LTR,
/**
* Deprecated value; treated the
* same as `PANGO_DIRECTION_LTR`
*/
TTB_RTL,
/**
* A weak left-to-right direction
*/
WEAK_LTR,
/**
* A weak right-to-left direction
*/
WEAK_RTL,
/**
* No direction specified
*/
NEUTRAL,
}
/**
* `PangoEllipsizeMode` describes what sort of ellipsization
* should be applied to 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.
*/
enum EllipsizeMode {
/**
* No ellipsization
*/
NONE,
/**
* Omit characters at the start of the text
*/
START,
/**
* Omit characters in the middle of the text
*/
MIDDLE,
/**
* Omit characters at the end of the text
*/
END,
}
/**
* An enumeration that affects font sizes for superscript
* and subscript positioning and for (emulated) Small Caps.
*/
enum FontScale {
/**
* Leave the font size unchanged
*/
NONE,
/**
* Change the font to a size suitable for superscripts
*/
SUPERSCRIPT,
/**
* Change the font to a size suitable for subscripts
*/
SUBSCRIPT,
/**
* Change the font to a size suitable for Small Caps
*/
SMALL_CAPS,
}
/**
* `PangoGravity` represents the orientation of glyphs in a segment
* of text.
*
* This is useful when rendering vertical text layouts. In those situations,
* the layout is rotated using a non-identity [struct`Pango`.Matrix], and then
* glyph orientation is controlled using `PangoGravity`.
*
* Not every value in this enumeration makes sense for every usage of
* `PangoGravity`; for example, %PANGO_GRAVITY_AUTO only can be passed to
* [method`Pango`.Context.set_base_gravity] and can only be returned by
* [method`Pango`.Context.get_base_gravity].
*
* See also: [enum`Pango`.GravityHint]
*/
enum Gravity {
/**
* Glyphs stand upright (default) <img align="right" valign="center" src="m-south.png">
*/
SOUTH,
/**
* Glyphs are rotated 90 degrees counter-clockwise. <img align="right" valign="center" src="m-east.png">
*/
EAST,
/**
* Glyphs are upside-down. <img align="right" valign="cener" src="m-north.png">
*/
NORTH,
/**
* Glyphs are rotated 90 degrees clockwise. <img align="right" valign="center" src="m-west.png">
*/
WEST,
/**
* Gravity is resolved from the context matrix
*/
AUTO,
}
/**
* `PangoGravityHint` defines how horizontal scripts should behave in a
* vertical context.
*
* That is, English excerpts in a vertical paragraph for example.
*
* See also [enum`Pango`.Gravity]
*/
enum GravityHint {
/**
* scripts will take their natural gravity based
* on the base gravity and the script. This is the default.
*/
NATURAL,
/**
* always use the base gravity set, regardless of
* the script.
*/
STRONG,
/**
* for scripts not in their natural direction (eg.
* Latin in East gravity), choose per-script gravity such that every script
* respects the line progression. This means, Latin and Arabic will take
* opposite gravities and both flow top-to-bottom for example.
*/
LINE,
}
/**
* Errors that can be returned by [func`Pango`.Layout.deserialize].
*/
enum LayoutDeserializeError {
/**
* Unspecified error
*/
INVALID,
/**
* A JSon value could not be
* interpreted
*/
INVALID_VALUE,
/**
* A required JSon member was
* not found
*/
MISSING_VALUE,
}
/**
* The `PangoOverline` enumeration is used to specify whether text
* should be overlined, and if so, the type of line.
*/
enum Overline {
/**
* no overline should be drawn
*/
NONE,
/**
* Draw a single line above the ink
* extents of the text being underlined.
*/
SINGLE,
}
/**
* `PangoRenderPart` defines different items to render for such
* purposes as setting colors.
*/
enum RenderPart {
/**
* the text itself
*/
FOREGROUND,
/**
* the area behind the text
*/
BACKGROUND,
/**
* underlines
*/
UNDERLINE,
/**
* strikethrough lines
*/
STRIKETHROUGH,
/**
* overlines
*/
OVERLINE,
}
/**
* The `PangoScript` enumeration identifies different writing
* systems.
*
* The values correspond to the names as defined in the Unicode standard. See
* [Unicode Standard Annex 24: Script names](http://www.unicode.org/reports/tr24/)
*
* Note that this enumeration is deprecated and will not be updated to include values
* in newer versions of the Unicode standard. Applications should use the
* [enum`GLib`.UnicodeScript] enumeration instead,
* whose values are interchangeable with `PangoScript`.
*/
enum Script {
/**
* a value never returned from pango_script_for_unichar()
*/
INVALID_CODE,
/**
* a character used by multiple different scripts
*/
COMMON,
/**
* a mark glyph that takes its script from the
* base glyph to which it is attached
*/
INHERITED,
/**
* Arabic
*/
ARABIC,
/**
* Armenian
*/
ARMENIAN,
/**
* Bengali
*/
BENGALI,
/**
* Bopomofo
*/
BOPOMOFO,
/**
* Cherokee
*/
CHEROKEE,
/**
* Coptic
*/
COPTIC,
/**
* Cyrillic
*/
CYRILLIC,
/**
* Deseret
*/
DESERET,
/**
* Devanagari
*/
DEVANAGARI,
/**
* Ethiopic
*/
ETHIOPIC,
/**
* Georgian
*/
GEORGIAN,
/**
* Gothic
*/
GOTHIC,
/**
* Greek
*/
GREEK,
/**
* Gujarati
*/
GUJARATI,
/**
* Gurmukhi
*/
GURMUKHI,
/**
* Han
*/
HAN,
/**
* Hangul
*/
HANGUL,
/**
* Hebrew
*/
HEBREW,
/**
* Hiragana
*/
HIRAGANA,
/**
* Kannada
*/
KANNADA,
/**
* Katakana
*/
KATAKANA,
/**
* Khmer
*/
KHMER,
/**
* Lao
*/
LAO,
/**
* Latin
*/
LATIN,
/**
* Malayalam
*/
MALAYALAM,
/**
* Mongolian
*/
MONGOLIAN,
/**
* Myanmar
*/
MYANMAR,
/**
* Ogham
*/
OGHAM,
/**
* Old Italic
*/
OLD_ITALIC,
/**
* Oriya
*/
ORIYA,
/**
* Runic
*/
RUNIC,
/**
* Sinhala
*/
SINHALA,
/**
* Syriac
*/
SYRIAC,
/**
* Tamil
*/
TAMIL,
/**
* Telugu
*/
TELUGU,
/**
* Thaana
*/
THAANA,
/**
* Thai
*/
THAI,
/**
* Tibetan
*/
TIBETAN,
/**
* Canadian Aboriginal
*/
CANADIAN_ABORIGINAL,
/**
* Yi
*/
YI,
/**
* Tagalog
*/
TAGALOG,
/**
* Hanunoo
*/
HANUNOO,
/**
* Buhid
*/
BUHID,
/**
* Tagbanwa
*/
TAGBANWA,
/**
* Braille
*/
BRAILLE,
/**
* Cypriot
*/
CYPRIOT,
/**
* Limbu
*/
LIMBU,
/**
* Osmanya
*/
OSMANYA,
/**
* Shavian
*/
SHAVIAN,
/**
* Linear B
*/
LINEAR_B,
/**
* Tai Le
*/
TAI_LE,
/**
* Ugaritic
*/
UGARITIC,
/**
* New Tai Lue. Since 1.10
*/
NEW_TAI_LUE,
/**
* Buginese. Since 1.10
*/
BUGINESE,
/**
* Glagolitic. Since 1.10
*/
GLAGOLITIC,
/**
* Tifinagh. Since 1.10
*/
TIFINAGH,
/**
* Syloti Nagri. Since 1.10
*/
SYLOTI_NAGRI,
/**
* Old Persian. Since 1.10
*/
OLD_PERSIAN,
/**
* Kharoshthi. Since 1.10
*/
KHAROSHTHI,
/**
* an unassigned code point. Since 1.14
*/
UNKNOWN,
/**
* Balinese. Since 1.14
*/
BALINESE,
/**
* Cuneiform. Since 1.14
*/
CUNEIFORM,
/**
* Phoenician. Since 1.14
*/
PHOENICIAN,
/**
* Phags-pa. Since 1.14
*/
PHAGS_PA,
/**
* N'Ko. Since 1.14
*/
NKO,
/**
* Kayah Li. Since 1.20.1
*/
KAYAH_LI,
/**
* Lepcha. Since 1.20.1
*/
LEPCHA,
/**
* Rejang. Since 1.20.1
*/
REJANG,
/**
* Sundanese. Since 1.20.1
*/
SUNDANESE,
/**
* Saurashtra. Since 1.20.1
*/
SAURASHTRA,
/**
* Cham. Since 1.20.1
*/
CHAM,
/**
* Ol Chiki. Since 1.20.1
*/
OL_CHIKI,
/**
* Vai. Since 1.20.1
*/
VAI,
/**
* Carian. Since 1.20.1
*/
CARIAN,
/**
* Lycian. Since 1.20.1
*/
LYCIAN,
/**
* Lydian. Since 1.20.1
*/
LYDIAN,
/**
* Batak. Since 1.32
*/
BATAK,
/**
* Brahmi. Since 1.32
*/
BRAHMI,
/**
* Mandaic. Since 1.32
*/
MANDAIC,
/**
* Chakma. Since: 1.32
*/
CHAKMA,
/**
* Meroitic Cursive. Since: 1.32
*/
MEROITIC_CURSIVE,
/**
* Meroitic Hieroglyphs. Since: 1.32
*/
MEROITIC_HIEROGLYPHS,
/**
* Miao. Since: 1.32
*/
MIAO,
/**
* Sharada. Since: 1.32
*/
SHARADA,
/**
* Sora Sompeng. Since: 1.32
*/
SORA_SOMPENG,
/**
* Takri. Since: 1.32
*/
TAKRI,
/**
* Bassa. Since: 1.40
*/
BASSA_VAH,
/**
* Caucasian Albanian. Since: 1.40
*/
CAUCASIAN_ALBANIAN,
/**
* Duployan. Since: 1.40
*/
DUPLOYAN,
/**
* Elbasan. Since: 1.40
*/
ELBASAN,
/**
* Grantha. Since: 1.40
*/
GRANTHA,
/**
* Kjohki. Since: 1.40
*/
KHOJKI,
/**
* Khudawadi, Sindhi. Since: 1.40
*/
KHUDAWADI,
/**
* Linear A. Since: 1.40
*/
LINEAR_A,
/**
* Mahajani. Since: 1.40
*/
MAHAJANI,
/**
* Manichaean. Since: 1.40
*/
MANICHAEAN,
/**
* Mende Kikakui. Since: 1.40
*/
MENDE_KIKAKUI,
/**
* Modi. Since: 1.40
*/
MODI,
/**
* Mro. Since: 1.40
*/
MRO,
/**
* Nabataean. Since: 1.40
*/
NABATAEAN,
/**
* Old North Arabian. Since: 1.40
*/
OLD_NORTH_ARABIAN,
/**
* Old Permic. Since: 1.40
*/
OLD_PERMIC,
/**
* Pahawh Hmong. Since: 1.40
*/
PAHAWH_HMONG,
/**
* Palmyrene. Since: 1.40
*/
PALMYRENE,
/**
* Pau Cin Hau. Since: 1.40
*/
PAU_CIN_HAU,
/**
* Psalter Pahlavi. Since: 1.40
*/
PSALTER_PAHLAVI,
/**
* Siddham. Since: 1.40
*/
SIDDHAM,
/**
* Tirhuta. Since: 1.40
*/
TIRHUTA,
/**
* Warang Citi. Since: 1.40
*/
WARANG_CITI,
/**
* Ahom. Since: 1.40
*/
AHOM,
/**
* Anatolian Hieroglyphs. Since: 1.40
*/
ANATOLIAN_HIEROGLYPHS,
/**
* Hatran. Since: 1.40
*/
HATRAN,
/**
* Multani. Since: 1.40
*/
MULTANI,
/**
* Old Hungarian. Since: 1.40
*/
OLD_HUNGARIAN,
/**
* Signwriting. Since: 1.40
*/
SIGNWRITING,
}
/**
* An enumeration specifying the width of the font relative to other designs
* within a family.
*/
enum Stretch {
/**
* ultra condensed width
*/
ULTRA_CONDENSED,
/**
* extra condensed width
*/
EXTRA_CONDENSED,
/**
* condensed width
*/
CONDENSED,
/**
* semi condensed width
*/
SEMI_CONDENSED,
/**
* the normal width
*/
NORMAL,
/**
* semi expanded width
*/
SEMI_EXPANDED,
/**
* expanded width
*/
EXPANDED,
/**
* extra expanded width
*/
EXTRA_EXPANDED,
/**
* ultra expanded width
*/
ULTRA_EXPANDED,
}
/**
* An enumeration specifying the various slant styles possible for a font.
*/
enum Style {
/**
* the font is upright.
*/
NORMAL,
/**
* the font is slanted, but in a roman style.
*/
OBLIQUE,
/**
* the font is slanted in an italic style.
*/
ITALIC,
}
/**
* `PangoTabAlign` specifies where the text appears relative to the tab stop
* position.
*/
enum TabAlign {
/**
* the text appears to the right of the tab stop position
*/
LEFT,
/**
* the text appears to the left of the tab stop position
* until the available space is filled. Since: 1.50
*/
RIGHT,
/**
* the text is centered at the tab stop position
* until the available space is filled. Since: 1.50
*/
CENTER,
/**
* text before the first occurrence of the decimal point
* character appears to the left of the tab stop position (until the available
* space is filled), the rest to the right. Since: 1.50
*/
DECIMAL,
}
/**
* An enumeration that affects how Pango treats characters during shaping.
*/
enum TextTransform {
/**
* Leave text unchanged
*/
NONE,
/**
* Display letters and numbers as lowercase
*/
LOWERCASE,
/**
* Display letters and numbers as uppercase
*/
UPPERCASE,
/**
* Display the first character of a word
* in titlecase
*/
CAPITALIZE,
}
/**
* The `PangoUnderline` enumeration is used to specify whether text
* should be underlined, and if so, the type of underlining.
*/
enum Underline {
/**
* no underline should be drawn
*/
NONE,
/**
* a single underline should be drawn
*/
SINGLE,
/**
* a double underline should be drawn
*/
DOUBLE,
/**
* 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.
*/
LOW,
/**
* an underline indicating an error should
* be drawn below. The exact style of rendering is up to the
* `PangoRenderer` in use, but typical styles include wavy
* or dotted lines.
* This underline is typically used to indicate an error such
* as a possible mispelling; in some cases a contrasting color
* may automatically be used. This type of underlining is
* available since Pango 1.4.
*/
ERROR,
/**
* Like `PANGO_UNDERLINE_SINGLE,` but
* drawn continuously across multiple runs. This type
* of underlining is available since Pango 1.46.
*/
SINGLE_LINE,
/**
* Like `PANGO_UNDERLINE_DOUBLE,` but
* drawn continuously across multiple runs. This type
* of underlining is available since Pango 1.46.
*/
DOUBLE_LINE,
/**
* Like `PANGO_UNDERLINE_ERROR,` but
* drawn continuously across multiple runs. This type
* of underlining is available since Pango 1.46.
*/
ERROR_LINE,
}
/**
* An enumeration specifying capitalization variant of the font.
*/
enum Variant {
/**
* A normal font.
*/
NORMAL,
/**
* A font with the lower case characters
* replaced by smaller variants of the capital characters.
*/
SMALL_CAPS,
/**
* A font with all characters
* replaced by smaller variants of the capital characters. Since: 1.50
*/
ALL_SMALL_CAPS,
/**
* A font with the lower case characters
* replaced by smaller variants of the capital characters.
* Petite Caps can be even smaller than Small Caps. Since: 1.50
*/
PETITE_CAPS,
/**
* A font with all characters
* replaced by smaller variants of the capital characters.
* Petite Caps can be even smaller than Small Caps. Since: 1.50
*/
ALL_PETITE_CAPS,
/**
* A font with the upper case characters
* replaced by smaller variants of the capital letters. Since: 1.50
*/
UNICASE,
/**
* A font with capital letters that
* are more suitable for all-uppercase titles. Since: 1.50
*/
TITLE_CAPS,
}
/**
* An enumeration specifying the weight (boldness) of a font.
*
* Weight is specified as a numeric value ranging from 100 to 1000.
* This enumeration simply provides some common, predefined values.
*/
enum Weight {
/**
* the thin weight (= 100) Since: 1.24
*/
THIN,
/**
* the ultralight weight (= 200)
*/
ULTRALIGHT,
/**
* the light weight (= 300)
*/
LIGHT,
/**
* the semilight weight (= 350) Since: 1.36.7
*/
SEMILIGHT,
/**
* the book weight (= 380) Since: 1.24)
*/
BOOK,
/**
* the default weight (= 400)
*/
NORMAL,
/**
* the medium weight (= 500) Since: 1.24
*/
MEDIUM,
/**
* the semibold weight (= 600)
*/
SEMIBOLD,
/**
* the bold weight (= 700)
*/
BOLD,
/**
* the ultrabold weight (= 800)
*/
ULTRABOLD,
/**
* the heavy weight (= 900)
*/
HEAVY,
/**
* the ultraheavy weight (= 1000) Since: 1.24
*/
ULTRAHEAVY,
}
/**
* `PangoWrapMode` describes how to wrap the lines of a `PangoLayout`
* to the desired width.
*
* For `PANGO_WRAP_WORD,` Pango uses break opportunities that are determined
* by the Unicode line breaking algorithm. For `PANGO_WRAP_CHAR,` Pango allows
* breaking at grapheme boundaries that are determined by the Unicode text
* segmentation algorithm.
*/
enum WrapMode {
/**
* wrap lines at word boundaries.
*/
WORD,
/**
* wrap lines at character boundaries.
*/
CHAR,
/**
* wrap lines at word boundaries, but fall back to
* character boundaries if there is not enough space for a full word.
*/
WORD_CHAR,
}
/**
* The bits in a `PangoFontMask` correspond to the set fields in a
* `PangoFontDescription`.
* @bitfield
*/
enum FontMask {
/**
* the font family is specified.
*/
FAMILY,
/**
* the font style is specified.
*/
STYLE,
/**
* the font variant is specified.
*/
VARIANT,
/**
* the font weight is specified.
*/
WEIGHT,
/**
* the font stretch is specified.
*/
STRETCH,
/**
* the font size is specified.
*/
SIZE,
/**
* the font gravity is specified (Since: 1.16.)
*/
GRAVITY,
/**
* OpenType font variations are specified (Since: 1.42)
*/
VARIATIONS,
}
/**
* Flags that influence the behavior of [func`Pango`.Layout.deserialize].
*
* New members may be added to this enumeration over time.
* @bitfield
*/
enum LayoutDeserializeFlags {
/**
* Default behavior
*/
DEFAULT,
/**
* Apply context information
* from the serialization to the `PangoContext`
*/
CONTEXT,
}
/**
* Flags that influence the behavior of [method`Pango`.Layout.serialize].
*
* New members may be added to this enumeration over time.
* @bitfield
*/
enum LayoutSerializeFlags {
/**
* Default behavior
*/
DEFAULT,
/**
* Include context information
*/
CONTEXT,
/**
* Include information about the formatted output
*/
OUTPUT,
}
/**
* Flags influencing the shaping process.
*
* `PangoShapeFlags` can be passed to [func`Pango`.shape_with_flags].
* @bitfield
*/
enum ShapeFlags {
/**
* Default value
*/
NONE,
/**
* Round glyph positions and widths to whole device units
* This option should be set if the target renderer can't do subpixel positioning of glyphs
*/
ROUND_POSITIONS,
}
/**
* These flags affect how Pango treats characters that are normally
* not visible in the output.
* @bitfield
*/
enum ShowFlags {
/**
* No special treatment for invisible characters
*/
NONE,
/**
* Render spaces, tabs and newlines visibly
*/
SPACES,
/**
* Render line breaks visibly
*/
LINE_BREAKS,
/**
* Render default-ignorable Unicode
* characters visibly
*/
IGNORABLES,
}
/**
* Whether the segment should be shifted to center around the baseline.
*
* This is mainly used in vertical writing directions.
*/
const ANALYSIS_FLAG_CENTERED_BASELINE: number;
/**
* Whether this run holds ellipsized text.
*/
const ANALYSIS_FLAG_IS_ELLIPSIS: number;
/**
* Whether to add a hyphen at the end of the run during shaping.
*/
const ANALYSIS_FLAG_NEED_HYPHEN: number;
/**
* Value for `start_index` in `PangoAttribute` that indicates
* the beginning of the text.
*/
const ATTR_INDEX_FROM_TEXT_BEGINNING: number;
/**
* Value for `end_index` in `PangoAttribute` that indicates
* the end of the text.
*/
const ATTR_INDEX_TO_TEXT_END: number;
/**
* A `PangoGlyph` value that indicates a zero-width empty glpyh.
*
* This is useful for example in shaper modules, to use as the glyph for
* various zero-width Unicode characters (those passing [func`is_zero_width]`).
*/
const GLYPH_EMPTY: Glyph;
/**
* A `PangoGlyph` value for invalid input.
*
* `PangoLayout` produces one such glyph per invalid input UTF-8 byte and such
* a glyph is rendered as a crossed box.
*
* Note that this value is defined such that it has the %PANGO_GLYPH_UNKNOWN_FLAG
* set.
*/
const GLYPH_INVALID_INPUT: Glyph;
/**
* Flag used in `PangoGlyph` to turn a `gunichar` value of a valid Unicode
* character into an unknown-character glyph for that `gunichar`.
*
* Such unknown-character glyphs may be rendered as a 'hex box'.
*/
const GLYPH_UNKNOWN_FLAG: Glyph;
/**
* 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.
*/
const SCALE: number;
/**
* The major component of the version of Pango available at compile-time.
*/
const VERSION_MAJOR: number;
/**
* The micro component of the version of Pango available at compile-time.
*/
const VERSION_MICRO: number;
/**
* The minor component of the version of Pango available at compile-time.
*/
const VERSION_MINOR: number;
/**
* A string literal containing the version of Pango available at compile-time.
*/
const VERSION_STRING: string | null;
/**
* Create a new allow-breaks attribute.
*
* If breaks are disabled, the range will be kept in a
* single run, as far as possible.
* @param allow_breaks %TRUE if we line breaks are allowed
* @returns the newly allocated `PangoAttribute`, which should be freed with [method@Pango.Attribute.destroy]
*/
function attr_allow_breaks_new(allow_breaks: boolean): Attribute;
/**
* Create a new background alpha attribute.
* @param alpha the alpha value, between 1 and 65536
* @returns the newly allocated `PangoAttribute`, which should be freed with [method@Pango.Attribute.destroy]
*/
function attr_background_alpha_new(alpha: number): Attribute;
/**
* Create a new background color attribute.
* @param red the red value (ranging from 0 to 65535)
* @param green the green value
* @param blue the blue value
* @returns the newly allocated `PangoAttribute`, which should be freed with [method@Pango.Attribute.destroy]
*/
function attr_background_new(
red: number,
green: number,
blue: number
): Attribute;
/**
* Create a new baseline displacement attribute.
*
* The effect of this attribute is to shift the baseline of a run,
* relative to the run of preceding run.
*
* <picture>
* <source srcset="baseline-shift-dark.png" media="(prefers-color-scheme: dark)">
* <img alt="Baseline Shift" src="baseline-shift-light.png">
* </picture>
* @param shift either a `PangoBaselineShift` enumeration value or an absolute value (> 1024) in Pango units, relative to the baseline of the previous run. Positive values displace the text upwards.
* @returns the newly allocated `PangoAttribute`, which should be freed with [method@Pango.Attribute.destroy]
*/
function attr_baseline_shift_new(shift: number): Attribute;
/**
* Apply customization from attributes to the breaks in `attrs`.
*
* The line breaks are assumed to have been produced
* by [func`Pango`.default_break] and [func`Pango`.tailor_break].
* @param text text to break. Must be valid UTF-8
* @param length length of text in bytes (may be -1 if `text` is nul-terminated)
* @param attr_list `PangoAttrList` to apply
* @param offset Byte offset of `text` from the beginning of the paragraph
* @param attrs array with one `PangoLogAttr` per character in `text,` plus one extra, to be filled in
*/
function attr_break(
text: string | null,
length: number,
attr_list: AttrList,
offset: number,
attrs: LogAttr[]
): void;
/**
* Create a new font fallback attribute.
*
* If fallback is disabled, characters will only be
* used from the closest matching font on the system.
* No fallback will be done to other fonts on the system
* that might contain the characters in the text.
* @param enable_fallback %TRUE if we should fall back on other fonts for characters the active font is missing
* @returns the newly allocated `PangoAttribute`, which should be freed with [method@Pango.Attribute.destroy]
*/
function attr_fallback_new(enable_fallback: boolean): Attribute;
/**
* Create a new font family attribute.
* @param family the family or comma-separated list of families
* @returns the newly allocated `PangoAttribute`, which should be freed with [method@Pango.Attribute.destroy]
*/
function attr_family_new(family: string | null): Attribute;
/**
* Create a new font description attribute.
*
* This attribute allows setting family, style, weight, variant,
* stretch, and size simultaneously.
* @param desc the font description
* @returns the newly allocated `PangoAttribute`, which should be freed with [method@Pango.Attribute.destroy]
*/
function attr_font_desc_new(desc: FontDescription): Attribute;
/**
* Create a new font features tag attribute.
*
* You can use this attribute to select OpenType font features like small-caps,
* alternative glyphs, ligatures, etc. for fonts that support them.
* @param features a string with OpenType font features, with the syntax of the [CSS font-feature-settings property](https://www.w3.org/TR/css-fonts-4/#font-rend-desc)
* @returns the newly allocated `PangoAttribute`, which should be freed with [method@Pango.Attribute.destroy]
*/
function attr_font_features_new(features: string | null): Attribute;
/**
* Create a new font scale attribute.
*
* The effect of this attribute is to change the font size of a run,
* relative to the size of preceding run.
* @param scale a `PangoFontScale` value, which indicates font size change relative to the size of the previous run.
* @returns the newly allocated `PangoAttribute`, which should be freed with [method@Pango.Attribute.destroy]
*/
function attr_font_scale_new(scale: FontScale): Attribute;
/**
* Create a new foreground alpha attribute.
* @param alpha the alpha value, between 1 and 65536
* @returns the newly allocated `PangoAttribute`, which should be freed with [method@Pango.Attribute.destroy]
*/
function attr_foreground_alpha_new(alpha: number): Attribute;
/**
* Create a new foreground color attribute.
* @param red the red value (ranging from 0 to 65535)
* @param green the green value
* @param blue the blue value
* @returns the newly allocated `PangoAttribute`, which should be freed with [method@Pango.Attribute.destroy]
*/
function attr_foreground_new(
red: number,
green: number,
blue: number
): Attribute;
/**
* Create a new gravity hint attribute.
* @param hint the gravity hint value
* @returns the newly allocated `PangoAttribute`, which should be freed with [method@Pango.Attribute.destroy]
*/
function attr_gravity_hint_new(hint: GravityHint): Attribute;
/**
* Create a new gravity attribute.
* @param gravity the gravity value; should not be %PANGO_GRAVITY_AUTO
* @returns the newly allocated `PangoAttribute`, which should be freed with [method@Pango.Attribute.destroy]
*/
function attr_gravity_new(gravity: Gravity): Attribute;
/**
* Create a new insert-hyphens attribute.
*
* Pango will insert hyphens when breaking lines in
* the middle of a word. This attribute can be used
* to suppress the hyphen.
* @param insert_hyphens %TRUE if hyphens should be inserted
* @returns the newly allocated `PangoAttribute`, which should be freed with [method@Pango.Attribute.destroy]
*/
function attr_insert_hyphens_new(insert_hyphens: boolean): Attribute;
/**
* Create a new language tag attribute.
* @param language language tag
* @returns the newly allocated `PangoAttribute`, which should be freed with [method@Pango.Attribute.destroy]
*/
function attr_language_new(language: Language): Attribute;
/**
* Create a new letter-spacing attribute.
* @param letter_spacing amount of extra space to add between graphemes of the text, in Pango units
* @returns the newly allocated `PangoAttribute`, which should be freed with [method@Pango.Attribute.destroy]
*/
function attr_letter_spacing_new(letter_spacing: number): Attribute;
/**
* Modify the height of logical line extents by a factor.
*
* This affects the values returned by
* [method`Pango`.LayoutLine.get_extents],
* [method`Pango`.LayoutLine.get_pixel_extents] and
* [method`Pango`.LayoutIter.get_line_extents].
* @param factor the scaling factor to apply to the logical height
*/
function attr_line_height_new(factor: number): Attribute;
/**
* Override the height of logical line extents to be `height`.
*
* This affects the values returned by
* [method`Pango`.LayoutLine.get_extents],
* [method`Pango`.LayoutLine.get_pixel_extents] and
* [method`Pango`.LayoutIter.get_line_extents].
* @param height the line height, in %PANGO_SCALE-ths of a point
*/
function attr_line_height_new_absolute(height: number): Attribute;
/**
* Deserializes a `PangoAttrList` from a string.
*
* This is the counterpart to [method`Pango`.AttrList.to_string].
* See that functions for details about the format.
* @param text a string
* @returns a new `PangoAttrList`
*/
function attr_list_from_string(text: string | null): AttrList | null;
/**
* Create a new overline color attribute.
*
* This attribute modifies the color of overlines.
* If not set, overlines will use the foreground color.
* @param red the red value (ranging from 0 to 65535)
* @param green the green value
* @param blue the blue value
* @returns the newly allocated `PangoAttribute`, which should be freed with [method@Pango.Attribute.destroy]
*/
function attr_overline_color_new(
red: number,
green: number,
blue: number
): Attribute;
/**
* Create a new overline-style attribute.
* @param overline the overline style
* @returns the newly allocated `PangoAttribute`, which should be freed with [method@Pango.Attribute.destroy]
*/
function attr_overline_new(overline: Overline): Attribute;
/**
* Create a new baseline displacement attribute.
* @param rise the amount that the text should be displaced vertically, in Pango units. Positive values displace the text upwards.
* @returns the newly allocated `PangoAttribute`, which should be freed with [method@Pango.Attribute.destroy]
*/
function attr_rise_new(rise: number): Attribute;
/**
* Create a new font size scale attribute.
*
* The base font for the affected text will have
* its size multiplied by `scale_factor`.
* @param scale_factor factor to scale the font
* @returns the newly allocated `PangoAttribute`, which should be freed with [method@Pango.Attribute.destroy]
*/
function attr_scale_new(scale_factor: number): Attribute;
/**
* Marks the range of the attribute as a single sentence.
*
* Note that this may require adjustments to word and
* sentence classification around the range.
* @returns the newly allocated `PangoAttribute`, which should be freed with [method@Pango.Attribute.destroy]
*/
function attr_sentence_new(): Attribute;
/**
* Create a new shape attribute.
*
* A shape is used to impose a particular ink and logical
* rectangle on the result of shaping a particular glyph.
* This might be used, for instance, for embedding a picture
* or a widget inside a `PangoLayout`.
* @param ink_rect ink rectangle to assign to each character
* @param logical_rect logical rectangle to assign to each character
* @returns the newly allocated `PangoAttribute`, which should be freed with [method@Pango.Attribute.destroy]
*/
function attr_shape_new(
ink_rect: Rectangle,
logical_rect: Rectangle
): Attribute;
/**
* Creates a new shape attribute.
*
* Like [func`Pango`.AttrShape.new], but a user data pointer
* is also provided; this pointer can be accessed when later
* rendering the glyph.
* @param ink_rect ink rectangle to assign to each character
* @param logical_rect logical rectangle to assign to each character
* @param data user data pointer
* @param copy_func function to copy `data` when the attribute is copied. If %NULL, `data` is simply copied as a pointer
* @returns the newly allocated `PangoAttribute`, which should be freed with [method@Pango.Attribute.destroy]
*/
function attr_shape_new_with_data(
ink_rect: Rectangle,
logical_rect: Rectangle,
data: any | null,
copy_func: AttrDataCopyFunc | null
): Attribute;
/**
* Create a new attribute that influences how invisible
* characters are rendered.
* @param flags `PangoShowFlags` to apply
* @returns the newly allocated `PangoAttribute`, which should be freed with [method@Pango.Attribute.destroy]
*/
function attr_show_new(flags: ShowFlags): Attribute;
/**
* Create a new font-size attribute in fractional points.
* @param size the font size, in %PANGO_SCALE-ths of a point
* @returns the newly allocated `PangoAttribute`, which should be freed with [method@Pango.Attribute.destroy]
*/
function attr_size_new(size: number): Attribute;
/**
* Create a new font-size attribute in device units.
* @param size the font size, in %PANGO_SCALE-ths of a device unit
* @returns the newly allocated `PangoAttribute`, which should be freed with [method@Pango.Attribute.destroy]
*/
function attr_size_new_absolute(size: number): Attribute;
/**
* Create a new font stretch attribute.
* @param stretch the stretch
* @returns the newly allocated `PangoAttribute`, which should be freed with [method@Pango.Attribute.destroy]
*/
function attr_stretch_new(stretch: Stretch): Attribute;
/**
* Create a new strikethrough color attribute.
*
* This attribute modifies the color of strikethrough lines.
* If not set, strikethrough lines will use the foreground color.
* @param red the red value (ranging from 0 to 65535)
* @param green the green value
* @param blue the blue value
* @returns the newly allocated `PangoAttribute`, which should be freed with [method@Pango.Attribute.destroy]
*/
function attr_strikethrough_color_new(
red: number,
green: number,
blue: number
): Attribute;
/**
* Create a new strike-through attribute.
* @param strikethrough %TRUE if the text should be struck-through
* @returns the newly allocated `PangoAttribute`, which should be freed with [method@Pango.Attribute.destroy]
*/
function attr_strikethrough_new(strikethrough: boolean): Attribute;
/**
* Create a new font slant style attribute.
* @param style the slant style
* @returns the newly allocated `PangoAttribute`, which should be freed with [method@Pango.Attribute.destroy]
*/
function attr_style_new(style: Style): Attribute;
/**
* Create a new attribute that influences how characters
* are transformed during shaping.
* @param transform `PangoTextTransform` to apply
* @returns the newly allocated `PangoAttribute`, which should be freed with [method@Pango.Attribute.destroy]
*/
function attr_text_transform_new(transform: TextTransform): Attribute;
/**
* Fetches the attribute type name.
*
* The attribute type name is the string passed in
* when registering the type using
* [func`Pango`.AttrType.register].
*
* The returned value is an interned string (see
* g_intern_string() for what that means) that should
* not be modified or freed.
* @param type an attribute type ID to fetch the name for
* @returns the type ID name (which may be %NULL), or %NULL if @type is a built-in Pango attribute type or invalid.
*/
function attr_type_get_name(type: AttrType): string | null;
/**
* Allocate a new attribute type ID.
*
* The attribute type name can be accessed later
* by using [func`Pango`.AttrType.get_name].
* @param name an identifier for the type
* @returns the new type ID.
*/
function attr_type_register(name: string | null): AttrType;
/**
* Create a new underline color attribute.
*
* This attribute modifies the color of underlines.
* If not set, underlines will use the foreground color.
* @param red the red value (ranging from 0 to 65535)
* @param green the green value
* @param blue the blue value
* @returns the newly allocated `PangoAttribute`, which should be freed with [method@Pango.Attribute.destroy]
*/
function attr_underline_color_new(
red: number,
green: number,
blue: number
): Attribute;
/**
* Create a new underline-style attribute.
* @param underline the underline style
* @returns the newly allocated `PangoAttribute`, which should be freed with [method@Pango.Attribute.destroy]
*/
function attr_underline_new(underline: Underline): Attribute;
/**
* Create a new font variant attribute (normal or small caps).
* @param variant the variant
* @returns the newly allocated `PangoAttribute`, which should be freed with [method@Pango.Attribute.destroy].
*/
function attr_variant_new(variant: Variant): Attribute;
/**
* Create a new font weight attribute.
* @param weight the weight
* @returns the newly allocated `PangoAttribute`, which should be freed with [method@Pango.Attribute.destroy]
*/
function attr_weight_new(weight: Weight): Attribute;
/**
* Marks the range of the attribute as a single word.
*
* Note that this may require adjustments to word and
* sentence classification around the range.
* @returns the newly allocated `PangoAttribute`, which should be freed with [method@Pango.Attribute.destroy]
*/
function attr_word_new(): Attribute;
/**
* Determines the bidirectional type of a character.
*
* The bidirectional type is specified in the Unicode Character Database.
*
* A simplified version of this function is available as [func`unichar_direction]`.
* @param ch a Unicode character
* @returns the bidirectional character type, as used in the Unicode bidirectional algorithm.
*/
function bidi_type_for_unichar(ch: string): BidiType;
/**
* Determines possible line, word, and character breaks
* for a string of Unicode text with a single analysis.
*
* For most purposes you may want to use [func`Pango`.get_log_attrs].
* @param text the text to process. Must be valid UTF-8
* @param length length of `te