昨天整合OpenJDK8到泰山JDK8,发现freetypeScaler.c有所改动。实际上这个文件已经被泰山JDK改得面目全非。吾当时还有点奇怪,这个文件应该不会改,怎么这次改动了呢?仔细对比了代码,发现其中一段很有意思:
// values used by FreeType (as of version 2.10.1) for italics transformation matrix in FT_GlyphSlot_Oblique #define FT_MATRIX_ONE 0x10000 #define FT_MATRIX_OBLIQUE_XY 0x0366A static void setupTransform(FT_Matrix* target, FTScalerContext *context) { FT_Matrix* transform = &context->transform; if (context->doItalize) { // we cannot use FT_GlyphSlot_Oblique as it doesn't work well with arbitrary transforms, // so we add corresponding shear transform to the requested glyph transformation target->xx = FT_MATRIX_ONE; target->xy = FT_MATRIX_OBLIQUE_XY; target->yx = 0; target->yy = FT_MATRIX_ONE; FT_Matrix_Multiply(transform, target); } else { target->xx = transform->xx; target->xy = transform->xy; target->yx = transform->yx; target->yy = transform->yy; } }
这意思就是:FreeType对于任意变形的斜体支持不好,所以我们不得不自行处理。
任意变形的斜体?某些情况下泰山OFFICE也会遇到,需要进行专门研究。