OberonPlace.com Forums  

Go Back   OberonPlace.com Forums > Developer Forums > VBA > CorelDRAW/Corel DESIGNER VBA

Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old 11-08-2008, 12:05
ddonnahoe's Avatar
ddonnahoe ddonnahoe is offline
Senior Member
 
Join Date: Jan 2004
Location: Louisville, KY
Posts: 552
Send a message via ICQ to ddonnahoe Send a message via AIM to ddonnahoe Send a message via MSN to ddonnahoe Send a message via Yahoo to ddonnahoe
Default Install fonts on the fly

I want to write a macro for creating numbers for jerseys. the question is, if I create a drop down of the fonts that I want to make available, (not actual installed fonts), and the font the user chooses is not installed, is there a way to install it on the fly? It has been suggested that I check my list against installed fonts and truncate the list to only available installed fonts., but I want to have the same fonts available every time the macro runs.
__________________
Sean
Waiting for a ride in the T.A.R.D.I.S.
Reply With Quote
  #2  
Old 11-08-2008, 20:58
shelbym's Avatar
shelbym shelbym is offline
Senior Member
 
Join Date: Nov 2002
Location: Cheyenne, WY
Posts: 1,769
Blog Entries: 9
Send a message via ICQ to shelbym Send a message via AIM to shelbym Send a message via MSN to shelbym Send a message via Yahoo to shelbym
Default Windows API

You can use the Windows API to install the fonts....
Code:
Private Declare Function AddFontResource Lib "gdi32" Alias "AddFontResourceA" (ByVal lpFileName As String) As Long
Private Declare Function RemoveFontResource Lib "gdi32" Alias "RemoveFontResourceA" (ByVal lpFileName As String) As Long

Private Sub cmb_Load_Click()
    AddFontResource "C:\Temp\Berling.ttf"
End Sub

Private Sub cmb_Unload_Click()
    RemoveFontResource "C:\Temp\Berling.ttf"
End Sub
Unfortunately CorelDRAW still can't see the newly installed font, because it registers fonts on startup. I have no idea how to force a refresh of the font list. If you close DRAW and reopen it, it will see the font.

-Shelby
Reply With Quote
  #3  
Old 11-08-2008, 22:13
vindaa
Guest
 
Posts: n/a
Default Font Navigator

If you use Bistream Font Navigator (that comes with Corel) to add fonts you won't need to restart coreldraw. Also once you perform the "find fonts" in Font Navigator it just finds fonts but does not install it all at a time, but when you try to open a file with some missing fonts it will install the missing fonts of its own and open the file. Generally what I do is, I make a folder somewhere on the disk that contains all the thousands of fonts, and Font Navigator installs it whenever needed.

Hope it helps
Reply With Quote
  #4  
Old 12-08-2008, 07:20
ddonnahoe's Avatar
ddonnahoe ddonnahoe is offline
Senior Member
 
Join Date: Jan 2004
Location: Louisville, KY
Posts: 552
Send a message via ICQ to ddonnahoe Send a message via AIM to ddonnahoe Send a message via MSN to ddonnahoe Send a message via Yahoo to ddonnahoe
Default

Vindaa, thank you for your reply, but I am well aware of Font Navigator and it's capabilities (and lack thereof). What I am looking for is what Shelby posted about using the API to install a font via VBA code during the running of a macro. Unless I can find a way to refresh the application, (haven't looked to see if there is an Application.Refresh for Draw) then my idea won't work.
__________________
Sean
Waiting for a ride in the T.A.R.D.I.S.
Reply With Quote
  #5  
Old 05-09-2008, 12:26
SteveDude SteveDude is offline
Senior Member
 
Join Date: Dec 2005
Location: Salina, Kansas USA
Posts: 149
Default

Quote:
Originally Posted by shelbym View Post
Unfortunately CorelDRAW still can't see the newly installed font, because it registers fonts on startup. I have no idea how to force a refresh of the font list. If you close DRAW and reopen it, it will see the font.
-Shelby
Thankfully in X4 there is a way...

.ForceUpdateFontTable

You should also use this API, so other apps that actually listen for the message will know you installed a new font...

Code:
Private Const HWND_BROADCAST As Long = &HFFFF&
Private Const WM_FONTCHANGE As Long = &H1D
Private Declare Function SendMessage Lib "user32" Alias "SendMessageA" (ByVal hWnd As Long, ByVal wMsg As Long, ByVal wParam As Long, lParam As Any) As Long
Private Sub MySub()
'Font Install/Uninstall Stuff
.ForceUpdateFontTable
Call SendMessage(HWND_BROADCAST, WM_FONTCHANGE, 0, ByVal 0&)
End Sub
Reply With Quote
  #6  
Old 05-09-2008, 12:53
ddonnahoe's Avatar
ddonnahoe ddonnahoe is offline
Senior Member
 
Join Date: Jan 2004
Location: Louisville, KY
Posts: 552
Send a message via ICQ to ddonnahoe Send a message via AIM to ddonnahoe Send a message via MSN to ddonnahoe Send a message via Yahoo to ddonnahoe
Default

Thanks Steve Dude. Pre-shade-it
__________________
Sean
Waiting for a ride in the T.A.R.D.I.S.
Reply With Quote
  #7  
Old 08-09-2008, 16:47
SteveDude SteveDude is offline
Senior Member
 
Join Date: Dec 2005
Location: Salina, Kansas USA
Posts: 149
Default ...

Not a problem...It working fine for me in one my dockers.
Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Install Spot Colors from C++ dynamica CorelDRAW/Corel DESIGNER VBA 1 02-03-2007 09:14
Install Spot Colors form C++ dynamica CorelDRAW CS 0 01-03-2007 03:45
Cannot Install Calendar Wizard 4.1 markr Calendar Wizard 1 18-05-2006 08:41
Re-install question IMRKE General 2 25-02-2006 20:10
Doing a clean install with CDGS12 up grade? Ghidrah General 0 26-11-2004 13:49


All times are GMT -5. The time now is 17:07.


Powered by vBulletin® Version 3.8.1
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.
Copyright © 2011, Oberonplace.com