From 1316b813fd6cb092c37ed471bfe68551a4100935 Mon Sep 17 00:00:00 2001 From: Parth Wazurkar Date: Tue, 10 Jul 2018 15:08:47 +0530 Subject: [pk] Initialise pk driver files and Makefiles. --- src/pk/module.mk | 22 +++++++ src/pk/pk.c | 27 +++++++++ src/pk/pk.h | 38 ++++++++++++ src/pk/pkdrivr.c | 179 +++++++++++++++++++++++++++++++++++++++++++++++++++++++ src/pk/pkdrivr.h | 56 +++++++++++++++++ src/pk/pkerror.h | 40 +++++++++++++ src/pk/pklib.c | 59 ++++++++++++++++++ src/pk/rules.mk | 70 ++++++++++++++++++++++ 8 files changed, 491 insertions(+) create mode 100644 src/pk/module.mk create mode 100644 src/pk/pk.c create mode 100644 src/pk/pk.h create mode 100644 src/pk/pkdrivr.c create mode 100644 src/pk/pkdrivr.h create mode 100644 src/pk/pkerror.h create mode 100644 src/pk/pklib.c create mode 100644 src/pk/rules.mk diff --git a/src/pk/module.mk b/src/pk/module.mk new file mode 100644 index 000000000..df9fe1113 --- /dev/null +++ b/src/pk/module.mk @@ -0,0 +1,22 @@ +# +# FreeType 2 PK 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 += PK_DRIVER + +define GF_DRIVER +$(OPEN_DRIVER) FT_Driver_ClassRec, pk_driver_class $(CLOSE_DRIVER) +$(ECHO_DRIVER)pk $(ECHO_DRIVER_DESC)METAFONT bitmap fonts$(ECHO_DRIVER_DONE) +endef + +# EOF diff --git a/src/pk/pk.c b/src/pk/pk.c new file mode 100644 index 000000000..79c11cbc9 --- /dev/null +++ b/src/pk/pk.c @@ -0,0 +1,27 @@ +/**************************************************************************** + * + * pk.c + * + * FreeType font driver for TeX's PK 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 "pklib.c" +#include "pkdrivr.c" + + +/* END */ diff --git a/src/pk/pk.h b/src/pk/pk.h new file mode 100644 index 000000000..c0ef30564 --- /dev/null +++ b/src/pk/pk.h @@ -0,0 +1,38 @@ +/**************************************************************************** + * + * pk.h + * + * FreeType font driver for TeX's PK 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 PK_H_ +#define PK_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 /* PK_H_ */ + + +/* END */ diff --git a/src/pk/pkdrivr.c b/src/pk/pkdrivr.c new file mode 100644 index 000000000..4fbf35106 --- /dev/null +++ b/src/pk/pkdrivr.c @@ -0,0 +1,179 @@ +/**************************************************************************** + * + * pkdrivr.c + * + * FreeType font driver for TeX's PK 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 "pk.h" +#include "pkdrivr.h" +#include "pkerror.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_pkdriver + + + typedef struct PK_CMapRec_ + { + FT_CMapRec cmap; + /* TO-DO */ + } PK_CMapRec, *PK_CMap; + + + FT_CALLBACK_DEF( FT_Error ) + pk_cmap_init( FT_CMap pkcmap, + FT_Pointer init_data ) + { + /* TO-DO */ + return FT_Err_Ok; + } + + + FT_CALLBACK_DEF( void ) + pk_cmap_done( FT_CMap pkcmap ) + { + /* TO-DO */ + } + + + FT_CALLBACK_DEF( FT_UInt ) + pk_cmap_char_index( FT_CMap pkcmap, + FT_UInt32 char_code ) + { + /* TO-DO */ + return gindex; + } + + FT_CALLBACK_DEF( FT_UInt ) + pk_cmap_char_next( FT_CMap pkcmap, + FT_UInt32 *achar_code ) + { + /* To-DO */ + return gindex; + } + + + static + const FT_CMap_ClassRec pk_cmap_class = + { + sizeof ( PK_CMapRec ), + pk_cmap_init, + pk_cmap_done, + pk_cmap_char_index, + pk_cmap_char_next, + + NULL, NULL, NULL, NULL, NULL + }; + + + FT_CALLBACK_DEF( void ) + PK_Face_Done( FT_Face pkface ) /* PK_Face */ + { + /* TO-DO */ + } + + + FT_CALLBACK_DEF( FT_Error ) + PK_Face_Init( FT_Stream stream, + FT_Face pkface, /* PK_Face */ + FT_Int face_index, + FT_Int num_params, + FT_Parameter* params ) + { + /* TO-DO */ + } + + FT_CALLBACK_DEF( FT_Error ) + PK_Size_Select( FT_Size size, + FT_ULong strike_index ) + { + /* TO-DO */ + } + + FT_CALLBACK_DEF( FT_Error ) + PK_Size_Request( FT_Size size, + FT_Size_Request req ) + { + /* TO-DO */ + } + + + + FT_CALLBACK_DEF( FT_Error ) + PK_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 pk_driver_class = + { + { + FT_MODULE_FONT_DRIVER | + FT_MODULE_DRIVER_NO_OUTLINES, + sizeof ( FT_DriverRec ), + + "pk", + 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 ( PK_FaceRec ), + sizeof ( FT_SizeRec ), + sizeof ( FT_GlyphSlotRec ), + + PK_Face_Init, /* FT_Face_InitFunc init_face */ + PK_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 */ + + PK_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 */ + + PK_Size_Request, /* FT_Size_RequestFunc request_size */ + PK_Size_Select /* FT_Size_SelectFunc select_size */ + }; + + +/* END */ diff --git a/src/pk/pkdrivr.h b/src/pk/pkdrivr.h new file mode 100644 index 000000000..001b35ba3 --- /dev/null +++ b/src/pk/pkdrivr.h @@ -0,0 +1,56 @@ +/**************************************************************************** + * + * pkdrivr.h + * + * FreeType font driver for TeX's PK 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 PKDRIVR_H_ +#define PKDRIVR_H_ + +#include +#include FT_INTERNAL_DRIVER_H + +#include "pk.h" + + +FT_BEGIN_HEADER + + typedef struct PK_BitmapRec_ + { + FT_UInt bbx_width, bbx_height; + FT_UInt off_x, off_y; + FT_UInt mv_x, mv_y; + FT_Byte *bitmap; + FT_UInt raster; + + } PK_BitmapRec, *PK_Bitmap; + + typedef struct PK_FaceRec_ + { + FT_FaceRec root; + /* TO-DO */ + } PK_FaceRec, *PK_Face; + + + FT_EXPORT_VAR( const FT_Driver_ClassRec ) pk_driver_class; + + +FT_END_HEADER + + +#endif /* PKDRIVR_H_ */ + + +/* END */ diff --git a/src/pk/pkerror.h b/src/pk/pkerror.h new file mode 100644 index 000000000..00d200e25 --- /dev/null +++ b/src/pk/pkerror.h @@ -0,0 +1,40 @@ +/**************************************************************************** + * + * pkerror.h + * + * FreeType font driver for TeX's PK 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 PK error enumeration constants. + * + */ + +#ifndef PKERROR_H_ +#define PKERROR_H_ + +#include FT_MODULE_ERRORS_H + +#undef FTERRORS_H_ + +#undef FT_ERR_PREFIX +#define FT_ERR_PREFIX PK_Err_ +#define FT_ERR_BASE FT_Mod_Err_PK + +#include FT_ERRORS_H + +#endif /* PKERROR_H_ */ + + +/* END */ diff --git a/src/pk/pklib.c b/src/pk/pklib.c new file mode 100644 index 000000000..db4310b59 --- /dev/null +++ b/src/pk/pklib.c @@ -0,0 +1,59 @@ +/**************************************************************************** + * + * pklib.c + * + * FreeType font driver for TeX's PK 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 "pk.h" +#include "pkdrivr.h" +#include "pkerror.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_pklib + + /************************************************************************** + * + * PK font utility functions. + * + */ + + /* TO-DO */ + + /************************************************************************** + * + * API. + * + */ + + /* TO-DO */ + +/* END */ diff --git a/src/pk/rules.mk b/src/pk/rules.mk new file mode 100644 index 000000000..8d5501190 --- /dev/null +++ b/src/pk/rules.mk @@ -0,0 +1,70 @@ +# +# FreeType 2 PK 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. + + +# pk driver directory +# +PK_DIR := $(SRC_DIR)/pk + + +PK_COMPILE := $(CC) $(ANSIFLAGS) \ + $I$(subst /,$(COMPILER_SEP),$(PK_DIR)) \ + $(INCLUDE_FLAGS) \ + $(FT_CFLAGS) + + +# pk driver sources (i.e., C files) +# +PK_DRV_SRC := $(PK_DIR)/pklib.c \ + $(PK_DIR)/pkdrivr.c + + +# pk driver headers +# +PK_DRV_H := $(PK_DIR)/pk.h \ + $(PK_DIR)/pkdrivr.h \ + $(PK_DIR)/pkerror.h + +# pk driver object(s) +# +# PK_DRV_OBJ_M is used during `multi' builds +# PK_DRV_OBJ_S is used during `single' builds +# +PK_DRV_OBJ_M := $(PK_DRV_SRC:$(PK_DIR)/%.c=$(OBJ_DIR)/%.$O) +PK_DRV_OBJ_S := $(OBJ_DIR)/pk.$O + +# pk driver source file for single build +# +PK_DRV_SRC_S := $(PK_DIR)/pk.c + + +# pk driver - single object +# +$(PK_DRV_OBJ_S): $(PK_DRV_SRC_S) $(PK_DRV_SRC) $(FREETYPE_H) $(PK_DRV_H) + $(PK_COMPILE) $T$(subst /,$(COMPILER_SEP),$@ $(PK_DRV_SRC_S)) + + +# pk driver - multiple objects +# +$(OBJ_DIR)/%.$O: $(PK_DIR)/%.c $(FREETYPE_H) $(PK_DRV_H) + $(PK_COMPILE) $T$(subst /,$(COMPILER_SEP),$@ $<) + + +# update main driver object lists +# +DRV_OBJS_S += $(PK_DRV_OBJ_S) +DRV_OBJS_M += $(PK_DRV_OBJ_M) + + +# EOF -- cgit v1.2.1