Trying to change the font of a text element from Arial to Century Gothic, and using a code snip from the U5 help file:
virtual StatusInt ChangeFontTool::_OnElementModify(EditElementHandleR eeh) override { // read the text string // aquire the font object DgnFontCP newFont = DgnFontManager::FindSystemFont(L"Century Gothic"); // Optionally provide a filter to find only RSC, SHX, or TrueType fonts; must also check NULL. if ( newFont->IsValid() && newFont != nullptr ) { wprintf(L"Font found\n"); // Create the helper class... ElementPropertiesSetterPtr remapper = ElementPropertiesSetter::Create(); remapper->SetFont(*newFont); // Dereference newFont if required based on how you got and verified the font object. // Change the font... bool bStatus = remapper->Apply(eeh); // You may now AddToModel or ReplaceInModel on eeh. if ( bStatus ) wprintf(L"Text Changed\n"); else wprintf(L"Text NOT Changed\n"); } else wprintf(L"Font not found\n"); return SUCCESS; // apply changes }
The remapper attempt fails, and I get the "Text NOT changed" message. The font IS found.
Bruce