fyne font example
1.0.0
Inglés / 日本語
Aplicación de muestra que utiliza diferentes fuentes en Fyne.
Importante
Esta es una descripción para Fyne V2.x. Si desea saber para Fyne v1.x o anterior, consulte el directorio V1.

Consejo
? ¿Prefieres trabajar con la GUI? ¡Prueba el Fyne-Theme-Generator!
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{
Ver ./v2/bundle.go.
Advertencia
El tamaño del archivo es muy 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
}
...Ver ./v2/theme.go.
...
a := app . New ()
a . Settings (). SetTheme ( & myTheme {})
...Ver ./v2/main.go.
bundle.go se genera con el comando Fyne.
$ fyne bundle mplus-1c-regular.ttf > bundle.go
$ fyne bundle -append mplus-1c-bold.ttf >> bundle.go
Vea el blog a continuación para obtener más información. (Japonés)
fyneTambién se ha agregado un tutorial oficial sobre la agrupación de recursos.
Las fuentes M+ se incluyen y se usan como un archivo de fuente de muestra.
https://mplusfonts.github.io