fontspec.cc

Go to the documentation of this file.
00001 
00003 
00004 //
00005 // Copyright (c) 2005-2007 University of Southern California
00006 // Rob Peters <rjpeters at usc dot edu>
00007 //
00008 // created: Fri Nov 11 14:56:22 2005
00009 // commit: $Id: fontspec.cc 10065 2007-04-12 05:54:56Z rjpeters $
00010 // $HeadURL: file:///lab/rjpeters/svnrepo/code/trunk/groovx/src/gfx/fontspec.cc $
00011 //
00012 // --------------------------------------------------------------------
00013 //
00014 // This file is part of GroovX.
00015 //   [http://www.klab.caltech.edu/rjpeters/groovx/]
00016 //
00017 // GroovX is free software; you can redistribute it and/or modify it
00018 // under the terms of the GNU General Public License as published by
00019 // the Free Software Foundation; either version 2 of the License, or
00020 // (at your option) any later version.
00021 //
00022 // GroovX is distributed in the hope that it will be useful, but
00023 // WITHOUT ANY WARRANTY; without even the implied warranty of
00024 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00025 // General Public License for more details.
00026 //
00027 // You should have received a copy of the GNU General Public License
00028 // along with GroovX; if not, write to the Free Software Foundation,
00029 // Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
00030 //
00032 
00033 #ifndef GROOVX_GFX_FONTSPEC_CC_UTC20051111225622_DEFINED
00034 #define GROOVX_GFX_FONTSPEC_CC_UTC20051111225622_DEFINED
00035 
00036 #include "gfx/fontspec.h"
00037 
00038 #include "rutz/fstring.h"
00039 
00040 #include <vector>
00041 
00042 void parseFontSpec(const rutz::fstring& spec,
00043                    rutz::fstring* family,
00044                    rutz::fstring* pxlsize,
00045                    rutz::fstring* mods)
00046 {
00047   unsigned int i = 0;
00048 
00049   std::vector<char> vfamily;
00050   std::vector<char> vpxlsize;
00051   std::vector<char> vmods;
00052 
00053   for ( ; i < spec.length(); ++i)
00054     {
00055       if (spec[i] == ':')
00056         { ++i; break; }
00057       else
00058         vfamily.push_back(spec[i]);
00059     }
00060 
00061   for ( ; i < spec.length(); ++i)
00062     {
00063       if (spec[i] == ':')
00064         { ++i; break; }
00065       else
00066         vpxlsize.push_back(spec[i]);
00067     }
00068 
00069   for ( ; i < spec.length(); ++i)
00070     {
00071       if (spec[i] == ':')
00072         { ++i; break; }
00073       else
00074         vmods.push_back(spec[i]);
00075     }
00076 
00077   vfamily.push_back('\0');
00078   vpxlsize.push_back('\0');
00079   vmods.push_back('\0');
00080 
00081   *family = rutz::fstring(&vfamily[0]);
00082   *pxlsize = rutz::fstring(&vpxlsize[0]);
00083   *mods = rutz::fstring(&vmods[0]);
00084 }
00085 
00086 static const char __attribute__((used)) vcid_groovx_gfx_fontspec_cc_utc20051111225622[] = "$Id: fontspec.cc 10065 2007-04-12 05:54:56Z rjpeters $ $HeadURL: file:
00087 #endif // !GROOVX_GFX_FONTSPEC_CC_UTC20051111225622DEFINED

The software described here is Copyright (c) 1998-2005, Rob Peters.
This page was generated Wed Dec 3 06:49:38 2008 by Doxygen version 1.5.5.