root/OpenSceneGraph/trunk/src/osgPlugins/freetype/FreeTypeLibrary.h @ 13041

Revision 13041, 2.1 kB (checked in by robert, 2 years ago)

Ran script to remove trailing spaces and tabs

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
Line 
1/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield
2 *
3 * This library is open source and may be redistributed and/or modified under
4 * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or
5 * (at your option) any later version.  The full license is in LICENSE file
6 * included with this distribution, and on the openscenegraph.org website.
7 *
8 * This library is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
11 * OpenSceneGraph Public License for more details.
12*/
13
14#ifndef FREETYPE_LIBRARY
15#define FREETYPE_LIBRARY
16
17#include "FreeTypeFont.h"
18
19#include <set>
20#include <istream>
21
22#include <osgText/Font>
23#include <osgText/Font3D>
24
25#include <ft2build.h>
26
27class FreeTypeLibrary : public osg::Referenced
28{
29public:
30
31    /** protected destrcutor to prevent inappropriate deletion.*/
32    virtual ~FreeTypeLibrary();
33
34    /** get the singleton instance.*/
35    static FreeTypeLibrary* instance();
36
37    OpenThreads::Mutex& getMutex() { return _mutex; }
38
39    osgText::Font* getFont(const std::string& fontfile,unsigned int index=0, unsigned int flags=0);
40    osgText::Font* getFont(std::istream& fontstream, unsigned int index=0, unsigned int flags=0);
41
42    void removeFontImplmentation(FreeTypeFont* fontImpl) { _fontImplementationSet.erase(fontImpl); }
43
44protected:
45
46    /** common method to load a FT_Face from a file*/
47    bool getFace(const std::string& fontfile,unsigned int index, FT_Face & face);
48    /** common method to load a FT_Face from a stream */
49    FT_Byte* getFace(std::istream& fontstream, unsigned int index, FT_Face & face);
50
51    /** Verify the correct character mapping for MS windows */
52    void  verifyCharacterMap(FT_Face face);
53
54    /** protected constructor to ensure the only way to create the
55      * library is via the singleton instance method.*/
56    FreeTypeLibrary();
57
58    typedef std::set< FreeTypeFont* > FontImplementationSet;
59
60    mutable OpenThreads::Mutex  _mutex;
61    FT_Library                  _ftlibrary;
62    FontImplementationSet       _fontImplementationSet;
63
64};
65
66
67#endif
Note: See TracBrowser for help on using the browser.