Претражи подршку

Избегните преваре подршке. Никада од вас нећемо тражити да зовете или шаљете поруке на број или да делите личне податке. Пријавите сумњиве радње преко „Пријавите злоупотребу” опције.

Сазнај више

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

  • 2 одговорa
  • 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.