Creates a new Pango attribute of the specified type$
. The other parameters
that must be passed to this function depend on the specified type.
The following types are currently supported:
AllowBreaks
-
Create a new allow-breaks attribute. You must pass an additional boolean argument
specifying if breaks are allowed. If breaks are disabled, the range will be kept in
a single run, as far as possible.
Background
-
Create a new background color attribute. You must pass the three additional
arguments which specify the red, green, and blue components of the background
color and must be between 0 and 65535 each.
BackgroundAlpha
-
Create a new background alpha attribute. You must pass the additional
argument
alpha
which specifies the background alpha value and must
be between 0 and 65535.
Fallback
-
Create a new font fallback attribute. You must pass an additional boolean
argument that specifies whether fallback should be enabled or disabled.
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.
Family
-
Create a new font family attribute. You must pass a string that contains
the family name or a comma-separated list of families.
FontDesc
-
Create a new font description attribute. You must a Pango font description
object as an additional argument. This attribute allows setting the attributes
Family
, Style
, Weight
, Variant
, Stretch
, and Size
simultaneously.
Foreground
-
Create a new foreground color attribute. You must pass the three additional
arguments which specify the red, green, and blue components of the foreground
color and must be between 0 and 65535 each.
ForegroundAlpha
-
Create a new foreground alpha attribute. You must pass an additional
value which specifies the foreground alpha value and must be between 0
and 65535.
Gravity
-
Create a new gravity attribute. You must pass an additional argument
that specifies the gravity. See pcontext:SetBaseGravity() for a list
of gravity constants.
GravityHint
-
Create a new gravity hint attribute. You must pass an additional argument
that specifies the gravity hint. See pcontext:SetGravityHint() for a list
of gravity hints.
InsertHyphens
-
Create a new insert-hyphens attribute. Pango will insert hyphens when breaking lines in
the middle of a word. Set this attribute to
False
to suppress the hyphen.
Language
-
Create a new language tag attribute. You must pass an additional argument
containing a Pango language object.
LetterSpacing
-
Create a new letter-spacing attribute. You must pass an additional argument
specifying the amount of extra space to add between graphemes of the text (in Pango units).
Rise
-
Create a new baseline displacement attribute. You must pass an additional argument
specifying the amount that the text should be displaced vertically, in Pango units.
Positive values displace the text upwards.
Scale
-
Create a new font size scale attribute. The base font for the affected text will have
its size multiplied by the scale factor that is passed as an additional
argument to this attribute.
Shape
-
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 Pango layout. You have to pass two additional
table arguments: The first is the ink rectangle to assign to each character, the second
is the logical rectangle to assign to each character. Both arguments must be tables with
the fields
x
, y
, width
, and height
initialized. Additionally, you can pass an optional
third argument which is considered user data and can be of any type.
Show
-
Create a new attribute that influences how invisible characters are rendered. You
must pass an additional argument that can be set to one of the following flags:
#PANGO_SHOW_NONE
-
No special treatment for invisible characters.
#PANGO_SHOW_SPACES
-
Render spaces, tabs and newlines visibly.
#PANGO_SHOW_LINE_BREAKS
-
Render line breaks visibly.
#PANGO_SHOW_IGNORABLES
-
Render default-ignorable Unicode characters visibly.
Size
-
Create a new font-size attribute in fractional points. You must pass an additional
argument specifying the font size, in #PANGO_SCALE-ths of a point.
SizeAbsolute
-
Create a new font-size attribute in device points. You must pass an additional
argument specifying the font size, in #PANGO_SCALE-ths of a device unit.
Stretch
-
Create a new font stretch attribute. You must pass an additional argument specifying
the font stretch mode. See pfontdesc:SetStretch() for a list of Pango stretch
modes.
Strikethrough
-
Create a new strike-through attribute. You must pass an additional boolean argument
specifying if the text should be struck-through.
StrikethroughColor
-
Create a new strikethrough color attribute. You must pass the three additional
arguments
red
, green
, blue
which specify the strikethrough color and must
be between 0 and 65535 for each value.
Style
-
Create a new font slant style attribute. You must pass an additional argument specifying
the font slant style. See pfontdesc:SetStyle() for a list of Pango styles.
Underline
-
Create a new underline-style attribute. You must pass an additional argument specifying
the underline style. The following underline styles are currently supported:
#PANGO_UNDERLINE_NONE
-
No underline should be drawn.
#PANGO_UNDERLINE_SINGLE
-
A single underline should be drawn.
#PANGO_UNDERLINE_DOUBLE
-
A double underline should be drawn.
#PANGO_UNDERLINE_LOW
-
A single underline should be drawn at a position beneath the ink extents of the text being
underlined. This should be used only for underlining single characters, such as for keyboard
accelerators.
#PANGO_UNDERLINE_SINGLE
should be used for extended portions of text.
#PANGO_UNDERLINE_ERROR
-
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.
#PANGO_UNDERLINE_SINGLE_LINE
-
Like PANGO_UNDERLINE_SINGLE, but drawn continuously across multiple runs.
#PANGO_UNDERLINE_DOUBLE_LINE
-
Like PANGO_UNDERLINE_DOUBLE, but drawn continuously across multiple runs.
#PANGO_UNDERLINE_ERROR_LINE
-
Like PANGO_UNDERLINE_ERROR, but drawn continuously across multiple runs.
UnderlineColor
-
Create a new underline color attribute. You must pass the three additional
arguments
red
, green
, blue
which specify the underline color and must
be between 0 and 65535 for each value.
Variant
-
Create a new font variant attribute. You must pass an additional argument specifying
the font variant style. See pfontdesc:SetVariant() for a list of Pango variants.
Weight
-
Create a new font weight attribute. You must pass an additional argument specifying
the font weight. This can be a number or one of the predefined font weights. See
pfontdesc:SetWeight() for a list of Pango font weights.
This function returns the newly allocated Pango attribute, which should
be freed with pattribute:Free().