Modify

Opened 5 years ago

Closed 5 years ago

#10301 closed enhancement (fixed)

extend display of maxspeed nodes [patch]

Reported by: Klumbumbus Owned by: bastiK
Priority: normal Milestone: 14.08
Component: Internal mappaint style Version:
Keywords: maxspeed Cc:

Description (last modified by Klumbumbus)

Currently every node with maxspeed=* shows a maxspeed icon with a maxspeed of 60, which is far from optimal.
This patch changes it, so it shows the actual value.

  • The value is shown if the value of maxspeed is
    • only a number
    • a number followed by a whitespace and followed by
      • km/h
      • mph
      • knots
  • If maxspeed=none a new icon is shown
  • If maxspeed:variable is set or maxspeed=signals, the sign turns into black backgrund with white text, which then looks like a common LED sign.
  • If maxspeed=signals a sign is shown which looks like the LED pixel matrix of such a sign

All other cases should be tagging errors, therefore no sign is displayed.

Source of new icon (license:PD)

Screenshot:

Attachments (21)

maxspeed_none.svg (10.1 KB) - added by Klumbumbus 5 years ago.
maxspeednodes.png (8.9 KB) - added by Klumbumbus 5 years ago.
maxspeednodes.diff (2.1 KB) - added by Klumbumbus 5 years ago.
trafficsigns-linux.png (4.4 KB) - added by bastiK 5 years ago.
maxspeednodesexample.osm (6.3 KB) - added by Klumbumbus 5 years ago.
Liberation Sans.png (7.4 KB) - added by Klumbumbus 5 years ago.
arial-8.png (36.6 KB) - added by bastiK 5 years ago.
arial-10.png (36.3 KB) - added by bastiK 5 years ago.
arial-12.png (39.1 KB) - added by bastiK 5 years ago.
dejavu-8.png (32.9 KB) - added by bastiK 5 years ago.
dejavu-10.png (35.2 KB) - added by bastiK 5 years ago.
dejavu-12.png (38.5 KB) - added by bastiK 5 years ago.
lucida-sans-8.png (37.0 KB) - added by bastiK 5 years ago.
lucida-sans-10.png (36.9 KB) - added by bastiK 5 years ago.
lucida-sans-12.png (38.7 KB) - added by bastiK 5 years ago.
droid-sans-8.png (33.1 KB) - added by bastiK 5 years ago.
droid-sans-10.png (35.0 KB) - added by bastiK 5 years ago.
droid-sans-12.png (37.9 KB) - added by bastiK 5 years ago.
Droid Sans maxspeed.png (6.8 KB) - added by Klumbumbus 5 years ago.
maxspeednodes2.diff (2.5 KB) - added by Klumbumbus 5 years ago.
zoom on maxspeed nodes.diff (1.8 KB) - added by Klumbumbus 5 years ago.

Download all attachments as: .zip

Change History (52)

Changed 5 years ago by Klumbumbus

Attachment: maxspeed_none.svg added

Changed 5 years ago by Klumbumbus

Attachment: maxspeednodes.png added

comment:1 Changed 5 years ago by Klumbumbus

Description: modified (diff)

Changed 5 years ago by Klumbumbus

Attachment: maxspeednodes.diff added

comment:2 Changed 5 years ago by Klumbumbus

Description: modified (diff)

comment:3 Changed 5 years ago by Don-vip

Milestone: 14.07

Great :)

comment:4 Changed 5 years ago by bastiK

Owner: changed from team to bastiK
Status: newassigned

Nice! I'll check it in soon.

Changed 5 years ago by bastiK

Attachment: trafficsigns-linux.png added

comment:5 Changed 5 years ago by Klumbumbus

Thats my test file:

Changed 5 years ago by Klumbumbus

Attachment: maxspeednodesexample.osm added

comment:6 Changed 5 years ago by Klumbumbus

My system is Windows 7. Does linux use other fonts/font families in JOSM?

comment:7 Changed 5 years ago by bastiK

On Linux (Ubuntu) it looks a little strange:

