I'm having some trouble computing the bounding box of glyphs. It's possible that I haven't understood the purpose of the FT_Glyph_Get_CBox function. In my understanding by using this function I should get the extreme coordinates of the glyphs, and these coordinates should match exactly the extreme coordinates of the rendered glyphs.
I'm using the FT_Outline_Render function to render glyphs with FT_RASTER_FLAG_DIRECT and FT_RASTER_FLAG_AA flags, and my own gray_spans callback. The glyph's bounding box is retreived with FT_Glyph_Get_CBox function with FT_GLYPH_BBOX_PIXELS mode.
Most of the time the bounding box returned by FT_Glyph_Get_CBox is accurate but for 5-10% of the glyphs the returned value differs by 1-2pixels from the rendered glyphs. The number and the character code of the glyphs for which I get inaccurate results depends on which pixel size I had set for the face.
For example, if I render all the glyphs of Arial version 5.06 using the default character map (the character map selected by FT) with 72px size, from 2814 glyphs i get inaccurate bounding boxes for 186.
I don't know if I can consider this as a bug in FT, because I'm not sure that the returned bounding box is meant to be 100% accurate or not.
If it's a bug I would be happy to help fixing it, if it's not please give me some advice how can I get accurate bounding boxes without actually rendering the glyphs.