From 1338d517c40e4a71ac697e83d82afeb2e621397d Mon Sep 17 00:00:00 2001 From: Parth Wazurkar Date: Sun, 24 Jun 2018 00:33:43 +0530 Subject: [PATCH] [tfm] Initialised TFM driver files. * src/tfm : Added all the driver source files and makefiles. --- src/tfm/README | 0 src/tfm/module.mk | 22 ++++++ src/tfm/rules.mk | 70 ++++++++++++++++++ src/tfm/tfm.c | 27 +++++++ src/tfm/tfm.h | 38 ++++++++++ src/tfm/tfmdrivr.c | 176 +++++++++++++++++++++++++++++++++++++++++++++ src/tfm/tfmdrivr.h | 46 ++++++++++++ src/tfm/tfmerror.h | 40 +++++++++++ src/tfm/tfmlib.c | 45 ++++++++++++ 9 files changed, 464 insertions(+) create mode 100644 src/tfm/README create mode 100644 src/tfm/module.mk create mode 100644 src/tfm/rules.mk create mode 100644 src/tfm/tfm.c create mode 100644 src/tfm/tfm.h create mode 100644 src/tfm/tfmdrivr.c create mode 100644 src/tfm/tfmdrivr.h create mode 100644 src/tfm/tfmerror.h create mode 100644 src/tfm/tfmlib.c diff --git a/src/tfm/README b/src/tfm/README new file mode 100644 index 000000000..e69de29bb diff --git a/src/tfm/module.mk b/src/tfm/module.mk new file mode 100644 index 000000000..00513046d --- /dev/null +++ b/src/tfm/module.mk @@ -0,0 +1,22 @@ +# +# FreeType 2 GF Font module definition +# + + +# Copyright 1996-2018 by +# David Turner, Robert Wilhelm, and Werner Lemberg. +# +# This file is part of the FreeType project, and may only be used, modified, +# and distributed under the terms of the FreeType project license, +# LICENSE.TXT. By continuing to use, modify, or distribute this file you +# indicate that you have read the license and understand and accept it +# fully. + +FTMODULE_H_COMMANDS += TFM_DRIVER + +define TFM_DRIVER +$(OPEN_DRIVER) FT_Driver_ClassRec, tfm_driver_class $(CLOSE_DRIVER) +$(ECHO_DRIVER)tfm $(ECHO_DRIVER_DESC)tfm TeX's bitmap fonts$(ECHO_DRIVER_DONE) +endef + +# EOF diff --git a/src/tfm/rules.mk b/src/tfm/rules.mk new file mode 100644 index 000000000..4bf58bf41 --- /dev/null +++ b/src/tfm/rules.mk @@ -0,0 +1,70 @@ +# +# FreeType 2 TFM driver configuration rules +# + + +# Copyright 1996-2018 by +# David Turner, Robert Wilhelm, and Werner Lemberg. +# +# This file is part of the FreeType project, and may only be used, modified, +# and distributed under the terms of the FreeType project license, +# LICENSE.TXT. By continuing to use, modify, or distribute this file you +# indicate that you have read the license and understand and accept it +# fully. + + +# tfm driver directory +# +TFM_DIR := $(SRC_DIR)/tfm + + +TFM_COMPILE := $(CC) $(ANSIFLAGS) \ + $I$(subst /,$(COMPILER_SEP),$(TFM_DIR)) \ + $(INCLUDE_FLAGS) \ + $(FT_CFLAGS) + + +# tfm driver sources (i.e., C files) +# +TFM_DRV_SRC := $(TFM_DIR)/tfmlib.c \ + $(TFM_DIR)/tfmdrivr.c + + +# tfm driver headers +# +TFM_DRV_H := $(TFM_DIR)/tfm.h \ + $(TFM_DIR)/tfmdrivr.h \ + $(TFM_DIR)/tfmerror.h + +# tfm driver object(s) +# +# TFM_DRV_OBJ_M is used during `multi' builds +# TFM_DRV_OBJ_S is used during `single' builds +# +TFM_DRV_OBJ_M := $(TFM_DRV_SRC:$(TFM_DIR)/%.c=$(OBJ_DIR)/%.$O) +TFM_DRV_OBJ_S := $(OBJ_DIR)/tfm.$O + +# tfm driver source file for single build +# +TFM_DRV_SRC_S := $(TFM_DIR)/tfm.c + + +# tfm driver - single object +# +$(TFM_DRV_OBJ_S): $(TFM_DRV_SRC_S) $(TFM_DRV_SRC) $(FREETYPE_H) $(TFM_DRV_H) + $(TFM_COMPILE) $T$(subst /,$(COMPILER_SEP),$@ $(TFM_DRV_SRC_S)) + + +# tfm driver - multiple objects +# +$(OBJ_DIR)/%.$O: $(TFM_DIR)/%.c $(FREETYPE_H) $(TFM_DRV_H) + $(TFM_COMPILE) $T$(subst /,$(COMPILER_SEP),$@ $<) + + +# update main driver object lists +# +DRV_OBJS_S += $(TFM_DRV_OBJ_S) +DRV_OBJS_M += $(TFM_DRV_OBJ_M) + + +# EOF diff --git a/src/tfm/tfm.c b/src/tfm/tfm.c new file mode 100644 index 000000000..26a58d9a7 --- /dev/null +++ b/src/tfm/tfm.c @@ -0,0 +1,27 @@ +/**************************************************************************** + * + * tfm.c + * + * FreeType font driver for TeX's TFM FONT files + * + * Copyright 1996-2018 by + * David Turner, Robert Wilhelm, and Werner Lemberg. + * + * This file is part of the FreeType project, and may only be used, + * modified, and distributed under the terms of the FreeType project + * license, LICENSE.TXT. By continuing to use, modify, or distribute + * this file you indicate that you have read the license and + * understand and accept it fully. + * + */ + + +#define FT_MAKE_OPTION_SINGLE_OBJECT + +#include + +#include "tfmlib.c" +#include "tfmdrivr.c" + + +/* END */ diff --git a/src/tfm/tfm.h b/src/tfm/tfm.h new file mode 100644 index 000000000..a783777d3 --- /dev/null +++ b/src/tfm/tfm.h @@ -0,0 +1,38 @@ +/**************************************************************************** + * + * tfm.h + * + * FreeType font driver for TeX's TFM FONT files + * + * Copyright 1996-2018 by + * David Turner, Robert Wilhelm, and Werner Lemberg. + * + * This file is part of the FreeType project, and may only be used, + * modified, and distributed under the terms of the FreeType project + * license, LICENSE.TXT. By continuing to use, modify, or distribute + * this file you indicate that you have read the license and + * understand and accept it fully. + * + */ + + +#ifndef TFM_H_ +#define TFM_H_ + +#include +#include FT_INTERNAL_OBJECTS_H +#include FT_INTERNAL_STREAM_H +#include FT_SYSTEM_H + + +FT_BEGIN_HEADER + +/* TO-DO */ + +FT_END_HEADER + + +#endif /* TFM_H_ */ + + +/* END */ diff --git a/src/tfm/tfmdrivr.c b/src/tfm/tfmdrivr.c new file mode 100644 index 000000000..563d01af4 --- /dev/null +++ b/src/tfm/tfmdrivr.c @@ -0,0 +1,176 @@ +/**************************************************************************** + * + * tfmdrivr.c + * + * FreeType font driver for TeX's TFM FONT files + * + * Copyright 1996-2018 by + * David Turner, Robert Wilhelm, and Werner Lemberg. + * + * This file is part of the FreeType project, and may only be used, + * modified, and distributed under the terms of the FreeType project + * license, LICENSE.TXT. By continuing to use, modify, or distribute + * this file you indicate that you have read the license and + * understand and accept it fully. + * + */ + +#include + +#include FT_INTERNAL_DEBUG_H +#include FT_INTERNAL_STREAM_H +#include FT_INTERNAL_OBJECTS_H +#include FT_TRUETYPE_IDS_H +#include FT_SERVICE_FONT_FORMAT_H + + +#include "tfm.h" +#include "tfmdrivr.h" +#include "tfmerror.h" + + + /************************************************************************** + * + * The macro FT_COMPONENT is used in trace mode. It is an implicit + * parameter of the FT_TRACE() and FT_ERROR() macros, used to print/log + * messages during execution. + */ +#undef FT_COMPONENT +#define FT_COMPONENT trace_tfmdriver + + + typedef struct TFM_CMapRec_ + { + FT_CMapRec cmap; + /* TO-DO */ + } TFM_CMapRec, *TFM_CMap; + + + FT_CALLBACK_DEF( FT_Error ) + tfm_cmap_init( FT_CMap tfmcmap, + FT_Pointer init_data ) + { + /* TO-DO */ + } + + + FT_CALLBACK_DEF( void ) + tfm_cmap_done( FT_CMap tfmcmap ) + { + /* TO-DO */ + } + + + FT_CALLBACK_DEF( FT_UInt ) + tfm_cmap_char_index( FT_CMap tfmcmap, + FT_UInt32 char_code ) + { + /* TO-DO */ + } + + FT_CALLBACK_DEF( FT_UInt ) + tfm_cmap_char_next( FT_CMap tfmcmap, + FT_UInt32 *achar_code ) + { + /* TO-DO */ + } + + + static + const FT_CMap_ClassRec tfm_cmap_class = + { + sizeof ( TFM_CMapRec ), + tfm_cmap_init, + tfm_cmap_done, + tfm_cmap_char_index, + tfm_cmap_char_next, + + NULL, NULL, NULL, NULL, NULL + }; + + + FT_CALLBACK_DEF( void ) + TFM_Face_Done( FT_Face tfmface ) /* TFM_Face */ + { + /* TO-DO */ + } + + + FT_CALLBACK_DEF( FT_Error ) + TFM_Face_Init( FT_Stream stream, + FT_Face tfmface, /* TFM_Face */ + FT_Int face_index, + FT_Int num_params, + FT_Parameter* params ) + { + /* TO-DO */ + } + + FT_CALLBACK_DEF( FT_Error ) + TFM_Size_Select( FT_Size size, + FT_ULong strike_index ) + { + /* TO-DO */ + } + + FT_CALLBACK_DEF( FT_Error ) + TFM_Size_Request( FT_Size size, + FT_Size_Request req ) + { + /* TO-DO */ + } + + + + FT_CALLBACK_DEF( FT_Error ) + TFM_Glyph_Load( FT_GlyphSlot slot, + FT_Size size, + FT_UInt glyph_index, + FT_Int32 load_flags ) + { + /* TO-DO */ + } + + + FT_CALLBACK_TABLE_DEF + const FT_Driver_ClassRec tfm_driver_class = + { + { + FT_MODULE_FONT_DRIVER | + FT_MODULE_DRIVER_NO_OUTLINES, + sizeof ( FT_DriverRec ), + + "tfm", + 0x10000L, + 0x20000L, + + NULL, /* module-specific interface */ + + NULL, /* FT_Module_Constructor module_init */ + NULL, /* FT_Module_Destructor module_done */ + NULL /* FT_Module_Requester get_interface */ + }, + + sizeof ( TFM_FaceRec ), + sizeof ( FT_SizeRec ), + sizeof ( FT_GlyphSlotRec ), + + TFM_Face_Init, /* FT_Face_InitFunc init_face */ + TFM_Face_Done, /* FT_Face_DoneFunc done_face */ + NULL, /* FT_Size_InitFunc init_size */ + NULL, /* FT_Size_DoneFunc done_size */ + NULL, /* FT_Slot_InitFunc init_slot */ + NULL, /* FT_Slot_DoneFunc done_slot */ + + TFM_Glyph_Load, /* FT_Slot_LoadFunc load_glyph */ + + NULL, /* FT_Face_GetKerningFunc get_kerning */ + NULL, /* FT_Face_AttachFunc attach_file */ + NULL, /* FT_Face_GetAdvancesFunc get_advances */ + + TFM_Size_Request, /* FT_Size_RequestFunc request_size */ + TFM_Size_Select /* FT_Size_SelectFunc select_size */ + }; + + +/* END */ diff --git a/src/tfm/tfmdrivr.h b/src/tfm/tfmdrivr.h new file mode 100644 index 000000000..07b76283d --- /dev/null +++ b/src/tfm/tfmdrivr.h @@ -0,0 +1,46 @@ +/**************************************************************************** + * + * tfmdrivr.h + * + * FreeType font driver for TeX's TFM FONT files + * + * Copyright 1996-2018 by + * David Turner, Robert Wilhelm, and Werner Lemberg. + * + * This file is part of the FreeType project, and may only be used, + * modified, and distributed under the terms of the FreeType project + * license, LICENSE.TXT. By continuing to use, modify, or distribute + * this file you indicate that you have read the license and + * understand and accept it fully. + * + */ + + +#ifndef TFMDRIVR_H_ +#define TFMDRIVR_H_ + +#include +#include FT_INTERNAL_DRIVER_H + +#include "tfm.h" + + +FT_BEGIN_HEADER + + typedef struct TFM_FaceRec_ + { + FT_FaceRec root; + /* TO-DO */ + } TFM_FaceRec, *TFM_Face; + + + FT_EXPORT_VAR( const FT_Driver_ClassRec ) tfm_driver_class; + + +FT_END_HEADER + + +#endif /* TFMDRIVR_H_ */ + + +/* END */ diff --git a/src/tfm/tfmerror.h b/src/tfm/tfmerror.h new file mode 100644 index 000000000..f2df33e93 --- /dev/null +++ b/src/tfm/tfmerror.h @@ -0,0 +1,40 @@ +/**************************************************************************** + * + * gferror.h + * + * FreeType font driver for TeX's GF FONT files + * + * Copyright 1996-2018 by + * David Turner, Robert Wilhelm, and Werner Lemberg. + * + * This file is part of the FreeType project, and may only be used, + * modified, and distributed under the terms of the FreeType project + * license, LICENSE.TXT. By continuing to use, modify, or distribute + * this file you indicate that you have read the license and + * understand and accept it fully. + * + */ + + /************************************************************************** + * + * This file is used to define the GF error enumeration constants. + * + */ + +#ifndef GFERROR_H_ +#define GFERROR_H_ + +#include FT_MODULE_ERRORS_H + +#undef FTERRORS_H_ + +#undef FT_ERR_PREFIX +#define FT_ERR_PREFIX GF_Err_ +#define FT_ERR_BASE FT_Mod_Err_GF + +#include FT_ERRORS_H + +#endif /* GFERROR_H_ */ + + +/* END */ diff --git a/src/tfm/tfmlib.c b/src/tfm/tfmlib.c new file mode 100644 index 000000000..4d4709976 --- /dev/null +++ b/src/tfm/tfmlib.c @@ -0,0 +1,45 @@ +/**************************************************************************** + * + * tfmlib.c + * + * FreeType font driver for TeX's TFM FONT files + * + * Copyright 1996-2018 by + * David Turner, Robert Wilhelm, and Werner Lemberg. + * + * This file is part of the FreeType project, and may only be used, + * modified, and distributed under the terms of the FreeType project + * license, LICENSE.TXT. By continuing to use, modify, or distribute + * this file you indicate that you have read the license and + * understand and accept it fully. + * + */ + +#include + +#include FT_FREETYPE_H +#include FT_INTERNAL_DEBUG_H +#include FT_INTERNAL_STREAM_H +#include FT_INTERNAL_OBJECTS_H +#include FT_SYSTEM_H +#include FT_CONFIG_CONFIG_H +#include FT_ERRORS_H +#include FT_TYPES_H + +#include "tfm.h" +#include "tfmdrivr.h" +#include "tfmerror.h" + + + /************************************************************************** + * + * The macro FT_COMPONENT is used in trace mode. It is an implicit + * parameter of the FT_TRACE() and FT_ERROR() macros, used to print/log + * messages during execution. + */ +#undef FT_COMPONENT +#define FT_COMPONENT trace_tfmlib + +/* TO-DO */ + +/* END */