diff options
author | Timothy Pearson <[email protected]> | 2013-02-01 17:25:42 -0600 |
---|---|---|
committer | Timothy Pearson <[email protected]> | 2013-02-01 17:25:42 -0600 |
commit | eba183d4de47093c6e44a99c8d7fe313aa2834c9 (patch) | |
tree | 53f8d1a08bd16668cb9040b2aaf9a041314b2003 /kcontrol/kfontinst/tdefile-plugin | |
parent | f537c21b68e08f649b1b297bce8f3904603137e0 (diff) | |
download | tdebase-eba183d4de47093c6e44a99c8d7fe313aa2834c9.tar.gz tdebase-eba183d4de47093c6e44a99c8d7fe313aa2834c9.zip |
Fix FTBFS
Diffstat (limited to 'kcontrol/kfontinst/tdefile-plugin')
-rw-r--r-- | kcontrol/kfontinst/tdefile-plugin/CMakeLists.txt | 36 | ||||
-rw-r--r-- | kcontrol/kfontinst/tdefile-plugin/KFileFont.cpp | 422 | ||||
-rw-r--r-- | kcontrol/kfontinst/tdefile-plugin/KFileFont.h | 58 | ||||
-rw-r--r-- | kcontrol/kfontinst/tdefile-plugin/Makefile.am | 13 | ||||
-rw-r--r-- | kcontrol/kfontinst/tdefile-plugin/tdefile_font.desktop | 86 |
5 files changed, 0 insertions, 615 deletions
diff --git a/kcontrol/kfontinst/tdefile-plugin/CMakeLists.txt b/kcontrol/kfontinst/tdefile-plugin/CMakeLists.txt deleted file mode 100644 index d12537903..000000000 --- a/kcontrol/kfontinst/tdefile-plugin/CMakeLists.txt +++ /dev/null @@ -1,36 +0,0 @@ -################################################# -# -# (C) 2010-2011 Serghei Amelian -# serghei (DOT) amelian (AT) gmail.com -# -# Improvements and feedback are welcome -# -# This file is released under GPL >= 2 -# -################################################# - -include_directories( - ${CMAKE_CURRENT_BINARY_DIR} - ${CMAKE_BINARY_DIR} - ${CMAKE_SOURCE_DIR}/kcontrol/kfontinst/lib - ${TDE_INCLUDE_DIR} - ${TQT_INCLUDE_DIRS} -) - -link_directories( - ${TQT_LIBRARY_DIRS} -) - - -##### other data ################################ - -install( FILES tdefile_font.desktop DESTINATION ${SERVICES_INSTALL_DIR} ) - - -##### tdefile_font (module) ####################### - -tde_add_kpart( tdefile_font - SOURCES KFileFont.cpp - LINK kfontinst-shared tdeio-shared - DESTINATION ${PLUGIN_INSTALL_DIR} -) diff --git a/kcontrol/kfontinst/tdefile-plugin/KFileFont.cpp b/kcontrol/kfontinst/tdefile-plugin/KFileFont.cpp deleted file mode 100644 index 4ac55807f..000000000 --- a/kcontrol/kfontinst/tdefile-plugin/KFileFont.cpp +++ /dev/null @@ -1,422 +0,0 @@ -//////////////////////////////////////////////////////////////////////////////// -// -// Class Name : KFI::KFileFont -// Author : Craig Drummond -// Project : K Font Installer -// Creation Date : 20/03/2003 -// Version : $Revision$ $Date$ -// -//////////////////////////////////////////////////////////////////////////////// -// -// This program is free software; you can redistribute it and/or -// modify it under the terms of the GNU General Public License -// as published by the Free Software Foundation; either version 2 -// of the License, or (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -// -// You should have received a copy of the GNU General Public License -// along with this program; if not, write to the Free Software -// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. -// -//////////////////////////////////////////////////////////////////////////////// -// (C) Craig Drummond, 2003, 2004 -//////////////////////////////////////////////////////////////////////////////// - -#include "KFileFont.h" -#include "KfiConstants.h" -#include <tqfile.h> -#include <tqtextstream.h> -#include <kgenericfactory.h> -#include <tdeio/netaccess.h> - -static void addEntry(int face, TQString &existing, const TQString &add) -{ - if(face>0) - existing.append(", "); - existing.append(add); -} - -static int strToWeight(const TQString &str) -{ - if(NULL==str) - return FC_WEIGHT_MEDIUM; - else if(str.contains("Bold", false)) - return FC_WEIGHT_BOLD; - else if(str.contains("Heavy", false)) - return FC_WEIGHT_HEAVY; - else if(str.contains("Black", false)) - return FC_WEIGHT_BLACK; - else if(str.contains("ExtraBold", false)) - return FC_WEIGHT_EXTRABOLD; - else if(str.contains("UltraBold", false)) - return FC_WEIGHT_ULTRABOLD; - else if(str.contains("ExtraLight", false)) - return FC_WEIGHT_EXTRALIGHT; - else if(str.contains("UltraLight", false)) - return FC_WEIGHT_ULTRALIGHT; - else if(str.contains("Light", false)) - return FC_WEIGHT_LIGHT; - else if(str.contains("Medium", false) || str.contains("Normal", false) || str.contains("Roman", false)) - return FC_WEIGHT_MEDIUM; - else if(str.contains("Regular", false)) - return FC_WEIGHT_REGULAR; - else if(str.contains("SemiBold", false)) - return FC_WEIGHT_SEMIBOLD; - else if(str.contains("DemiBold", false)) - return FC_WEIGHT_DEMIBOLD; - else if(str.contains("Thin", false)) - return FC_WEIGHT_THIN; - else if(str.contains("Book", false)) - return FC_WEIGHT_NORMAL; - else if(str.contains("Demi", false)) - return FC_WEIGHT_NORMAL; - else - return FC_WEIGHT_MEDIUM; -} - -#ifndef KFI_FC_NO_WIDTHS -static int strToWidth(const TQString &str) -{ - if(str.isEmpty()) - return FC_WIDTH_NORMAL; - else if(str.contains("UltraCondensed", false)) - return FC_WIDTH_ULTRACONDENSED; - else if(str.contains("ExtraCondensed", false)) - return FC_WIDTH_EXTRACONDENSED; - else if(str.contains("SemiCondensed", false)) - return FC_WIDTH_SEMICONDENSED; - else if(str.contains("Condensed", false)) - return FC_WIDTH_CONDENSED; - else if(str.contains("SemiExpanded", false)) - return FC_WIDTH_SEMIEXPANDED; - else if(str.contains("UltraExpanded", false)) - return FC_WIDTH_ULTRAEXPANDED; - else if(str.contains("ExtraExpanded", false)) - return FC_WIDTH_EXTRAEXPANDED; - else if(str.contains("Expanded", false)) - return FC_WIDTH_EXPANDED; - else - return FC_WIDTH_NORMAL; -} -#endif - -struct FoundryMap -{ - const char *noticeStr, - *foundry; - unsigned short len; -}; - -static const FoundryMap map[]= // These are (mainly) taken from type1inst -{ - { "Bigelow", "B&H", 3}, - { "Adobe", "Adobe", 5}, - { "Bitstream", "Bitstream", 9}, - { "Monotype", "Monotype", 8}, - { "Linotype", "Linotype", 8}, - { "LINOTYPE-HELL", "Linotype", 0}, - { "IBM", "IBM", 3}, - { "URW", "URW", 3}, - { "International Typeface Corporation", "ITC", 3}, - { "Tiro Typeworks", "Tiro", 4}, - { "XFree86", "XFree86", 7}, - { "Microsoft", "Microsoft", 9}, - { "Omega", "Omega", 5}, - { "Font21", "Hwan", 4}, - { "HanYang System", "Hanyang", 7}, - { "Richard Mitchell", "Mitchell", 8}, - { "Doug Miles", "Miles", 5}, - { "Hank Gillette", "Gillette", 8}, - { "Three Islands Press", "3ip", 3}, - { "MacroMind", "Macromind", 9}, - { "MWSoft", "MWSoft", 6}, - { "Digiteyes Multimedia", "DigitEyes", 9}, - { "ZSoft", "ZSoft", 5}, - { "Title Wave", "Titlewave", 9}, - { "Southern Software", "Southern", 8}, - { "Reasonable Solutions", "Reasonable", 10}, - { "David Rakowski", "Rakowski", 8}, - { "D. Rakowski", "Rakowski", 0}, - { "S. G. Moye", "Moye", 4}, - { "S.G. Moye", "Moye", 0}, - { "Andrew s. Meit", "Meit", 4}, - { "A.S.Meit", "Meit", 0}, - { "Hershey", "Hershey", 7}, - { "FontBank", "FontBank", 8}, - { "A. Carr", "Carr", 4}, - { "Brendel Informatik", "Brendel", 7}, - { "Jonathan Brecher", "Brecher", 7}, - { "SoftMaker", "Softmaker", 9}, - { "LETRASET", "Letraset", 8}, - { "Corel Corp", "Corel", 5}, - { "PUBLISHERS PARADISE", "Paradise", 8}, - { "Publishers Paradise", "Paradise", 0}, - { "Allied Corporation", "Allied", 6}, - { NULL, NULL, 0} -}; - -static const char * getFoundry(const char *notice) -{ - const FoundryMap *entry; - - if(notice) - for(entry=map; NULL!=entry->foundry; entry++) - if(NULL!=strstr(notice, entry->noticeStr)) - return entry->foundry; - - return NULL; -} - -static bool readAfm(const TQString &file, TQString &full, TQString &family, TQString &foundry, TQString &weight, -#ifndef KFI_FC_NO_WIDTHS - TQString &width, -#endif - TQString &spacing, TQString &slant) -{ - TQFile f(file); - bool foundName=false, - foundFamily=false; - int intSpacing=FC_PROPORTIONAL, -#ifndef KFI_FC_NO_WIDTHS - intWidth=FC_WIDTH_NORMAL, -#endif - intWeight=FC_WEIGHT_NORMAL, - intSlant=FC_SLANT_ROMAN, - intItalic=FC_SLANT_ROMAN; - - if(f.open(IO_ReadOnly)) - { - TQTextStream stream(&f); - TQString line; - bool inMetrics=false; - - while(!stream.atEnd()) - { - line=stream.readLine(); - line=line.simplifyWhiteSpace(); - - if(inMetrics) - { - if(0==line.find("FullName ")) - { - full=line.mid(9); -#ifndef KFI_FC_NO_WIDTHS - intWidth=strToWidth(full); -#endif - foundName=true; - } - else if(0==line.find("FamilyName ")) - { - family=line.mid(11); - foundFamily=true; - } - else if(0==line.find("Weight ")) - intWeight=strToWeight(line.mid(7)); - else if(0==line.find("ItalicAngle ")) - intSlant=0.0f==line.mid(12).toFloat() ? FC_SLANT_ROMAN : FC_SLANT_ITALIC; - else if(0==line.find("IsFixedPitch ")) - intSpacing=0==line.mid(13).find("false", 0, false) ? FC_PROPORTIONAL : FC_MONO; - else if(0==line.find("Notice ")) - foundry=getFoundry(line.mid(7).latin1()); - else if(0==line.find("StartCharMetrics")) - break; - } - else - if(0==line.find("StartFontMetrics")) - inMetrics=true; - }; - f.close(); - - if(!foundFamily && foundName) - { - family=full; - foundFamily=true; - } - - if(foundName && FC_SLANT_ITALIC==intItalic && (-1!=full.find("Oblique") || -1!=full.find("Slanted"))) - intItalic=FC_SLANT_OBLIQUE; - } - - if(foundName && foundFamily) - { - weight=KFI::CFcEngine::weightStr(intWeight, false); -#ifndef KFI_FC_NO_WIDTHS - width=KFI::CFcEngine::widthStr(intWidth, false); -#endif - slant=KFI::CFcEngine::slantStr(intSlant, false); - spacing=KFI::CFcEngine::spacingStr(intSpacing); - - if(foundry.isEmpty()) - foundry=i18n(KFI_UNKNOWN_FOUNDRY); - - return true; - } - - return false; -} - -typedef KGenericFactory<KFI::KFileFontPlugin> KFileFontPluginFactory; -K_EXPORT_COMPONENT_FACTORY(tdefile_font, KFileFontPluginFactory("kfontinst")) - -namespace KFI -{ - -KFileFontPlugin::KFileFontPlugin(TQObject *parent, const char *name, const TQStringList& args) - : KFilePlugin(parent, name, args) -{ - TDEGlobal::locale()->insertCatalogue(KFI_CATALOGUE); - - addMimeType("application/x-font-ttf"), - addMimeType("application/x-font-type1"); - //addMimeType("application/x-font-speedo"); - addMimeType("application/x-font-bdf"); - addMimeType("application/x-font-pcf"); - //addMimeType("application/x-font-snf"); - addMimeType("application/x-font-otf"); - addMimeType("application/x-font-ttc"); - addMimeType("application/x-afm"); -} - -void KFileFontPlugin::addMimeType(const char *mime) -{ - KFileMimeTypeInfo *info=addMimeTypeInfo(mime); - KFileMimeTypeInfo::GroupInfo *group=addGroupInfo(info, "General", i18n("General")); - - addItemInfo(group, "Full", i18n("Full Name"), TQVariant::String); - addItemInfo(group, "Family", i18n("Family"), TQVariant::String); - addItemInfo(group, "Foundry", i18n("Foundry"), TQVariant::String); - addItemInfo(group, "Weight", i18n("Weight"), TQVariant::String); -#ifndef KFI_FC_NO_WIDTHS - addItemInfo(group, "Width", i18n("Width"), TQVariant::String); -#endif - addItemInfo(group, "Spacing", i18n("Spacing"), TQVariant::String); - addItemInfo(group, "Slant", i18n("Slant"), TQVariant::String); -} - -bool KFileFontPlugin::readInfo(KFileMetaInfo& info, uint what) -{ - TQString full, - lastFull, - family, - foundry, - weight, -#ifndef KFI_FC_NO_WIDTHS - width, -#endif - spacing, - slant, - fullAll, - familyAll, - foundryAll, - weightAll, -#ifndef KFI_FC_NO_WIDTHS - widthAll, -#endif - spacingAll, - slantAll; - KURL url(info.url()); - TQString fName; - bool fontsProt = KFI_KIO_FONTS_PROTOCOL == url.protocol(), - fileProt = "file" == url.protocol(), - downloaded = false, - status = false; - - what=0; - - if(!fontsProt && !fileProt && TDEIO::NetAccess::download(url, fName, NULL)) - { - downloaded=true; - url=KURL(fName); - } - - if(downloaded || fontsProt || fileProt) - { - if("application/x-afm"==info.mimeType()) // Then fontconfig can't give us the data :-( - status=readAfm(url.path(), fullAll, familyAll, foundryAll, weightAll, -#ifndef KFI_FC_NO_WIDTHS - widthAll, -#endif - spacingAll, slantAll); - else - for(int face=0; face<10; ++face) // How to get num faces from fontconfig? don't know - so just try 1st 10... - { - if(itsEngine.getInfo(url, face, full, family, foundry, weight, -#ifndef KFI_FC_NO_WIDTHS - width, -#endif - spacing, slant) && - !full.isEmpty() && full!=lastFull) - { - addEntry(face, fullAll, full); - lastFull=full; - - if(KFileMetaInfo::Fastest!=what) - { - addEntry(face, familyAll, family); - if(0==face) - { - foundryAll=foundry; - - if(foundryAll.isEmpty()) - foundryAll=i18n(KFI_UNKNOWN_FOUNDRY); - else - { - // Try to make sure foundry is capitalised, and looks the same as that of - // any AFM. - foundryAll[0]=foundryAll[0].upper(); - - const FoundryMap *entry; - - for(entry=map; NULL!=entry->foundry; entry++) - if(foundryAll.length()==entry->len && foundryAll.contains(entry->foundry, false)) - { - foundryAll=entry->foundry; - break; - } - } - } - addEntry(face, weightAll, weight); -#ifndef KFI_FC_NO_WIDTHS - addEntry(face, widthAll, width); -#endif - addEntry(face, spacingAll, spacing); - addEntry(face, slantAll, slant); - } - status=true; - } - else - break; - } - - if(status) - { - KFileMetaInfoGroup group; - - group=appendGroup(info, "General"); - appendItem(group, "Full", fullAll); - - if(KFileMetaInfo::Fastest!=what) - { - appendItem(group, "Family", familyAll); - appendItem(group, "Foundry", foundryAll); - appendItem(group, "Weight", weightAll); -#ifndef KFI_FC_NO_WIDTHS - appendItem(group, "Width", widthAll); -#endif - appendItem(group, "Spacing", spacingAll); - appendItem(group, "Slant", slantAll); - } - } - - if(downloaded) - TDEIO::NetAccess::removeTempFile(fName); - } - - return status; -} - -} diff --git a/kcontrol/kfontinst/tdefile-plugin/KFileFont.h b/kcontrol/kfontinst/tdefile-plugin/KFileFont.h deleted file mode 100644 index b479ba3b1..000000000 --- a/kcontrol/kfontinst/tdefile-plugin/KFileFont.h +++ /dev/null @@ -1,58 +0,0 @@ -#ifndef __TDEFILE_FONT_H__ -#define __TDEFILE_FONT_H__ - -//////////////////////////////////////////////////////////////////////////////// -// -// Class Name : KFileFont -// Author : Craig Drummond -// Project : K Font Installer -// Creation Date : 20/03/2003 -// Version : $Revision$ $Date$ -// -//////////////////////////////////////////////////////////////////////////////// -// -// This program is free software; you can redistribute it and/or -// modify it under the terms of the GNU General Public License -// as published by the Free Software Foundation; either version 2 -// of the License, or (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -// -// You should have received a copy of the GNU General Public License -// along with this program; if not, write to the Free Software -// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. -// -//////////////////////////////////////////////////////////////////////////////// -// (C) Craig Drummond, 2003, 2004 -//////////////////////////////////////////////////////////////////////////////// - -#include <tdefilemetainfo.h> -#include "FcEngine.h" - -namespace KFI -{ - -class KFileFontPlugin : public KFilePlugin -{ - public: - - KFileFontPlugin(TQObject *parent, const char *name, const TQStringList& args); - virtual ~KFileFontPlugin() {} - - bool readInfo(KFileMetaInfo& info, uint what = KFileMetaInfo::Fastest); - - private: - - void addMimeType(const char *mime); - - private: - - CFcEngine itsEngine; -}; - -} - -#endif diff --git a/kcontrol/kfontinst/tdefile-plugin/Makefile.am b/kcontrol/kfontinst/tdefile-plugin/Makefile.am deleted file mode 100644 index 04ab41861..000000000 --- a/kcontrol/kfontinst/tdefile-plugin/Makefile.am +++ /dev/null @@ -1,13 +0,0 @@ -kde_module_LTLIBRARIES = tdefile_font.la - -tdefile_font_la_SOURCES = KFileFont.cpp -tdefile_font_la_LDFLAGS = $(all_libraries) $(KDE_RPATH) $(LIBFREETYPE_RPATH) -module $(KDE_PLUGIN) -tdefile_font_la_LIBADD = $(LIB_KIO) $(LIBFREETYPE_LIBS) ../lib/libkfontinst.la - -kdelnkdir = $(kde_servicesdir) -kde_services_DATA = tdefile_font.desktop - -AM_CPPFLAGS = -I$(srcdir)/../lib -I$(srcdir)/../../fonts $(all_includes) $(LIBFREETYPE_CFLAGS) - -METASOURCES = AUTO -noinst_HEADERS = KFileFont.h diff --git a/kcontrol/kfontinst/tdefile-plugin/tdefile_font.desktop b/kcontrol/kfontinst/tdefile-plugin/tdefile_font.desktop deleted file mode 100644 index 20e502c59..000000000 --- a/kcontrol/kfontinst/tdefile-plugin/tdefile_font.desktop +++ /dev/null @@ -1,86 +0,0 @@ -[Desktop Entry] -Type=Service -Name=Font Information -Name[af]=Skrif tipe Informasie -Name[ar]=معلومات المحرف -Name[az]=Yazı Növü Mə'lumatı -Name[be]=Інфармацыя аб шрыфце -Name[bg]=Информация за шрифт -Name[bn]=ফন্ট তথ্য -Name[br]=Titouroù diwar-benn ar font -Name[bs]=Informacije o fontu -Name[ca]=Informació de la lletra -Name[cs]=Informace o písmu -Name[csb]=Wëdowiédzô ò fòntach -Name[cy]=Gwybodaeth Ffont -Name[da]=Skrifttypeinformation -Name[de]=Schriftarteninformation -Name[el]=Πληροφορίες γραμματοσειράς -Name[eo]=Tiparinformo -Name[es]=Información del tipo de letra -Name[et]=Fondi info -Name[eu]=Letra-tipoei buruzko informazioa -Name[fa]=اطلاعات قلم -Name[fi]=Kirjasintiedot -Name[fr]=Informations sur les polices -Name[fy]=Lettertype-Ynformaasje -Name[ga]=Eolas Clófhoirne -Name[gl]=Información da Fonte -Name[he]=מידע גופנים -Name[hi]=फ़ॉन्ट जानकारी -Name[hr]=Podaci o fontu -Name[hu]=Betűtípus-jellemzők -Name[id]=Informasi Font -Name[is]=Leturupplýsingar -Name[it]=Informazioni caratteri -Name[ja]=フォント情報 -Name[ka]=ინფორმაცია ფონტის შესახებ -Name[kk]=Қаріп мәліметі -Name[km]=ព័ត៌មានពុម្ពអក្សរ -Name[ko]=연락처 정보 -Name[lo]=ຂໍ້ມູນຕ່າງໆ -Name[lt]=Šrifto(-ų) informacija -Name[lv]=Fontu Informācija -Name[mk]=Информации за фонтовите -Name[mn]=Бичиг-Мэдээлэл -Name[ms]=Maklumat Fon -Name[mt]=Informazzjoni dwar font -Name[nb]=Skriftinformasjon -Name[nds]=Schriftoort-Informatschoon -Name[ne]=फन्ट सूचना -Name[nl]=Lettertype-informatie -Name[nn]=Skriftinformasjon -Name[nso]=Tshedimoso ya Fonto -Name[pa]=ਫੋਂਟ ਜਾਣਕਾਰੀ -Name[pl]=Informacje o czcionkach -Name[pt]=Informação do Tipo de Letra -Name[pt_BR]=Informações sobre a Fonte -Name[ro]=Informații font -Name[ru]=Сведения о шрифте -Name[rw]=Amakuru y'Imyandikire -Name[se]=Fontadieđut -Name[sk]=Informácie o písmach -Name[sl]=Informacije o pisavi -Name[sr]=Информације о фонту -Name[sr@Latn]=Informacije o fontu -Name[sv]=Teckensnittsinformation -Name[ta]=எழுத்துரு தகவல் -Name[tg]=Иттилооти ҳарфҳо -Name[th]=ข้อมูลแบบอักษร -Name[tr]=Yazıtipi Bilgisi -Name[tt]=Yazu Turında -Name[uk]=Інформація про шрифти -Name[uz]=Shrift haqida maʼlumot -Name[uz@cyrillic]=Шрифт ҳақида маълумот -Name[ven]=Mafhungo a fontu -Name[vi]=Thông tin về Phông chữ -Name[wa]=Informåcion sol fonte -Name[xh]=Ulwazi Lohlobo lwamagama -Name[zh_CN]=字体信息 -Name[zh_TW]=字型資訊 -Name[zu]=Ulwazi lohlobo lwamagama -ServiceTypes=KFilePlugin -X-TDE-Library=tdefile_font -MimeType=application/x-font-ttf;application/x-font-type1;application/x-font-bdf;application/x-font-pcf;application/x-font-otf;application/x-font-ttc;application/x-afm -PreferredGroups=General -PreferredItems=Full,Family,Foundry,Weight,Width,Spacing,Slant |