mirror of
https://github.com/gnustep/libs-back.git
synced 2025-06-01 09:42:17 +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
5b21bf465d
commit
8b2171d644
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>
|
2013-09-17 Ivan Vucica <ivan@vucica.net>
|
||||||
|
|
||||||
* configure:
|
* configure:
|
||||||
|
|
|
@ -50,6 +50,8 @@
|
||||||
CGFontRef face;
|
CGFontRef face;
|
||||||
CGSize maximumAdvancementCG;
|
CGSize maximumAdvancementCG;
|
||||||
CGRect fontBBoxCG;
|
CGRect fontBBoxCG;
|
||||||
|
CGFloat unitsPerEm;
|
||||||
|
CGFloat pointSize;
|
||||||
|
|
||||||
if (![super setupAttributes])
|
if (![super setupAttributes])
|
||||||
{
|
{
|
||||||
|
@ -94,16 +96,18 @@
|
||||||
// (internal discussion between ivucica and ericwa, 2013-09-17)
|
// (internal discussion between ivucica and ericwa, 2013-09-17)
|
||||||
lineHeight = CGFontGetLeading(face) + CGFontGetAscent(face) - CGFontGetDescent(face);
|
lineHeight = CGFontGetLeading(face) + CGFontGetAscent(face) - CGFontGetDescent(face);
|
||||||
|
|
||||||
CGFloat pointSize = matrix[0]; // from GSFontInfo
|
pointSize = matrix[0]; // from GSFontInfo
|
||||||
ascender /= pointSize;
|
unitsPerEm = CGFontGetUnitsPerEm(face);
|
||||||
descender /= pointSize;
|
#define ratio pointSize / unitsPerEm
|
||||||
xHeight /= pointSize;
|
ascender *= ratio; // ascender = scaleEmToUnits(ascender) * pointSize;
|
||||||
fontBBox.origin.x /= pointSize;
|
descender *= ratio;
|
||||||
fontBBox.origin.y /= pointSize;
|
xHeight *= ratio;
|
||||||
fontBBox.size.width /= pointSize;
|
fontBBox.origin.x *= ratio;
|
||||||
fontBBox.size.height /= pointSize;
|
fontBBox.origin.y *= ratio;
|
||||||
maximumAdvancement.width /= pointSize;
|
fontBBox.size.width *= ratio;
|
||||||
maximumAdvancement.height /= pointSize;
|
fontBBox.size.height *= ratio;
|
||||||
|
maximumAdvancement.width *= ratio;
|
||||||
|
maximumAdvancement.height *= ratio;
|
||||||
|
|
||||||
#if 0
|
#if 0
|
||||||
// Get default font options
|
// Get default font options
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue