You are viewing a plain text version of this content. The canonical link for it is here.
Posted to fop-commits@xmlgraphics.apache.org by ma...@apache.org on 2009/09/24 12:09:56 UTC
svn commit: r818424 - in /xmlgraphics/fop/trunk:
src/java/org/apache/fop/fonts/FontLoader.java
test/java/org/apache/fop/StandardTestSuite.java
test/java/org/apache/fop/fonts/DejaVuLGCSerifTest.java
Author: maxberger
Date: Thu Sep 24 10:09:55 2009
New Revision: 818424
URL: http://svn.apache.org/viewvc?rev=818424&view=rev
Log:
Added Testcase from Bug #47872 (thanks to alex kiel) and fixed it in FontLoader
Added:
xmlgraphics/fop/trunk/test/java/org/apache/fop/fonts/DejaVuLGCSerifTest.java (with props)
Modified:
xmlgraphics/fop/trunk/src/java/org/apache/fop/fonts/FontLoader.java
xmlgraphics/fop/trunk/test/java/org/apache/fop/StandardTestSuite.java
Modified: xmlgraphics/fop/trunk/src/java/org/apache/fop/fonts/FontLoader.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/trunk/src/java/org/apache/fop/fonts/FontLoader.java?rev=818424&r1=818423&r2=818424&view=diff
==============================================================================
--- xmlgraphics/fop/trunk/src/java/org/apache/fop/fonts/FontLoader.java (original)
+++ xmlgraphics/fop/trunk/src/java/org/apache/fop/fonts/FontLoader.java Thu Sep 24 10:09:55 2009
@@ -87,8 +87,8 @@
*/
public static CustomFont loadFont(File fontFile, String subFontName,
boolean embedded, EncodingMode encodingMode, FontResolver resolver) throws IOException {
- return loadFont(fontFile.getAbsolutePath(), subFontName,
- embedded, encodingMode, true, resolver);
+ return loadFont(fontFile.toURI().toURL(), subFontName,
+ embedded, encodingMode, resolver);
}
/**
Modified: xmlgraphics/fop/trunk/test/java/org/apache/fop/StandardTestSuite.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/trunk/test/java/org/apache/fop/StandardTestSuite.java?rev=818424&r1=818423&r2=818424&view=diff
==============================================================================
--- xmlgraphics/fop/trunk/test/java/org/apache/fop/StandardTestSuite.java (original)
+++ xmlgraphics/fop/trunk/test/java/org/apache/fop/StandardTestSuite.java Thu Sep 24 10:09:55 2009
@@ -22,6 +22,7 @@
import junit.framework.Test;
import junit.framework.TestSuite;
+import org.apache.fop.fonts.DejaVuLGCSerifTest;
import org.apache.fop.fonts.TrueTypeAnsiTestCase;
import org.apache.fop.image.loader.batik.ImageLoaderTestCase;
import org.apache.fop.image.loader.batik.ImagePreloaderTestCase;
@@ -54,6 +55,7 @@
suite.addTest(new TestSuite(PDFCMapTestCase.class));
suite.addTest(new TestSuite(PDFsRGBSettingsTestCase.class));
suite.addTest(new TestSuite(TrueTypeAnsiTestCase.class));
+ suite.addTest(new TestSuite(DejaVuLGCSerifTest.class));
suite.addTest(RichTextFormatTestSuite.suite());
suite.addTest(new TestSuite(ImageLoaderTestCase.class));
suite.addTest(new TestSuite(ImagePreloaderTestCase.class));
Added: xmlgraphics/fop/trunk/test/java/org/apache/fop/fonts/DejaVuLGCSerifTest.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/trunk/test/java/org/apache/fop/fonts/DejaVuLGCSerifTest.java?rev=818424&view=auto
==============================================================================
--- xmlgraphics/fop/trunk/test/java/org/apache/fop/fonts/DejaVuLGCSerifTest.java (added)
+++ xmlgraphics/fop/trunk/test/java/org/apache/fop/fonts/DejaVuLGCSerifTest.java Thu Sep 24 10:09:55 2009
@@ -0,0 +1,52 @@
+/*
+ * 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.io.File;
+
+import junit.framework.TestCase;
+
+/**
+ *
+ */
+public class DejaVuLGCSerifTest extends TestCase {
+
+ private FontResolver fontResolver = FontManager.createMinimalFontResolver();
+ private CustomFont font;
+
+ /**
+ * sets up the testcase by loading the DejaVu Font.
+ *
+ * @throws Exception
+ * if the test fails.
+ */
+ public void setUp() throws Exception {
+ File file = new File("test/resources/fonts/DejaVuLGCSerif.ttf");
+ font = FontLoader.loadFont(file, "", true, EncodingMode.AUTO,
+ fontResolver);
+ }
+
+ /**
+ * Simple test to see if font name was detected correctly.
+ */
+ public void testFontName() {
+ assertEquals("DejaVu", font.getFontName());
+ }
+}
Propchange: xmlgraphics/fop/trunk/test/java/org/apache/fop/fonts/DejaVuLGCSerifTest.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: xmlgraphics/fop/trunk/test/java/org/apache/fop/fonts/DejaVuLGCSerifTest.java
------------------------------------------------------------------------------
svn:keywords = Id
Propchange: xmlgraphics/fop/trunk/test/java/org/apache/fop/fonts/DejaVuLGCSerifTest.java
------------------------------------------------------------------------------
svn:mime-type = text/plain
---------------------------------------------------------------------
To unsubscribe, e-mail: fop-commits-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: fop-commits-help@xmlgraphics.apache.org