当前位置: 首页>>代码示例>>C++>>正文


C++ FontLib类代码示例

本文整理汇总了C++中FontLib的典型用法代码示例。如果您正苦于以下问题:C++ FontLib类的具体用法?C++ FontLib怎么用?C++ FontLib使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了FontLib类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: sceFontOpenUserFile

// Open a user font in a file into a FontLib
u32 sceFontOpenUserFile(u32 libHandle, const char *fileName, u32 mode, u32 errorCodePtr) {
	INFO_LOG(HLE, "sceFontOpenUserFile(%08x, %s, %08x, %08x)", libHandle, fileName, mode, errorCodePtr);
	if (!Memory::IsValidAddress(errorCodePtr))
		return ERROR_FONT_INVALID_PARAMETER;

	PSPFileInfo info = pspFileSystem.GetFileInfo(fileName);
	if (!info.exists) {
		Memory::Write_U32(ERROR_FONT_INVALID_PARAMETER, errorCodePtr);
		return 0;
	}

	FontLib *fontLib = GetFontLib(libHandle);
	if (!fontLib) {
		Memory::Write_U32(ERROR_FONT_INVALID_PARAMETER, errorCodePtr);
		return 0;
	}

	u8 *buffer = new u8[(size_t)info.size];

	u32 fileHandle = pspFileSystem.OpenFile(fileName, FILEACCESS_READ);
	pspFileSystem.ReadFile(fileHandle, buffer, info.size);
	pspFileSystem.CloseFile(fileHandle);

	LoadedFont *font = fontLib->OpenFont(new Font(buffer, (size_t)info.size));
	if (font) {
		fontMap[font->Handle()] = font;
		Memory::Write_U32(0, errorCodePtr);
		return font->Handle();
	} else {
		Memory::Write_U32(ERROR_FONT_TOO_MANY_OPEN_FONTS, errorCodePtr);
		return 0;
	}
}
开发者ID:KrisLee,项目名称:ppsspp,代码行数:34,代码来源:sceFont.cpp

示例2: sceFontOpen

// Open internal font into a FontLib
u32 sceFontOpen(u32 libHandle, u32 index, u32 mode, u32 errorCodePtr) {
	if (!Memory::IsValidAddress(errorCodePtr)) {
		// Would crash on the PSP.
		ERROR_LOG(HLE, "sceFontOpen(%x, %x, %x, %x): invalid pointer", libHandle, index, mode, errorCodePtr);
		return 0;
	}

	INFO_LOG(HLE, "sceFontOpen(%x, %x, %x, %x)", libHandle, index, mode, errorCodePtr);
	FontLib *fontLib = GetFontLib(libHandle);
	if (fontLib == NULL) {
		Memory::Write_U32(ERROR_FONT_INVALID_LIBID, errorCodePtr);
		return 0;
	}
	if (index >= internalFonts.size()) {
		Memory::Write_U32(ERROR_FONT_INVALID_PARAMETER, errorCodePtr);
		return 0;
	}

	LoadedFont *font = fontLib->OpenFont(internalFonts[index]);
	if (font) {
		fontMap[font->Handle()] = font;
		Memory::Write_U32(0, errorCodePtr);
		return font->Handle();
	} else {
		Memory::Write_U32(ERROR_FONT_TOO_MANY_OPEN_FONTS, errorCodePtr);
		return 0;
	}
}
开发者ID:KrisLee,项目名称:ppsspp,代码行数:29,代码来源:sceFont.cpp

示例3: sceFontSetResolution

int sceFontSetResolution(u32 fontLibHandle, float hRes, float vRes) {
	INFO_LOG(HLE, "sceFontSetResolution(%08x, %f, %f)", fontLibHandle, hRes, vRes);
	FontLib *fl = GetFontLib(fontLibHandle);
	if (fl) {
		fl->SetResolution(hRes, vRes);
	}
	return 0;
}
开发者ID:KrisLee,项目名称:ppsspp,代码行数:8,代码来源:sceFont.cpp

示例4: sceFontSetAltCharacterCode

int sceFontSetAltCharacterCode(u32 fontLibHandle, u32 charCode) {
	INFO_LOG(HLE, "sceFontSetAltCharacterCode(%08x) (%08x)", fontLibHandle, charCode);
	FontLib *fl = GetFontLib(fontLibHandle);
	if (fl) {
		fl->SetAltCharCode(charCode);
	}
	return 0;
}
开发者ID:KrisLee,项目名称:ppsspp,代码行数:8,代码来源:sceFont.cpp

