summaryrefslogtreecommitdiff
path: root/Build/source/libs/xpdf/xpdf-src/xpdf/UnicodeRemapping.h
blob: 679c002987fd289e46d838fac57ce75fd559f14d (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
//========================================================================
//
// UnicodeRemapping.h
//
// Sparse remapping of Unicode characters.
//
// Copyright 2018 Glyph & Cog, LLC
//
//========================================================================

#ifndef UNICODEREMAPPING_H
#define UNICODEREMAPPING_H

#include <aconf.h>

#include "CharTypes.h"

struct UnicodeRemappingString;

//------------------------------------------------------------------------

class UnicodeRemapping {
public:

  // Create an empty (i.e., identity) remapping.
  UnicodeRemapping();

  ~UnicodeRemapping();

  // Add a remapping for <in>.
  void addRemapping(Unicode in, Unicode *out, int len);

  // Add entries from the specified file to this UnicodeRemapping.
  void parseFile(GString *fileName);

  // Map <in> to zero or more (up to <size>) output characters in
  // <out>.  Returns the number of output characters.
  int map(Unicode in, Unicode *out, int size);

private:

  int findSMap(Unicode u);

  Unicode page0[256];
  UnicodeRemappingString *sMap;
  int sMapLen, sMapSize;
};

#endif