Re: Cairo's Arial font smaller than Arial in browsers

Simon Sapin <[email protected]>
Newsgroups gmane.comp.lib.cairo
Message-ID <[email protected]>
Le 24/03/2013 15:11, Ken Resander a écrit :
>     cairo_set_font_size(cr, 12);   // <<<<< assume this is in pts

It’s not. It’s in cairo’s "user coordinates", which default to pixels 
when drawing on screen without a scale or other transformation matrix.


> <p class="some_class" style="font-family:Arial;font-size:12pt;">This is
> text</p>
> </body>

In CSS units, 12pt equals 16px
http://www.w3.org/TR/css3-values/#absolute-lengths


> The three browsers showed the text in exactly the same way. The height
> of the capital letter T was 12 pixels for the browsers and only 8 pixels
> for the Cairo output.
>
> Why is this?

The "font size" (both in cairo and in CSS) defines the height of the "em 
box". It’s quite possible that a glyph such as T is a bit smaller than 
its em box.


Try either using the px unit in CSS, or multiplying cairo font sizes by 4/3.

-- 
Simon Sapin
-- 
cairo mailing list
[email protected]
http://lists.cairographics.org/mailman/listinfo/cairo
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.