w32tex
About: TeX Live provides a comprehensive TeX system including all the major TeX-related programs, macro packages, and fonts that are free software. Windows sources.
  Fossies Dox: w32tex-src.tar.xz  ("unofficial" and yet experimental doxygen-generated source code documentation)  

Pass.h
Go to the documentation of this file.
1 /* GRAPHITE2 LICENSING
2 
3  Copyright 2010, SIL International
4  All rights reserved.
5 
6  This library is free software; you can redistribute it and/or modify
7  it under the terms of the GNU Lesser General Public License as published
8  by the Free Software Foundation; either version 2.1 of License, or
9  (at your option) any later version.
10 
11  This program is distributed in the hope that it will be useful,
12  but WITHOUT ANY WARRANTY; without even the implied warranty of
13  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14  Lesser General Public License for more details.
15 
16  You should also have received a copy of the GNU Lesser General Public
17  License along with this library in the file named "LICENSE".
18  If not, write to the Free Software Foundation, 51 Franklin Street,
19  Suite 500, Boston, MA 02110-1335, USA or visit their web page on the
20  internet at http://www.fsf.org/licenses/lgpl.html.
21 
22 Alternatively, the contents of this file may be used under the terms of the
23 Mozilla Public License (http://mozilla.org/MPL) or the GNU General Public
24 License, as published by the Free Software Foundation, either version 2
25 of the License or (at your option) any later version.
26 */
27 #pragma once
28 
29 #include <cstdlib>
30 #include "inc/Code.h"
31 
32 namespace graphite2 {
33 
34 class Segment;
35 class Face;
36 class Silf;
37 struct Rule;
38 struct RuleEntry;
39 struct State;
40 class FiniteStateMachine;
41 class Error;
42 class ShiftCollider;
43 class KernCollider;
44 class json;
45 
46 enum passtype;
47 
48 class Pass
49 {
50 public:
51  Pass();
52  ~Pass();
53 
54  bool readPass(const byte * pPass, size_t pass_length, size_t subtable_base, Face & face,
55  enum passtype pt, uint32 version, Error &e);
56  bool runGraphite(vm::Machine & m, FiniteStateMachine & fsm, bool reverse) const;
57  void init(Silf *silf) { m_silf = silf; }
58  byte collisionLoops() const { return m_numCollRuns; }
59  bool reverseDir() const { return m_isReverseDir; }
60 
62 private:
63  void findNDoRule(Slot* & iSlot, vm::Machine &, FiniteStateMachine& fsm) const;
64  int doAction(const vm::Machine::Code* codeptr, Slot * & slot_out, vm::Machine &) const;
66  bool testConstraint(const Rule & r, vm::Machine &) const;
67  bool readRules(const byte * rule_map, const size_t num_entries,
68  const byte *precontext, const uint16 * sort_key,
69  const uint16 * o_constraint, const byte *constraint_data,
70  const uint16 * o_action, const byte * action_data,
71  Face &, enum passtype pt, Error &e);
72  bool readStates(const byte * starts, const byte * states, const byte * o_rule_map, Face &, Error &e);
73  bool readRanges(const byte * ranges, size_t num_ranges, Error &e);
74  uint16 glyphToCol(const uint16 gid) const;
75  bool runFSM(FiniteStateMachine & fsm, Slot * slot) const;
76  void dumpRuleEventConsidered(const FiniteStateMachine & fsm, const RuleEntry & re) const;
77  void dumpRuleEventOutput(const FiniteStateMachine & fsm, const Rule & r, Slot * os) const;
78  void adjustSlot(int delta, Slot * & slot_out, SlotMap &) const;
79  bool collisionShift(Segment *seg, int dir, json * const dbgout) const;
80  bool collisionKern(Segment *seg, int dir, json * const dbgout) const;
81  bool collisionFinish(Segment *seg, GR_MAYBE_UNUSED json * const dbgout) const;
82  bool resolveCollisions(Segment *seg, Slot *slot, Slot *start, ShiftCollider &coll, bool isRev,
83  int dir, bool &moved, bool &hasCol, json * const dbgout) const;
84  float resolveKern(Segment *seg, Slot *slot, Slot *start, int dir,
85  float &ymin, float &ymax, json *const dbgout) const;
86 
87  const Silf * m_silf;
89  Rule * m_rules; // rules
91  uint16 * m_startStates; // prectxt length
95  byte * m_progs;
96 
99  byte m_iMaxLoop;
112 
113 private: //defensive
114  Pass(const Pass&);
115  Pass& operator=(const Pass&);
116 };
117 
118 } // namespace graphite2
Definition: error.hpp:20
Definition: rule.hpp:20
vm::Machine::Code m_cPConstraint
Definition: Pass.h:111
bool testConstraint(const Rule &r, vm::Machine &) const
Pass(const Pass &)
bool readPass(const byte *pPass, size_t pass_length, size_t subtable_base, Face &face, enum passtype pt, uint32 version, Error &e)
Definition: Pass.cpp:93
byte m_kernColls
Definition: Pass.h:98
void findNDoRule(Slot *&iSlot, vm::Machine &, FiniteStateMachine &fsm) const
uint16 * m_startStates
Definition: Pass.h:91
bool readStates(const byte *starts, const byte *states, const byte *o_rule_map, Face &, Error &e)
Definition: Pass.cpp:310
uint16 m_successStart
Definition: Pass.h:105
byte m_minPreCtxt
Definition: Pass.h:107
Pass & operator=(const Pass &)
State * m_states
Definition: Pass.h:93
bool collisionFinish(Segment *seg, GR_MAYBE_UNUSED json *const dbgout) const
int doAction(const vm::Machine::Code *codeptr, Slot *&slot_out, vm::Machine &) const
byte collisionLoops() const
Definition: Pass.h:58
uint16 m_numStates
Definition: Pass.h:102
bool reverseDir() const
Definition: Pass.h:59
bool runGraphite(vm::Machine &m, FiniteStateMachine &fsm, bool reverse) const
Definition: Pass.cpp:398
uint16 * m_transitions
Definition: Pass.h:92
void adjustSlot(int delta, Slot *&slot_out, SlotMap &) const
Definition: Pass.cpp:699
byte m_maxPreCtxt
Definition: Pass.h:108
float resolveKern(Segment *seg, Slot *slot, Slot *start, int dir, float &ymin, float &ymax, json *const dbgout) const
Definition: Pass.cpp:1031
bool m_isReverseDir
Definition: Pass.h:110
byte m_numCollRuns
Definition: Pass.h:97
bool runFSM(FiniteStateMachine &fsm, Slot *slot) const
Definition: Pass.cpp:454
uint16 m_numRules
Definition: Pass.h:101
const Silf * m_silf
Definition: Pass.h:87
bool readRules(const byte *rule_map, const size_t num_entries, const byte *precontext, const uint16 *sort_key, const uint16 *o_constraint, const byte *constraint_data, const uint16 *o_action, const byte *action_data, Face &, enum passtype pt, Error &e)
Definition: Pass.cpp:214
uint16 m_numColumns
Definition: Pass.h:106
byte * m_progs
Definition: Pass.h:95
void dumpRuleEventConsidered(const FiniteStateMachine &fsm, const RuleEntry &re) const
Definition: Pass.cpp:566
bool collisionShift(Segment *seg, int dir, json *const dbgout) const
Definition: Pass.cpp:736
bool resolveCollisions(Segment *seg, Slot *slot, Slot *start, ShiftCollider &coll, bool isRev, int dir, bool &moved, bool &hasCol, json *const dbgout) const
Definition: Pass.cpp:947
Rule * m_rules
Definition: Pass.h:89
uint16 * m_cols
Definition: Pass.h:88
vm::Machine::Code * m_codes
Definition: Pass.h:94
bool collisionKern(Segment *seg, int dir, json *const dbgout) const
Definition: Pass.cpp:865
bool readRanges(const byte *ranges, size_t num_ranges, Error &e)
Definition: Pass.cpp:373
bool testPassConstraint(vm::Machine &m) const
uint16 glyphToCol(const uint16 gid) const
void init(Silf *silf)
Definition: Pass.h:57
void dumpRuleEventOutput(const FiniteStateMachine &fsm, const Rule &r, Slot *os) const
Definition: Pass.cpp:585
uint16 m_numGlyphs
Definition: Pass.h:100
byte m_iMaxLoop
Definition: Pass.h:99
RuleEntry * m_ruleMap
Definition: Pass.h:90
uint16 m_numSuccess
Definition: Pass.h:104
uint16 m_numTransition
Definition: Pass.h:103
byte m_colThreshold
Definition: Pass.h:109
void sort_key(void)
Definition: dvispc.c:2085
FT_Face face
Definition: cffdrivr.c:659
enum State_ State
Definition: bits.h:30
passtype
Definition: Code.h:44
gr_uint16 uint16
Definition: Main.h:40
gr_uint32 uint32
Definition: Main.h:41
#define version
Definition: nup.c:10
#define codeptr(v)
Definition: obx.h:93
static int delta
Definition: pbmtolj.c:36
static boolean reverse
Definition: ppagelist.c:30
int r
Definition: ppmqvga.c:68
#define dir
#define GR_MAYBE_UNUSED
Definition: Main.h:172
#define CLASS_NEW_DELETE
Definition: Main.h:159
slotref slot
Definition: opcodes.h:237
state_type states[100]
Definition: routines.c:44
ShellFileEnvironment e
Definition: sh6.c:388
Definition: gd.c:2418
m
Definition: tex4ht.c:3990
@ start
Definition: preamble.c:52
PATTERN * pt
Definition: vlna.c:74