Fonts for different resolutions

10 posts / 0 new
Last post
hyui
hyui's picture
Offline
Joined: 19 Oct 2011
Posts:
Fonts for different resolutions

Hey,

I was wondering how I can handle fonts for different screen resolutions. At the moment I use the existing fonts from MoSync installation (verdana13 up to 20). These looks good in MoSync emulator but way too small on my real android device.

So one solution I had in mind was to generate new and larger fonts and use different sets of fonts depending on screen resolution. However, I don't really like this approach because I then have to have lots of different hard resources for all these fonts. Is this the way to go?

Is there any way to scale the font sizes programmatically? Or is there some other way I can handle this problem? I mainly use fonts on Labels ("captions") at the moment, if that makes any difference. I don't use maDrawFont* functions directly.

/Hyui

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
Sam Pickard
rival's picture
Offline
Mobile Archmage
Joined: 19 Mar 2009
Posts:

Hi,

The way I've always done it in the past is with different .lst files and different font files. There isn't a way to scale MAUI fonts. If Android is your target platform, you can use Native UI instead, which will format properly on all Android devices. Have a look at the NativeUI example in the 'Examples' folder.

hyui
hyui's picture
Offline
Joined: 19 Oct 2011
Posts:

Thanks for your fast reply.

Too bad there's no scaling. My target devices are Android and iPhone but I only test on Android for now. I looked into the NativeUI a few days ago but I think I missed some UI element from it, I'll have another look.

Emma Tresanszki
emma_christine's picture
Offline
Joined: 16 Sep 2011
Posts:

Hi,

If you are using fonts in NativeUI, you can apply setFontSize(float) on most of the text widgets. It sets the default text size to the given value, interpreted as "scaled pixel" units. In this way, there is no need to create another font resource.
For more info on NativeUI you can check out this tutorial: http://www.mosync.com/documentation/manualpages/using-nativeui-library

Cheers,
Emma

rishimittal
rishimittal's picture
Offline
Mobile Conjurer
Joined: 8 Mar 2012
Posts:

No,I have to use in cross plateform..????Without using the NativeUI then ...what to do..Any Examples..???

 

Ovidiu
ovidiu's picture
Offline
Mobile Wizard
Joined: 27 Jan 2011
Posts:

If NativeUI is not what you want then take a look here: http://www.mosync.com/documentation/manualpage/font-tools

Iraklis Rossis
Iraklis Rossis's picture
Offline
Mobile Wizard
Joined: 3 Aug 2011
Posts:

rishimittal wrote:

No,I have to use in cross plateform..????Without using the NativeUI then ...what to do..Any Examples..???

 

But the whole point of our NativeUI API is that you can still make cross platform apps. I could see the point if you are also targeting a platform that is not supported by our NativeUI API, but iOS and Android are basically the poster children for this system right now.

rishimittal
rishimittal's picture
Offline
Mobile Conjurer
Joined: 8 Mar 2012
Posts:

Yes ,For the Time being...Actually I am developing for java,androis,symbian..altogether..that why i asked....!!!

Patrick Broman
patrick's picture
Offline
Mobile Wizard
Joined: 17 Feb 2009
Posts:

Hi,

Here's the bottom line: MAUI is an incomplete system which was being developed when our main target platforms were Symbian, JavaME and Windows Mobile. When iOS and Andorid came along, it became clear that Native UI was neccesary. At MoSync, we're now focusing on those platforms and Windows Phone and thereby Native UI, and we just don't have the resources to continue working on MAUI. So if you're actively targeting the "legacy" platforms, there's only so much we can do, unfortunately :(

I would advise that you focus on iOS, Android and WP7 and use Native UI. If that's not an option, I'd recommend that you take a look at http://www.mosync.com/documentation/manualpages/resource-compiler-reference where you can read about some new tricks you can do with the revamped resource compiler regarding automatically loading correct variations of resources depending on things like screen size. This could at least simplify your application logic.

Sam Pickard
rival's picture
Offline
Mobile Archmage
Joined: 19 Mar 2009
Posts:

To add a quick additional comment to this, AppMancer has continued to develop MAUI as AMUI.  I've fixed MAUI bugs, written new widgets and combined the old widgets with NativeUI.  AppMancer is open source, but you need a licence to sell closed-source commercial applications.  MAUI can be easily replaced by MAUI. http://appmancer.com