[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Devel] TT CMap Info service for cff
From: |
Masatake YAMATO |
Subject: |
[Devel] TT CMap Info service for cff |
Date: |
Sun, 18 Jan 2004 03:15:55 +0900 (JST) |
> > I've defined a almost empty method to cff's FT_SERVICE_ID_TT_CMAP.
> > I don't know well about cff however, if cff(ps?) supports something
> > like language ID, you can hack the empty method.
>
> An OpenType CFF font uses the SFNT format, so it has OpenType CMaps.
> On the other hand, a bare CFF font should return zero. It should be
> sufficient to call the cmap service from the sfnt module for the
> former case. Can you implement this?
>
>
> Werner
Here is the patch.
2004-01-18 Masatake YAMATO <address@hidden>
* src/cff/cffdrivr.c (cff_get_cmap_info): call
sfnt module's TT CMap Info service function if the cmap
comes from sfnt. Just return 0 if the cmap is synchronized
in cff module
Index: src/cff/cffdrivr.c
===================================================================
RCS file: /cvsroot/freetype2/src/cff/cffdrivr.c,v
retrieving revision 1.49
diff -u -r1.49 cffdrivr.c
--- cffdrivr.c 2004/01/11 10:01:08 1.49
+++ cffdrivr.c 2004/01/17 18:10:17
@@ -29,6 +29,7 @@
#include "cffdrivr.h"
#include "cffgload.h"
#include "cffload.h"
+#include "cffcmap.h"
#include "cfferrs.h"
@@ -340,22 +341,37 @@
/*
- * (empty) TT CMAP INFO
+ * TT CMAP INFO
*
- * Hide TT CMAP INFO service defined in SFNT module;
- * just return 0.
+ * If charmap is "SYNTHETIC UNICODE ENCODING CMAP" or
+ * "TYPE1 STANDARD (AND EXPERT) ENCODING CMAPS", hide TT CMAP INFO
+ * service defined in SFNT module; and just return CFF_Err_Ok.
+ * If not(the cmap is created in the sfnt module), call the service
+ * function in the sfnt.
*
*/
-
static FT_Error
cff_get_cmap_info( FT_CharMap charmap,
- TT_CMapInfo *cmap_info )
+ TT_CMapInfo *cmap_info )
{
- FT_UNUSED( charmap );
+ FT_CMap cmap = FT_CMAP(charmap);
+ FT_Error error = CFF_Err_Ok;
+
cmap_info->language = 0;
- return CFF_Err_Ok;
+ if ( ( cmap->clazz != ( &cff_cmap_encoding_class_rec ) ) &&
+ ( cmap->clazz != ( &cff_cmap_unicode_class_rec ) ) )
+ {
+ FT_Face face = FT_CMAP_FACE( cmap );
+ FT_Library library = FT_FACE_LIBRARY( face );
+ FT_Module sfnt = FT_Get_Module( library, "sfnt" );
+ FT_Service_TTCMaps service = ft_module_get_service ( sfnt,
+
FT_SERVICE_ID_TT_CMAP );
+ if ( service && service->get_cmap_info )
+ error = service->get_cmap_info( charmap, cmap_info );
+ }
+ return error;
}
- [Devel] TT CMap Info service for cff,
Masatake YAMATO <=