summary refs log tree commit diff
path: root/bin
diff options
context:
space:
mode:
authorJune McEnroe <june@causal.agency>2018-10-03 16:34:09 -0400
committerJune McEnroe <june@causal.agency>2018-10-03 16:34:09 -0400
commit2287c43eef06304be656a70184f9fd42d9645014 (patch)
tree1c6f6f19e6243c111269ce9b0292de0eb0331df6 /bin
parentFix ≈ glyph of sans6x8 (diff)
downloadsrc-2287c43eef06304be656a70184f9fd42d9645014.tar.gz
src-2287c43eef06304be656a70184f9fd42d9645014.zip
Add -H flag to psfed to increase height
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();
 
td>June McEnroe 2018-08-07Handle PART and QUIT without messagesJune McEnroe 2018-08-07Make safe filling the who bufferJune McEnroe 2018-08-07Add reverse and reset IRC formatting codesJune McEnroe 2018-08-06Rewrite line editing again, add formattingJune McEnroe 2018-08-06Fix allocation size in vaswprintfJune McEnroe This is so embarrassing. It only started crashing once it had strings that were long enough, and then it took me so long to notice this mistake. I was worried I was still doing va_list wrong somehow. 2018-08-06Implement word wrappingJune McEnroe 2018-08-06Use wchar_t strings for all of UIJune McEnroe vaswprintf is a nightmare. 2018-08-06Rename line editing functionsJune McEnroe 2018-08-05Initialize all possible color pairsJune McEnroe This is actually possible with use_default_colors! 2018-08-05Refactor color initializationJune McEnroe 2018-08-05Add ^L redrawJune McEnroe 2018-08-05Use 16 colors if availableJune McEnroe Fall back to using bold if there are only 8 colors. This also allowed bright background colors in 16-color terminals. I must port this system to torus. I'll be able to remove the awful termcap patch hack. 2018-08-05Limit parsed colors to number of mIRC colorsJune McEnroe Oh boy that's embarrassing. 2018-08-04Show source link on exitJune McEnroe 2018-08-04Implement line editing, scrollingJune McEnroe Don't really have a way to implement the M-* keys, and currently missing C-w. 2018-08-04Handle /topicJune McEnroe