Modify

Opened 10 years ago

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

Download all attachments as: .zip

Change History (52)

by Klumbumbus, 10 years ago

Attachment: maxspeed_none.svg added

by Klumbumbus, 10 years ago

Attachment: maxspeednodes.png added

comment:1 by Klumbumbus, 10 years ago

Description: modified (diff)

by Klumbumbus, 10 years ago

Attachment: maxspeednodes.diff added

comment:2 by Klumbumbus, 10 years ago

Description: modified (diff)

comment:3 by Don-vip, 10 years ago

Milestone: 14.07

Great :)

comment:4 by bastiK, 10 years ago

Owner: changed from team to bastiK
Status: newassigned

Nice! I'll check it in soon.

by bastiK, 10 years ago

Attachment: trafficsigns-linux.png added

comment:5 by Klumbumbus, 10 years ago

Thats my test file:

by Klumbumbus, 10 years ago

Attachment: maxspeednodesexample.osm added

comment:6 by Klumbumbus, 10 years ago

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

comment:7 by bastiK, 10 years ago

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 by Klumbumbus, 10 years ago

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 by bastiK, 10 years ago

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 by Don-vip, 10 years ago

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 by bastiK, 10 years ago

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.

by Klumbumbus, 10 years ago

Attachment: Liberation Sans.png added

comment:12 by Klumbumbus, 10 years ago

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 by Klumbumbus, 10 years ago

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?

in reply to:  12 ; comment:14 by bastiK, 10 years ago

Replying to Klumbumbus:

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

Looks good, but not compatible to GPL v3.

by bastiK, 10 years ago

Attachment: arial-8.png added

in reply to:  14 ; comment:15 by Don-vip, 10 years ago

Replying to bastiK:

Looks good, but not compatible to GPL v3.

Why?

by bastiK, 10 years ago

Attachment: arial-10.png added

by bastiK, 10 years ago

Attachment: arial-12.png added

by bastiK, 10 years ago

Attachment: dejavu-8.png added

by bastiK, 10 years ago

Attachment: dejavu-10.png added

by bastiK, 10 years ago

Attachment: dejavu-12.png added

by bastiK, 10 years ago

Attachment: lucida-sans-8.png added

by bastiK, 10 years ago

Attachment: lucida-sans-10.png added

by bastiK, 10 years ago

Attachment: lucida-sans-12.png added

by bastiK, 10 years ago

Attachment: droid-sans-8.png added

by bastiK, 10 years ago

Attachment: droid-sans-10.png added

by bastiK, 10 years ago

Attachment: droid-sans-12.png added

by Klumbumbus, 10 years ago

Attachment: Droid Sans maxspeed.png added

comment:16 by bastiK, 10 years ago

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 by Klumbumbus, 10 years ago

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.

in reply to:  15 comment:18 by bastiK, 10 years ago

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 by Don-vip, 10 years ago

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.

by Klumbumbus, 10 years ago

Attachment: maxspeednodes2.diff added

comment:20 by Klumbumbus, 10 years ago

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 10 years ago by Klumbumbus (previous) (diff)

in reply to:  14 comment:21 by skyper, 10 years ago

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 by mkoniecz, 10 years ago

#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?

in reply to:  22 comment:23 by Klumbumbus, 10 years ago

Replying to mkoniecz:

#9357 is very similar

I made a comment there

comment:24 by Don-vip, 10 years ago

Milestone: 14.0714.08

comment:25 by Don-vip, 10 years ago

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

comment:26 by bastiK, 10 years ago

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.

by Klumbumbus, 10 years ago

Attachment: zoom on maxspeed nodes.diff added

comment:27 by Klumbumbus, 10 years ago

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

comment:28 by Klumbumbus, 10 years ago

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

comment:29 by bastiK, 10 years ago

In 7385/josm:

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

comment:30 by Don-vip, 10 years ago

Resolution: fixed
Status: closedreopened

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

comment:31 by bastiK, 10 years ago

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. Next status will be 'reopened'.

Add Comment


E-mail address and name can be saved in the Preferences .
 
Note: See TracTickets for help on using tickets.