Ejemplo n.º 1
0
int CGadgetFont::isUnderlined()
{
	LOGFONT info;

	getFontInfo(&info);

	return info.lfUnderline;
}
Ejemplo n.º 2
0
int CGadgetFont::isItalic()
{
	LOGFONT info;

	getFontInfo(&info);

    return info.lfItalic;
}
Ejemplo n.º 3
0
bool FontMan::buildComponent(CPM_ES_CEREAL_NS::CerealCore& core, uint64_t entityID,
                             const std::string& assetName)
{
  uint64_t id = getIDForAsset(assetName.c_str());
  if (id != 0)
  {
    // Go ahead and add a new component for the entityID. If this is the
    // last promise to fulfill, then systems should automatically start
    // rendering the data.
    Font component;
    component.fontID = id;
    core.addComponent(entityID, component);

    // Ensure we look for the texture in the correct directory (the same
    // directory as the font itself).
    std::string::size_type slashIdx = assetName.rfind('/');
    std::string rootAssetName = "";
    if (slashIdx != std::string::npos)
    { 
      rootAssetName = assetName.substr(0, slashIdx + 1);
    }

    TextureMan& texMan = *core.getStaticComponent<StaticTextureMan>()->instance;
    const FontMan::FontInfo& info = getFontInfo(id);
    const BMFont::PageBlock& pageBlock = info.fontInfo.getPageBlock();
    for (size_t i = 0; i < pageBlock.pages.size(); ++i)
    {
      // Extract texture name and replace filename in asset with this
      // texture name? Or should we just replace this asset's file
      // extension and make that the thing?
      std::string textureName = rootAssetName + pageBlock.pages[i];

      // Ensure the texture has the appropriate itx extension.
      std::string::size_type dotIdx = textureName.rfind('.');
      if (dotIdx != std::string::npos)
      {
        textureName = textureName.substr(0, dotIdx);
      }
      textureName += ".itx";

      std::stringstream ss;
      ss << "uTX" << i;
      texMan.loadTexture(core, entityID, textureName, static_cast<int32_t>(i), ss.str());
    }

    return true;
  }
  else
  {
    return false;
  }
}
Ejemplo n.º 4
0
char* CGadgetFont::getFace()
{
	LOGFONT info;
	char*   fontName=new char[32];

	getFontInfo(&info);

	strcpy(fontName,(char*)&info.lfFaceName);

	

	return fontName;
}
Ejemplo n.º 5
0
int CGadgetFont::isBold()
{
	LOGFONT info;

	getFontInfo(&info);

	if (info.lfWeight > FW_NORMAL)
	{
		return 1;
	}
	else
	{
		return 0;
	}
}
Ejemplo n.º 6
0
int CGadgetFont::getSize()
{
	float size;
    HDC screenDC;
	int pixelsPerInch;
	LOGFONT info;

	getFontInfo(&info);

	screenDC=GetDC(GetDesktopWindow());
	pixelsPerInch=GetDeviceCaps(screenDC,LOGPIXELSY);
	ReleaseDC(GetDesktopWindow(),screenDC);

    size=(float)((72.0*abs(info.lfHeight))/pixelsPerInch);
     
	//Counter flooring effect of int division
	int sizeInt=(int)(size+0.5);


	return sizeInt;
}