1
0
mirror of https://github.com/cc65/cc65.git synced 2024-12-25 17:29:50 +00:00

Small change in the vector font format.

git-svn-id: svn://svn.cc65.org/cc65/trunk@5088 b7a2c559-68d2-44c3-8de9-860c34a00d81
This commit is contained in:
uz 2011-07-17 17:15:54 +00:00
parent e33bd9a44c
commit 928f675e4b
3 changed files with 20 additions and 13 deletions

View File

@ -54,8 +54,8 @@ TGI_VF_CCOUNT = (TGI_VF_LASTCHAR - TGI_VF_FIRSTCHAR + 1)
; Font data loaded directly from file
.struct TGI_VECTORFONT
TOP .byte ; Height of char
BASELINE .byte ; Character baseline
BOTTOM .byte ; Descender
BOTTOM .byte ; Descender
HEIGHT .byte ; Maximum char height
WIDTHS .byte ::TGI_VF_CCOUNT ; Char widths
CHARS .word ::TGI_VF_CCOUNT ; Pointer to character defs
OPS .byte ; Actually dynamic

View File

@ -2,7 +2,7 @@
; Ullrich von Bassewitz, 2009-10-30
;
.include "tgi-kernel.inc"
.include "tgi-vectorfont.inc"
.include "zeropage.inc"
@ -36,11 +36,8 @@
stx ptr1
lda _tgi_vectorfont+1
sta ptr1+1
ldy #TGI_VECTORFONT::TOP
lda (ptr1),y
ldy #TGI_VECTORFONT::BOTTOM
clc
adc (ptr1),y ; Total font height is top + bottom
ldy #TGI_VECTORFONT::HEIGHT
lda (ptr1),y ; Get height of font
sta ptr1
lda #0

View File

@ -129,15 +129,20 @@
* .byte $54, $43, $48, $00 ; "TCH" version
* .word <size of data portion>
* Data portion:
* .byte <top> ; Value from $88
* .byte <baseline> ; Value from $89
* .byte <bottom> ; Negative value from $8A
* .byte <top> ; Baseline to top
* .byte <bottom> ; Baseline to bottom
* .byte <height> ; Maximum char height
* .byte <width>, ... ; $5F width bytes
* .word <char definition offset>, ... ; $5F char def offsets
* Character definitions:
* .word <converted opcode>, ...
* .byte $80
*
* The baseline of the character is assume to be at position zero. top and
* bottom are both positive values. The former extends in positive, the other
* in negative direction of the baseline. height contains the sum of top and
* bottom and is stored here just for easier handling.
*
* The opcodes get converted for easier handling: END is marked by bit 7
* set in the first byte. The second byte of this opcode is not needed.
* Bit 7 of the second byte marks a MOVE (bit 7 = 0) or DRAW (bit 7 = 1).
@ -411,8 +416,13 @@ static void ConvertFile (const char* Input, const char* Output)
TchHeader[4] = Offs & 0xFF;
TchHeader[5] = (Offs >> 8) & 0xFF;
TchHeader[6] = Buf[0x88];
TchHeader[7] = Buf[0x89];
TchHeader[8] = (unsigned char) -(signed char)(Buf[0x8A]);
TchHeader[7] = (unsigned char) -(signed char)(Buf[0x8A]);
TchHeader[8] = TchHeader[6] + TchHeader[7];
/* The baseline must be zero, otherwise we cannot convert */
if (Buf[0x89] != 0) {
Error ("Baseline of font in `%s' is not zero", Input);
}
/* If the output file is NULL, use the name of the input file with ".tch"
* appended.