Skip to content

Commit

Permalink
リリースできる拼音付きフォントを生成できるようになった。漢字は縮小しないようにした。
Browse files Browse the repository at this point in the history
  • Loading branch information
MaruTama committed Jul 26, 2019
1 parent e7b30de commit a92a3f1
Show file tree
Hide file tree
Showing 10 changed files with 175 additions and 341 deletions.
43 changes: 22 additions & 21 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,16 +1,19 @@
# oss-pinyin-font-tools
Tools for to create OpenSource Pinyin Font
![screenshot](./imgs/ss.png)

元のフォント
- [source-han-serif(源ノ明朝) otf](https://github.com/adobe-fonts/source-han-serif/tree/release/OTF)
- [source-han-sans(源ノ角ゴシック) otf](https://github.com/adobe-fonts/source-han-sans/tree/release/OTF)


<!-- otf->ttf にしてあるフォント
- [Source-Han-TrueType](https://github.com/Pal3love/Source-Han-TrueType) -->

<!-- # 変換方法
```
#otf -> ttf
$ python otf2ttf.py SourceHanSerif-Regular.otf
$ python otf2ttf.py fonts/SourceHanSerifSC-Regular.otf
```
```
Expand All @@ -34,6 +37,7 @@ ttx -y n ./NotoSansCJK-Regular.ttc
$ pyenv global 3.7.2
$ pip install -r requirements.txt
```

```
#GUI で使う
$ brew cask install xquartz
Expand Down Expand Up @@ -90,39 +94,35 @@ $ python getPinyinAlphbets.py
|k| K.svg | k.svg |
|l| L.svg | l.svg |
|m| M.svg | m.svg |
|ḿ| uni1E3F.svg | ḿ.svg |
|n| N.svg | n.svg |
|ń| Nacute.svg | ń.svg |
|o| O.svg | o.svg |
|ō| Omacron.svg | ō.svg |
|ó| Oacute.svg | ó.svg |
|ǒ| uni01D2.svg | ǒ.svg |
|ò| Ograve.svg | ò.svg |
|| uni1EDF.svg | ở.svg |
|p| P.svg | p.svg |
|q| Q.svg | q.svg |
|r| R.svg | r.svg |
|s| S.svg | s.svg |
|t| T.svg | t.svg |
|u| U.svg | u.svg |
|ū| Umacron.svg | ū.svg |
|ú| Uacute.svg | ú.svg |
|ǔ| uni01D4.svg | ǔ.svg |
|ù| Ugrave.svg | ù.svg |
|ū| Umacron.svg | ū.svg |
|ú| Uacute.svg | ú.svg |
|ǔ| uni01D4.svg | ǔ.svg |
|ù| Ugrave.svg | ù.svg |
|ü| Udieresis.svg | ü.svg |
|ǖ| uni01D6.svg | ǖ.svg |
|ǘ| uni01D8.svg | ǘ.svg |
|ǚ| uni01DA.svg | ǚ.svg |
|ǜ| uni01DC.svg | ǜ.svg |
|v| V.svg | v.svg |
|w| W.svg | w.svg |
|x| X.svg | x.svg |
|y| Y.svg | y.svg |
|z| Z.svg | z.svg |
|ǖ| uni01D6.svg | ǖ.svg |
|ǘ| uni01D8.svg | ǘ.svg |
|ǚ| uni01DA.svg | ǚ.svg |
|ǜ| uni01DC.svg | ǜ.svg |
|ḿ| uni1E3F.svg | ḿ.svg |
|ń| Nacute.svg | ń.svg |
|| uni1EDF.svg | ở.svg |


ピンインの配置をするために、文字に関する位置情報をまとめる。AI上の情報をまとめてる。
jsons/pinyin-alphabet-size.json を編集する

## 拼音を書き込む漢字のSVGを抽出する
漢字のSVGを取り出す
Expand All @@ -140,6 +140,10 @@ $ python pinyinFont.py
$ python removeWithoutHanziSVG.py
```

## SVGの最適化する
transformが多重に掛かっているので、一つにまとめる.
簡単なので[SVGCleaner.app](https://github.com/RazrFalcon/svgcleaner-gui/releases)を使う。

## SVG -> glif に置き換える
ufoの中の各文字のアウトラインを持つのがglif
Ref.[extract rotation, scale values from 2d transformation matrix](https://stackoverflow.com/questions/4361242/extract-rotation-scale-values-from-2d-transformation-matrix)
Expand All @@ -149,13 +153,10 @@ Matrix can calculate the scale, rotation, and shift at one time by raising the d
\y'/ = \b b f/ × |y|
\1/

## SVG の容量を削除する
transformが多重に掛かっているので、一つにまとめる
SVGCleaner.appを使う

```
$ python svgs2glifs.py fonts/SVGs jsons/unicode-cid-mapping.json -w 2048 -H 2048 -t "2 0 0
-2 0 0"
2 0 0"
```
<!-- ```
$ python svg2glif.py fonts/SVGs/cid09502.svg out.glif -w 2048 -H 2048 -t "2 0 0 -2 0 0"
Expand All @@ -171,4 +172,4 @@ fontforge を用いて変換
[FIX_PINYIN.md](FIX_PINYIN.md)

# やること
[] 文字のサイズの設定を外部におく
[] 数値設定を外部におく
Binary file added fonts/SourceHanSerifCN-Regular.ttf
Binary file not shown.
Binary file added fonts/SourceHanSerifSC-Regular.ttf
Binary file not shown.
File renamed without changes
3 changes: 3 additions & 0 deletions imgs/outline1.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added imgs/ss.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
272 changes: 0 additions & 272 deletions jsons/pinyin-alphabet-size.json

This file was deleted.

Loading

0 comments on commit a92a3f1

Please sign in to comment.