Hi,
i am trying to set the font size of a BlTextElement, and i do not have much success. I use the following code to add the text element, where 'model' is a string.
First, if the string is '0.0' then the font size is correct (see screenshot). But, if for example the value is '21.0' then the font size is wrong (see the other screenshot). I don't understand, i've tried variants but it seems to me that this code was the right way to do it. Sometimes, a '9' would be displayed at the correct font size, sometimes not. Any ideas ?
text := BlTextElement new
text:
((BrRopedText string: model)
attributes:
{(BrTextForegroundAttribute paint: (Color green alpha: 0.8)).
(BrFontSizeAttribute size: 60).
(BrFontWeightAttribute weight: 50).
(BrFontGenericFamilyAttribute monospace).
"(BrFontFamilyAttribute named: 'Source Sans Pro')"});
yourself.
text
constraintsDo: [ :c |
c frame horizontal alignCenter.
c frame vertical alignCenter ].
"text is added to a parent BlElement"
self addChild: text
Second, i don't have the impression that changing the font family does have any effect (but maybe its my local setup i don't know...).
Steven.