亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關于我們
? 蟲蟲下載站

?? fontconvertdlg.cpp

?? VIA CDMA 字體庫轉換工具原碼 FontConvert是一個字庫轉換工具
?? CPP
字號:
// FontConvertDlg.cpp : implementation file
//

#include "stdafx.h"
#include "FontConvert.h"
#include "FontConvertDlg.h"
#include "stdio.h"
#include "io.h"
#include "direct.h"
#include "stdlib.h"

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

/////////////////////////////////////////////////////////////////////////////
// CAboutDlg dialog used for App About

class CAboutDlg : public CDialog
{
public:
	CAboutDlg();

// Dialog Data
	//{{AFX_DATA(CAboutDlg)
	enum { IDD = IDD_ABOUTBOX };
	//}}AFX_DATA

	// ClassWizard generated virtual function overrides
	//{{AFX_VIRTUAL(CAboutDlg)
	protected:
	virtual void DoDataExchange(CDataExchange* pDX);    // DDX/DDV support
	//}}AFX_VIRTUAL

// Implementation
protected:
	//{{AFX_MSG(CAboutDlg)
	//}}AFX_MSG
	DECLARE_MESSAGE_MAP()
};

CAboutDlg::CAboutDlg() : CDialog(CAboutDlg::IDD)
{
	//{{AFX_DATA_INIT(CAboutDlg)
	//}}AFX_DATA_INIT
}

void CAboutDlg::DoDataExchange(CDataExchange* pDX)
{
	CDialog::DoDataExchange(pDX);
	//{{AFX_DATA_MAP(CAboutDlg)
	//}}AFX_DATA_MAP
}

BEGIN_MESSAGE_MAP(CAboutDlg, CDialog)
	//{{AFX_MSG_MAP(CAboutDlg)
		// No message handlers
	//}}AFX_MSG_MAP
END_MESSAGE_MAP()

/////////////////////////////////////////////////////////////////////////////
// CFontConvertDlg dialog

CFontConvertDlg::CFontConvertDlg(CWnd* pParent /*=NULL*/)
	: CDialog(CFontConvertDlg::IDD, pParent)
{
	//{{AFX_DATA_INIT(CFontConvertDlg)
	m_StartIndex = 0;
	m_EndIndex = 0;
	//}}AFX_DATA_INIT
	// Note that LoadIcon does not require a subsequent DestroyIcon in Win32
	m_hIcon = AfxGetApp()->LoadIcon(IDR_MAINFRAME);
}

void CFontConvertDlg::DoDataExchange(CDataExchange* pDX)
{
	CDialog::DoDataExchange(pDX);
	//{{AFX_DATA_MAP(CFontConvertDlg)
	DDX_Text(pDX, IDC_EDIT_START_INDEX, m_StartIndex);
	DDX_Text(pDX, IDC_EDIT_END_INDEX, m_EndIndex);
	//}}AFX_DATA_MAP
}

BEGIN_MESSAGE_MAP(CFontConvertDlg, CDialog)
	//{{AFX_MSG_MAP(CFontConvertDlg)
	ON_WM_SYSCOMMAND()
	ON_WM_PAINT()
	ON_WM_QUERYDRAGICON()
	ON_BN_CLICKED(ID_BUTTON_BROWSE_BMF, OnButtonBrowseBmf)
	ON_BN_CLICKED(ID_BUTTON_BROWSE_TXT, OnButtonBrowseTxt)
	//}}AFX_MSG_MAP
END_MESSAGE_MAP()

/////////////////////////////////////////////////////////////////////////////
// CFontConvertDlg message handlers

BOOL CFontConvertDlg::OnInitDialog()
{
	CDialog::OnInitDialog();

	// Add "About..." menu item to system menu.

	// IDM_ABOUTBOX must be in the system command range.
	ASSERT((IDM_ABOUTBOX & 0xFFF0) == IDM_ABOUTBOX);
	ASSERT(IDM_ABOUTBOX < 0xF000);

	CMenu* pSysMenu = GetSystemMenu(FALSE);
	if (pSysMenu != NULL)
	{
		CString strAboutMenu;
		strAboutMenu.LoadString(IDS_ABOUTBOX);
		if (!strAboutMenu.IsEmpty())
		{
			pSysMenu->AppendMenu(MF_SEPARATOR);
			pSysMenu->AppendMenu(MF_STRING, IDM_ABOUTBOX, strAboutMenu);
		}
	}

	// Set the icon for this dialog.  The framework does this automatically
	//  when the application's main window is not a dialog
	SetIcon(m_hIcon, TRUE);			// Set big icon
	SetIcon(m_hIcon, FALSE);		// Set small icon
	
	// TODO: Add extra initialization here
	
	return TRUE;  // return TRUE  unless you set the focus to a control
}

