Subversion Repositories Scribus


Rev 13510 | Go to most recent revision | Blame | Compare with Previous | Last modification | View Log | RSS feed

For general Scribus (>=1.3.2) copyright and licensing information please refer
to the COPYING file provided with the program. Following this notice may exist
a copyright and/or license notice that predates the release of Scribus 1.3.2
for which a new license (GPL+exception) is in place.

#ifndef SCFACE_TTF_H
#define SCFACE_TTF_H

#include "scribusapi.h"
#include "fonts/ftface.h"


        An object holding a table of kerning pairs extracted from
        a kern feature such as found in a GPOS table

class SCRIBUS_API KernFeature
                * Build a ready-to-use kerning pairs table
                * @param face a valid FT_Face, It won’t be store by KernFeature

                KernFeature ( FT_Face face );
                KernFeature ( const KernFeature& kf );

                 * Get the kerning value for a pair of glyph indexes.
                 * @param glyph1 Index of the left glyph in logical order
                 * @param glyph2 Index of the right glyph in logical order
                 * @return the unscaled delta to apply to xadvance of the first glyph

                double getPairValue ( unsigned int glyph1, unsigned int glyph2 ) const;

                 * The table can have been invalidated if something went wrong at any moment.
                 * @return True if valid, False otherwise.

                bool isValid() const {return m_valid;}

                bool m_valid;
                QByteArray GPOSTableRaw;
                QMap<quint16,QList<quint16> > coverages;
                QMap<quint16, QMap<quint16, double> > pairs;

                void makeCoverage();
                void makePairs ( quint16 subtableOffset );

                typedef QMap<quint16, QList<quint16> > ClassDefTable; // <Class , list<GLyph> >
                ClassDefTable getClass ( quint16 classDefOffset, quint16 coverageId );
                inline quint16 toUint16 ( quint16 index );
                inline qint16 toInt16 ( quint16 index );

                enum ValueFormat
                        XPlacement = 0x0001,
                        YPlacement = 0x0002,
                        XAdvance = 0x0004,
                        YAdvance = 0x0008,
                        XPlaDevice =0x0010,
                        YPlaDevice =0x0020,
                        XAdvDevice =0x0040,
                        YAdvDevice =0x0080
                QString FontName;// for debugging purpose

        Class ScFace_ttf
        Subclass of ScFace, specifically for TrueType fonts.
        Implements: RealName() and EmbedFont().

class SCRIBUS_API ScFace_ttf : public FtFace
        ScFace_ttf ( QString fam, QString sty, QString alt, QString scname, QString psname, QString path, int face );

        void load () const;
        void unload () const;

        bool EmbedFont(QString &str) const;
        void RawData(QByteArray & bb) const;

        qreal glyphKerning ( uint gl1, uint gl2, qreal sz ) const;

        mutable KernFeature * kernFeature;