On 6/16/2025 10:17 AM, christian_kule...@me.com.INVALID wrote:
Thank you for the quick response and I apologise for the imprecise
description of my problem.
The COSName CIDSet is not contained in the font descriptor. There is data in
the cmap which, based on its ID, suggests that it could be CIDSet-relevant
data. All my attempts to access this data directly have failed. Is it even
intended to access the CID mappings?
I looked at the source code, specifically at
PDCIDFontType2Embedder.buildCIDSet()
the only thing you need is CIDMax, i.e. the highest CID.
private void buildCIDSet(TreeMap<Integer, Integer> cidToGid) throws
IOException
{
int cidMax = cidToGid.lastKey();
byte[] bytes = new byte[cidMax / 8 + 1];
for (int cid = 0; cid <= cidMax; cid++)
{
int mask = 1 << 7 - cid % 8;
bytes[cid / 8] |= mask;
}
InputStream input = new ByteArrayInputStream(bytes);
PDStream stream = new PDStream(document, input,
COSName.FLATE_DECODE);
fontDescriptor.setCIDSet(stream);
}
Now in the PDFDebugger source code, there the file Type0Font.java. That
one retrieves the count of CIDs and thus the highest. (The code is quite
long but much could be removed because you need only the count = highest
number)
Tilman
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@pdfbox.apache.org
For additional commands, e-mail: users-h...@pdfbox.apache.org