Rename unzip tool.
[SquirrelJME.git] / nanocoat / include / lib / scritchui / scritchuiPencilFontSqf.h
blob752ffd7f874f6287d4a28d264e104fe0d60866d6
1 /* -*- Mode: C; indent-tabs-mode: t; tab-width: 4 -*-
2 // ---------------------------------------------------------------------------
3 // SquirrelJME
4 // Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
5 // ---------------------------------------------------------------------------
6 // SquirrelJME is under the Mozilla Public License Version 2.0.
7 // See license.mkd for licensing and copyright information.
8 // -------------------------------------------------------------------------*/
10 /**
11 * SQF Font Structure.
13 * @since 2024/06/10
16 #ifndef SQUIRRELJME_SCRITCHUIPENCILFONTSQF_H
17 #define SQUIRRELJME_SCRITCHUIPENCILFONTSQF_H
19 #include "sjme/nvm.h"
20 #include "sjme/alloc.h"
21 #include "lib/scritchui/scritchuiPencilFont.h"
23 /* Anti-C++. */
24 #ifdef __cplusplus
25 #ifndef SJME_CXX_IS_EXTERNED
26 #define SJME_CXX_IS_EXTERNED
27 #define SJME_CXX_SQUIRRELJME_SCRITCHUIPENCILFONTSQF_H
28 extern "C" {
29 #endif /* #ifdef SJME_CXX_IS_EXTERNED */
30 #endif /* #ifdef __cplusplus */
32 /*--------------------------------------------------------------------------*/
34 /**
35 * Flags for a specific character.
37 * @since 2024/06/04
39 typedef enum sjme_scritchui_sqfFlag
41 /** Character is valid. */
42 SJME_SCRITCHUI_SQF_FLAG_VALID = 1,
44 /** Compressed with RaFoCES w/ huffman table. */
45 SJME_SCRITCHUI_SQF_FLAG_RAFOCES = 2,
46 } sjme_scritchui_sqfFlag;
48 /**
49 * Represents the SQF family.
51 * @since 2024/06/14
53 typedef enum sjme_scritchui_sqfFamily
55 /** Regular font. */
56 SJME_SCRITCHUI_SQF_FAMILY_REGULAR,
58 /** Monospace. */
59 SJME_SCRITCHUI_SQF_FAMILY_MONOSPACE,
61 /** Sans Serif. */
62 SJME_SCRITCHUI_SQF_FAMILY_SANS_SERIF,
64 /** Serif. */
65 SJME_SCRITCHUI_SQF_FAMILY_SERIF,
67 /** The number of families. */
68 SJME_SCRITCHUI_NUM_SQF_FAMILY
69 } sjme_scritchui_sqfFamily;
71 /**
72 * SQF Font information.
74 * @since 2019/06/20
76 typedef struct sjme_scritchui_sqf
78 /** The name of the font. */
79 sjme_lpcstr name;
81 /** The font family. */
82 sjme_jint family;
84 /** The pixel height of the font. */
85 sjme_jint pixelHeight;
87 /** The ascent of the font. */
88 sjme_jint ascent;
90 /** The descent of the font. */
91 sjme_jint descent;
93 /** Bounding box X offset. */
94 sjme_jint bbx;
96 /** Bounding box Y offset. */
97 sjme_jint bby;
99 /** Bounding box width. */
100 sjme_jint bbw;
102 /** Bounding box height. */
103 sjme_jint bbh;
105 /** The starting codepoint for this font. */
106 sjme_jint codepointStart;
108 /** The number of codepoints which are in this font. */
109 sjme_jint codepointCount;
111 /** The size of the @c huffBits member. */
112 sjme_jint huffBitsSize;
114 /** The size of the @c charBmp member. */
115 sjme_jint charBmpSize;
117 /** Huffman bits for huffman tables. */
118 const sjme_jbyte* huffBits;
120 /** Widths for each character. */
121 const sjme_jbyte* charWidths;
123 /** X offset for character. */
124 const sjme_jbyte* charXOffset;
126 /** Y offset for character. */
127 const sjme_jbyte* charYOffset;
129 /** SQF Font Flags, per character. */
130 const sjme_jbyte* charFlags;
132 /** Offset to the character bitmap for the given character. */
133 const sjme_jshort* charBmpOffset;
135 /** The bytes per scanline for each character. */
136 const sjme_jbyte* charBmpScan;
138 /** Which characters make up the bitmap? */
139 const sjme_jbyte* charBmp;
140 } sjme_scritchui_sqf;
142 typedef struct sjme_scritchui_sqfCodepage
144 /** The name of the font. */
145 sjme_lpcstr name;
147 /** The number of codepages in the font. */
148 sjme_jint numCodepages;
150 /** The codepages for the font. */
151 const sjme_scritchui_sqf* const* codepages;
152 } sjme_scritchui_sqfCodepage;
155 * Initializes a new pencil font using the given SQF codepage set.
157 * @param inOutFont The resultant font.
158 * @param inSqfCodepage The input SQF codepage to use.
159 * @return Any resultant error, if any.
160 * @since 2024/06/10
162 sjme_errorCode sjme_scritchui_newPencilFontSqfStatic(
163 sjme_scritchui_pencilFont inOutFont,
164 const sjme_scritchui_sqfCodepage* inSqfCodepage);
166 /*--------------------------------------------------------------------------*/
168 /* Anti-C++. */
169 #ifdef __cplusplus
170 #ifdef SJME_CXX_SQUIRRELJME_SCRITCHUIPENCILFONTSQF_H
172 #undef SJME_CXX_SQUIRRELJME_SCRITCHUIPENCILFONTSQF_H
173 #undef SJME_CXX_IS_EXTERNED
174 #endif /* #ifdef SJME_CXX_SQUIRRELJME_SCRITCHUIPENCILFONTSQF_H */
175 #endif /* #ifdef __cplusplus */
177 #endif /* SQUIRRELJME_SCRITCHUIPENCILFONTSQF_H */