The Kinetic Jump site navigation header requires JavaScript to be enabled and the latest version of the Macromedia Flash Player. If you are you using a browser with JavaScript disabled please enable it now. Otherwise, please update your version of the free Flash Player by downloading here.

Welcome Guest Search | Active Topics | Log In | Register

Best way to install a font Options
mobilwave
#1 Posted : Friday, December 31, 2010 6:33:03 AM
Rank: Member
Groups: Member

Joined: 12/31/2010
Posts: 9
Location: Lisboa
I wonder what the best solution to make the installation of a font in Windows through Applife with a Windows Forms application.

Thanks in advance
brianh
#2 Posted : Friday, December 31, 2010 10:39:10 AM
Rank: Administration
Groups: Member, Administration

Joined: 5/24/2007
Posts: 362
Location: Minnesota

Hello,

 

To install a font during an update you will need to add the font to the Fonts folder and then call a native method (AddFontResourceA)to complete the installation.  Before installing, you'll probably want to check to see if the font is already installed.  I'll provide an example project on how to do this with this post.  In this example, I'll use four update actions that you can add to your update.

 

Action 1 - Set Shared Property action.  With this action I'll add the local client fonts directory to a shared property.  The other three actions will use this location.

 

Action 2 - Dynamic Code action.  With this action, I'll iterate the local fonts folder, looking for the font that I am installing.  If the font is not present, I'll conditionally execute the final two actions to install the font.  If the font is already here, the next two actions will be skipped.

 

Action 3 - Add & Replace files action.  Conditionally execute.  Add the new font files to the Fonts folder.

 

Action 4 - Dynamic Code action.  Conditionally execute.  Use P/Invoke to call the AddFontResource method.  This completes the font installation.

 

These actions will add a font to a system during an update.  If you'll be doing this in many updates, you could alternatively build a single custom update action to add a font.

 

 

File Attachment(s):
FontInstallExample.zip (91kb) downloaded 9 time(s).
brianh attached the following image(s):
action1.png
action2.png
action3.png
action4.png
Brian Haas
Kinetic Jump Software
mobilwave
#3 Posted : Thursday, January 06, 2011 8:23:27 AM
Rank: Member
Groups: Member

Joined: 12/31/2010
Posts: 9
Location: Lisboa
Great! thanks.
Deena7slater
#4 Posted : Tuesday, June 14, 2011 4:48:07 AM
Rank: Member
Groups: Member

Joined: 6/14/2011
Posts: 1
Location: 1540 Butler St Se, Washington
What is exactly Conditionally execute?
brianh
#5 Posted : Tuesday, June 14, 2011 7:10:51 AM
Rank: Administration
Groups: Member, Administration

Joined: 5/24/2007
Posts: 362
Location: Minnesota

Every action in an action list can have a conditional statement, based on Shared Properties.  Shared Properties are basically variables that can be assigned by update actions and shared between them.

 

In this particular case, the dynamic code action iterates the fonts that are currently installed on the deployed client. If the font that is being installed by this update is already present, this information is used to conditionally execute (or skip) the actions that will install the font.

Brian Haas
Kinetic Jump Software
Users browsing this topic
Guest
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.