当前位置: 首页>>代码示例>>C++>>正文


C++ LoadFont函数代码示例

本文整理汇总了C++中LoadFont函数的典型用法代码示例。如果您正苦于以下问题:C++ LoadFont函数的具体用法?C++ LoadFont怎么用?C++ LoadFont使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了LoadFont函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: TryLoadFonts

void TryLoadFonts()
{
    TTFFontSetDescriptor * font = LanguagesDescriptors[gCurrentLanguage].font;
    if (font != FONT_OPENRCT2_SPRITE)
    {
        if (!String::IsNullOrEmpty(gConfigFonts.file_name))
        {
            if (LoadCustomConfigFont())
            {
                return;
            }
            Console::Error::WriteLine("Unable to initialise configured TrueType font -- falling back to Language default.");
        }

        if (LoadFont(font))
        {
            return;
        }
        Console::Error::WriteLine("Unable to initialise prefered TrueType font -- falling back to Arial.");

        if (LoadFont(&TTFFontArial))
        {
            return;
        }
        Console::Error::WriteLine("Unable to initialise prefered TrueType font -- Falling back to sprite font.");
    }
    LoadSpriteFont();
}
开发者ID:YJSoft,项目名称:OpenRCT2,代码行数:28,代码来源:Fonts.cpp

示例2: FGAS_GetFontFamilyHash

CFGAS_GEFont* CFGAS_FontMgr::LoadFont(const FX_WCHAR* pszFontFamily,
                                      uint32_t dwFontStyles,
                                      uint16_t wCodePage) {
  uint32_t dwHash =
      FGAS_GetFontFamilyHash(pszFontFamily, dwFontStyles, wCodePage);
  CFGAS_GEFont* pFont = nullptr;
  if (m_FamilyFonts.Lookup((void*)(uintptr_t)dwHash, (void*&)pFont))
    return pFont ? LoadFont(pFont, dwFontStyles, wCodePage) : nullptr;
  FX_FONTDESCRIPTOR const* pFD =
      FindFont(pszFontFamily, dwFontStyles, true, wCodePage);
  if (!pFD)
    pFD = FindFont(pszFontFamily, dwFontStyles, false, wCodePage);
  if (!pFD)
    return nullptr;

  if (wCodePage == 0xFFFF)
    wCodePage = FX_GetCodePageFromCharset(pFD->uCharSet);
  pFont =
      CFGAS_GEFont::LoadFont(pFD->wsFontFace, dwFontStyles, wCodePage, this);
  if (!pFont)
    return nullptr;

  m_Fonts.Add(pFont);
  m_FamilyFonts.SetAt((void*)(uintptr_t)dwHash, (void*)pFont);
  dwHash = FGAS_GetFontHashCode(wCodePage, dwFontStyles);
  m_CPFonts.SetAt((void*)(uintptr_t)dwHash, (void*)pFont);
  return LoadFont(pFont, dwFontStyles, wCodePage);
}
开发者ID:documentcloud,项目名称:pdfium,代码行数:28,代码来源:cfgas_fontmgr.cpp

示例3: InitFonts

void InitFonts()
{
	LoadFont("Courier New", &fonts[0], 10, FW_NORMAL, "default");
	LoadFont("Courier New", &fonts[1], 14, FW_NORMAL, "log_screen");
	LoadFont("Times New Roman", &fonts[2], 14, FW_BOLD, "debug");
	LoadFont("Courier New", &fonts[3], 10, FW_NORMAL, "star");
}
开发者ID:lightsgoout,项目名称:interview,代码行数:7,代码来源:openorion.cpp

示例4: FGAS_GetFontHashCode

CFGAS_GEFont* CFGAS_StdFontMgrImp::GetDefFontByCodePage(
    uint16_t wCodePage,
    uint32_t dwFontStyles,
    const FX_WCHAR* pszFontFamily) {
  uint32_t dwHash = FGAS_GetFontHashCode(wCodePage, dwFontStyles);
  CFGAS_GEFont* pFont = nullptr;
  if (m_CPFonts.Lookup((void*)(uintptr_t)dwHash, (void*&)pFont)) {
    return pFont ? LoadFont(pFont, dwFontStyles, wCodePage) : nullptr;
  }
  FX_FONTDESCRIPTOR const* pFD =
      FindFont(pszFontFamily, dwFontStyles, TRUE, wCodePage);
  if (!pFD)
    pFD = FindFont(nullptr, dwFontStyles, TRUE, wCodePage);
  if (!pFD)
    pFD = FindFont(nullptr, dwFontStyles, FALSE, wCodePage);
  if (!pFD)
    return nullptr;

  pFont =
      CFGAS_GEFont::LoadFont(pFD->wsFontFace, dwFontStyles, wCodePage, this);
  if (pFont) {
    m_Fonts.Add(pFont);
    m_CPFonts.SetAt((void*)(uintptr_t)dwHash, (void*)pFont);
    dwHash = FGAS_GetFontFamilyHash(pFD->wsFontFace, dwFontStyles, wCodePage);
    m_FamilyFonts.SetAt((void*)(uintptr_t)dwHash, (void*)pFont);
    return LoadFont(pFont, dwFontStyles, wCodePage);
  }
  return nullptr;
}
开发者ID:endlessm,项目名称:chromium-browser,代码行数:29,代码来源:fgas_stdfontmgr.cpp

