Página 1 de 1

FZX: a new standard format and driver for proportional fonts

Publicado: Mié Jun 12, 2013 9:54 am
por cheveron
FZX is a very compact and efficient (although extremely flexible and powerful) standard format to create new fonts for the ZX-Spectrum. It supports proportional fonts, you can print characters anywhere on screen, and it's very easy to use in Sinclair BASIC, or called directly from Assembly routines.

The official FZX font format definition (including several sample fonts) is now available in FZX_Standard.zip (http://www.mediafire.com/?8uuhvsnpgb51owb), a tape file containing some practical examples is available in FZX.tap.zip (http://www.mediafire.com/?mdv5v7grxohsr33), and the source code for the proportional printing driver is available in FZX_Driver.zip (http://www.mediafire.com/?771dvvm797h7srr).

However let's skip all the tech details and go straight to the interesting stuff! Every character in a regular ZX-Spectrum font is designed using a 8x8 grid like this:

Imagen

But using FZX, each character definition is fully configurable and uses an arbitrary sized grid, like this:

Imagen

In the example above, the character pixels are defined in a smaller 5x5 grid, and everything else is configurable. This particular FZX font specifies that all characters are 9 pixels tall ("baseline"), character "a" is located at a distance of 2 pixels from the top ("leading"), character "a" is 5 pixels wide ("width"), and there should be 2 pixels of distance before the next character ("tracking").

All these configurations make it possible to define proportional fonts that are fully flexible and configurable, but still very compact, using about the same amount of memory as a regular font.

Now let's consider a practical example. This is the original Sinclair font:

Imagen

And here's the same text, using the same font style, but now converted to take advantage of FZX format using proportional spacing:

Imagen

Although it's the same font style and size, the latter version is more comfortable to read and doesn't take so much room on screen, so it's certainly an improvement!

Another nice feature of FZX format is that it supports quite large fonts, with characters up to 16 pixels wide. Here's another example, this time using a much larger font called "Grotesk" (also supplied in the link above):

Imagen

So how do you use FZX fonts in practice? It's actually very simple. First, load the driver from tape (together with any FZX font of your choice) and initialize it only once, like this:

Código: Seleccionar todo

CLEAR 59999: LOAD "Sinclair"CODE 60000: LOAD "FZXdriver"CODE 65000: RANDOMIZE USR 65000


Afterwards, simply use PRINT #4 to print your text, for instance:

Código: Seleccionar todo

PRINT #4;AT 0,0;"FZX driver code (c) Einar Saukas"'"FZX font format (c) Andrew Owen"
PRINT #4: FOR f=32 TO 127: PRINT #4;CHR$ f;: NEXT f


Using font "Zaibatsu" for instance (also supplied in this package), the program above will produce the following result:

Imagen

That's easy, right? :)

As indicated in the screen above, Einar Saukas and I have worked together to create FZX. I concentrated on defining the standard and designing the sample fonts supplied in this package, while he focused on coding it. Anyway everything presented here is open source and royalty-free, so you are welcome to use any of this material in your own programs (even commercial releases) and to create new FZX fonts yourself!

Re: FZX: a new standard format and driver for proportional f

Publicado: Mié Jun 12, 2013 11:54 am
por na_th_an
Awesome.

I envision text and graphic adventures looking better than ever, for example.

Re: FZX: a new standard format and driver for proportional f

Publicado: Vie Jun 21, 2013 1:07 am
por cheveron
Just a small update to let you know that editors should soon be available for Windows, Mac, and Linux. I'll post details when I have them as I'm not involved in any of these projects.

Re: FZX: a new standard format and driver for proportional f

Publicado: Vie Jun 21, 2013 9:27 am
por cheveron

Re: FZX: a new standard format and driver for proportional f

Publicado: Jue Jun 27, 2013 10:02 am
por cheveron

Re: FZX: a new standard format and driver for proportional f

Publicado: Vie Oct 13, 2017 11:22 am
por AncientBits
Hola, estoy programando un juego en BASIC puro con mucho texto y haciendo búsquedas sobre cambiar el estilo de fuente del ZX Spectrum encontré este maravilloso hilo sobre el FZX Driver.

He intentado cargar el driver usando BASin 0.13, pero me da un error. Pongo FZXdriver.asm y Sinclair.fzx en la misma carpeta de BASin, ejecuto el código...

CLEAR 59999: LOAD "Sinclair"CODE 60000: LOAD "FZXdriver"CODE 65000: RANDOMIZE USR 65000

... pero BASin me dice "A file was found on disk, but could not be loaded by some reason". ¿No puedo cargar .asm con BASin? ¿Cómo podría cargarlo entonces?

Gracias!



***********************************************************




Hi! I'm programming a ZX48K plenty of text game in pure BASIC and searching in Google about change the default ZX Spectrum fonts I found this marvelous thread about FZX Driver.

I tried load the driver using BASin 0.13 but it fails. I put FZXdriver.asm and Sinclair.fzx files in the same folder where BASIN.exe is, then I type this...

CLEAR 59999: LOAD "Sinclair"CODE 60000: LOAD "FZXdriver"CODE 65000: RANDOMIZE USR 65000

... pero BASin says "A file was found on disk, but could not be loaded by some reason". Is not possible load .asm files with BASin? If not... how coudl I load the driver?

Thank you!

Re: FZX: a new standard format and driver for proportional f

Publicado: Vie Feb 01, 2019 5:42 pm
por farvardin
hello, I'm not using Basin, but pasmo and zmakebas (on linux, but you can probably adapt it to other OS), here is what I did to make it work:

Código: Seleccionar todo

zmakebas -a 1 -o loader.tap loader.bas
pasmo --tap --name Sinclair font.asm  Font.TAP 
pasmo --tap --name FZXdriver FZXdriver.asm  FZXdriver.TAP 
cat loader.tap  FZXdriver.TAP Font.TAP  > samplefzx.tap
where font.asm is:

Código: Seleccionar todo

org 60000
incbin "Sinclair.fzx"

and loader.bas is this basic code:

Código: Seleccionar todo

02 CLEAR 59999: LOAD "Sinclair"CODE 60000: LOAD "FZXdriver"CODE 65000: RANDOMIZE USR 65000

03 PRINT #4;AT 0,0;"FZX driver code (c) Einar Saukas"'"FZX font format (c) Andrew Owen"
04 PRINT #4: FOR f=32 TO 127: PRINT #4;CHR$ f;: NEXT f

05 REM CLS
10 PRINT #4; "Hello World ";
hope this can help for future reference.

Re: FZX: a new standard format and driver for proportional f

Publicado: Lun Feb 18, 2019 11:20 pm
por AncientBits
farvardin escribió:hello, I'm not using Basin, but pasmo and zmakebas (on linux, but you can probably adapt it to other OS), here is what I did to make it work:

Código: Seleccionar todo

zmakebas -a 1 -o loader.tap loader.bas
pasmo --tap --name Sinclair font.asm  Font.TAP 
pasmo --tap --name FZXdriver FZXdriver.asm  FZXdriver.TAP 
cat loader.tap  FZXdriver.TAP Font.TAP  > samplefzx.tap
where font.asm is:

Código: Seleccionar todo

org 60000
incbin "Sinclair.fzx"

and loader.bas is this basic code:

Código: Seleccionar todo

02 CLEAR 59999: LOAD "Sinclair"CODE 60000: LOAD "FZXdriver"CODE 65000: RANDOMIZE USR 65000

03 PRINT #4;AT 0,0;"FZX driver code (c) Einar Saukas"'"FZX font format (c) Andrew Owen"
04 PRINT #4: FOR f=32 TO 127: PRINT #4;CHR$ f;: NEXT f

05 REM CLS
10 PRINT #4; "Hello World ";
hope this can help for future reference.


Thank you! I'll try your tips for another future game!