Changeset 194 for trunk/docx4j/src/main/java/org/docx4j/openpackaging/packages/WordprocessingMLPackage.java
- Timestamp:
- 03/15/08 14:54:12 (4 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/docx4j/src/main/java/org/docx4j/openpackaging/packages/WordprocessingMLPackage.java
r193 r194 21 21 22 22 23 import java.io.File; 23 24 import java.io.OutputStream; 24 25 import java.util.Iterator; … … 46 47 import org.docx4j.openpackaging.parts.WordprocessingML.MainDocumentPart; 47 48 import org.docx4j.openpackaging.parts.relationships.Namespaces; 49 50 import com.lowagie.text.pdf.BaseFont; 48 51 49 52 … … 445 448 if (fm.getEmbeddedFile()!=null) { 446 449 try { 447 renderer.getFontResolver().addFont(fm.getEmbeddedFile(), true); 448 } catch (com.lowagie.text.DocumentException e) { 449 log.error("Shouldn't happen - should have been detected upstream ... " + e.getMessage()); 450 if (fm.getEmbeddedFile().endsWith(".pfb")) { 451 452 String afm = fm.getEmbeddedFile().substring(5, fm.getEmbeddedFile().length()-4 ) + ".afm"; // drop the 'file:' 453 log.info("Looking for: " + afm); 454 455 // Given the check in substituter, we expect to find one or the other. 456 File f = new File(afm); 457 if (f.exists()) { 458 log.info("Got it"); 459 renderer.getFontResolver().addFont(afm, BaseFont.CP1252, true, fm.getEmbeddedFile().substring(5)); // drop the 'file:' 460 } else { 461 // Should we be doing afm first, or pfm? 462 String pfm = fm.getEmbeddedFile().substring(5, fm.getEmbeddedFile().length()-4 ) + ".pfm"; // drop the 'file:' 463 log.info("Looking for: " + pfm); 464 f = new File(pfm); 465 if (f.exists()) { 466 log.info("Got it"); 467 renderer.getFontResolver().addFont(pfm, BaseFont.CP1252, true, fm.getEmbeddedFile().substring(5)); // drop the 'file:' 468 } else { 469 // Shouldn't happen. 470 log.error("Couldn't find afm or pfm corresponding to " + fm.getEmbeddedFile()); 471 } 472 } 473 } else { 474 renderer.getFontResolver().addFont(fm.getEmbeddedFile(), true); 475 } 450 476 } catch (java.io.IOException e) { 451 477 … … 454 480 java.io.IOException: Unsupported font type 455 481 at org.xhtmlrenderer.pdf.ITextFontResolver.addFont(ITextFontResolver.java:199) 482 483 .pfb not supported, even with iText 2.0.8 484 456 485 */ 486 e.printStackTrace(); 457 487 log.warn("Shouldn't happen - should have been detected upstream ... " + e.getMessage() + ": " + fm.getEmbeddedFile()); 488 } catch (Exception e) { 489 e.printStackTrace(); 490 log.error("Shouldn't happen - should have been detected upstream ... " + e.getMessage()); 458 491 } 459 492 } else {
Note: See TracChangeset
for help on using the changeset viewer.