void CFontConvertDlg::OnSysCommand(UINT nID, LPARAM lParam)
{
	if ((nID & 0xFFF0) == IDM_ABOUTBOX)
	{
		CAboutDlg dlgAbout;
		dlgAbout.DoModal();
	}
	else
	{
		CDialog::OnSysCommand(nID, lParam);
	}
}

// If you add a minimize button to your dialog, you will need the code below
//  to draw the icon.  For MFC applications using the document/view model,
//  this is automatically done for you by the framework.

void CFontConvertDlg::OnPaint() 
{
	if (IsIconic())
	{
		CPaintDC dc(this); // device context for painting

		SendMessage(WM_ICONERASEBKGND, (WPARAM) dc.GetSafeHdc(), 0);

		// Center icon in client rectangle
		int cxIcon = GetSystemMetrics(SM_CXICON);
		int cyIcon = GetSystemMetrics(SM_CYICON);
		CRect rect;
		GetClientRect(&rect);
		int x = (rect.Width() - cxIcon + 1) / 2;
		int y = (rect.Height() - cyIcon + 1) / 2;

		// Draw the icon
		dc.DrawIcon(x, y, m_hIcon);
	}
	else
	{
		CDialog::OnPaint();
	}
}

// The system calls this to obtain the cursor to display while the user drags
//  the minimized window.
HCURSOR CFontConvertDlg::OnQueryDragIcon()
{
	return (HCURSOR) m_hIcon;
}

void CFontConvertDlg::OnButtonBrowseBmf() 
{
	// TODO: Add your control notification handler code here
	CFileDialog dlg(TRUE, NULL, NULL, OFN_HIDEREADONLY, "Bmf Files (*.bmf)|*.bmf|| ", NULL);
	
	if (dlg.DoModal() == IDOK)
	{
		m_BmfFileName = dlg.GetPathName();
		CWnd* pwnd = GetDlgItem(IDC_EDIT_BMFFILE);
		pwnd->SetWindowText(m_BmfFileName);
		UpdateData(FALSE);
	}
}

void CFontConvertDlg::OnButtonBrowseTxt() 
{
	// TODO: Add your control notification handler code here
	CFileDialog dlg(TRUE, NULL, NULL, OFN_HIDEREADONLY, "Txt Files (*.txt)|*.txt|| ", NULL);
	
	if (dlg.DoModal() == IDOK)
	{
		m_TxtFileName = dlg.GetPathName();
		CWnd* pwnd = GetDlgItem(IDC_EDIT_TXTFILE);
		pwnd->SetWindowText(m_TxtFileName);
		UpdateData(FALSE);
	}
}

