pwaller/pyfiglet

Umlaute

u0nel opened this issue · 5 comments

u0nel commented

The Umlauts ä, ü and ö don't work even though, the font has them.

Research and patches welcomed! Sorry I don't have time to delve in myself but I will do code review.

What font?

For example in the font "big" the German Umlaute "ÄÖÜäöüß" are defined.

But they are not loaded, as they are outside the range of the first 128 characters and they don't have a font number defined for extended font characters (

# Load ASCII extended character set
)

Additionaly pyfiglet expects the character number to be a hex string. All other extended font characters in the big font file have a number that is probably not in hex format (0x... - see regex) and so they are not loaded either.

Adding these font numbers in the big font file at the beginning of each respective character definition enables rendering of German Umlaute:

        @@
0xc4    German Umlaut Ä
        @
...
0xd6    German Umlaut Ö
...
0xdc    German Umlaut Ü
...
0xe4    German Umlaut ä
...
0xf6    German Umlaut ö
...
0xfc    German Umlaut ü
...
0xdf    German Umlaut ß

Added a patch to load the German Umlaute in the init.py - not changing the font format.
This patch will solve the issue for all fonts that have the umlaute defined.

Merged in #96.