michael@0: /* GRAPHITE2 LICENSING michael@0: michael@0: Copyright 2010, SIL International michael@0: All rights reserved. michael@0: michael@0: This library is free software; you can redistribute it and/or modify michael@0: it under the terms of the GNU Lesser General Public License as published michael@0: by the Free Software Foundation; either version 2.1 of License, or michael@0: (at your option) any later version. michael@0: michael@0: This program is distributed in the hope that it will be useful, michael@0: but WITHOUT ANY WARRANTY; without even the implied warranty of michael@0: MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU michael@0: Lesser General Public License for more details. michael@0: michael@0: You should also have received a copy of the GNU Lesser General Public michael@0: License along with this library in the file named "LICENSE". michael@0: If not, write to the Free Software Foundation, 51 Franklin Street, michael@0: Suite 500, Boston, MA 02110-1335, USA or visit their web page on the michael@0: internet at http://www.fsf.org/licenses/lgpl.html. michael@0: michael@0: Alternatively, the contents of this file may be used under the terms of the michael@0: Mozilla Public License (http://mozilla.org/MPL) or the GNU General Public michael@0: License, as published by the Free Software Foundation, either version 2 michael@0: of the License or (at your option) any later version. michael@0: */ michael@0: #pragma once michael@0: michael@0: #include "graphite2/Font.h" michael@0: #include "inc/Main.h" michael@0: #include "inc/Pass.h" michael@0: michael@0: namespace graphite2 { michael@0: michael@0: class Face; michael@0: class Segment; michael@0: class FeatureVal; michael@0: class VMScratch; michael@0: class Error; michael@0: michael@0: class Pseudo michael@0: { michael@0: public: michael@0: uint32 uid; michael@0: uint32 gid; michael@0: CLASS_NEW_DELETE; michael@0: }; michael@0: michael@0: class Justinfo michael@0: { michael@0: public: michael@0: Justinfo(uint8 stretch, uint8 shrink, uint8 step, uint8 weight) : michael@0: m_astretch(stretch), m_ashrink(shrink), m_astep(step), michael@0: m_aweight(weight) {}; michael@0: uint8 attrStretch() const { return m_astretch; } michael@0: uint8 attrShrink() const { return m_ashrink; } michael@0: uint8 attrStep() const { return m_astep; } michael@0: uint8 attrWeight() const { return m_aweight; } michael@0: michael@0: private: michael@0: uint8 m_astretch; michael@0: uint8 m_ashrink; michael@0: uint8 m_astep; michael@0: uint8 m_aweight; michael@0: }; michael@0: michael@0: class Silf michael@0: { michael@0: // Prevent copying michael@0: Silf(const Silf&); michael@0: Silf& operator=(const Silf&); michael@0: michael@0: public: michael@0: Silf() throw(); michael@0: ~Silf() throw(); michael@0: michael@0: bool readGraphite(const byte * const pSilf, size_t lSilf, Face &face, uint32 version); michael@0: bool runGraphite(Segment *seg, uint8 firstPass=0, uint8 lastPass=0, int dobidi = 0) const; michael@0: uint16 findClassIndex(uint16 cid, uint16 gid) const; michael@0: uint16 getClassGlyph(uint16 cid, unsigned int index) const; michael@0: uint16 findPseudo(uint32 uid) const; michael@0: uint8 numUser() const { return m_aUser; } michael@0: uint8 aPseudo() const { return m_aPseudo; } michael@0: uint8 aBreak() const { return m_aBreak; } michael@0: uint8 aMirror() const {return m_aMirror; } michael@0: uint8 aPassBits() const { return m_aPassBits; } michael@0: uint8 aBidi() const { return m_aBidi; } michael@0: uint8 substitutionPass() const { return m_sPass; } michael@0: uint8 positionPass() const { return m_pPass; } michael@0: uint8 justificationPass() const { return m_jPass; } michael@0: uint8 bidiPass() const { return m_bPass; } michael@0: uint8 numPasses() const { return m_numPasses; } michael@0: uint8 maxCompPerLig() const { return m_iMaxComp; } michael@0: uint16 numClasses() const { return m_nClass; } michael@0: byte flags() const { return m_flags; } michael@0: uint8 numJustLevels() const { return m_numJusts; } michael@0: Justinfo *justAttrs() const { return m_justs; } michael@0: uint16 endLineGlyphid() const { return m_gEndLine; } michael@0: const gr_faceinfo *silfInfo() const { return &m_silfinfo; } michael@0: michael@0: CLASS_NEW_DELETE; michael@0: michael@0: private: michael@0: size_t readClassMap(const byte *p, size_t data_len, uint32 version, Error &e); michael@0: template inline uint32 readClassOffsets(const byte *&p, size_t data_len, Error &e); michael@0: michael@0: Pass * m_passes; michael@0: Pseudo * m_pseudos; michael@0: uint32 * m_classOffsets; michael@0: uint16 * m_classData; michael@0: Justinfo * m_justs; michael@0: uint8 m_numPasses; michael@0: uint8 m_numJusts; michael@0: uint8 m_sPass, m_pPass, m_jPass, m_bPass, michael@0: m_flags; michael@0: michael@0: uint8 m_aPseudo, m_aBreak, m_aUser, m_aBidi, m_aMirror, m_aPassBits, michael@0: m_iMaxComp; michael@0: uint16 m_aLig, michael@0: m_numPseudo, michael@0: m_nClass, michael@0: m_nLinear, michael@0: m_gEndLine; michael@0: gr_faceinfo m_silfinfo; michael@0: michael@0: void releaseBuffers() throw(); michael@0: }; michael@0: michael@0: } // namespace graphite2