Skip to main content
Inspiring
October 29, 2024
Question

Loading and Unloading Custom Fonts with InDesign Plugin

  • October 29, 2024
  • 2 replies
  • 585 views

Hi All,

 

I have a custom open type font and i wants to load this font when my custom plugin loaded so that it won't be available to other user when custom plugin is not there.

Is there a way to Embed a font file as a resource in indesign sdk project so that font is available when plugin gets loaded. or some other alternate approach using native system api that I can use inside plugin code to load/unload it.

 

Regards,

Alam

 

 

<Title renamed by MOD>

This topic has been closed for replies.

2 replies

Legend
October 29, 2024

Something like these?

https://developer.apple.com/documentation/coretext/1499468-ctfontmanagerregisterfontsforurl

https://learn.microsoft.com/en-us/windows/win32/api/wingdi/nf-wingdi-addfontresourceexa

You'd eventually register your font before use by your widget draw, then unregister afterward so that it does not show in InDesign Font UI.

On the other hand if it works at all, it may cause a serious performance penalty whenever InDesign's font manager is reset. You'd also have to figure out how to associate the font with a UI font ID if you use that kind of widgets.

I'd stick to graphics as Robert suggested - e.g. try whether the SVG subset supported by widgets can embed a font (that would be woff rather than otf).

https://graphicdesign.stackexchange.com/questions/5162/how-do-i-embed-google-web-fonts-into-an-svg

Robert at ID-Tasker
Legend
October 29, 2024

I was more like using bitmap instead of text. 

 

For me, custom font in UI means some specific, graphic elements - not for large blocks of text. 

 

Robert at ID-Tasker
Legend
October 29, 2024

You mean for UI purpose? 

 

You would've to unpack font, install it in the system and then uninstall. But as I'm not a plug-in developer - I've no idea if it's doable. 

 

But if InDesign will crash - your font will stay... 

 

alam_84Author
Inspiring
October 29, 2024

yes I need to show that font in UI when plugin is loaded otherwise it should not be shown

Someone suggest me that I need to create a dll/framework with font resource and use that dll to install/uninstall font

Robert at ID-Tasker
Legend
October 29, 2024

Can't you use icons / graphic elements?