Package wx :: Package lib :: Package floatcanvas :: Module FloatCanvas :: Class ScaledText
[frames | no frames]

Class ScaledText

       DrawObject --+
                    |
XYObjectMixin --+   |
                |   |
  TextObjectMixin --+
                    |
                   ScaledText


This class creates a text object that is scaled when zoomed.  It is
placed at the coordinates, x,y. the "Position" argument is a two
charactor string, indicating where in relation to the coordinates
the string should be oriented.

The first letter is: t, c, or b, for top, center and bottom The
second letter is: l, c, or r, for left, center and right The
position refers to the position relative to the text itself. It
defaults to "tl" (top left).

Size is the size of the font in world coordinates.

Family:
    Font family, a generic way of referring to fonts without
    specifying actual facename. One of:
        wx.DEFAULT:  Chooses a default font.
        wx.DECORATI: A decorative font.
        wx.ROMAN: A formal, serif font.
        wx.SCRIPT: A handwriting font.
        wx.SWISS: A sans-serif font.
        wx.MODERN: A fixed pitch font.
    NOTE: these are only as good as the wxWindows defaults, which aren't so good.
Style:
    One of wx.NORMAL, wx.SLANT and wx.ITALIC.
Weight:
    One of wx.NORMAL, wx.LIGHT and wx.BOLD.
Underlined:
    The value can be True or False. At present this may have an an
    effect on Windows only.

Alternatively, you can set the kw arg: Font, to a wx.Font, and the
above will be ignored. The size of the font you specify will be
ignored, but the rest of its attributes will be preserved.

The size will scale as the drawing is zoomed.

Bugs/Limitations:

As fonts are scaled, the do end up a little different, so you don't
get exactly the same picture as you scale up and doen, but it's
pretty darn close.

On wxGTK1 on my Linux system, at least, using a font of over about
3000 pts. brings the system to a halt. It's the Font Server using
huge amounts of memory. My work around is to max the font size to
3000 points, so it won't scale past there. GTK2 uses smarter font
drawing, so that may not be an issue in future versions, so feel
free to test. Another smarter way to do it would be to set a global
zoom limit at that point.

The hit-test is done on the entire text extent. This could be made
optional, but I haven't gotten around to it.

Method Summary
  __init__(self, String, XY, Size, Color, BackgroundColor, Family, Style, Weight, Underlined, Position, Font, InForeground)
  CalcBoundingBox(self)
  LayoutText(self)
A dummy method to re-do the layout of the text.

Class Variable Summary

Method Details

LayoutText(self)

A dummy method to re-do the layout of the text.

A derived object needs to override this if required.

Overrides:
wx.lib.floatcanvas.FloatCanvas.TextObjectMixin.LayoutText (inherited documentation)

Generated by Epydoc 2.1.20050511.rpd on Mon Feb 16 12:54:40 2009 http://epydoc.sf.net