[mapserver-commits] r10782 - trunk/mapserver

svn at osgeo.org svn at osgeo.org
Tue Dec 7 11:23:41 EST 2010


Author: tbonfort
Date: 2010-12-07 08:23:41 -0800 (Tue, 07 Dec 2010)
New Revision: 10782

Modified:
   trunk/mapserver/mapagg.cpp
   trunk/mapserver/mapcairo.c
Log:
make font rendering start on integer coordinates to avoid blurred text

Modified: trunk/mapserver/mapagg.cpp
===================================================================
--- trunk/mapserver/mapagg.cpp	2010-12-07 15:05:26 UTC (rev 10781)
+++ trunk/mapserver/mapagg.cpp	2010-12-07 16:23:41 UTC (rev 10782)
@@ -234,7 +234,7 @@
 
    const mapserver::glyph_cache* glyph;
    int unicode;
-   cache->m_feng.hinting(true);
+   //cache->m_feng.hinting(true);
    cache->m_feng.height(style->size);
    cache->m_feng.resolution(96);
    cache->m_feng.flip_y(true);
@@ -245,19 +245,19 @@
    mtx *= mapserver::trans_affine_rotation(-style->rotation);
    mtx *= mapserver::trans_affine_translation(x, y);
 
-   double fx = x, fy = y;
+   double fx = MS_NINT(x), fy = MS_NINT(y);
    const char *utfptr = text;
    mapserver::path_storage glyphs;
 
    //first render all the glyphs to a path
    while (*utfptr) {
       if (*utfptr == '\r') {
-         fx = x;
+         fx = MS_NINT(x);
          utfptr++;
          continue;
       }
       if (*utfptr == '\n') {
-         fx = x;
+         fx = MS_NINT(x);
          fy += ceil(style->size * AGG_LINESPACE);
          utfptr++;
          continue;
@@ -266,7 +266,7 @@
       glyph = cache->m_fman.glyph(unicode);
       ;
       if (glyph) {
-         cache->m_fman.add_kerning(&fx, &fy);
+         //cache->m_fman.add_kerning(&fx, &fy);
     	 cache->m_fman.init_embedded_adaptors(glyph, fx, fy);
          mapserver::conv_transform<font_curve_type, mapserver::trans_affine> trans_c(m_curves, mtx);
          glyphs.concat_path(trans_c);

Modified: trunk/mapserver/mapcairo.c
===================================================================
--- trunk/mapserver/mapcairo.c	2010-12-07 15:05:26 UTC (rev 10781)
+++ trunk/mapserver/mapcairo.c	2010-12-07 16:23:41 UTC (rev 10782)
@@ -477,7 +477,7 @@
     cairo_set_font_size(r->cr,style->size*96/72.0);
 
     cairo_save(r->cr);
-    cairo_translate(r->cr,x,y);
+    cairo_translate(r->cr,MS_NINT(x),MS_NINT(y));
     if(style->rotation != 0.0)
        cairo_rotate(r->cr, -style->rotation);
 



More information about the mapserver-commits mailing list