I am trying to calculate character width in order to show highlighted search results in a PDF document. The problem I have faced is that the /Widths array I am depending on has a portion of its values equal to 0. The values substituted with zeros are the ones that are used in the text. This is probably related to embedded font subsets, but I am not sure at the moment. What are the actions that should be taken in such a situation? See the structure of the mentioned PDF in a screenshot below:
Thank you in advance for your time.
Yes, writing a 0 into the width for a character that has been removed from a subset is a somewhat-common operation.
I am surprised that you are finding glyphs that are actually being used in the content stream with 0 widths.
The strange thing is that according to description of the document it was produced by Adobe InDesign CS4 (6.0.6) using Adobe PDF Library 9.0. Any ideas on how to find out the widths except for the array approach?
Europe, Middle East and Africa