Esempio n. 1
0
bool StringComposer::readSpecificsFromFile(const std::string & fileName, float textureSize)
{
    m_characterSpecifics.clear();
    
    std::ifstream file(fileName);
    
    if (!file.good()) {
        glow::debug() << "Could not open " << fileName;
        return false;
    }
    
    std::string line;
    getline(file, line);
    
    glow::debug() << "Reading info of font" << findFontName(line);

    getline(file, line); //Additional line ...

    while (getline(file, line))
        parseCharacterLine(line, textureSize);
    
    file.close();
    
    return true;
}
Esempio n. 2
0
ScFace gtAction::validateFont(gtFont* font)
{
	// Dirty hack for family Times New Roman
	if (font->getFamily() == "Times New")
	{
		font->setFamily("Times New Roman");
		if (font->getWeight() == "Roman")
			font->setWeight("Regular");
	}

	QString useFont = font->getName();
	if ((useFont.isNull()) || (useFont.isEmpty()))
		useFont = textFrame->itemText.defaultStyle().charStyle().font().scName();
	else if (prefsManager->appPrefs.fontPrefs.AvailFonts[font->getName()].isNone())
	{
		bool found = false;
		// Do not empty otherwise user may be asked to replace an empty font 
		// by font replacement dialog
		// useFont = "";
		QString tmpName = findFontName(font);
		if (!tmpName.isEmpty())
		{
			useFont = tmpName;
			found = true;
		}
		if (!found)
		{
			if (font->getSlant() == gtFont::fontSlants[ITALIC])
			{
				gtFont* tmp = new gtFont(*font);
				tmp->setSlant(OBLIQUE);
				tmpName = findFontName(tmp);
				if (!tmpName.isEmpty())
				{
					useFont = tmpName;
					found = true;
				}
				delete tmp;
			}
			else if (font->getSlant() == gtFont::fontSlants[OBLIQUE])
			{
				gtFont* tmp = new gtFont(*font);
				tmp->setSlant(ITALIC);
				tmpName = findFontName(tmp);
				if (!tmpName.isEmpty())
				{
					useFont = tmpName;
					found = true;
				}
				delete tmp;
			}
			if (!found)
			{
				if (!prefsManager->appPrefs.fontPrefs.GFontSub.contains(font->getName()))
				{
					MissingFont *dia = new MissingFont(0, useFont, textFrame->doc());
					dia->exec();
					useFont = dia->getReplacementFont();
					prefsManager->appPrefs.fontPrefs.GFontSub[font->getName()] = useFont;
					delete dia;
				}
				else
					useFont = prefsManager->appPrefs.fontPrefs.GFontSub[font->getName()];
			}
		}
	}

	if(!textFrame->doc()->UsedFonts.contains(useFont))
		textFrame->doc()->AddFont(useFont);
	return prefsManager->appPrefs.fontPrefs.AvailFonts[useFont];
}
Esempio n. 3
-1
File: font.cpp Progetto: Try/Tempest
void Tempest::FontElement::init(const Str &name, int sz ) {
  key.name = findFontName(name);
  key.size = sz;

  lt = ft().letterBox[key];
  if( !lt ){
    lt = new Leters();
    ft().letterBox[key] = lt;
    }
  }