-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathzh_apple_font.h
88 lines (84 loc) · 5.18 KB
/
zh_apple_font.h
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
// Copyright (c) 2021 Stoiko Todorov
// This work is licensed under the terms of the MIT license.
// For a copy, see https://opensource.org/licenses/MIT.
// apple II font
#define APPLEIIF_WIDTH 96
#define APPLEIIF_HEIGHT 64
#define APPLEIIF_CLMS 16
#define APPLEIIF_ROWS 8
#define APPLEIIF_CW (APPLEIIF_WIDTH/APPLEIIF_CLMS)
#define APPLEIIF_CH (APPLEIIF_HEIGHT/APPLEIIF_ROWS)
static unsigned char zh_apple_font[APPLEIIF_WIDTH * APPLEIIF_HEIGHT / 8] = {
0x0e,0xf1,0x38,0xcf,0xf7,0x79,0x91,0x03,0x45,0x41,0x14,0x39,0x91,0x12,0x45,0x51,
0x10,0x04,0x11,0x01,0x25,0xc1,0x16,0x45,0x55,0x14,0x05,0x51,0x10,0x04,0x11,0x01,
0x15,0x41,0x35,0x45,0x5d,0xf4,0x04,0xd1,0xf3,0x04,0x1f,0x01,0x0d,0x41,0x55,0x45,
0xcd,0x17,0x05,0x51,0x10,0x64,0x11,0x01,0x15,0x41,0x94,0x45,0x41,0x14,0x45,0x51,
0x10,0x44,0x11,0x11,0x25,0x41,0x14,0x45,0x5e,0xf4,0x38,0xcf,0x17,0x78,0x91,0xe3,
0x44,0x5f,0x14,0x39,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x8f,0xf3,0x38,0x5f,0x14,0x45,0x51,0xf4,0x7d,0xc0,0x07,0x00,0x51,0x14,0x45,0x44,
0x14,0x45,0x51,0x04,0x0d,0x01,0x06,0x00,0x51,0x14,0x05,0x44,0x14,0x45,0x8a,0x82,
0x0c,0x02,0x46,0x00,0x4f,0xf4,0x38,0x44,0x14,0x55,0x04,0x41,0x0c,0x04,0xa6,0x00,
0x41,0x55,0x40,0x44,0x14,0x55,0x0a,0x21,0x0c,0x08,0x16,0x01,0x41,0x92,0x44,0x44,
0xa4,0x6c,0x11,0x11,0x0c,0x10,0x06,0x00,0x81,0x15,0x39,0x84,0x43,0x44,0x11,0xf1,
0x7d,0xc0,0x07,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xfc,
0x00,0xa1,0x28,0xc4,0x20,0x10,0x04,0x41,0x00,0x00,0x00,0x00,0x00,0xa1,0x28,0xde,
0x54,0x10,0x02,0x52,0x11,0x00,0x00,0x40,0x00,0xa1,0x7c,0x05,0x52,0x10,0x01,0xe4,
0x10,0x00,0x00,0x20,0x00,0x01,0x28,0x0e,0x21,0x00,0x01,0x44,0x7c,0xc0,0x07,0x10,
0x00,0x01,0x7c,0x94,0x50,0x01,0x01,0xe4,0x10,0x04,0x00,0x08,0x00,0x00,0x28,0x4f,
0x96,0x00,0x02,0x52,0x11,0x04,0x00,0x04,0x00,0x01,0x28,0x04,0x66,0x01,0x04,0x41,
0x00,0x02,0x40,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x0e,0xe1,0x7c,0xc8,0xc7,0x7d,0x8e,0x03,0x00,0x08,0x20,0x38,0x91,0x11,0x41,0x4c,
0x20,0x40,0x51,0x04,0x00,0x04,0x40,0x44,0x19,0x01,0x21,0xca,0x13,0x20,0x51,0x44,
0x10,0xc2,0x87,0x20,0x15,0xc1,0x30,0x09,0xf4,0x10,0x8e,0x07,0x00,0x01,0x00,0x11,
0x13,0x21,0x40,0x1f,0x14,0x09,0x11,0x44,0x10,0xc2,0x87,0x10,0x11,0x11,0x44,0x48,
0x14,0x09,0x11,0x02,0x10,0x04,0x40,0x00,0x8e,0xf3,0x39,0x88,0xe3,0x08,0xce,0x01,
0x08,0x08,0x20,0x10,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x0e,0xf1,0x38,0xcf,0xf7,0x79,0x91,0x03,0x45,0x41,0x14,0x39,0x91,0x12,0x45,0x51,
0x10,0x04,0x11,0x01,0x25,0xc1,0x16,0x45,0x55,0x14,0x05,0x51,0x10,0x04,0x11,0x01,
0x15,0x41,0x35,0x45,0x5d,0xf4,0x04,0xd1,0xf3,0x04,0x1f,0x01,0x0d,0x41,0x55,0x45,
0xcd,0x17,0x05,0x51,0x10,0x64,0x11,0x01,0x15,0x41,0x94,0x45,0x41,0x14,0x45,0x51,
0x10,0x44,0x11,0x11,0x25,0x41,0x14,0x45,0x5e,0xf4,0x38,0xcf,0x17,0x78,0x91,0xe3,
0x44,0x5f,0x14,0x39,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x8f,0xf3,0x38,0x5f,0x14,0x45,0x51,0xf4,0x7d,0xc0,0x07,0x00,0x51,0x14,0x45,0x44,
0x14,0x45,0x51,0x04,0x0d,0x01,0x06,0x00,0x51,0x14,0x05,0x44,0x14,0x45,0x8a,0x82,
0x0c,0x02,0x46,0x00,0x4f,0xf4,0x38,0x44,0x14,0x55,0x04,0x41,0x0c,0x04,0xa6,0x00,
0x41,0x55,0x40,0x44,0x14,0x55,0x0a,0x21,0x0c,0x08,0x16,0x01,0x41,0x92,0x44,0x44,
0xa4,0x6c,0x11,0x11,0x0c,0x10,0x06,0x00,0x81,0x15,0x39,0x84,0x43,0x44,0x11,0xf1,
0x7d,0xc0,0x07,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xfc,
0x02,0x10,0x00,0x10,0xc0,0x00,0x01,0x81,0x04,0x06,0x00,0x00,0x04,0x10,0x00,0x10,
0x20,0x01,0x01,0x00,0x04,0x04,0x00,0x00,0x88,0xf3,0x78,0x9e,0x23,0x38,0x8f,0xc1,
0x44,0xc4,0xf6,0x38,0x00,0x14,0x05,0x51,0xf4,0x44,0x11,0x81,0x24,0x44,0x15,0x45,
0x80,0x17,0x05,0xd1,0x27,0x44,0x11,0x81,0x1c,0x44,0x15,0x45,0x40,0x14,0x05,0x51,
0x20,0x78,0x11,0x81,0x24,0x44,0x15,0x45,0x80,0xf7,0x78,0x9e,0x27,0x40,0x91,0x93,
0x44,0x4e,0x14,0x39,0x00,0x00,0x00,0x00,0x00,0x38,0x00,0x60,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x02,0x00,0x00,0x00,0x00,0x70,0xc4,0x61,0x01,0x00,0x00,0x00,0x02,
0x00,0x00,0x00,0x00,0x18,0x04,0xd3,0x54,0x8f,0xd7,0x79,0x4f,0x14,0x45,0x51,0xf4,
0x19,0x04,0x03,0x28,0x51,0x34,0x04,0x42,0x14,0x45,0x4a,0x84,0x0c,0x04,0x06,0x54,
0x51,0x14,0x38,0x42,0x14,0x55,0x44,0x44,0x18,0x04,0x03,0x28,0x8f,0x17,0x40,0x52,
0xa6,0x54,0x8a,0x27,0x18,0x04,0x03,0x54,0x01,0x14,0x3c,0x8c,0x45,0x6c,0x11,0xf4,
0x71,0xc4,0x01,0x00,0x01,0x04,0x00,0x00,0x00,0x00,0x80,0x03,0x00,0x04,0x00,0x00,
};
#ifdef SDL_MAJOR_VERSION
SDL_Texture* ZH_APLF_CreateTexture( SDL_Renderer *renderer ) {
SDL_SetHint( SDL_HINT_RENDER_SCALE_QUALITY, "0" );
SDL_Texture *tex = SDL_CreateTexture( renderer, SDL_PIXELFORMAT_ABGR8888,
SDL_TEXTUREACCESS_STATIC, APPLEIIF_WIDTH, APPLEIIF_HEIGHT );
int pitch = APPLEIIF_WIDTH * 4;
int bw = APPLEIIF_WIDTH / 8;
unsigned char bytes[pitch * APPLEIIF_HEIGHT];
for ( int y = 0, idx = 0; y < APPLEIIF_HEIGHT; y++ ) {
for ( int x = 0; x < bw; x++ ) {
int byte = zh_apple_font[x + y * bw];
for ( int i = 0; i < 8; i++, idx += 4 ) {
int alpha = ( byte & ( 1 << i ) ) ? 0xff : 0;
bytes[idx + 0] = 0xff;
bytes[idx + 1] = 0xff;
bytes[idx + 2] = 0xff;
bytes[idx + 3] = alpha;
}
}
}
SDL_UpdateTexture( tex, NULL, bytes, pitch );
return tex;
}
#endif