git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/trunk@1811944 13f79535-47bb-0310-9956-ffa450edef68tags/fop-2_3
@@ -19,7 +19,6 @@ | |||
package org.apache.fop.fonts; | |||
import java.awt.Rectangle; | |||
import java.io.IOException; | |||
import java.io.InputStream; | |||
import java.net.URI; | |||
import java.util.List; | |||
@@ -31,7 +30,6 @@ import org.xml.sax.InputSource; | |||
import org.apache.commons.logging.Log; | |||
import org.apache.commons.logging.LogFactory; | |||
import org.apache.fop.apps.FOPException; | |||
import org.apache.fop.apps.io.InternalResourceResolver; | |||
import org.apache.fop.complexscripts.fonts.Positionable; | |||
import org.apache.fop.complexscripts.fonts.Substitutable; | |||
@@ -124,15 +122,14 @@ public class LazyFont extends Typeface implements FontDescriptor, Substitutable, | |||
if (realFont instanceof FontDescriptor) { | |||
realFontDescriptor = (FontDescriptor) realFont; | |||
} | |||
} catch (FOPException fopex) { | |||
log.error("Failed to read font metrics file " + fontUris.getMetrics(), fopex); | |||
} catch (RuntimeException e) { | |||
String error = "Failed to read font file " + fontUris.getEmbed(); | |||
throw new RuntimeException(error, e); | |||
} catch (Exception e) { | |||
String error = "Failed to read font file " + fontUris.getEmbed(); | |||
log.error(error, e); | |||
if (fail) { | |||
throw new RuntimeException(fopex); | |||
} | |||
} catch (IOException ioex) { | |||
log.error("Failed to read font metrics file " + fontUris.getMetrics(), ioex); | |||
if (fail) { | |||
throw new RuntimeException(ioex); | |||
throw new RuntimeException(error, e); | |||
} | |||
} | |||
realFont.setEventListener(this.eventListener); |
@@ -0,0 +1,40 @@ | |||
/* | |||
* Licensed to the Apache Software Foundation (ASF) under one or more | |||
* contributor license agreements. See the NOTICE file distributed with | |||
* this work for additional information regarding copyright ownership. | |||
* The ASF licenses this file to You under the Apache License, Version 2.0 | |||
* (the "License"); you may not use this file except in compliance with | |||
* the License. You may obtain a copy of the License at | |||
* | |||
* http://www.apache.org/licenses/LICENSE-2.0 | |||
* | |||
* Unless required by applicable law or agreed to in writing, software | |||
* distributed under the License is distributed on an "AS IS" BASIS, | |||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | |||
* See the License for the specific language governing permissions and | |||
* limitations under the License. | |||
*/ | |||
/* $Id$ */ | |||
package org.apache.fop.fonts; | |||
import java.net.URI; | |||
import java.net.URISyntaxException; | |||
import org.junit.Assert; | |||
import org.junit.Test; | |||
public class LazyFontTestCase { | |||
@Test | |||
public void testFontError() throws URISyntaxException { | |||
FontUris fontUris = new FontUris(new URI("test"), null); | |||
LazyFont lazyFont = new LazyFont(new EmbedFontInfo(fontUris, true, true, null, null), null, true); | |||
String ex = null; | |||
try { | |||
lazyFont.getAscender(); | |||
} catch (RuntimeException e) { | |||
ex = e.getMessage(); | |||
} | |||
Assert.assertEquals(ex, "Failed to read font file test"); | |||
} | |||
} |