aboutsummaryrefslogtreecommitdiff
path: root/graphics/fonts/ttf.h
diff options
context:
space:
mode:
authorBastien Bouclet2015-11-22 14:18:14 +0100
committerBastien Bouclet2015-12-21 18:41:14 +0100
commit2d86f6da9c0ee2ffa80a2b570c148ea337b09cec (patch)
tree245b7c44d49e1e77f0b0b31732b3ce700285cf42 /graphics/fonts/ttf.h
parent366e164705a920ccd5de9dc606399f9c5b54913c (diff)
downloadscummvm-rg350-2d86f6da9c0ee2ffa80a2b570c148ea337b09cec.tar.gz
scummvm-rg350-2d86f6da9c0ee2ffa80a2b570c148ea337b09cec.tar.bz2
scummvm-rg350-2d86f6da9c0ee2ffa80a2b570c148ea337b09cec.zip
GRAPHICS: Introduce a size mode for TrueType fonts
Allows to match Windows font size selection by converting font heights to point sizes using the TrueType tables.
Diffstat (limited to 'graphics/fonts/ttf.h')
-rw-r--r--graphics/fonts/ttf.h24
1 files changed, 23 insertions, 1 deletions
diff --git a/graphics/fonts/ttf.h b/graphics/fonts/ttf.h
index bd25b69f21..4110486357 100644
--- a/graphics/fonts/ttf.h
+++ b/graphics/fonts/ttf.h
@@ -56,10 +56,32 @@ enum TTFRenderMode {
};
/**
+ * This specifies how the font size is defined.
+ */
+enum TTFSizeMode {
+ /**
+ * Character height only.
+ *
+ * This matches rendering obtained when calling
+ * CreateFont in Windows with negative height values.
+ */
+ kTTFSizeModeCharacter,
+
+ /**
+ * Full cell height.
+ *
+ * This matches rendering obtained when calling
+ * CreateFont in Windows with positive height values.
+ */
+ kTTFSizeModeCell
+};
+
+/**
* 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 sizeMode The point size definition used for the size parameter.
* @param dpi The dpi to use for size calculations, by default 72dpi
* are used.
* @param renderMode FreeType2 mode used to render glyphs. @see TTFRenderMode
@@ -71,7 +93,7 @@ enum TTFRenderMode {
* supported.
* @return 0 in case loading fails, otherwise a pointer to the Font object.
*/
-Font *loadTTFFont(Common::SeekableReadStream &stream, int size, uint dpi = 0, TTFRenderMode renderMode = kTTFRenderModeLight, const uint32 *mapping = 0);
+Font *loadTTFFont(Common::SeekableReadStream &stream, int size, TTFSizeMode sizeMode = kTTFSizeModeCharacter, uint dpi = 0, TTFRenderMode renderMode = kTTFRenderModeLight, const uint32 *mapping = 0);
void shutdownTTF();