<html>
<head>
<style>
.hmmessage P
{
margin:0px;
padding:0px
}
body.hmmessage
{
font-size: 10pt;
font-family:Verdana
}
</style>
</head>
<body class='hmmessage'>
Hi Andreas,<BR>
I think the problem with the size discrepency results from the scaling factor used in TTCFont computeForm:<BR>
<BR>
FreeType divides the pixel size by the units per em , but TTCFont divides by (ttcDescription ascender - ttcDescription descender).<BR>
<BR>
Try making TTCFont>>computeForm: use the unitsPerEm value instead, it appears to give the correct size glyphs. i.e. ...<BR>
<BR>computeForm: char<BR>
| ttGlyph scale |<BR> scale := self pixelSize asFloat / ttcDescription unitsPerEm.<BR> Scale ifNotNil: [scale := Scale * scale].<BR>
<BR>
etc.<BR>
<BR>
This is from the FreeType manual page <A href="http://freetype.sourceforge.net/freetype2/docs/glyphs/glyphs-2.html">http://freetype.sourceforge.net/freetype2/docs/glyphs/glyphs-2.html</A> ...<BR>
<BR>
<quote><BR>
In creating the glyph outlines, a type designer uses an imaginary square called the <EM>EM square</EM>. Typically, the EM square can be thought of as a tablet on which the characters are drawn. The square's size, i.e., the number of grid units on its sides, is very important for two reasons:<BR>
<UL>
<LI>
It is the reference used to scale the outlines to a given text dimension. For example, a size of 12pt at 300x300 dpi corresponds to 12*300/72 = 50 pixels. This is the size the EM square would appear on the output device if it was rendered directly. In other words, scaling from grid units to pixels uses the formula:<BR>
<CENTER><TT>pixel_size = point_size * resolution / 72</TT><BR><TT>pixel_coord = grid_coord * pixel_size / EM_size</TT> </CENTER>
<P><BR></LI></UL>
</quote><BR>
<BR>
Line spacing is a separate issue; it is there that the ascender, descender, and other vertical metrics become important .<BR>
<BR>
Cheers,<BR>
Andy<BR>
<BR>.<BR><BR><BR> <BR>> Date: Fri, 28 Aug 2009 20:22:19 -0700<BR>> From: andreas.raab@gmx.de<BR>> To: squeak-dev@lists.squeakfoundation.org<BR>> Subject: [squeak-dev] Cuis font sizes<BR>> <BR>> Hi Juan -<BR>> <BR>> This is mostly to Juan but others might be able to help as well. I <BR>> noticed that the Cuis fonts disagree in their pixel sizes significantly <BR>> with that we get from the plain DejaVu true type fonts in Squeak. A bit <BR>> of math reveals that at the (assumed) screen resolution of 96dpi a 12pt <BR>> font should result in 16px high font (12*96/72 see Eqn. 3 in [1]). The <BR>> corresponding Bitmap DejaVu 12pt font, however, is 19px high which would <BR>> mean a screen resolution of 114dpi (19*72/12).<BR>> <BR>> Is this choice intentional? Unfortunately, none of the pixel sizes for <BR>> Bitmap DejaVu correspond exactly to a point size when assuming 96dpi.<BR>> <BR>> The reason this is causing me grief is that I am trying to set up a <BR>> mechanism for allowing people to drop the DejaVu fonts into their images <BR>> and have any glyphs not part of the cuis fonts rendered in DejaVu <BR>> truetype instead. I can probably get the truetype rendering to spit out <BR>> a precise pixel size to match it but I think it'd be good if we had <BR>> clarity on how these pixel sizes came into being.<BR>> <BR>> Any insights appreciated!<BR>> <BR>> Cheers,<BR>> - Andreas<BR>> <BR>> [1] http://www.emdpi.com/emsquare.html<BR>> <BR><br /><hr />View your other email accounts from your Hotmail inbox. <a href='http://clk.atdmt.com/UKM/go/167688463/direct/01/' target='_new'>Add them now.</a></body>
</html>