Re: Rasterizing text (simple html for example) to low resosultion grahics



Hello Dmitry,

Dmitry Ponyatov wrote:
Does anybody do rasterizing text to low resolution 320x240 (320x200) 1
bit per pixel graphics ? What resources should I see to understand how
to show text in form like Palm Weasel Reader using few-pixel-sized
raster fonts ?

You basically want create a terminal except there is no functionality
to output characters to screen. You have to create those
functionalities yourself! :).

A simple approach would be to "draw" the fonts with zero's and one's in
small buffers for all the characters you want to be able to display.

It is easier to do monofont since you don't need additional information
about the width of each character. If you use matrices of 8x8 pixels,
then "i" could look like this (this is easier in binary. Each line of
the 8x8 matrix nicely fits in a byte):

00111100
00111100
00111100
00000000
00111100
00111100
00111100
00111100

The next step is scanning the matrix and whenever a 1 is encountered,
you output a pixel on screen of the desired color. If you have 1 bit
per pixel then it is very easy though, your pixel is either on or off
so you can probably output each byte directly to your display without
having to scan anything. You have to make sure your virtual cursor
"jumps" to the correct location after every character is displayed so
that characters don't overlap.

You will probably need a line concept. A line copy and line clear will
also come in handy if you want to add scroll capabilities but don't
really care about keeping track of what "scrolls" out of sight. Clear
screen is also nice to have.

Just take a bunch of small steps, you'll get there ;-).

Regards
Jean-Francois Michaud

.



Relevant Pages

  • Tk canvas: why are some lines a pixel too short?
    ... My Tk application draws its own characters, ... to have one few pixel fewer lit up on the two right-hand ends compared ... the supposedly symmetrical pattern has a distinctly flat ...
    (comp.lang.tcl)
  • Re: Screen Size
    ... So I presume you mean that you used the conversion obtained from Point to Pixels to set up the size of your font in the LOGFONT structure that you used with CreateFontIndirect API and then just happened to draw that text to the screen DC using DrawText. ... If that is the case then you've probably used the pixel value directly when using CreateFontIndirect, ... When you use a negative value for the pixel size in the lfHeight entry in the LOGFONT structure then you are effectively asking Windows to select a font size such that the height of the "glyph" (the part of the character cell actually occupied by the shape of the characters) is the requested pixel height. ...
    (microsoft.public.vb.general.discussion)
  • Re: Setting the column width size to n number of characters
    ... size in pixel. ... number of characters. ... for some possible choices of font. ... Roedy Green Canadian Mind Products ...
    (comp.lang.java.gui)
  • Re: mapping a pixel to a character
    ... > I would like to map each pixel to a character. ... > I have 64 characters arranged in order based on ... you have an index into a character array -- i.e. put the grey level ...
    (comp.programming)
  • Re: Algorithm for "Windows Center" and "Windows Width"
    ... y represents the output display level. ... For 16 bit pixel values, you have a potential range of 65536 values but you have only a display range of 256 values, so some manipulation must be done. ... As an extra challenge for you, I think you will find that performing this calculation for every pixel everytime the user changes the window settings will make your application run very slowly. ... identity (no rescale values or Modality LUT, ...
    (comp.protocols.dicom)

Loading