From 21035f02977fedfbd6cef25ae560bf8d6f6a2770 Mon Sep 17 00:00:00 2001 From: ferdymercury Date: Wed, 13 May 2026 09:22:54 +0200 Subject: [PATCH 01/11] [graf] fix misleading indentation --- graf2d/graf/src/TLatex.cxx | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/graf2d/graf/src/TLatex.cxx b/graf2d/graf/src/TLatex.cxx index a7c9a691adb5c..1164c293f6201 100644 --- a/graf2d/graf/src/TLatex.cxx +++ b/graf2d/graf/src/TLatex.cxx @@ -956,13 +956,15 @@ TLatex::TLatexFormSize TLatex::Analyse(Double_t x, Double_t y, const TextSpec_t } UInt_t lastsize = 0; if (!opFound) - for(k=0;k<82;k++) { - if ((opSpec==-1 || strlen(tab2[k])>lastsize) && UInt_t(length)>i+strlen(tab2[k])) { - if (strncmp(&text[i+1],tab2[k],strlen(tab2[k]))==0) { - lastsize = strlen(tab2[k]); - opSpec=k; - opFound = kTRUE; - if (i>0 && opCloseCurly==-2) opCloseCurly=i-1; + for (k = 0; k < 82; k++) { + if ((opSpec == -1 || strlen(tab2[k]) > lastsize) && UInt_t(length) > i + strlen(tab2[k])) { + if (strncmp(&text[i + 1], tab2[k], strlen(tab2[k])) == 0) { + lastsize = strlen(tab2[k]); + opSpec = k; + opFound = kTRUE; + if (i > 0 && opCloseCurly == -2) + opCloseCurly = i - 1; + } } } } From 34ff887d82901951d355578dc4ac7a3896eeb428 Mon Sep 17 00:00:00 2001 From: ferdymercury Date: Wed, 13 May 2026 09:24:21 +0200 Subject: [PATCH 02/11] [graf] avoid magic number in length of table --- graf2d/graf/src/TLatex.cxx | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/graf2d/graf/src/TLatex.cxx b/graf2d/graf/src/TLatex.cxx index 1164c293f6201..d860e248feaf0 100644 --- a/graf2d/graf/src/TLatex.cxx +++ b/graf2d/graf/src/TLatex.cxx @@ -955,8 +955,9 @@ TLatex::TLatexFormSize TLatex::Analyse(Double_t x, Double_t y, const TextSpec_t } } UInt_t lastsize = 0; + constexpr Int_t lenTab2 = sizeof(tab2) / sizeof(const char *); if (!opFound) - for (k = 0; k < 82; k++) { + for (k = 0; k < lenTab2; k++) { if ((opSpec == -1 || strlen(tab2[k]) > lastsize) && UInt_t(length) > i + strlen(tab2[k])) { if (strncmp(&text[i + 1], tab2[k], strlen(tab2[k])) == 0) { lastsize = strlen(tab2[k]); From e88382eaac0f3b68a13aa1371dfd0adff11fe8f4 Mon Sep 17 00:00:00 2001 From: ferdymercury Date: Wed, 13 May 2026 09:26:53 +0200 Subject: [PATCH 03/11] [graf] avoid duplicated checks --- graf2d/graf/src/TLatex.cxx | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/graf2d/graf/src/TLatex.cxx b/graf2d/graf/src/TLatex.cxx index d860e248feaf0..c7bffa4441ce5 100644 --- a/graf2d/graf/src/TLatex.cxx +++ b/graf2d/graf/src/TLatex.cxx @@ -1368,16 +1368,17 @@ TLatex::TLatexFormSize TLatex::Analyse(Double_t x, Double_t y, const TextSpec_t newSpec.fFont = GetTextFont(); if (gPad->GetPainter()->IsCocoa()) { if (opSpec == 75) letter = '\201'; // AA Angstroem - if (opSpec == 76) letter = '\214'; // aa Angstroem + else if (opSpec == 76) letter = '\214'; // aa Angstroem } else { if (opSpec == 75) letter = '\305'; // AA Angstroem - if (opSpec == 76) letter = '\345'; // aa Angstroem + else if (opSpec == 76) letter = '\345'; // aa Angstroem } } - if(opSpec == 80 || opSpec == 81) { - if (opSpec == 80) letter = '\042'; // #forall - if (opSpec == 81) letter = '\044'; // #exists - } + if(opSpec == 80) + letter = '\042'; // #forall + else if (opSpec == 81) + letter = '\044'; // #exists + Double_t props, propi; props = 1.8 ; // scale factor for #sum(66) propi = 2.3 ; // scale factor for #int(79) From db562e7d4be52bd57437fd402aa321cdd427dd6a Mon Sep 17 00:00:00 2001 From: ferdymercury Date: Wed, 13 May 2026 09:29:01 +0200 Subject: [PATCH 04/11] [TLatex] two new sumbols: textendash and textemdash Fixes https://github.com/root-project/root/issues/22259 --- graf2d/graf/src/TLatex.cxx | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/graf2d/graf/src/TLatex.cxx b/graf2d/graf/src/TLatex.cxx index c7bffa4441ce5..bc7a501d12c89 100644 --- a/graf2d/graf/src/TLatex.cxx +++ b/graf2d/graf/src/TLatex.cxx @@ -586,7 +586,7 @@ TLatex::TLatexFormSize TLatex::Analyse(Double_t x, Double_t y, const TextSpec_t "vee","Leftrightarrow","Leftarrow","Uparrow","Rightarrow", "Downarrow","diamond","LT","void1","copyright","void3","sum", "arctop","lbar","arcbottom","topbar","void8", "bottombar","arcbar", - "ltbar","AA","aa","void06","GT","int","forall","exists" }; + "ltbar","AA","aa","void06","GT","int","forall","exists", "textendash", "textemdash" }; const char *tab3[] = { "bar","vec","dot","hat","ddot","acute","grave","check","tilde","slash"}; @@ -1378,6 +1378,10 @@ TLatex::TLatexFormSize TLatex::Analyse(Double_t x, Double_t y, const TextSpec_t letter = '\042'; // #forall else if (opSpec == 81) letter = '\044'; // #exists + else if (opSpec == 82) + letter = '\055'; // #textendash + else if (opSpec == 83) + letter = '\276'; // #textemdash Double_t props, propi; props = 1.8 ; // scale factor for #sum(66) From ae3635f7b31c2f08206915c53698a6fd32071bad Mon Sep 17 00:00:00 2001 From: ferdymercury Date: Wed, 13 May 2026 09:30:52 +0200 Subject: [PATCH 05/11] [graf] add new dash symbols to macro test --- graf2d/graf/doc/macros/mathsymbols.C | 2 ++ 1 file changed, 2 insertions(+) diff --git a/graf2d/graf/doc/macros/mathsymbols.C b/graf2d/graf/doc/macros/mathsymbols.C index e64e1ced8fe29..e312032558fed 100644 --- a/graf2d/graf/doc/macros/mathsymbols.C +++ b/graf2d/graf/doc/macros/mathsymbols.C @@ -110,6 +110,8 @@ TCanvas *mathsymbols() y -= step ; Tl.DrawLatex(x1, y, "#exists") ; Tl.DrawText(x2, y, "#exists"); y -= step ; Tl.DrawLatex(x1, y, "#plus") ; Tl.DrawText(x2, y, "#plus"); y -= step ; Tl.DrawLatex(x1, y, "#minus") ; Tl.DrawText(x2, y, "#minus"); + y -= step ; Tl.DrawLatex(x1, y, "#textendash") ; Tl.DrawText(x2, y, "#textendash"); + y -= step ; Tl.DrawLatex(x1, y, "#textemdash") ; Tl.DrawText(x2, y, "#textemdash"); return Ms; } From 65c7e2f60e900035f74af4524befd50173f99650 Mon Sep 17 00:00:00 2001 From: ferdymercury Date: Wed, 13 May 2026 09:38:01 +0200 Subject: [PATCH 06/11] [graf] missing brace --- graf2d/graf/src/TLatex.cxx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/graf2d/graf/src/TLatex.cxx b/graf2d/graf/src/TLatex.cxx index bc7a501d12c89..94379764f6f36 100644 --- a/graf2d/graf/src/TLatex.cxx +++ b/graf2d/graf/src/TLatex.cxx @@ -956,7 +956,7 @@ TLatex::TLatexFormSize TLatex::Analyse(Double_t x, Double_t y, const TextSpec_t } UInt_t lastsize = 0; constexpr Int_t lenTab2 = sizeof(tab2) / sizeof(const char *); - if (!opFound) + if (!opFound) { for (k = 0; k < lenTab2; k++) { if ((opSpec == -1 || strlen(tab2[k]) > lastsize) && UInt_t(length) > i + strlen(tab2[k])) { if (strncmp(&text[i + 1], tab2[k], strlen(tab2[k])) == 0) { From 93526ce3707b5917e6b84ac632c6f3a34cca5bf5 Mon Sep 17 00:00:00 2001 From: ferdymercury Date: Wed, 13 May 2026 09:48:16 +0200 Subject: [PATCH 07/11] [tutorials] add new two dash symbols --- tutorials/visualisation/graphics/latex5.C | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/tutorials/visualisation/graphics/latex5.C b/tutorials/visualisation/graphics/latex5.C index 9c9ea9736fba2..245ab2aba8876 100644 --- a/tutorials/visualisation/graphics/latex5.C +++ b/tutorials/visualisation/graphics/latex5.C @@ -224,6 +224,9 @@ void latex5() y -= step; l.DrawLatex(x1, y, "#perp"); l.DrawText(x2, y, "#perp"); + y -= step; + l.DrawLatex(x1, y, "#textendash"); + l.DrawText(x2, y, "#textendash"); // Draw Fourth Column y = 0.96; @@ -289,6 +292,9 @@ void latex5() y -= step; l.DrawLatex(x1, y, "#odot"); l.DrawText(x2, y, "#odot"); + y -= step; + l.DrawLatex(x1, y, "#textemdash"); + l.DrawText(x2, y, "#textemdash"); // Save the picture in various formats c1->Print("mathsymb.ps"); From 5d0ae6d8330bcaee4e0a7a84a214d5159fb72f3e Mon Sep 17 00:00:00 2001 From: ferdymercury Date: Wed, 13 May 2026 10:09:27 +0200 Subject: [PATCH 08/11] [test,tutorials] add missing symbols, simplify step --- test/stressGraphics.cxx | 12 ++++++++---- tutorials/visualisation/graphics/latex5.C | 11 +++++++---- 2 files changed, 15 insertions(+), 8 deletions(-) diff --git a/test/stressGraphics.cxx b/test/stressGraphics.cxx index f2dc008d612cd..32d8645283b16 100644 --- a/test/stressGraphics.cxx +++ b/test/stressGraphics.cxx @@ -1271,7 +1271,7 @@ void tlatex5() l.SetTextSize(0.03); l.SetTextAlign(12); float y, step, x1, x2; - y = 0.96; step = 0.0465; x1 = 0.02; x2 = x1+0.04; + y = 0.96; step = 0.044; x1 = 0.02; x2 = x1+0.04; l.DrawLatex(x1, y, "#club") ; l.DrawText(x2, y, "#club"); y -= step ; l.DrawLatex(x1, y, "#voidn") ; l.DrawText(x2, y, "#voidn"); y -= step ; l.DrawLatex(x1, y, "#leq") ; l.DrawText(x2, y, "#leq"); @@ -1293,7 +1293,8 @@ void tlatex5() y -= step ; l.DrawLatex(x1, y, "#Leftrightarrow") ; l.DrawText(x2, y, "#Leftrightarrow"); y -= step ; l.DrawLatex(x1, y, "#void8") ; l.DrawText(x2, y, "#void8"); y -= step ; l.DrawLatex(x1, y, "#hbar") ; l.DrawText(x2, y, "#hbar"); - y = 0.96; step = 0.0465; x1 = 0.27; x2 = x1+0.04; + y -= step ; l.DrawLatex(x1, y, "#forall") ; l.DrawText(x2, y, "#forall"); + y = 0.96; x1 = 0.27; x2 = x1+0.04; l.DrawLatex(x1, y, "#diamond") ; l.DrawText(x2, y, "#diamond"); y -= step ; l.DrawLatex(x1, y, "#aleph") ; l.DrawText(x2, y, "#aleph"); y -= step ; l.DrawLatex(x1, y, "#geq") ; l.DrawText(x2, y, "#geq"); @@ -1315,7 +1316,8 @@ void tlatex5() y -= step ; l.DrawLatex(x1, y, "#prod") ; l.DrawText(x2, y, "#prod"); y -= step ; l.DrawLatex(x1, y, "#Box") ; l.DrawText(x2, y, "#Box"); y -= step ; l.DrawLatex(x1, y, "#parallel") ; l.DrawText(x2, y, "#parallel"); - y = 0.96; step = 0.0465; x1 = 0.52; x2 = x1+0.04; + y -= step ; l.DrawLatex(x1, y, "#exists") ; l.DrawText(x2, y, "#exists"); + y = 0.96; x1 = 0.52; x2 = x1+0.04; l.DrawLatex(x1, y, "#heart") ; l.DrawText(x2, y, "#heart"); y -= step ; l.DrawLatex(x1, y, "#Jgothic") ; l.DrawText(x2, y, "#Jgothic"); y -= step ; l.DrawLatex(x1, y, "#LT") ; l.DrawText(x2, y, "#LT"); @@ -1336,7 +1338,8 @@ void tlatex5() y -= step ; l.DrawLatex(x1, y, "#Uparrow") ; l.DrawText(x2, y, "#Uparrow"); y -= step ; l.DrawLatex(x1, y-0.01, "#sum") ; l.DrawText(x2, y, "#sum"); y -= step ; l.DrawLatex(x1, y, "#perp") ; l.DrawText(x2, y, "#perp"); - y = 0.96; step = 0.0465; x1 = 0.77; x2 = x1+0.04; + y -= step ; l.DrawLatex(x1, y, "#textendash") ; l.DrawText(x2, y, "#textendash"); + y = 0.96; x1 = 0.77; x2 = x1+0.04; l.DrawLatex(x1, y, "#spade") ; l.DrawText(x2, y, "#spade"); y -= step ; l.DrawLatex(x1, y, "#Rgothic") ; l.DrawText(x2, y, "#Rgothic"); y -= step ; l.DrawLatex(x1, y, "#GT") ; l.DrawText(x2, y, "#GT"); @@ -1357,6 +1360,7 @@ void tlatex5() y -= step ; l.DrawLatex(x1, y, "#Rightarrow") ; l.DrawText(x2, y, "#Rightarrow"); y -= step ; l.DrawLatex(x1, y-0.015, "#int") ; l.DrawText(x2, y, "#int"); y -= step ; l.DrawLatex(x1, y, "#odot") ; l.DrawText(x2, y, "#odot"); + y -= step ; l.DrawLatex(x1, y, "#textemdash") ; l.DrawText(x2, y, "#textemdash"); TestReport(C, "tlatex5", "TLatex 5 (Mathematical Symbols)"); } diff --git a/tutorials/visualisation/graphics/latex5.C b/tutorials/visualisation/graphics/latex5.C index 245ab2aba8876..4777702293e24 100644 --- a/tutorials/visualisation/graphics/latex5.C +++ b/tutorials/visualisation/graphics/latex5.C @@ -26,7 +26,7 @@ void latex5() l.SetTextAlign(12); float y, step, x1, x2; y = 0.96; - step = 0.0465; + step = 0.044; x1 = 0.02; x2 = x1 + 0.04; l.DrawLatex(x1, y, "#club"); @@ -91,10 +91,12 @@ void latex5() y -= step; l.DrawLatex(x1, y, "#hbar"); l.DrawText(x2, y, "#hbar"); + y -= step; + l.DrawLatex(x1, y, "#forall"); + l.DrawText(x2, y, "#forall"); // Draw Second Column y = 0.96; - step = 0.0465; x1 = 0.27; x2 = x1 + 0.04; l.DrawLatex(x1, y, "#diamond"); @@ -159,10 +161,12 @@ void latex5() y -= step; l.DrawLatex(x1, y, "#parallel"); l.DrawText(x2, y, "#parallel"); + y -= step; + l.DrawLatex(x1, y, "#exists"); + l.DrawText(x2, y, "#exists"); // Draw Third Column y = 0.96; - step = 0.0465; x1 = 0.52; x2 = x1 + 0.04; l.DrawLatex(x1, y, "#heart"); @@ -230,7 +234,6 @@ void latex5() // Draw Fourth Column y = 0.96; - step = 0.0465; x1 = 0.77; x2 = x1 + 0.04; l.DrawLatex(x1, y, "#spade"); From f6dbe9d4ae3d3e24b4de40aa14a366234dad9e22 Mon Sep 17 00:00:00 2001 From: ferdymercury Date: Wed, 13 May 2026 17:20:36 +0200 Subject: [PATCH 09/11] [test] adapt stress graphics refs --- test/stressGraphics.ref | 2 +- test/stressGraphics_zlibng.ref | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/test/stressGraphics.ref b/test/stressGraphics.ref index 5b3d019887e4b..c94bd663a397f 100644 --- a/test/stressGraphics.ref +++ b/test/stressGraphics.ref @@ -14,7 +14,7 @@ tlatex2 5442 80 13533 50 18430 700 12398 300 5469 80 tlatex3 9253 100 14437 150 19851 2400 12199 900 9283 100 tlatex4 8863 70 13705 100 24343 1100 23278 1700 8894 70 - tlatex5 12971 100 14810 50 34063 2000 32033 1200 13070 150 + tlatex5 13686 100 14880 50 34063 2000 32033 1200 13715 150 kerning 7444 100 13593 100 83557 3000 38505 4000 7494 150 itbf 5600 400 13302 400 16881 400 15063 800 5638 400 tmathtext 14190539 4000000 12986 100 23076 9500 25987 3000 14190704 4000000 diff --git a/test/stressGraphics_zlibng.ref b/test/stressGraphics_zlibng.ref index 5bd9ccf88228b..da4ccbd7b3a72 100644 --- a/test/stressGraphics_zlibng.ref +++ b/test/stressGraphics_zlibng.ref @@ -14,7 +14,7 @@ tlatex2 5488 80 13507 100 18439 700 12061 500 5502 80 tlatex3 9154 100 14323 150 20441 2400 12143 900 9283 100 tlatex4 8831 70 13705 100 24251 1100 23337 1700 8862 70 - tlatex5 12967 100 14770 50 33842 2000 30348 1200 12970 150 + tlatex5 13686 100 14840 50 33842 2000 32356 1200 13715 150 kerning 7454 100 13557 50 83044 3000 37165 4100 7504 150 itbf 5600 400 13302 300 16868 400 15083 800 5638 400 tmathtext 14193187 4000000 12984 100 27112 9500 25080 3000 14193352 4000000 From 099a0e7f66159a5b9a922d259f24205ac6bb1665 Mon Sep 17 00:00:00 2001 From: ferdymercury Date: Thu, 14 May 2026 11:00:54 +0200 Subject: [PATCH 10/11] [test] update svgref --- test/svg_ref/tlatex5.svg | 342 ++++++++++++++++++++------------------- 1 file changed, 179 insertions(+), 163 deletions(-) diff --git a/test/svg_ref/tlatex5.svg b/test/svg_ref/tlatex5.svg index 746025de769eb..259c7382955c8 100644 --- a/test/svg_ref/tlatex5.svg +++ b/test/svg_ref/tlatex5.svg @@ -10,334 +10,350 @@ tlatex5.svg #club -℘ + -#voidn +#voidn -≤ + -#leq +#leq -≈ + -#approx +#approx -ε +ε -#in +#in -⊃ + -#supset +#supset -∩ + -#cap +#cap -© +© -#ocopyright +#ocopyright -™ + -#trademark +#trademark -× +× -#times +#times -• + -#bullet +#bullet -ƒ +ƒ -#voidb +#voidb -" +" -#doublequote +#doublequote -❘ + -#lbar +#lbar -⎝ + -#arcbottom +#arcbottom -↓ + -#downarrow +#downarrow -↔ + -#leftrightarrow +#leftrightarrow -̯ +̯ -#Downarrow +#Downarrow -̫ +̫ -#Leftrightarrow +#Leftrightarrow -̺ +̺ -#void8 +#void8 -h +h - -#hbar + +#hbar + +Ͳ + +#forall #diamond -ℵ +ℵ + +#aleph + + -#aleph +#geq -≥ + -#geq +#neq -≠ + -#neq +#notin -∉ + -#notin +#subseteq -⊆ + -#subseteq +#cup -∪ +© -#cup +#copyright -© +̴ -#copyright +#void3 -̴ +÷ -#void3 +#divide -÷ +° -#divide +#circ -° + -#circ +#infty -∞ + -#infty +#angle -∠ + -#angle +#cbar -❘ + -#cbar +#arctop -⎛ + -#arctop +#leftarrow -← + -#leftarrow +#otimes -⊗ + -#otimes +#Leftarrow -⇐ + -#Leftarrow +#prod -∏ + + + + +#Box -#prod + + +#parallel - - - - -#Box +ʹ - - -#parallel +#exists #heart -ℑ + -#Jgothic +#Jgothic -< +< -#LT +#LT -≣ + -#equiv +#equiv -⊂ + -#subset +#subset -⊇ + -#supseteq +#supseteq -∧ + -#wedge +#wedge -Ⓡ + -#oright +#oright -Å + -#AA +#AA -± +± -#pm +#pm -… + -#3dots +#3dots -∇ + -#nabla +#nabla -↵ + -#downleftarrow +#downleftarrow -― + -#topbar +#topbar -⎧ + -#arcbar +#arcbar -↑ + -#uparrow +#uparrow -⊕ + -#oplus +#oplus -⇑ + -#Uparrow +#Uparrow -∑ + -#sum +#sum - - -#perp + + +#perp + +− + +#textendash #spade -ℜ + -#Rgothic +#Rgothic -> +> -#GT +#GT -∝ + -#propto +#propto -⊄ + -#notsubset +#notsubset -∅ + -#oslash +#oslash -∨ + -#vee +#vee -̲ +̲ -#void1 +#void1 -å +å -#aa +#aa -⁄ + -#/ +#/ -‧ + -#upoint +#upoint -∂ + -#partial +#partial -⌝ + -#corner +#corner -⎨ + -#ltbar +#ltbar -⎣ + -#bottombar +#bottombar -→ + -#rightarrow +#rightarrow -√ + -#surd +#surd -⇒ + -#Rightarrow +#Rightarrow -∫ + -#int +#int - - -#odot +#odot + +― + +#textemdash From 80b420c257afc9362a47c6d2eec5f10aa4f6e5eb Mon Sep 17 00:00:00 2001 From: ferdymercury Date: Thu, 14 May 2026 12:21:08 +0200 Subject: [PATCH 11/11] [test] adjust stressgraphics web ref --- test/stressGraphics_web.ref | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/stressGraphics_web.ref b/test/stressGraphics_web.ref index ea2a96c73f156..bcec92a8dc9f1 100644 --- a/test/stressGraphics_web.ref +++ b/test/stressGraphics_web.ref @@ -14,7 +14,7 @@ tlatex2 4760 50 9867 62 44760 8732 30329 7888 4760 50 tlatex3 9971 50 18489 50 44087 8064 32000 10000 9971 50 tlatex4 20678 50 15186 50 72078 10677 45000 30000 20678 50 - tlatex5 30431 50 20725 50 98532 11922 68020 33853 30431 50 + tlatex5 31915 50 21579 50 98532 11922 102142 33853 31915 50 kerning 13535 50 12671 50 179782 31960 66694 28160 13535 50 itbf 4538 50 9061 70 45280 8144 39000 14000 4538 50 tmathtext 109566 50 387050 100 76838 7616 62298 28760 109921 50