Optimized SVG adds gaps in tutorials

Bug #435689 reported by jazzynico on 2009-09-24
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Inkscape
Low
codedread
Scour
High
codedread

Bug Description

I've tried to scour the Shapes tutorial on Windows XP, Inkscape rev. 22275. The saved files contains lots of gaps in the text and some parts of the text are rendered in italic when they should be regular. Probably affects the other tutorials.

Steps to reproduce:
1. Open the Shape tutorial (Help>Tutorials>Inkscape: Shapes).
2. Scour it ((File>Save As>Optmized SVG).
3. Reopen the saved file (File>Revert).

jazzynico (jazzynico) wrote :
codedread (codedread) wrote :

I see at least two problems when scouring the tutorials:

1) Scoured tutorial had to be zoomed in several times - not sure why.

2) Scour sees the following
    <flowDiv
        xml:space="preserve"
        id="flowDiv2890">Inkscape has four versatile <flowSpan
   style="font-style:italic"
   id="flowSpan2892">shape tools</flowSpan>, each tool capable of
creating and editing its own type of shapes. A shape is an object which you can modify
in ways unique to this shape type, using draggable <flowSpan
   style="font-style:italic"
   id="flowSpan2894">handles</flowSpan> and
numeric <flowSpan
   style="font-style:italic"
   id="flowSpan2896">parameters</flowSpan> that determine the shape's appearance.
</flowDiv>

Scour sees the flowDiv element and notices that all the element children (the three flowSpans) all have font-style="italic" so it thinks it can commonize font-style="italic" to the flowDiv. This is definitely a bug in Scour that needs to be fixed (basically only commonize attributes if the parent only has element children - but not if it has text children).

Changed in inkscape:
status: New → Confirmed
Changed in scour:
status: New → Confirmed
importance: Undecided → High
assignee: nobody → codedread (codedread)
codedread (codedread) wrote :

Ok, fixed the commonizing of attributes problem - but there is another problem. Scour tries to pretty-print elements, even when whitespace is important. So it turns this:

    <flowDiv
       xml:space="preserve"
       id="flowDiv2890">Inkscape has four versatile <flowSpan
   style="font-style:italic"
   id="flowSpan2892">shape tools</flowSpan>, each tool capable of
creating and editing its own type of shapes. A shape is an object which you can modify
in ways unique to this shape type, using draggable <flowSpan
   style="font-style:italic"
   id="flowSpan2894">handles</flowSpan> and
numeric <flowSpan
   style="font-style:italic"
   id="flowSpan2896">parameters</flowSpan> that determine the shape's appearance.
</flowDiv>

into this:

  <flowDiv id="flowDiv2890" xml:space="preserve">Inkscape has four versatile
   <flowSpan id="flowSpan2892" font-style="italic">shape tools</flowSpan>
, each tool capable of
creating and editing its own type of shapes. A shape is an object which you can modify
in ways unique to this shape type, using draggable
   <flowSpan id="flowSpan2894" font-style="italic">handles</flowSpan>
and
numeric
   <flowSpan id="flowSpan2896" font-style="italic">parameters</flowSpan>
that determine the shape's appearance. </flowDiv>

which adds whitespace to the flowed text in the wrong places.

codedread (codedread) wrote :

Ok, fixed in r145 - haven't pushed it to the lp servers yet. Can you try the attached scour.py script??field.comment=Ok, fixed in r145 - haven't pushed it to the lp servers yet. Can you try the attached scour.py script?

jazzynico (jazzynico) wrote :

Thanks Jeff, it's almost working.
I still see three bugs:
1. The tutorial is unzoomed so that it fits in the window.
2. There are extra white spaces in the side texts (Use Ctrl+down arrow to scroll).
3. The page border and shadow are shown.

The page size is not adjusted to the drawing, but it's the same with the original tutorial.
Thanks again for this improvement.

summary: - Optimized SVG add gaps in tutorials
+ Optimized SVG adds gaps in tutorials
codedread (codedread) wrote :

Hi JazzyNico,

1. It looks like this is because scour automatically strips out inkscape/sodipodi elements and attributes. To get the zoom proper, you would need to add back in the xmlns:inkscape, xmlns:sodipodi declarations in <svg> and the sodipodi:namedView element. I did this manually and it showed up just fine, but scour could be run with --keep-editor-data (this will make the resultant SVG file much larger though).

2. I've now fixed the bug with the side texts, checked in as r146 and pushed to the launchpad servers. I was not properly determining if whitespace had preserved up the tree (only on the immediate parent). On a side note, I'm on a Mac, and Ctrl+down arrow does not work at all. ;) Any idea why?

3. Actually the original tutorial doesn't seem to have a border for me, does it for you? When I scour the tutorial, I actually DO get a border (though it is zoomed all the way out as in #1). If I I manually add the namedView as above and set showborder="true" in the namedView the border/dropshadow did show up. In both cases, I get a page border that seems to end at "As a useful complement for the on-canvas handle dragging..." in the "Star" section. I'm not sure what's going on here, sorry.

Also, do you know why the tutorial paragraph alignments are all screwed up? Even in the original tutorials in Inkscape 0.47 I see the second paragraph ("For example, with a star...") starts too high up in the vertical direction. It almost overlaps the first paragraph end line ("...but the reverse configuration is not possible.")

jazzynico (jazzynico) wrote :

Since the side texts are now ok (sorry, I really don't know about Mac keys, I can test with Ubuntu and XP only), I think r146 fixes all the bugs listed in this report.
The zoom and page issues are resolved if I run scour from a command line with --keep-editor-data. But it's not a bug and we don't need to activate this option when exporting from Inkscape.

I think there's another weird bug (xlink:href is turned into href) when scour is run from the command line with Python 2.6 (works fine when exporting from Inkscape and Python 2.5). I'll probably open a specific scour report if I can confirm it on Ubuntu. So let's wait a bit before committing this scour rev in Inkscape.

The overlapping bug is now fixed in SVN. The tutorials just needed to be rebuilt!

Thanks!

Changed in inkscape:
status: Confirmed → In Progress
codedread (codedread) wrote :

Once 0.21 is released, will update the plugin for Inkscape - so for now I will leave this bug opened

Changed in scour:
status: Confirmed → Fix Committed
su_v (suv-lp) wrote :

<off-topic>

> I'm on a Mac, and Ctrl+down arrow does not work at all

1) OS X version, X11/XQuartz version, Inkscape version?
2) Do you use a '~/.Xmodmap' file (e.g. like recommended in the FAQ) that - besides remapping the Option/Alt key from 'Mode_switch' to 'Alt_L' - also switches 'Cmd' and 'Ctrl' (often recommended or wished for by Mac users who want to use the same key as in native apps for copy&paste)?

For me 'Ctrl' + <down arrow> works fine for scrolling (need to click once first on the canvas though to set focus) - but I only remapped the left Option/Alt key to 'Alt_L' in '~/.Xmodmap' (I can still use the right Option/Alt key for diacritics and special chars in text input) and didn't change the mapping for the Ctrl or Cmd keys.

MBP 15" late 2008, OS X 10.5.8, XQuartz 2.4.0

</off-topic>

codedread (codedread) on 2009-09-28
Changed in scour:
status: Fix Committed → Fix Released
codedread (codedread) wrote :

Scour 0.21 script is now included in Inkscape trunk at r22326

Changed in inkscape:
status: In Progress → Fix Committed
jazzynico (jazzynico) on 2009-09-29
Changed in inkscape:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers