| 2912 | } |
| 2913 | |
| 2914 | void Document::startFontReading() |
| 2915 | { |
| 2916 | if (!d->m_generator || !d->m_generator->hasFeature(Generator::FontInfo) || d->m_fontThread) { |
| 2917 | return; |
| 2918 | } |
| 2919 | |
| 2920 | if (d->m_fontsCached) { |
| 2921 | // in case we have cached fonts, simulate a reading |
| 2922 | // this way the API is the same, and users no need to care about the |
| 2923 | // internal caching |
| 2924 | for (int i = 0; i < d->m_fontsCache.count(); ++i) { |
| 2925 | Q_EMIT gotFont(d->m_fontsCache.at(i)); |
| 2926 | Q_EMIT fontReadingProgress(i / pages()); |
| 2927 | } |
| 2928 | Q_EMIT fontReadingEnded(); |
| 2929 | return; |
| 2930 | } |
| 2931 | |
| 2932 | d->m_fontThread = new FontExtractionThread(d->m_generator, pages()); |
| 2933 | connect(d->m_fontThread, &FontExtractionThread::gotFont, this, [this](const Okular::FontInfo &f) { d->fontReadingGotFont(f); }); |
| 2934 | connect(d->m_fontThread.data(), &FontExtractionThread::progress, this, [this](int p) { d->slotFontReadingProgress(p); }); |
| 2935 | |
| 2936 | d->m_fontThread->startExtraction(/*d->m_generator->hasFeature( Generator::Threaded )*/ true); |
| 2937 | } |
| 2938 | |
| 2939 | void Document::stopFontReading() |
| 2940 | { |
no test coverage detected