Added Type1 file attach test
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142
diff --git a/test/FTBBox-Test.cpp b/test/FTBBox-Test.cpp
index a2200c0..859ea70 100755
--- a/test/FTBBox-Test.cpp
+++ b/test/FTBBox-Test.cpp
@@ -132,7 +132,7 @@ class FTBBoxTest : public CppUnit::TestCase
long glyphIndex = FT_Get_Char_Index( face, CHARACTER_CODE_G);
- FT_Set_Char_Size( face, 0L, GOOD_SIZE * 64, RESOLUTION, RESOLUTION);
+ FT_Set_Char_Size( face, 0L, FONT_POINT_SIZE * 64, RESOLUTION, RESOLUTION);
error = FT_Load_Glyph( face, glyphIndex, FT_LOAD_DEFAULT);
assert(!error);
diff --git a/test/FTFace-Test.cpp b/test/FTFace-Test.cpp
index ca6e475..0928057 100755
--- a/test/FTFace-Test.cpp
+++ b/test/FTFace-Test.cpp
@@ -49,7 +49,13 @@ class FTFaceTest : public CppUnit::TestCase
void testAttachFile()
{
CPPUNIT_ASSERT( !testFace->Attach( GOOD_FONT_FILE));
- CPPUNIT_ASSERT( testFace->Error() == 7);
+ CPPUNIT_ASSERT( testFace->Error() == 7);
+
+ FTFace test( TYPE1_FONT_FILE);
+ CPPUNIT_ASSERT( test.Error() == 0);
+
+ CPPUNIT_ASSERT( test.Attach( TYPE1_AFM_FILE));
+ CPPUNIT_ASSERT( test.Error() == 0);
}
@@ -68,7 +74,7 @@ class FTFaceTest : public CppUnit::TestCase
void testSetFontSize()
{
- FTSize size = testFace->Size( GOOD_SIZE, RESOLUTION);
+ FTSize size = testFace->Size( FONT_POINT_SIZE, RESOLUTION);
CPPUNIT_ASSERT( testFace->Error() == 0);
}
diff --git a/test/FTFont-Test.cpp b/test/FTFont-Test.cpp
index 4b57269..1c34e72 100755
--- a/test/FTFont-Test.cpp
+++ b/test/FTFont-Test.cpp
@@ -106,18 +106,18 @@ class FTFontTest : public CppUnit::TestCase
CPPUNIT_ASSERT_DOUBLES_EQUAL( 0, testFont->Ascender(), 0.01);
CPPUNIT_ASSERT_DOUBLES_EQUAL( 0, testFont->Descender(), 0.01);
- CPPUNIT_ASSERT( testFont->FaceSize( GOOD_SIZE));
+ CPPUNIT_ASSERT( testFont->FaceSize( FONT_POINT_SIZE));
CPPUNIT_ASSERT( testFont->Error() == 0);
- CPPUNIT_ASSERT( testFont->FaceSize() == GOOD_SIZE);
+ CPPUNIT_ASSERT( testFont->FaceSize() == FONT_POINT_SIZE);
CPPUNIT_ASSERT_DOUBLES_EQUAL( 52, testFont->Ascender(), 0.01);
CPPUNIT_ASSERT_DOUBLES_EQUAL( -14, testFont->Descender(), 0.01);
- CPPUNIT_ASSERT( testFont->FaceSize( GOOD_SIZE * 2));
+ CPPUNIT_ASSERT( testFont->FaceSize( FONT_POINT_SIZE * 2));
CPPUNIT_ASSERT( testFont->Error() == 0);
- CPPUNIT_ASSERT( testFont->FaceSize() == GOOD_SIZE * 2);
+ CPPUNIT_ASSERT( testFont->FaceSize() == FONT_POINT_SIZE * 2);
CPPUNIT_ASSERT_DOUBLES_EQUAL( 103, testFont->Ascender(), 0.01);
CPPUNIT_ASSERT_DOUBLES_EQUAL( -29, testFont->Descender(), 0.01);
@@ -135,7 +135,7 @@ class FTFontTest : public CppUnit::TestCase
void testBoundingBox()
{
- CPPUNIT_ASSERT( testFont->FaceSize( GOOD_SIZE));
+ CPPUNIT_ASSERT( testFont->FaceSize( FONT_POINT_SIZE));
CPPUNIT_ASSERT( testFont->Error() == 0);
float llx, lly, llz, urx, ury, urz;
@@ -180,7 +180,7 @@ class FTFontTest : public CppUnit::TestCase
void testAdvance()
{
- CPPUNIT_ASSERT( testFont->FaceSize( GOOD_SIZE));
+ CPPUNIT_ASSERT( testFont->FaceSize( FONT_POINT_SIZE));
CPPUNIT_ASSERT( testFont->Error() == 0);
float advance = testFont->Advance( GOOD_ASCII_TEST_STRING);
diff --git a/test/FTSize-Test.cpp b/test/FTSize-Test.cpp
index cfeb793..68b8e0a 100755
--- a/test/FTSize-Test.cpp
+++ b/test/FTSize-Test.cpp
@@ -45,7 +45,7 @@ class FTSizeTest : public CppUnit::TestCase
FTSize size;
- CPPUNIT_ASSERT( size.CharSize( &face, GOOD_SIZE, RESOLUTION, RESOLUTION));
+ CPPUNIT_ASSERT( size.CharSize( &face, FONT_POINT_SIZE, RESOLUTION, RESOLUTION));
CPPUNIT_ASSERT( size.Error() == 0);
CPPUNIT_ASSERT_DOUBLES_EQUAL( 72, size.CharSize(), 0.01);
diff --git a/test/FTVectoriser-Test.cpp b/test/FTVectoriser-Test.cpp
index 07b4d00..9bf440d 100755
--- a/test/FTVectoriser-Test.cpp
+++ b/test/FTVectoriser-Test.cpp
@@ -431,7 +431,7 @@ class FTVectoriserTest : public CppUnit::TestCase
{
long glyphIndex = FT_Get_Char_Index( face, characterIndex);
- FT_Set_Char_Size( face, 0L, GOOD_SIZE * 64, RESOLUTION, RESOLUTION);
+ FT_Set_Char_Size( face, 0L, FONT_POINT_SIZE * 64, RESOLUTION, RESOLUTION);
FT_Error error = FT_Load_Glyph( face, glyphIndex, FT_LOAD_DEFAULT);
assert(!error);
diff --git a/test/Fontdefs.h b/test/Fontdefs.h
index 701d71a..50ae9cc 100644
--- a/test/Fontdefs.h
+++ b/test/Fontdefs.h
@@ -2,16 +2,18 @@
#define __Font_defs__
-const char* const BAD_FONT_FILE = "missing_font.ttf";
-const char* const GOOD_FONT_FILE = "../../test/MHei-Medium-Acro";
-const char* const FONT_FILE = "../../test/arial.ttf";
-
-const char* const GOOD_ASCII_TEST_STRING = "test string";
-const char* const BAD_ASCII_TEST_STRING = "";
+const char* const BAD_FONT_FILE = "missing_font.ttf";
+const char* const GOOD_FONT_FILE = "../../test/MHei-Medium-Acro";
+const char* const FONT_FILE = "../../test/arial.ttf";
+const char* const TYPE1_FONT_FILE = "../../test/HPGCalc.pfb";
+const char* const TYPE1_AFM_FILE = "../../test/HPGCalc.afm";
+
+const char* const GOOD_ASCII_TEST_STRING = "test string";
+const char* const BAD_ASCII_TEST_STRING = "";
const wchar_t GOOD_UNICODE_TEST_STRING[4] = { 0x6FB3, 0x9580, 0x0};
const wchar_t* const BAD_UNICODE_TEST_STRING = L"";
-const unsigned int GOOD_SIZE = 72;
+const unsigned int FONT_POINT_SIZE = 72;
const unsigned int RESOLUTION = 72;
const unsigned int CHARACTER_CODE_A = 'A';