From: J. S. A. <js...@sh...> - 2004-03-11 20:12:48
|
Hi Jerome, On Fri, 2004-03-05 at 02:28, Jerome Berthet wrote: > - Splitting GDevice in two classes: one for vector graphics > (GDevice), and > one for fonts management i.e: GPlateformFontMgr. The GDevice could > embed its FontManager (thus, that would similar to the current > implementation), > then GuidoInitDesc would just require a FontManager. Providing a > graphic device > at initialisation is definitely strange, but providing a font > manager would make > more sense. I think it would not be too much work to convert > existing devices to > this design. What do you think about it ? I've gone ahead with this implementation. It appears to work fine (that is, it compiles, I haven't done any real form of exhaustive testing :-) ). What I have done is create a GFontManager class that contains the font and bitmap routines (the bitmap routines are really just stubs as it doesn't seem to be fully implemented yet). The GuidoInitDesc now only requires the GFontManager instead of the VGDevice. The base GFontManager reads in a file that contains font metric data and uses that to implement the various GetScreenExtent, GetTextExtent, etc. routines. Then, similar to the VGDevice model, child classes can be created (i.e. GFontManagerWin32, GFontManagerPS, etc.) that override those routines with their device specific implementations. As well, I have embedded a GFontManager instance (gFontManager) into VGDevice, so that when any graphic device object is created, it attaches a font manager to itself. This has allowed for very minimal code changes, mostly just relocating routines and creating a few pointers to the new objects, while still allowing for a device-independent interface with which to implement the GGS. However, it will break all the current applications/libraries due to the addition of a required GFontManager pointer to the VGDevice constructor as well as the change in GuidoInitDesc. I have implemented the base GFontManager, a GFontManagerPS (postscript), GFontManagerWin32 (win32) and GFontManagerWin2000 (win2000), however, I have not altered any of the applications. I don't believe it will be terribly difficult to fix these, I just haven't done so yet. Additionally, my familiarity with OSX programming is very minimal, so I have not yet approached that aspect. At this point, I would like to have you and the others take a look at what I have done and comment, but I think it may be prudent to create a new branch in the cvs for this (perhaps a ggs branch as I will begin to add in routines for that quite soon). This way the current dev branch will not be broken, and when things progress enough on the ggs branch a merge can be examined. What are your thoughts? Cheers, Scott |