Skip to content

Setting a custom default font #1401

Answered by kkoreilly
0pcom asked this question in Q&A
Dec 25, 2024 · 2 comments · 3 replies
Discussion options

You must be logged in to vote

Yes, the documentation is certainly incomplete in this area right now, but we will definitely improve it going forward. It is possible to do this now, although the API for this may change after issues like #568, which we are planning to work on in the next few weeks. Regardless, here is the code I got working for this now (to make all widgets in the app use the embedded font by default):

package main

import (
	"embed"

	"cogentcore.org/core/base/mergefs"
	"cogentcore.org/core/core"
	"cogentcore.org/core/paint"
	"cogentcore.org/core/styles"
)

//go:embed myFonts/*.ttf
var myFonts embed.FS

func main() {
	core.TheApp.SetSceneInit(func(sc *core.Scene) {
		sc.SetWidgetInit(func(w core.Widget)…

Replies: 2 comments 3 replies

Comment options

You must be logged in to vote
0 replies
Answer selected by 0pcom
Comment options

You must be logged in to vote
3 replies
@kkoreilly
Comment options

@0pcom
Comment options

@kkoreilly
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants