Пример #1
0
FX_BOOL CFX_Font::LoadFile(IFX_FileRead* pFile)
{
    m_bEmbedded = FALSE;
    FXFT_Library library;
    if (CFX_GEModule::Get()->GetFontMgr()->m_FTLibrary == NULL) {
        FXFT_Init_FreeType(&CFX_GEModule::Get()->GetFontMgr()->m_FTLibrary);
    }
    library = CFX_GEModule::Get()->GetFontMgr()->m_FTLibrary;
    FXFT_Stream stream = NULL;
    if (!_LoadFile(library, &m_Face, pFile, &stream)) {
        return FALSE;
    }
    m_pOwnedStream = stream;
    FXFT_Set_Pixel_Sizes(m_Face, 0, 64);
    return TRUE;
}
Пример #2
0
FX_BOOL CFX_Font::LoadFile(IFX_FileRead* pFile,
                           int nFaceIndex,
                           int* pFaceCount) {
  m_bEmbedded = FALSE;

  CFX_FontMgr* pFontMgr = CFX_GEModule::Get()->GetFontMgr();
  pFontMgr->InitFTLibrary();
  FXFT_Library library = pFontMgr->GetFTLibrary();

  FXFT_Stream stream = nullptr;
  if (!_LoadFile(library, &m_Face, pFile, &stream, nFaceIndex))
    return FALSE;

  if (pFaceCount)
    *pFaceCount = (int)m_Face->num_faces;
  m_pOwnedStream = stream;
  FXFT_Set_Pixel_Sizes(m_Face, 0, 64);
  return TRUE;
}
Пример #3
0
CConfigFileReader::CConfigFileReader(const char* filename)
{
	m_config_map = new map<string, string>;
	_LoadFile(filename);
}
Пример #4
0
void KGT_g_OpenIniFileFromArgumentsTest::Test_ErrorInput()
{
    int nResult = true;
    int nRetCode = false;

    int i = 0;
    int j = 0;
    int nErrorIndex = 0;
    int nPrevSpace = 0;
    int nArgc = 0;
    char szArgv[10][IIniFile::INI_MAX_SUPPORT_SECTION_AND_KEY_SIZE];
    IIniFile *piIniFile = NULL;
    char *pszArgv[10] = {0};

    nRetCode = _LoadFile();
    KG_PROCESS_ERROR(nRetCode);

    ASSERT(m_szErrorInput[0]);

    i = 0;
    while (m_szErrorInput[i] != '\0')
    {
        nArgc = 0;
        ZeroMemory(szArgv, sizeof(szArgv));
        nPrevSpace = i;
        while (m_szErrorInput[i] != '\n' && m_szErrorInput[i] != '\0')
        {
            if (m_szErrorInput[i] == ' ')
            {
                strncpy(szArgv[nArgc], m_szErrorInput + nPrevSpace, i - nPrevSpace);

                szArgv[nArgc][i - nPrevSpace] = '\0';
                pszArgv[nArgc] = szArgv[nArgc];
                nArgc++;
                nPrevSpace = i;
            }
            i++;
        }
        //最后一个空格到'\n'或'\0'
        strncpy(szArgv[nArgc], m_szErrorInput + nPrevSpace, i - nPrevSpace);
        szArgv[nArgc][i - nPrevSpace] = '\0';
        pszArgv[nArgc] = szArgv[nArgc];
        nArgc++;
        i++;
        nPrevSpace = i;

        if (nArgc == 0)
            continue;
        
        piIniFile = g_OpenIniFileFromArguments(nArgc, pszArgv);
        if (!piIniFile)
        {  
            ASSERT(nErrorIndex < sizeof(g_pcszErrorMessage) / sizeof(g_pcszErrorMessage[0]));
            printf("%s\n", g_pcszErrorMessage[nErrorIndex]);
            nResult = false;
        }
        nRetCode = piIniFile->GetSectionCount();
        if (nRetCode != 0)
        {
            ASSERT(nErrorIndex < sizeof(g_pcszErrorMessage) / sizeof(g_pcszErrorMessage[0]));
            printf("%s\n", g_pcszErrorMessage[nErrorIndex]);    
            nResult = false;
        }
        KG_COM_RELEASE(piIniFile);
        nErrorIndex++;
    }

/*    printf("%d\n", nErrorIndex);*/
Exit0:
    CPPUNIT_ASSERT(nResult);
}
Пример #5
0
CConfigFileReader::CConfigFileReader(const char* filename)
{
	_LoadFile(filename);
}
Пример #6
0
/** @brief Load and analyze the XML configuration file
* @remarks CoInitialize or CoInitializeEx must be called before (use MSXML)
* @param _sFileName the full path name of an existing file
*/
bool MenuCommandSetCfg::Load(const std::string& _sFileName)
{
	return _LoadFile(_sFileName);
}