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

List:       kde-devel
Subject:    [Patch] khtml/konqueror:   rendering (BR#40588)
From:       Torsten Kasch <tk () Genetik ! Uni-Bielefeld ! DE>
Date:       2002-08-16 7:27:06
[Download RAW message or body]

Hi,

as noted at the end of BR#40588, there is still a problem with the
rendering of non-breaking spaces on Solaris systems: in various form
elements, & nbsp; is rendered as a small square if the selected font
doesn't provide an appropriate symbol which makes the affected text
difficult to read.

The effect can be seen e.g. on the http://bugs.kde.org/ pages which make
use of nbsp's in various combo-boxes (using konqueror on Solaris).

The first patch (against kdelibs-3.0.6/khtml/rendering/render_form.cpp)
attached to this mail fixes this by replacing every 0xa0 character with
a real space. Perhaps this should depend on the selected font as it is
done in kdelibs/khtml/rendering/font.cpp (from where i took the code
for this patch), but, assuming that the affected form elements consist
always of only one line of text, this should not be a problem, I think.

The second patch (against kdebase-3.0.6/konqueror/konq_frame.cc) does
practically the same for Konqueror's window title (and therefore kicker's
windowlist).

This effect can be seen on the (German) pages of the "Heise Newsticker"
discussion forum, e.g. on
http://www.heise.de/newsticker/foren/go.shtml?read=1&msg_id=2158540&forum_id=32623

It would be nice if someone could have a look at the diffs (and perhaps
even apply them?) if they are ok that way. If not, you'll let me know,
im sure... ;-)

cheers,
	Torsten

-- 
   Torsten Kasch                               tk@Genetik.Uni-Bielefeld.DE
        Biologie VI/Zentrum f. Genomforschung
        Universität Bielefeld                  Phone: +49 521 106-4828
        D-33594 Bielefeld                      Fax:   +49 521 106-5626

["render_form.cpp.udiff" (text/plain)]

--- render_form.cpp	2002/07/01 18:58:37	1.1
+++ render_form.cpp	2002/08/15 16:38:29
@@ -747,15 +747,20 @@
                 if (text.isNull())
                     text = "";
 
+		QString ElemString = QString(text.implementation()->s, text.implementation()->l);
+		QChar *uc = (QChar *)ElemString.unicode();
+		for( int i = 0; i < ElemString.length(); i++ )
+		    if ( (uc+i)->unicode() == 0xa0 )
+			*(uc+i) = ' ';
                 if(m_useListBox) {
-                    QListBoxText *item = new \
QListBoxText(QString(text.implementation()->s, text.implementation()->l)); +          \
QListBoxText *item = new QListBoxText(ElemString);  static_cast<KListBox*>(m_widget)
                         ->insertItem(item, listIndex);
                     item->setSelectable(false);
                 }
                 else
                     static_cast<KComboBox*>(m_widget)
-                        ->insertItem(QString(text.implementation()->s, \
text.implementation()->l), listIndex); +                        \
->insertItem(ElemString, listIndex);  }
             else if (listItems[listIndex]->id() == ID_OPTION) {
                 DOMString text = \
static_cast<HTMLOptionElementImpl*>(listItems[listIndex])->text(); @@ -764,12 +769,18 \
                @@
                 if (listItems[listIndex]->parentNode()->id() == ID_OPTGROUP)
                     text = DOMString("    ")+text;
 
+		QString ElemString = QString(text.implementation()->s, text.implementation()->l);
+		QChar *uc = (QChar *)ElemString.unicode();
+		for( int i = 0; i < ElemString.length(); i++ )
+		    if ( (uc+i)->unicode() == 0xa0 )
+			*(uc+i) = ' ';
+
                 if(m_useListBox)
                     static_cast<KListBox*>(m_widget)
-                        ->insertItem(QString(text.implementation()->s, \
text.implementation()->l), listIndex); +                        \
->insertItem(ElemString, listIndex);  else
                     static_cast<KComboBox*>(m_widget)
-                        ->insertItem(QString(text.implementation()->s, \
text.implementation()->l), listIndex); +                        \
->insertItem(ElemString, listIndex);  }
             else
                 KHTMLAssert(false);


["konq_frame.cc.udiff" (text/plain)]

--- konq_frame.cc	2002/07/01 18:54:06	1.1
+++ konq_frame.cc	2002/08/15 15:21:56
@@ -509,6 +509,10 @@
 void KonqFrame::setTitle( QString title , QWidget* /*sender*/)
 {
   kdDebug(1202) << "KonqFrame::setTitle( " << title << " )" << endl;
+  QChar *uc = (QChar *)title.unicode();
+  for( int i = 0; i < title.length(); i++ )
+    if ( (uc+i)->unicode() == 0xa0 )
+      *(uc+i) = ' ';
   if (m_pParentContainer) m_pParentContainer->setTitle( title , this);
 }
 
@@ -698,6 +702,10 @@
 void KonqFrameContainer::setTitle( QString title , QWidget* sender)
 {
   kdDebug(1202) << "KonqFrameContainer::setTitle( " << title << " , " << sender << " \
)" << endl; +  QChar *uc = (QChar *)title.unicode();
+  for( int i = 0; i < title.length(); i++ )
+    if ( (uc+i)->unicode() == 0xa0 )
+      *(uc+i) = ' ';
   if (m_pParentContainer && activeChild() && (sender == activeChild()->widget())) \
m_pParentContainer->setTitle( title , this);  }
 


>> Visit http://mail.kde.org/mailman/listinfo/kde-devel#unsub to unsubscribe <<

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

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