summaryrefslogtreecommitdiff
path: root/thirdparty/graphite/src/GlyphFace.cpp
blob: d9408f556b18fd02b5b4aa37bf79c2174cb8f3bb (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
// SPDX-License-Identifier: MIT OR MPL-2.0 OR LGPL-2.1-or-later OR GPL-2.0-or-later
// Copyright 2010, SIL International, All rights reserved.

#include "inc/GlyphFace.h"


using namespace graphite2;

int32 GlyphFace::getMetric(uint8 metric) const
{
    switch (metrics(metric))
    {
        case kgmetLsb       : return int32(m_bbox.bl.x);
        case kgmetRsb       : return int32(m_advance.x - m_bbox.tr.x);
        case kgmetBbTop     : return int32(m_bbox.tr.y);
        case kgmetBbBottom  : return int32(m_bbox.bl.y);
        case kgmetBbLeft    : return int32(m_bbox.bl.x);
        case kgmetBbRight   : return int32(m_bbox.tr.x);
        case kgmetBbHeight  : return int32(m_bbox.tr.y - m_bbox.bl.y);
        case kgmetBbWidth   : return int32(m_bbox.tr.x - m_bbox.bl.x);
        case kgmetAdvWidth  : return int32(m_advance.x);
        case kgmetAdvHeight : return int32(m_advance.y);
        default : return 0;
    }
}