Glyph is a very basic typesetting library. It takes plain text and prints it to a surface. A glyph object is a surface on the screen to which the text is printed. each glyph object is initialized with certain settings such as postion, size, font, and color. Commands are given in text with a preceding backslash followed by the command (eg. '
' starts a newline).
Most glyph objects consist of multiple surfaces. each object is given the mainscreen surface, and in addition creates two other surfaces: a text surface and a view surface. The text surface has the text printed to it. The text surface is blitted to the view surface. The view surface is what is ultimately blitted to the mainscreen. if the view surface is smaller than the text surface, than different areas of the text surface can be blitted to it, essentially creating scrolling. If the text and veiw surfaces are the same size or the view surface is larger, than there is no real difference.
All glyph objects take plain text and convert it into font images. Each begins by wrapping the text to a specified width and splitting it into lines. It then converts each line to a text image and stores it in a dictionary keyed to its position on the surface it is to be blitted to. Some objects retain the plain text associated with the images for later procesing, others discard it. For more details, see 'usage'. glyph uses a number of basic functions, such as linewrapping, and some optional ones, such as justifying. All functions are performed on text images, not the plain text. This is to ensure that text is positioned perfectly on the screen, something that is not possible by working with the plain text directly.
What's New in This Release: [ read full changelog ]
· Editor import bug in glyph.py
· Example bug in example.py
· Environment parsing bug in glyph.py
· RE to parse environment bug in glyph.py
· pygame.image not imported
· GlyphGrp and EditorGrp self args omitted
· Column width not correctly calculated
· Columns added to Glyph
· clear method of Glyph now accepts 0 or 2 arguments. If 2 args received behaviour remains the same. If 0 args received it will now reset glyph, but not clear any surfaces.
· draw method added to GlyphGroup and EditorGroup
· overwrite method added. update keyword added to input method.
· update method added to GlyphGroup
· GlyphGroup and EditorGroup added to __init__ imports
· GlyphGroup and EditorGroup __iter__ now iterates over self.items rather than self
· GlyphGroup and EditorGroup exit conditions now all return tuples of the same length
· buff attribute deprivatized
· Warning when buffer not emptied now sent to stderr
· update method now returns 1 if buffer emptied, 0 otherwise