# Node bounding box is way to big to node content

**URL:** <https://forum.graphviz.org/t/node-bounding-box-is-way-to-big-to-node-content/1927>\
**Category:** Help\
**Created:** [December 15, 2023, 9:56am UTC](https://forum.graphviz.org/t/node-bounding-box-is-way-to-big-to-node-content/1927 "2023-12-15T09:56:18Z")\
**Posts on this page:** 14\
**Page:** 1

<div class="post-metadata">

**Author:** ![Jens](https://avatars.discourse-cdn.com/v4/letter/j/d2c977/32.png) [@Jens](https://forum.graphviz.org/u/Jens)\
**Post date:** [December 15, 2023, 9:56am UTC](https://forum.graphviz.org/t/node-bounding-box-is-way-to-big-to-node-content/1927/1 "2023-12-15T09:56:18Z")

</div>

Hi

I am having an issue, with creating svg using Graphviz on an Azure machine.  
I use the command dot -Tsvg myfile.txt  
Having a VERY simple graph like this:

```
graph{
"test";
} 

```

it renders perfectly on my own machine, but when I create it from my AppService in Azure, it looks like hits:

 ![image](https://global.discourse-cdn.com/graphviz/original/2X/d/d1851f268725094686d07c23c35552dee695dc87.png)  
 ![image](https://global.discourse-cdn.com/graphviz/original/2X/f/f49af8d5107c9c43119aa88186d641d7b2947a4b.png)

With -v, it gives:  
dot - graphviz version 9.0.0 (20230911.1827)  
libdir = “C:\home\site\wwwroot\Graphviz”  
Activated plugin library: gvplugin\_core.dll  
Using render: svg:core  
Using device: svg:svg:core

Activated plugin library: gvplugin\_dot\_layout.dll  
Using layout: dot:dot\_layout  
The plugin configuration file:  
C:\home\site\wwwroot\Graphviz\config6  
was successfully loaded.  
render : cairo dot dot\_json fig gdiplus json json0 map mp pic pov ps svg tk xdot xdot\_json  
layout : circo dot fdp neato nop nop1 nop2 osage patchwork sfdp twopi  
textlayout : textlayout  
device : bmp canon cmap cmapx cmapx\_np dot dot\_json emf emfplus eps fig gif gv imap imap\_np ismap jpe jpeg jpg json json0 metafile mp pdf pic plain plain-ext png pov ps ps2 svg tif tiff tk xdot xdot1.2 xdot1.4 xdot\_json  
loadimage : (lib) bmp eps gif jpe jpeg jpg png ps svg  
pack info:  
mode undefined  
size 0  
flags 0  
margin 8  
pack info:  
mode node  
size 0  
flags 0  
fontname: “Times-Roman” resolved to: (ps:pango Times New Roman, ) (PangoCairoWin32Font) “Times New Roman, 13.9990234375”  
network simplex: 1 nodes 0 edges maxiter=2147483647 balance=1  
network simplex: 1 nodes 0 edges 0 iter 0.00 sec  
Maxrank = 0, minrank = 0  
mincross: pass 0 iter 0 trying 0 cur\_cross 0 best\_cross 0  
mincross %3: 0 crossings, 0.00 secs.  
network simplex: 1 nodes 0 edges maxiter=2147483647 balance=2  
network simplex: 1 nodes 0 edges 0 iter 0.00 sec  
routesplines: 0 edges, 0 boxes 0.00 sec  
Using render: svg:core  
Using device: svg:svg:core  
gvRenderJobs %3: 0.01 secs.

I guess it might be some environment variables or similar, which Graphviz is using, since it is the exact same version of Graphviz (9.0.0), and the same file I am trying to convert to svg.

Really hope someone can help me here,  
thanks in advance 🙂

---

<div class="post-metadata">

**Author:** ![mark](https://sea2.discourse-cdn.com/graphviz/user_avatar/forum.graphviz.org/mark/32/84_2.png) [@mark](https://forum.graphviz.org/u/mark)\
**Post date:** [December 15, 2023, 10:31am UTC](https://forum.graphviz.org/t/node-bounding-box-is-way-to-big-to-node-content/1927/2 "2023-12-15T10:31:52Z")

</div>

Probably different fonts on the machine?

---

<div class="post-metadata">

**Author:** ![Jens](https://avatars.discourse-cdn.com/v4/letter/j/d2c977/32.png) [@Jens](https://forum.graphviz.org/u/Jens)\
**Post date:** [December 15, 2023, 10:35am UTC](https://forum.graphviz.org/t/node-bounding-box-is-way-to-big-to-node-content/1927/3 "2023-12-15T10:35:02Z")

</div>

> [@mark](#):
>
> robably different fonts on the

I tried with Helvetica as well, but same issue.  
When I run it on my own machine, it also says:

fontname: “Times-Roman” resolved to: (ps:pango Times New Roman, ) (PangoCairoWin32Font) “Times New Roman, 13.9990234375”

So as far as I understand, it finds the same font on both machines ☹

For reference it looks like this on my own machine:

![image](https://global.discourse-cdn.com/graphviz/original/2X/9/997f4c465720e4b5541ce286a35d83c3662bcbf0.png)

---

<div class="post-metadata">

**Author:** ![mark](https://sea2.discourse-cdn.com/graphviz/user_avatar/forum.graphviz.org/mark/32/84_2.png) [@mark](https://forum.graphviz.org/u/mark)\
**Post date:** [December 15, 2023, 10:55am UTC](https://forum.graphviz.org/t/node-bounding-box-is-way-to-big-to-node-content/1927/4 "2023-12-15T10:55:48Z")

</div>

Try with -Tsvg:cairo. That uses different drawing backend that knows fonts better

---

<div class="post-metadata">

**Author:** ![Jens](https://avatars.discourse-cdn.com/v4/letter/j/d2c977/32.png) [@Jens](https://forum.graphviz.org/u/Jens)\
**Post date:** [December 15, 2023, 11:07am UTC](https://forum.graphviz.org/t/node-bounding-box-is-way-to-big-to-node-content/1927/5 "2023-12-15T11:07:25Z")

</div>

> [@Jens](#):
>
> ```auto
> graph{
> "test";
> } 
> 
> ```

Using -Tsvg:cairo only made it worse 😕

 ![image](https://global.discourse-cdn.com/graphviz/original/2X/8/811feb43375686d41231ea34cd9eb9ca08d5b1e2.png)

---

<div class="post-metadata">

**Author:** ![Jens](https://avatars.discourse-cdn.com/v4/letter/j/d2c977/32.png) [@Jens](https://forum.graphviz.org/u/Jens)\
**Post date:** [December 15, 2023, 12:35pm UTC](https://forum.graphviz.org/t/node-bounding-box-is-way-to-big-to-node-content/1927/6 "2023-12-15T12:35:20Z")

</div>

Now I tried to specify the height and the width directly on the node like this:  
graph{  
“Test” [width=1, height=0.5];  
}

Again it works perfectly on my local machine, but it totally ignores the width and height parameters, when run on Azure. Maybe that can help someone having a clue on what it is, or pointing me in some direction 😕

---

<div class="post-metadata">

**Author:** ![mark](https://sea2.discourse-cdn.com/graphviz/user_avatar/forum.graphviz.org/mark/32/84_2.png) [@mark](https://forum.graphviz.org/u/mark)\
**Post date:** [December 16, 2023, 12:32am UTC](https://forum.graphviz.org/t/node-bounding-box-is-way-to-big-to-node-content/1927/7 "2023-12-16T00:32:52Z")

</div>

Sometimes with svg we get a difference between fonts in the server and fonts in the browser. Might be worth trying to render to png with -Tpng to see a “server only” view of what’s going on.

---

<div class="post-metadata">

**Author:** ![scnorth](https://sea2.discourse-cdn.com/graphviz/user_avatar/forum.graphviz.org/scnorth/32/89_2.png) [@scnorth](https://forum.graphviz.org/u/scnorth)\
**Post date:** [December 16, 2023, 1:10pm UTC](https://forum.graphviz.org/t/node-bounding-box-is-way-to-big-to-node-content/1927/8 "2023-12-16T13:10:24Z")

</div>

Others may have traveled this road before: [Font-Size different (LARGE) in Azure Web App · Issue #857 · Automattic/node-canvas · GitHub](https://github.com/Automattic/node-canvas/issues/857)

It’s probably not that graphviz “totally ignores the width and height parameters”. More likely, it’s something like, the font rendering subsystem on a headless Azure node has its own, different definition of DPI or maybe DPI is invalid.

---

<div class="post-metadata">

**Author:** ![Jens](https://avatars.discourse-cdn.com/v4/letter/j/d2c977/32.png) [@Jens](https://forum.graphviz.org/u/Jens)\
**Post date:** [December 17, 2023, 8:24pm UTC](https://forum.graphviz.org/t/node-bounding-box-is-way-to-big-to-node-content/1927/9 "2023-12-17T20:24:50Z")

</div>

When i try to render it as .png, it gives me this:

 ![image](https://global.discourse-cdn.com/graphviz/original/2X/3/3c80e83a822b174bc1302b71928f20b2b5d07a2e.png)

I guess that tells me, that it can not find the font? I have tried to google around, and I also found some places mentioning the sandboxes which Azure Web Apps are running in, has not the web-fonts installed.

I have tried playing around with adding my own custom font. But have not been able to make it work.  
Is it correctly understood, that I have to install the font to be able to use it. It is not possible to just add a fontpath in my graph, to a ttf file?

---

<div class="post-metadata">

**Author:** ![scnorth](https://sea2.discourse-cdn.com/graphviz/user_avatar/forum.graphviz.org/scnorth/32/89_2.png) [@scnorth](https://forum.graphviz.org/u/scnorth)\
**Post date:** [December 18, 2023, 2:31am UTC](https://forum.graphviz.org/t/node-bounding-box-is-way-to-big-to-node-content/1927/10 "2023-12-18T02:31:51Z")

</div>

If I’m not mistaken, font lookup is always? done through fontconfig. fontconfig can be controlled through environment variables, and it has some runtime debugging options and path control settings. [This writeup](https://github.com/conan-io/conan-center-index/issues/2981) seems promising.

---

<div class="post-metadata">

**Author:** ![Jens](https://avatars.discourse-cdn.com/v4/letter/j/d2c977/32.png) [@Jens](https://forum.graphviz.org/u/Jens)\
**Post date:** [December 19, 2023, 10:20am UTC](https://forum.graphviz.org/t/node-bounding-box-is-way-to-big-to-node-content/1927/11 "2023-12-19T10:20:19Z")

</div>

To my understanding fontconfig uses fontconfig\_path, when it is build.  
So to be able to add a new directory, it will require me to make a new dll for fontconfig, instead of the one shipped with Graphviz.

This has to be done in a Linux environment, and I am sitting on a Windows machine.  
It really seems like a lot of work-around/hassle to be able to provide your own ttf file, and to be honest I am not sure I have the capabilities to do this.

It is sad, since I really prefer Graphviz, and it works perfectly on my own machine. But I am currently leaning towards using Mermaid.js, since it does not depend on the server, eventhough I think Graphviz functionality wise is much better ☹

---

<div class="post-metadata">

**Author:** ![scnorth](https://sea2.discourse-cdn.com/graphviz/user_avatar/forum.graphviz.org/scnorth/32/89_2.png) [@scnorth](https://forum.graphviz.org/u/scnorth)\
**Post date:** [December 19, 2023, 1:41pm UTC](https://forum.graphviz.org/t/node-bounding-box-is-way-to-big-to-node-content/1927/12 "2023-12-19T13:41:47Z")

</div>

BTW, it should still be possible to set [fontpath](https://graphviz.org/docs/attrs/fontname/) in the graph file. It should be possible to set the file name in fontname. At least, someone said that worked [12 years ago](https://stackoverflow.com/questions/4787273/graphviz-cant-find-any-fonts).

---

<div class="post-metadata">

**Author:** ![Jens](https://avatars.discourse-cdn.com/v4/letter/j/d2c977/32.png) [@Jens](https://forum.graphviz.org/u/Jens)\
**Post date:** [December 20, 2023, 2:04pm UTC](https://forum.graphviz.org/t/node-bounding-box-is-way-to-big-to-node-content/1927/13 "2023-12-20T14:04:12Z")

</div>

I have actually been past that post, and tried it, and it does not work like that anymore.  
It says here: [fontpath | Graphviz](https://graphviz.org/docs/attrs/fontpath/) - Used if Graphviz was not built with the [fontconfig library](https://www.freedesktop.org/wiki/Software/fontconfig/).  
So I think the post 12 years ago, is from before Graphviz utilized fontconfig.

I am however also in doubt if this is actually my problem.

In AZURE, if I try to use Arial and run “dot.exe -v -Tsvg -o .svg”  
Get the following line in my output:

- "fontname: “Arial” resolved to: (PangoCairoWin32Font) “Arial 13.9990234375"”

While if I try to run it with a weird/unknown font name, I get

- (dot.exe:18568): Pango-WARNING \*\*: couldn’t load font “WeirdFontName Not-Rotated 14”, falling back to “Sans Not-Rotated 14”, expect ugly output.  
fontname: unable to resolve “WeirdFontName”

So unless this does not really mean, that it can find the font, but just that it can match it in some list of names, then it can actually find the font.

But I still get this results for .png file, so I am quite confused at the moment:

 ![image](https://global.discourse-cdn.com/graphviz/original/2X/d/d5048700e32b1770de0b353b93bdeaa223a541d6.png)

---

<div class="post-metadata">

**Author:** ![Jens](https://avatars.discourse-cdn.com/v4/letter/j/d2c977/32.png) [@Jens](https://forum.graphviz.org/u/Jens)\
**Post date:** [January 3, 2024, 9:36am UTC](https://forum.graphviz.org/t/node-bounding-box-is-way-to-big-to-node-content/1927/14 "2024-01-03T09:36:28Z")

</div>

When I removed the “Fontconfig.dll” file from the Graphviz folder/version I had downloaded, it started working on Azure AppService as well! I am not sure why, but it makes it unable to use pango, and then the default when that is not working, is apparently looking a better place 🙂 I have not added anything else, like ie environment variables or fontpath, I just removed that dll.

@scnorth and @mark Thank you very much for all the suggestions, even though it was not directly any of them, which solved it, it was a huge help!
