From 0eebe4250e143a85d7423b79c36bf5a041e76e12 Mon Sep 17 00:00:00 2001 From: NerdyPepper Date: Fri, 2 Feb 2018 22:39:56 +0530 Subject: Begin support for hidpi --- doubler.py | 47 +++++++++++++++++++++++++++++++++++++++++++++++ scientifica-11.bdf | 17 +++++++++-------- scientifica.sfd | 6 +++--- 3 files changed, 59 insertions(+), 11 deletions(-) create mode 100644 doubler.py diff --git a/doubler.py b/doubler.py new file mode 100644 index 0000000..6be9f6c --- /dev/null +++ b/doubler.py @@ -0,0 +1,47 @@ +#!/usr/bin/env python3 + +import sys + +from bdflib import reader, writer, model + + +def double_glyph_data(gd): + ret = [] + for gl in gd: + # get the bits in each line + glh = int(gl, 16) + bits = bin(glh)[2:] + double_bits = [] + for bit in bits: + # output two bits for each bit in the line + double_bits.append(bit) + double_bits.append(bit) + double_bits = ''.join(double_bits) + double_glh = int(double_bits, 2) + double_gl = hex(double_glh)[2:].upper() + # must 0-pad to two times the length of the original lines + double_gl = "0" * (len(gl) * 2 - len(double_gl)) + double_gl + # output the line two times + ret.append(double_gl) + ret.append(double_gl) + return ret + + +bdf = reader.read_bdf(sys.stdin) + +double_bdf = model.Font(bdf['FACE_NAME'], + bdf['POINT_SIZE'], + bdf['RESOLUTION_X'], + bdf['RESOLUTION_Y']) + +for g in bdf.glyphs_by_codepoint.values(): + double_bdf.new_glyph_from_data(g.name, + double_glyph_data(g.get_data()), + g.bbX * 2, + g.bbY * 2, + g.bbW * 2, + g.bbH * 2, + g.advance * 2, + g.codepoint) + +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 F0 80 80 -C0 +E0 80 80 80 @@ -562,8 +562,8 @@ BBX 4 7 0 0 BITMAP 90 90 -F0 90 +F0 90 90 90 @@ -707,7 +707,7 @@ E0 90 E0 A0 -A0 +90 90 ENDCHAR STARTCHAR S @@ -905,8 +905,8 @@ BITMAP 70 90 90 -90 -70 +B0 +50 ENDCHAR STARTCHAR b ENCODING 98 @@ -1286,10 +1286,11 @@ STARTCHAR asciitilde ENCODING 126 SWIDTH 454 0 DWIDTH 5 0 -BBX 4 2 0 2 +BBX 5 3 0 2 BITMAP -50 -A0 +40 +A8 +10 ENDCHAR STARTCHAR uni00A0 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 DisplaySize: 11 AntiAlias: 1 FitToEm: 0 -WinInfo: 0 44 15 +WinInfo: 44 44 15 OnlyBitmaps: 1 BeginPrivate: 0 EndPrivate @@ -8166,8 +8166,8 @@ BDFChar: 92 124 5 2 2 0 6 J:N0#J:N.M BDFChar: 93 125 5 0 4 -1 7 ^`XaB(a'qD^]4?7 -BDFChar: 94 126 5 0 4 2 3 -BTN2o +BDFChar: 94 126 5 0 4 2 4 +5c>4o BDFChar: 95 160 5 0 0 0 0 z BDFChar: 96 161 5 2 2 0 7 -- cgit v1.2.3