[cairo-bugs] [Bug 28100] New: Font option CAIRO_HINT_METRICS_OFF unhonoured on win32 (and a fix)

bugzilla-daemon at freedesktop.org bugzilla-daemon at freedesktop.org
Fri May 14 01:41:25 PDT 2010


https://bugs.freedesktop.org/show_bug.cgi?id=28100

           Summary: Font option CAIRO_HINT_METRICS_OFF unhonoured on win32
                    (and a fix)
           Product: cairo
           Version: 1.9.7
          Platform: Other
        OS/Version: Windows (All)
            Status: NEW
          Severity: normal
          Priority: medium
         Component: win32 backend
        AssignedTo: cairo-bugs at cairographics.org
        ReportedBy: richard.n.procter at gmail.com
         QAContact: cairo-bugs at cairographics.org


Created an attachment (id=35646)
 --> (https://bugs.freedesktop.org/attachment.cgi?id=35646)
Proposed fix

Note: This was mistakenly logged as pango bug #615909 - see there for the test
program. 

Running the test program gives this output: 

$ ./textsize.exe ON
MINGW32_NT-5.0 LOTUS 1.0.11(0.46/3/2) 2009-07-11 17:46 i686 Msys
Cairo version: 1.8.8
Pango version: 1.26.2
Hint metrics set to: ON
Font: 'arial 12px'
Layout text: 'The origin of thinking is some perplexity, confusion or doubt.'
Ink extents: (0,3) 326x11
Logical extents: (0,0) 327x15

$ ./textsize.exe OFF
MINGW32_NT-5.0 LOTUS 1.0.11(0.46/3/2) 2009-07-11 17:46 i686 Msys
Cairo version: 1.8.8
Pango version: 1.26.2
Hint metrics set to: OFF
Font: 'arial 12px'
Layout text: 'The origin of thinking is some perplexity, confusion or doubt.'
Ink extents: (0,3) 326x11
Logical extents: (0,0) 327x15

The logical extents are unaffected by the cario hint metrics font option
setting on win32.

According to Behdad Esfahbod, this is a known problem on win32, where hint
metrics is stuck at CAIRO_HINT_METRICS_ON (whereas on OS X it is stuck at
CAIRO_HINT_METRICS_OFF).

This is significant because turning off hint metrics is a useful way to ensure
consistent layout sizes cross-platform, which is a requirement for
cross-platform diagramming applications.  

The problem looks to be a typo in cairo-win32-font.c, comparing 
CAIRO_HINT_METRICS_OFF against options.hint_style, 
rather than options.hint_metrics. Once fixed with the attached patch the 
backend looks to do the Right Thing (and is a useful reminder for me 
that C enums are macros in drag!).  

best, 
Richard. 

PS. And I'll take the opportunity here to thank everyone responsible for cairo.
I am no expert on such libraries, but I have found it a pleasure to understand
and to use due to the clear separation of concerns, the elegant and powerful
interface, and the largely impeccable documentation to boot.

-- 
Configure bugmail: https://bugs.freedesktop.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the QA contact for the bug.
You are the assignee for the bug.


More information about the cairo-bugs mailing list