PgAttribute

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.

class PgAttribute {}

Constructors

this
this(PangoAttribute* pangoAttribute)

Sets our main struct and passes it to the parent class

Members

Functions

attributeCopy
PgAttribute attributeCopy()

Make a copy of an attribute.

attributeDestroy
void attributeDestroy()

Destroy a PangoAttribute and free all associated memory.

attributeEqual
int attributeEqual(PgAttribute attr2)

Compare two attributes for equality. This compares only the actual value of the two attributes and not the ranges that the attributes apply to.

attributeInit
void attributeInit(PangoAttrClass* klass)

Initializes attr's klass to klass, it's start_index to PANGO_ATTR_INDEX_FROM_TEXT_BEGINNING and end_index to PANGO_ATTR_INDEX_TO_TEXT_END such that the attribute applies to the entire text by default. Since 1.20

getPgAttributeStruct
PangoAttribute* getPgAttributeStruct()

Get the main Gtk struct

getStruct
void* getStruct()

the main Gtk struct as a void*

Static functions

backgroundNew
PgAttribute backgroundNew(ushort red, ushort green, ushort blue)

Create a new background color attribute.

fallbackNew
PgAttribute fallbackNew(int enableFallback)

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. Since 1.4

familyNew
PgAttribute familyNew(string family)

Create a new font family attribute.

fontDescNew
PgAttribute fontDescNew(PgFontDescription desc)

Create a new font description attribute. This attribute allows setting family, style, weight, variant, stretch, and size simultaneously.

foregroundNew
PgAttribute foregroundNew(ushort red, ushort green, ushort blue)

Create a new foreground color attribute.

gravityHintNew
PgAttribute gravityHintNew(PangoGravityHint hint)

Create a new gravity hint attribute. Since 1.16

gravityNew
PgAttribute gravityNew(PangoGravity gravity)

Create a new gravity attribute. Since 1.16

languageNew
PgAttribute languageNew(PgLanguage language)

Create a new language tag attribute.

letterSpacingNew
PgAttribute letterSpacingNew(int letterSpacing)

Create a new letter-spacing attribute. Since 1.6

markupParserFinish
int markupParserFinish(SimpleXML context, PgAttributeList attrList, string text, gunichar accelChar)

After feeding a pango markup parser some data with g_markup_parse_context_parse(), use this function to get the list of pango attributes and text out of the markup. This function will not free context, use g_markup_parse_context_free() to do so. Since 1.31.0

markupParserNew
SimpleXML markupParserNew(gunichar accelMarker)

Parses marked-up text (see markup format) to create a plain-text string and an attribute list. If accel_marker is nonzero, the given character will mark the character following it as an accelerator. For example, accel_marker might be an ampersand or underscore. All characters marked as an accelerator will receive a PANGO_UNDERLINE_LOW attribute, and the first character so marked will be returned in accel_char, when calling finish(). Two accel_marker characters following each other produce a single literal accel_marker character. To feed markup to the parser, use g_markup_parse_context_parse() on the returned GMarkupParseContext. When done with feeding markup to the parser, use pango_markup_parser_finish() to get the data out of it, and then use g_markup_parse_context_free() to free it. This function is designed for applications that read pango markup from streams. To simply parse a string containing pango markup, the simpler pango_parse_markup() API is recommended instead. Since 1.31.0

parseMarkup
int parseMarkup(string markupText, int length, gunichar accelMarker, PgAttributeList attrList, string text, gunichar* accelChar)

Parses marked-up text (see markup format) to create a plain-text string and an attribute list. If accel_marker is nonzero, the given character will mark the character following it as an accelerator. For example, accel_marker might be an ampersand or underscore. All characters marked as an accelerator will receive a PANGO_UNDERLINE_LOW attribute, and the first character so marked will be returned in accel_char. Two accel_marker characters following each other produce a single literal accel_marker character. To parse a stream of pango markup incrementally, use pango_markup_parser_new(). If any error happens, none of the output arguments are touched except for error.

riseNew
PgAttribute riseNew(int rise)

Create a new baseline displacement attribute.

scaleNew
PgAttribute scaleNew(double scaleFactor)

Create a new font size scale attribute. The base font for the affected text will have its size multiplied by scale_factor.

shapeNew
PgAttribute shapeNew(PangoRectangle* inkRect, PangoRectangle* logicalRect)

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.

shapeNewWithData
PgAttribute shapeNewWithData(PangoRectangle* inkRect, PangoRectangle* logicalRect, void* data, PangoAttrDataCopyFunc copyFunc, GDestroyNotify destroyFunc)

Like pango_attr_shape_new(), but a user data pointer is also provided; this pointer can be accessed when later rendering the glyph. Since 1.8

sizeNew
PgAttribute sizeNew(int size)

Create a new font-size attribute in fractional points.

sizeNewAbsolute
PgAttribute sizeNewAbsolute(int size)

Create a new font-size attribute in device units. Since 1.8

stretchNew
PgAttribute stretchNew(PangoStretch stretch)

Create a new font stretch attribute

strikethroughColorNew
PgAttribute strikethroughColorNew(ushort red, ushort green, ushort blue)

Create a new strikethrough color attribute. This attribute modifies the color of strikethrough lines. If not set, strikethrough lines will use the foreground color. Since 1.8

strikethroughNew
PgAttribute strikethroughNew(int strikethrough)

Create a new strike-through attribute.

styleNew
PgAttribute styleNew(PangoStyle style)

Create a new font slant style attribute.

typeGetName
string typeGetName(PangoAttrType type)

Fetches the attribute type name passed in when registering the type using pango_attr_type_register(). The returned value is an interned string (see g_intern_string() for what that means) that should not be modified or freed. Since 1.22

typeRegister
PangoAttrType typeRegister(string name)

Allocate a new attribute type ID. The attribute type name can be accessed later by using pango_attr_type_get_name().

underlineColorNew
PgAttribute underlineColorNew(ushort red, ushort green, ushort blue)

Create a new underline color attribute. This attribute modifies the color of underlines. If not set, underlines will use the foreground color. Since 1.8

underlineNew
PgAttribute underlineNew(PangoUnderline underline)

Create a new underline-style attribute.

variantNew
PgAttribute variantNew(PangoVariant variant)

Create a new font variant attribute (normal or small caps)

weightNew
PgAttribute weightNew(PangoWeight weight)

Create a new font weight attribute.

Variables

pangoAttribute
PangoAttribute* pangoAttribute;

the main Gtk struct

Meta