Main Page | Modules | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Class Members | File Members | Related Pages | Examples

EmbeddedFontImpl.h

Go to the documentation of this file.
00001 //
00002 //  Copyright (c) 2000-2004 by Autodesk, Inc.
00003 //
00004 //  By using this code, you are agreeing to the terms and conditions of
00005 //  the License Agreement included in the documentation for this code.
00006 //
00007 //  AUTODESK MAKES NO WARRANTIES, EXPRESSED OR IMPLIED,
00008 //  AS TO THE CORRECTNESS OF THIS CODE OR ANY DERIVATIVE
00009 //  WORKS WHICH INCORPORATE IT.
00010 //
00011 //  AUTODESK PROVIDES THE CODE ON AN "AS-IS" BASIS
00012 //  AND EXPLICITLY DISCLAIMS ANY LIABILITY, INCLUDING
00013 //  CONSEQUENTIAL AND INCIDENTAL DAMAGES FOR ERRORS,
00014 //  OMISSIONS, AND OTHER PROBLEMS IN THE CODE.
00015 //
00016 //  Use, duplication, or disclosure by the U.S. Government is subject to
00017 //  restrictions set forth in FAR 52.227-19 (Commercial Computer Software
00018 //  Restricted Rights) and DFAR 252.227-7013(c)(1)(ii) (Rights in Technical
00019 //  Data and Computer Software), as applicable.
00020 //
00021 
00022 #ifndef _DWFTK_EMBEDDED_FONT_IMPL_WIN32_H
00023 #define _DWFTK_EMBEDDED_FONT_IMPL_WIN32_H
00024 
00025 
00030 
00031 #include "dwf/publisher/EmbeddedFont.h"
00032 
00033 
00034 #ifdef  _DWFCORE_WIN32_SYSTEM
00035 
00036 #include "dwf/publisher/win32/t2embapi.h"
00037 
00038 
00039 #include "dwfcore/TempFile.h"
00040 #include "dwfcore/BufferInputStream.h"
00041 #include "dwfcore/BufferOutputStream.h"
00042 using namespace DWFCore;
00043 
00044 
00045 #include "dwf/package/FontResource.h"
00046 
00047 
00048 namespace DWFToolkit
00049 {
00050 
00060 class DWFEmbeddedFontImpl_Win32 : public DWFToolkitMemory
00061                                 , public DWFEmbeddedFontImpl
00062 {
00063 
00064 public:
00065 
00066 #ifndef DWFTK_READ_ONLY
00067 
00093     _DWFTK_API
00094     DWFEmbeddedFontImpl_Win32( HFONT    hFont,
00095                                size_t   nHeapLimit = DWFTK_EMBEDDED_FONT_HEAP_LIMIT )
00096         throw();
00097 
00098 #endif
00099 
00109     _DWFTK_API
00110     DWFEmbeddedFontImpl_Win32( DWFFontResource& rFontResource )
00111         throw();
00112 
00118     _DWFTK_API
00119     virtual ~DWFEmbeddedFontImpl_Win32()
00120         throw();
00121 
00122 #ifndef DWFTK_READ_ONLY
00123 
00127     _DWFTK_API
00128     void embed()
00129         throw( DWFException );
00130 
00134     _DWFTK_API
00135     void addCharacters( const DWFString& rCharacters )
00136         throw( DWFException );
00137 
00141     _DWFTK_API
00142     DWFInputStream* getInputStream()
00143         throw( DWFException );
00144 
00148     _DWFTK_API
00149     const DWFString& getFaceName()
00150         throw( DWFException );
00151 
00155     _DWFTK_API
00156     const DWFString& getLogfontName()
00157         throw( DWFException );
00158 
00159 #endif
00160 
00164     _DWFTK_API
00165     int getRequest()
00166         throw( DWFException );
00167 
00171     _DWFTK_API
00172     DWFFontResource::tePrivilege getPrivilege()
00173         throw( DWFException );
00174 
00178     _DWFTK_API
00179     DWFFontResource::teCharacterCode getCharacterCode()
00180         throw( DWFException );
00181 
00185     _DWFTK_API
00186     void load( bool bForceRename = true )
00187         throw ( DWFException );
00188 
00192     _DWFTK_API
00193     const DWFString& loadedFontName() const
00194         throw();
00195 
00199     _DWFTK_API
00200     void unload()
00201         throw ( DWFException );
00202 
00203 private:
00204 
00205 #ifndef DWFTK_READ_ONLY
00206 
00207     //
00208     // streams the EFF to either the heap buffer or temp file
00209     //
00210     void _serializeFont( HDC hDC )
00211         throw( DWFException );
00212 
00213     //
00214     // TTEmbedFont callback
00215     //
00216     static unsigned long _WriteFontBuffer( void*               pStream,
00217                                            const void*         pBuffer,
00218                                            const unsigned long nBytesToWrite )
00219         throw( DWFException );
00220 
00221 #endif
00222 
00223     //
00224     // TTEmbedFont callback
00225     //
00226     static unsigned long _ReadFontBuffer( void*               pStream,
00227                                           void*               pBuffer,
00228                                           const unsigned long nBytesToRead )
00229         throw( DWFException );
00230 
00231     //
00232     // Loads the font embedding library 
00233     //
00234     static void _loadFontLibrary( void );
00235 
00236 private:
00237 
00238 #ifndef DWFTK_READ_ONLY
00239     size_t                  _nHeapLimit;
00240 
00241     HFONT                   _hFont;
00242     DWFString               _zFaceName;
00243     DWFString               _zLogfontName;
00244     DWFTempFile*            _pFontFile;
00245 
00246     bool                    _abCodePoints[65536];
00247         unsigned short          _nCodePoints;
00248     unsigned short*         _pSparseCharacters;
00249 #endif
00250 
00251     unsigned long           _nPriv;
00252     unsigned long           _nRequest;
00253     unsigned long           _nCharacterCode;
00254 
00255     DWFBufferOutputStream*  _pFontOutputStream;
00256     DWFFontResource*        _pFontResource;
00257     DWFInputStream*         _pFontInputStream;
00258     DWFBufferInputStream*   _pReadAheadStream;
00259     HANDLE                  _hLoadedFont;
00260     DWFString               _zLoadedFontName;
00261 
00262     static HINSTANCE                _khLib;
00263     static int                      _knLibRef;
00264     static const char*              _kz_T2Embed;
00265     static fpTTEmbedFont            _kfpTTEmbedFont;
00266     static fpTTLoadEmbeddedFont     _kfpTTLoadEmbeddedFont;
00267     static fpTTDeleteEmbeddedFont   _kfpTTDeleteEmbeddedFont;
00268 
00269 private:
00270 
00271     DWFEmbeddedFontImpl_Win32( const DWFEmbeddedFontImpl_Win32& );
00272     DWFEmbeddedFontImpl_Win32& operator=( const DWFEmbeddedFontImpl_Win32& );
00273 };
00274 
00275 
00276     //
00277     // required for win32 dll external linkage
00278     //
00279 #ifdef  _DWFCORE_WIN32_SYSTEM
00280 #ifndef DWFTK_STATIC
00281 
00282 _declspec(selectany) const char* DWFEmbeddedFontImpl_Win32::_kz_T2Embed = "t2embed.dll";
00283 
00284 #endif
00285 #endif
00286 
00287 }
00288 
00289 
00290 
00291 #else
00292 #error  This is a Win32 header file and is incompatible with your current system configuration
00293 #endif  
00294 
00295 #endif
00296 

Generated on Tue May 17 12:38:50 2005 for Autodesk DWF Toolkit by  doxygen 1.4.1