public override int GetWidth(string text) {
if (vertical)
return text.Length * 1000;
int total = 0;
if (fontSpecific) {
char[] cc = text.ToCharArray();
int len = cc.Length;
for (int k = 0; k < len; ++k) {
char c = cc[k];
if ((c & 0xff00) == 0 || (c & 0xff00) == 0xf000)
total += GetRawWidth(c & 0xff, null);
}
}
else {
int len = text.Length;
for (int k = 0; k < len; ++k) {
if (Utilities.IsSurrogatePair(text, k)) {
total += GetRawWidth(Utilities.ConvertToUtf32(text, k), encoding);
++k;
}
else
total += GetRawWidth(text[k], encoding);
}
}
return total;
}