フォント METAFONT 新しいページはコチラ
提供: yonewiki
(→簡単なMETAFONTの流れ) |
(→METAFONTプログラミング) |
||
149行: | 149行: | ||
このプログラムの中身を説明しませんが、試しに現在よく使われているフォントファイルを作成する作業を知るために、わけがわからないまま変換作業をしてみます。プログラムの細かい説明はまた時間があったらどこかでやりたいと思います。 | このプログラムの中身を説明しませんが、試しに現在よく使われているフォントファイルを作成する作業を知るために、わけがわからないまま変換作業をしてみます。プログラムの細かい説明はまた時間があったらどこかでやりたいと思います。 | ||
− | そしたら、[[フォント]]にある手順でFonfForgeをインストールした上で、以下のコマンドを実行します。 | + | そしたら、[[フォント#Windowsフォントファイル作成アプリ]]にある手順でFonfForgeをインストールした上で、以下のコマンドを実行します。 |
− | >mf | + | >'''mf''' |
− | **\mode=localfont; input o.mf | + | **'''\mode=localfont; input o.mf''' |
それで次に | それで次に | ||
− | >mf2pt1 o.mf | + | >'''mf2pt1 o.mf''' |
ちなみに4行目のfont_size 10pt#;という指定が無い場合は | ちなみに4行目のfont_size 10pt#;という指定が無い場合は | ||
a design size must be specified in o.mf or on the command line | a design size must be specified in o.mf or on the command line | ||
− | + | というようなエラーになります。 | |
mf2pt1コマンドの実行結果は以下のようになると思います。 | mf2pt1コマンドの実行結果は以下のようになると思います。 | ||
+ | >'''mf2pt1 o.mf''' | ||
+ | Invoking "mpost -mem=mf2pt1 -progname=mpost '\mode:=localfont; mag:=100; bpppix 0.02; nonstopmode; input o.mf'"... | ||
+ | This is MetaPost, version 2.000 (TeX Live 2017/W32TeX) (kpathsea version 6.2.3) | ||
+ | (c:/texlive/2017/texmf-dist/metapost/mf2pt1/mf2pt1.mp | ||
+ | (c:/texlive/2017/texmf-dist/metapost/base/mfplain.mp | ||
+ | Preloading the plain base, version 0.99: preliminaries, | ||
+ | basic constants and mathematical macros, | ||
+ | macros for converting units, | ||
+ | macros and tables for various modes of operation, | ||
+ | macros for drawing and filling, | ||
+ | macros for proof labels and rules, | ||
+ | macros for character and font administration, | ||
+ | and a few last-minute items.)) | ||
+ | (./o.mf [79] ) | ||
+ | Font metrics written on io2.tfm. | ||
+ | 1 output files written: io2.79 | ||
+ | Transcript written on o.log. | ||
+ | |||
+ | mf2pt1 is using the following font parameters: | ||
+ | font_version: 001.000 | ||
+ | font_comment: Font converted to Type 1 by mf2pt1, written by Scott Pakin. | ||
+ | font_family: O | ||
+ | font_weight: Medium | ||
+ | font_identifier: O | ||
+ | font_fixed_pitch: false | ||
+ | font_slant: 0 | ||
+ | font_underline_position: -100 | ||
+ | font_underline_thickness: 50 | ||
+ | font_name: O-Medium | ||
+ | font_unique_id: 4501927 | ||
+ | font_size: 9.9626400996264 (bp) | ||
+ | font_coding_scheme: standard | ||
+ | |||
+ | Invoking "mpost -mem=mf2pt1 -progname=mpost '\mode:=localfont; mag:=100.375; bpppix 0.02; nonstopmode; input o.mf'"... | ||
+ | This is MetaPost, version 2.000 (TeX Live 2017/W32TeX) (kpathsea version 6.2.3) | ||
+ | (c:/texlive/2017/texmf-dist/metapost/mf2pt1/mf2pt1.mp | ||
+ | (c:/texlive/2017/texmf-dist/metapost/base/mfplain.mp | ||
+ | Preloading the plain base, version 0.99: preliminaries, | ||
+ | basic constants and mathematical macros, | ||
+ | macros for converting units, | ||
+ | macros and tables for various modes of operation, | ||
+ | macros for drawing and filling, | ||
+ | macros for proof labels and rules, | ||
+ | macros for character and font administration, | ||
+ | and a few last-minute items.)) | ||
+ | (./o.mf [79] ) | ||
+ | Font metrics written on o.tfm. | ||
+ | 1 output files written: io2.79 | ||
+ | Transcript written on o.log. | ||
+ | |||
+ | Converting PostScript graphics to Type 1 font programs... | ||
+ | |||
+ | Invoking "t1asm o.pt1 o.pfb"... | ||
+ | |||
+ | Invoking "fontforge -script o.pe o.pfb"... | ||
+ | Copyright (c) 2000-2014 by George Williams. See AUTHORS for Contributors. | ||
+ | License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html> | ||
+ | with many parts BSD <http://fontforge.org/license.html>. Please read LICENSE. | ||
+ | Based on sources from XX:XX AWST XX-MMM-YYYY-ML-TtfDb-D. | ||
+ | Based on source from git with hash: f72e17e105afb8d934cadac0e738443f00ef6553 | ||
+ | |||
+ | *** Successfully generated o.pfb! *** | ||
− | + | 上記によって生成されたpfbファイルをFontForgeで開いてフォントファイルの出力からttfやotfのファイルを保存できます。(FontForgeでttfファイルを出力するときとかには、ちょいちょい警告エラーがでたりしますが、無視してもなんとかなります。警告に対処していく作業ができるようになった方がいいですけどね。この生成したO-Midium.ttfをウィンドウズにインストールしたりするとOだけが指定したフォントで表示されるようになります。他の文字コードも対応したい場合はメタフォントプログラムをガッチリ勉強して、ASCIIコードの範囲を網羅すること->IS漢字第一水準->第二水準->最終的にはUnicodeフォントと幅を広げる必要があります。) | |
− | 上記によって生成されたpfbファイルをFontForgeで開いてフォントファイルの出力からttfやotfのファイルを保存できます。 | + | |
== '''TEXにフォントを認識させる''' == | == '''TEXにフォントを認識させる''' == | ||
205行: | 266行: | ||
という感じです。aからhのコードとカタチを無視すれば、コード1は固定ですが、いろいろなバランスにした同じ文字を比較したりもできます。 | という感じです。aからhのコードとカタチを無視すれば、コード1は固定ですが、いろいろなバランスにした同じ文字を比較したりもできます。 | ||
+ | |||
+ | |||
+ | == '''METAFONTプログラミング''' == | ||
+ | ここからは、実際にMETAFONTプログラミングをやってみるための解説記事になります。 | ||
+ | あまり見たことのないような英字の等幅フォントを作るサンプルとともにMETAFONTプログラムの解説をするつもりです。全部出来上がったら、自分を自分で褒めてあげたい。そう思います。そのあとにtfmを活用したプロポーショナルフォントや、連続文字によって置き換わる文字とかのような特殊なフォントを作ってみたいですね。 | ||
+ | |||
+ | |||
+ | *[[METAFONT 単位]] METAFONTなどのフォント制作に必要となる単位の知識について | ||
+ | *[[METAFONT 設定変数]] font_identifier | ||
+ | *[[METAFONT 設定関数]] define_pixels、define_blacker_pixels、define_corrected_pixels | ||
+ | *[[METAFONT beginchar … endchar]] フォント定義関数 | ||
+ | |||
[[フォント]]に戻る | [[フォント]]に戻る |