Font reader

Go To Last Post
4 posts / 0 new
Author
Message
#1
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Hi there,

ok, I know this is a wrong site to ask this question, but it has a to do with AVR micros.

Listen:
I try a project using an AVR connected with an LCD graphic display and a touch in order to be a real touch screen.

I want to build a Visual Basic 6 program which will alow me to see and setup the windows fonts, in order to choose the one that I will use for my graphic display.

So does anybody knows how can I read a Windows font file with Visual Basic. Is there any VB module that do this thing (of course with open code)?

Thank you very much

Michael

Michael.

User of:
IAR Embedded Workbench C/C++ Compiler
Altium Designer

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Not wrong site, but wrong forum. Try the "off topic" one next time :P.

I don't know of any libraries, but it's not an impossible task. Use a Rich Text Box component to display the font, and then use the windows GDI graphics library functions (DrawText, etc) to draw the text into a GDI bitmap handle, convert that to a bitmap array and then extract the array bytes to get the bitmap data. It's been a long time since I've done much VB6 programming, so I suggest you try www.planetsourcecode.com for GDI or font reading code.

- Dean :twisted:

Make Atmel Studio better with my free extensions. Open source and feedback welcome!

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I'd do it a MUCH simpler way, fire up MS Word or any editor that allows font selection. Type in a..z, A..Z, 0..9 and the other symbols you want. Resize the font so that it gets to be the right pixel height for your ultimate application (the Zoomin.exe that comes as part of MS Visual Studio would help here!), then snapshot the screen using Alt-PrtScrn and paste it into your favourite graphics editor. save this out as an uncompressed 1bit .BMP (or a .RAW if that's supported) then the only tricky thing is to write a little 20 line C program to read a BMP file and lift the font squares out of it.

Obviously it's a lot easier to do this starting with a fixed pitch font like Courier New rather than a proportional font like Arial.

Cliff

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Thank you very much.

I found a freeware which converts a ttf into a bmb, including all the 256 chars. with a lot of udjustments.

It is much easier to read a simple bmp file from spending time reading and learning about the ttf format.

Thanks a lot.

Michael

Michael.

User of:
IAR Embedded Workbench C/C++ Compiler
Altium Designer