Draws a text object
The object is scaled when zoomed.
The hit-test is done on the entire text extent
Bugs/Limitations:
As fonts are scaled, they do end up a little different, so you don’t get exactly the same picture as you scale up and down, but it’s pretty darn close.
On wxGTK1 on my Linux system, at least, using a font of over about 1000 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 1000 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.
wx.lib.floatcanvas.FCObjects.DrawObject
, wx.lib.floatcanvas.FCObjects.TextObjectMixin
__init__ |
Default class constructor. |
CalcBoundingBox |
Calculates the Bounding Box |
GetBoxRect |
|
LayoutText |
Calculates the positions of the words of text. |
ReWrap |
|
WrapToWidth |
ScaledTextBox
(TextObjectMixin, DrawObject)¶Draws a text object
The object is scaled when zoomed.
The hit-test is done on the entire text extent
Bugs/Limitations:
As fonts are scaled, they do end up a little different, so you don’t get exactly the same picture as you scale up and down, but it’s pretty darn close.
On wxGTK1 on my Linux system, at least, using a font of over about 1000 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 1000 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.
__init__
(self, String, Point, Size, Color = "Black", BackgroundColor = None, LineColor = 'Black', LineStyle = 'Solid', LineWidth = 1, Width = None, PadSize = None, Family = wx.FONTFAMILY_MODERN, Style = wx.FONTSTYLE_NORMAL, Weight = wx.FONTWEIGHT_NORMAL, Underlined = False, Position = 'tl', Alignment = "left", Font = None, LineSpacing = 1.0, InForeground = False)¶Default class constructor.
Parameters: |
|
---|
CalcBoundingBox
(self)¶Calculates the Bounding Box
GetBoxRect
(self)¶LayoutText
(self)¶Calculates the positions of the words of text.
This isn’t exact, as fonts don’t scale exactly. To help this, the position of each individual word is stored separately, so that the general layout stays the same in world coordinates, as the fonts scale.
ReWrap
(self, Width)¶WrapToWidth
(self)¶