extern "C" int main(int argc, char *argv[]) {
	if (!loadFontModule()) {
		return 1;
	}

	FontNewLibParams libParams;
	memset(&libParams, 0, sizeof(libParams));
	libParams.allocFuncAddr = allocQuiet;
	libParams.freeFuncAddr = freeQuiet;
	libParams.numFonts = 4;

	uint error = -1;
	fontLib = sceFontNewLib(&libParams, &error);
	fontLibDone = sceFontNewLib(&libParams, &error);
	sceFontDoneLib(fontLibDone);

	testBasicParams();
	testFallback();

	sceFontDoneLib(fontLib);

	return 0;
}
Example #2
0
void testDataLayout() {
	FontNewLibParams libParams;
	memset(&libParams, 0, sizeof(libParams));
	libParams.allocFuncAddr = allocQuiet;
	libParams.freeFuncAddr = freeQuiet;
	libParams.numFonts = 4;

	checkpointNext("FontLib data layout");

	uint error = -1;
	FontLibraryHandle libID = sceFontNewLib(&libParams, &error);

	checkpoint("  Params: %d", memcmp(&libParams, &libID->params, sizeof(libParams)));
	checkpoint("  unk1=%04x, unk2=%04x hRes=%f, vRes=%f, internal count=%d, altCharCode=%04x, unk5=%04x", libID->unk1, libID->unk2, libID->hRes, libID->vRes, libID->internalFontCount, libID->altCharCode, libID->unk5);

	sceFontDoneLib(libID);
}
bool loadFontHandles() {
	FontNewLibParams libParams;
	memset(&libParams, 0, sizeof(libParams));
	libParams.allocFuncAddr = allocQuiet;
	libParams.freeFuncAddr = freeQuiet;
	libParams.numFonts = 4;

	uint error = -1;
	fontLib = sceFontNewLib(&libParams, &error);

	font = sceFontOpenUserFile(fontLib, "ltn0.pgf", 1, &error);
	if (font <= 0) {
		printf("TEST ERROR: Unable to load ltn0.pgf\n");
		return false;
	}

	fontClosed = sceFontOpenUserFile(fontLib, "ltn0.pgf", 1, &error);
	sceFontClose(fontClosed);

	return true;
}
Example #4
0
File: font.c Project: rnbpsp/pmc
int load(SceSize args, void *argp){
	int stat,modid;
	if(sceKernelStartModule(modid=sceKernelLoadModule("flash0:/vsh/module/libfont_hv.prx",0,NULL),0,NULL,&stat,NULL)<0)return -__LINE__;
	int errorCode;
	InitParam initParams = {NULL,4,NULL,myMalloc,myFree,NULL,NULL,NULL,NULL,NULL,NULL};
	void* libID = sceFontNewLib(&initParams, &errorCode);if(errorCode)return  -__LINE__;
	void* fontID = sceFontOpen(libID, FONT(BOLD), FILE, &errorCode);if(errorCode)return -__LINE__;
	memset((void*)0x44000000,0,4*512*16);

	//print build date
	printchar(fontID, __DATE__" "__TIME__);//on vram
	sceIoWrite(2,__DATE__" "__TIME__,11+1+8);//on cout

	if(sceFontClose(fontID)) return  -__LINE__;
	if(sceFontDoneLib(libID)) return  -__LINE__;

	sceKernelStopModule(modid,0,NULL,&stat,NULL);
	sceKernelUnloadModule(modid);
	sceKernelSelfStopUnloadModule(1,0,NULL);
	return 0;
}
Example #5
0
vita2d_pgf *vita2d_load_default_pgf()
{
	unsigned int error;

	vita2d_pgf *font = malloc(sizeof(*font));
	if (!font)
		return NULL;

	SceFontNewLibParams params = {
		font,
		1,
		NULL,
		pgf_alloc_func,
		pgf_free_func,
		NULL,
		NULL,
		NULL,
		NULL,
		NULL,
		NULL
	};

	font->lib_handle = sceFontNewLib(&params, &error);
	if (error != 0) {
		free(font);
		return NULL;
	}

	font->font_handle = sceFontOpen(font->lib_handle, 1, 0, &error);
	if (error != 0) {
		sceFontDoneLib(font->lib_handle);
		free(font);
		return NULL;
	}

	font->tex_atlas = texture_atlas_create(ATLAS_DEFAULT_W, ATLAS_DEFAULT_H,
		SCE_GXM_TEXTURE_FORMAT_U8_R111);

	return font;
}
Example #6
0
int main(int argc, char *argv[]) {
	FontLibraryHandle libHandle;
	FontHandle        fontHandle;
	//FontInfo          fontInfo;
	//int result;
	u32 errorCode;
	FontNewLibParams params = { NULL, 4, NULL, Font_Alloc, Font_Free, NULL, NULL, NULL, NULL, NULL, NULL };

	//pspDebugScreenInit();
	
	printf("Starting fonttest...\n");

	libHandle = sceFontNewLib(&params, &errorCode);
	printf("sceFontNewLib: %d, %08X\n", libHandle != 0, errorCode);
	
	fontHandle = sceFontOpen(libHandle, 0, 0777, &errorCode);
	printf("sceFontOpen: %d, %08X\n", fontHandle != 0, errorCode);
	
	/*
	result = sceFontGetFontInfo(fontHandle, &fontInfo);
	printf("sceFontGetFontInfo: %d\n", result);
	
	#define PRINT_GLYPH_METRICS_MAX(TYPE) printf("fontInfo.max" #TYPE ": %d, %f\n", fontInfo.max## TYPE ## I, fontInfo.max## TYPE ## F);
	#define PRINT_GLYPH_METRICS_MIN(TYPE) printf("fontInfo.min" #TYPE ": %d, %f\n", fontInfo.min## TYPE ## I, fontInfo.min## TYPE ## F);
	
	PRINT_GLYPH_METRICS_MAX(GlyphWidth);
	PRINT_GLYPH_METRICS_MAX(GlyphHeight);
	PRINT_GLYPH_METRICS_MAX(GlyphAscender);
	PRINT_GLYPH_METRICS_MAX(GlyphDescender);
	PRINT_GLYPH_METRICS_MAX(GlyphLeftX);
	PRINT_GLYPH_METRICS_MAX(GlyphBaseY);
	PRINT_GLYPH_METRICS_MIN(GlyphCenterX);
	PRINT_GLYPH_METRICS_MAX(GlyphTopY);
	PRINT_GLYPH_METRICS_MAX(GlyphAdvanceX);
	PRINT_GLYPH_METRICS_MAX(GlyphAdvanceY);
	*/

	return 0;
}