void CFontConvertDlg::OnOK() 
{
	// TODO: Add extra validation here
	long int BmfFileLength, TxtFileLength;

	UpdateData(TRUE);
	CWnd* pwnd;
	if (m_BmfFileName.IsEmpty())
	{
		AfxMessageBox("Please select bmf file!", MB_OK | MB_ICONEXCLAMATION);	
		pwnd = GetDlgItem(IDC_EDIT_BMFFILE);
		pwnd->SetFocus();
		return;
	}
	if (m_TxtFileName.IsEmpty())
	{
		AfxMessageBox("Please select index file!", MB_OK | MB_ICONEXCLAMATION);	
		pwnd = GetDlgItem(IDC_EDIT_TXTFILE);
		pwnd->SetFocus();		
		return;
	}
	if (m_StartIndex == m_EndIndex)
	{
		AfxMessageBox("Start index can't equal to end index!", MB_OK | MB_ICONEXCLAMATION);	
		return;
	}

	FILE* pBmfFile = fopen(m_BmfFileName, "r");
	if (pBmfFile == NULL)
	{
		AfxMessageBox("Bmf file open error!", MB_OK);
		return;
	}
	BmfFileLength = _filelength(pBmfFile->_file);
	byte* pBmfFileData = new byte[BmfFileLength];
	fread(pBmfFileData, BmfFileLength, sizeof(byte), pBmfFile);
	rewind(pBmfFile);
//	fclose(pBmfFile);
	

	FILE* pTxtFile = fopen(m_TxtFileName, "r");
	if (pTxtFile == NULL)
	{
		AfxMessageBox("Txt file open error!", MB_OK);
		return;
	}
	TxtFileLength = _filelength(pTxtFile->_file);
	byte* pTxtFileData = new byte[TxtFileLength];
	fread(pTxtFileData, TxtFileLength, sizeof(byte), pTxtFile);
	fclose(pTxtFile);

	int driver;
	char path[MAX_PATH];
	char ppath[MAX_PATH];
	
	//在工作目錄下生成VTUI font目錄
	driver = _getdrive();
	_getdcwd(driver, path, MAX_PATH);
	_searchenv("VTUI font", path, ppath);
	if (strlen(ppath) == 0)
	{
		strcpy(ppath, strcat(path, "\\VTUI font"));		
		if (_mkdir(ppath) == -1)			//建立文件存放目錄出錯
		{
			AfxMessageBox("Create directory error!", MB_OK);
			return;
		}
	}
	CString VTUI2ChineseCharBmfFile;
	VTUI2ChineseCharBmfFile.Format("%s%s", path, "\\VTUIfont.bmf");
	CString VTUI2ChineseCharTxtFile;
	VTUI2ChineseCharTxtFile.Format("%s%s", path, "\\VTUIfont.txt");
	
	FILE* pConvertedBmfFile = fopen(VTUI2ChineseCharBmfFile, "a + t");
	if (pConvertedBmfFile == NULL)
	{
		AfxMessageBox("VTUIfont.bmf file open error!", MB_OK);
		return;
	}
	FILE* pConvertedTxtFile = fopen(VTUI2ChineseCharTxtFile, "a + t");
	if (pConvertedTxtFile == NULL)
	{
		AfxMessageBox("VTUIfont.txt file open error!", MB_OK);
		return;
	}

	long int BeginIndex = 0, EndIndex = 0, Offset = 0;
	byte OneCharBmp[32];
	byte ConvertBmp[28];
	byte Matrix[256];
	byte temp[4];
	char tempbyte[2];
	DWORD index = 0, oldindex = 0;
	int i, j;
	int CharCount = BmfFileLength / 32;
	for(i = 0; i < CharCount; i++)
	{
		for(; *pTxtFileData != NULL; pTxtFileData++)
		{
			if (*pTxtFileData == 0x0a)
			{
				memcpy(temp, pTxtFileData + 1, 4);
				pTxtFileData = pTxtFileData + 4;
				break;
			}
		}

		oldindex = index;
		index = 0;
		index = index | (ASCII2Int(temp[0]) << 12) | (ASCII2Int(temp[1]) << 8) | (ASCII2Int(temp[2]) << 4) | ASCII2Int(temp[3]);
		memset(temp, 0, 4);

		if (index < m_StartIndex || index > m_EndIndex)
		{
			continue;
		}

		if (BeginIndex == 0)
		{
			BeginIndex = index;
		}
		if (EndIndex == 0)
		{
			EndIndex = index;
		}
		if (index - oldindex > 1)				//the index is not continuous
		{
			EndIndex = oldindex;
		}

		//write index to .txt
		if (index - oldindex != 1)				//the index is not continuous
		{	
			if (BeginIndex <= EndIndex)
			{
				fprintf(pConvertedTxtFile, "{0x%04x,0x%04x,0x%04x},\n", BeginIndex, EndIndex, Offset);
			}
			if (BeginIndex == EndIndex)
			{
				Offset++;
			}
			else
			{
				Offset = Offset + EndIndex - BeginIndex + 1;
				if (Offset < 0)
				{
					Offset = 0;
				}
			}
			BeginIndex = index;				
		}

		//write matrix data to .bmf
		fseek(pBmfFile, i * 32, 0);
		fread(OneCharBmp, 1, 32, pBmfFile);
//			memcpy(OneCharBmp, pBmfFileData + i * 32, 32);
		Bmp2Bin(OneCharBmp, Matrix);
		Bin2Bmp(Matrix, ConvertBmp);
		for(j = 0; j < sizeof(ConvertBmp); j++)
		{
			fprintf(pConvertedBmfFile, "0x%02x", ConvertBmp[j]);
			fputc(',', pConvertedBmfFile);
		}
		fputc('\n', pConvertedBmfFile);
	}

	//寫最后一行索引表
	EndIndex = index;
	fprintf(pConvertedTxtFile, "{0x%04x,0x%04x,0x%04x},\n", BeginIndex, EndIndex, Offset);
	
	fclose(pBmfFile);
	fclose(pConvertedBmfFile);
	fclose(pConvertedTxtFile);
	delete pBmfFileData;
//	delete pTxtFileData;
	AfxMessageBox("Font convert succeed!", MB_OK | MB_ICONINFORMATION);	
	
	CDialog::OnOK();
}

