#18468 closed enhancement (fixed)
[Patch] Text Rotation in MapCSS
Reported by: | BrackoNe | Owned by: | simon04 |
---|---|---|---|
Priority: | normal | Milestone: | 20.05 |
Component: | Core mappaint | Version: | tested |
Keywords: | text; rotation; style | Cc: |
Description (last modified by )
Hi!
I would like most kindly to ask if it is possible to add a support to rotate the text within the map style in JOSM.
I would propose to use text-rotation:"0.05"; which is as same as icon-rotation:"0.05";
I'm creating content-aware traffic signs which are available at the following location:
https://github.com/BrackoNe/rs_traffic_signs
For the traffic sign which represents ascent or descent (RS:I-3 and RS:I-4), text rotation is necessary:
https://en.wikipedia.org/wiki/File:Mauritius_Road_Signs_-_Warning_Sign_-_Dangerous_Descent.svg
Thank you in advance,
Nemanja
Attachments (5)
Change History (25)
by , 5 years ago
Attachment: | 44.6730752-20.6034399.png added |
---|
by , 5 years ago
Attachment: | 18468.patch added |
---|
comment:1 by , 5 years ago
Summary: | Text Rotation in MapCSS → [Patch] Text Rotation in MapCSS |
---|
Draft patch: attachment:18468.patch
The rotation centre is might need to be adapted…ç
by , 5 years ago
Attachment: | 2020-01-15_22-05.png added |
---|
comment:2 by , 5 years ago
Did you check that MapCSSRendererTest did not require any change? I would find it surprising.
comment:3 by , 5 years ago
I'm afraid that I'm not aware of it. I was using a wiki page where you can see all MapCSS objects and I have used it in process of creating this paint style. Can you be more specific, please?
comment:4 by , 5 years ago
This is one traffic sign:
node|z-15["traffic_sign:background"="yellow"]["side"="left"]["distance_ahead"]::background3_sign_layer_bckground{ text:"distance_ahead"; text-color: black; text-anchor-vertical: center; text-anchor-horizontal: center; font-size:"2"; font-weight:"bold"; text-offset-x:"-11"; text-offset-y:"-8"; icon-offset-x:"-10"; icon-offset-y:"1"; icon-width:"15"; icon-image:"RS/yellow_single.png"; }
If I need to use icon rotation, I would use: icon-rotation: command, as it is stated here: https://josm.openstreetmap.de/wiki/Help/Styles/MapCSSImplementation, in section Icon and symbol styles
I have tried text-rotation, but it is not possible, I'm not sure how to use MapCSSRendererTest and is it possible to combine with this "classic" MapCSS file?
Thanks in advance,
Nemanja
comment:5 by , 5 years ago
@BrackoNe: comment:2 was addressed to simon04. No action from your side required atm.
by , 5 years ago
Attachment: | 18468-v2.patch added |
---|
by , 5 years ago
Attachment: | MapCSSRendererTest-fails.zip added |
---|
follow-up: 10 comment:7 by , 5 years ago
@team, can someone please review attachment:18468-v2.patch
The MapCSSRendererTest
test fails on my system also without this patch applied. Here are the generated PNG files: attachment:MapCSSRendererTest-fails.zip
comment:9 by , 5 years ago
Milestone: | → 20.03 |
---|
comment:10 by , 5 years ago
Replying to simon04:
The
MapCSSRendererTest
test fails on my system also without this patch applied. Here are the generated PNG files: attachment:MapCSSRendererTest-fails.zip
What's the font used in source:trunk/test/data/renderer/node-text2/reference.png
When debugging MapCSSRendererTest[node-text2]
, font
in org.openstreetmap.josm.gui.mappaint.styleelement.TextLabel#create
is java.awt.Font[family=Droid Sans,name=Droid Sans,style=plain,size=10]
, but the test fails.
comment:11 by , 5 years ago
Vincent, would you please help me with the unit test and let me know the required font. Simply, by setting a breakpoint in org.openstreetmap.josm.gui.mappaint.styleelement.TextLabel#create
for the font
variable. Thanks!
comment:13 by , 5 years ago
The font on my system is java.awt.Font[family=Dialog,name=Droid Sans,style=plain,size=10]
and it fails too.
I retrieve the reference data on JOSM server from Jenkins, I guess we should add logs so that the exact font can be retrieved in the test output.
comment:15 by , 5 years ago
...[truncated 5558 chars]... rategy={DeriveLabelFromNameTagsCompositionStrategy} font=java.awt.Font[family=Dialog,name=Droid Sans,style=plain,size=10] color=#ffd700 box=java.awt.Rectangle[x=-25,y=-25,width=50,height=50] hAlign=CENTER vAlign=ABOVE xOffset=0 yOffset=0}
Still not much clearer …
comment:16 by , 5 years ago
Description: | modified (diff) |
---|
comment:17 by , 5 years ago
Milestone: | 20.03 → 20.04 |
---|---|
Owner: | changed from | to
Status: | new → assigned |
comment:19 by , 5 years ago
Please check if https://josm.openstreetmap.de/wiki/Help/Styles/MapCSSImplementation?action=diff&version=175 is correct and complete.
Samples of Content Aware traffic signs in MapStyle.