Skip to content
Merged
2 changes: 2 additions & 0 deletions graf2d/graf/doc/macros/mathsymbols.C
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
38 changes: 23 additions & 15 deletions graf2d/graf/src/TLatex.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -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"};

Expand Down Expand Up @@ -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;
}
}
}
}
Expand Down Expand Up @@ -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)
Expand Down
12 changes: 8 additions & 4 deletions test/stressGraphics.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -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");
Expand All @@ -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");
Expand All @@ -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");
Expand All @@ -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");
Expand All @@ -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)");
}
Expand Down
2 changes: 1 addition & 1 deletion test/stressGraphics.ref
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion test/stressGraphics_web.ref
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion test/stressGraphics_zlibng.ref
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Loading
Loading