24 #include <QXmlStreamReader>
26 #include "resolution.h"
62 qreal
angle()
const {
return _angle;};
69 QXmlStreamAttributes
attributes()
const {
return _attributes;};
164 QImage
toImage(
const QFont &overrideFont, QImage::Format format=QImage::Format_Grayscale8)
const;
232 QString
text()
const {
return _text;};
236 struct renderingHints {
241 QPoint referencePoint;
244 qreal horizontalStretchFactor;
256 renderingHints getRenderingHints(
const QFont &font)
const;
273 void interpretAttributes(QSet<QString> &warnings, qint64 line, qint64 column);
276 QXmlStreamAttributes _attributes;
279 QList<HOCRTextBox> _subBoxes;
291 QVector<qreal> _baselinePolynomial;
296 QPoint _baselineReferencePoint;
337 QVector<int> getIntegers(
const QString& spec)
const;
341 QVector<qreal> getFloats(
const QString& spec)
const;
346 QByteArray toNumber(qreal x)
const;
Reads and interprets HOCR files, the standard output file format for Optical Character Recognition sy...
Text box, as defined in an HOCR file.
HOCRTextBox()
Constructs an empty text box.
void render(QPainter &painter) const
Paint the contents of the text box to a painter.
qint64 estimateFit(const QFont &font) const
Estimate how well a given font fits the textbox.
QString classType() const
Class of this textBox.
QByteArray toRawPDFContentStream(const QFont &font, resolution xRes, resolution yRes, length deltaX=length(), length deltaY=length()) const
Return raw PDF text rendering commands.
QString toText() const
Export this text box as text.
qreal angle() const
Text angle.
qreal fontSize() const
Font size.
QVector< qreal > baselinePolynomial() const
Base line as a polynomial.
QPoint baselineReferencePoint() const
Base line reference point.
QRect boundingBox() const
Bounding box.
QString text() const
Text content of the text box.
bool hasText() const
Decide if the text box contains non-trivial text.
QString imageName() const
Image associated with content of this text box.
int confidence() const
Confidence level.
QXmlStreamAttributes attributes() const
Returns the attributes of the textBox.
QFont suggestFont() const
Suggest font.
QImage toImage(const QFont &overrideFont, QImage::Format format=QImage::Format_Grayscale8) const
Export this text box as an image.
QString language() const
Language of the content of this text box.
QString direction() const
Text flow direction.
The length stores a length and converts between units.
The resolution class stores a resolution and converts between units.