mirror of
https://github.com/gnustep/libs-back.git
synced 2025-04-22 23:42:16 +00:00
Fixed scale of metrics by using unitsPerEm and pointSize.
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/back/trunk@37084 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
3f417045cc
commit
0027a8bd8b
2 changed files with 19 additions and 10 deletions
|
@ -1,3 +1,8 @@
|
|||
2013-09-17 Ivan Vucica <ivan@vucica.net>
|
||||
|
||||
* Source/opal/OpalFontInfo.m:
|
||||
Fixed scale of metrics by using unitsPerEm and pointSize.
|
||||
|
||||
2013-09-17 Ivan Vucica <ivan@vucica.net>
|
||||
|
||||
* configure:
|
||||
|
|
|
@ -50,6 +50,8 @@
|
|||
CGFontRef face;
|
||||
CGSize maximumAdvancementCG;
|
||||
CGRect fontBBoxCG;
|
||||
CGFloat unitsPerEm;
|
||||
CGFloat pointSize;
|
||||
|
||||
if (![super setupAttributes])
|
||||
{
|
||||
|
@ -94,16 +96,18 @@
|
|||
// (internal discussion between ivucica and ericwa, 2013-09-17)
|
||||
lineHeight = CGFontGetLeading(face) + CGFontGetAscent(face) - CGFontGetDescent(face);
|
||||
|
||||
CGFloat pointSize = matrix[0]; // from GSFontInfo
|
||||
ascender /= pointSize;
|
||||
descender /= pointSize;
|
||||
xHeight /= pointSize;
|
||||
fontBBox.origin.x /= pointSize;
|
||||
fontBBox.origin.y /= pointSize;
|
||||
fontBBox.size.width /= pointSize;
|
||||
fontBBox.size.height /= pointSize;
|
||||
maximumAdvancement.width /= pointSize;
|
||||
maximumAdvancement.height /= pointSize;
|
||||
pointSize = matrix[0]; // from GSFontInfo
|
||||
unitsPerEm = CGFontGetUnitsPerEm(face);
|
||||
#define ratio pointSize / unitsPerEm
|
||||
ascender *= ratio; // ascender = scaleEmToUnits(ascender) * pointSize;
|
||||
descender *= ratio;
|
||||
xHeight *= ratio;
|
||||
fontBBox.origin.x *= ratio;
|
||||
fontBBox.origin.y *= ratio;
|
||||
fontBBox.size.width *= ratio;
|
||||
fontBBox.size.height *= ratio;
|
||||
maximumAdvancement.width *= ratio;
|
||||
maximumAdvancement.height *= ratio;
|
||||
|
||||
#if 0
|
||||
// Get default font options
|
||||
|
|
Loading…
Reference in a new issue