本文整理汇总了C++中CDWordArray::GetCount方法的典型用法代码示例。如果您正苦于以下问题:C++ CDWordArray::GetCount方法的具体用法?C++ CDWordArray::GetCount怎么用?C++ CDWordArray::GetCount使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CDWordArray
的用法示例。
在下文中一共展示了CDWordArray::GetCount方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: EmbedeedFont
bool
EmbedeedFontMan::AddFont(const CString sFontFolder, const CString sFontName){
CString sDir = sFontFolder;
if( sDir.GetAt(sDir.GetLength() - 1) != '\\' )
sDir += _T("\\");
EmbedeedFont* pFont = new EmbedeedFont();
// Load characters code map. {{
BYTE* lpContent = NULL;
int nSize = 0;
if( Path::ReadFileContent(sDir + _T("codes.txt"), lpContent, nSize) && nSize > 0 ){
CString sContent;
memcpy(sContent.GetBufferSetLength(nSize), lpContent, nSize);
CStringArray arrStrings;
StringHelper::Split(&sContent, _T(";"), arrStrings);
CString sCharCode;
for(int i=0; i<arrStrings.GetCount(); i++){
sCharCode = arrStrings.GetAt(i);
int nCharCode = 0;
// Hex value
if( sCharCode.GetAt(0) == '#' )
nCharCode = StringHelper::HexStringIntoInt(&((TCHAR*)sCharCode.GetBuffer())[1], sCharCode.GetLength() - 1);
else
nCharCode = _ttoi(sCharCode.GetBuffer());
pFont->m_arrCharacters.Add((void*)nCharCode, (void*)i);
}
}
else{
#ifdef _DEBUG
CString sMsg;
sMsg.Format(_T("Couldn't find %s"), sDir + _T("codes.txt"));
AfxMessageBox(sMsg);
#endif
if( lpContent )
delete [] lpContent;
delete pFont;
return false;
}
// }}
if( lpContent ){
delete [] lpContent;
lpContent = NULL;
}
CStringArray arrFileNames;
if( Path::GetFilesByExtention(sDir, _T("*.bmp"), arrFileNames, true) == 0 ){
delete pFont;
return false;
}
for(int i=0; i<arrFileNames.GetCount(); i++){
CString sName = arrFileNames.GetAt(i);
CString sName2 = sName;
CString sFile = sDir + sName;
if( sName.Left(sFontName.GetLength()) != sFontName )
continue; // Skip wrong file name.
sName.Delete (0, sFontName.GetLength());
sName.MakeLower ();
int nIndex = 0;
EmbedeedFontItemInfo* pInfo = new EmbedeedFontItemInfo();
pInfo->ZeroInit();
// Bold
if( sName.GetAt(nIndex) == 'b' ){
pInfo->m_nCharFlags |= EmbedeedFontItemInfo::EMBEDEED_FONT_FLAG_BOLD;
nIndex ++;
}
// Underline
if( sName.GetAt(nIndex) == 'u' ){
pInfo->m_nCharFlags |= EmbedeedFontItemInfo::EMBEDEED_FONT_FLAG_UNDERLINE;
nIndex ++;
}
// Italic
if( sName.GetAt(nIndex) == 'i' ){
pInfo->m_nCharFlags |= EmbedeedFontItemInfo::EMBEDEED_FONT_FLAG_ITALIC;
nIndex ++;
}
// Load characters map image and detect characters left offset and width (in pixels). {{
CImage* pImage = ImageHelper::LoadImage(sFile, -1, -1, false);
if( pImage ){
BITMAP bmImage;
GetObject(*pImage, sizeof(BITMAP), &bmImage);
int nWidthLimit = bmImage.bmWidth;
int nSymbolCt = 0;
BYTE* pBits = (BYTE*)bmImage.bmBits;
int nXOffset = 0;
int nBPP = bmImage.bmBitsPixel/8;
int nSymbolMostLeftOffset = -1;
int nSymbolMostRightOffset = -1;
CDWordArray arrSymbolLeftOffsetAndWidth;
CString sSymbolStartPointAndWidth;
//.........这里部分代码省略.........