I use skia to measure text's width and to build own pixel independent text layout. As I understood method SkFont::getWidths returns the advanced width for each glyph in pixels.
I have investigated that skia uses free type library under hood to fetch information about font metrics for font face . Skia creates inside SkScalerContext_FreeType and calls FT_Set_Char_Size for new scaled font face and set default DPI equal 72:
if (FT_IS_SCALABLE(fFaceRec->fFace)) {
err = FT_Set_Char_Size(fFaceRec->fFace.get(), scaleX, scaleY, 72, 72);
if (err != 0) {
SK_TRACEFTR(err, "FT_Set_CharSize(%s, %f, %f) failed.", fFaceRec->fFace->family_name, fScale.fX, fScale.fY);
return;
}
}
As I understood when I called SkFont::getWidths in this case 1 px = 1 pt?
I wonder how I get advanced width of each glyph in points (1/72 inch) to build pixel independent text layout for different DPI(for example I have logical dpi equal 96 on my OS now )? Is there any way to get glyph width information in pixel independent units?
I know that free type allows to pass special configuration flag FT_LOAD_NO_SCALE in function FT_Load_Glyph don't scale the outline glyph loaded and t keep it in font units. Does it possible do via Skia?