summaryrefslogtreecommitdiff
path: root/src/ui
diff options
context:
space:
mode:
Diffstat (limited to 'src/ui')
-rw-r--r--src/ui/text.c6
-rw-r--r--src/ui/text.h4
2 files changed, 9 insertions, 1 deletions
diff --git a/src/ui/text.c b/src/ui/text.c
index 7367e6c0..f3d945e4 100644
--- a/src/ui/text.c
+++ b/src/ui/text.c
@@ -390,12 +390,16 @@ static void deinitCache_Text_(iText *d) {
390 SDL_DestroyTexture(d->cache); 390 SDL_DestroyTexture(d->cache);
391} 391}
392 392
393iRegExp *makeAnsiEscapePattern_Text(void) {
394 return new_RegExp("[[()][?]?([0-9;AB]*?)([ABCDEFGHJKSTfhilmn])", 0);
395}
396
393void init_Text(iText *d, SDL_Renderer *render) { 397void init_Text(iText *d, SDL_Renderer *render) {
394 iText *oldActive = activeText_; 398 iText *oldActive = activeText_;
395 activeText_ = d; 399 activeText_ = d;
396 init_Array(&d->fonts, sizeof(iFont)); 400 init_Array(&d->fonts, sizeof(iFont));
397 d->contentFontSize = contentScale_Text_; 401 d->contentFontSize = contentScale_Text_;
398 d->ansiEscape = new_RegExp("[[()][?]?([0-9;AB]*?)([ABCDEFGHJKSTfhilmn])", 0); 402 d->ansiEscape = makeAnsiEscapePattern_Text();
399 d->baseFontId = -1; 403 d->baseFontId = -1;
400 d->baseFgColorId = -1; 404 d->baseFgColorId = -1;
401 d->missingGlyphs = iFalse; 405 d->missingGlyphs = iFalse;
diff --git a/src/ui/text.h b/src/ui/text.h
index b7934855..cb29adad 100644
--- a/src/ui/text.h
+++ b/src/ui/text.h
@@ -29,6 +29,8 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */
29 29
30#include "fontpack.h" 30#include "fontpack.h"
31 31
32iDeclareType(RegExp)
33
32/* Content sizes: regular (1x) -> medium (1.2x) -> big (1.33x) -> large (1.67x) -> huge (2x) */ 34/* Content sizes: regular (1x) -> medium (1.2x) -> big (1.33x) -> large (1.67x) -> huge (2x) */
33 35
34#define FONT_ID(name, style, size) ((name) + ((style) * max_FontSize) + (size)) 36#define FONT_ID(name, style, size) ((name) + ((style) * max_FontSize) + (size))
@@ -230,6 +232,8 @@ enum iTextBlockMode { quadrants_TextBlockMode, shading_TextBlockMode };
230iString * renderBlockChars_Text (const iBlock *fontData, int height, enum iTextBlockMode, 232iString * renderBlockChars_Text (const iBlock *fontData, int height, enum iTextBlockMode,
231 const iString *text); 233 const iString *text);
232 234
235iRegExp * makeAnsiEscapePattern_Text (void);
236
233/*-----------------------------------------------------------------------------------------------*/ 237/*-----------------------------------------------------------------------------------------------*/
234 238
235iDeclareType(TextBuf) 239iDeclareType(TextBuf)