//java画图时切割字符串,font就一行显示多少字=控件宽度/字体大小-首尾空格(width/fontSize - 2)
public static List<String> dealRows(String text, int font)
{
// String target = "[0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ -[]()<>&=:@{}~!#$%^/.]";
text = text.trim();
StringBuffer sb = new StringBuffer();
List<String> list = new ArrayList<String>();
int tmp = 0;
int row = 0;
int fontSize = font * 2;
int fontStrSize = 0;
for (char c : text.toCharArray()) {
tmp = isChinese(c) ? 2 : 1;
fontStrSize = fontStrSize + tmp;
sb.append(c);
if (fontSize <= fontStrSize) {
fontStrSize = 0;
list.add(sb.toString());
sb = new StringBuffer();
row++;
}
}
if(row == 0 || fontStrSize < fontSize){
list.add(sb.toString());
}
return list;
}