diff --git a/builder/mapserver/mapfile.go b/builder/mapserver/mapfile.go index 1a008e5..1dd3c10 100644 --- a/builder/mapserver/mapfile.go +++ b/builder/mapserver/mapfile.go @@ -487,6 +487,16 @@ func (m *Map) addTextSymbolizer(b *Block, r mss.Rule, isLine bool) (styled bool) style.AddNonNil("Font", fontNames) } + var minFeatureSizeSet bool + if _, ok := r.Properties.GetString("text-min-path-length"); ok { + minFeatureSizeSet = true + style.Add("MinFeatureSize", "AUTO") + } + if minLength, ok := r.Properties.GetFloat("text-min-path-length"); ok { + minFeatureSizeSet = true + style.Add("MinFeatureSize", minLength) + } + style.Add("Type", "truetype") if isLine { angle, ok := r.Properties.GetString("text-placement") @@ -497,7 +507,9 @@ func (m *Map) addTextSymbolizer(b *Block, r mss.Rule, isLine bool) (styled bool) style.Add("Angle", "FOLLOW") } - style.Add("MinFeatureSize", "AUTO") + if !minFeatureSizeSet { + style.Add("MinFeatureSize", "AUTO") + } } if wrapWidth, ok := r.Properties.GetFloat("text-wrap-width"); ok { maxLength := wrapWidth / textSize diff --git a/mss/spec.go b/mss/spec.go index 7fc4704..1d4f5e0 100644 --- a/mss/spec.go +++ b/mss/spec.go @@ -83,6 +83,15 @@ func isKeyword(keywords ...string) isValid { } } +func isKeywordOr(other isValid, keywords ...string) isValid { + return func(val interface{}) bool { + if other(val) { + return true + } + return isKeyword(keywords...)(val) + } +} + func isStops(val interface{}) bool { vals, ok := val.([]Value) if !ok { @@ -376,7 +385,7 @@ func init() { "text-justify-alignment": isJustifyAlignment, "text-margin": isNumber, "text-repeat-distance": isNumber, - "text-min-path-length": isNumber, + "text-min-path-length": isKeywordOr(isNumber, "auto"), "text-rotate-displacement": isBool, "text-upgright": isKeyword("auto", "auto-down", "left", "right", "left-only", "right-only"), "text-simplify": isNumber,