You call GetTextExtentPoint32 on each character individually, not on whole string. Because you need to know size of each char in the bitmap anyway, so you can copy it out for your needs.
File name of font is irrelevant. You can rename arial font to a.ttf and it will still work. Font name is embedded in font.
I don't think there is a good and official way to get font name from file in GDI.
Hacky way would be using undocumented GetFontResourceInfo function with QFR_DESCRIPTION query:
https://superuser.com/a/1452012
Documented way would be to enumerate currently installed fonts, call AddFontResourceEx, then enumerate again and find the name that is new.