ZX-Spectrum - Proportional font.

----------------------------------------------------------------
(C) gRAVER_ZX, 2007
----------------------------------------------------------------

Beginning


Proportional font


What will I write about here?

We'll talk about the ideas that I used
to implement a proportional font
(psh) in their menus.
Also a few words about ideas that
unimplemented.


PSh

So, for psh we use the standard
a set of characters with a length of 2048. But there is
a small modification in its format - for
alphabetic characters (usually) in the first
byte is set to its width in pixels. Then
there is a maximum height of such a symbol 7
pixels.  Since the width of the character according to its
nature is no more than 8, then if the first byte
character > 8, it is considered that the character width
6, and its height is 8 - this is done so that
use pseudographics.
You can, of course, do it differently.
Create a 256 byte table that would
stored the length of each character. But I'm not like that
did. Maybe someone will try.
Actually pieces of code from psh sources
won’t be here, because I think it’s better
do it yourself. And then compare.
Well, then starting from the format
storage psh, code is written for it
processing.  In hisimplementations I use
second screen (32768).  First I draw on
it, and then I display it on the main one (16384).
Having an engine for printing psh on the screen,
easy to add additional ones
functions - writing kypcubou characters,
bold letter and double height. And also
various combinations of them.
About the gap.   So far there is a gap
fixed length, which is a little strange
for the idea psh. In general, the length of the space should be
vary from minimum to 255. But
This also comes down to the format of storing texts.
For example, then the space will be narrower
double-byte - <32>, .  Need a common storage format
text.  And at least if not the editor, then
text formatter.


Text module. Thoughts.

Let there be a program that has
area of interactive variables - area
memory with which the user
controls the program, and is itself executable
program code.
For the program you need to set in the area
interactive variables width, height
screen area where it will be displayed
text. Set font address, text address in
memory.
There can be one text module, and
You can operate with several texts.
Before calling the module, when it is already
initialized, values are set for
other cells in the interactive area
changes.They may indicate
various events, for example: user
pressed the "scroll down" button. During
calling the module scans its area
interactive variables, reacting to
events that happened.  In general generation
events for the text module falls on
coder who uses it in his
program.   The module can respond to
event change to appropriate
cells in the interactive area, reporting
for example, that the end of the text has been reached.

Therefore, without going into details
internal work of the module (it is important for us in general
its outer side) use this
text module in different
programs. If you need to save memory, you can
create many modifications of it,
meeting specific needs. Each
the modification will have a similar structure,
having specific functions.

End.

Share your thoughts about the article