1 /* -*- Mode: C; indent-tabs-mode: t; tab-width: 4 -*-
2 // ---------------------------------------------------------------------------
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 // -------------------------------------------------------------------------*/
16 #ifndef SQUIRRELJME_SCRITCHUIPENCILFONTSQF_H
17 #define SQUIRRELJME_SCRITCHUIPENCILFONTSQF_H
19 #include "sjme/stdTypes.h"
20 #include "sjme/alloc.h"
21 #include "lib/scritchui/scritchuiPencilFont.h"
25 #ifndef SJME_CXX_IS_EXTERNED
26 #define SJME_CXX_IS_EXTERNED
27 #define SJME_CXX_SQUIRRELJME_SCRITCHUIPENCILFONTSQF_H
29 #endif /* #ifdef SJME_CXX_IS_EXTERNED */
30 #endif /* #ifdef __cplusplus */
32 /*--------------------------------------------------------------------------*/
35 * Flags for a specific character.
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
;
49 * Represents the SQF family.
53 typedef enum sjme_scritchui_sqfFamily
56 SJME_SCRITCHUI_SQF_FAMILY_REGULAR
,
59 SJME_SCRITCHUI_SQF_FAMILY_MONOSPACE
,
62 SJME_SCRITCHUI_SQF_FAMILY_SANS_SERIF
,
65 SJME_SCRITCHUI_SQF_FAMILY_SERIF
,
67 /** The number of families. */
68 SJME_SCRITCHUI_NUM_SQF_FAMILY
69 } sjme_scritchui_sqfFamily
;
72 * SQF Font information.
76 typedef struct sjme_scritchui_sqf
78 /** The name of the font. */
81 /** The font family. */
84 /** The pixel height of the font. */
85 sjme_jint pixelHeight
;
87 /** The ascent of the font. */
90 /** The descent of the font. */
93 /** Bounding box X offset. */
96 /** Bounding box Y offset. */
99 /** Bounding box width. */
102 /** Bounding box height. */
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. */
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.
162 sjme_errorCode
sjme_scritchui_newPencilFontSqfStatic(
163 sjme_scritchui_pencilFont inOutFont
,
164 const sjme_scritchui_sqfCodepage
* inSqfCodepage
);
166 /*--------------------------------------------------------------------------*/
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 */