* include/freetype/freetype.h, include/freetype/internal/ftobjs.h, src/base/ftobjs.c, src/base/ftinit.c: adding the new FT_Library_Version API to return the library's current version in dynamic links.
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 143
diff --git a/ChangeLog b/ChangeLog
index 99cc463..fa9e335 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -7,6 +7,10 @@
* src/pshinter/pshalgo2.c: changed 'print_zone' to 'psh2_print_zone'
* src/pshinter/pshalgo1.c: changed 'print_zone' to 'psh1_print_zone'
+ * include/freetype/freetype.h, include/freetype/internal/ftobjs.h,
+ src/base/ftobjs.c, src/base/ftinit.c: adding the new FT_Library_Version
+ API to return the library's current version in dynamic links.
+
2002-03-06 Werner Lemberg <wl@gnu.org>
diff --git a/include/freetype/freetype.h b/include/freetype/freetype.h
index 57e212b..16e8e87 100644
--- a/include/freetype/freetype.h
+++ b/include/freetype/freetype.h
@@ -106,6 +106,7 @@ FT_BEGIN_HEADER
/* */
/* FT_Init_FreeType */
/* FT_Done_FreeType */
+ /* FT_Library_Version */
/* */
/* FT_New_Face */
/* FT_Done_Face */
@@ -1341,6 +1342,40 @@ FT_BEGIN_HEADER
/*************************************************************************/
/* */
/* <Function> */
+ /* FT_Library_Version */
+ /* */
+ /* <Description> */
+ /* Return the version of the FreeType library being used. This */
+ /* is useful when dynamically linking to the library, since one */
+ /* cannot use the macros FT_FREETYPE_MAJOR, FT_FREETYPE_MINOR and */
+ /* FT_FREETYPE_PATCH. */
+ /* */
+ /* <Input> */
+ /* library :: source library handle. */
+ /* */
+ /* <Output> */
+ /* amajor :: major version number */
+ /* aminor :: minor version number */
+ /* apatch :: patch version number */
+ /* */
+ /* <Note> */
+ /* the reason why this function takes a 'library' argument is */
+ /* because certain programs implement library initialisation in */
+ /* a custom way that doesn't use FT_Init_FreeType. */
+ /* */
+ /* in certain such cases, the library version cannot be known until */
+ /* the library object has been created.. */
+ /* */
+ FT_EXPORT( void )
+ FT_Library_Version( FT_Library library,
+ FT_Int *amajor,
+ FT_Int *aminor,
+ FT_Int *apatch );
+
+
+ /*************************************************************************/
+ /* */
+ /* <Function> */
/* FT_Done_FreeType */
/* */
/* <Description> */
diff --git a/include/freetype/internal/ftobjs.h b/include/freetype/internal/ftobjs.h
index 9d9f0be..a292ab8 100644
--- a/include/freetype/internal/ftobjs.h
+++ b/include/freetype/internal/ftobjs.h
@@ -657,6 +657,10 @@ FT_BEGIN_HEADER
FT_Generic generic;
+ FT_Int version_major;
+ FT_Int version_minor;
+ FT_Int version_patch;
+
FT_UInt num_modules;
FT_Module modules[FT_MAX_MODULES]; /* module objects */
diff --git a/src/base/ftinit.c b/src/base/ftinit.c
index e2f809d..8cc0e3b 100644
--- a/src/base/ftinit.c
+++ b/src/base/ftinit.c
@@ -125,7 +125,13 @@
error = FT_New_Library( memory, alibrary );
if ( !error )
+ {
+ (*alibrary)->version_major = FREETYPE_MAJOR;
+ (*alibrary)->version_minor = FREETYPE_MINOR;
+ (*alibrary)->version_patch = FREETYPE_PATCH;
+
FT_Add_Default_Modules( *alibrary );
+ }
return error;
}
diff --git a/src/base/ftobjs.c b/src/base/ftobjs.c
index 2cb2faa..f4d7af3 100644
--- a/src/base/ftobjs.c
+++ b/src/base/ftobjs.c
@@ -2300,6 +2300,37 @@
}
+ /* documentation is in freetype.h */
+
+ FT_EXPORT_DEF( void )
+ FT_Library_Version( FT_Library library,
+ FT_Int *amajor,
+ FT_Int *aminor,
+ FT_Int *apatch )
+ {
+ FT_Int major = 0;
+ FT_Int minor = 0;
+ FT_Int patch = 0;
+
+
+ if ( library )
+ {
+ major = library->version_major;
+ minor = library->version_minor;
+ patch = library->version_patch;
+ }
+
+ if ( *amajor )
+ *amajor = major;
+
+ if ( *aminor )
+ *aminor = minor;
+
+ if ( *apatch )
+ *apatch = patch;
+ }
+
+
/* documentation is in ftmodule.h */
FT_EXPORT_DEF( FT_Error )