doudou1523102
2019-12-07 10:01:59 +08:00
G2DStringDemo g2DStringDemo = new G2DStringDemo();
int fontSize = 36; //描述字体大小
int standardShift = 50;//描述水平位移
Font introFont = new Font("微软雅黑", Font.PLAIN, fontSize);
int len = G2DStringDemo.getWordWidth(introFont, "A");
int len2 = G2DStringDemo.getWordWidth(introFont, "a");
int len3 = G2DStringDemo.getWordWidth(introFont, "中");
int len4 = G2DStringDemo.getWordWidth(introFont, "久");
int len5 = G2DStringDemo.getWordWidth(introFont, "+");
int len6 = G2DStringDemo.getWordWidth(introFont, " ");
System.out.println(len);
System.out.println(len2);
System.out.println(len3);
System.out.println(len4);
System.out.println(len5);
System.out.println(len6);