Add support for Unicode rendering (#47)

This uses utfcpp combined with a custom font, in the form of a PNG and text file. By default, the game acts exactly as it did before; custom fonts can be provided by third parties.
This commit is contained in:
leo60228
2020-01-31 13:25:37 -05:00
committed by GitHub
parent 98ac1fdb53
commit 6a17625727
10 changed files with 505 additions and 87 deletions

View File

@@ -1,4 +1,5 @@
#include "Textbox.h"
#include <utf8/unchecked.h>
textboxclass::textboxclass()
{
@@ -133,7 +134,8 @@ void textboxclass::resize()
max = 0;
for (int iter = 0; iter < numlines; iter++)
{
if (line[iter].length() > (unsigned int)max) max = line[iter].length();
unsigned int len = utf8::unchecked::distance(line[iter].begin(), line[iter].end());
if (len > (unsigned int)max) max = len;
}
lw = max;