File tree Expand file tree Collapse file tree 1 file changed +16
-5
lines changed Expand file tree Collapse file tree 1 file changed +16
-5
lines changed Original file line number Diff line number Diff line change @@ -1539,14 +1539,25 @@ void TSVG::Initialize()
15391539}
15401540
15411541// //////////////////////////////////////////////////////////////////////////////
1542- // / Write real value into output stream
1543- // / In compact form only integer value will be written
1542+ // / Write float value into output stream
1543+ // / In compact form try to store only first 2-3 significant digits
15441544
15451545void TSVG::WriteReal (Float_t r, Bool_t space)
15461546{
1547- if (fCompact )
1548- TVirtualPS::WriteInteger (std::lround (r), space);
1549- else
1547+ if (fCompact ) {
1548+ auto a = std::abs (r);
1549+ if (a > 10 )
1550+ TVirtualPS::WriteInteger (std::lround (r), space);
1551+ else if (a < 0.005 )
1552+ TVirtualPS::WriteReal (r, space);
1553+ else {
1554+ char str[15 ];
1555+ snprintf (str, 15 , (a > 1 ) ? " %3.1f" : " %5.3f" , r);
1556+ if (space)
1557+ PrintFast (1 ," " );
1558+ PrintStr (str);
1559+ }
1560+ } else
15501561 TVirtualPS::WriteReal (r, space);
15511562}
15521563
You can’t perform that action at this time.
0 commit comments