Hi, I'm working on a renderer using FreeType. The renderer creates a list of FT_Faces, and query each face to find a suitable glyph for a given codepoint. This glyph is then rendered into a bitmap and stored for later use. When text is rendered, the renderer calculates the position of the bitmap with the following formula: // font->size is the intended height of the face, passed into FT_Set_Pixel_Sizes() baseline = (face->ascender / (float) face->units_per_EM) * font->size; target_y = y - face->glyph->bitmap_top + baseline;
My problem arises when different faces have different baselines, and some faces (especially CJK) has weird baselines as CJK scripts technically don't have a concept of baselines. This causes the text using different faces to be offsetted vertically. I've thought of choosing the lowest baseline or calculating the average baseline for the entire run, but all of them would potentially mess up the text. What would be a good way to solve this? Any help is appreciated. Thanks, Kelvin