| 635 | /// |
| 636 | /// the width of the given string in this font instance |
| 637 | public int stringWidth(String str) { |
| 638 | // this happens often for icons without text and can cost a bit more in the native platform |
| 639 | if (str == null || str.length() == 0) { |
| 640 | return 0; |
| 641 | } |
| 642 | // Its common to use a space character to create a label that takes up space but the value |
| 643 | // of string width in this case becomes less important |
| 644 | if (" ".equals(str)) { |
| 645 | return 5; |
| 646 | } |
| 647 | return Display.impl.stringWidth(font, str); |
| 648 | } |
| 649 | |
| 650 | /// Return the width of the specific character when rendered alone |
| 651 | /// |