* include/freetype/freetype.h: changing version to 2.1.0 to indicate an unstable branch. Added the declarations of FT_Get_First_Char and FT_Get_Next_Char * src/base/ftobjs.c: implemented FT_Get_First_Char and FT_Get_Next_Char
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 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181
diff --git a/ChangeLog b/ChangeLog
index 5d1e159..417865c 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,11 @@
2002-02-28 David Turner <david@freetype.org>
+ * include/freetype/freetype.h: changing version to 2.1.0 to indicate
+ an unstable branch. Added the declarations of FT_Get_First_Char and
+ FT_Get_Next_Char
+
+ * src/base/ftobjs.c: implemented FT_Get_First_Char and FT_Get_Next_Char
+
* include/freetype/t1tables.h: re-naming structure types. This done
basically:
diff --git a/include/freetype/freetype.h b/include/freetype/freetype.h
index c36aacb..57e212b 100644
--- a/include/freetype/freetype.h
+++ b/include/freetype/freetype.h
@@ -34,8 +34,8 @@
/* drivers. It starts at 2.0. */
/* */
#define FREETYPE_MAJOR 2
-#define FREETYPE_MINOR 0
-#define FREETYPE_PATCH 8
+#define FREETYPE_MINOR 1
+#define FREETYPE_PATCH 0
#include <ft2build.h>
@@ -2395,6 +2395,89 @@ FT_BEGIN_HEADER
/*************************************************************************/
/* */
/* <Function> */
+ /* FT_Get_First_Char */
+ /* */
+ /* <Description> */
+ /* This function is used to return the first character code in the */
+ /* current charmap of a given face. It will also return the */
+ /* corresponding glyph index. */
+ /* */
+ /* <Input> */
+ /* face :: A handle to the source face object. */
+ /* */
+ /* <Output> */
+ /* agindex :: glyph index of first character code. 0 if charmap */
+ /* is empty.. */
+ /* */
+ /* <Return> */
+ /* the charmap's first character code. */
+ /* */
+ /* <Note> */
+ /* you should use this function with @FT_Get_Next_Char to be able */
+ /* to parse all character codes available in a given charmap. */
+ /* the code should look like: */
+ /* */
+ /* { */
+ /* FT_ULong charcode; */
+ /* FT_UInt gindex; */
+ /* */
+ /* charcode = FT_Get_First_Char( face, &gindex ); */
+ /* while ( gindex != 0 ) */
+ /* { */
+ /* .. do something with (charcode,gindex) pair */
+ /* */
+ /* charcode = FT_Get_Next_Char( face, charcode, &gindex ); */
+ /* } */
+ /* } */
+ /* */
+ /* note that '*agindex' will be set to 0 if the charmap is empty. */
+ /* the result itself can be 0 in two cases: if the charmap is empty */
+ /* or when the value 0 is the first valid character code. */
+ /* */
+ FT_EXPORT( FT_ULong )
+ FT_Get_First_Char( FT_Face face,
+ FT_UInt *agindex );
+
+
+ /*************************************************************************/
+ /* */
+ /* <Function> */
+ /* FT_Get_Next_Char */
+ /* */
+ /* <Description> */
+ /* This function is used to return the next character code in the */
+ /* current charmap of a given face following the value 'char_code', */
+ /* as well as the corresponding glyph index */
+ /* */
+ /* <Input> */
+ /* face :: A handle to the source face object. */
+ /* char_code :: starting character code */
+ /* */
+ /* <Output> */
+ /* agindex :: glyph index of first character code. 0 if charmap */
+ /* is empty.. */
+ /* */
+ /* <Return> */
+ /* the charmap's next character code. */
+ /* */
+ /* <Note> */
+ /* you should use this function with @FT_Get_First_Char to be able */
+ /* to parse all character codes available in a given charmap. see */
+ /* the note for this function for a simple code example.. */
+ /* */
+ /* note that '*agindex' will be set to 0 when there are no more */
+ /* codes in the charmap.. */
+ /* */
+ FT_EXPORT( FT_ULong )
+ FT_Get_Next_Char( FT_Face face,
+ FT_ULong char_code,
+ FT_UInt *agindex );
+
+
+
+ /*************************************************************************/
+ /* */
+ /* <Function> */
/* FT_Get_Name_Index */
/* */
/* <Description> */
diff --git a/src/base/ftobjs.c b/src/base/ftobjs.c
index 27a5233..e347e4b 100644
--- a/src/base/ftobjs.c
+++ b/src/base/ftobjs.c
@@ -1466,19 +1466,52 @@
/* documentation is in freetype.h */
FT_EXPORT_DEF( FT_ULong )
+ FT_Get_First_Char( FT_Face face,
+ FT_UInt *agindex )
+ {
+ FT_ULong result = 0;
+ FT_UInt gindex = 0;
+
+ if ( face && face->charmap )
+ {
+ gindex = FT_Get_Char_Index( face, 0 );
+ if ( gindex == 0 )
+ result = FT_Get_Next_Char( face, 0, &gindex );
+ }
+
+ if ( agindex )
+ *agindex = gindex;
+
+ return result;
+ }
+
+ /* documentation is in freetype.h */
+
+ FT_EXPORT_DEF( FT_ULong )
FT_Get_Next_Char( FT_Face face,
- FT_ULong charcode )
+ FT_ULong charcode,
+ FT_UInt *agindex )
{
- FT_ULong result;
+ FT_ULong result = 0;
+ FT_UInt gindex = 0;
FT_Driver driver;
- result = 0;
if ( face && face->charmap )
{
driver = face->driver;
result = driver->clazz->get_next_char( face->charmap, charcode );
+ if ( result != 0 )
+ {
+ gindex = driver->clazz->get_char_index( face->charmap, result );
+ if ( gindex == 0 )
+ result = 0;
+ }
}
+
+ if ( agindex )
+ *agindex = gindex;
+
return result;
}