Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

Loading and Unloading Custom Fonts with InDesign Plugin

Contributor ,
Oct 28, 2024 Oct 28, 2024

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>

TOPICS
SDK
657
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Oct 29, 2024 Oct 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... 

 

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Contributor ,
Oct 29, 2024 Oct 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

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Oct 29, 2024 Oct 29, 2024

Can't you use icons / graphic elements? 

 

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Mentor ,
Oct 29, 2024 Oct 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

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Oct 29, 2024 Oct 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. 

 

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Contributor ,
Oct 29, 2024 Oct 29, 2024
LATEST

Yes we need to use system api to unpack font on plugin loading

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines