root icon indicating copy to clipboard operation
root copied to clipboard

Tex Gyre fonts has a bad side effect ...

Open couet opened this issue 1 year ago • 1 comments

Check duplicate issues.

  • [ ] Checked for duplicates

Description

As well explained in this forum post, the Tex Gyre fonts put in action by this PR on CMS demand have a very bad side effect: white spaces before special symbols like #pm are far too large. The following example shows the problem:

{
   auto c = new TCanvas;
   auto l1 = new TLatex(.1, 0.9, "A #pm #in B");
   l1->SetTextFont(42);
   l1->SetTextSize(0.05);
   l1->Draw();
    c->Print("file.ps");
    c->Print("file.pdf");
}

For the time being, there is no obvious fix except reverting the PR.

Reproducer

see the forum post

ROOT version

= v6.32.00

Installation method

any

Operating system

all

Additional context

No response

couet avatar Jun 27 '24 14:06 couet

Results of the latest investigation show that the problem lies in TTF::PrepareString. With the new font, the width of a whitespace is significantly larger than it was with the old one. The computation is done with:

(Int_t)((fgFace[fgCurFontIdx]->glyph->advance.x)>>6)

With the following code:

{
   auto c = new TCanvas;
   auto l1 = new TLatex(.1, 0.9, "A #alpha");
   l1->SetTextFont(42);
   l1->SetTextSize(0.05);
   l1->Draw();
   c->Print("file.ps");
}

This value in 19 with the new font whereas, it was 7 with the old one.

couet avatar Jun 28 '24 14:06 couet

Fixed with https://github.com/root-project/root/pull/15971

couet avatar Jul 03 '24 09:07 couet

Hi @couet,

It appears this issue is closed, but wasn't yet added to a project. Please add upcoming versions that will include the fix, or 'not applicable' otherwise.

Sincerely, :robot:

github-actions[bot] avatar Jul 04 '24 06:07 github-actions[bot]

Hi @couet,

It appears this issue is closed, but wasn't yet added to a project. Please add upcoming versions that will include the fix, or 'not applicable' otherwise.

Sincerely, :robot:

github-actions[bot] avatar Jul 05 '24 06:07 github-actions[bot]

Hi @couet,

It appears this issue is closed, but wasn't yet added to a project. Please add upcoming versions that will include the fix, or 'not applicable' otherwise.

Sincerely, :robot:

github-actions[bot] avatar Jul 08 '24 06:07 github-actions[bot]