9 Star 109 Fork 23

子安/FireShotGo

加入 Gitee
与超过 1400万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
shang_shou_jian_song.go 1.26 KB
一键复制 编辑 原始数据 按行查看 历史
子安 提交于 2021-09-28 00:31 +08:00 . 添加直线绘制功能
package firetheme
import (
_ "embed"
"fyne.io/fyne/v2"
"fyne.io/fyne/v2/theme"
"image/color"
)
type ShanGShouJianSongTheme struct {
}
//1. 第一种方式
// 这个功能只有go 1.16之后的版本才支持的,如果你的版本是1.16之前,请使用
// fyne bundle ShangShouJianSongXianXiTi-2.ttf > bundle.go
// 2. 第二种方式
//go:embed ShangShouJianSongXianXiTi-2.ttf
var ShangShouJianSongXianXiTi []byte
var resourceShangShouJianSongXianXiTi2Ttf = &fyne.StaticResource{
StaticName: "ShangShouJianSongXianXiTi-2.ttf",
StaticContent: ShangShouJianSongXianXiTi,
}
// Font 返回的就是字体名
func (m *ShanGShouJianSongTheme) Font(s fyne.TextStyle) fyne.Resource {
// 因为在裁剪的主题中指定了font这里不能再对类型判断,全部按照中文显示
//if s.Monospace || s.Bold || s.Italic {
// return theme.DefaultTheme().Font(s)
//}
return resourceShangShouJianSongXianXiTi2Ttf
}
func (*ShanGShouJianSongTheme) Color(n fyne.ThemeColorName, v fyne.ThemeVariant) color.Color {
return theme.DefaultTheme().Color(n, v)
}
func (*ShanGShouJianSongTheme) Icon(n fyne.ThemeIconName) fyne.Resource {
return theme.DefaultTheme().Icon(n)
}
func (*ShanGShouJianSongTheme) Size(n fyne.ThemeSizeName) float32 {
return theme.DefaultTheme().Size(n)
}
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
Go
1
https://gitee.com/andrewgithub/FireShotGo.git
git@gitee.com:andrewgithub/FireShotGo.git
andrewgithub
FireShotGo
FireShotGo
v1.0.2

搜索帮助