This patch adds the basic functionality of ftdump in
ftinspect. More changes/features will be added in
subsequent patches.
Please have a look & suggest the required changes
for refinement of this patch.
Regards,
Ankit
diff --git a/src/ftinspect/engine/engine.cpp b/src/ftinspect/engine/engine.cpp
index 6856beb..43ce423 100644
--- a/src/ftinspect/engine/engine.cpp
+++ b/src/ftinspect/engine/engine.cpp
@@ -401,12 +401,20 @@ Engine::loadFont(int fontIndex,
ftSize = NULL;
curFamilyName = QString();
curStyleName = QString();
+ postscriptName = QString();
+ driverName = QString();
+ issfnt = QString();
+
}
else
{
curFamilyName = QString(ftSize->face->family_name);
curStyleName = QString(ftSize->face->style_name);
+ postscriptName = FT_Get_Postscript_Name(ftSize->face);
+ if( postscriptName == NULL )
+ postscriptName = "UNAVAILABLE";
+
FT_Module module = &ftSize->face->driver->root;
const char* moduleName = module->clazz->module_name;
@@ -415,6 +423,9 @@ Engine::loadFont(int fontIndex,
fontType = FontType_CFF;
else if (!strcmp(moduleName, "truetype"))
fontType = FontType_TrueType;
+
+ driverName = moduleName;
+ issfnt = FT_IS_SFNT( ftSize->face ) ? QString("yes") : QString("no");
}
return numGlyphs;
@@ -459,6 +470,29 @@ Engine::currentStyleName()
return curStyleName;
}
+const QString&
+Engine::currentPostscriptName()
+{
+ return postscriptName;
+}
+
+const QString&
+Engine::DriverName()
+{
+ return driverName;
+}
+
+const QString&
+Engine::issfntwrapped()
+{
+ return issfnt;
+}
+
+FT_Size
+Engine::getftSize()
+{
+ return ftSize;
+}
QString
Engine::glyphName(int index)
diff --git a/src/ftinspect/engine/engine.hpp b/src/ftinspect/engine/engine.hpp
index 175e8db..b49fd1d 100644
--- a/src/ftinspect/engine/engine.hpp
+++ b/src/ftinspect/engine/engine.hpp
@@ -46,6 +46,11 @@ public:
const QString& currentFamilyName();
const QString& currentStyleName();
+ const QString& currentPostscriptName();
+ const QString& DriverName();
+ const QString& issfntwrapped();
+ FT_Size getftSize();
+
QString glyphName(int glyphIndex);
long numberOfFaces(int fontIndex);
int numberOfNamedInstances(int fontIndex,
@@ -81,6 +86,9 @@ private:
QString curFamilyName;
QString curStyleName;
+ QString postscriptName;
+ QString driverName;
+ QString issfnt;
FT_Library library;
FTC_Manager cacheManager;
diff --git a/src/ftinspect/maingui.cpp b/src/ftinspect/maingui.cpp
index 7fd185f..b0e3822 100644
--- a/src/ftinspect/maingui.cpp
+++ b/src/ftinspect/maingui.cpp
@@ -13,6 +13,7 @@
#include <QSettings>
#include FT_DRIVER_H
+#include FT_TRUETYPE_TABLES_H
MainGUI::MainGUI()
@@ -59,6 +60,114 @@ MainGUI::closeEvent(QCloseEvent* event)
event->accept();
}
+void
+MainGUI::showFontName()
+{
+ QMessageBox::about(
+ this,
+ tr("Font Name Entries"),
+ tr("<b> Face number : %1 </b><br><br>"
+ "Family : %2 <br>"
+ "Style : %3 <br>"
+ "Postscript : %4")
+ .arg(fontList.size())
+ .arg(engine->currentFamilyName())
+ .arg(engine->currentStyleName())
+ .arg(engine->currentPostscriptName()));
+}
+
+void
+MainGUI::showFontType()
+{
+ FT_Face face = engine->ftSize->face;
+ const char* fontType;
+ if (FT_IS_SCALABLE( face ) != 0 )
+ { if (FT_HAS_MULTIPLE_MASTERS( face ) != 0 )
+ {
+ fontType = "scalable, multiple masters";
+ }
+ else
+ {
+ fontType = "scalable";
+ }
+ }
+ else if(FT_HAS_FIXED_SIZES( face ) != 0)
+ {
+ fontType = "fixed size";
+ }
+ const char* direction = "" ;
+ if( FT_HAS_HORIZONTAL( face) )
+ {
+ if(FT_HAS_VERTICAL( face ) )
+ direction = " horizontal vertical";
+ else
+ direction = " horizontal";
+ }
+ else
+ {
+ if(FT_HAS_VERTICAL( face ) )
+ direction = " vertical";
+ }
+
+ QMessageBox::about(
+ this,
+ tr("Font Type Entries"),
+ tr("<b>Face number : %1</b><br><br>"
+ "FreeType driver: %2<br>"
+ "sfnt wrapped : %3<br>"
+ "type : %4<br>"
+ "direction : %5 <br>"
+ "fixed width : %6 <br>"
+ "glyph names : %7 <br>")
+ .arg(fontList.size())
+ .arg(engine->DriverName())
+ .arg(FT_IS_SFNT( face ) ? QString("yes") : QString("no"))
+ .arg(fontType)
+ .arg(direction)
+ .arg(FT_IS_FIXED_WIDTH(face) ? QString("yes") : QString("no"))
+ .arg(FT_HAS_GLYPH_NAMES( face ) ? QString("yes") : QString("no")));
+
+ if(FT_IS_SCALABLE( face ))
+ {
+ QMessageBox::about(
+ this,
+ tr("Scalability Properties"),
+ tr("EM size : %1 <br>"
+ "global BBox : (%2, %3):(%4, %5) <br>"
+ "ascent : %6 <br>"
+ "descent : %7<br>"
+ "text height : %8 <br>")
+ .arg(face->units_per_EM)
+ .arg(face->bbox.xMin)
+ .arg(face->bbox.yMin)
+ .arg(face->bbox.xMax)
+ .arg(face->bbox.yMax)
+ .arg(face->ascender)
+ .arg(face->descender)
+ .arg(face->height));
+ }
+
+}
+
+void
+MainGUI::showCharmapsInfo()
+{
+ FT_Face face = engine->ftSize->face;
+ for(int i = 0 ; i < face->num_charmaps ; i++)
+ {
+ QMessageBox::about(
+ this,
+ tr("Charmaps Info"),
+ tr("Format : %1<br>"
+ "Platform : %2<br>"
+ "Encoding : %3 <br>"
+ "Language : %4<br>")
+ .arg(FT_Get_CMap_Format( face->charmaps[i] ))
+ .arg(face->charmaps[i]->platform_id)
+ .arg(face->charmaps[i]->encoding_id)
+ .arg(FT_Get_CMap_Language_ID(face->charmaps[i])));
+ }
+}
void
MainGUI::about()
@@ -1134,6 +1243,15 @@ MainGUI::createActions()
exitAct->setShortcuts(QKeySequence::Quit);
connect(exitAct, SIGNAL(triggered()), SLOT(close()));
+ showFontNameAct = new QAction(tr("&Font Name"), this);
+ connect(showFontNameAct, SIGNAL(triggered()), SLOT(showFontName()));
+
+ showFontTypeAct = new QAction(tr("&Font Type"), this);
+ connect(showFontTypeAct, SIGNAL(triggered()), SLOT(showFontType()));
+
+ showCharmapsInfoAct = new QAction(tr("&Charmap Info"), this);
+ connect(showCharmapsInfoAct, SIGNAL(triggered()), SLOT(showCharmapsInfo()));
+
aboutAct = new QAction(tr("&About"), this);
connect(aboutAct, SIGNAL(triggered()), SLOT(about()));
@@ -1150,6 +1268,11 @@ MainGUI::createMenus()
menuFile->addAction(closeFontAct);
menuFile->addAction(exitAct);
+ menuInfo = menuBar()->addMenu(tr("&Font Info"));
+ menuInfo->addAction(showFontNameAct);
+ menuInfo->addAction(showFontTypeAct);
+ menuInfo->addAction(showCharmapsInfoAct);
+
menuHelp = menuBar()->addMenu(tr("&Help"));
menuHelp->addAction(aboutAct);
menuHelp->addAction(aboutQtAct);
diff --git a/src/ftinspect/maingui.hpp b/src/ftinspect/maingui.hpp
index 8ad6c30..35f98a3 100644
--- a/src/ftinspect/maingui.hpp
+++ b/src/ftinspect/maingui.hpp
@@ -70,6 +70,9 @@ protected:
private slots:
void about();
void aboutQt();
+ void showCharmapsInfo();
+ void showFontType();
+ void showFontName();
void adjustGlyphIndex(int);
void checkAntiAliasing();
void checkAutoHinting();
@@ -119,6 +122,9 @@ private:
QAction *aboutAct;
QAction *aboutQtAct;
+ QAction *showCharmapsInfoAct;
+ QAction *showFontTypeAct;
+ QAction *showFontNameAct;
QAction *closeFontAct;
QAction *exitAct;
QAction *loadFontsAct;
@@ -186,6 +192,7 @@ private:
QLocale *locale;
QMenu *menuFile;
+ QMenu *menuInfo;
QMenu *menuHelp;
QPen axisPen;
_______________________________________________
Freetype-devel mailing list
[email protected]
https://lists.nongnu.org/mailman/listinfo/freetype-devel