I made a tool in C# that converts characters from a font to RGB565 C arrays that can be used with CopySprite and the like. I haven't tested it myself on my Prizm, but it should work since it shares a lot of the same code with ImgViewer's image converter.



Download (requires .NET 2.0 or newer): https://dl.dropbox.com/u/3601919/font2array/font2array.exe

The arrays that it outputs have their first two bytes set as the width and the height of the character, and the actual image data starts after that. Characters like % and # which can not be used as variable names in C are converted to their hash codes in the output file. The arrays are pretty big, but they seem easily compressible through RLE or some other basic compression scheme.
Very cool tool, Souvik1997! This might inspire me to get more creative with the text in some of my future Prizm games. Or TI-84+CSE while we're at it, since that's 16-bit color too!
Hi,
this is super tool, I planned to write something similar, but it never happened.
I have some ideas, which are probably easy to implement:
- full Unicode support (yes, the output would be huge Smile)
- optional monochrome output - save each pixel of the font to 1 bit (not word), so the output would be 16x smaller. This would support older calculator with monochrome display.
MPoupe wrote:
- full Unicode support (yes, the output would be huge Smile
How about giving the option to select which code pages would be dumped, which would help control the size of the output.
Actually, it already supports Unicode. My program doesn't convert every character, you select which ones you want to convert from the Options menu. I've tested this with Japanese and Russian, and it should work. Monochrome output is definitely something I'll look in to.

Edit: I just uploaded a new version that supports monochrome output in either binary or hexadecimal.
souvik1997 wrote:
Actually, it already supports Unicode. My program doesn't convert every character, you select which ones you want to convert from the Options menu.
Could you add an option to set characters by interval ?
Is this what you mean?

I uploaded a new version that adds this feature.
I'm having trouble exporting to 1 bpp. (RGB565 seems to work fine.) After selecting a font and color, an error message about an exception appears (it translates to "The parameter is invalid.")

http://pastebin.com/TXVK5ez3
Which font, font styles, and color are you using?

Edit: I uploaded a new version which doesn't use Bitmap.LockBits to convert to the 1bpp format. Try that version and see if it works.

Edit 2: Actually, don't try that just yet. My conversion algorithm doesn't work. <.<
souvik1997 wrote:
Which font, font styles, and color are you using?
I tried the default (Microsoft Sans Serif, no special formatting, #000000, TextRenderer set to AntiAlias) but also Arial (and TextRenderer set to SystemDefault, I think). The error log is using the default settings.
It seems to have been some kind of GDI+ weirdness, since it worked perfectly on my computer but not on yours. I wrote a simple algorithm that seems to do the job better than the automated conversion, but it's slightly slower. If I have time, I'll implement optional Floyd-Steinberg dithering for monochrome output.

The new version has been uploaded.
souvik1997 wrote:
Is this what you mean?

I uploaded a new version that adds this feature.

Yes, exactly Smile
But there are some issues:
- try to generate interval starting by 0 character (e.g. 0 to 1)
The output is empty
- try to generate 256 characters (ok, skip char 0, so enter 1 - 255)
The declaration contains weird authenticators like:
unsigned char MicrosoftSansSerif_-842352737[496]

But it is a very cool tool, and I can workaround these issues easily.
Thank you.
Those aren't really issues. Character 0x00 is the ASCII NUL, and the characters from 0x01 to 0xFF are going to have other, strange characters as well (see this). I can't really use those characters in the variable declaration, so I use hash codes.
souvik1997 wrote:
Those aren't really issues. Character 0x00 is the ASCII NUL, and the characters from 0x01 to 0xFF are going to have other, strange characters as well (see this). I can't really use those characters in the variable declaration, so I use hash codes.

I agree partially, but each character (NUL included) has it's font image. E.g. on Casio fx7700 and cfx9850 the NUL character (not the token) is the small "10" used as power of 10.
I think you may consider to name the variables by hex value of the character, that is valid for all of them.
  
Register to Join the Conversation
Have your own thoughts to add to this or any other topic? Want to ask a question, offer a suggestion, share your own programs and projects, upload a file to the file archives, get help with calculator and computer programming, or simply chat with like-minded coders and tech and calculator enthusiasts via the site-wide AJAX SAX widget? Registration for a free Cemetech account only takes a minute.

» Go to Registration page
Page 1 of 1
» All times are UTC - 5 Hours
 
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum

 

Advertisement