What is more: Tc is in unscaled text units, only subject to scaling by Th, not
Tfs. I think this needs to be:
return (dWidth * m_matrix.front().GetReal() * this->GetFontSize() +
this->GetFontCharSpace())
* (this->GetFontScale() / 100.0);
Cheers,
Christopher
The MathWorks GmbH | Friedlandstr.18 | 52064 Aachen | District Court Aachen |
HRB 8082 | Managing Directors: Bertrand Dissler, Steven D. Barbo, Jeanne O’Keefe
From: Christophe <[email protected]>
Sent: Tuesday, May 11, 2021 9:15
To: Michal Sudolsky <[email protected]>
Cc: [email protected]
Subject: Re: [Podofo-users] PdfFontMetricsFreetype::CharWidth
Hello Michal,
My remark was relative to class PdfFontMetricsFreetype, not
PdfFontMetricsObject.
But, in your patch, you also divide font char space by 100, twice:
return (dWidth * m_matrix.front().GetReal() + this->GetFontCharSpace() / 100.0)
* this->GetFontSize() * this->GetFontScale() / 100.0;
Are you sure of that ?
In PDF format, the font char space (Tc) is given in PDF units, not in percent.
Does it mean, we have to transform this Tc value into percent before affecting
the m_fFontCharSpace variable ? If yes, how shall we do that ?
Thank you for your help
Christophe
Le lun. 10 mai 2021 à 20:54, Michal Sudolsky
<[email protected]<mailto:[email protected]>> a écrit :
On Mon, May 10, 2021 at 12:23 PM Christophe
<[email protected]<mailto:[email protected]>> wrote:
Hello all,
I have a doubt relative to this method definition:
double PdfFontMetricsFreetype::CharWidth( unsigned char c ) const
{
double dWidth = m_vecWidth[static_cast<unsigned int>(c)];
return dWidth * static_cast<double>(this->GetFontSize() *
this->GetFontScale() / 100.0) / 1000.0 +
static_cast<double>( this->GetFontSize() * this->GetFontScale() / 100.0
* this->GetFontCharSpace() / 100.0);
}
The Char Space is divided by 100.0 and I think it is an error as it is not the
case for PdfFontMetricsObject::CharWidth, nor for
PdfFontMetricsObject::CharWidth.
It is intended to be divided by 100. See comment above that function:
/** Set the character spacing of this metrics object
* \param fCharSpace character spacing in percent
*/
inline void SetFontCharSpace( float fCharSpace );
What do you think ?
Thank you
Christophe
_______________________________________________
Podofo-users mailing list
[email protected]<mailto:[email protected]>
https://lists.sourceforge.net/lists/listinfo/podofo-users<https://lists.sourceforge.net/lists/listinfo/podofo-users>
_______________________________________________
Podofo-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/podofo-users