diff options
author | Chris Bowditch <cbowditch@apache.org> | 2011-11-17 12:10:34 +0000 |
---|---|---|
committer | Chris Bowditch <cbowditch@apache.org> | 2011-11-17 12:10:34 +0000 |
commit | 32ad33cda1ee32f8bb6fa5212933827485787d37 (patch) | |
tree | b608ef7bac41d71f24a4085e11f88ec997e1c603 /test | |
parent | 02303acdd92bbdd79dfe9b8866617209b183ae26 (diff) | |
download | xmlgraphics-fop-32ad33cda1ee32f8bb6fa5212933827485787d37.tar.gz xmlgraphics-fop-32ad33cda1ee32f8bb6fa5212933827485787d37.zip |
Bugzilla #51592: TTFFontLoader ignores the useKerning attribute used with fonts
Patch submitted by Mehdi Houshmand (mehdi1985 at gmail.com)
git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/trunk@1203163 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'test')
-rw-r--r-- | test/java/org/apache/fop/fonts/truetype/TTFFontLoaderTestCase.java | 57 |
1 files changed, 57 insertions, 0 deletions
diff --git a/test/java/org/apache/fop/fonts/truetype/TTFFontLoaderTestCase.java b/test/java/org/apache/fop/fonts/truetype/TTFFontLoaderTestCase.java new file mode 100644 index 000000000..595eb9b5f --- /dev/null +++ b/test/java/org/apache/fop/fonts/truetype/TTFFontLoaderTestCase.java @@ -0,0 +1,57 @@ +/*
+ * 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.truetype;
+
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertTrue;
+
+import java.io.File;
+import java.io.IOException;
+
+import org.junit.Test;
+
+import org.apache.fop.fonts.EncodingMode;
+import org.apache.fop.fonts.FontManager;
+import org.apache.fop.fonts.FontResolver;
+
+/**
+ * Test case for {@link TTFFontLoader}.
+ */
+public class TTFFontLoaderTestCase {
+
+ @Test
+ public void testUseKerning() throws IOException {
+ File file = new File("test/resources/fonts/DejaVuLGCSerif.ttf");
+ String absoluteFilePath = file.toURL().toExternalForm();
+ FontResolver resolver = FontManager.createMinimalFontResolver();
+ String fontName = "Deja Vu";
+ boolean embedded = false;
+ boolean useKerning = true;
+
+ TTFFontLoader fontLoader = new TTFFontLoader(absoluteFilePath, fontName, embedded,
+ EncodingMode.AUTO, useKerning, resolver);
+ assertTrue(fontLoader.getFont().hasKerningInfo());
+ useKerning = false;
+
+ fontLoader = new TTFFontLoader(absoluteFilePath, fontName, embedded, EncodingMode.AUTO,
+ useKerning, resolver);
+ assertFalse(fontLoader.getFont().hasKerningInfo());
+ }
+}
\ No newline at end of file |