Beispiel #1
0
/**
 * Initialise vim to use the font "font_name".  If it's NULL, pick a default
 * font.
 * If "fontset" is TRUE, load the "font_name" as a fontset.
 * Return FAIL if the font could not be loaded, OK otherwise.
 */
int
gui_mch_init_font(char_u *font_name, int do_fontset)
{
	QFont *qf = gui_mch_get_font(font_name, TRUE);
	if ( qf == NULL ) {
		return FAIL;
	}

	QFontMetrics metric( *qf );

	if ( metric.averageCharWidth() != metric.maxWidth() ) {
		qDebug() << "Warning, fake monospace font?";
	}

	gui.norm_font = qf;
	gui.char_width = metric.width("M");
	gui.char_height = metric.height();
	gui.char_ascent = metric.ascent();
	vimshell->setCharWidth(gui.char_width);

	return OK;
}
Beispiel #2
0
/**
 * Initialise vim to use the font "font_name".  If it's NULL, pick a default
 * font.
 * If "fontset" is TRUE, load the "font_name" as a fontset.
 * Return FAIL if the font could not be loaded, OK otherwise.
 */
int
gui_mch_init_font(char_u *font_name, int do_fontset)
{
	QFont *qf = gui_mch_get_font(font_name, FALSE);
	if ( qf == NULL ) {
		return FAIL;
	}

	QFontMetrics metric( *qf );

	if ( VimWrapper::isFakeMonospace(*qf) || getenv("QVIM_DRAW_STRING_SLOW") ) {
		vimshell->setSlowStringDrawing( true );
	} else {
		vimshell->setSlowStringDrawing( false );
	}

	gui.norm_font = qf;
	update_char_metrics(metric);
	vimshell->setCharWidth(gui.char_width);

	return OK;
}