# Fontsize fontname fontcolor all ignored

**URL:** <https://forum.graphviz.org/t/fontsize-fontname-fontcolor-all-ignored/1807>\
**Category:** Help\
**Created:** [October 3, 2023, 5:24pm UTC](https://forum.graphviz.org/t/fontsize-fontname-fontcolor-all-ignored/1807 "2023-10-03T17:24:18Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![ejhyer](https://avatars.discourse-cdn.com/v4/letter/e/3ec8ea/32.png) [@ejhyer](https://forum.graphviz.org/u/ejhyer)\
**Post date:** [October 3, 2023, 5:24pm UTC](https://forum.graphviz.org/t/fontsize-fontname-fontcolor-all-ignored/1807/1 "2023-10-03T17:24:18Z")

</div>

![qq.dot](https://global.discourse-cdn.com/graphviz/original/2X/e/eb1c5266aa5dd41927a3fcc867c16ddafe1e61bc.png)

This is my test graph:

```auto
digraph "TEST" {
    node [shape = ellipse, style = solid]
    edge [style = solid]

        blackrect {
            fontsize = 21.0
            fontname = "Bookman-LightItalic"
            fontcolor = black
            shape = rectangle
            style = solid
        }
        bigblue {
            fontsize = 27.75
            fontname = "Monospace"
            fontcolor = "blue"
            shape = ellipse
            style = solid
        }
        smallgreen {
            fontsize = 8.25
            fontname = "serif"
            fontcolor = "green"
            shape = ellipse
            style = solid
        }
        bigblue -> smallgreen {
            fontsize = 10.75
            fontname = "Inconsolata:style=Regular"
            fontcolor = black
            color = "red"
            style = solid
        }
    }

```

I installed graphviz using conda, and the output uses a single font and color for all objects. The output from `dot -v -Kdot -Tpng testgraph.dot -o testgraph.dot.png` contains this:

```auto
dot - graphviz version 8.1.0 (20230707.2238)
libdir = "/DATA/hyer/src/conda/miniconda3_cal/envs/graphviz/bin/../lib/graphviz"
Activated plugin library: libgvplugin_dot_layout.so.6
Using layout: dot:dot_layout
Using render: cairo:cairo
Using device: png:cairo:cairo
The plugin configuration file:
        /DATA/hyer/src/conda/miniconda3_cal/envs/graphviz/bin/../lib/graphviz/config6
                was successfully loaded.
    render : cairo dot dot_json fig gd json json0 map mp pic pov ps svg tk vrml 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 eps fig gd gd2 gif gv ico imap imap_np ismap jpe jpeg jpg json json0 mp pdf pic plain plain-ext png pov ps ps2 svg svgz tif tiff tk vrml vt100 vt100-24bit wbmp webp xdot xdot1.2 xdot1.4 xdot_json
    loadimage : (lib) bmp eps gd gd2 gif ico jpe jpeg jpg png ps svg webp xbm
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 Serif, REGULAR) (PangoCairoFcFont) "Inconsolata, Regular" /DATA/hyer/src/conda/miniconda3_cal/envs/graphviz/fonts/Inconsolata-Regular.ttf
network simplex: 1 nodes 0 edges maxiter=2147483647 balance=1
network simplex: 1 nodes 0 edges 0 iter 0.00 sec
network simplex: 2 nodes 1 edges maxiter=2147483647 balance=1
network simplex: 2 nodes 1 edges 0 iter 0.00 sec
Maxrank = 1, minrank = 0
mincross: pass 0 iter 0 trying 0 cur_cross 0 best_cross 0
mincross: pass 0 iter 0 trying 0 cur_cross 0 best_cross 0
mincross TEST: 0 crossings, 0.00 secs.
network simplex: 4 nodes 3 edges maxiter=2147483647 balance=2
network simplex: 4 nodes 3 edges 0 iter 0.00 sec
routesplines: 1 edges, 3 boxes 0.00 sec
Using render: cairo:cairo
Using device: png:cairo:cairo
dot: allocating a 182K cairo image surface (301 x 155 pixels)
gvRenderJobs TEST: 0.01 secs.

```

---

<div class="post-metadata">

**Author:** ![smattr](https://sea2.discourse-cdn.com/graphviz/user_avatar/forum.graphviz.org/smattr/32/85_2.png) [@smattr](https://forum.graphviz.org/u/smattr)\
**Post date:** [October 4, 2023, 7:04am UTC](https://forum.graphviz.org/t/fontsize-fontname-fontcolor-all-ignored/1807/3 "2023-10-04T07:04:37Z")

</div>

You need square brackets `[` `]`, not braces `{` `}` to enclose attributes. I.e. `blackrect[fontsize=21.0, fontname="Bookman-LightItalic", ...`. I’m surprised your graph passes through Graphviz warning-free.

---

<div class="post-metadata">

**Author:** ![steveroush](https://avatars.discourse-cdn.com/v4/letter/s/a9adbd/32.png) [@steveroush](https://forum.graphviz.org/u/steveroush)\
**Post date:** [October 4, 2023, 2:09pm UTC](https://forum.graphviz.org/t/fontsize-fontname-fontcolor-all-ignored/1807/4 "2023-10-04T14:09:16Z")

</div>

Nice catch!!

Here is what Graphviz sees ( **dot -Tcanon** ) . New subgraphs because of the braces and attributes at the graph-level.

```auto
digraph TEST {
	node [label="\N",
		shape=ellipse,
		style=solid
	];
	edge [style=solid];
	{
		graph [fontcolor=black,
			fontname="Bookman-LightItalic",
			fontsize=21.0,
			shape=rectangle,
			style=solid
		];
	}
	{
		graph [fontcolor=blue,
			fontname=Monospace,
			fontsize=27.75,
			shape=ellipse,
			style=solid
		];
	}
	{
		graph [fontcolor=green,
			fontname=serif,
			fontsize=8.25,
			shape=ellipse,
			style=solid
		];
	}
	{
		graph [color=red,
			fontcolor=black,
			fontname="Inconsolata:style=Regular",
			fontsize=10.75,
			style=solid
		];
	}
	blackrect;
	bigblue -> smallgreen;
}

```

---

<div class="post-metadata">

**Author:** ![ejhyer](https://avatars.discourse-cdn.com/v4/letter/e/3ec8ea/32.png) [@ejhyer](https://forum.graphviz.org/u/ejhyer)\
**Post date:** [October 4, 2023, 4:30pm UTC](https://forum.graphviz.org/t/fontsize-fontname-fontcolor-all-ignored/1807/5 "2023-10-04T16:30:19Z")

</div>

Thanks to all for the assist. Summary and postscript: The syntax I was using was wildly wrong, it’s amazing that graphviz was able to parse it. With this updated syntax:

```auto
digraph "TEST" {
    node [shape = ellipse, style = solid]
    edge [style = solid]
    blackrect [fontsize = 21.0, fontname = "Bookman-LightItalic", fontcolor = black, shape = rectangle, style = solid]        
    bigblue [fontsize = 27.75, fontname = "Monospace", fontcolor = "blue", shape = ellipse, style = solid]
    smallgreen [fontsize = 8.25, fontname = "serif", fontcolor = "green", shape = ellipse, style = solid]
    bigblue -> smallgreen [fontsize = 10.75, fontname = "Inconsolata:style=Regular", fontcolor = black, color = "red", style = solid, label="Connector"]
}

```

I get the response I was hoping for:  
 ![image](https://global.discourse-cdn.com/graphviz/original/2X/a/aeaa62de89efb876de786a987fd00d6d7d8efadf.png)
