{"id":30669553,"url":"https://github.com/unity3d-jp/example-customcharset","last_synced_at":"2025-09-01T01:34:13.510Z","repository":{"id":2218967,"uuid":"3168661","full_name":"unity3d-jp/example-customcharset","owner":"unity3d-jp","description":"Custom character set を使った TrueType フォントインポートの例。","archived":false,"fork":false,"pushed_at":"2012-01-13T06:35:38.000Z","size":5729,"stargazers_count":5,"open_issues_count":0,"forks_count":4,"subscribers_count":9,"default_branch":"master","last_synced_at":"2025-04-05T22:26:08.564Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/unity3d-jp.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2012-01-13T05:26:25.000Z","updated_at":"2017-12-14T00:12:47.000Z","dependencies_parsed_at":"2022-09-09T14:00:55.247Z","dependency_job_id":null,"html_url":"https://github.com/unity3d-jp/example-customcharset","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/unity3d-jp/example-customcharset","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/unity3d-jp%2Fexample-customcharset","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/unity3d-jp%2Fexample-customcharset/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/unity3d-jp%2Fexample-customcharset/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/unity3d-jp%2Fexample-customcharset/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/unity3d-jp","download_url":"https://codeload.github.com/unity3d-jp/example-customcharset/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/unity3d-jp%2Fexample-customcharset/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":273064444,"owners_count":25039261,"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-08-31T02:00:09.071Z","response_time":79,"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":[],"created_at":"2025-09-01T01:34:12.885Z","updated_at":"2025-09-01T01:34:13.505Z","avatar_url":"https://github.com/unity3d-jp.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"### 概要\n\nUnity 3.5 から `TrueTypeFontImporter` に追加された `customCharacters` プロパティの使用例です。\n\nこのプロパティは、TrueType フォントをテクスチャ化する際に、限定された文字セットだけを採用するというものです。これを使用することにより、フォントに含まれる全文字をテクスチャ化するのではなく、ゲーム中で使用しうる文字だけをテクスチャ化することができます。\n\nUnity で静的な日本語フォントを使用する場合、すべての文字を1枚のテクスチャに収める事が難しく、問題になりがちです。もしゲームの仕様として文字セットを限定することが可能ならば、この機能によって問題が解決されるかもしれません。\n\n### サンプルの内容\n\n百人一首を順に表示します。\n\n![Screenshot on iPhone](https://github.com/downloads/unity3d-jp/example-customcharset/screenshot-iphone.png)\n\nフォントを百人一首で使用されている文字だけに限定することにより、高品質な文字表示を実現しています。\n\n![Character set](https://github.com/downloads/unity3d-jp/example-customcharset/charset.png)\n\nサンプルプロジェクトの内容は、実際のゲームにおける運用を意識したものとなっています。百人一首のテキストは、一首ごとに独立したテキストファイルとして Resources ディレクトリの中に格納されています。\n\n![Resources folder](https://github.com/downloads/unity3d-jp/example-customcharset/resources.png)\n\nカスタムメニューとして追加された \"Custom Char\" から \"Collect Texts\" を選択すると、これらのテキストアセットが収集され customCharacters に設定されたのち、フォントの再インポートが行われます。\n\n![Custom menu](https://github.com/downloads/unity3d-jp/example-customcharset/custommenu.png)\n\n### Custom set 使用のコツ\n\nフォントの Custom set を Unity エディター上で設定する（テキストボックスに手作業で入力する）場合は、未整理の生テキストを入れるだけでOKです。そのテキストから使用文字セットを自動的に抽出したうえでインポートが行われます。\n\nただしエディタースクリプト上から `customCharacters` を代入すると、この「文字セットの抽出」が行われません。テキストから重複文字を抜く作業を自前で行わなければいけません。\n\nこれは [Enumerable の Dictinct メソッド](http://msdn.microsoft.com/en-us/library/bb348436.aspx)を使うことで簡単に解決できます。\n\n    charSet = String(sourceText.Distinct().ToArray());\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Funity3d-jp%2Fexample-customcharset","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Funity3d-jp%2Fexample-customcharset","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Funity3d-jp%2Fexample-customcharset/lists"}