microsoft / automatic-graph-layout

A set of tools for graph layout and viewing
Other
1.34k stars 301 forks source link

node.Label.FontSize fails render proeprly when exporting to svg #351

Open wvdvegt opened 1 year ago

wvdvegt commented 1 year ago

node.Label.FontSize fails render proeprly when exporting to svg especially when the fontsize is less then the default (I used 8).

Expected: image

but got:

image

The export to SVG works nicely if I do not set the FontSize.

levnach commented 12 months ago

I do not know how to tackle this. I do not know how to measure a text string in a specific font for SVG export.

wvdvegt commented 11 months ago

The bonding box is not the issue, i think it's size is ok. But the font size is not rendered correctly (to big for the node so overflowing). So i think the issue is related on what happens in WriteLabel.

The following 3 lines are clearly not writing a correct font size reflecting the node's Font Size.

var fontSize = 16;
WriteAttribute("font-size", fontSize);
WriteLabelText(label.Text, x, fontSize);