[go: up one dir, main page]

Menu

[80c337]: / lurchtextobject.h  Maximize  Restore  History

Download this file

87 lines (57 with data), 2.3 kB

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
#ifndef LURCHTEXTOBJECT_H
#define LURCHTEXTOBJECT_H
#include <QTextObjectInterface>
#include <QCache>
#include <QSvgRenderer>
#include "Interface.h"
#include "lob.h"
#include "texengine.h"
const int LTO_FORMAT_KEY = QTextFormat::UserProperty+0x010000;
class QtMmlWidget;
class QTextDocument;
class QTextFormat;
class QPainter;
class QRectF;
class QSizeF;
class LurchEnvironment;
class LurchTextObject : public QObject, public QTextObjectInterface
{
Q_OBJECT
Q_INTERFACES( QTextObjectInterface )
public:
enum { FormatCode = QTextFormat::UserObject+0x0100 };
LurchTextObject ( QFont defaultFont );
~LurchTextObject ();
void setEnvironment ( LurchEnvironment* environment );
QSizeF intrinsicSize ( QTextDocument *doc, int posInDocument,
const QTextFormat &format );
void drawObject ( QPainter *painter, const QRectF &rect, QTextDocument *doc,
int posInDocument, const QTextFormat &format );
int descent ( const QTextFormat &format, int fullImageHeight = -1,
bool includeMagnificationFactor = true ); // in pixels
bool updateLobRepresentation ( const Lob& L, QTextDocument* document,
bool force = false );
void setMagnification ( qreal factor );
QString formatToHTML ( const QTextFormat& format );
signals:
// emitted when computation of a typeset math expression was queued for
// background processing, and thus not actually done yet. in such cases, an
// empty image is returned for use in the document, but this signal is
// emitted so that the application knows to check back soon for when the
// asynchronous typesetting is complete, to get the real typeset image.
void deferredTypesetting ();
private:
QString formatToString ( const QTextFormat& format, bool forceRecompute = false );
QPicture formatToPicture ( const QTextFormat& format );
blahtex::Interface blahi;
QtMmlWidget* mathRenderer;
LurchEnvironment* env;
qreal magFactor;
static QCache<QString,QPicture> cache;
static QMap<QString,float> percentBelowBaseline;
TeXEngine te;
QSvgRenderer* svgRenderer;
QFont documentFont;
int lastScaleFactor;
};
#endif // LURCHTEXTOBJECT_H