Base 14 fonts have hardcoded underline and strikeout thickness set to zero.
On enlarged texts this looks really bad. I am sending how it looks in
attachment when using Helvetica and when using some freetype font.

In PdfFontMetricsObject.cpp is almost something sane:

    // Try to fine some sensible values
    m_dUnderlineThickness = 1.0;
    m_dUnderlinePosition  = 0.0;
    m_dStrikeOutThickness = m_dUnderlinePosition;
    m_dStrikeOutPosition  = m_dAscent / 2.0;

But why to set strikeout thickness to underline position? This looks like
typo, here should be m_dStrikeOutThickness = m_dUnderlineThickness. But
thickness 1.0 would give real thickness equal to font size which is too
large it will cover text entirely. Better would be something like 0.05.

But seems unfortunately thicknesses are overwritten in PdfFontMetricsBase14
constructor to zero:

    m_dUnderlineThickness = 0.0;
    m_dStrikeOutThickness = 0.0;

Another problem is that positions of underline and strikeout are little
off. Underline should be "more" under text.

I noticed that these metrics for base 14 fonts like ascent and descent are
quite different that what is seen in freetype fonts regarding spaces above
and below text itself.

This gives more natural look:

    // Set default values for strikeout, in case the font has no direct
values
    m_dUnderlineThickness = 0.05;
    m_dUnderlinePosition  = -2 * m_dUnderlineThickness;
    m_dStrikeOutThickness = 0.05;
    m_dStrikeOutPosition  = m_dAscent / 2.0 - 2 * m_dStrikeOutThickness;

Another thing this constructor "PdfFont* PdfDocument::CreateFont( const
char* pszFontName, bool bBold, bool bItalic, bool bSymbolCharset, ...)"
takes arguments whether to select bold or italic font but this does not
work for base 14 fonts but instead is needed to select different font name
like for example Helvetica-Bold, Helvetica-Italic or Helvetica-BoldItalic
so maybe it should detect such cases in case base 14 fonts are selected so
I can call "...CreateFont("Helvetica", true, false)" and I will get
Helvetica-Bold in pdf.
_______________________________________________
Podofo-users mailing list
Podofo-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/podofo-users

Reply via email to