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; } diff --git a/graf2d/graf/src/TLatex.cxx b/graf2d/graf/src/TLatex.cxx index a7c9a691adb5c..94379764f6f36 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"}; @@ -955,14 +955,17 @@ 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; + constexpr Int_t lenTab2 = sizeof(tab2) / sizeof(const char *); + 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) { + lastsize = strlen(tab2[k]); + opSpec = k; + opFound = kTRUE; + if (i > 0 && opCloseCurly == -2) + opCloseCurly = i - 1; + } } } } @@ -1365,16 +1368,21 @@ 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 + 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) propi = 2.3 ; // scale factor for #int(79) 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/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_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 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 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 diff --git a/tutorials/visualisation/graphics/latex5.C b/tutorials/visualisation/graphics/latex5.C index 9c9ea9736fba2..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"); @@ -224,10 +228,12 @@ 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; - step = 0.0465; x1 = 0.77; x2 = x1 + 0.04; l.DrawLatex(x1, y, "#spade"); @@ -289,6 +295,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");