outputhead.h

来自「万能字库生成工具: 将UNICODE」· C头文件 代码 · 共 58 行

H
58
字号
#ifndef OUTPUT_HEAD_H
#define OUTPUT_HEAD_H


bool GetLatticeFontBuf(FILE * fl,
					   unsigned char * pOutBuf, 
					   int nOutBufLength, 
					   int nLatticeWidth, 
					   int nLatticeHeight,
					   int nLibraryBegin,
					   int nUnicode);
/*
描述:
	根据显示字点阵的宽度和高度以及传入的unicode编码来得到该编码在
	Unicode字库中的点阵缓冲;
参数:
	[in]fl unicode字库文件指针
	[out]pOutBuf 用于存放点阵缓冲的输出
	[in]nOutBuflength 传出缓冲的长度
	[in]nLatticeWidth 点阵的宽度(最小为8,最大为32)
	[in]nLatticeHeight 点阵的实际高度(最小为8,最大为32)
	[in]nLibraryBegin unicode编码点阵字库的起始unicode编码
	[in]nUnicode 传入的unicode编码
返回:
	找到返回 true, 否则返回 false
*/
bool GetLatticeFontBuf(FILE * fl,
					   unsigned char * pOutBuf, 
					   int nOutBufLength, 
					   int nLatticeWidth, 
					   int nLatticeHeight,
					   int nLibraryBegin,
					   int nUnicode)
{
	if(fl == NULL)
		return false;
	if(pOutBuf == NULL)
		return false;
	
	int nTempWidth = 0;
	if(nLatticeWidth <= 8)
		nTempWidth = 8;
	else if(nLatticeWidth <= 16)
		nTempWidth = 16;
	else if(nLatticeWidth <= 32)
		nTempWidth = 32;

	if((nTempWidth*nLatticeHeight/8) > nOutBufLength)
		return false;
	int nOffset = (nUnicode - nLibraryBegin)*(nTempWidth*nLatticeHeight/8);
	int nSeek = fseek(fl, nOffset, SEEK_SET);
	if(nSeek != 0)
		return false;
	fread(pOutBuf, (nTempWidth*nLatticeHeight/8), sizeof(unsigned char), fl);
	return true;
}

#endif

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?