This is currently hardcoded to 640x480 English builds.
What I've done is temporarily gutted the FreeType2 font renderer, and
instead introduced a system where the font is read from a
pre-rendered font atlas. This allows me to get 100% accurate font
rendering to Windows XP... because I literally created these atlases
with Windows XP.
So not only does this eliminate the issue of FreeType producing
misshapen glyphs, but it also works around the copyright issue
regarding bundling the Courier New and MS Gothic fonts with CSE2.
You see, font files can be copyrighted like any old software, however
typefaces have a lot less protection - they're basically fair-game.
IANAL, of course - look it up yourself.
I don't really want to throw away the FreeType font system since I
spent a ton of time working on it, it allows you to use other font
files, and I'll probably wind up needing it for CSE2EX. I guess I'll
just have to find some way to either have the two systems coexist, or
make it so one or the other can be selected at compile-time.
Previously, the font batching system was very shoddy: basically,
glyph bitmaps would be cached to system memory, and uploaded
on-demand to the GPU.
The OpenGL3, OpenGLES2, and SDLTexture backends relied on
`cute_spritebatch.h` to handle batching. While nice, this library is
overkill: it's intended for managing a whole game, not just a couple
of glyphs. It also depends on C++11, which is something I'd rather be
without.
Being so complex, it appears that internally it spams the backend
when merging atlases together. According to bug reports, this causes
the game to skip a lot of frames.
Instead, I've ditched the system-memory-side caching, and made the
game maintain its own atlas. Unlike `cute_spritebatch.h`, this one
doesn't purge glyphs after they've gone unused for 30(?) seconds -
instead, glyphs are only purged when room in the atlas runs out, at
which point the oldest glyph is replaced. This method doesn't involve
creating or destroying atlases at runtime, avoiding the overhead of
whatever OpenGL/DirectX do internally when that happens.
Currently only the OpenGL3, OpenGLES2, and Software renderers have
been updated with this - the others will fail to build.
I know immediate-mode renderers won't benefit from this, but it
replaces the leaky old caching system, so it's still an improvement.
CSE2 Portable is meant to be a purist thing - experiencing Cave Story
the way it was meant to be. The crappy font rendering was definitely
not how it was meant to be.
Turns out, for all this time, I never enabled FreeType's
mono-hinting.
Now, the English font looks pretty good. I can't say the same for the
Japanese one though - that one looks identical. I guess Noto doesn't
come with hinting data? FreeType's auto-hinter just makes it look
worse...
Prevents a crash on the Wii U port in 1280x720 when you try to open
the pause menu. There's a giant delay now instead, and I'm not sure
where it comes from. Still, it's an improvement.
Previous, I used a godawful hack to emulate Windows' API, but it
seems this only ever worked for Courier New: with something like
Liberation Mono, it would squash the font. Now I'm just giving up on
it, and using actual font sizes rather than "cell" sizes.
I'm not sure if this is accurate the original EXE.