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

Create custom font filter

Community Expert ,
Apr 04, 2024 Apr 04, 2024

Copy link to clipboard

Copied

So the requirement is to display only some fonts in the various font dropdowns to restrict the user to use only those and prevent the clutter of all the other fonts. I thought maybe a filter could help in trying to do this but I did not find anything in the C++ SDK regarding the font filter or any other way where we could restrict the fonts displayed. Is this possible? Any other ideas

-Manan

TOPICS
SDK

Views

707

Translate

Translate

Report

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
Community Expert ,
Apr 04, 2024 Apr 04, 2024

Copy link to clipboard

Copied

You mean built in UI dropdowns?

 

If you are building your own tool - why not create your own dropdown with a "restricted" list of fonts.

 

Votes

Translate

Translate

Report

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
Community Expert ,
Apr 04, 2024 Apr 04, 2024

Copy link to clipboard

Copied

I am building my own solution. But if I go ahead with creating my own list in my own dialog then how would I provide the user with the capabiltiy to use only the short list of fonts in different places of InDesign UI like styles panel etc. This would need a deeper integration using InDesign SDK if that is even possible

-Manan

Votes

Translate

Translate

Report

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
Community Expert ,
Apr 04, 2024 Apr 04, 2024

Copy link to clipboard

Copied

quote

I am building my own solution. But if I go ahead with creating my own list in my own dialog then how would I provide the user with the capabiltiy to use only the short list of fonts in different places of InDesign UI like styles panel etc. This would need a deeper integration using InDesign SDK if that is even possible

-Manan


By @Manan Joshi

 

You want to modify InDesign's underbelly - but without going DEEP into SDK - you can't.

 

You won't be able to do in JavaScript what I've done with my tool - use InDesign as a "rendering engine" - but maybe partially you could do something similar?

 

Create your own set of pallets?

 

Votes

Translate

Translate

Report

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
Community Expert ,
Apr 04, 2024 Apr 04, 2024

Copy link to clipboard

Copied

I am willing to go as deep the SDK allows. I am not averse to using the C++ SDK infact that has been my main go to tool as I started developing for InDesign using the C++. But for this problem I am not able to find any solution in the SDK that I could figure out.

-Manan

Votes

Translate

Translate

Report

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
Community Expert ,
Apr 04, 2024 Apr 04, 2024

Copy link to clipboard

Copied

quote

I am willing to go as deep the SDK allows. I am not averse to using the C++ SDK infact that has been my main go to tool as I started developing for InDesign using the C++. But for this problem I am not able to find any solution in the SDK that I could figure out.


By @Manan Joshi

 

Then good luck.

I prefer VB - less hassle and still way more possibilities than JS.

 

Votes

Translate

Translate

Report

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
Community Expert ,
Apr 04, 2024 Apr 04, 2024

Copy link to clipboard

Copied

I prefer VB - less hassle and still way more possibilities than JS.

 


By @Robert at ID-Tasker

JS and VB share almost the same DOM methods so how can VB offer more capabilites, I would love to know. Are you talking about the language features?

-Manan

Votes

Translate

Translate

Report

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
Community Expert ,
Apr 04, 2024 Apr 04, 2024

Copy link to clipboard

Copied

quote

I prefer VB - less hassle and still way more possibilities than JS.

 


By @Robert at ID-Tasker

JS and VB share almost the same DOM methods so how can VB offer more capabilites, I would love to know. Are you talking about the language features?


By @Manan Joshi

 

With JS - you are running from "inside" - with VB complied to EXE - I'm connecting from "outside" - so I have a lot more "options".

 

And by "less hassle" I meant "less hassle than plugins".

 

Votes

Translate

Translate

Report

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
Community Expert ,
Apr 07, 2024 Apr 07, 2024

Copy link to clipboard

Copied

Thanks @Robert at ID-Tasker for sharing your outlook. Yeah that is one benefit but then you lose out on platform comaptibility. Your solution would lack support for MAC. I would prefer to use JS because that one code works both on MAC and WIN and for things that you get for "running outside" we can use VB and Applescript repectively. By the way MAC supports JS automations as well.

