virtual void beginElement(const string &name,const XMLAttributes &atts) { if (name == "description") { font->name = atts.GetValue("family"); } else if (name == "metrics") { font->height = atoi(atts.GetValue("height").c_str()); font->ascender = atoi(atts.GetValue("ascender").c_str()); font->descender = atoi(atts.GetValue("descender").c_str()); } else if (name == "texture") { font->imgfile = atts.GetValue("file"); font->imgw = atoi(atts.GetValue("width").c_str()); font->imgh = atoi(atts.GetValue("height").c_str()); } else if (name == "padding") { font->padl = atoi(atts.GetValue("left").c_str()); font->padt = atoi(atts.GetValue("top").c_str()); font->padr = atoi(atts.GetValue("right").c_str()); font->padb = atoi(atts.GetValue("bottom").c_str()); } else if (name == "char") { eavlBitmapFont::Character c; c.id = atts.GetValue("id"); c.c = char(c.id[0]); if (c.id.length() == 1) { font->shortmap[(int)(unsigned char)(c.c)] = font->chars.size(); } c.offx = atoi(atts.GetValue("offset_x").c_str()); c.offy = atoi(atts.GetValue("offset_y").c_str()); c.x = atoi(atts.GetValue("rect_x").c_str()); c.y = atoi(atts.GetValue("rect_y").c_str()); c.w = atoi(atts.GetValue("rect_w").c_str()); c.h = atoi(atts.GetValue("rect_h").c_str()); c.adv = atoi(atts.GetValue("advance").c_str()); font->chars.push_back(c); } else if (name == "kerning") { // we should now be parsing a character which has just // been added to the end of the list in the font eavlBitmapFont::Character &c = font->chars[font->chars.size()-1]; string s = atts.GetValue("id"); char shortid = char(s[0]); if (s.length() == 1) { c.kern[(int)(unsigned char)(shortid)] = atoi(atts.GetValue("advance").c_str()); //cerr << "c.c="<<c.c<<" id="<<shortid<<" kern="<<c.kern[(int)(unsigned char)(shortid)]<<endl; } } }