示例5: sceFontDoneLib

int sceFontDoneLib(u32 fontLibHandle) {
	INFO_LOG(HLE, "sceFontDoneLib(%08x)", fontLibHandle);
	FontLib *fl = GetFontLib(fontLibHandle);
	if (fl) {
		fl->Done();
	}
	return 0;
}
开发者ID:KrisLee,项目名称:ppsspp,代码行数:8,代码来源:sceFont.cpp

示例6: INFO_LOG

void PostAllocCallback::run(MipsCall &call) {
	INFO_LOG(HLE, "Entering PostAllocCallback::run");
	u32 v0 = currentMIPS->r[MIPS_REG_V0];
	FontLib *fontLib = fontLibList[fontLibID_];
	fontLib->AllocDone(v0);
	fontLibMap[fontLib->handle()] = fontLibID_;
	call.setReturnValue(fontLib->handle());
	INFO_LOG(HLE, "Leaving PostAllocCallback::run");
}
开发者ID:KrisLee,项目名称:ppsspp,代码行数:9,代码来源:sceFont.cpp

示例7: sceFontPointToPixelV

float sceFontPointToPixelV(int fontLibHandle, float fontPointsV, u32 errorCodePtr) {
	DEBUG_LOG(HLE, "sceFontPointToPixelV(%08x, %f, %08x)", fontLibHandle, fontPointsV, errorCodePtr);
	if (Memory::IsValidAddress(errorCodePtr))
		Memory::Write_U32(0, errorCodePtr);
	FontLib *fl = GetFontLib(fontLibHandle);
	if (fl) {
		return fontPointsV * fl->FontVRes() / pointDPI;
	}
	return 0;
}
开发者ID:KrisLee,项目名称:ppsspp,代码行数:10,代码来源:sceFont.cpp

示例8: sceFontPixelToPointH

float sceFontPixelToPointH(int fontLibHandle, float fontPixelsH, u32 errorCodePtr) {
	DEBUG_LOG(HLE, "sceFontPixelToPointH(%08x, %f, %08x)", fontLibHandle, fontPixelsH, errorCodePtr);
	if (Memory::IsValidAddress(errorCodePtr))
		Memory::Write_U32(0, errorCodePtr);
	FontLib *fl = GetFontLib(fontLibHandle);
	if (fl) {
		return fontPixelsH * pointDPI / fl->FontHRes();
	}
	return 0;
}
开发者ID:KrisLee,项目名称:ppsspp,代码行数:10,代码来源:sceFont.cpp

示例9: sceFontPointToPixelH

float sceFontPointToPixelH(int fontLibHandle, float fontPointsH, u32 errorCodePtr) {
	INFO_LOG(HLE, "UNIMPL sceFontPointToPixelH(%08x, %f, %08x)", fontLibHandle, fontPointsH, errorCodePtr);
	if (Memory::IsValidAddress(errorCodePtr))
		Memory::Write_U32(0, errorCodePtr);
	FontLib *fl = GetFontLib(fontLibHandle);
	if (fl) {
		return fontPointsH * fl->FontHRes() / pointDPI;
	}
	return 0;
}
开发者ID:Chalky2013,项目名称:ppsspp,代码行数:10,代码来源:sceFont.cpp

示例10: sceFontPixelToPointV

float sceFontPixelToPointV(int fontLibHandle, float fontPixelsV, u32 errorCodePtr) {
	INFO_LOG(HLE, "UNIMPL sceFontPixelToPointV(%08x, %f, %08x)", fontLibHandle, fontPixelsV, errorCodePtr);
	if (Memory::IsValidAddress(errorCodePtr))
		Memory::Write_U32(0, errorCodePtr);
	FontLib *fl = GetFontLib(fontLibHandle);
	if (fl) {
		return fontPixelsV * pointDPI / fl->FontVRes();
	}
	return 0;
}
开发者ID:Chalky2013,项目名称:ppsspp,代码行数:10,代码来源:sceFont.cpp

示例11: sceFontClose

