Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Wrong rotation of characters if label is first rendered with cairo and then by agg (fastcgi, fontcache, cairo) #5338

Closed
wants to merge 1 commit into from

Conversation

tbonfort
Copy link
Member

@tbonfort tbonfort commented Oct 19, 2016

Issue: Characters in labels are rotated incorrecly
Environment: Mapserver: 7.x built from source in FastCGI-mode

How to reproduce:

  1. Start a fresh mapserver process
  2. Request a map with labels and where labels are using the "ANGLE"-keyword with driver CARIO/PDF
  3. Request the same map from the same fastcgi-process using the driver AGG/PNG

Example:

  1. Create the following mapfile. Update FONT/FONTSET to a valid truetype font
MAP
  NAME "WMS"
  EXTENT 0 0 200 200 

  OUTPUTFORMAT
    NAME pdf
    DRIVER "CAIRO/PDF"
    MIMETYPE "application/x-pdf"
    IMAGEMODE RGB
    EXTENSION "pdf"
    FORMATOPTION "GEO_ENCODING=ISO32000"
  END

  OUTPUTFORMAT
    NAME png
    DRIVER "AGG/PNG"
    MIMETYPE "image/png"
    IMAGEMODE RGBA
    EXTENSION "png" 
  END

  RESOLUTION 300
  FONTSET "fonts/fonts.list"
  PROJECTION
    "init=epsg:3006"
  END
  WEB
    METADATA  
      "wms_enable_request" "*"
      "wms_srs" "epsg:3006"
    END
  END

LAYER
  NAME "lname"
  EXTENT 0 0 200 200 
  TYPE POINT
        FEATURE
                POINTS
                        100 100
                END
                TEXT "Gavle"
        END
  STATUS ON
  SIZEUNITS pixels

  CLASS
    NAME "name"
    LABEL
      FONT "arial"
      TYPE truetype
      SIZE 12
      ANGLE 60  
        POSITION ul
    END
  END
END
END
  1. Restart apache (to get a clean mapserver fastcgi process)
  2. Request WMS map using caiiro:
GET /mapserv?map=../maps/simple.map&SERVICE=WMS&VERSION=1.1.1&REQUEST=GetMap&BBOX=0,0,200,200&SRS=EPSG:3006&WIDTH=400&HEIGHT=400&LAYERS=lname&FORMAT=application/x-pdf

image

  1. Request WMS map using agg
GET /mapserv?map=../maps/simple.map&SERVICE=WMS&VERSION=1.1.1&REQUEST=GetMap&BBOX=0,0,200,200&SRS=EPSG:3006&WIDTH=400&HEIGHT=400&LAYERS=lname&FORMAT=image/png

image

Notice the rotated characters.
The opposite, by first using agg-driver followed by cario does not seem to have any issues.

@tbonfort tbonfort self-assigned this Oct 19, 2016
@tbonfort
Copy link
Member

tbonfort commented Oct 19, 2016

The attached patch fixes the issue, apparently without major side-effects as that part of the code is pretty-well tested by travis.

@tbonfort
Copy link
Member

tbonfort commented Oct 19, 2016

Might be related to https://lists.freedesktop.org/archives/cairo/2016-January/027175.html . I'm not sure if this a bug in cairo, or if we (mapserver) were incorrectly loading the freetype glyphs.

@foggel
Copy link
Author

foggel commented Oct 20, 2016

The patch resolves both the simplified case given in the bug report and the original problem we had with our basemap WMS.

The quick response from mapserve-dev is impressive! Thanks.

@tbonfort
Copy link
Member

tbonfort commented Dec 5, 2016

applied to branch-7-0 in 82ec23b

@tbonfort tbonfort closed this Dec 5, 2016
@tbonfort tbonfort deleted the issues/5338-ft-cairo-agg branch Dec 5, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants