Hi Jim,

> On May 27, 2024, at 11:41 AM, Jim Hall via Freedos-devel 
> <freedos-devel@lists.sourceforge.net> wrote:
> 
> I created a FreeDOS program that simulates printing on a 9-pin impact
> ("dot matrix") printer.
> 
> I made this for a few reasons: 1. I am writing an article about dot
> matrix printing, and didn't have a good way to demonstrate it; and 2.
> It was something fun to do in an afternoon.
> 
> A few notes:
> 
> - This is a simplified version of a dot matrix printer. Characters are
> 5x8. The 9th "pin" is reserved for underline only. Although printer
> control codes aren't implemented yet, so underline doesn't work
> anyway.
> 
> - I didn't create a character set as "firmware" for the virtual
> printer. So currently, printable characters are rendered as the bit
> pattern for the character's ascii code (except 32, which is rendered
> as a space).

This gives you the perfect opportunity to demonstrate another program included 
with FreeDOS. 

You could use ImgEdit (under the Apps program group). While creating "the 
Danger Engine” 2D DOS gaming engine, I needed graphics and fonts. So, I built 
ImgEdit and DE at the same time. Because ImgEdit runs onto of DE, it was a 
"chicken or egg” development. 

ImgEdit is not perfect. There is a lot of stuff that ImgEdit does that was 
improved and moved into the actual DE at later points. Plus, there are at least 
2 bugs I should get around to fixing someday. But overall, it works fairly 
well. Especially for this kind of thing. 

You can easily create a “new” font. The minimum size is 8x8. Doing a 5x8 font, 
you would just want to discard the extra bits in your program. 

You can only change sizes from the command line. So, you would run “imgedit 
myfont.fnt /size 8:8” 

ImgEdit will see there is no font file called “myfont.fnt” (or whatever 
filename you used) and create a new 8x8 font based on it’s own 8x8 font. 

You can then simply iterate through the characters, rotate them and save the 
font file. (note: since height and width are the same, rotate is available)

You can do this by using the mouse. Which I advise having the driver loaded, so 
you can navigate menus without having to remember the hotkeys. Also, the mouse 
will be needed if you want to make any pixel level changes to the font.

However, iterating and rotating will be much quicker to simply use the 
keyboard. 

Click on the first character (or use the arrow keys to get there). 
Press LEFT_ALT+T (rotate counter clockwise) or RIGHT_ALT+T (rotate clockwise)
If you need to adjust the position use LEFT_SHIFT+ARROW_KEY (move and fill with 
clear bit. right shift + arrow fills with set bit)
Use RIGHT_ARROW to move to the next character.
repeat until all characters were rotated
press ALT+S or click save in the menu.

Some notes: 

The file name is displayed in the lower right. If there have been changes made, 
it is in RED. If no changes since the last save, it is Gray. 
Left mouse click to set a pixel, right click to erase a pixel.
You can click and drag draw or erase.
The White and Gray carrots above the character indicate the farthest pixels in 
that character when it was selected. They do not change unless you select a 
different character. 
The Green and Red carrots below the character indicate the farthest pixels in 
the entire font. This is not much use in an 8x8 font or event x 9x16 font. But, 
ImgEdit supports bitmap fonts up to 32x32 at present. Actually the menu bar 
text is a proportionally spaced 16 bit wide font. All the lower case letter are 
less than 8 bits. Many of the uppercase letters are 10-bits wide. 
8-bit wide fonts are always saved and loaded the common format used by DOS 
bitmap raster font files. They can be loaded using programs like vfont, gnuchcp 
and other DOS programs. Fonts over 8-bits wide use a different file format by 
necessity. 

Down a rabbit hole… Technically from a programming standpoint, ImgEdit is not 
really an application with a graphical user interface. It’s a game. All the UI 
elements like buttons and menus are simulated by the Danger Engine using game 
elements like sprites. It’s abstracted a lot and the game engine presents it to 
the program like UI elements (buttons, menu items, etc). But, going a couple 
layers into the abstraction it is nothing like that at all. Depending on memory 
requirements, the engine is locking, releasing, loading and discarding all that 
stuff from images to font files behind the scenes through it’s game element 
asset management routines. 

:-)

Jerome


> I've shared it on my GitHub, with screenshots of the output:
> https://github.com/freedosproject/vp
> 
> 
> Compile with OpenWatcom. Uses the MIT license.
> 
> 
> Jim
> 
> 
> 
> *I grabbed the "freedosproject" username some time ago so no one else
> could take it and use it for something else. I use this account to
> share source code for programming projects that I do on the YouTube
> channel. The FreeDOS source archive is at GitLab:
> https://gitlab.com/FreeDOS (there's also a link from my GitHub
> profile)
> 
> 
> _______________________________________________
> Freedos-devel mailing list
> Freedos-devel@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/freedos-devel

_______________________________________________
Freedos-devel mailing list
Freedos-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/freedos-devel

Reply via email to