24 #include <QXmlStreamReader> 26 #include "resolution.h" 62 qreal
angle()
const {
return _angle;};
69 QXmlStreamAttributes
attributes()
const {
return _attributes;};
150 void render(QPainter &painter)
const;
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;
QString language() const
Language of the content of this text box.
The resolution class stores a resolution and converts between units.
int confidence() const
Confidence level.
QImage toImage(const QFont &overrideFont, QImage::Format format=QImage::Format_Grayscale8) const
Export this text box as an image.
QString toText() const
Export this text box as text.
void render(QPainter &painter) const
Paint the contents of the text box to a painter.
QRect boundingBox() const
Bounding box.
QFont suggestFont() const
Suggest font.
QString direction() const
Text flow direction.
QByteArray toRawPDFContentStream(const QFont &font, resolution xRes, resolution yRes, length deltaX=length(), length deltaY=length()) const
Return raw PDF text rendering commands.
Text box, as defined in an HOCR file.
QString classType() const
Class of this textBox.
The length stores a length and converts between units.
bool hasText() const
Decide if the text box contains non-trivial text.
HOCRTextBox()
Constructs an empty text box.
QXmlStreamAttributes attributes() const
Returns the attributes of the textBox.
qint64 estimateFit(const QFont &font) const
Estimate how well a given font fits the textbox.
QString imageName() const
Image associated with content of this text box.
qreal fontSize() const
Font size.
QPoint baselineReferencePoint() const
Base line reference point.
qreal angle() const
Text angle.
Reads and interprets HOCR files, the standard output file format for Optical Character Recognition sy...
QVector< qreal > baselinePolynomial() const
Base line as a polynomial.
QString text() const
Text content of the text box.