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


C++ FontMap类代码示例

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


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

示例1: FreeOpenGLFonts

/**
**  Free OpenGL fonts
*/
void FreeOpenGLFonts()
{
	for (FontMap::iterator it = Fonts.begin(); it != Fonts.end(); ++it) {
		CFont &font = *it->second;

		font.FreeOpenGL();
	}
}
开发者ID:Andrettin,项目名称:Wyrmgus,代码行数:11,代码来源:font.cpp

示例2: ReloadFonts

/**
**  Reload OpenGL fonts
*/
void ReloadFonts()
{
	for (FontMap::iterator it = Fonts.begin(); it != Fonts.end(); ++it) {
		CFont &font = *it->second;

		font.Reload();
	}
}
开发者ID:Andrettin,项目名称:Wyrmgus,代码行数:11,代码来源:font.cpp

示例3: LoadFonts

/**
**  Load all fonts.
*/
void LoadFonts()
{
	for (FontMap::iterator it = Fonts.begin(); it != Fonts.end(); ++it) {
		CFont &font = *it->second;
		font.Load();
	}

	// TODO: remove this
	SmallFont = CFont::Get("small");
	GameFont = CFont::Get("game");
}
开发者ID:Andrettin,项目名称:Wyrmgus,代码行数:14,代码来源:font.cpp

示例4: info

Font *Font::Create(TextFormat &inFormat,double inScale,GlyphRotation inRotation,bool inNative,bool inInitRef)
{
   FontInfo info(inFormat,inScale,inRotation,inNative);

   Font *font = 0;
   FontMap::iterator fit = sgFontMap.find(info);
   if (fit!=sgFontMap.end())
   {
      font = fit->second;
      if (inInitRef)
         font->IncRef();
      return font;
   }


   FontFace *face = 0;
   
   AutoGCRoot *bytes = 0;
   FontBytesMap::iterator fbit = sgRegisteredFonts.find(WideToUTF8(inFormat.font).c_str());
   if (fbit!=sgRegisteredFonts.end())
   {
      bytes = fbit->second;
   }
   
   if (bytes != NULL)
	  face = FontFace::CreateFreeType(inFormat,inScale,bytes);

   if (!face)
      face = FontFace::CreateCFFIFont(inFormat,inScale);

   if (!face && inNative)
      face = FontFace::CreateNative(inFormat,inScale);

   if (!face)
      face = FontFace::CreateFreeType(inFormat,inScale,NULL);
  
   if (!face && !inNative)
      face = FontFace::CreateNative(inFormat,inScale);
 
   if (!face)
        return 0;

   font =  new Font(face,info.height,inRotation,inInitRef);
   // Store for Ron ...
   font->IncRef();
   sgFontMap[info] = font;
   return font;
}
开发者ID:anshpat2826,项目名称:NME,代码行数:48,代码来源:Font.cpp

示例5: CleanFonts

/**
**  Clean up the font module.
*/
void CleanFonts()
{
	for (FontMap::iterator it = Fonts.begin(); it != Fonts.end(); ++it) {
		CFont *font = it->second;

		font->Clean();
		delete font;
	}
	if (UseOpenGL) {
		FontColorGraphics.clear();
	}
	Fonts.clear();

	for (FontColorMap::iterator it = FontColors.begin(); it != FontColors.end(); ++it) {
		delete it->second;
	}
	FontColors.clear();

	SmallFont = NULL;
	GameFont = NULL;
}
开发者ID:stefanhendriks,项目名称:stratagus,代码行数:24,代码来源:font.cpp

示例6: CleanFonts

/**
**  Clean up the font module.
*/
void CleanFonts()
{
	for (FontMap::iterator it = Fonts.begin(); it != Fonts.end(); ++it) {
		CFont *font = it->second;

		font->Clean();
		delete font;
	}
#if defined(USE_OPENGL) || defined(USE_GLES)
	if (UseOpenGL) {
		FontColorGraphics.clear();
	}
#endif
	Fonts.clear();

	for (FontColorMap::iterator it = FontColors.begin(); it != FontColors.end(); ++it) {
		delete it->second;
	}
	FontColors.clear();

	SmallFont = nullptr;
	GameFont = nullptr;
}
开发者ID:Andrettin,项目名称:Wyrmgus,代码行数:26,代码来源:font.cpp

示例7: info

Font *Font::Create(TextFormat &inFormat,double inScale,GlyphRotation inRotation,bool inNative,bool inInitRef)
{
   FontInfo info(inFormat,inScale,inRotation,inNative);

   Font *font = 0;
   FontMap::iterator fit = sgFontMap.find(info);
   if (fit!=sgFontMap.end())
   {
      font = fit->second;
      if (inInitRef)
         font->IncRef();
      return font;
   }


   FontFace *face = 0;

   if (inNative)
      face = FontFace::CreateNative(inFormat,inScale);
   
   #ifndef IPHONE
   if (!face)
      face = FontFace::CreateFreeType(inFormat,inScale);
   #endif
  
   if (!face && !inNative)
      face = FontFace::CreateNative(inFormat,inScale);
 
   if (!face)
        return 0;

   font =  new Font(face,info.height,inRotation,inInitRef);
   // Store for Ron ...
   font->IncRef();
   sgFontMap[info] = font;
   return font;
}
开发者ID:deltaluca,项目名称:Haxe-NME--fork-,代码行数:37,代码来源:Font.cpp

示例8: buffer_begin

/**
 * Create a new paragraph layouter.
 * @param buffer The characters of the paragraph.
 * @param length The length of the paragraph.
 * @param runs   The font mapping of this paragraph.
 */
