pango.c.types

C types for pango1 library

Types 85

aliasPangoGlyph = uint

A PangoGlyph represents a single glyph in the output form of a string.

aliasPangoGlyphUnit = int

The PangoGlyphUnit type is used to store dimensions within Pango.

Dimensions are stored in 1/PANGO_SCALE of a device unit. (A device unit might be a pixel for screen display, or a point on a printer.) PANGO_SCALE is currently 1024, and may change in the future (unlikely though), but you should not depend on its exact value.

The PANGO_PIXELS() macro can be used to convert from glyph units into device units with correct rounding.

A PangoLayoutRun represents a single run within a [pango.layout_line.LayoutLine].

It is simply an alternate name for [pango.glyph_item.GlyphItem]. See the [pango.glyph_item.GlyphItem] docs for details on the fields.

[pango.types.Alignment] describes how to align the lines of a [pango.layout.Layout] within the available space.

If the [pango.layout.Layout] is set to justify using [pango.layout.Layout.setJustify], this only affects partial lines.

See [pango.layout.Layout.setAutoDir] for how text direction affects the interpretation of [pango.types.Alignment] values.

Left = 0Put all available space on the right
Center = 1Center the line within the available space
Right = 2Put all available space on the left

The [pango.types.AttrType] 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.

Invalid = 0does not happen
Language = 1language ([pango.attr_language.AttrLanguage])
Family = 2font family name list ([pango.attr_string.AttrString])
Style = 3font slant style ([pango.attr_int.AttrInt])
Weight = 4font weight ([pango.attr_int.AttrInt])
Variant = 5font variant (normal or small caps) ([pango.attr_int.AttrInt])
Stretch = 6font stretch ([pango.attr_int.AttrInt])
Size = 7font size in points scaled by [pango.types.SCALE] ([pango.attr_int.AttrInt])
FontDesc = 8font description ([pango.attrfontdesc.AttrFontDesc])
Foreground = 9foreground color ([pango.attr_color.AttrColor])
Background = 10background color ([pango.attr_color.AttrColor])
Underline = 11whether the text has an underline ([pango.attr_int.AttrInt])
Strikethrough = 12whether the text is struck-through ([pango.attr_int.AttrInt])
Rise = 13baseline displacement ([pango.attr_int.AttrInt])
Shape = 14shape ([pango.attr_shape.AttrShape])
Scale = 15font size scale factor ([pango.attr_float.AttrFloat])
Fallback = 16whether fallback is enabled ([pango.attr_int.AttrInt])
LetterSpacing = 17letter spacing (`struct@PangoAttrInt`)
UnderlineColor = 18underline color ([pango.attr_color.AttrColor])
StrikethroughColor = 19strikethrough color ([pango.attr_color.AttrColor])
AbsoluteSize = 20font size in pixels scaled by [pango.types.SCALE] ([pango.attr_int.AttrInt])
Gravity = 21base text gravity ([pango.attr_int.AttrInt])
GravityHint = 22gravity hint ([pango.attr_int.AttrInt])
FontFeatures = 23OpenType font features ([pango.attrfontfeatures.AttrFontFeatures]). Since 1.38
ForegroundAlpha = 24foreground alpha ([pango.attr_int.AttrInt]). Since 1.38
BackgroundAlpha = 25background alpha ([pango.attr_int.AttrInt]). Since 1.38
AllowBreaks = 26whether breaks are allowed ([pango.attr_int.AttrInt]). Since 1.44
Show = 27how to render invisible characters ([pango.attr_int.AttrInt]). Since 1.44
InsertHyphens = 28whether to insert hyphens at intra-word line breaks ([pango.attr_int.AttrInt]). Since 1.44
Overline = 29whether the text has an overline ([pango.attr_int.AttrInt]). Since 1.46
OverlineColor = 30overline color ([pango.attr_color.AttrColor]). Since 1.46
LineHeight = 31line height factor ([pango.attr_float.AttrFloat]). Since: 1.50
AbsoluteLineHeight = 32line height ([pango.attr_int.AttrInt]). Since: 1.50
TextTransform = 33
Word = 34override segmentation to classify the range of the attribute as a single word ([pango.attr_int.AttrInt]). Since 1.50
Sentence = 35override segmentation to classify the range of the attribute as a single sentence ([pango.attr_int.AttrInt]). Since 1.50
BaselineShift = 36baseline displacement ([pango.attr_int.AttrInt]). Since 1.50
FontScale = 37font-relative size change ([pango.attr_int.AttrInt]). Since 1.50

An enumeration that affects baseline shifts between runs.

None = 0Leave the baseline unchanged
Superscript = 1Shift the baseline to the superscript position, relative to the previous run
Subscript = 2Shift the baseline to the subscript position, relative to the previous run

[pango.types.BidiType] represents the bidirectional character type of a Unicode character.

The values in this enumeration are specified by the

Unicode bidirectional algorithm.

Deprecated

Use fribidi for this information
L = 0Left-to-Right
Lre = 1Left-to-Right Embedding
Lro = 2Left-to-Right Override
R = 3Right-to-Left
Al = 4Right-to-Left Arabic
Rle = 5Right-to-Left Embedding
Rlo = 6Right-to-Left Override
Pdf = 7Pop Directional Format
En = 8European Number
Es = 9European Number Separator
Et = 10European Number Terminator
An = 11Arabic Number
Cs = 12Common Number Separator
Nsm = 13Nonspacing Mark
Bn = 14Boundary Neutral
B = 15Paragraph Separator
S = 16Segment Separator
Ws = 17Whitespace
On = 18Other Neutrals
Lri = 19Left-to-Right isolate. Since 1.48.6
Rli = 20Right-to-Left isolate. Since 1.48.6
Fsi = 21First strong isolate. Since 1.48.6
Pdi = 22Pop directional isolate. Since 1.48.6

