本文整理汇总了C++中scaledFontPixelSize函数的典型用法代码示例。如果您正苦于以下问题:C++ scaledFontPixelSize函数的具体用法?C++ scaledFontPixelSize怎么用?C++ scaledFontPixelSize使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了scaledFontPixelSize函数的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: scaledFontPixelSize
void QgsComposerUtils::drawText( QPainter *painter, const QRectF &rect, const QString &text, const QFont &font, const QColor &color, const Qt::AlignmentFlag halignment, const Qt::AlignmentFlag valignment, const int flags )
{
if ( !painter )
{
return;
}
//upscale using FONT_WORKAROUND_SCALE
//ref: http://osgeo-org.1560.x6.nabble.com/Multi-line-labels-and-font-bug-td4157152.html
QFont textFont = scaledFontPixelSize( font );
QRectF scaledRect( rect.x() * FONT_WORKAROUND_SCALE, rect.y() * FONT_WORKAROUND_SCALE,
rect.width() * FONT_WORKAROUND_SCALE, rect.height() * FONT_WORKAROUND_SCALE );
painter->save();
painter->setFont( textFont );
if ( color.isValid() )
{
painter->setPen( color );
}
double scaleFactor = 1.0 / FONT_WORKAROUND_SCALE;
painter->scale( scaleFactor, scaleFactor );
painter->drawText( scaledRect, halignment | valignment | flags, text );
painter->restore();
}
示例2: scaledFontPixelSize
double QgsLayoutUtils::fontAscentMM( const QFont &font )
{
//upscale using FONT_WORKAROUND_SCALE
//ref: http://osgeo-org.1560.x6.nabble.com/Multi-line-labels-and-font-bug-td4157152.html
QFont metricsFont = scaledFontPixelSize( font );
QFontMetricsF fontMetrics( metricsFont );
return ( fontMetrics.ascent() / FONT_WORKAROUND_SCALE );
}
示例3: scaledFontPixelSize
void QgsComposerItem::drawText( QPainter* p, double x, double y, const QString& text, const QFont& font ) const
{
QFont textFont = scaledFontPixelSize( font );
p->save();
p->setFont( textFont );
double scaleFactor = 1.0 / FONT_WORKAROUND_SCALE;
p->scale( scaleFactor, scaleFactor );
p->drawText( QPointF( x * FONT_WORKAROUND_SCALE, y * FONT_WORKAROUND_SCALE ), text );
p->restore();
}
示例4: scaledFontPixelSize
void QgsDecorationGrid::drawText( QPainter* p, double x, double y, const QString& text, const QFont& font ) const
{
QFont textFont = scaledFontPixelSize( font );
p->save();
p->setFont( textFont );
p->setPen( QColor( 0, 0, 0 ) ); //draw text always in black
double scaleFactor = 1.0 / FONT_WORKAROUND_SCALE;
p->scale( scaleFactor, scaleFactor );
p->drawText( QPointF( x * FONT_WORKAROUND_SCALE, y * FONT_WORKAROUND_SCALE ), text );
p->restore();
}