cogentcore / core

A free and open source framework for building powerful, fast, elegant 2D and 3D apps that run on macOS, Windows, Linux, iOS, Android, and the web with a single Go codebase, allowing you to Code Once, Run Everywhere.
http://cogentcore.org/core
BSD 3-Clause "New" or "Revised" License
1.74k stars 82 forks source link

Button style font size did not have effect. how to set default font size for all. #1150

Closed runsys closed 1 week ago

runsys commented 2 months ago

Describe the bug

Button style font size did not have effect. how to set default font size by code for all. version about 20240706 os freebsd 14.1

How to reproduce

see code in picture 屏幕截图 2024-08-19 075046

Example code

No response

Relevant output

No response

Platform

macOS

kkoreilly commented 2 months ago

You can use this code to set the font size of the button text:

    bt := core.NewButton(b).SetText("Hello")
    tree.AddChildInit(bt, "text", func(w *core.Text) {
        w.Styler(func(s *styles.Style) {
            s.Font.Size.Dp(48)
            s.Text.LineHeight.Dp(48)
        })
    })

If you want to change the font size of all elements, you can change the Font size in the Settings menu.