Example #1
0
FontFacePtr Widget::getDefaultFontFace()
{
    auto font = getDefaultFont();
    if (!font)
        return nullptr;

    return font->getDefaultFace();
}
int GUIFontManager::getCharacterWidth(char Char, int fontIndex)
{
  GUIFont *currentFont = getFont(fontIndex);
  currentFont          = currentFont ? currentFont : getDefaultFont();
  if(currentFont)
    return  currentFont->getFontObject()->getCharHorizontalGlyphs()[Char];  

  return 0;
}
	void ResourceManager::init() {
		mIO = Engine::GetIO();

		loadDefaultPlugins();

		Engine::out(Engine::INFO) << "[ResourceManager] Adding default font" << std::endl;
		sf::Font* f = new sf::Font(getDefaultFont());
		add(f, "default");
	}
Example #4
0
void TextWidget::setTextFont(int fontIndex)
{
	if (myFontIndex != fontIndex)
	{
		myFontIndex = fontIndex;
		myText.setFont(getDefaultFont(fontIndex));
		invalidateVertices();
		onTextResize();
	}
}
int GUIFontManager::getCharacterWidth(char Char, GUIFont *font)
{
  GUIFont *currentFont = getDefaultFont();
  if(!font)
  {
    if(currentFont)
      return  currentFont->getFontObject()->getCharHorizontalGlyphs()[Char];  
  }
  else
    return font->getFontObject()->getCharHorizontalGlyphs()[Char];
  return 0;
}
Example #6
0
void TextWidget::loadTextFont()
{
	if (!myText.hasFont())
	{
		myText.setFont(getDefaultFont(myFontIndex));

		if (myText.hasFont())
		{
			invalidateVertices();
			onLoadFont();
		}
	}
}
Example #7
0
qreal ModuleInterface::getFontSizeForLanguage(const QString& language)
{
    auto lang = getLanguageFromEnglishName(language);
    if (lang) {
        BtConfig::FontSettingsPair fontPair = btConfig().getFontForLanguage(*lang);
        if (fontPair.first) {
            QFont font = fontPair.second;
            int fontPointSize = font.pointSize();
            return fontPointSize;
        }
    }
    qreal pointSize = getDefaultFont().pointSizeF();
    return pointSize;
}
Example #8
0
QString ModuleInterface::getFontNameForLanguage(const QString& language)
{
    auto lang = getLanguageFromEnglishName(language);
    if (lang) {
        BtConfig::FontSettingsPair fontPair = btConfig().getFontForLanguage(*lang);
        if (fontPair.first) {
            QFont font = fontPair.second;
            QString fontFamily = font.family();
            return fontFamily;
        }
    }
    QString fontFamily = getDefaultFont().family();
    return fontFamily;
}
Example #9
0
void Menu::updateMenu()
{
	if (myIsMenuInvalid)
	{
		myMenuWidth = 0.f;
		float yPos = cvPadding * 2.f;

		myTexts.resize(myModel->getItemCount());

		for (std::size_t i = 0; i < myModel->getItemCount(); ++i)
		{
			if (!myTexts[i])
			{
				myTexts[i].reset(new btx::BitmapText);
			}

			btx::BitmapText & text = *myTexts[i];

			if (!text.hasFont())
			{
				text.setFont(getDefaultFont(Application::FontDefault));
			}


			text.setPosition(25.f, yPos);

			if (myModel->isSeparator(i))
			{
				text.setText("");
				yPos += cvPadding * 2.f;
			}
			else
			{
				text.setText(myModel->getItem(i));
				yPos += cvItemHeight;
			}

			text.setColor(myModel->isEnabled(i) ? sf::Color::White : sf::Color(128, 128, 128));

			myMenuWidth = std::max(text.getPosition().x + text.getSize().x + cvPadding * 4.f, myMenuWidth);

			yPos += cvPadding;
		}

		setSize(getSize().x, yPos);
		updateSize();

		myIsMenuInvalid = false;
	}
}
Example #10
0
void TextLayer::setDefaultFontSettings(QTextDocument *document)
{
	document->setDefaultFont(getDefaultFont());
}
Example #11
0
std::shared_ptr<const BitmapFont> Widget::getDefaultFont() const
{
	//return onGetFont(Application::FontDefault);
	return getDefaultFont(Application::FontDefault);
}