From 2d86f6da9c0ee2ffa80a2b570c148ea337b09cec Mon Sep 17 00:00:00 2001 From: Bastien Bouclet Date: Sun, 22 Nov 2015 14:18:14 +0100 Subject: 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. --- graphics/fonts/ttf.h | 24 +++++++++++++++++++++++- 1 file changed, 23 insertions(+), 1 deletion(-) (limited to 'graphics/fonts/ttf.h') 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 @@ -55,11 +55,33 @@ enum TTFRenderMode { kTTFRenderModeMonochrome }; +/** + * 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(); -- cgit v1.2.3