From 519ac01c92c11a0305f13b7124fe2242cfb5b922 Mon Sep 17 00:00:00 2001 From: Vincent Hennebert Date: Fri, 27 Aug 2010 18:40:49 +0000 Subject: Added possibility to use glyphs outside WinAnsiEncoding for TrueType fonts that are not embedded in the PostScript file, and that don't have a list of glyph names ('post' table version 3). This is done by creating glyph names using Adobe's convention (/u1234) and adding a CharStrings table that maps those glyph names to the actual glyph index. git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/branches/Temp_TrueTypeInPostScript@990225 13f79535-47bb-0310-9956-ffa450edef68 --- test/java/org/apache/fop/UtilityCodeTestSuite.java | 2 +- .../apache/fop/render/ps/HexEncoderTestCase.java | 58 ---------------------- .../org/apache/fop/util/HexEncoderTestCase.java | 58 ++++++++++++++++++++++ 3 files changed, 59 insertions(+), 59 deletions(-) delete mode 100644 test/java/org/apache/fop/render/ps/HexEncoderTestCase.java create mode 100644 test/java/org/apache/fop/util/HexEncoderTestCase.java (limited to 'test/java') diff --git a/test/java/org/apache/fop/UtilityCodeTestSuite.java b/test/java/org/apache/fop/UtilityCodeTestSuite.java index 153b2649e..3a01f7bf8 100644 --- a/test/java/org/apache/fop/UtilityCodeTestSuite.java +++ b/test/java/org/apache/fop/UtilityCodeTestSuite.java @@ -24,10 +24,10 @@ import junit.framework.TestSuite; import org.apache.fop.events.BasicEventTestCase; import org.apache.fop.pdf.PDFObjectTestCase; -import org.apache.fop.render.ps.HexEncoderTestCase; import org.apache.fop.traits.BorderPropsTestCase; import org.apache.fop.util.ColorUtilTestCase; import org.apache.fop.util.ElementListUtilsTestCase; +import org.apache.fop.util.HexEncoderTestCase; import org.apache.fop.util.PDFNumberTestCase; import org.apache.fop.util.XMLResourceBundleTestCase; diff --git a/test/java/org/apache/fop/render/ps/HexEncoderTestCase.java b/test/java/org/apache/fop/render/ps/HexEncoderTestCase.java deleted file mode 100644 index 75aee060f..000000000 --- a/test/java/org/apache/fop/render/ps/HexEncoderTestCase.java +++ /dev/null @@ -1,58 +0,0 @@ -/* - * 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.render.ps; - -import junit.framework.TestCase; - -/** - * Test case for the conversion of characters into hex-encoded strings. - */ -public class HexEncoderTestCase extends TestCase { - - private static char successor(char d) { - if (d == '9') { - return 'A'; - } else if (d == 'F') { - return '0'; - } else { - return (char) (d + 1); - } - } - - private static void increment(char[] digits) { - int d = 4; - do { - d--; - digits[d] = successor(digits[d]); - } while (digits[d] == '0' && d > 0); - } - - /** - * Tests that characters are properly encoded into hex strings. - */ - public void testEncodeChar() { - char[] digits = new char[] {'0', '0', '0', '0'}; - for (int c = 0; c <= 0xFFFF; c++) { - assertEquals(new String(digits), HexEncoder.encode((char) c)); - increment(digits); - } - } - -} diff --git a/test/java/org/apache/fop/util/HexEncoderTestCase.java b/test/java/org/apache/fop/util/HexEncoderTestCase.java new file mode 100644 index 000000000..e6198e0ad --- /dev/null +++ b/test/java/org/apache/fop/util/HexEncoderTestCase.java @@ -0,0 +1,58 @@ +/* + * 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.util; + +import junit.framework.TestCase; + +/** + * Test case for the conversion of characters into hex-encoded strings. + */ +public class HexEncoderTestCase extends TestCase { + + private static char successor(char d) { + if (d == '9') { + return 'A'; + } else if (d == 'F') { + return '0'; + } else { + return (char) (d + 1); + } + } + + private static void increment(char[] digits) { + int d = 4; + do { + d--; + digits[d] = successor(digits[d]); + } while (digits[d] == '0' && d > 0); + } + + /** + * Tests that characters are properly encoded into hex strings. + */ + public void testEncodeChar() { + char[] digits = new char[] {'0', '0', '0', '0'}; + for (int c = 0; c <= 0xFFFF; c++) { + assertEquals(new String(digits), HexEncoder.encode((char) c)); + increment(digits); + } + } + +} -- cgit v1.2.3