Also "less hassle than plugins" is right but limited in firepower as well. Scripting can't match the capabilities/speed of C++ plugins at all. So different tools can't be compared as such in my opinion

-Manan

Votes

Translate

Translate

Report

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
Community Expert ,
Apr 08, 2024 Apr 08, 2024

Copy link to clipboard

Copied

 

@Manan Joshi 

 

Mac support - directly - no - indirectly - a dedicted PC connected to Mac network - yes.

 

"running outside" - but your VB / AS solution will still be run "from inside" so you won't be able to achieve low-level system integration.

 

"less hassle than plugins" - I'm only limited in terms of speed - when processing a single INDD file (*) - and if you want to add some "native" new objects - otherwise, I can easily add a new functionality.

 

I can do real multithreading - (*) modify multiple INDD files - at the same time - using the same installation of InDesign...

 

 

Votes

Translate

Translate

Report

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
Community Expert ,
Apr 08, 2024 Apr 08, 2024

Copy link to clipboard

Copied

You have your points @Robert at ID-Tasker. I never got any usecase to limit myself to VB though. So I would wait for that before I change my mind 🙂

-Manan

Votes

Translate

Translate

Report

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
Community Expert ,
Apr 08, 2024 Apr 08, 2024

Copy link to clipboard

Copied

quote

I never got any usecase to limit myself to VB though.


By @Manan Joshi

 

I had a lot.

 

quote

So I would wait for that before I change my mind 🙂

-Manan


By @Manan Joshi

 

Yes, of ocurse.

 

JS is great if you need direct cross-platform - but if you need greater functionality...

 

I dare to say, that I can do more than can be done via "real" plugins - not to mention UXP or "fake" ones...

 

Votes

Translate

Translate

Report

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
Community Expert ,
Apr 08, 2024 Apr 08, 2024

Copy link to clipboard

Copied

That's a very bold statement to challenge C++ from VB 🙂

-Manan

Votes

Translate

Translate

Report

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
Community Expert ,
Apr 08, 2024 Apr 08, 2024

Copy link to clipboard

Copied

quote

That's a very bold statement to challenge C++ from VB 🙂

-Manan


By @Manan Joshi

 

I  know. 

 

Like I've said before - I can't compete in terms of performance or adding new objects as a "native" objects - although I could simulate them - but in terms of overall functionality - I can.

 

Votes

Translate

Translate

Report

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
Community Expert ,
Apr 04, 2024 Apr 04, 2024

Copy link to clipboard

Copied

The best I could come up with is to give a dropdown list of fonts allowed - select the text frame - run the script - and select the font.

It's jsx - but not really sure how else to go about it - just an idea.

 

// Define an array of allowed font names
var allowedFonts = ["Arial", "Helvetica", "Times New Roman", "Verdana"];

// Function to create and display a dialog box with dropdowns for font selection
function showDialog() {
    // Create a new dialog box
    var dialog = app.dialogs.add({ name: "Font Selector" });
    
    // Create a dialog column
    var dialogColumn = dialog.dialogColumns.add();
    
    // Create a dropdown control for font selection
    var fontDropdown = dialogColumn.dropdowns.add({
        stringList: allowedFonts
    });
    
    // Display the dialog box
    var result = dialog.show();
    
    // Check if the user clicked OK
    if (result == true) {
        // Get the selected font from the dropdown
        var selectedFont = fontDropdown.stringList[fontDropdown.selectedIndex];
        
        // Apply the selected font to the text
        applyFont(selectedFont);
    }
    
    // Close the dialog box
    dialog.destroy();
}

// Function to apply the selected font to a text frame
function applyFont(fontName) {
    // Check if there is a text frame selected
    if (app.selection.length > 0 && app.selection[0] instanceof TextFrame) {
        // Apply the font to the text frame
        app.selection[0].texts[0].appliedFont = app.fonts.itemByName(fontName);
    } else {
        // If no text frame is selected, display an error message
        alert("Please select a text frame before applying the font.");
    }
}

