Greetings,
> I'd like to use it for typeface specimen at a moment.
You might have noticed the "specimen" package in SILE's core distribution.
There's also the "fontproof" separate modules (
https://github.com/sile-typesetter/fontproof) -- I don't know it well and don't know if it's very active, but I am told it was used by some font designers to show-case fonts in various ways.
> I need to calculate width of text (word) rendered with specific font family, wight and size.
An unconventional question with low-level tones ;)
SILE uses Harfbuzz as "shaper" library by default, and it should be possible to do the same kind of low-level things with it as with Cairo, i.e. shape stuff and retrieve various measurements.
(The above-mentioned "specimen" package actually does that kind of things it its "set-to-width" command implementation)
At a higher-level, one could also build an "hbox" and use it's dimensions.
E.g. from the SILE CLI REPL, you see what the gives:
SILE.call("font", { family = "Libertinus Serif", size = "12pt", weight=400 })
pl.pretty.dump(SILE.shaper:shapeToken("mytext", SILE.font.loadDefaults({})))
SILE.typesetter = SILE.typesetters.base()
print(SILE.typesetter:makeHbox({ "mytext" }).width)
N.B. It picks a font, shapes some word and outputs all the gory low-level details; then it instantiates a typesetter (as we are just in the CLI REPL without much loaded at that time, wraps the text in a box and show its width (height and depth fields of that box could of course be queried).
That's some basics to get you bootstrapped. Now you can read the manual on how to implement your own package for these bits of Lua code, implement some cool commands and access them from the markup ;)
Regards
Didier.