# Text rendering bug related to Tex GyreHeros font (again)

**URL:** <https://root-forum.cern.ch/t/text-rendering-bug-related-to-tex-gyreheros-font-again/61845>\
**Category:** ROOT\
**Tags:** bug\
**Created:** [October 4, 2024, 8:52am UTC](https://root-forum.cern.ch/t/text-rendering-bug-related-to-tex-gyreheros-font-again/61845 "2024-10-04T08:52:07Z")\
**Posts on this page:** 11\
**Page:** 1

<div class="post-metadata">

**Author:** ![lmassa](https://root-forum.cern.ch/letter_avatar_proxy/v4/letter/l/258eb7/32.png) [@lmassa](https://root-forum.cern.ch/u/lmassa)\
**Post date:** [October 4, 2024, 8:52am UTC](https://root-forum.cern.ch/t/text-rendering-bug-related-to-tex-gyreheros-font-again/61845/1 "2024-10-04T08:52:07Z")

</div>

### Describe the bug

It seems that the bug I previously reported [here](https://root-forum.cern.ch/t/text-rendering-bug-related-to-tex-gyreheros-font-since-v6-32/60032) is back. In the following canvas, the `#` symbols which are precede by a space character are too distant from the character that comes before them.

 ![file](https://root-forum.cern.ch/uploads/default/original/3X/e/f/efadc26ec7d44590282afdbca9113a8b01cfe123.png)

The problem persists also if I print the canvas to a pdf file: [file.pdf](https://root-forum.cern.ch/uploads/short-url/hMdfuBDZbUXt6NYAEsvEglNnXlQ.pdf) (12.4 KB).

### Expected behavior

### To Reproduce

```auto
gStyle->SetTextFont(42);
gStyle->SetTextSize(0.05);
TCanvas *c = new TCanvas;
TLatex l;
l.DrawLatexNDC(0.1, 0.9, "With space 123 #pm 456 123 < 456 123 #leq 456");
l.DrawLatexNDC(0.1, 0.8, "Without space 123#pm456 123<456 123#leq456");
c->Print("file.png");
c->Print("file.pdf", "pdf");

```

### Setup

```auto
ROOT v6.32.04
Built for linuxx8664gcc on Aug 30 2024, 16:41:36
From heads/master@tags/v6-32-04
With c++ (GCC) 14.2.1 20240805
Binary directory: /usr/bin

```

Running on Arch linux, using the official `root` package, version 6.32.04-1.

### Additional context

The problem is not present if I use, e.g., font number 1 (free serif).

---

<div class="post-metadata">

**Author:** ![StephanH](https://root-forum.cern.ch/letter_avatar_proxy/v4/letter/s/c68b51/32.png) [@StephanH](https://root-forum.cern.ch/u/StephanH)\
**Post date:** [October 4, 2024, 9:04am UTC](https://root-forum.cern.ch/t/text-rendering-bug-related-to-tex-gyreheros-font-again/61845/2 "2024-10-04T09:04:00Z")

</div>

I invite @couet to give us a hand on this.

---

<div class="post-metadata">

**Author:** ![couet](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/couet/32/12037_2.png) [@couet](https://root-forum.cern.ch/u/couet)\
**Post date:** [October 4, 2024, 10:06am UTC](https://root-forum.cern.ch/t/text-rendering-bug-related-to-tex-gyreheros-font-again/61845/3 "2024-10-04T10:06:36Z")

</div>

I’ll check

---

<div class="post-metadata">

**Author:** ![couet](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/couet/32/12037_2.png) [@couet](https://root-forum.cern.ch/u/couet)\
**Post date:** [October 4, 2024, 10:12am UTC](https://root-forum.cern.ch/t/text-rendering-bug-related-to-tex-gyreheros-font-again/61845/4 "2024-10-04T10:12:19Z")

</div>

> [@lmassa](#):
>
> ```auto
> gStyle->SetTextFont(42);
> gStyle->SetTextSize(0.05);
> TCanvas *c = new TCanvas;
> TLatex l;
> l.DrawLatexNDC(0.1, 0.9, "With space 123 #pm 456 123 < 456 123 #leq 456");
> l.DrawLatexNDC(0.1, 0.8, "Without space 123#pm456 123<456 123#leq456");
> c->Print("file.png");
> c->Print("file.pdf", "pdf");
> 
> ```

I tried your example and I get the right output . For me the bug is fixed (master version on Mac)

 ![Screenshot 2024-10-04 at 12.11.09](https://root-forum.cern.ch/uploads/default/original/3X/c/2/c255efb0e3cde5cf8b6954615b3b0a2f147aaba5.png)

---

<div class="post-metadata">

**Author:** ![lmassa](https://root-forum.cern.ch/letter_avatar_proxy/v4/letter/l/258eb7/32.png) [@lmassa](https://root-forum.cern.ch/u/lmassa)\
**Post date:** [October 4, 2024, 10:34am UTC](https://root-forum.cern.ch/t/text-rendering-bug-related-to-tex-gyreheros-font-again/61845/5 "2024-10-04T10:34:11Z")

</div>

Thanks for the quick check. I will try to update and see if it’s still present.

---

<div class="post-metadata">

**Author:** ![lmassa](https://root-forum.cern.ch/letter_avatar_proxy/v4/letter/l/258eb7/32.png) [@lmassa](https://root-forum.cern.ch/u/lmassa)\
**Post date:** [October 4, 2024, 10:47am UTC](https://root-forum.cern.ch/t/text-rendering-bug-related-to-tex-gyreheros-font-again/61845/6 "2024-10-04T10:47:08Z")

</div>

Tried version [6.32.06 from the official extra-testing repo](https://archlinux.org/packages/extra-testing/x86_64/root/), but I still see the issue.

---

<div class="post-metadata">

**Author:** ![lmassa](https://root-forum.cern.ch/letter_avatar_proxy/v4/letter/l/258eb7/32.png) [@lmassa](https://root-forum.cern.ch/u/lmassa)\
**Post date:** [October 4, 2024, 10:53am UTC](https://root-forum.cern.ch/t/text-rendering-bug-related-to-tex-gyreheros-font-again/61845/7 "2024-10-04T10:53:41Z")

</div>

Did [PR#15971](https://github.com/root-project/root/pull/15971) end up in 6.32-06? The fix to the previous bug was there, but I can not find the definition of `TTF::ComputeTrailingBlanksWidth(int)` in the sources for 6.32-06.

---

<div class="post-metadata">

**Author:** ![couet](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/couet/32/12037_2.png) [@couet](https://root-forum.cern.ch/u/couet)\
**Post date:** [October 4, 2024, 11:30am UTC](https://root-forum.cern.ch/t/text-rendering-bug-related-to-tex-gyreheros-font-again/61845/8 "2024-10-04T11:30:13Z")

</div>

It could be that this fix was not in that one yet.

---

<div class="post-metadata">

**Author:** ![lmassa](https://root-forum.cern.ch/letter_avatar_proxy/v4/letter/l/258eb7/32.png) [@lmassa](https://root-forum.cern.ch/u/lmassa)\
**Post date:** [October 4, 2024, 11:51am UTC](https://root-forum.cern.ch/t/text-rendering-bug-related-to-tex-gyreheros-font-again/61845/9 "2024-10-04T11:51:38Z")

</div>

Then I will compile master myself until it ends up in the official release. Thank you.

---

<div class="post-metadata">

**Author:** ![couet](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/couet/32/12037_2.png) [@couet](https://root-forum.cern.ch/u/couet)\
**Post date:** [October 4, 2024, 12:58pm UTC](https://root-forum.cern.ch/t/text-rendering-bug-related-to-tex-gyreheros-font-again/61845/10 "2024-10-04T12:58:28Z")

</div>

Indeed it is clear on the PR page [1] that it is intended to appear in version 6.34 as you can see on the right side of this page. So for now, as you noticed, the way to get the fix is to get the master version or to compile ROOt yourself.

[1] [Tex Gyre fonts has a bad side effect ... · Issue #15948 · root-project/root · GitHub](https://github.com/root-project/root/issues/15948)

---

<div class="post-metadata">

**Author:** ![system](https://root-forum.cern.ch/uploads/default/original/3X/e/f/efe4f24398fd8ffeb76bccb6ecc46d9d9c003376.png) [@system](https://root-forum.cern.ch/u/system)\
**Post date:** [October 18, 2024, 12:59pm UTC](https://root-forum.cern.ch/t/text-rendering-bug-related-to-tex-gyreheros-font-again/61845/11 "2024-10-18T12:59:24Z")

</div>

Closed on October 18, 2024, 12:59pm UTC

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.
