Nevermind, I just figured it out. For future reference, the
fontCharset.getEntries() was the index which I required which was being
lost in the mappings array because of the encoding used.

On 1 February 2013 15:29, Robert Meyer <[email protected]> wrote:

> Hi,
>
> I am struggling at the moment to map from the cmap data to the CFF data
> using fontbox.
>
> I am not using the CMap class in fontbox to get the following information
> (as much as I would like to) as I can only assume it was not written with
> TTF or OTF fonts in mind as I get  "java.lang.NumberFormatException:
> multiple points" when trying to use the CMapParser. The code I am using for
> parsing the cmap works against TTF files and as such am using the same code
> for OTF CFF files. Anyway, from the CMAP I get a unicode index which if you
> convert to a char gives me the character. Along with that I get a
> calculated glyph index e.g.
>
> unicode character index: 34
> character: "
> glyphIdx: 517
>
> This is using the SourceSansProBold.otf font from Adobe. The data which is
> returned from fontbox from the Mapping array doesn't seem to correlate with
> the correct character though e.g.
>
> mappings[glyphIdx] = character called "uni1EA1"
>
> Looking in the mappings array, the quotedbl character which I want is
> actually the third element, so I have no idea how 517 would equal 3.
>
> There is a mappingCode for each mapping which initially I thought was a
> matching unicode character index, but because it uses CFFStandardEncoding,
> it does not follow the traditional unicode mappings.
>
> I have tried just about everything to try and get the cmap and cff
> mappings to play together, but I have run out of ideas.
>
> Has anyone else tried to map between the cmap and CFF data and got
> anywhere? Any help would be much appreciated.
>
> Regards,
>
> Robert Meyer
>

Reply via email to