1 | /*
|
---|
2 | * Copyright (c) 2022 Jiri Svoboda
|
---|
3 | * All rights reserved.
|
---|
4 | *
|
---|
5 | * Redistribution and use in source and binary forms, with or without
|
---|
6 | * modification, are permitted provided that the following conditions
|
---|
7 | * are met:
|
---|
8 | *
|
---|
9 | * - Redistributions of source code must retain the above copyright
|
---|
10 | * notice, this list of conditions and the following disclaimer.
|
---|
11 | * - Redistributions in binary form must reproduce the above copyright
|
---|
12 | * notice, this list of conditions and the following disclaimer in the
|
---|
13 | * documentation and/or other materials provided with the distribution.
|
---|
14 | * - The name of the author may not be used to endorse or promote products
|
---|
15 | * derived from this software without specific prior written permission.
|
---|
16 | *
|
---|
17 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
|
---|
18 | * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
|
---|
19 | * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
|
---|
20 | * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
|
---|
21 | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
|
---|
22 | * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
---|
23 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
---|
24 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
---|
25 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
---|
26 | * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
---|
27 | */
|
---|
28 |
|
---|
29 | /** @addtogroup libgfxfont
|
---|
30 | * @{
|
---|
31 | */
|
---|
32 | /**
|
---|
33 | * @file TPF file definitions
|
---|
34 | *
|
---|
35 | */
|
---|
36 |
|
---|
37 | #ifndef _GFX_PRIVATE_TPF_FILE_H
|
---|
38 | #define _GFX_PRIVATE_TPF_FILE_H
|
---|
39 |
|
---|
40 | #include <stdint.h>
|
---|
41 |
|
---|
42 | enum {
|
---|
43 | /** Typeface RIFF format ID */
|
---|
44 | FORM_TPFC = 0x43465054,
|
---|
45 |
|
---|
46 | /** Font list type */
|
---|
47 | LTYPE_font = 0x746e6f66,
|
---|
48 |
|
---|
49 | /** Font properties chunk ID */
|
---|
50 | CKID_fprp = 0x70727066,
|
---|
51 | /** Font metrics chunk ID */
|
---|
52 | CKID_fmtr = 0x72746d66,
|
---|
53 | /** Font bitmap chunk ID */
|
---|
54 | CKID_fbmp = 0x706d6266,
|
---|
55 |
|
---|
56 | /** Glyph list type */
|
---|
57 | LTYPE_glph = 0x68706c67,
|
---|
58 |
|
---|
59 | /** Glyph metrics chunk ID */
|
---|
60 | CKID_gmtr = 0x72746d67,
|
---|
61 | /** Glyph patterns chunk ID */
|
---|
62 | CKID_gpat = 0x74617067,
|
---|
63 | /** Glyph rectangle/origin chunk ID */
|
---|
64 | CKID_gror = 0x726f7267
|
---|
65 | };
|
---|
66 |
|
---|
67 | /** TPF font properties */
|
---|
68 | typedef struct {
|
---|
69 | uint16_t size;
|
---|
70 | uint16_t flags;
|
---|
71 | } tpf_font_props_t;
|
---|
72 |
|
---|
73 | /** TPF font metrics */
|
---|
74 | typedef struct {
|
---|
75 | uint16_t ascent;
|
---|
76 | uint16_t descent;
|
---|
77 | uint16_t leading;
|
---|
78 | int16_t underline_y0;
|
---|
79 | int16_t underline_y1;
|
---|
80 | } tpf_font_metrics_t;
|
---|
81 |
|
---|
82 | /** TPF glyph metrics */
|
---|
83 | typedef struct {
|
---|
84 | uint16_t advance;
|
---|
85 | } tpf_glyph_metrics_t;
|
---|
86 |
|
---|
87 | /** TPF glyph rectangle/origin */
|
---|
88 | typedef struct {
|
---|
89 | /** Rectangle p0.x */
|
---|
90 | uint32_t p0x;
|
---|
91 | /** Rectangle p0.y */
|
---|
92 | uint32_t p0y;
|
---|
93 | /** Rectangle p1.x */
|
---|
94 | uint32_t p1x;
|
---|
95 | /** Rectangle p1.y */
|
---|
96 | uint32_t p1y;
|
---|
97 | /** Origin X */
|
---|
98 | uint32_t orig_x;
|
---|
99 | /** Origin Y */
|
---|
100 | uint32_t orig_y;
|
---|
101 | } tpf_glyph_ror_t;
|
---|
102 |
|
---|
103 | /** TPF font bitmap header */
|
---|
104 | typedef struct {
|
---|
105 | /** Width in pixels */
|
---|
106 | uint32_t width;
|
---|
107 | /** Height in pixels */
|
---|
108 | uint32_t height;
|
---|
109 | /** Format (0) */
|
---|
110 | uint16_t fmt;
|
---|
111 | /** Depth (bits/pixel) */
|
---|
112 | uint16_t depth;
|
---|
113 | } tpf_font_bmp_hdr_t;
|
---|
114 |
|
---|
115 | #endif
|
---|
116 |
|
---|
117 | /** @}
|
---|
118 | */
|
---|