Getting a font from fontid, or fontid from VectorFont / TextSequence?

Context:

I am looking for a way get the size of a text strip.

In the BA thread above, @testure kindly pointed me at blf.dimensions, which works but requires a fontid. Since I have not loaded the font myself via blf, I do not have a fontid†. The suggestion was to add 3 to the index of the font in bpy.data.fonts, but I found that in my case the offset is bigger (24-26) and not consistent even within the same blend file (via writing an operator to walk text strips and fontids and output results in text form).

I’ve looked at the python API docs but I don’t see anything that links existing fontids and fonts. However, since I am relatively unfamiliar with the API it is possible I have overlooked a convenience function, perhaps an operator or in another module.

Q: is there anything in the API that lets me figure out a (blf) fontid from a TextSequence.font / blf.data.fonts; or conversely figure out a font’s identity (.name) from a fontid? Does such a thing exist, or would the API have to be extended to match one to the other?

This seemed like the more appropriate place than BA to ask about in-depth API usage; thanks in advance for your time!


†: It works in the sense that if I figure out the fontid that represents the text strip’s font manually, I can call blf.size() and blf.dimensions() and get a result that exactly matches the text strip

The only workaround I can think of so far to get a fontid for blf that matches a text strip would be to grab the TextSequence.font.filepath, which could be resolved to an absolute filesystem path passed to blf.load() to get a fontid which definitely corresponds to the font in the text strip.

Update: I can confirm the workaround works (see below), but I would prefer a more direct way of doing this if possible!

def get_fontid_from_filepath(filepath=None) -> int:
    # use normpath() as blf.load() treats different representations
    # of the same path as different, resulting in a new fontid
    return blf.load(
        os.path.normpath(
           bpy.path.abspath(filepath)
    ))

# with a text strip selected in VSE
>>> get_fontid_from_filepath(C.selected_editable_sequences[0].font.filepath)
27