Package libavg :: Module avg :: Class Words

Class Words


A words node displays formatted text. Rendering is done by pango. All properties are set in pixels. International and multi-byte character sets are fully supported. Words nodes should use UTF-8 to encode international characters. The pos attribute of a words node is the logical top left of the first character for left-aligned text. For centered and right-aligned text, it is the top center and right of the first line, respectively. For latin text, the logical top usually corresponds to the height of the ascender. There may be cases where portions of the text are rendered to the left of or above the position, for instance when italics are used.

Instance Methods
pos
getGlyphPos(i)
Returns the position of the glyph at byte index i in the layout.
pos
getGlyphSize(i)
Returns the size of the glyph at byte index i in the layout.

Inherited from unreachable.instance: __new__

Inherited from object: __delattr__, __getattribute__, __reduce__, __reduce_ex__, __repr__, __setattr__, __str__

    Inherited from RasterNode
Bitmap
getBitmap()
Returns a copy of the bitmap that the node contains.
 
getOrigVertexCoords()
Returns the unwarped coordinate of all vertices as a list of lists.
 
getWarpedVertexCoords()
Returnes the current coordinate of all vertices as a list of lists.
 
setWarpedVertexCoords(grid)
Changes the current coordinates of all vertices.
    Inherited from AreaNode
AreaNode
getElementByPos(pos)
Returns the topmost child node that is at the position given.
mediasize
getMediaSize()
Returns the size in pixels of the media in the node.
    Inherited from Node
 
__eq__(...)
 
__hash__(...)
hash(x)
 
__init__(...)
Raises an exception This class cannot be instantiated from Python
 
__ne__(...)
abspos
getAbsPos(relpos)
Transforms a position in coordinates relative to the node to a position in window coordinates.
node
getParent()
Returns the container (AVGNode or DivNode) the node is in.
relpos
getRelPos(abspos)
Transforms a position in window coordinates to a position in coordinates relative to the node.
 
releaseEventCapture(cursorid)
Restores normal mouse operation after a call to setEventCapture().
 
setEventCapture(cursorid)
Sets up event capturing so that cursor events are sent to this node regardless of the cursor position.
 
setEventHandler(type, source, pyfunc)
Sets a callback function that is invoked whenever an event of the specified type from the specified source occurs.
None
unlink(kill)
Removes a node from it's parent container.
Static Methods
 
addFontDir(s)
Adds a directory to be searched for fonts.This only works before Player.play().
 
getFontFamilies(...)
 
getFontVariants(...)
Properties
  alignment
The paragraph alignment.
  color
The color of the text in standard html color notation: FF0000 is red, 00FF00 green, etc.
  font
The family name of the truetype font to use.
  fontsize
The font size in pixels.
  hint
Whether or not hinting (http://en.wikipedia.org/wiki/Font_hinting) should be used when rendering the text.
  indent
The indentation of the first line of the paragraph.
  justify
Whether each complete line should be stretched to fill the entire width of the layout.
  letterspacing
The amount of space between the idividual glyphs of the text in pixels, with 0 being standard spacing and negative values indicating packed text (less letter spacing than normal).
  linespacing
The number of pixels between different lines of a paragraph.
  parawidth
  rawtextmode
Sets whether the text should be parsed (False, default) or interpreted as raw string (True).
  text
The string to display.
  variant
The variant (bold, italic, etc.) of the truetype font to use.
  wrapmode
Paragraph's wrap behaviour.

Inherited from object: __class__

    Inherited from RasterNode
  blendmode
The method of compositing the node with the nodes under it.
  maskhref
The source filename for a mask image to be used as alpha channel.
  maskpos
An offset for the mask image.
  masksize
The size of the mask image.
  maxtileheight
The maximum width and height of the tiles used for warping.
  maxtilewidth
The maximum width and height of the tiles used for warping.
  mipmap
Determines whether mipmaps are generated for this node.
    Inherited from AreaNode
  angle
The angle that the node is rotated to in radians.
  height
  pivot
The position of the point that the node is rotated around.
  pivotx
Deprecated.
  pivoty
Deprecated.
  pos
The position of the node's top left corner relative to it's parent node.
  size
  width
  x
The position of the node's left edge relative to it's parent node.
  y
The position of the node's top edge relative to it's parent node.
    Inherited from Node
  active
If this attribute is true, the node behaves as usual.
  id
A unique identifier that can be used to reference the node.
  opacity
A measure of the node's transparency.
  sensitive
A node only reacts to events if sensitive is true.
Method Details

getGlyphPos(i)

 

Returns the position of the glyph at byte index i in the layout. The position is a Point2D, in pixels, and relative to the words node.

Returns: pos

getGlyphSize(i)

 

Returns the size of the glyph at byte index i in the layout. The position is a Point2D, in pixels.

Returns: pos

Property Details

alignment

The paragraph alignment. Possible values are 'left', 'center' and 'right'.

Get Method:
unreachable(...)
Set Method:
unreachable(...)

color

The color of the text in standard html color notation: FF0000 is red, 00FF00 green, etc.

Get Method:
unreachable(...)
Set Method:
unreachable(...)

font

The family name of the truetype font to use. This font must be installed in the system (for instance using the installfonts.sh script in the main libavg source directory) or available in a fonts/ subdirectory of the current directory.

Get Method:
unreachable(...)
Set Method:
unreachable(...)

fontsize

The font size in pixels. Fractional sizes are supported.

Get Method:
unreachable(...)
Set Method:
unreachable(...)

hint

Whether or not hinting (http://en.wikipedia.org/wiki/Font_hinting) should be used when rendering the text. Unfortunately, this setting does not override the fontconfig settings in /etc/fonts/conf.d/*-hinting.conf or other fontconfig configuration files.

Get Method:
unreachable(...)
Set Method:
unreachable(...)

indent

The indentation of the first line of the paragraph.

Get Method:
unreachable(...)
Set Method:
unreachable(...)

justify

Whether each complete line should be stretched to fill the entire width of the layout. Default is false.

Get Method:
unreachable(...)
Set Method:
unreachable(...)

letterspacing

The amount of space between the idividual glyphs of the text in pixels, with 0 being standard spacing and negative values indicating packed text (less letter spacing than normal). Only active when text attribute markup is not being used.

Get Method:
unreachable(...)
Set Method:
unreachable(...)

linespacing

The number of pixels between different lines of a paragraph.

Get Method:
unreachable(...)
Set Method:
unreachable(...)

parawidth

Get Method:
unreachable(...)
Set Method:
unreachable(...)

rawtextmode

Sets whether the text should be parsed (False, default) or interpreted as raw string (True).

Get Method:
unreachable(...)
Set Method:
unreachable(...)

text

The string to display. In the avg file, this is either the text attribute of the words node or the content of the words node itself. In the second case, the string can be formatted using the pango text attribute markup language described at http://library.gnome.org/devel/pango/unstable/PangoMarkupFormat.html. Markup can also be used if the text is set using python. Markup parsing is controlled with 'rawtextmode' property.

Get Method:
unreachable(...)
Set Method:
unreachable(...)

variant

The variant (bold, italic, etc.) of the truetype font to use. To figure out which variants are available, use the avg_showfonts.py utility.

Get Method:
unreachable(...)
Set Method:
unreachable(...)

wrapmode

Paragraph's wrap behaviour. Possible values are 'word' (break to the nearest space, default), 'char' (break at any position) and 'wordchar' (break words but fall backto char mode if there is no free space for a full word).

Get Method:
unreachable(...)
Set Method:
unreachable(...)