mirror of
https://github.com/JakubMelka/PDF4QT.git
synced 2025-06-05 21:59:17 +02:00
CID fonts
This commit is contained in:
@ -24,6 +24,7 @@
|
||||
#include "pdfdrawwidget.h"
|
||||
#include "pdfdrawspacecontroller.h"
|
||||
#include "pdfrenderingerrorswidget.h"
|
||||
#include "pdffont.h"
|
||||
|
||||
#include <QSettings>
|
||||
#include <QFileDialog>
|
||||
@ -303,4 +304,44 @@ void PDFViewerMainWindow::on_actionRendering_Errors_triggered()
|
||||
renderingErrorsDialog.exec();
|
||||
}
|
||||
|
||||
void PDFViewerMainWindow::on_actionGenerateCMAPrepository_triggered()
|
||||
{
|
||||
QStringList files = QFileDialog::getOpenFileNames(this, tr("Select CMAP mapping files"));
|
||||
|
||||
pdf::PDFFontCMapRepository* instance = pdf::PDFFontCMapRepository::getInstance();
|
||||
instance->clear();
|
||||
|
||||
for (const QString& fileName : files)
|
||||
{
|
||||
QFile file(fileName);
|
||||
if (file.open(QFile::ReadOnly))
|
||||
{
|
||||
pdf::PDFFontCMap map = pdf::PDFFontCMap::createFromData(file.readAll());
|
||||
file.close();
|
||||
|
||||
if (map.isValid())
|
||||
{
|
||||
QFileInfo fileInfo(file);
|
||||
instance->add(fileInfo.baseName().toLatin1(), map.serialize());
|
||||
}
|
||||
else
|
||||
{
|
||||
QMessageBox::critical(this, tr("Error"), tr("Invalid CMAP in file '%1'.").arg(fileName));
|
||||
return;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
QMessageBox::critical(this, tr("Error"), tr("File '%1' can't be opened.").arg(fileName));
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
QString repositoryFileName = QFileDialog::getSaveFileName(this, tr("Save CMAP repository to file"));
|
||||
if (!repositoryFileName.isEmpty())
|
||||
{
|
||||
instance->saveToFile(repositoryFileName);
|
||||
}
|
||||
}
|
||||
|
||||
} // namespace pdfviewer
|
||||
|
Reference in New Issue
Block a user