From koffice-devel Sat Dec 08 22:31:04 2001 From: Nicolas Goutte Date: Sat, 08 Dec 2001 22:31:04 +0000 To: koffice-devel Subject: KWord: new font size -1 problem (constructor KWDocument) X-MARC-Message: https://marc.info/?l=koffice-devel&m=100785097601105 I have found a new font size -1 problem. To trigger it the file to be loaded in KWord should not have any element. This does not happend normally with any KWord version. However such files can be generated by quick&dirty programs, like when you test something for an import filter (that's how I found it.) I have found the source of the problem. It is in KWDocument::KWDocument (file kword/kwdoc.cc line 202) The code is (in one line): m_defaultFont.setPointSize( ptToLayoutUnit( QFontInfo(m_defaultFont).pointSize() ) ); A comment just a line before tells that QFontInfo is used not to have the -1 problem. However, it does not change much and a 0 value (instead of -1) is returned by QFontInfo::pointSize(). Therefore the standard style is created with a wrong font size. I suppose that we need something like this instead (not tested): int size=m_defaultFont.pointSize(); if (size==-1) size=int(m_default.pixelSize()* 72.0 / QPaintDevice::x11AppDpiY() + 0.5); m_defaultFont.setPointSize(ptToLayoutUnit(size)); Have a nice day/evening/night! _______________________________________________ koffice-devel mailing list koffice-devel@mail.kde.org http://mail.kde.org/mailman/listinfo/koffice-devel