From 1d1043b1754ad0110fe848b506f57588bd29bb26 Mon Sep 17 00:00:00 2001 From: David Turner Date: Fri, 17 Jan 2003 08:40:32 +0000 Subject: [PATCH] adding missing source file --- include/freetype/ftwinfnt.h | 129 ++++++++++++++++++++++++++++++++++++ src/base/ftwinfnt.c | 55 +++++++++++++++ 2 files changed, 184 insertions(+) create mode 100644 include/freetype/ftwinfnt.h create mode 100644 src/base/ftwinfnt.c diff --git a/include/freetype/ftwinfnt.h b/include/freetype/ftwinfnt.h new file mode 100644 index 000000000..6d29fe16a --- /dev/null +++ b/include/freetype/ftwinfnt.h @@ -0,0 +1,129 @@ +/***************************************************************************/ +/* */ +/* ftwinfnt.h */ +/* */ +/* FreeType API for accessing Windows fnt-specific data. */ +/* */ +/* Copyright 2002 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 __FTWINFNT_H__ +#define __FTWINFNT_H__ + +#include +#include FT_FREETYPE_H + + +FT_BEGIN_HEADER + + + /*************************************************************************/ + /* */ + /*
*/ + /* winfnt_fonts */ + /* */ + /* */ + /* Window FNT Fonts */ + /* */ + /* <Abstract> */ + /* Windows FNT specific APIs */ + /* */ + /* <Description> */ + /* This section contains the declaration of Windows FNT specific */ + /* functions. */ + /* */ + /*************************************************************************/ + + /*************************************************************************/ + /* */ + /* <Struct> */ + /* FT_WinFNT_HeaderRec_ */ + /* */ + /* <Description> */ + /* Windows FNT Header info. */ + /* */ + typedef struct FT_WinFNT_HeaderRec_ + { + FT_UShort version; + FT_ULong file_size; + FT_Byte copyright[60]; + FT_UShort file_type; + FT_UShort nominal_point_size; + FT_UShort vertical_resolution; + FT_UShort horizontal_resolution; + FT_UShort ascent; + FT_UShort internal_leading; + FT_UShort external_leading; + FT_Byte italic; + FT_Byte underline; + FT_Byte strike_out; + FT_UShort weight; + FT_Byte charset; + FT_UShort pixel_width; + FT_UShort pixel_height; + FT_Byte pitch_and_family; + FT_UShort avg_width; + FT_UShort max_width; + FT_Byte first_char; + FT_Byte last_char; + FT_Byte default_char; + FT_Byte break_char; + FT_UShort bytes_per_row; + FT_ULong device_offset; + FT_ULong face_name_offset; + FT_ULong bits_pointer; + FT_ULong bits_offset; + FT_Byte reserved; + FT_ULong flags; + FT_UShort A_space; + FT_UShort B_space; + FT_UShort C_space; + FT_UShort color_table_offset; + FT_ULong reserved1[4]; + + } FT_WinFNT_HeaderRec, *FT_WinFNT_Header; + + + + /********************************************************************** + * + * @function: + * FT_Get_WinFNT_Header + * + * @description: + * Retrieves a Windows FNT font info header. + * + * @input: + * face :: handle to input face + * + * @output: + * header :: WinFNT header. + * + * @return: + * FreeType error code. 0 means success. + * + * @note: + * This function only works with Windows FNT faces, returning an erro + * otherwise. + */ + FT_EXPORT( FT_Error ) + FT_Get_WinFNT_Header( FT_Face face, + FT_WinFNT_HeaderRec *header ); + + /* */ + +FT_END_HEADER + +#endif /* __FTWINFNT_H__ */ + + +/* END */ diff --git a/src/base/ftwinfnt.c b/src/base/ftwinfnt.c new file mode 100644 index 000000000..88644e954 --- /dev/null +++ b/src/base/ftwinfnt.c @@ -0,0 +1,55 @@ +/***************************************************************************/ +/* */ +/* ftwinfnt.c */ +/* */ +/* FreeType API for accessing Windows FNT specific info (body). */ +/* */ +/* Copyright 2002 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 <ft2build.h> +#include FT_WINFONTS_H +#include FT_INTERNAL_FNT_TYPES_H +#include FT_INTERNAL_OBJECTS_H + + + FT_EXPORT_DEF( FT_Error ) + FT_Get_WinFNT_Header( FT_Face face, + FT_WinFNT_HeaderRec *header ) + { + FT_Error error; + + error = FT_Err_Invalid_Argument; + + if ( face != NULL && face->driver != NULL ) + { + FT_Module driver = (FT_Module) face->driver; + + + if ( driver->clazz && driver->clazz->module_name && + ft_strcmp( driver->clazz->module_name, "winfonts" ) == 0 ) + { + FNT_Size size = (FNT_Size)face->size; + FNT_Font font = size->font; + + if (font) + { + FT_MEM_COPY( header, &font->header, sizeof(*header) ); + error = 0; + } + } + } + return error; + } + + +/* END */