Terminal-Print
Terminal-Print copied to clipboard
Choose defaults for expected terminal features
At this point, we should probably assume that the user's terminal supports more than 16 colors unless we have evidence to the contrary; sadly there's no way to reliably and portably detect this without asking the user. Likewise we should assume the user's terminal and installed fonts have support for a reasonable set of Unicode characters, not just plain 7-bit ASCII; again there's no good way to detect this reliably and portably, because even if you can prove the terminal supports the most recent Unicode character set, it still doesn't tell you if the terminal font has the proper glyphs rather than a bunch of boxes.
Unless someone actively disagrees, I'll assume:
- Most terminals support at least 256 colors, but it must be possible to force 16-color mode if needed
- Most terminals support Unicode as their default character set, but it must be possible to force ASCII-only (or CP 437 eventually) if needed
- Unicode fonts will most likely include at least:
- The characters from CP 437 (though of course at different codepoints outside of 0x20-0x7E)
- All 128 box-drawing characters
- The fullwidth forms of the ASCII characters (U+FF01 to U+FF5E)
- If the terminal's font doesn't support the above, it's OK to put the onus on the user to fix that situation or fall back to e.g. ASCII
Eventually, it might be wise to include a test suite that will run tests designed for a user to know their terminal's capabilities and report that back to T::P.
Aside from that, I don't find anything wrong with your current assumptions.
- X/C
On Tue, Dec 27, 2016 at 8:17 PM, japhb [email protected] wrote:
At this point, we should probably assume that the user's terminal supports more than 16 colors unless we have evidence to the contrary; sadly there's no way to reliably and portably detect this without asking the user. Likewise we should assume the user's terminal and installed fonts have support for a reasonable set of Unicode characters, not just plain 7-bit ASCII; again there's no good way to detect this reliably and portably, because even if you can prove the terminal supports the most recent Unicode character set, it still doesn't tell you if the terminal font has the proper glyphs rather than a bunch of boxes.
Unless someone actively disagrees, I'll assume:
- Most terminals support at least 256 colors, but it must be possible to force 16-color mode if needed
- Most terminals support Unicode as their default character set, but it must be possible to force ASCII-only (or CP 437 eventually) if needed
- Unicode fonts will most likely include at least:
- The characters from CP 437 https://en.wikipedia.org/wiki/Code_page_437 (though of course at different codepoints outside of 0x20-0x7E)
- All 128 box-drawing characters https://en.wikipedia.org/wiki/Box-drawing_character
- The fullwidth forms https://en.wikipedia.org/wiki/Halfwidth_and_fullwidth_forms of the ASCII characters (U+FF01 to U+FF5E)
- If the terminal's font doesn't support the above, it's OK to put the onus on the user to fix that situation or fall back to e.g. ASCII
— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/ab5tract/Terminal-Print/issues/35, or mute the thread https://github.com/notifications/unsubscribe-auth/AAlOwjUUm-UPQ8Iby9F-aR24OH0xhGkrks5rMbihgaJpZM4LWmvD .
@Xliff I really like this idea of yours.
@ab5tract - Darn you! Now I need to figure out how to do it! :P