Skip to content

A program to check whether or not texts in various languages are being rendered correctly by pygame

License

Notifications You must be signed in to change notification settings

peanutbutterandcrackers/PyGameTextRenderTester

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

21 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

PyGameTextRenderTester

This program essentially tests whether or not texts in various languages are being rendered correctly by pygame. Please see this thread as to why.

How does this work?

Essentially, this renders the same text-on-a-solid-background png using pygame and gimp using the exact same font, color, font-size, dimensions, etc, and checks the similarity of the rendered pngs using perceptual hash function (allowing for a slight dissimilarity threshold).

Usage:

$ ./main.py

Dependencies:

This mostly uses the standard python library modules but there are a few other modules/libraries and fonts that are required:

  1. GIMP (also gimp-python, if it is not installed with GIMP)
  2. pillow (pip install pillow)
  3. imagehash (pip install ImageHash)
  4. pygame (pip install pygame), obviously.

text.json:

To check the rendering of other languages/scripts, all one needs to do is to add the text to text.json file. The file is simple and the syntax is:

[	
	{
		"script": "<SCRIPT - 'Devanagari', 'Latin', etc.>",
		"font": "<Font to render the text with. Should be pre-installed>",
		"text": [
			"TEXT1",
			"TEXT2",
			"TEXTS CAN ALSO HAVE SPACES"
			]
	}
]

settings.py:

This file specifies the image dimensions, text size, text colour, background colour, etc.

About

A program to check whether or not texts in various languages are being rendered correctly by pygame

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages