Skip to main content
dublove
Legend
January 3, 2026
Answered

Is there a way to restrict InDesign files to point to Document fonts?

  • January 3, 2026
  • 2 replies
  • 352 views

After packaging fonts, I need to restart ID 1-2 times before it correctly points to the Document fonts folder in the current directory.
Sometimes it fails, which is quite frustrating.

Correct answer rob day

@rob day 

I'm not quite sure how to copy it to Document Fonts.
Also, after copying, will it be possible to avoid restarting InDesign multiple times?


I'm not quite sure how to copy it to Document Fonts.

 

This copies the local document fonts, so now you have at least 2 local copies of the same font.

 

 

 
var doc = app.activeDocument;
//get the document fonts as an array
var f = doc.fonts.everyItem().getElements();
//make a folder on the desktop
var pf = Folder(doc.filePath + "/Document Fonts");
if (!pf.exists) {
    pf.create();
}

//loop through all the document fonts
var fp, nf;
for (var i = 0; i < f.length; i++){
    //check if the font is locally installed (not substituted) and is not added from Adobe Fonts
    if (f[i].status == FontStatus.INSTALLED && f[i].location != "Added from Adobe Fonts") {
        fp = f[i].location
        //returns the font’s local file path
        nf = File(fp)
        //copy the font to the destination folder
        nf.copy(pf + "/" + nf.name)
    } 
}   

2 replies

rob day
Community Expert
Community Expert
January 5, 2026

Hi @dublove , Also, when you Package a document and include the fonts, they are copied not moved. The assumption is the printer receiving the package does not have the document fonts needed for output and the font license allows copying for output. A font management application like FontAgent, Suitcase, etc. would let you control which fonts load. 

dublove
dubloveAuthor
Legend
January 6, 2026

@rob day  @Manan Joshi 

Does this script include operations to copy the original fonts?

Often, only an empty font file is obtained.
It likely doesn't manipulate the actual font paths, only operating on C:\windows\fonts.

6680.png

//获取当前文档(Get the current document)
var doc = app.activeDocument;

//获取字体列表(Get the list of fonts)
var fonts = doc.fonts.everyItem().name;

//创建数组(Creating Arrays)
var fontFiles = [];

//循环字体并添加到数组中(Loop through the fonts and add to the array)
for (var i = 0; i < fonts.length; i++) {
    var font = fonts[i];
    try {
        var fontFile = File(doc.fonts.itemByName(font).location);
        if (arrayContains(fontFiles, fontFile) == false) {
            fontFiles.push(fontFile);
        }
    } catch (e) {
        alert("The Font " + font + " is not available");
    }
}

//创建打包文件夹(Creating a Packaging Folder)
var packageFolder = Folder(doc.filePath + "/Document fonts");

if (!packageFolder.exists) {
    packageFolder.create();
}

//将字体复制到打包文件夹(Copy the fonts to the packaging folder)
for (var i = 0; i < fontFiles.length; i++) {
    var fontFile = fontFiles[i];
    var newFile = File(packageFolder.fsName + "/" + fontFile.name);
    fontFile.copy(newFile);
}

//打开打包文件夹(Open the packing folder)
packageFolder.execute();

function arrayContains(arr, item) {
    for (var i = 0; i < arr.length; i++) {
        if (arr[i].toString() == item.toString()) {
            return true;
        }
    }
    return false;
}

 

Community Expert
January 6, 2026

@dublove the script broadly looks fine. One thing if the font is loaded from the Document Fonts folders itself then the source and destination would be the same. However, why are you doing this when this is automatically done for you by the packaging operation. There are some fonts which may have restrictions for being copied during package but that is due to licensing issues.

-Manan

-Manan
Community Expert
January 5, 2026

Ideally if the font is placed in the fonts folder then that is what should be loaded. To absolutely force it uninstall the font from the system so that the only place the font is present is in the Documents Fonts folder. When the font is present at multiple locations accessible by the app we may see issues.

-Manan

-Manan