| 83 | } |
| 84 | |
| 85 | GFont* GFont::load( const Torque::Path& path ) |
| 86 | { |
| 87 | FileStream stream; |
| 88 | |
| 89 | stream.open( path.getFullPath(), Torque::FS::File::Read ); |
| 90 | if ( stream.getStatus() != Stream::Ok ) |
| 91 | return NULL; |
| 92 | |
| 93 | GFont *ret = new GFont; |
| 94 | ret->mGFTFile = path; |
| 95 | |
| 96 | if(!ret->read(stream)) |
| 97 | { |
| 98 | Con::errorf( "GFont::load - error reading '%s'", path.getFullPath().c_str() ); |
| 99 | SAFE_DELETE(ret); |
| 100 | } |
| 101 | else |
| 102 | { |
| 103 | PlatformFont *platFont = createPlatformFont(ret->getFontFaceName(), ret->getFontSize(), ret->getFontCharSet()); |
| 104 | |
| 105 | if ( platFont == NULL ) |
| 106 | { |
| 107 | Con::errorf( "GFont::load - error creating platform font for '%s'", path.getFullPath().c_str() ); |
| 108 | SAFE_DELETE(ret); |
| 109 | } |
| 110 | else |
| 111 | ret->setPlatformFont(platFont); |
| 112 | } |
| 113 | |
| 114 | return ret; |
| 115 | } |
| 116 | |
| 117 | Resource<GFont> GFont::create(const String &faceName, U32 size, const char *cacheDirectory, U32 charset /* = TGE_ANSI_CHARSET */) |
| 118 | { |
no test coverage detected