[pango.types.CoverageLevel] is used to indicate how well a font can represent a particular Unicode character for a particular script.

Since 1.44, only [pango.types.CoverageLevel.None] and [pango.types.CoverageLevel.Exact] will be returned.

None = 0The character is not representable with the font.
Fallback = 1The 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 translitera...
Approximate = 2The character is represented as basically the correct graphical form, but with a stylistic variant inappropriate for the current script.
Exact = 3The character is represented as the correct graphical form.

[pango.types.Direction] represents a direction in the Unicode bidirectional algorithm.

Not every value in this enumeration makes sense for every usage of [pango.types.Direction]; for example, the return value of func@unichar_direction and func@find_base_dir cannot be [pango.types.Direction.WeakLtr] or [pango.types.Direction.WeakRtl], since every character is either neutral or has a strong direction; on the other hand [pango.types.Direction.Neutral] doesn't make sense to pass to func@itemize_with_base_dir.

The [pango.types.Direction.TtbLtr], [pango.types.Direction.TtbRtl] values come from an earlier interpretation of this enumeration as the writing direction of a block of text and are no longer used. See [pango.types.Gravity] for how vertical text is handled in Pango.

If you are interested in text direction, you should really use fribidi directly. [pango.types.Direction] is only retained because it is used in some public apis.

Ltr = 0A strong left-to-right direction
Rtl = 1A strong right-to-left direction
TtbLtr = 2Deprecated value; treated the same as [pango.types.Direction.Rtl].
TtbRtl = 3Deprecated value; treated the same as [pango.types.Direction.Ltr]
WeakLtr = 4A weak left-to-right direction
WeakRtl = 5A weak right-to-left direction
Neutral = 6No direction specified

[pango.types.EllipsizeMode] 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.

None = 0No ellipsization
Start = 1Omit characters at the start of the text
Middle = 2Omit characters in the middle of the text
End = 3Omit characters at the end of the text
enumPangoFontMask : uint

The bits in a [pango.types.FontMask] correspond to the set fields in a [pango.font_description.FontDescription].

Family = 1the font family is specified.
Style = 2the font style is specified.
Variant = 4the font variant is specified.
Weight = 8the font weight is specified.
Stretch = 16the font stretch is specified.
Size = 32the font size is specified.
Gravity = 64the font gravity is specified (Since: 1.16.)
Variations = 128OpenType font variations are specified (Since: 1.42)

An enumeration that affects font sizes for superscript and subscript positioning and for (emulated) Small Caps.

None = 0Leave the font size unchanged
Superscript = 1Change the font to a size suitable for superscripts
Subscript = 2Change the font to a size suitable for subscripts
SmallCaps = 3Change the font to a size suitable for Small Caps

[pango.types.Gravity] 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 [pango.matrix.Matrix], and then glyph orientation is controlled using [pango.types.Gravity].

Not every value in this enumeration makes sense for every usage of [pango.types.Gravity]; for example, [pango.types.Gravity.Auto] only can be passed to [pango.context.Context.setBaseGravity] and can only be returned by [pango.context.Context.getBaseGravity].

See also: [pango.types.GravityHint]

South = 0Glyphs stand upright (default) <img align="right" valign="center" src="m-south.png">
East = 1Glyphs are rotated 90 degrees counter-clockwise. <img align="right" valign="center" src="m-east.png">
North = 2Glyphs are upside-down. <img align="right" valign="cener" src="m-north.png">
West = 3Glyphs are rotated 90 degrees clockwise. <img align="right" valign="center" src="m-west.png">
Auto = 4Gravity is resolved from the context matrix

[pango.types.GravityHint] defines how horizontal scripts should behave in a vertical context.

That is, English excerpts in a vertical paragraph for example.

See also [pango.types.Gravity]

Natural = 0scripts will take their natural gravity based on the base gravity and the script. This is the default.
Strong = 1always use the base gravity set, regardless of the script.
Line = 2for 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 opposi...

Errors that can be returned by [pango.layout.Layout.deserialize].

Invalid = 0Unspecified error
InvalidValue = 1A JSon value could not be interpreted
MissingValue = 2A required JSon member was not found

Flags that influence the behavior of [pango.layout.Layout.deserialize].

New members may be added to this enumeration over time.

Default = 0Default behavior
Context = 1Apply context information from the serialization to the [pango.context.Context]

Flags that influence the behavior of [pango.layout.Layout.serialize].

New members may be added to this enumeration over time.

Default = 0Default behavior
Context = 1Include context information
Output = 2Include information about the formatted output

The [pango.types.Overline] enumeration is used to specify whether text should be overlined, and if so, the type of line.

None = 0no overline should be drawn
Single = 1Draw a single line above the ink extents of the text being underlined.

[pango.types.RenderPart] defines different items to render for such purposes as setting colors.

Foreground = 0the text itself
Background = 1the area behind the text
Underline = 2underlines
Strikethrough = 3strikethrough lines
Overline = 4overlines

The [pango.types.Script] enumeration identifies different writing systems.

The values correspond to the names as defined in the Unicode standard. See

Unicode Standard Annex 24: Script names

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 [glib.types.UnicodeScript] enumeration instead, whose values are interchangeable with [pango.types.Script].

InvalidCode = - 1a value never returned from [pango.global.scriptForUnichar]
Common = 0a character used by multiple different scripts
Inherited = 1a mark glyph that takes its script from the base glyph to which it is attached
Arabic = 2Arabic
Armenian = 3Armenian
Bengali = 4Bengali
Bopomofo = 5Bopomofo
Cherokee = 6Cherokee
Coptic = 7Coptic
Cyrillic = 8Cyrillic
Deseret = 9Deseret
Devanagari = 10Devanagari
Ethiopic = 11Ethiopic
Georgian = 12Georgian
Gothic = 13Gothic
Greek = 14Greek
Gujarati = 15Gujarati
Gurmukhi = 16Gurmukhi
Han = 17Han
Hangul = 18Hangul
Hebrew = 19Hebrew
Hiragana = 20Hiragana
Kannada = 21Kannada
Katakana = 22Katakana
Khmer = 23Khmer
Lao = 24Lao
Latin = 25Latin
Malayalam = 26Malayalam
Mongolian = 27Mongolian
Myanmar = 28Myanmar
Ogham = 29Ogham
OldItalic = 30Old Italic
Oriya = 31Oriya
Runic = 32Runic
Sinhala = 33Sinhala
Syriac = 34Syriac
Tamil = 35Tamil
Telugu = 36Telugu
Thaana = 37Thaana
Thai = 38Thai
Tibetan = 39Tibetan
CanadianAboriginal = 40Canadian Aboriginal
Yi = 41Yi
Tagalog = 42Tagalog
Hanunoo = 43Hanunoo
Buhid = 44Buhid
Tagbanwa = 45Tagbanwa
Braille = 46Braille
Cypriot = 47Cypriot
Limbu = 48Limbu
Osmanya = 49Osmanya
Shavian = 50Shavian
LinearB = 51Linear B
TaiLe = 52Tai Le
Ugaritic = 53Ugaritic
NewTaiLue = 54New Tai Lue. Since 1.10
Buginese = 55Buginese. Since 1.10
Glagolitic = 56Glagolitic. Since 1.10
Tifinagh = 57Tifinagh. Since 1.10
SylotiNagri = 58Syloti Nagri. Since 1.10
OldPersian = 59Old Persian. Since 1.10
Kharoshthi = 60Kharoshthi. Since 1.10
Unknown = 61an unassigned code point. Since 1.14
Balinese = 62Balinese. Since 1.14
Cuneiform = 63Cuneiform. Since 1.14
Phoenician = 64Phoenician. Since 1.14
PhagsPa = 65Phags-pa. Since 1.14
Nko = 66N'Ko. Since 1.14
KayahLi = 67Kayah Li. Since 1.20.1
Lepcha = 68Lepcha. Since 1.20.1
Rejang = 69Rejang. Since 1.20.1
Sundanese = 70Sundanese. Since 1.20.1
Saurashtra = 71Saurashtra. Since 1.20.1
Cham = 72Cham. Since 1.20.1
OlChiki = 73Ol Chiki. Since 1.20.1
Vai = 74Vai. Since 1.20.1
Carian = 75Carian. Since 1.20.1
Lycian = 76Lycian. Since 1.20.1
Lydian = 77Lydian. Since 1.20.1
Batak = 78Batak. Since 1.32
Brahmi = 79Brahmi. Since 1.32
Mandaic = 80Mandaic. Since 1.32
Chakma = 81Chakma. Since: 1.32
MeroiticCursive = 82Meroitic Cursive. Since: 1.32
MeroiticHieroglyphs = 83Meroitic Hieroglyphs. Since: 1.32
Miao = 84Miao. Since: 1.32
Sharada = 85Sharada. Since: 1.32
SoraSompeng = 86Sora Sompeng. Since: 1.32
Takri = 87Takri. Since: 1.32
BassaVah = 88Bassa. Since: 1.40
CaucasianAlbanian = 89Caucasian Albanian. Since: 1.40
Duployan = 90Duployan. Since: 1.40
Elbasan = 91Elbasan. Since: 1.40
Grantha = 92Grantha. Since: 1.40
Khojki = 93Kjohki. Since: 1.40
Khudawadi = 94Khudawadi, Sindhi. Since: 1.40
LinearA = 95Linear A. Since: 1.40
Mahajani = 96Mahajani. Since: 1.40
Manichaean = 97Manichaean. Since: 1.40
MendeKikakui = 98Mende Kikakui. Since: 1.40
Modi = 99Modi. Since: 1.40
Mro = 100Mro. Since: 1.40
Nabataean = 101Nabataean. Since: 1.40
OldNorthArabian = 102Old North Arabian. Since: 1.40
OldPermic = 103Old Permic. Since: 1.40
PahawhHmong = 104Pahawh Hmong. Since: 1.40
Palmyrene = 105Palmyrene. Since: 1.40
PauCinHau = 106Pau Cin Hau. Since: 1.40
PsalterPahlavi = 107Psalter Pahlavi. Since: 1.40
Siddham = 108Siddham. Since: 1.40
Tirhuta = 109Tirhuta. Since: 1.40
WarangCiti = 110Warang Citi. Since: 1.40
Ahom = 111Ahom. Since: 1.40
AnatolianHieroglyphs = 112Anatolian Hieroglyphs. Since: 1.40
Hatran = 113Hatran. Since: 1.40
Multani = 114Multani. Since: 1.40
OldHungarian = 115Old Hungarian. Since: 1.40
Signwriting = 116Signwriting. Since: 1.40
enumPangoShapeFlags : uint

