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

Label outline gets scaled with changing map scale #4942

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

Label outline gets scaled with changing map scale #4942

ejn opened this issue Jun 18, 2014 · 8 comments
Milestone

Comments

@ejn
Copy link
Contributor

@ejn 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
Copy link
Contributor Author

@ejn 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
Copy link
Member

@tbonfort 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
Copy link
Contributor Author

@ejn 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
Copy link
Member

@tbonfort 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
Copy link
Contributor Author

@ejn 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
Copy link
Contributor Author

@ejn 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
Copy link
Member

@sdlime 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
Copy link
Member

@tbonfort 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/MapServer-documentation that referenced this issue Apr 11, 2015
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
Labels
None yet
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
3 participants