示例5: ASSERT

CFGAS_GEFont* CFGAS_StdFontMgrImp::LoadFont(IFX_Stream* pFontStream,
                                            const FX_WCHAR* pszFontAlias,
                                            uint32_t dwFontStyles,
                                            uint16_t wCodePage,
                                            FX_BOOL bSaveStream) {
  ASSERT(pFontStream && pFontStream->GetLength() > 0);
  CFGAS_GEFont* pFont = nullptr;
  if (m_StreamFonts.Lookup((void*)pFontStream, (void*&)pFont)) {
    if (pFont) {
      if (pszFontAlias) {
        uint32_t dwHash =
            FGAS_GetFontFamilyHash(pszFontAlias, dwFontStyles, wCodePage);
        m_FamilyFonts.SetAt((void*)(uintptr_t)dwHash, (void*)pFont);
      }
      return LoadFont(pFont, dwFontStyles, wCodePage);
    }
  }
  pFont = CFGAS_GEFont::LoadFont(pFontStream, this, bSaveStream);
  if (pFont) {
    m_Fonts.Add(pFont);
    m_StreamFonts.SetAt((void*)pFontStream, (void*)pFont);
    if (pszFontAlias) {
      uint32_t dwHash =
          FGAS_GetFontFamilyHash(pszFontAlias, dwFontStyles, wCodePage);
      m_FamilyFonts.SetAt((void*)(uintptr_t)dwHash, (void*)pFont);
    }
    return LoadFont(pFont, dwFontStyles, wCodePage);
  }
  return nullptr;
}
开发者ID:endlessm,项目名称:chromium-browser,代码行数:30,代码来源:fgas_stdfontmgr.cpp

示例6: CGlyphCache

bool CTextRenderer::Init()
{	
	//Cleaning
	for(int i=0; i<m_Fonts.size(); i++)
		delete m_Fonts[i];
	
	for(int i=0; i<m_GlyphCaches.size(); i++)
		delete m_GlyphCaches[i];
	
	m_Fonts.clear();
	m_GlyphCaches.clear();
	
	//Init caches
	m_GlyphCaches.set_size(NUM_FONT_SIZES);
	for(int i=0; i<m_GlyphCaches.size(); i++)
	{
		m_GlyphCaches[i] = new CGlyphCache(Kernel());
		m_GlyphCaches[i]->Init(s_aFontSizes[i]);
	}
	
	//Load FreeType
	if(FT_Init_FreeType(&m_FTLibrary) != FT_Err_Ok)
		return false;
	
	//Load Font
	if(!LoadFont("fonts/DejaVuSans.ttf"))
		return false;
	LoadFont("fonts/NotoSansCJKjp-Medium.ttf");
	
	return true;
}
开发者ID:teeworlds-modapi,项目名称:teeworlds,代码行数:31,代码来源:textrenderer.cpp

示例7: TTF_Init

FontManager::FontManager()
{
	TTF_Init();
	TTF_Font *pScriptFont = LoadFont("script",96);
	mFontData.insert(std::pair<std::string,TTF_Font*>("script",pScriptFont));
	TTF_Font *pAirStrike = LoadFont("airstrike",56);
	mFontData.insert(std::pair<std::string,TTF_Font*>("airstrike",pAirStrike));
	TTF_Font *pOrange = LoadFont("orange",56);
	mFontData.insert(std::pair<std::string,TTF_Font*>("orange",pOrange));
}
开发者ID:suenting,项目名称:ProjectWalker,代码行数:10,代码来源:FontManager.cpp

示例8: Init

// ****************************************************************************************
//	Init
// ****************************************************************************************
void Resources::Init()
{
	// load all
	_pFontDebug		=LoadFont("Data/Verdana60.fnt", 0.4f);
	_pFontScore		=LoadFont("Data/Bauhaus93.fnt");
	_pFontTitle		=LoadFont("Data/Bauhaus93.fnt");
	_pFontMenus		=LoadFont("Data/Verdana60.fnt", 0.5f);
	_pFontMessages	=LoadFont("Data/Lucida70.fnt");

// 	_BallTexture =hge->Texture_Load("Data/TennisBall3.png");
// 	_pSpriteBall =new hgeSprite(_BallTexture,0,0,16,16);
// 	_pSpriteBall->SetHotSpot(8,8);

	const Float32 TileSize =32.0f;
	const Int32 x=3;
	const Int32 y=2;
	_TexBall =hge->Texture_Load("Data/particles.png");
	_pSpriteBall =new hgeSprite(_TexBall, x*TileSize, y*TileSize, TileSize, TileSize);
	_pSpriteBall->SetHotSpot(16,16);

	_pSpriteBallTrail =new hgeSprite(*_pSpriteBall);

	_texPowerBar =hge->Texture_Load("Data/PowerBar.png");

	_texRacketTrail =hge->Texture_Load("Data/RacketTrail.png");
	_pSpriteRacketTrail =new hgeSprite(_texRacketTrail, 0.0f, 0.0f, 16.0f, 16.0f);
	_pSpriteRacketTrail->SetBlendMode(BLEND_COLORADD);

	// ---- help ----
	_texPadXbox =hge->Texture_Load("Data/Common_Controller_NoStick.png");
	const Int32 nPadXboxSizeX =hge->Texture_GetWidth(_texPadXbox, true);
	const Int32 nPadXboxSizeY =hge->Texture_GetHeight(_texPadXbox, true);
	_pSpritePadXbox	=new hgeSprite(_texPadXbox, 0, 0, (Float32)nPadXboxSizeX, (Float32)nPadXboxSizeY);
	_pSpritePadXbox->SetHotSpot((Float32)(nPadXboxSizeX/2), (Float32)(nPadXboxSizeY/2));

	_texPadStick =hge->Texture_Load("Data/Stick.png");
	const Int32 nPadStickSizeX =hge->Texture_GetWidth(_texPadStick, true);
	const Int32 nPadStickSizeY =hge->Texture_GetHeight(_texPadStick, true);
	_pSpritePadStick	=new hgeSprite(_texPadStick, 0, 0, (Float32)nPadStickSizeX, (Float32)nPadStickSizeY);
	_pSpritePadStick->SetHotSpot((Float32)(nPadStickSizeX/2), (Float32)(nPadStickSizeY/2));

	// ---- AUDIO ---
	Audio& audio =Otb::GetInstance()->GetAudio();
	_hsBoing 			=audio.SampleLoad("Data/snd/player_bounce3.wav");
	_hsShoot 			=audio.SampleLoad("Data/snd/shine_reject2.wav");
	_hsNetHit			=audio.SampleLoad("Data/snd/bang1.wav");
	_hsRacketFlap		=audio.SampleLoad("Data/snd/flap.wav");
	_hsMenuChangeItem	=audio.SampleLoad("Data/snd/menu.wav");
	_hsZion				=audio.SampleLoad("Data/snd/zion.wav");
	_hsMenuValidate		=audio.SampleLoad("Data/snd/bedroom_switch_a.wav");
	_hsMenuCancel		=audio.SampleLoad("Data/snd/bedroom_switch_b.wav");
}
开发者ID:speedoog,项目名称:off-the-ball,代码行数:55,代码来源:Resources.cpp

示例9: LoadDatafile

void Game_sys::LoadDatafiles()
{
	//LOAD ALL THE DATAFILES
    backgrounds = LoadDatafile( "Datafiles/backgrounds.dat" );
    bgmusic = LoadDatafile( "Datafiles/bgmusic.dat" );
    s_samples = LoadDatafile( "Datafiles/samples.dat" );
    playerSprites = LoadDatafile( "Datafiles/playerSprites.dat" );
    evilBubbleSprites = LoadDatafile( "Datafiles/evilBubbleSprites.dat" );

    interfaceFont = LoadFont("Fonts/interfaceFont.pcx");
    titleFont = LoadFont("Fonts/titlesFont.pcx");

}
开发者ID:BozhidarHrusanov,项目名称:Small_projects,代码行数:13,代码来源:game_sys.cpp

示例10: LoadFont

Font::Font(const char *filename)
{
    m_texture = NULL;
    m_characters.resize(256);

    LoadFont(filename);
}
开发者ID:GrimwadeN,项目名称:AIEProjects-StarterTemplate,代码行数:7,代码来源:Font.cpp

