Skip to content

Commit

Permalink
Improve: フォントを改善 (VOICEVOX#1103)
Browse files Browse the repository at this point in the history
Co-authored-by: Hiroshiba <[email protected]>
  • Loading branch information
sevenc-nanashi and Hiroshiba authored Jan 14, 2023
1 parent 38837c0 commit 160615a
Show file tree
Hide file tree
Showing 18 changed files with 38 additions and 5 deletions.
1 change: 1 addition & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
src/openapi/**/* linguist-generated=true
openapi.json linguist-generated=true
*.woff2 linguist-vendored=true
32 changes: 32 additions & 0 deletions docs/フォントについて.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
# フォントの作り方

VOICEVOX では改変したRounded M+ 1pを使用しています。
具体的には、
- ヒント情報の削除
- ttfからwoff2への変換
を行っています。

## 手順

1. [自家製 Rounded M+ とは](http://jikasei.me/font/rounded-mplus/about.html)からRounded M+をダウンロードします。

2. [ttfautohint](https://freetype.org/ttfautohint/)をインストールします。
> **Note**
> [ttfautohint-py](https://pypi.org/project/ttfautohint-py/)を使用しました。
3. [woff2](https://github.com/google/woff2)をビルドします。

4. `rounded-mplus-20150529.7z`から`rounded-mplus-1p-(ウェイト).ttf`を全て`src/fonts`に解凍します。
5. ttfautohintを使用して、Rounded M+のヒント情報を削除します。名前は`Unhinted Rounded M+ 1p`とします。
6. woff2を使用して、ttfからwoff2へ変換します。

[#1103](https://github.com/VOICEVOX/voicevox/pull/1103)の作成には以下のスクリプトを使用しました(PowerShell 7.3.1)

```pwsh
# cwd:src/fonts
foreach ($f in gci("./*.ttf")){
py -m ttfautohint -dF " Unhinted" $f.name "unhinted-$($f.name)"
woff2_compress.exe "unhinted-$($f.name)"
}
```

Binary file removed src/fonts/rounded-mplus-1p-black.ttf
Binary file not shown.
Binary file removed src/fonts/rounded-mplus-1p-bold.ttf
Binary file not shown.
Binary file removed src/fonts/rounded-mplus-1p-heavy.ttf
Binary file not shown.
Binary file removed src/fonts/rounded-mplus-1p-light.ttf
Binary file not shown.
Binary file removed src/fonts/rounded-mplus-1p-medium.ttf
Binary file not shown.
Binary file removed src/fonts/rounded-mplus-1p-regular.ttf
Binary file not shown.
Binary file removed src/fonts/rounded-mplus-1p-thin.ttf
Binary file not shown.
Binary file added src/fonts/unhinted-rounded-mplus-1p-black.woff2
Binary file not shown.
Binary file added src/fonts/unhinted-rounded-mplus-1p-bold.woff2
Binary file not shown.
Binary file added src/fonts/unhinted-rounded-mplus-1p-heavy.woff2
Binary file not shown.
Binary file added src/fonts/unhinted-rounded-mplus-1p-light.woff2
Binary file not shown.
Binary file added src/fonts/unhinted-rounded-mplus-1p-medium.woff2
Binary file not shown.
Binary file not shown.
Binary file added src/fonts/unhinted-rounded-mplus-1p-thin.woff2
Binary file not shown.
2 changes: 1 addition & 1 deletion src/styles/_index.scss
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ body:not(#dummy) {
}

body[data-editor-font="default"] {
font-family: "Rounded M+ 1p", sans-serif;
font-family: "Unhinted Rounded M+ 1p", sans-serif;
}

img {
Expand Down
8 changes: 4 additions & 4 deletions src/styles/fonts.scss
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
@font-face {
font-family: "Rounded M+ 1p";
src: url("../fonts/rounded-mplus-1p-regular.ttf");
font-family: "Unhinted Rounded M+ 1p";
src: url("../fonts/unhinted-rounded-mplus-1p-regular.woff2");

font-weight: normal;
}

@font-face {
font-family: "Rounded M+ 1p";
src: url("../fonts/rounded-mplus-1p-bold.ttf");
font-family: "Unhinted Rounded M+ 1p";
src: url("../fonts/unhinted-rounded-mplus-1p-bold.woff2");

font-weight: bold;
}

0 comments on commit 160615a

Please sign in to comment.