Welcome!

Welcome to the official BlackBerry Support Community Forums.

This is your resource to discuss support topics with your peers, and learn from each other.

inside custom component

Java Development

Reply
Regular Contributor
mohdfarhanakram
Posts: 73
Registered: ‎12-30-2011
My Device: All devices
Accepted Solution

Custom Font Problem

[ Edited ]

Hi every one,

 

     Please help me i want to load customize font "Calibri.TTF"  , but it is not working my code is given ....

 

FontFamily family=null;

if (FontManager.getInstance().load("CalibriBold.TTF", "MyFont11", FontManager.APPLICATION_FONT) == FontManager.SUCCESS) 
                {
                    try 
                    {
                        family  = FontFamily.forName("MyFont11");
                        
                    }
                    catch (ClassNotFoundException e) 
                    {
                        try{
                              family=FontFamily.forName(FontFamily.FAMILY_SYSTEM); 
                        }catch(Exception ex){}      
                       
                        
                    }
                }

 

Plese tell me what is problem with this

Thanks

Mohd Farhan
Please use plain text.
BlackBerry Development Advisor (Retired)
smacmartin
Posts: 499
Registered: ‎05-07-2012
My Device: developer

Re: Custom Font Problem

Which NDK?

Which FontManager are you using?  (which namespace)

Did you test the != FontManager.SUCCESS case?

 

What has your debugginng shown so far?

 

Stuart

Please use plain text.
BlackBerry Development Advisor (Retired)
smacmartin
Posts: 499
Registered: ‎05-07-2012
My Device: developer

Re: Custom Font Problem

This is Java?

The most likely explanation is that it can't find the font file.  Check examples on how to reference the font directories. Did you try handling the != SUCCESS case to see if it found the error, and if not what the reason is?

 

Stuart

Please use plain text.
Regular Contributor
mohdfarhanakram
Posts: 73
Registered: ‎12-30-2011
My Device: All devices

Re: Custom Font Problem

Hi Stuart,

 

        It is java , FontManager is class which is given in BlackBerry API 5.0.0 & above , net.rim.device.api.ui.FontManager, but it is not working i dont know why

Thanks

Mohd Farhan
Please use plain text.
BlackBerry Development Advisor (Retired)
smacmartin
Posts: 499
Registered: ‎05-07-2012
My Device: developer

Re: Custom Font Problem

You'll excuse me for having had my head in C++ I hope :smileyhappy:

Can you check which line fails and what the error is?

Rule out the usual issue that the file is not in the directory or path that the routine is looking in.

 

Stuart

Please use plain text.
Developer
rcmaniac25
Posts: 1,805
Registered: ‎04-28-2009
My Device: Z10 (STL100-4)-10.2.1.3253, Z10 (STL100-3)-10.3.1.634 Dev OS, Z30 (STA100-5)-10.3.1.634 Dev OS, Passport (SQW100-1)-10.3.0.1418, PlayBook (16GB)-2.1.0.1917

Re: Custom Font Problem

Check your path. Otherwise check the return value. One of the most common mistakes people make is loading a really big font. BlackBerry has a 6mb size restriction on fonts.
---Spends time in #blackberrydev on freenode (IRC)----
Three simple rules:
1. Please use the search bar before making new posts.
2. "Like" posts that you find helpful.
3. If a solution has been found for your post, mark it as solved.
--I code too much. Well, too bad.
Please use plain text.
BlackBerry Development Advisor (Retired)
smacmartin
Posts: 499
Registered: ‎05-07-2012
My Device: developer

Re: Custom Font Problem

Did you solve your issue?

If it was one of our answers, please mark them as solution, else for others with similar questions in the future please post your solution and mark it as solution.

Otherwise, can you provide us with where the code fails?

 

Stuart

Please use plain text.
Developer
HorizonXP
Posts: 133
Registered: ‎03-28-2011
My Device: BlackBerry 9900 & PlayBook

Re: Custom Font Problem

Err... can we move this post to the right forum? I'm subscribed to the forum, and I got an e-mail about this, came here thinking I could provide help. I'm not a Java dev, so I cannot. Slightly annoying. 


Founder of Pulsecode Inc. and taab
Authomator - Two-factor authentication codes on BlackBerry 10 - http://www.xitijpatel.com/ - Follow @xitijpatel
Is there a helpful or useful post in this thread? Click the thumbs up on it so that other people can find it more easily!
Please use plain text.
Developer
rcmaniac25
Posts: 1,805
Registered: ‎04-28-2009
My Device: Z10 (STL100-4)-10.2.1.3253, Z10 (STL100-3)-10.3.1.634 Dev OS, Z30 (STA100-5)-10.3.1.634 Dev OS, Passport (SQW100-1)-10.3.0.1418, PlayBook (16GB)-2.1.0.1917

Re: Custom Font Problem

Agreed. I'm a little surprised it hasn't been moved already.
---Spends time in #blackberrydev on freenode (IRC)----
Three simple rules:
1. Please use the search bar before making new posts.
2. "Like" posts that you find helpful.
3. If a solution has been found for your post, mark it as solved.
--I code too much. Well, too bad.
Please use plain text.
Regular Contributor
mohdfarhanakram
Posts: 73
Registered: ‎12-30-2011
My Device: All devices

Re: Custom Font Problem

soryy i was busy to complete my project. so i could not give you response , yes i got soloution , my code is working fine , sure i should be moved in right forum.

Thanks

Mohd Farhan
Please use plain text.