Hi Xavi

Thanks a lot for the great story; I really enjoyed it!

It looks like you got further than I got staring myself blind getting it to 
import any fonts.

This mail is to say, that your findings is in no way forgotten, but I am 
effectively MIA for some more weeks (the being far away, with poor internet at 
irregular times), and I'll come back to it when caching up on my backlog in 
June.

I'm kind of sad having to postpone helping my new friends Alice and Bob.

Cheers,
Andreas
-- 
 ,-¤.  Kubuntu Linux
¤    ; http://www.kubuntu.org
 `-¤'  Linux for Human Beings

On Tuesday 05 May 2009 02:01:01 Xavi Drudis Ferran wrote:
> Hello. Here's a recent use case I've found myself with,
> and I think the user experience could be improved.
> The names and files have been changed to protect the
> guilty (and to simplify, to familiarize, to entertain...).
>
>
> Alice installs a Debian sid system, because when real girls
> want to go to Wonderland they know how to use a mirror
> (to download from, not to go through, what was Lewis Carroll thinking?).
>
> Alice is quite unexperienced with graphics, and worse with svg,
> but she's got this hola.svg file she would like to convert to pdf.
>
> In aptitude, the roadmap to Wonderland, she finds python-uniconvertor.
>
> So she installs it and simply runs:
>
>    al...@wonderland:~$ uniconvertor hola.svg hola.pdf
>    I can't find font Bitstream Vera Sans. I'll use Slim instead
>    I can't find font Slim. I'll use Slim instead
>    Fontsystem not yet implemented in UniConvertor. See
> /usr/share/doc/python-uniconvertor/README.Debian for more info
>
> She's directed to README.Debian, and she reads:
>
>    --- Font support ---
>    UniConvertor doesn't have font support yet and should be used against
> path-based files only.
>
>    See: http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=504223
>
>    SVG (and possibly other files as well) can be converted to path-based
> files in inkscape.
>
> Ok, ideally she would just draw a patch from a hat to implement ttf
> in python-uniconvertor, but she doesn't have a hat and the White Rabbit
> is in a hurry and can't lend her his hat. So she opens inkscape instead,
> loads hola.svg, and starts looking for a way to convert text to
> path-based files. She finds a menu called "camí" (path) and an option
> called "Objecte a camí" (object to path). Looks like it could be
> it. She clicks on the arrow tool, she uses "select All in all layers"
> from the Edit menu, and then she uses this "object to path" option.
> Finally she saves, as hola-path.svg (for good measure she chooses "simple
> SVG" as format).
>
> When she looks at the files, hola.svg has a <text> element and
> hola-path.svg has a <path> element instead. Good. :)
>
> So she now runs
>
>    al...@wonderland:~$ uniconvertor hola-path.svg hola-path.pdf
>
> And she gets exactly the same error refering her to docs
> that keep telling her to do what she thought she had already done. :(
> She's starting to feel some empathy for the Queen of Hearts,
> but she regains her temper and decides to ask for help.
> So Alice in Wonderland sends a message to Bob in Workaroundland
> (encrypted, of course, but that's irrelevant) asking him to
> come over here.
>
> When Bob meets Alice, looking closer, they see that the <path>
> element in hola-path.svg has a style attribute that defines
> a font-family property.
> Namely:
>  
> style="font-size:12px;font-style:normal;font-weight:normal;fill:#000000;fil
>l-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoi
> n:miter;stroke-opacity:1;font-family:Bitstream Vera Sans"
>
> The Mad Hatter says that's beacuse inkScape knows the font-family
> attribute won't be used for rendering but it may come handy in case
> anyone was to add other text or whatever, at least the information is
> not lost, but the March Hare thinks it's just that there was no need
>  to change the style attribute value, since other properties in it
> may be relevant. Alice and Bob don't care.
>
> Alice asks:
> Is there a better way to use inkScape to change text based svg files
> to path based svg files ? If so, could it please be explained clearer
> in README.Debian ? Thanks.
>
> But Bob isn't satisfied, so he goes:
> b...@workaround~: mkdir ~/.uniconvertor
> b...@workaround~: cd ~/.uniconvertor/
> b...@workaround~: ln -s /usr/share/fonts/type1/gsfonts/n021023l.afm .
> b...@workaround~: ln -s /usr/share/fonts/type1/gsfonts/n021023l.pfm .
> b...@workaround~: ln -s /usr/share/fonts/type1/gsfonts/n021023l.pfb .
> b...@workaround~: python /usr/share/doc/skencil/tools/mkfontdb.py -sxg .
> b...@workaround~: perl -pi -e 's/^[^,]+,[^,]+,/Slim,Slim,/' std.sfd
> b...@workaround~: cd
> b...@workaround~: uniconvertor hola-path.svg hola-path.pdf
>
> And it still fails the same as before
>
> Alice: So what ?. At least I didn't waste my time on my console...
>
> Bob: No, wait, the problem is uniconvertor can't load its fonts,
> in particular the fallback font (Slim). If it could, we wouldn't
> have to remove font-family styles from svgs...  it would only
> fail when actually rendering fonts whch wouldn't happen in
> path-based files...
>
> Alice: I see. That's why you tried to generate the .sfd file listing
> the fonts it loads and give it one random type1 font from ghostscript
> which you named as Slim in the sfd. You won't make it render fonts,
> but at least you can make it survive the mention of fonts.
>
> [...]
>
> After some more debugging, Alice finds that adding this one line at the
> end of /usr/lib/python2.5/site-packages/uniconvertor/app/Graphics/font.py
> fixes it:
>
> read_font_dirs()
>
> Now she can convert hola-path.svg to hola-path.pdf correctly,
> by following README.Debian.
>
> Bob: Great!. So this is it.
>
> Alice: Well. I can go on with my work, but it's not the end of the
> story. This function should have been called from
> app/__init__.py init_lib() anyway (through an Issue(...) call that fires
> a connector where fonts.py was theoretically subscribed). So there
> must be some other bug that causes this direct call to read_font_dirs()
> to be needed. Besides, there is a font_path that could include some
> system directory containing this one font and .sfd file already
> distributed with the debian package,so that users don't have to work
> around it themselves in each home directory...
>
> Bob: but we worked around it, look, now it even converts hola+empty.svg,
> which has a <text> element in it (without any text in it). Working
> with inkscape I sometimes leave empty text objects around when I don't
> realise I have the text tool selected instead of the selection tool.
> And I dont know how to remove them afterwards, because they're quite
> invisible. So it's useful.
>
> Alice: it's somewhat useful but it isn't wonderful enough for
> wonderland.  Let's send a comment to bug #504223 with our test files
> and link to file:///usr/share/doc/skencil/html/usersguide-4.html for
> some more info on .sfd , and let's hope for a wonderful workaround to
> be added to the package while we don't have font support, so that at
> least it works as README.Debian says. Thanks debian developers for
> uniconvertor, and thanks Bob for your workaround. Is there anything I
> can do for you ?
>
> Bob: Mmmm... I'm starting to enjoy wonderland, would you help me install
> Debian, Alice ?



--
To UNSUBSCRIBE, email to debian-bugs-dist-requ...@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmas...@lists.debian.org

Reply via email to