Wed, 31 Dec 2014 06:09:35 +0100
Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.
michael@0 | 1 | /* GRAPHITE2 LICENSING |
michael@0 | 2 | |
michael@0 | 3 | Copyright 2010, SIL International |
michael@0 | 4 | All rights reserved. |
michael@0 | 5 | |
michael@0 | 6 | This library is free software; you can redistribute it and/or modify |
michael@0 | 7 | it under the terms of the GNU Lesser General Public License as published |
michael@0 | 8 | by the Free Software Foundation; either version 2.1 of License, or |
michael@0 | 9 | (at your option) any later version. |
michael@0 | 10 | |
michael@0 | 11 | This program is distributed in the hope that it will be useful, |
michael@0 | 12 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
michael@0 | 13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
michael@0 | 14 | Lesser General Public License for more details. |
michael@0 | 15 | |
michael@0 | 16 | You should also have received a copy of the GNU Lesser General Public |
michael@0 | 17 | License along with this library in the file named "LICENSE". |
michael@0 | 18 | If not, write to the Free Software Foundation, 51 Franklin Street, |
michael@0 | 19 | Suite 500, Boston, MA 02110-1335, USA or visit their web page on the |
michael@0 | 20 | internet at http://www.fsf.org/licenses/lgpl.html. |
michael@0 | 21 | |
michael@0 | 22 | Alternatively, the contents of this file may be used under the terms of the |
michael@0 | 23 | Mozilla Public License (http://mozilla.org/MPL) or the GNU General Public |
michael@0 | 24 | License, as published by the Free Software Foundation, either version 2 |
michael@0 | 25 | of the License or (at your option) any later version. |
michael@0 | 26 | */ |
michael@0 | 27 | #pragma once |
michael@0 | 28 | |
michael@0 | 29 | #include "graphite2/Font.h" |
michael@0 | 30 | #include "inc/Main.h" |
michael@0 | 31 | #include "inc/Pass.h" |
michael@0 | 32 | |
michael@0 | 33 | namespace graphite2 { |
michael@0 | 34 | |
michael@0 | 35 | class Face; |
michael@0 | 36 | class Segment; |
michael@0 | 37 | class FeatureVal; |
michael@0 | 38 | class VMScratch; |
michael@0 | 39 | class Error; |
michael@0 | 40 | |
michael@0 | 41 | class Pseudo |
michael@0 | 42 | { |
michael@0 | 43 | public: |
michael@0 | 44 | uint32 uid; |
michael@0 | 45 | uint32 gid; |
michael@0 | 46 | CLASS_NEW_DELETE; |
michael@0 | 47 | }; |
michael@0 | 48 | |
michael@0 | 49 | class Justinfo |
michael@0 | 50 | { |
michael@0 | 51 | public: |
michael@0 | 52 | Justinfo(uint8 stretch, uint8 shrink, uint8 step, uint8 weight) : |
michael@0 | 53 | m_astretch(stretch), m_ashrink(shrink), m_astep(step), |
michael@0 | 54 | m_aweight(weight) {}; |
michael@0 | 55 | uint8 attrStretch() const { return m_astretch; } |
michael@0 | 56 | uint8 attrShrink() const { return m_ashrink; } |
michael@0 | 57 | uint8 attrStep() const { return m_astep; } |
michael@0 | 58 | uint8 attrWeight() const { return m_aweight; } |
michael@0 | 59 | |
michael@0 | 60 | private: |
michael@0 | 61 | uint8 m_astretch; |
michael@0 | 62 | uint8 m_ashrink; |
michael@0 | 63 | uint8 m_astep; |
michael@0 | 64 | uint8 m_aweight; |
michael@0 | 65 | }; |
michael@0 | 66 | |
michael@0 | 67 | class Silf |
michael@0 | 68 | { |
michael@0 | 69 | // Prevent copying |
michael@0 | 70 | Silf(const Silf&); |
michael@0 | 71 | Silf& operator=(const Silf&); |
michael@0 | 72 | |
michael@0 | 73 | public: |
michael@0 | 74 | Silf() throw(); |
michael@0 | 75 | ~Silf() throw(); |
michael@0 | 76 | |
michael@0 | 77 | bool readGraphite(const byte * const pSilf, size_t lSilf, Face &face, uint32 version); |
michael@0 | 78 | bool runGraphite(Segment *seg, uint8 firstPass=0, uint8 lastPass=0, int dobidi = 0) const; |
michael@0 | 79 | uint16 findClassIndex(uint16 cid, uint16 gid) const; |
michael@0 | 80 | uint16 getClassGlyph(uint16 cid, unsigned int index) const; |
michael@0 | 81 | uint16 findPseudo(uint32 uid) const; |
michael@0 | 82 | uint8 numUser() const { return m_aUser; } |
michael@0 | 83 | uint8 aPseudo() const { return m_aPseudo; } |
michael@0 | 84 | uint8 aBreak() const { return m_aBreak; } |
michael@0 | 85 | uint8 aMirror() const {return m_aMirror; } |
michael@0 | 86 | uint8 aPassBits() const { return m_aPassBits; } |
michael@0 | 87 | uint8 aBidi() const { return m_aBidi; } |
michael@0 | 88 | uint8 substitutionPass() const { return m_sPass; } |
michael@0 | 89 | uint8 positionPass() const { return m_pPass; } |
michael@0 | 90 | uint8 justificationPass() const { return m_jPass; } |
michael@0 | 91 | uint8 bidiPass() const { return m_bPass; } |
michael@0 | 92 | uint8 numPasses() const { return m_numPasses; } |
michael@0 | 93 | uint8 maxCompPerLig() const { return m_iMaxComp; } |
michael@0 | 94 | uint16 numClasses() const { return m_nClass; } |
michael@0 | 95 | byte flags() const { return m_flags; } |
michael@0 | 96 | uint8 numJustLevels() const { return m_numJusts; } |
michael@0 | 97 | Justinfo *justAttrs() const { return m_justs; } |
michael@0 | 98 | uint16 endLineGlyphid() const { return m_gEndLine; } |
michael@0 | 99 | const gr_faceinfo *silfInfo() const { return &m_silfinfo; } |
michael@0 | 100 | |
michael@0 | 101 | CLASS_NEW_DELETE; |
michael@0 | 102 | |
michael@0 | 103 | private: |
michael@0 | 104 | size_t readClassMap(const byte *p, size_t data_len, uint32 version, Error &e); |
michael@0 | 105 | template<typename T> inline uint32 readClassOffsets(const byte *&p, size_t data_len, Error &e); |
michael@0 | 106 | |
michael@0 | 107 | Pass * m_passes; |
michael@0 | 108 | Pseudo * m_pseudos; |
michael@0 | 109 | uint32 * m_classOffsets; |
michael@0 | 110 | uint16 * m_classData; |
michael@0 | 111 | Justinfo * m_justs; |
michael@0 | 112 | uint8 m_numPasses; |
michael@0 | 113 | uint8 m_numJusts; |
michael@0 | 114 | uint8 m_sPass, m_pPass, m_jPass, m_bPass, |
michael@0 | 115 | m_flags; |
michael@0 | 116 | |
michael@0 | 117 | uint8 m_aPseudo, m_aBreak, m_aUser, m_aBidi, m_aMirror, m_aPassBits, |
michael@0 | 118 | m_iMaxComp; |
michael@0 | 119 | uint16 m_aLig, |
michael@0 | 120 | m_numPseudo, |
michael@0 | 121 | m_nClass, |
michael@0 | 122 | m_nLinear, |
michael@0 | 123 | m_gEndLine; |
michael@0 | 124 | gr_faceinfo m_silfinfo; |
michael@0 | 125 | |
michael@0 | 126 | void releaseBuffers() throw(); |
michael@0 | 127 | }; |
michael@0 | 128 | |
michael@0 | 129 | } // namespace graphite2 |