BASIC compiler/interpreter for PIC32MX/MZ-80K
Revision | 3bb49c390cae5881022825182c0a91a13facaa63 (tree) |
---|---|
Time | 2019-03-03 09:29:36 |
Author | Katsumi <kmorimatsu@sour...> |
Commiter | Katsumi |
Update font-creating scrips for CKNJ12 and CKNJ16
@@ -10,6 +10,44 @@ | ||
10 | 10 | |
11 | 11 | */ |
12 | 12 | |
13 | +$tfile=file_get_contents('./shnm6x12a.bdf'); | |
14 | +$ftable=array(); | |
15 | +preg_replace_callback('/STARTCHAR[\s]+([0-9a-f]{2})[\s\S]*?(([0-9a-f]{2}[\s]+){12})/',function($m) use(&$ftable){ | |
16 | + /* 0x23 # */ | |
17 | + /* example: | |
18 | + STARTCHAR 23 | |
19 | + ENCODING 35 | |
20 | + SWIDTH 960 0 | |
21 | + DWIDTH 6 0 | |
22 | + BBX 6 12 0 -2 | |
23 | + BITMAP | |
24 | + 00 | |
25 | + 50 | |
26 | + 50 | |
27 | + f8 | |
28 | + 50 | |
29 | + 50 | |
30 | + 50 | |
31 | + f8 | |
32 | + 50 | |
33 | + 50 | |
34 | + 00 | |
35 | + 00 | |
36 | + ENDCHAR | |
37 | + */ | |
38 | + $ftable[hexdec($m[1])]=preg_replace('/([0-9a-f]{2})[\s]+/','$1',$m[2]); | |
39 | +},$tfile); | |
40 | +//print_r($ftable);exit; | |
41 | + | |
42 | +$result=''; | |
43 | +for($code=0x20;$code<=0x7f;$code++){ | |
44 | + for($i=0;$i<24;$i+=2){ | |
45 | + $result.=chr(hexdec(substr($ftable[$code],$i,2))); | |
46 | + } | |
47 | +} | |
48 | +// half font area is 1152 bytes (12*96) | |
49 | +//file_put_contents('./result',$result);exit; | |
50 | + | |
13 | 51 | $tfile=file_get_contents('./shnmk12.bdf'); |
14 | 52 | $ftable=array(); |
15 | 53 | preg_replace_callback('/STARTCHAR[\s]+([0-9a-f]{4})[\s\S]*?(([0-9a-f]{4}[\s]+){12})/',function($m) use(&$ftable){ |
@@ -39,7 +77,6 @@ preg_replace_callback('/STARTCHAR[\s]+([0-9a-f]{4})[\s\S]*?(([0-9a-f]{4}[\s]+){1 | ||
39 | 77 | },$tfile); |
40 | 78 | //print_r($ftable);exit; |
41 | 79 | |
42 | -$result=''; | |
43 | 80 | for($code=0x2121;$code<=0x7426;$code++){ |
44 | 81 | if (isset($ftable[$code])) { |
45 | 82 | for($i=0;$i<36;$i+=2){ |
@@ -2,6 +2,7 @@ | ||
2 | 2 | /* |
3 | 3 | |
4 | 4 | Binary font file generator for Shinonome 12x12 font. |
5 | + Place 'shnm6x12a.bdf' in the same directory and run this script. | |
5 | 6 | Place 'shnmk16.bdf' in the same directory and run this script. |
6 | 7 | Place 'JIS0208.TXT' in the same directory and run this script. |
7 | 8 | The font file is used for UTF-8. |
@@ -11,6 +12,44 @@ | ||
11 | 12 | |
12 | 13 | */ |
13 | 14 | |
15 | +$tfile=file_get_contents('./shnm6x12a.bdf'); | |
16 | +$ftable=array(); | |
17 | +preg_replace_callback('/STARTCHAR[\s]+([0-9a-f]{2})[\s\S]*?(([0-9a-f]{2}[\s]+){12})/',function($m) use(&$ftable){ | |
18 | + /* 0x23 # */ | |
19 | + /* example: | |
20 | + STARTCHAR 23 | |
21 | + ENCODING 35 | |
22 | + SWIDTH 960 0 | |
23 | + DWIDTH 6 0 | |
24 | + BBX 6 12 0 -2 | |
25 | + BITMAP | |
26 | + 00 | |
27 | + 50 | |
28 | + 50 | |
29 | + f8 | |
30 | + 50 | |
31 | + 50 | |
32 | + 50 | |
33 | + f8 | |
34 | + 50 | |
35 | + 50 | |
36 | + 00 | |
37 | + 00 | |
38 | + ENDCHAR | |
39 | + */ | |
40 | + $ftable[hexdec($m[1])]=preg_replace('/([0-9a-f]{2})[\s]+/','$1',$m[2]); | |
41 | +},$tfile); | |
42 | +//print_r($ftable);exit; | |
43 | + | |
44 | +$result=''; | |
45 | +for($code=0x20;$code<=0x7f;$code++){ | |
46 | + for($i=0;$i<24;$i+=2){ | |
47 | + $result.=chr(hexdec(substr($ftable[$code],$i,2))); | |
48 | + } | |
49 | +} | |
50 | +// half font area is 1152 bytes (12*96) | |
51 | +//file_put_contents('./result',$result);exit; | |
52 | + | |
14 | 53 | $tfile=file_get_contents('./shnmk12.bdf'); |
15 | 54 | $ftable=array(); |
16 | 55 | preg_replace_callback('/STARTCHAR[\s]+([0-9a-f]{4})[\s\S]*?(([0-9a-f]{4}[\s]+){12})/',function($m) use(&$ftable){ |
@@ -49,7 +88,6 @@ preg_replace_callback('/[\r\n]0x([0-9A-F]{4})[\s]+0x([0-9A-F]{4})[\s]+0x([0-9A-F | ||
49 | 88 | } |
50 | 89 | },$tfile); |
51 | 90 | |
52 | -$result=''; | |
53 | 91 | for($code=0x0000;$code<=0xffff;$code++){ |
54 | 92 | /* |
55 | 93 | Skip: |
@@ -4,11 +4,55 @@ | ||
4 | 4 | |
5 | 5 | Binary font file generator for Shinonome 16x16 font. |
6 | 6 | Place 'shnmk16.bdf' in the same directory and run this script. |
7 | + Place 'shnm8x16.bdf' in the same directory and run this script. | |
7 | 8 | The font file is used for EUC-JP. |
8 | 9 | On 2/23/2019, Shinonome font is available from: https://www.mgo-tec.com/kanji-font-shinonome |
9 | 10 | |
10 | 11 | */ |
11 | 12 | |
13 | +$tfile=file_get_contents('./shnm8x16.bdf'); | |
14 | +$ftable=array(); | |
15 | +preg_replace_callback('/STARTCHAR[\s]+([0-9a-f]{2})[\s\S]*?(([0-9a-f]{2}[\s]+){16})/',function($m) use(&$ftable){ | |
16 | + /* 0x23: # */ | |
17 | + /* example: | |
18 | + STARTCHAR 23 | |
19 | + ENCODING 35 | |
20 | + SWIDTH 480 0 | |
21 | + DWIDTH 8 0 | |
22 | + BBX 8 16 0 -2 | |
23 | + BITMAP | |
24 | + 00 | |
25 | + 12 | |
26 | + 12 | |
27 | + 12 | |
28 | + 7f | |
29 | + 24 | |
30 | + 24 | |
31 | + 24 | |
32 | + 24 | |
33 | + 24 | |
34 | + fe | |
35 | + 48 | |
36 | + 48 | |
37 | + 48 | |
38 | + 48 | |
39 | + 00 | |
40 | + ENDCHAR | |
41 | + */ | |
42 | + $ftable[hexdec($m[1])]=preg_replace('/[\s]+/','',$m[2]); | |
43 | +},$tfile); | |
44 | +$ftable[0x7f]='00000000000000000000000000000000'; | |
45 | +//print_r($ftable);exit; | |
46 | + | |
47 | +$result=''; | |
48 | +for($code=0x20;$code<=0x7f;$code++){ | |
49 | + for($i=0;$i<32;$i+=2){ | |
50 | + $result.=chr(hexdec(substr($ftable[$code],$i,2))); | |
51 | + } | |
52 | +} | |
53 | +// half font area is 1536 bytes (16*96) | |
54 | +//file_put_contents('./result',$result);exit; | |
55 | + | |
12 | 56 | $tfile=file_get_contents('./shnmk16.bdf'); |
13 | 57 | $ftable=array(); |
14 | 58 | preg_replace_callback('/STARTCHAR[\s]+([0-9a-f]{4})[\s\S]*?(([0-9a-f]{4}[\s]+){16})/',function($m) use(&$ftable){ |
@@ -42,7 +86,6 @@ preg_replace_callback('/STARTCHAR[\s]+([0-9a-f]{4})[\s\S]*?(([0-9a-f]{4}[\s]+){1 | ||
42 | 86 | },$tfile); |
43 | 87 | //print_r($ftable);exit; |
44 | 88 | |
45 | -$result=''; | |
46 | 89 | for($code=0x2121;$code<=0x7426;$code++){ |
47 | 90 | if (isset($ftable[$code])) { |
48 | 91 | for($i=0;$i<64;$i+=2){ |
@@ -3,6 +3,7 @@ | ||
3 | 3 | |
4 | 4 | Binary font file generator for Shinonome 16x16 font. |
5 | 5 | Place 'shnmk16.bdf' in the same directory and run this script. |
6 | + Place 'shnm8x16.bdf' in the same directory and run this script. | |
6 | 7 | Place 'JIS0208.TXT' in the same directory and run this script. |
7 | 8 | The font file is used for UTF-8. |
8 | 9 | On 2/23/2019, Shinonome font is available from: https://www.mgo-tec.com/kanji-font-shinonome |
@@ -10,6 +11,49 @@ | ||
10 | 11 | |
11 | 12 | */ |
12 | 13 | |
14 | +$tfile=file_get_contents('./shnm8x16.bdf'); | |
15 | +$ftable=array(); | |
16 | +preg_replace_callback('/STARTCHAR[\s]+([0-9a-f]{2})[\s\S]*?(([0-9a-f]{2}[\s]+){16})/',function($m) use(&$ftable){ | |
17 | + /* 0x23: # */ | |
18 | + /* example: | |
19 | + STARTCHAR 23 | |
20 | + ENCODING 35 | |
21 | + SWIDTH 480 0 | |
22 | + DWIDTH 8 0 | |
23 | + BBX 8 16 0 -2 | |
24 | + BITMAP | |
25 | + 00 | |
26 | + 12 | |
27 | + 12 | |
28 | + 12 | |
29 | + 7f | |
30 | + 24 | |
31 | + 24 | |
32 | + 24 | |
33 | + 24 | |
34 | + 24 | |
35 | + fe | |
36 | + 48 | |
37 | + 48 | |
38 | + 48 | |
39 | + 48 | |
40 | + 00 | |
41 | + ENDCHAR | |
42 | + */ | |
43 | + $ftable[hexdec($m[1])]=preg_replace('/[\s]+/','',$m[2]); | |
44 | +},$tfile); | |
45 | +$ftable[0x7f]='00000000000000000000000000000000'; | |
46 | +//print_r($ftable);exit; | |
47 | + | |
48 | +$result=''; | |
49 | +for($code=0x20;$code<=0x7f;$code++){ | |
50 | + for($i=0;$i<32;$i+=2){ | |
51 | + $result.=chr(hexdec(substr($ftable[$code],$i,2))); | |
52 | + } | |
53 | +} | |
54 | +// half font area is 1536 bytes (16*96) | |
55 | +//file_put_contents('./result',$result);exit; | |
56 | + | |
13 | 57 | $tfile=file_get_contents('./shnmk16.bdf'); |
14 | 58 | $ftable=array(); |
15 | 59 | preg_replace_callback('/STARTCHAR[\s]+([0-9a-f]{4})[\s\S]*?(([0-9a-f]{4}[\s]+){16})/',function($m) use(&$ftable){ |
@@ -52,7 +96,6 @@ preg_replace_callback('/[\r\n]0x([0-9A-F]{4})[\s]+0x([0-9A-F]{4})[\s]+0x([0-9A-F | ||
52 | 96 | } |
53 | 97 | },$tfile); |
54 | 98 | |
55 | -$result=''; | |
56 | 99 | for($code=0x0000;$code<=0xffff;$code++){ |
57 | 100 | /* |
58 | 101 | Skip: |