To find the current font name used for a Text object named myText, use the following syntax:
myText.SetSelection(0,-1);
var myTextFormat = myText.GetSelectionStyle();
var myTextFont = myTextFormat.fontname;
Note:
You must first set the selection of the Text object or the Return Values for this function will be ‘undefined’. In this example, the whole Text object myText was selected and the Return Values for GetSelectionStyle saved in a variable named myTextFormat. The variable myTextFormat is now an object that contains the Return Values as properties. In this example, to save the property fontsize in a new variable named myTextFont the fontsize property is identified in the myTextFormat object i.e. myTextFormat.fontsize. To identify the boldReturn Value use, myTextFormat.bold; to identify the italicReturn Value, use myTextFormat.italic, and so on.
see also:GetSelectionParagraphStyle and SetSelectionParagraphStyle