aboutsummaryrefslogtreecommitdiff
path: root/graphics/fonts/ttf.h
diff options
context:
space:
mode:
authorJohannes Schickel2014-06-09 01:04:47 +0200
committerJohannes Schickel2014-06-09 01:04:47 +0200
commit5b03ba04d78be0f7d60ac777dbf8b51584192f7d (patch)
treee52733f62eaedb60c6158ad3dc1e39713d62d53f /graphics/fonts/ttf.h
parent924f1f1fee3f46a6bfcd6182631bdd91f61c279e (diff)
downloadscummvm-rg350-5b03ba04d78be0f7d60ac777dbf8b51584192f7d.tar.gz
scummvm-rg350-5b03ba04d78be0f7d60ac777dbf8b51584192f7d.tar.bz2
scummvm-rg350-5b03ba04d78be0f7d60ac777dbf8b51584192f7d.zip
GRAPHICS: Allow client code to specify TTF render mode.
This allows clients to use the default FreeType2 render mode instead of light. We really only use light as default because that's what looks best with the font we use in our GUI right now (which is the same reason why formerly light was always used in non-monochrome mode).
Diffstat (limited to 'graphics/fonts/ttf.h')
-rw-r--r--graphics/fonts/ttf.h27
1 files changed, 24 insertions, 3 deletions
diff --git a/graphics/fonts/ttf.h b/graphics/fonts/ttf.h
index 65aba32fbf..bd25b69f21 100644
--- a/graphics/fonts/ttf.h
+++ b/graphics/fonts/ttf.h
@@ -34,14 +34,35 @@ namespace Graphics {
class Font;
/**
+ * This specifies the mode in which TTF glyphs are rendered. This, for example,
+ * allows to render glyphs fully monochrome, i.e. without any anti-aliasing.
+ */
+enum TTFRenderMode {
+ /**
+ * Standard render mode. Equivalent of FreeType2's FT_RENDER_MODE_NORMAL.
+ */
+ kTTFRenderModeNormal,
+
+ /**
+ * Use lighter hinting. Equivalent of FreeType2's FT_RENDER_MODE_LIGHT.
+ */
+ kTTFRenderModeLight,
+
+ /**
+ * Render fully monochrome. This makes glyph pixels either be fully opaque
+ * or fully transparent.
+ */
+ kTTFRenderModeMonochrome
+};
+
+/**
* Loads a TTF font file from a given data stream object.
*
* @param stream Stream object to load font data from.
* @param size The point size to load.
* @param dpi The dpi to use for size calculations, by default 72dpi
* are used.
- * @param monochrome Whether the font should be loaded in pure monochrome
- * mode. In case this is true no aliasing is used.
+ * @param renderMode FreeType2 mode used to render glyphs. @see TTFRenderMode
* @param mapping A mapping from code points 0-255 into UTF-32 code points.
* This can be used to support various 8bit character sets.
* In case the msb of the UTF-32 code point is set the font
@@ -50,7 +71,7 @@ class Font;
* supported.
* @return 0 in case loading fails, otherwise a pointer to the Font object.
*/
-Font *loadTTFFont(Common::SeekableReadStream &stream, int size, uint dpi = 0, bool monochrome = false, const uint32 *mapping = 0);
+Font *loadTTFFont(Common::SeekableReadStream &stream, int size, uint dpi = 0, TTFRenderMode renderMode = kTTFRenderModeLight, const uint32 *mapping = 0);
void shutdownTTF();