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 | #include "inc/GlyphFace.h" |
5 | |
6 | |
7 | using namespace graphite2; |
8 | |
9 | int32 GlyphFace::getMetric(uint8 metric) const |
10 | { |
11 | switch (metrics(metric)) |
12 | { |
13 | case kgmetLsb : return int32(m_bbox.bl.x); |
14 | case kgmetRsb : return int32(m_advance.x - m_bbox.tr.x); |
15 | case kgmetBbTop : return int32(m_bbox.tr.y); |
16 | case kgmetBbBottom : return int32(m_bbox.bl.y); |
17 | case kgmetBbLeft : return int32(m_bbox.bl.x); |
18 | case kgmetBbRight : return int32(m_bbox.tr.x); |
19 | case kgmetBbHeight : return int32(m_bbox.tr.y - m_bbox.bl.y); |
20 | case kgmetBbWidth : return int32(m_bbox.tr.x - m_bbox.bl.x); |
21 | case kgmetAdvWidth : return int32(m_advance.x); |
22 | case kgmetAdvHeight : return int32(m_advance.y); |
23 | default : return 0; |
24 | } |
25 | } |
26 |