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

Native Development

Reply
Regular Contributor
bemipefe
Posts: 75
Registered: ‎06-14-2013
My Device: Z10
Accepted Solution

Fixed Text Size

[ Edited ]

I understand that blocking the font size it's not the corret way to make accessibility on the app. However as developer I can handle only one default font size because the increasing of size in the font style it's not handled for all the graphic objects. This mean that sometimes images and backgrounds are made for a specific font size and can't be used with another one.

That's why I want ask you: Is it'possible to handle the font size in a centralized way, like bar-descriptor settings or centralized app settings ?

Thanks in advance.

 

MOD EDIT: Subject changed to reflect a new topic

Developer
BBSJdev
Posts: 6,118
Registered: ‎07-05-2012
My Device: Playbook, Dev Alpha C, Z10 LE, Z30

Re: Fixed Text Size

Please refrain from adding to old solved threads instead create your own new one.

 

I've asked a moderator to split this thread at your message.


If you've been helped click on Like Button, if you've been saved buy the app. :smileyhappy:

Developer of stokLocker, Sympatico and Super Sentences.
Developer
BBSJdev
Posts: 6,118
Registered: ‎07-05-2012
My Device: Playbook, Dev Alpha C, Z10 LE, Z30

Re: Fixed Text Size

TextStyle Definition is probably what you are looking for...

 

http://developer.blackberry.com/native/reference/cascades/bb__cascades__textstyledefinition.html


If you've been helped click on Like Button, if you've been saved buy the app. :smileyhappy:

Developer of stokLocker, Sympatico and Super Sentences.
Regular Contributor
bemipefe
Posts: 75
Registered: ‎06-14-2013
My Device: Z10

Re: Fixed Text Size

I'm sorry. I thought that adding new post would be unapporpiated due to the existance of another with the same object.

 

However I already use this object in each component. More precisely I use textStyle()->setFontSize() to handle the font size of a Label. Althought this method works it's not the way to handle the font size that I'm looking for. I need a centralized way to control font not a way to control the font of a specific graphic object. If I use the method you suggested me I need to set the size for every new object I create. I need to set the size one time for all actual and future object without worring about the font size.

Developer
BBSJdev
Posts: 6,118
Registered: ‎07-05-2012
My Device: Playbook, Dev Alpha C, Z10 LE, Z30

Re: Fixed Text Size

No need to apologise your post has a better chance of being answered if it's in its own thread and also means people with a similar problem coming along later can more easily find the solution.

Unfortunately in your case AFAIK there is no way to set a global size for text within controls, it will need to be done for each individual control.
However there is nothing stopping you subclassing your own 'text' controls with the fixed font change and then using those in place of the default ones.

If you've been helped click on Like Button, if you've been saved buy the app. :smileyhappy:

Developer of stokLocker, Sympatico and Super Sentences.
Regular Contributor
bemipefe
Posts: 75
Registered: ‎06-14-2013
My Device: Z10

Re: Fixed Text Size

I tried to use the setFontSize method :

 

 

Label *LabelText1;

...


LabelText1->textStyle()->setFontSize(FontSize::Small);

 

Hovever this doesn't prevent the OS from changing the size of the label when I do manually in the menu Settings->Display->Font Size.

How can I make the size not editable by the OS ?

 

Developer
BBSJdev
Posts: 6,118
Registered: ‎07-05-2012
My Device: Playbook, Dev Alpha C, Z10 LE, Z30

Re: Fixed Text Size

You can set it yourself...

http://developer.blackberry.com/native/reference/cascades/bb__cascades__fontsize.html

If you've been helped click on Like Button, if you've been saved buy the app. :smileyhappy:

Developer of stokLocker, Sympatico and Super Sentences.
Regular Contributor
bemipefe
Posts: 75
Registered: ‎06-14-2013
My Device: Z10

Re: Fixed Text Size

[ Edited ]

I knew that. Thank you.

 

I used many times in the code but I never realized until now that this doesn't prevent the OS to change the size of the text in the app if the relative settings in the Display sheet is changed. I can set a text to FontSize::smileyfrustrated:mall but if I increase the size of the font on the OS settings the font size in the app increase too.

 

I'm wondering if does exist a way to set a text to a fixed size and avoid that changing in the OS settings affects the size of the font in the app.

Developer
BBSJdev
Posts: 6,118
Registered: ‎07-05-2012
My Device: Playbook, Dev Alpha C, Z10 LE, Z30

Re: Fixed Text Size

[ Edited ]

No you misunderstood what I was gettin at, you have to set it to a PointSize...

 

http://developer.blackberry.com/native/reference/cascades/bb__cascades__fontsize.html

 

XXSmall to XXLarge are relative but specifying a point size is not.

 

	TextStyle cardLabelXSmall;

	cardLabelXSmall.setFontSize(FontSize::PointValue);
	cardLabelXSmall.setFontSizeValue(4);

 

 

 


If you've been helped click on Like Button, if you've been saved buy the app. :smileyhappy:

Developer of stokLocker, Sympatico and Super Sentences.
Regular Contributor
bemipefe
Posts: 75
Registered: ‎06-14-2013
My Device: Z10

Re: Fixed Text Size

Ok perfect. You definetively solved my problem.

I have tried to use the value in the past but it didn't work because of this missing piece:

cardLabelXSmall.setFontSize(FontSize::PointValue);

 

Thank you once again.