Opened 19 years ago

Closed 13 years ago

#1383 closed defect (fixed)

Truetype font text not wrapping when using WRAP command

Reported by: andrew.seales@… Owned by: sdlime
Priority: high Milestone:
Component: MapServer C Library Version: 4.6
Severity: normal Keywords:
Cc: mapserver@…

Description (last modified by tbonfort)

Using the WRAP command inside a mapfile to specify which symbol a text string
will wrap on truetype fonts doesn't seem to work. Using bitmap fonts seems to
work fine. Here is a sample mapfile layer:

LAYER
    NAME "Copyright"
  
    METADATA
        "wms_title" "Copyright"
        "wms_srs"   "EPSG:27700"
        "wms_extent"    "0.0 0.0 700000.0 1300000.0"
    END

    STATUS DEFAULT
    TRANSFORM FALSE
    TYPE ANNOTATION

    POSTLABELCACHE TRUE

    FEATURE
        POINTS
        2 5
        END
        TEXT '© Crown copyright/database right 2004.|An Ordnance
Survey/EDINA supplied service.'
    END

    CLASS

        STYLE
            SYMBOL "copy_box_os"
            COLOR 255 255 255
            SIZE 30
        END
        LABEL
            BACKGROUNDCOLOR 0 255 255
            COLOR 0 0 0
            #OUTLINECOLOR 255 255 255
            TYPE TRUETYPE
            FONT arial
            SIZE 7
            ANTIALIAS TRUE
            PARTIALS TRUE
            POSITION CR
            WRAP "|"

        END
    END

    MINSCALE 1000.0
    MAXSCALE 25000.0
    PROJECTION
        "init=epsg:27700"
    END
END # End copyright

In the above example, the text string displayed on the map should be:
© Crown copyright/database right 2004.
An Ordnance Survey/EDINA supplied service.

But this is displayed instead:
© Crown copyright/database right 2004.|An Ordnance Survey/EDINA supplied service.

Attachments (1)

wrapfix.patch (490 bytes ) - added by andrew.seales@… 19 years ago.
This is a patch which adds code to the truetype font section of mapgd.c to wrap the text

Download all attachments as: .zip

Change History (7)

by andrew.seales@…, 19 years ago

Attachment: wrapfix.patch added

This is a patch which adds code to the truetype font section of mapgd.c to wrap the text

comment:1 by dmorissette, 19 years ago

Cc: dmorissette@… added

comment:2 by mapserver@…, 19 years ago

Cc: mapserver@… added

comment:3 by sdlime, 19 years ago

Status: newassigned
Wrapping is handled in maplabel.c (for all drivers) and not in mapgd.c. Not
aware of any changes in that code that changed but will have a look ASAP...

Steve

comment:4 by sdlime, 19 years ago

Funny, works fine with bitmap fonts makes me think something changed under the
hood with GD and/or Freetype.

Steve 

comment:5 by sdlime, 19 years ago

Ok, I see the problem. Since you're drawing the label outside of the cache it is
not added being processed for the WRAP operator. The patch supplied isn't quite
what we want because for cached truetype labels since you need the text
converted to support multilines well before actually being rendered. The patch
does work but causes the WRAP processing to happen twice in that case. Perhaps
that's not a huge deal. Might be better to move this logic into msDrawShape
someplace so that the label is "right" before passing to any labeling code. I'll
have to think about that. 

The workaround at the moment would be to place the copyright layer at the end of
the mapfile and remove the postlabelcache option...

Steve

comment:6 by tbonfort, 13 years ago

Description: modified (diff)
Resolution: fixed
Status: assignedclosed

wrapping occurs ahead of rendering time now. This happened around 5.2.

Note: See TracTickets for help on using tickets.