Flags influencing the shaping process.

[pango.types.ShapeFlags] can be passed to func@Pango.shape_with_flags.

None = 0Default value
RoundPositions = 1Round glyph positions and widths to whole device units This option should be set if the target renderer can't do subpixel positioning of glyphs
enumPangoShowFlags : uint

These flags affect how Pango treats characters that are normally not visible in the output.

None = 0No special treatment for invisible characters
Spaces = 1Render spaces, tabs and newlines visibly
LineBreaks = 2Render line breaks visibly
Ignorables = 4Render default-ignorable Unicode characters visibly

An enumeration specifying the width of the font relative to other designs within a family.

UltraCondensed = 0ultra condensed width
ExtraCondensed = 1extra condensed width
Condensed = 2condensed width
SemiCondensed = 3semi condensed width
Normal = 4the normal width
SemiExpanded = 5semi expanded width
Expanded = 6expanded width
ExtraExpanded = 7extra expanded width
UltraExpanded = 8ultra expanded width

An enumeration specifying the various slant styles possible for a font.

Normal = 0the font is upright.
Oblique = 1the font is slanted, but in a roman style.
Italic = 2the font is slanted in an italic style.

[pango.types.TabAlign] specifies where the text appears relative to the tab stop position.

Left = 0the text appears to the right of the tab stop position
Right = 1the text appears to the left of the tab stop position until the available space is filled. Since: 1.50
Center = 2the text is centered at the tab stop position until the available space is filled. Since: 1.50
Decimal = 3text 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

An enumeration that affects how Pango treats characters during shaping.

None = 0Leave text unchanged
Lowercase = 1Display letters and numbers as lowercase
Uppercase = 2Display letters and numbers as uppercase
Capitalize = 3Display the first character of a word in titlecase

The [pango.types.Underline] enumeration is used to specify whether text should be underlined, and if so, the type of underlining.

None = 0no underline should be drawn
Single = 1a single underline should be drawn
Double = 2a double underline should be drawn
Low = 3a 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....
Error = 4an underline indicating an error should be drawn below. The exact style of rendering is up to the [pango.renderer.Renderer] in use, but typical styles include wavy or dotted lines. This underline i...
SingleLine = 5Like @PANGOUNDERLINESINGLE, but drawn continuously across multiple runs. This type of underlining is available since Pango 1.46.
DoubleLine = 6Like @PANGOUNDERLINEDOUBLE, but drawn continuously across multiple runs. This type of underlining is available since Pango 1.46.
ErrorLine = 7Like @PANGOUNDERLINEERROR, but drawn continuously across multiple runs. This type of underlining is available since Pango 1.46.

An enumeration specifying capitalization variant of the font.

Normal = 0A normal font.
SmallCaps = 1A font with the lower case characters replaced by smaller variants of the capital characters.
AllSmallCaps = 2A font with all characters replaced by smaller variants of the capital characters. Since: 1.50
PetiteCaps = 3A 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
AllPetiteCaps = 4A font with all characters replaced by smaller variants of the capital characters. Petite Caps can be even smaller than Small Caps. Since: 1.50
Unicase = 5A font with the upper case characters replaced by smaller variants of the capital letters. Since: 1.50
TitleCaps = 6A font with capital letters that are more suitable for all-uppercase titles. Since: 1.50

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.

Thin = 100the thin weight (= 100) Since: 1.24
Ultralight = 200the ultralight weight (= 200)
Light = 300the light weight (= 300)
Semilight = 350the semilight weight (= 350) Since: 1.36.7
Book = 380the book weight (= 380) Since: 1.24)
Normal = 400the default weight (= 400)
Medium = 500the medium weight (= 500) Since: 1.24
Semibold = 600the semibold weight (= 600)
Bold = 700the bold weight (= 700)
Ultrabold = 800the ultrabold weight (= 800)
Heavy = 900the heavy weight (= 900)
Ultraheavy = 1000the ultraheavy weight (= 1000) Since: 1.24

[pango.types.WrapMode] describes how to wrap the lines of a [pango.layout.Layout] 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.

Word = 0wrap lines at word boundaries.
Char = 1wrap lines at character boundaries.
WordChar = 2wrap lines at word boundaries, but fall back to character boundaries if there is not enough space for a full word.

The [pango.analysis.Analysis] structure stores information about the properties of a segment of text.

Fields
void * shapeEngineunused, reserved
void * langEngineunused, reserved
PangoFont * fontthe font for this segment.
ubyte levelthe bidirectional level for this segment.
ubyte gravitythe glyph orientation for this segment (A [pango.types.Gravity]).
ubyte flagsboolean flags for this segment (Since: 1.16).
ubyte scriptthe detected script for this segment (A [pango.types.Script]) (Since: 1.18).
PangoLanguage * languagethe detected language for this segment.
GSList * extraAttrsextra attributes for this segment.

The [pango.types.AttrClass] structure stores the type and operations for a particular type of attribute.

The functions in this structure should not be called directly. Instead, one should use the wrapper functions provided for [pango.attribute.Attribute].

Fields
PangoAttrType typethe type ID for this attribute
PangoAttribute * function(const(PangoAttribute) * attr) copy
void function(PangoAttribute * attr) destroy
gboolean function(const(PangoAttribute) * attr1, const(PangoAttribute) * attr2) equal

The [pango.attr_color.AttrColor] structure is used to represent attributes that are colors.

Fields
PangoAttribute attrthe common portion of the attribute
PangoColor colorthe [pango.color.Color] which is the value of the attribute

The [pango.attr_float.AttrFloat] structure is used to represent attributes with a float or double value.

Fields
PangoAttribute attrthe common portion of the attribute
double valuethe value of the attribute

The [pango.attr_font_desc.AttrFontDesc] structure is used to store an attribute that sets all aspects of the font description at once.

Fields
PangoAttribute attrthe common portion of the attribute
PangoFontDescription * descthe font description which is the value of this attribute

The [pango.attr_font_features.AttrFontFeatures] structure is used to represent OpenType font features as an attribute.

Fields
PangoAttribute attrthe common portion of the attribute
char * featuresthe features, as a string in CSS syntax

The [pango.attr_int.AttrInt] structure is used to represent attributes with an integer or enumeration value.

Fields
PangoAttribute attrthe common portion of the attribute
int valuethe value of the attribute

A [pango.attr_iterator.AttrIterator] is used to iterate through a [pango.attr_list.AttrList].

A new iterator is created with [pango.attr_list.AttrList.getIterator]. Once the iterator is created, it can be advanced through the style changes in the text using [pango.attr_iterator.AttrIterator.next]. At each style change, the range of the current style segment and the attributes currently in effect can be queried.

The [pango.attr_language.AttrLanguage] structure is used to represent attributes that are languages.

Fields
PangoAttribute attrthe common portion of the attribute
PangoLanguage * valuethe [pango.language.Language] which is the value of the attribute

A [pango.attr_list.AttrList] represents a list of attributes that apply to a section of text.

The attributes in a [pango.attr_list.AttrList] are, in general, allowed to overlap in an arbitrary fashion. However, if the attributes are manipulated only through [pango.attr_list.AttrList.change], the overlap between properties will meet stricter criteria.

Since the [pango.attr_list.AttrList] structure is stored as a linear list, it is not suitable for storing attributes for large amounts of text. In general, you should not use a single [pango.attr_list.AttrList] for more than one paragraph of text.

The [pango.attr_shape.AttrShape] structure is used to represent attributes which impose shape restrictions.

Fields
PangoAttribute attrthe common portion of the attribute
PangoRectangle inkRectthe ink rectangle to restrict to
PangoRectangle logicalRectthe logical rectangle to restrict to
void * datauser data set (see [pango.attr_shape.AttrShape.newWithData])
PangoAttrDataCopyFunc copyFunccopy function for the user data
GDestroyNotify destroyFuncdestroy function for the user data

The [pango.attr_size.AttrSize] structure is used to represent attributes which set font size.

Fields
PangoAttribute attrthe common portion of the attribute
int sizesize of font, in units of 1/[pango.types.SCALE] of a point (for [pango.types.AttrType.Size]) or of a device unit (for [pango.types.AttrType.AbsoluteSize])
uint absolutewhether the font size is in device units or points. This field is only present for compatibility with Pango-1.8.0 ([pango.types.AttrType.AbsoluteSize] was added in 1.8.1); and always will be false ...

The [pango.attr_string.AttrString] structure is used to represent attributes with a string value.

Fields
PangoAttribute attrthe common portion of the attribute
char * valuethe string which is the value of the attribute

The [pango.attribute.Attribute] structure represents the common portions of all attributes.

Particular types of attributes include this structure as their initial portion. The common portion of the attribute holds the range to which the value in the type-specific part of the attribute applies and should be initialized using [pango.attribute.Attribute.init_]. By default, an attribute will have an all-inclusive range of [0,G_MAXUINT].

Fields
const(PangoAttrClass) * klassthe class structure holding information about the type of the attribute
uint startIndexthe start index of the range (in bytes).
uint endIndexend index of the range (in bytes). The character at this index is not included in the range.

The [pango.color.Color] structure is used to represent a color in an uncalibrated RGB color-space.

Fields
ushort redvalue of red component
ushort greenvalue of green component
ushort bluevalue of blue component

A [pango.context.Context] stores global information used to control the itemization process.

The information stored by [pango.context.Context] includes the fontmap used to look up fonts, and default values such as the default language, default gravity, or default font.

To obtain a [pango.context.Context], use [pango.font_map.FontMap.createContext].

A [pango.coverage.Coverage] structure is a map from Unicode characters to [pango.types.CoverageLevel] values.

It is often necessary in Pango to determine if a particular font can represent a particular character, and also how well it can represent that character. The [pango.coverage.Coverage] is a data structure that is used to represent that information. It is an opaque structure with no public fields.

structPangoFont

A [pango.font.Font] is used to represent a font in a rendering-system-independent manner.

Fields
GObject parentInstance
Fields
GObjectClass parentClass
PangoFontDescription * function(PangoFont * font) describe
PangoCoverage * function(PangoFont * font, PangoLanguage * language) getCoverage
void function(PangoFont * font, PangoGlyph glyph, PangoRectangle * inkRect, PangoRectangle * logicalRect) getGlyphExtents
PangoFontMetrics * function(PangoFont * font, PangoLanguage * language) getMetrics
PangoFontMap * function(PangoFont * font) getFontMap
PangoFontDescription * function(PangoFont * font) describeAbsolute
void function(PangoFont * font, hb_feature_t * features, uint len, uint * numFeatures) getFeatures
hb_font_t * function(PangoFont * font) createHbFont

