wiki:Styles/HiDPISupport

Version 2 (modified by Klumbumbus, 9 years ago) ( diff )

wikitext adjustments

HiDPI Support

Description

This mapcss mappaint style was created to scale node sizes and font sizes in the MapView for better view on HiDPI screens. This is only a temporary solution until ticket #9995 is solved (automatic scaling).

This style works only together with the default JOSM internal mappaint style. In the List of mappaint styles in the preferences HiDPISupport needs to be below the internal style (which means higher priority). You can add more additional styles further down in the list.

There is a style setting "Less obtrusive node symbols at low zoom" in this style as well as in the internal default style. For correct display you need to have them both in the same state (both checked or both unchecked).

For the HiDPISupport mappaint style JOSM version 10018 or newer is required. For ideas/questions/bugs/suggestions or similar please write a message to Klumbumbus. This style is "untested" because the author has no HiDPI screen.

Feel free to translate this wiki page into more languages. Already translated languages see top right.

How to adjust the sizes

Go to the Advanced Preferences and adjust the following two keys:

  • font-size-summand: The font size will be increased by the number set here. The default value is 2. Only integer numbers are allowed. Try other values like e.g. 1, 3 or 4.
  • node-size-factor: The node size will be multiplied by the number set here. The default value is 1.8. Float numbers are allowed. Try other values like e.g. 1.5 or 2.

Code

meta {
    title: "HiDPI Support";
    version: "1.12_2025-01-13";
    description: "Allows to scale the size of nodes and the font size in the Mapview. Min. JOSM version is 10018.";
    icon: "HiDPISupportLogo.svg";
    author: "Klumbumbus";
    link: "http://josm.openstreetmap.de/wiki/Styles/HiDPISupport";
    watch-modified: true;
    min-josm-version: "10018";
    /* This mapcss mappaint style is only a temporary solution until ticket #9995 is solved. */
}

setting::shrink_nodes {
  type: boolean;
  label: tr("Less obtrusive node symbols at low zoom");
  default: true;
}

* {
    font-size-summand: JOSM_pref("font-size-summand", 2);
}
node {
    node-size-factor: JOSM_pref("node-size-factor", 1.8);
}

node["openGeoDB:type"=Stadt],
node["openGeoDB:type"=Kreis],
node["openGeoDB:type"=Gemeinde],
node["openGeoDB:type"=Ort],
node["openGeoDB:type"=District],
node["openGeoDB:location"=locality] {
    font-size: 10 + prop("font-size-summand");
}

node[place=continent],
node[place=country],
node[place=state],
node[place=region],
node[place=county],
node[place=city],
node[place=town],
node[place=suburb],
node[place=village],
node[place=neighbourhood],
node[place=hamlet],
node[place=isolated_dwelling],
node[place=farm],
node[place=island],
node[place=islet] {
    font-size: 10 + prop("font-size-summand");
}

node|z15-[place=locality],
node|z-14[place=locality][!setting("hide_icons")] {
    font-size: 10 + prop("font-size-summand");
}

node|z-16,
node[!is_prop_set("icon-image")]!.maxspeedclass {
    symbol-size: 2 * prop("node-size-factor");
}

way > node|z16[setting("shrink_nodes")]!:tagged { symbol-size: 1 * prop("node-size-factor"); }

node|z17[setting("shrink_nodes")]               { symbol-size: 4 * prop("node-size-factor"); }
way > node|z17[setting("shrink_nodes")]         { symbol-size: 2 * prop("node-size-factor"); }
node|z17[setting("shrink_nodes")]:connection    { symbol-size: 4 * prop("node-size-factor"); }

node|z18[setting("shrink_nodes")]               { symbol-size: 4 * prop("node-size-factor"); }
way > node|z18[setting("shrink_nodes")]         { symbol-size: 3 * prop("node-size-factor"); }
node|z18[setting("shrink_nodes")]:connection    { symbol-size: 5 * prop("node-size-factor"); }

node|z19-[setting("shrink_nodes")]              { symbol-size: 4 * prop("node-size-factor"); }
way > node|z19-[setting("shrink_nodes")]        { symbol-size: 4 * prop("node-size-factor"); }
node|z19-[setting("shrink_nodes")]:connection   { symbol-size: 6 * prop("node-size-factor"); }

node[!setting("shrink_nodes")]                  { symbol-size: 4 * prop("node-size-factor"); }
way > node[!setting("shrink_nodes")]            { symbol-size: 4 * prop("node-size-factor"); }
node[!setting("shrink_nodes")]:connection       { symbol-size: 6 * prop("node-size-factor"); }

node:selected {
    symbol-size: 6 * prop("node-size-factor");
}

node|z-18,area|z-18 { font-size: 8 + prop("font-size-summand"); }
node|z19,area|z19   { font-size: 9 + prop("font-size-summand"); }
node|z20-,area|z20- { font-size: 10 + prop("font-size-summand"); }

way|z17-[highway^=motorway],
way|z17-[highway^=trunk],
way|z17-[highway^=primary],
way|z17-[highway^=secondary],
way|z17-[highway^=tertiary],
way|z17-[highway=unclassified],
way|z17-[highway=residential],
way|z17-[highway=living_street],
way|z17-[highway=escape],
way|z17-[highway=pedestrian][!area?],
way|z17-[highway=steps],
way|z17-[highway=footway],
way|z17-[highway=path],
way|z17-[highway=service],
way|z17-[highway=track],
way|z17-[highway=cycleway],
way|z17-[highway=bridleway],
way|z17-[highway=bus_guideway],
way|z17-[highway=raceway],
way|z17-[highway=construction],
way|z17-[highway=road] {
    font-size: 9 + prop("font-size-summand");
}

way|z18[highway] {
    font-size: 10 + prop("font-size-summand");
}
way|z19[highway] {
    font-size: 11 + prop("font-size-summand");
}
way|z20-[highway] {
    font-size: 12 + prop("font-size-summand");
}

Styles_HiDPISupport-style.mapcss, Styles_HiDPISupport.zip

Attachments (1)

Download all attachments as: .zip

Note: See TracWiki for help on using the wiki.