diff options
author | NerdyPepper <[email protected]> | 2018-02-02 17:09:56 +0000 |
---|---|---|
committer | NerdyPepper <[email protected]> | 2018-02-02 17:09:56 +0000 |
commit | 0eebe4250e143a85d7423b79c36bf5a041e76e12 (patch) | |
tree | db32ff04a46fbc5766f257f59926b4686c2737ed | |
parent | 079671292e63524757b5d7f8b0e16c11cad3f69e (diff) |
Begin support for hidpi
-rw-r--r-- | doubler.py | 47 | ||||
-rw-r--r-- | scientifica-11.bdf | 17 | ||||
-rw-r--r-- | scientifica.sfd | 6 |
3 files changed, 59 insertions, 11 deletions
diff --git a/doubler.py b/doubler.py new file mode 100644 index 0000000..6be9f6c --- /dev/null +++ b/doubler.py | |||
@@ -0,0 +1,47 @@ | |||
1 | #!/usr/bin/env python3 | ||
2 | |||
3 | import sys | ||
4 | |||
5 | from bdflib import reader, writer, model | ||
6 | |||
7 | |||
8 | def double_glyph_data(gd): | ||
9 | ret = [] | ||
10 | for gl in gd: | ||
11 | # get the bits in each line | ||
12 | glh = int(gl, 16) | ||
13 | bits = bin(glh)[2:] | ||
14 | double_bits = [] | ||
15 | for bit in bits: | ||
16 | # output two bits for each bit in the line | ||
17 | double_bits.append(bit) | ||
18 | double_bits.append(bit) | ||
19 | double_bits = ''.join(double_bits) | ||
20 | double_glh = int(double_bits, 2) | ||
21 | double_gl = hex(double_glh)[2:].upper() | ||
22 | # must 0-pad to two times the length of the original lines | ||
23 | double_gl = "0" * (len(gl) * 2 - len(double_gl)) + double_gl | ||
24 | # output the line two times | ||
25 | ret.append(double_gl) | ||
26 | ret.append(double_gl) | ||
27 | return ret | ||
28 | |||
29 | |||
30 | bdf = reader.read_bdf(sys.stdin) | ||
31 | |||
32 | double_bdf = model.Font(bdf['FACE_NAME'], | ||
33 | bdf['POINT_SIZE'], | ||
34 | bdf['RESOLUTION_X'], | ||
35 | bdf['RESOLUTION_Y']) | ||
36 | |||
37 | for g in bdf.glyphs_by_codepoint.values(): | ||
38 | double_bdf.new_glyph_from_data(g.name, | ||
39 | double_glyph_data(g.get_data()), | ||
40 | g.bbX * 2, | ||
41 | g.bbY * 2, | ||
42 | g.bbW * 2, | ||
43 | g.bbH * 2, | ||
44 | g.advance * 2, | ||
45 | g.codepoint) | ||
46 | |||
47 | writer.write_bdf(double_bdf, sys.stdout) | ||
diff --git a/scientifica-11.bdf b/scientifica-11.bdf index 90882f1..d431345 100644 --- a/scientifica-11.bdf +++ b/scientifica-11.bdf | |||
@@ -535,7 +535,7 @@ BITMAP | |||
535 | F0 | 535 | F0 |
536 | 80 | 536 | 80 |
537 | 80 | 537 | 80 |
538 | C0 | 538 | E0 |
539 | 80 | 539 | 80 |
540 | 80 | 540 | 80 |
541 | 80 | 541 | 80 |
@@ -562,8 +562,8 @@ BBX 4 7 0 0 | |||
562 | BITMAP | 562 | BITMAP |
563 | 90 | 563 | 90 |
564 | 90 | 564 | 90 |
565 | F0 | ||
566 | 90 | 565 | 90 |
566 | F0 | ||
567 | 90 | 567 | 90 |
568 | 90 | 568 | 90 |
569 | 90 | 569 | 90 |
@@ -707,7 +707,7 @@ E0 | |||
707 | 90 | 707 | 90 |
708 | E0 | 708 | E0 |
709 | A0 | 709 | A0 |
710 | A0 | 710 | 90 |
711 | 90 | 711 | 90 |
712 | ENDCHAR | 712 | ENDCHAR |
713 | STARTCHAR S | 713 | STARTCHAR S |
@@ -905,8 +905,8 @@ BITMAP | |||
905 | 70 | 905 | 70 |
906 | 90 | 906 | 90 |
907 | 90 | 907 | 90 |
908 | 90 | 908 | B0 |
909 | 70 | 909 | 50 |
910 | ENDCHAR | 910 | ENDCHAR |
911 | STARTCHAR b | 911 | STARTCHAR b |
912 | ENCODING 98 | 912 | ENCODING 98 |
@@ -1286,10 +1286,11 @@ STARTCHAR asciitilde | |||
1286 | ENCODING 126 | 1286 | ENCODING 126 |
1287 | SWIDTH 454 0 | 1287 | SWIDTH 454 0 |
1288 | DWIDTH 5 0 | 1288 | DWIDTH 5 0 |
1289 | BBX 4 2 0 2 | 1289 | BBX 5 3 0 2 |
1290 | BITMAP | 1290 | BITMAP |
1291 | 50 | 1291 | 40 |
1292 | A0 | 1292 | A8 |
1293 | 10 | ||
1293 | ENDCHAR | 1294 | ENDCHAR |
1294 | STARTCHAR uni00A0 | 1295 | STARTCHAR uni00A0 |
1295 | ENCODING 160 | 1296 | ENCODING 160 |
diff --git a/scientifica.sfd b/scientifica.sfd index bfb0ba8..8e0ea10 100644 --- a/scientifica.sfd +++ b/scientifica.sfd | |||
@@ -45,7 +45,7 @@ NameList: AGL For New Fonts | |||
45 | DisplaySize: 11 | 45 | DisplaySize: 11 |
46 | AntiAlias: 1 | 46 | AntiAlias: 1 |
47 | FitToEm: 0 | 47 | FitToEm: 0 |
48 | WinInfo: 0 44 15 | 48 | WinInfo: 44 44 15 |
49 | OnlyBitmaps: 1 | 49 | OnlyBitmaps: 1 |
50 | BeginPrivate: 0 | 50 | BeginPrivate: 0 |
51 | EndPrivate | 51 | EndPrivate |
@@ -8166,8 +8166,8 @@ BDFChar: 92 124 5 2 2 0 6 | |||
8166 | J:N0#J:N.M | 8166 | J:N0#J:N.M |
8167 | BDFChar: 93 125 5 0 4 -1 7 | 8167 | BDFChar: 93 125 5 0 4 -1 7 |
8168 | ^`XaB(a'qD^]4?7 | 8168 | ^`XaB(a'qD^]4?7 |
8169 | BDFChar: 94 126 5 0 4 2 3 | 8169 | BDFChar: 94 126 5 0 4 2 4 |
8170 | BTN2o | 8170 | 5c>4o |
8171 | BDFChar: 95 160 5 0 0 0 0 | 8171 | BDFChar: 95 160 5 0 0 0 0 |
8172 | z | 8172 | z |
8173 | BDFChar: 96 161 5 2 2 0 7 | 8173 | BDFChar: 96 161 5 2 2 0 7 |