From 2287c43eef06304be656a70184f9fd42d9645014 Mon Sep 17 00:00:00 2001 From: Curtis McEnroe Date: Wed, 3 Oct 2018 16:34:09 -0400 Subject: Add -H flag to psfed to increase height --- bin/man/psfed.1 | 5 +++++ bin/psfed.c | 22 +++++++++++++++++++++- 2 files changed, 26 insertions(+), 1 deletion(-) 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(); -- cgit 1.4.1 rc/log/bin?id=76f4d8afb7a394c4a36b04e0b04921e1ed961c18&showmsg=1&follow=1'>bin/cash/bltin.h (unfollow)
Commit message (Collapse)Author
2019-02-09Fix IRC output monospace option to emit once per lineJune McEnroe
2019-02-09Add output format options to hiJune McEnroe
The monospace option for IRC output doesn't really work, since IRCCloud puts a box around each span this way.
2019-02-09Avoid using SGRReset and IRCResetJune McEnroe
2019-02-08Use X macros for hi classesJune McEnroe
2019-02-08Don't open folds when using {}June McEnroe
2019-02-08Add sh syntax to hiJune McEnroe
2019-02-08Use [] to quote special characters in regexJune McEnroe
This looks much cleaner than having to double-escape backslash.
2019-02-08Improve ANSI output and base IRC on itJune McEnroe
2019-02-08Add hi -nJune McEnroe
2019-02-08Elaborate hi man pageJune McEnroe
2019-02-08Use set for parent in hiJune McEnroe
2019-02-08Switch back to semantic keyword grouping in hiJune McEnroe
2019-02-08Match only the basename in hiJune McEnroe
2019-02-07Add mdoc syntax to hiJune McEnroe
2019-02-07Support multi-line C macros in hiJune McEnroe
2019-02-07Detect .mk files as makeJune McEnroe
2019-02-07Add make syntax to hiJune McEnroe
2019-02-07Add IRC output to hiJune McEnroe
2019-02-07Improve C syntax accuracy and add Format classJune McEnroe
2019-02-07Factor out hi checkJune McEnroe
Fix subexpression bounds check and compile pattends.
2019-02-07Add Escape class to hiJune McEnroe
2019-02-07Add Todo class and parent syntax constraintJune McEnroe