The reason is that there are different default fonts in different operating systems:

  • Win: Arial
  • Linux: Dejavu (haven't checked all distributions, but I would guess it is the same)
  • Apple: ?

Possible solutions:

  1. Abandon the patch and add one image and one rule for each number that can be found on a restriction sign. This would be simple and we'd get a consistent look. However this approach does not work for the planned rendering of house number plates, highway shields and similar advanced techniques.
  2. Platform / font dependent tweaks in the style sheet. (ugly, hard to maintain)
  3. Ship a common opensource font inside the binary .jar
    • This would guarantee consistent look for all fancy geometric construction that involve font.
    • Increased download size probably in the order of ~100-200 kB.
    • May improve quality of text rendering in general.

comment:8 Changed 5 years ago by Klumbumbus

I there a font which is shiped with all (or the most) operating systems? So we could specify this in the mappaint font-family: "xyz";

comment:9 Changed 5 years ago by bastiK

I don't think so. Lucida is shipped with Oracle JRE but not with OpenJDK. All the pre-installed fonts in Win XP seem to be proprietary, so none of these will be available in Linux.

comment:10 Changed 5 years ago by Don-vip

Yes and no.

See http://docs.oracle.com/javase/7/docs/api/java/awt/Font.html

The Java Platform distinguishes between two kinds of fonts: physical fonts and logical fonts.

Physical fonts are the actual font libraries containing glyph data and tables to map from character sequences to glyph sequences, using a font technology such as TrueType or PostScript Type 1. All implementations of the Java Platform must support TrueType fonts; support for other font technologies is implementation dependent. Physical fonts may use names such as Helvetica, Palatino, HonMincho, or any number of other font names. Typically, each physical font supports only a limited set of writing systems, for example, only Latin characters or only Japanese and Basic Latin. The set of available physical fonts varies between configurations. Applications that require specific fonts can bundle them and instantiate them using the createFont method.

Logical fonts are the five font families defined by the Java platform which must be supported by any Java runtime environment: Serif, SansSerif, Monospaced, Dialog, and DialogInput. These logical fonts are not actual font libraries. Instead, the logical font names are mapped to physical fonts by the Java runtime environment. The mapping is implementation and usually locale dependent, so the look and the metrics provided by them vary. Typically, each logical font name maps to several physical fonts in order to cover a large range of characters.

Can both of you try playing with font families "Serif, SansSerif, Monospaced, Dialog, and DialogInput" ?

Maybe we can find one that behaves in the same way on Windows and Ubuntu.

comment:11 Changed 5 years ago by bastiK

According to fontconfig.properties:

Linux:

serif = DejaVu Serif
sansserif = DejaVu Sans
monospaced = DejaVu Sans Mono

Win:

serif = Times New Roman
sansserif = Arial
monospaced = Courier New

On both systems, dialog is an alias for sansserif and dialoginput is an alias for monospaced.

Changed 5 years ago by Klumbumbus

Attachment: Liberation Sans.png added

comment:12 Changed 5 years ago by Klumbumbus

DejaVu Serif
DejaVu Sans
DejaVu Sans Mono
Times New Roman
Arial
Courier New

I tried all of these. For the maxspeed signs only Arial looks good. All others are to wide compared to their height, so they don't fit in the circle. I don't want to make the circle bigger, because it would be bigger than other icons then.

What about Libaration Sans? Seems it's open license.

Modification to:

    font-family: "Liberation Sans";
    text-offset-y: -1;

looks on my system like

comment:13 Changed 5 years ago by Klumbumbus

Another thing to consider:
JOSM warns about maxspeed on nodes, because maxspeed is better on ways. However some tag the signs itself beside the street so it is easier to create maxspeed:forward and maxspeed:backward on the way. Another valid case I think is if the maxspeed node is part of a oneway (e.g. on motorways) and indicates the sign and beginning of the maxspeed restriction. Maxspeed is used 29000 times on nodes. So I think it is ok, to display maxspeed on nodes in general, or should we drop it at all?

comment:14 in reply to:  12 ; Changed 5 years ago by bastiK

Replying to Klumbumbus:

What about Libaration Sans? Seems it's open license.

Looks good, but not compatible to GPL v3.

Changed 5 years ago by bastiK

Attachment: arial-8.png added

comment:15 in reply to:  14 ; Changed 5 years ago by Don-vip

Replying to bastiK:

Looks good, but not compatible to GPL v3.

Why?

Changed 5 years ago by bastiK

Attachment: arial-10.png added

Changed 5 years ago by bastiK

Attachment: arial-12.png added

Changed 5 years ago by bastiK

Attachment: dejavu-8.png added

Changed 5 years ago by bastiK

Attachment: dejavu-10.png added

Changed 5 years ago by bastiK

Attachment: dejavu-12.png added

Changed 5 years ago by bastiK

Attachment: lucida-sans-8.png added

Changed 5 years ago by bastiK

Attachment: lucida-sans-10.png added

Changed 5 years ago by bastiK

Attachment: lucida-sans-12.png added

Changed 5 years ago by bastiK

Attachment: droid-sans-8.png added

Changed 5 years ago by bastiK

Attachment: droid-sans-10.png added

Changed 5 years ago by bastiK

Attachment: droid-sans-12.png added

Changed 5 years ago by Klumbumbus

Attachment: Droid Sans maxspeed.png added

comment:16 Changed 5 years ago by bastiK

Sorry to digress a little, but I compared the general text rendering and it looks quite different if you compare Windows and Linux. We use font-size 8 at the moment. Arial looks pretty faint and blurry, compared to Dejavu which is clearer, but a little flashy. I added font size 10 and 12 for comparison. We could switch to larger font sizes at high zoom level.

As mentioned, Lucida is always available for Oracle JRE. I added the free font Droid (former Android font) for comparison. If we want to ship a font to unify the rendering, this would be a candidate.

(a)

(b)

(c)

(d)

(a) Arial
(b) Dejavu sans
(c) Lucida sans
(d) Droid sans

comment:17 Changed 5 years ago by Klumbumbus

I very like Droid sans, because it is very good readable at the default text size 8. This would be a great improvement in general. It also fits good for the maxspeed signs.

comment:18 in reply to:  15 Changed 5 years ago by bastiK

Replying to Don-vip:

Replying to bastiK:

Looks good, but not compatible to GPL v3.

Why?

The font itself cannot be re-licensed as GPL v3. (See e.g. https://github.com/FortAwesome/Font-Awesome/issues/1124)

This is a similar problem as with images. In this case one could really argue that the font is not an essential part of the program, but is a separate work that is distributed along JOSM as an aggregate (can be replaced by a different font at any time). Therefore I think it might be no problem.

comment:19 Changed 5 years ago by Don-vip

OK thanks for the licensing explanation. Damn, these licensing issues are really boring. Sometimes it amazes me we can't ship an open source image/font/whatever in an open source program because of all these numerous and incompatible licences...

+1 for inclusion of Droid font, it looks very nice.

Changed 5 years ago by Klumbumbus

Attachment: maxspeednodes2.diff added

comment:20 Changed 5 years ago by Klumbumbus

I uploaded a new maxspeed nodes diff file. I changed the character for maxspeed signals and maxspeed signs do no longer conflict with other icons (e.g. highway=speed_camera). It is also already optimized for the Droid Sans font.

Last edited 5 years ago by Klumbumbus (previous) (diff)

comment:21 in reply to:  14 Changed 5 years ago by skyper

Replying to bastiK:

Replying to Klumbumbus:

What about Libaration Sans? Seems it's open license.

Looks good, but not compatible to GPL v3.

Found Linux Libertine which is licensed GPL v3, but license does not seem to be the problem.

comment:22 Changed 5 years ago by mkoniecz

#9357 is very similar "Adress icon displaying value of "addr:housenumber" rather than fixed 41."

Maybe it can be fixed by the same person with limited additional work?

comment:23 in reply to:  22 Changed 5 years ago by Klumbumbus

Replying to mkoniecz:

#9357 is very similar

I made a comment there

comment:24 Changed 5 years ago by Don-vip

Milestone: 14.0714.08

comment:25 Changed 5 years ago by Don-vip

@Paul: I think we can integrate this patch with Droid Sans, no?

comment:26 Changed 5 years ago by bastiK

Resolution: fixed
Status: assignedclosed

In 7383/josm:

applied #10301 - extend display of maxspeed nodes (patch by Klumbumbus)
Include Droid Sans font in the JOSM binary distribution.
This unifies the font rendering on different platforms and allows geometric constructions with text (as demonstrated for maxspeed). Both regular and bold style are available.

Changed 5 years ago by Klumbumbus

Attachment: zoom on maxspeed nodes.diff added

comment:27 Changed 5 years ago by Klumbumbus

This patch adds zoom level to maxspeed nodes.
zoom on maxspeed nodes.diff

comment:28 Changed 5 years ago by Klumbumbus

(Just for documentation: Icon added in [o30582])

comment:29 Changed 5 years ago by bastiK

In 7385/josm:

see #10301 - zoom dependence for maxspeed nodes (patch by Klumbumbus)

comment:30 Changed 5 years ago by Don-vip

Resolution: fixed
Status: closedreopened

Unit test MapCSSWithExtendedTextDirectivesTest needs to be updated:
http://donvip.fr/jenkins/job/JOSM/lastCompletedBuild/testReport/

comment:31 Changed 5 years ago by bastiK

Resolution: fixed
Status: reopenedclosed

In 7418/josm:

fixed #10301 - update of MapCSSWithExtendedTextDirectivesTest unit test

Modify Ticket

Change Properties
Set your email in Preferences
Action
as closed The owner will remain bastiK.
as The resolution will be set.
The resolution will be deleted.

Add Comment


E-mail address and name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.