Comment 19 for bug 1239682

Revision history for this message
Alvin Penner (apenner) wrote :

actually I have done some further testing and thinking, and finally realized that none of the existing routines will be satisfactory, neither in the sp_file_open routine, nor in the sp_file_new routine, neither before rev 13937 nor after rev 13938. The reason being that they all use the call to doc->getDisplayUnit() in the case where there is no viewbox. External svg viewers such as IE do not have access to this variable, therefore we are certain to be incompatible with them if we use this variable. IE, as far as I can determine, defaults back to the use of px, and defaults also to a value of 96 dpi as well, if no viewbox exists, and therefore so should we, assuming no viewbox exists. At the same time, it is unacceptable to not define a viewbox at all, because that is just postponing the inevitable. At the same time it is also unacceptable to have file open behave differently than file new, so I would propose the following solution:

replace line 147 in sp_file_new and line 294 in sp_file_open in the file file.cpp:

        doc->setViewBox(Geom::Rect::from_xywh(0, 0, doc->getWidth().value(doc->getDisplayUnit()), doc->getHeight().value(doc->getDisplayUnit())));

with the new line:

        doc->setViewBox(Geom::Rect::from_xywh(0, 0, doc->getWidth().value("px"), doc->getHeight().value("px")));

I believe this should satisfy everyone, including the original problem reported here in comment 2. I will do some further testing tomorrow, but if it works as expected and if there are no strong objections in the next 24 hours, then I will commit this proposed change.