Re: Using reasonable Qt font defaults (was: lyx crash)
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 On Dienstag, 18. Mai 2004 03:59, John Levon wrote: On Tue, May 18, 2004 at 01:42:58AM +0200, Kornel Benko wrote: The patch I am using now without any crash is attached. The selected fonts may have some unwanted default value, but at least you are then able to select your own font with the lyx-UI. Hmm, that's interesting. Why would fromqstr() help us here? It is not fromqstr() helping. It is only, that QFontInfo(font).family().latin1() returned NULL under gdb-controll, while fromqstr(QFontInfo(font).family()) did not. There was also a discussion with a patch for a similar problem about half a year ago, but I do not remember on which of the lyx-lists. I tried myself to find a working function to get what latin1() was supposed to. Looking on the qt-sources it seemed to me fromqstr() would be ok. It worked here, but I remained quiet, as nobody else had a problem with screen-fonts. This patch can safely go in I think, so if it works, it works, but it's still curious. john Kornel - -- Kornel Benko [EMAIL PROTECTED] -BEGIN PGP SIGNATURE- Version: GnuPG v1.2.2 (GNU/Linux) iD8DBQFAqdHLjEH+780+qtIRAt2JAKCJVsemtieKPhTftya38sVOnRQgVgCeK2i0 lo1nsMOsLtR4IAhVcGXukEs= =nHxp -END PGP SIGNATURE-
Re: Using reasonable Qt font defaults (was: lyx crash)
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 On Dienstag, 18. Mai 2004 03:59, John Levon wrote: > On Tue, May 18, 2004 at 01:42:58AM +0200, Kornel Benko wrote: > > > The patch I am using now without any crash is attached. The selected fonts may > > have some unwanted default value, but at least you are then able to select your > > own font with the lyx-UI. > > Hmm, that's interesting. Why would fromqstr() help us here? It is not fromqstr() helping. It is only, that "QFontInfo(font).family().latin1()" returned NULL under gdb-controll, while "fromqstr(QFontInfo(font).family())" did not. There was also a discussion with a patch for a similar problem about half a year ago, but I do not remember on which of the lyx-lists. I tried myself to find a working function to get what latin1() was supposed to. Looking on the qt-sources it seemed to me fromqstr() would be ok. It worked here, but I remained quiet, as nobody else had a problem with screen-fonts. > This patch can safely go in I think, so if it works, it works, but it's > still curious. > > john > Kornel - -- Kornel Benko [EMAIL PROTECTED] -BEGIN PGP SIGNATURE- Version: GnuPG v1.2.2 (GNU/Linux) iD8DBQFAqdHLjEH+780+qtIRAt2JAKCJVsemtieKPhTftya38sVOnRQgVgCeK2i0 lo1nsMOsLtR4IAhVcGXukEs= =nHxp -END PGP SIGNATURE-
Using reasonable Qt font defaults (was: lyx crash)
Maurizio == Maurizio Monge [EMAIL PROTECTED] writes: Maurizio Hello. I compiled lyx cvs (lyx-devel) on and amd64-pc-linux, Maurizio with gcc-3.4, latest binutils and qt font-end (qt-3.3.2). Maurizio I get: Maurizio terminate called after throwing an instance of Maurizio 'std::logic_error' what(): basic_string::_S_construct NULL Maurizio not valid Aborted The problem seems to be related to the use of the sans font family which is unknown from qt. Could you try the attached patch which has been send by Kornel Benko a while ago? Before applying this patch, though, I would like to understand why we have those font values now, and why they do not work. Anyone has ideas? JMarc Index: src/frontends/qt2/lyx_gui.C === RCS file: /cvs/lyx/lyx-devel/src/frontends/qt2/lyx_gui.C,v retrieving revision 1.59 diff -u -p -r1.59 lyx_gui.C --- src/frontends/qt2/lyx_gui.C 2003/11/05 10:49:07 1.59 +++ src/frontends/qt2/lyx_gui.C 2004/01/03 16:31:07 @@ -287,8 +287,9 @@ string const roman_font_name() QFont font; font.setStyleHint(QFont::Serif); - font.setFamily(serif); - return QFontInfo(font).family().latin1(); + font.setFamily(Times New Roman); + const char *x = QFontInfo(font).family().latin1(); + return x?x:; } @@ -299,8 +300,9 @@ string const sans_font_name() QFont font; font.setStyleHint(QFont::SansSerif); - font.setFamily(sans); - return QFontInfo(font).family().latin1(); + font.setFamily(Arial); + const char *x = QFontInfo(font).family().latin1(); + return x?x:; } @@ -311,8 +313,9 @@ string const typewriter_font_name() QFont font; font.setStyleHint(QFont::TypeWriter); - font.setFamily(monospace); - return QFontInfo(font).family().latin1(); + font.setFamily(Courier); + const char *x = QFontInfo(font).family().latin1(); + return x?x:; } }; // namespace lyx_gui
Re: Using reasonable Qt font defaults (was: lyx crash)
On Mon, May 17, 2004 at 03:14:42PM +0200, Jean-Marc Lasgouttes wrote: The problem seems to be related to the use of the sans font family which is unknown from qt. Could you try the attached patch which has been send by Kornel Benko a while ago? It looks wrong. For starters, these default aliases should exist on any sane Qt system using Xft. Secondly, even if they don't exist, the created font should change to a default, NOT return a NULL. Something is badly wrong... john
Re: Using reasonable Qt font defaults (was: lyx crash)
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 On Montag, 17. Mai 2004 15:14, Jean-Marc Lasgouttes wrote: Maurizio == Maurizio Monge [EMAIL PROTECTED] writes: Maurizio Hello. I compiled lyx cvs (lyx-devel) on and amd64-pc-linux, Maurizio with gcc-3.4, latest binutils and qt font-end (qt-3.3.2). Maurizio I get: Maurizio terminate called after throwing an instance of Maurizio 'std::logic_error' what(): basic_string::_S_construct NULL Maurizio not valid Aborted The problem seems to be related to the use of the sans font family which is unknown from qt. Could you try the attached patch which has been send by Kornel Benko a while ago? Before applying this patch, though, I would like to understand why we have those font values now, and why they do not work. Anyone has ideas? JMarc The patch I am using now without any crash is attached. The selected fonts may have some unwanted default value, but at least you are then able to select your own font with the lyx-UI. Kornel - -- Kornel Benko [EMAIL PROTECTED] -BEGIN PGP SIGNATURE- Version: GnuPG v1.2.2 (GNU/Linux) iD8DBQFAqU4IjEH+780+qtIRAgE6AKCLvL9LQMmT47qFK9YLgyihRGq9fgCdGdWd OhOaXcQ07gncW95MqJ3L/qE= =q8HG -END PGP SIGNATURE- Index: lyx_gui.C === RCS file: /cvs/lyx/lyx-devel/src/frontends/qt2/lyx_gui.C,v retrieving revision 1.62 diff -u -p -r1.62 lyx_gui.C --- lyx_gui.C 2004/04/03 08:37:10 1.62 +++ lyx_gui.C 2004/05/17 23:34:59 @@ -323,7 +323,7 @@ string const roman_font_name() QFont font; font.setStyleHint(QFont::Serif); font.setFamily(serif); - return QFontInfo(font).family().latin1(); + return fromqstr(QFontInfo(font).family()); } @@ -335,7 +335,7 @@ string const sans_font_name() QFont font; font.setStyleHint(QFont::SansSerif); font.setFamily(sans); - return QFontInfo(font).family().latin1(); + return fromqstr(QFontInfo(font).family()); } @@ -347,7 +347,7 @@ string const typewriter_font_name() QFont font; font.setStyleHint(QFont::TypeWriter); font.setFamily(monospace); - return QFontInfo(font).family().latin1(); + return fromqstr(QFontInfo(font).family()); } }; // namespace lyx_gui Index: QPrefs.C === RCS file: /cvs/lyx/lyx-devel/src/frontends/qt2/QPrefs.C,v retrieving revision 1.56 diff -u -p -r1.56 QPrefs.C --- QPrefs.C 2004/04/20 08:51:11 1.56 +++ QPrefs.C 2004/05/17 23:35:00 @@ -409,7 +409,7 @@ void setComboxFont(QComboBox * cb, strin for (int i = 0; i cb-count(); ++i) { lyxerr Looking at fromqstr(cb-text(i)) endl; - if (compare_no_case(cb-text(i).latin1(), info.family().latin1()) == 0) { + if (compare_no_case(fromqstr(cb-text(i)), fromqstr(info.family())) == 0) { cb-setCurrentItem(i); return; }
Re: Using reasonable Qt font defaults (was: lyx crash)
On Tue, May 18, 2004 at 01:42:58AM +0200, Kornel Benko wrote: The patch I am using now without any crash is attached. The selected fonts may have some unwanted default value, but at least you are then able to select your own font with the lyx-UI. Hmm, that's interesting. Why would fromqstr() help us here? This patch can safely go in I think, so if it works, it works, but it's still curious. john
Using reasonable Qt font defaults (was: lyx crash)
> "Maurizio" == Maurizio Monge <[EMAIL PROTECTED]> writes: Maurizio> Hello. I compiled lyx cvs (lyx-devel) on and amd64-pc-linux, Maurizio> with gcc-3.4, latest binutils and qt font-end (qt-3.3.2). Maurizio> I get: Maurizio> terminate called after throwing an instance of Maurizio> 'std::logic_error' what(): basic_string::_S_construct NULL Maurizio> not valid Aborted The problem seems to be related to the use of the "sans" font family which is unknown from qt. Could you try the attached patch which has been send by Kornel Benko a while ago? Before applying this patch, though, I would like to understand why we have those font values now, and why they do not work. Anyone has ideas? JMarc Index: src/frontends/qt2/lyx_gui.C === RCS file: /cvs/lyx/lyx-devel/src/frontends/qt2/lyx_gui.C,v retrieving revision 1.59 diff -u -p -r1.59 lyx_gui.C --- src/frontends/qt2/lyx_gui.C 2003/11/05 10:49:07 1.59 +++ src/frontends/qt2/lyx_gui.C 2004/01/03 16:31:07 @@ -287,8 +287,9 @@ string const roman_font_name() QFont font; font.setStyleHint(QFont::Serif); - font.setFamily("serif"); - return QFontInfo(font).family().latin1(); + font.setFamily("Times New Roman"); + const char *x = QFontInfo(font).family().latin1(); + return x?x:""; } @@ -299,8 +300,9 @@ string const sans_font_name() QFont font; font.setStyleHint(QFont::SansSerif); - font.setFamily("sans"); - return QFontInfo(font).family().latin1(); + font.setFamily("Arial"); + const char *x = QFontInfo(font).family().latin1(); + return x?x:""; } @@ -311,8 +313,9 @@ string const typewriter_font_name() QFont font; font.setStyleHint(QFont::TypeWriter); - font.setFamily("monospace"); - return QFontInfo(font).family().latin1(); + font.setFamily("Courier"); + const char *x = QFontInfo(font).family().latin1(); + return x?x:""; } }; // namespace lyx_gui
Re: Using reasonable Qt font defaults (was: lyx crash)
On Mon, May 17, 2004 at 03:14:42PM +0200, Jean-Marc Lasgouttes wrote: > The problem seems to be related to the use of the "sans" font family > which is unknown from qt. Could you try the attached patch which has > been send by Kornel Benko a while ago? It looks wrong. For starters, these default aliases should exist on any sane Qt system using Xft. Secondly, even if they don't exist, the created font should change to a default, NOT return a NULL. Something is badly wrong... john
Re: Using reasonable Qt font defaults (was: lyx crash)
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 On Montag, 17. Mai 2004 15:14, Jean-Marc Lasgouttes wrote: > > "Maurizio" == Maurizio Monge <[EMAIL PROTECTED]> writes: > > Maurizio> Hello. I compiled lyx cvs (lyx-devel) on and amd64-pc-linux, > Maurizio> with gcc-3.4, latest binutils and qt font-end (qt-3.3.2). > > Maurizio> I get: > > Maurizio> terminate called after throwing an instance of > Maurizio> 'std::logic_error' what(): basic_string::_S_construct NULL > Maurizio> not valid Aborted > > The problem seems to be related to the use of the "sans" font family > which is unknown from qt. Could you try the attached patch which has > been send by Kornel Benko a while ago? > > Before applying this patch, though, I would like to understand why we > have those font values now, and why they do not work. Anyone has > ideas? > > JMarc The patch I am using now without any crash is attached. The selected fonts may have some unwanted default value, but at least you are then able to select your own font with the lyx-UI. Kornel - -- Kornel Benko [EMAIL PROTECTED] -BEGIN PGP SIGNATURE- Version: GnuPG v1.2.2 (GNU/Linux) iD8DBQFAqU4IjEH+780+qtIRAgE6AKCLvL9LQMmT47qFK9YLgyihRGq9fgCdGdWd OhOaXcQ07gncW95MqJ3L/qE= =q8HG -END PGP SIGNATURE- Index: lyx_gui.C === RCS file: /cvs/lyx/lyx-devel/src/frontends/qt2/lyx_gui.C,v retrieving revision 1.62 diff -u -p -r1.62 lyx_gui.C --- lyx_gui.C 2004/04/03 08:37:10 1.62 +++ lyx_gui.C 2004/05/17 23:34:59 @@ -323,7 +323,7 @@ string const roman_font_name() QFont font; font.setStyleHint(QFont::Serif); font.setFamily("serif"); - return QFontInfo(font).family().latin1(); + return fromqstr(QFontInfo(font).family()); } @@ -335,7 +335,7 @@ string const sans_font_name() QFont font; font.setStyleHint(QFont::SansSerif); font.setFamily("sans"); - return QFontInfo(font).family().latin1(); + return fromqstr(QFontInfo(font).family()); } @@ -347,7 +347,7 @@ string const typewriter_font_name() QFont font; font.setStyleHint(QFont::TypeWriter); font.setFamily("monospace"); - return QFontInfo(font).family().latin1(); + return fromqstr(QFontInfo(font).family()); } }; // namespace lyx_gui Index: QPrefs.C === RCS file: /cvs/lyx/lyx-devel/src/frontends/qt2/QPrefs.C,v retrieving revision 1.56 diff -u -p -r1.56 QPrefs.C --- QPrefs.C 2004/04/20 08:51:11 1.56 +++ QPrefs.C 2004/05/17 23:35:00 @@ -409,7 +409,7 @@ void setComboxFont(QComboBox * cb, strin for (int i = 0; i < cb->count(); ++i) { lyxerr << "Looking at " << fromqstr(cb->text(i)) << endl; - if (compare_no_case(cb->text(i).latin1(), info.family().latin1()) == 0) { + if (compare_no_case(fromqstr(cb->text(i)), fromqstr(info.family())) == 0) { cb->setCurrentItem(i); return; }
Re: Using reasonable Qt font defaults (was: lyx crash)
On Tue, May 18, 2004 at 01:42:58AM +0200, Kornel Benko wrote: > The patch I am using now without any crash is attached. The selected fonts may > have some unwanted default value, but at least you are then able to select your > own font with the lyx-UI. Hmm, that's interesting. Why would fromqstr() help us here? This patch can safely go in I think, so if it works, it works, but it's still curious. john