2018-06-03 09:01:17 +02:00
|
|
|
/****************************************************************************
|
|
|
|
*
|
|
|
|
* pfrload.c
|
|
|
|
*
|
|
|
|
* FreeType PFR loader (body).
|
|
|
|
*
|
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
|
|
|
|
|
|
|
|
2002-04-19 17:13:47 +02:00
|
|
|
#include "pfrload.h"
|
2020-06-08 13:31:55 +02:00
|
|
|
#include <freetype/internal/ftdebug.h>
|
|
|
|
#include <freetype/internal/ftstream.h>
|
2002-04-19 17:13:47 +02:00
|
|
|
|
2002-04-28 12:25:55 +02:00
|
|
|
#include "pfrerror.h"
|
|
|
|
|
2002-04-19 17:13:47 +02:00
|
|
|
#undef FT_COMPONENT
|
2018-08-15 18:13:17 +02:00
|
|
|
#define FT_COMPONENT pfr
|
2002-04-19 17:13:47 +02:00
|
|
|
|
2002-04-20 07:38:33 +02:00
|
|
|
|
2015-10-27 21:04:48 +01:00
|
|
|
/*
|
2018-06-03 09:01:17 +02:00
|
|
|
* The overall structure of a PFR file is as follows.
|
|
|
|
*
|
|
|
|
* PFR header
|
|
|
|
* 58 bytes (contains nPhysFonts)
|
|
|
|
*
|
|
|
|
* Logical font directory (size at most 2^16 bytes)
|
|
|
|
* 2 bytes (nLogFonts)
|
|
|
|
* + nLogFonts * 5 bytes
|
|
|
|
*
|
|
|
|
* ==> nLogFonts <= 13106
|
|
|
|
*
|
|
|
|
* Logical font section (size at most 2^24 bytes)
|
|
|
|
* nLogFonts * logFontRecord
|
|
|
|
*
|
|
|
|
* logFontRecord (size at most 2^16 bytes)
|
|
|
|
* 12 bytes (fontMatrix)
|
|
|
|
* + 1 byte (flags)
|
|
|
|
* + 0-5 bytes (depending on `flags')
|
|
|
|
* + 0-(1+255*(2+255)) = 0-65536 (depending on `flags')
|
|
|
|
* + 5 bytes (physical font info)
|
|
|
|
* + 0-1 bytes (depending on PFR header)
|
|
|
|
*
|
|
|
|
* ==> minimum size 18 bytes
|
|
|
|
*
|
|
|
|
* Physical font section (size at most 2^24 bytes)
|
|
|
|
* nPhysFonts * (physFontRecord
|
|
|
|
* + nBitmapSizes * nBmapChars * bmapCharRecord)
|
|
|
|
*
|
|
|
|
* physFontRecord (size at most 2^24 bytes)
|
|
|
|
* 14 bytes (font info)
|
|
|
|
* + 1 byte (flags)
|
|
|
|
* + 0-2 (depending on `flags')
|
|
|
|
* + 0-? (structure too complicated to be shown here; depending on
|
|
|
|
* `flags'; contains `nBitmapSizes' and `nBmapChars')
|
|
|
|
* + 3 bytes (nAuxBytes)
|
|
|
|
* + nAuxBytes
|
|
|
|
* + 1 byte (nBlueValues)
|
|
|
|
* + 2 * nBlueValues
|
|
|
|
* + 6 bytes (hinting data)
|
|
|
|
* + 2 bytes (nCharacters)
|
|
|
|
* + nCharacters * (4-10 bytes) (depending on `flags')
|
|
|
|
*
|
|
|
|
* ==> minimum size 27 bytes
|
|
|
|
*
|
|
|
|
* bmapCharRecord
|
|
|
|
* 4-7 bytes
|
|
|
|
*
|
|
|
|
* Glyph program strings (three possible types: simpleGps, compoundGps,
|
|
|
|
* and bitmapGps; size at most 2^24 bytes)
|
|
|
|
* simpleGps (size at most 2^16 bytes)
|
|
|
|
* 1 byte (flags)
|
|
|
|
* 1-2 bytes (n[XY]orus, depending on `flags')
|
|
|
|
* 0-(64+512*2) = 0-1088 bytes (depending on `n[XY]orus')
|
|
|
|
* 0-? (structure too complicated to be shown here; depending on
|
|
|
|
* `flags')
|
|
|
|
* 1-? glyph data (faintly resembling PS Type 1 charstrings)
|
|
|
|
*
|
|
|
|
* ==> minimum size 3 bytes
|
|
|
|
*
|
|
|
|
* compoundGps (size at most 2^16 bytes)
|
|
|
|
* 1 byte (nElements <= 63, flags)
|
|
|
|
* + 0-(1+255*(2+255)) = 0-65536 (depending on `flags')
|
|
|
|
* + nElements * (6-14 bytes)
|
|
|
|
*
|
|
|
|
* bitmapGps (size at most 2^16 bytes)
|
|
|
|
* 1 byte (flags)
|
|
|
|
* 3-13 bytes (position info, depending on `flags')
|
|
|
|
* 0-? bitmap data
|
|
|
|
*
|
|
|
|
* ==> minimum size 4 bytes
|
|
|
|
*
|
|
|
|
* PFR trailer
|
|
|
|
* 8 bytes
|
|
|
|
*
|
|
|
|
*
|
|
|
|
* ==> minimum size of a valid PFR:
|
|
|
|
* 58 (header)
|
|
|
|
* + 2 (nLogFonts)
|
|
|
|
* + 27 (1 physFontRecord)
|
|
|
|
* + 8 (trailer)
|
|
|
|
* -----
|
|
|
|
* 95 bytes
|
2015-10-27 21:04:48 +01:00
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
2002-04-20 07:38:33 +02:00
|
|
|
/*************************************************************************/
|
|
|
|
/*************************************************************************/
|
|
|
|
/***** *****/
|
|
|
|
/***** EXTRA ITEMS *****/
|
|
|
|
/***** *****/
|
|
|
|
/*************************************************************************/
|
|
|
|
/*************************************************************************/
|
2002-04-19 17:13:47 +02:00
|
|
|
|
|
|
|
|
|
|
|
FT_LOCAL_DEF( 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
|
|
|
{
|
|
|
|
return pfr_extra_items_parse( pp, limit, NULL, NULL );
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
FT_LOCAL_DEF( FT_Error )
|
|
|
|
pfr_extra_items_parse( FT_Byte* *pp,
|
|
|
|
FT_Byte* limit,
|
|
|
|
PFR_ExtraItem item_list,
|
|
|
|
FT_Pointer item_data )
|
|
|
|
{
|
2013-03-14 11:21:17 +01:00
|
|
|
FT_Error error = FT_Err_Ok;
|
2002-04-19 17:13:47 +02:00
|
|
|
FT_Byte* p = *pp;
|
|
|
|
FT_UInt num_items, item_type, item_size;
|
* src/pfr/pfrsbit.h, src/pfr/pfrsbit.c, src/pfr/pfrload.c,
src/pfr/pfrgload.c, src/pfr/pfrobjs.c, src/pfr/pfrtypes.h,
Jamfile, src/base/ftobjs.c: adding support for embedded bitmaps to
the PFR driver, and rewriting its kerning loader / handler to use all
kerning pairs in a physical font (and not just the first item).
* src/tools/docmaker/content.py, src/tools/docmaker/sources.py,
src/tools/docmaker/tohtml.py: fixing a few nasty bugs
* src/sfnt/ttcmap0.c: the validator for format 4 sub-tables is
now capable of dealing with invalid "length" fields at the start
of the sub-table. This allows fonts like "mg______.ttf" (i.e.
Marriage) to return accurate charmaps.
2002-10-05 16:57:03 +02:00
|
|
|
|
2002-04-20 07:38:33 +02:00
|
|
|
|
|
|
|
PFR_CHECK( 1 );
|
|
|
|
num_items = PFR_NEXT_BYTE( p );
|
|
|
|
|
2002-04-19 17:13:47 +02:00
|
|
|
for ( ; num_items > 0; num_items-- )
|
|
|
|
{
|
2002-04-20 07:38:33 +02:00
|
|
|
PFR_CHECK( 2 );
|
|
|
|
item_size = PFR_NEXT_BYTE( p );
|
|
|
|
item_type = PFR_NEXT_BYTE( p );
|
* src/pfr/pfrsbit.h, src/pfr/pfrsbit.c, src/pfr/pfrload.c,
src/pfr/pfrgload.c, src/pfr/pfrobjs.c, src/pfr/pfrtypes.h,
Jamfile, src/base/ftobjs.c: adding support for embedded bitmaps to
the PFR driver, and rewriting its kerning loader / handler to use all
kerning pairs in a physical font (and not just the first item).
* src/tools/docmaker/content.py, src/tools/docmaker/sources.py,
src/tools/docmaker/tohtml.py: fixing a few nasty bugs
* src/sfnt/ttcmap0.c: the validator for format 4 sub-tables is
now capable of dealing with invalid "length" fields at the start
of the sub-table. This allows fonts like "mg______.ttf" (i.e.
Marriage) to return accurate charmaps.
2002-10-05 16:57:03 +02:00
|
|
|
|
2002-04-20 07:38:33 +02:00
|
|
|
PFR_CHECK( item_size );
|
2002-04-19 17:13:47 +02:00
|
|
|
|
|
|
|
if ( item_list )
|
* src/pfr/pfrsbit.h, src/pfr/pfrsbit.c, src/pfr/pfrload.c,
src/pfr/pfrgload.c, src/pfr/pfrobjs.c, src/pfr/pfrtypes.h,
Jamfile, src/base/ftobjs.c: adding support for embedded bitmaps to
the PFR driver, and rewriting its kerning loader / handler to use all
kerning pairs in a physical font (and not just the first item).
* src/tools/docmaker/content.py, src/tools/docmaker/sources.py,
src/tools/docmaker/tohtml.py: fixing a few nasty bugs
* src/sfnt/ttcmap0.c: the validator for format 4 sub-tables is
now capable of dealing with invalid "length" fields at the start
of the sub-table. This allows fonts like "mg______.ttf" (i.e.
Marriage) to return accurate charmaps.
2002-10-05 16:57:03 +02:00
|
|
|
{
|
2002-04-19 17:13:47 +02:00
|
|
|
PFR_ExtraItem extra = item_list;
|
2002-04-20 07:38:33 +02:00
|
|
|
|
2002-06-22 15:35:41 +02:00
|
|
|
|
2002-04-19 17:13:47 +02:00
|
|
|
for ( extra = item_list; extra->parser != NULL; extra++ )
|
|
|
|
{
|
|
|
|
if ( extra->type == item_type )
|
|
|
|
{
|
|
|
|
error = extra->parser( p, p + item_size, item_data );
|
2015-10-27 19:27:39 +01:00
|
|
|
if ( error )
|
|
|
|
goto Exit;
|
* src/pfr/pfrsbit.h, src/pfr/pfrsbit.c, src/pfr/pfrload.c,
src/pfr/pfrgload.c, src/pfr/pfrobjs.c, src/pfr/pfrtypes.h,
Jamfile, src/base/ftobjs.c: adding support for embedded bitmaps to
the PFR driver, and rewriting its kerning loader / handler to use all
kerning pairs in a physical font (and not just the first item).
* src/tools/docmaker/content.py, src/tools/docmaker/sources.py,
src/tools/docmaker/tohtml.py: fixing a few nasty bugs
* src/sfnt/ttcmap0.c: the validator for format 4 sub-tables is
now capable of dealing with invalid "length" fields at the start
of the sub-table. This allows fonts like "mg______.ttf" (i.e.
Marriage) to return accurate charmaps.
2002-10-05 16:57:03 +02:00
|
|
|
|
2002-04-19 17:13:47 +02:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
* src/pfr/pfrsbit.h, src/pfr/pfrsbit.c, src/pfr/pfrload.c,
src/pfr/pfrgload.c, src/pfr/pfrobjs.c, src/pfr/pfrtypes.h,
Jamfile, src/base/ftobjs.c: adding support for embedded bitmaps to
the PFR driver, and rewriting its kerning loader / handler to use all
kerning pairs in a physical font (and not just the first item).
* src/tools/docmaker/content.py, src/tools/docmaker/sources.py,
src/tools/docmaker/tohtml.py: fixing a few nasty bugs
* src/sfnt/ttcmap0.c: the validator for format 4 sub-tables is
now capable of dealing with invalid "length" fields at the start
of the sub-table. This allows fonts like "mg______.ttf" (i.e.
Marriage) to return accurate charmaps.
2002-10-05 16:57:03 +02:00
|
|
|
|
2002-04-19 17:13:47 +02:00
|
|
|
p += item_size;
|
|
|
|
}
|
|
|
|
|
|
|
|
Exit:
|
|
|
|
*pp = p;
|
|
|
|
return error;
|
* src/pfr/pfrsbit.h, src/pfr/pfrsbit.c, src/pfr/pfrload.c,
src/pfr/pfrgload.c, src/pfr/pfrobjs.c, src/pfr/pfrtypes.h,
Jamfile, src/base/ftobjs.c: adding support for embedded bitmaps to
the PFR driver, and rewriting its kerning loader / handler to use all
kerning pairs in a physical font (and not just the first item).
* src/tools/docmaker/content.py, src/tools/docmaker/sources.py,
src/tools/docmaker/tohtml.py: fixing a few nasty bugs
* src/sfnt/ttcmap0.c: the validator for format 4 sub-tables is
now capable of dealing with invalid "length" fields at the start
of the sub-table. This allows fonts like "mg______.ttf" (i.e.
Marriage) to return accurate charmaps.
2002-10-05 16:57:03 +02:00
|
|
|
|
2002-04-19 17:13:47 +02:00
|
|
|
Too_Short:
|
2002-04-20 07:38:33 +02:00
|
|
|
FT_ERROR(( "pfr_extra_items_parse: invalid extra items table\n" ));
|
2013-03-14 10:27:35 +01:00
|
|
|
error = FT_THROW( Invalid_Table );
|
2002-04-19 17:13:47 +02:00
|
|
|
goto Exit;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2002-04-20 07:38:33 +02:00
|
|
|
/*************************************************************************/
|
|
|
|
/*************************************************************************/
|
|
|
|
/***** *****/
|
|
|
|
/***** PFR HEADER *****/
|
|
|
|
/***** *****/
|
|
|
|
/*************************************************************************/
|
|
|
|
/*************************************************************************/
|
2002-04-19 17:13:47 +02:00
|
|
|
|
2002-04-20 07:38:33 +02:00
|
|
|
static const FT_Frame_Field pfr_header_fields[] =
|
2002-04-19 17:13:47 +02:00
|
|
|
{
|
|
|
|
#undef FT_STRUCTURE
|
|
|
|
#define FT_STRUCTURE PFR_HeaderRec
|
|
|
|
|
2002-04-20 07:38:33 +02:00
|
|
|
FT_FRAME_START( 58 ),
|
|
|
|
FT_FRAME_ULONG ( signature ),
|
|
|
|
FT_FRAME_USHORT( version ),
|
|
|
|
FT_FRAME_USHORT( signature2 ),
|
|
|
|
FT_FRAME_USHORT( header_size ),
|
2002-04-19 17:13:47 +02:00
|
|
|
|
2002-04-20 07:38:33 +02:00
|
|
|
FT_FRAME_USHORT( log_dir_size ),
|
|
|
|
FT_FRAME_USHORT( log_dir_offset ),
|
2002-04-19 17:13:47 +02:00
|
|
|
|
2002-04-20 07:38:33 +02:00
|
|
|
FT_FRAME_USHORT( log_font_max_size ),
|
|
|
|
FT_FRAME_UOFF3 ( log_font_section_size ),
|
|
|
|
FT_FRAME_UOFF3 ( log_font_section_offset ),
|
2002-04-19 17:13:47 +02:00
|
|
|
|
2002-04-20 07:38:33 +02:00
|
|
|
FT_FRAME_USHORT( phy_font_max_size ),
|
|
|
|
FT_FRAME_UOFF3 ( phy_font_section_size ),
|
|
|
|
FT_FRAME_UOFF3 ( phy_font_section_offset ),
|
2002-04-19 17:13:47 +02:00
|
|
|
|
2002-04-20 07:38:33 +02:00
|
|
|
FT_FRAME_USHORT( gps_max_size ),
|
|
|
|
FT_FRAME_UOFF3 ( gps_section_size ),
|
|
|
|
FT_FRAME_UOFF3 ( gps_section_offset ),
|
2002-04-19 17:13:47 +02:00
|
|
|
|
2002-04-20 07:38:33 +02:00
|
|
|
FT_FRAME_BYTE ( max_blue_values ),
|
|
|
|
FT_FRAME_BYTE ( max_x_orus ),
|
|
|
|
FT_FRAME_BYTE ( max_y_orus ),
|
2002-04-19 17:13:47 +02:00
|
|
|
|
2002-04-20 07:38:33 +02:00
|
|
|
FT_FRAME_BYTE ( phy_font_max_size_high ),
|
|
|
|
FT_FRAME_BYTE ( color_flags ),
|
2002-04-19 17:13:47 +02:00
|
|
|
|
2002-04-20 07:38:33 +02:00
|
|
|
FT_FRAME_UOFF3 ( bct_max_size ),
|
|
|
|
FT_FRAME_UOFF3 ( bct_set_max_size ),
|
|
|
|
FT_FRAME_UOFF3 ( phy_bct_set_max_size ),
|
2002-04-19 17:13:47 +02:00
|
|
|
|
2002-04-20 07:38:33 +02:00
|
|
|
FT_FRAME_USHORT( num_phy_fonts ),
|
|
|
|
FT_FRAME_BYTE ( max_vert_stem_snap ),
|
|
|
|
FT_FRAME_BYTE ( max_horz_stem_snap ),
|
|
|
|
FT_FRAME_USHORT( max_chars ),
|
2002-04-19 17:13:47 +02:00
|
|
|
FT_FRAME_END
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
FT_LOCAL_DEF( FT_Error )
|
|
|
|
pfr_header_load( PFR_Header header,
|
|
|
|
FT_Stream stream )
|
|
|
|
{
|
2003-04-23 16:14:06 +02:00
|
|
|
FT_Error error;
|
2002-04-19 17:13:47 +02:00
|
|
|
|
2002-04-20 07:38:33 +02:00
|
|
|
|
2002-04-19 17:13:47 +02:00
|
|
|
/* read header directly */
|
|
|
|
if ( !FT_STREAM_SEEK( 0 ) &&
|
|
|
|
!FT_STREAM_READ_FIELDS( pfr_header_fields, header ) )
|
|
|
|
{
|
|
|
|
/* make a few adjustments to the header */
|
|
|
|
header->phy_font_max_size +=
|
|
|
|
(FT_UInt32)header->phy_font_max_size_high << 16;
|
|
|
|
}
|
|
|
|
|
|
|
|
return error;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
FT_LOCAL_DEF( FT_Bool )
|
|
|
|
pfr_header_check( PFR_Header header )
|
|
|
|
{
|
|
|
|
FT_Bool result = 1;
|
|
|
|
|
2002-04-20 07:38:33 +02:00
|
|
|
|
2002-04-19 17:13:47 +02:00
|
|
|
/* check signature and header size */
|
2002-04-20 07:38:33 +02:00
|
|
|
if ( header->signature != 0x50465230L || /* "PFR0" */
|
|
|
|
header->version > 4 ||
|
|
|
|
header->header_size < 58 ||
|
2014-12-07 11:03:57 +01:00
|
|
|
header->signature2 != 0x0D0A ) /* CR/LF */
|
2002-04-19 17:13:47 +02:00
|
|
|
{
|
|
|
|
result = 0;
|
|
|
|
}
|
2015-10-27 19:27:39 +01:00
|
|
|
|
|
|
|
return result;
|
2002-04-19 17:13:47 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/***********************************************************************/
|
|
|
|
/***********************************************************************/
|
|
|
|
/***** *****/
|
|
|
|
/***** PFR LOGICAL FONTS *****/
|
|
|
|
/***** *****/
|
|
|
|
/***********************************************************************/
|
|
|
|
/***********************************************************************/
|
|
|
|
|
|
|
|
|
|
|
|
FT_LOCAL_DEF( FT_Error )
|
|
|
|
pfr_log_font_count( FT_Stream stream,
|
|
|
|
FT_UInt32 section_offset,
|
2015-02-21 09:52:29 +01:00
|
|
|
FT_Long *acount )
|
2002-04-19 17:13:47 +02:00
|
|
|
{
|
2003-04-23 16:14:06 +02:00
|
|
|
FT_Error error;
|
|
|
|
FT_UInt count;
|
|
|
|
FT_UInt result = 0;
|
* src/pfr/pfrsbit.h, src/pfr/pfrsbit.c, src/pfr/pfrload.c,
src/pfr/pfrgload.c, src/pfr/pfrobjs.c, src/pfr/pfrtypes.h,
Jamfile, src/base/ftobjs.c: adding support for embedded bitmaps to
the PFR driver, and rewriting its kerning loader / handler to use all
kerning pairs in a physical font (and not just the first item).
* src/tools/docmaker/content.py, src/tools/docmaker/sources.py,
src/tools/docmaker/tohtml.py: fixing a few nasty bugs
* src/sfnt/ttcmap0.c: the validator for format 4 sub-tables is
now capable of dealing with invalid "length" fields at the start
of the sub-table. This allows fonts like "mg______.ttf" (i.e.
Marriage) to return accurate charmaps.
2002-10-05 16:57:03 +02:00
|
|
|
|
2002-04-20 07:38:33 +02:00
|
|
|
|
2015-10-27 19:27:39 +01:00
|
|
|
if ( FT_STREAM_SEEK( section_offset ) ||
|
|
|
|
FT_READ_USHORT( count ) )
|
2002-04-19 17:13:47 +02:00
|
|
|
goto Exit;
|
* src/pfr/pfrsbit.h, src/pfr/pfrsbit.c, src/pfr/pfrload.c,
src/pfr/pfrgload.c, src/pfr/pfrobjs.c, src/pfr/pfrtypes.h,
Jamfile, src/base/ftobjs.c: adding support for embedded bitmaps to
the PFR driver, and rewriting its kerning loader / handler to use all
kerning pairs in a physical font (and not just the first item).
* src/tools/docmaker/content.py, src/tools/docmaker/sources.py,
src/tools/docmaker/tohtml.py: fixing a few nasty bugs
* src/sfnt/ttcmap0.c: the validator for format 4 sub-tables is
now capable of dealing with invalid "length" fields at the start
of the sub-table. This allows fonts like "mg______.ttf" (i.e.
Marriage) to return accurate charmaps.
2002-10-05 16:57:03 +02:00
|
|
|
|
2016-03-30 09:11:02 +02:00
|
|
|
/* check maximum value and a rough minimum size: */
|
|
|
|
/* - no more than 13106 log fonts */
|
|
|
|
/* - we need 5 bytes for a log header record */
|
|
|
|
/* - we need at least 18 bytes for a log font record */
|
|
|
|
/* - the overall size is at least 95 bytes plus the */
|
|
|
|
/* log header and log font records */
|
2015-10-27 21:04:48 +01:00
|
|
|
if ( count > ( ( 1 << 16 ) - 2 ) / 5 ||
|
2016-03-30 09:11:02 +02:00
|
|
|
2 + count * 5 >= stream->size - section_offset ||
|
|
|
|
95 + count * ( 5 + 18 ) >= stream->size )
|
2015-10-27 21:04:48 +01:00
|
|
|
{
|
|
|
|
FT_ERROR(( "pfr_log_font_count:"
|
|
|
|
" invalid number of logical fonts\n" ));
|
|
|
|
error = FT_THROW( Invalid_Table );
|
|
|
|
goto Exit;
|
|
|
|
}
|
|
|
|
|
2002-04-19 17:13:47 +02:00
|
|
|
result = count;
|
* src/pfr/pfrsbit.h, src/pfr/pfrsbit.c, src/pfr/pfrload.c,
src/pfr/pfrgload.c, src/pfr/pfrobjs.c, src/pfr/pfrtypes.h,
Jamfile, src/base/ftobjs.c: adding support for embedded bitmaps to
the PFR driver, and rewriting its kerning loader / handler to use all
kerning pairs in a physical font (and not just the first item).
* src/tools/docmaker/content.py, src/tools/docmaker/sources.py,
src/tools/docmaker/tohtml.py: fixing a few nasty bugs
* src/sfnt/ttcmap0.c: the validator for format 4 sub-tables is
now capable of dealing with invalid "length" fields at the start
of the sub-table. This allows fonts like "mg______.ttf" (i.e.
Marriage) to return accurate charmaps.
2002-10-05 16:57:03 +02:00
|
|
|
|
2002-04-19 17:13:47 +02:00
|
|
|
Exit:
|
2015-02-21 09:52:29 +01:00
|
|
|
*acount = (FT_Long)result;
|
2002-04-19 17:13:47 +02:00
|
|
|
return error;
|
* src/pfr/pfrsbit.h, src/pfr/pfrsbit.c, src/pfr/pfrload.c,
src/pfr/pfrgload.c, src/pfr/pfrobjs.c, src/pfr/pfrtypes.h,
Jamfile, src/base/ftobjs.c: adding support for embedded bitmaps to
the PFR driver, and rewriting its kerning loader / handler to use all
kerning pairs in a physical font (and not just the first item).
* src/tools/docmaker/content.py, src/tools/docmaker/sources.py,
src/tools/docmaker/tohtml.py: fixing a few nasty bugs
* src/sfnt/ttcmap0.c: the validator for format 4 sub-tables is
now capable of dealing with invalid "length" fields at the start
of the sub-table. This allows fonts like "mg______.ttf" (i.e.
Marriage) to return accurate charmaps.
2002-10-05 16:57:03 +02:00
|
|
|
}
|
2002-04-19 17:13:47 +02:00
|
|
|
|
|
|
|
|
|
|
|
FT_LOCAL_DEF( FT_Error )
|
2002-04-20 07:38:33 +02:00
|
|
|
pfr_log_font_load( PFR_LogFont log_font,
|
|
|
|
FT_Stream stream,
|
2002-08-06 23:47:40 +02:00
|
|
|
FT_UInt idx,
|
2002-04-20 07:38:33 +02:00
|
|
|
FT_UInt32 section_offset,
|
|
|
|
FT_Bool size_increment )
|
2002-04-19 17:13:47 +02:00
|
|
|
{
|
|
|
|
FT_UInt num_log_fonts;
|
|
|
|
FT_UInt flags;
|
|
|
|
FT_UInt32 offset;
|
|
|
|
FT_UInt32 size;
|
|
|
|
FT_Error error;
|
|
|
|
|
2002-04-20 07:38:33 +02:00
|
|
|
|
|
|
|
if ( FT_STREAM_SEEK( section_offset ) ||
|
|
|
|
FT_READ_USHORT( num_log_fonts ) )
|
2002-04-19 17:13:47 +02:00
|
|
|
goto Exit;
|
|
|
|
|
2002-08-06 23:47:40 +02:00
|
|
|
if ( idx >= num_log_fonts )
|
2013-03-14 10:27:35 +01:00
|
|
|
return FT_THROW( Invalid_Argument );
|
2002-04-19 17:13:47 +02:00
|
|
|
|
2002-08-06 23:47:40 +02:00
|
|
|
if ( FT_STREAM_SKIP( idx * 5 ) ||
|
2003-04-23 16:14:06 +02:00
|
|
|
FT_READ_USHORT( size ) ||
|
|
|
|
FT_READ_UOFF3 ( offset ) )
|
2002-04-19 17:13:47 +02:00
|
|
|
goto Exit;
|
|
|
|
|
|
|
|
/* save logical font size and offset */
|
|
|
|
log_font->size = size;
|
|
|
|
log_font->offset = offset;
|
|
|
|
|
|
|
|
/* now, check the rest of the table before loading it */
|
|
|
|
{
|
|
|
|
FT_Byte* p;
|
|
|
|
FT_Byte* limit;
|
|
|
|
FT_UInt local;
|
* src/pfr/pfrsbit.h, src/pfr/pfrsbit.c, src/pfr/pfrload.c,
src/pfr/pfrgload.c, src/pfr/pfrobjs.c, src/pfr/pfrtypes.h,
Jamfile, src/base/ftobjs.c: adding support for embedded bitmaps to
the PFR driver, and rewriting its kerning loader / handler to use all
kerning pairs in a physical font (and not just the first item).
* src/tools/docmaker/content.py, src/tools/docmaker/sources.py,
src/tools/docmaker/tohtml.py: fixing a few nasty bugs
* src/sfnt/ttcmap0.c: the validator for format 4 sub-tables is
now capable of dealing with invalid "length" fields at the start
of the sub-table. This allows fonts like "mg______.ttf" (i.e.
Marriage) to return accurate charmaps.
2002-10-05 16:57:03 +02:00
|
|
|
|
2002-04-20 07:38:33 +02:00
|
|
|
|
2015-10-27 19:27:39 +01:00
|
|
|
if ( FT_STREAM_SEEK( offset ) ||
|
|
|
|
FT_FRAME_ENTER( size ) )
|
2002-04-19 17:13:47 +02:00
|
|
|
goto Exit;
|
|
|
|
|
|
|
|
p = stream->cursor;
|
|
|
|
limit = p + size;
|
* src/pfr/pfrsbit.h, src/pfr/pfrsbit.c, src/pfr/pfrload.c,
src/pfr/pfrgload.c, src/pfr/pfrobjs.c, src/pfr/pfrtypes.h,
Jamfile, src/base/ftobjs.c: adding support for embedded bitmaps to
the PFR driver, and rewriting its kerning loader / handler to use all
kerning pairs in a physical font (and not just the first item).
* src/tools/docmaker/content.py, src/tools/docmaker/sources.py,
src/tools/docmaker/tohtml.py: fixing a few nasty bugs
* src/sfnt/ttcmap0.c: the validator for format 4 sub-tables is
now capable of dealing with invalid "length" fields at the start
of the sub-table. This allows fonts like "mg______.ttf" (i.e.
Marriage) to return accurate charmaps.
2002-10-05 16:57:03 +02:00
|
|
|
|
2015-10-27 19:27:39 +01:00
|
|
|
PFR_CHECK( 13 );
|
* src/pfr/pfrsbit.h, src/pfr/pfrsbit.c, src/pfr/pfrload.c,
src/pfr/pfrgload.c, src/pfr/pfrobjs.c, src/pfr/pfrtypes.h,
Jamfile, src/base/ftobjs.c: adding support for embedded bitmaps to
the PFR driver, and rewriting its kerning loader / handler to use all
kerning pairs in a physical font (and not just the first item).
* src/tools/docmaker/content.py, src/tools/docmaker/sources.py,
src/tools/docmaker/tohtml.py: fixing a few nasty bugs
* src/sfnt/ttcmap0.c: the validator for format 4 sub-tables is
now capable of dealing with invalid "length" fields at the start
of the sub-table. This allows fonts like "mg______.ttf" (i.e.
Marriage) to return accurate charmaps.
2002-10-05 16:57:03 +02:00
|
|
|
|
2002-04-20 07:38:33 +02:00
|
|
|
log_font->matrix[0] = PFR_NEXT_LONG( p );
|
|
|
|
log_font->matrix[1] = PFR_NEXT_LONG( p );
|
|
|
|
log_font->matrix[2] = PFR_NEXT_LONG( p );
|
|
|
|
log_font->matrix[3] = PFR_NEXT_LONG( p );
|
* src/pfr/pfrsbit.h, src/pfr/pfrsbit.c, src/pfr/pfrload.c,
src/pfr/pfrgload.c, src/pfr/pfrobjs.c, src/pfr/pfrtypes.h,
Jamfile, src/base/ftobjs.c: adding support for embedded bitmaps to
the PFR driver, and rewriting its kerning loader / handler to use all
kerning pairs in a physical font (and not just the first item).
* src/tools/docmaker/content.py, src/tools/docmaker/sources.py,
src/tools/docmaker/tohtml.py: fixing a few nasty bugs
* src/sfnt/ttcmap0.c: the validator for format 4 sub-tables is
now capable of dealing with invalid "length" fields at the start
of the sub-table. This allows fonts like "mg______.ttf" (i.e.
Marriage) to return accurate charmaps.
2002-10-05 16:57:03 +02:00
|
|
|
|
2002-04-20 07:38:33 +02:00
|
|
|
flags = PFR_NEXT_BYTE( p );
|
* src/pfr/pfrsbit.h, src/pfr/pfrsbit.c, src/pfr/pfrload.c,
src/pfr/pfrgload.c, src/pfr/pfrobjs.c, src/pfr/pfrtypes.h,
Jamfile, src/base/ftobjs.c: adding support for embedded bitmaps to
the PFR driver, and rewriting its kerning loader / handler to use all
kerning pairs in a physical font (and not just the first item).
* src/tools/docmaker/content.py, src/tools/docmaker/sources.py,
src/tools/docmaker/tohtml.py: fixing a few nasty bugs
* src/sfnt/ttcmap0.c: the validator for format 4 sub-tables is
now capable of dealing with invalid "length" fields at the start
of the sub-table. This allows fonts like "mg______.ttf" (i.e.
Marriage) to return accurate charmaps.
2002-10-05 16:57:03 +02:00
|
|
|
|
2002-04-19 17:13:47 +02:00
|
|
|
local = 0;
|
|
|
|
if ( flags & PFR_LOG_STROKE )
|
|
|
|
{
|
|
|
|
local++;
|
|
|
|
if ( flags & PFR_LOG_2BYTE_STROKE )
|
|
|
|
local++;
|
* src/pfr/pfrsbit.h, src/pfr/pfrsbit.c, src/pfr/pfrload.c,
src/pfr/pfrgload.c, src/pfr/pfrobjs.c, src/pfr/pfrtypes.h,
Jamfile, src/base/ftobjs.c: adding support for embedded bitmaps to
the PFR driver, and rewriting its kerning loader / handler to use all
kerning pairs in a physical font (and not just the first item).
* src/tools/docmaker/content.py, src/tools/docmaker/sources.py,
src/tools/docmaker/tohtml.py: fixing a few nasty bugs
* src/sfnt/ttcmap0.c: the validator for format 4 sub-tables is
now capable of dealing with invalid "length" fields at the start
of the sub-table. This allows fonts like "mg______.ttf" (i.e.
Marriage) to return accurate charmaps.
2002-10-05 16:57:03 +02:00
|
|
|
|
2016-03-29 08:37:07 +02:00
|
|
|
if ( ( flags & PFR_LINE_JOIN_MASK ) == PFR_LINE_JOIN_MITER )
|
2002-04-19 17:13:47 +02:00
|
|
|
local += 3;
|
|
|
|
}
|
|
|
|
if ( flags & PFR_LOG_BOLD )
|
|
|
|
{
|
|
|
|
local++;
|
|
|
|
if ( flags & PFR_LOG_2BYTE_BOLD )
|
|
|
|
local++;
|
|
|
|
}
|
|
|
|
|
2002-04-20 07:38:33 +02:00
|
|
|
PFR_CHECK( local );
|
2002-04-19 17:13:47 +02:00
|
|
|
|
|
|
|
if ( flags & PFR_LOG_STROKE )
|
|
|
|
{
|
|
|
|
log_font->stroke_thickness = ( flags & PFR_LOG_2BYTE_STROKE )
|
2002-04-20 07:38:33 +02:00
|
|
|
? PFR_NEXT_SHORT( p )
|
|
|
|
: PFR_NEXT_BYTE( p );
|
* src/pfr/pfrsbit.h, src/pfr/pfrsbit.c, src/pfr/pfrload.c,
src/pfr/pfrgload.c, src/pfr/pfrobjs.c, src/pfr/pfrtypes.h,
Jamfile, src/base/ftobjs.c: adding support for embedded bitmaps to
the PFR driver, and rewriting its kerning loader / handler to use all
kerning pairs in a physical font (and not just the first item).
* src/tools/docmaker/content.py, src/tools/docmaker/sources.py,
src/tools/docmaker/tohtml.py: fixing a few nasty bugs
* src/sfnt/ttcmap0.c: the validator for format 4 sub-tables is
now capable of dealing with invalid "length" fields at the start
of the sub-table. This allows fonts like "mg______.ttf" (i.e.
Marriage) to return accurate charmaps.
2002-10-05 16:57:03 +02:00
|
|
|
|
2002-04-20 07:38:33 +02:00
|
|
|
if ( ( flags & PFR_LINE_JOIN_MASK ) == PFR_LINE_JOIN_MITER )
|
|
|
|
log_font->miter_limit = PFR_NEXT_LONG( p );
|
2002-04-19 17:13:47 +02:00
|
|
|
}
|
* src/pfr/pfrsbit.h, src/pfr/pfrsbit.c, src/pfr/pfrload.c,
src/pfr/pfrgload.c, src/pfr/pfrobjs.c, src/pfr/pfrtypes.h,
Jamfile, src/base/ftobjs.c: adding support for embedded bitmaps to
the PFR driver, and rewriting its kerning loader / handler to use all
kerning pairs in a physical font (and not just the first item).
* src/tools/docmaker/content.py, src/tools/docmaker/sources.py,
src/tools/docmaker/tohtml.py: fixing a few nasty bugs
* src/sfnt/ttcmap0.c: the validator for format 4 sub-tables is
now capable of dealing with invalid "length" fields at the start
of the sub-table. This allows fonts like "mg______.ttf" (i.e.
Marriage) to return accurate charmaps.
2002-10-05 16:57:03 +02:00
|
|
|
|
2002-04-19 17:13:47 +02:00
|
|
|
if ( flags & PFR_LOG_BOLD )
|
|
|
|
{
|
|
|
|
log_font->bold_thickness = ( flags & PFR_LOG_2BYTE_BOLD )
|
2002-04-20 07:38:33 +02:00
|
|
|
? PFR_NEXT_SHORT( p )
|
|
|
|
: PFR_NEXT_BYTE( p );
|
2002-04-19 17:13:47 +02:00
|
|
|
}
|
* src/pfr/pfrsbit.h, src/pfr/pfrsbit.c, src/pfr/pfrload.c,
src/pfr/pfrgload.c, src/pfr/pfrobjs.c, src/pfr/pfrtypes.h,
Jamfile, src/base/ftobjs.c: adding support for embedded bitmaps to
the PFR driver, and rewriting its kerning loader / handler to use all
kerning pairs in a physical font (and not just the first item).
* src/tools/docmaker/content.py, src/tools/docmaker/sources.py,
src/tools/docmaker/tohtml.py: fixing a few nasty bugs
* src/sfnt/ttcmap0.c: the validator for format 4 sub-tables is
now capable of dealing with invalid "length" fields at the start
of the sub-table. This allows fonts like "mg______.ttf" (i.e.
Marriage) to return accurate charmaps.
2002-10-05 16:57:03 +02:00
|
|
|
|
2002-04-19 17:13:47 +02:00
|
|
|
if ( flags & PFR_LOG_EXTRA_ITEMS )
|
|
|
|
{
|
|
|
|
error = pfr_extra_items_skip( &p, limit );
|
2015-10-27 19:27:39 +01:00
|
|
|
if ( error )
|
|
|
|
goto Fail;
|
2002-04-19 17:13:47 +02:00
|
|
|
}
|
|
|
|
|
2015-10-27 19:27:39 +01:00
|
|
|
PFR_CHECK( 5 );
|
2002-04-20 07:38:33 +02:00
|
|
|
log_font->phys_size = PFR_NEXT_USHORT( p );
|
|
|
|
log_font->phys_offset = PFR_NEXT_ULONG( p );
|
2002-04-19 17:13:47 +02:00
|
|
|
if ( size_increment )
|
|
|
|
{
|
2002-04-20 07:38:33 +02:00
|
|
|
PFR_CHECK( 1 );
|
|
|
|
log_font->phys_size += (FT_UInt32)PFR_NEXT_BYTE( p ) << 16;
|
2002-04-19 17:13:47 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
Fail:
|
|
|
|
FT_FRAME_EXIT();
|
|
|
|
|
|
|
|
Exit:
|
|
|
|
return error;
|
* src/pfr/pfrsbit.h, src/pfr/pfrsbit.c, src/pfr/pfrload.c,
src/pfr/pfrgload.c, src/pfr/pfrobjs.c, src/pfr/pfrtypes.h,
Jamfile, src/base/ftobjs.c: adding support for embedded bitmaps to
the PFR driver, and rewriting its kerning loader / handler to use all
kerning pairs in a physical font (and not just the first item).
* src/tools/docmaker/content.py, src/tools/docmaker/sources.py,
src/tools/docmaker/tohtml.py: fixing a few nasty bugs
* src/sfnt/ttcmap0.c: the validator for format 4 sub-tables is
now capable of dealing with invalid "length" fields at the start
of the sub-table. This allows fonts like "mg______.ttf" (i.e.
Marriage) to return accurate charmaps.
2002-10-05 16:57:03 +02:00
|
|
|
|
2002-04-19 17:13:47 +02:00
|
|
|
Too_Short:
|
|
|
|
FT_ERROR(( "pfr_log_font_load: invalid logical font table\n" ));
|
2013-03-14 10:27:35 +01:00
|
|
|
error = FT_THROW( Invalid_Table );
|
2002-04-19 17:13:47 +02:00
|
|
|
goto Fail;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/***********************************************************************/
|
|
|
|
/***********************************************************************/
|
|
|
|
/***** *****/
|
|
|
|
/***** PFR PHYSICAL FONTS *****/
|
|
|
|
/***** *****/
|
|
|
|
/***********************************************************************/
|
|
|
|
/***********************************************************************/
|
|
|
|
|
|
|
|
|
2002-04-20 07:38:33 +02:00
|
|
|
/* load bitmap strikes lists */
|
2002-04-19 17:13:47 +02:00
|
|
|
FT_CALLBACK_DEF( FT_Error )
|
|
|
|
pfr_extra_item_load_bitmap_info( FT_Byte* p,
|
|
|
|
FT_Byte* limit,
|
|
|
|
PFR_PhyFont phy_font )
|
|
|
|
{
|
|
|
|
FT_Memory memory = phy_font->memory;
|
|
|
|
PFR_Strike strike;
|
|
|
|
FT_UInt flags0;
|
|
|
|
FT_UInt n, count, size1;
|
2013-03-14 11:21:17 +01:00
|
|
|
FT_Error error = FT_Err_Ok;
|
2002-04-19 17:13:47 +02:00
|
|
|
|
* src/pfr/pfrsbit.h, src/pfr/pfrsbit.c, src/pfr/pfrload.c,
src/pfr/pfrgload.c, src/pfr/pfrobjs.c, src/pfr/pfrtypes.h,
Jamfile, src/base/ftobjs.c: adding support for embedded bitmaps to
the PFR driver, and rewriting its kerning loader / handler to use all
kerning pairs in a physical font (and not just the first item).
* src/tools/docmaker/content.py, src/tools/docmaker/sources.py,
src/tools/docmaker/tohtml.py: fixing a few nasty bugs
* src/sfnt/ttcmap0.c: the validator for format 4 sub-tables is
now capable of dealing with invalid "length" fields at the start
of the sub-table. This allows fonts like "mg______.ttf" (i.e.
Marriage) to return accurate charmaps.
2002-10-05 16:57:03 +02:00
|
|
|
|
2002-04-20 07:38:33 +02:00
|
|
|
PFR_CHECK( 5 );
|
2002-04-19 17:13:47 +02:00
|
|
|
|
2015-10-27 19:27:39 +01:00
|
|
|
p += 3; /* skip bctSize */
|
2002-04-20 07:38:33 +02:00
|
|
|
flags0 = PFR_NEXT_BYTE( p );
|
|
|
|
count = PFR_NEXT_BYTE( p );
|
2002-04-19 17:13:47 +02:00
|
|
|
|
|
|
|
/* re-allocate when needed */
|
|
|
|
if ( phy_font->num_strikes + count > phy_font->max_strikes )
|
|
|
|
{
|
2003-12-24 02:10:46 +01:00
|
|
|
FT_UInt new_max = FT_PAD_CEIL( phy_font->num_strikes + count, 4 );
|
2003-04-23 16:14:06 +02:00
|
|
|
|
* src/pfr/pfrsbit.h, src/pfr/pfrsbit.c, src/pfr/pfrload.c,
src/pfr/pfrgload.c, src/pfr/pfrobjs.c, src/pfr/pfrtypes.h,
Jamfile, src/base/ftobjs.c: adding support for embedded bitmaps to
the PFR driver, and rewriting its kerning loader / handler to use all
kerning pairs in a physical font (and not just the first item).
* src/tools/docmaker/content.py, src/tools/docmaker/sources.py,
src/tools/docmaker/tohtml.py: fixing a few nasty bugs
* src/sfnt/ttcmap0.c: the validator for format 4 sub-tables is
now capable of dealing with invalid "length" fields at the start
of the sub-table. This allows fonts like "mg______.ttf" (i.e.
Marriage) to return accurate charmaps.
2002-10-05 16:57:03 +02:00
|
|
|
|
2002-04-20 07:38:33 +02:00
|
|
|
if ( FT_RENEW_ARRAY( phy_font->strikes,
|
|
|
|
phy_font->num_strikes,
|
|
|
|
new_max ) )
|
2002-04-19 17:13:47 +02:00
|
|
|
goto Exit;
|
* src/pfr/pfrsbit.h, src/pfr/pfrsbit.c, src/pfr/pfrload.c,
src/pfr/pfrgload.c, src/pfr/pfrobjs.c, src/pfr/pfrtypes.h,
Jamfile, src/base/ftobjs.c: adding support for embedded bitmaps to
the PFR driver, and rewriting its kerning loader / handler to use all
kerning pairs in a physical font (and not just the first item).
* src/tools/docmaker/content.py, src/tools/docmaker/sources.py,
src/tools/docmaker/tohtml.py: fixing a few nasty bugs
* src/sfnt/ttcmap0.c: the validator for format 4 sub-tables is
now capable of dealing with invalid "length" fields at the start
of the sub-table. This allows fonts like "mg______.ttf" (i.e.
Marriage) to return accurate charmaps.
2002-10-05 16:57:03 +02:00
|
|
|
|
2002-04-19 17:13:47 +02:00
|
|
|
phy_font->max_strikes = new_max;
|
|
|
|
}
|
|
|
|
|
|
|
|
size1 = 1 + 1 + 1 + 2 + 2 + 1;
|
|
|
|
if ( flags0 & PFR_STRIKE_2BYTE_XPPM )
|
|
|
|
size1++;
|
|
|
|
|
|
|
|
if ( flags0 & PFR_STRIKE_2BYTE_YPPM )
|
|
|
|
size1++;
|
|
|
|
|
|
|
|
if ( flags0 & PFR_STRIKE_3BYTE_SIZE )
|
|
|
|
size1++;
|
|
|
|
|
|
|
|
if ( flags0 & PFR_STRIKE_3BYTE_OFFSET )
|
|
|
|
size1++;
|
|
|
|
|
|
|
|
if ( flags0 & PFR_STRIKE_2BYTE_COUNT )
|
|
|
|
size1++;
|
|
|
|
|
|
|
|
strike = phy_font->strikes + phy_font->num_strikes;
|
|
|
|
|
2002-04-20 07:38:33 +02:00
|
|
|
PFR_CHECK( count * size1 );
|
2002-04-19 17:13:47 +02:00
|
|
|
|
|
|
|
for ( n = 0; n < count; n++, strike++ )
|
|
|
|
{
|
|
|
|
strike->x_ppm = ( flags0 & PFR_STRIKE_2BYTE_XPPM )
|
2002-04-20 07:38:33 +02:00
|
|
|
? PFR_NEXT_USHORT( p )
|
|
|
|
: PFR_NEXT_BYTE( p );
|
2002-04-19 17:13:47 +02:00
|
|
|
|
|
|
|
strike->y_ppm = ( flags0 & PFR_STRIKE_2BYTE_YPPM )
|
2002-04-20 07:38:33 +02:00
|
|
|
? PFR_NEXT_USHORT( p )
|
|
|
|
: PFR_NEXT_BYTE( p );
|
2002-04-19 17:13:47 +02:00
|
|
|
|
2002-04-20 07:38:33 +02:00
|
|
|
strike->flags = PFR_NEXT_BYTE( p );
|
2002-04-19 17:13:47 +02:00
|
|
|
|
|
|
|
strike->bct_size = ( flags0 & PFR_STRIKE_3BYTE_SIZE )
|
2002-04-20 07:38:33 +02:00
|
|
|
? PFR_NEXT_ULONG( p )
|
|
|
|
: PFR_NEXT_USHORT( p );
|
2002-04-19 17:13:47 +02:00
|
|
|
|
|
|
|
strike->bct_offset = ( flags0 & PFR_STRIKE_3BYTE_OFFSET )
|
2002-04-20 07:38:33 +02:00
|
|
|
? PFR_NEXT_ULONG( p )
|
|
|
|
: PFR_NEXT_USHORT( p );
|
2002-04-19 17:13:47 +02:00
|
|
|
|
|
|
|
strike->num_bitmaps = ( flags0 & PFR_STRIKE_2BYTE_COUNT )
|
2002-04-20 07:38:33 +02:00
|
|
|
? PFR_NEXT_USHORT( p )
|
|
|
|
: PFR_NEXT_BYTE( p );
|
2002-04-19 17:13:47 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
phy_font->num_strikes += count;
|
* src/pfr/pfrsbit.h, src/pfr/pfrsbit.c, src/pfr/pfrload.c,
src/pfr/pfrgload.c, src/pfr/pfrobjs.c, src/pfr/pfrtypes.h,
Jamfile, src/base/ftobjs.c: adding support for embedded bitmaps to
the PFR driver, and rewriting its kerning loader / handler to use all
kerning pairs in a physical font (and not just the first item).
* src/tools/docmaker/content.py, src/tools/docmaker/sources.py,
src/tools/docmaker/tohtml.py: fixing a few nasty bugs
* src/sfnt/ttcmap0.c: the validator for format 4 sub-tables is
now capable of dealing with invalid "length" fields at the start
of the sub-table. This allows fonts like "mg______.ttf" (i.e.
Marriage) to return accurate charmaps.
2002-10-05 16:57:03 +02:00
|
|
|
|
2002-04-19 17:13:47 +02:00
|
|
|
Exit:
|
|
|
|
return error;
|
* src/pfr/pfrsbit.h, src/pfr/pfrsbit.c, src/pfr/pfrload.c,
src/pfr/pfrgload.c, src/pfr/pfrobjs.c, src/pfr/pfrtypes.h,
Jamfile, src/base/ftobjs.c: adding support for embedded bitmaps to
the PFR driver, and rewriting its kerning loader / handler to use all
kerning pairs in a physical font (and not just the first item).
* src/tools/docmaker/content.py, src/tools/docmaker/sources.py,
src/tools/docmaker/tohtml.py: fixing a few nasty bugs
* src/sfnt/ttcmap0.c: the validator for format 4 sub-tables is
now capable of dealing with invalid "length" fields at the start
of the sub-table. This allows fonts like "mg______.ttf" (i.e.
Marriage) to return accurate charmaps.
2002-10-05 16:57:03 +02:00
|
|
|
|
2002-04-19 17:13:47 +02:00
|
|
|
Too_Short:
|
2013-03-14 10:27:35 +01:00
|
|
|
error = FT_THROW( Invalid_Table );
|
2009-06-26 06:15:41 +02:00
|
|
|
FT_ERROR(( "pfr_extra_item_load_bitmap_info:"
|
|
|
|
" invalid bitmap info table\n" ));
|
2002-04-19 17:13:47 +02:00
|
|
|
goto Exit;
|
* src/pfr/pfrsbit.h, src/pfr/pfrsbit.c, src/pfr/pfrload.c,
src/pfr/pfrgload.c, src/pfr/pfrobjs.c, src/pfr/pfrtypes.h,
Jamfile, src/base/ftobjs.c: adding support for embedded bitmaps to
the PFR driver, and rewriting its kerning loader / handler to use all
kerning pairs in a physical font (and not just the first item).
* src/tools/docmaker/content.py, src/tools/docmaker/sources.py,
src/tools/docmaker/tohtml.py: fixing a few nasty bugs
* src/sfnt/ttcmap0.c: the validator for format 4 sub-tables is
now capable of dealing with invalid "length" fields at the start
of the sub-table. This allows fonts like "mg______.ttf" (i.e.
Marriage) to return accurate charmaps.
2002-10-05 16:57:03 +02:00
|
|
|
}
|
2002-04-19 17:13:47 +02:00
|
|
|
|
|
|
|
|
2015-10-27 19:27:39 +01:00
|
|
|
/* Load font ID. This is a so-called `unique' name that is rather
|
|
|
|
* long and descriptive (like `Tiresias ScreenFont v7.51').
|
2003-04-23 16:14:06 +02:00
|
|
|
*
|
|
|
|
* Note that a PFR font's family name is contained in an *undocumented*
|
2015-10-27 19:27:39 +01:00
|
|
|
* string of the `auxiliary data' portion of a physical font record. This
|
|
|
|
* may also contain the `real' style name!
|
2003-04-23 16:14:06 +02:00
|
|
|
*
|
|
|
|
* If no family name is present, the font ID is used instead for the
|
|
|
|
* family.
|
|
|
|
*/
|
2002-04-19 17:13:47 +02:00
|
|
|
FT_CALLBACK_DEF( FT_Error )
|
|
|
|
pfr_extra_item_load_font_id( FT_Byte* p,
|
|
|
|
FT_Byte* limit,
|
|
|
|
PFR_PhyFont phy_font )
|
|
|
|
{
|
2015-02-18 09:22:06 +01:00
|
|
|
FT_Error error = FT_Err_Ok;
|
|
|
|
FT_Memory memory = phy_font->memory;
|
|
|
|
FT_UInt len = (FT_UInt)( limit - p );
|
* src/pfr/pfrsbit.h, src/pfr/pfrsbit.c, src/pfr/pfrload.c,
src/pfr/pfrgload.c, src/pfr/pfrobjs.c, src/pfr/pfrtypes.h,
Jamfile, src/base/ftobjs.c: adding support for embedded bitmaps to
the PFR driver, and rewriting its kerning loader / handler to use all
kerning pairs in a physical font (and not just the first item).
* src/tools/docmaker/content.py, src/tools/docmaker/sources.py,
src/tools/docmaker/tohtml.py: fixing a few nasty bugs
* src/sfnt/ttcmap0.c: the validator for format 4 sub-tables is
now capable of dealing with invalid "length" fields at the start
of the sub-table. This allows fonts like "mg______.ttf" (i.e.
Marriage) to return accurate charmaps.
2002-10-05 16:57:03 +02:00
|
|
|
|
2002-04-20 07:38:33 +02:00
|
|
|
|
2016-12-26 17:08:17 +01:00
|
|
|
if ( phy_font->font_id )
|
2002-04-19 17:13:47 +02:00
|
|
|
goto Exit;
|
* src/pfr/pfrsbit.h, src/pfr/pfrsbit.c, src/pfr/pfrload.c,
src/pfr/pfrgload.c, src/pfr/pfrobjs.c, src/pfr/pfrtypes.h,
Jamfile, src/base/ftobjs.c: adding support for embedded bitmaps to
the PFR driver, and rewriting its kerning loader / handler to use all
kerning pairs in a physical font (and not just the first item).
* src/tools/docmaker/content.py, src/tools/docmaker/sources.py,
src/tools/docmaker/tohtml.py: fixing a few nasty bugs
* src/sfnt/ttcmap0.c: the validator for format 4 sub-tables is
now capable of dealing with invalid "length" fields at the start
of the sub-table. This allows fonts like "mg______.ttf" (i.e.
Marriage) to return accurate charmaps.
2002-10-05 16:57:03 +02:00
|
|
|
|
2021-04-23 14:35:02 +02:00
|
|
|
if ( FT_QALLOC( phy_font->font_id, len + 1 ) )
|
2002-04-19 17:13:47 +02:00
|
|
|
goto Exit;
|
|
|
|
|
|
|
|
/* copy font ID name, and terminate it for safety */
|
|
|
|
FT_MEM_COPY( phy_font->font_id, p, len );
|
|
|
|
phy_font->font_id[len] = 0;
|
* src/pfr/pfrsbit.h, src/pfr/pfrsbit.c, src/pfr/pfrload.c,
src/pfr/pfrgload.c, src/pfr/pfrobjs.c, src/pfr/pfrtypes.h,
Jamfile, src/base/ftobjs.c: adding support for embedded bitmaps to
the PFR driver, and rewriting its kerning loader / handler to use all
kerning pairs in a physical font (and not just the first item).
* src/tools/docmaker/content.py, src/tools/docmaker/sources.py,
src/tools/docmaker/tohtml.py: fixing a few nasty bugs
* src/sfnt/ttcmap0.c: the validator for format 4 sub-tables is
now capable of dealing with invalid "length" fields at the start
of the sub-table. This allows fonts like "mg______.ttf" (i.e.
Marriage) to return accurate charmaps.
2002-10-05 16:57:03 +02:00
|
|
|
|
2002-04-19 17:13:47 +02:00
|
|
|
Exit:
|
|
|
|
return error;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2002-04-20 07:38:33 +02:00
|
|
|
/* load stem snap tables */
|
2002-04-19 17:13:47 +02:00
|
|
|
FT_CALLBACK_DEF( FT_Error )
|
|
|
|
pfr_extra_item_load_stem_snaps( FT_Byte* p,
|
|
|
|
FT_Byte* limit,
|
|
|
|
PFR_PhyFont phy_font )
|
|
|
|
{
|
2002-04-20 07:38:33 +02:00
|
|
|
FT_UInt count, num_vert, num_horz;
|
2011-06-14 19:48:33 +02:00
|
|
|
FT_Int* snaps = NULL;
|
2013-03-14 11:21:17 +01:00
|
|
|
FT_Error error = FT_Err_Ok;
|
2002-04-20 07:38:33 +02:00
|
|
|
FT_Memory memory = phy_font->memory;
|
|
|
|
|
2002-04-19 17:13:47 +02:00
|
|
|
|
2016-12-26 17:08:17 +01:00
|
|
|
if ( phy_font->vertical.stem_snaps )
|
2002-04-19 17:13:47 +02:00
|
|
|
goto Exit;
|
* src/pfr/pfrsbit.h, src/pfr/pfrsbit.c, src/pfr/pfrload.c,
src/pfr/pfrgload.c, src/pfr/pfrobjs.c, src/pfr/pfrtypes.h,
Jamfile, src/base/ftobjs.c: adding support for embedded bitmaps to
the PFR driver, and rewriting its kerning loader / handler to use all
kerning pairs in a physical font (and not just the first item).
* src/tools/docmaker/content.py, src/tools/docmaker/sources.py,
src/tools/docmaker/tohtml.py: fixing a few nasty bugs
* src/sfnt/ttcmap0.c: the validator for format 4 sub-tables is
now capable of dealing with invalid "length" fields at the start
of the sub-table. This allows fonts like "mg______.ttf" (i.e.
Marriage) to return accurate charmaps.
2002-10-05 16:57:03 +02:00
|
|
|
|
2002-04-20 07:38:33 +02:00
|
|
|
PFR_CHECK( 1 );
|
|
|
|
count = PFR_NEXT_BYTE( p );
|
* src/pfr/pfrsbit.h, src/pfr/pfrsbit.c, src/pfr/pfrload.c,
src/pfr/pfrgload.c, src/pfr/pfrobjs.c, src/pfr/pfrtypes.h,
Jamfile, src/base/ftobjs.c: adding support for embedded bitmaps to
the PFR driver, and rewriting its kerning loader / handler to use all
kerning pairs in a physical font (and not just the first item).
* src/tools/docmaker/content.py, src/tools/docmaker/sources.py,
src/tools/docmaker/tohtml.py: fixing a few nasty bugs
* src/sfnt/ttcmap0.c: the validator for format 4 sub-tables is
now capable of dealing with invalid "length" fields at the start
of the sub-table. This allows fonts like "mg______.ttf" (i.e.
Marriage) to return accurate charmaps.
2002-10-05 16:57:03 +02:00
|
|
|
|
2002-04-19 17:13:47 +02:00
|
|
|
num_vert = count & 15;
|
|
|
|
num_horz = count >> 4;
|
|
|
|
count = num_vert + num_horz;
|
* src/pfr/pfrsbit.h, src/pfr/pfrsbit.c, src/pfr/pfrload.c,
src/pfr/pfrgload.c, src/pfr/pfrobjs.c, src/pfr/pfrtypes.h,
Jamfile, src/base/ftobjs.c: adding support for embedded bitmaps to
the PFR driver, and rewriting its kerning loader / handler to use all
kerning pairs in a physical font (and not just the first item).
* src/tools/docmaker/content.py, src/tools/docmaker/sources.py,
src/tools/docmaker/tohtml.py: fixing a few nasty bugs
* src/sfnt/ttcmap0.c: the validator for format 4 sub-tables is
now capable of dealing with invalid "length" fields at the start
of the sub-table. This allows fonts like "mg______.ttf" (i.e.
Marriage) to return accurate charmaps.
2002-10-05 16:57:03 +02:00
|
|
|
|
2002-04-20 07:38:33 +02:00
|
|
|
PFR_CHECK( count * 2 );
|
* src/pfr/pfrsbit.h, src/pfr/pfrsbit.c, src/pfr/pfrload.c,
src/pfr/pfrgload.c, src/pfr/pfrobjs.c, src/pfr/pfrtypes.h,
Jamfile, src/base/ftobjs.c: adding support for embedded bitmaps to
the PFR driver, and rewriting its kerning loader / handler to use all
kerning pairs in a physical font (and not just the first item).
* src/tools/docmaker/content.py, src/tools/docmaker/sources.py,
src/tools/docmaker/tohtml.py: fixing a few nasty bugs
* src/sfnt/ttcmap0.c: the validator for format 4 sub-tables is
now capable of dealing with invalid "length" fields at the start
of the sub-table. This allows fonts like "mg______.ttf" (i.e.
Marriage) to return accurate charmaps.
2002-10-05 16:57:03 +02:00
|
|
|
|
2021-04-26 23:14:28 +02:00
|
|
|
if ( FT_QNEW_ARRAY( snaps, count ) )
|
2002-04-19 17:13:47 +02:00
|
|
|
goto Exit;
|
* src/pfr/pfrsbit.h, src/pfr/pfrsbit.c, src/pfr/pfrload.c,
src/pfr/pfrgload.c, src/pfr/pfrobjs.c, src/pfr/pfrtypes.h,
Jamfile, src/base/ftobjs.c: adding support for embedded bitmaps to
the PFR driver, and rewriting its kerning loader / handler to use all
kerning pairs in a physical font (and not just the first item).
* src/tools/docmaker/content.py, src/tools/docmaker/sources.py,
src/tools/docmaker/tohtml.py: fixing a few nasty bugs
* src/sfnt/ttcmap0.c: the validator for format 4 sub-tables is
now capable of dealing with invalid "length" fields at the start
of the sub-table. This allows fonts like "mg______.ttf" (i.e.
Marriage) to return accurate charmaps.
2002-10-05 16:57:03 +02:00
|
|
|
|
2002-04-19 17:13:47 +02:00
|
|
|
phy_font->vertical.stem_snaps = snaps;
|
|
|
|
phy_font->horizontal.stem_snaps = snaps + num_vert;
|
* src/pfr/pfrsbit.h, src/pfr/pfrsbit.c, src/pfr/pfrload.c,
src/pfr/pfrgload.c, src/pfr/pfrobjs.c, src/pfr/pfrtypes.h,
Jamfile, src/base/ftobjs.c: adding support for embedded bitmaps to
the PFR driver, and rewriting its kerning loader / handler to use all
kerning pairs in a physical font (and not just the first item).
* src/tools/docmaker/content.py, src/tools/docmaker/sources.py,
src/tools/docmaker/tohtml.py: fixing a few nasty bugs
* src/sfnt/ttcmap0.c: the validator for format 4 sub-tables is
now capable of dealing with invalid "length" fields at the start
of the sub-table. This allows fonts like "mg______.ttf" (i.e.
Marriage) to return accurate charmaps.
2002-10-05 16:57:03 +02:00
|
|
|
|
2002-04-19 17:13:47 +02:00
|
|
|
for ( ; count > 0; count--, snaps++ )
|
2002-04-20 07:38:33 +02:00
|
|
|
*snaps = FT_NEXT_SHORT( p );
|
* src/pfr/pfrsbit.h, src/pfr/pfrsbit.c, src/pfr/pfrload.c,
src/pfr/pfrgload.c, src/pfr/pfrobjs.c, src/pfr/pfrtypes.h,
Jamfile, src/base/ftobjs.c: adding support for embedded bitmaps to
the PFR driver, and rewriting its kerning loader / handler to use all
kerning pairs in a physical font (and not just the first item).
* src/tools/docmaker/content.py, src/tools/docmaker/sources.py,
src/tools/docmaker/tohtml.py: fixing a few nasty bugs
* src/sfnt/ttcmap0.c: the validator for format 4 sub-tables is
now capable of dealing with invalid "length" fields at the start
of the sub-table. This allows fonts like "mg______.ttf" (i.e.
Marriage) to return accurate charmaps.
2002-10-05 16:57:03 +02:00
|
|
|
|
2002-04-19 17:13:47 +02:00
|
|
|
Exit:
|
|
|
|
return error;
|
* src/pfr/pfrsbit.h, src/pfr/pfrsbit.c, src/pfr/pfrload.c,
src/pfr/pfrgload.c, src/pfr/pfrobjs.c, src/pfr/pfrtypes.h,
Jamfile, src/base/ftobjs.c: adding support for embedded bitmaps to
the PFR driver, and rewriting its kerning loader / handler to use all
kerning pairs in a physical font (and not just the first item).
* src/tools/docmaker/content.py, src/tools/docmaker/sources.py,
src/tools/docmaker/tohtml.py: fixing a few nasty bugs
* src/sfnt/ttcmap0.c: the validator for format 4 sub-tables is
now capable of dealing with invalid "length" fields at the start
of the sub-table. This allows fonts like "mg______.ttf" (i.e.
Marriage) to return accurate charmaps.
2002-10-05 16:57:03 +02:00
|
|
|
|
2002-04-19 17:13:47 +02:00
|
|
|
Too_Short:
|
2013-03-14 10:27:35 +01:00
|
|
|
error = FT_THROW( Invalid_Table );
|
2016-04-13 06:11:52 +02:00
|
|
|
FT_ERROR(( "pfr_extra_item_load_stem_snaps:"
|
2009-06-26 06:15:41 +02:00
|
|
|
" invalid stem snaps table\n" ));
|
2002-04-19 17:13:47 +02:00
|
|
|
goto Exit;
|
* src/pfr/pfrsbit.h, src/pfr/pfrsbit.c, src/pfr/pfrload.c,
src/pfr/pfrgload.c, src/pfr/pfrobjs.c, src/pfr/pfrtypes.h,
Jamfile, src/base/ftobjs.c: adding support for embedded bitmaps to
the PFR driver, and rewriting its kerning loader / handler to use all
kerning pairs in a physical font (and not just the first item).
* src/tools/docmaker/content.py, src/tools/docmaker/sources.py,
src/tools/docmaker/tohtml.py: fixing a few nasty bugs
* src/sfnt/ttcmap0.c: the validator for format 4 sub-tables is
now capable of dealing with invalid "length" fields at the start
of the sub-table. This allows fonts like "mg______.ttf" (i.e.
Marriage) to return accurate charmaps.
2002-10-05 16:57:03 +02:00
|
|
|
}
|
|
|
|
|
2002-04-19 17:13:47 +02:00
|
|
|
|
2002-10-07 12:12:43 +02:00
|
|
|
|
* src/pfr/pfrsbit.h, src/pfr/pfrsbit.c, src/pfr/pfrload.c,
src/pfr/pfrgload.c, src/pfr/pfrobjs.c, src/pfr/pfrtypes.h,
Jamfile, src/base/ftobjs.c: adding support for embedded bitmaps to
the PFR driver, and rewriting its kerning loader / handler to use all
kerning pairs in a physical font (and not just the first item).
* src/tools/docmaker/content.py, src/tools/docmaker/sources.py,
src/tools/docmaker/tohtml.py: fixing a few nasty bugs
* src/sfnt/ttcmap0.c: the validator for format 4 sub-tables is
now capable of dealing with invalid "length" fields at the start
of the sub-table. This allows fonts like "mg______.ttf" (i.e.
Marriage) to return accurate charmaps.
2002-10-05 16:57:03 +02:00
|
|
|
/* load kerning pair data */
|
|
|
|
FT_CALLBACK_DEF( FT_Error )
|
|
|
|
pfr_extra_item_load_kerning_pairs( FT_Byte* p,
|
|
|
|
FT_Byte* limit,
|
|
|
|
PFR_PhyFont phy_font )
|
|
|
|
{
|
2010-07-12 21:13:22 +02:00
|
|
|
PFR_KernItem item = NULL;
|
2013-03-14 11:21:17 +01:00
|
|
|
FT_Error error = FT_Err_Ok;
|
* src/pfr/pfrsbit.h, src/pfr/pfrsbit.c, src/pfr/pfrload.c,
src/pfr/pfrgload.c, src/pfr/pfrobjs.c, src/pfr/pfrtypes.h,
Jamfile, src/base/ftobjs.c: adding support for embedded bitmaps to
the PFR driver, and rewriting its kerning loader / handler to use all
kerning pairs in a physical font (and not just the first item).
* src/tools/docmaker/content.py, src/tools/docmaker/sources.py,
src/tools/docmaker/tohtml.py: fixing a few nasty bugs
* src/sfnt/ttcmap0.c: the validator for format 4 sub-tables is
now capable of dealing with invalid "length" fields at the start
of the sub-table. This allows fonts like "mg______.ttf" (i.e.
Marriage) to return accurate charmaps.
2002-10-05 16:57:03 +02:00
|
|
|
FT_Memory memory = phy_font->memory;
|
2002-06-21 09:33:23 +02:00
|
|
|
|
2002-10-07 12:12:43 +02:00
|
|
|
|
* src/pfr/pfrsbit.h, src/pfr/pfrsbit.c, src/pfr/pfrload.c,
src/pfr/pfrgload.c, src/pfr/pfrobjs.c, src/pfr/pfrtypes.h,
Jamfile, src/base/ftobjs.c: adding support for embedded bitmaps to
the PFR driver, and rewriting its kerning loader / handler to use all
kerning pairs in a physical font (and not just the first item).
* src/tools/docmaker/content.py, src/tools/docmaker/sources.py,
src/tools/docmaker/tohtml.py: fixing a few nasty bugs
* src/sfnt/ttcmap0.c: the validator for format 4 sub-tables is
now capable of dealing with invalid "length" fields at the start
of the sub-table. This allows fonts like "mg______.ttf" (i.e.
Marriage) to return accurate charmaps.
2002-10-05 16:57:03 +02:00
|
|
|
if ( FT_NEW( item ) )
|
|
|
|
goto Exit;
|
|
|
|
|
|
|
|
PFR_CHECK( 4 );
|
|
|
|
|
|
|
|
item->pair_count = PFR_NEXT_BYTE( p );
|
|
|
|
item->base_adj = PFR_NEXT_SHORT( p );
|
|
|
|
item->flags = PFR_NEXT_BYTE( p );
|
2015-02-21 09:52:29 +01:00
|
|
|
item->offset = phy_font->offset +
|
|
|
|
(FT_Offset)( p - phy_font->cursor );
|
* src/pfr/pfrsbit.h, src/pfr/pfrsbit.c, src/pfr/pfrload.c,
src/pfr/pfrgload.c, src/pfr/pfrobjs.c, src/pfr/pfrtypes.h,
Jamfile, src/base/ftobjs.c: adding support for embedded bitmaps to
the PFR driver, and rewriting its kerning loader / handler to use all
kerning pairs in a physical font (and not just the first item).
* src/tools/docmaker/content.py, src/tools/docmaker/sources.py,
src/tools/docmaker/tohtml.py: fixing a few nasty bugs
* src/sfnt/ttcmap0.c: the validator for format 4 sub-tables is
now capable of dealing with invalid "length" fields at the start
of the sub-table. This allows fonts like "mg______.ttf" (i.e.
Marriage) to return accurate charmaps.
2002-10-05 16:57:03 +02:00
|
|
|
|
|
|
|
#ifndef PFR_CONFIG_NO_CHECKS
|
|
|
|
item->pair_size = 3;
|
|
|
|
|
|
|
|
if ( item->flags & PFR_KERN_2BYTE_CHAR )
|
|
|
|
item->pair_size += 2;
|
|
|
|
|
|
|
|
if ( item->flags & PFR_KERN_2BYTE_ADJ )
|
|
|
|
item->pair_size += 1;
|
|
|
|
|
|
|
|
PFR_CHECK( item->pair_count * item->pair_size );
|
|
|
|
#endif
|
|
|
|
|
|
|
|
/* load first and last pairs into the item to speed up */
|
|
|
|
/* lookup later... */
|
|
|
|
if ( item->pair_count > 0 )
|
|
|
|
{
|
|
|
|
FT_UInt char1, char2;
|
|
|
|
FT_Byte* q;
|
|
|
|
|
2002-10-07 12:12:43 +02:00
|
|
|
|
* src/pfr/pfrsbit.h, src/pfr/pfrsbit.c, src/pfr/pfrload.c,
src/pfr/pfrgload.c, src/pfr/pfrobjs.c, src/pfr/pfrtypes.h,
Jamfile, src/base/ftobjs.c: adding support for embedded bitmaps to
the PFR driver, and rewriting its kerning loader / handler to use all
kerning pairs in a physical font (and not just the first item).
* src/tools/docmaker/content.py, src/tools/docmaker/sources.py,
src/tools/docmaker/tohtml.py: fixing a few nasty bugs
* src/sfnt/ttcmap0.c: the validator for format 4 sub-tables is
now capable of dealing with invalid "length" fields at the start
of the sub-table. This allows fonts like "mg______.ttf" (i.e.
Marriage) to return accurate charmaps.
2002-10-05 16:57:03 +02:00
|
|
|
if ( item->flags & PFR_KERN_2BYTE_CHAR )
|
|
|
|
{
|
|
|
|
q = p;
|
2002-10-07 12:12:43 +02:00
|
|
|
char1 = PFR_NEXT_USHORT( q );
|
|
|
|
char2 = PFR_NEXT_USHORT( q );
|
* src/pfr/pfrsbit.h, src/pfr/pfrsbit.c, src/pfr/pfrload.c,
src/pfr/pfrgload.c, src/pfr/pfrobjs.c, src/pfr/pfrtypes.h,
Jamfile, src/base/ftobjs.c: adding support for embedded bitmaps to
the PFR driver, and rewriting its kerning loader / handler to use all
kerning pairs in a physical font (and not just the first item).
* src/tools/docmaker/content.py, src/tools/docmaker/sources.py,
src/tools/docmaker/tohtml.py: fixing a few nasty bugs
* src/sfnt/ttcmap0.c: the validator for format 4 sub-tables is
now capable of dealing with invalid "length" fields at the start
of the sub-table. This allows fonts like "mg______.ttf" (i.e.
Marriage) to return accurate charmaps.
2002-10-05 16:57:03 +02:00
|
|
|
|
2002-10-07 12:12:43 +02:00
|
|
|
item->pair1 = PFR_KERN_INDEX( char1, char2 );
|
* src/pfr/pfrsbit.h, src/pfr/pfrsbit.c, src/pfr/pfrload.c,
src/pfr/pfrgload.c, src/pfr/pfrobjs.c, src/pfr/pfrtypes.h,
Jamfile, src/base/ftobjs.c: adding support for embedded bitmaps to
the PFR driver, and rewriting its kerning loader / handler to use all
kerning pairs in a physical font (and not just the first item).
* src/tools/docmaker/content.py, src/tools/docmaker/sources.py,
src/tools/docmaker/tohtml.py: fixing a few nasty bugs
* src/sfnt/ttcmap0.c: the validator for format 4 sub-tables is
now capable of dealing with invalid "length" fields at the start
of the sub-table. This allows fonts like "mg______.ttf" (i.e.
Marriage) to return accurate charmaps.
2002-10-05 16:57:03 +02:00
|
|
|
|
2002-10-07 12:12:43 +02:00
|
|
|
q = p + item->pair_size * ( item->pair_count - 1 );
|
|
|
|
char1 = PFR_NEXT_USHORT( q );
|
|
|
|
char2 = PFR_NEXT_USHORT( q );
|
* src/pfr/pfrsbit.h, src/pfr/pfrsbit.c, src/pfr/pfrload.c,
src/pfr/pfrgload.c, src/pfr/pfrobjs.c, src/pfr/pfrtypes.h,
Jamfile, src/base/ftobjs.c: adding support for embedded bitmaps to
the PFR driver, and rewriting its kerning loader / handler to use all
kerning pairs in a physical font (and not just the first item).
* src/tools/docmaker/content.py, src/tools/docmaker/sources.py,
src/tools/docmaker/tohtml.py: fixing a few nasty bugs
* src/sfnt/ttcmap0.c: the validator for format 4 sub-tables is
now capable of dealing with invalid "length" fields at the start
of the sub-table. This allows fonts like "mg______.ttf" (i.e.
Marriage) to return accurate charmaps.
2002-10-05 16:57:03 +02:00
|
|
|
|
2002-10-07 12:12:43 +02:00
|
|
|
item->pair2 = PFR_KERN_INDEX( char1, char2 );
|
* src/pfr/pfrsbit.h, src/pfr/pfrsbit.c, src/pfr/pfrload.c,
src/pfr/pfrgload.c, src/pfr/pfrobjs.c, src/pfr/pfrtypes.h,
Jamfile, src/base/ftobjs.c: adding support for embedded bitmaps to
the PFR driver, and rewriting its kerning loader / handler to use all
kerning pairs in a physical font (and not just the first item).
* src/tools/docmaker/content.py, src/tools/docmaker/sources.py,
src/tools/docmaker/tohtml.py: fixing a few nasty bugs
* src/sfnt/ttcmap0.c: the validator for format 4 sub-tables is
now capable of dealing with invalid "length" fields at the start
of the sub-table. This allows fonts like "mg______.ttf" (i.e.
Marriage) to return accurate charmaps.
2002-10-05 16:57:03 +02:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
q = p;
|
2002-10-07 12:12:43 +02:00
|
|
|
char1 = PFR_NEXT_BYTE( q );
|
|
|
|
char2 = PFR_NEXT_BYTE( q );
|
* src/pfr/pfrsbit.h, src/pfr/pfrsbit.c, src/pfr/pfrload.c,
src/pfr/pfrgload.c, src/pfr/pfrobjs.c, src/pfr/pfrtypes.h,
Jamfile, src/base/ftobjs.c: adding support for embedded bitmaps to
the PFR driver, and rewriting its kerning loader / handler to use all
kerning pairs in a physical font (and not just the first item).
* src/tools/docmaker/content.py, src/tools/docmaker/sources.py,
src/tools/docmaker/tohtml.py: fixing a few nasty bugs
* src/sfnt/ttcmap0.c: the validator for format 4 sub-tables is
now capable of dealing with invalid "length" fields at the start
of the sub-table. This allows fonts like "mg______.ttf" (i.e.
Marriage) to return accurate charmaps.
2002-10-05 16:57:03 +02:00
|
|
|
|
2002-10-07 12:12:43 +02:00
|
|
|
item->pair1 = PFR_KERN_INDEX( char1, char2 );
|
* src/pfr/pfrsbit.h, src/pfr/pfrsbit.c, src/pfr/pfrload.c,
src/pfr/pfrgload.c, src/pfr/pfrobjs.c, src/pfr/pfrtypes.h,
Jamfile, src/base/ftobjs.c: adding support for embedded bitmaps to
the PFR driver, and rewriting its kerning loader / handler to use all
kerning pairs in a physical font (and not just the first item).
* src/tools/docmaker/content.py, src/tools/docmaker/sources.py,
src/tools/docmaker/tohtml.py: fixing a few nasty bugs
* src/sfnt/ttcmap0.c: the validator for format 4 sub-tables is
now capable of dealing with invalid "length" fields at the start
of the sub-table. This allows fonts like "mg______.ttf" (i.e.
Marriage) to return accurate charmaps.
2002-10-05 16:57:03 +02:00
|
|
|
|
2002-10-07 12:12:43 +02:00
|
|
|
q = p + item->pair_size * ( item->pair_count - 1 );
|
|
|
|
char1 = PFR_NEXT_BYTE( q );
|
|
|
|
char2 = PFR_NEXT_BYTE( q );
|
* src/pfr/pfrsbit.h, src/pfr/pfrsbit.c, src/pfr/pfrload.c,
src/pfr/pfrgload.c, src/pfr/pfrobjs.c, src/pfr/pfrtypes.h,
Jamfile, src/base/ftobjs.c: adding support for embedded bitmaps to
the PFR driver, and rewriting its kerning loader / handler to use all
kerning pairs in a physical font (and not just the first item).
* src/tools/docmaker/content.py, src/tools/docmaker/sources.py,
src/tools/docmaker/tohtml.py: fixing a few nasty bugs
* src/sfnt/ttcmap0.c: the validator for format 4 sub-tables is
now capable of dealing with invalid "length" fields at the start
of the sub-table. This allows fonts like "mg______.ttf" (i.e.
Marriage) to return accurate charmaps.
2002-10-05 16:57:03 +02:00
|
|
|
|
2002-10-07 12:12:43 +02:00
|
|
|
item->pair2 = PFR_KERN_INDEX( char1, char2 );
|
* src/pfr/pfrsbit.h, src/pfr/pfrsbit.c, src/pfr/pfrload.c,
src/pfr/pfrgload.c, src/pfr/pfrobjs.c, src/pfr/pfrtypes.h,
Jamfile, src/base/ftobjs.c: adding support for embedded bitmaps to
the PFR driver, and rewriting its kerning loader / handler to use all
kerning pairs in a physical font (and not just the first item).
* src/tools/docmaker/content.py, src/tools/docmaker/sources.py,
src/tools/docmaker/tohtml.py: fixing a few nasty bugs
* src/sfnt/ttcmap0.c: the validator for format 4 sub-tables is
now capable of dealing with invalid "length" fields at the start
of the sub-table. This allows fonts like "mg______.ttf" (i.e.
Marriage) to return accurate charmaps.
2002-10-05 16:57:03 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
/* add new item to the current list */
|
|
|
|
item->next = NULL;
|
|
|
|
*phy_font->kern_items_tail = item;
|
|
|
|
phy_font->kern_items_tail = &item->next;
|
|
|
|
phy_font->num_kern_pairs += item->pair_count;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2002-10-07 12:12:43 +02:00
|
|
|
/* empty item! */
|
* src/pfr/pfrsbit.h, src/pfr/pfrsbit.c, src/pfr/pfrload.c,
src/pfr/pfrgload.c, src/pfr/pfrobjs.c, src/pfr/pfrtypes.h,
Jamfile, src/base/ftobjs.c: adding support for embedded bitmaps to
the PFR driver, and rewriting its kerning loader / handler to use all
kerning pairs in a physical font (and not just the first item).
* src/tools/docmaker/content.py, src/tools/docmaker/sources.py,
src/tools/docmaker/tohtml.py: fixing a few nasty bugs
* src/sfnt/ttcmap0.c: the validator for format 4 sub-tables is
now capable of dealing with invalid "length" fields at the start
of the sub-table. This allows fonts like "mg______.ttf" (i.e.
Marriage) to return accurate charmaps.
2002-10-05 16:57:03 +02:00
|
|
|
FT_FREE( item );
|
|
|
|
}
|
|
|
|
|
|
|
|
Exit:
|
|
|
|
return error;
|
|
|
|
|
|
|
|
Too_Short:
|
|
|
|
FT_FREE( item );
|
|
|
|
|
2013-03-14 10:27:35 +01:00
|
|
|
error = FT_THROW( Invalid_Table );
|
2009-06-26 06:15:41 +02:00
|
|
|
FT_ERROR(( "pfr_extra_item_load_kerning_pairs:"
|
|
|
|
" invalid kerning pairs table\n" ));
|
* src/pfr/pfrsbit.h, src/pfr/pfrsbit.c, src/pfr/pfrload.c,
src/pfr/pfrgload.c, src/pfr/pfrobjs.c, src/pfr/pfrtypes.h,
Jamfile, src/base/ftobjs.c: adding support for embedded bitmaps to
the PFR driver, and rewriting its kerning loader / handler to use all
kerning pairs in a physical font (and not just the first item).
* src/tools/docmaker/content.py, src/tools/docmaker/sources.py,
src/tools/docmaker/tohtml.py: fixing a few nasty bugs
* src/sfnt/ttcmap0.c: the validator for format 4 sub-tables is
now capable of dealing with invalid "length" fields at the start
of the sub-table. This allows fonts like "mg______.ttf" (i.e.
Marriage) to return accurate charmaps.
2002-10-05 16:57:03 +02:00
|
|
|
goto Exit;
|
|
|
|
}
|
2003-09-09 22:11:56 +02:00
|
|
|
|
|
|
|
|
2002-04-20 07:38:33 +02:00
|
|
|
static const PFR_ExtraItemRec pfr_phy_font_extra_items[] =
|
2002-04-19 17:13:47 +02:00
|
|
|
{
|
2003-09-17 07:26:33 +02:00
|
|
|
{ 1, (PFR_ExtraItem_ParseFunc)pfr_extra_item_load_bitmap_info },
|
|
|
|
{ 2, (PFR_ExtraItem_ParseFunc)pfr_extra_item_load_font_id },
|
|
|
|
{ 3, (PFR_ExtraItem_ParseFunc)pfr_extra_item_load_stem_snaps },
|
|
|
|
{ 4, (PFR_ExtraItem_ParseFunc)pfr_extra_item_load_kerning_pairs },
|
2002-04-19 17:13:47 +02:00
|
|
|
{ 0, NULL }
|
|
|
|
};
|
|
|
|
|
|
|
|
|
2015-10-27 19:27:39 +01:00
|
|
|
/*
|
|
|
|
* Load a name from the auxiliary data. Since this extracts undocumented
|
2003-04-23 16:14:06 +02:00
|
|
|
* strings from the font file, we need to be careful here.
|
|
|
|
*/
|
2003-02-25 20:20:12 +01:00
|
|
|
static FT_Error
|
|
|
|
pfr_aux_name_load( FT_Byte* p,
|
|
|
|
FT_UInt len,
|
|
|
|
FT_Memory memory,
|
|
|
|
FT_String* *astring )
|
|
|
|
{
|
2013-03-14 11:21:17 +01:00
|
|
|
FT_Error error = FT_Err_Ok;
|
2003-02-25 20:20:12 +01:00
|
|
|
FT_String* result = NULL;
|
|
|
|
FT_UInt n, ok;
|
2003-02-25 22:31:25 +01:00
|
|
|
|
2003-04-23 16:14:06 +02:00
|
|
|
|
2016-03-30 18:55:27 +02:00
|
|
|
if ( *astring )
|
|
|
|
FT_FREE( *astring );
|
|
|
|
|
2003-04-23 16:14:06 +02:00
|
|
|
if ( len > 0 && p[len - 1] == 0 )
|
2003-02-25 20:20:12 +01:00
|
|
|
len--;
|
|
|
|
|
2016-03-30 08:44:46 +02:00
|
|
|
/* check that each character is ASCII */
|
|
|
|
/* for making sure not to load garbage */
|
2003-04-23 16:14:06 +02:00
|
|
|
ok = ( len > 0 );
|
2003-02-25 20:20:12 +01:00
|
|
|
for ( n = 0; n < len; n++ )
|
|
|
|
if ( p[n] < 32 || p[n] > 127 )
|
|
|
|
{
|
|
|
|
ok = 0;
|
|
|
|
break;
|
|
|
|
}
|
2003-02-25 22:31:25 +01:00
|
|
|
|
2003-02-25 20:20:12 +01:00
|
|
|
if ( ok )
|
|
|
|
{
|
2021-04-23 14:35:02 +02:00
|
|
|
if ( FT_QALLOC( result, len + 1 ) )
|
2003-02-25 20:20:12 +01:00
|
|
|
goto Exit;
|
2003-02-25 22:31:25 +01:00
|
|
|
|
2003-02-25 20:20:12 +01:00
|
|
|
FT_MEM_COPY( result, p, len );
|
|
|
|
result[len] = 0;
|
|
|
|
}
|
2016-03-30 18:55:27 +02:00
|
|
|
|
2003-02-25 20:20:12 +01:00
|
|
|
Exit:
|
|
|
|
*astring = result;
|
|
|
|
return error;
|
2003-02-25 22:31:25 +01:00
|
|
|
}
|
2003-02-25 20:20:12 +01:00
|
|
|
|
|
|
|
|
2002-04-19 17:13:47 +02:00
|
|
|
FT_LOCAL_DEF( void )
|
|
|
|
pfr_phy_font_done( PFR_PhyFont phy_font,
|
|
|
|
FT_Memory memory )
|
|
|
|
{
|
2003-02-25 20:20:12 +01:00
|
|
|
FT_FREE( phy_font->font_id );
|
|
|
|
FT_FREE( phy_font->family_name );
|
|
|
|
FT_FREE( phy_font->style_name );
|
2002-04-19 17:13:47 +02:00
|
|
|
|
|
|
|
FT_FREE( phy_font->vertical.stem_snaps );
|
|
|
|
phy_font->vertical.num_stem_snaps = 0;
|
|
|
|
|
|
|
|
phy_font->horizontal.stem_snaps = NULL;
|
|
|
|
phy_font->horizontal.num_stem_snaps = 0;
|
|
|
|
|
|
|
|
FT_FREE( phy_font->strikes );
|
|
|
|
phy_font->num_strikes = 0;
|
|
|
|
phy_font->max_strikes = 0;
|
* src/pfr/pfrsbit.h, src/pfr/pfrsbit.c, src/pfr/pfrload.c,
src/pfr/pfrgload.c, src/pfr/pfrobjs.c, src/pfr/pfrtypes.h,
Jamfile, src/base/ftobjs.c: adding support for embedded bitmaps to
the PFR driver, and rewriting its kerning loader / handler to use all
kerning pairs in a physical font (and not just the first item).
* src/tools/docmaker/content.py, src/tools/docmaker/sources.py,
src/tools/docmaker/tohtml.py: fixing a few nasty bugs
* src/sfnt/ttcmap0.c: the validator for format 4 sub-tables is
now capable of dealing with invalid "length" fields at the start
of the sub-table. This allows fonts like "mg______.ttf" (i.e.
Marriage) to return accurate charmaps.
2002-10-05 16:57:03 +02:00
|
|
|
|
2002-04-19 17:13:47 +02:00
|
|
|
FT_FREE( phy_font->chars );
|
|
|
|
phy_font->num_chars = 0;
|
|
|
|
phy_font->chars_offset = 0;
|
2002-06-02 14:11:48 +02:00
|
|
|
|
|
|
|
FT_FREE( phy_font->blue_values );
|
|
|
|
phy_font->num_blue_values = 0;
|
2002-06-21 09:33:23 +02:00
|
|
|
|
* src/pfr/pfrsbit.h, src/pfr/pfrsbit.c, src/pfr/pfrload.c,
src/pfr/pfrgload.c, src/pfr/pfrobjs.c, src/pfr/pfrtypes.h,
Jamfile, src/base/ftobjs.c: adding support for embedded bitmaps to
the PFR driver, and rewriting its kerning loader / handler to use all
kerning pairs in a physical font (and not just the first item).
* src/tools/docmaker/content.py, src/tools/docmaker/sources.py,
src/tools/docmaker/tohtml.py: fixing a few nasty bugs
* src/sfnt/ttcmap0.c: the validator for format 4 sub-tables is
now capable of dealing with invalid "length" fields at the start
of the sub-table. This allows fonts like "mg______.ttf" (i.e.
Marriage) to return accurate charmaps.
2002-10-05 16:57:03 +02:00
|
|
|
{
|
|
|
|
PFR_KernItem item, next;
|
|
|
|
|
2002-10-07 12:12:43 +02:00
|
|
|
|
* src/pfr/pfrsbit.h, src/pfr/pfrsbit.c, src/pfr/pfrload.c,
src/pfr/pfrgload.c, src/pfr/pfrobjs.c, src/pfr/pfrtypes.h,
Jamfile, src/base/ftobjs.c: adding support for embedded bitmaps to
the PFR driver, and rewriting its kerning loader / handler to use all
kerning pairs in a physical font (and not just the first item).
* src/tools/docmaker/content.py, src/tools/docmaker/sources.py,
src/tools/docmaker/tohtml.py: fixing a few nasty bugs
* src/sfnt/ttcmap0.c: the validator for format 4 sub-tables is
now capable of dealing with invalid "length" fields at the start
of the sub-table. This allows fonts like "mg______.ttf" (i.e.
Marriage) to return accurate charmaps.
2002-10-05 16:57:03 +02:00
|
|
|
item = phy_font->kern_items;
|
2002-10-07 12:12:43 +02:00
|
|
|
while ( item )
|
* src/pfr/pfrsbit.h, src/pfr/pfrsbit.c, src/pfr/pfrload.c,
src/pfr/pfrgload.c, src/pfr/pfrobjs.c, src/pfr/pfrtypes.h,
Jamfile, src/base/ftobjs.c: adding support for embedded bitmaps to
the PFR driver, and rewriting its kerning loader / handler to use all
kerning pairs in a physical font (and not just the first item).
* src/tools/docmaker/content.py, src/tools/docmaker/sources.py,
src/tools/docmaker/tohtml.py: fixing a few nasty bugs
* src/sfnt/ttcmap0.c: the validator for format 4 sub-tables is
now capable of dealing with invalid "length" fields at the start
of the sub-table. This allows fonts like "mg______.ttf" (i.e.
Marriage) to return accurate charmaps.
2002-10-05 16:57:03 +02:00
|
|
|
{
|
|
|
|
next = item->next;
|
|
|
|
FT_FREE( item );
|
|
|
|
item = next;
|
|
|
|
}
|
|
|
|
phy_font->kern_items = NULL;
|
|
|
|
phy_font->kern_items_tail = NULL;
|
|
|
|
}
|
2002-10-07 12:12:43 +02:00
|
|
|
|
2002-06-21 09:33:23 +02:00
|
|
|
phy_font->num_kern_pairs = 0;
|
2002-04-19 17:13:47 +02:00
|
|
|
}
|
* src/pfr/pfrsbit.h, src/pfr/pfrsbit.c, src/pfr/pfrload.c,
src/pfr/pfrgload.c, src/pfr/pfrobjs.c, src/pfr/pfrtypes.h,
Jamfile, src/base/ftobjs.c: adding support for embedded bitmaps to
the PFR driver, and rewriting its kerning loader / handler to use all
kerning pairs in a physical font (and not just the first item).
* src/tools/docmaker/content.py, src/tools/docmaker/sources.py,
src/tools/docmaker/tohtml.py: fixing a few nasty bugs
* src/sfnt/ttcmap0.c: the validator for format 4 sub-tables is
now capable of dealing with invalid "length" fields at the start
of the sub-table. This allows fonts like "mg______.ttf" (i.e.
Marriage) to return accurate charmaps.
2002-10-05 16:57:03 +02:00
|
|
|
|
2002-04-19 17:13:47 +02:00
|
|
|
|
|
|
|
FT_LOCAL_DEF( 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
|
|
|
{
|
|
|
|
FT_Error error;
|
|
|
|
FT_Memory memory = stream->memory;
|
2009-07-31 17:37:56 +02:00
|
|
|
FT_UInt flags;
|
|
|
|
FT_ULong num_aux;
|
2002-04-19 17:13:47 +02:00
|
|
|
FT_Byte* p;
|
|
|
|
FT_Byte* limit;
|
|
|
|
|
2002-04-20 07:38:33 +02:00
|
|
|
|
2002-04-19 17:13:47 +02:00
|
|
|
phy_font->memory = memory;
|
|
|
|
phy_font->offset = offset;
|
|
|
|
|
* src/pfr/pfrsbit.h, src/pfr/pfrsbit.c, src/pfr/pfrload.c,
src/pfr/pfrgload.c, src/pfr/pfrobjs.c, src/pfr/pfrtypes.h,
Jamfile, src/base/ftobjs.c: adding support for embedded bitmaps to
the PFR driver, and rewriting its kerning loader / handler to use all
kerning pairs in a physical font (and not just the first item).
* src/tools/docmaker/content.py, src/tools/docmaker/sources.py,
src/tools/docmaker/tohtml.py: fixing a few nasty bugs
* src/sfnt/ttcmap0.c: the validator for format 4 sub-tables is
now capable of dealing with invalid "length" fields at the start
of the sub-table. This allows fonts like "mg______.ttf" (i.e.
Marriage) to return accurate charmaps.
2002-10-05 16:57:03 +02:00
|
|
|
phy_font->kern_items = NULL;
|
|
|
|
phy_font->kern_items_tail = &phy_font->kern_items;
|
|
|
|
|
2015-10-27 19:27:39 +01:00
|
|
|
if ( FT_STREAM_SEEK( offset ) ||
|
|
|
|
FT_FRAME_ENTER( size ) )
|
2002-04-19 17:13:47 +02:00
|
|
|
goto Exit;
|
|
|
|
|
* src/pfr/pfrsbit.h, src/pfr/pfrsbit.c, src/pfr/pfrload.c,
src/pfr/pfrgload.c, src/pfr/pfrobjs.c, src/pfr/pfrtypes.h,
Jamfile, src/base/ftobjs.c: adding support for embedded bitmaps to
the PFR driver, and rewriting its kerning loader / handler to use all
kerning pairs in a physical font (and not just the first item).
* src/tools/docmaker/content.py, src/tools/docmaker/sources.py,
src/tools/docmaker/tohtml.py: fixing a few nasty bugs
* src/sfnt/ttcmap0.c: the validator for format 4 sub-tables is
now capable of dealing with invalid "length" fields at the start
of the sub-table. This allows fonts like "mg______.ttf" (i.e.
Marriage) to return accurate charmaps.
2002-10-05 16:57:03 +02:00
|
|
|
phy_font->cursor = stream->cursor;
|
|
|
|
|
2002-04-19 17:13:47 +02:00
|
|
|
p = stream->cursor;
|
|
|
|
limit = p + size;
|
|
|
|
|
|
|
|
PFR_CHECK( 15 );
|
2002-04-20 07:38:33 +02:00
|
|
|
phy_font->font_ref_number = PFR_NEXT_USHORT( p );
|
|
|
|
phy_font->outline_resolution = PFR_NEXT_USHORT( p );
|
|
|
|
phy_font->metrics_resolution = PFR_NEXT_USHORT( p );
|
|
|
|
phy_font->bbox.xMin = PFR_NEXT_SHORT( p );
|
|
|
|
phy_font->bbox.yMin = PFR_NEXT_SHORT( p );
|
|
|
|
phy_font->bbox.xMax = PFR_NEXT_SHORT( p );
|
|
|
|
phy_font->bbox.yMax = PFR_NEXT_SHORT( p );
|
|
|
|
phy_font->flags = flags = PFR_NEXT_BYTE( p );
|
2002-04-19 17:13:47 +02:00
|
|
|
|
2007-01-26 23:18:56 +01:00
|
|
|
/* get the standard advance for non-proportional fonts */
|
2002-04-19 17:13:47 +02:00
|
|
|
if ( !(flags & PFR_PHY_PROPORTIONAL) )
|
|
|
|
{
|
2002-04-20 07:38:33 +02:00
|
|
|
PFR_CHECK( 2 );
|
|
|
|
phy_font->standard_advance = PFR_NEXT_SHORT( p );
|
2002-04-19 17:13:47 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
/* load the extra items when present */
|
|
|
|
if ( flags & PFR_PHY_EXTRA_ITEMS )
|
|
|
|
{
|
2015-10-27 19:27:39 +01:00
|
|
|
error = pfr_extra_items_parse( &p, limit,
|
|
|
|
pfr_phy_font_extra_items, phy_font );
|
* src/pfr/pfrsbit.h, src/pfr/pfrsbit.c, src/pfr/pfrload.c,
src/pfr/pfrgload.c, src/pfr/pfrobjs.c, src/pfr/pfrtypes.h,
Jamfile, src/base/ftobjs.c: adding support for embedded bitmaps to
the PFR driver, and rewriting its kerning loader / handler to use all
kerning pairs in a physical font (and not just the first item).
* src/tools/docmaker/content.py, src/tools/docmaker/sources.py,
src/tools/docmaker/tohtml.py: fixing a few nasty bugs
* src/sfnt/ttcmap0.c: the validator for format 4 sub-tables is
now capable of dealing with invalid "length" fields at the start
of the sub-table. This allows fonts like "mg______.ttf" (i.e.
Marriage) to return accurate charmaps.
2002-10-05 16:57:03 +02:00
|
|
|
|
2002-04-19 17:13:47 +02:00
|
|
|
if ( error )
|
|
|
|
goto Fail;
|
|
|
|
}
|
* src/pfr/pfrsbit.h, src/pfr/pfrsbit.c, src/pfr/pfrload.c,
src/pfr/pfrgload.c, src/pfr/pfrobjs.c, src/pfr/pfrtypes.h,
Jamfile, src/base/ftobjs.c: adding support for embedded bitmaps to
the PFR driver, and rewriting its kerning loader / handler to use all
kerning pairs in a physical font (and not just the first item).
* src/tools/docmaker/content.py, src/tools/docmaker/sources.py,
src/tools/docmaker/tohtml.py: fixing a few nasty bugs
* src/sfnt/ttcmap0.c: the validator for format 4 sub-tables is
now capable of dealing with invalid "length" fields at the start
of the sub-table. This allows fonts like "mg______.ttf" (i.e.
Marriage) to return accurate charmaps.
2002-10-05 16:57:03 +02:00
|
|
|
|
2015-10-27 19:27:39 +01:00
|
|
|
/* In certain fonts, the auxiliary bytes contain interesting */
|
|
|
|
/* information. These are not in the specification but can be */
|
|
|
|
/* guessed by looking at the content of a few PFR0 fonts. */
|
2002-04-20 07:38:33 +02:00
|
|
|
PFR_CHECK( 3 );
|
|
|
|
num_aux = PFR_NEXT_ULONG( p );
|
* src/pfr/pfrsbit.h, src/pfr/pfrsbit.c, src/pfr/pfrload.c,
src/pfr/pfrgload.c, src/pfr/pfrobjs.c, src/pfr/pfrtypes.h,
Jamfile, src/base/ftobjs.c: adding support for embedded bitmaps to
the PFR driver, and rewriting its kerning loader / handler to use all
kerning pairs in a physical font (and not just the first item).
* src/tools/docmaker/content.py, src/tools/docmaker/sources.py,
src/tools/docmaker/tohtml.py: fixing a few nasty bugs
* src/sfnt/ttcmap0.c: the validator for format 4 sub-tables is
now capable of dealing with invalid "length" fields at the start
of the sub-table. This allows fonts like "mg______.ttf" (i.e.
Marriage) to return accurate charmaps.
2002-10-05 16:57:03 +02:00
|
|
|
|
2003-02-25 20:20:12 +01:00
|
|
|
if ( num_aux > 0 )
|
|
|
|
{
|
|
|
|
FT_Byte* q = p;
|
|
|
|
FT_Byte* q2;
|
2003-02-25 22:31:25 +01:00
|
|
|
|
2003-04-23 16:14:06 +02:00
|
|
|
|
2015-10-27 21:04:48 +01:00
|
|
|
PFR_CHECK_SIZE( num_aux );
|
2003-02-25 20:20:12 +01:00
|
|
|
p += num_aux;
|
2003-02-25 22:31:25 +01:00
|
|
|
|
|
|
|
while ( num_aux > 0 )
|
2003-02-25 20:20:12 +01:00
|
|
|
{
|
|
|
|
FT_UInt length, type;
|
2003-02-25 22:31:25 +01:00
|
|
|
|
2003-04-23 16:14:06 +02:00
|
|
|
|
2003-02-25 20:20:12 +01:00
|
|
|
if ( q + 4 > p )
|
|
|
|
break;
|
2003-02-25 22:31:25 +01:00
|
|
|
|
2003-04-23 16:14:06 +02:00
|
|
|
length = PFR_NEXT_USHORT( q );
|
2003-02-25 20:20:12 +01:00
|
|
|
if ( length < 4 || length > num_aux )
|
|
|
|
break;
|
2003-02-25 22:31:25 +01:00
|
|
|
|
2003-02-25 20:20:12 +01:00
|
|
|
q2 = q + length - 2;
|
2003-04-23 16:14:06 +02:00
|
|
|
type = PFR_NEXT_USHORT( q );
|
2003-02-25 20:20:12 +01:00
|
|
|
|
|
|
|
switch ( type )
|
|
|
|
{
|
2003-04-23 16:14:06 +02:00
|
|
|
case 1:
|
2015-10-27 19:27:39 +01:00
|
|
|
/* this seems to correspond to the font's family name, padded to */
|
|
|
|
/* an even number of bytes with a zero byte appended if needed */
|
2003-04-23 16:14:06 +02:00
|
|
|
error = pfr_aux_name_load( q, length - 4U, memory,
|
|
|
|
&phy_font->family_name );
|
|
|
|
if ( error )
|
|
|
|
goto Exit;
|
|
|
|
break;
|
2003-02-25 22:31:25 +01:00
|
|
|
|
2003-04-23 16:14:06 +02:00
|
|
|
case 2:
|
|
|
|
if ( q + 32 > q2 )
|
2003-02-25 20:20:12 +01:00
|
|
|
break;
|
2003-02-25 22:31:25 +01:00
|
|
|
|
2003-04-23 16:14:06 +02:00
|
|
|
q += 10;
|
|
|
|
phy_font->ascent = PFR_NEXT_SHORT( q );
|
|
|
|
phy_font->descent = PFR_NEXT_SHORT( q );
|
|
|
|
phy_font->leading = PFR_NEXT_SHORT( q );
|
|
|
|
break;
|
2003-02-25 22:31:25 +01:00
|
|
|
|
2003-04-23 16:14:06 +02:00
|
|
|
case 3:
|
2015-10-27 19:27:39 +01:00
|
|
|
/* this seems to correspond to the font's style name, padded to */
|
|
|
|
/* an even number of bytes with a zero byte appended if needed */
|
2003-04-23 16:14:06 +02:00
|
|
|
error = pfr_aux_name_load( q, length - 4U, memory,
|
|
|
|
&phy_font->style_name );
|
|
|
|
if ( error )
|
|
|
|
goto Exit;
|
|
|
|
break;
|
|
|
|
|
|
|
|
default:
|
|
|
|
;
|
2003-02-25 20:20:12 +01:00
|
|
|
}
|
2003-04-23 16:14:06 +02:00
|
|
|
|
2003-02-25 20:20:12 +01:00
|
|
|
q = q2;
|
|
|
|
num_aux -= length;
|
|
|
|
}
|
|
|
|
}
|
2002-04-19 17:13:47 +02:00
|
|
|
|
|
|
|
/* read the blue values */
|
|
|
|
{
|
|
|
|
FT_UInt n, count;
|
|
|
|
|
2003-04-23 16:14:06 +02:00
|
|
|
|
2002-04-19 17:13:47 +02:00
|
|
|
PFR_CHECK( 1 );
|
2002-04-20 07:38:33 +02:00
|
|
|
phy_font->num_blue_values = count = PFR_NEXT_BYTE( p );
|
2002-04-19 17:13:47 +02:00
|
|
|
|
2002-04-20 07:38:33 +02:00
|
|
|
PFR_CHECK( count * 2 );
|
* src/pfr/pfrsbit.h, src/pfr/pfrsbit.c, src/pfr/pfrload.c,
src/pfr/pfrgload.c, src/pfr/pfrobjs.c, src/pfr/pfrtypes.h,
Jamfile, src/base/ftobjs.c: adding support for embedded bitmaps to
the PFR driver, and rewriting its kerning loader / handler to use all
kerning pairs in a physical font (and not just the first item).
* src/tools/docmaker/content.py, src/tools/docmaker/sources.py,
src/tools/docmaker/tohtml.py: fixing a few nasty bugs
* src/sfnt/ttcmap0.c: the validator for format 4 sub-tables is
now capable of dealing with invalid "length" fields at the start
of the sub-table. This allows fonts like "mg______.ttf" (i.e.
Marriage) to return accurate charmaps.
2002-10-05 16:57:03 +02:00
|
|
|
|
2021-04-26 23:14:28 +02:00
|
|
|
if ( FT_QNEW_ARRAY( phy_font->blue_values, count ) )
|
2002-04-19 17:13:47 +02:00
|
|
|
goto Fail;
|
|
|
|
|
|
|
|
for ( n = 0; n < count; n++ )
|
2002-04-20 07:38:33 +02:00
|
|
|
phy_font->blue_values[n] = PFR_NEXT_SHORT( p );
|
2002-04-19 17:13:47 +02:00
|
|
|
}
|
|
|
|
|
2002-04-20 07:38:33 +02:00
|
|
|
PFR_CHECK( 8 );
|
|
|
|
phy_font->blue_fuzz = PFR_NEXT_BYTE( p );
|
|
|
|
phy_font->blue_scale = PFR_NEXT_BYTE( p );
|
2002-04-19 17:13:47 +02:00
|
|
|
|
2002-04-20 07:38:33 +02:00
|
|
|
phy_font->vertical.standard = PFR_NEXT_USHORT( p );
|
|
|
|
phy_font->horizontal.standard = PFR_NEXT_USHORT( p );
|
2002-04-19 17:13:47 +02:00
|
|
|
|
|
|
|
/* read the character descriptors */
|
|
|
|
{
|
2002-04-20 07:38:33 +02:00
|
|
|
FT_UInt n, count, Size;
|
2002-04-19 17:13:47 +02:00
|
|
|
|
2002-04-20 07:38:33 +02:00
|
|
|
|
|
|
|
phy_font->num_chars = count = PFR_NEXT_USHORT( p );
|
2015-02-21 09:52:29 +01:00
|
|
|
phy_font->chars_offset = offset + (FT_Offset)( p - stream->cursor );
|
2002-04-19 17:13:47 +02:00
|
|
|
|
2002-04-20 07:38:33 +02:00
|
|
|
Size = 1 + 1 + 2;
|
2002-04-19 17:13:47 +02:00
|
|
|
if ( flags & PFR_PHY_2BYTE_CHARCODE )
|
2002-04-20 07:38:33 +02:00
|
|
|
Size += 1;
|
* src/pfr/pfrsbit.h, src/pfr/pfrsbit.c, src/pfr/pfrload.c,
src/pfr/pfrgload.c, src/pfr/pfrobjs.c, src/pfr/pfrtypes.h,
Jamfile, src/base/ftobjs.c: adding support for embedded bitmaps to
the PFR driver, and rewriting its kerning loader / handler to use all
kerning pairs in a physical font (and not just the first item).
* src/tools/docmaker/content.py, src/tools/docmaker/sources.py,
src/tools/docmaker/tohtml.py: fixing a few nasty bugs
* src/sfnt/ttcmap0.c: the validator for format 4 sub-tables is
now capable of dealing with invalid "length" fields at the start
of the sub-table. This allows fonts like "mg______.ttf" (i.e.
Marriage) to return accurate charmaps.
2002-10-05 16:57:03 +02:00
|
|
|
|
2002-04-19 17:13:47 +02:00
|
|
|
if ( flags & PFR_PHY_PROPORTIONAL )
|
2002-04-20 07:38:33 +02:00
|
|
|
Size += 2;
|
* src/pfr/pfrsbit.h, src/pfr/pfrsbit.c, src/pfr/pfrload.c,
src/pfr/pfrgload.c, src/pfr/pfrobjs.c, src/pfr/pfrtypes.h,
Jamfile, src/base/ftobjs.c: adding support for embedded bitmaps to
the PFR driver, and rewriting its kerning loader / handler to use all
kerning pairs in a physical font (and not just the first item).
* src/tools/docmaker/content.py, src/tools/docmaker/sources.py,
src/tools/docmaker/tohtml.py: fixing a few nasty bugs
* src/sfnt/ttcmap0.c: the validator for format 4 sub-tables is
now capable of dealing with invalid "length" fields at the start
of the sub-table. This allows fonts like "mg______.ttf" (i.e.
Marriage) to return accurate charmaps.
2002-10-05 16:57:03 +02:00
|
|
|
|
2002-04-19 17:13:47 +02:00
|
|
|
if ( flags & PFR_PHY_ASCII_CODE )
|
2002-04-20 07:38:33 +02:00
|
|
|
Size += 1;
|
* src/pfr/pfrsbit.h, src/pfr/pfrsbit.c, src/pfr/pfrload.c,
src/pfr/pfrgload.c, src/pfr/pfrobjs.c, src/pfr/pfrtypes.h,
Jamfile, src/base/ftobjs.c: adding support for embedded bitmaps to
the PFR driver, and rewriting its kerning loader / handler to use all
kerning pairs in a physical font (and not just the first item).
* src/tools/docmaker/content.py, src/tools/docmaker/sources.py,
src/tools/docmaker/tohtml.py: fixing a few nasty bugs
* src/sfnt/ttcmap0.c: the validator for format 4 sub-tables is
now capable of dealing with invalid "length" fields at the start
of the sub-table. This allows fonts like "mg______.ttf" (i.e.
Marriage) to return accurate charmaps.
2002-10-05 16:57:03 +02:00
|
|
|
|
2002-04-19 17:13:47 +02:00
|
|
|
if ( flags & PFR_PHY_2BYTE_GPS_SIZE )
|
2002-04-20 07:38:33 +02:00
|
|
|
Size += 1;
|
* src/pfr/pfrsbit.h, src/pfr/pfrsbit.c, src/pfr/pfrload.c,
src/pfr/pfrgload.c, src/pfr/pfrobjs.c, src/pfr/pfrtypes.h,
Jamfile, src/base/ftobjs.c: adding support for embedded bitmaps to
the PFR driver, and rewriting its kerning loader / handler to use all
kerning pairs in a physical font (and not just the first item).
* src/tools/docmaker/content.py, src/tools/docmaker/sources.py,
src/tools/docmaker/tohtml.py: fixing a few nasty bugs
* src/sfnt/ttcmap0.c: the validator for format 4 sub-tables is
now capable of dealing with invalid "length" fields at the start
of the sub-table. This allows fonts like "mg______.ttf" (i.e.
Marriage) to return accurate charmaps.
2002-10-05 16:57:03 +02:00
|
|
|
|
2002-04-19 17:13:47 +02:00
|
|
|
if ( flags & PFR_PHY_3BYTE_GPS_OFFSET )
|
2002-04-20 07:38:33 +02:00
|
|
|
Size += 1;
|
* src/pfr/pfrsbit.h, src/pfr/pfrsbit.c, src/pfr/pfrload.c,
src/pfr/pfrgload.c, src/pfr/pfrobjs.c, src/pfr/pfrtypes.h,
Jamfile, src/base/ftobjs.c: adding support for embedded bitmaps to
the PFR driver, and rewriting its kerning loader / handler to use all
kerning pairs in a physical font (and not just the first item).
* src/tools/docmaker/content.py, src/tools/docmaker/sources.py,
src/tools/docmaker/tohtml.py: fixing a few nasty bugs
* src/sfnt/ttcmap0.c: the validator for format 4 sub-tables is
now capable of dealing with invalid "length" fields at the start
of the sub-table. This allows fonts like "mg______.ttf" (i.e.
Marriage) to return accurate charmaps.
2002-10-05 16:57:03 +02:00
|
|
|
|
2015-10-27 21:04:48 +01:00
|
|
|
PFR_CHECK_SIZE( count * Size );
|
|
|
|
|
2022-01-26 21:49:24 +01:00
|
|
|
if ( FT_QNEW_ARRAY( phy_font->chars, count ) )
|
2015-10-27 21:04:48 +01:00
|
|
|
goto Fail;
|
2002-04-19 17:13:47 +02:00
|
|
|
|
|
|
|
for ( n = 0; n < count; n++ )
|
|
|
|
{
|
2002-04-20 07:38:33 +02:00
|
|
|
PFR_Char cur = &phy_font->chars[n];
|
|
|
|
|
2002-04-19 17:13:47 +02:00
|
|
|
|
2002-04-20 07:38:33 +02:00
|
|
|
cur->char_code = ( flags & PFR_PHY_2BYTE_CHARCODE )
|
|
|
|
? PFR_NEXT_USHORT( p )
|
|
|
|
: PFR_NEXT_BYTE( p );
|
2002-04-19 17:13:47 +02:00
|
|
|
|
2002-04-20 07:38:33 +02:00
|
|
|
cur->advance = ( flags & PFR_PHY_PROPORTIONAL )
|
|
|
|
? PFR_NEXT_SHORT( p )
|
2015-02-21 09:52:29 +01:00
|
|
|
: phy_font->standard_advance;
|
2002-04-19 17:13:47 +02:00
|
|
|
|
|
|
|
#if 0
|
2002-04-20 07:38:33 +02:00
|
|
|
cur->ascii = ( flags & PFR_PHY_ASCII_CODE )
|
|
|
|
? PFR_NEXT_BYTE( p )
|
2002-04-19 17:13:47 +02:00
|
|
|
: 0;
|
|
|
|
#else
|
2002-04-20 07:38:33 +02:00
|
|
|
if ( flags & PFR_PHY_ASCII_CODE )
|
|
|
|
p += 1;
|
2002-04-19 17:13:47 +02:00
|
|
|
#endif
|
2002-04-20 07:38:33 +02:00
|
|
|
cur->gps_size = ( flags & PFR_PHY_2BYTE_GPS_SIZE )
|
|
|
|
? PFR_NEXT_USHORT( p )
|
|
|
|
: PFR_NEXT_BYTE( p );
|
2002-04-19 17:13:47 +02:00
|
|
|
|
2002-04-20 07:38:33 +02:00
|
|
|
cur->gps_offset = ( flags & PFR_PHY_3BYTE_GPS_OFFSET )
|
|
|
|
? PFR_NEXT_ULONG( p )
|
|
|
|
: PFR_NEXT_USHORT( p );
|
2002-04-19 17:13:47 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2003-04-23 16:14:06 +02:00
|
|
|
/* that's it! */
|
|
|
|
|
2002-04-19 17:13:47 +02:00
|
|
|
Fail:
|
|
|
|
FT_FRAME_EXIT();
|
|
|
|
|
* src/pfr/pfrsbit.h, src/pfr/pfrsbit.c, src/pfr/pfrload.c,
src/pfr/pfrgload.c, src/pfr/pfrobjs.c, src/pfr/pfrtypes.h,
Jamfile, src/base/ftobjs.c: adding support for embedded bitmaps to
the PFR driver, and rewriting its kerning loader / handler to use all
kerning pairs in a physical font (and not just the first item).
* src/tools/docmaker/content.py, src/tools/docmaker/sources.py,
src/tools/docmaker/tohtml.py: fixing a few nasty bugs
* src/sfnt/ttcmap0.c: the validator for format 4 sub-tables is
now capable of dealing with invalid "length" fields at the start
of the sub-table. This allows fonts like "mg______.ttf" (i.e.
Marriage) to return accurate charmaps.
2002-10-05 16:57:03 +02:00
|
|
|
/* save position of bitmap info */
|
|
|
|
phy_font->bct_offset = FT_STREAM_POS();
|
|
|
|
phy_font->cursor = NULL;
|
|
|
|
|
2002-04-19 17:13:47 +02:00
|
|
|
Exit:
|
|
|
|
return error;
|
* src/pfr/pfrsbit.h, src/pfr/pfrsbit.c, src/pfr/pfrload.c,
src/pfr/pfrgload.c, src/pfr/pfrobjs.c, src/pfr/pfrtypes.h,
Jamfile, src/base/ftobjs.c: adding support for embedded bitmaps to
the PFR driver, and rewriting its kerning loader / handler to use all
kerning pairs in a physical font (and not just the first item).
* src/tools/docmaker/content.py, src/tools/docmaker/sources.py,
src/tools/docmaker/tohtml.py: fixing a few nasty bugs
* src/sfnt/ttcmap0.c: the validator for format 4 sub-tables is
now capable of dealing with invalid "length" fields at the start
of the sub-table. This allows fonts like "mg______.ttf" (i.e.
Marriage) to return accurate charmaps.
2002-10-05 16:57:03 +02:00
|
|
|
|
2002-04-19 17:13:47 +02:00
|
|
|
Too_Short:
|
2013-03-14 10:27:35 +01:00
|
|
|
error = FT_THROW( Invalid_Table );
|
2002-04-19 17:13:47 +02:00
|
|
|
FT_ERROR(( "pfr_phy_font_load: invalid physical font table\n" ));
|
|
|
|
goto Fail;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2002-04-20 07:38:33 +02:00
|
|
|
/* END */
|