Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
path: root/pdf/xpdf/FontEncoding.h
blob: 7c811536a8c852ee8e5024ccf4661dfdf78fed74 (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
62
63
64
//========================================================================
//
// FontEncoding.h
//
// Copyright 1999 Derek B. Noonburg
//
//========================================================================

#ifndef FONTENCODING_H
#define FONTENCODING_H

#ifdef __GNUC__
#pragma interface
#endif

#include "gtypes.h"

//------------------------------------------------------------------------
// FontEncoding
//------------------------------------------------------------------------

#define fontEncHashSize 419

class FontEncoding {
public:

  // Construct an empty encoding.
  FontEncoding();

  // Construct an encoding from an array of char names.
  FontEncoding(char **encoding, int size);

  // Destructor.
  ~FontEncoding();

  // Create a copy of the encoding.
  FontEncoding *copy() { return new FontEncoding(this); }

  // Return number of codes in encoding, i.e., max code + 1.
  int getSize() { return size; }

  // Add a char to the encoding.
  void addChar(int code, char *name);

  // Return the character name associated with <code>.
  char *getCharName(int code) { return encoding[code]; }

  // Return the code associated with <name>.
  int getCharCode(char *name);

private:

  FontEncoding(FontEncoding *fontEnc);
  int hash(char *name);
  void addChar1(int code, char *name);

  char **encoding;		// code --> name mapping
  int size;			// number of codes
  GBool freeEnc;		// should we free the encoding array?
  short				// name --> code hash table
    hashTab[fontEncHashSize];
};

#endif