int CFontConvertDlg::ASCII2Int(byte asic)
{
	int number;
	if (asic >= '0' && asic <= '9')
	{
		number =  asic - '0';
	}
	else
	{
		switch(asic)
		{
		case 'a':
			number = 10;
			break;
		case 'b':
			number = 11;
			break;
		case 'c':
			number = 12;
			break;
		case 'd':
			number = 13;
			break;
		case 'e':
			number = 14;
			break;
		case 'f':
			number = 15;
			break;
		default:
			break;
		}
	}
	return number;
}

void CFontConvertDlg::Bmp2Bin(byte resource[], byte destine[])
{
	memset(destine, 0, 256);
	int i;
	for(i = 0; i < 256; i++)
	{
		if (ReverseByte(resource[i/8]) & (0x01 << (i % 8)))
		{
			destine[i] = 1;
		}
	}
}

byte CFontConvertDlg::ReverseByte(byte a)
{
	byte b = 0;
	int i;
	for(i = 0; i < 8; i++)
	{
		if (a & (0x01 << i))
		{
			b = b | 0x01 << (7 - i);
		}
	}
	return b;
}

void CFontConvertDlg::Bin2Bmp(byte resource[], byte destine[])
{
	int x, y, i, byteindex, bitindex;
	memset(destine, 0, 28);
	for(i = 0; i < 256; i++)
	{
		if (resource[i])
		{
			x = i % 16;
			y = i / 16;
			if (x >= 14 || y >= 14)			//cut the rect of 16*16 into 14*14
			{
				continue;
			}
			if (y <= 7)						//the upper line
			{
				byteindex = x;
				bitindex = y;
			}
			else
			{
				byteindex = x + 14;			//the down line
				bitindex = y - 8;
			}
			destine[byteindex] = destine[byteindex] | (0x01 << bitindex);
		}
	}
}

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
欧美一级免费大片| 国产精品主播直播| 欧美体内she精视频| 亚洲综合区在线| 欧洲精品视频在线观看| 午夜久久久久久电影| 欧美一级淫片007| 精品一区二区三区在线播放 | 911精品国产一区二区在线| 亚洲小说春色综合另类电影| 欧美日本一区二区在线观看| 日本不卡不码高清免费观看| 久久综合九色综合97_久久久| 国产精品 欧美精品| 自拍偷在线精品自拍偷无码专区| 在线中文字幕不卡| 欧美aⅴ一区二区三区视频| 精品国产伦一区二区三区免费| 豆国产96在线|亚洲| 亚洲一区视频在线| 精品国产在天天线2019| 成人av网站免费| 婷婷成人激情在线网| 久久综合九色综合久久久精品综合| 成人精品视频一区二区三区 | 欧美日本一区二区三区| 老司机午夜精品99久久| 中文字幕欧美日韩一区| 欧美日韩一区在线| 国产精品99久久久久久宅男| 亚洲欧洲综合另类| 日韩欧美一级二级三级| 99热这里都是精品| 蜜臀a∨国产成人精品| 国产精品全国免费观看高清| 欧美精品在线观看一区二区| 成人国产精品免费观看动漫| 日韩国产欧美一区二区三区| 国产精品国产三级国产aⅴ无密码 国产精品国产三级国产aⅴ原创 | 国产日韩欧美精品综合| 成人精品国产福利| 青青草原综合久久大伊人精品| 精品国产91乱码一区二区三区| 99久久久免费精品国产一区二区| 蜜桃视频一区二区| 亚洲狠狠爱一区二区三区| 国产亚洲欧美日韩俺去了| 欧美日韩成人激情| 色94色欧美sute亚洲线路一ni | 久久精品一区四区| 欧美精品自拍偷拍| 91黄视频在线| 99久久婷婷国产综合精品电影 | 在线成人免费视频| 91丝袜高跟美女视频| 国产成人午夜片在线观看高清观看| 午夜国产不卡在线观看视频| 综合激情成人伊人| 国产丝袜欧美中文另类| 精品国产一区二区三区四区四| 欧美精品日韩精品| 91久久线看在观草草青青| 成人午夜短视频| 国产精品影视在线| 精品在线一区二区三区| 蜜臀a∨国产成人精品| 婷婷成人综合网| 亚洲成人在线网站| 亚洲午夜私人影院| 亚洲最大成人综合| 亚洲伦理在线免费看| 国产精品不卡视频| 中文一区二区完整视频在线观看| 2017欧美狠狠色| 久久色成人在线| 国产亚洲精品超碰| 国产亚洲综合在线| 国产精品色哟哟| 中文字幕av一区二区三区免费看| 久久综合久久久久88| 久久久不卡影院| 国产无人区一区二区三区| 久久精品视频一区二区三区| 久久久精品tv| 国产精品成人一区二区艾草 | 国产精品一区二区在线观看不卡| 狂野欧美性猛交blacked| 美国毛片一区二区三区| 九九视频精品免费| 国产精品一区二区不卡| 成人精品国产免费网站| 91论坛在线播放| 欧美日韩精品一区二区在线播放| 欧美色中文字幕| 3d成人动漫网站| 2017欧美狠狠色| 国产精品国产三级国产普通话蜜臀 | 3d成人动漫网站| 欧美精品粉嫩高潮一区二区| 91精品在线麻豆| 久久这里只有精品视频网| 国产欧美精品区一区二区三区| 国产精品乱人伦| 亚洲一区中文在线| 激情综合色播激情啊| 福利一区二区在线| 欧美在线制服丝袜| 欧美成人猛片aaaaaaa| 国产精品伦理在线| 亚洲大片精品永久免费| 国产一区二区伦理| 日本久久精品电影| 精品久久人人做人人爽| 亚洲欧美在线高清| 日韩va欧美va亚洲va久久| 国产成人午夜精品影院观看视频 | 91精品国产品国语在线不卡| 337p日本欧洲亚洲大胆精品 | 久久久久久亚洲综合影院红桃| 中文字幕亚洲综合久久菠萝蜜| 天堂av在线一区| www.在线欧美| 欧美大尺度电影在线| 国产精品第13页| 久久er99热精品一区二区| 94-欧美-setu| 久久综合色综合88| 夜夜爽夜夜爽精品视频| 国产精品夜夜爽| 91精品国产综合久久精品| 中文字幕欧美一| 韩国三级在线一区| 欧美日韩国产天堂| 亚洲欧美影音先锋| 国模套图日韩精品一区二区| 欧美日韩中文字幕一区二区| 国产日韩欧美亚洲| 久久国产精品99久久久久久老狼| 色av成人天堂桃色av| 国产日韩欧美一区二区三区乱码 | 国产日韩欧美高清| 天堂蜜桃一区二区三区| 99riav久久精品riav| 欧美精品一区二区三区四区 | 日韩精品一区二区三区视频播放| 亚洲视频综合在线| 国产成人在线视频播放| 欧美电影免费观看高清完整版| 亚洲图片有声小说| 91免费精品国自产拍在线不卡| 国产肉丝袜一区二区| 九一久久久久久| 欧美第一区第二区| 日韩1区2区日韩1区2区| 欧美色图12p| 亚洲一区二区视频| 色国产综合视频| 亚洲男人的天堂在线观看| 成人av在线一区二区| 国产欧美日韩卡一| 国产成人免费在线观看不卡| 日韩欧美一二三四区| 另类综合日韩欧美亚洲| 日韩亚洲欧美中文三级| 麻豆91精品视频| 日韩欧美国产一二三区| 美女被吸乳得到大胸91| 精品久久久久久久久久久久久久久久久| 亚洲成av人片一区二区三区| 欧美日韩另类一区| 天天综合色天天| 91精品黄色片免费大全| 麻豆成人久久精品二区三区红| 日韩视频在线观看一区二区| 久久av老司机精品网站导航| 2024国产精品| 国产精品123| 国产精品福利影院| 色婷婷亚洲精品| 亚洲成a人片综合在线| 67194成人在线观看| 激情综合网天天干| 日韩激情av在线| 日韩午夜激情视频| 国产精品1024| 亚洲欧美日韩久久| 7799精品视频| 国产精品538一区二区在线| 国产精品天天看| 日本韩国精品一区二区在线观看| 亚洲成人av电影| 亚洲精品一区在线观看| 99久久国产综合精品女不卡| 一区二区三区电影在线播| 91精品视频网| 国产一区二区三区免费播放| 综合久久综合久久| 91精品国产乱码| 国产iv一区二区三区| 亚洲综合激情网|