为提升您的使用体验,本站正在维护,部分功能暂时无法使用。如果本站文章无法解决您的问题,您想要向社区提问的话,请到 Twitter 上的 @FirefoxSupport 或 Reddit 上的 /r/firefox 提问,我们的支持社区将会很快回复您的疑问。

搜索 | 用户支持

防范以用户支持为名的诈骗。我们绝对不会要求您拨打电话或发送短信,及提供任何个人信息。请使用“举报滥用”选项报告涉及违规的行为。

详细了解

Extracted svg figure is different with which show in orginal html file

  • 2 个回答
  • 1 人有此问题
  • 3 次查看
  • 最后回复者为 xiestcn

more options

I have a local HTML file which executes some js functions to draw svg figure. The browser rendered the HTML well, and then I extracted the svg conent from console using console.log(document.getElementsByTagName('svg')[0].outerHTML) and save as "t.svg". I found there was a slight difference between figure in "t.svg" and the orignal HMTL rendered by browser. But when I redid these in chrome and ms edge, the "t.svg" and the HTML were exactly same.

I have a local HTML file which executes some js functions to draw svg figure. The browser rendered the HTML well, and then I extracted the svg conent from console using console.log(document.getElementsByTagName('svg')[0].outerHTML) and save as "t.svg". I found there was a slight difference between figure in "t.svg" and the orignal HMTL rendered by browser. But when I redid these in chrome and ms edge, the "t.svg" and the HTML were exactly same.
已附加屏幕截图

所有回复 (2)

more options

The second screenshot shows a bit zoomed with only the text being zoomed and not their containers causing content to overlap.

You may have accidentally zoomed webpage(s). Reset the page zoom on pages that cause problems.

  • View -> Zoom -> Reset (Ctrl+0/Command+0 (zero))

Also make sure you aren't using "Zoom text only"

  • Settings -> General -> Language and Appearance -> Zoom
more options

cor-el said

Thanks for your reply!

The problem is not caused by Zoom setting. It's probably caused by Font family. The text's font family set in svg is not exists in my Win10 laptop. As I extracted the svg from console, the browser may compute the text box width use "Times new roman"(default font family set in firefox), and the rendered svg displayed the text in other Font family which is wider than "Times new roman" in same font size. I fixed the problem by changing the font family to "Microsoft YaHei".

But the problem is still there with default font family setting. Could Firefox do this by default without modify the settings (or may be in future version?), as the HTML can be rendered correctly by default.