yampex.adjust.TextSizeComputer(object)
class documentation
Part of yampex.adjust
(View In Hierarchy)
I compute dimensions of text strings and Matplotlib text objects, using my default DPI of 100 or a different one you supply in my constructor.
Method | __init__ | Undocumented |
Method | width | Returns an estimated width of the supplied text proportional to full height of a full-height letter of the specified size. For Arial font. |
Method | height | Returns an estimated height of the supplied text proportional to that of a full-height letter of the specified size, based on the number of lines it contains. |
Method | realistic_dims | Returns the dimensions of the supplied textObj, initially computed from its bounding box but replaced by an estimate if they weren't realistic. |
Method | dims | Returns the dimensions of the supplied text object in pixels. |
Static Method | pixels2fraction | Given a 2-sequence of dimensions dimsObj of some object and another 2-sequence of dimensions dimsFig of the figure, returns fractional dimensions. |
Returns an estimated width of the supplied text proportional to full height of a full-height letter of the specified size. For Arial font.
Adapted from https://stackoverflow.com/a/16008023.
Returns an estimated height of the supplied text proportional to that of a full-height letter of the specified size, based on the number of lines it contains.
Returns the dimensions of the supplied textObj, initially computed from its bounding box but replaced by an estimate if they weren't realistic.
You must supply a size as a float. Call this method indirectly
via dims
.