only set font-size if different from default

This commit is contained in:
Gavin Nishizawa 2023-09-25 12:16:32 -07:00
parent d7d088cc45
commit b55ff3debc
No known key found for this signature in database
GPG key ID: AE3B177777CE55CD

View file

@ -1267,8 +1267,12 @@ func drawShape(writer, appendixWriter io.Writer, diagramHash string, targetShape
if !isLight { if !isLight {
class = "dark-code" class = "dark-code"
} }
fmt.Fprintf(writer, `<g transform="translate(%f %f)" class="%s" style="font-size:%v">`, var fontSize string
box.TopLeft.X, box.TopLeft.Y, class, targetShape.FontSize, if targetShape.FontSize != d2fonts.FONT_SIZE_M {
fontSize = fmt.Sprintf(` style="font-size:%v"`, targetShape.FontSize)
}
fmt.Fprintf(writer, `<g transform="translate(%f %f)" class="%s"%s>`,
box.TopLeft.X, box.TopLeft.Y, class, fontSize,
) )
rectEl := d2themes.NewThemableElement("rect") rectEl := d2themes.NewThemableElement("rect")
rectEl.Width = float64(targetShape.Width) rectEl.Width = float64(targetShape.Width)