Some Ideas for text printing without GDI?

Started by
3 comments, last by EmilianoGenghini 16 years, 2 months ago
Ciao, to all I'm thinkin' of my own font engine obviously bypassing GDI interface DDraw 32 bit mode. My idea was saving fonts as bmp files, in two colors. Then loading them on surfaces setting as colorkey the one of font shape. Obviously background color would be the same set as primary or back surface colorkey. At the end creating surfaces of 1 pix RECT containing my desired colors. So, to blit a letter I should blit a color (resizing its dimension) on the letter surface and then I could blit the colored letter on the primary or back. This is teory but before implementing my code I'd like to know if someone has other and maybe better ideas.
Advertisement
Quote:Original post by EmilianoGenghini
This is teory but before implementing my code I'd like to know if someone has other and maybe better ideas.
Use D3D and ID3DXFont instead [smile]

Is there a particular reason for using DDraw? It's likely slower than D3D, it's about 10 years old, and it's no longer being updated.

In any case. why do you want to bypass GDI? What's wrong with it? Why not go all the way and bypass DirectDraw and use BIOS interrupts to write pixels to the screen?
You were right with your last idea. As an old dos C/Assembly programmer I shold print my screens in 0xa000 location, and workin in 320x200 (no need for interrupts) maybe with near and far pointers, but there's the fukin windows...

However I just restarted my C programminq under win, I found DDraw maybe cause what I've read focused on it. I'll follow your advice if there's better tecnology right, something good to read?
Regading GDI, it's slow, and fonts depend from s/o ones so better to create your ones.
Quote:Original post by EmilianoGenghini
However I just restarted my C programminq under win, I found DDraw maybe cause what I've read focused on it. I'll follow your advice if there's better tecnology right, something good to read?
I don't really know of any good tutorials I'm afraid. There's bound to be some in the forum FAQ though.

Quote:Original post by EmilianoGenghini
Regading GDI, it's slow, and fonts depend from s/o ones so better to create your ones.
GDI is just as slow as drawing your own fonts, if you want to be as flexible as GDI (I.e. able to use truetype fonts). The usual way of handling fonts is to pre-render all the letters you need (at runtime) to a surface, and then copy from that surface when you draw the text. That's how ID3DXFont works, my text system, and most text engines out there.

As for only being able to use installed fonts, you can always use AddFontMemResourceEx to install a font temporarily (It'll only be available to your app while it's running - it doesn't actually install the font, it just lets GDI calls use it).
Thanks for your help,
so for now I'll keep using Xgdi and in the meantime I'll see about 3D3.
Last question, can I integrate it with all Ddraw init,create surfaces and blitting or do I have to rewrite all my own function prototypes?

This topic is closed to new replies.

Advertisement