public MetaFont(String faceName, String searchDir)
{
if (String.IsNullOrEmpty(searchDir)) { throw new ArgumentException("Bad search directory"); }
if (String.IsNullOrEmpty(faceName)) { throw new ArgumentException("Bad font face name"); }
_baseFonts = new Dictionary<int, SpriteFont>();
// find some mothafuckin' fonts
String[] fontCandidates = Directory.GetFiles(searchDir, faceName + "*.xnb");
Regex r = new Regex(String.Format(@".*\\({0} ([0-9]+)).xnb", faceName));
foreach (String candidate in fontCandidates)
{
Match match = r.Match(candidate);
if (match.Groups.Count < 3)
{
//Console.WriteLine("candidate turned out not to match regex; so sad :(");
continue;
}
Console.WriteLine("found base font(\"{0}\", \"{1}\") for metafont {2} at {3}, loading...", match.Groups[1], match.Groups[2], faceName, candidate);
int sz = Int32.Parse(match.Groups[2].Value);
_baseFonts.Add(sz, ZeplinGame.ContentManager.Load<SpriteFont>(match.Groups[1].Value));
}
}