summaryrefslogtreecommitdiff
path: root/src/lib/preprocess/SvgFont.cpp
blob: 4309188bc39b252d7c4b116dbbe09e490c3edfec (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
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
#include "SvgFont.h"

using namespace std;


SvgFontC::SvgFontC(
  unsigned int id, double heightInch, unsigned int weight, bool isItalic, const string &faceName
)
  : m_id(id),
    m_heightInch(heightInch),
    m_weight(weight),
    m_isItalic(isItalic),
    m_faceName(faceName)
{
}

unsigned int SvgFontC::GetId() const
{
  return m_id;
}

double SvgFontC::GetHeightInch() const
{
  return m_heightInch;
}

unsigned int SvgFontC::GetWeight() const
{
  return m_weight;
}

bool SvgFontC::IsItalic() const
{
  return m_isItalic;
}

string SvgFontC::GetFaceName() const
{
  return m_faceName;
}


bool SvgFontCompareS::operator()(const SvgFontC *pFont1, const SvgFontC *pFont2) const
{
  if (pFont1->GetHeightInch() != pFont2->GetHeightInch())
  {
    return pFont1->GetHeightInch() < pFont2->GetHeightInch();
  }

  if (pFont1->GetWeight() != pFont2->GetWeight())
  {
    return pFont1->GetWeight() < pFont2->GetWeight();
  }

  if (pFont1->IsItalic() != pFont2->IsItalic())
  {
    return !pFont1->IsItalic();
  }

  return pFont1->GetFaceName().compare(pFont2->GetFaceName()) < 0;
}