WYSIWYG Printing: GooCanvas Reference Manual

## WYSIWYG Printing WYSIWYG Printing — how to use the canvas to create accurate printed output. |

## WYSIWYG Printing

### Screen Resolution

The GooCanvas “resolution-x” and “resolution-y” properties must be set correctly. They both default to 96dpi, which corresponds to a typical monitor. To get a more accurate figure you might be able to use `gdk_screen_get_resolution()`, but this isn't always guaranteed to be correct. If accuracy is very important a method should be provided for the user to calibrate the screen.

### Units

The GooCanvas “units” property must be set to one of `GTK_UNIT_MM`, `GTK_UNIT_POINTS` or `GTK_UNIT_INCH` (it defaults to `GTK_UNIT_PIXEL`). All values used within the canvas are assumed to be in the specified units, including font sizes.

### Font Sizes

Absolute font sizes must be used (to prevent the fonts being mistakenly scaled by Pango as well as by GooCanvas). To specify absolute font sizes add "px" after the font size, e.g. instead of "Sans 9" use "Sans 9px".

Font sizes must be converted to the units used by the canvas. For example, if a 9 point "Sans" font is desired but “units” is set to `GTK_UNIT_MM`, then the size must first be converted into millimeters: (9 / 72) * 25.4 = 3.175mm. So the font used would be "Sans 3.175px".

### Example Code

The units-demo application that comes with the GooCanvas source code demonstrates the use of different units and absolute font sizes.