Pango tab stops are incorrect if set in Pango units in Win32
Submitted by Ian Puleston
Link to original bug (#580508)
Description
Please describe the problem: If pango_tab_array_new() is used to create tab stops given in Pango units and they are then applied to a PangoLayout for a GtkPrintContext using pango_layout_set_tabs(), the tabs do not print in the correct positions if printing from a Win32 app - they are way smaller than they should be. The same problem does not show up with exactly the same code in Linux and in that case the tabs print in the correct positions.
If tab stops are created in pixels with the correct pixel size for the print device (or scaled for the print device's resolution) then they print correctly in both Windows and Linux.
I suspect that for Pango units in Win32 the tab positions are being calculated using device units for the print device (typically 300dpi or 600dpi for a printer) rather than Pango font "device" units (i.e. points - 72dpi).
Steps to reproduce: I will attach a small program to demonstrate the problem:
- Compile and run the app in Linux. Click both test buttons and the printout is identical in both cases (with tab positions at 1", 1.5", 4.5" and 5").
- Compile and run the app in Windows.
- Click the button labeled for tab stops in pixels and the printout is the same as was printed in Linux.
- Click the button labeled for tab stops in pango units and the printout is incorrect with the tab positions way too close together.
Actual results: Tab positions in printed output are way too close together.
Expected results: Just like what happens in Linux.
Does this happen every time? Yep.
Other information:
Version: 1.22.x