开发者

BlackBerry programming - Setting font size for label

I'm trying to make the font on a LabelField the same size as the built-in digital clock on the Storm and Torch.

No matter what I set the size too, it seems to only goto a certain size and it will开发者_开发问答 no longer increase.

How do I increase the font size / label width?

// set up custom font for timer label  
if (FontManager.getInstance().load("Digital Readout Thick Upright.ttf", "DigitalFont", FontManager.APPLICATION_FONT) == FontManager.SUCCESS) {}
try {
    FontFamily family = FontFamily.forName("DigitalFont");

    // I've tried to set it to 100 but it doesn't make any different
    Font digitalFont = family.getFont(Font.BOLD, 72); 
    lblSpotTime.setFont(digitalFont);
} catch (ClassNotFoundException e) {
    System.out.println(e.getMessage());
}


I think that's just a limit of that font - you can't make it bigger than 72. The digital clock on the Torch and the Storm probably (almost certainly) uses embedded image files to render the numbers. If you want a label field with characters that big, you'd have to roll your own by overriding your inherited field's paint method and drawing the characters yourself, copying embedded images instead of drawing text. This is a lot of work and I certainly don't recommend it.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