ASF Bugzilla – Attachment 18987 Details for
Bug 5335
Text with embedded CID fonts not retrievable from pdf
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
patch for PDFToUnicodeCMap.java, correcting bugs and simplifying the code
toUnicodeCMap.patch (text/plain), 5.93 KB, created by
Vincent Hennebert
on 2006-10-11 01:30:43 UTC
(
hide
)
Description:
patch for PDFToUnicodeCMap.java, correcting bugs and simplifying the code
Filename:
MIME Type:
Creator:
Vincent Hennebert
Created:
2006-10-11 01:30:43 UTC
Size:
5.93 KB
patch
obsolete
>Index: src/java/org/apache/fop/pdf/PDFToUnicodeCMap.java >=================================================================== >--- src/java/org/apache/fop/pdf/PDFToUnicodeCMap.java (révision 462727) >+++ src/java/org/apache/fop/pdf/PDFToUnicodeCMap.java (copie de travail) >@@ -104,7 +104,6 @@ > * @param charArray all the characters to map > */ > protected void writeBFCharEntries(StringBuffer p, char[] charArray) { >- int completedEntries = 0; > int totalEntries = 0; > for (int i = 0; i < charArray.length; i++) { > if (!partOfRange(charArray, i)) { >@@ -115,32 +114,23 @@ > return; > } > int remainingEntries = totalEntries; >- /* Limited to 100 entries in each section */ >- int entriesThisSection = Math.min(remainingEntries, 100); >- int remainingEntriesThisSection = entriesThisSection; >- p.append(entriesThisSection + " beginbfchar\n"); >- for (int i = 0; i < charArray.length; i++) { >- if (partOfRange(charArray, i)) { >- continue; >+ int charIndex = 0; >+ do { >+ /* Limited to 100 entries in each section */ >+ int entriesThisSection = Math.min(remainingEntries, 100); >+ p.append(entriesThisSection + " beginbfchar\n"); >+ for (int i = 0; i < entriesThisSection; i++) { >+ /* Go to the next char not in a range */ >+ while (partOfRange(charArray, charIndex)) { >+ charIndex++; >+ } >+ p.append("<" + padHexString(Integer.toHexString(charIndex), 4) + "> "); >+ p.append("<" + padHexString(Integer.toHexString(charArray[charIndex]), 4) + ">\n"); >+ charIndex++; > } >- p.append("<" + padHexString(Integer.toHexString(i), 4) >- + "> "); >- p.append("<" + padHexString(Integer.toHexString(charArray[i]), 4) >- + ">\n"); >- /* Compute the statistics. */ >- completedEntries++; >- remainingEntries = totalEntries - completedEntries; >- remainingEntriesThisSection--; >- if (remainingEntriesThisSection < 1) { >- if (remainingEntries > 0) { >- p.append("endbfchar\n"); >- entriesThisSection = Math.min(remainingEntries, 100); >- remainingEntriesThisSection = entriesThisSection; >- p.append(entriesThisSection + " beginbfchar\n"); >- } >- } >- } >- p.append("endbfchar\n"); >+ remainingEntries -= entriesThisSection; >+ p.append("endbfchar\n"); >+ } while (remainingEntries > 0); > } > > /** >@@ -149,7 +139,6 @@ > * @param charArray all the characters to map > */ > protected void writeBFRangeEntries(StringBuffer p, char[] charArray) { >- int completedEntries = 0; > int totalEntries = 0; > for (int i = 0; i < charArray.length; i++) { > if (startOfRange(charArray, i)) { >@@ -160,36 +149,26 @@ > return; > } > int remainingEntries = totalEntries; >- int entriesThisSection = Math.min(remainingEntries, 100); >- int remainingEntriesThisSection = entriesThisSection; >- p.append(entriesThisSection + " beginbfrange\n"); >- for (int i = 0; i < charArray.length; i++) { >- if (!startOfRange(charArray, i)) { >- continue; >+ int charIndex = 0; >+ do { >+ /* Limited to 100 entries in each section */ >+ int entriesThisSection = Math.min(remainingEntries, 100); >+ p.append(entriesThisSection + " beginbfrange\n"); >+ for (int i = 0; i < entriesThisSection; i++) { >+ /* Go to the next start of a range */ >+ while (!startOfRange(charArray, charIndex)) { >+ charIndex++; >+ } >+ p.append("<" + padHexString(Integer.toHexString(charIndex), 4) + "> "); >+ p.append("<" >+ + padHexString(Integer.toHexString(endOfRange(charArray, charIndex)), 4) >+ + "> "); >+ p.append("<" + padHexString(Integer.toHexString(charArray[charIndex]), 4) + ">\n"); >+ charIndex++; > } >- p.append("<" >- + padHexString(Integer.toHexString(i), 4) >- + "> "); >- p.append("<" >- + padHexString(Integer.toHexString >- (endOfRange(charArray, i)), 4) >- + "> "); >- p.append("<" >- + padHexString(Integer.toHexString(charArray[i]), 4) >- + ">\n"); >- /* Compute the statistics. */ >- completedEntries++; >- remainingEntries = totalEntries - completedEntries; >- if (remainingEntriesThisSection < 1) { >- if (remainingEntries > 0) { >- p.append("endbfrange\n"); >- entriesThisSection = Math.min(remainingEntries, 100); >- remainingEntriesThisSection = entriesThisSection; >- p.append(entriesThisSection + " beginbfrange\n"); >- } >- } >- } >- p.append("endbfrange\n"); >+ remainingEntries -= entriesThisSection; >+ p.append("endbfrange\n"); >+ } while (remainingEntries > 0); > } > > /** >@@ -200,14 +179,11 @@ > * @return The index to the element that is the end of the range. > */ > private int endOfRange(char[] charArray, int startOfRange) { >- int endOfRange = -1; >- for (int i = startOfRange; i < charArray.length - 1 && endOfRange < 0; >- i++) { >- if (!sameRangeEntryAsNext(charArray, i)) { >- endOfRange = i; >- } >+ int i = startOfRange; >+ while (i < charArray.length - 1 && sameRangeEntryAsNext(charArray, i)) { >+ i++; > } >- return endOfRange; >+ return i; > } > > /**
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 5335
:
3939
|
17104
|
17203
| 18987