コード例 #1
0
ファイル: Qt_Fonts.cpp プロジェクト: dieface/radium-1
static void set_system_font(QFont font){
  QApplication::setFont(font);
  qApp->setFont(font);

  printf("Raw font name: \"%s\". family name: %s, style: %s\n",font.rawName().toUtf8().constData(),font.family().toUtf8().constData(),font.styleName().toUtf8().constData());

  {
    QFont write_font = font;
#if 0 //FOR_MACOSX
    font.setPointSize(font.pointSize()*72.0/96.0); // macs have dpi of 72, while linux and mac have 96.
#endif    
    SETTINGS_write_string("system_font",write_font.toString());
  }
  
  SETTINGS_write_string("system_font_style",font.styleName()); // toString doesn't seem to cover this.

  {
    struct Tracker_Windows *tvisual = root->song->tracker_windows;
    const QFont &font=QApplication::font();
    QFontMetrics fm(font);
    tvisual->systemfontheight=fm.height();
  }

  foreach (QWidget *widget, QApplication::allWidgets()) {
    updateAllFonts(widget);
    widget->update();
  }
コード例 #2
0
ファイル: qfontproto.cpp プロジェクト: Wushaowei001/xtuple-1
QString QFontProto::rawName() const
{
  QFont *item = qscriptvalue_cast<QFont*>(thisObject());
  if (item)
    return item->rawName();
  return QString();
}
コード例 #3
0
void MainWindow::setFont(QFont font)
{
    ui_.editChinese->setFont(font);
    model_->setChFont(font);

    qDebug() << "Font set to: " << font.rawName() << " " << font.pixelSize() << " px";

    font_ = font;
}
コード例 #4
0
ファイル: setting.cpp プロジェクト: rd8/qGo
QString Setting::fontToString(QFont f)
{
#ifdef Q_WS_X11_xxx
	return f.rawName();
#else
	return f.family() + "-" +
		QString::number(f.pointSize()) + "-" +
		QString::number(f.weight()) + "-" +
		QString::number(f.italic()) + "-" +
		QString::number(f.underline()) + "-" +
		QString::number(f.strikeOut());
#endif
}
コード例 #5
0
ファイル: kresourceman.cpp プロジェクト: kthxbyte/KDE1-Linaro
QString KResourceMan::writeEntry( const QString& rKey, const QFont& rFont )
{
	QString aValue;
#if QT_VERSION > 140
	aValue = rFont.rawName();
	return writeEntry( rKey, aValue );
#endif
	QFontInfo fi( rFont );

	aValue.sprintf( "-*-" );
	aValue += fi.family();
	
	if ( fi.bold() )
		aValue += "-bold";
	else
		aValue += "-medium";
	
	if ( fi.italic() )
		aValue += "-i";
	else
		aValue += "-r";
	
	//
	// For setting font size the code I have commented out here should be
	// correct according to the technical documentation of Qt and X. However, the
	// actual code used below does a better job of matching Qt fonts with X
	// server fonts. MD 8 Apr 98
	//	
	//aValue += "-normal--*-";
	//	
	//QString s;
	//s.sprintf( "%d-*-*-*-*-", 10*fi.pointSize() );
	//aValue += s;
	
	aValue += "-normal-*-";
		
	QString s;
	s.sprintf( "%d-*-*-*-*-*-", fi.pointSize() );
	aValue += s;
	
	switch ( fi.charSet() ) {
		case QFont::Latin1:
			aValue += "iso8859-1";
			break;
		case QFont::AnyCharSet:
		default:
			aValue += "*-*";
			break;
		case QFont::Latin2:
			aValue += "iso8859-2";
			break;
		case QFont::Latin3:
			aValue += "iso8859-3";
			break;
		case QFont::Latin4:
			aValue += "iso8859-4";
			break;
		case QFont::Latin5:
			aValue += "iso8859-5";
			break;
		case QFont::Latin6:
			aValue += "iso8859-6";
			break;
		case QFont::Latin7:
			aValue += "iso8859-7";
			break;
		case QFont::Latin8:
			aValue += "iso8859-8";
			break;
		case QFont::Latin9:
			aValue += "iso8859-9";
			break;
	}
  return writeEntry( rKey, aValue );
}