Version: 2.0.4 OS: Linux Legend items and left labels (units) are not properly escaped: e.g. _ gets interpreted as the beginning of a subscript. Reproducible: Always Steps to Reproduce: - Modify a unit in TWIN1xxx and TWIN2xxx from the sample_data/ subdir of the kst source tree, e.g. Torq_req from N.m to N_m - load Torq_req vs Time from TWIN1xxx - duplicate with the change data file tool to show Torq_req from TWIN2 as well - activate "Show legend" Actual Results: 1) The file path in the legend is not properly escaped (sample_*d*ata has d as a subscript) 2) The unit in the left label is not properly escaped Expected Results: All strings should be properly escaped Those are 2 concrete examples, but I think there are other places with similar issues. Barth, I'd appreciate if you could have a look at that because I don't have the overview how this works. I think the right way to handle it would be to create a global method to escape strings before passing them to the renderer, something like "static QString KstString::escape(const QString& inString)" like QRegExp::escape(). We could then store unescaped string in all objects (names etc) and escape them just before rendering.
The file name in the above example should be escaped. The units should not, because you might have units in terms of some constant like k_b. If you want N_m to not be subscripted, then you should use N\_m. Superscripts are even more likely, such as m/s^2
OK for your comment, what I can do is pre-escape unit names when reading them from file in the ASCII data source. But a static public method KstString::escape() would be nice to avoid duplicating code...
On Fri, Feb 24, 2012 at 6:09 PM, Nicolas Brisset <nicolas.brisset@eurocopter.com> wrote: > --- Comment #2 from Nicolas Brisset <nicolas brisset eurocopter com> 2012-02-24 23:09:20 --- > OK for your comment, what I can do is pre-escape unit names when reading them > from file in the ASCII data source. I don't understand: your should be able to have the ascii data source interpret m/s^2 as the 2 being a super script, shouldn't you? you could have an option to 'disable latex interpretation', but it would have to be optional. Being able to have properly formatted units with superscripts is pretty nice.
SVN commit 1282831 by netterfield: Properly escape special characters in file names. Also, fix a bug in label positions coming out of 'maximize plot' mode. M +5 -0 libkst/labelinfo.cpp M +1 -0 libkst/labelinfo.h M +14 -0 libkstapp/labelitem.cpp M +1 -0 libkstapp/labelitem.h M +3 -2 libkstapp/legenditem.cpp M +3 -3 libkstapp/viewitem.h WebSVN link: http://websvn.kde.org/?view=rev&revision=1282831
Thanks Barth! I guess you are right about units, it is nice to be able to have them being typeset. The only thing is that I doubt users who may run into the issue will know how to solve the issue. But then, they'll probably ask on the list and we can tell them, or decide what to do. For the rest, your fix seems to solve my issues.