FallbackParagraphLayout::FallbackParagraphLayout(WChar *buffer, int length, FontMap &runs) : buffer_begin(buffer), buffer(buffer), runs(runs)
{
	assert(runs.End()[-1].first == length);
}
开发者ID:newfang,项目名称:OpenTTD,代码行数:10,代码来源:gfx_layout.cpp

示例9: info

Font *Font::Create(TextFormat &inFormat,double inScale,bool inNative,bool inInitRef)
{
   FontInfo info(inFormat,inScale,inNative);

   Font *font = 0;
   FontMap::iterator fit = sgFontMap.find(info);
   if (fit!=sgFontMap.end())
   {
      font = fit->second;
      if (inInitRef)
         font->IncRef();
      return font;
   }


   FontFace *face = 0;
   
   AutoGCRoot *bytes = 0;
   FontBytesMap::iterator fbit = sgRegisteredFonts.find(WideToUTF8(inFormat.font).c_str());
   if (fbit!=sgRegisteredFonts.end())
   {
      bytes = fbit->second;
   }
   
   if (bytes != NULL)
	  face = FontFace::CreateFreeType(inFormat,inScale,bytes);

   if (!face)
      face = FontFace::CreateCFFIFont(inFormat,inScale);

   if (!face && inNative)
      face = FontFace::CreateNative(inFormat,inScale);

   if (!face)
      face = FontFace::CreateFreeType(inFormat,inScale,NULL);
  
   if (!face && !inNative)
      face = FontFace::CreateNative(inFormat,inScale);
 
   if (!face)
        return 0;

   font =  new Font(face,info.height,inInitRef);
   // Store for Ron ...
   font->IncRef();
   sgFontMap[info] = font;

   // Clear out any old fonts
   for (FontMap::iterator fit = sgFontMap.begin(); fit!=sgFontMap.end();)
   {
      if (fit->second->GetRefCount()==1)
      {
         fit->second->DecRef();
         FontMap::iterator next = fit;
         next++;
         sgFontMap.erase(fit);
         fit = next;
      }
      else
         ++fit;
   }
   
   return font;
}
开发者ID:massiveinteractive,项目名称:lime,代码行数:64,代码来源:Font.cpp

示例10: Object


//.........这里部分代码省略.........
   return mFace->Height();
}


// --- CharGroup ---------------------------------------------

void  CharGroup::UpdateMetrics(TextLineMetrics &ioMetrics)
{
   if (mFont)
      mFont->UpdateMetrics(ioMetrics);
}

int CharGroup::Height()
{ return mFont ? mFont->Height() : 12; }


// --- Create font from TextFormat ----------------------------------------------------





struct FontInfo
{
   FontInfo(const TextFormat &inFormat,double inScale,GlyphRotation inRotation,bool inNative)
   {
      name = inFormat.font;
      height = (int )(inFormat.size*inScale + 0.5);
      flags = 0;
      native = inNative;
      if (inFormat.bold)
         flags |= ffBold;
      if (inFormat.italic)
         flags |= ffItalic;
      rotation = inRotation;
   }

   bool operator<(const FontInfo &inRHS) const
   {
      if (name < inRHS.name) return true;
      if (name > inRHS.name) return false;
      if (height < inRHS.height) return true;
      if (height > inRHS.height) return false;
      if (!native && inRHS.native) return true;
      if (native && !inRHS.native) return false;
      if (rotation < inRHS.rotation) return true;
      if (rotation > inRHS.rotation) return false;
      return flags < inRHS.flags;
   }
   WString      name;
   bool         native;
   int          height;
   unsigned int flags;
   GlyphRotation rotation;
};


typedef std::map<FontInfo, Font *> FontMap;
FontMap sgFontMap;

Font *Font::Create(TextFormat &inFormat,double inScale,GlyphRotation inRotation,bool inNative,bool inInitRef)
{
   FontInfo info(inFormat,inScale,inRotation,inNative);

   Font *font = 0;
   FontMap::iterator fit = sgFontMap.find(info);
   if (fit!=sgFontMap.end())
   {
      font = fit->second;
      if (inInitRef)
         font->IncRef();
      return font;
   }


   FontFace *face = 0;

   if (inNative)
      face = FontFace::CreateNative(inFormat,inScale);
   
   #ifndef IPHONE
   if (!face)
      face = FontFace::CreateFreeType(inFormat,inScale);
   #endif
  
   if (!face && !inNative)
      face = FontFace::CreateNative(inFormat,inScale);
 
   if (!face)
        return 0;

   font =  new Font(face,info.height,inRotation,inInitRef);
   // Store for Ron ...
   font->IncRef();
   sgFontMap[info] = font;
   return font;
}


} // end namespace nme
开发者ID:deltaluca,项目名称:Haxe-NME--fork-,代码行数:101,代码来源:Font.cpp

示例11:

/**
**  Get a font
**
**  @param ident  Font identifier
**
**  @return       The font
*/
/* static */ CFont *CFont::Get(const std::string &ident)
{
	std::map<std::string, CFont *>::iterator it = Fonts.find(ident);
	if (it == Fonts.end()) {
		DebugPrint("font not found: %s\n" _C_ ident.c_str());
		return nullptr;
	}
	CFont *font = it->second;
	if (font == nullptr) {
		DebugPrint("font not found: %s\n" _C_ ident.c_str());
		return nullptr;
	}
	return font;
}
开发者ID:Andrettin,项目名称:Wyrmgus,代码行数:21,代码来源:font.cpp


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