Search code examples
c++qtunicodecp1252

Drawing bitmap fonts from cp-1252 characters


I'm developping a prototype application to generate bitmap fonts giving TTF. I'm using Qt library which I'm using for years. However, I realized I've never been involved into "characters" issues before.

What I'm trying is quiet simple:

I need to draw into a PNG file each character of the 1252 codepage. I'm a bit lost with the different issues related to codec, textdecoder etc.

Any suggestion is welcome !

Z.


Solution

    1. The codec that you want is QTextCodec::codecForName("Windows-1252")
    2. The characters that you want are char(32) to char(255); put those in a char[225]. Don't forget to zero-terminate them.
    3. Convert that char[225] to a QString with the codec from (1)
    4. Draw the QString from (4)