diff options
-rw-r--r-- | src/ui/color.h | 1 | ||||
-rw-r--r-- | src/ui/text.c | 28 |
2 files changed, 13 insertions, 16 deletions
diff --git a/src/ui/color.h b/src/ui/color.h index e2a1c95b..8039506f 100644 --- a/src/ui/color.h +++ b/src/ui/color.h | |||
@@ -175,6 +175,7 @@ iLocalDef iBool isRegularText_ColorId(enum iColorId d) { | |||
175 | #define asciiBase_ColorEscape 33 | 175 | #define asciiBase_ColorEscape 33 |
176 | #define asciiExtended_ColorEscape (128 - asciiBase_ColorEscape) | 176 | #define asciiExtended_ColorEscape (128 - asciiBase_ColorEscape) |
177 | 177 | ||
178 | #define restore_ColorEscape "\r\x24" /* ASCII Cancel */ | ||
178 | #define black_ColorEscape "\r!" | 179 | #define black_ColorEscape "\r!" |
179 | #define gray25_ColorEscape "\r\"" | 180 | #define gray25_ColorEscape "\r\"" |
180 | #define gray50_ColorEscape "\r#" | 181 | #define gray50_ColorEscape "\r#" |
diff --git a/src/ui/text.c b/src/ui/text.c index 8736ed18..b2a9af2e 100644 --- a/src/ui/text.c +++ b/src/ui/text.c | |||
@@ -716,6 +716,7 @@ struct Impl_RunArgs { | |||
716 | iInt2 pos; | 716 | iInt2 pos; |
717 | int xposLimit; /* hard limit for wrapping */ | 717 | int xposLimit; /* hard limit for wrapping */ |
718 | int xposLayoutBound; /* visible bound for layout purposes; does not affect wrapping */ | 718 | int xposLayoutBound; /* visible bound for layout purposes; does not affect wrapping */ |
719 | int color; | ||
719 | const char ** continueFrom_out; | 720 | const char ** continueFrom_out; |
720 | int * runAdvance_out; | 721 | int * runAdvance_out; |
721 | }; | 722 | }; |
@@ -770,17 +771,6 @@ static iRect run_Font_(iFont *d, const iRunArgs *args) { | |||
770 | ch = nextChar_(&chPos, args->text.end); | 771 | ch = nextChar_(&chPos, args->text.end); |
771 | } | 772 | } |
772 | } | 773 | } |
773 | #if 0 | ||
774 | iChar nextCh = 0; { | ||
775 | /* TODO: Since we're peeking ahead, should use this on the next loop iteration. */ | ||
776 | const char *ncp = chPos; | ||
777 | nextCh = nextChar_(&ncp, text.end); | ||
778 | } | ||
779 | /* VS15: Peek ahead and treat as Emoji font. */ | ||
780 | if (nextCh == emojiVariationSelector_Char) { | ||
781 | isEmoji = iTrue; | ||
782 | } | ||
783 | #endif | ||
784 | if (isVariationSelector_Char(ch)) { | 774 | if (isVariationSelector_Char(ch)) { |
785 | ch = nextChar_(&chPos, args->text.end); /* skip it */ | 775 | ch = nextChar_(&chPos, args->text.end); /* skip it */ |
786 | } | 776 | } |
@@ -832,11 +822,16 @@ static iRect run_Font_(iFont *d, const iRunArgs *args) { | |||
832 | } | 822 | } |
833 | if (ch == '\r') { | 823 | if (ch == '\r') { |
834 | iChar esc = nextChar_(&chPos, args->text.end); | 824 | iChar esc = nextChar_(&chPos, args->text.end); |
835 | if (esc == '\r') { /* Extended range. */ | 825 | int colorNum = args->color; |
826 | if (esc != 0x24) { /* ASCII Cancel */ | ||
827 | colorNum = esc - asciiBase_ColorEscape; | ||
828 | } | ||
829 | else if (esc == '\r') { /* Extended range. */ | ||
836 | esc = nextChar_(&chPos, args->text.end) + asciiExtended_ColorEscape; | 830 | esc = nextChar_(&chPos, args->text.end) + asciiExtended_ColorEscape; |
831 | colorNum = esc - asciiBase_ColorEscape; | ||
837 | } | 832 | } |
838 | if (mode & draw_RunMode && ~mode & permanentColorFlag_RunMode) { | 833 | if (mode & draw_RunMode && ~mode & permanentColorFlag_RunMode) { |
839 | const iColor clr = get_Color(esc - asciiBase_ColorEscape); | 834 | const iColor clr = get_Color(colorNum); |
840 | SDL_SetTextureColorMod(text_.cache, clr.r, clr.g, clr.b); | 835 | SDL_SetTextureColorMod(text_.cache, clr.r, clr.g, clr.b); |
841 | } | 836 | } |
842 | prevCh = 0; | 837 | prevCh = 0; |
@@ -1036,9 +1031,10 @@ static void drawBounded_Text_(int fontId, iInt2 pos, int xposBound, int color, i | |||
1036 | &(iRunArgs){ .mode = draw_RunMode | | 1031 | &(iRunArgs){ .mode = draw_RunMode | |
1037 | (color & permanent_ColorId ? permanentColorFlag_RunMode : 0) | | 1032 | (color & permanent_ColorId ? permanentColorFlag_RunMode : 0) | |
1038 | runFlagsFromId_(fontId), | 1033 | runFlagsFromId_(fontId), |
1039 | .text = text, | 1034 | .text = text, |
1040 | .pos = pos, | 1035 | .pos = pos, |
1041 | .xposLayoutBound = xposBound }); | 1036 | .xposLayoutBound = xposBound, |
1037 | .color = color }); | ||
1042 | } | 1038 | } |
1043 | 1039 | ||
1044 | static void draw_Text_(int fontId, iInt2 pos, int color, iRangecc text) { | 1040 | static void draw_Text_(int fontId, iInt2 pos, int color, iRangecc text) { |