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
|
||||
|
@ -57,6 +57,8 @@ private slots:
|
||||
|
||||
void on_actionRendering_Errors_triggered();
|
||||
|
||||
void on_actionGenerateCMAPrepository_triggered();
|
||||
|
||||
private:
|
||||
void onActionOpenTriggered();
|
||||
void onActionCloseTriggered();
|
||||
|
@ -59,10 +59,17 @@
|
||||
</property>
|
||||
<addaction name="actionRendering_Errors"/>
|
||||
</widget>
|
||||
<widget class="QMenu" name="menuDeveloper">
|
||||
<property name="title">
|
||||
<string>Developer</string>
|
||||
</property>
|
||||
<addaction name="actionGenerateCMAPrepository"/>
|
||||
</widget>
|
||||
<addaction name="menuFile"/>
|
||||
<addaction name="menuView"/>
|
||||
<addaction name="menuGoTo"/>
|
||||
<addaction name="menuTools"/>
|
||||
<addaction name="menuDeveloper"/>
|
||||
</widget>
|
||||
<widget class="QToolBar" name="mainToolBar">
|
||||
<attribute name="toolBarArea">
|
||||
@ -154,6 +161,11 @@
|
||||
<string>Ctrl+E</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="actionGenerateCMAPrepository">
|
||||
<property name="text">
|
||||
<string>Generate CMAP repository</string>
|
||||
</property>
|
||||
</action>
|
||||
</widget>
|
||||
<layoutdefault spacing="6" margin="11"/>
|
||||
<resources/>
|
||||
|
Reference in New Issue
Block a user