Specify the font size for khtml again in pixel to get also the same size as

in the font dialog, if the X-Server doesn't know the screen size.

svn path=/trunk/kdenetwork/kmail/; revision=142245
wilder-work
Michael Haeckel 24 years ago
parent d4a7b0c4be
commit e65a9a9dd1
  1. 2
      about/main.html
  2. 17
      kmreaderwin.cpp
  3. 3
      kmreaderwin.h

@ -4,7 +4,7 @@
<title>Conquer your Desktop!</title>
<link rel="stylesheet" href="konq.css" type="text/css">
<STYLE TYPE="text/css">
body { font-size: %1pt }
body { font-size: %1px }
</STYLE>
</HEAD>

@ -13,6 +13,7 @@
#include <qhbox.h>
#include <qstyle.h>
#include <qtextcodec.h>
#include <qpaintdevicemetrics.h>
#include <kaction.h>
#include <kapplication.h>
@ -589,7 +590,7 @@ void KMReaderWin::displayAboutPage()
} else {
info = info.arg( QString::null );
}
mViewer->write(content.arg(fntSize).arg(info));
mViewer->write(content.arg(pointsToPixel(fntSize), 0, 'f', 5).arg(info));
mViewer->end();
}
@ -683,6 +684,14 @@ void KMReaderWin::sendNextHtmlChunk()
mHtmlTimer.start(0, TRUE);
}
//-----------------------------------------------------------------------------
double KMReaderWin::pointsToPixel(int pointSize)
{
QPaintDeviceMetrics pdm(mViewer->view());
double pixelSize = pointSize;
return pixelSize * pdm.logicalDpiY() / 72;
}
//-----------------------------------------------------------------------------
void KMReaderWin::parseMsg(void)
{
@ -725,10 +734,10 @@ void KMReaderWin::parseMsg(void)
((mPrinting) ? QString("body { font-family: \"%1\"; font-size: %2pt; "
"color: #000000; background-color: #FFFFFF; }\n")
.arg( mBodyFamily ).arg( fntSize )
: QString("body { font-family: \"%1\"; font-size: %2pt; "
: QString("body { font-family: \"%1\"; font-size: %2px; "
"color: %3; background-color: %4; }\n")
.arg( mBodyFamily ).arg( fntSize ).arg(c1.name())
.arg(c4.name())) +
.arg( mBodyFamily ).arg( pointsToPixel(fntSize), 0, 'f', 5 )
.arg(c1.name()) .arg(c4.name())) +
((mPrinting) ? QString("a { color: #000000; text-decoration: none; }")
: QString("a { color: %1; ").arg(c2.name()) +
"text-decoration: none; }" + // just playing

@ -191,6 +191,9 @@ protected:
/** Watch for palette changes */
virtual bool event(QEvent *e);
/** Calculate the pixel size */
double pointsToPixel(int pointSize);
/** Feeds the HTML viewer with the contents of the given message.
HTML begin/end parts are written around the message. */
virtual void parseMsg(void);

Loading…
Cancel
Save