1 /*
2 * FTGL - OpenGL font library
3 *
4 * Copyright (c) 2001-2004 Henry Maddocks <ftgl@opengl.geek.nz>
5 * Copyright (c) 2008 Sam Hocevar <sam@zoy.org>
6 *
7 * Permission is hereby granted, free of charge, to any person obtaining
8 * a copy of this software and associated documentation files (the
9 * "Software"), to deal in the Software without restriction, including
10 * without limitation the rights to use, copy, modify, merge, publish,
11 * distribute, sublicense, and/or sell copies of the Software, and to
12 * permit persons to whom the Software is furnished to do so, subject to
13 * the following conditions:
14 *
15 * The above copyright notice and this permission notice shall be
16 * included in all copies or substantial portions of the Software.
17 *
18 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
19 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
20 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
21 * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
22 * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
23 * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
24 * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
25 */
26
27 #include "config.h"
28
29 #include "FTGL/ftgl.h"
30
31 #include "FTInternals.h"
32 #include "FTExtrudeFontImpl.h"
33
34
35 //
36 // FTExtrudeFont
37 //
38
39
FTExtrudeFont(char const * fontFilePath)40 FTExtrudeFont::FTExtrudeFont(char const *fontFilePath) :
41 FTFont(new FTExtrudeFontImpl(this, fontFilePath))
42 {}
43
44
FTExtrudeFont(const unsigned char * pBufferBytes,size_t bufferSizeInBytes)45 FTExtrudeFont::FTExtrudeFont(const unsigned char *pBufferBytes,
46 size_t bufferSizeInBytes) :
47 FTFont(new FTExtrudeFontImpl(this, pBufferBytes, bufferSizeInBytes))
48 {}
49
50
~FTExtrudeFont()51 FTExtrudeFont::~FTExtrudeFont()
52 {}
53
54
MakeGlyph(FT_GlyphSlot ftGlyph)55 FTGlyph* FTExtrudeFont::MakeGlyph(FT_GlyphSlot ftGlyph)
56 {
57 FTExtrudeFontImpl *myimpl = dynamic_cast<FTExtrudeFontImpl *>(impl);
58 if(!myimpl)
59 {
60 return NULL;
61 }
62
63 return new FTExtrudeGlyph(ftGlyph, myimpl->depth, myimpl->front,
64 myimpl->back, myimpl->useDisplayLists);
65 }
66
67
68 //
69 // FTExtrudeFontImpl
70 //
71
72
FTExtrudeFontImpl(FTFont * ftFont,const char * fontFilePath)73 FTExtrudeFontImpl::FTExtrudeFontImpl(FTFont *ftFont, const char* fontFilePath)
74 : FTFontImpl(ftFont, fontFilePath),
75 depth(0.0f), front(0.0f), back(0.0f)
76 {
77 load_flags = FT_LOAD_NO_HINTING;
78 }
79
80
FTExtrudeFontImpl(FTFont * ftFont,const unsigned char * pBufferBytes,size_t bufferSizeInBytes)81 FTExtrudeFontImpl::FTExtrudeFontImpl(FTFont *ftFont,
82 const unsigned char *pBufferBytes,
83 size_t bufferSizeInBytes)
84 : FTFontImpl(ftFont, pBufferBytes, bufferSizeInBytes),
85 depth(0.0f), front(0.0f), back(0.0f)
86 {
87 load_flags = FT_LOAD_NO_HINTING;
88 }
89
90