21 : mFontColor( QColor( 0, 0, 0 ) )
23 , mWmsLegendSize( 50, 25 )
24 , mRasterStrokeColor( Qt::black )
40 return 1 / ( mMmPerMapUnit * ( mDpi / 25.4 ) );
45 mMmPerMapUnit = 1 / mapUnitsPerPixel / ( mDpi / 25.4 );
55 list = stringToSplt.split(
wrapChar() );
59 #define FONT_WORKAROUND_SCALE 10 //scale factor for upscaling fontsize and downscaling painter 67 p->setFont( textFont );
69 p->scale( scaleFactor, scaleFactor );
75 void QgsLegendSettings::drawText( QPainter *p,
const QRectF &rect,
const QString &text,
const QFont &font, Qt::AlignmentFlag halignment, Qt::AlignmentFlag valignment,
int flags )
const 83 p->setFont( textFont );
85 p->scale( scaleFactor, scaleFactor );
86 p->drawText( scaledRect, halignment | valignment | flags, text );
93 QFont scaledFont = font;
95 scaledFont.setPixelSize( pixelSize );
101 return ( pointSize * 0.3527 );
107 QFontMetricsF fontMetrics( metricsFont );
114 QFontMetricsF fontMetrics( metricsFont );
121 QFontMetricsF fontMetrics( metricsFont );
128 QFontMetricsF fontMetrics( metricsFont );
double fontHeightCharacterMM(const QFont &font, QChar c) const
Returns the font height of a character in millimeters.
double fontAscentMillimeters(const QFont &font) const
Returns the font ascent in Millimeters (considers upscaling and downscaling with FONT_WORKAROUND_SCAL...
double mapUnitsPerPixel() const
Returns the factor of map units per pixel for symbols with size given in map units calculated by mDpi...
void setMapUnitsPerPixel(double mapUnitsPerPixel)
Sets the mMmPerMapUnit calculated by mapUnitsPerPixel mostly taken from the map settings.
As part of the API refactoring and improvements which landed in the Processing API was substantially reworked from the x version This was done in order to allow much of the underlying Processing framework to be ported into c
double fontDescentMillimeters(const QFont &font) const
Returns the font descent in Millimeters (considers upscaling and downscaling with FONT_WORKAROUND_SCA...
QStringList splitStringForWrapping(const QString &stringToSplt) const
Splits a string using the wrap char taking into account handling empty wrap char which means no wrapp...
void setMargin(Side side, double margin)
QgsLegendStyle & rstyle(QgsLegendStyle::Style s)
Returns reference to modifiable style.
#define FONT_WORKAROUND_SCALE
QFont & rfont()
Modifiable reference to font.
double pixelFontSize(double pointSize) const
Calculates font to from point size to pixel size.
QFont scaledFontPixelSize(const QFont &font) const
Returns a font where size is in pixel and font size is upscaled with FONT_WORKAROUND_SCALE.
void drawText(QPainter *p, double x, double y, const QString &text, const QFont &font) const
Draws Text.
double textWidthMillimeters(const QFont &font, const QString &text) const
Returns the font width in millimeters (considers upscaling and downscaling with FONT_WORKAROUND_SCALE...