/*************************************************************************** * Copyright (C) 2007 by Pierre Marchand * * pierre@moulindetouvois.com * * * * 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., * * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * ***************************************************************************/ #ifndef ULGLYPHCOLLECTION_H #define ULGLYPHCOLLECTION_H #include #include #include class ULGlyphScene; class ULGlyphItem; /** @author Pierre Marchand */ class ULGlyphCollection : public QList { public: ULGlyphCollection(QGraphicsScene *scene, double size); ~ULGlyphCollection(); void autoFeed();//load all glyphs void userFeed(QString fpath,QString fname, QMap glyames); QString name(); QString fontPath(); double fontSize(); QString toElement(); ULGlyphScene *scene(); double kern(QString gl, QString gr); void newKern(QString gl, QString gr, double v); ULGlyphItem* charcode(int c){return at(cMap[c]);}; // QMap pixGlyph; private: QGraphicsScene *m_scene; QString m_name; QString fontfile; double sz; QMap kernMap; bool hasDesignKern; QMap reversedCMap; QMap cMap; }; class ULGlyphCollectionRegister { QMap map; static ULGlyphCollectionRegister * instance; static ULGlyphCollectionRegister * that(); ULGlyphCollectionRegister(){} public: static void Register(ULGlyphCollection*); static ULGlyphCollection* Get(const QString& name); }; #endif