Back to index

scribus-ng  1.3.4.dfsg+svn20071115
gtfont.h
Go to the documentation of this file.
00001 /*
00002 For general Scribus (>=1.3.2) copyright and licensing information please refer
00003 to the COPYING file provided with the program. Following this notice may exist
00004 a copyright and/or license notice that predates the release of Scribus 1.3.2
00005 for which a new license (GPL+exception) is in place.
00006 */
00007 /***************************************************************************
00008  *   Copyright (C) 2004 by Riku Leino                                      *
00009  *   tsoots@gmail.com                                                      *
00010  *                                                                         *
00011  *   This program is free software; you can redistribute it and/or modify  *
00012  *   it under the terms of the GNU General Public License as published by  *
00013  *   the Free Software Foundation; either version 2 of the License, or     *
00014  *   (at your option) any later version.                                   *
00015  *                                                                         *
00016  *   This program is distributed in the hope that it will be useful,       *
00017  *   but WITHOUT ANY WARRANTY; without even the implied warranty of        *
00018  *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the         *
00019  *   GNU General Public License for more details.                          *
00020  *                                                                         *
00021  *   You should have received a copy of the GNU General Public License     *
00022  *   along with this program; if not, write to the                         *
00023  *   Free Software Foundation, Inc.,                                       *
00024  *   59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.             *
00025  ***************************************************************************/
00026 
00027 #ifndef GTFONT_H
00028 #define GTFONT_H
00029 
00030 #include <vector>
00031 
00032 #include <qstring.h>
00033 #include "scribusapi.h"
00034 
00035 enum FontEffect {
00036        NORMAL,
00037        UNDERLINE,
00038        STRIKETHROUGH,
00039        SMALL_CAPS,
00040        SUPERSCRIPT,
00041        SUBSCRIPT,
00042        OUTLINE,
00043        FontEffectMAX
00044 };
00045 
00046 enum FontWeight {
00047        NO_WEIGHT,
00048        DEMIBOLD,
00049        EXTRABLACK,
00050        EXTRABOLD,
00051        EXTRAHEAVY,
00052        EXTRALIGHT,
00053        SEMIBOLD,
00054        BLACK,
00055        BOLD,
00056        BOOK,
00057        DEMI,
00058        HEAVY,
00059        LIGHT,
00060        LITE,
00061        MEDIUM,
00062        REGULAR,
00063        ROMAN,
00064        FontWeightMAX
00065 };
00066 
00067 enum FontSlant {
00068        NO_SLANT,
00069        ITALIC,
00070        OBLIQUE,
00071        FontSlantMAX
00072 };
00073 
00074 enum FontWidth {
00075        NO_WIDTH,
00076        EXTRACONDENSED,
00077        SEMICONDENSED,
00078        ULTRACONDENSED,
00079        EXTRACOMPRESSED,
00080        SEMICOMPRESSED,
00081        ULTRACOMPRESSED,
00082        CONDENSED,
00083        COMPRESSED,
00084        FontWidthMAX
00085 };
00086 
00087 /*
00088        Font will do the font search in Scribus and in case a font
00089        cannot be found it will launch the font substitution dialog.
00090 */
00091 class SCRIBUS_API gtFont
00092 {
00093 private:
00094        QString name;
00095        QString family;
00096        QString weight;
00097        QString slant;
00098        QString width;
00099        QString append;
00100        int     size;
00101        bool    fontEffects[FontEffectMAX];
00102        QString color;
00103        int     shade;
00104        QString strokeColor;
00105        int     strokeShade;
00106        /* Width of a character in percentages to it's "real width" */
00107        int     hscale;
00108        int  kerning;
00109        bool useFullName;
00110        int  weightIndex;
00111        int  slantIndex;
00112        int  widthIndex;
00113        int smallestIndex;
00114        int biggestIndex;
00115        int index;
00116        int tmpWeightIndex;
00117        int tmpSlantIndex;
00118        int tmpWidthIndex;
00119        void initArrays();
00120        void parseName();
00121        void parseWeight();
00122        void parseSlant();
00123        void parseWidth();
00124        void parseFamily();
00125        int  find(const QString& where, const QString& what);
00126 public:
00127        static const QString fontWeights[];
00128        static const QString fontSlants[];
00129        static const QString fontWidths[];
00130        void    noEffects();
00131        bool    isToggled(FontEffect fe);
00132        bool    toggleEffect(FontEffect fe);
00133        int     getEffectsValue();
00134        void   setName(QString newName);
00135        void    setFamily(QString newFamily);
00136        QString getFamily();
00137        void    setWeight(FontWeight newWeight);
00138        void    setWeight(QString newWeight);
00139        QString getWeight();
00140        void    setSlant(FontSlant newSlant);
00141        void    setSlant(QString newSlant);
00142        QString getSlant();
00143        void    setWidth(FontWidth newWidth);
00144        void    setWidth(QString newWidth);
00145        QString getWidth();
00146        void    setSize(int newSize);
00147        void    setSize(double newSize);
00148        void    setColor(QString newColor);
00149        void    setShade(int newShade);
00150        void    setStrokeColor(QString newColor);
00151        void    setStrokeShade(int newShade);
00152        QString getName();
00153        QString getName(uint i);
00154        static const int NAMECOUNT = 14;
00155        int     getSize();
00156        QString getColor();
00157        int     getShade();
00158        QString getStrokeColor();
00159        int     getStrokeShade();
00160        int     getHscale();
00161        void    setHscale(int newHscale);
00162        int  getKerning();
00163        void    setKerning(int newKerning);
00164        gtFont();
00165        gtFont(const gtFont& f);
00166        ~gtFont();
00167 };
00168 
00169 #endif // GTFONT_H