[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-devel
Subject: Re: KHTMLW & charsets?
From: Lars Knoll <knoll () mpi-hd ! mpg ! de>
Date: 1999-02-04 4:38:11
[Download RAW message or body]
Sven Radej wrote:
>
> Hi,
>
> Try to open http://www.tzo.com
> For me this page opens with font "fixed" which looks very ugly and incorect.
> Details:
> page has "Content-Type" content="text/html; charset=iso-8859-1" in header
> (http-meta...)
> Later, there are "... font size="5" face="Arial.." tags.
>
> I have Arial fonts thanks to TTF font server. However, even without this I
> should get helvetica fonts, and not fixed.
> Settings:
> Accept languages = C de en hr us
> Accept charsets = us-ascii iso-8859-1 iso-8859-2 windows-1250
> Default Charset = use language charset
> View->Encoding = Auto.
>
> On some pages I can fix the problem with View->Encoding-><Correct encoding>.
> But not on this page.
> I tried to play with Default Charset, no sucess
>
> Sometimes German umlauts are displayed in fixed font too, while the rest of the
> word is ok. This is extremly ugly.
>
> And: I have /usr/sharei18n/ dir whic KCharset requires.
>
> Thanks for any hint.
>
> Sven (who needs this encoding stuff, but knows nothing about it :-( )
Well, I think I finally found the problem. It's actually a bug in qt. It
looks
like QFontInfo::charSet() returns AnyCharSet when it means Latin1 and
vice versa.
Could be just a problem of the sorting order of the enum QFont::CharSet,
which
sets Latin1==0 and AnyCharSet==1 (and then QFontInfo::charSet() doing a
cast from
int to the enum...)
Anyway, here's a workaround for kcharsets.cpp plus a fix in
kcharsetsdata.cpp (fixing
a smaller bug and a memory hole). Could you please test it and tell me
if I should
commit the fix.
Cheers,
Lars
["kcharsets.patch" (text/plain)]
? kcharsets.patch
Index: kcharsets.cpp
===================================================================
RCS file: /home/kde/kdelibs/kdecore/kcharsets.cpp,v
retrieving revision 1.26
diff -u -r1.26 kcharsets.cpp
--- kcharsets.cpp 1998/11/22 14:42:45 1.26
+++ kcharsets.cpp 1999/02/04 04:32:09
@@ -179,7 +179,6 @@
}
QFont &KCharset::setQFont(QFont &fnt){
-
if (!entry) {
warning("KCharset: Wrong charset!\n");
return fnt;
@@ -209,11 +208,18 @@
kchdebug("qtCharset: %i\n",(int)qtCharset());
fnt.setCharSet(qtCharset());
QString family=fnt.family(); //
- if (family=="times") fnt.setFamily("courier"); // workaround for bug
+ if (family=="times") fnt.setFamily("courier"); // workaround for bug
else fnt.setFamily("times"); // in Qt
fnt.setFamily(family); //
QFontInfo fi(fnt);
- if (fi.charSet()!=qtCharset())
+ int ch = fi.charSet();
+#if QT_VERSION==142
+ if( ch == 0 ) ch = 1;
+ if( ch == 1 ) ch = 0;
+#endif
+ if (ch != qtCharset())
+ {
+ kchdebug("didn't get charset: %d <--> %d\n", ch, qtCharset());
if (entry->good_family && !(entry->good_family->isEmpty())){
fnt.setCharSet(qtCharset());
fnt.setFamily(*(entry->good_family));
@@ -225,9 +231,11 @@
fnt.setCharSet(QFont::AnyCharSet);
fnt.setFamily(faceStr);
}
+ }
}
kchdebug("New charset: \"%s\"\n",charsets->name(fnt));
return fnt;
+#undef kchdebug
}
KCharset::operator const KCharsetEntry *()const{
Index: kcharsetsdata.cpp
===================================================================
RCS file: /home/kde/kdelibs/kdecore/kcharsetsdata.cpp,v
retrieving revision 1.24
diff -u -r1.24 kcharsetsdata.cpp
--- kcharsetsdata.cpp 1998/11/22 14:42:47 1.24
+++ kcharsetsdata.cpp 1999/02/04 04:32:10
@@ -694,7 +694,6 @@
}
bool KCharsetsData::charsetOfFace(const KCharsetEntry * charset,const QString &face){
-
kchdebug("Testing if face %s is of charset %s...",(const char *)face,
charset->name);
config->setGroup("faces");
@@ -782,12 +781,11 @@
for(int i = 0; i < numFonts; i++){
qfontname = "";
- qfontname = *fontNames;
+ qfontname = fontNames[i];
int dash = qfontname.find ('-', 1, TRUE); // find next dash
if (dash == -1) { // No such next dash -- this shouldn't happen.
// but what do I care -- lets skip it.
- fontNames ++;
continue;
}
@@ -798,7 +796,6 @@
if (dash == -1) { // No such next dash -- this shouldn't happen.
// But what do I care -- lets skip it.
- fontNames ++;
continue;
}
@@ -806,6 +803,7 @@
qfontname = qfontname.mid(dash +1, dash_two - dash -1);
lst->append(qfontname);
}
+ XFreeFontNames(fontNames);
}
bool KCharsetsData::isDisplayableHack(KCharsetEntry *charset){
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic