[CE 10.17.00.209 C#] Get font used by selected TextElement

As the title suggest I'm trying to retrieve what font is being used by a selected `TextElement`. I would have expected this information to be stored in the 'ElementDisplayParameters' or the `TextBlock.Properties`, but this does not seem to be the case.

I'm able to retrieve a list of all fonts currently in use using:

var allFonts = DgnFontManager.CreateKnownFontList(Session.Instance.GetActiveDgnFile(), DgnFontFilterFlags.All);

After which I loop through all selected elements (in test case only one element selected) and check if the selected element is of type TextElement.

DgnModelRef modelRef = Session.Instance.GetActiveDgnModelRef();
uint numSelected = SelectionSetManager.NumSelected();
for (uint i = 0; i < numSelected; i++)
{
    Element el = null;
    var status = SelectionSetManager.GetElement(i, ref el, ref modelRef);

    if(el.ElementType == MSElementType.Text)
    {
        
    }
}

After which I can get the TextBlock properties and the TextElements DisplayProperties:

var textEle = (TextElement)el;
var partIDs = textEle.GetTextPartIds(new TextQueryOptions());
foreach (var id in partIDs)
{
    var textPart = textEle.GetTextPart(id);
    var props = textPart.GetProperties();
}

var textEleDisplayParams = textEle.GetElementDisplayParameters(false);

However none of these seem to contain any information on what font was used for the placed text.

Looking at the documentation `ElementDisplayParameters` only contains properties on level, colour and line style weight and transparancy and the TextBlock properties only seems to contain information about the actual textual content and the caret.

There is also the class 'DgnFontNumberMap', but this only maps the names and ID's together.

Is there a way to retrieve the font used from a TextElement?

Regards,
Remy

Parents Reply Children
No Data