From 192f2c94b2511d4984dd9f74c921fec030f1f705 Mon Sep 17 00:00:00 2001 From: John Levon Date: Wed, 23 Jul 2003 23:13:53 +0000 Subject: [PATCH] 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 --- src/frontends/qt2/ChangeLog | 6 ++++++ src/frontends/qt2/QPrefs.C | 14 +++++++++++++- 2 files changed, 19 insertions(+), 1 deletion(-) diff --git a/src/frontends/qt2/ChangeLog b/src/frontends/qt2/ChangeLog index d0a687d2e0..1131a72075 100644 --- a/src/frontends/qt2/ChangeLog +++ b/src/frontends/qt2/ChangeLog @@ -1,3 +1,9 @@ +2003-07-24 John Levon + + * 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 * QExternal.C (apply, update_contents): diff --git a/src/frontends/qt2/QPrefs.C b/src/frontends/qt2/QPrefs.C index cca79d5b4a..d8d9ef4387 100644 --- a/src/frontends/qt2/QPrefs.C +++ b/src/frontends/qt2/QPrefs.C @@ -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 tmpfam = parseFontName(family); + + // We count in reverse in order to prefer the Xft foundry + for (int i = cb->count() - 1; i >= 0; --i) { + pair 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. -- 2.39.2