Opened 4 years ago

Last modified 3 years ago

#1181 new enhancement/feature request

Font-sizes in navit.xml are too small for Nexus 5

Reported by: fred jelk Owned by: cp15
Priority: major Milestone: version 0.6.0
Component: port/android Version: git master
Severity: normal Keywords: android, xml, nexus5, xhdpi
Cc:, (2)


The display of the Nexus 5 is now a xhdpi-device. So the fonts at the standard navit.xml are to small. See also the thread in the forum:

I've made now some changes in the navit.xml for this device. Please check the attached navitxhdpi.xml and it would be nice, if this could be implemented in the stock-android-port.

Attachments (4) (30.5 KB) - added by fred jelk 4 years ago.
01Map.png (234.6 KB) - added by fred jelk 4 years ago.
02Menu.png (102.3 KB) - added by fred jelk 4 years ago.
03Location.png (97.0 KB) - added by fred jelk 4 years ago.

Download all attachments as: .zip

Change History (16)

Changed 4 years ago by fred jelk

comment:1 Changed 4 years ago by kamikaaze

  • Keywords xml added
  • Milestone set to version 0.5.1
  • Summary changed from Font-sizes in navit.xml are to small for Nexus 5 to Font-sizes in navit.xml are too small for Nexus 5

comment:2 Changed 4 years ago by usul

  • Milestone changed from version 0.5.1 to version 0.6.0

I'm sorry for the late reply :(

First thanks for your submission.
We already have an HDPI layout here:
Can you please tell us, if this works fine for you?

Also it would be very useful, if you could say us what you changed, so we don't have a to track your navit.xml as a whole and can point the essential changes :)

IMHO this changes should be reflected in 0.6 major release, that also focus on bringing better flexibility to OSD and map style design.

comment:3 Changed 4 years ago by fred jelk

The HDPI-Layout is just for the Map. But the fonts in the Menu are also to small. Have a look at the attached screenshots.

In my customized xml, I have changed the font-sizes in the menu, changed the sizes from the OSD-elements and aligned them and I've changed the size of the curser. Now, I can use Navit on my Nexus 5 - before, it wasn't usable because it was difficult to identify the words.

PS: The Nexus 5 haven't a hdpi-Display. It have a xxhdpi-Display.

Last edited 4 years ago by fred jelk (previous) (diff)

Changed 4 years ago by fred jelk

Changed 4 years ago by fred jelk

Changed 4 years ago by fred jelk

comment:4 Changed 3 years ago by mvglasow (2)

  • Cc (2) added

The trouble is that Navit works with physical pixels and doesn't care about display densities. Remember that the beginnings of Navit were in the early 2000s, when smartphones were still unheard of and display densities were seldom outside the 75–120 dpi range.

The Android port attempted to rectify this by using different flavors of the navit.xml file – for ldpi (120 dpi), mdpi (160 dpi) and hdpi (240 dpi). This worked well on those platforms.

However, now we are seeing even higher densities, with xhdpi (320), xxhdpi (480) and even xxxhdpi (640). These were never considered in navit.

Also, the map styles are the same at any dpi sizes, meaning map details will get tinier at higher resolutions. We might want to tackle that in a more generic manner.

The idea I had was to introduce a dpi attribute for the graphics driver. Default would be 120 (which is ldpi on Android and somewhere in the range of a laptop screen). On Android, the graphics driver could populate this attribute with the actual DPI of the device.

