DenverCoder1/table2ascii

Emojis don't affect the width of columns

sacooke opened this issue ยท 3 comments

If a unicode emoji is part of the longest text in a column, the width of the column will not account for its existence.

Example:
outputBoss = t2a( header=["","Crocodile ๐ŸŠ"], body=[["HP","100/100"], ["Atk","10"], ["Def","8"]], first_col_heading=True )

Output: https://i.imgur.com/kacEMc6.png

Actually, the issue might be that the emoji is actually being factored into the width, but it's only being treated as the same width as a non-emoji character. Now that I think about it, this issue might be unresolvable.

The emojis are being rendered with a font that is not monospace, meaning the characters do not take up the same width as other characters.

Unfortunately, there is no possible fix for this since you can't know how much space is necessary to align characters with variable widths.

#63 is also a fix for this issue when displaying the table at least with some fonts (where emojis take up exactly twice the width of regular characters)