Label outline gets scaled with changing map scale #4942

Closed
ejn opened this Issue Jun 18, 2014 · 8 comments

Comments

Projects
None yet
3 participants
@ejn
Contributor

ejn commented Jun 18, 2014

According to the docs for OUTLINEWIDTH in STYLE;

The thickness of the outline will not depend on the scale.

The corresponding docs in LABEL don't specify any behaviour in this regard, but the behaviour as specified in STYLE would seem a reasonable expectation.

Currently however, the outline for labels gets scaled up with the map scale - see images below - with seemingly no way to prevent this.

It doesn't appear to be the fault of the font (c.f #4774) since I've tested it with various fonts (including major ones such as Arial).

I've put up the self-contained minimalist test case used for generating the images at https://github.com/faegi/testcases/tree/master/mapserver-outlinewidth - tested using a recent build from master.

~1:500 000: test500
~1:50 000: test50
~1:5 000: test5

@ejn ejn added this to the 7.0 Release milestone Mar 23, 2015

@ejn

This comment has been minimized.

Show comment
Hide comment
@ejn

ejn Mar 23, 2015

Contributor

Appears to only occur when SYMBOLSCALEDENOM is set on the layer.

Does anyone have time to check this before the 7.0 release? I had a quick look through but couldn't see where this was going wrong. With 5.4 then the behaviour was as per the documentation.

Contributor

ejn commented Mar 23, 2015

Appears to only occur when SYMBOLSCALEDENOM is set on the layer.

Does anyone have time to check this before the 7.0 release? I had a quick look through but couldn't see where this was going wrong. With 5.4 then the behaviour was as per the documentation.

@tbonfort

This comment has been minimized.

Show comment
Hide comment
@tbonfort

tbonfort Mar 23, 2015

Member

untested patch attached here, can you give it a spin?

diff --git a/maprendering.c b/maprendering.c
index bf96a3f..f7c5c50 100644
--- a/maprendering.c
+++ b/maprendering.c
@@ -1023,7 +1023,7 @@ int msDrawTextSymbol(mapObj *map, imageObj *image, pointObj labelPnt, textSymbol
     c = &ts->label->color;
   if(MS_VALID_COLOR(ts->label->outlinecolor))
     oc = &ts->label->outlinecolor;
-  ow = ts->label->outlinewidth * ts->scalefactor;
+  ow = ts->label->outlinewidth * (ts->textpath->glyph_size / ts->label->size);
   if(!renderer->renderGlyphs) return MS_FAILURE;
   return renderer->renderGlyphs(image,ts->textpath,c,oc,ow);
Member

tbonfort commented Mar 23, 2015

untested patch attached here, can you give it a spin?

diff --git a/maprendering.c b/maprendering.c
index bf96a3f..f7c5c50 100644
--- a/maprendering.c
+++ b/maprendering.c
@@ -1023,7 +1023,7 @@ int msDrawTextSymbol(mapObj *map, imageObj *image, pointObj labelPnt, textSymbol
     c = &ts->label->color;
   if(MS_VALID_COLOR(ts->label->outlinecolor))
     oc = &ts->label->outlinecolor;
-  ow = ts->label->outlinewidth * ts->scalefactor;
+  ow = ts->label->outlinewidth * (ts->textpath->glyph_size / ts->label->size);
   if(!renderer->renderGlyphs) return MS_FAILURE;
   return renderer->renderGlyphs(image,ts->textpath,c,oc,ow);
@ejn

This comment has been minimized.

Show comment
Hide comment
@ejn

ejn Mar 23, 2015

Contributor

Looks good - the width always stays fixed (at 1 pixel in my example) now with your patch, just as documented.

Contributor

ejn commented Mar 23, 2015

Looks good - the width always stays fixed (at 1 pixel in my example) now with your patch, just as documented.

@tbonfort

This comment has been minimized.

Show comment
Hide comment
@tbonfort

tbonfort Mar 23, 2015

Member

hmm, it should scale along with the label size, as that's the intended behavior. I suspect you're fixing the label size with minsize/maxsize, which is why the outline stays at 1 pixel in your case, correct?

Member

tbonfort commented Mar 23, 2015

hmm, it should scale along with the label size, as that's the intended behavior. I suspect you're fixing the label size with minsize/maxsize, which is why the outline stays at 1 pixel in your case, correct?

@ejn

This comment has been minimized.

Show comment
Hide comment
@ejn

ejn Mar 23, 2015

Contributor

Correct: MINSIZE == MAXSIZE == 10

If the intended behaviour is that it scales with the label then the documentation should be corrected!

Contributor

ejn commented Mar 23, 2015

Correct: MINSIZE == MAXSIZE == 10

If the intended behaviour is that it scales with the label then the documentation should be corrected!

@ejn

This comment has been minimized.

Show comment
Hide comment
@ejn

ejn Mar 23, 2015

Contributor

Still with your patch, if I remove MINSIZE and MAXSIZE then the label and the outline width both scale proportionally - I guess this is probably the "expected" behaviour for most use cases (?), even if it is not what the documentation currently states.

Contributor

ejn commented Mar 23, 2015

Still with your patch, if I remove MINSIZE and MAXSIZE then the label and the outline width both scale proportionally - I guess this is probably the "expected" behaviour for most use cases (?), even if it is not what the documentation currently states.

@sdlime

This comment has been minimized.

Show comment
Hide comment
@sdlime

sdlime Mar 26, 2015

Member

Thomas: Could we use the label's min/maxsize relative to the normal size to also derive min/max outline width bounds? I'd think the two should behave exactly the same. That is, stop scaling the outline if the size has hit a min/max threshold.

Steve

Member

sdlime commented Mar 26, 2015

Thomas: Could we use the label's min/maxsize relative to the normal size to also derive min/max outline width bounds? I'd think the two should behave exactly the same. That is, stop scaling the outline if the size has hit a min/max threshold.

Steve

@tbonfort

This comment has been minimized.

Show comment
Hide comment
@tbonfort

tbonfort Mar 27, 2015

Member

@sdlime that's what the patch intends to do: scale the label outlinewidth by the scaling factor that was effectively applied to the label->size.

Member

tbonfort commented Mar 27, 2015

@sdlime that's what the patch intends to do: scale the label outlinewidth by the scaling factor that was effectively applied to the label->size.

@tbonfort tbonfort closed this in d0043f2 Mar 27, 2015

ejn added a commit to faegi/docs that referenced this issue Apr 9, 2015

havatv added a commit to mapserver/docs that referenced this issue Apr 11, 2015

Merge pull request #117 from faegi/labelOutlineWidth
Clarify label OUTLINEWIDTH w.r.t. mapserver/mapserver#4942
Looks good - I merge
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment