Opened 6 years ago

Closed 6 years ago

Last modified 5 years ago

#1036 closed defect/bug (fixed)

Navigation next turn icon is not displayed anymore

Reported by: ziaou Owned by: tryagain
Priority: major Milestone:
Component: install Version: git master
Severity: Keywords: navigation, osd, turn, svg
Cc: https://wiki.navit-project.org/index.php/user:ziaou

Description

When OSD navigation_next_turn is enabled, only a question mark is displayed, osd_core is unable to find the right icon with the right scale in the xpm directory.

Only png files are available in xpm directory for navigation icon but osd core seems to look for svg :

osd_core:osd_nav_next_turn_draw:failed to load work_directory/navit/out/navit/xpm/nav_right_2_wh.svg in -1x-1

I tested with SVN 5090 and 5096

Change History (13)

comment:1 Changed 6 years ago by sleske

How did you install Navit? Binary package or compiled yourself? If self-compiled, using autotools or CMake build?

If you compiled yourself using CMake:

The CMake build does not (yet) correctly install the SVG files into the build tree (they should be copied to build/navit/xpm).

As a workaround, try copying all SVG files from the src tree under navit/navit/xpm to build/navit/xpm. Then navit should find them.

comment:2 Changed 6 years ago by sleske

When I get around to it, I'll try to fix the CMake build to install the SVG files as well. Do we maybe need a switch for that? Some systems cannot load SVGs, then installing them may be futile.

comment:3 Changed 6 years ago by ziaou

I've tested with a downloaded android daily build and a self compiled win32 with Cmake.

I guess Android version is built with cmake too, then it is logical to meet the same issue.

I've already tested your workaround with win32 and it works fine, I will try to build for android soon.

I don't clearly understand why there is so many types of icons in the source (xpm, svg, svgz, png). Perhaps this could be clarify in a wiki page.

comment:4 Changed 6 years ago by ziaou

  • Cc https://wiki.navit-project.org/index.php/user:ziaou added

comment:5 Changed 6 years ago by sleske

I've already tested your workaround with win32 and it works fine, I will try to build for android soon.

That's good.

I don't clearly understand why there is so many types of icons in the source (xpm, svg, svgz, png).

There's no special reason - it's just the format the icons were available in. XPM and PNG are sort of deprecated, the icons are replaced gradually with SVG icons. SVGZ ist just compressed SVG, so not really a different type.

The build process then converts the SVGs to PNGs, because some platforms cannot load SVG directly.

comment:6 Changed 6 years ago by ziaou

Unfortunately, the workaround seems to not work to android target, SVG are not copied in "drawable"

comment:7 Changed 6 years ago by tryagain

AFAIK we have no support for SVGs on Android.

Recent builds seem to include references to SVG at least in some layouts. Unsure if that was forever or appeared recently.

As a workaround, you may try to put an extracted navit[hlm]dpi.xml file to the /sdcard/navit/navit.xml (it should be renamed) and replace all substrings .svgz and .svg with .png in it.

It also may be helpful to test different screen layouts available in prebuilt navit configuration.

comment:8 Changed 6 years ago by ziaou

The issue is fixed by removing size of navigation icon in OSD declaration in navit.xml.

The default value in the wiki is (for android) :

<osd enabled="yes" type="navigation_next_turn" x="0" y="-75" icon_src="%s_wh_64_64.png" />

I replaced with :

<osd enabled="yes" type="navigation_next_turn" x="0" y="-75" icon_src="%s_wh.png" />

because _x_y.png does not exist for nav icons.

Wiki should be updated accordingly.

comment:9 Changed 6 years ago by ziaou

Could #939 be considered as a duplicate of this bug ? or as deprecated ?

comment:10 Changed 6 years ago by tryagain

  • Owner changed from KaZeR to tryagain
  • Status changed from new to assigned

Now it become clear to me that this one is a separate bug introduced with svn r5063

I think rather than reverting that commit at least partially (for nav icons) I better change the osd code to the following:

  • if icon is found, proceed as before
  • else, if image matches regex .*_[0-9]+_[0-9]+\..* , try stripping the size suffix and loadaing image by that name, scaled to size given in removed suffix.

Probably that is even more better can be done in graphics part rather than in osd. As a bonus, this way we'll be able to scale on the fly any icon referenced from navit.xml to any needed size by giving the size suffix.

comment:11 Changed 6 years ago by tryagain

Fixed with r5107 r5108 r5109

Now image name can be given with or without any size suffix and filename extension, and navit will try to load images in the following order:

  • png prescaled to the needed size of name <imagename>_<w>_<h>.png;
  • by the exact name specified by user;
  • svg and svgz extensions added to image name with extension and _<w>_<h> part stripped;
  • png extension added to image name with extension and _<w>_<h> part stripped;
  • xpm extension added to image name with extension and _<w>_<h> part stripped.

If image name were specified with _<w>_<h> but image size were not otherwise specified (so it is for the next turn icons), found image would be scaled to given size on the fly if prescaled image not found.

All above attempts would be done only once for each given image name and size.

comment:12 Changed 6 years ago by tryagain

  • Resolution set to fixed
  • Status changed from assigned to closed

comment:13 Changed 5 years ago by sleske

Note: The CMake build is now also fixed; now SVG(Z)s and XPMs (if enabled) are copied to the build directory (and later installed). See r5157.

Note: See TracTickets for help on using tickets.