mirror of
https://github.com/JakubMelka/PDF4QT.git
synced 2025-06-05 21:59:17 +02:00
Text to speech engine implementation
This commit is contained in:
@ -225,7 +225,8 @@ qt_libraries.files = $$[QT_INSTALL_BINS]/Qt?Widgets$${SUFFIX}.dll \
|
||||
$$[QT_INSTALL_BINS]/Qt?Core$${SUFFIX}.dll \
|
||||
$$[QT_INSTALL_BINS]/Qt?WinExtras$${SUFFIX}.dll \
|
||||
$$[QT_INSTALL_BINS]/Qt?Svg$${SUFFIX}.dll \
|
||||
$$[QT_INSTALL_BINS]/Qt?PrintSupport$${SUFFIX}.dll
|
||||
$$[QT_INSTALL_BINS]/Qt?PrintSupport$${SUFFIX}.dll \
|
||||
$$[QT_INSTALL_BINS]/Qt?TextToSpeech$${SUFFIX}.dll
|
||||
qt_libraries.path = $$DESTDIR/install
|
||||
INSTALLS += qt_libraries
|
||||
|
||||
@ -240,3 +241,8 @@ INSTALLS += qt_plugin_iconengine
|
||||
qt_plugin_printsupport.files = $$[QT_INSTALL_PLUGINS]/printsupport/windowsprintersupport$${SUFFIX}.dll
|
||||
qt_plugin_printsupport.path = $$DESTDIR/install/printsupport
|
||||
INSTALLS += qt_plugin_printsupport
|
||||
|
||||
qt_plugin_texttospeech.files = $$[QT_INSTALL_PLUGINS]/texttospeech/qtexttospeech_sapi$${SUFFIX}.dll
|
||||
qt_plugin_texttospeech.path = $$DESTDIR/install/texttospeech
|
||||
INSTALLS += qt_plugin_texttospeech
|
||||
|
||||
|
@ -272,7 +272,7 @@ using PDFTextFlows = std::vector<PDFTextFlow>;
|
||||
|
||||
/// This class represents a portion of continuous text on the page. It can
|
||||
/// consists of multiple blocks (which follow reading order).
|
||||
class PDFTextFlow
|
||||
class PDFFORQTLIBSHARED_EXPORT PDFTextFlow
|
||||
{
|
||||
public:
|
||||
|
||||
@ -294,6 +294,9 @@ public:
|
||||
/// \param expression Regular expression to be matched
|
||||
PDFFindResults find(const QRegularExpression& expression) const;
|
||||
|
||||
/// Returns whole text for this text flow
|
||||
QString getText() const { return m_text; }
|
||||
|
||||
/// Returns text form character pointers
|
||||
/// \param begin Begin character
|
||||
/// \param end End character
|
||||
@ -327,7 +330,7 @@ private:
|
||||
|
||||
/// Text layout of single page. Can handle various fonts, various angles of lines
|
||||
/// and vertically oriented text. It performs the "docstrum" algorithm.
|
||||
class PDFTextLayout
|
||||
class PDFFORQTLIBSHARED_EXPORT PDFTextLayout
|
||||
{
|
||||
public:
|
||||
explicit PDFTextLayout();
|
||||
@ -498,4 +501,6 @@ private:
|
||||
|
||||
} // namespace pdf
|
||||
|
||||
Q_DECLARE_OPERATORS_FOR_FLAGS(pdf::PDFTextFlow::FlowFlags)
|
||||
|
||||
#endif // PDFTEXTLAYOUT_H
|
||||
|
@ -445,6 +445,32 @@ inline QColor invertColor(QColor color)
|
||||
return QColor::fromRgbF(r, g, b, a);
|
||||
}
|
||||
|
||||
/// Performs linear interpolation of interval [x1, x2] to interval [y1, y2],
|
||||
/// using formula y = y1 + (x - x1) * (y2 - y1) / (x2 - x1), transformed
|
||||
/// to formula y = k * x + q, where q = y1 - x1 * k and
|
||||
/// k = (y2 - y1) / (x2 - x1).
|
||||
template<typename T>
|
||||
class PDFLinearInterpolation
|
||||
{
|
||||
public:
|
||||
constexpr inline PDFLinearInterpolation(T x1, T x2, T y1, T y2) :
|
||||
m_k((y2 - y1) / (x2 - x1)),
|
||||
m_q(y1 - x1 * m_k)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
/// Maps value from x interval to y interval
|
||||
constexpr inline T operator()(T x) const
|
||||
{
|
||||
return m_k * x + m_q;
|
||||
}
|
||||
|
||||
private:
|
||||
T m_k;
|
||||
T m_q;
|
||||
};
|
||||
|
||||
} // namespace pdf
|
||||
|
||||
#endif // PDFUTILS_H
|
||||
|
Reference in New Issue
Block a user