To use the pygame.freetypeEnhanced Pygame module for loading and
rendering computer fonts based pygame.ftfont as pygame.fontpygame
module for loading and rendering fonts define the enviroment variable
PYGAME_FREETYPE before the first import of pygamethe top level pygame
package. pygame.ftfont is a pygame.fontpygame module for loading and
rendering fonts compatible module that passes all but one of the font
module unit tests: it does not have the UCS-2 limitation of the
SDL_ttf based font module, so fails to raise an exception for a code
point greater than ‘uFFFF’. If pygame.freetypeEnhanced Pygame module
for loading and rendering computer fonts is unavailable then the
SDL_ttf font module will be loaded instead.
尽管这是一个最合适的regex工具,但它问的问题并不合适。您可以迭代变量中的每个字符使用
ord(c) > 0xFFFF
来检测有问题的字符。在但是如果您需要regex,请尝试(python3)
对于python2,只需在字符串文字之前添加“u”(使其成为unicode)。在
字体可能是这里真正的问题,所以我不确定用regex过滤会给你带来什么好处。我建议您看看^{} 模块,因为它不限制使用
\uFFFF
范围以上的代码点。在↳http://www.pygame.org/docs/ref/font.html
相关问题 更多 >
编程相关推荐