Add new function FT_Get_PS_Font_Private(). * include/freetype/internal/services/svpsinfo.h (PS_GetFontPrivateFunc): New service function. * include/freetype/t1tables.h, src/base/fttype1.c (FT_Get_PS_Font_Private): New function. * src/type1/t1driver.c (t1_ps_get_font_private): New function. (t1_service_ps_info): Updated. * src/cff/cffdrivr.c (cff_service_ps_info): Updated. * src/cid/cidriver.c (cid_service_ps_info): Updated. * src/type42/t42drivr.c (t42_ps_get_font_private): New function. (t42_service_ps_info): Updated. * src/type42/t42parse.c (t42_parse_dict): Remove compiler warning.
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
diff --git a/ChangeLog b/ChangeLog
index d1e2e50..93090c4 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,25 @@
+2004-11-11 Werner Lemberg <wl@gnu.org>
+
+ * src/cff/cffdrivr.c (cff_service_ps_info): Updated.
+ * src/cid/cidriver.c (cid_service_ps_info): Updated.
+ * src/type42/t42drivr.c (t42_ps_get_font_private): New function.
+ (t42_service_ps_info): Updated.
+
+ * src/type42/t42parse.c (t42_parse_dict): Remove compiler warning.
+
+2004-11-11 David Bevan <dbevan@emtex.com>
+
+ Add new function FT_Get_PS_Font_Private().
+
+ * include/freetype/internal/services/svpsinfo.h
+ (PS_GetFontPrivateFunc): New service function.
+
+ * include/freetype/t1tables.h, src/base/fttype1.c
+ (FT_Get_PS_Font_Private): New function.
+
+ * src/type1/t1driver.c (t1_ps_get_font_private): New function.
+ (t1_service_ps_info): Updated.
+
2004-10-13 Werner Lemberg <wl@gnu.org>
* include/freetype/config/ftstdlib.h: Include `stddef.h'.
diff --git a/include/freetype/internal/services/svpsinfo.h b/include/freetype/internal/services/svpsinfo.h
index 73c02cd..63f5db9 100644
--- a/include/freetype/internal/services/svpsinfo.h
+++ b/include/freetype/internal/services/svpsinfo.h
@@ -4,7 +4,7 @@
/* */
/* The FreeType PostScript info service (specification). */
/* */
-/* Copyright 2003 by */
+/* Copyright 2003, 2004 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */
/* This file is part of the FreeType project, and may only be used, */
@@ -36,11 +36,16 @@ FT_BEGIN_HEADER
typedef FT_Int
(*PS_HasGlyphNamesFunc)( FT_Face face );
+ typedef FT_Error
+ (*PS_GetFontPrivateFunc)( FT_Face face,
+ PS_PrivateRec* afont_private );
+
FT_DEFINE_SERVICE( PsInfo )
{
- PS_GetFontInfoFunc ps_get_font_info;
- PS_HasGlyphNamesFunc ps_has_glyph_names;
+ PS_GetFontInfoFunc ps_get_font_info;
+ PS_HasGlyphNamesFunc ps_has_glyph_names;
+ PS_GetFontPrivateFunc ps_get_font_private;
};
/* */
diff --git a/include/freetype/t1tables.h b/include/freetype/t1tables.h
index 60938aa..5ae12b8 100644
--- a/include/freetype/t1tables.h
+++ b/include/freetype/t1tables.h
@@ -387,6 +387,38 @@ FT_BEGIN_HEADER
FT_Get_PS_Font_Info( FT_Face face,
PS_FontInfoRec *afont_info );
+
+ /************************************************************************
+ *
+ * @function:
+ * FT_Get_PS_Font_Private
+ *
+ * @description:
+ * Retrieve the @PS_PrivateRec structure corresponding to a given
+ * Postscript font.
+ *
+ * @input:
+ * face ::
+ * Postscript face handle.
+ *
+ * @output:
+ * afont_private ::
+ * Output private dictionary structure pointer.
+ *
+ * @return:
+ * FreeType error code. 0 means success.
+ *
+ * @note:
+ * The string pointers within the font info structure are owned by
+ * the face and don't need to be freed by the caller.
+ *
+ * If the font's format is not Postscript-based, this function will
+ * return the FT_Err_Invalid_Argument error code.
+ */
+ FT_EXPORT( FT_Error )
+ FT_Get_PS_Font_Private( FT_Face face,
+ PS_PrivateRec *afont_private );
+
/* */
diff --git a/src/base/fttype1.c b/src/base/fttype1.c
index 553b84f..3975584 100644
--- a/src/base/fttype1.c
+++ b/src/base/fttype1.c
@@ -4,7 +4,7 @@
/* */
/* FreeType utility file for PS names support (body). */
/* */
-/* Copyright 2002, 2003 by */
+/* Copyright 2002, 2003, 2004 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */
/* This file is part of the FreeType project, and may only be used, */
@@ -67,4 +67,28 @@
}
+ /* documentation is in t1tables.h */
+
+ FT_EXPORT_DEF( FT_Error )
+ FT_Get_PS_Font_Private( FT_Face face,
+ PS_PrivateRec* afont_private )
+ {
+ FT_Error error = FT_Err_Invalid_Argument;
+
+
+ if ( face )
+ {
+ FT_Service_PsInfo service = NULL;
+
+
+ FT_FACE_FIND_SERVICE( face, service, POSTSCRIPT_INFO );
+
+ if ( service && service->ps_get_font_private )
+ error = service->ps_get_font_private( face, afont_private );
+ }
+
+ return error;
+ }
+
+
/* END */
diff --git a/src/cff/cffdrivr.c b/src/cff/cffdrivr.c
index e1f274e..b84bfdb 100644
--- a/src/cff/cffdrivr.c
+++ b/src/cff/cffdrivr.c
@@ -338,8 +338,9 @@
static const FT_Service_PsInfoRec cff_service_ps_info =
{
- (PS_GetFontInfoFunc) NULL, /* unsupported with CFF fonts */
- (PS_HasGlyphNamesFunc)cff_ps_has_glyph_names
+ (PS_GetFontInfoFunc) NULL, /* unsupported with CFF fonts */
+ (PS_HasGlyphNamesFunc) cff_ps_has_glyph_names,
+ (PS_GetFontPrivateFunc)NULL /* unsupported with CFF fonts */
};
diff --git a/src/cid/cidriver.c b/src/cid/cidriver.c
index 7d885a8..377835b 100644
--- a/src/cid/cidriver.c
+++ b/src/cid/cidriver.c
@@ -78,8 +78,9 @@
static const FT_Service_PsInfoRec cid_service_ps_info =
{
- (PS_GetFontInfoFunc) cid_ps_get_font_info,
- (PS_HasGlyphNamesFunc)NULL /* unsupported with CID fonts */
+ (PS_GetFontInfoFunc) cid_ps_get_font_info,
+ (PS_HasGlyphNamesFunc) NULL, /* unsupported with CID fonts */
+ (PS_GetFontPrivateFunc)NULL /* unsupported */
};
diff --git a/src/type1/t1driver.c b/src/type1/t1driver.c
index 652eebc..dbcdb2a 100644
--- a/src/type1/t1driver.c
+++ b/src/type1/t1driver.c
@@ -160,10 +160,20 @@
}
+ static FT_Error
+ t1_ps_get_font_private( FT_Face face,
+ PS_PrivateRec* afont_private )
+ {
+ *afont_private = ((T1_Face)face)->type1.private_dict;
+ return 0;
+ }
+
+
static const FT_Service_PsInfoRec t1_service_ps_info =
{
- (PS_GetFontInfoFunc) t1_ps_get_font_info,
- (PS_HasGlyphNamesFunc)t1_ps_has_glyph_names
+ (PS_GetFontInfoFunc) t1_ps_get_font_info,
+ (PS_HasGlyphNamesFunc) t1_ps_has_glyph_names,
+ (PS_GetFontPrivateFunc)t1_ps_get_font_private,
};
diff --git a/src/type42/t42drivr.c b/src/type42/t42drivr.c
index 2afe2db..c87c3f2 100644
--- a/src/type42/t42drivr.c
+++ b/src/type42/t42drivr.c
@@ -139,7 +139,7 @@
PS_FontInfoRec* afont_info )
{
*afont_info = ((T42_Face)face)->type1.font_info;
- return 0;
+ return T42_Err_Ok;
}
@@ -151,10 +151,20 @@
}
+ static FT_Error
+ t42_ps_get_font_private( FT_Face face,
+ PS_PrivateRec* afont_private )
+ {
+ *afont_private = ((T42_Face)face)->type1.private_dict;
+ return T42_Err_Ok;
+ }
+
+
static const FT_Service_PsInfoRec t42_service_ps_info =
{
- (PS_GetFontInfoFunc) t42_ps_get_font_info,
- (PS_HasGlyphNamesFunc)t42_ps_has_glyph_names
+ (PS_GetFontInfoFunc) t42_ps_get_font_info,
+ (PS_HasGlyphNamesFunc) t42_ps_has_glyph_names,
+ (PS_GetFontPrivateFunc)t42_ps_get_font_private
};
diff --git a/src/type42/t42parse.c b/src/type42/t42parse.c
index ff53a3e..30846c0 100644
--- a/src/type42/t42parse.c
+++ b/src/type42/t42parse.c
@@ -1053,9 +1053,9 @@
if ( !name )
continue;
- if ( cur[0] == name[0] &&
- len == ft_strlen( (const char *)name ) &&
- ft_memcmp( cur, name, len ) == 0 )
+ if ( cur[0] == name[0] &&
+ len == (FT_PtrDist)ft_strlen( (const char *)name ) &&
+ ft_memcmp( cur, name, len ) == 0 )
{
/* we found it -- run the parsing callback! */
parser->root.error = t42_load_keyword( face,