int sceFontClose(u32 fontHandle) {
	LoadedFont *font = GetLoadedFont(fontHandle, false);
	if (font)
	{
		INFO_LOG(HLE, "sceFontClose(%x)", fontHandle);
		FontLib *fontLib = font->GetFontLib();
		if (fontLib)
			fontLib->CloseFont(font);
	}
	else
		ERROR_LOG(HLE, "sceFontClose(%x) - font not open?", fontHandle);
	return 0;
}
开发者ID:KrisLee,项目名称:ppsspp,代码行数:13,代码来源:sceFont.cpp

示例12: __FontShutdown

void __FontShutdown() {
	for (auto iter = fontMap.begin(); iter != fontMap.end(); iter++) {
		FontLib *fontLib = iter->second->GetFontLib();
		if (fontLib)
			fontLib->CloseFont(iter->second);
	}
	fontMap.clear();
	for (auto iter = fontLibList.begin(); iter != fontLibList.end(); iter++) {
		delete *iter;
	}
	fontLibList.clear();
	fontLibMap.clear();
	for (auto iter = internalFonts.begin(); iter != internalFonts.end(); ++iter) {
		delete *iter;
	}
	internalFonts.clear();
}
开发者ID:KrisLee,项目名称:ppsspp,代码行数:17,代码来源:sceFont.cpp

示例13: sceFontNewLib

u32 sceFontNewLib(u32 paramPtr, u32 errorCodePtr) {
	// Lazy load internal fonts, only when font library first inited.
	__LoadInternalFonts();
	INFO_LOG(HLE, "sceFontNewLib(%08x, %08x)", paramPtr, errorCodePtr);

	if (Memory::IsValidAddress(paramPtr) && Memory::IsValidAddress(errorCodePtr)) {
		Memory::Write_U32(0, errorCodePtr);
		
		FontLib *newLib = new FontLib(paramPtr);
		fontLibList.push_back(newLib);
		// The game should never see this value, the return value is replaced
		// by the action. Except if we disable the alloc, in this case we return
		// the handle correctly here.
		return newLib->handle();
	}

	return 0;
}
开发者ID:KrisLee,项目名称:ppsspp,代码行数:18,代码来源:sceFont.cpp

示例14: sceFontOpenUserMemory

// Open a user font in RAM into a FontLib
u32 sceFontOpenUserMemory(u32 libHandle, u32 memoryFontAddrPtr, u32 memoryFontLength, u32 errorCodePtr) {
	INFO_LOG(HLE, "sceFontOpenUserMemory %x, %x, %x, %x", libHandle, memoryFontAddrPtr, memoryFontLength, errorCodePtr);
	if (!Memory::IsValidAddress(errorCodePtr) || !Memory::IsValidAddress(memoryFontAddrPtr)) {
		Memory::Write_U32(ERROR_FONT_INVALID_PARAMETER, errorCodePtr);
		return 0;
	}

	FontLib *fontLib = GetFontLib(libHandle);
	if (!fontLib) {
		Memory::Write_U32(ERROR_FONT_INVALID_PARAMETER, errorCodePtr);
		return 0;
	}

	const u8 *fontData = Memory::GetPointer(memoryFontAddrPtr);
	LoadedFont *font = fontLib->OpenFont(new Font(fontData, memoryFontLength));
	if (font) {
		fontMap[font->Handle()] = font;
		Memory::Write_U32(0, errorCodePtr);
		return font->Handle();
	} else {
		Memory::Write_U32(ERROR_FONT_TOO_MANY_OPEN_FONTS, errorCodePtr);
		return 0;
	}
}
开发者ID:KrisLee,项目名称:ppsspp,代码行数:25,代码来源:sceFont.cpp

示例15: sceFontGetFontInfoByIndexNumber

int sceFontGetFontInfoByIndexNumber(u32 libHandle, u32 fontInfoPtr, u32 unknown, u32 fontIndex) {
	DEBUG_LOG(HLE, "sceFontGetFontInfoByIndexNumber(%x, %x, %i, %i)", libHandle, fontInfoPtr, unknown, fontIndex);
	FontLib *fl = GetFontLib(libHandle);
	u32 fontHandle = fl->GetFontHandle(fontIndex);
	return sceFontGetFontInfo(fontHandle, fontInfoPtr);
}
开发者ID:KrisLee,项目名称:ppsspp,代码行数:6,代码来源:sceFont.cpp


注:本文中的FontLib类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。