示例11: name

/*
==============================
idFont::idFont
==============================
*/
idFont::idFont( const char* n ) : name( n )
{
	fontInfo = NULL;
	alias = RemapFont( n );
	
	if( alias != NULL )
	{
		// Make sure we don't have a circular reference
		for( idFont* f = alias; f != NULL; f = f->alias )
		{
			if( f == this )
			{
				idLib::FatalError( "Font alias \"%s\" is a circular reference!", n );
			}
		}
		return;
	}
	
	if( !LoadFont() )
	{
		if( name.Icmp( DEFAULT_FONT ) == 0 )
		{
			idLib::FatalError( "Could not load default font \"%s\"", DEFAULT_FONT );
		}
		else
		{
			idLib::Warning( "Could not load font %s", n );
			alias = renderSystem->RegisterFont( DEFAULT_FONT );
		}
	}
}
开发者ID:Yetta1,项目名称:OpenTechBFG,代码行数:36,代码来源:Font.cpp

示例12: LoadFont

Label::Label(const sf::String& text, unsigned int size, const sf::Vector2f& pos, float rot) {
	LoadFont();
	m_Text.setString(text);
	m_Text.setCharacterSize(size);
	setPosition(pos);
	setRotation(rot);
}
开发者ID:LexRudera,项目名称:CMCNext-RPG,代码行数:7,代码来源:Label.cpp

示例13: main

int main(int argc, char* argv[])
{
	if(argc != 4)
	{
		std::cout<<"ERROR: missing parameters."<<std::endl;
		system("PAUSE");
		return 0;
	}
	gInputFile = std::string(argv[1]);
	gFontFile = std::string(argv[2]);
	gSize = atoi(argv[3]);
	SDL_Init(SDL_INIT_EVERYTHING);
	TTF_Init();
	pFont = LoadFont(gFontFile,gSize);
	std::string line;
	std::ifstream iFile (gInputFile);
	if (iFile.is_open())
	{
		while ( getline (iFile,line) )
		{
			SDL_Surface *pSurface = GetSurface(line);
			SDL_SaveBMP(pSurface,(std::string(line)+".bmp").c_str());
			SDL_FreeSurface(pSurface);
		}
		iFile.close();
	}
	TTF_CloseFont(pFont);
	return 0;
}
开发者ID:suenting,项目名称:TextToImage,代码行数:29,代码来源:TextToImage.cpp

示例14: LoadFont

 bool LoadFont(const bfs::path && path, const std::string & font)
 {
     if(bfs::exists(path))
     {
         if( is_regular_file(path) )
         {
             if(path.filename() == font)
             {
                 sf::Font * f = new sf::Font();
                 f->loadFromFile(path.string());
                 loaded_fonts[const_cast<std::string&>(font)] = f;
                 return true;
             }
         }
         if( is_directory(path) )
         {
             std::vector<bfs::path> ls_path;
             std::copy(bfs::directory_iterator(path), bfs::directory_iterator(), std::back_inserter(ls_path));
             for(auto it = ls_path.begin(); it != ls_path.end(); ++it)
             {
                 if( LoadFont(std::move(*it), font) ) return true;
             }
         }
     }
     return false;
 }
开发者ID:gergondet,项目名称:bci-interface,代码行数:26,代码来源:FontManager.cpp

示例15: ScrLoadFontTable

VOID
ScrLoadFontTable(UINT32 CodePage)
{
    PHYSICAL_ADDRESS BaseAddress;
    PUCHAR Bitplane;
    PUCHAR FontBitfield = NULL;
    NTSTATUS Status = STATUS_SUCCESS;

    FontBitfield = (PUCHAR) ExAllocatePoolWithTag(NonPagedPool, 2048, TAG_BLUE);
    if(FontBitfield)
    {
        /* open bit plane for font table access */
        OpenBitPlane();

        /* get pointer to video memory */
        BaseAddress.QuadPart = BITPLANE_BASE;
        Bitplane = (PUCHAR)MmMapIoSpace (BaseAddress, 0xFFFF, MmNonCached);

        Status = ExtractFont(CodePage, FontBitfield);
        if (NT_SUCCESS(Status))
            LoadFont(Bitplane, FontBitfield);

        MmUnmapIoSpace(Bitplane, 0xFFFF);
        ExFreePool(FontBitfield);

        /* close bit plane */
        CloseBitPlane();
    }
}
开发者ID:RareHare,项目名称:reactos,代码行数:29,代码来源:font.c


注:本文中的LoadFont函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。