Ticket #2 (closed enhancement: fixed)

Opened 4 years ago

Last modified 3 years ago

Rewrite font class to use freetype2 instead of afont

Reported by: chris Owned by: chris
Priority: major Milestone: 0.1.0
Component: Video Version:
Keywords: Cc:

Description

The afont OpenGL code has some minor coordinate issues and issues printing against transparency, as well as requiring the fonts be converted by an external utility. Jared Minch, the original writer of afont, is out of contact, and NeHe? has a great tutorial about using freetype2 (very famous/good font loading library) with SDL/OpenGL.

Attachments

lesson43.tar (180.0 KB) - added by chris 4 years ago.
NeHe? Tutorial #43: SDL/OpenGL font rendering using freetype2

Change History

Changed 4 years ago by chris

NeHe? Tutorial #43: SDL/OpenGL font rendering using freetype2

comment:1 Changed 4 years ago by chris

  • Status changed from new to closed
  • Resolution set to wontfix

comment:2 Changed 4 years ago by chris

Got in contact with Jared and received an updated version of afont that nullifies these concerns.

comment:3 Changed 3 years ago by knowknowledge

  • Status changed from closed to reopened
  • Resolution wontfix deleted

I won't be able to do any UI work or use Epiar in general without an option besides afont. My graphics card doesn't handle the way afont renders text.

comment:4 Changed 3 years ago by knowknowledge

  • Status changed from reopened to closed
  • Resolution set to fixed

Adapted Maoserr's FreeType? work to add optional freetype support with a configure flag "--enable-freetype". This is off by default so systems without freetype will use AFont (for now).

I wasn't able to use Maoserr's FreeType? implementation because (1) it removed afont and (2) it required warping all the screen coordinates to get the text to draw rightside-up. I fixed the mirrored text by doing an opengl translation (pushmatrix/flip/popmatrix) as a wrapper for each text Render.

FreeType? does not support the .af format (AFONT specific?), so all fonts are rendered with FreeSans?.ttf until we find replacements for the opther fonts.

This solves my problems (Full game speed even with text on the screen), and should not affect other developers or users.

Note: See TracTickets for help on using tickets.