[printing-japan] フォント関連調査 #1

吉山 晃 yosshy @ debian.or.jp
2003年 7月 27日 (日) 04:49:41 PDT


  吉山です。

  フォント関連の調査を割り振られたので、とりあえず FreeType2 ライブラリに
ついて調査を始めました(STSF でも内部で FreeType2 を利用している為)。
  とりあえずは概要をまとめた(というより和訳した)ので送付します。

---
FreeType2 概要(http://freetype.sourceforge.net/freetype2/)

■ライセンス

下記のデュアルライセンス
・BSD-like "FreeType License"
・GPL

■機能概略

・単純かつ使いやすい API
・TrueType や Type 1 などのスケーラブルフォント形式をサポートし、クラ
  イアントアプリケーションにアウトラインデータ(と制御命令/ヒント情報)
  を提供できる(!)
・各種フォント形式/グリフイメージフォーマットのサポートに使用される、
  静的/動的リンク可能なモジュール化構造
・アプリケーション側のメモリ管理/I/Oストリーム実装を利用(ROM化可能)
・多数のフォント形式をサポート
	TrueType フォント
	Type1 フォント
	CIDキー化 Type1 フォント
	CFF フォント
	OpenType フォント(TrueType/CFF派生の両方)
	SFNT ベースビットマップフォント
	X11 PCF フォント
	Windows FNT フォント
	BDF フォント(アンチエイリアス版を含む)
	PFR フォント
	Type42 フォント(限定的サポート)
・与えられたグリフアウトラインから、高品質な単色 bitmap、または 256 階
  調の灰色でアンチエイリアスされた pixmap(Windows/FreeType1 では5階調)
  を生成可能
・TrueType や OpenType 仕様で定義された全てのキャラクタマッピングをサ
  ポート。また、Type1 フォントを自動的に Unicode キャラクタマッピング
  化する事も可能(オリジナルマップでも利用可能)。
・グリフ名やカーニングデータなどの情報にアクセスする為の単純な機能を 
  FreeType2 コア API が提供
・完全かつ実用的な TrueType バイトコードインタプリタ。
  (特許について注意事項あり)
・TrueType バイトコードインタプリタを必要としない/使いたくない場合の
  為に、独自の自動ヒントモジュールを開発。TrueType 以外のスケーラブル
  フォントでも使用可能。
・他の類似ライブラリでは提供していない、kerning distances, glyph
  names, vertical metrics 等の情報を提供可能
・FreeType(2.0.1 以降)独自のキャッシュ機能。フェイスインスタンスやグリ
  フイメージのキャッシングに利用可能。

■プログラミング言語

・ANSI C
  ※gcc, Visual C++, Borland C++ でコンパイル可能
  ※外部依存性がないので、様々なシステムでコンパイル/インストール可能

■特許問題

TrueType 仕様の幾つかの小さな側面は Apple COmputer が持つ幾つかの特許
によって保護されているので、この特許に抵触するかライセンスを受けない限
り、TrueType グリフを正確にレンダリングする事ができない。このため、デ
フォルト設定で構築された FreeType2 は TrueType グリフをレンダリングす
る為の特許化されたテクニックを一切使用しない。(Apple の特許が認められ
ていない国での使用の場合やあなたがライセンスを持っている場合、TrueType 
フォントの最良な品質を求めるのであれば、単純な設定マクロを修正してライ
ブラリをインストールするだけで OK)

※TrueType 特許

・Patent #1 : US5155805: Method and apparatus for moving control
  points in displaying digital typeface on raster output devices
  Filed on May, 8 1989

・Patent #2 : US5159668: Method and apparatus for manipulating
  outlines in improving digital typeface on raster output devices
  Filed on May, 8 1989 too. Actually, the two patents were filed and
  granted concurrently.

・Patent #3 : US5325479: Method and apparatus for moving control
  points in displaying digital typeface on raster output devices
  Filed on May 28, 1992

※TrueType バイトコードインタプリタ

The reason why TrueType fonts can render so beautifully at small pixel
sizes comes from the way glyph images are described and processed
according to the TrueType specification. Namely:

Each glyph image is stored in a TrueType font file as a simple scalable
outline (built from line segments and quadratic bezier arcs), to which is
associated an array of bytes, called the glyph program.

The glyph program really contains a series of program instructions,
written for a specific virtual machine (the TrueType VM), defined in the
TrueType specification.

The TrueType VM is heavily designed towards the processing of geometric
shapes. For example, it contains instructions to move points, measure
distances, align points to the pixel grid, etc..

When a glyph needs to be rendered at a specific pixel size, its outline is
loaded and scaled linearly to the current device space. Its glyph program
is fed to a Bytecode Interpreter that executes it.

The glyph program knows about the current pixel size, and will adjust the
glyph outline's to the font designer's intent in order to produce the best
possible bitmap (at least in theory :-)

※特許の影響
  特許で保護されたヒンティングなどのテクニックを使用しない場合、Arial 
  フォントでアルファベットを一通りレンダリングすると

・K,M,N,R,W,Z などの斜めの直線が太かったりおかしかったりする
・ウムラウト等の小さな点が汚い?

  FreeType1 はこの特許問題の影響を受ける(1.3からバイトコードインタプリ
  タを無効化できるがグリフ品質は落ちる)が、FreeType2 は自動ヒンティン
  グモジュールを持っている為にグリフ品質を落とさずに特許問題を回避でき
  る。

※デマ

・FreeType は商利用できない?
  いいえ。デジタルカメラ、ビデオゲーム、Java ランタイム、Psion PDA 等
  に利用されています。

・Apple は FreeType を suing または sued した(?)
  完全なデマ。

  su って何でしょ?

---
吉山あきら<yosshy @ debian.or.jp>





More information about the Printing-japan mailing list