mirror of
https://github.com/qgis/QGIS.git
synced 2025-02-27 00:33:48 -05:00
Use different print font scaling factor for Mac.
Define factor in header file so it can be adjusted with one edit. git-svn-id: http://svn.osgeo.org/qgis/trunk/qgis@4041 c8812cc2-4d05-0410-92ff-de0c093fc19c
This commit is contained in:
parent
71a0e7f62b
commit
adc6c5c69c
@ -158,7 +158,7 @@ void QgsComposerLabel::draw ( QPainter & painter )
|
||||
// In any case, each font scales in in different way even if painter.scale()
|
||||
// is used instead of font size!!! -> Postscript is never exactly the same as
|
||||
// in preview.
|
||||
double factor = 2.45;
|
||||
double factor = QgsComposition::psFontScaleFactor();
|
||||
|
||||
double pssize = factor * 72.0 * mFont.pointSizeFloat() / mComposition->resolution();
|
||||
double psscale = pssize/size;
|
||||
|
@ -178,8 +178,7 @@ void QgsComposerMap::draw ( QPainter *painter, QgsRect *extent, QgsMapToPixel *t
|
||||
if ( vector->labelOn() ) {
|
||||
double fontScale = 25.4 * mFontScale * mComposition->scale() / 72;
|
||||
if ( plotStyle() == QgsComposition::Postscript ) {
|
||||
// I have no idea why 2.54 - it is an empirical value
|
||||
fontScale = 2.54 * 72.0 / mComposition->resolution();
|
||||
fontScale = QgsComposition::psFontScaleFactor() * 72.0 / mComposition->resolution();
|
||||
}
|
||||
vector->drawLabels ( painter, extent, transform, device, fontScale );
|
||||
}
|
||||
|
@ -220,7 +220,7 @@ QRect QgsComposerScalebar::render ( QPainter *p )
|
||||
// In any case, each font scales in in different way even if painter.scale()
|
||||
// is used instead of font size!!! -> Postscript is never exactly the same as
|
||||
// in preview.
|
||||
double factor = 2.45;
|
||||
double factor = QgsComposition::psFontScaleFactor();
|
||||
|
||||
double pssize = factor * 72.0 * mFont.pointSizeFloat() / mComposition->resolution();
|
||||
double psscale = pssize/size;
|
||||
|
@ -210,13 +210,12 @@ QRect QgsComposerVectorLegend::render ( QPainter *p )
|
||||
|
||||
// Fonts for rendering
|
||||
|
||||
// I have no idea why 2.54 - it is an empirical value
|
||||
// TODO: For output to Postscript the font must be scaled. But how?
|
||||
// The factor is an empirical value.
|
||||
// In any case, each font scales in in different way even if painter.scale()
|
||||
// is used instead of font size!!! -> Postscript is never exactly the same as
|
||||
// in preview.
|
||||
double psFontFactor = 2.45;
|
||||
double psFontFactor = QgsComposition::psFontScaleFactor();
|
||||
|
||||
double psTitleSize = psFontFactor * 72.0 * mTitleFont.pointSizeFloat() / mComposition->resolution();
|
||||
double psSectionSize = psFontFactor * 72.0 * mSectionFont.pointSizeFloat() / mComposition->resolution();
|
||||
|
@ -99,6 +99,21 @@ public:
|
||||
Postscript // Fonts need different scaling!
|
||||
};
|
||||
|
||||
/** \brief Font scaling factor for PostScript output
|
||||
*
|
||||
* For output to Postscript the font must be scaled. But how?
|
||||
* The factor is an empirical value. In any case, each font scales
|
||||
* in in different way even if painter.scale() is used instead of
|
||||
* font size!!! -> Postscript is never exactly the same as in preview.
|
||||
*/
|
||||
static const double psFontScaleFactor() {
|
||||
#ifdef Q_OS_MACX
|
||||
return 1.85;
|
||||
#else
|
||||
return 2.45; // I have no idea why 2.45 - it is an empirical value
|
||||
#endif
|
||||
}
|
||||
|
||||
/** \brief Composition ID */
|
||||
int id ( void );
|
||||
|
||||
@ -290,7 +305,7 @@ private:
|
||||
/** \brief Temporary item used as pointer to new objecs which must be drawn */
|
||||
QCanvasItem *mNewCanvasItem;
|
||||
|
||||
/** \breif Resolution in DPI */
|
||||
/** \brief Resolution in DPI */
|
||||
int mResolution;
|
||||
|
||||
/** \brief canvas scale */
|
||||
|
Loading…
x
Reference in New Issue
Block a user