Rebol font size not working - rebol

For some reason when I run my code - or even the example codes from the Rebol website - the font size of the GUI text do not have an effect. I can write:
view layout [ text "This should be big!" font [size: 50] ]
or even:
view layout [ text "This should also be big!" font-size 50 ]
but neither do anything. Peculiarly, however, I can add a color to the text.

Related

How to change the font in the SpTextPresenter?

Pharo 9, Spec 2 -- I have a Spec 2 presenter with a text widget:
initializePresenters
text := self newText.
super initializePresenters
As I understand its type is SpTextPresenter. How to change the font of this text? Font face, size of the all shown text in this widget... For example, to "Courier New", 9.
EDIT 1:
Also I tried:
text addStyle: { SpStyleSTONReader fromString:
'
Font {
#name: "Source Sans Pro",
#size: 12,
#bold: false,
#italic: true
}' }.
but it does not work, the error is: Improper store into indexable object.
EDIT 2:
Also I found this documentation. It seems that the scenario must be:
Read styles as STON
Set styles somwhere (where?) for the all application. They are described under its names in the STON so they can be referred under its names in the application.
Call addStyle: 'the-name' so the widget with a name the-name will refer own styles from the loaded STON.
The problem is in 2. - I have not application, just one presenter which I open with openWithSpec.
I didn't notice this 'till now.
Spec "styles" cannot be added directly to the component but they need to be part of a stylesheet.
Stylesheets are defined in your application (in particular in your application configuration).
You can take a look at StPharoApplication>>resetConfiguration, StPharoMorphicConfiguration>>styleSheet and StPharoMorphicConfiguration>>styleSheetCommon as examples (you will also see there than using STON to declare your styles is just a convenience way, not mandatory).
Here a simplified version of what you will find there:
StPharoApplication >> resetConfiguration
self useBackend: #Morphic with: StPharoMorphicConfiguration new
StPharoMorphicConfiguration >> styleSheet
^ SpStyle defaultStyleSheet, self styleSheetCommon
StPharoMorphicConfiguration >> styleSheetCommon
"Just an example on how to build styles programatically ;)"
^ SpStyleSTONReader fromString: '
.application [
.searchInputField [
Font { #size: 12 }
]
]
'
Then you can add the style to your component:
text addStyle: 'searchInputField'

HTML startapp view inside Graphics.element.container

I am trying to place my html view in the middle of a container.
Unfortunately, container gives output of type Graphics.Element.Element whereas html view must be of the type, Html.Html.
And also, the html element constructors like div, checkbox, button, body return type is Html whereas, container needs a Graphics.Element parameter.
This is an erroneous html view, which i would like to make it work,
view : Signal.Address Action -> Model -> Element
view address model =
container 1000 1000 middle <|
toForm <|
div []
[ button [ onClick address Decrement ] [text "-"]
, div [ countStyle ] [ text (toString model ) ]
, button [ onClick address Increment ] [ text "+" ]
]
It has two buttons, one div all placed in the middle of a 1000 * 1000 container.
The elm-html package has a fromElement that can be used to create an Html from an Element.
I will say though, the idea with elm-html is to allow for a more "normal" flow of rendering HTML and using CSS to style it. While it would work to take your Html, convert it to an to either a Form or Element, use a collage or container to move it to the center of some area, and then convert back to Html, I'd probably recommend against it. If you're using HTML, just render that and style it (either with an external stylesheet or withHtml.Attributes).

List bullet size

How to increase the size of a list bullet? I am using ""\u2023 ABC" and applying style with font size :16. However the bullet size does not scale and only the font size scales.
"\u2023"= unicode for the bullet
Prasad, size of the bullet is also increasing with respect to the font size. But the probelm is the size of the bullet is small compared to the text. Please refer the screenshots I've taken in iPhone simulator with different font size
The above in the above images, each of them has font sizes 16, 30 and 80 respectively. You can see that the arrow size is also increasing with respect to the font size.
And here is a working solution for you.
Here I've used two labels - one for the arrow and other for the city name having a font size 40 and 20 respectively, added them to the tableViewRow. You can change the font size as per your requirement
Here is my code
for(var i = 0 ; i < number_of_cities; i++ ){
var lblArrow = Ti.UI.createLabel({
text : "\u2023",
font : {fontSize : 40},
left : '3%'
});
var lblValue = Ti.UI.createLabel({
text : cityList[i].name,
font : {fontSize : 20},
left : '10%'
});
tblData[i] = Ti.UI.createTableViewRow();
tblData[i].add(lblArrow);
tblData[i].add(lblValue);
}
Please note : I'm not sure that it's a best method, but it will resolve your issue
There are numerous variations of Unicode bullets and a quick visit to
Geometric Shapes is always useful. My personal favorite is "Black Circle" which, as with so much of Unicode, may be many things but a circle it is not.
● is a nice fat bullet — a bullet with attitude. In Hex it is ● and parsed for the purposes of list styling written as "\25AC" in the content value of your li:before tag:
li:before {
content: "\25AC";
etc.

How to stylize text-list and other elements?

Default Rebol VID style is eye-searing, put bluntly. I started making my own default, but ran into a snag. Namely, how do I specify styles for a sub-element of an element?
good-looking: stylize [
field: field
edge [size: 1x1]
colors [255.255.255 255.255.255]
area: area
edge [size: 1x1]
colors [255.255.255 255.255.255]
text-list: text-list
;text-list/sub-area/edge [size: 1x1]
]
I want all fields to have a thin border, including text-list and others. But I have no idea how to include that rule in the text-list definition.
Also, how to reduce repetition with styles, like with the colors?
I can partly answer your first question. At the REBOL consol, try this...
>> lo: layout [t: text-list]
That both creates a layout and allows the text-list object (t) to be examined using PROBE...
>> probe first t
== [self type offset size span pane text color image effect data edge font para feel saved-area rate show? options parent-face old-offset old-size line-list changes face-flags action state access style alt-action facets related words colors texts images file var keycode reset styles init multi blinker pane-size dirty? help user-data flags doc xy sz iter sub-area sld sn lc picked cnt act slf lines text-pane update resize]
Notice the SUB-AREA there. That's the list area in a text-list. Probe into that and you get...
>> probe first t/sub-area/edge
== [self color image effect size]
>> probe first t/sub-area/edge/size
== 2
So, change SIZE there and view the layout we made...
>> t/sub-area/edge/size: 1x1
== 1x1
>> view lo
The text-list's edge should be thin now. I'm not sure how you achieve that using style, but hopefully this will put you on the right track.
So, first:
layout [X: field]
type? X/edge
type? X/colors
Objects should get re-made to avoid unexpected side-effects on the shared ones.
good-looking: stylize [
field: field with [
edge: make edge [size: 1x1]
colors: copy [255.255.255 255.255.255]
]
area: area with [
edge: make edge [size: 1x1]
colors: copy [255.255.255 255.255.255]
]
text-list: text-list with [
sub-area: make sub-area [
edge: make edge [size: 1x1]
]
]
]

How do I create a graphics banner with multiple lines in Rebol (can only create one line)?

This works:
view layout [
box white 728x90 effect reduce [ 'gradient 0x1 sky]
font [align: 'center size: 40 color: red] "Your banner text"
]
But how do I add other lines ?
Thank you.
Include a new line in your text:
view layout [
box white 728x90 effect reduce [ 'gradient 0x1 sky]
font [align: 'center size: 40 color: red] "Your banner text^/on two lines"
]
If you aren't used to "escaping" characters in Rebol, it's pretty similar to doing so in C or Java or JavaScript or .....
This page in the Rebol Core Manual has all the details - http://www.rebol.com/docs/core23/rebolcore-16.html#section-2.11
You should be able to work out how to get multiple lines with different font sizes and colours by reading this - http://www.rebol.com/how-to/subpanels.html