C++: Printing ASCII Heart and Diamonds With Platform Independent

前端 未结 4 1265
孤城傲影
孤城傲影 2021-01-02 17:13

I\'m developing a card playing game and would like to print out the symbol for hearts, diamonds, spades and clubs. My target platform will be Linux.

In Windows, I k

4条回答
  •  轻奢々
    轻奢々 (楼主)
    2021-01-02 17:41

    It's not a question of the library, it's a question of the codepage of the font you're using.

    • read about Code page (what you used on Windows, are actually Control Characters)
    • check the ASCII table

    If the font used for the terminal you're running on doesn't have hearts and diamonds in it's current code page, no library will help you -- you'd have to use graphics.

    For further reading, I'd try to find it maybe in Unicode Tables -- however, unicode terminals are rare... And even if you have a Unicode font, there's no guarantee that it will have the card-images in it.

    Bottom line: it all depends on the font, and there's no guaranteed portable way to achieve it without suppling your own gylphs.

提交回复
热议问题