pango-Text-Attributes: Text Attributes

Description Methods and Functions Detailed Description Structures Enums and Flags User Functions Author(s) References

Description

Font and other attributes for annotating text

Methods and Functions

pangoParseMarkup(markup.text, accel.marker, .errwarn = TRUE)
pangoAttrTypeRegister(name)
pangoAttrTypeGetName(type)
pangoAttributeInit(attr, klass)
pangoAttributeCopy(object)
pangoAttributeEqual(object, attr2)
pangoAttrLanguageNew(language)
pangoAttrFamilyNew(family)
pangoAttrStyleNew(style)
pangoAttrVariantNew(variant)
pangoAttrStretchNew(stretch)
pangoAttrWeightNew(weight)
pangoAttrSizeNew(size)
pangoAttrSizeNewAbsolute(size)
pangoAttrFontDescNew(desc)
pangoAttrForegroundNew(red, green, blue)
pangoAttrBackgroundNew(red, green, blue)
pangoAttrStrikethroughNew(strikethrough)
pangoAttrStrikethroughColorNew(red, green, blue)
pangoAttrUnderlineNew(underline)
pangoAttrUnderlineColorNew(red, green, blue)
pangoAttrShapeNew(ink.rect, logical.rect)
pangoAttrShapeNewWithData(ink.rect, logical.rect, data)
pangoAttrScaleNew(scale.factor)
pangoAttrRiseNew(rise)
pangoAttrLetterSpacingNew(letter.spacing)
pangoAttrFallbackNew(fallback)
pangoAttrGravityNew(gravity)
pangoAttrGravityHintNew(hint)
pangoColorParse(spec)
pangoColorCopy(object)
pangoColorFree(object)
pangoColorToString(object)
pangoAttrListNew()
pangoAttrListCopy(object)
pangoAttrListInsert(object, attr)
pangoAttrListInsertBefore(object, attr)
pangoAttrListChange(object, attr)
pangoAttrListSplice(object, other, pos, len)
pangoAttrListFilter(object, func, data)
pangoAttrListGetIterator(object)
pangoAttrIteratorCopy(object)
pangoAttrIteratorNext(object)
pangoAttrIteratorRange(object)
pangoAttrIteratorGet(object, type)
pangoAttrIteratorGetFont(object)
pangoAttrIteratorGetAttrs(object)

Detailed Description

Attributed text is used in a number of places in Pango. It is used as the input to the itemization process and also when creating a PangoLayout. The data types and functions in this section are used to represent and manipulate sets of attributes applied to a portion of text.

Structures

PangoAttrClass

The PangoAttrClass 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 PangoAttribute.

type

[PangoAttrType] the type ID for this attribute

PangoAttribute

The PangoAttribute 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 pangoAttributeInit. By default an attribute will have an all-inclusive range of [0,G_MAXUINT].

klass

[PangoAttrClass] the class structure holding information about the type of the attribute

startIndex

[numeric] the start index of the range (in bytes).

endIndex

[numeric] end index of the range (in bytes). The character at this index is not included in the range.

PangoAttrString

The PangoAttrString structure is used to represent attributes with a string value.

value

[char] the common portion of the attribute

PangoAttrLanguage

The PangoAttrLanguage structure is used to represent attributes that are languages.

value

[PangoLanguage] the common portion of the attribute

PangoAttrColor

The PangoAttrColor structure is used to represent attributes that are colors.

color

[PangoColor] the common portion of the attribute

PangoAttrInt

The PangoAttrInt structure is used to represent attributes with an integer or enumeration value.

value

[integer] the common portion of the attribute

PangoAttrFloat

The PangoAttrFloat structure is used to represent attributes with a float or double value.

value

[numeric] the common portion of the attribute

PangoAttrFontDesc

The PangoAttrFontDesc structure is used to store an attribute that sets all aspects of the font description at once.

desc

[PangoFontDescription] the common portion of the attribute

PangoAttrShape

The PangoAttrShape structure is used to represent attributes which impose shape restrictions.

inkRect

[PangoRectangle] the common portion of the attribute

logicalRect

[PangoRectangle] the ink rectangle to restrict to

PangoAttrSize

The PangoAttrShape structure is used to represent attributes which set font size.

size

[integer] the common portion of the attribute

absolute

[numeric] size of font, in units of 1/PANGO_SCALE of a point (for PANGO_ATTR_SIZE) or of a device uni (for PANGO_ATTR_ABSOLUTE_SIZE)

PangoColor

The PangoColor structure is used to represent a color in an uncalibrated RGB color-space.

red

[integer] The red component of the color. This is a value between 0 and 65535, with 65535 indicating full intensity.

green

[integer] The green component of the color. This is a value between 0 and 65535, with 65535 indicating full intensity.

blue

[integer] The blue component of the color. This is a value between 0 and 65535, with 65535 indicating full intensity.

PangoAttrList

The PangoAttrList structure represents a list of attributes that apply to a section of text. The attributes are, in general, allowed to overlap in an arbitrary fashion, however, if the attributes are manipulated only through pangoAttrListChange, the overlap between properties will meet stricter criteria.

Since the PangoAttrList 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 PangoAttrList for more than one paragraph of text.

PangoAttrIterator

The PangoAttrIterator structure is used to represent an iterator through a PangoAttrList. A new iterator is created with pangoAttrListGetIterator. Once the iterator is created, it can be advanced through the style changes in the text using pangoAttrIteratorNext. At each style change, the range of the current style segment and the attributes currently in effect can be queried.

Enums and Flags

PangoAttrType

The PangoAttrType distinguishes between different types of attributes. Along with the predefined values, it is possible to allocate additional values for custom attributes using pangoAttrTypeRegister. The predefined values are given below. The type of structure used to store the attribute is listed in parentheses after the description.

invalid

does not happen

language

language (PangoAttrLanguage)

family

font family name list (PangoAttrString)

style

font slant style (PangoAttrInt)

weight

font weight (PangoAttrInt)

variant

font variant (normal or small caps) (PangoAttrInt)

stretch

font stretch (PangoAttrInt)

size

font size in points scaled by PANGO_SCALE (PangoAttrInt)

font-desc

font description (PangoAttrFontDesc)

foreground

foreground color (PangoAttrColor)

background

background color (PangoAttrColor)

underline

whether the text has an underline (PangoAttrInt)

strikethrough

whether the text is struck-through (PangoAttrInt)

rise

baseline displacement (PangoAttrInt)

shape

shape (PangoAttrShape)

scale

font size scale factor (PangoAttrFloat)

fallback

whether fallback is enabled (PangoAttrInt)

letter-spacing

letter spacing (PangoAttrInt)

underline-color

underline color (PangoAttrColor)

strikethrough-color

strikethrough color (PangoAttrColor)

absolute-size

font size in pixels scaled by PANGO_SCALE (PangoAttrInt)

gravity

base text gravity (PangoAttrInt)

gravity-hint

gravity hint (PangoAttrInt)

PangoUnderline

the PangoUnderline enumeration is used to specify whether text should be underlined, and if so, the type of underlining.

none

no underline should be drawn

single

a single underline should be drawn

double

a double underline should be drawn

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.

User Functions

PangoAttrDataCopyFunc(data)

A copy function passed to attribute new functions that take user data.

data

[R object] the user data

Returns: [R object] a new copy of data.

PangoAttrFilterFunc(attribute, data)

A predicate function used by pangoAttrListFilter to filter out a subset of attributes for a list.

attribute

[PangoAttribute] a PangoAttribute

data

[R object] callback data passed to pangoAttrListFilter

Returns: [logical] TRUE if the attribute should be filtered out

Author(s)

Derived by RGtkGen from GTK+ documentation

References

https://developer.gnome.org/pango/stable/pango-Text-Attributes.html


RGtk2 documentation built on Oct. 14, 2021, 5:08 p.m.