summary refs log tree commit diff
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--bin/man/psfed.15
-rw-r--r--bin/psfed.c22
2 files changed, 26 insertions, 1 deletions
diff --git a/bin/man/psfed.1 b/bin/man/psfed.1
index f0709594..11f0fb94 100644
--- a/bin/man/psfed.1
+++ b/bin/man/psfed.1
@@ -8,6 +8,7 @@
 .
 .Sh SYNOPSIS
 .Nm
+.Op Fl H Ar height
 .Op Fl g Ar glyphs
 .Op Fl h Ar height
 .Op Fl w Ar width
@@ -22,6 +23,10 @@ for the Linux framebuffer.
 The arguments are as follows:
 .
 .Bl -tag -width Ds
+.It Fl H Ar height
+Modify the height of an existing font.
+Only increasing the height is allowed.
+.
 .It Fl g Ar glyphs
 Set the number of glyphs in a new font.
 The default number of glyphs is 256.
diff --git a/bin/psfed.c b/bin/psfed.c
index b51da092..307e32b4 100644
--- a/bin/psfed.c
+++ b/bin/psfed.c
@@ -504,10 +504,12 @@ int main(int argc, char *argv[]) {
 	uint32_t newLen = 256;
 	uint32_t newWidth = 8;
 	uint32_t newHeight = 16;
+	uint32_t setHeight = 0;
 
 	int opt;
-	while (0 < (opt = getopt(argc, argv, "g:h:w:"))) {
+	while (0 < (opt = getopt(argc, argv, "H:g:h:w:"))) {
 		switch (opt) {
+			break; case 'H': setHeight = strtoul(optarg, NULL, 0);
 			break; case 'g': newLen = strtoul(optarg, NULL, 0);
 			break; case 'h': newHeight = strtoul(optarg, NULL, 0);
 			break; case 'w': newWidth = strtoul(optarg, NULL, 0);
@@ -520,6 +522,24 @@ int main(int argc, char *argv[]) {
 	path = strdup(argv[optind]);
 	fileRead(newLen, newWidth, newHeight);
 
+	if (setHeight) {
+		if (setHeight < header.glyph.height) {
+			errx(EX_CONFIG, "cannot decrease height");
+		}
+
+		uint32_t setSize = bytes(header.glyph.width) * setHeight;
+		uint8_t *setGlyphs = calloc(header.glyph.len, setSize);
+		for (uint32_t i = 0; i < header.glyph.len; ++i) {
+			memcpy(&setGlyphs[setSize * i], glyph(i), header.glyph.size);
+		}
+		free(glyphs);
+		glyphs = setGlyphs;
+
+		header.glyph.height = setHeight;
+		header.glyph.size = setSize;
+		normal.modified = true;
+	}
+
 	frameOpen();
 	frameClear();
 
nick in input windowJune McEnroe 2018-09-13Never send PRIVMSG to TagStatus or TagVerboseJune McEnroe 2018-09-13Move color selection to format.cJune McEnroe 2018-09-13Fix len for format->split at end of stringJune McEnroe 2018-09-13Avoid uninitialized x in uiReadJune McEnroe 2018-09-13Add IRCDefault to colors enumJune McEnroe 2018-09-13Return a format->split even at the end of the stringJune McEnroe 2018-09-13Fix weird tab-complete after commaJune McEnroe 2018-09-13Rewrite UI againJune McEnroe 2018-09-12Add note about C-oJune McEnroe 2018-09-12Use formatParse split to position input cursorJune McEnroe 2018-09-12Factor out IRC formatting parsingJune McEnroe 2018-09-11Add /help equivalent to /manJune McEnroe 2018-09-11Don't render every PM as a pingJune McEnroe 2018-09-11Add urlOpenMatchJune McEnroe 2018-09-10Depend on man.sh for chroot.tar targetJune McEnroe 2018-09-10Set LESSSECURE=1 in man.shJune McEnroe 2018-09-10Add /man commandJune McEnroe 2018-09-10Install man page in chrootJune McEnroe 2018-09-10Install man pageJune McEnroe 2018-09-10Split keys into subsections and document colorsJune McEnroe 2018-09-10Add "blank" lines to chatte.1June McEnroe 2018-09-10Document key bindings in chatte.1June McEnroe 2018-09-08Document slash commands in chatte.1June McEnroe