A [pango.font_description.FontDescription] describes a font in an implementation-independent manner.

[pango.font_description.FontDescription] structures are used both to list what fonts are available on the system and also for specifying the characteristics of a font to load.

A [pango.font_face.FontFace] is used to represent a group of fonts with the same family, slant, weight, and width, but varying sizes.

Fields
GObject parentInstance
Fields
GObjectClass parentClass
const(char) * function(PangoFontFace * face) getFaceName
PangoFontDescription * function(PangoFontFace * face) describe
void function(PangoFontFace * face, int * * sizes, int * nSizes) listSizes
gboolean function(PangoFontFace * face) isSynthesized
PangoFontFamily * function(PangoFontFace * face) getFamily
void function() PangoReserved3
void function() PangoReserved4

A [pango.font_family.FontFamily] is used to represent a family of related font faces.

The font faces in a family share a common design, but differ in slant, weight, width or other aspects.

Fields
GObject parentInstance
Fields
GObjectClass parentClass
void function(PangoFontFamily * family, PangoFontFace * * * faces, int * nFaces) listFaces
const(char) * function(PangoFontFamily * family) getName
gboolean function(PangoFontFamily * family) isMonospace
gboolean function(PangoFontFamily * family) isVariable
PangoFontFace * function(PangoFontFamily * family, const(char) * name) getFace
void function() PangoReserved2

A [pango.font_map.FontMap] 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
GObject parentInstance

The [pango.font_map_class.FontMapClass] structure holds the virtual functions for a particular [pango.font_map.FontMap] implementation.

Fields
GObjectClass parentClassparent [gstpbutils.types.ObjectClass]
PangoFont * function(PangoFontMap * fontmap, PangoContext * context, const(PangoFontDescription) * desc) loadFont
void function(PangoFontMap * fontmap, PangoFontFamily * * * families, int * nFamilies) listFamilies
PangoFontset * function(PangoFontMap * fontmap, PangoContext * context, const(PangoFontDescription) * desc, PangoLanguage * language) loadFontset
const(char) * shapeEngineTypethe type of rendering-system-dependent engines that can handle fonts of this fonts loaded with this fontmap.
uint function(PangoFontMap * fontmap) getSerial
void function(PangoFontMap * fontmap) changed
PangoFontFamily * function(PangoFontMap * fontmap, const(char) * name) getFamily
PangoFontFace * function(PangoFontMap * fontmap, PangoFont * font) getFace

A [pango.font_metrics.FontMetrics] structure holds the overall metric information for a font.

The information in a [pango.font_metrics.FontMetrics] structure may be restricted to a script. The fields of this structure are private to implementations of a font backend. See the documentation of the corresponding getters for documentation of their meaning.

For an overview of the most important metrics, see:

Font metrics
Fields
uint refCount
int ascent
int descent
int height
int approximateCharWidth
int approximateDigitWidth
int underlinePosition
int underlineThickness
int strikethroughPosition
int strikethroughThickness

A [pango.fontset.Fontset] represents a set of [pango.font.Font] to use when rendering text.

A [pango.fontset.Fontset] is the result of resolving a [pango.font_description.FontDescription] against a particular [pango.context.Context]. It has operations for finding the component font for a particular Unicode character, and for finding a composite set of metrics for the entire fontset.

Fields
GObject parentInstance

The [pango.fontset_class.FontsetClass] structure holds the virtual functions for a particular [pango.fontset.Fontset] implementation.

Fields
GObjectClass parentClassparent [gstpbutils.types.ObjectClass]
PangoFont * function(PangoFontset * fontset, uint wc) getFont
PangoFontMetrics * function(PangoFontset * fontset) getMetrics
PangoLanguage * function(PangoFontset * fontset) getLanguage
void function(PangoFontset * fontset, PangoFontsetForeachFunc func, void * data) foreach_
void function() PangoReserved1
void function() PangoReserved2
void function() PangoReserved3
void function() PangoReserved4

[pango.fontset_simple.FontsetSimple] is a implementation of the abstract [pango.fontset.Fontset] base class as an array of fonts.

When creating a [pango.fontset_simple.FontsetSimple], you have to provide the array of fonts that make up the fontset.

The [pango.types.GlyphGeometry] structure contains width and positioning information for a single glyph.

Note that @width is not guaranteed to be the same as the glyph extents. Kerning and other positioning applied during shaping will affect both the @width and the @x_offset for the glyphs in the glyph string that results from shaping.

The information in this struct is intended for rendering the glyphs, as follows:

  1. Assume the current point is (x, y)
  2. Render the current glyph at (x + x_offset, y + y_offset),
  3. Advance the current point to (x + width, y)
  4. Render the next glyph
Fields
PangoGlyphUnit widththe logical width to use for the the character.
PangoGlyphUnit xOffsethorizontal offset from nominal character position.
PangoGlyphUnit yOffsetvertical offset from nominal character position.

A [pango.glyph_info.GlyphInfo] structure represents a single glyph with positioning information and visual attributes.

Fields
PangoGlyph glyphthe glyph itself.
PangoGlyphGeometry geometrythe positional information about the glyph.
PangoGlyphVisAttr attrthe visual attributes of the glyph.

A [pango.glyph_item.GlyphItem] is a pair of a [pango.item.Item] and the glyphs resulting from shaping the items text.

As an example of the usage of [pango.glyph_item.GlyphItem], the results of shaping text with [pango.layout.Layout] is a list of [pango.layout_line.LayoutLine], each of which contains a list of [pango.glyph_item.GlyphItem].

Fields
PangoItem * itemcorresponding [pango.item.Item]
PangoGlyphString * glyphscorresponding [pango.glyph_string.GlyphString]
int yOffsetshift of the baseline, relative to the baseline of the containing line. Positive values shift upwards
int startXOffsethorizontal displacement to apply before the glyph item. Positive values shift right
int endXOffsethorizontal displacement to apply after th glyph item. Positive values shift right

A [pango.glyph_item_iter.GlyphItemIter] is an iterator over the clusters in a [pango.glyph_item.GlyphItem].

The forward direction of the iterator is the logical direction of text. That is, with increasing @start_index and @start_char values. If @glyph_item is right-to-left (that is, if glyph_item->item->analysis.level is odd), then @start_glyph decreases as the iterator moves forward. Moreover, in right-to-left cases, @start_glyph is greater than @end_glyph.

An iterator should be initialized using either [pango.glyph_item_iter.GlyphItemIter.initStart] or [pango.glyph_item_iter.GlyphItemIter.initEnd], for forward and backward iteration respectively, and walked over using any desired mixture of [pango.glyph_item_iter.GlyphItemIter.nextCluster] and [pango.glyph_item_iter.GlyphItemIter.prevCluster].

A common idiom for doing a forward iteration over the clusters is:

PangoGlyphItemIter cluster_iter;
gboolean have_cluster;

for (have_cluster = pango_glyph_item_iter_init_start (&cluster_iter,
                                                     glyph_item, text);
    have_cluster;
    have_cluster = pango_glyph_item_iter_next_cluster (&cluster_iter))
{
 ...
}

Note that @text is the start of the text for layout, which is then indexed by glyph_item->item->offset to get to the text of @glyph_item. The @start_index and @end_index values can directly index into @text. The @start_glyph, @end_glyph, @start_char, and @end_char values however are zero-based for the @glyph_item. For each cluster, the item pointed at by the start variables is included in the cluster while the one pointed at by end variables is not.

None of the members of a [pango.glyph_item_iter.GlyphItemIter] should be modified manually.

Fields
PangoGlyphItem * glyphItem
const(char) * text
int startGlyph
int startIndex
int startChar
int endGlyph
int endIndex
int endChar

A [pango.glyph_string.GlyphString] is used to store strings of glyphs with geometry and visual attribute information.

The storage for the glyph information is owned by the structure which simplifies memory management.

Fields
int numGlyphsnumber of glyphs in this glyph string
PangoGlyphInfo * glyphsarray of glyph information
int * logClusterslogical cluster info, indexed by the byte index within the text corresponding to the glyph string
int space

A [pango.types.GlyphVisAttr] structure communicates information between the shaping and rendering phases.

Currently, it contains cluster start and color information. More attributes may be added in the future.

Clusters are stored in visual order, within the cluster, glyphs are always ordered in logical order, since visual order is meaningless; that is, in Arabic text, accent glyphs follow the glyphs for the base character.

Fields
uint isClusterStartset for the first logical glyph in each cluster.
uint isColorset if the the font will render this glyph with color. Since 1.50
structPangoItem

The [pango.item.Item] structure stores information about a segment of text.

You typically obtain PangoItems by itemizing a piece of text with func@itemize.

Fields
int offsetbyte offset of the start of this item in text.
int lengthlength of this item in bytes.
int numCharsnumber of Unicode characters in the item.
PangoAnalysis analysisanalysis results for the item.

The [pango.language.Language] structure is used to represent a language.

[pango.language.Language] pointers can be efficiently copied and compared with each other.

A [pango.layout.Layout] structure represents an entire paragraph of text.

While complete access to the layout capabilities of Pango is provided using the detailed interfaces for itemization and shaping, using that functionality directly involves writing a fairly large amount of code. [pango.layout.Layout] provides a high-level driver for formatting entire paragraphs of text at once. This includes paragraph-level functionality such as line breaking, justification, alignment and ellipsization.

A [pango.layout.Layout] is initialized with a [pango.context.Context], UTF-8 string and set of attributes for that string. Once that is done, the set of formatted lines can be extracted from the object, the layout can be rendered, and conversion between logical character positions within the layout's text, and the physical position of the resulting glyphs can be made.

There are a number of parameters to adjust the formatting of a [pango.layout.Layout]. The following image shows adjustable parameters (on the left) and font metrics (on the right):

Pango Layout Parameters

The following images demonstrate the effect of alignment and justification on the layout of text:

!align=left!align=left, justify
!align=center!align=center, justify
!align=right!align=right, justify

It is possible, as well, to ignore the 2-D setup, and simply treat the results of a [pango.layout.Layout] as a list of lines.

A [pango.layout_iter.LayoutIter] can be used to iterate over the visual extents of a [pango.layout.Layout].

To obtain a [pango.layout_iter.LayoutIter], use [pango.layout.Layout.getIter].

The [pango.layout_iter.LayoutIter] structure is opaque, and has no user-visible fields.

A [pango.layout_line.LayoutLine] represents one of the lines resulting from laying out a paragraph via [pango.layout.Layout].

[pango.layout_line.LayoutLine] structures are obtained by calling [pango.layout.Layout.getLine] and are only valid until the text, attributes, or settings of the parent [pango.layout.Layout] are modified.

Fields
PangoLayout * layoutthe layout this line belongs to, might be null
int startIndexstart of line as byte index into layout->text
int lengthlength of line in bytes
GSList * runslist of runs in the line, from left to right
uint isParagraphStart#TRUE if this is the first line of the paragraph
uint resolvedDir#Resolved PangoDirection of line

