Bug 267 - Font for labels is not applied for all classes
: Font for labels is not applied for all classes
Status: REOPENED
: MapLab
SECT (Studio)
: 3.0
: PC Windows 2000
: P2 normal
: ---
Assigned To:
:
:
:
:
:
  Show dependency treegraph
 
Reported: 2004-03-05 13:22 by
Modified: 2004-03-05 14:27 (History)


Attachments


Note

You need to log in before you can comment on or make changes to this bug.


Description From 2004-03-05 13:22:27
I have created an SLD document with 2 classes.
The first class has the following font:
monospace, oblique, 20

The second class:
monospace, bold, 10

But both classes show the same font in the Map image.

SLD:
<StyledLayerDescriptor version="1.0.0">
<NamedLayer>
<NAME>Gemeentes</NAME>
<UserStyle>
<FeatureTypeStyle>
<Rule>
<Filter><PropertyIsEqualTo><PropertyName>GEMNAAM</PropertyName><Literal>Deurne</Literal></PropertyIsEqualTo></Filter>
<PolygonSymbolizer>
<Fill>
<CssParameter name="fill">#0000b9</CssParameter>
<GraphicFill>
<Graphic>
<Size>1</Size>
<Mark>
<WellKnownName>cross</WellKnownName>
<Fill>
<CssParameter name="fill">#0000b9</CssParameter>
</Fill>
</Mark>
</Graphic>
</GraphicFill>
</Fill>
</PolygonSymbolizer>
<TextSymbolizer>
<Label>GEMNAAM</Label>
<Font>
<CssParameter name="font-family">monospace</CssParameter>
<CssParameter name="font-style">oblique</CssParameter>
<CssParameter name="font-size">20</CssParameter>
</Font>
<Fill>
<CssParameter name="fill">#000000</CssParameter>
</Fill>
<LabelPlacement>
<PointPlacement>
<AnchorPoint>
<AnchorPointX>0.5</AnchorPointX>
<AnchorPointY>0.5</AnchorPointY>
</AnchorPoint>
</PointPlacement>
</LabelPlacement>
</TextSymbolizer>
</Rule>
<Rule>
<Filter><PropertyIsEqualTo><PropertyName>GEMNAAM</PropertyName><Literal>Amsterdam</Literal></PropertyIsEqualTo></Filter>
<PolygonSymbolizer>
<Fill>
<CssParameter name="fill">#00dd00</CssParameter>
<GraphicFill>
<Graphic>
<Size>1</Size>
<Mark>
<WellKnownName>square</WellKnownName>
<Fill>
<CssParameter name="fill">#00dd00</CssParameter>
</Fill>
</Mark>
</Graphic>
</GraphicFill>
</Fill>
</PolygonSymbolizer>
<TextSymbolizer>
<Label>GEMNAAM</Label>
<Font>
<CssParameter name="font-family">monospace</CssParameter>
<CssParameter name="font-weight">bold</CssParameter>
<CssParameter name="font-size">10</CssParameter>
</Font>
<Fill>
<CssParameter name="fill">#000000</CssParameter>
</Fill>
<LabelPlacement>
<PointPlacement>
<AnchorPoint>
<AnchorPointX>1.0</AnchorPointX>
<AnchorPointY>0.5</AnchorPointY>
</AnchorPoint>
</PointPlacement>
</LabelPlacement>
</TextSymbolizer>
</Rule>
</FeatureTypeStyle>
</UserStyle>
</NamedLayer>
</StyledLayerDescriptor>
------- Comment #1 From 2004-03-05 13:29:26 -------
Ofcourse, it could be that not all fonts are installed on the server on which
Mapserver runs. I checked and this seems to be the case.

What should be done in this case according to the SLD spec? And what does
Mapserver do, does it take the first font it finds?

The SLD spec does not say anything about this.
------- Comment #2 From 2004-03-05 14:14:11 -------
Bart ... I think this is a limitation of SLD ... there is no way to know what
fonts the remote server supports.  MapServer (when acting as a WMS Server) will
try to match the font to one in its font file and will always fall back on
bitmap fonts ... which is why you always see the same font no matter what you
choose.

One of the problems is the MapServer does not use the native operating system to
retrieve fonts ... which is what applications do.  Every font registers certain
characteristics with the font management system, and then when an application
requests a font, the font manager tries to get the closest matching font.  If
mapserver was doing things right then it would use the font information coming
from the SLD request to get the closest matching font from the font manager. 
But it doesn't.

Our choice of names is arbitrary ... but kind of matches a set of font
characteristics that we think could be useful ... so any wms server could try to
match up sans-oblique to some local font in a server-specific way.  With that in
mind, it would be most useful if every MapServer WMS included a font file that
defined the basic fonts that we have included (ours point to Vera, a newly
open-sourced font from Bitstream - v.nice :))
------- Comment #3 From 2004-03-05 14:27:40 -------
Sorry to be a pain... I'll reopen...

You write that MapServer "... will try to match the font to one in its font file
and will always fall back on bitmap fonts...".  Is this behavior coded in SECT
or in MapServer?

I think that instead of using bitmap fonts as the default, there should be a
possibility for the person setting up the server to control the default font. 
e.g. If no match is found in the list of fonts, then it looks for a font called
"default", and if "default" is not found then it falls back on the bitmap fonts.

This is the way fonts (and symbols) are matched by the STYLEITEM AUTO feature
for instance. 

Excerpt from the OGR HOWTO:
-----------
 Text font mapping follows the following rules:

  1. If TTF fonts are supported:
     a. If the native font name (e.g. "Arial") is found in your fontset 
        then this font will be used.
     b. If 1a. failed and a font called "default" is present in your 
        fontset then this "default" font will be used. 
  2. If TTF fonts are not supported or if all above cases failed, then 
     BITMAP MEDIUM font will be used. 
----------

If this font matching behavior is coded in MapServer then please someone open a
corresponding MapServer bug and put a reference to it here. It will also be
important to have all those behaviors properly documented.