[autofit] Fix interface of `af_get_char_index'. * src/autofit/hbshim.c (af_get_char_index): Return error value. Add argument for y offset (to be used in a yet-to-come patch). * src/autofit/hbshim.h, src/autofit/afcjk.c, src/autofit/aflatin.c: Updated.
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 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212
diff --git a/ChangeLog b/ChangeLog
index 7939836..181cbe3 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,13 @@
+2013-12-31 Werner Lemberg <wl@gnu.org>
+
+ [autofit] Fix interface of `af_get_char_index'.
+
+ * src/autofit/hbshim.c (af_get_char_index): Return error value.
+ Add argument for y offset (to be used in a yet-to-come patch).
+
+ * src/autofit/hbshim.h, src/autofit/afcjk.c,
+ src/autofit/aflatin.c: Updated.
+
2013-12-30 Werner Lemberg <wl@gnu.org>
[autofit] Don't combine multiple features into one set.
diff --git a/src/autofit/afcjk.c b/src/autofit/afcjk.c
index f27e72a..c396d69 100644
--- a/src/autofit/afcjk.c
+++ b/src/autofit/afcjk.c
@@ -87,7 +87,8 @@
{
FT_Error error;
- FT_UInt glyph_index;
+ FT_ULong glyph_index;
+ FT_Long y_offset;
int dim;
AF_CJKMetricsRec dummy[1];
AF_Scaler scaler = &dummy->root.scaler;
@@ -101,8 +102,10 @@
[style_class->script];
- glyph_index = af_get_char_index( &metrics->root,
- script_class->standard_char );
+ af_get_char_index( &metrics->root,
+ script_class->standard_char,
+ &glyph_index,
+ &y_offset );
if ( glyph_index == 0 )
goto Exit;
@@ -289,7 +292,8 @@
while ( *p )
{
FT_ULong ch;
- FT_UInt glyph_index;
+ FT_ULong glyph_index;
+ FT_Long y_offset;
FT_Pos best_pos; /* same as points.y or points.x, resp. */
FT_Int best_point;
FT_Vector* points;
@@ -298,7 +302,7 @@
GET_UTF8_CHAR( ch, p );
/* load the character in the face -- skip unknown or empty ones */
- glyph_index = af_get_char_index( &metrics->root, ch );
+ af_get_char_index( &metrics->root, ch, &glyph_index, &y_offset );
if ( glyph_index == 0 )
{
FT_TRACE5(( " U+%04lX unavailable\n", ch ));
@@ -477,10 +481,11 @@
/* digit `0' is 0x30 in all supported charmaps */
for ( i = 0x30; i <= 0x39; i++ )
{
- FT_UInt glyph_index;
+ FT_ULong glyph_index;
+ FT_Long y_offset;
- glyph_index = af_get_char_index( &metrics->root, i );
+ af_get_char_index( &metrics->root, i, &glyph_index, &y_offset );
if ( glyph_index == 0 )
continue;
diff --git a/src/autofit/aflatin.c b/src/autofit/aflatin.c
index 0b4709a..279953f 100644
--- a/src/autofit/aflatin.c
+++ b/src/autofit/aflatin.c
@@ -74,7 +74,8 @@
{
FT_Error error;
- FT_UInt glyph_index;
+ FT_ULong glyph_index;
+ FT_Long y_offset;
int dim;
AF_LatinMetricsRec dummy[1];
AF_Scaler scaler = &dummy->root.scaler;
@@ -88,8 +89,10 @@
[style_class->script];
- glyph_index = af_get_char_index( &metrics->root,
- script_class->standard_char );
+ af_get_char_index( &metrics->root,
+ script_class->standard_char,
+ &glyph_index,
+ &y_offset );
if ( glyph_index == 0 )
goto Exit;
@@ -287,7 +290,8 @@
while ( *p )
{
FT_ULong ch;
- FT_UInt glyph_index;
+ FT_ULong glyph_index;
+ FT_Long y_offset;
FT_Pos best_y; /* same as points.y */
FT_Int best_point, best_contour_first, best_contour_last;
FT_Vector* points;
@@ -297,7 +301,7 @@
GET_UTF8_CHAR( ch, p );
/* load the character in the face -- skip unknown or empty ones */
- glyph_index = af_get_char_index( &metrics->root, ch );
+ af_get_char_index( &metrics->root, ch, &glyph_index, &y_offset );
if ( glyph_index == 0 )
{
FT_TRACE5(( " U+%04lX unavailable\n", ch ));
@@ -743,10 +747,11 @@
/* digit `0' is 0x30 in all supported charmaps */
for ( i = 0x30; i <= 0x39; i++ )
{
- FT_UInt glyph_index;
+ FT_ULong glyph_index;
+ FT_Long y_offset;
- glyph_index = af_get_char_index( &metrics->root, i );
+ af_get_char_index( &metrics->root, i, &glyph_index, &y_offset );
if ( glyph_index == 0 )
continue;
diff --git a/src/autofit/hbshim.c b/src/autofit/hbshim.c
index c9e21cb..d280e55 100644
--- a/src/autofit/hbshim.c
+++ b/src/autofit/hbshim.c
@@ -230,9 +230,11 @@
}
- FT_UInt
+ FT_Error
af_get_char_index( AF_StyleMetrics metrics,
- FT_ULong charcode )
+ FT_ULong charcode,
+ FT_ULong *codepoint,
+ FT_Long *y_offset )
{
FT_Face face;
@@ -242,7 +244,10 @@
face = metrics->globals->face;
- return FT_Get_Char_Index( face, charcode );
+ *codepoint = FT_Get_Char_Index( face, charcode );
+ *y_offset = 0;
+
+ return FT_Err_Ok;
}
@@ -262,9 +267,11 @@
}
- FT_UInt
+ FT_Error
af_get_char_index( AF_StyleMetrics metrics,
- FT_ULong charcode )
+ FT_ULong charcode,
+ FT_ULong *codepoint,
+ FT_Long *y_offset )
{
FT_Face face;
@@ -274,7 +281,10 @@
face = metrics->globals->face;
- return FT_Get_Char_Index( face, charcode );
+ *codepoint = FT_Get_Char_Index( face, charcode );
+ *y_offset = 0;
+
+ return FT_Err_Ok;
}
diff --git a/src/autofit/hbshim.h b/src/autofit/hbshim.h
index 52b67c4..02f1513 100644
--- a/src/autofit/hbshim.h
+++ b/src/autofit/hbshim.h
@@ -40,9 +40,11 @@ FT_BEGIN_HEADER
AF_StyleClass style_class,
FT_Byte* gstyles );
- FT_UInt
+ FT_Error
af_get_char_index( AF_StyleMetrics metrics,
- FT_ULong charcode );
+ FT_ULong charcode,
+ FT_ULong *codepoint,
+ FT_Long *y_offset );
/* */