The [pango.types.LogAttr] structure stores information about the attributes of a single character.

Fields
uint isLineBreakif set, can break line in front of character
uint isMandatoryBreakif set, must break line in front of character
uint isCharBreakif set, can break here when doing character wrapping
uint isWhiteis whitespace character
uint isCursorPositionif set, cursor can appear in front of character. i.e. this is a grapheme boundary, or the first character in the text. This flag implements Unicode's [Grapheme Cluster Boundaries](http://www.unicod...
uint isWordStartis first character in a word
uint isWordEndis first non-word char after a word Note that in degenerate cases, you could have both @iswordstart and @iswordend set for some character.
uint isSentenceBoundaryis a sentence boundary. There are two ways to divide sentences. The first assigns all inter-sentence whitespace/control/format chars to some sentence, so all chars are in some sentence; @issentence...
uint isSentenceStartis first character in a sentence
uint isSentenceEndis first char after a sentence. Note that in degenerate cases, you could have both @issentencestart and @issentenceend set for some character. (e.g. no space after a period, so the next sentence st...
uint backspaceDeletesCharacterif set, backspace deletes one character rather than the entire grapheme cluster. This field is only meaningful on grapheme boundaries (where @iscursorposition is set). In some languages, the full g...
uint isExpandableSpaceis a whitespace character that can possibly be expanded for justification purposes. (Since: 1.18)
uint isWordBoundaryis a word boundary, as defined by UAX#29. More specifically, means that this is not a position in the middle of a word. For example, both sides of a punctuation mark are considered word boundaries....
uint breakInsertsHyphenwhen breaking lines before this char, insert a hyphen. Since: 1.50
uint breakRemovesPrecedingwhen breaking lines before this char, remove the preceding char. Since 1.50
uint reserved

A [pango.matrix.Matrix] specifies a transformation between user-space and device coordinates.

The transformation is given by

x_device = x_user * matrix->xx + y_user * matrix->xy + matrix->x0;
y_device = x_user * matrix->yx + y_user * matrix->yy + matrix->y0;

Fields
double xx1st component of the transformation matrix
double xy2nd component of the transformation matrix
double yx3rd component of the transformation matrix
double yy4th component of the transformation matrix
double x0x translation
double y0y translation

The [pango.types.Rectangle] structure represents a rectangle.

[pango.types.Rectangle] is frequently used to represent the logical or ink extents of a single glyph or section of text. (See, for instance, [pango.font.Font.getGlyphExtents].)

Fields
int xX coordinate of the left side of the rectangle.
int yY coordinate of the the top side of the rectangle.
int widthwidth of the rectangle.
int heightheight of the rectangle.

[pango.renderer.Renderer] is a base class for objects that can render text provided as [pango.glyph_string.GlyphString] or [pango.layout.Layout].

By subclassing [pango.renderer.Renderer] and overriding operations such as @draw_glyphs and @draw_rectangle, renderers for particular font backends and destinations can be created.

Fields
GObject parentInstance
PangoUnderline underline
gboolean strikethrough
int activeCount
PangoMatrix * matrixthe current transformation matrix for the Renderer; may be null, which should be treated the same as the identity matrix.

Class structure for [pango.renderer.Renderer].

The following vfuncs take user space coordinates in Pango units and have default implementations:

  • draw_glyphs
  • draw_rectangle
  • draw_error_underline
  • draw_shape
  • draw_glyph_item

The default draw_shape implementation draws nothing.

The following vfuncs take device space coordinates as doubles and must be implemented:

  • draw_trapezoid
  • draw_glyph
Fields
GObjectClass parentClass
void function(PangoRenderer * renderer, PangoFont * font, PangoGlyphString * glyphs, int x, int y) drawGlyphs
void function(PangoRenderer * renderer, PangoRenderPart part, int x, int y, int width, int height) drawRectangle
void function(PangoRenderer * renderer, int x, int y, int width, int height) drawErrorUnderline
void function(PangoRenderer * renderer, PangoAttrShape * attr, int x, int y) drawShape
void function(PangoRenderer * renderer, PangoRenderPart part, double y1, double x11, double x21, double y2, double x12, double x22) drawTrapezoid
void function(PangoRenderer * renderer, PangoFont * font, PangoGlyph glyph, double x, double y) drawGlyph
void function(PangoRenderer * renderer, PangoRenderPart part) partChanged
void function(PangoRenderer * renderer) begin
void function(PangoRenderer * renderer) end
void function(PangoRenderer * renderer, PangoLayoutRun * run) prepareRun
void function(PangoRenderer * renderer, const(char) * text, PangoGlyphItem * glyphItem, int x, int y) drawGlyphItem
void function() PangoReserved2
void function() PangoReserved3
void function() PangoReserved4

A [pango.script_iter.ScriptIter] is used to iterate through a string and identify ranges in different scripts.

A [pango.tab_array.TabArray] contains an array of tab stops.

[pango.tab_array.TabArray] can be used to set tab stops in a [pango.layout.Layout]. Each tab stop has an alignment, a position, and optionally a character to use as decimal point.

aliasPangoAttrDataCopyFunc = void * function(const(void) * userData)
aliasPangoAttrFilterFunc = gboolean function(PangoAttribute * attribute, void * userData)
aliasPangoFontsetForeachFunc = gboolean function(PangoFontset * fontset, PangoFont * font, void * userData)