fyne font example
1.0.0
Inglês / 日本語
Aplicação de amostra que usa fontes diferentes no Fyne.
Importante
Esta é uma descrição para Fyne v2.x. Se você quiser saber para o fyne v1.x ou anterior, consulte o diretório V1.

Dica
? Prefere trabalhar com a GUI? Experimente o generador do time de Fyne!
fyne $ go get fyne.io/fyne/v2/cmd/fyne
$ fyne
Usage: fyne [command] [parameters], where command is one of:
...
fyne bundle $ fyne bundle mplus-1c-regular.ttf > bundle.go
$ head -n 9 bundle.go
// auto-generated
package main
import "fyne.io/fyne/v2"
var resourceMplus1cRegularTtf = &fyne.StaticResource{
StaticName: "mplus-1c-regular.ttf",
StaticContent: []byte{
Veja ./v2/bundle.go.
Aviso
O tamanho do arquivo é muito grande
type myTheme struct {}
func ( * myTheme ) Font ( s fyne. TextStyle ) fyne. Resource {
if s . Monospace {
return theme . DefaultTheme (). Font ( s )
}
if s . Bold {
if s . Italic {
return theme . DefaultTheme (). Font ( s )
}
return resourceMplus1cBoldTtf
}
if s . Italic {
return theme . DefaultTheme (). Font ( s )
}
return resourceMplus1cRegularTtf
}
...Veja ./v2/theme.go.
...
a := app . New ()
a . Settings (). SetTheme ( & myTheme {})
...Veja ./v2/main.go.
bundle.go é gerado usando o comando fyne.
$ fyne bundle mplus-1c-regular.ttf > bundle.go
$ fyne bundle -append mplus-1c-bold.ttf >> bundle.go
Veja o blog abaixo para obter mais informações. (Japonês)
fyneUm tutorial oficial também foi adicionado ao agrupamento de recursos.
As fontes M+ são incluídas e usadas como um arquivo de fonte de amostra.
https://mplusfonts.github.io