As far as I can tell fontRender only has a function getLineHeight, if this is really the case would someone be willing to try out adding a function to get the width?
I will also try this but I have never built an e2 image so this may take a while.
The following code would need to be added to lib/gdi/font.cpp
float fontRenderClass::getFontWidth(const gFont& font) { if (!instance) return 0; ePtr<Font> fnt; getFont(fnt, font.family.c_str(), font.pointSize); if (!fnt) return 0; singleLock s(ftlock); FT_Face current_face; if ((FTC_Manager_LookupFace(cacheManager, fnt->scaler.face_id, ¤t_face) < 0) || (FTC_Manager_LookupSize(cacheManager, &fnt->scaler, &fnt->size) < 0)) { eDebug("FTC_Manager_Lookup_Size failed!"); return 0; } int width = current_face->size->metrics.width; if (!width) { /* some fonts don't have width filled in. Estimate it based on the bbox dimensions. */ /* Usually, 'width' is less than the complete boundingbox width, so we use only xMax, to avoid getting a much too large line spacing */ width = FT_MulFix(current_face->bbox.xMax, current_face->size->metrics.x_scale); } return (width>>6); }
The following function definition would need to be added to the fontRenderClass in font.h
float getLineHeight(const gFont& font);