Summary: | Ability to add arbitrary Unicode characters to labels. | ||
---|---|---|---|
Product: | [Applications] kst | Reporter: | Duncan Hanson <duncan.hanson> |
Component: | general | Assignee: | kst |
Status: | RESOLVED FIXED | ||
Severity: | wishlist | ||
Priority: | NOR | ||
Version: | 1.x | ||
Target Milestone: | --- | ||
Platform: | unspecified | ||
OS: | Linux | ||
Latest Commit: | Version Fixed In: | ||
Sentry Crash Report: |
Description
Duncan Hanson
2007-04-30 21:25:11 UTC
SVN commit 659771 by dhanson: CCBUG:144890 for using \unicode{} in labels. M +21 -8 labelparser.cpp --- branches/work/kst/1.5/kst/src/libkstmath/labelparser.cpp #659770:659771 @@ -464,6 +464,15 @@ *skip = 7; setNormalChar(QChar(0x3A5+x), tail); return true; + } else if (txt.mid(from + 1).startsWith("nichar{")) { + uint charStart = from + 8; + uint charEnd = txt.find('}',charStart); + if (charEnd == -1) { + return false; + } + setNormalChar(QChar( (txt.mid(charStart,charEnd - charStart)).toInt(0,0)), tail); + *skip = charEnd - from + 1; + return true; } break; @@ -527,16 +536,20 @@ case 0x5e: // ^ dir = Chunk::Up; case 0x5f: // _ - if (ctail->vOffset != Chunk::None) { - if (ctail->vOffset != dir) { - ctail = new Chunk(ctail->prev, dir, false, true); - } else if (ctail->group) { + if (ctail->text.isEmpty() && !ctail->group) { + setNormalChar(c, &ctail); + } else { + if (ctail->vOffset != Chunk::None) { + if (ctail->vOffset != dir) { + ctail = new Chunk(ctail->prev, dir, false, true); + } else if (ctail->group) { + ctail = new Chunk(ctail, dir, false, true); + } else { + return 0L; // parse error - x^y^z etc + } + } else { ctail = new Chunk(ctail, dir, false, true); - } else { - return 0L; // parse error - x^y^z etc } - } else { - ctail = new Chunk(ctail, dir, false, true); } break; case 0x7b: // { Duncan, your changes wiped out the fix to an earlier bug. Could you check the code in again with the previous fix reinstated. SVN commit 660205 by arwalker: BUG:144890 Add back support for unichar without removal of earlier bug fix M +11 -15 labelparser.cpp --- branches/work/kst/1.5/kst/src/libkstmath/labelparser.cpp #660204:660205 @@ -465,10 +465,10 @@ setNormalChar(QChar(0x3A5+x), tail); return true; } else if (txt.mid(from + 1).startsWith("nichar{")) { - uint charStart = from + 8; - uint charEnd = txt.find('}',charStart); + int charStart = from + 8; + int charEnd = txt.find('}', charStart); if (charEnd == -1) { - return false; + return false; } setNormalChar(QChar( (txt.mid(charStart,charEnd - charStart)).toInt(0,0)), tail); *skip = charEnd - from + 1; @@ -536,20 +536,16 @@ case 0x5e: // ^ dir = Chunk::Up; case 0x5f: // _ - if (ctail->text.isEmpty() && !ctail->group) { - setNormalChar(c, &ctail); - } else { - if (ctail->vOffset != Chunk::None) { - if (ctail->vOffset != dir) { - ctail = new Chunk(ctail->prev, dir, false, true); - } else if (ctail->group) { - ctail = new Chunk(ctail, dir, false, true); - } else { - return 0L; // parse error - x^y^z etc - } - } else { + if (ctail->vOffset != Chunk::None) { + if (ctail->vOffset != dir) { + ctail = new Chunk(ctail->prev, dir, false, true); + } else if (ctail->group) { ctail = new Chunk(ctail, dir, false, true); + } else { + return 0L; // parse error - x^y^z etc } + } else { + ctail = new Chunk(ctail, dir, false, true); } break; case 0x7b: // { |