|
From: Tony G. <Ton...@Su...> - 2005-03-18 17:48:50
|
Tony Graham <Ton...@Su...> writes:
> Tim Waugh <tw...@re...> writes:
>> On Thu, Mar 10, 2005 at 04:41:49PM +0000, Tony Graham wrote:
> ..
>> Oh, now that I look more closely, it's the fo:external-graphic ones I
>> wanted. The background-image things were for 'draft'-type watermarks,
>> and they come from docbook-xsl.
>>
>> So is that more difficult?
>
> Oh, yes.
>
> The simple answer:
For the record...
> - Implement the graphic handing in FoDocGP that used to be in
> FoDocPDF.
I.e., implement these commands from libfo/fo-doc-commands.h for
FoDocGP:
void fo_doc_place_image (FoDoc *fo_doc,
gint image,
gfloat x,
gfloat y,
gfloat scale);
gint fo_doc_open_image_file (FoDoc *fo_doc,
const char *imagetype,
const char *filename,
const char *stringparam,
gint intparam);
void fo_doc_close_image (FoDoc *fo_doc,
gint image);
In practice, it would be okay to modify the fo-doc-commands.h commands
since these were based on PDFlib functions and PDFlib is no longer
used.
> - Modify PangoXSL to walk the PangoLayout after it's been rendered
> and call the callback for each graphic.
Actually, modify fo_doc_gp_render_layout_lines() to add something
similar to pangopdf_layout_lines() after the
gnome_print_pango_layout() call to iterate through each PangoAttribute
of each run of each line of fo_area_layout_get_layout (area_layout) to
find any callback attributes similarly to what was done in
pangopdflib.c in the PangoPDF project:
if (attr_type == pango_attr_callback_get_type ())
{
GValue values[1] = { { 0, } };
g_value_init (&values[0], G_TYPE_POINTER);
g_value_set_pointer (&values[0], pdf_doc);
#if 0
g_message ("Got a callback: callback: %p",
((PangoAttrPointer *) attr)->pointer);
#endif
PDF_translate (pdf_doc,
((float) x) / PANGO_SCALE,
((float) y) / PANGO_SCALE);
g_closure_invoke (((GClosure *) ((PangoAttrPointer *) attr)->pointer),
NULL,
1,
values,
NULL);
PDF_translate (pdf_doc,
- (((float) x) / PANGO_SCALE),
- (((float) y) / PANGO_SCALE));
}
(See
http://cvs.sourceforge.net/viewcvs.py/pangopdf/pangopdf/pango/pangopdflib.c?rev=1.6&view=auto)
Regards,
Tony.
|