Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve: フォントを改善 #1103

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 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 not shown.
Binary file not shown.
Binary file not shown.
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;
}