Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>If you have to target both the screen and a printer, then you need to make some decisions about your approach before deciding which rendering engine to use. Here are some possibilities:</p> <ol> <li>Lay out in screen units and do a best-possible approximation for the printer.</li> <li>Lay out in printer units and do a best-possible approximation for the screen.</li> <li>Lay out in a theoretical high-resolution space and do a best-possible approximation for both printer and screen.</li> </ol> <p>In all cases, the best-possible approximation might be done by very careful approximations at each step, which can give the highest fidelity for each device at the cost of accuracy in matching, or you could render to bitmap and scale to the device, which gives lower fidelity but a the best-possible approximation to the other space.</p> <p>I've done hard-core print preview with GDI. It's hard, but do-able for regular layouts. But if you're handling arbitrary transforms, especially rotations other than +/-90 degrees, it's nigh impossible.</p> <p>It's very easy to make subtle mistakes and believe that the measurements you get back are wrong. </p> <ul> <li><p>Font hinting makes font scaling non-linear when the stroke widths are on the same order of magnitude as the dpi, so if you get a width <code>w</code> for some text, then the width if you double the size of the font may not be exactly <code>2*w</code>.</p></li> <li><p>Font substitution is common in many printer drivers. Even if you choose a TrueType or OpenType font you might <em>not</em> get the same font on the printer as you got on the screen.</p></li> <li><p>Non-square pixels are common in some printers. These can mess up even decent rasterizers when you're doing something that's not axis-aligned.</p></li> <li><p>Kerning can be surprising. Don't assume that width('a') + width('b') == width("ab").</p></li> <li><p>Rounding errors are easy to make. Sometimes you have to know the rounding rules used by the underlying rasterizer.</p></li> <li><p>Measuring in the wrong context is too common. Don't try to measure in a screen context and apply a transform to get to printer units. If you need printer units, measure in the printer context.</p></li> </ul> <p>I'm of the opinion today that if you need just print preview, then you should lay out in printer units to a bitmap that's sized to the page, and scale the bitmap to the screen based on the ratios of the DPIs. That's the easiest thing to do and it gives good results. But it's not clear if a good hardcopy and print-preview is really what you're after.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload