⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 hfilefactory_font.cpp

📁 Resource editor base speadrum Chinese mobile
💻 CPP
字号:
// HFileFactory_Font.cpp: implementation of the CHFileFactory class.
//
//////////////////////////////////////////////////////////////////////

#include "stdafx.h"
#include "resourceeditor.h"
#include "HFileFactory.h"
#include "DirFileInfo.h"

#ifdef _DEBUG
#undef THIS_FILE
static char THIS_FILE[]=__FILE__;
#define new DEBUG_NEW
#endif

BOOL CHFileFactory::GenerateFontH( LPCTSTR pszFileName , CString bin_name )
{
    _ASSERTE( pszFileName != NULL && m_pMMIRes != NULL );

    if( !IsCoverFile(pszFileName) )
        return  FALSE;
    //buffer for unicode to mbcs
	char *pszBuf = new char[1024*100];
	int nUnicodeSize = 0; // by 16-bit
	
    CFile file;
    try{
        if( !file.Open(pszFileName, CFile::modeCreate | CFile::modeWrite) )
        {
            return FALSE;
        }
		_TCHAR szTitle[] = 
			_T("/*****************************************************************************\r\n")
			_T("** File Name:      xxx_mmi_font.h                                            *\r\n")
			_T("** Author:                                                                   *\r\n")
			_T("** Date:           05/2006                                                   *\r\n")
			_T("** Copyright:      2006 Spreadtrum, Incoporated. All Rights Reserved.        *\r\n")
			_T("** Description:    This file is used to describe call log                    *\r\n")
			_T("******************************************************************************\r\n")
			_T("**                         Important Edit History                            *\r\n")
			_T("** --------------------------------------------------------------------------*\r\n")
			_T("** Create by Spreadtrum Resource Editor tool                                 *\r\n")
			_T("******************************************************************************/\r\n\r\n");
    
		_TCHAR szBegin1[] = 
			_T("#ifndef _MMI_FONT_H__\r\n")
			_T("#define _MMI_FONT_H__\r\n\r\n")
			_T("#include \"sci_types.h\"\r\n\r\n")
			_T("#ifdef __cplusplus\r\n")
			_T("extern   \"C\" {\r\n")
			_T("#endif\r\n\r\n")
			_T("///////////////////////////////////////////////////////////////////////////////\r\n")
			_T("// Font Resource \r\n")
			_T("///////////////////////////////////////////////////////////////////////////////\r\n\r\n")
			_T("// Font Type\r\n")
			_T("typedef enum _GUI_FONT_T\r\n")
			_T("{\r\n");


		CString strBegin2=_T("");
		for(int i =0;i<g_theApp.m_strArrFontType.GetSize();i++)
		{
			CString str;
			if(i==0)
			   str.Format(_T("\t%s = %d,\r\n"),g_theApp.m_strArrFontType.GetAt(i),0);
			else
			   str.Format(_T("\t%s,\r\n"),g_theApp.m_strArrFontType.GetAt(i));
			strBegin2+=str;
		}

		_TCHAR szBegin3[] = 
			_T("\tGUI_MAX_FONT_NUM\r\n")
			_T("} GUI_FONT_T;\r\n\r\n")
			_T("typedef struct _GUI_FONT_INFO_T\r\n")
			_T("{\r\n")
			_T("\tGUI_FONT_T   type;                //font type\r\n")
			_T("\tuint32       ngb_db_size;\r\n")
			_T("\tuint8      * gb_database_ptr;     //font GB DB\r\n")
			_T("\tuint32       nascii_db_size;\r\n")
			_T("\tuint8      * pascii_ptr;          //font ASCII DB\r\n")
			_T("} GUI_FONT_INFO_T, * P_GUI_FONT_INFO_T;\r\n\r\n")
			_T("typedef struct _GUI_FONT_DB_T\r\n")
			_T("{\r\n")
			_T("\tuint32       db_size;\r\n")
			_T("\tuint8      * pdb;                 //font DB\r\n")
			_T("} GUI_FONT_DB_T, * P_GUI_FONT_DB_T;\r\n\r\n")
			_T("typedef struct _GUI_FONT_INFO_EX_T\r\n")
			_T("{\r\n")
			_T("\tGUI_FONT_T   type;                //font type\r\n")
			_T("\tuint8      * pdbtt;               //DBs,point to GUI_FONT_DB_T\r\n")
			_T("} GUI_FONT_INFO_EX_T, * P_GUI_FONT_INFO_EX_T;\r\n\r\n\r\n");
    

		_TCHAR szEnd[] = 
			_T("#ifdef __cplusplus\r\n")
			_T("}\r\n")
			_T("#endif\r\n\r\n")
			_T("#endif // _MMI_FONT_DEF_H__");

		nUnicodeSize = _tcslen(szTitle);
		WideCharToMultiByte( CP_ACP, 0, szTitle, -1, pszBuf, nUnicodeSize*2, NULL, NULL );
		file.Write(pszBuf, strlen(pszBuf));

		nUnicodeSize = _tcslen(szBegin1);
		WideCharToMultiByte( CP_ACP, 0, szBegin1, -1, pszBuf, nUnicodeSize*2, NULL, NULL );
		file.Write(pszBuf, strlen(pszBuf));
		
		nUnicodeSize = strBegin2.GetLength();
		WideCharToMultiByte( CP_ACP, 0, strBegin2, -1, pszBuf, nUnicodeSize*2, NULL, NULL );
		file.Write(pszBuf, strlen(pszBuf));

		nUnicodeSize = _tcslen(szBegin3);
		WideCharToMultiByte( CP_ACP, 0, szBegin3, -1, pszBuf, nUnicodeSize*2, NULL, NULL );
		file.Write(pszBuf, strlen(pszBuf));

		nUnicodeSize = _tcslen(szEnd);
		WideCharToMultiByte( CP_ACP, 0, szEnd, -1, pszBuf, nUnicodeSize*2, NULL, NULL );
		file.Write(pszBuf, strlen(pszBuf));

        file.Close();
		delete []pszBuf;
    }
    catch(CFileException * pfe)
    {
        pfe->ReportError();
        pfe->Delete();
		delete []pszBuf;
        return FALSE;
    }

    return TRUE;
}

⌨️ 快捷键说明

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