| 1 |
// -*- related-file-name: "../../libefont/encoding.cc" -*- |
| 2 |
#ifndef EFONT_ENCODING_HH |
| 3 |
#define EFONT_ENCODING_HH |
| 4 |
#include <lcdf/vector.hh> |
| 5 |
namespace Efont { |
| 6 |
typedef int GlyphIndex; |
| 7 |
|
| 8 |
class Encoding8 { |
| 9 |
|
| 10 |
Vector<GlyphIndex> _codes; |
| 11 |
Vector<int> _code_map; |
| 12 |
|
| 13 |
public: |
| 14 |
|
| 15 |
Encoding8() : _code_map(256, -1) { } |
| 16 |
|
| 17 |
void reserve_glyphs(int); |
| 18 |
|
| 19 |
int code(GlyphIndex gi) const { return _codes[gi]; } |
| 20 |
GlyphIndex find_code(int c) const { return _code_map[c]; } |
| 21 |
|
| 22 |
void set_code(GlyphIndex gi, int c) { _codes[gi] = c; _code_map[c] = gi; } |
| 23 |
|
| 24 |
}; |
| 25 |
|
| 26 |
} |
| 27 |
#endif |