-
Notifications
You must be signed in to change notification settings - Fork 12
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
TTF font rendering #17
base: master
Are you sure you want to change the base?
Conversation
Fixed that bug, and cleaned up a little. It can now load any font that supports all the characters in the character map, which is good enough for me! If in the future I need to support that, I just need to create a block (or one pixel) character to stand in. |
My MakePCX occasionally encodes a "bad" pcx file that only crashes the engine when heap tracking is enabled in gflags. Everything else seems to read it fine. This occasionally causes the font stuff to crash on several resolution changes. (Or on some cases one!) Need to figure this out.. |
…one bug that causes malformed pcx images to be generated.
…bugging features for fontmgr.
Bug fixed. Was off by one in the header...oops. Swapped back to pitch. Another bug squashed where I wasn't clearing "ThisColumnIsSolid" at the beginning of a Column. Need to flush all the menus, so they'll run build() on resolution change. Yikes. |
This was crashing, but I think I've fixed it..
Added flushing folders on resolution change. There's currently a bug where player hud still has some references to the fonts that were destroyed. |
…he folder show a nice error message...that works in fullscreen too!
(WIP)
This PR adds TTF font rendering!..well not really, but kinda!
So while this version of the engine can load TTF fonts, it's limited to system fonts and the actual rendering is incredibly slow.
So what I do to get around this is use a library (SDL TTF) to load custom TTF fonts, format them correctly (the engine expects only a single space in between characters. Which is a huge pain, because fonts like to lie about their glyph width.) export the font sheet to PCX format (the engine only supports PCX for bitmap fonts.) in a encoder I wrote (because there weren't any good small portable ones.) and then immediately load that pcx.
And bam, we have variable size font rendering! 50% of this PR could be avoided if we could create a font from an array of pixels, but we can't.
There's still bug in the glyph rendering. I need to properly take into account the minX and maxX. Right now I'm trimming the start of the character to get the real minX, but some fonts can be cut off on the maxX portion.
Square 721 (included in NOLF2)
Comic Sans (yay)