You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@pdfbox.apache.org by "John Hewson (JIRA)" <ji...@apache.org> on 2015/02/05 05:56:34 UTC
[jira] [Updated] (PDFBOX-2663) CMap handling bug
[ https://issues.apache.org/jira/browse/PDFBOX-2663?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
John Hewson updated PDFBOX-2663:
--------------------------------
Description:
Some CMap includes another CMap using the "usecmap" command in the CMap resource file. For example, "ETenms-B5-H" includes "ETen-B5-H" CMap. The command in resource file is "/ETen-B5-H usecmap"
The CMapParser does handle this case. Please find the coding below:
{code}
if (op.op.equals(USECMAP))
{
LiteralName useCmapName = (LiteralName) previousToken;
InputStream useStream = ResourceLoader.loadResource(resourceRoot + useCmapName.name);
if (useStream == null)
{
throw new IOException("Error: Could not find referenced cmap stream " + useCmapName.name);
}
CMap useCMap = parse(resourceRoot, useStream);
result.useCmap(useCMap);
}
But the useCmap method of CMap class doesn't copy the cidRanges list from the child CMap. Please find the coding below:
public void useCmap( CMap cmap )
{
this.codeSpaceRanges.addAll( cmap.codeSpaceRanges );
this.singleByteMappings.putAll( cmap.singleByteMappings );
this.doubleByteMappings.putAll( cmap.doubleByteMappings );
}
{code}
Without the cidRanges from the included CMap, PDFBox doesn't know a text can be solved by the CMap and return "?" finally.
Suggest to add the following coding to useCmap method of CMap class to solve the problem.
this.cidRanges.addAll( cmap.cidRanges);
was:
Some CMap includes another CMap using the "usecmap" command in the CMap resource file. For example, "ETenms-B5-H" includes "ETen-B5-H" CMap. The command in resource file is "/ETen-B5-H usecmap"
The CMapParser does handle this case. Please find the coding below:
if (op.op.equals(USECMAP))
{
LiteralName useCmapName = (LiteralName) previousToken;
InputStream useStream = ResourceLoader.loadResource(resourceRoot + useCmapName.name);
if (useStream == null)
{
throw new IOException("Error: Could not find referenced cmap stream " + useCmapName.name);
}
CMap useCMap = parse(resourceRoot, useStream);
result.useCmap(useCMap);
}
But the useCmap method of CMap class doesn't copy the cidRanges list from the child CMap. Please find the coding below:
public void useCmap( CMap cmap )
{
this.codeSpaceRanges.addAll( cmap.codeSpaceRanges );
this.singleByteMappings.putAll( cmap.singleByteMappings );
this.doubleByteMappings.putAll( cmap.doubleByteMappings );
}
Without the cidRanges from the included CMap, PDFBox doesn't know a text can be solved by the CMap and return "?" finally.
Suggest to add the following coding to useCmap method of CMap class to solve the problem.
this.cidRanges.addAll( cmap.cidRanges);
> CMap handling bug
> -----------------
>
> Key: PDFBOX-2663
> URL: https://issues.apache.org/jira/browse/PDFBOX-2663
> Project: PDFBox
> Issue Type: Bug
> Components: FontBox
> Affects Versions: 1.8.8
> Environment: Windows 7
> Reporter: Matthew GAO
> Fix For: 1.8.8
>
> Original Estimate: 24h
> Remaining Estimate: 24h
>
> Some CMap includes another CMap using the "usecmap" command in the CMap resource file. For example, "ETenms-B5-H" includes "ETen-B5-H" CMap. The command in resource file is "/ETen-B5-H usecmap"
> The CMapParser does handle this case. Please find the coding below:
> {code}
> if (op.op.equals(USECMAP))
> {
> LiteralName useCmapName = (LiteralName) previousToken;
> InputStream useStream = ResourceLoader.loadResource(resourceRoot + useCmapName.name);
> if (useStream == null)
> {
> throw new IOException("Error: Could not find referenced cmap stream " + useCmapName.name);
> }
> CMap useCMap = parse(resourceRoot, useStream);
> result.useCmap(useCMap);
> }
> But the useCmap method of CMap class doesn't copy the cidRanges list from the child CMap. Please find the coding below:
> public void useCmap( CMap cmap )
> {
> this.codeSpaceRanges.addAll( cmap.codeSpaceRanges );
> this.singleByteMappings.putAll( cmap.singleByteMappings );
> this.doubleByteMappings.putAll( cmap.doubleByteMappings );
> }
> {code}
> Without the cidRanges from the included CMap, PDFBox doesn't know a text can be solved by the CMap and return "?" finally.
> Suggest to add the following coding to useCmap method of CMap class to solve the problem.
> this.cidRanges.addAll( cmap.cidRanges);
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@pdfbox.apache.org
For additional commands, e-mail: dev-help@pdfbox.apache.org