{"id":20548088,"url":"https://github.com/lusingander/fyne-font-example","last_synced_at":"2025-07-29T05:32:38.680Z","repository":{"id":46318288,"uuid":"240706814","full_name":"lusingander/fyne-font-example","owner":"lusingander","description":"Sample application that uses different fonts in Fyne","archived":false,"fork":false,"pushed_at":"2024-02-15T13:50:09.000Z","size":9767,"stargazers_count":49,"open_issues_count":1,"forks_count":13,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-07-19T09:58:04.309Z","etag":null,"topics":["font","fyne","go"],"latest_commit_sha":null,"homepage":"","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/lusingander.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2020-02-15T12:29:25.000Z","updated_at":"2025-04-04T20:25:59.000Z","dependencies_parsed_at":"2024-02-15T14:56:55.025Z","dependency_job_id":null,"html_url":"https://github.com/lusingander/fyne-font-example","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/lusingander/fyne-font-example","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lusingander%2Ffyne-font-example","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lusingander%2Ffyne-font-example/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lusingander%2Ffyne-font-example/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lusingander%2Ffyne-font-example/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/lusingander","download_url":"https://codeload.github.com/lusingander/fyne-font-example/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lusingander%2Ffyne-font-example/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":267633670,"owners_count":24118777,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-07-29T02:00:12.549Z","response_time":2574,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["font","fyne","go"],"created_at":"2024-11-16T02:12:00.845Z","updated_at":"2025-07-29T05:32:38.641Z","avatar_url":"https://github.com/lusingander.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"fyne-font-example\n====\n\nEnglish / [日本語](./README_ja.md)\n\n## About\n\nSample application that uses different fonts in [Fyne](https://fyne.io).\n\n\u003e [!IMPORTANT]\n\u003e This is a description for Fyne v2.x. If you want to know for Fyne v1.x or earlier, please refer to the [v1](./v1) directory.\n\n\u003cimg src=\"./resource/image-v2.png\" width=300\u003e\n\n\u003e [!TIP]\n\u003e 🎨 Prefer to work with the GUI? Try the [fyne-theme-generator](https://github.com/lusingander/fyne-theme-generator)!\n\n## Summary\n\n#### 0. Install `fyne` command\n\n```\n$ go get fyne.io/fyne/v2/cmd/fyne\n\n$ fyne\nUsage: fyne [command] [parameters], where command is one of:\n...\n```\n\n#### 1. Prepare the font file and execute `fyne bundle` command\n\n```\n$ fyne bundle mplus-1c-regular.ttf \u003e bundle.go\n\n$ head -n 9 bundle.go\n// auto-generated\n\npackage main\n\nimport \"fyne.io/fyne/v2\"\n\nvar resourceMplus1cRegularTtf = \u0026fyne.StaticResource{\n\tStaticName: \"mplus-1c-regular.ttf\",\n\tStaticContent: []byte{\n```\n\nSee [./v2/bundle.go](./v2/bundle.go).\n\n\u003e [!WARNING]\n\u003e the file size is very large\n\n#### 2. Create the custom theme and load font resources\n\n```go\ntype myTheme struct{}\n\nfunc (*myTheme) Font(s fyne.TextStyle) fyne.Resource {\n\tif s.Monospace {\n\t\treturn theme.DefaultTheme().Font(s)\n\t}\n\tif s.Bold {\n\t\tif s.Italic {\n\t\t\treturn theme.DefaultTheme().Font(s)\n\t\t}\n\t\treturn resourceMplus1cBoldTtf\n\t}\n\tif s.Italic {\n\t\treturn theme.DefaultTheme().Font(s)\n\t}\n\treturn resourceMplus1cRegularTtf\n}\n...\n```\n\nSee [./v2/theme.go](./v2/theme.go).\n\n#### 3. Load the custom theme\n\n```go\n...\n\ta := app.New()\n\ta.Settings().SetTheme(\u0026myTheme{})\n...\n```\n\nSee [./v2/main.go](./v2/main.go).\n\n## A little more details\n\n`bundle.go` is generated using [fyne command](https://github.com/fyne-io/fyne/tree/master/cmd/fyne).\n\n```\n$ fyne bundle mplus-1c-regular.ttf \u003e bundle.go\n$ fyne bundle -append mplus-1c-bold.ttf \u003e\u003e bundle.go\n```\n\nSee the Blog below for more information. (Japanese)\n\n- [About the `fyne` command](https://lusingander.netlify.app/posts/200613-fyne-resourece/)\n- [About fonts](https://lusingander.netlify.app/posts/200614-fyne-font/)\n\nAn official tutorial has also been added on resource bundling.\n\n- [Bundling resources | Develop using Fyne](https://developer.fyne.io/tutorial/bundle)\n\n----\n\n[M+ FONTS](https://mplusfonts.github.io) is included and used as a sample font file.\n\nhttps://mplusfonts.github.io\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flusingander%2Ffyne-font-example","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Flusingander%2Ffyne-font-example","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flusingander%2Ffyne-font-example/lists"}