Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[gef-dev] Zoom support and Greeking


I'm currently implementing zoom, and one common feature of zooming out is to "greek" text that is too small to be read.  This is typically done by replacing the area where the small text would have appeared with a line or rectangle of the same proportions.

The problem I see is that calculating the proportions of the string is actually more expensive than just painting it.  The Graphics object is given only a Point and a String, therefore it would have to calculate the rectangle that that String would occupy at the current zoom level.  Therefore, I propose an additional method on Graphics that takes the Rectangle into which the String is being drawn, instead of a point.  Most Figures already calculate this rectangle during their validate() method, and therefore can supply it for free.  The ZoomGraphics would then support 3 greeking modes: never, when available, and always (which would be slow if the figure didn't supply the rectangle).  And it would also support a greeking threshold, which would be the font height in pixels.

Have others implemented zoom already? If so, how did you handle small fonts?

Back to the top