2008年2月17日日曜日

xpdfの高画質化 part2

FreeType2のドキュメントを読んだりしたりして xpdf を解析しようとしていたけど, 根負けして諦めた. またそのうち暇があったら触ってみようかと思う. とりあえず, いじったところをアップしてみる.

ポイントは, 一つ目の size を 8倍にしているところ. (8倍じゃなくても, 適当に大きくしてあればいいらしい) これだけで見た目はグッと変わった. あと, 標準ではヒンティングがオフになっているが, それをオンにした. これは好みの問題.

このパッチは FreeType2 用なので T1lib はオフにしないと効果がないかもしれない. ~/.xpdfrc に
enableT1lib no
enableFreeType yes

を足せばOK.

なお, PDFファイルによっては xpdf が落ちることもあったので要注意!

--- a/splash/SplashFTFont.cc Sun Feb 17 12:40:58 2008 +0900
+++ b/splash/SplashFTFont.cc Sun Feb 17 22:27:23 2008 +0900
@@ -50,7 +50,7 @@ SplashFTFont::SplashFTFont(SplashFTFontF
return;
}
face->size = sizeObj;
- size = splashSqrt(mat[2]*mat[2] + mat[3]*mat[3]);
+ size = 8 * splashSqrt(mat[2]*mat[2] + mat[3]*mat[3]);
if (FT_Set_Pixel_Sizes(face, 0, (int)size)) {
return;
}
@@ -180,9 +180,9 @@ GBool SplashFTFont::makeGlyph(int c, int
}

// if we have the FT2 bytecode interpreter, autohinting won't be used
-#ifdef TT_CONFIG_OPTION_BYTECODE_INTERPRETER
- if (FT_Load_Glyph(ff->face, gid,
- aa ? FT_LOAD_NO_BITMAP : FT_LOAD_DEFAULT)) {
+//#ifdef TT_CONFIG_OPTION_BYTECODE_INTERPRETER
+#if 1
+ if (FT_Load_Glyph(ff->face, gid, FT_LOAD_DEFAULT | FT_LOAD_TARGET_LIGHT)) {
return gFalse;
}
#else
@@ -196,7 +196,7 @@ GBool SplashFTFont::makeGlyph(int c, int
return gFalse;
}
#endif
- if (FT_Render_Glyph(slot, aa ? ft_render_mode_normal
+ if (FT_Render_Glyph(slot, aa ? FT_RENDER_MODE_LIGHT
: ft_render_mode_mono)) {
return gFalse;
}

0 件のコメント: