# Font specification? "Times New Roman"

**URL:** <https://forum.graphviz.org/t/font-specification-times-new-roman/3255>\
**Category:** Dev\
**Created:** [January 7, 2026, 7:55am UTC](https://forum.graphviz.org/t/font-specification-times-new-roman/3255 "2026-01-07T07:55:25Z")\
**Posts on this page:** 10\
**Page:** 1

<div class="post-metadata">

**Author:** ![brianrmurphy](https://avatars.discourse-cdn.com/v4/letter/b/ce73a5/32.png) [@brianrmurphy](https://forum.graphviz.org/u/brianrmurphy)\
**Post date:** [January 7, 2026, 7:55am UTC](https://forum.graphviz.org/t/font-specification-times-new-roman/3255/1 "2026-01-07T07:55:25Z")

</div>

I recently have a bit of time and was thinking of trying to help improve graphviz performance, since it’s a tool I seem to use often in my work, and it hasn’t speeded up as much as computer hardware has over the past few decades. But first I was trying to make sure that I can run all tests locally to make it easier to detect any changes in output.

However, I found that, on my Ubuntu 24.04(.03) AMD laptop, I’m unable to pass one test, due to slight variation in output sizes:

```auto
tests/test_rtest.py:382: AssertionError
----------------------------- Captured stdout call -----------------------------
+ dot -Kdot -Tgv -o /tmp/pytest-of-brm/pytest-5/test_graph_shapes_input1_dot_g0/shapes_dot.gv /home/brm/code/graphviz/tests/graphs/shapes.gv
=========================== short test summary info ============================
FAILED tests/test_rtest.py::test_graph[shapes-input1-dot-gv-flags1-0] - asser...
============================== 1 failed in 0.05s ===============================

```

Comparing my local run with a local but pristine Docker-based build-and-test run, I eventually determined (by comparing strace output when running the test in the two environments) that the problem is most likely that my deskotop system is loading “Times\_New\_Roman.ttf”, while the pristine Ubuntu environment doesn’t have that font, and seems to be using “DejaVuSerif.ttf” instead.

As the documentation indicates that “Times New Roman” will be used by default, it seems odd that one needs the not-very-free `msttcorefonts` package for the described behavior to happen, and that tests on Linux (at least Ubuntu) don’t seem to expect this font. But anyway…

Trying to reproduce this test unchanged in my own desktop environment (for future debugging convenience), I have noticed that there is an environment variable `DOTFONTPATH` which might be used to set the font to use, but I still seem to wind up with `/usr/share/fonts/truetype/msttcorefonts/Times_New_Roman.ttf` used even if I set and export `DOTFONTPATH=/usr/share/fonts/truetype/dejavu`.

Am I using this environment variable wrong? Not sure where the latest docs are, other than dotguide.pdf in the source, which seems about 10 years old.

Thanks,

-Brian

---

<div class="post-metadata">

**Author:** ![brianrmurphy](https://avatars.discourse-cdn.com/v4/letter/b/ce73a5/32.png) [@brianrmurphy](https://forum.graphviz.org/u/brianrmurphy)\
**Post date:** [January 7, 2026, 8:09am UTC](https://forum.graphviz.org/t/font-specification-times-new-roman/3255/2 "2026-01-07T08:09:33Z")

</div>

Oops, I should have used an LLM before wasting human time. (But if noone asks questions and accepts answers in the forums, then how will LLMs datamine those questions and answers in the future?)

I now see that [https://graphviz.org/faq/font/`](https://graphviz.org/faq/font/%60) probably answers my question about why `DOTFONTPATH` doesn’t work: fontconfig takes precedence if available. I still think it’s odd that the Linux tests aren’t using “Times Roman”, which is still mentioned as the default: [fontname | Graphviz](http://graphviz.org/docs/attrs/fontname/).

Guess I’ll just patch the reference test output locally while I’m debugging, and put it back before sharing.

-Brian

---

<div class="post-metadata">

**Author:** ![bathterror](https://avatars.discourse-cdn.com/v4/letter/b/cab0a1/32.png) [@bathterror](https://forum.graphviz.org/u/bathterror)\
**Post date:** [January 7, 2026, 8:57am UTC](https://forum.graphviz.org/t/font-specification-times-new-roman/3255/3 "2026-01-07T08:57:42Z")

</div>

I don’t know how the graphviz CI is set up, but for my work’s test environment I have a very minimal font config file and tiny set of fonts and force the use of these by setting the FONTCONFIG\_FILE and XDG\_DATA\_HOME environment variables.

---

<div class="post-metadata">

**Author:** ![brianrmurphy](https://avatars.discourse-cdn.com/v4/letter/b/ce73a5/32.png) [@brianrmurphy](https://forum.graphviz.org/u/brianrmurphy)\
**Post date:** [January 7, 2026, 6:44pm UTC](https://forum.graphviz.org/t/font-specification-times-new-roman/3255/4 "2026-01-07T18:44:39Z")

</div>

Well, I gave up on running the CI scripts directly, but FYI, I was able to manually execute build and test properly to pass on Ubuntu-24.04 by doing the following:

```auto
docker run -it --rm -v $(pwd):/work -w /work registry.gitlab.com/graphviz/graphviz/ubuntu-24.04 
bin/bash
export PREFIX=$(mktemp -d)
./autogen.sh && ./configure --prefix=${PREFIX} && make clean && make && make install |& tee build.out2
env PATH=${PREFIX}/bin:/opt/virtualenv/bin:${PATH} C_INCLUDE_PATH=${PREFIX}/include \
  LD_LIBRARY_PATH=${PREFIX}/lib LIBRARY_PATH=${PREFIX}/lib \
  PYTHONPATH=${PREFIX}/lib/graphviz/python3 \
  TCLLIBPATH=${PREFIX}/lib/graphviz/tcl \
  PKG_CONFIG_PATH=${PREFIX}/lib/pkgconfig \
  graphviz_ROOT=${PREFIX} \
  python3 -m pytest tests

```

After the first line those are commands run in the docker image.

The specified image doesn’t have as many fonts as my dev machine, so the test passes. (Maybe I should slim down?)

I suspect that other CI jobs can be run similarly, though to run multiple configs one might want to figure out how to invoke the CI jobs directly.

-Brian

---

<div class="post-metadata">

**Author:** ![brianrmurphy](https://avatars.discourse-cdn.com/v4/letter/b/ce73a5/32.png) [@brianrmurphy](https://forum.graphviz.org/u/brianrmurphy)\
**Post date:** [January 7, 2026, 9:41pm UTC](https://forum.graphviz.org/t/font-specification-times-new-roman/3255/5 "2026-01-07T21:41:55Z")

</div>

Thanks for the hint. I was able to just create a minimal `fonts.conf` file and point `FONTCONFIG_FILE` to it to get consistent test output on my machine.  
Not sure why you needed `XDG_DATA_HOME`, maybe for some other tests?

---

<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:** [January 8, 2026, 9:47am UTC](https://forum.graphviz.org/t/font-specification-times-new-roman/3255/6 "2026-01-08T09:47:06Z")

</div>

Well this certainly explains why I was getting different results for that test locally than CI 🙂 One of my background tasks has been to resurrect the old “rtest” test suite that does these comparisons. But one of the problems, as you’ve experienced, is that a diff against a reference file doesn’t really work when some of these things are dependent on which fonts you have installed. We should probably explore how to isolate the tests and ensure they don’t see arbitrary local fonts the user has added.

---

<div class="post-metadata">

**Author:** ![bathterror](https://avatars.discourse-cdn.com/v4/letter/b/cab0a1/32.png) [@bathterror](https://forum.graphviz.org/u/bathterror)\
**Post date:** [January 8, 2026, 9:57am UTC](https://forum.graphviz.org/t/font-specification-times-new-roman/3255/7 "2026-01-08T09:57:48Z")

</div>

I forget the details, but I think it suited me to have relative paths in my minimal fontconfig file, and those are resolved relative to XDG\_DATA\_HOME.

---

<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:** [February 21, 2026, 4:52am UTC](https://forum.graphviz.org/t/font-specification-times-new-roman/3255/8 "2026-02-21T04:52:56Z")

</div>

I perhaps have not said this explicitly, but IMHO _the most valuable_ contribution to Graphviz testing right now would be this minimal fonts.conf file to make the tests/test\_rtest.py stuff reproducible.

---

<div class="post-metadata">

**Author:** ![brianrmurphy](https://avatars.discourse-cdn.com/v4/letter/b/ce73a5/32.png) [@brianrmurphy](https://forum.graphviz.org/u/brianrmurphy)\
**Post date:** [February 22, 2026, 6:04am UTC](https://forum.graphviz.org/t/font-specification-times-new-roman/3255/9 "2026-02-22T06:04:46Z")

</div>

I’m not sure how to incorporate it into the project, but if you point environment variable `FONTCONFIG_FILE` at the attached file then it should work. I guess you also need to make sure you have whatever fonts the Docker image has (but it doesn’t install any fonts directly).

(Attachment fonts.conf is missing)

---

<div class="post-metadata">

**Author:** ![brianrmurphy](https://avatars.discourse-cdn.com/v4/letter/b/ce73a5/32.png) [@brianrmurphy](https://forum.graphviz.org/u/brianrmurphy)\
**Post date:** [February 22, 2026, 6:15am UTC](https://forum.graphviz.org/t/font-specification-times-new-roman/3255/10 "2026-02-22T06:15:32Z")

</div>

[fonts.conf.txt](https://forum.graphviz.org/uploads/short-url/4YYUMgthzHCdDkjFuRhMPMut4x1.txt) (2.3 KB)

That’s the file.
