Textengine contrib #165

Open
wants to merge 21 commits into
from

3 participants

@safetydank

I'm opening this to get feedback on the current state of the refactor and track associated issues. This branch is based on master.

It introduces one breaking change - the Font class has been replaced by FontRef, constructed by Font::create methods and accessed by ->. All other public interfaces have been kept the same.

The TextEngine class holds the backend specific code for rendering TextureFont and TextBox classes. TextLayout does not use TextEngine for now I'm not sure the best way to implements the platform specific parts of Run / Line while keeping the internals hidden as they are now.

TextureFont uses a new class gl::TextureFontAtlas to tightly pack glyphs onto multiple textures, and enable multiple TextureFonts to share a GL texture. This is an optional interface, the existing create methods still work as expected.

A FreeType TextEngine implementation is provided. It adds a third-party library "UTF8-CPP" for handling UTF-8 conversions (necessary on Android, which has minimal wstring support). This supports rendering via TextureFont methods only, and will return empty Surfaces for other render calls. It doesn't handle Shape2D conversion, returning an empty shape.

I've modified and tested samples to use the new Font class, on Windows, OS X and Android so far.

@andrewfb
Collaborator

Thanks for your work on this - I will be sitting down with it immediately upon our upcoming 0.8.4 release...

@cinder
Owner

I'm going to leave this here for the time being; text is likely to be the focus of 0.8.7 now, and I'm certain it will be very valuable for that rewrite.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment