fix bug 1285 (selecting font properly in the prefs combo)

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@7354 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
John Levon 2003-07-23 23:13:53 +00:00
parent 6b67e6829a
commit 192f2c94b2
2 changed files with 19 additions and 1 deletions

View File

@ -1,3 +1,9 @@
2003-07-24 John Levon <levon@movementarian.org>
* QPrefs.C: make sure to correctly split a default
lyxrc font for finding the font in the combo box
(bug 1285)
2003-07-23 Angus Leeming <leeming@lyx.org>
* QExternal.C (apply, update_contents):

View File

@ -342,7 +342,7 @@ void setComboxFont(QComboBox * cb, string const & family, string const & foundry
}
}
// Try matching without foundary name
// Try matching without foundry name
// We count in reverse in order to prefer the Xft foundry
for (int i = cb->count() - 1; i >= 0; --i) {
@ -353,6 +353,18 @@ void setComboxFont(QComboBox * cb, string const & family, string const & foundry
}
}
// family alone can contain e.g. "Helvetica [Adobe]"
pair<string, string> tmpfam = parseFontName(family);
// We count in reverse in order to prefer the Xft foundry
for (int i = cb->count() - 1; i >= 0; --i) {
pair<string, string> tmp = parseFontName(fromqstr(cb->text(i)));
if (compare_no_case(tmp.first, tmpfam.first) == 0) {
cb->setCurrentItem(i);
return;
}
}
// Bleh, default fonts, and the names couldn't be found. Hack
// for bug 1063. Qt makes baby Jesus cry.