diff options
Diffstat (limited to 'doubler.py')
-rw-r--r-- | doubler.py | 47 |
1 files changed, 0 insertions, 47 deletions
diff --git a/doubler.py b/doubler.py deleted file mode 100644 index 6be9f6c..0000000 --- a/doubler.py +++ /dev/null | |||
@@ -1,47 +0,0 @@ | |||
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) | ||