1// SPDX-License-Identifier: MIT OR MPL-2.0 OR LGPL-2.1-or-later OR GPL-2.0-or-later
2// Copyright 2010, SIL International, All rights reserved.
3
4#pragma once
5
6#include "inc/Main.h"
7#include "inc/Position.h"
8#include "inc/Sparse.h"
9
10namespace graphite2 {
11
12enum metrics {
13 kgmetLsb = 0, kgmetRsb,
14 kgmetBbTop, kgmetBbBottom, kgmetBbLeft, kgmetBbRight,
15 kgmetBbHeight, kgmetBbWidth,
16 kgmetAdvWidth, kgmetAdvHeight,
17 kgmetAscent, kgmetDescent
18};
19
20
21class GlyphFace
22{
23public:
24 GlyphFace();
25 template<typename I>
26 GlyphFace(const Rect & bbox, const Position & adv, I first, const I last);
27
28 const Position & theAdvance() const;
29 const Rect & theBBox() const { return m_bbox; }
30 const sparse & attrs() const { return m_attrs; }
31 int32 getMetric(uint8 metric) const;
32
33 CLASS_NEW_DELETE;
34private:
35 Rect m_bbox; // bounding box metrics in design units
36 Position m_advance; // Advance width and height in design units
37 sparse m_attrs;
38};
39
40
41// Inlines: class GlyphFace
42//
43inline
44GlyphFace::GlyphFace()
45{}
46
47template<typename I>
48GlyphFace::GlyphFace(const Rect & bbox, const Position & adv, I first, const I last)
49: m_bbox(bbox),
50 m_advance(adv),
51 m_attrs(first, last)
52{
53}
54
55inline
56const Position & GlyphFace::theAdvance() const {
57 return m_advance;
58}
59
60} // namespace graphite2
61