From: <Sha...@si...> - 2005-03-03 19:13:24
|
Martin and Tim and I had an IM session yesterday and talked about exception handling in Graphite, specifically in the situation where an error happens in trying to create a Graphite segment. To summarize the discussion as I remember it: Tim was in favor of throwing exceptions because (a) it is more consistent with the way other rendering systems would work, (b) the automatic clean-up of allocated memory and so forth would work better, and (c) it is more time-efficient than generating a dumb segment that is not needed. (Hope I got all those reasons right.) I am in favor of Graphite catching the exception itself and performing some kind of dumb rendering which can then be recognized by the application if it cares to ask. I am favor of this because it is a more forgiving approach for applications that aren't in the practice of catching exceptions--it mostly guarantees that the user will see *something* on the screen that represents their data. In the end we decided to compromise and provide a flag that says which approach to use. At this point we are probably going to implement this using an argument on LayoutEnvironment. (Another option is a class method on Segment with the advantage that it only needs to be called once, but the disadvantage that class methods can affect thread safety.) The default for the argument is false, meaning that exceptions would be thrown. Also Martin and Tim expressed the opinion that that totally dumb segment is not really all that useful; what would be a lot more useful is for Graphite to do an "as-smart-as-possible" rendering, with a record of which glyphs are "not quite right." So after the API work is done, that will be on my list of things to try to implement. To that end there will be an "erroneous" flag added to the GlyphInfo data structure. |