• Welcome to Dark Bit Factory & Gravity.
 

Create custom OpenGL stroked fonts, Ready for release!

Started by Pixel_Outlaw, January 21, 2008

Previous topic - Next topic

0 Members and 0 Guests are viewing this topic.

Pixel_Outlaw

Hello dear chaps.

I've started work on a font program that should let the user make their own characters and then export to a usable OpenGL format in the form of a text file.

Consult the drHelp file for more info.

Challenge Trophies Won:

Shockwave

That's a really helpful idea that I will be sure to check out Pixel :)

I was thinking about making a similar (but not identical) version of this http://www.intro-inferno.com/production.php?id=2505 so a vector font editor is a great idea :)
Shockwave ^ Codigos
Challenge Trophies Won:

Pixel_Outlaw

Yes it would look great if you were going for an early look of simply didn't like the anti-aliasing done on image based fonts.

I'll work on an OpenGL exporter today.

I plan to export to an OpenGL list with each sublist a character.

Challenge Trophies Won:

benny!

Cool project. Good luck with it !!!
[ mycroBLOG - POUET :: whatever keeps us longing - for another breath of air - is getting rare ]

Challenge Trophies Won:

Pixel_Outlaw


I guess since I'm ready to export to some usable OpenGL text, my question becomes what are my options.

In the "red book" they have a demonstration program of using a stroked vector font on page 228-290 of chapter 7.

I think that this will work well. It would be up to the user to write a string drawing function, they would have all of the font information however.
Challenge Trophies Won:

stormbringer

What would be nice is to draw also filled chars, not just wireframe ones. And pre-tesselate them for faster processing.

I did that for this remake: http://www.intro-inferno.com/production.php?id=6025 but it's just a piece of dirty code, not a tool... could be helpful to have a tool that can make my life easier...
We once had a passion
It all seemed so right
So young and so eager
No end in sight
But now we are prisoners
In our own hearts
Nothing seems real
It's all torn apart

zawran

Cool project. I did a couple of these back when I was using BlitzPlus to help me do some wireframe demos. It looks like you are off to a good start. One thing I was thinking that you might want to have as an option is to be able to do lines that do not have to connect all the way through. For instance when doing the character "i" or "!" it would be nice to be able to have the point seperate, but ofcause then you might not be able to utilize displaylist, but I can't remember exactly how those are setup.

Pixel_Outlaw

I think you can have some lines as line_strips and some lines as just plain lines in a disply sublist. This should fix letters with disconnected parts such as i and j. I have no idea how to begin making filled characters. I know that polygon triangulization is a huge pain in the ass and probably too complex for my current skills.
Challenge Trophies Won:

Pixel_Outlaw

#8
OK well it is now fully operational. You can export your fonts to a handy .bmx file. (Or do some editing in notepad to make it fit other languages). There will probably be support for individual spacing on letters and things of that nature in later releases. I have included a test font, test application and also all source from everything.

DAMN the file is exactly 300 KB. I shall have to upload somewhere.

HERE: character designer WORKING.rar

EDIT sorry I've forgotten the "demofont" file that has a saved and loadable vector font. You may want to load this in the editor to see where I exported the font1 file from.
Challenge Trophies Won:

Dr.Death

What a cool idea this should come in handy  :goodpost:
Proud member of DAWN

zawran

Its really nice that it generates ready to use code (at least bmax ready).

As far as filled vector goes, you could instead of automatic tesselation, offer that the user can draw them using either triangles or quads. Here is a picture to help explain:



The user can add either quads or triangles and then display lists of these are built. As you can see the character A could be done with 4 quads or 10 triangles. I did something like that for a demo I made and it worked just fine. At least with this manual way of producing the vector, you are in control of the number of triangles/quads and how they are put together to form the character.

Pixel_Outlaw

I just realized that you are right. I could use the exact same system only change the file output to include the proper list type. Perhaps a small strip of check boxes next to the font would select the drawing list type. Later today I'll try to add support for automatically finding the spacing for each character, and saving the drawing type for each character. I think I will add this information to the file after the letter vertex information. This will let you still load the old version fonts. I doubt anyone has made a font in the last 8 hours, but you never know.
Challenge Trophies Won:

stormbringer

for the tesselation, you could stick to the tesselation functions in the GLU (gluNewTess() etc). It's not the best tesselator ever, but should be enough for this project. Basically (as it is the case in any font design tool) a glyph (the graphical representation of a letter) is made of contours (inner and outter contours). The orientation of the contour (the order in which you define them, clockwise or counter-clockwise) tell the tesselator if it's an inner or an outter contour (to create holes for example).

In about 1 hour you should be able to have this working properly, it's not that difficult.

And yes, looks like a very useful tool (at least for me!)

Good job!
We once had a passion
It all seemed so right
So young and so eager
No end in sight
But now we are prisoners
In our own hearts
Nothing seems real
It's all torn apart

Pixel_Outlaw

Nobody told me that I sent the broken version in the upload like.


This one has a working export to .bmx option and also a gradient font option. You have 2 gradient colors one is changed by hitting the 1 key and the second is changed by hitting the 2 key. This will carry over to the solid vector fonts when I get time to work on the display methods as choices. The color gradient is exported into the .bmx file but is not yet saved into the custom reloadable file.


Here is the full version with my apologies. You can export with this version.
http://myfreefilehosting.com/f/502cc73be1_0.31MB
Challenge Trophies Won:

Jim

'glut' provides some font routines, the stroke character stuff is very like your first example.  Apologies for not posting this before - I couldn't remember which API it was from.:(
http://www.opengl.org/resources/libraries/glut/spec3/node75.html#SECTION000110000000000000000

Jim
Challenge Trophies Won:

Pixel_Outlaw

#15

I got a little something up and running. This time I should be able to directly upload this.

Currently every type of OpenGL primative is supported except GL_TRIANGLE_FAN. It exports pretty well now and you simply add the OpenGL data directly into your work. There are some options for gradient font of your choice. Just remember when you make solid letters, if you want the polygons to work in a lighting mode you need to wind them properly.

I've got a migrane and have stayed up coding untill 2 am so enjoy folks.



Now for the file.
Challenge Trophies Won:

zawran

Really nice work on this. Great to see that you are sticking with.