1 /*
2  * gltt graphics library
3  * Copyright (C) 1998-1999 Stephane Rehel
4  *
5  * This library is free software; you can redistribute it and/or
6  * modify it under the terms of the GNU Library General Public
7  * License as published by the Free Software Foundation; either
8  * version 2 of the License, or (at your option) any later version.
9  *
10  * This library is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
13  * Library General Public License for more details.
14  *
15  * You should have received a copy of the GNU Library General Public
16  * License along with this library; if not, write to the Free
17  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
18  */
19 
20 #ifndef __FTFace_h
21 #define __FTFace_h
22 
23 #ifndef __GLTTboolean_h
24 #include "GLTTboolean.h"
25 #endif
26 
27 struct TT_Face_;
28 typedef struct TT_Face_ TT_Face;
29 
30 class FTEngine;
31 
32 /////////////////////////////////////////////////////////////////////////////
33 
34 class FTFace
35 {
36 protected:
37   FTEngine* engine;
38   TT_Face* face;
39   int indices[256];
40   int* CP_table;
41 
42 public:
43   FTFace( FTEngine* _engine = 0 );
44 
45   virtual ~FTFace();
46 
47   GLTTboolean open( const char* filename );
48 
49   int CP_Translate( int code ) const;
50 
51 private:
52   GLTTboolean makeIndicesTable();
53 
54 public:
getEngine()55   FTEngine* getEngine() const
56     {
57     return engine;
58     }
59 
getFace()60   TT_Face* getFace() const
61     {
62     return face;
63     }
64 
getGlyphIndex(int ascii_code)65   int getGlyphIndex( int ascii_code ) const
66     {
67     if( ascii_code < 0 || ascii_code > 255 )
68       ascii_code= 0;
69 
70     return indices[ascii_code];
71     }
72 };
73 
74 /////////////////////////////////////////////////////////////////////////////
75 
76 #endif // ifndef __FTFace_h
77