Main Page   Namespace List   Class Hierarchy   Compound List   File List   Namespace Members   Compound Members   Related Pages  

Descriptor.hh

Go to the documentation of this file.
00001 /*
00002     libpdf++: a C++ Free library to generate PDF file
00003     Copyright (C) 2002 Nestal Wan
00004 
00005     This library is free software; you can redistribute it and/or
00006     modify it under the terms of the GNU Lesser General Public
00007     License as published by the Free Software Foundation; either
00008     version 2.1 of the License, or (at your option) any later version.
00009 
00010     This library is distributed in the hope that it will be useful,
00011     but WITHOUT ANY WARRANTY; without even the implied warranty of
00012     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00013     Lesser General Public License for more details.
00014 
00015     You should have received a copy of the GNU Lesser General Public
00016     License along with this library; if not, write to the Free Software
00017     Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
00018 */
00026 #ifndef __PDF_FONT_DESCRIPTOR_HEADER_INCLUDED__
00027 #define __PDF_FONT_DESCRIPTOR_HEADER_INCLUDED__
00028 
00029 #ifndef __PDF_FONT_FLAGS_HEADER_INCLUDED__
00030 #include "Flags.hh"
00031 #endif
00032 
00033 #include <boost/cstdint.hpp>
00034 
00035 #include <string>
00036 #include <vector>
00037 #include <iosfwd>
00038 #include <utility>
00039 
00040 namespace freetype
00041 {
00042     class CFace ;
00043 }
00044 
00045 namespace pdf {
00046 
00047 namespace core
00048 {
00049     class CFile ;
00050     class CObjRef ;
00051 }
00052 
00053 namespace font {
00054 
00055 // forward declaration
00056 class CFlags ;
00057 
00081 class CDescriptor
00082 {
00083 public :
00084     typedef const int* WidthIt ;
00085     
00086 private :
00088     std::string m_name ;
00089     
00091     boost::int32_t m_flags ;
00092     
00094     int m_bbox[4] ;
00095     
00097     double m_italic_angle ;
00098     
00100     int m_ascent ;
00101     
00103     int m_descent ;
00104     
00106     int m_cap_height ;
00107 
00109     int m_stem_v ;
00110     
00112     const std::string m_filename ;
00113 
00115     static const int char_count = 256 ;
00116 
00119     int m_widths[char_count] ;
00120 
00122 //  int m_avg_width ;
00123     
00125 //  int m_max_width ;
00126 
00127 public :
00128     CDescriptor( const std::string& filename, int index = 0,
00129                  CFlags::EFlags flag = CFlags::serif ) ;
00130     ~CDescriptor( ) ;
00131     
00132     void FromFont( freetype::CFace& face, CFlags::EFlags flag = CFlags::serif );
00133     
00134     const core::CObjRef Write( core::CFile& file ) const ;
00135 
00136 //  void SetWidth( int *widths, int count ) ;
00137 
00138     const std::string& Name( ) const ;
00139 
00140     double GlyphWidth( wchar_t glyph ) const ;
00141 
00142     int CharCount( ) const { return char_count ; }
00143 
00144     typedef std::pair<WidthIt, WidthIt> WidthPair ;
00145     WidthPair Widths( ) const ;
00146 
00147 private :
00148 //  void Init( freetype::CFace& face, CFlags::EFlags flag = CFlags::serif ) ;
00149     static int EM2Glyph( int em_unit, const freetype::CFace& face ) ;
00150 } ;
00151 
00152 } } // end of namespace
00153 
00154 #endif

Generated on Sun Feb 2 09:16:04 2003 for libpdf++ by doxygen1.2.16