LCOV - code coverage report
Current view: top level - gfx/graphite2/src/inc - Slot.h (source / functions) Hit Total Coverage
Test: output.info Lines: 0 39 0.0 %
Date: 2017-07-14 16:53:18 Functions: 0 39 0.0 %
Legend: Lines: hit not hit

          Line data    Source code
       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 "graphite2/Types.h"
      30             : #include "graphite2/Segment.h"
      31             : #include "inc/Main.h"
      32             : #include "inc/Font.h"
      33             : #include "inc/Position.h"
      34             : 
      35             : namespace graphite2 {
      36             : 
      37             : typedef gr_attrCode attrCode;
      38             : 
      39             : class GlyphFace;
      40             : class SegCacheEntry;
      41             : class Segment;
      42             : 
      43             : struct SlotJustify
      44             : {
      45             :     static const int NUMJUSTPARAMS = 5;
      46             : 
      47             :     SlotJustify(const SlotJustify &);
      48             :     SlotJustify & operator = (const SlotJustify &);
      49             : 
      50             : public:
      51           0 :     static size_t size_of(size_t levels) { return sizeof(SlotJustify) + ((levels > 1 ? levels : 1)*NUMJUSTPARAMS - 1)*sizeof(int16); }
      52             : 
      53             :     void LoadSlot(const Slot *s, const Segment *seg);
      54             : 
      55             :     SlotJustify *next;
      56             :     int16 values[1];
      57             : };
      58             : 
      59             : class Slot
      60             : {
      61             :     enum Flag
      62             :     {
      63             :         DELETED     = 1,
      64             :         INSERTED    = 2,
      65             :         COPIED      = 4,
      66             :         POSITIONED  = 8,
      67             :         ATTACHED    = 16
      68             :     };
      69             : 
      70             : public:
      71             :     struct iterator;
      72             : 
      73           0 :     unsigned short gid() const { return m_glyphid; }
      74           0 :     Position origin() const { return m_position; }
      75           0 :     float advance() const { return m_advance.x; }
      76           0 :     void advance(Position &val) { m_advance = val; }
      77           0 :     Position advancePos() const { return m_advance; }
      78           0 :     int before() const { return m_before; }
      79           0 :     int after() const { return m_after; }
      80           0 :     uint32 index() const { return m_index; }
      81           0 :     void index(uint32 val) { m_index = val; }
      82             : 
      83             :     Slot(int16 *m_userAttr = NULL);
      84             :     void set(const Slot & slot, int charOffset, size_t numUserAttr, size_t justLevels, size_t numChars);
      85           0 :     Slot *next() const { return m_next; }
      86           0 :     void next(Slot *s) { m_next = s; }
      87           0 :     Slot *prev() const { return m_prev; }
      88           0 :     void prev(Slot *s) { m_prev = s; }
      89           0 :     uint16 glyph() const { return m_realglyphid ? m_realglyphid : m_glyphid; }
      90             :     void setGlyph(Segment *seg, uint16 glyphid, const GlyphFace * theGlyph = NULL);
      91             :     void setRealGid(uint16 realGid) { m_realglyphid = realGid; }
      92             :     void adjKern(const Position &pos) { m_shift = m_shift + pos; m_advance = m_advance + pos; }
      93           0 :     void origin(const Position &pos) { m_position = pos + m_shift; }
      94           0 :     void originate(int ind) { m_original = ind; }
      95           0 :     int original() const { return m_original; }
      96           0 :     void before(int ind) { m_before = ind; }
      97           0 :     void after(int ind) { m_after = ind; }
      98           0 :     bool isBase() const { return (!m_parent); }
      99             :     void update(int numSlots, int numCharInfo, Position &relpos);
     100             :     Position finalise(const Segment* seg, const Font* font, Position & base, Rect & bbox, uint8 attrLevel, float & clusterMin, bool rtl, bool isFinal, int depth = 0);
     101           0 :     bool isDeleted() const { return (m_flags & DELETED) ? true : false; }
     102           0 :     void markDeleted(bool state) { if (state) m_flags |= DELETED; else m_flags &= ~DELETED; }
     103           0 :     bool isCopied() const { return (m_flags & COPIED) ? true : false; }
     104           0 :     void markCopied(bool state) { if (state) m_flags |= COPIED; else m_flags &= ~COPIED; }
     105             :     bool isPositioned() const { return (m_flags & POSITIONED) ? true : false; }
     106             :     void markPositioned(bool state) { if (state) m_flags |= POSITIONED; else m_flags &= ~POSITIONED; }
     107           0 :     bool isInsertBefore() const { return !(m_flags & INSERTED); }
     108             :     uint8 getBidiLevel() const { return m_bidiLevel; }
     109             :     void setBidiLevel(uint8 level) { m_bidiLevel = level; }
     110             :     int8 getBidiClass(const Segment *seg);
     111           0 :     int8 getBidiClass() const { return m_bidiCls; }
     112           0 :     void setBidiClass(int8 cls) { m_bidiCls = cls; }
     113           0 :     int16 *userAttrs() const { return m_userAttr; }
     114           0 :     void userAttrs(int16 *p) { m_userAttr = p; }
     115           0 :     void markInsertBefore(bool state) { if (!state) m_flags |= INSERTED; else m_flags &= ~INSERTED; }
     116             :     void setAttr(Segment* seg, attrCode ind, uint8 subindex, int16 val, const SlotMap & map);
     117             :     int getAttr(const Segment *seg, attrCode ind, uint8 subindex) const;
     118             :     int getJustify(const Segment *seg, uint8 level, uint8 subindex) const;
     119             :     void setJustify(Segment *seg, uint8 level, uint8 subindex, int16 value);
     120             :     bool isLocalJustify() const { return m_justs != NULL; };
     121           0 :     void attachTo(Slot *ap) { m_parent = ap; }
     122           0 :     Slot *attachedTo() const { return m_parent; }
     123             :     Position attachOffset() const { return m_attach - m_with; }
     124           0 :     Slot* firstChild() const { return m_child; }
     125           0 :     void firstChild(Slot *ap) { m_child = ap; }
     126             :     bool child(Slot *ap);
     127           0 :     Slot* nextSibling() const { return m_sibling; }
     128           0 :     void nextSibling(Slot *ap) { m_sibling = ap; }
     129             :     bool sibling(Slot *ap);
     130             :     bool removeChild(Slot *ap);
     131             :     int32 clusterMetric(const Segment* seg, uint8 metric, uint8 attrLevel, bool rtl);
     132             :     void positionShift(Position a) { m_position += a; }
     133             :     void floodShift(Position adj, int depth = 0);
     134           0 :     float just() const { return m_just; }
     135           0 :     void just(float j) { m_just = j; }
     136             :     Slot *nextInCluster(const Slot *s) const;
     137             :     bool isChildOf(const Slot *base) const;
     138             : 
     139             :     CLASS_NEW_DELETE
     140             : 
     141             : private:
     142             :     Slot *m_next;           // linked list of slots
     143             :     Slot *m_prev;
     144             :     unsigned short m_glyphid;        // glyph id
     145             :     uint16 m_realglyphid;
     146             :     uint32 m_original;      // charinfo that originated this slot (e.g. for feature values)
     147             :     uint32 m_before;        // charinfo index of before association
     148             :     uint32 m_after;         // charinfo index of after association
     149             :     uint32 m_index;         // slot index given to this slot during finalising
     150             :     Slot *m_parent;         // index to parent we are attached to
     151             :     Slot *m_child;          // index to first child slot that attaches to us
     152             :     Slot *m_sibling;        // index to next child that attaches to our parent
     153             :     Position m_position;    // absolute position of glyph
     154             :     Position m_shift;       // .shift slot attribute
     155             :     Position m_advance;     // .advance slot attribute
     156             :     Position m_attach;      // attachment point on us
     157             :     Position m_with;        // attachment point position on parent
     158             :     float    m_just;        // Justification inserted space
     159             :     uint8    m_flags;       // holds bit flags
     160             :     byte     m_attLevel;    // attachment level
     161             :     int8     m_bidiCls;     // bidirectional class
     162             :     byte     m_bidiLevel;   // bidirectional level
     163             :     int16   *m_userAttr;    // pointer to user attributes
     164             :     SlotJustify *m_justs;   // pointer to justification parameters
     165             : 
     166             :     friend class SegCacheEntry;
     167             :     friend class Segment;
     168             : };
     169             : 
     170             : } // namespace graphite2
     171             : 
     172             : struct gr_slot : public graphite2::Slot {};

Generated by: LCOV version 1.13