class Textline

Last modified: March 19, 2014

Contents

Textline

In module gamera.toolkits.ocr.classes

The Textline object stores information about a text line in its following properties:

bbox
A Rect object representing the bounding box of the text line.
glyphs
A list of Cc objects, each representing a character in the line.
words
A nested list of Cc objects, where each sublist represents the characters of a single word.

__init__

Signature:

init (bbox, glyphs=None)

with

bbox:
Rect object representing position and size of the text line
glyphs:
A list of Cc objects representing the characters in the text line

add_glyph

Adds the given glyph to the Textline. Signature:

add_glyph (glyph, extend=True)

When extend is True, the text line bounding box bbox is extended by the glyph's bounding box.

add_glyphs

Adds the given glyphs to the Textline. Signature:

add_glyphs (glyphs, extend=True)

When extend is True, the text line bounding box bbox is extended by the union of the glyphs' bounding boxes.

sort_glyphs

Sorts the characters in Textline.glyphs from left to right.