mirror of
https://invent.kde.org/graphics/okular
synced 2024-08-27 03:30:20 +00:00
fix overlapping text
This commit is contained in:
parent
ed0d146457
commit
9b673d04f1
|
@ -9,6 +9,8 @@
|
|||
|
||||
#include "epubdocument.h"
|
||||
|
||||
#include <QRegExp>
|
||||
|
||||
using namespace Epub;
|
||||
|
||||
namespace {
|
||||
|
@ -64,6 +66,12 @@ int EpubDocument::maxContentWidth() const
|
|||
return pageSize().width() - (2 * padding);
|
||||
}
|
||||
|
||||
void EpubDocument::checkCSS(QString &css)
|
||||
{
|
||||
// remove paragraph line-heights
|
||||
css.remove(QRegExp("line-height\\s*:\\s*[\\w\\.]*;"));
|
||||
}
|
||||
|
||||
QVariant EpubDocument::loadResource(int type, const QUrl &name)
|
||||
{
|
||||
int size;
|
||||
|
@ -80,6 +88,12 @@ QVariant EpubDocument::loadResource(int type, const QUrl &name)
|
|||
resource.setValue(QImage::fromData((unsigned char *)data, size));
|
||||
break;
|
||||
|
||||
case QTextDocument::StyleSheetResource: {
|
||||
QString css = QString::fromUtf8(data);
|
||||
checkCSS(css);
|
||||
resource.setValue(css);
|
||||
break;
|
||||
}
|
||||
default:
|
||||
resource.setValue(QString::fromUtf8(data));
|
||||
break;
|
||||
|
|
|
@ -34,6 +34,8 @@ namespace Epub {
|
|||
virtual QVariant loadResource(int type, const QUrl &name);
|
||||
|
||||
private:
|
||||
void checkCSS(QString &css);
|
||||
|
||||
struct epub *mEpub;
|
||||
KUrl mCurrentSubDocument;
|
||||
|
||||
|
|
Loading…
Reference in a new issue