Main Page   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members   File Members  

pandatool/src/egg-mkfont/fontFile.cxx

Go to the documentation of this file.
00001 // Filename: fontFile.cxx
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 #include "fontFile.h"
00020 #include "charBitmap.h"
00021 
00022 #include <algorithm>
00023 
00024 
00025 // An STL function object to sort the characters in order from tallest
00026 // to shortest.  This provides a more optimal packing into the
00027 // resulting image.
00028 class SortCharBitmap {
00029 public:
00030   bool operator() (const CharBitmap *c1, const CharBitmap *c2) const {
00031     return (c1->get_height() > c2->get_height());
00032   }
00033 };
00034 
00035 
00036 ////////////////////////////////////////////////////////////////////
00037 //     Function: FontFile::Constructor
00038 //       Access: Public
00039 //  Description:
00040 ////////////////////////////////////////////////////////////////////
00041 FontFile::
00042 FontFile() {
00043   // A standard design size for font types that don't specify
00044   // otherwise.
00045   _ds = 12.0;
00046 }
00047 
00048 ////////////////////////////////////////////////////////////////////
00049 //     Function: FontFile::Destructor
00050 //       Access: Public, Virtual
00051 //  Description:
00052 ////////////////////////////////////////////////////////////////////
00053 FontFile::
00054 ~FontFile() {
00055 }
00056 
00057 ////////////////////////////////////////////////////////////////////
00058 //     Function: FontFile::sort_chars_by_height
00059 //       Access: Public
00060 //  Description: Sorts the array of characters in the font as returned
00061 //               by get_char() so that the tallest ones appear first
00062 //               in the list.
00063 ////////////////////////////////////////////////////////////////////
00064 void FontFile::
00065 sort_chars_by_height() {
00066   sort(_chars.begin(), _chars.end(), SortCharBitmap());
00067 }

Generated on Fri May 2 03:17:09 2003 for Panda-Tool by doxygen1.3