LCOV - code coverage report
Current view: directory - gfx/graphite2/src/inc - GlyphFace.h (source / functions) Found Hit Coverage
Test: app.info Lines: 12 0 0.0 %
Date: 2012-06-02 Functions: 9 0 0.0 %

       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 "inc/Main.h"
      30                 : #include "inc/Position.h"
      31                 : #include "inc/Sparse.h"
      32                 : 
      33                 : namespace graphite2 {
      34                 : 
      35                 : enum metrics {
      36                 :     kgmetLsb = 0, kgmetRsb,
      37                 :     kgmetBbTop, kgmetBbBottom, kgmetBbLeft, kgmetBbRight,
      38                 :     kgmetBbHeight, kgmetBbWidth,
      39                 :     kgmetAdvWidth, kgmetAdvHeight,
      40                 :     kgmetAscent, kgmetDescent
      41                 : };
      42                 : 
      43                 : class Rect
      44                 : {
      45                 : public :
      46               0 :     Rect() {}
      47               0 :     Rect(const Position& botLeft, const Position& topRight): bl(botLeft), tr(topRight) {}
      48               0 :     Rect widen(const Rect& other) { return Rect(Position(bl.x > other.bl.x ? other.bl.x : bl.x, bl.y > other.bl.y ? other.bl.y : bl.y), Position(tr.x > other.tr.x ? tr.x : other.tr.x, tr.y > other.tr.y ? tr.y : other.tr.y)); }
      49               0 :     Rect operator + (const Position &a) const { return Rect(Position(bl.x + a.x, bl.y + a.y), Position(tr.x + a.x, tr.y + a.y)); }
      50               0 :     Rect operator * (float m) const { return Rect(Position(bl.x, bl.y) * m, Position(tr.x, tr.y) * m); }
      51                 : 
      52                 :     Position bl;
      53                 :     Position tr;
      54                 : };
      55                 : 
      56                 : class GlyphFaceCacheHeader;
      57                 : 
      58                 : class GlyphFace
      59                 : {
      60                 : private:
      61                 : friend class GlyphFaceCache;
      62                 :     GlyphFace(const GlyphFaceCacheHeader& hdr, unsigned short glyphid);
      63                 :     ~GlyphFace() throw();
      64                 : 
      65                 : public:
      66                 : 
      67                 :     const Position    & theAdvance() const;
      68               0 :     const Rect &theBBox() const { return m_bbox; }
      69               0 :     uint16  getAttr(uint8 index) const { 
      70               0 :         return m_attrs ? m_attrs[index] : 0;
      71                 :     }
      72                 :     uint16  getMetric(uint8 metric) const;
      73                 : 
      74                 : private:
      75                 :     Rect     m_bbox;        // bounding box metrics in design units
      76                 :     Position m_advance;     // Advance width and height in design units
      77                 :     sparse   m_attrs;
      78                 : };
      79                 : 
      80                 : 
      81               0 : inline GlyphFace::~GlyphFace() throw() {
      82               0 : }
      83                 : 
      84               0 : inline const Position & GlyphFace::theAdvance() const { 
      85               0 :     return m_advance;
      86                 : }
      87                 : 
      88                 : } // namespace graphite2

Generated by: LCOV version 1.7