Opened 14 years ago

Last modified 14 years ago

#3202 new defect

mapscript: mapObj.save("mapfile.map") will not save a fontset if fontset is created by code.

Reported by: getiem Owned by: sdlime
Priority: normal Milestone: 5.6 release
Component: MapServer C Library Version: svn-trunk (development)
Severity: normal Keywords:
Cc:

Description

Saving the mapfile from mapscript (C#) where all settings are done by code will result in a mapfile where not fontset is set.

if below code is in your mapscript (C#)

mapObj pngBasis = new mapObj(null);
pngBasis.fontset.fonts.set("arial", fontFileArial);
pngBasis.save("mapfile.map");

The font set in the second line, will not be in your saved mapfile, or anywhere else. So the saved mapfile is not usable.

Not really a problem if you normally have a fonts.txt together with your mapfile, but if you save your mapfile dynamically on places where no fonts.txt is available this will be nasty.

Bug tested in versions 5.2, 5.4.2, 5.6b5

Change History (2)

comment:1 by sdlime, 14 years ago

But you're adding an element to the fontset and the contents of a fontset was never saved by the "save" method anyway. All that methods saves is the name of the fontset text file. I'm not sure what could be saved in this case.

Perhaps you're looking for a fontset.save()?

Steve

comment:2 by getiem, 14 years ago

I am aware that it was never saved that way. I am also aware of the fontset.save() not beeing in the code.

So to have the fonts set you are now bound to a fonts.txt where all the paths are absolute (if you do'nt want to copy the arial.ttf yourself along the mapfile and the fontsfile) So if on one machine it is: C:\windows\fonts and on the other machine its C:\winnt\fonts you will have to make 2 fonts files and have to clearly state which one to use.

In my case, i can set those paths dynamically.

The reason i'm posting this as bug, is that I was looking to the analogy with the symbols. I create my symbols programmatically, and add them to the symbolset of my mapobj. Then I have two ways to save the symbols: mapObj.symbolset.save() to a symbols.txt or just with mapObj.save() to a mapfile.map where the symbols are put inline in the mapfile. With fontset both are not available.

At the moment, its no bother to me directly, since workarounds exist. But to make more consistancy, it could be nice to have this implemented.

Note: See TracTickets for help on using tickets.