* include/freetype/ftxf86.h, src/base/ftxf86.c: added a new API named FT_Get_X11_Font_Format to return an X11-compatible string describing the font format of a given face. This was put in a new optional base source file, corresponding to a new public header (named FT_XFREE86_H since this function should only be used within the XFree86 font server IMO). * include/freetype/config/ftheader.h: adding FT_XFREE86_H, though it's not documented yet. * include/freetype/t1tables.h, src/base/fttype1.c: adding two new APIs named "FT_Get_PS_Font_Info" and "FT_Has_PS_Glyph_Names". This required a new optional source in 'src/base' named "fttype1.c" * src/base/Jamfile, src/base/rules.mk, src/base/descrip.mms: updating build control files for the new files "ftxf86.c" and "fttype1.c" in src/base
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 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344
diff --git a/ChangeLog b/ChangeLog
index 00c8ffc..b9558ca 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,22 @@
2005-05-28 David Turner <david@freetype.org>
+ * include/freetype/ftxf86.h, src/base/ftxf86.c: added a new API named
+ FT_Get_X11_Font_Format to return an X11-compatible string describing the
+ font format of a given face. This was put in a new optional base source
+ file, corresponding to a new public header (named FT_XFREE86_H since
+ this function should only be used within the XFree86 font server IMO).
+
+ * include/freetype/config/ftheader.h: adding FT_XFREE86_H, though it's
+ not documented yet.
+
+ * include/freetype/t1tables.h, src/base/fttype1.c: adding two new APIs
+ named "FT_Get_PS_Font_Info" and "FT_Has_PS_Glyph_Names". This required
+ a new optional source in 'src/base' named "fttype1.c"
+
+ * src/base/Jamfile, src/base/rules.mk, src/base/descrip.mms: updating
+ build control files for the new files "ftxf86.c" and "fttype1.c" in
+ src/base
+
* src/pshinter/pshglob.c (psh_blues_scale_zones): fixed a bug that
prevented family blue zones substitution from hapenning correctly
diff --git a/include/freetype/config/ftheader.h b/include/freetype/config/ftheader.h
index 0a6788c..3e26c96 100644
--- a/include/freetype/config/ftheader.h
+++ b/include/freetype/config/ftheader.h
@@ -496,6 +496,8 @@
#define FT_CACHE_INTERNAL_GLYPH_H <freetype/cache/ftcglyph.h>
#define FT_CACHE_INTERNAL_CACHE_H <freetype/cache/ftccache.h>
+#define FT_XFREE86_H <freetype/ftxf86.h>
+
/* now include internal headers definitions from <freetype/internal/...> */
#define FT_INTERNAL_INTERNAL_H <freetype/internal/internal.h>
diff --git a/include/freetype/ftxf86.h b/include/freetype/ftxf86.h
new file mode 100644
index 0000000..2f2f342
--- /dev/null
+++ b/include/freetype/ftxf86.h
@@ -0,0 +1,35 @@
+#ifndef __FT_XFREE86_H__
+#define __FT_XFREE86_H__
+
+#include <ft2build.h>
+#include FT_FREETYPE_H
+
+FT_BEGIN_HEADER
+
+ /* this comment is intentionally disabled for now, to prevent this */
+ /* function from appearing in the API Reference. */
+
+ /*@***********************************************************************/
+ /* */
+ /* <Function> */
+ /* FT_Get_X11_Font_Format */
+ /* */
+ /* <Description> */
+ /* Returns a string describing the format of a given face as a X11 */
+ /* FONT_PROPERTY. It should only be used by FreeType 2 font backend */
+ /* of the XFree86 font server. */
+ /* */
+ /* <Input> */
+ /* face :: input face handle. */
+ /* */
+ /* <Return> */
+ /* font format string. NULL in case of error. */
+ /* */
+ FT_EXPORT_DEF( const char* )
+ FT_Get_X11_Font_Format( FT_Face face );
+
+ /* */
+
+FT_END_HEADER
+
+#endif /* __FT_XFREE86_H__ */
diff --git a/include/freetype/t1tables.h b/include/freetype/t1tables.h
index 951a133..08f245f 100644
--- a/include/freetype/t1tables.h
+++ b/include/freetype/t1tables.h
@@ -186,7 +186,7 @@ FT_BEGIN_HEADER
} T1_Blend_Flags;
- /* backwards compatible definitions */
+ /*# backwards compatible definitions */
#define t1_blend_underline_position T1_BLEND_UNDERLINE_POSITION
#define t1_blend_underline_thickness T1_BLEND_UNDERLINE_THICKNESS
#define t1_blend_italic_angle T1_BLEND_ITALIC_ANGLE
@@ -317,10 +317,65 @@ FT_BEGIN_HEADER
/* FreeType. */
/* */
typedef CID_FaceInfoRec CID_Info;
-
+
/* */
+ /************************************************************************
+ *
+ * @function: FT_Has_PS_Glyph_Names
+ *
+ * @description:
+ * returns true when a given face provides reliable Postscript glyph
+ * names. This is similar to using the @FT_HAS_GLYPH_NAMES macro, except
+ * that certain fonts (mostly TrueType) contain incorrect glyph name
+ * tables.
+ *
+ * when this function returns true, the caller is sure that the glyph
+ * names returned by @FT_Get_Glyph_Name are reliable.
+ *
+ * @input:
+ * face :: face handle
+ *
+ * @return:
+ * boolean. true if glyph names are reliable
+ */
+ FT_EXPORT( FT_Int )
+ FT_Has_PS_Glyph_Names( FT_Face face );
+
+
+ /************************************************************************
+ *
+ * @function: FT_Get_PS_Font_Info
+ *
+ * @description:
+ * retrieve the @PS_FontInfoRec structure corresponding to a given
+ * Postscript font.
+ *
+ * @input:
+ * face :: postscript face handle
+ *
+ * @output:
+ * afont_info :: output font info structure pointer
+ *
+ * @return:
+ * 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_Info( FT_Face face,
+ PS_FontInfoRec *afont_info );
+
+ /* */
+
+
+
FT_END_HEADER
#endif /* __T1TABLES_H__ */
diff --git a/src/base/Jamfile b/src/base/Jamfile
index 76efd28..c579b3b 100644
--- a/src/base/Jamfile
+++ b/src/base/Jamfile
@@ -23,8 +23,8 @@ SubDirHdrs [ FT2_SubDir src base ] ;
# Add the optional/replaceable files.
#
-Library $(FT2_LIB) : ftsystem.c ftinit.c ftglyph.c ftmm.c ftbdf.c
- ftbbox.c ftdebug.c ;
+Library $(FT2_LIB) : ftsystem.c ftinit.c ftglyph.c ftmm.c ftbdf.c
+ ftbbox.c ftdebug.c ftxf86.c fttype1.c ;
# Add Macintosh-specific file to the library when necessary.
#
diff --git a/src/base/descrip.mms b/src/base/descrip.mms
index 83bb508..8639e04 100644
--- a/src/base/descrip.mms
+++ b/src/base/descrip.mms
@@ -15,7 +15,7 @@
CFLAGS=$(COMP_FLAGS)$(DEBUG)/include=([--.builds.vms],[--.include],[--.src.base])
-OBJS=ftbase.obj,ftinit.obj,ftglyph.obj,ftdebug.obj,ftbdf.obj,ftmm.obj
+OBJS=ftbase.obj,ftinit.obj,ftglyph.obj,ftdebug.obj,ftbdf.obj,ftmm.obj,fttype1.obj,ftxf86.obj
all : $(OBJS)
library [--.lib]freetype.olb $(OBJS)
diff --git a/src/base/fttype1.c b/src/base/fttype1.c
new file mode 100644
index 0000000..7445238
--- /dev/null
+++ b/src/base/fttype1.c
@@ -0,0 +1,74 @@
+#include <ft2build.h>
+#include FT_INTERNAL_TYPE1_TYPES_H
+#include FT_INTERNAL_OBJECTS_H
+
+ /* case a FT_Face to a T1_Face when relevant */
+ /* this implementation sucks, but a lot of things should change in the */
+ /* future anyway.. */
+ /* */
+ static T1_Face
+ t1_face_check_cast( FT_Face face )
+ {
+ FT_Module driver;
+ T1_Face result = NULL;
+
+ if ( face && face->driver != NULL )
+ {
+ driver = (FT_Module) face->driver;
+
+ if ( driver->clazz && driver->clazz->module_name &&
+ ft_strcmp( driver->clazz->module_name, "type1" ) == 0 )
+ {
+ /* correct typecast ! */
+ result = (T1_Face) face;
+ }
+ }
+ return result;
+ }
+
+
+
+ /* documentation is in t1tables.h */
+
+ FT_EXPORT_DEF( FT_Error )
+ FT_Get_PS_Font_Info( FT_Face face,
+ PS_FontInfoRec* afont_info )
+ {
+ FT_Error error = FT_Err_Invalid_Argument;
+ T1_Face t1_face = t1_face_check_cast( face );
+
+ if ( t1_face != NULL )
+ {
+ *afont_info = t1_face->type1.font_info;
+ error = FT_Err_Ok;
+ }
+ return error;
+ }
+
+
+ /* XXX: bad hack, but I didn't want to change several drivers here */
+
+ /* documentation is in t1tables.h */
+
+ FT_EXPORT_DEF( FT_Int )
+ FT_Has_PS_Glyph_Names( FT_Face face )
+ {
+ FT_Int result = 0;
+ const char* driver_name;
+
+ if ( face && face->driver && face->driver->root.clazz )
+ {
+ /* for now, only the type1 and cff drivers provide reliable */
+ /* glyph names... */
+
+ /* we could probably hack the TrueType driver to recognize */
+ /* certain cases where the glyph names are most certainly */
+ /* correct (e.g. using a 20 or 22 format 'post' table), but */
+ /* this will probably happen later... :-) */
+
+ driver_name = face->driver->root.clazz->module_name;
+ result = ( ft_strcmp( driver_name, "type1" ) ||
+ ft_strcmp( driver_name, "cff" ) );
+ }
+ return result;
+ }
diff --git a/src/base/ftxf86.c b/src/base/ftxf86.c
new file mode 100644
index 0000000..dd27c9a
--- /dev/null
+++ b/src/base/ftxf86.c
@@ -0,0 +1,56 @@
+#include <ft2build.h>
+#include FT_XFREE86_H
+#include FT_INTERNAL_OBJECTS_H
+
+ /* XXX: this really is a sad hack, but I didn't want to change every */
+ /* driver just to support this at the moment, since other important */
+ /* changes are coming anyway !! */
+
+ typedef struct
+ {
+ const char* driver_name;
+ const char* format_name;
+
+ } FT_FontFormatRec;
+
+
+ FT_EXPORT_DEF( const char* )
+ FT_Get_X11_Font_Format( FT_Face face )
+ {
+ static const FT_FontFormatRec font_formats[] =
+ {
+ { "type1", "Type 1" },
+ { "truetype", "TrueType" },
+ { "bdf", "BDF" },
+ { "pcf", "PCF" },
+ { "type42", "Type 42" },
+ { "cidtype1", "CID Type 1" },
+ { "cff", "CFF" },
+ { "pfr", "PFR" },
+ { "winfonts", "Windows FNT" }
+ };
+
+ const char* result = NULL;
+
+
+ if ( face && face->driver )
+ {
+ FT_Module driver = (FT_Module) face->driver;
+
+ if ( driver->clazz && driver->clazz->module_name )
+ {
+ FT_Int n, count = sizeof(font_formats)/sizeof(font_formats[0]);
+
+ result = driver->clazz->module_name;
+
+ for ( n = 0; n < count; n++ )
+ if ( ft_strcmp( result, font_formats[n].driver_name ) == 0 )
+ {
+ result = font_formats[n].format_name;
+ break;
+ }
+ }
+ }
+
+ return result;
+ }
diff --git a/src/base/rules.mk b/src/base/rules.mk
index b27611d..5f7816d 100644
--- a/src/base/rules.mk
+++ b/src/base/rules.mk
@@ -52,6 +52,8 @@ BASE_SRC := $(BASE_)ftcalc.c \
BASE_EXT_SRC := $(BASE_)ftglyph.c \
$(BASE_)ftmm.c \
$(BASE_)ftbdf.c \
+ $(BASE_)fttype1.c \
+ $(BASE_)ftxf86.c \
$(BASE_)ftbbox.c
# Default extensions objects