Visual elements would then also get a dpi attribute. A value of 0 means "do not scale, interpret pixels as physical pixels" (giving basically the same behavior as currently and for compatibility, I'd make that the default). Any other value means that pixel sizes are to be interpreted as physical pixels at that resolution, and if graphics dpi differs from the dpi of the visual element, pixel values should be increased/decreased appropriately.

That would eliminate the need of maintaining configurations for every single density bin. The different XML files would be needed only if there are any differences in visual design that are not related to scaling (because higher DPI also allows for more fine-grained detail).

Besides, we will probably need to add x[x[x]]hdpi resources (icons and XML) to Navit.

comment:5 Changed 3 years ago by tryagain

I have changed build scripts since r5983 to support xhdpi, xxhdpi, xxxhdpi, including map layouts.

Left a few TODOs: scale map POI icons, and vehicle cursor (should be simple, just not have time right now).

I have no xhdpi, xxhdpi, xxxhdpi devices, so please report your results here.


comment:6 Changed 3 years ago by tryagain

Have updated the code, svn 5987.

comment:7 Changed 3 years ago by mvglasow (2)

Thanks for the good work! I've tried r5988 (with unscaled images) on a OnePlus? One (XXHDPI, ~400 dpi physical density) and found the best setting is:

<gui type="internal" enabled="yes" font_size="740" icon_xs="96" icon_s="128" icon_l="128" spacing="8">

With unscaled icons I had used icon_xs="32" icon_s="32" icon_l="64" spacing="4".

I feel the large icons are still too small, 192 would be better but 128 is currently the biggest supported size.

Also, I notice that if icons in the desired size are not available, Navit falls back to a default size (apparently those with no size in the file name, which are 24×24). A more elegant and user-friendly way to do this would be to pick the icon in the closest matching size. An *even* more elegant way would be to scale them to the requested size.

comment:8 Changed 3 years ago by mvglasow (2)

By the way, the same goes for maneuver icons. 96 is definitely too small on XXHDPI, 128 is better but I think we need at least 192 here as well.

For XXXHDPI devices, no practical experience but should be twice the XHDPI number of pixels (as per its definition). There's a converter at

comment:9 Changed 3 years ago by mvglasow (2)

PPS: for scaling map layouts and cursors, I have created a script which you can find at:

It will scale map layouts (stroke widths etc.) but not POI icons. Feel free to use and extend it.

Comparing screen layouts, I would eyeball icons in earlier versions to be ~192px on XXHDPI.

With the current Android DPI bins, I would suggest the following:

Resolution dpi icon_xs icon_s icon_l
LDPI 120 24 36 48
MDPI 160 32 48 64
HDPI 240 48 72 96
XHDPI 320 64 96 128
XXHDPI 480 96 128 192
XXXHDPI 640 128 192 256

navigation_next_turn OSD icons should be the same size as icon_l. For POI icons icon_xs is probably closest.

That means we'd need to supply icons at 24, 32, 36, 48, 64, 72, 96, 128, 192 and 256 pixels.

Last edited 3 years ago by mvglasow (2) (previous) (diff)

comment:10 Changed 3 years ago by tryagain

With svn5990-svn5994, navit should mostly conform to your icon size suggestions, including png scaling to get 192 and 256 px size from 128px. I do not think 32/36px and 64/72px icons make significant difference, so i decided to use 32px and 72px for icon_s on ldpi and hdpi, without even scaling existing icons.

Also i have added dash scaling.

comment:11 Changed 3 years ago by mvglasow (2)

Looks good, except that icons at 192px are heavily scaled (judging by the pixelation I would say from 48px). Looking at the code, I see there are no prescaled images beyond 128px – I would suggest extending that to 192 and 256 (in fact all icon sizes in the above table should be available for prescaled icons).

comment:12 Changed 3 years ago by tryagain

What svn version did you test? I have commited forgotten part yesterday, it significantly decreases pixelization. Before that change, 16px images were actually used to scale to 192 and 256.

Please check if that change makes sense. I do not like an idea of adding more resolutions, as it would significantly increase apk size. And i dont think that on 640dpi you will notice significant blur on 256px image scaled from 128px one.

I think we might make separate apk for higher densities, if 96px icons are not sufficient.

UPDATE: if you build new version in the same directory as previous one, please make sure to clean up all png files in navit/xpm and navit/android/res/drawable, navit/android/res/drawable-nodpi before running make.

Last edited 3 years ago by tryagain (previous) (diff)
Note: See TracTickets for help on using tickets.