From 3e9aef47a91994cd129f07f58f9e50ad8766802d Mon Sep 17 00:00:00 2001 From: Gavin Nishizawa Date: Tue, 5 Sep 2023 18:23:33 -0700 Subject: [PATCH] emulate setting font size according to level --- d2layouts/d2grid/layout.go | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/d2layouts/d2grid/layout.go b/d2layouts/d2grid/layout.go index 3e5e1d104..3bef6a423 100644 --- a/d2layouts/d2grid/layout.go +++ b/d2layouts/d2grid/layout.go @@ -6,6 +6,7 @@ import ( "fmt" "math" "sort" + "strconv" "oss.terrastruct.com/d2/d2graph" "oss.terrastruct.com/d2/d2target" @@ -65,6 +66,12 @@ func withoutGridDiagrams(ctx context.Context, g *d2graph.Graph, layout d2graph.L } } else if len(child.ChildrenArray) > 0 { tempGraph := g.ExtractAsNestedGraph(child) + // emulating setting font size with layout + fontSize := child.Text().FontSize + if child.Style.FontSize == nil { + child.Style.FontSize = &d2graph.Scalar{} + } + child.Style.FontSize.Value = strconv.Itoa(fontSize) if err := layout(ctx, tempGraph); err != nil { return err }