本文整理汇总了C++中CDWordArray::at方法的典型用法代码示例。如果您正苦于以下问题:C++ CDWordArray::at方法的具体用法?C++ CDWordArray::at怎么用?C++ CDWordArray::at使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CDWordArray
的用法示例。
在下文中一共展示了CDWordArray::at方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: EmbedeedFont
bool
EmbedeedFontMan::AddFont(const std::string sFontFolder, const std::string sFontName){
std::string sDir = sFontFolder;
if( sDir[sDir.length() - 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 ){
std::string sContent;
sContent.resize(nSize);
memcpy((void*)sContent.c_str(), lpContent, nSize);
//memcpy(sContent.GetBufferSetLength(nSize), lpContent, nSize);
CStringArray arrStrings;
StringHelper::Split(&sContent, _T(";"), arrStrings);
std::string sCharCode;
for(int i=0; i<arrStrings.size(); i++){
sCharCode = arrStrings[i];
int nCharCode = 0;
// Hex value
if( sCharCode[0] == '#' )
nCharCode = StringHelper::HexStringIntoInt(&((TCHAR*)sCharCode.c_str())[1], sCharCode.length() - 1);
else
nCharCode = _ttoi(sCharCode.c_str());
pFont->m_arrCharacters.Add((void*)nCharCode, (void*)i);
}
}
else{
#ifdef _DEBUG
std::string sMsg;
stringEx::Format(sMsg, _T("Couldn't find %s"), (sDir + _T("codes.txt")).c_str());
::MessageBox(NULL, sMsg.c_str(), _T("Error"), MB_OK);
#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.size(); i++){
std::string sName = arrFileNames[i];
std::string sName2 = sName;
std::string sFile = sDir + sName;
if( sName.substr(0, sFontName.length()) != sFontName )
continue; // Skip wrong file name.
sName.erase(0, sFontName.length());
stringEx::MakeLower(sName);
int nIndex = 0;
EmbedeedFontItemInfo* pInfo = new EmbedeedFontItemInfo();
pInfo->ZeroInit();
// Bold
if( sName[nIndex] == 'b' ){
pInfo->m_nCharFlags |= EmbedeedFontItemInfo::EMBEDEED_FONT_FLAG_BOLD;
nIndex ++;
}
// Underline
if( sName[nIndex] == 'u' ){
pInfo->m_nCharFlags |= EmbedeedFontItemInfo::EMBEDEED_FONT_FLAG_UNDERLINE;
nIndex ++;
}
// Italic
if( sName[nIndex] == 'i' ){
pInfo->m_nCharFlags |= EmbedeedFontItemInfo::EMBEDEED_FONT_FLAG_ITALIC;
nIndex ++;
}
// Load characters map image and detect characters left offset and width (in pixels). {{
Image* pImage = Image::LoadImage(sFile, -1, -1, false);
if( pImage ){
int nWidthLimit = pImage->GetWidth();
int nWidth = pImage->GetWidth();
int nHeight = pImage->GetHeight();
int nWidthBytes = pImage->GetWidthBytes();
int nSymbolCt = 0;
BYTE* pBits = (BYTE*)pImage->GetBits();
int nXOffset = 0;
int nBPP = pImage->GetBPP()/8;
int nSymbolMostLeftOffset = -1;
int nSymbolMostRightOffset = -1;
//.........这里部分代码省略.........