2018-06-03 09:01:17 +02:00
|
|
|
/****************************************************************************
|
|
|
|
*
|
|
|
|
* pfrload.h
|
|
|
|
*
|
|
|
|
* FreeType PFR loader (specification).
|
|
|
|
*
|
2022-01-11 10:54:10 +01:00
|
|
|
* Copyright (C) 2002-2022 by
|
2018-06-03 09:01:17 +02:00
|
|
|
* 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.
|
|
|
|
*
|
|
|
|
*/
|
2002-04-20 07:38:33 +02:00
|
|
|
|
|
|
|
|
2016-01-12 21:37:13 +01:00
|
|
|
#ifndef PFRLOAD_H_
|
|
|
|
#define PFRLOAD_H_
|
2002-04-19 17:13:47 +02:00
|
|
|
|
|
|
|
#include "pfrobjs.h"
|
2020-06-08 13:31:55 +02:00
|
|
|
#include <freetype/internal/ftstream.h>
|
2002-04-19 17:13:47 +02:00
|
|
|
|
2002-04-20 07:38:33 +02:00
|
|
|
|
2002-04-19 17:13:47 +02:00
|
|
|
FT_BEGIN_HEADER
|
|
|
|
|
2015-10-27 21:04:48 +01:00
|
|
|
/* some size checks should be always done (mainly to prevent */
|
|
|
|
/* excessive allocation for malformed data), ... */
|
|
|
|
#define PFR_CHECK_SIZE( x ) do \
|
|
|
|
{ \
|
|
|
|
if ( p + (x) > limit ) \
|
|
|
|
goto Too_Short; \
|
|
|
|
} while ( 0 )
|
|
|
|
|
|
|
|
/* ... and some only if intensive checking is explicitly requested */
|
2002-04-19 17:13:47 +02:00
|
|
|
#ifdef PFR_CONFIG_NO_CHECKS
|
2002-04-20 07:38:33 +02:00
|
|
|
#define PFR_CHECK( x ) do { } while ( 0 )
|
2002-04-19 17:13:47 +02:00
|
|
|
#else
|
2015-10-27 21:04:48 +01:00
|
|
|
#define PFR_CHECK PFR_CHECK_SIZE
|
2002-04-19 17:13:47 +02:00
|
|
|
#endif
|
|
|
|
|
2002-04-20 07:38:33 +02:00
|
|
|
#define PFR_NEXT_BYTE( p ) FT_NEXT_BYTE( p )
|
|
|
|
#define PFR_NEXT_INT8( p ) FT_NEXT_CHAR( p )
|
|
|
|
#define PFR_NEXT_SHORT( p ) FT_NEXT_SHORT( p )
|
|
|
|
#define PFR_NEXT_USHORT( p ) FT_NEXT_USHORT( p )
|
|
|
|
#define PFR_NEXT_LONG( p ) FT_NEXT_OFF3( p )
|
|
|
|
#define PFR_NEXT_ULONG( p ) FT_NEXT_UOFF3( p )
|
|
|
|
|
2002-04-19 17:13:47 +02:00
|
|
|
|
|
|
|
/* handling extra items */
|
|
|
|
|
2002-04-20 07:38:33 +02:00
|
|
|
typedef FT_Error
|
|
|
|
(*PFR_ExtraItem_ParseFunc)( FT_Byte* p,
|
|
|
|
FT_Byte* limit,
|
|
|
|
FT_Pointer data );
|
|
|
|
|
|
|
|
typedef struct PFR_ExtraItemRec_
|
2002-04-19 17:13:47 +02:00
|
|
|
{
|
|
|
|
FT_UInt type;
|
|
|
|
PFR_ExtraItem_ParseFunc parser;
|
2007-01-16 07:11:27 +01:00
|
|
|
|
2002-04-19 17:13:47 +02:00
|
|
|
} PFR_ExtraItemRec;
|
2007-01-16 07:11:27 +01:00
|
|
|
|
2002-04-19 17:13:47 +02:00
|
|
|
typedef const struct PFR_ExtraItemRec_* PFR_ExtraItem;
|
2007-01-16 07:11:27 +01:00
|
|
|
|
2002-04-20 07:38:33 +02:00
|
|
|
|
2002-04-19 17:13:47 +02:00
|
|
|
FT_LOCAL( FT_Error )
|
2002-04-20 07:38:33 +02:00
|
|
|
pfr_extra_items_skip( FT_Byte* *pp,
|
|
|
|
FT_Byte* limit );
|
2002-04-19 17:13:47 +02:00
|
|
|
|
|
|
|
FT_LOCAL( FT_Error )
|
|
|
|
pfr_extra_items_parse( FT_Byte* *pp,
|
|
|
|
FT_Byte* limit,
|
|
|
|
PFR_ExtraItem item_list,
|
|
|
|
FT_Pointer item_data );
|
|
|
|
|
|
|
|
|
2002-04-20 07:38:33 +02:00
|
|
|
/* load a PFR header */
|
2002-04-19 17:13:47 +02:00
|
|
|
FT_LOCAL( FT_Error )
|
|
|
|
pfr_header_load( PFR_Header header,
|
|
|
|
FT_Stream stream );
|
|
|
|
|
2002-04-20 07:38:33 +02:00
|
|
|
/* check a PFR header */
|
2002-04-19 17:13:47 +02:00
|
|
|
FT_LOCAL( FT_Bool )
|
|
|
|
pfr_header_check( PFR_Header header );
|
|
|
|
|
|
|
|
|
2002-04-20 07:38:33 +02:00
|
|
|
/* return number of logical fonts in this file */
|
2002-04-19 17:13:47 +02:00
|
|
|
FT_LOCAL( FT_Error )
|
2002-04-20 07:38:33 +02:00
|
|
|
pfr_log_font_count( FT_Stream stream,
|
|
|
|
FT_UInt32 log_section_offset,
|
2015-02-21 09:52:29 +01:00
|
|
|
FT_Long *acount );
|
2002-04-19 17:13:47 +02:00
|
|
|
|
2002-04-20 07:38:33 +02:00
|
|
|
/* load a pfr logical font entry */
|
2002-04-19 17:13:47 +02:00
|
|
|
FT_LOCAL( FT_Error )
|
2002-04-20 07:38:33 +02:00
|
|
|
pfr_log_font_load( PFR_LogFont log_font,
|
|
|
|
FT_Stream stream,
|
|
|
|
FT_UInt face_index,
|
|
|
|
FT_UInt32 section_offset,
|
|
|
|
FT_Bool size_increment );
|
2002-04-19 17:13:47 +02:00
|
|
|
|
|
|
|
|
2002-04-20 07:38:33 +02:00
|
|
|
/* load a physical font entry */
|
2002-04-19 17:13:47 +02:00
|
|
|
FT_LOCAL( FT_Error )
|
2002-04-20 07:38:33 +02:00
|
|
|
pfr_phy_font_load( PFR_PhyFont phy_font,
|
|
|
|
FT_Stream stream,
|
|
|
|
FT_UInt32 offset,
|
|
|
|
FT_UInt32 size );
|
2002-04-19 17:13:47 +02:00
|
|
|
|
2002-04-20 07:38:33 +02:00
|
|
|
/* finalize a physical font */
|
2002-04-19 17:13:47 +02:00
|
|
|
FT_LOCAL( void )
|
|
|
|
pfr_phy_font_done( PFR_PhyFont phy_font,
|
|
|
|
FT_Memory memory );
|
|
|
|
|
2002-04-20 07:38:33 +02:00
|
|
|
/* */
|
2007-01-16 07:11:27 +01:00
|
|
|
|
2002-04-19 17:13:47 +02:00
|
|
|
FT_END_HEADER
|
|
|
|
|
2016-01-12 21:37:13 +01:00
|
|
|
#endif /* PFRLOAD_H_ */
|
2002-04-20 07:38:33 +02:00
|
|
|
|
|
|
|
|
|
|
|
/* END */
|