File: font.cpp

package info (click to toggle)
scummvm 2.9.1%2Bdfsg-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 450,580 kB
  • sloc: cpp: 4,299,825; asm: 28,322; python: 12,901; sh: 11,302; java: 9,289; xml: 7,895; perl: 2,639; ansic: 2,465; yacc: 1,670; javascript: 1,020; makefile: 933; lex: 578; awk: 275; objc: 82; sed: 11; php: 1
file content (577 lines) | stat: -rw-r--r-- 21,815 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
/* ScummVM - Graphic Adventure Engine
 *
 * ScummVM is the legal property of its developers, whose names
 * are too numerous to list here. Please refer to the COPYRIGHT
 * file distributed with this source distribution.
 *
 * This program is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 *
 */

#include "common/endian.h"

#include "graphics/fonts/ttf.h"
#include "graphics/font.h"
#include "graphics/surface.h"

#include "image/tga.h"

#include "engines/grim/debug.h"
#include "engines/grim/grim.h"
#include "engines/grim/savegame.h"
#include "engines/grim/font.h"
#include "engines/grim/resource.h"
#include "engines/grim/gfx_base.h"

namespace Grim {

void Font::save(const Font *font, SaveGame *state) {
	const FontTTF *ttf = dynamic_cast<const FontTTF *>(font);
	if (ttf) {
		state->writeLESint32(-2);
		state->writeLESint32(ttf->getId());
		return;
	}
	const BitmapFont *bitmapFont = dynamic_cast<const BitmapFont *>(font);
	if (bitmapFont) {
		state->writeLESint32(bitmapFont->getId());
		return;
	}
	state->writeLESint32(-1);
}

Font *Font::load(SaveGame *state) {
	int32 fontId = state->readLESint32();
	if (fontId == -1) {
		return nullptr;
	}
	if (fontId == -2) {
		fontId = state->readLESint32();
		return FontTTF::getPool().getObject(fontId);
	}

	return BitmapFont::getPool().getObject(fontId);
}

Font *Font::getByFileName(const Common::String& fontName) {
	for (Font *f : BitmapFont::getPool()) {
		if (f->getFilename() == fontName) {
			return f;
		}
	}
	for (Font *f : FontTTF::getPool()) {
		if (f->getFilename() == fontName) {
			return f;
		}
	}
	return nullptr;
}

Font *Font::getFirstFont() {
	if (BitmapFont::getPool().begin() != BitmapFont::getPool().end())
		return *BitmapFont::getPool().begin();
	if (FontTTF::getPool().begin() != FontTTF::getPool().end())
		return *FontTTF::getPool().begin();
	return nullptr;
}

bool BitmapFont::is8Bit() const {
	return !_isDBCS && !_isUnicode;
}

BitmapFont::BitmapFont() :
		_userData(nullptr),
		_fontData(nullptr), _charHeaders(nullptr),
		_numChars(0), _dataSize(0), _kernedHeight(0), _baseOffsetY(0),
		_firstChar(0), _lastChar(0), _isUnicode(false), _isDBCS(false) {
}

BitmapFont::~BitmapFont() {
	_fwdCharIndex.clear();
	delete[] _charHeaders;
	delete[] _fontData;
	g_driver->destroyFont(this);
}

void BitmapFont::load(const Common::String &filename, Common::SeekableReadStream *data) {
	_filename = filename;
	_numChars = data->readUint32LE();
	_dataSize = data->readUint32LE();
	_kernedHeight = data->readUint32LE();
	_baseOffsetY = data->readUint32LE();
	data->seek(24, SEEK_SET);
	_firstChar = data->readUint32LE();
	_lastChar = data->readUint32LE();

	_isDBCS = g_grim->getGameLanguage() == Common::ZH_CHN && _numChars > 0xff;

	if (_isDBCS) {
		// Read character indexes - are the key/value reversed?
		_fwdCharIndex.resize(_numChars);
		for (uint i = 0; i < _numChars; ++i) {
			uint16 point = data->readUint16LE();
			_fwdCharIndex[i] = point ? point : -1;
		}
	} else {
		// Read character indexes - are the key/value reversed?
		Common::Array<uint16> revCharIndex;
		revCharIndex.resize(_numChars);
		uint16 maxPoint = 0;
		for (uint i = 0; i < _numChars; ++i) {
			uint16 point = data->readUint16LE();
			revCharIndex[i] = point;
			if (point > maxPoint)
				maxPoint = point;
		}
		_fwdCharIndex.resize(maxPoint + 1, -1);
		for (uint i = 0; i < _numChars; ++i) {
			_fwdCharIndex[revCharIndex[i]] = i;
		}

		// In order to ensure the correct character codes for
		// accented characters it is necessary to check the
		// requested code against the index of characters for
		// the font.  Previously, signed characters were
		// causing the problem but it might be possible for
		// an invalid character to be called for other reasons.
		//
		// Example: Without this fix when Manny greets Eva
		// for the first time and he says "Buenos Días" the
		// 'í' character will either show up as a different
		// character or it crashes the game.
		for (uint i = 0; i < _numChars; ++i) {
			if (revCharIndex[i] == i)
				_fwdCharIndex[revCharIndex[i]] = i;
		}
	}

	// Read character headers
	_charHeaders = new CharHeader[_numChars];
	for (uint i = 0; i < _numChars; ++i) {
		_charHeaders[i].offset = data->readUint32LE();
		// Kerned character size
		_charHeaders[i].kernedWidth = data->readSByte();
		_charHeaders[i].startingCol = data->readSByte();
		_charHeaders[i].startingLine = data->readSByte();
		data->seek(1, SEEK_CUR);
		// Character bitmap size
		_charHeaders[i].bitmapPitch = _charHeaders[i].bitmapWidth = data->readUint32LE();
		_charHeaders[i].bitmapHeight = data->readUint32LE();
	}
	// Read font data
	_fontData = new byte[_dataSize];

	data->read(_fontData, _dataSize);

	g_driver->createFont(this);
}

void BitmapFont::loadTGA(const Common::String &filename, Common::SeekableReadStream *index, Common::SeekableReadStream *image) {
  	Image::TGADecoder dec;
	bool success = dec.loadStream(*image);

	if (!success)
		return;

	const Graphics::Surface *surf = dec.getSurface();

	const int MAX_16BIT_CHARACTER = 0xffff;
	const int INDEX_ENTRY_SIZE = 10;

	_filename = filename;
	_numChars = index->size() / INDEX_ENTRY_SIZE;
	_dataSize = surf->w * surf->h;
	_kernedHeight = 16;
	_baseOffsetY = 0;
	_firstChar = 0;
	_lastChar = MAX_16BIT_CHARACTER;

	_isDBCS = false;
	_isUnicode = true;

	// Read character headers
	_charHeaders = new CharHeader[_numChars];

	_fwdCharIndex.resize(MAX_16BIT_CHARACTER + 1, -1);
	for (uint i = 0; i < _numChars; ++i) {
		uint16 point = index->readUint16LE();
		uint32 x = index->readUint32LE();
		uint32 y = index->readUint32LE();
		_fwdCharIndex[point] = i;
		_charHeaders[i].offset = x + y * surf->w;
		_charHeaders[i].kernedWidth = 16;
		_charHeaders[i].startingCol = 0;
		_charHeaders[i].startingLine = 0;
		_charHeaders[i].bitmapWidth = 16;
		_charHeaders[i].bitmapHeight = 16;
		_charHeaders[i].bitmapPitch = surf->w;
	}
	// Read font data
	_fontData = new byte[_dataSize];

	for (int y = 0; y < surf->h; y++)
		for (int x = 0; x < surf->w; x++)
			_fontData[y * surf->w + x] = surf->getPixel(x, y) ? 0 : 0xff;

	g_driver->createFont(this);
}

uint16 BitmapFont::getCharIndex(uint32 c) const {
	int res = c < _fwdCharIndex.size() ? _fwdCharIndex[c] : -1;
	if (res >= 0)
		return res;
	Debug::warning(Debug::Fonts, "The requested character (code 0x%x) does not correspond to anything in the font data!", c);
	// If we couldn't find the character then default to
	// the first character in the font so that something
	// gets loaded to prevent the game from crashing
	return 0;
}

uint32 BitmapFont::getNextChar(const Common::String &text, uint32 &i) const {
	if (_isUnicode) {
		uint32 chr = 0;
		uint num = 1;

		if ((text[i] & 0xF8) == 0xF0) {
			num = 4;
		} else if ((text[i] & 0xF0) == 0xE0) {
			num = 3;
		} else if ((text[i] & 0xE0) == 0xC0) {
			num = 2;
		}

		if (text.size() - i < num) {
			i = text.size();
			return '?';
		}

		switch (num) {
		case 4:
			chr |= (text[i++] & 0x07) << 18;
			chr |= (text[i++] & 0x3F) << 12;
			chr |= (text[i++] & 0x3F) << 6;
			chr |= (text[i++] & 0x3F);
			break;

		case 3:
			chr |= (text[i++] & 0x0F) << 12;
			chr |= (text[i++] & 0x3F) << 6;
			chr |= (text[i++] & 0x3F);
			break;

		case 2:
			chr |= (text[i++] & 0x1F) << 6;
			chr |= (text[i++] & 0x3F);
			break;

		default:
			chr = (text[i++] & 0x7F);
			break;
		}

		return chr;
	}
	uint16 ch = uint8(text[i]);
	if (_isDBCS && i + 1 < text.size() && (ch & 0x80)) {
		ch = (ch << 8) | (text[++i] & 0xff);
	}
	i++;
	return ch;
}

int BitmapFont::getKernedStringLength(const Common::String &text) const {
	int result = 0;
	for (uint32 i = 0; i < text.size(); ) {
		result += getCharKernedWidth(getNextChar(text, i));
	}
	return result;
}

int BitmapFont::getBitmapStringLength(const Common::String &text) const {
	int result = 0;
	for (uint32 i = 0; i < text.size(); ) {
		uint32 ch = getNextChar(text, i);
		result += getCharKernedWidth(ch) + getCharStartingCol(ch);
	}
	return result;
}

int BitmapFont::getStringHeight(const Common::String &text) const {
	int result = 0;
	for (uint32 i = 0; i < text.size(); ) {
		uint32 ch = getNextChar(text, i);

		int verticalOffset = getCharStartingLine(ch) + getBaseOffsetY();
		int charHeight = verticalOffset + getCharBitmapHeight(ch);
		if (charHeight > result)
			result = charHeight;
	}
	return result;
}

void BitmapFont::saveState(SaveGame *state) const {
	state->writeString(getFilename());
}

void BitmapFont::restoreState(SaveGame *state) {
	Common::String fname = state->readString();
	Common::SeekableReadStream *stream;

	g_driver->destroyFont(this);
	delete[] _fontData;
	_fontData = nullptr;
	_fwdCharIndex.clear();
	delete[] _charHeaders;
	_charHeaders = nullptr;

	stream = g_resourceloader->openNewStreamFile(fname.c_str(), true);
	load(fname, stream);
	delete stream;
}

void FontTTF::saveState(SaveGame *state) const {
	state->writeString(getFilename());
	state->writeLESint32(_size);
}

void FontTTF::restoreState(SaveGame *state) {
	Common::String fname = state->readString();
	int size = state->readLESint32();
	Common::SeekableReadStream *stream;

	g_driver->destroyFont(this);
	delete _font;

	if (g_grim->getGameType() == GType_GRIM && g_grim->getGameLanguage() == Common::KO_KOR) {
		Common::String name = fname + ".txt";
		stream = g_resourceloader->openNewStreamFile(name, true);
		if (stream) {
			Common::String line = stream->readLine();
			Common::String font;
			Common::String fsize;
			for (uint i = 0; i < line.size(); ++i) {
				if (line[i] == ' ') {
					font = Common::String(line.c_str(), i);
					fsize = Common::String(line.c_str() + i + 1, line.size() - i - 2);
				}
			}

			int s = atoi(fsize.c_str());
			delete stream;
			stream = g_resourceloader->openNewStreamFile(font.c_str(), true);
			loadTTF(fname, stream, s);
		} else {
			error("Cannot load korean ttf font");
		}
	} else {
		stream = g_resourceloader->openNewStreamFile(fname.c_str(), true);
		loadTTF(fname, stream, size);
	}
}

void BitmapFont::render(Graphics::Surface &buf, const Common::String &currentLine,
			const Graphics::PixelFormat &pixelFormat, uint32 blackColor, uint32 color, uint32 colorKey) const {
	int width = getBitmapStringLength(currentLine) + 1;
	int height = getStringHeight(currentLine) + 1;

	int startColumn = 0;

	buf.create(width, height, pixelFormat);
	buf.fillRect(Common::Rect(0, 0, width, height), colorKey);

	for (uint32 d = 0; d < currentLine.size(); ) {
		uint32 ch = getNextChar(currentLine, d);
		int32 charBitmapWidth = getCharBitmapWidth(ch);
		int32 charBitmapPitch = getCharBitmapPitch(ch);
		int32 charBitmapHeight = getCharBitmapHeight(ch);
		int8 fontRow = getCharStartingLine(ch) + getBaseOffsetY();
		int8 fontCol = getCharStartingCol(ch);

		for (int line = 0; line < charBitmapHeight; line++) {
			int lineOffset = (fontRow + line);
			int columnOffset = startColumn + fontCol;
			int fontOffset = (charBitmapPitch * line);
			for (int bitmapCol = 0; bitmapCol < charBitmapWidth; bitmapCol++, columnOffset++, fontOffset++) {
				byte pixel = getCharData(ch)[fontOffset];
				if (pixel == 0x80) {
					buf.setPixel(columnOffset, lineOffset, blackColor);
				} else if (pixel == 0xFF) {
					buf.setPixel(columnOffset, lineOffset, color);
				}
			}
		}
		startColumn += getCharKernedWidth(ch);
	}
}

void FontTTF::loadTTF(const Common::String &filename, Common::SeekableReadStream *data, int size) {
	_filename = filename;
	_size = size;
#ifdef USE_FREETYPE2
	_font = Graphics::loadTTFFont(data, DisposeAfterUse::YES, size);
#else
	_font = nullptr;
#endif
	_isUnicode = false;
}

void FontTTF::loadTTFFromArchive(const Common::String &filename, int size) {
	_filename = filename;
	_size = size;
#ifdef USE_FREETYPE2
	_font = Graphics::loadTTFFontFromArchive(filename, size, Graphics::kTTFSizeModeCharacter, 0, Graphics::kTTFRenderModeLight);
#else
	_font = nullptr;
#endif
	_isUnicode = true;
}

int FontTTF::getKernedStringLength(const Common::String &text) const {
	if (g_grim->getGameLanguage() == Common::KO_KOR) {
		return _font->getStringWidth(convertToU32String(text.c_str(), Common::kWindows949));
	}
	if (_isUnicode) {
		return _font->getStringWidth(text.decode(Common::CodePage::kUtf8));
	}
	return _font->getStringWidth(text);
}

void FontTTF::render(Graphics::Surface &surface, const Common::String &currentLine, const Graphics::PixelFormat &pixelFormat, uint32 blackColor, uint32 color, uint32 colorKey) const {
#ifdef USE_FREETYPE2
	if (g_grim->getGameLanguage() == Common::KO_KOR) {
		Common::U32String u32CurrentLine(currentLine, Common::kWindows949);
		int width = _font->getStringWidth(u32CurrentLine);
		int height = _font->getFontHeight();
		surface.create(width, height, pixelFormat);
		surface.fillRect(Common::Rect(0, 0, width, height), colorKey);
		_font->drawString(&surface, u32CurrentLine, 0, 0, width, 0xFFFFFFFF);
	} else if (_isUnicode) {
		Common::Rect bbox = _font->getBoundingBox(currentLine.decode(Common::CodePage::kUtf8));

		surface.create(bbox.right, bbox.bottom, pixelFormat);
		surface.fillRect(Common::Rect(0, 0, bbox.right, bbox.bottom), colorKey);

		_font->drawString(&surface, currentLine.decode(Common::CodePage::kUtf8), 0, 0, bbox.right, 0xFFFFFFFF);
	} else {
		Common::Rect bbox = _font->getBoundingBox(currentLine);

		surface.create(bbox.right, bbox.bottom, pixelFormat);
		surface.fillRect(Common::Rect(0, 0, bbox.right, bbox.bottom), colorKey);

		_font->drawString(&surface, currentLine, 0, 0, bbox.right, 0xFFFFFFFF);
	}
#endif
}

// Hardcoded default font for FPS, GUI, etc
const uint8 BitmapFont::emerFont[][13] = {
{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00},
{0x00, 0x00, 0x18, 0x18, 0x00, 0x00, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18},
{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x36, 0x36, 0x36, 0x36},
{0x00, 0x00, 0x00, 0x66, 0x66, 0xff, 0x66, 0x66, 0xff, 0x66, 0x66, 0x00, 0x00},
{0x00, 0x00, 0x18, 0x7e, 0xff, 0x1b, 0x1f, 0x7e, 0xf8, 0xd8, 0xff, 0x7e, 0x18},
{0x00, 0x00, 0x0e, 0x1b, 0xdb, 0x6e, 0x30, 0x18, 0x0c, 0x76, 0xdb, 0xd8, 0x70},
{0x00, 0x00, 0x7f, 0xc6, 0xcf, 0xd8, 0x70, 0x70, 0xd8, 0xcc, 0xcc, 0x6c, 0x38},
{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x1c, 0x0c, 0x0e},
{0x00, 0x00, 0x0c, 0x18, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x18, 0x0c},
{0x00, 0x00, 0x30, 0x18, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x18, 0x30},
{0x00, 0x00, 0x00, 0x00, 0x99, 0x5a, 0x3c, 0xff, 0x3c, 0x5a, 0x99, 0x00, 0x00},
{0x00, 0x00, 0x00, 0x18, 0x18, 0x18, 0xff, 0xff, 0x18, 0x18, 0x18, 0x00, 0x00},
{0x00, 0x00, 0x30, 0x18, 0x1c, 0x1c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00},
{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00},
{0x00, 0x00, 0x00, 0x38, 0x38, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00},
{0x00, 0x60, 0x60, 0x30, 0x30, 0x18, 0x18, 0x0c, 0x0c, 0x06, 0x06, 0x03, 0x03},
{0x00, 0x00, 0x3c, 0x66, 0xc3, 0xe3, 0xf3, 0xdb, 0xcf, 0xc7, 0xc3, 0x66, 0x3c},
{0x00, 0x00, 0x7e, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x78, 0x38, 0x18},
{0x00, 0x00, 0xff, 0xc0, 0xc0, 0x60, 0x30, 0x18, 0x0c, 0x06, 0x03, 0xe7, 0x7e},
{0x00, 0x00, 0x7e, 0xe7, 0x03, 0x03, 0x07, 0x7e, 0x07, 0x03, 0x03, 0xe7, 0x7e},
{0x00, 0x00, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0xff, 0xcc, 0x6c, 0x3c, 0x1c, 0x0c},
{0x00, 0x00, 0x7e, 0xe7, 0x03, 0x03, 0x07, 0xfe, 0xc0, 0xc0, 0xc0, 0xc0, 0xff},
{0x00, 0x00, 0x7e, 0xe7, 0xc3, 0xc3, 0xc7, 0xfe, 0xc0, 0xc0, 0xc0, 0xe7, 0x7e},
{0x00, 0x00, 0x30, 0x30, 0x30, 0x30, 0x18, 0x0c, 0x06, 0x03, 0x03, 0x03, 0xff},
{0x00, 0x00, 0x7e, 0xe7, 0xc3, 0xc3, 0xe7, 0x7e, 0xe7, 0xc3, 0xc3, 0xe7, 0x7e},
{0x00, 0x00, 0x7e, 0xe7, 0x03, 0x03, 0x03, 0x7f, 0xe7, 0xc3, 0xc3, 0xe7, 0x7e},
{0x00, 0x00, 0x00, 0x38, 0x38, 0x00, 0x00, 0x38, 0x38, 0x00, 0x00, 0x00, 0x00},
{0x00, 0x00, 0x30, 0x18, 0x1c, 0x1c, 0x00, 0x00, 0x1c, 0x1c, 0x00, 0x00, 0x00},
{0x00, 0x00, 0x06, 0x0c, 0x18, 0x30, 0x60, 0xc0, 0x60, 0x30, 0x18, 0x0c, 0x06},
{0x00, 0x00, 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0x66, 0xc3},
{0x00, 0x00, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x3c, 0x3c, 0x66, 0x66, 0xc3},
{0x00, 0x00, 0xff, 0xc0, 0xc0, 0x60, 0x30, 0x7e, 0x0c, 0x06, 0x03, 0x03, 0xff},
{0x00, 0x00, 0x3c, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x3c},
{0x00, 0x03, 0x03, 0x06, 0x06, 0x0c, 0x0c, 0x18, 0x18, 0x30, 0x30, 0x60, 0x60},
{0x00, 0x00, 0x3c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x3c},
{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc3, 0x66, 0x3c, 0x18},
{0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00},
{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x38, 0x30, 0x70},
{0x00, 0x00, 0x7f, 0xc3, 0xc3, 0x7f, 0x03, 0xc3, 0x7e, 0x00, 0x00, 0x00, 0x00},
{0x00, 0x00, 0xfe, 0xc3, 0xc3, 0xc3, 0xc3, 0xfe, 0xc0, 0xc0, 0xc0, 0xc0, 0xc0},
{0x00, 0x00, 0x7e, 0xc3, 0xc0, 0xc0, 0xc0, 0xc3, 0x7e, 0x00, 0x00, 0x00, 0x00},
{0x00, 0x00, 0x7f, 0xc3, 0xc3, 0xc3, 0xc3, 0x7f, 0x03, 0x03, 0x03, 0x03, 0x03},
{0x00, 0x00, 0x7f, 0xc0, 0xc0, 0xfe, 0xc3, 0xc3, 0x7e, 0x00, 0x00, 0x00, 0x00},
{0x00, 0x00, 0x30, 0x30, 0x30, 0x30, 0x30, 0xfc, 0x30, 0x30, 0x30, 0x33, 0x1e},
{0x7e, 0xc3, 0x03, 0x03, 0x7f, 0xc3, 0xc3, 0xc3, 0x7e, 0x00, 0x00, 0x00, 0x00},
{0x00, 0x00, 0xc3, 0xc3, 0xc3, 0xc3, 0xc3, 0xc3, 0xfe, 0xc0, 0xc0, 0xc0, 0xc0},
{0x00, 0x00, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x00, 0x00, 0x18, 0x00},
{0x38, 0x6c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x00, 0x00, 0x0c, 0x00},
{0x00, 0x00, 0xc6, 0xcc, 0xf8, 0xf0, 0xd8, 0xcc, 0xc6, 0xc0, 0xc0, 0xc0, 0xc0},
{0x00, 0x00, 0x7e, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x78},
{0x00, 0x00, 0xdb, 0xdb, 0xdb, 0xdb, 0xdb, 0xdb, 0xfe, 0x00, 0x00, 0x00, 0x00},
{0x00, 0x00, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0xfc, 0x00, 0x00, 0x00, 0x00},
{0x00, 0x00, 0x7c, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0x7c, 0x00, 0x00, 0x00, 0x00},
{0xc0, 0xc0, 0xc0, 0xfe, 0xc3, 0xc3, 0xc3, 0xc3, 0xfe, 0x00, 0x00, 0x00, 0x00},
{0x03, 0x03, 0x03, 0x7f, 0xc3, 0xc3, 0xc3, 0xc3, 0x7f, 0x00, 0x00, 0x00, 0x00},
{0x00, 0x00, 0xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0xe0, 0xfe, 0x00, 0x00, 0x00, 0x00},
{0x00, 0x00, 0xfe, 0x03, 0x03, 0x7e, 0xc0, 0xc0, 0x7f, 0x00, 0x00, 0x00, 0x00},
{0x00, 0x00, 0x1c, 0x36, 0x30, 0x30, 0x30, 0x30, 0xfc, 0x30, 0x30, 0x30, 0x00},
{0x00, 0x00, 0x7e, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0x00, 0x00, 0x00, 0x00},
{0x00, 0x00, 0x18, 0x3c, 0x3c, 0x66, 0x66, 0xc3, 0xc3, 0x00, 0x00, 0x00, 0x00},
{0x00, 0x00, 0xc3, 0xe7, 0xff, 0xdb, 0xc3, 0xc3, 0xc3, 0x00, 0x00, 0x00, 0x00},
{0x00, 0x00, 0xc3, 0x66, 0x3c, 0x18, 0x3c, 0x66, 0xc3, 0x00, 0x00, 0x00, 0x00},
{0xc0, 0x60, 0x60, 0x30, 0x18, 0x3c, 0x66, 0x66, 0xc3, 0x00, 0x00, 0x00, 0x00},
{0x00, 0x00, 0xff, 0x60, 0x30, 0x18, 0x0c, 0x06, 0xff, 0x00, 0x00, 0x00, 0x00},
{0x00, 0x00, 0x0f, 0x18, 0x18, 0x18, 0x38, 0xf0, 0x38, 0x18, 0x18, 0x18, 0x0f},
{0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18},
{0x00, 0x00, 0xf0, 0x18, 0x18, 0x18, 0x1c, 0x0f, 0x1c, 0x18, 0x18, 0x18, 0xf0},
{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x06, 0x8f, 0xf1, 0x60, 0x00, 0x00, 0x00},
{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}
};

} // end of namespace Grim