diff options
author | Jaakko Keränen <jaakko.keranen@iki.fi> | 2020-08-21 13:21:11 +0300 |
---|---|---|
committer | Jaakko Keränen <jaakko.keranen@iki.fi> | 2020-08-21 13:21:11 +0300 |
commit | 17d7cc86578eb0a9e97e3a51bad0e10a9da1482e (patch) | |
tree | 9f95e7fd9f91bea0590959d656f4a2e98f0d86de /src/gmrequest.c | |
parent | 648ddbf3d118d28a20027b8c5dd074494c53b90a (diff) |
Experimenting with text art
Convert glyph bitmaps to Unicode block characters
Diffstat (limited to 'src/gmrequest.c')
-rw-r--r-- | src/gmrequest.c | 19 |
1 files changed, 18 insertions, 1 deletions
diff --git a/src/gmrequest.c b/src/gmrequest.c index fd24b2b9..fe6fee47 100644 --- a/src/gmrequest.c +++ b/src/gmrequest.c | |||
@@ -3,6 +3,7 @@ | |||
3 | #include "gmcerts.h" | 3 | #include "gmcerts.h" |
4 | #include "app.h" /* dataDir_App() */ | 4 | #include "app.h" /* dataDir_App() */ |
5 | #include "embedded.h" | 5 | #include "embedded.h" |
6 | #include "ui/text.h" | ||
6 | 7 | ||
7 | #include <the_Foundation/file.h> | 8 | #include <the_Foundation/file.h> |
8 | #include <the_Foundation/mutex.h> | 9 | #include <the_Foundation/mutex.h> |
@@ -278,7 +279,7 @@ static const iBlock *aboutPageSource_(iRangecc path) { | |||
278 | } | 279 | } |
279 | 280 | ||
280 | static const iBlock *replaceVariables_(const iBlock *block) { | 281 | static const iBlock *replaceVariables_(const iBlock *block) { |
281 | iRegExp *var = new_RegExp("\\$\\{([A-Z_+-]+)\\}", 0); | 282 | iRegExp *var = new_RegExp("\\$\\{([^}]+)\\}", 0); |
282 | iRegExpMatch m; | 283 | iRegExpMatch m; |
283 | if (matchRange_RegExp(var, range_Block(block), &m)) { | 284 | if (matchRange_RegExp(var, range_Block(block), &m)) { |
284 | iBlock *replaced = collect_Block(copy_Block(block)); | 285 | iBlock *replaced = collect_Block(copy_Block(block)); |
@@ -289,6 +290,22 @@ static const iBlock *replaceVariables_(const iBlock *block) { | |||
289 | if (equal_Rangecc(&name, "APP_VERSION")) { | 290 | if (equal_Rangecc(&name, "APP_VERSION")) { |
290 | repl = range_CStr(LAGRANGE_APP_VERSION); | 291 | repl = range_CStr(LAGRANGE_APP_VERSION); |
291 | } | 292 | } |
293 | else if (startsWith_Rangecc(&name, "BT:")) { /* block text */ | ||
294 | repl = range_String(collect_String(renderBlockChars_Text( | ||
295 | &fontFiraSansRegular_Embedded, | ||
296 | 11, /* should be larger if shaded */ | ||
297 | quadrants_TextBlockMode, | ||
298 | &(iString){ iBlockLiteral( | ||
299 | name.start + 3, size_Range(&name) - 3, size_Range(&name) - 3) }))); | ||
300 | } | ||
301 | else if (startsWith_Rangecc(&name, "ST:")) { /* shaded text */ | ||
302 | repl = range_String(collect_String(renderBlockChars_Text( | ||
303 | &fontSymbola_Embedded, | ||
304 | 20, | ||
305 | shading_TextBlockMode, | ||
306 | &(iString){ iBlockLiteral( | ||
307 | name.start + 3, size_Range(&name) - 3, size_Range(&name) - 3) }))); | ||
308 | } | ||
292 | else if (equal_Rangecc(&name, "ALT")) { | 309 | else if (equal_Rangecc(&name, "ALT")) { |
293 | #if defined (iPlatformApple) | 310 | #if defined (iPlatformApple) |
294 | repl = range_CStr("\u2325"); | 311 | repl = range_CStr("\u2325"); |