标题: Positioning Issue of Texts [打印本页] 作者: milkyjing 时间: 2012-2-3 16:52:53 标题: Positioning Issue of Texts
In order to meet the way that both cairo and magick used to position the texts, the TCAX needs to be updated mainly focusing on its position algorithms.
1. meaning of PIX[0] of text PIXs will be changed to 'the offsets to the pen' while the old meaning is 'the distances from the virtual left-top to the bounding-box of the text glyph'.
2. font size definition will also be changed. from FT_SIZE_REQUEST_TYPE_REAL_DIM to FT_SIZE_REQUEST_TYPE_NOMINAL.
for reference, see,
FT_GlyphSlot slot = face->glyph; /* a small shortcut */
FT_UInt glyph_index;
int pen_x, pen_y, n;
... initialize library ...
... create face object ...
... set character size ...
pen_x = 300;
pen_y = 200;
for ( n = 0; n < num_chars; n++ )
{
/* load glyph image into the slot (erase previous one) */
While, after trial and error, I find we only need to change FT_SIZE_REQUEST_TYPE_REAL_DIM to FT_SIZE_REQUEST_TYPE_NOMINAL, then every thing goes fine.
作者: milkyjing 时间: 2012-2-4 14:14:56
Too bad, I just cannot get the same result of text layout from tcaxLib, cairo, magick, none of them produce the same result, +-1 pixel error occurs by chance. Only a few font may produce the same result. : (
Conclusion: if we use FT_SIZE_REQUEST_TYPE_REAL_DIM, the TCAS result can fit better to ASS, but the result of text is too small (smaller than a font size with 50 should be). However the good news is that, with most Japanese fonts, both of the definitions are OK. Sigh~~