00001 // Filename: fontFile.h 00002 // Created by: drose (18Feb01) 00003 // 00004 //////////////////////////////////////////////////////////////////// 00005 // 00006 // PANDA 3D SOFTWARE 00007 // Copyright (c) 2001, Disney Enterprises, Inc. All rights reserved 00008 // 00009 // All use of this software is subject to the terms of the Panda 3d 00010 // Software license. You should have received a copy of this license 00011 // along with this source code; you will also find a current copy of 00012 // the license at http://www.panda3d.org/license.txt . 00013 // 00014 // To contact the maintainers of this program write to 00015 // panda3d@yahoogroups.com . 00016 // 00017 //////////////////////////////////////////////////////////////////// 00018 00019 #ifndef FONTFILE_H 00020 #define FONTFILE_H 00021 00022 #include <pandatoolbase.h> 00023 00024 #include <filename.h> 00025 #include <notify.h> 00026 00027 #include <math.h> 00028 00029 class CharBitmap; 00030 00031 //////////////////////////////////////////////////////////////////// 00032 // Class : FontFile 00033 // Description : This is an abstract base class that provides the 00034 // interface to reading and/or rasterizing a particular 00035 // font file. 00036 //////////////////////////////////////////////////////////////////// 00037 class FontFile { 00038 public: 00039 FontFile(); 00040 virtual ~FontFile(); 00041 00042 virtual bool read(const Filename &filename, 00043 bool extract_all, const string &extract_only)=0; 00044 00045 INLINE double get_ds() const; 00046 INLINE double get_dpi() const; 00047 INLINE double get_vppp() const; 00048 INLINE double get_hppp() const; 00049 00050 void sort_chars_by_height(); 00051 INLINE int get_num_chars() const; 00052 INLINE CharBitmap *get_char(int n) const; 00053 00054 protected: 00055 double _ds; 00056 double _vppp; 00057 double _hppp; 00058 00059 typedef pvector<CharBitmap *> Chars; 00060 Chars _chars; 00061 }; 00062 00063 #include "fontFile.I" 00064 00065 #endif