Label font size - graphics

I want add to stage a label with specified font size.
val label = Label("label", Skin(Gdx.files.internal("uiskin.json")))
label.height = 20f
stage.addActor(label)
Changing label.height does not works, label is shown with some default size.
So the question is how to set label font size?

You can do only:
label.setFontScale(5.0f)
Also, you can specify font size in font file. It's the only way.

Try either setSize label.setSize(width, height) or setScale label.setScale(xyScaleFactor)

Related

tk.Text: Tag Font

Is there a way to get a proper Font instance out of a tag, so I can change just the size? I know I can dump it in tk.font.Font but that seems really inefficient.
for tag in self.tag_names():
#I need `f` to be a Font instance, not just a string
f = self.tag_cget(tag, 'font')
If you used font objects to create the tags, then you can get the font name from the tag and then use nametofont to convert it to an instance of tkinter.font.Font. However, this only works if the tag has a font associated with it, and if the font is a font object rather than shorthand notation (eg: ("Helvetica", 24, "bold")).
from tkinter.font import nametofont
...
for tag_name in self.tag_names():
font_name = self.tag_cget(tag_name, "font")
if font_name:
font = nametofont(font_name)
size = int(font.cget("size"))
font.configure(size = size + delta)
One method is to premake all of the Font instances and assign the instances to the applicable tag's font option. When you want to change the sizes, loop over the stored Font instances, and change their sizes directly. Every tag that uses your Font instances will change accordingly.

How to fix canvas size not following the configuration

I created a canvas and specified the height using (width, height), but when it comes to the GUI, it doesn't change the size at all.
atEdit=Frame(Attend,borderwidth=0)
atEdit.grid(row=2,column=0,columnspan=5,sticky='news',pady=(0,10),padx=10)
scrollbar = Scrollbar(atEdit)
scrollbar.grid(row=0,column=5,sticky='ns')
canvas = Canvas(atEdit,bg='black',height=20)
canvas.grid(row=0,column=0,columnspan=5,sticky='news')
scrollbar.config(command = canvas.yview)
left = Frame(canvas,borderwidth=0,bg='#dbdbdb',height=2)
left.grid(row=0,column=0,sticky='news')
right=Frame(canvas,borderwidth=0,bg='white',height=2)
right.grid(row=0,column=1,columnspan=4,sticky='news')
left.bind('<Configure>',lambda event,canvas=canvas:self.onFrameConfigure(canvas))
right.bind('<Configure>',lambda event,canvas=canvas:self.onFrameConfigure(canvas))
I add labels to the 'left' and 'right', which increases the size of the frames, but it shouldn't grow larger than the specified size. Is there anyway to make the canvas a fixed size, even if I add more labels to it, and be able to scroll through it using the scrollbar?
def onFrameConfigure(self,canvas):
canvas.configure(scrollregion=canvas.bbox("all"))

changing text size of SCNText

I'm trying to set the size of the font using this code:
func setupText(){
let text = SCNText(string: "textString", extrusionDepth: 4)
textNode.geometry = text
textNode.position = SCNVector3Make(0, -200, 5)
scene.rootNode.addChildNode(textNode)
text.alignmentMode = kCAAlignmentCenter
text.font = UIFont(name: "Helvatica", size: 30)
}
I'm changing the size argument but my text doesn't get any bigger or smaller. What am I doing wrong?
It doesn't work because the font isn't being set. The font isn't being set because you misspelled "Helvetica" as "Helvatica".
Changing the font size should work but maybe not as much as you would expect. This depends of the size of your 3d world.
Another way to scale up a 3d text is to scale its node:
textNode.scale = SCNVector3Make( scaleValue, scaleValue, scaleValue); //todo: make me swift

How to change hint text font size and color in j2me using LWUIT?

I am using the following code in java file and not using resource file.
m_txtSearch = new TextField();
m_txtSearch.setHint("Search");
Then how can i change the font size and color of hint text ?
Can u please help me ?
Font font = new Font("Verdana", Font.BOLD, 12);
txt.setFont(font);
txt.setForeground(Color.BLUE);

Change Size of Tick Labels D3

I want to increase the size of the numbers which label my legend using D3. The legend is made as follows:
map.legend_axes = d3.svg.axis()
.scale(map.legend_scales)
.orient('bottom')
.tickSize(map.settings.legend.ticks);
Is there an argument I can pass which will increase the size of the numbers?
Add a CSS class that increases the font size and then add that class to the text on the axis:
d3.selectAll("axisElement")
.classed("large-font", true);

Resources