vitasdk
Documentation of the vitasdk
pgf.h
Go to the documentation of this file.
1 
7 #ifndef _PSP2_PGF_H_
8 #define _PSP2_PGF_H_
9 
10 #include <vitasdk/build_utils.h>
11 #include <psp2/types.h>
12 
13 #ifdef __cplusplus
14 extern "C" {
15 #endif
16 
17 /* typedef */
18 
19 typedef void *SceFontLibHandle;
21 typedef void *SceFontHandle;
23 
24 /* struct */
25 
26 typedef enum SceFontErrorCode {
34 
35 typedef struct SceFontNewLibParams {
36  void *userData;
37  unsigned int numFonts;
38  void *cacheData;
39 
40  // Driver callbacks.
41  void *(*allocFunc)(void *, unsigned int);
42  void (*freeFunc)(void *, void *);
43  void *openFunc;
44  void *closeFunc;
45  void *readFunc;
46  void *seekFunc;
47  void *errorFunc;
48  void *ioFinishFunc;
51 
52 typedef enum SceFontFamilyCode {
58 
59 typedef enum SceFontStyleCode {
76 
77 typedef enum SceFontLanguageCode {
85 
86 typedef enum SceFontPixelFormatCode {
93 
94 typedef struct SceFontImageRect {
95  unsigned short width;
96  unsigned short height;
99 
100 typedef struct SceFontGlyphImage {
101  unsigned int pixelFormat;
102  int xPos64;
103  int yPos64;
104  unsigned short bufWidth;
105  unsigned short bufHeight;
106  unsigned short bytesPerLine;
107  unsigned short pad;
108  unsigned int bufferPtr;
111 
112 typedef struct SceFontStyle {
113  float fontH;
114  float fontV;
115  float fontHRes;
116  float fontVRes;
117  float fontWeight;
118  unsigned short fontFamily;
119  unsigned short fontStyle;
120  // Check.
121  unsigned short fontStyleSub;
122  unsigned short fontLanguage;
123  unsigned short fontRegion;
124  unsigned short fontCountry;
125  char fontName[64];
126  char fontFileName[64];
127  unsigned int fontAttributes;
128  unsigned int fontExpire;
129 } SceFontStyle;
131 
132 typedef struct SceFontCharInfo {
133  unsigned int bitmapWidth;
134  unsigned int bitmapHeight;
135  unsigned int bitmapLeft;
136  unsigned int bitmapTop;
137  // Glyph metrics (in 26.6 signed fixed-point).
138  unsigned int sfp26Width;
139  unsigned int sfp26Height;
148  short shadowFlags;
149  short shadowId;
152 
153 typedef struct SceFontInfo {
154  // Glyph metrics (in 26.6 signed fixed-point).
155  unsigned int maxGlyphWidthI;
156  unsigned int maxGlyphHeightI;
157  unsigned int maxGlyphAscenderI;
158  unsigned int maxGlyphDescenderI;
159  unsigned int maxGlyphLeftXI;
160  unsigned int maxGlyphBaseYI;
161  unsigned int minGlyphCenterXI;
162  unsigned int maxGlyphTopYI;
163  unsigned int maxGlyphAdvanceXI;
164  unsigned int maxGlyphAdvanceYI;
165 
166  // Glyph metrics (replicated as float).
177 
178  // Bitmap dimensions.
181  unsigned int charMapLength;
182  unsigned int shadowMapLength;
183 
184  // Font style (used by font comparison functions).
186 
187  uint8_t BPP;
188  uint8_t pad[3];
189 } SceFontInfo;
191 
192 /* prototypes */
193 
194 SceFontLibHandle sceFontNewLib(SceFontNewLibParams *params, unsigned int *errorCode);
196 
198  int index, int mode, unsigned int *errorCode);
199 
201  void *pMemoryFont, SceSize pMemoryFontSize, unsigned int *errorCode);
202 
204  char *file, int mode, unsigned int *errorCode);
205 
206 int sceFontClose(SceFontHandle fontHandle);
207 
208 int sceFontGetNumFontList(SceFontLibHandle libHandle, unsigned int *errorCode);
209 
211  SceFontStyle *fontStyle, unsigned int *errorCode);
212 
214  SceFontStyle *fontStyle, unsigned int *errorCode);
215 
216 int sceFontGetFontInfo(SceFontHandle fontHandle, SceFontInfo *fontInfo);
217 
219  SceFontStyle *fontStyle, int unknown, int fontIndex);
220 
221 int sceFontSetResolution(SceFontLibHandle libHandle, float hRes, float vRes);
222 
224  SceFontStyle *fontStyle, int numFonts);
225 
227  unsigned int charCode, SceFontCharInfo *charInfo);
228 
230  unsigned int charCode, SceFontImageRect *charRect);
231 
233  unsigned int charCode, SceFontGlyphImage *glyphImage);
234 
236  unsigned int charCode, SceFontGlyphImage *glyphImage,
237  int clipXPos, int clipYPos, int clipWidth, int clipHeight);
238 
240  float fontPixelsH, unsigned int *errorCode);
241 
243  float fontPixelsV, unsigned int *errorCode);
244 
246  float fontPointsH, unsigned int *errorCode);
247 
249  float fontPointsV, unsigned int *errorCode);
250 
251 int sceFontSetAltCharacterCode(SceFontLibHandle libHandle, unsigned int charCode);
252 
253 int sceFontFlush(SceFontHandle fontHandle);
254 
255 #ifdef __cplusplus
256 }
257 #endif
258 
259 #endif /* _PSP2_PGF_H_ */
int sceFontGetFontInfo(SceFontHandle fontHandle, SceFontInfo *fontInfo)
unsigned int sfp26Width
Definition: pgf.h:138
SceFontLanguageCode
Definition: pgf.h:77
float fontWeight
Definition: pgf.h:117
SceFontHandle sceFontOpenUserMemory(SceFontLibHandle libHandle, void *pMemoryFont, SceSize pMemoryFontSize, unsigned int *errorCode)
SceFontFamilyCode
Definition: pgf.h:52
float maxGlyphTopYF
Definition: pgf.h:174
unsigned int maxGlyphTopYI
Definition: pgf.h:162
char fontName[64]
Definition: pgf.h:125
unsigned int bitmapWidth
Definition: pgf.h:133
SceFontStyle fontStyle
Definition: pgf.h:185
unsigned int maxGlyphWidthI
Definition: pgf.h:155
unsigned int bitmapTop
Definition: pgf.h:136
unsigned short fontLanguage
Definition: pgf.h:122
SceFontPixelFormatCode
Definition: pgf.h:86
float fontH
Definition: pgf.h:113
unsigned short bufHeight
Definition: pgf.h:105
float sceFontPixelToPointH(SceFontLibHandle libHandle, float fontPixelsH, unsigned int *errorCode)
unsigned int maxGlyphBaseYI
Definition: pgf.h:160
int sfp26AdvanceV
Definition: pgf.h:147
SceFontLibHandle sceFontNewLib(SceFontNewLibParams *params, unsigned int *errorCode)
unsigned int charMapLength
Number of elements in the font's charmap.
Definition: pgf.h:181
unsigned int fontAttributes
Definition: pgf.h:127
int sfp26BearingVY
Definition: pgf.h:145
unsigned int bufferPtr
Definition: pgf.h:108
int yPos64
Definition: pgf.h:103
unsigned short height
Definition: pgf.h:96
void * ioFinishFunc
Definition: pgf.h:48
unsigned int maxGlyphDescenderI
Definition: pgf.h:158
void * cacheData
Definition: pgf.h:38
int sceFontGetCharGlyphImage(SceFontHandle fontHandle, unsigned int charCode, SceFontGlyphImage *glyphImage)
int sfp26BearingHX
Definition: pgf.h:142
float fontHRes
Definition: pgf.h:115
float fontVRes
Definition: pgf.h:116
unsigned int maxGlyphAdvanceYI
Definition: pgf.h:164
float maxGlyphHeightF
Definition: pgf.h:168
int sceFontGetFontInfoByIndexNumber(SceFontLibHandle libHandle, SceFontStyle *fontStyle, int unknown, int fontIndex)
float sceFontPixelToPointV(SceFontLibHandle libHandle, float fontPixelsV, unsigned int *errorCode)
float maxGlyphAdvanceXF
Definition: pgf.h:175
float maxGlyphWidthF
Definition: pgf.h:167
void * SceFontHandle
Definition: pgf.h:21
int sceFontSetAltCharacterCode(SceFontLibHandle libHandle, unsigned int charCode)
int sfp26Ascender
Definition: pgf.h:140
unsigned int numFonts
Definition: pgf.h:37
void * seekFunc
Definition: pgf.h:46
SceFontStyleCode
Definition: pgf.h:59
unsigned short fontCountry
Definition: pgf.h:124
char fontFileName[64]
Definition: pgf.h:126
int sceFontDoneLib(SceFontLibHandle libHandle)
float sceFontPointToPixelV(SceFontLibHandle libHandle, float fontPointsV, unsigned int *errorCode)
int sceFontSetResolution(SceFontLibHandle libHandle, float hRes, float vRes)
unsigned short bytesPerLine
Definition: pgf.h:106
float fontV
Definition: pgf.h:114
VITASDK_BUILD_ASSERT_EQ(4, SceFontLibHandle)
uint8_t pad[3]
Definition: pgf.h:188
unsigned int bitmapHeight
Definition: pgf.h:134
void * readFunc
Definition: pgf.h:45
void * errorFunc
Definition: pgf.h:47
void * openFunc
Definition: pgf.h:43
float sceFontPointToPixelH(SceFontLibHandle libHandle, float fontPointsH, unsigned int *errorCode)
float maxGlyphDescenderF
Definition: pgf.h:170
unsigned int pixelFormat
Definition: pgf.h:101
int sceFontGetCharImageRect(SceFontHandle fontHandle, unsigned int charCode, SceFontImageRect *charRect)
int sceFontGetFontList(SceFontLibHandle libHandle, SceFontStyle *fontStyle, int numFonts)
void * userData
Definition: pgf.h:36
unsigned short fontFamily
Definition: pgf.h:118
SceFontErrorCode
Definition: pgf.h:26
float maxGlyphBaseYF
Definition: pgf.h:172
int sfp26Descender
Definition: pgf.h:141
int sceFontFlush(SceFontHandle fontHandle)
void * closeFunc
Definition: pgf.h:44
int sceFontGetCharGlyphImage_Clip(SceFontHandle fontHandle, unsigned int charCode, SceFontGlyphImage *glyphImage, int clipXPos, int clipYPos, int clipWidth, int clipHeight)
int sceFontFindFont(SceFontLibHandle libHandle, SceFontStyle *fontStyle, unsigned int *errorCode)
int sceFontFindOptimumFont(SceFontLibHandle libHandle, SceFontStyle *fontStyle, unsigned int *errorCode)
float minGlyphCenterXF
Definition: pgf.h:173
unsigned int maxGlyphHeightI
Definition: pgf.h:156
unsigned int sfp26Height
Definition: pgf.h:139
unsigned short pad
Definition: pgf.h:107
unsigned int shadowMapLength
Number of elements in the font's shadow charmap.
Definition: pgf.h:182
void * SceFontLibHandle
Definition: pgf.h:19
float maxGlyphAdvanceYF
Definition: pgf.h:176
unsigned short width
Definition: pgf.h:95
unsigned int maxGlyphAdvanceXI
Definition: pgf.h:163
SceFontHandle sceFontOpenUserFile(SceFontLibHandle libHandle, char *file, int mode, unsigned int *errorCode)
unsigned short bufWidth
Definition: pgf.h:104
short shadowFlags
Definition: pgf.h:148
short shadowId
Definition: pgf.h:149
int sceFontGetCharInfo(SceFontHandle fontHandle, unsigned int charCode, SceFontCharInfo *charInfo)
int sfp26BearingVX
Definition: pgf.h:144
short maxGlyphWidth
Definition: pgf.h:179
unsigned int fontExpire
Definition: pgf.h:128
int sceFontGetNumFontList(SceFontLibHandle libHandle, unsigned int *errorCode)
float maxGlyphLeftXF
Definition: pgf.h:171
unsigned int minGlyphCenterXI
Definition: pgf.h:161
unsigned int maxGlyphAscenderI
Definition: pgf.h:157
unsigned short fontStyle
Definition: pgf.h:119
unsigned int maxGlyphLeftXI
Definition: pgf.h:159
int sceFontClose(SceFontHandle fontHandle)
int xPos64
Definition: pgf.h:102
int sfp26AdvanceH
Definition: pgf.h:146
uint8_t BPP
Font's BPP.
Definition: pgf.h:187
SceFontHandle sceFontOpen(SceFontLibHandle libHandle, int index, int mode, unsigned int *errorCode)
unsigned short fontRegion
Definition: pgf.h:123
void(* freeFunc)(void *, void *)
Definition: pgf.h:42
short maxGlyphHeight
Definition: pgf.h:180
unsigned short fontStyleSub
Definition: pgf.h:121
unsigned int bitmapLeft
Definition: pgf.h:135
int sfp26BearingHY
Definition: pgf.h:143
float maxGlyphAscenderF
Definition: pgf.h:169
@ SCE_FONT_LANGUAGE_LATIN
Definition: pgf.h:80
@ SCE_FONT_LANGUAGE_JAPANESE
Definition: pgf.h:79
@ SCE_FONT_LANGUAGE_DEFAULT
Definition: pgf.h:78
@ SCE_FONT_LANGUAGE_KOREAN
Definition: pgf.h:81
@ SCE_FONT_LANGUAGE_CJK
Definition: pgf.h:83
@ SCE_FONT_LANGUAGE_CHINESE
Definition: pgf.h:82
@ SCE_FONT_FAMILY_DEFAULT
Definition: pgf.h:53
@ SCE_FONT_FAMILY_ROUNDED
Definition: pgf.h:56
@ SCE_FONT_FAMILY_SERIF
Definition: pgf.h:55
@ SCE_FONT_FAMILY_SANS_SERIF
Definition: pgf.h:54
@ SCE_FONT_PIXELFORMAT_24
1 pixel in 3 bytes (RGB)
Definition: pgf.h:90
@ SCE_FONT_PIXELFORMAT_4_REV
2 pixels packed in 1 byte (reversed order)
Definition: pgf.h:88
@ SCE_FONT_PIXELFORMAT_4
2 pixels packed in 1 byte (natural order)
Definition: pgf.h:87
@ SCE_FONT_PIXELFORMAT_8
1 pixel in 1 byte
Definition: pgf.h:89
@ SCE_FONT_PIXELFORMAT_32
1 pixel in 4 bytes (RGBA)
Definition: pgf.h:91
@ SCE_FONT_STYLE_M
Definition: pgf.h:70
@ SCE_FONT_STYLE_BLACK_ITALIC
Definition: pgf.h:68
@ SCE_FONT_STYLE_NARROW_ITALIC
Definition: pgf.h:64
@ SCE_FONT_STYLE_BOLD_ITALIC
Definition: pgf.h:66
@ SCE_FONT_STYLE_DEFAULT
Definition: pgf.h:60
@ SCE_FONT_STYLE_DB
Demi-Bold / semi-bold.
Definition: pgf.h:71
@ SCE_FONT_STYLE_BLACK
Definition: pgf.h:67
@ SCE_FONT_STYLE_L
Definition: pgf.h:69
@ SCE_FONT_STYLE_B
Definition: pgf.h:72
@ SCE_FONT_STYLE_REGULAR
Definition: pgf.h:61
@ SCE_FONT_STYLE_BOLD
Definition: pgf.h:65
@ SCE_FONT_STYLE_ITALIC
Definition: pgf.h:62
@ SCE_FONT_STYLE_EB
Definition: pgf.h:73
@ SCE_FONT_STYLE_NARROW
Definition: pgf.h:63
@ SCE_FONT_STYLE_UB
Definition: pgf.h:74
@ SCE_FONT_ERROR_TOO_MANY_OPEN_FONTS
Definition: pgf.h:31
@ SCE_FONT_ERROR_OUT_OF_MEMORY
Definition: pgf.h:27
@ SCE_FONT_ERROR_HANDLER_OPEN_FAILED
Definition: pgf.h:30
@ SCE_FONT_ERROR_INVALID_LIBID
Definition: pgf.h:28
@ SCE_FONT_ERROR_INVALID_FONT_DATA
Definition: pgf.h:32
@ SCE_FONT_ERROR_INVALID_PARAMETER
Definition: pgf.h:29
Definition: pgf.h:132
Definition: pgf.h:100
Definition: pgf.h:94
Definition: pgf.h:153
Definition: pgf.h:35
Definition: pgf.h:112
unsigned int SceSize
Definition: types.h:56