<!doctype linuxdoc system>

<!--
bitedit - a graphical file/bit editor
$Id: bitedit.sgml,v 1.3 2003/05/27 12:03:20 andrewm Exp $
-->


<article>

<!-- All about this document -->
<title>bitedit bit editor</title>
<author>Andrew McGill, <tt>andrew at ledge dot co.za</tt></author>
<!--<date>Document revision 0.1, 8 September 2001 </date>-->
<date>Document revision 0.2, 15 May 2003</date>
<abstract>
	bitedit is a simple ncurses program for editing a file.  It allows
	direct editing of the individual bits in a graphical fashion.  This is
	useful for directly editing existing bitmap font files, such as linux
	psf and psfu font files.
</abstract>
<!-- Table of contents -->
<toc>
<!--    -->

<sect>Introduction
<p>
	bitedit is a ncurses program for editing a file.  It allows direct
	editing of the individual bits in a graphical fashion.  This is useful
	for editing existing bitmap font files, such as linux psf and psfu font 
	files.
<p>
	bitedit is a rather simple program (at the moment) (and it will
	probably stay this way).  It does not attempt
	to interpret the data it is displaying, beyond showing the bits of the
	data file on the
	screen graphically.
<p>
<sect>Compiling
<p>
If <tt>make</tt> doesn't do it for you, and you are really excited about this program,
send your problem report to me, or, even better, a patch.
<p>
<sect>Invoking
<p>
To run the program, you need a file containing the data you want to edit.  Although the
program works perfectly well in an X terminal, the testing of your bitmap is not as
satisfying outside of the linux console environment:
<tscreen><verb>
cp /usr/lib/kbd/consolefonts/fonttoedit.psfu.gz .
gunzip fonttoedit.psfu.gz
./bitedit fonttoedit.psfu
setfont fonttoedit.psfu
</verb></tscreen>
The following command line options are supported:
<itemize>
<item><tt>-t 'command'</tt> - use the supplied command instead of `setfont' to
	test the changes to the file you are editing.
<item><tt>-m</tt> - mirror
<item><tt>-1</tt> - 1 byte display width (default)
<item><tt>-2</tt> - 2 byte display width (default)
<item><tt>-3</tt> - 3 byte display width (default)
<item><tt>-4</tt> - 4 byte display width (default)
</itemize>

<sect>Keys
<p>
The keys you use for editing and movement are similar to the <tt>vi</tt> keystrokes:
<p>
<sect1>Movement keys
<p>
These are the keys to move the cursor in the editing area and edit.
<itemize>
<item>h - move left
<item>j - move down
<item>k - move up
<item>l - move right
<item>PgUp, b - Move a page towards the top of the file
<item>PgDn, n, Ctrl+D - Move a page towards the end of the file
<item>0 - zero, followed by a number, repeats the next command that many times.
So, for example, if you type <tt>020j</tt>, you will move 20 lines down - like
in vi, but not quite as useful.  This is probably the only way to get to where
you want to be in a huge file.
</itemize>

<sect1>Display control
<p>
These are the keys to change the format of the display.
<itemize>
<item>&lt; - Scroll the viewing window left by 1 byte without changing the cursor position
<item>&gt; - Scroll the viewing window right by 1 byte without changing the cursor position
<item>1, 2, 3, 4 - set the width of the display (ie. one, two, three or four bytes on a line)
<item>Ctrl+L - Redraw the display (if corrupted by the output of a program)
<item>m - mirror each byte from left to right.  This is useful for some fonts.
</itemize>

<sect1>Editing keys
<p>
These are the keys that make changes to the data in memory.
<itemize>
<item>H - move left, changing current bit
<item>J - move down, changing current bit
<item>K - move up, changing current bit
<item>L - move right, changing current bit
<item>Space - flip current bit
<item>Enter - Set current bit
<item>Backspace - Clear current bit
</itemize>
There is (currently) no undo function.

<sect1>Saving and stuff
<p>
The keys to manage the file are:
<itemize>
<item>w - write file to disk.  You cannot change the name of the file -- it is
always the file name invoked from the command line.
<item>t - test bitmap ... this is hard-coded to run <tt>setfont</tt>
for the file you are editing.  The program which is run can be changed from 
the default using the <tt>-t</tt> command line switch.  An <tt>xsetfont.sh</tt>
file is included for showing the ascii characters in an xterm.
<item>q - try to quit <tt>:)</tt>, and print a message that SIGINT will do it.
</itemize>

</article>

