Skip to content

Commit

Permalink
Use antialiasing to make sure the path is drawn without artifacts, dr…
Browse files Browse the repository at this point in the history
…aw text using painter path too to avoid problems with buffer and text not being lined up correctly.

git-svn-id: http://svn.osgeo.org/qgis/branches/symbology-ng-branch@11314 c8812cc2-4d05-0410-92ff-de0c093fc19c
  • Loading branch information
wonder committed Aug 9, 2009
1 parent b03ae30 commit 6e6a970
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions src/plugins/labeling/pallabeling.cpp
Expand Up @@ -445,6 +445,8 @@ void PalLabeling::doLabeling(QPainter* painter, QgsRectangle extent)
std::cout << "LABELING work: " << t.elapsed() << "ms ... labels# " << labels->size() << std::endl;
t.restart();

painter->setRenderHint(QPainter::Antialiasing);

// draw the labels
std::list<LabelPosition*>::iterator it = labels->begin();
for ( ; it != labels->end(); ++it)
Expand Down Expand Up @@ -550,9 +552,15 @@ void PalLabeling::drawLabel( pal::LabelPosition* label, QPainter* painter, const
else
{
// we're drawing real label
painter->setFont( lyr.textFont );
/*painter->setFont( lyr.textFont );
painter->setPen( lyr.textColor );
painter->drawText(0,0, txt);
painter->drawText((0,0, txt);*/

QPainterPath path;
path.addText(0,0, lyr.textFont, text);
painter->setPen( Qt::NoPen );
painter->setBrush( lyr.textColor );
painter->drawPath(path);
}
painter->restore();

Expand Down

0 comments on commit 6e6a970

Please sign in to comment.