Open abu-irrational opened 5 months ago
checkout the svgviewer example as well, it does more with the fontHandler. The FontHandler is used in two places. You need it when you're parsing, because you're setting up bounding boxes of text, and you need to grab font information to do that. You need it again when you're rendering, because then you actually need the fonts so you can draw. Ideally it's the same FontHandler in both cases, which here it is.
The one in svgimage is just inemic (doesn't setup any fonts). I'll have to change that example so it's not misleading. It will default to "Arial" on the Windows platform. The one in svgviewer is more ambitious, loading all the fonts on a Windows machine.
Hi William, The svgandme integration is going well, but I have a concern regarding SVGDocument and FontHandler.
Please, can you explain what's the purpose of a fFontHandler member in a SVGDocument class ?
As far I can understand, reading your demo "svgimage.cpp", a FontHandler is "used" only when rendering a SGVDocument, (and thus the SvgDrawingContext is initialized with a FontHandler) but then, I don't understand why SVGDocument requires an empty FontHandler for the initial parsing.
Here's an extract from the demo "svgimage.cpp" ... // [ABU] // here a SVGDocument is created and the SVG is parsed. // This SVGDocument requires a FontHandler, and here we pass // a gFontHandler with zero loaded fonts ... // So, what's purpose of FontHandler in a SVGDocument, // given that it is again passed to the rendering-context ?