// Call the function to display the dialog box
showDialog();

 

Votes

Translate

Translate

Report

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
Community Expert ,
Apr 04, 2024 Apr 04, 2024

Copy link to clipboard

Copied

Thanks @Eugene Tyson I am looking for more deeper integration so that the user is given only these fonts as choice if possible at different places where we can make font selection in the InDesign UI. Scripting won't be able to make changes in the native UI

-Manan

Votes

Translate

Translate

Report

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
Community Expert ,
Apr 04, 2024 Apr 04, 2024

Copy link to clipboard

Copied

Yeh there's so many places you can choose a font from - I can't think of a way other than invoking a panel instead of allowing a user to click a button in the ui.

 

I will keep trying to explore this - but I don't have high hopes, I mean if you can't find a way I doubt I will. But it's an interesting one for me too.

Votes

Translate

Translate

Report

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
Community Expert ,
Apr 04, 2024 Apr 04, 2024

Copy link to clipboard

Copied

quote

Thanks @Eugene Tyson I am looking for more deeper integration so that the user is given only these fonts as choice if possible at different places where we can make font selection in the InDesign UI. Scripting won't be able to make changes in the native UI


By @Manan Joshi

 

If I understand your goal correctly, then it appears to me that the only solution is to disable (deactivate) the undesired fonts. Or to deactivate all fonts, then activate only the desired ones. I don't know if it's possible through InDesign scripting or SDK. Maybe some 3rd-party font management utilities allow to activate fonts programmatically on the fly? If so then you can incorporate such a tool into your final solution.

 

Votes

Translate

Translate

Report

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
Community Expert ,
Apr 04, 2024 Apr 04, 2024

Copy link to clipboard

Copied

There's an idea - but how do you handle third party font handlers like Connect Fonts?

Votes

Translate

Translate

Report

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
Community Expert ,
Apr 04, 2024 Apr 04, 2024

Copy link to clipboard

Copied

quote

There's an idea - but how do you handle third party font handlers like Connect Fonts?


By @Eugene Tyson

 

Not from InDesign.

InDesign will only show you fonts that are available to him.

You would have to control fonts through 3rd party tools.

 

Or create your own font handler?

 

Votes

Translate

Translate

Report

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
Community Expert ,
Apr 04, 2024 Apr 04, 2024

Copy link to clipboard

Copied

That's what I was getting at 

Votes

Translate

Translate

Report

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
Community Expert ,
Apr 07, 2024 Apr 07, 2024

Copy link to clipboard

Copied

Thanks for the idea @leo.r, there is a method called DeleteFont in IFontMgr, maybe that could be of help. I will try that

-Manan

Votes

Translate

Translate

Report

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
Community Expert ,
Apr 12, 2024 Apr 12, 2024

Copy link to clipboard

Copied

Hi @leo.r,

I tried the following with no success

  • Try the deleteFont API. Nothing happens
  • Add the font again in the hope that maybe the font would be listed on top and we could have our own sorting order. Did not work
  • Mark the font as bad. Did work and did remove the font from the list I suppose but it was not reliable
  • Mark the font as bad and then delete it. This did not work as well

I am out of ideas now.

-Manan

Votes

Translate

Translate

Report

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
Community Expert ,
Apr 12, 2024 Apr 12, 2024

Copy link to clipboard

Copied

LATEST
quote

Hi @leo.r,

I tried the following with no success

I am out of ideas now.


By @Manan Joshi

 

Yeah I'm not sure if your goal is achievable with InDesign API.

 

Like I mentioned, you may have better luck with 3rd-party font management software (Extensis Connect etc.) If they have API (scripting or otherwise) that allows to activate/deactivate fonts on the fly, then you can include them as part of your solution and send appropriate commands to the font manager.

Votes

Translate

Translate

Report

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
Guide ,
Apr 08, 2024 Apr 08, 2024

Copy link to clipboard

Copied

Sounds like a very useful PlugIn. I searched the SDK, I didn't see anything obvious. I wonder if the way document fonts are handled, might be a clue.

 

P.

Votes

Translate

Translate

Report

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