summaryrefslogtreecommitdiffstats
path: root/src/psnames
diff options
context:
space:
mode:
Diffstat (limited to 'src/psnames')
-rw-r--r--src/psnames/psmodule.c58
-rw-r--r--src/psnames/pspic.c19
-rw-r--r--src/psnames/pspic.h23
3 files changed, 54 insertions, 46 deletions
diff --git a/src/psnames/psmodule.c b/src/psnames/psmodule.c
index 3619174..0a5bcb7 100644
--- a/src/psnames/psmodule.c
+++ b/src/psnames/psmodule.c
@@ -4,7 +4,7 @@
/* */
/* PSNames module implementation (body). */
/* */
-/* Copyright 1996-2001, 2002, 2003, 2005, 2006, 2007, 2008 by */
+/* Copyright 1996-2003, 2005-2008, 2012, 2013 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */
/* This file is part of the FreeType project, and may only be used, */
@@ -17,6 +17,7 @@
#include <ft2build.h>
+#include FT_INTERNAL_DEBUG_H
#include FT_INTERNAL_OBJECTS_H
#include FT_SERVICE_POSTSCRIPT_CMAPS_H
@@ -369,7 +370,7 @@
/* No unicode chars here! */
FT_FREE( table->maps );
if ( !error )
- error = PSnames_Err_No_Unicode_Glyph_Name;
+ error = FT_THROW( No_Unicode_Glyph_Name );
}
else
{
@@ -377,7 +378,7 @@
if ( count < num_glyphs / 2 )
{
(void)FT_RENEW_ARRAY( table->maps, num_glyphs, count );
- error = PSnames_Err_Ok;
+ error = FT_Err_Ok;
}
/* Sort the table in increasing order of unicode values, */
@@ -521,7 +522,9 @@
#ifdef FT_CONFIG_OPTION_ADOBE_GLYPH_LIST
- FT_DEFINE_SERVICE_PSCMAPSREC(pscmaps_interface,
+
+ FT_DEFINE_SERVICE_PSCMAPSREC(
+ pscmaps_interface,
(PS_Unicode_ValueFunc) ps_unicode_value,
(PS_Unicodes_InitFunc) ps_unicodes_init,
(PS_Unicodes_CharIndexFunc)ps_unicodes_char_index,
@@ -531,39 +534,36 @@
(PS_Adobe_Std_StringsFunc) ps_get_standard_strings,
t1_standard_encoding,
- t1_expert_encoding
- )
+ t1_expert_encoding )
#else
- FT_DEFINE_SERVICE_PSCMAPSREC(pscmaps_interface,
- 0,
- 0,
- 0,
- 0,
+ FT_DEFINE_SERVICE_PSCMAPSREC(
+ pscmaps_interface,
+ NULL,
+ NULL,
+ NULL,
+ NULL,
(PS_Macintosh_NameFunc) ps_get_macintosh_name,
(PS_Adobe_Std_StringsFunc) ps_get_standard_strings,
t1_standard_encoding,
- t1_expert_encoding
- )
+ t1_expert_encoding )
#endif /* FT_CONFIG_OPTION_ADOBE_GLYPH_LIST */
- FT_DEFINE_SERVICEDESCREC1(pscmaps_services,
- FT_SERVICE_ID_POSTSCRIPT_CMAPS, &FT_PSCMAPS_INTERFACE_GET
- )
-
-
+ FT_DEFINE_SERVICEDESCREC1(
+ pscmaps_services,
+ FT_SERVICE_ID_POSTSCRIPT_CMAPS, &PSCMAPS_INTERFACE_GET )
static FT_Pointer
psnames_get_service( FT_Module module,
const char* service_id )
{
- /* FT_PSCMAPS_SERVICES_GET derefers `library' in PIC mode */
+ /* PSCMAPS_SERVICES_GET derefers `library' in PIC mode */
#ifdef FT_CONFIG_OPTION_PIC
FT_Library library;
@@ -577,19 +577,20 @@
FT_UNUSED( module );
#endif
- return ft_service_list_lookup( FT_PSCMAPS_SERVICES_GET, service_id );
+ return ft_service_list_lookup( PSCMAPS_SERVICES_GET, service_id );
}
#endif /* FT_CONFIG_OPTION_POSTSCRIPT_NAMES */
#ifndef FT_CONFIG_OPTION_POSTSCRIPT_NAMES
-#define PUT_PS_NAMES_SERVICE(a) 0
+#define PUT_PS_NAMES_SERVICE( a ) NULL
#else
-#define PUT_PS_NAMES_SERVICE(a) a
+#define PUT_PS_NAMES_SERVICE( a ) a
#endif
- FT_DEFINE_MODULE(psnames_module_class,
+ FT_DEFINE_MODULE(
+ psnames_module_class,
0, /* this is not a font driver, nor a renderer */
sizeof ( FT_ModuleRec ),
@@ -598,12 +599,11 @@
0x10000L, /* driver version */
0x20000L, /* driver requires FreeType 2 or above */
- PUT_PS_NAMES_SERVICE((void*)&FT_PSCMAPS_INTERFACE_GET), /* module specific interface */
- (FT_Module_Constructor)0,
- (FT_Module_Destructor) 0,
- (FT_Module_Requester) PUT_PS_NAMES_SERVICE(psnames_get_service)
- )
-
+ PUT_PS_NAMES_SERVICE(
+ (void*)&PSCMAPS_INTERFACE_GET ), /* module specific interface */
+ (FT_Module_Constructor)NULL,
+ (FT_Module_Destructor) NULL,
+ (FT_Module_Requester) PUT_PS_NAMES_SERVICE( psnames_get_service ) )
/* END */
diff --git a/src/psnames/pspic.c b/src/psnames/pspic.c
index 467ab73..3820f65 100644
--- a/src/psnames/pspic.c
+++ b/src/psnames/pspic.c
@@ -4,7 +4,7 @@
/* */
/* The FreeType position independent code services for psnames module. */
/* */
-/* Copyright 2009, 2010 by */
+/* Copyright 2009, 2010, 2012, 2013 by */
/* Oran Agra and Mickey Gabel. */
/* */
/* This file is part of the FreeType project, and may only be used, */
@@ -22,6 +22,7 @@
#include "pspic.h"
#include "psnamerr.h"
+
#ifdef FT_CONFIG_OPTION_PIC
/* forward declaration of PIC init functions from psmodule.c */
@@ -36,11 +37,12 @@
FT_Init_Class_pscmaps_interface( FT_Library library,
FT_Service_PsCMapsRec* clazz );
+
void
psnames_module_class_pic_free( FT_Library library )
{
FT_PIC_Container* pic_container = &library->pic_container;
- FT_Memory memory = library->memory;
+ FT_Memory memory = library->memory;
if ( pic_container->psnames )
@@ -48,7 +50,7 @@
PSModulePIC* container = (PSModulePIC*)pic_container->psnames;
- if(container->pscmaps_services)
+ if ( container->pscmaps_services )
FT_Destroy_Class_pscmaps_services( library,
container->pscmaps_services );
container->pscmaps_services = NULL;
@@ -62,18 +64,19 @@
psnames_module_class_pic_init( FT_Library library )
{
FT_PIC_Container* pic_container = &library->pic_container;
- FT_Error error = PSnames_Err_Ok;
- PSModulePIC* container;
+ FT_Error error = FT_Err_Ok;
+ PSModulePIC* container = NULL;
FT_Memory memory = library->memory;
/* allocate pointer, clear and set global container pointer */
- if ( FT_ALLOC ( container, sizeof ( *container ) ) )
+ if ( FT_ALLOC( container, sizeof ( *container ) ) )
return error;
FT_MEM_SET( container, 0, sizeof ( *container ) );
pic_container->psnames = container;
- /* initialize pointer table - this is how the module usually expects this data */
+ /* initialize pointer table - */
+ /* this is how the module usually expects this data */
error = FT_Create_Class_pscmaps_services(
library, &container->pscmaps_services );
if ( error )
@@ -81,7 +84,7 @@
FT_Init_Class_pscmaps_interface( library,
&container->pscmaps_interface );
-Exit:
+ Exit:
if ( error )
psnames_module_class_pic_free( library );
return error;
diff --git a/src/psnames/pspic.h b/src/psnames/pspic.h
index 1169b89..6ff002c 100644
--- a/src/psnames/pspic.h
+++ b/src/psnames/pspic.h
@@ -4,7 +4,7 @@
/* */
/* The FreeType position independent code services for psnames module. */
/* */
-/* Copyright 2009 by */
+/* Copyright 2009, 2012 by */
/* Oran Agra and Mickey Gabel. */
/* */
/* This file is part of the FreeType project, and may only be used, */
@@ -25,22 +25,27 @@ FT_BEGIN_HEADER
#include FT_INTERNAL_PIC_H
#ifndef FT_CONFIG_OPTION_PIC
-#define FT_PSCMAPS_SERVICES_GET pscmaps_services
-#define FT_PSCMAPS_INTERFACE_GET pscmaps_interface
+
+#define PSCMAPS_SERVICES_GET pscmaps_services
+#define PSCMAPS_INTERFACE_GET pscmaps_interface
#else /* FT_CONFIG_OPTION_PIC */
#include FT_SERVICE_POSTSCRIPT_CMAPS_H
- typedef struct PSModulePIC_
+ typedef struct PSModulePIC_
{
- FT_ServiceDescRec* pscmaps_services;
- FT_Service_PsCMapsRec pscmaps_interface;
+ FT_ServiceDescRec* pscmaps_services;
+ FT_Service_PsCMapsRec pscmaps_interface;
+
} PSModulePIC;
-#define GET_PIC(lib) ((PSModulePIC*)((lib)->pic_container.psnames))
-#define FT_PSCMAPS_SERVICES_GET (GET_PIC(library)->pscmaps_services)
-#define FT_PSCMAPS_INTERFACE_GET (GET_PIC(library)->pscmaps_interface)
+
+#define GET_PIC( lib ) \
+ ( (PSModulePIC*)((lib)->pic_container.psnames) )
+#define PSCMAPS_SERVICES_GET ( GET_PIC( library )->pscmaps_services )
+#define PSCMAPS_INTERFACE_GET ( GET_PIC( library )->pscmaps_interface )
+
/* see pspic.c for the implementation */
void