1/* Copyright (c) 2013 The Chromium OS Authors. All rights reserved.
2 * Use of this source code is governed by a BSD-style license that can be
3 * found in the LICENSE file.
4 *
5 * This describes the internal format used to pack a set of character glpyhs so
6 * we can render strings by drawing one character at a time.
7 *
8 * The format is this:
9 *
10 *   +-------------------------+
11 *   | FontArrayHeader         |
12 *   +-------------------------+
13 *   | FontArrayEntryHeader[0] |
14 *   +-------------------------+
15 *   | raw image data[0]       |
16 *   +-------------------------+
17 *   | FontArrayEntryHeader[1] |
18 *   +-------------------------+
19 *   | raw image data[1]       |
20 *   +-------------------------+
21 *   | FontArrayEntryHeader[2] |
22 *   +-------------------------+
23 *   | raw image data[2]       |
24 *   +-------------------------+
25 *      ...
26 *   +-------------------------+
27 *   | FontArrayEntryHeader[n] |
28 *   +-------------------------+
29 *   | raw image data[n]       |
30 *   +-------------------------+
31 *
32 * The FontArrayHeader describes how many characters will be encoded.
33 * Each character encoding consists of a FontArrayEntryHeader followed
34 * immediately by the raw image data for that character.
35 */
36
37#ifndef VBOOT_REFERENCE_BMPBLK_FONT_H_
38#define VBOOT_REFERENCE_BMPBLK_FONT_H_
39
40#include "bmpblk_header.h"
41
42#define FONT_SIGNATURE      "FONT"
43#define FONT_SIGNATURE_SIZE 4
44
45typedef struct FontArrayHeader {
46	uint8_t  signature[FONT_SIGNATURE_SIZE];
47	uint32_t num_entries;  /* Number of chars encoded here. */
48} __attribute__((packed)) FontArrayHeader;
49
50typedef struct FontArrayEntryHeader {
51	uint32_t ascii;  /* What to show. Could even be UTF? */
52	ImageInfo info;  /* Describes the bitmap. */
53
54	/*
55	 * The image to use follows immediately, NOT compressed. It's
56	 * uncompressed because each glyph is only a few hundred bytes, but
57	 * they have much in common (colormaps, for example). When we add the
58	 * whole font blob to the bmpblk, it will be compressed as a single
59	 * item there.
60	 */
61} __attribute__((packed)) FontArrayEntryHeader;
62
63#endif  /* VBOOT_REFERENCE_BMPBLK_FONT_H_ */
64