Is there a way to get the default document font info?

Is there a way to get the font used of the current document or the font that XD uses for new documents?

Update:
Also, basically get text defaults including font size, font family, font color, font weight.

1 Like

You can only get font data of the selected texts. What would be the use case for this?

If you are exporting from XD to any other format like XML, HTML, MXML, XAML, SVG or other document format there is a default font style that you can add to the body tag.

So then in the exported document, if the body tag has font: Arial 12px black, then all of the text elements in XD do not have to have that style information since they will inherit that style (unless that style is different in that element).

This saves space in the exported document and it gives a default text style in case the document doesn’t have any text elements added to it.

For example, let’s say I’m a designer in a 3 step workflow. I create a vectorization of a medical image. When I finish my plugin exports that vectorized graphic to my co-worker who uses Illustrator to add annotations (step 2). I want to set the default text style for him to use in my export (sort of style guide).

Currently if I want to include the font style with the export and there is no text in the XD project then during export I would have to programmatically add a dummy text field to the artboard, get it’s initial values and then remove it all while in loop. If I was able to get the default document font styles via API I could include those values in the export.

Thanks @Velara this is a good and valid use case. I will add this to my list and have a discussion with the product team. Please stay tuned!