Add support for ISOLatin1 PS encoding. * include/freetype/freetype.h (ft_encoding_latin_1): New tag (`lat1'). * include/freetype/internal/t1types.h (T1_Encoding_Type): Add `t1_encoding_isolatin1'. * src/type1/t1driver.c (Get_Char_Index, Get_Next_Char): Handle ft_encoding_latin_1. * src/type1/t1load.c (parse_encoding): Handle `ISOLatin1Encoding'. * src/type1/t1objs.c (T1_Face_Init): Handle `t1_encoding_isolatin1'.
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 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266
diff --git a/ChangeLog b/ChangeLog
index cd1db7b..8132b99 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,16 @@
+2002-02-10 Roberto Alameda <ojancano@geekmail.de>
+
+ Add support for ISOLatin1 PS encoding.
+
+ * include/freetype/freetype.h (ft_encoding_latin_1): New tag
+ (`lat1').
+ * include/freetype/internal/t1types.h (T1_Encoding_Type): Add
+ `t1_encoding_isolatin1'.
+ * src/type1/t1driver.c (Get_Char_Index, Get_Next_Char): Handle
+ ft_encoding_latin_1.
+ * src/type1/t1load.c (parse_encoding): Handle `ISOLatin1Encoding'.
+ * src/type1/t1objs.c (T1_Face_Init): Handle `t1_encoding_isolatin1'.
+
2002-02-09 Werner Lemberg <wl@gnu.org>
* README: Fix typo.
diff --git a/include/freetype/freetype.h b/include/freetype/freetype.h
index 40a4e65..c36aacb 100644
--- a/include/freetype/freetype.h
+++ b/include/freetype/freetype.h
@@ -395,6 +395,7 @@ FT_BEGIN_HEADER
FT_ENC_TAG( ft_encoding_symbol, 's', 'y', 'm', 'b' ),
FT_ENC_TAG( ft_encoding_unicode, 'u', 'n', 'i', 'c' ),
+ FT_ENC_TAG( ft_encoding_latin_1, 'l', 'a', 't', '1' ),
FT_ENC_TAG( ft_encoding_latin_2, 'l', 'a', 't', '2' ),
FT_ENC_TAG( ft_encoding_sjis, 's', 'j', 'i', 's' ),
FT_ENC_TAG( ft_encoding_gb2312, 'g', 'b', ' ', ' ' ),
diff --git a/include/freetype/internal/t1types.h b/include/freetype/internal/t1types.h
index e561acb..cc76b03 100644
--- a/include/freetype/internal/t1types.h
+++ b/include/freetype/internal/t1types.h
@@ -80,6 +80,7 @@ FT_BEGIN_HEADER
t1_encoding_none = 0,
t1_encoding_array,
t1_encoding_standard,
+ t1_encoding_isolatin1,
t1_encoding_expert
} T1_EncodingType;
diff --git a/src/type1/t1driver.c b/src/type1/t1driver.c
index b5bf444..0e9c3b8 100644
--- a/src/type1/t1driver.c
+++ b/src/type1/t1driver.c
@@ -275,6 +275,24 @@
/*******************************************************************/
/* */
+ /* ISOLatin1 encoding support */
+ /* */
+ case ft_encoding_latin_1:
+ /* ISOLatin1 is the first page of Unicode */
+ if ( charcode < 256 && psnames->unicode_value )
+ {
+ result = psnames->lookup_unicode( &face->unicode_map,
+ (FT_ULong)charcode );
+
+ /* the function returns 0xFFFF if the Unicode charcode has */
+ /* no corresponding glyph */
+ if ( result == 0xFFFF )
+ result = 0;
+ }
+ goto Exit;
+
+ /*******************************************************************/
+ /* */
/* Custom Type 1 encoding */
/* */
case ft_encoding_adobe_custom:
@@ -367,6 +385,23 @@
/*******************************************************************/
/* */
+ /* ISOLatin1 encoding support */
+ /* */
+ case ft_encoding_latin_1:
+ {
+ FT_Long code;
+
+
+ /* use the `PSNames' module to synthetize the Unicode charmap */
+ code = psnames->next_unicode( &face->unicode_map,
+ (FT_ULong)charcode );
+ if ( code < 256 )
+ return code;
+ break;
+ }
+
+ /*******************************************************************/
+ /* */
/* Custom Type 1 encoding */
/* */
case ft_encoding_adobe_custom:
@@ -426,9 +461,9 @@
{
{
ft_module_font_driver |
- ft_module_driver_scalable |
+ ft_module_driver_scalable |
ft_module_driver_has_hinter,
-
+
sizeof( FT_DriverRec ),
"type1",
@@ -466,7 +501,7 @@
(FTDriver_attachFile) T1_Read_AFM,
#endif
(FTDriver_getAdvances) 0,
-
+
(FTDriver_getNextChar) Get_Next_Char
};
diff --git a/src/type1/t1load.c b/src/type1/t1load.c
index 69116f0..8b512a5 100644
--- a/src/type1/t1load.c
+++ b/src/type1/t1load.c
@@ -1082,6 +1082,10 @@
strncmp( (const char*)cur, "ExpertEncoding", 14 ) == 0 )
face->type1.encoding_type = t1_encoding_expert;
+ else if ( cur + 18 < limit &&
+ strncmp( (const char*)cur, "ISOLatin1Encoding", 17 ) == 0 )
+ face->type1.encoding_type = t1_encoding_isolatin1;
+
else
{
FT_ERROR(( "parse_encoding: invalid token!\n" ));
diff --git a/src/type1/t1objs.c b/src/type1/t1objs.c
index dfe8125..172ee51 100644
--- a/src/type1/t1objs.c
+++ b/src/type1/t1objs.c
@@ -61,7 +61,7 @@
T1_Face face = (T1_Face) size->root.face;
PSHinter_Interface* pshinter = face->pshinter;
FT_Module module;
-
+
module = FT_Get_Module( size->root.face->driver->root.library,
"pshinter" );
@@ -77,7 +77,7 @@
if ( size->root.internal )
{
PSH_Globals_Funcs funcs;
-
+
funcs = T1_Size_Get_Globals_Funcs( size );
if ( funcs )
@@ -93,20 +93,20 @@
{
FT_Error error = 0;
PSH_Globals_Funcs funcs = T1_Size_Get_Globals_Funcs( size );
-
+
if ( funcs )
{
PSH_Globals globals;
T1_Face face = (T1_Face)size->root.face;
-
- error = funcs->create( size->root.face->memory,
+
+ error = funcs->create( size->root.face->memory,
&face->type1.private_dict, &globals );
if ( !error )
size->root.internal = (FT_Size_Internal)(void*)globals;
}
-
+
return error;
}
@@ -117,7 +117,7 @@
PSH_Globals_Funcs funcs = T1_Size_Get_Globals_Funcs( size );
FT_Error error = 0;
-
+
if ( funcs )
error = funcs->set_scale( (PSH_Globals)size->root.internal,
size->root.metrics.x_scale,
@@ -142,29 +142,29 @@
FT_LOCAL_DEF FT_Error
T1_GlyphSlot_Init( T1_GlyphSlot slot )
- {
+ {
T1_Face face;
PSHinter_Interface* pshinter;
-
+
face = (T1_Face) slot->root.face;
pshinter = face->pshinter;
if (pshinter)
{
FT_Module module;
-
+
module = FT_Get_Module( slot->root.face->driver->root.library, "pshinter" );
if (module)
{
T1_Hints_Funcs funcs;
-
+
funcs = pshinter->get_t1_funcs( module );
slot->root.internal->glyph_hints = (void*)funcs;
}
}
return 0;
}
-
-
+
+
/*************************************************************************/
/* */
/* FACE FUNCTIONS */
@@ -304,7 +304,7 @@
face->psaux = psaux;
}
-
+
pshinter = (PSHinter_Interface*)face->pshinter;
if ( !pshinter )
{
@@ -372,7 +372,7 @@
family++;
full++;
}
-
+
root->style_name = ( *full == ' ' ? full + 1
: (char *)"Regular" );
}
@@ -489,10 +489,20 @@
charmap->encoding_id = 1;
break;
- default:
+ case t1_encoding_array:
charmap->encoding = ft_encoding_adobe_custom;
charmap->encoding_id = 2;
break;
+
+ case t1_encoding_isolatin1:
+ charmap->encoding = ft_encoding_latin_1;
+ charmap->encoding_id = 3;
+ break;
+
+ default:
+ FT_ERROR(( "T1_Face_Init: invalid encoding\n" ));
+ error = T1_Err_Invalid_File_Format;
+ goto Exit;
}
root->charmaps = face->charmaps;