summaryrefslogtreecommitdiff
path: root/firmware/ajf.h
blob: 70d94fb3e09cedd84ec278f71722f8fa0eb468b0 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
/***************************************************************************
 *             __________               __   ___.
 *   Open      \______   \ ____   ____ |  | _\_ |__   _______  ___
 *   Source     |       _//  _ \_/ ___\|  |/ /| __ \ /  _ \  \/  /
 *   Jukebox    |    |   (  <_> )  \___|    < | \_\ (  <_> > <  <
 *   Firmware   |____|_  /\____/ \___  >__|_ \|___  /\____/__/\_ \
 *                     \/            \/     \/    \/            \/
 * $Id$
 *
 * Copyright (C) 2002 by Alex Gitelman
 *
 * All files in this archive are subject to the GNU General Public License.
 * See the file COPYING in the source tree root for full license agreement.
 *
 * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
 * KIND, either express or implied.
 *
 ****************************************************************************/
#ifndef __AJF__
#define __AJF__

/* defined here because they are used by tools/bdf2ajz */
#define MAGIC1 0xBD
#define MAGIC2 0xFC
#define MAX_FONT_BUFLEN 4096

#define CODE_PAGE_OFFSET 2 /* 1 byte TODO: unused now */
#define FONT_NAME_OFFSET 3
#define FONT_NAME_LEN 32
#define MAX_WIDTH_OFFSET (FONT_NAME_OFFSET + FONT_NAME_LEN)  /* 2 byte */
#define HEIGHT_OFFSET (MAX_WIDTH_OFFSET + 2) /* 2 byte */
#define ASCENT_OFFSET (HEIGHT_OFFSET+2)      /* 2 byte ascent (baseline) height*/
#define FIRST_CHAR_OFFSET (HEIGHT_OFFSET+2)  /* 2 bytes first character of font*/
#define SIZE_OFFSET (FIRST_CHAR_OFFSET+2)    /* 2 bytes size of font (# encodings)*/
#define LOOKUP_MAP_OFFSET SIZE_OFFSET+2      /* Map to lookup char positions */


#define WRITE_SHORT(s,buf) { (buf)[0] = (s & 0xff00) >> 8 ; \
                             (buf)[1] = s & 0x00ff; }
#define READ_SHORT(buf) (((buf)[0]<<8) + (buf)[1])

unsigned char* ajf_read_font(char* fname);
unsigned char* ajf_get_charbuf(unsigned char c, unsigned char* font, 
                               int *width, int *height);
void ajf_get_charsize(unsigned char c, unsigned char* font,
                      int *width, int *height);
int ajf_get_fontheight(unsigned char* font);

extern char _font_error_msg[];


#endif