platformFont.h
Engine/source/platform/platformFont.h
Classes:
class
Public Enumerations
enum
FontCharset { TGE_ANSI_CHARSET = 0 TGE_SYMBOL_CHARSET TGE_SHIFTJIS_CHARSET TGE_HANGEUL_CHARSET TGE_HANGUL_CHARSET TGE_GB2312_CHARSET TGE_CHINESEBIG5_CHARSET TGE_OEM_CHARSET TGE_JOHAB_CHARSET TGE_HEBREW_CHARSET TGE_ARABIC_CHARSET TGE_GREEK_CHARSET TGE_TURKISH_CHARSET TGE_VIETNAMESE_CHARSET TGE_THAI_CHARSET TGE_EASTEUROPE_CHARSET TGE_RUSSIAN_CHARSET TGE_MAC_CHARSET TGE_BALTIC_CHARSET }
Public Functions
createPlatformFont(const char * name, dsize_t size, U32 charset)
const char *
getCharSetName(const U32 charSet)
Detailed Description
Public Enumerations
FontCharset
Enumerator
- TGE_ANSI_CHARSET = 0
- TGE_SYMBOL_CHARSET
- TGE_SHIFTJIS_CHARSET
- TGE_HANGEUL_CHARSET
- TGE_HANGUL_CHARSET
- TGE_GB2312_CHARSET
- TGE_CHINESEBIG5_CHARSET
- TGE_OEM_CHARSET
- TGE_JOHAB_CHARSET
- TGE_HEBREW_CHARSET
- TGE_ARABIC_CHARSET
- TGE_GREEK_CHARSET
- TGE_TURKISH_CHARSET
- TGE_VIETNAMESE_CHARSET
- TGE_THAI_CHARSET
- TGE_EASTEUROPE_CHARSET
- TGE_RUSSIAN_CHARSET
- TGE_MAC_CHARSET
- TGE_BALTIC_CHARSET
Public Functions
createPlatformFont(const char * name, dsize_t size, U32 charset)
getCharSetName(const U32 charSet)
1 2//----------------------------------------------------------------------------- 3// Copyright (c) 2012 GarageGames, LLC 4// 5// Permission is hereby granted, free of charge, to any person obtaining a copy 6// of this software and associated documentation files (the "Software"), to 7// deal in the Software without restriction, including without limitation the 8// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or 9// sell copies of the Software, and to permit persons to whom the Software is 10// furnished to do so, subject to the following conditions: 11// 12// The above copyright notice and this permission notice shall be included in 13// all copies or substantial portions of the Software. 14// 15// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 20// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS 21// IN THE SOFTWARE. 22//----------------------------------------------------------------------------- 23 24#ifndef _PLATFORM_H_ 25#include "platform/platform.h" 26#endif 27 28#ifndef _PLATFORMFONT_H_ 29#define _PLATFORMFONT_H_ 30 31// Charsets for fonts 32 33// [tom, 7/27/2005] These are intended to map to their Win32 equivalents. This 34// enumeration may require changes to accommodate other platforms. 35enum FontCharset 36{ 37 TGE_ANSI_CHARSET = 0, 38 TGE_SYMBOL_CHARSET, 39 TGE_SHIFTJIS_CHARSET, 40 TGE_HANGEUL_CHARSET, 41 TGE_HANGUL_CHARSET, 42 TGE_GB2312_CHARSET, 43 TGE_CHINESEBIG5_CHARSET, 44 TGE_OEM_CHARSET, 45 TGE_JOHAB_CHARSET, 46 TGE_HEBREW_CHARSET, 47 TGE_ARABIC_CHARSET, 48 TGE_GREEK_CHARSET, 49 TGE_TURKISH_CHARSET, 50 TGE_VIETNAMESE_CHARSET, 51 TGE_THAI_CHARSET, 52 TGE_EASTEUROPE_CHARSET, 53 TGE_RUSSIAN_CHARSET, 54 TGE_MAC_CHARSET, 55 TGE_BALTIC_CHARSET 56}; 57 58extern const char *getCharSetName(const U32 charSet); 59 60class PlatformFont 61{ 62public: 63 struct CharInfo 64 { 65 S16 bitmapIndex; ///< @note -1 indicates character is NOT to be 66 /// rendered, i.e., \n, \r, etc. 67 U32 xOffset; ///< x offset into bitmap sheet 68 U32 yOffset; ///< y offset into bitmap sheet 69 U32 width; ///< width of character (pixels) 70 U32 height; ///< height of character (pixels) 71 S32 xOrigin; 72 S32 yOrigin; 73 S32 xIncrement; 74 U8 *bitmapData; ///< temp storage for bitmap data 75 }; 76 77 virtual ~PlatformFont() {} 78 79 /// Is the specified character valid for rendering? 80 virtual bool isValidChar(const UTF16 ch) const = 0; 81 virtual bool isValidChar(const UTF8 *str) const = 0; 82 83 virtual U32 getFontHeight() const = 0; 84 virtual U32 getFontBaseLine() const = 0; 85 86 virtual PlatformFont::CharInfo &getCharInfo(const UTF16 ch) const = 0; 87 virtual PlatformFont::CharInfo &getCharInfo(const UTF8 *str) const = 0; 88 89 /// This is just for createPlatformFont to call. 90 /// 91 /// @todo Rethink this so we don't have a private public. 92 virtual bool create( const char *name, dsize_t size, U32 charset = TGE_ANSI_CHARSET ) = 0; 93 static void enumeratePlatformFonts( Vector<StringTableEntry>& fonts, UTF16* fontFamily = NULL ); 94}; 95 96extern PlatformFont *createPlatformFont(const char *name, dsize_t size, U32 charset = TGE_ANSI_CHARSET); 97 98#endif // _PLATFORMFONT_H_ 99