From: <ai...@us...> - 2009-03-16 17:16:14
|
Revision: 9748 http://plplot.svn.sourceforge.net/plplot/?rev=9748&view=rev Author: airwin Date: 2009-03-16 17:15:49 +0000 (Mon, 16 Mar 2009) Log Message: ----------- AWI for Alban Rochel. Patch to make glyph sizes consistent between qtwidget and the remaining qt devices. This works on both the AR and AWI platforms, but on the AWI platform (Debian Lenny, 64-bit, cmake-2.6.0, with Qt-4.5.0 as downloaded from Trolltech), the consistent glyph size for all qt devices is still about 20 per cent too small compared to the equivalent pngcairo results and also 20 per cent too small compared to AR screenshots of qt device driver results taken earlier. So this patch seems to be a step in the right direction, but we are not there yet. Modified Paths: -------------- trunk/drivers/qt.cpp trunk/drivers/qt.h Modified: trunk/drivers/qt.cpp =================================================================== --- trunk/drivers/qt.cpp 2009-03-16 15:29:08 UTC (rev 9747) +++ trunk/drivers/qt.cpp 2009-03-16 17:15:49 UTC (rev 9748) @@ -253,6 +253,7 @@ plP_fci2hex(unicode, &fontWeight, PL_FCI_WEIGHT); QFont f; + f.setPointSizeF(currentFontSize*currentFontScale<4 ? 4 : currentFontSize*currentFontScale); switch(fontFamily) @@ -313,7 +314,7 @@ yOffset=0.; xOffset=0.; - currentFontSize=chrht*p.device()->logicalDpiY()/25.4*fontScalingFactor; + currentFontSize=chrht*72./25.4*1.5; currentFontScale=1.; underlined=false; overlined=false; @@ -424,11 +425,11 @@ QMatrix rotShearMatrix(cos(rotation)*stride, -sin(rotation)*stride, cos(rotation)*sin(shear)+sin(rotation)*cos(shear), -sin(rotation)*sin(shear)+cos(rotation)*cos(shear), 0., 0.); m_painterP->setWorldMatrix(rotShearMatrix, true); + m_painterP->translate(-txt->just*xOffset*m_painterP->device()->logicalDpiY()/picDpi, 0.); m_painterP->drawPicture(0., 0., picText); m_painterP->setWorldMatrix(QMatrix()); - } void QtPLDriver::setColor(int r, int g, int b, double alpha) @@ -657,14 +658,14 @@ b.setStyle(Qt::SolidPattern); m_painterP->setBrush(b); m_painterP->setRenderHint(QPainter::Antialiasing, true); - int res=DPI/25.4*1000.; - setDotsPerMeterX(res); - setDotsPerMeterY(res); +// int res=DPI/25.4/downscale*1000.; +// setDotsPerMeterX(res); +// setDotsPerMeterY(res); // Let's fill the background m_painterP->fillRect(0, 0, width(), height(), QBrush(Qt::black)); - fontScalingFactor=1.; +// fontScalingFactor=1.; } QtRasterDevice::~QtRasterDevice() @@ -710,13 +711,6 @@ pls->dev_unicode = 1; // want unicode initQtApp(false); - /*$$ these variables must be 1 so that we can process - unicode text on our own */ - - - /*$$ if you want to use the hershey font only for the - symbols set this to 1 - pls->dev_hrshsym = 1; */ // Shamelessly copied on the Cairo stuff :) if (pls->xlength <= 0 || pls->ylength <= 0) @@ -739,6 +733,8 @@ plP_setpxl(DPI/25.4/((QtRasterDevice*)(pls->dev))->downscale, DPI/25.4/((QtRasterDevice*)(pls->dev))->downscale); + ((QtRasterDevice*)(pls->dev))->setResolution(pls->xpmm); + /* Initialize family file info */ plFamInit(pls); @@ -916,7 +912,7 @@ setSize(QSize(m_dWidth, m_dHeight)); m_painterP=NULL; - fontScalingFactor=1.; +// fontScalingFactor=1.; } QtSVGDevice::~QtSVGDevice() @@ -1041,7 +1037,7 @@ m_dHeight=pageRect().height(); m_painterP=NULL; - fontScalingFactor=1.; +// fontScalingFactor=1.; } QtEPSDevice::~QtEPSDevice() @@ -1211,7 +1207,7 @@ pic=new QPicture; m_painterP->begin(pic); - fontScalingFactor=0.6; +// fontScalingFactor=1.;//0.6; } @@ -1490,7 +1486,10 @@ plP_setphy((PLINT) 0, (PLINT) (plsc->xlength / tabWidget->downscale), (PLINT) 0, (PLINT) (plsc->ylength / tabWidget->downscale)); - plP_setpxl(DPI/25.4/tabWidget->downscale, DPI/25.4/tabWidget->downscale); + QPicture temp; + QPainter tempPainter(&temp); + + plP_setpxl(temp.logicalDpiX()/25.4/tabWidget->downscale, temp.logicalDpiY()/25.4/tabWidget->downscale); pls->color = 1; /* Is a color device */ pls->plbuf_write=0; @@ -1523,7 +1522,7 @@ delete ((QtPLTabWidget*)pls->dev); pls->dev=NULL; - closeQtApp(); +// closeQtApp(); } #endif Modified: trunk/drivers/qt.h =================================================================== --- trunk/drivers/qt.h 2009-03-16 15:29:08 UTC (rev 9747) +++ trunk/drivers/qt.h 2009-03-16 17:15:49 UTC (rev 9748) @@ -98,7 +98,7 @@ double yOffset; double xOffset; - double fontScalingFactor;// To have a nice font size on qtwidget +// double fontScalingFactor;// To have a nice font size on qtwidget QPainter* m_painterP; }; @@ -117,6 +117,12 @@ void savePlot(); + virtual void setResolution(double dotsPerMM) + { + setDotsPerMeterX(dotsPerMM*1000.*downscale); + setDotsPerMeterY(dotsPerMM*1000.*downscale); + } + protected: char format[5]; QString fileName; @@ -309,6 +315,8 @@ protected: void newTab(); QList<QtPLWidget*> widgets; + + double resolution; }; #endif This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |