00001 // Filename: fontFile.I 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 00020 //////////////////////////////////////////////////////////////////// 00021 // Function: FontFile::get_ds 00022 // Access: Public 00023 // Description: Returns the designed size of the font in points. 00024 // This is the basic height of a line of text in the 00025 // given font. 00026 //////////////////////////////////////////////////////////////////// 00027 INLINE double FontFile:: 00028 get_ds() const { 00029 return _ds; 00030 } 00031 00032 //////////////////////////////////////////////////////////////////// 00033 // Function: FontFile::get_dpi 00034 // Access: Public 00035 // Description: Returns the resolution of the rasterized font in dots 00036 // per inch. This is mainly useful for user 00037 // information; use get_vppp() and get_hppp() for more 00038 // precises measurements. 00039 //////////////////////////////////////////////////////////////////// 00040 INLINE double FontFile:: 00041 get_dpi() const { 00042 return floor(_vppp * 72.27 + 0.5); 00043 } 00044 00045 //////////////////////////////////////////////////////////////////// 00046 // Function: FontFile::get_vppp 00047 // Access: Public 00048 // Description: Returns the vertical pixels per point of the 00049 // rasterized font characters. This is the number of 00050 // pixels high each bitmap characters is per point of 00051 // font. 00052 //////////////////////////////////////////////////////////////////// 00053 INLINE double FontFile:: 00054 get_vppp() const { 00055 return _vppp; 00056 } 00057 00058 //////////////////////////////////////////////////////////////////// 00059 // Function: FontFile::get_hppp 00060 // Access: Public 00061 // Description: Returns the horizontal pixels per point of the 00062 // rasterized font characters. This is the number of 00063 // pixels wide each bitmap characters is per point of 00064 // font. 00065 //////////////////////////////////////////////////////////////////// 00066 INLINE double FontFile:: 00067 get_hppp() const { 00068 return _hppp; 00069 } 00070 00071 //////////////////////////////////////////////////////////////////// 00072 // Function: FontFile::get_num_chars 00073 // Access: Public 00074 // Description: Returns the number of characters (glyphs) read from 00075 // the font. 00076 //////////////////////////////////////////////////////////////////// 00077 INLINE int FontFile:: 00078 get_num_chars() const { 00079 return _chars.size(); 00080 } 00081 00082 //////////////////////////////////////////////////////////////////// 00083 // Function: FontFile::get_char 00084 // Access: Public 00085 // Description: Returns the nth character (glyph) read from the font. 00086 //////////////////////////////////////////////////////////////////// 00087 INLINE CharBitmap *FontFile:: 00088 get_char(int n) const { 00089 nassertr(n >= 0 && n < (int)_chars.size(), (CharBitmap *)NULL); 00090 return _chars[n]; 00091 }