[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    koffice/filters/kword/rtf/export
From:       Nicolas Goutte <nicolasg () snafu ! de>
Date:       2004-08-04 19:12:05
Message-ID: 20040804191205.070C39A45 () office ! kde ! org
[Download RAW message or body]

CVS commit by goutte: 

Try to use QFontDatabase instead of QFontInfo.
(I am not sure about the result, as it goes not much further than what we had.)

(Also a few changes of comments.)


  M +9 -7      ExportFilter.cc   2.102


--- koffice/filters/kword/rtf/export/ExportFilter.cc  #2.101:2.102
@@ -28,4 +28,5 @@
 #include <qfileinfo.h>
 #include <qfontinfo.h>
+#include <qfontdatabase.h>
 #include <qpicture.h>
 #include <qregion.h> // for #include <kdebugclasses.h>
@@ -918,4 +919,5 @@ void RTFWorker::writeFontData(void)
     *m_streamOut << "{\\fonttbl";
     uint count;
+    QFontDatabase fontDatabase;
     QStringList::ConstIterator it;
     for (count=0, it=m_fontList.begin();
@@ -923,6 +925,5 @@ void RTFWorker::writeFontData(void)
         count++, it++)
     {
-        QFontInfo info(*it);
-        QString strLower(info.family().lower());
+        const QString strLower( (*it).lower() );
         *m_streamOut << "{\\f" << count;
         if ( (strLower.find("symbol")>-1) || (strLower.find("dingbat")>-1) )
@@ -934,5 +935,5 @@ void RTFWorker::writeFontData(void)
         else
         {
-            // We do not know the font type that we have and we cannot even tell if \
it is TrueType +            // We do not know the font type that we have
             *m_streamOut << "\\fnil";
         }
@@ -941,4 +942,5 @@ void RTFWorker::writeFontData(void)
         // QFontInfo:styleHint() does not guess anything, it just returns what is in \
the QFont. Nothing put in, nothing gets out.  {
+            QFontInfo info(*it);
             switch (info.styleHint())
             {
@@ -967,7 +969,7 @@ void RTFWorker::writeFontData(void)
         }
 #endif
-        // ### TODO: check if QFontInfo::fixedPitch is really working
-        *m_streamOut << "\\fprq" << (info.fixedPitch()?1:2) << " "; // font \
                definition
-        *m_streamOut << escapeRtfText(info.family()); // ### TODO: does RTF allows \
brackets in the font names? +        // ### TODO: \fcharset would be mandatory but \
Qt3 does not give us the font charset. :-( +        *m_streamOut << "\\fprq" << ( \
fontDatabase.isFixedPitch( *it ) ? 1 : 2 ) << " "; // font definition +        \
                *m_streamOut << escapeRtfText( *it );
         *m_streamOut <<  ";}" << m_eol; // end font table entry
     }


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic