Answered
Find Missing Glyphs/Fpmts
- August 27, 2024
- 1 reply
- 761 views
Hi Guys,
I need yours help.
I have one document in illustrator, It have missing glyph/font. Attached Screenshot below. Particular missing charchter not available in particular font family. So it's automatically changed to "Placedholder/rectangle" shape. need to find the missing glyphs with particular "placeholder/rectangle"shape. I have tried more. Unable to find the missing charchter shape.

I have tried below code:
// Function to find placeholder symbols for missing characters
function findMissingCharacterPlaceholders(missingChar) {
var doc = app.activeDocument;
var placeholders = [];
// Loop through all text frames in the document
for (var i = 0; i < doc.textFrames.length; i++) {
var textFrame = doc.textFrames[i];
var textRange = textFrame.textRange;
// Check each character in the text frame
for (var j = 0; j < textRange.characters.length; j++) {
var character = textRange.characters[j];
// Check if the character has a missing glyph and is replaced by a placeholder symbol
if (character.contents === missingChar && isPlaceholder(character)) {
// Get the placeholder related to the missing character
var placeholder = findPlaceholderForCharacter(textFrame, j);
if (placeholder) {
placeholders.push({
textFrame: textFrame,
characterIndex: j,
placeholder: placeholder
});
}
}
}
}
return placeholders;
}
// Function to check if the character is replaced by a placeholder symbol
function isPlaceholder(character) {
// Placeholder check: Adjust this condition if necessary
// e.g., check for a specific font or other attributes if needed
return character.textFont.name === "PlaceholderFont"; // Replace "PlaceholderFont" with actual placeholder font name if known
}
// Function to find the placeholder shape for a given character index in a text frame
function findPlaceholderForCharacter(textFrame, charIndex) {
var charBounds = textFrame.textRange.characters[charIndex].geometricBounds;
var placeholder = null;
// Check each page item in the document
for (var i = 0; i < app.activeDocument.pageItems.length; i++) {
var item = app.activeDocument.pageItems[i];
// Check if the item is a shape or symbol that could represent the placeholder
if (item.typename === "PathItem" || item.typename === "CompoundPathItem") {
var itemBounds = item.geometricBounds;
if (itemBounds[0] >= charBounds[0] && itemBounds[1] >= charBounds[1] &&
itemBounds[2] <= charBounds[2] && itemBounds[3] <= charBounds[3]) {
placeholder = item;
break;
}
}
}
return placeholder;
}
// Define the missing character to search for
var missingChar = "e"; // Character that is missing
var placeholders = findMissingCharacterPlaceholders(missingChar);
// Output results
if (placeholders.length > 0) {
alert("Missing character '" + missingChar + "' placeholders found.");
} else {
alert("No missing character placeholders found.");
}
