Hello Guest

Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Messages - deen

Pages: [1]
1
Support / WordWrap and InlineStyle
« on: March 03, 2014, 08:25:16 pm »
Hello,

I wanted to use InlineStyle. I heavily used gradient selection (^1 to ^9).
I also used WordWrap to format the text.

Example:
text: "^1This ^2is ^3one ^4very ^5very ^6very ^7very, ^8long ^9text
Fixed word wrap width

I think the issue is inside the tk2dTextMesh#GetInlineStyleCommandLength(int cmdSymbol) method.
The gradient inline commands are missing, and so the escape characters aren't skipped:

Original:
static int GetInlineStyleCommandLength(int cmdSymbol) {
      int val = 0;
      switch (cmdSymbol) {
         case 'c': val = 5; break; // cRGBA
         case 'C': val = 9; break; // CRRGGBBAA
         case 'g': val = 9; break; // gRGBARGBA
         case 'G': val = 17; break; // GRRGGBBAARRGGBBAA
      }
      return val;
   }


After manual modification:
static int GetInlineStyleCommandLength(int cmdSymbol) {
        int val = 0;
        switch (cmdSymbol) {
            case 'c': val = 5; break; // cRGBA
            case 'C': val = 9; break; // CRRGGBBAA
            case 'g': val = 9; break; // gRGBARGBA
            case 'G': val = 17; break; // GRRGGBBAARRGGBBAA
            case '1': val = 1; break; // 1
            case '2': val = 1; break; // 2
            case '3': val = 1; break; // 3
            case '4': val = 1; break; // 4
            case '5': val = 1; break; // 5
            case '6': val = 1; break; // 6
            case '7': val = 1; break; // 7
            case '8': val = 1; break; // 8
            case '9': val = 1; break; // 9
        }
        return val;
    }

With the modification the formatted text displays as expected. Please see the attachment.


Best regards

Pages: [1]