WhatPumpkin/Sburb — pull request #70 by Gankro (2012-09-07 02:10:35+00:00)
Title: Tentaitive Specification for TextEngine

Diffs are just one file, the spec.

TextEngine will replace FontEngine's job, and absorb some of Dialoger's as well. TextEngine is fully implemented.

Abstract Classes:
TextParser will know about default styles and take raw text and either:
Apply only default styles
Parse style formatting and apply that (while removing it from the text)
Parse style formatting and multi-dialog formatting (terminology: "batches") (while removing it from the text)

TextRenderer handles knowing everything about the current state of the text, and of course drawing it on the screen at the desired location.

Misc:
TextStyleToken reflects what we discussed.

Looking Forward:

Other things that would make sense to add to the API (but I didn't):
TextRenderer.charWidth
TextRenderer.lineHeight
TextRenderer/TextEngine.measureText(text) // return width of text given, if it were rendered.

Obviously, also, this isn't hooked up at all to the current engine. It would be a pretty big endeavour to get it all hooked up, too.
Dialoger would have to be massively refactored.
FontEngine would have to be massively refactored (at very least the Parser has to be ported) Chooser would also have to be refactored to use TextEngines and better use the API.