Comment 4 for bug 694517

Revision history for this message
MDP (m.d.p) wrote :

I would redifine the DESCRIPTION:
- A curve is converted to a SVG font glyph with a wrong y coordinate for the start point.

The error REPLICATION:
1) create a 800x800 square in a 800x800 page and 'get curves from selection', the description of polygon "d" of the square is 'm 0,0 800,0 0,800 -800,0 z', of the glyph is 'm 0,1024 800,0 0,-800 -800,0 z'. Note the y of the first, reference point from 0 becomes 1024.
2) create a 400x400 square centered in a 800x800 page and 'get curves from selection', polygon: m 200,200 400,0 0,400 -400,0 z
glyph: m 200,824 400,0 0,-400 -400,0 z . The y of the first point, 200 -> 824
3) a path for a 600x200 rectangle described as 'm 100,367 600,0 0,200 -600,0 z' but with a 'transform: translate(0,133)' in its parent node, obtained by draggin the thing around, will be converted as 'm 100,657 600,0 0,-200 -600,0 z'. While 367+657 is correctly 1024, as expected (still wrong of course), the translation (133px) is not computed - thus the obtained glyph will not be positioned like the one which is seen.

On fontforge, the first gliph will actually be drawn from point (0,1024), the second from (200,824), the third from (100,657).

Where would I TRACK it:
Inside file
svg-font-dialog.cpp
inside the function
SvgFontsDialog::set_glyph_description_from_selected_path
the path is flipped vertically then it is offset, only for what x is concerned.
I presume also the y needs to be interpolated.
Following is the original code:

    Geom::PathVector pathv = sp_svg_read_pathv(node->attribute("d"));
    //This matrix flips the glyph vertically
    Geom::Matrix m(Geom::Coord(1),Geom::Coord(0),Geom::Coord(0),Geom::Coord(-1),Geom::Coord(0),Geom::Coord(0));
    pathv*=m;
    //then we offset it
    pathv+=Geom::Point(Geom::Coord(0),Geom::Coord(get_selected_spfont()->horiz_adv_x));

Best Regards