upverter/schematic-file-converter — Issue #22: .bounds() for text labels
Author: patrickyeon
Created: 2011-12-15 04:57:33+00:00
State: open

I don't know that there's any sensible way to implement a .bounds() method for text labels (core.shape.Label, core.annotation.Annotation), seeing as there's no spec for font/size of the text to be used (and I would expect it to vary depending on the writer used). Annotation.bounds() currently uses a hack I put in, of a 20x20 box centered on the anchor of the annotation, but that's no more than a hack.

Two possibilities I would float: a 1x1 bounding box at the label's anchor (essentially `[Point(self.x, self.y), Point(self.x, self.y)]`), or a box for a specific [monospaced] font and size (eg 10pt Courier), possibly with a possibility of a writer hooking in a different bounds method?

Either way, I'd like to see shape.Label.bounds() succeed, as the current alternative is to filter out Labels anywhere they may be before calculating an objects' bounds.