-
Notifications
You must be signed in to change notification settings - Fork 4.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Unicode in mapgen #38149
Merged
Merged
Unicode in mapgen #38149
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ifreund
added
<Enhancement / Feature>
New features, or enhancements on existing
[C++]
Changes (can be) made in C++. Previously named `Code`
Code: Infrastructure / Style / Static Analysis
Code internal infrastructure and style
Map / Mapgen
Overmap, Mapgen, Map extras, Map display
labels
Feb 19, 2020
jbytheway
force-pushed
the
unicode_in_mapgen
branch
from
February 29, 2020 22:33
02cfb17
to
61b8a34
Compare
jbytheway
force-pushed
the
unicode_in_mapgen
branch
from
March 8, 2020 13:21
61b8a34
to
dac0256
Compare
This splits a string into a sequence of displayed characters.
Using new facility to split strings into displayed chunks, allow mapgen to use arbitrary Unicode characters (including combining characters) as keys.
Replace bookcase symbol in the house_w_nest_palette with a Unicode symbol that looks similar to a bookcase (▤).
jbytheway
force-pushed
the
unicode_in_mapgen
branch
from
March 9, 2020 11:56
dac0256
to
47d20e3
Compare
ZhilkinSerg
pushed a commit
that referenced
this pull request
Apr 1, 2020
ZhilkinSerg
pushed a commit
that referenced
this pull request
Apr 1, 2020
ZhilkinSerg
pushed a commit
that referenced
this pull request
Apr 2, 2020
ZhilkinSerg
pushed a commit
that referenced
this pull request
Apr 2, 2020
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
[C++]
Changes (can be) made in C++. Previously named `Code`
Code: Infrastructure / Style / Static Analysis
Code internal infrastructure and style
<Enhancement / Feature>
New features, or enhancements on existing
Map / Mapgen
Overmap, Mapgen, Map extras, Map display
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Summary
SUMMARY: Infrastructure "Allow Unicode keys in mapgen rows"
Purpose of change
Some mapgen palettes (such as the one for houses) are running out of useful ASCII characters to use as keys.
Describe the solution
Allow arbitrary Unicode characters as keys, provided they consume only a single column (so e.g. no Chinese characters, nor most emojis).
Combining characters are handled, so arbitrary accents and even Z̴̨̧̞̦̱̭̼̹̱̠̱͍͙̥̃̽͋̅͝ā̴̛̛̬̞͈̞͇̀̏̐́̎͆́̚ͅl̵̖͔̥̑̓͛͑̇̃͋̑̈́̀͆̅̓̕͝g̶̨̗͋̆̆̈́̀̋̌͗͝o̴̥̥̬̥̱͆̀̍͐͌͑̍͘̕͠ ̴̺̫̹̂̏̇͒̀͂̈̌͌̉̓̔͆̽͘͜ẗ̷̛̲͈̱͚̣͔̥͍̗͔͖́̅͊̀͛̎͒͠͠e̷̙̣͇̗͖͈͔̲̤̞̥̱̤̜͚͆̀̈́̎̈́̈́̒͂͠͝x̴̢̢̨̨̫̬͇̱͖̯̠͙̬̩͚̓̑̆̿̌̌́͘t̷̡̮̓̓͗͛͋͒̆̑̀̌̌̒ should work. No normalization is performed.
Add a single example use of this feature in
house_w_palette
by using a box-drawing character that looks somewhat like a bookcase (▤) to represent bookcase.Document the new feature.
Describe alternatives you've considered
We could try to allow double-width characters. We'd probably want to enforce that the entire map used a single width of character consistently. But this seems like enough generalization for now.
Could try to normalize the strings so that different representations of the same character are equivalent, but we don't have the Unicode data required to do that, and I didn't want to add a dependency on libicu just for this.
Testing
Used the new feature in
house_w_palette
as mentioned above. Spawned some of those houses in-game to verify that bookcases and books still appear.Additional context
Requested by @I-am-Erk.