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 19-02-2003, 11:08
RobC
Guest
 
Posts: n/a
Default Font Substitution Upon Import

Hi-

If I try to open or import a file manually in Draw11 and that file references fonts that aren't available on my computer, I get a warning and a chance to substitute another font (I know that this behavior is set under the Panose matching window).

However, if I import via Activelayer.Import myFileName, I do not get a warning and the default font is substituted automatically. The StructImportOptions object does not appear to offer any control over this behavior.

I'd prefer to be warned if a font is missing. How can I achieve this?

Thanks,
Rob
Reply With Quote
  #2  
Old 19-02-2003, 13:39
Alex's Avatar
Alex Alex is offline
Administrator
 
Join Date: Nov 2002
Posts: 1,941
Blog Entries: 4
Default PANOSE matching dialog on import

You should set Application.PanoseMatching property to cdrPanosePrompt.
Reply With Quote
  #3  
Old 04-03-2003, 13:26
RobC
Guest
 
Posts: n/a
Default

This worked on one application (from vba), but doesn't work in another application. In fact, although I set panosematching = cdrPanoseprompt, I can't get Draw to prompt me.
Reply With Quote
  #4  
Old 05-03-2003, 15:02
RobC
Guest
 
Posts: n/a
Default Panose Matching

When I set matching = cdrPanosePrompt (from VB via COM), I would expect Draw11 to pop up the modal font substitution dialog box. It doesn't.

Instead, it performs a permanent font substitution. Suprisingly, this is not even the default behavior I have set in the options menu.

It's critical that I be able to identify situations in which fonts are being substituted or are missing. How can I acheive this?
Reply With Quote
  #5  
Old 10-03-2003, 23:06
Alex's Avatar
Alex Alex is offline
Administrator
 
Join Date: Nov 2002
Posts: 1,941
Blog Entries: 4
Default Re: Panose Matching

Rob,

I have investigated this issue a little further and here is what I have found out.

Each time you connect to CorelDRAW from an out-of-process controller, a new instnace of the Application object is created for you. There is also an application instance provided for VBA the very first time it is initialized. The thing is that the PanoseMatching property is stored in the Application class and it turns out that each class instance has its own settings which do not affect each other. It also happened that the VBA's Application object is the one whose PanoseMatching settings is used by the application to control that dialog on import/open.

This is definitely a bug but understanding why it happens might allow us to find a workaround. Fortunately there is one.

The trick is to get the Application object used by VBA. Good thing is that most CorelDRAW object have an Application property that return the Application object which is the same Application object used by VBA. So in order to get it we need:
  1. Make sure the VBA is initialized and the Application object for VBA is created
  2. Get that VBA Application object and use it to set the PanoseMatching property

Here is how you do it:

Code:
Sub TestPanose()
    Dim Draw As CorelDRAW.Application
    Dim doc As Document
    
    Set Draw = New CorelDRAW.Application
    Draw.InitializeVBA
    Draw.Application.PanoseMatching = cdrPanosePrompt
    Set doc = Draw.CreateDocument
    doc.ActiveLayer.Import "D:\SomeFile.cdr"
End Sub
Here I create an instance of CorelDRAW's application object by using VB's New keyword. Then I initialize VBA which creates another instance of the Application object.
Finally I get the reference to the VBA's Application object by using the Application property of our Application object (looks heavy but it's not as complicated as it sounds).

If you do not initialize VBA, then each time you access an object's Application property, a new instance of Application object will be created and destroyed as soon as you release the reference to it. So, another trick could be to use the second copy of the Application object and keep it referenced as long as you application is running:

Code:
Sub TestPanose()
    Dim Draw As CorelDRAW.Application
    Dim doc As Document
    
    Set Draw = New CorelDRAW.Application
    Set Draw = Draw.Application ' Get a reference to the "VBA" app object instead
    Draw.PanoseMatching = cdrPanosePrompt
    Set doc = Draw.CreateDocument
    doc.ActiveLayer.Import "D:\SomeFile.cdr"
End Sub
This should work to your satisfaction.

I hope this helps.
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
T1 fonts & Bitstream font nav. vs Corel draw 12 & 11 xombie General 2 22-05-2005 17:35
weird font issue bbolte CorelDRAW/Corel DESIGNER VBA 1 21-04-2005 15:20
how to specify the font size in inches bbolte CorelDRAW/Corel DESIGNER VBA 14 26-01-2005 22:19
Bitstream Font Nav Problem ddonnahoe General 0 16-12-2004 08:25
Missing font dialog on import click101 CorelDRAW/Corel DESIGNER VBA 2 28-04-2003 12:32


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


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