About:

GNUGoS60 is a port of the FSF's GNU Go game engine to Nokia's S60 smartphone platform running on SymbianOS.

It is Free Software.

Monday, February 19, 2007

Inkscape and svg2svgt

If you want to make an icon for S60 3.0 you are supposed to make them as SVGT, and to help with that the SDK contains a utility called svg2svgt. This is written in Java, and it's wonderful installer generally fails to install (at least on the 3 PCs I have tried). There is a workaround for this though which works, and is included in the release notes (though who ever reads those). Anyway, generally what happens is that it complains that it is not compatible with the Java 1.3.x that is by default installed on most Windows. It doesn't recognize even if you have later JRE installed. Anyway, the solution is to put JAVA 1.4.x in your PATH.

cmd
c:>set PATH=C:\program files\java\jre1.4.x\bin;%PATH%

then run the installer for svg2svgt from the command line.

c:>\Symbian\9.1\S60_3rd_MR\S60Tools\svg2svgt\installer\svg2svgtconverter.exe

Hey presto, it installs.

So now you look around for a way to make a SVG, and really there is only one good free option, and that is to use Inkscape. You duly design whatever you want and save it in Inkscape, and then run the svg2svgt on it. Hey presto, it looks nothing like the icon you designed in Inkscape.

What has gone wrong? For a reason explained here by Greg_Jokiel the svg2svgt doesn't parse the style attribute used extensively by Inkscape to set the colors and other things. The end result is that your icon looks nothing like you expected. shapes are the wrong color or disappear altogether. Greg_Jokiel gives a solution in that link, though it would be a pain to do by hand even for one icon. Anyway, I created a script svg2s60 to do what he recommends and make the Inkscape files parsable correctly by svg2svgt. No guarantee that it works correctly for all (or even any) files, but it worked correctly for my icon.

Updated 01 Sept 2007: "here" link fixed

11 comments:

Anonymous said...

Thanks for the help getting svg2svgtconverter installed! You have a broken link labeled "here".

Gnu Go for S60 said...

Thanks for the notification. "here" link is fixed now.

Unknown said...

Thanks for the tools. One word of advice to user:

It convert from Inkscape files. That mean the style="..." is one signe line. If you have the file modified by other mean - i.e. svg2svgt from Nokia - the result can be disastrous. To avoid any problem, oen the file in Inkscape and save it.

Anonymous said...

Is there an installer for vista?

Gnu Go for S60 said...

Sorry, I have no idea about Vista. Have you tried the existing svg2svgtconverter.exe from Nokia? If that doesn't work, maybe ask on Forum Nokia.

Anonymous said...

Hi,

There is a bug in this. If '/>' is on the same line as a 'style="' it is ommitted in the converted file and svg2svgt won't like it.

Eg. (I had to remove the < before the stops below)
stop
id="stop3175"
offset="0"
style="stop-color:#ff0600;stop-opacity:0.74901962;" />
stop
style="stop-color:#ff0600;stop-opacity:1;"
offset="1"
id="stop3159" />

The first stop won't be closed. I tried to fix but I'm not a perl regexp expert.

Error is like:
Unable to parse the XML file "Test.svg". Reason: "Element type "stop" must be followed by either attribute specifications, ">" or "/>".".

Can you fix and update... please :) Love the concept...

Anonymous said...

The svg2svgt installer must be run using Windows XP compatibility mode (right click on the installer, choose the compatibility tab) on Vista, as of the S60 3rd Edition FP2 SDK.

Anonymous said...

@Anonymous:

I guess the original script was written for a version of inkscape that put every attribute on its own line. Current versions of Inkscape put the end-of-element marker "/>" on the same line as the attribute.

Here is a version of the script that works for me:

while (<>) {
if (/(.*)style=\"(.*)\"(.*)/) {
my @styles = split /;/,$2;
my $before = $1;
my $after = $3;
print $before;
foreach $style (@styles) {
if ($style =~ /(.*):(.*)/) {
print "$1=\"$2\"\n";
}
}
print $after;
} else {
print STDERR "hello";
print $_;
}
}

Mário Homem said...

Great job, simple and working explanation... I was almost giving up... Thanks

Unknown said...

Hi,

I'm pulling my hair trying to find a sample svg icon just to verify that it can go into my midlet (nokia claims they support svg as app icon for a midlet). All of my tries (svg converted using the svg2svgt) failed so I thought perhaps someone can maybe send me a sample icon so that I can eliminate the issue of the svg I'm creating is not compatible for some reason.
I would really appriciate it if someone can email me such to tsayag@gmail.com
thanx!
-t

Anonymous said...

tsurz, I could use any inkscape svg file and test with S60 java. Of course lot of attributes doesn't work but you can see something.

I spent lot of time with Nokia-Scalable-Icon attribute in jad (tried with N97). You need to add "-MIDlet-1" to the end or svg icon doesn't usually appear. Looks like a bug to me since I've only one midlet in jar.