How to change element fonts?

MagicDraw OpenAPI, scripting related questions and discussions

Moderator: Moderators

How to change element fonts?

Postby MarianneB » Wed Aug 27, 2014 6:21 am

I'd like to change all fonts in several diagrams from Arial to Times New Roman (and back in case I need the diagrams for presentations, not for documents). Sizes should stay the same.

Is it possible to change fonts manually without selecting all sets of modeling elements with the same font size?
If not: How can I change the font type, but keep the font size using MagicDraw's OpenAPI (including role names, enumeration items, and so on)?

Thank you in advance!
MarianneB
Forum Newbie
Forum Newbie
 
Posts: 14
Posts Rating:0
Joined: Mon Jan 25, 2010 4:22 am

Re: How to change element fonts?

Postby mindaugas.genutis » Thu Aug 28, 2014 5:47 am

Hello,

Manual approach:

1. Go to Options -> Project
2. Select Symbol Styles -> Shapes.
3. Change the font.
4. Click Apply and select the diagrams to which you want to apply.
5. In the next dialog leave only the Font property on the right.
6. The style will be changed for symbols on the diagrams.

This will cover 99% of your needs, because most shapes reuse the same font size.

Open API approach: iterate all symbols on the diagram and for each Presentation Element use its getFont() and setFont() methods to manipulate fonts. Here you may change only the family of the font object, you won't have to care about font size.

Yours Sincerely,

-- Mindaugas Genutis
User avatar
mindaugas.genutis
Customer Support
Customer Support
 
Posts: 510
Posts Rating:37
Joined: Thu Feb 04, 2010 1:57 am
Location: Kaunas

Re: How to change element fonts?

Postby MarianneB » Fri Aug 29, 2014 5:43 am

Thanks a lot! That's easy.
MarianneB
Forum Newbie
Forum Newbie
 
Posts: 14
Posts Rating:0
Joined: Mon Jan 25, 2010 4:22 am

Re: How to change element fonts?

Postby carternikloas@yandex.com » Sat May 07, 2022 6:43 am

nice post amzaing topic for discussion
carternikloas@yandex.com
Forum Newbie
Forum Newbie
 
Posts: 3
Posts Rating:0
Joined: Thu Feb 10, 2022 12:25 am

Re: How to change element fonts?

Postby thomas8927eva@gmail.com » Sat May 14, 2022 1:07 am

I am also facing the same issue. If you find a solution please don't forget to update this thread.
thomas8927eva@gmail.com
Forum Newbie
Forum Newbie
 
Posts: 1
Posts Rating:0
Joined: Sat May 14, 2022 1:05 am


Return to Programmatic Extendibility

Who is online

Users browsing this forum: No registered users and 0 guests

cron