summaryrefslogtreecommitdiff
path: root/thirdparty/graphite/src/inc/CmapCache.h
blob: b18ce2929b939e866bc447d49c03e9d13e32bf00 (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
// 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.

#pragma once

#include "inc/Main.h"
#include "inc/Face.h"

namespace graphite2 {

class Face;

class Cmap
{
public:

    virtual ~Cmap() throw() {}

    virtual uint16 operator [] (const uint32) const throw() { return 0; }

    virtual operator bool () const throw() { return false; }

    CLASS_NEW_DELETE;
};

class DirectCmap : public Cmap
{
    DirectCmap(const DirectCmap &);
    DirectCmap & operator = (const DirectCmap &);

public:
    DirectCmap(const Face &);
    virtual uint16 operator [] (const uint32 usv) const throw();
    virtual operator bool () const throw();

    CLASS_NEW_DELETE;
private:
    const Face::Table   _cmap;
    const void        * _smp,
                      * _bmp;
};

class CachedCmap : public Cmap
{
    CachedCmap(const CachedCmap &);
    CachedCmap & operator = (const CachedCmap &);

public:
    CachedCmap(const Face &);
    virtual ~CachedCmap() throw();
    virtual uint16 operator [] (const uint32 usv) const throw();
    virtual operator bool () const throw();
    CLASS_NEW_DELETE;
private:
    bool m_isBmpOnly;
    uint16 ** m_blocks;
};

} // namespace graphite2