Page 1 of 1

Bug when reading Greek symbol subscripts from file

Posted: Wed Sep 25, 2024 12:30 am
by kidorion
QCAD has a problem trashing Greek symbol subscripts when read from a saved file.

Generally Greek subscripts work fine until you save a file then retreive it. This problem applied to the previous QCAD version(s) as well.

Example
When created:
\fTimes New Roman|b0|i0|c0|p0;%%c\S^%%c;\PΔ\S^Δ;\Pπ\S^π;

After reading from a saved dxf file:
\fTimes New Roman|b0|i0|c0|p0;%%c\S^%%c;\PΔ\S^^U+0394;\Pπ\S^^U+03c0;

What is in the dxf file:
\fTimes New Roman|b0|i0|c0|p0;%%c\S^%%c;\P\U+0394\S^\U+0394;\P\U+03c0\S^\U+03c0;

Note:
  • This seems to be independent of font choice.
  • Note the above example shows that subscripting using \phi seems to be broken regardless. Separate bug I guess.
  • Posted here because registering for bug submission failed! :(
  • I use QCAD to create nice force diagrams for scientific work. So lots of math symbols.

Version: 3.30.1.0 (3.30.1)
Build Date: Jun 17 2024
Revision: 5067327
Qt Version: 5.14.2
Architecture: x86_64
Compiler: gcc 5.4.0

regards...

Re: Bug when reading Greek symbol subscripts from file

Posted: Wed Sep 25, 2024 7:05 am
by CVH
Hi,

On QCAD Pro 3.27.6.0 Win7 32bit
I can replicate the:
øø >>> %%c\S^%%c;

But I can't replicate the:
\PΔ\S^Δ;\Pπ\S^π; >>> \PΔ\S^^U+0394;\Pπ\S^^U+03c0; >>> \P\U+0394\S^\U+0394;\P\U+03c0\S^\U+03c0;

It may have to do with the limited file format R15(CE) vs R32/27(Pro).
Your second and last example don't all render as Greek symbols.


Even more peculiar.
With inline formatting (left) it works but as a non simple text in Times New Roman it doesn't recognize the newLine markers (\P).
Greek subscript.png
Greek subscript.png (7.37 KiB) Viewed 74983 times

It fails in general with a newLine in combination with sub/superscript (4 rightmost examples):
Normal supper-subscript and newLine.png
Normal supper-subscript and newLine.png (3.89 KiB) Viewed 74983 times

I know that a string is scanned by Regular Expressions (Wiki) and that can be a daunting task to get it right for any arbitrary combination ... :(


kidorion wrote:
Wed Sep 25, 2024 12:30 am
Posted here because registering for bug submission failed!
That should not happen, registering is straightforward, a formality, probably to keep spammers out.
It may not work if you use Greek letters, though. :lol:

Try again and if anything fails then let me know.
I can always enter a report on your behalf.

Regards,
CVH

Re: Bug when reading Greek symbol subscripts from file

Posted: Fri Sep 27, 2024 3:13 pm
by CVH
kidorion wrote:
Wed Sep 25, 2024 12:30 am
Note the above example shows that subscripting using \phi seems to be broken regardless. Separate bug I guess.
A bug report was created (FS#2604) and the issue should be fixed for the upcoming release. :P

Thanks Andrew.

Regards,
CVH

Re: Bug when reading Greek symbol subscripts from file

Posted: Tue Mar 11, 2025 10:02 pm
by kidorion
Hi Andrew,
Many thanks for your reply - and sorry for the super delayed response.

The problem still exists with version

Version: 3.32.2.0 (3.32.2)
Build Date: Feb 20 2025
Revision: 6616def
Qt Version: 5.14.2
Architecture: x86_64
Compiler: gcc 5.4.0

My take is this:
  1. On writing to a file QCAD expands Unicode characters like this Ω to a representation like this \U+2126.
  2. On reading the file QCAD fails to correctly convert \U+2126 back to the Unicode character if the original char was a subscript or superscript
I agree if a regexp is involved it is likely to be the guilty party since making errors is all too easy and debugging is hard. In my experience breaking a complex regexp into steps is safest.

Ironically, if I manually edit the DXF file and replace \U+2126 with the Unicode char the superscripts and subscripts chars are fine... so step one is not strictly necessary (maybe its part of the DXF standard); but regardless it is step two, the file parsing, that has the bug.

On the topic you discovered of sometimes incorrectly stacking superscripts directly above subscripts... for me this works correctly only if you place superscripts before subscripts.

I'll try submitting on bug tracker.

thanks!

Re: Bug when reading Greek symbol subscripts from file

Posted: Tue Mar 11, 2025 11:00 pm
by kidorion
Hi Andrew,

Still can't login to BugTracker... my email is registered but I get this on login...

Error #23: User or group not enabled for login.

thanks.