From: Dave M. <da...@da...> - 2003-07-08 00:28:42
|
On Mon, 2003-07-07 at 22:44, Tony Graham wrote: [snip] > That's something that I haven't worked out yet: whether to expose all > the object types or just let everything be an FoObject or, at best, an > FoNode and let programs get at an object's properties using > g_object_get_property() (or whatever it's called). > [snip] > The 'xmlroff-libfo' example doesn't compile because I baulked at > making area-to-pdf.h an installed file since the stuff in > area-to-pdf.h is likely to be subsumed into a 'draw' method of each > object type. > For what it's worth, here a fragment of code that should give an idea of what I'm trying to do with libfo within Conglomerate... Hopefully we can meet somewhere in the middle. I've got a GnomePrintContext, to print to either a real printer, or to generate a print preview. I could pass a GnomePrintJob instead, if need be. However the FoDoc constructor for GnomePrint likes to create its own GPC, and could be a pain for me - perhaps I need some higher level object to pass. I looked through the go_doc_gp code and IIRC it can create new print jobs as it goes along, in the case that the paper size changes half-way through a job. Not sure how to go about getting that into the print preview dialog :-( I've also got an xmlDocPtr, containing the document (i.e. with a fo:root as the root element); it's typically the result of a XSLT transform, which my GUI has hidden from the end-user. Here my pseudo-code - will this be a sane way of using libfo? void print_xslfo(GnomePrintContext *gpc, xmlDocPtr xml_doc) { FoDoc *fo_doc; FoFo *fo_tree; FoArea *area_tree; GError *error = NULL; g_return_if_fail(gpc); g_return_if_fail(xml_doc); fo_doc = fo_doc_gp_new (); /* FIXME: need some way to pass our gpc or job to the FoDoc constructor; would a config do it? */ fo_xml_doc_to_fo_and_area_trees (xml_doc, fo_doc, &fo_tree, &area_tree, 0, /* gint debug_level */, &error); /* FIXME: error handling! */ } -- David Malcolm www.conglomerate.org |