1
//========================================================================
5
// Copyright 2001-2003 Glyph & Cog, LLC
7
//========================================================================
9
//========================================================================
11
// Modified under the Poppler project - http://poppler.freedesktop.org
13
// All changes made under the Poppler project to this file are licensed
14
// under GPL version 2 or later
16
// Copyright (C) 2008 Koji Otani <sho@bbr.jp>
17
// Copyright (C) 2009 Albert Astals Cid <aacid@kde.org>
19
// To see a description of the changes please see the Changelog file that
20
// came with your tarball or type make ChangeLog if you are building from git
22
//========================================================================
27
#ifdef USE_GCC_PRAGMAS
31
#include "poppler-config.h"
32
#include "goo/gtypes.h"
33
#include "CharTypes.h"
36
#include "goo/GooMutex.h"
40
struct CMapVectorEntry;
44
//------------------------------------------------------------------------
49
// Create the CMap specified by <collection> and <cMapName>. Sets
50
// the initial reference count to 1.
51
// Stream is a stream containing the CMap, can be NULL and
52
// this means the CMap will be searched in the CMap files
53
// Returns NULL on failure.
54
static CMap *parse(CMapCache *cache, GooString *collectionA,
55
GooString *cMapNameA, Stream *stream);
62
// Return collection name (<registry>-<ordering>).
63
GooString *getCollection() { return collection; }
65
// Return true if this CMap matches the specified <collectionA>, and
67
GBool match(GooString *collectionA, GooString *cMapNameA);
69
// Return the CID corresponding to the character code starting at
70
// <s>, which contains <len> bytes. Sets *<nUsed> to the number of
71
// bytes used by the char code.
72
CID getCID(char *s, int len, int *nUsed);
74
// Return the writing mode (0=horizontal, 1=vertical).
75
int getWMode() { return wMode; }
77
void setReverseMap(Guint *rmap, Guint rmapSize, Guint ncand);
81
CMap(GooString *collectionA, GooString *cMapNameA);
82
CMap(GooString *collectionA, GooString *cMapNameA, int wModeA);
83
void useCMap(CMapCache *cache, char *useName);
84
void copyVector(CMapVectorEntry *dest, CMapVectorEntry *src);
85
void addCodeSpace(CMapVectorEntry *vec, Guint start, Guint end,
87
void addCIDs(Guint start, Guint end, Guint nBytes, CID firstCID);
88
void freeCMapVector(CMapVectorEntry *vec);
89
void setReverseMapVector(Guint startCode, CMapVectorEntry *vec,
90
Guint *rmap, Guint rmapSize, Guint ncand);
92
GooString *collection;
94
int wMode; // writing mode (0=horizontal, 1=vertical)
95
CMapVectorEntry *vector; // vector for first byte (NULL for
103
//------------------------------------------------------------------------
105
#define cMapCacheSize 4
113
// Get the <cMapName> CMap for the specified character collection.
114
// Increments its reference count; there will be one reference for
115
// the cache plus one for the caller of this function.
116
// Stream is a stream containing the CMap, can be NULL and
117
// this means the CMap will be searched in the CMap files
118
// Returns NULL on failure.
119
CMap *getCMap(GooString *collection, GooString *cMapName, Stream *stream);
123
CMap *cache[cMapCacheSize];