Skip navigation
Currently Being Moderated

Loading font into memory.

Jun 26, 2012 2:45 AM

Hi all,

 

I have a scenario where i have to load the font(ttf files) into the memory  and apply it to all the selected textframe in the active document. So for loading the font i am using 'AddFontResourceEx()' api.

 

The problem is this, when i used this api it will not load the font at the same time, it will take some time to load the font. But the plugin will try to apply that font to the text frame. Sometimes font will apply somtimes not.

 

I am unable to understand its behaviour. Can someone tell me why its happening? Also is there any api through which we can refresh font list?

 

Thanks in advance....

 
Replies
  • Currently Being Moderated
    Jun 26, 2012 11:03 AM   in reply to AI_learner

    Interesting. I have a similar problem I solved using AddFontResourceEx(), but it was sort of the reverse. I have a library using FreeType that wouldn't 'see' fonts Adobe was loading (because they were coming from their own folders and not the Windows Font folder).

     

    You have the reverse problem, sort of. You also need to load additional fonts from (presumably) odd locations, but you want Illustrator to see the result. I'm not sure what to do for your case, though perhaps its a matter of timing? Are you seeing this "sometimes it works, sometimes it doesn't" on the same machine, or different ones? If the latter, it could just be the plugin load order. If it's the same machine, that's more troubling.

     

    Either way, your best bet is to find as early a place as possible to do the font loading. Where are you doing it now?

     
    |
    Mark as:
  • Currently Being Moderated
    Jun 27, 2012 11:03 AM   in reply to AI_learner

    Is there any reason you can't pre-load the fonts before they're clicked on in the panel? Or is that the point of the plugin, to load additional fonts?

     

    I don't know what causes the delay, or if there's a way to 'kick' it to make it update faster. The best bet is to have done it long before its needed so they're already there, but if that's the point of the panel, I guess we'll need to see if we can find something else.

     
    |
    Mark as:
  • Currently Being Moderated
    Jun 28, 2012 12:12 PM   in reply to AI_learner

    I don't see anything that lets you kick the font listing. You're cleary trying something along those lines with SendNotifyMessage(). I suspect it treats that as a call from a different thread, so sometimes it processes it before you count the fonts and sometimes it doesn't.

     

    Have you tried SendMessageCallback()? That lets you do the same thing (I think, more or less) but SendMessageCallback should invoke a callback function when the message has been processed. You could try that, and see if you get consistent results inside the callback function.

     

    Otherwise, I don't have any idae. This is strange territory for Illustrator, and its starting to sound like its an OS problem more than an application problem (if only because the SDK doesn't provide any help).

     
    |
    Mark as:

More Like This

  • Retrieving data ...

Bookmarked By (0)

Answers + Points = Status

  • 10 points awarded for Correct Answers
  • 5 points awarded for Helpful Answers
  • 10,000+ points
  • 1,001-10,000 points
  • 501-1,000 points
  • 5-500 points