fyne font example
1.0.0
Bahasa Inggris / 日本語
Aplikasi sampel yang menggunakan font berbeda di fyne.
Penting
Ini adalah deskripsi untuk fyne v2.x. Jika Anda ingin tahu untuk Fyne v1.x atau lebih awal, silakan merujuk ke direktori V1.

Tip
? Lebih suka bekerja dengan GUI? Coba 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{
Lihat ./v2/bundle.go.
Peringatan
Ukuran file sangat besar
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
}
...Lihat ./v2/theme.go.
...
a := app . New ()
a . Settings (). SetTheme ( & myTheme {})
...Lihat ./v2/main.go.
bundle.go dihasilkan menggunakan perintah fyne.
$ fyne bundle mplus-1c-regular.ttf > bundle.go
$ fyne bundle -append mplus-1c-bold.ttf >> bundle.go
Lihat blog di bawah ini untuk informasi lebih lanjut. (Jepang)
fyneTutorial resmi juga telah ditambahkan pada bundling sumber daya.
Font M+ disertakan dan digunakan sebagai file font sampel.
https://mplusfonts.github.io