microsoft/automatic-graph-layout

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

wvdvegt opened this issue · 2 comments

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.

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.

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);