From 31ec757f0b59706daff4ce894795643c4049a48c Mon Sep 17 00:00:00 2001 From: June McEnroe Date: Thu, 27 Sep 2018 13:16:22 -0400 Subject: Add HJKL for moving glyphs to psfed --- bin/man/psfed.1 | 10 ++++++++-- bin/psfed.c | 56 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 64 insertions(+), 2 deletions(-) (limited to 'bin') diff --git a/bin/man/psfed.1 b/bin/man/psfed.1 index 88430551..bd15d897 100644 --- a/bin/man/psfed.1 +++ b/bin/man/psfed.1 @@ -62,10 +62,10 @@ Select previous/next glyph. Select glyph in previous/next row. . .It Ic y -Copy the selected glyph. +Copy selected glyph. . .It Ic e -Edit the selected glyph in +Edit selected glyph in .Sx Edit Mode . . .It Ic i @@ -101,6 +101,12 @@ Flip selected bit. .It Ic r Invert glyph. . +.It Ic H Ic L +Move glyph left/right. +. +.It Ic K Ic J +Move glyph up/down. +. .It Ic p Paste the copied glyph. . diff --git a/bin/psfed.c b/bin/psfed.c index cb0a1475..4fbfb402 100644 --- a/bin/psfed.c +++ b/bin/psfed.c @@ -188,6 +188,10 @@ static uint8_t bitGet(uint32_t index, uint32_t x, uint32_t y) { static void bitFlip(uint32_t index, uint32_t x, uint32_t y) { *bitByte(index, x, y) ^= 1 << (7 - x % 8); } +static void bitSet(uint32_t index, uint32_t x, uint32_t y, uint8_t bit) { + *bitByte(index, x, y) &= ~(1 << (7 - x % 8)); + *bitByte(index, x, y) |= bit << (7 - x % 8); +} static void drawGlyph( uint32_t destX, uint32_t destY, uint32_t scale, @@ -344,6 +348,7 @@ static void inputEdit(char ch) { break; case 'k': if (edit.y) edit.y--; break; case 'j': if (edit.y + 1 < header.glyph.height) edit.y++; break; case ' ': bitFlip(edit.index, edit.x, edit.y); + break; case 'r': { for (uint32_t y = 0; y < header.glyph.height; ++y) { for (uint32_t x = 0; x < header.glyph.width; ++x) { @@ -351,6 +356,57 @@ static void inputEdit(char ch) { } } } + + break; case 'H': { + for (uint32_t x = 0; x < header.glyph.width; ++x) { + for (uint32_t y = 0; y < header.glyph.height; ++y) { + if (x + 1 < header.glyph.width) { + bitSet(edit.index, x, y, bitGet(edit.index, x + 1, y)); + } else { + bitSet(edit.index, x, y, 0); + } + } + } + } + + break; case 'L': { + uint32_t width = header.glyph.width; + for (uint32_t x = width - 1; x < width; --x) { + for (uint32_t y = 0; y < header.glyph.height; ++y) { + if (x - 1 < width) { + bitSet(edit.index, x, y, bitGet(edit.index, x - 1, y)); + } else { + bitSet(edit.index, x, y, 0); + } + } + } + } + + break; case 'K': { + for (uint32_t y = 0; y < header.glyph.height; ++y) { + for (uint32_t x = 0; x < header.glyph.width; ++x) { + if (y + 1 < header.glyph.height) { + bitSet(edit.index, x, y, bitGet(edit.index, x, y + 1)); + } else { + bitSet(edit.index, x, y, 0); + } + } + } + } + + break; case 'J': { + uint32_t height = header.glyph.height; + for (uint32_t y = height - 1; y < height; --y) { + for (uint32_t x = 0; x < header.glyph.width; ++x) { + if (y - 1 < height) { + bitSet(edit.index, x, y, bitGet(edit.index, x, y - 1)); + } else { + bitSet(edit.index, x, y, 0); + } + } + } + } + break; case 'p': { memcpy(glyph(edit.index), edit.copy, header.glyph.size); } -- cgit 1.4.1 3726bd375f391bc513119bbe1571974336&follow=1'>Collapse)Author 2021-03-08Update imbox to 1.4June McEnroe 2021-02-09Update catgirl to 1.6June McEnroe 2021-02-08Update catsit to 1.2June McEnroe 2021-02-08Update pounce to 2.3June McEnroe 2021-02-04Update cgit-causal-agency to 8e4c63cJune McEnroe 2021-01-20Update cgit-causal-agency to 8a10aa5June McEnroe 2021-01-17Update cgit-causal-agencyJune McEnroe 2021-01-17Update scooper to 1.1June McEnroe 2021-01-17Update catgirl to 1.5 (BONUS WEBISODE)June McEnroe 2021-01-15Update litterbox to 1.7June McEnroe 2021-01-15Update pounce to 2.2June McEnroe 2021-01-15Update catgirl to 1.4June McEnroe 2020-12-28Replace cgit-patched with cgit-causal-agencyJune McEnroe 2020-12-18Add notemap portJune McEnroe 2020-12-15Update libretls to 3.3.1June McEnroe 2020-12-15Update catsit to 1.1June McEnroe 2020-12-15Update pounce to 2.1p1June McEnroe 2020-12-15Add imbox portJune McEnroe 2020-11-24Update pounce to 2.1June McEnroe 2020-11-24Update libretls to 3.3.0June McEnroe 2020-11-17Update catgirl to 1.3June McEnroe 2020-11-17Update libretls to 3.2.2June McEnroe 2020-09-29Update libretls to 3.2.1June McEnroe 2020-09-10Update catgirl to 1.2June McEnroe 2020-09-09Add pounce-palaver portJune McEnroe 2020-09-09Update pounce to 2.0June McEnroe 2020-09-09Update litterbox to 1.6June McEnroe 2020-08-23Add scooper portJune McEnroe 2020-08-23Add catsit portJune McEnroe 2020-08-13Update pounce to 1.4p2June McEnroe 2020-08-11Update pounce to 1.4p1June McEnroe 2020-08-10Add litterbox portJune McEnroe 2020-08-10Add missing USES=pkgconfig to pounceJune McEnroe