diff --git a/README/ReleaseNotes/v608/index.md b/README/ReleaseNotes/v608/index.md index fa48eaa3bb0c3a7f7d1b1b38eb8af219b49f4631..67bbbd941cdfc577c9211c85c63b84e311888220 100644 --- a/README/ReleaseNotes/v608/index.md +++ b/README/ReleaseNotes/v608/index.md @@ -140,8 +140,8 @@ We added a cache specifically for the fast option of the TTreeCloner to signific ## Math Libraries * Improve thread safety of TMinuit constructor [ROOT-8217] -* Vc has ben removed from the ROOT sources. If the option 'vc' is enabled, the package will be searched (by default), - alternatively the source tarfile can be downloded and build with the option 'builtin_vc'. +* Vc has ben removed from the ROOT sources. If the option 'vc' is enabled, the package will be searched (by default), + alternatively the source tarfile can be downloded and build with the option 'builtin_vc'. ## RooFit Libraries @@ -214,9 +214,10 @@ We added a cache specifically for the fast option of the TTreeCloner to signific * New optional parameter "option" in TPad::BuildLegend to set the TLegend option (Georg Troska). * TCandle: a new candle plot painter class. It is now used in THistPainter and THStack to paint candle plots (Georg Troska). -* Fix two issues with the fill patterns in `TTextDump` (reported [here](https://sft.its.cern.ch/jira/browse/ROOT-8206)): +* Fix two issues with the fill patterns in `TTeXDump` (reported [here](https://sft.its.cern.ch/jira/browse/ROOT-8206)): - The pattern number 3 was not implemented. - Filled area drawn with pattern where surrounded by a solid line. +* Support custom line styles in `TTeXDump` as requested [here](https://sft.its.cern.ch/jira/browse/ROOT-8215) * `TColor::GetFreeColorIndex()` allows to make sure the new color is created with an unused color index. diff --git a/graf2d/postscript/src/TTeXDump.cxx b/graf2d/postscript/src/TTeXDump.cxx index 72a3558a8e9cd8501a7f82527b4bf6fc2d8fe376..8f7f7e93d9007816489ef098f836116c6743c978 100644 --- a/graf2d/postscript/src/TTeXDump.cxx +++ b/graf2d/postscript/src/TTeXDump.cxx @@ -522,36 +522,34 @@ void TTeXDump::DrawPS(Int_t nn, Double_t *xw, Double_t *yw) SetColor(fLineColor); PrintStr("@"); PrintStr("\\draw [c"); - switch(fLineStyle) { - case 1: - break; - case 2: - PrintStr(",dashed"); - break; - case 3: - PrintStr(",dotted"); - break; - case 4: - PrintStr(",dash pattern=on 2.4pt off 3.2pt on 0.8pt off 3.2pt"); - break; - case 5: - PrintStr(",dash pattern=on 4pt off 2.4pt on 0.8pt off 2.4pt"); - break; - case 6: - PrintStr(",dash pattern=on 4pt off 2.4pt on 0.8pt off 2.4pt on 0.8pt off 2.4pt on 0.8pt off 2.4pt"); - break; - case 7: - PrintStr(",dash pattern=on 4pt off 4pt"); - break; - case 8: - PrintStr(",dash pattern=on 4pt off 2.4pt on 0.8pt off 2.4pt on 0.8pt off 2.4pt"); - break; - case 9: - PrintStr(",dash pattern=on 16pt off 4pt"); - break; - case 10: - PrintStr(",dash pattern=on 16pt off 8pt on 0.8pt off 8pt"); - break; + TString spec = gStyle->GetLineStyleString(fLineStyle); + TString tikzSpec; + TString stripped = TString{spec.Strip(TString::kBoth)}; + if (stripped.Length()) { + tikzSpec.Append(",dash pattern="); + Ssiz_t i{0}, j{0}; + bool on{true}, iterate{true}; + + while (iterate){ + j = stripped.Index(" ", 1, i, TString::kExact); + if (j == kNPOS){ + iterate = false; + j = stripped.Length(); + } + + if (on) { + tikzSpec.Append("on "); + on = false; + } else { + tikzSpec.Append("off "); + on = true; + } + int num = TString{stripped(i, j - i)}.Atoi(); + float pt = 0.2*num; + tikzSpec.Append(TString::Format("%.2fpt ", pt)); + i = j + 1; + } + PrintStr(tikzSpec.Data()); } PrintStr(",line width="); WriteReal(0.3*fLineScale*fLineWidth, kFALSE);