[Qgis-developer] Re: Fonts in composer

Radim Blazek radim.blazek at gmail.com
Thu May 18 10:50:10 EDT 2006


On 5/18/06, Radim Blazek <radim.blazek at gmail.com> wrote:
> Heureka (maybe)!
>
> Because Qt4 QPainter supports floating point numbers I could
> remove QgsComposition::mScale (set to 1 for now).
> Consequently the font scaling factor QgsComposition::psFontScaleFactor
> became wrong. I tried to fix the problem with scaling again
> and hopefully I found solution, basicaly:
>
>    QFont font;
>    font.setPointSize ( size );
>    QFontMetrics metrics ( font );
>    if ( plotStyle() == QgsComposition::Postscript )
>    {
>        font.setPointSizeF ( metrics.ascent() * 72.0 /
> mComposition->resolution() );
>    }
>    painter.setFont ( font );
>    painter.drawText ( x, y, text );
>
> That means the size of font in Postscript must be set to metrics.ascent()
> of original font size.
>
> I tested on Linux with many fonts and different sizes and the font height
> seems to be almost always correct and text length is mostly correct.
>
> Tom, could you test on Mac?

I was too optimistic about floating point support, they are still using
d->cpen.width() to set with in PS. How can they release such a shit?!
PDF is the same. Is it possible that nobody wants to print a line < 1 mm?

Radim



More information about the Qgis-developer mailing list