From: Paul B. <ba...@st...> - 2004-03-12 20:17:35
|
John Hunter wrote: > > I think font handling should be factored out of the Text class into a > dedicated class. > > class Font: > > pass > > class Text(dpi, bbox, font, etc...): > pass Just to make sure that I have this straight, the Text class should look like this: def __init__(self, ..., font, ...): ... self._color = color self._text = text self._verticalalignment = verticalalignment self._horizontalalignment = horizontalalignment self._rotation = rotation self._font = font instead of this: def __init__(self, ...): ... self._color = color self._text = text self._verticalalignment = verticalalignment self._horizontalalignment = horizontalalignment self._rotation = rotation self._fontname = fontname self._fontsize = fontsize self._fontweight = fontweight self._fontangle = fontangle If so, do you planning on changing get_fontxxxx() for get_font()? > > For user API compatibility, the critical thing is to preserve the > getters and setters of Text, since the following is legal code > > t = title('hi mom', fontname='Courier', fontsize=12) > > which calls text.set_fontname and text.fontsize under the hood. > > But the setters and getters can just forward the call to the new font > instance as necessary. OK. > Vis-a-vis backends: > > PS: As far as the finder algorithm is concerned, it would be nice if > it was sufficiently generic that backend_ps could use it too. If > you define an API that the algorithm needs vis-a-vis font > properties, we modify the AFM and FT2Font classes to provide > these. Yes, this is my intention. > Division of labor: if you want to make the required changes to > text.Text, ttf_font_finder and (optionally) matplotlibrc I'm all for > it. Once you have a prototype, I can help with all the text > instantiators if you like, or you can do this too. Whichever way, I > can definitely help with the backend ports once the above issues are > resolved. I should be able to do most of it. -- Paul -- Paul Barrett, PhD Space Telescope Science Institute Phone: 410-338-4475 ESS/Science Software Branch FAX: 410-338-4767 Baltimore, MD 21218 |