1 /* Fo
2  * fo-doc.c: Wrapper for libfo output document
3  *
4  * Copyright (C) 2001-2006 Sun Microsystems
5  * Copyright (C) 2007-2010 Menteith Consulting Ltd
6  *
7  * See COPYING for the status of this software.
8  */
9 
10 #include "config.h"
11 #include <string.h>
12 #include "fo-utils.h"
13 #include "fo-doc-private.h"
14 #include "fo-doc-commands.h"
15 #if ENABLE_CAIRO
16 #include "fo-doc-cairo.h"
17 #endif
18 #if ENABLE_GP
19 #include "fo-doc-gp.h"
20 #endif
21 #include "datatype/fo-color.h"
22 #include <pango/pango.h>
23 #if 0
24 #include <pango/pangoft2.h>
25 #include <pango/pango-context.h>
26 #endif
27 #include "fo-font-desc-private.h"
28 #include "fo-libfo-context.h"
29 
30 /**
31  * SECTION:fo-doc
32  * @short_description: Abstract output document type
33  *
34  * #FoDoc provides the primitives for writing text, lines, rectangles,
35  * etc., to the output.
36  *
37  * It is generalised so that libfo can support multiple backend
38  * implementations (and add and remove backend implementations)
39  * without having to restructure the rest of libfo.
40  */
41 
42 const char *fo_doc_error_messages [] = {
43   N_("FoDoc error"),
44   N_("Cannot open output document: '%s'"),
45   N_("Unsupported document format.")
46 };
47 
48 enum {
49   PROP_0,
50   PROP_FORMATS
51 };
52 
53 static void          _base_init    (FoDocClass *klass);
54 static void          _class_init   (FoDocClass *klass);
55 static void          _dispose     (GObject      *object);
56 static void          fo_doc_get_property (GObject    *object,
57 					  guint       param_id,
58 					  GValue     *value,
59 					  GParamSpec *pspec);
60 
61 static void          fo_doc_open_file_default      (FoDoc          *fo_doc,
62 						    const gchar    *filename,
63 						    FoLibfoContext *libfo_context,
64 						    GError        **error);
65 static FoLayout *    fo_doc_get_new_layout_default (FoDoc        *fo_doc);
66 static void          fo_doc_begin_page_default     (FoDoc        *fo_doc,
67 						    gdouble        width,
68 						    gdouble        height,
69 						    GError       **error);
70 static void          fo_doc_end_page_default       (FoDoc        *fo_doc);
71 static FoDatatype *  fo_doc_get_fill_color_default (FoDoc        *fo_doc);
72 static void          fo_doc_set_fill_color_default (FoDoc        *fo_doc,
73 						    FoDatatype   *color);
74 static FoDatatype *  fo_doc_get_stroke_color_default (FoDoc        *fo_doc);
75 static void          fo_doc_set_stroke_color_default (FoDoc        *fo_doc,
76 						      FoDatatype   *color);
77 static FoDocLineCap  fo_doc_get_line_cap_default    (FoDoc        *fo_doc);
78 static void          fo_doc_set_line_cap_default    (FoDoc        *fo_doc,
79 						     FoDocLineCap  line_cap);
80 static FoDocLineJoin fo_doc_get_line_join_default   (FoDoc        *fo_doc);
81 static void          fo_doc_set_line_join_default   (FoDoc        *fo_doc,
82 						     FoDocLineJoin line_join);
83 static gdouble        fo_doc_get_line_width_default  (FoDoc        *fo_doc);
84 static void          fo_doc_set_line_width_default  (FoDoc        *fo_doc,
85 						     gdouble        line_width);
86 static void          fo_doc_set_dash_default        (FoDoc        *fo_doc,
87 						     gdouble        b,
88 						     gdouble        w);
89 static void          fo_doc_translate_default       (FoDoc        *fo_doc,
90 						     gdouble        x,
91 						     gdouble        y);
92 static void          fo_doc_clip_default            (FoDoc        *fo_doc);
93 static void          fo_doc_save_default            (FoDoc        *fo_doc);
94 static void          fo_doc_restore_default         (FoDoc        *fo_doc);
95 static void          fo_doc_line_to_default         (FoDoc        *fo_doc,
96 						     gdouble        x,
97 						     gdouble        y);
98 static void          fo_doc_move_to_default         (FoDoc        *fo_doc,
99 						     gdouble        x,
100 						     gdouble        y);
101 static void          fo_doc_line_stroked_default    (FoDoc        *fo_doc,
102 						     gdouble        x0,
103 						     gdouble        y0,
104 						     gdouble        x1,
105 						     gdouble        y1);
106 static void          fo_doc_rect_stroked_default    (FoDoc        *fo_doc,
107 						     gdouble        x,
108 						     gdouble        y,
109 						     gdouble        width,
110 						     gdouble        height);
111 static void          fo_doc_rect_filled_default     (FoDoc        *fo_doc,
112 						     gdouble        x,
113 						     gdouble        y,
114 						     gdouble        width,
115 						     gdouble        height);
116 static void          fo_doc_fill_default            (FoDoc        *fo_doc);
117 static void          fo_doc_stroke_default          (FoDoc        *fo_doc);
118 static void          fo_doc_place_image_default     (FoDoc        *fo_doc,
119 						     FoImage      *fo_image,
120 						     gdouble        x,
121 						     gdouble        y,
122 						     gdouble        xscale,
123 						     gdouble        yscale);
124 static void          fo_doc_render_layout_lines_default (FoDoc   *fo_doc,
125 							 FoArea  *area_layout,
126 							 gdouble   x,
127 							 gdouble   y);
128 static void 	     fo_doc_render_layout_default       (FoDoc   *fo_doc,
129 							 FoArea  *area_layout,
130 							 gdouble   x,
131 							 gdouble   y);
132 
133 static gpointer parent_class;
134 
135 /**
136  * fo_doc_error_quark:
137  *
138  * Get the error quark for #FoDoc.
139  *
140  * If the quark does not yet exist, create it.
141  *
142  * Return value: Quark associated with #FoDoc errors.
143  **/
144 GQuark
fo_doc_error_quark(void)145 fo_doc_error_quark (void)
146 {
147   static GQuark quark = 0;
148   if (quark == 0)
149     quark = g_quark_from_static_string ("FoDoc error");
150   return quark;
151 }
152 
153 
154 /**
155  * fo_doc_get_type:
156  *
157  * Register the #FoDoc object type.
158  *
159  * Return value: #GType value of the #FoDoc object type.
160  **/
161 GType
fo_doc_get_type(void)162 fo_doc_get_type (void)
163 {
164   static GType object_type = 0;
165 
166   if (!object_type)
167     {
168       static const GTypeInfo object_info =
169       {
170         sizeof (FoDocClass),
171         (GBaseInitFunc) _base_init,
172         NULL,           /* base_finalize */
173         (GClassInitFunc) _class_init,
174         NULL,           /* class_finalize */
175         NULL,           /* class_data */
176         sizeof (FoDoc),
177         0,              /* n_preallocs */
178         NULL,
179 	NULL		/* value_table */
180       };
181 
182       object_type = g_type_register_static (FO_TYPE_LIBFO_MODULE,
183                                             "FoDoc",
184                                             &object_info,
185 					    G_TYPE_FLAG_ABSTRACT);
186     }
187 
188   return object_type;
189 }
190 
191 /**
192  * _base_init:
193  * @klass: #FoDocClass base class object to initialise.
194  *
195  * Implements #GBaseInitFunc for #FoDocClass.
196  **/
197 static void
_base_init(FoDocClass * klass)198 _base_init (FoDocClass *klass)
199 {
200   klass->formats             = FO_FLAG_FORMAT_UNKNOWN;
201 
202   klass->open_file           = fo_doc_open_file_default;
203 
204   klass->get_new_layout = fo_doc_get_new_layout_default;
205 
206   klass->begin_page          = fo_doc_begin_page_default;
207   klass->end_page            = fo_doc_end_page_default;
208   klass->get_fill_color      = fo_doc_get_fill_color_default;
209   klass->set_fill_color      = fo_doc_set_fill_color_default;
210   klass->get_stroke_color    = fo_doc_get_stroke_color_default;
211   klass->set_stroke_color    = fo_doc_set_stroke_color_default;
212   klass->translate           = fo_doc_translate_default;
213   klass->get_line_cap        = fo_doc_get_line_cap_default;
214   klass->set_line_cap        = fo_doc_set_line_cap_default;
215   klass->get_line_join       = fo_doc_get_line_join_default;
216   klass->set_line_join       = fo_doc_set_line_join_default;
217   klass->get_line_width      = fo_doc_get_line_width_default;
218   klass->set_line_width      = fo_doc_set_line_width_default;
219   klass->set_dash            = fo_doc_set_dash_default;
220   klass->translate           = fo_doc_translate_default;
221   klass->clip                = fo_doc_clip_default;
222   klass->save                = fo_doc_save_default;
223   klass->restore             = fo_doc_restore_default;
224   klass->line_to             = fo_doc_line_to_default;
225   klass->move_to             = fo_doc_move_to_default;
226   klass->line_stroked        = fo_doc_line_stroked_default;
227   klass->rect_stroked        = fo_doc_rect_stroked_default;
228   klass->rect_filled         = fo_doc_rect_filled_default;
229   klass->fill                = fo_doc_fill_default;
230   klass->stroke              = fo_doc_stroke_default;
231   klass->place_image         = fo_doc_place_image_default;
232   klass->render_layout_lines = fo_doc_render_layout_lines_default;
233   klass->render_layout       = fo_doc_render_layout_default;
234 }
235 
236 /**
237  * _class_init:
238  * @klass: #FoDocClass object to initialise.
239  *
240  * Implements #GClassInitFunc for #FoDocClass.
241  **/
242 static void
_class_init(FoDocClass * klass)243 _class_init (FoDocClass *klass)
244 {
245   GObjectClass *object_class = G_OBJECT_CLASS (klass);
246 
247   parent_class = g_type_class_peek_parent (klass);
248 
249   object_class->get_property = fo_doc_get_property;
250   object_class->dispose = _dispose;
251 
252   g_object_class_install_property
253     (object_class,
254      PROP_FORMATS,
255      g_param_spec_flags ("formats",
256 			 _("Output formats"),
257 			 _("Supported output file formats"),
258 			 FO_TYPE_FLAGS_FORMAT,
259 			 FO_FLAG_FORMAT_UNKNOWN,
260 			 G_PARAM_READABLE));
261 }
262 
263 /**
264  * _dispose:
265  * @object: #FoDocGP object to dispose.
266  *
267  * Implements #GObjectDisposeFunc for #FoDocGP.
268  **/
269 static void
_dispose(GObject * object)270 _dispose (GObject *object)
271 {
272   FoDoc *fo_doc = FO_DOC (object);
273 
274   /* Allow a subtype to free the PangoContext (or even to not use a
275      PangoContext). */
276   if (fo_doc->pango_context != NULL)
277     {
278       g_object_unref (fo_doc->pango_context);
279       fo_doc->pango_context = NULL;
280     }
281 }
282 
283 /**
284  * fo_doc_get_property:
285  * @object:  #GObject whose property will be retreived
286  * @prop_id: Property ID assigned when property registered
287  * @value:   #GValue to set with property value
288  * @pspec:   Parameter specification for this property type
289  *
290  * Implements #GObjectGetPropertyFunc for #FoLibfoContext
291  **/
292 void
fo_doc_get_property(GObject * object,guint param_id,GValue * value,GParamSpec * pspec)293 fo_doc_get_property (GObject        *object,
294 		     guint           param_id,
295 		     GValue         *value,
296 		     GParamSpec     *pspec)
297 {
298   switch (param_id)
299     {
300     case PROP_FORMATS:
301       g_value_set_flags (value,
302 			 fo_doc_formats_from_name (G_OBJECT_CLASS_NAME (object)));
303       break;
304     default:
305       G_OBJECT_WARN_INVALID_PROPERTY_ID (object, param_id, pspec);
306       break;
307     }
308 }
309 
310 /**
311  * fo_doc_new_from_type:
312  * @type: Type of the new #FoDoc.
313  *
314  * Creates a new #FoDoc.
315  *
316  * Return value: the newly created #FoDoc.
317  **/
318 FoDoc *
fo_doc_new_from_type(const gchar * type)319 fo_doc_new_from_type (const gchar *type)
320 {
321   FoDoc *fo_doc = NULL;
322 
323   if (type == NULL)
324     {
325 #if ENABLE_GP
326       fo_doc = fo_doc_gp_new ();
327 #else
328 #if ENABLE_CAIRO
329       fo_doc = fo_doc_cairo_new ();
330 #else
331       g_critical ("No output type is supported by this build of libfo.");
332 #endif /* ENABLE_CAIRO */
333 #endif /* ENABLE_GP */
334     }
335   else if (strcmp (type, "cairo") == 0)
336     {
337 #if ENABLE_CAIRO
338       fo_doc = fo_doc_cairo_new ();
339 #else
340       g_critical ("Output using Cairo is not supported by this build of libfo.");
341 #endif /* ENABLE_CAIRO */
342     }
343   else if (strcmp (type, "gp") == 0)
344     {
345 #if ENABLE_GP
346       fo_doc = fo_doc_gp_new ();
347 #else
348       g_critical ("Output using GNOME Print is not supported by this build of libfo.");
349 #endif /* ENABLE_GP */
350     }
351   else
352     {
353       g_critical ("Unknown output type: '%s'", type);
354     }
355 
356   return fo_doc;
357 }
358 
359 /**
360  * fo_doc_new:
361  *
362  * Creates a new #FoDoc.
363  *
364  * Return value: the newly created #FoDoc.
365  **/
366 FoDoc *
fo_doc_new(void)367 fo_doc_new (void)
368 {
369   return fo_doc_new_from_type (NULL);
370 }
371 
372 void
fo_doc_open_file_default(FoDoc * fo_doc,const gchar * filename G_GNUC_UNUSED,FoLibfoContext * libfo_context G_GNUC_UNUSED,GError ** error G_GNUC_UNUSED)373 fo_doc_open_file_default (FoDoc          *fo_doc,
374 			  const gchar    *filename G_GNUC_UNUSED,
375 			  FoLibfoContext *libfo_context G_GNUC_UNUSED,
376 			  GError        **error G_GNUC_UNUSED)
377 {
378 #if defined(LIBFO_DEBUG)
379   g_log (G_LOG_DOMAIN,
380 	 G_LOG_LEVEL_DEBUG,
381 	 _("%s does not have a 'open_file' function."),
382 	 fo_object_sprintf (fo_doc));
383 #endif
384 }
385 
386 /**
387  * fo_doc_formats_from_name:
388  * @name: Registered #FoObject type name, e.g., "FoDocCairo"
389  *
390  * Gets the output formats supported by @name class.
391  *
392  * @name should not be #NULL.
393  *
394  * If @name does not implement any formats, returns
395  * #FO_FLAG_FORMAT_UNKNOWN.
396  *
397  * Returns: #FoFlagsFormat with zero or more bits set for the
398  *   supported formats.
399  **/
400 FoFlagsFormat
fo_doc_formats_from_name(const gchar * name)401 fo_doc_formats_from_name (const gchar *name)
402 {
403   g_return_val_if_fail (name != NULL, FO_FLAG_FORMAT_UNKNOWN);
404 
405   FoFlagsFormat formats = FO_FLAG_FORMAT_UNKNOWN;
406   GType type = g_type_from_name (name);
407 
408   if (g_type_is_a (type, fo_doc_get_type ()))
409     {
410       gpointer klass = g_type_class_ref (type);
411       formats =
412 	((FoDocClass *) klass)->formats;
413       g_type_class_unref (klass);
414     }
415 
416   return formats;
417 }
418 
419 /**
420  * fo_doc_open_file:
421  * @fo_doc:        #FoDoc for which to open an output file.
422  * @filename:      Name of output file.
423  * @libfo_context: #FoLibfoContext containing extra info.
424  * @error:         Information about any error that occurred.
425  *
426  *
427  * No reference to @libfo_context is kept.
428  **/
429 void
fo_doc_open_file(FoDoc * fo_doc,const gchar * filename,FoLibfoContext * libfo_context,GError ** error)430 fo_doc_open_file (FoDoc          *fo_doc,
431 		  const gchar    *filename,
432 		  FoLibfoContext *libfo_context,
433 		  GError        **error)
434 {
435   FO_DOC_GET_CLASS (fo_doc)->open_file (fo_doc,
436 					filename,
437 					libfo_context,
438 					error);
439 }
440 
441 /**
442  * fo_doc_get_new_layout_default:
443  * @fo_doc: #FoDoc.
444  *
445  * Get a new #FoLayout for use with @fo_doc.
446  *
447  * Return value: New #FoLayout.
448  **/
449 FoLayout *
fo_doc_get_new_layout_default(FoDoc * fo_doc)450 fo_doc_get_new_layout_default (FoDoc  *fo_doc)
451 {
452 #if defined(LIBFO_DEBUG)
453   g_log (G_LOG_DOMAIN,
454 	 G_LOG_LEVEL_DEBUG,
455 	 _("%s does not have a 'get_new_layout' function."),
456 	 fo_object_sprintf (fo_doc));
457 #endif
458 
459   return NULL;
460 }
461 
462 /**
463  * fo_doc_get_new_layout:
464  * @fo_doc: #FoDoc.
465  *
466  * Get a new #FoLayout for use with @fo_doc.
467  *
468  * Return value: New #FoLayout.
469  **/
470 FoLayout *
fo_doc_get_new_layout(FoDoc * fo_doc)471 fo_doc_get_new_layout (FoDoc *fo_doc)
472 {
473   return FO_DOC_GET_CLASS (fo_doc)->get_new_layout (fo_doc);
474 }
475 
476 /**
477  * fo_doc_get_pango_context:
478  * @fo_doc: #FoDoc
479  *
480  * Get the #PangoContext in @fo_doc.
481  *
482  * Return value: #PangoContext associated with @fo_doc.
483  **/
484 PangoContext *
fo_doc_get_pango_context(FoDoc * fo_doc)485 fo_doc_get_pango_context (FoDoc *fo_doc)
486 {
487   g_return_val_if_fail (fo_doc != NULL, NULL);
488 
489   return fo_doc->pango_context;
490 }
491 
492 /**
493  * fo_doc_get_language:
494  * @fo_doc: #FoDoc
495  *
496  * Get the language in @fo_doc.
497  *
498  * Return value: Language of file parsed to make @fo_doc.
499  **/
500 const gchar *
fo_doc_get_language(FoDoc * fo_doc)501 fo_doc_get_language (FoDoc *fo_doc)
502 {
503   g_return_val_if_fail (fo_doc != NULL, NULL);
504 
505   return pango_language_to_string (pango_context_get_language (fo_doc->pango_context));
506 }
507 
508 /**
509  * fo_doc_set_language:
510  * @fo_doc:   #FoDoc.
511  * @language: Language.
512  *
513  * Set the language in @fo_doc.
514  **/
515 void
fo_doc_set_language(FoDoc * fo_doc,const gchar * language)516 fo_doc_set_language (FoDoc          *fo_doc,
517 		     const gchar    *language)
518 {
519   g_return_if_fail (fo_doc != NULL);
520   g_return_if_fail (language != NULL && *language != '\0');
521 
522   pango_context_set_language (fo_doc->pango_context,
523 			      pango_language_from_string (language));
524 }
525 
526 /**
527  * fo_doc_get_font_desc:
528  * @fo_doc: #FoDoc.
529  *
530  * Get the #PangoFontDescription in @fo_doc.
531  *
532  * Return value: #PangoFontDescription in @fo_doc.
533  **/
534 FoFontDesc *
fo_doc_get_font_desc(FoDoc * fo_doc)535 fo_doc_get_font_desc (FoDoc *fo_doc)
536 {
537   FoFontDesc *font_desc;
538 
539   g_return_val_if_fail (fo_doc != NULL, NULL);
540 
541   font_desc = fo_font_desc_new ();
542 
543   fo_font_desc_set_font_description (font_desc,
544 				     pango_context_get_font_description (fo_doc->pango_context));
545 
546   return font_desc;
547 }
548 
549 /**
550  * fo_doc_get_font_description:
551  * @fo_doc: #FoDoc.
552  *
553  * Get the #PangoFontDescription in @fo_doc.
554  *
555  * Return value: #PangoFontDescription in @fo_doc.
556  **/
557 PangoFontDescription *
fo_doc_get_font_description(FoDoc * fo_doc)558 fo_doc_get_font_description (FoDoc *fo_doc)
559 {
560   g_return_val_if_fail (fo_doc != NULL, NULL);
561 
562   return pango_context_get_font_description (fo_doc->pango_context);
563 }
564 
565 /**
566  * fo_doc_set_font_description:
567  * @fo_doc: #FoDoc.
568  * @font_description: #PangoFontDescription.
569  *
570  * Set the language in @fo_doc.
571  **/
572 void
fo_doc_set_font_description(FoDoc * fo_doc,const PangoFontDescription * desc)573 fo_doc_set_font_description (FoDoc *fo_doc,
574 			     const PangoFontDescription *desc)
575 {
576   g_return_if_fail (fo_doc != NULL);
577   g_return_if_fail (desc != NULL);
578 
579   pango_context_set_font_description (fo_doc->pango_context,
580 				      desc);
581 }
582 
583 /**
584  * fo_doc_get_base_dir:
585  * @fo_doc: #FoDoc.
586  *
587  * Get the #FoEnumAreaDirection used as input to @fo_doc.
588  *
589  * Return value: #FoEnumAreaDirection used as input to @fo_doc.
590  **/
591 FoEnumAreaDirection
fo_doc_get_base_dir(FoDoc * fo_doc)592 fo_doc_get_base_dir (FoDoc *fo_doc)
593 {
594   PangoDirection pango_direction;
595 
596   g_return_val_if_fail (fo_doc != NULL,
597 			FO_ENUM_AREA_DIRECTION_UNKNOWN);
598 
599   pango_direction =
600     pango_context_get_base_dir (fo_doc->pango_context);
601 
602   switch (pango_direction)
603     {
604     case PANGO_DIRECTION_LTR:
605     case PANGO_DIRECTION_WEAK_LTR:
606 	/* FIXME: Not sure how to handle neutral */
607     case PANGO_DIRECTION_NEUTRAL:
608       return FO_ENUM_AREA_DIRECTION_LR;
609       break;
610     case PANGO_DIRECTION_RTL:
611     case PANGO_DIRECTION_WEAK_RTL:
612       return FO_ENUM_AREA_DIRECTION_RL;
613       break;
614     case PANGO_DIRECTION_TTB_RTL:
615     case PANGO_DIRECTION_TTB_LTR:
616       return FO_ENUM_AREA_DIRECTION_TB;
617       break;
618     }
619 
620   return FO_ENUM_AREA_DIRECTION_UNKNOWN;
621 }
622 
623 /**
624  * fo_doc_set_base_dir:
625  * @fo_doc:   #FoDoc.
626  * @base_dir: #FoEnumAreaDirection value for new base direction.
627  *
628  * Set the #FoEnumAreaDirection in @fo_doc.
629  **/
630 void
fo_doc_set_base_dir(FoDoc * fo_doc,FoEnumAreaDirection base_dir)631 fo_doc_set_base_dir (FoDoc      *fo_doc,
632 		     FoEnumAreaDirection  base_dir)
633 {
634   PangoDirection pango_direction = PANGO_DIRECTION_LTR;
635 
636   g_return_if_fail (fo_doc != NULL);
637   g_return_if_fail (base_dir != FO_ENUM_AREA_DIRECTION_UNKNOWN);
638 
639   switch (base_dir)
640     {
641     case FO_ENUM_AREA_DIRECTION_LR:
642       pango_direction = PANGO_DIRECTION_LTR;
643       break;
644     case FO_ENUM_AREA_DIRECTION_RL:
645       pango_direction = PANGO_DIRECTION_RTL;
646       break;
647     case FO_ENUM_AREA_DIRECTION_TB:
648       pango_direction = PANGO_DIRECTION_TTB_RTL;
649       break;
650     case FO_ENUM_AREA_DIRECTION_UNKNOWN:
651     default:
652       g_assert_not_reached ();
653     }
654 
655   pango_context_set_base_dir (fo_doc->pango_context,
656 			      pango_direction);
657 }
658 
659 /**
660  * fo_doc_begin_page_default:
661  * @fo_doc: #FoDoc.
662  * @width:  Width of the new page.
663  * @height: Height of the new page.
664  * @error:  Indication of any error that occurred.
665  *
666  * Add a new page to @fo_doc.
667  *
668  * This must always be paired with a matching #fo_doc_end_page call.
669  **/
670 void
fo_doc_begin_page_default(FoDoc * fo_doc,gdouble width G_GNUC_UNUSED,gdouble height G_GNUC_UNUSED,GError ** error G_GNUC_UNUSED)671 fo_doc_begin_page_default (FoDoc   *fo_doc,
672 			   gdouble  width G_GNUC_UNUSED,
673 			   gdouble  height G_GNUC_UNUSED,
674 			   GError **error G_GNUC_UNUSED)
675 {
676 #if defined(LIBFO_DEBUG)
677   g_log (G_LOG_DOMAIN,
678 	 G_LOG_LEVEL_DEBUG,
679 	 _("%s does not have a 'begin_page' function."),
680 	 fo_object_sprintf (fo_doc));
681 #endif
682 }
683 
684 /**
685  * fo_doc_begin_page:
686  * @fo_doc: #FoDoc.
687  * @width:  Width of the new page.
688  * @height: Height of the new page.
689  * @error:  Indication of any error that occurred.
690  *
691  * Add a new page to @fo_doc.
692  *
693  * This must always be paired with a matching #fo_doc_end_page call.
694  **/
695 void
fo_doc_begin_page(FoDoc * fo_doc,gdouble width,gdouble height,GError ** error)696 fo_doc_begin_page (FoDoc   *fo_doc,
697 		   gdouble  width,
698 		   gdouble  height,
699 		   GError **error)
700 {
701   FO_DOC_GET_CLASS (fo_doc)->begin_page (fo_doc,
702 					 width,
703 					 height,
704 					 error);
705 }
706 
707 /**
708  * fo_doc_end_page_default:
709  * @fo_doc: #FoDoc.
710  *
711  * Finish the current page of @fo_doc.
712  **/
713 void
fo_doc_end_page_default(FoDoc * fo_doc)714 fo_doc_end_page_default (FoDoc        *fo_doc)
715 {
716 #if defined(LIBFO_DEBUG)
717   g_log (G_LOG_DOMAIN,
718 	 G_LOG_LEVEL_DEBUG,
719 	 _("%s does not have a 'end_page' function."),
720 	 fo_object_sprintf (fo_doc));
721 #endif
722 }
723 
724 /**
725  * fo_doc_end_page:
726  * @fo_doc: #FoDoc.
727  *
728  * Finish the current page of @fo_doc.
729  **/
730 void
fo_doc_end_page(FoDoc * fo_doc)731 fo_doc_end_page (FoDoc        *fo_doc)
732 {
733   FO_DOC_GET_CLASS (fo_doc)->end_page (fo_doc);
734 }
735 
736 /**
737  * fo_doc_get_fill_color_default:
738  * @fo_doc: #FoDoc.
739  *
740  * Get the current fill color of @fo_doc.
741  *
742  * Return value: #FoDatatype for the current fill color.
743  **/
744 FoDatatype *
fo_doc_get_fill_color_default(FoDoc * fo_doc)745 fo_doc_get_fill_color_default (FoDoc        *fo_doc)
746 {
747 #if defined(LIBFO_DEBUG)
748   g_log (G_LOG_DOMAIN,
749 	 G_LOG_LEVEL_DEBUG,
750 	 _("%s does not have a 'get_fill_color' function."),
751 	 fo_object_sprintf (fo_doc));
752 #endif
753 
754   return NULL;
755 }
756 
757 /**
758  * fo_doc_get_fill_color:
759  * @fo_doc: #FoDoc.
760  *
761  * Get the current fill color of @fo_doc.
762  *
763  * Return value: #FoDatatype for the current fill color.
764  **/
765 FoDatatype *
fo_doc_get_fill_color(FoDoc * fo_doc)766 fo_doc_get_fill_color (FoDoc        *fo_doc)
767 {
768   return FO_DOC_GET_CLASS (fo_doc)->get_fill_color (fo_doc);
769 }
770 
771 /**
772  * fo_doc_set_fill_color_default:
773  * @fo_doc: #FoDoc.
774  * @color:  #FoDatatype for new fill color.
775  *
776  * Set the fill color of @fo_doc to @color.
777  **/
778 void
fo_doc_set_fill_color_default(FoDoc * fo_doc,FoDatatype * color G_GNUC_UNUSED)779 fo_doc_set_fill_color_default (FoDoc        *fo_doc,
780 			       FoDatatype   *color G_GNUC_UNUSED)
781 {
782 #if defined(LIBFO_DEBUG)
783   g_log (G_LOG_DOMAIN,
784 	 G_LOG_LEVEL_DEBUG,
785 	 _("%s does not have a 'set_fill_color' function."),
786 	 fo_object_sprintf (fo_doc));
787 #endif
788 }
789 
790 /**
791  * fo_doc_set_fill_color:
792  * @fo_doc: #FoDoc.
793  * @color:  #FoDatatype for new fill color.
794  *
795  * Set the fill color of @fo_doc to @color.
796  **/
797 void
fo_doc_set_fill_color(FoDoc * fo_doc,FoDatatype * color)798 fo_doc_set_fill_color (FoDoc        *fo_doc,
799 		       FoDatatype   *color)
800 {
801   FO_DOC_GET_CLASS (fo_doc)->set_fill_color (fo_doc,
802 					     color);
803 }
804 
805 /**
806  * fo_doc_get_stroke_color_default:
807  * @fo_doc: #FoDoc.
808  *
809  * Get the current stroke color of @fo_doc.
810  *
811  * Return value: #FoDatatype for the current stroke color.
812  **/
813 FoDatatype *
fo_doc_get_stroke_color_default(FoDoc * fo_doc)814 fo_doc_get_stroke_color_default (FoDoc        *fo_doc)
815 {
816 #if defined(LIBFO_DEBUG)
817   g_log (G_LOG_DOMAIN,
818 	 G_LOG_LEVEL_DEBUG,
819 	 _("%s does not have a 'get_stroke_color' function."),
820 	 fo_object_sprintf (fo_doc));
821 #endif
822 
823   return NULL;
824 }
825 
826 
827 /**
828  * fo_doc_get_stroke_color:
829  * @fo_doc: #FoDoc.
830  *
831  * Get the current stroke color of @fo_doc.
832  *
833  * Return value: #FoDatatype for the current stroke color.
834  **/
835 FoDatatype *
fo_doc_get_stroke_color(FoDoc * fo_doc)836 fo_doc_get_stroke_color (FoDoc        *fo_doc)
837 {
838   return FO_DOC_GET_CLASS (fo_doc)->get_stroke_color (fo_doc);
839 }
840 
841 /**
842  * fo_doc_set_stroke_color_default:
843  * @fo_doc: #FoDoc.
844  * @color:  #FoDatatype for new stroke color.
845  *
846  * Set the stroke color of @fo_doc to @color.
847  **/
848 void
fo_doc_set_stroke_color_default(FoDoc * fo_doc,FoDatatype * color G_GNUC_UNUSED)849 fo_doc_set_stroke_color_default (FoDoc        *fo_doc,
850 				 FoDatatype   *color G_GNUC_UNUSED)
851 {
852 #if defined(LIBFO_DEBUG)
853   g_log (G_LOG_DOMAIN,
854 	 G_LOG_LEVEL_DEBUG,
855 	 _("%s does not have a 'set_stroke_color' function."),
856 	 fo_object_sprintf (fo_doc));
857 #endif
858 }
859 
860 /**
861  * fo_doc_set_stroke_color:
862  * @fo_doc: #FoDoc.
863  * @color:  #FoDatatype for new stroke color.
864  *
865  * Set the stroke color of @fo_doc to @color.
866  **/
867 void
fo_doc_set_stroke_color(FoDoc * fo_doc,FoDatatype * color)868 fo_doc_set_stroke_color (FoDoc        *fo_doc,
869 			 FoDatatype   *color)
870 {
871   FO_DOC_GET_CLASS (fo_doc)->set_stroke_color (fo_doc,
872 					       color);
873 }
874 
875 /**
876  * fo_doc_get_line_cap_default:
877  * @fo_doc: #FoDoc.
878  *
879  * Get the current "linecap" parameter value of @fo_doc.
880  *
881  * Return value: Current "linecap" parameter value.
882  **/
883 FoDocLineCap
fo_doc_get_line_cap_default(FoDoc * fo_doc)884 fo_doc_get_line_cap_default (FoDoc        *fo_doc)
885 {
886 #if defined(LIBFO_DEBUG)
887   g_log (G_LOG_DOMAIN,
888 	 G_LOG_LEVEL_DEBUG,
889 	 _("%s does not have a 'get_line_cap' function."),
890 	 fo_object_sprintf (fo_doc));
891 #endif
892 
893   return FO_DOC_LINE_CAP_INVALID;
894 }
895 
896 /**
897  * fo_doc_get_line_cap:
898  * @fo_doc: #FoDoc.
899  *
900  * Get the current "linecap" parameter value of @fo_doc.
901  *
902  * Return value: Current "linecap" parameter value.
903  **/
904 FoDocLineCap
fo_doc_get_line_cap(FoDoc * fo_doc)905 fo_doc_get_line_cap (FoDoc        *fo_doc)
906 {
907   return FO_DOC_GET_CLASS (fo_doc)->get_line_cap (fo_doc);
908 }
909 
910 /**
911  * fo_doc_set_line_cap_default:
912  * @fo_doc:   #FoDoc.
913  * @line_cap: New "linecap" parameter value.
914  *
915  * Set the "linecap" parameter value of @fo_doc.
916  **/
917 void
fo_doc_set_line_cap_default(FoDoc * fo_doc,FoDocLineCap line_cap G_GNUC_UNUSED)918 fo_doc_set_line_cap_default (FoDoc        *fo_doc,
919 			     FoDocLineCap  line_cap G_GNUC_UNUSED)
920 {
921 #if defined(LIBFO_DEBUG)
922   g_log (G_LOG_DOMAIN,
923 	 G_LOG_LEVEL_DEBUG,
924 	 _("%s does not have a 'set_line_cap' function."),
925 	 fo_object_sprintf (fo_doc));
926 #endif
927 }
928 
929 /**
930  * fo_doc_set_line_cap:
931  * @fo_doc:   #FoDoc.
932  * @line_cap: New "linecap" parameter value.
933  *
934  * Set the "linecap" parameter value of @fo_doc.
935  **/
936 void
fo_doc_set_line_cap(FoDoc * fo_doc,FoDocLineCap line_cap)937 fo_doc_set_line_cap (FoDoc        *fo_doc,
938 		     FoDocLineCap  line_cap)
939 {
940   FO_DOC_GET_CLASS (fo_doc)->set_line_cap (fo_doc,
941 					   line_cap);
942 }
943 
944 /**
945  * fo_doc_get_line_join_default:
946  * @fo_doc: #FoDoc.
947  *
948  * Get the current "linejoin" parameter value of @fo_doc.
949  *
950  * Return value: Current "linejoin" parameter value.
951  **/
952 FoDocLineJoin
fo_doc_get_line_join_default(FoDoc * fo_doc)953 fo_doc_get_line_join_default (FoDoc        *fo_doc)
954 {
955 #if defined(LIBFO_DEBUG)
956   g_log (G_LOG_DOMAIN,
957 	 G_LOG_LEVEL_DEBUG,
958 	 _("%s does not have a 'get_line_join' function."),
959 	 fo_object_sprintf (fo_doc));
960 #endif
961 
962   return FO_DOC_LINE_JOIN_INVALID;
963 }
964 
965 /**
966  * fo_doc_get_line_join:
967  * @fo_doc: #FoDoc.
968  *
969  * Get the current "linejoin" parameter value of @fo_doc.
970  *
971  * Return value: Current "linejoin" parameter value.
972  **/
973 FoDocLineJoin
fo_doc_get_line_join(FoDoc * fo_doc)974 fo_doc_get_line_join (FoDoc        *fo_doc)
975 {
976   return FO_DOC_GET_CLASS (fo_doc)->get_line_join (fo_doc);
977 }
978 
979 /**
980  * fo_doc_set_line_join_default:
981  * @fo_doc:   #FoDoc.
982  * @line_join: New "linejoin" parameter value.
983  *
984  * Set the "linejoin" parameter value of @fo_doc.
985  **/
986 void
fo_doc_set_line_join_default(FoDoc * fo_doc,FoDocLineJoin line_join G_GNUC_UNUSED)987 fo_doc_set_line_join_default (FoDoc        *fo_doc,
988 			      FoDocLineJoin line_join G_GNUC_UNUSED)
989 {
990 #if defined(LIBFO_DEBUG)
991   g_log (G_LOG_DOMAIN,
992 	 G_LOG_LEVEL_DEBUG,
993 	 _("%s does not have a 'set_line_join' function."),
994 	 fo_object_sprintf (fo_doc));
995 #endif
996 }
997 
998 /**
999  * fo_doc_set_line_join:
1000  * @fo_doc:   #FoDoc.
1001  * @line_join: New "linejoin" parameter value.
1002  *
1003  * Set the "linejoin" parameter value of @fo_doc.
1004  **/
1005 void
fo_doc_set_line_join(FoDoc * fo_doc,FoDocLineJoin line_join)1006 fo_doc_set_line_join (FoDoc        *fo_doc,
1007 		      FoDocLineJoin line_join)
1008 {
1009   FO_DOC_GET_CLASS (fo_doc)->set_line_join (fo_doc,
1010 					    line_join);
1011 }
1012 
1013 /**
1014  * fo_doc_get_line_width_default:
1015  * @fo_doc: #FoDoc.
1016  *
1017  * Get the current line width of @fo_doc.
1018  *
1019  * Return value: Current line width.
1020  **/
1021 gdouble
fo_doc_get_line_width_default(FoDoc * fo_doc)1022 fo_doc_get_line_width_default (FoDoc        *fo_doc)
1023 {
1024 #if defined(LIBFO_DEBUG)
1025   g_log (G_LOG_DOMAIN,
1026 	 G_LOG_LEVEL_DEBUG,
1027 	 _("%s does not have a 'get_line_width' function."),
1028 	 fo_object_sprintf (fo_doc));
1029 #endif
1030 
1031   return 0.0;
1032 }
1033 
1034 /**
1035  * fo_doc_get_line_width:
1036  * @fo_doc: #FoDoc.
1037  *
1038  * Get the current line width of @fo_doc.
1039  *
1040  * Return value: Current line width.
1041  **/
1042 gdouble
fo_doc_get_line_width(FoDoc * fo_doc)1043 fo_doc_get_line_width (FoDoc        *fo_doc)
1044 {
1045   return FO_DOC_GET_CLASS (fo_doc)->get_line_width (fo_doc);
1046 }
1047 
1048 /**
1049  * fo_doc_set_line_width_default:
1050  * @fo_doc:   #FoDoc.
1051  * @line_width: New line width value.
1052  *
1053  * Set the line width of @fo_doc.
1054  **/
1055 void
fo_doc_set_line_width_default(FoDoc * fo_doc,gdouble line_width G_GNUC_UNUSED)1056 fo_doc_set_line_width_default (FoDoc        *fo_doc,
1057 			       gdouble        line_width G_GNUC_UNUSED)
1058 {
1059 #if defined(LIBFO_DEBUG)
1060   g_log (G_LOG_DOMAIN,
1061 	 G_LOG_LEVEL_DEBUG,
1062 	 _("%s does not have a 'set_line_width' function."),
1063 	 fo_object_sprintf (fo_doc));
1064 #endif
1065 }
1066 
1067 /**
1068  * fo_doc_set_line_width:
1069  * @fo_doc:   #FoDoc.
1070  * @line_width: New line width value.
1071  *
1072  * Set the line width of @fo_doc.
1073  **/
1074 void
fo_doc_set_line_width(FoDoc * fo_doc,gdouble line_width)1075 fo_doc_set_line_width (FoDoc        *fo_doc,
1076 		       gdouble        line_width)
1077 {
1078   FO_DOC_GET_CLASS (fo_doc)->set_line_width (fo_doc,
1079 					     line_width);
1080 }
1081 
1082 /**
1083  * fo_doc_set_dash_default:
1084  * @fo_doc: #FoDoc.
1085  * @b:      Number of black units.
1086  * @w:      Number of white units.
1087  *
1088  * Set the current dash pattern of @fo_doc.
1089  *
1090  * The dash pattern is the ratio of @b to @w.
1091  *
1092  * Set @b and @w to 0 to produce a solid line.
1093  *
1094  * The dash pattern is set to solid (@b = @w = 0) at the beginning of
1095  * each page.
1096  **/
1097 void
fo_doc_set_dash_default(FoDoc * fo_doc,gdouble b G_GNUC_UNUSED,gdouble w G_GNUC_UNUSED)1098 fo_doc_set_dash_default (FoDoc        *fo_doc,
1099 			 gdouble        b G_GNUC_UNUSED,
1100 			 gdouble        w G_GNUC_UNUSED)
1101 {
1102 #if defined(LIBFO_DEBUG)
1103   g_log (G_LOG_DOMAIN,
1104 	 G_LOG_LEVEL_DEBUG,
1105 	 _("%s does not have a 'set_dash' function."),
1106 	 fo_object_sprintf (fo_doc));
1107 #endif
1108 }
1109 
1110 /**
1111  * fo_doc_set_dash:
1112  * @fo_doc: #FoDoc.
1113  * @b:      Number of black units.
1114  * @w:      Number of white units.
1115  *
1116  * Set the current dash pattern of @fo_doc.
1117  *
1118  * The dash pattern is the ratio of @b to @w.
1119  *
1120  * Set @b and @w to 0 to produce a solid line.
1121  *
1122  * The dash pattern is set to solid (@b = @w = 0) at the beginning of
1123  * each page.
1124  **/
1125 void
fo_doc_set_dash(FoDoc * fo_doc,gdouble b,gdouble w)1126 fo_doc_set_dash (FoDoc        *fo_doc,
1127 		 gdouble        b,
1128 		 gdouble        w)
1129 {
1130   FO_DOC_GET_CLASS (fo_doc)->set_dash (fo_doc,
1131 				       b,
1132 				       w);
1133 }
1134 
1135 /**
1136  * fo_doc_translate_default:
1137  * @fo_doc: #FoDoc.
1138  * @x:      X-coordinate of the new origin of the coordinate system.
1139  * @y:      Y-coordinate of the new origin of the coordinate system.
1140  *
1141  * Translate the origin of the coordinate system of @fo_doc.
1142  *
1143  * @x and @y are measured in the old coordinate system.
1144  **/
1145 void
fo_doc_translate_default(FoDoc * fo_doc,gdouble x G_GNUC_UNUSED,gdouble y G_GNUC_UNUSED)1146 fo_doc_translate_default (FoDoc        *fo_doc,
1147 			  gdouble        x G_GNUC_UNUSED,
1148 			  gdouble        y G_GNUC_UNUSED)
1149 {
1150 #if defined(LIBFO_DEBUG)
1151   g_log (G_LOG_DOMAIN,
1152 	 G_LOG_LEVEL_DEBUG,
1153 	 _("%s does not have a 'translate' function."),
1154 	 fo_object_sprintf (fo_doc));
1155 #endif
1156 }
1157 
1158 /**
1159  * fo_doc_translate:
1160  * @fo_doc: #FoDoc.
1161  * @x:      X-coordinate of the new origin of the coordinate system.
1162  * @y:      Y-coordinate of the new origin of the coordinate system.
1163  *
1164  * Translate the origin of the coordinate system of @fo_doc.
1165  *
1166  * @x and @y are measured in the old coordinate system.
1167  **/
1168 void
fo_doc_translate(FoDoc * fo_doc,gdouble x,gdouble y)1169 fo_doc_translate (FoDoc        *fo_doc,
1170 		  gdouble        x,
1171 		  gdouble        y)
1172 {
1173   FO_DOC_GET_CLASS (fo_doc)->translate (fo_doc,
1174 					x,
1175 					y);
1176 }
1177 
1178 /**
1179  * fo_doc_clip_default:
1180  * @fo_doc: #FoDoc.
1181  *
1182  * Use the current path of @fo_doc as its clipping path.
1183  **/
1184 void
fo_doc_clip_default(FoDoc * fo_doc)1185 fo_doc_clip_default (FoDoc        *fo_doc)
1186 {
1187 #if defined(LIBFO_DEBUG)
1188   g_log (G_LOG_DOMAIN,
1189 	 G_LOG_LEVEL_DEBUG,
1190 	 _("%s does not have a 'clip' function."),
1191 	 fo_object_sprintf (fo_doc));
1192 #endif
1193 }
1194 
1195 /**
1196  * fo_doc_clip:
1197  * @fo_doc: #FoDoc.
1198  *
1199  * Use the current path of @fo_doc as its clipping path.
1200  **/
1201 void
fo_doc_clip(FoDoc * fo_doc)1202 fo_doc_clip (FoDoc        *fo_doc)
1203 {
1204   FO_DOC_GET_CLASS (fo_doc)->clip (fo_doc);
1205 }
1206 
1207 /**
1208  * fo_doc_save_default:
1209  * @fo_doc: #FoDoc.
1210  *
1211  * Save the current graphics state of @fo_doc.
1212  **/
1213 void
fo_doc_save_default(FoDoc * fo_doc)1214 fo_doc_save_default (FoDoc        *fo_doc)
1215 {
1216 #if defined(LIBFO_DEBUG)
1217   g_log (G_LOG_DOMAIN,
1218 	 G_LOG_LEVEL_DEBUG,
1219 	 _("%s does not have a 'save' function."),
1220 	 fo_object_sprintf (fo_doc));
1221 #endif
1222 }
1223 
1224 /**
1225  * fo_doc_save:
1226  * @fo_doc: #FoDoc.
1227  *
1228  * Save the current graphics state of @fo_doc.
1229  **/
1230 void
fo_doc_save(FoDoc * fo_doc)1231 fo_doc_save (FoDoc        *fo_doc)
1232 {
1233   FO_DOC_GET_CLASS (fo_doc)->save (fo_doc);
1234 }
1235 
1236 /**
1237  * fo_doc_restore_default:
1238  * @fo_doc: #FoDoc.
1239  *
1240  * Restore the most recently saved graphics state of @fo_doc.
1241  **/
1242 void
fo_doc_restore_default(FoDoc * fo_doc)1243 fo_doc_restore_default (FoDoc        *fo_doc)
1244 {
1245 #if defined(LIBFO_DEBUG)
1246   g_log (G_LOG_DOMAIN,
1247 	 G_LOG_LEVEL_DEBUG,
1248 	 _("%s does not have a 'restore' function."),
1249 	 fo_object_sprintf (fo_doc));
1250 #endif
1251 }
1252 
1253 /**
1254  * fo_doc_restore:
1255  * @fo_doc: #FoDoc.
1256  *
1257  * Restore the most recently saved graphics state of @fo_doc.
1258  **/
1259 void
fo_doc_restore(FoDoc * fo_doc)1260 fo_doc_restore (FoDoc        *fo_doc)
1261 {
1262   FO_DOC_GET_CLASS (fo_doc)->restore (fo_doc);
1263 }
1264 
1265 /**
1266  * fo_doc_line_to_default:
1267  * @fo_doc: #FoDoc.
1268  * @x:      X-coordinate of the new current point.
1269  * @y:      Y-coordinate of the new current point.
1270  *
1271  * Draw a line from the current point to another point.
1272  **/
1273 void
fo_doc_line_to_default(FoDoc * fo_doc,gdouble x G_GNUC_UNUSED,gdouble y G_GNUC_UNUSED)1274 fo_doc_line_to_default (FoDoc        *fo_doc,
1275 			gdouble        x G_GNUC_UNUSED,
1276 			gdouble        y G_GNUC_UNUSED)
1277 {
1278 #if defined(LIBFO_DEBUG)
1279   g_log (G_LOG_DOMAIN,
1280 	 G_LOG_LEVEL_DEBUG,
1281 	 _("%s does not have a 'line_to' function."),
1282 	 fo_object_sprintf (fo_doc));
1283 #endif
1284 }
1285 
1286 /**
1287  * fo_doc_line_to:
1288  * @fo_doc: #FoDoc.
1289  * @x:      X-coordinate of the new current point.
1290  * @y:      Y-coordinate of the new current point.
1291  *
1292  * Draw a line from the current point to another point.
1293  **/
1294 void
fo_doc_line_to(FoDoc * fo_doc,gdouble x,gdouble y)1295 fo_doc_line_to (FoDoc        *fo_doc,
1296 		gdouble        x,
1297 		gdouble        y)
1298 {
1299   FO_DOC_GET_CLASS (fo_doc)->line_to (fo_doc,
1300 				      x,
1301 				      y);
1302 }
1303 
1304 /**
1305  * fo_doc_move_to_default:
1306  * @fo_doc: #FoDoc.
1307  * @x:      X-coordinate of the new current point.
1308  * @y:      Y-coordinate of the new current point.
1309  *
1310  * Set the current point of @fo_doc to (@x, @y).
1311  **/
1312 void
fo_doc_move_to_default(FoDoc * fo_doc,gdouble x G_GNUC_UNUSED,gdouble y G_GNUC_UNUSED)1313 fo_doc_move_to_default (FoDoc        *fo_doc,
1314 			gdouble        x G_GNUC_UNUSED,
1315 			gdouble        y G_GNUC_UNUSED)
1316 {
1317 #if defined(LIBFO_DEBUG)
1318   g_log (G_LOG_DOMAIN,
1319 	 G_LOG_LEVEL_DEBUG,
1320 	 _("%s does not have a 'move_to' function."),
1321 	 fo_object_sprintf (fo_doc));
1322 #endif
1323 }
1324 
1325 /**
1326  * fo_doc_move_to:
1327  * @fo_doc: #FoDoc.
1328  * @x:      X-coordinate of the new current point.
1329  * @y:      Y-coordinate of the new current point.
1330  *
1331  * Set the current point of @fo_doc to (@x, @y).
1332  **/
1333 void
fo_doc_move_to(FoDoc * fo_doc,gdouble x,gdouble y)1334 fo_doc_move_to (FoDoc        *fo_doc,
1335 		gdouble        x,
1336 		gdouble        y)
1337 {
1338   FO_DOC_GET_CLASS (fo_doc)->move_to (fo_doc,
1339 				      x,
1340 				      y);
1341 }
1342 
1343 /**
1344  * fo_doc_line_stroked_default:
1345  * @fo_doc: #FoDoc.
1346  * @x0: X-coordinate of the start of the line.
1347  * @y0: Y-coordinate of the start of the line.
1348  * @x1: X-coordinate of the end of the line.
1349  * @y1: Y-coordinate of the end of the line.
1350  *
1351  * Draw a line from (@x0,@y0) to (@x1,@y1).
1352  **/
1353 void
fo_doc_line_stroked_default(FoDoc * fo_doc,gdouble x0 G_GNUC_UNUSED,gdouble y0 G_GNUC_UNUSED,gdouble x1 G_GNUC_UNUSED,gdouble y1 G_GNUC_UNUSED)1354 fo_doc_line_stroked_default (FoDoc *fo_doc,
1355 			     gdouble x0 G_GNUC_UNUSED,
1356 			     gdouble y0 G_GNUC_UNUSED,
1357 			     gdouble x1 G_GNUC_UNUSED,
1358 			     gdouble y1 G_GNUC_UNUSED)
1359 {
1360 #if defined(LIBFO_DEBUG)
1361   g_log (G_LOG_DOMAIN,
1362 	 G_LOG_LEVEL_DEBUG,
1363 	 _("%s does not have a 'rect_stroked' function."),
1364 	 fo_object_sprintf (fo_doc));
1365 #endif
1366 }
1367 
1368 /**
1369  * fo_doc_line_stroked:
1370  * @fo_doc: #FoDoc.
1371  * @x0: X-coordinate of the start of the line.
1372  * @y0: Y-coordinate of the start of the line.
1373  * @x1: X-coordinate of the end of the line.
1374  * @y1: Y-coordinate of the end of the line.
1375  *
1376  * Draw a line from (@x0,@y0) to (@x1,@y1).
1377  **/
1378 void
fo_doc_line_stroked(FoDoc * fo_doc,gdouble x0,gdouble y0,gdouble x1,gdouble y1)1379 fo_doc_line_stroked (FoDoc *fo_doc,
1380 		     gdouble x0,
1381 		     gdouble y0,
1382 		     gdouble x1,
1383 		     gdouble y1)
1384 {
1385   FO_DOC_GET_CLASS (fo_doc)->line_stroked (fo_doc,
1386 					   x0,
1387 					   y0,
1388 					   x1,
1389 					   y1);
1390 }
1391 
1392 
1393 /**
1394  * fo_doc_rect_stroked_default:
1395  * @fo_doc: #FoDoc.
1396  * @x:      X-coordinate of the lower-left corner of the rectangle.
1397  * @y:      Y-coordinate of the lower-left corner of the rectangle.
1398  * @width:  Width of the rectangle.
1399  * @height: Height of the rectangle.
1400  *
1401  * Draw an outline rectangle.
1402  **/
1403 void
fo_doc_rect_stroked_default(FoDoc * fo_doc,gdouble x G_GNUC_UNUSED,gdouble y G_GNUC_UNUSED,gdouble width G_GNUC_UNUSED,gdouble height G_GNUC_UNUSED)1404 fo_doc_rect_stroked_default (FoDoc        *fo_doc,
1405 			     gdouble        x G_GNUC_UNUSED,
1406 			     gdouble        y G_GNUC_UNUSED,
1407 			     gdouble        width G_GNUC_UNUSED,
1408 			     gdouble        height G_GNUC_UNUSED)
1409 {
1410 #if defined(LIBFO_DEBUG)
1411   g_log (G_LOG_DOMAIN,
1412 	 G_LOG_LEVEL_DEBUG,
1413 	 _("%s does not have a 'rect_stroked' function."),
1414 	 fo_object_sprintf (fo_doc));
1415 #endif
1416 }
1417 
1418 /**
1419  * fo_doc_rect_stroked:
1420  * @fo_doc: #FoDoc.
1421  * @x:      X-coordinate of the lower-left corner of the rectangle.
1422  * @y:      Y-coordinate of the lower-left corner of the rectangle.
1423  * @width:  Width of the rectangle.
1424  * @height: Height of the rectangle.
1425  *
1426  * Draw an outline rectangle.
1427  **/
1428 void
fo_doc_rect_stroked(FoDoc * fo_doc,gdouble x,gdouble y,gdouble width,gdouble height)1429 fo_doc_rect_stroked (FoDoc        *fo_doc,
1430 		     gdouble        x,
1431 		     gdouble        y,
1432 		     gdouble        width,
1433 		     gdouble        height)
1434 {
1435   FO_DOC_GET_CLASS (fo_doc)->rect_stroked (fo_doc,
1436 					   x,
1437 					   y,
1438 					   width,
1439 					   height);
1440 }
1441 
1442 /**
1443  * fo_doc_rect_filled_default:
1444  * @fo_doc: #FoDoc.
1445  * @x:      X-coordinate of the lower-left corner of the rectangle.
1446  * @y:      Y-coordinate of the lower-left corner of the rectangle.
1447  * @width:  Width of the rectangle.
1448  * @height: Height of the rectangle.
1449  *
1450  * Draw a filled rectangle.
1451  **/
1452 void
fo_doc_rect_filled_default(FoDoc * fo_doc,gdouble x G_GNUC_UNUSED,gdouble y G_GNUC_UNUSED,gdouble width G_GNUC_UNUSED,gdouble height G_GNUC_UNUSED)1453 fo_doc_rect_filled_default (FoDoc        *fo_doc,
1454 			     gdouble        x G_GNUC_UNUSED,
1455 			     gdouble        y G_GNUC_UNUSED,
1456 			     gdouble        width G_GNUC_UNUSED,
1457 			     gdouble        height G_GNUC_UNUSED)
1458 {
1459 #if defined(LIBFO_DEBUG)
1460   g_log (G_LOG_DOMAIN,
1461 	 G_LOG_LEVEL_DEBUG,
1462 	 _("%s does not have a 'rect_filled' function."),
1463 	 fo_object_sprintf (fo_doc));
1464 #endif
1465 }
1466 
1467 /**
1468  * fo_doc_rect_filled:
1469  * @fo_doc: #FoDoc.
1470  * @x:      X-coordinate of the lower-left corner of the rectangle.
1471  * @y:      Y-coordinate of the lower-left corner of the rectangle.
1472  * @width:  Width of the rectangle.
1473  * @height: Height of the rectangle.
1474  *
1475  * Draw a filled rectangle.
1476  **/
1477 void
fo_doc_rect_filled(FoDoc * fo_doc,gdouble x,gdouble y,gdouble width,gdouble height)1478 fo_doc_rect_filled (FoDoc        *fo_doc,
1479 		    gdouble        x,
1480 		    gdouble        y,
1481 		    gdouble        width,
1482 		    gdouble        height)
1483 {
1484   FO_DOC_GET_CLASS (fo_doc)->rect_filled (fo_doc,
1485 					  x,
1486 					  y,
1487 					  width,
1488 					  height);
1489 }
1490 
1491 /**
1492  * fo_doc_fill_default:
1493  * @fo_doc: #FoDoc.
1494  *
1495  * Fill the interior of the path of @fo_doc with the current fill color.
1496  **/
1497 void
fo_doc_fill_default(FoDoc * fo_doc)1498 fo_doc_fill_default (FoDoc        *fo_doc)
1499 {
1500 #if defined(LIBFO_DEBUG)
1501   g_log (G_LOG_DOMAIN,
1502 	 G_LOG_LEVEL_DEBUG,
1503 	 _("%s does not have a 'fill' function."),
1504 	 fo_object_sprintf (fo_doc));
1505 #endif
1506 }
1507 
1508 /**
1509  * fo_doc_fill:
1510  * @fo_doc: #FoDoc.
1511  *
1512  * Fill the interior of the path of @fo_doc with the current fill color.
1513  **/
1514 void
fo_doc_fill(FoDoc * fo_doc)1515 fo_doc_fill (FoDoc        *fo_doc)
1516 {
1517   FO_DOC_GET_CLASS (fo_doc)->fill (fo_doc);
1518 }
1519 
1520 /**
1521  * fo_doc_stroke_default:
1522  * @fo_doc: #FoDoc.
1523  *
1524  * Stroke the path of @fo_doc and clear the path.
1525  **/
1526 void
fo_doc_stroke_default(FoDoc * fo_doc)1527 fo_doc_stroke_default (FoDoc        *fo_doc)
1528 {
1529 #if defined(LIBFO_DEBUG)
1530   g_log (G_LOG_DOMAIN,
1531 	 G_LOG_LEVEL_DEBUG,
1532 	 _("%s does not have a 'stroke' function."),
1533 	 fo_object_sprintf (fo_doc));
1534 #endif
1535 }
1536 
1537 /**
1538  * fo_doc_stroke:
1539  * @fo_doc: #FoDoc.
1540  *
1541  * Stroke the path of @fo_doc and clear the path.
1542  **/
1543 void
fo_doc_stroke(FoDoc * fo_doc)1544 fo_doc_stroke (FoDoc        *fo_doc)
1545 {
1546   FO_DOC_GET_CLASS (fo_doc)->stroke (fo_doc);
1547 }
1548 
1549 /**
1550  * fo_doc_place_image_default:
1551  * @fo_doc:   #FoDoc in which to place image
1552  * @fo_image: #FoImage
1553  * @x:        X-offset
1554  * @y:        Y-offset
1555  * @xscale:   Scale to apply to X dimension of @image
1556  * @yscale:   Scale to apply to Y dimension of @image
1557  *
1558  * Places @fo_image in @fo_doc at position given by @x and @y with image
1559  * scaled by @xscale and @yscale.
1560  **/
1561 void
fo_doc_place_image_default(FoDoc * fo_doc,FoImage * image G_GNUC_UNUSED,gdouble x G_GNUC_UNUSED,gdouble y G_GNUC_UNUSED,gdouble xscale G_GNUC_UNUSED,gdouble yscale G_GNUC_UNUSED)1562 fo_doc_place_image_default (FoDoc   *fo_doc,
1563 			    FoImage *image G_GNUC_UNUSED,
1564 			    gdouble   x G_GNUC_UNUSED,
1565 			    gdouble   y G_GNUC_UNUSED,
1566 			    gdouble   xscale G_GNUC_UNUSED,
1567 			    gdouble   yscale G_GNUC_UNUSED)
1568 {
1569 #if defined(LIBFO_DEBUG)
1570   g_log (G_LOG_DOMAIN,
1571 	 G_LOG_LEVEL_DEBUG,
1572 	 _("%s does not have a 'place_image' function."),
1573 	 fo_object_sprintf (fo_doc));
1574 #endif
1575 }
1576 
1577 /**
1578  * fo_doc_place_image:
1579  * @fo_doc:   #FoDoc in which to place image
1580  * @fo_image: #FoImage
1581  * @x:        X-offset
1582  * @y:        Y-offset
1583  * @xscale:   Scale to apply to X dimension of @image
1584  * @yscale:   Scale to apply to Y dimension of @image
1585  *
1586  * Places @fo_image in @fo_doc at position given by @x and @y with image
1587  * scaled by @xscale and @yscale.
1588  **/
1589 void
fo_doc_place_image(FoDoc * fo_doc,FoImage * fo_image,gdouble x,gdouble y,gdouble xscale,gdouble yscale)1590 fo_doc_place_image (FoDoc   *fo_doc,
1591 		    FoImage *fo_image,
1592 		    gdouble   x,
1593 		    gdouble   y,
1594 		    gdouble   xscale,
1595 		    gdouble   yscale)
1596 {
1597   FO_DOC_GET_CLASS (fo_doc)->place_image (fo_doc,
1598 					  fo_image,
1599 					  x,
1600 					  y,
1601 					  xscale,
1602 					  yscale);
1603 }
1604 
1605 /**
1606  * fo_doc_render_layout_lines_default:
1607  * @fo_doc:      #FoDoc for which to render lines.
1608  * @area_layout: #FoArea containing lines.
1609  * @x:           X-offset
1610  * @y:           Y-offset
1611  *
1612  * Renders the lines in @area_layout at position (@x, @y) on current
1613  * page of @fo_doc.
1614  **/
1615 void
fo_doc_render_layout_lines_default(FoDoc * fo_doc,FoArea * area_layout G_GNUC_UNUSED,gdouble x G_GNUC_UNUSED,gdouble y G_GNUC_UNUSED)1616 fo_doc_render_layout_lines_default (FoDoc   *fo_doc,
1617 				    FoArea  *area_layout G_GNUC_UNUSED,
1618 				    gdouble   x G_GNUC_UNUSED,
1619 				    gdouble   y G_GNUC_UNUSED)
1620 {
1621 #if defined(LIBFO_DEBUG)
1622   g_log (G_LOG_DOMAIN,
1623 	 G_LOG_LEVEL_DEBUG,
1624 	 _("%s does not have a 'render_layout_lines' function."),
1625 	 fo_object_sprintf (fo_doc));
1626 #endif
1627 }
1628 
1629 /**
1630  * fo_doc_render_layout_lines:
1631  * @fo_doc:      #FoDoc for which to render lines.
1632  * @area_layout: #FoArea containing lines.
1633  * @x:           X-offset
1634  * @y:           Y-offset
1635  *
1636  * Renders the lines in @area_layout at position (@x, @y) on current
1637  * page of @fo_doc.
1638  **/
1639 void
fo_doc_render_layout_lines(FoDoc * fo_doc,FoArea * area_layout,gdouble x,gdouble y)1640 fo_doc_render_layout_lines (FoDoc   *fo_doc,
1641 			    FoArea  *area_layout,
1642 			    gdouble   x,
1643 			    gdouble   y)
1644 {
1645   FO_DOC_GET_CLASS (fo_doc)->render_layout_lines (fo_doc,
1646 						  area_layout,
1647 						  x,
1648 						  y);
1649 }
1650 
1651 /**
1652  * fo_doc_render_layout_default:
1653  * @fo_doc:      #FoDoc to which to render.
1654  * @area_layout: #FoArea containing lines.
1655  * @x:           X-offset
1656  * @y:           Y-offset
1657  *
1658  * Renders @area_layout at position (@x, @y) on current page of
1659  * @fo_doc.
1660  **/
1661 void
fo_doc_render_layout_default(FoDoc * fo_doc,FoArea * area_layout G_GNUC_UNUSED,gdouble x G_GNUC_UNUSED,gdouble y G_GNUC_UNUSED)1662 fo_doc_render_layout_default (FoDoc   *fo_doc,
1663 			      FoArea  *area_layout G_GNUC_UNUSED,
1664 			      gdouble   x G_GNUC_UNUSED,
1665 			      gdouble   y G_GNUC_UNUSED)
1666 {
1667 #if defined(LIBFO_DEBUG)
1668   g_log (G_LOG_DOMAIN,
1669 	 G_LOG_LEVEL_DEBUG,
1670 	 _("%s does not have a 'render_layout' function."),
1671 	 fo_object_sprintf (fo_doc));
1672 #endif
1673 }
1674 
1675 /**
1676  * fo_doc_render_layout:
1677  * @fo_doc:      #FoDoc to which to render.
1678  * @area_layout: #FoArea containing lines.
1679  * @x:           X-offset
1680  * @y:           Y-offset
1681  *
1682  * Renders @area_layout at position (@x, @y) on current page of
1683  * @fo_doc.
1684  **/
1685 void
fo_doc_render_layout(FoDoc * fo_doc,FoArea * area_layout,gdouble x,gdouble y)1686 fo_doc_render_layout (FoDoc   *fo_doc,
1687 		      FoArea  *area_layout,
1688 		      gdouble   x,
1689 		      gdouble   y)
1690 {
1691   FO_DOC_GET_CLASS (fo_doc)->render_layout (fo_doc,
1692 					    area_layout,
1693 					    x,
1694 					    y);
1695 }
1696