2018-06-03 09:01:17 +02:00
|
|
|
/****************************************************************************
|
|
|
|
*
|
|
|
|
* pfrsbit.c
|
|
|
|
*
|
|
|
|
* FreeType PFR bitmap loader (body).
|
|
|
|
*
|
2020-01-19 17:05:19 +01:00
|
|
|
* Copyright (C) 2002-2020 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-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
|
|
|
#include "pfrsbit.h"
|
|
|
|
#include "pfrload.h"
|
2020-06-08 13:31:55 +02:00
|
|
|
#include <freetype/internal/ftdebug.h>
|
|
|
|
#include <freetype/internal/ftstream.h>
|
* 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
|
|
|
|
|
|
|
#include "pfrerror.h"
|
|
|
|
|
|
|
|
#undef FT_COMPONENT
|
2018-08-15 18:13:17 +02:00
|
|
|
#define FT_COMPONENT pfr
|
* 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
|
|
|
|
* 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 BIT WRITER *****/
|
|
|
|
/***** *****/
|
|
|
|
/*************************************************************************/
|
|
|
|
/*************************************************************************/
|
|
|
|
|
2002-10-07 12:12:43 +02:00
|
|
|
typedef struct PFR_BitWriter_
|
* 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
|
|
|
FT_Byte* line; /* current line start */
|
|
|
|
FT_Int pitch; /* line size in bytes */
|
|
|
|
FT_UInt width; /* width in pixels/bits */
|
|
|
|
FT_UInt rows; /* number of remaining rows to scan */
|
|
|
|
FT_UInt total; /* total number of bits to draw */
|
* 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_BitWriterRec, *PFR_BitWriter;
|
|
|
|
|
|
|
|
|
|
|
|
static void
|
|
|
|
pfr_bitwriter_init( PFR_BitWriter writer,
|
|
|
|
FT_Bitmap* target,
|
2003-06-09 17:54:18 +02:00
|
|
|
FT_Bool decreasing )
|
* 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
|
|
|
{
|
|
|
|
writer->line = target->buffer;
|
|
|
|
writer->pitch = target->pitch;
|
|
|
|
writer->width = target->width;
|
|
|
|
writer->rows = target->rows;
|
|
|
|
writer->total = writer->width * writer->rows;
|
|
|
|
|
|
|
|
if ( !decreasing )
|
|
|
|
{
|
2015-02-21 09:52:29 +01:00
|
|
|
writer->line += writer->pitch * (FT_Int)( target->rows - 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
|
|
|
writer->pitch = -writer->pitch;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
static void
|
|
|
|
pfr_bitwriter_decode_bytes( PFR_BitWriter writer,
|
|
|
|
FT_Byte* p,
|
|
|
|
FT_Byte* limit )
|
|
|
|
{
|
2015-02-21 09:52:29 +01:00
|
|
|
FT_UInt n, reload;
|
|
|
|
FT_UInt left = writer->width;
|
* 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_Byte* cur = writer->line;
|
|
|
|
FT_UInt mask = 0x80;
|
|
|
|
FT_UInt val = 0;
|
|
|
|
FT_UInt c = 0;
|
|
|
|
|
2002-10-07 12:12:43 +02:00
|
|
|
|
2015-02-21 09:52:29 +01:00
|
|
|
n = (FT_UInt)( limit - p ) * 8;
|
* 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 ( n > writer->total )
|
|
|
|
n = writer->total;
|
|
|
|
|
|
|
|
reload = n & 7;
|
|
|
|
|
|
|
|
for ( ; n > 0; n-- )
|
|
|
|
{
|
2002-10-07 12:12:43 +02:00
|
|
|
if ( ( n & 7 ) == reload )
|
* 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
|
|
|
val = *p++;
|
|
|
|
|
|
|
|
if ( val & 0x80 )
|
|
|
|
c |= mask;
|
|
|
|
|
|
|
|
val <<= 1;
|
|
|
|
mask >>= 1;
|
|
|
|
|
|
|
|
if ( --left <= 0 )
|
|
|
|
{
|
2002-10-07 12:12:43 +02:00
|
|
|
cur[0] = (FT_Byte)c;
|
* 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
|
|
|
left = writer->width;
|
|
|
|
mask = 0x80;
|
|
|
|
|
|
|
|
writer->line += writer->pitch;
|
|
|
|
cur = writer->line;
|
|
|
|
c = 0;
|
|
|
|
}
|
|
|
|
else if ( mask == 0 )
|
|
|
|
{
|
2003-01-31 00:24:18 +01:00
|
|
|
cur[0] = (FT_Byte)c;
|
* 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
|
|
|
mask = 0x80;
|
|
|
|
c = 0;
|
2015-02-21 09:52:29 +01:00
|
|
|
cur++;
|
* 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 ( mask != 0x80 )
|
2003-04-23 16:14:06 +02:00
|
|
|
cur[0] = (FT_Byte)c;
|
* 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
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
static void
|
|
|
|
pfr_bitwriter_decode_rle1( PFR_BitWriter writer,
|
|
|
|
FT_Byte* p,
|
|
|
|
FT_Byte* limit )
|
|
|
|
{
|
2015-02-21 09:52:29 +01:00
|
|
|
FT_Int phase, count, counts[2];
|
|
|
|
FT_UInt n, reload;
|
|
|
|
FT_UInt left = writer->width;
|
* 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_Byte* cur = writer->line;
|
|
|
|
FT_UInt mask = 0x80;
|
|
|
|
FT_UInt c = 0;
|
|
|
|
|
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
|
|
|
n = writer->total;
|
|
|
|
|
|
|
|
phase = 1;
|
|
|
|
counts[0] = 0;
|
|
|
|
counts[1] = 0;
|
|
|
|
count = 0;
|
|
|
|
reload = 1;
|
|
|
|
|
|
|
|
for ( ; n > 0; n-- )
|
|
|
|
{
|
|
|
|
if ( reload )
|
|
|
|
{
|
|
|
|
do
|
|
|
|
{
|
|
|
|
if ( phase )
|
|
|
|
{
|
|
|
|
FT_Int v;
|
|
|
|
|
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 ( p >= limit )
|
|
|
|
break;
|
|
|
|
|
|
|
|
v = *p++;
|
2002-10-07 12:12:43 +02:00
|
|
|
counts[0] = v >> 4;
|
|
|
|
counts[1] = v & 15;
|
* 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
|
|
|
phase = 0;
|
|
|
|
count = counts[0];
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
phase = 1;
|
|
|
|
count = counts[1];
|
|
|
|
}
|
2002-10-07 12:12:43 +02:00
|
|
|
|
|
|
|
} while ( count == 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
|
|
|
}
|
|
|
|
|
|
|
|
if ( phase )
|
|
|
|
c |= mask;
|
|
|
|
|
|
|
|
mask >>= 1;
|
|
|
|
|
|
|
|
if ( --left <= 0 )
|
|
|
|
{
|
2015-02-21 09:52:29 +01:00
|
|
|
cur[0] = (FT_Byte)c;
|
* 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
|
|
|
left = writer->width;
|
|
|
|
mask = 0x80;
|
|
|
|
|
|
|
|
writer->line += writer->pitch;
|
|
|
|
cur = writer->line;
|
|
|
|
c = 0;
|
|
|
|
}
|
|
|
|
else if ( mask == 0 )
|
|
|
|
{
|
2003-04-23 16:14:06 +02:00
|
|
|
cur[0] = (FT_Byte)c;
|
* 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
|
|
|
mask = 0x80;
|
|
|
|
c = 0;
|
2015-02-21 09:52:29 +01:00
|
|
|
cur++;
|
* 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
|
|
|
}
|
|
|
|
|
|
|
|
reload = ( --count <= 0 );
|
|
|
|
}
|
|
|
|
|
|
|
|
if ( mask != 0x80 )
|
|
|
|
cur[0] = (FT_Byte) c;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
static void
|
|
|
|
pfr_bitwriter_decode_rle2( PFR_BitWriter writer,
|
|
|
|
FT_Byte* p,
|
|
|
|
FT_Byte* limit )
|
|
|
|
{
|
2015-02-21 09:52:29 +01:00
|
|
|
FT_Int phase, count;
|
|
|
|
FT_UInt n, reload;
|
|
|
|
FT_UInt left = writer->width;
|
* 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_Byte* cur = writer->line;
|
|
|
|
FT_UInt mask = 0x80;
|
|
|
|
FT_UInt c = 0;
|
|
|
|
|
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
|
|
|
n = writer->total;
|
|
|
|
|
2002-10-07 12:12:43 +02:00
|
|
|
phase = 1;
|
|
|
|
count = 0;
|
|
|
|
reload = 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
|
|
|
|
|
|
|
for ( ; n > 0; n-- )
|
|
|
|
{
|
|
|
|
if ( reload )
|
|
|
|
{
|
|
|
|
do
|
|
|
|
{
|
|
|
|
if ( p >= limit )
|
|
|
|
break;
|
|
|
|
|
|
|
|
count = *p++;
|
|
|
|
phase = phase ^ 1;
|
2002-10-07 12:12:43 +02:00
|
|
|
|
|
|
|
} while ( count == 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
|
|
|
}
|
|
|
|
|
|
|
|
if ( phase )
|
|
|
|
c |= mask;
|
|
|
|
|
|
|
|
mask >>= 1;
|
|
|
|
|
|
|
|
if ( --left <= 0 )
|
|
|
|
{
|
2015-02-21 09:52:29 +01:00
|
|
|
cur[0] = (FT_Byte)c;
|
* 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
|
|
|
c = 0;
|
|
|
|
mask = 0x80;
|
|
|
|
left = writer->width;
|
|
|
|
|
|
|
|
writer->line += writer->pitch;
|
|
|
|
cur = writer->line;
|
|
|
|
}
|
|
|
|
else if ( mask == 0 )
|
|
|
|
{
|
2003-04-23 16:14:06 +02:00
|
|
|
cur[0] = (FT_Byte)c;
|
* 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
|
|
|
c = 0;
|
|
|
|
mask = 0x80;
|
2015-02-21 09:52:29 +01:00
|
|
|
cur++;
|
* 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
|
|
|
}
|
|
|
|
|
|
|
|
reload = ( --count <= 0 );
|
|
|
|
}
|
|
|
|
|
|
|
|
if ( mask != 0x80 )
|
|
|
|
cur[0] = (FT_Byte) c;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/*************************************************************************/
|
|
|
|
/*************************************************************************/
|
|
|
|
/***** *****/
|
|
|
|
/***** BITMAP DATA DECODING *****/
|
|
|
|
/***** *****/
|
|
|
|
/*************************************************************************/
|
|
|
|
/*************************************************************************/
|
|
|
|
|
|
|
|
static void
|
2002-10-07 12:12:43 +02:00
|
|
|
pfr_lookup_bitmap_data( FT_Byte* base,
|
|
|
|
FT_Byte* limit,
|
2003-06-09 17:54:18 +02:00
|
|
|
FT_UInt count,
|
2016-03-26 08:00:07 +01:00
|
|
|
FT_UInt* flags,
|
2002-10-07 12:12:43 +02:00
|
|
|
FT_UInt char_code,
|
|
|
|
FT_ULong* found_offset,
|
|
|
|
FT_ULong* found_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
|
|
|
{
|
2016-03-29 08:56:03 +02:00
|
|
|
FT_UInt min, max, char_len;
|
2016-03-26 08:00:07 +01:00
|
|
|
FT_Bool two = FT_BOOL( *flags & PFR_BITMAP_2BYTE_CHARCODE );
|
2002-10-07 12:12:43 +02:00
|
|
|
FT_Byte* buff;
|
|
|
|
|
* 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
|
|
|
|
|
|
|
char_len = 4;
|
2016-03-25 10:54:37 +01:00
|
|
|
if ( two )
|
|
|
|
char_len += 1;
|
2016-03-26 08:00:07 +01:00
|
|
|
if ( *flags & PFR_BITMAP_2BYTE_SIZE )
|
2016-03-25 10:54:37 +01:00
|
|
|
char_len += 1;
|
2016-03-26 08:00:07 +01:00
|
|
|
if ( *flags & PFR_BITMAP_3BYTE_OFFSET )
|
2016-03-25 10:54:37 +01:00
|
|
|
char_len += 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
|
|
|
|
2016-03-26 08:00:07 +01:00
|
|
|
if ( !( *flags & PFR_BITMAP_CHARCODES_VALIDATED ) )
|
|
|
|
{
|
|
|
|
FT_Byte* p;
|
|
|
|
FT_Byte* lim;
|
|
|
|
FT_UInt code;
|
|
|
|
FT_Long prev_code;
|
|
|
|
|
|
|
|
|
|
|
|
*flags |= PFR_BITMAP_VALID_CHARCODES;
|
|
|
|
prev_code = -1;
|
|
|
|
lim = base + count * char_len;
|
|
|
|
|
|
|
|
if ( lim > limit )
|
|
|
|
{
|
|
|
|
FT_TRACE0(( "pfr_lookup_bitmap_data:"
|
|
|
|
" number of bitmap records too large,\n"
|
|
|
|
" "
|
|
|
|
" thus ignoring all bitmaps in this strike\n" ));
|
|
|
|
*flags &= ~PFR_BITMAP_VALID_CHARCODES;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
/* check whether records are sorted by code */
|
|
|
|
for ( p = base; p < lim; p += char_len )
|
|
|
|
{
|
|
|
|
if ( two )
|
|
|
|
code = FT_PEEK_USHORT( p );
|
|
|
|
else
|
|
|
|
code = *p;
|
|
|
|
|
2016-07-05 07:38:52 +02:00
|
|
|
if ( (FT_Long)code <= prev_code )
|
2016-03-26 08:00:07 +01:00
|
|
|
{
|
|
|
|
FT_TRACE0(( "pfr_lookup_bitmap_data:"
|
|
|
|
" bitmap records are not sorted,\n"
|
|
|
|
" "
|
|
|
|
" thus ignoring all bitmaps in this strike\n" ));
|
|
|
|
*flags &= ~PFR_BITMAP_VALID_CHARCODES;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
prev_code = code;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
*flags |= PFR_BITMAP_CHARCODES_VALIDATED;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* ignore bitmaps in case table is not valid */
|
|
|
|
/* (this might be sanitized, but PFR is dead...) */
|
|
|
|
if ( !( *flags & PFR_BITMAP_VALID_CHARCODES ) )
|
|
|
|
goto Fail;
|
|
|
|
|
2016-03-29 08:56:03 +02:00
|
|
|
min = 0;
|
|
|
|
max = 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
|
|
|
|
2016-03-29 08:56:03 +02:00
|
|
|
/* binary search */
|
|
|
|
while ( min < max )
|
* 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:56:03 +02:00
|
|
|
FT_UInt mid, code;
|
* 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:56:03 +02:00
|
|
|
mid = ( min + max ) >> 1;
|
|
|
|
buff = base + mid * char_len;
|
2002-10-07 12:12:43 +02:00
|
|
|
|
|
|
|
if ( two )
|
|
|
|
code = PFR_NEXT_USHORT( buff );
|
|
|
|
else
|
|
|
|
code = PFR_NEXT_BYTE( buff );
|
* 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 09:13:13 +02:00
|
|
|
if ( char_code < code )
|
2016-03-29 08:56:03 +02:00
|
|
|
max = mid;
|
2016-03-29 09:13:13 +02:00
|
|
|
else if ( char_code > code )
|
|
|
|
min = mid + 1;
|
|
|
|
else
|
|
|
|
goto Found_It;
|
* 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
|
|
|
}
|
|
|
|
|
|
|
|
Fail:
|
|
|
|
/* Not found */
|
|
|
|
*found_size = 0;
|
|
|
|
*found_offset = 0;
|
|
|
|
return;
|
|
|
|
|
|
|
|
Found_It:
|
2016-03-26 08:00:07 +01:00
|
|
|
if ( *flags & PFR_BITMAP_2BYTE_SIZE )
|
2002-10-07 12:12:43 +02:00
|
|
|
*found_size = PFR_NEXT_USHORT( buff );
|
|
|
|
else
|
|
|
|
*found_size = PFR_NEXT_BYTE( buff );
|
|
|
|
|
2016-03-26 08:00:07 +01:00
|
|
|
if ( *flags & PFR_BITMAP_3BYTE_OFFSET )
|
2002-10-07 12:12:43 +02:00
|
|
|
*found_offset = PFR_NEXT_ULONG( buff );
|
|
|
|
else
|
|
|
|
*found_offset = PFR_NEXT_USHORT( buff );
|
* 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
|
|
|
/* load bitmap metrics. `*padvance' must be set to the default value */
|
|
|
|
/* before calling this function */
|
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
|
|
|
static FT_Error
|
2002-10-07 12:12:43 +02:00
|
|
|
pfr_load_bitmap_metrics( FT_Byte** pdata,
|
|
|
|
FT_Byte* limit,
|
|
|
|
FT_Long scaled_advance,
|
|
|
|
FT_Long *axpos,
|
|
|
|
FT_Long *aypos,
|
|
|
|
FT_UInt *axsize,
|
|
|
|
FT_UInt *aysize,
|
|
|
|
FT_Long *aadvance,
|
|
|
|
FT_UInt *aformat )
|
* 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
|
|
|
{
|
2013-03-14 11:21:17 +01:00
|
|
|
FT_Error error = FT_Err_Ok;
|
2002-10-07 12:12:43 +02:00
|
|
|
FT_Byte flags;
|
2015-02-21 09:52:29 +01:00
|
|
|
FT_Byte b;
|
2002-10-07 12:12:43 +02:00
|
|
|
FT_Byte* p = *pdata;
|
|
|
|
FT_Long xpos, ypos, advance;
|
|
|
|
FT_UInt xsize, ysize;
|
* 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
|
|
|
|
|
|
|
PFR_CHECK( 1 );
|
|
|
|
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
|
|
|
|
|
|
|
xpos = 0;
|
|
|
|
ypos = 0;
|
|
|
|
xsize = 0;
|
|
|
|
ysize = 0;
|
|
|
|
advance = 0;
|
|
|
|
|
2002-10-07 12:12:43 +02:00
|
|
|
switch ( flags & 3 )
|
* 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
|
|
|
case 0:
|
|
|
|
PFR_CHECK( 1 );
|
2016-03-25 08:47:14 +01:00
|
|
|
b = PFR_NEXT_BYTE( p );
|
|
|
|
xpos = (FT_Char)b >> 4;
|
|
|
|
ypos = ( (FT_Char)( b << 4 ) ) >> 4;
|
2002-10-07 12:12:43 +02:00
|
|
|
break;
|
|
|
|
|
|
|
|
case 1:
|
|
|
|
PFR_CHECK( 2 );
|
|
|
|
xpos = PFR_NEXT_INT8( p );
|
|
|
|
ypos = PFR_NEXT_INT8( p );
|
|
|
|
break;
|
|
|
|
|
|
|
|
case 2:
|
|
|
|
PFR_CHECK( 4 );
|
|
|
|
xpos = PFR_NEXT_SHORT( p );
|
|
|
|
ypos = PFR_NEXT_SHORT( p );
|
|
|
|
break;
|
|
|
|
|
|
|
|
case 3:
|
|
|
|
PFR_CHECK( 6 );
|
|
|
|
xpos = PFR_NEXT_LONG( p );
|
|
|
|
ypos = PFR_NEXT_LONG( p );
|
|
|
|
break;
|
|
|
|
|
|
|
|
default:
|
|
|
|
;
|
* 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
|
|
|
}
|
|
|
|
|
|
|
|
flags >>= 2;
|
2002-10-07 12:12:43 +02:00
|
|
|
switch ( flags & 3 )
|
* 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
|
|
|
case 0:
|
|
|
|
/* blank image */
|
|
|
|
xsize = 0;
|
|
|
|
ysize = 0;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case 1:
|
|
|
|
PFR_CHECK( 1 );
|
|
|
|
b = PFR_NEXT_BYTE( p );
|
|
|
|
xsize = ( b >> 4 ) & 0xF;
|
|
|
|
ysize = b & 0xF;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case 2:
|
|
|
|
PFR_CHECK( 2 );
|
|
|
|
xsize = PFR_NEXT_BYTE( p );
|
|
|
|
ysize = PFR_NEXT_BYTE( p );
|
|
|
|
break;
|
|
|
|
|
|
|
|
case 3:
|
|
|
|
PFR_CHECK( 4 );
|
|
|
|
xsize = PFR_NEXT_USHORT( p );
|
|
|
|
ysize = PFR_NEXT_USHORT( p );
|
|
|
|
break;
|
|
|
|
|
|
|
|
default:
|
|
|
|
;
|
* 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
|
|
|
}
|
|
|
|
|
|
|
|
flags >>= 2;
|
2002-10-07 12:12:43 +02:00
|
|
|
switch ( flags & 3 )
|
* 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
|
|
|
case 0:
|
|
|
|
advance = scaled_advance;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case 1:
|
|
|
|
PFR_CHECK( 1 );
|
2016-03-29 08:56:03 +02:00
|
|
|
advance = PFR_NEXT_INT8( p ) * 256;
|
2002-10-07 12:12:43 +02:00
|
|
|
break;
|
|
|
|
|
|
|
|
case 2:
|
|
|
|
PFR_CHECK( 2 );
|
|
|
|
advance = PFR_NEXT_SHORT( p );
|
|
|
|
break;
|
|
|
|
|
|
|
|
case 3:
|
|
|
|
PFR_CHECK( 3 );
|
|
|
|
advance = PFR_NEXT_LONG( p );
|
|
|
|
break;
|
|
|
|
|
|
|
|
default:
|
|
|
|
;
|
* 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
|
|
|
}
|
|
|
|
|
|
|
|
*axpos = xpos;
|
|
|
|
*aypos = ypos;
|
|
|
|
*axsize = xsize;
|
|
|
|
*aysize = ysize;
|
|
|
|
*aadvance = advance;
|
|
|
|
*aformat = flags >> 2;
|
|
|
|
*pdata = p;
|
|
|
|
|
|
|
|
Exit:
|
|
|
|
return error;
|
|
|
|
|
|
|
|
Too_Short:
|
2013-03-14 10:27:35 +01:00
|
|
|
error = FT_THROW( Invalid_Table );
|
* 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_ERROR(( "pfr_load_bitmap_metrics: invalid glyph data\n" ));
|
|
|
|
goto Exit;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
static FT_Error
|
2002-10-07 12:12:43 +02:00
|
|
|
pfr_load_bitmap_bits( FT_Byte* p,
|
|
|
|
FT_Byte* limit,
|
|
|
|
FT_UInt format,
|
2003-06-09 17:54:18 +02:00
|
|
|
FT_Bool decreasing,
|
2002-10-07 12:12:43 +02:00
|
|
|
FT_Bitmap* target )
|
* 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
|
|
|
{
|
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
|
|
|
PFR_BitWriterRec writer;
|
|
|
|
|
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 ( target->rows > 0 && target->width > 0 )
|
|
|
|
{
|
|
|
|
pfr_bitwriter_init( &writer, target, decreasing );
|
|
|
|
|
2002-10-07 12:12:43 +02:00
|
|
|
switch ( format )
|
* 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
|
|
|
case 0: /* packed bits */
|
|
|
|
pfr_bitwriter_decode_bytes( &writer, p, limit );
|
|
|
|
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-10-07 12:12:43 +02:00
|
|
|
case 1: /* RLE1 */
|
|
|
|
pfr_bitwriter_decode_rle1( &writer, p, limit );
|
|
|
|
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-10-07 12:12:43 +02:00
|
|
|
case 2: /* RLE2 */
|
|
|
|
pfr_bitwriter_decode_rle2( &writer, p, limit );
|
|
|
|
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-10-07 12:12:43 +02:00
|
|
|
default:
|
2015-10-27 21:04:48 +01: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
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return error;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/*************************************************************************/
|
|
|
|
/*************************************************************************/
|
|
|
|
/***** *****/
|
|
|
|
/***** BITMAP LOADING *****/
|
|
|
|
/***** *****/
|
|
|
|
/*************************************************************************/
|
|
|
|
/*************************************************************************/
|
|
|
|
|
|
|
|
FT_LOCAL( FT_Error )
|
|
|
|
pfr_slot_load_bitmap( PFR_Slot glyph,
|
|
|
|
PFR_Size size,
|
2016-11-06 12:32:51 +01:00
|
|
|
FT_UInt glyph_index,
|
|
|
|
FT_Bool metrics_only )
|
* 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_Error error;
|
|
|
|
PFR_Face face = (PFR_Face) glyph->root.face;
|
|
|
|
FT_Stream stream = face->root.stream;
|
|
|
|
PFR_PhyFont phys = &face->phy_font;
|
|
|
|
FT_ULong gps_offset;
|
|
|
|
FT_ULong gps_size;
|
|
|
|
PFR_Char character;
|
|
|
|
PFR_Strike strike;
|
|
|
|
|
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
|
|
|
character = &phys->chars[glyph_index];
|
|
|
|
|
2015-10-27 19:27:39 +01:00
|
|
|
/* look up a bitmap strike corresponding to the current */
|
* 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
|
|
|
/* character dimensions */
|
|
|
|
{
|
2002-10-07 12:12:43 +02:00
|
|
|
FT_UInt 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
|
|
|
|
|
|
|
strike = phys->strikes;
|
|
|
|
for ( n = 0; n < phys->num_strikes; n++ )
|
|
|
|
{
|
2002-10-07 12:12:43 +02:00
|
|
|
if ( strike->x_ppm == (FT_UInt)size->root.metrics.x_ppem &&
|
|
|
|
strike->y_ppm == (FT_UInt)size->root.metrics.y_ppem )
|
* 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 Found_Strike;
|
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
|
|
|
strike++;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* couldn't find it */
|
2013-03-14 10:27:35 +01:00
|
|
|
return FT_THROW( Invalid_Argument );
|
* 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
|
|
|
}
|
|
|
|
|
|
|
|
Found_Strike:
|
|
|
|
|
2015-10-27 19:27:39 +01:00
|
|
|
/* now look up the glyph's position within the file */
|
* 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
|
|
|
FT_UInt char_len;
|
|
|
|
|
* 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
|
|
|
|
|
|
|
char_len = 4;
|
2016-03-25 10:54:37 +01:00
|
|
|
if ( strike->flags & PFR_BITMAP_2BYTE_CHARCODE )
|
|
|
|
char_len += 1;
|
|
|
|
if ( strike->flags & PFR_BITMAP_2BYTE_SIZE )
|
|
|
|
char_len += 1;
|
|
|
|
if ( strike->flags & PFR_BITMAP_3BYTE_OFFSET )
|
|
|
|
char_len += 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 19:27:39 +01:00
|
|
|
/* access data directly in the frame to speed lookups */
|
* 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_STREAM_SEEK( phys->bct_offset + strike->bct_offset ) ||
|
2002-10-07 12:12:43 +02:00
|
|
|
FT_FRAME_ENTER( char_len * strike->num_bitmaps ) )
|
* 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;
|
|
|
|
|
|
|
|
pfr_lookup_bitmap_data( stream->cursor,
|
|
|
|
stream->limit,
|
|
|
|
strike->num_bitmaps,
|
2016-03-26 08:00:07 +01:00
|
|
|
&strike->flags,
|
* 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
|
|
|
character->char_code,
|
|
|
|
&gps_offset,
|
|
|
|
&gps_size );
|
|
|
|
|
|
|
|
FT_FRAME_EXIT();
|
|
|
|
|
2002-10-07 12:12:43 +02:00
|
|
|
if ( gps_size == 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
|
|
|
{
|
2015-10-27 19:27:39 +01:00
|
|
|
/* could not find a bitmap program string for this glyph */
|
2013-03-14 10:27:35 +01:00
|
|
|
error = FT_THROW( Invalid_Argument );
|
* 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;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/* get the bitmap metrics */
|
|
|
|
{
|
2009-12-03 05:57:30 +01:00
|
|
|
FT_Long xpos = 0, ypos = 0, advance = 0;
|
|
|
|
FT_UInt xsize = 0, ysize = 0, format = 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
|
|
|
FT_Byte* p;
|
|
|
|
|
2002-10-07 12:12:43 +02:00
|
|
|
|
2006-02-21 17:50:17 +01:00
|
|
|
/* compute linear advance */
|
|
|
|
advance = character->advance;
|
|
|
|
if ( phys->metrics_resolution != phys->outline_resolution )
|
|
|
|
advance = FT_MulDiv( advance,
|
2015-02-21 09:52:29 +01:00
|
|
|
(FT_Long)phys->outline_resolution,
|
|
|
|
(FT_Long)phys->metrics_resolution );
|
2006-02-21 17:50:17 +01:00
|
|
|
|
|
|
|
glyph->root.linearHoriAdvance = advance;
|
|
|
|
|
2015-10-27 19:27:39 +01:00
|
|
|
/* compute default advance, i.e., scaled advance; this can be */
|
|
|
|
/* overridden in the bitmap header of certain glyphs */
|
2006-02-21 17:50:17 +01:00
|
|
|
advance = FT_MulDiv( (FT_Fixed)size->root.metrics.x_ppem << 8,
|
* 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
|
|
|
character->advance,
|
2015-02-21 09:52:29 +01:00
|
|
|
(FT_Long)phys->metrics_resolution );
|
* 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_STREAM_SEEK( face->header.gps_section_offset + gps_offset ) ||
|
2002-10-07 12:12:43 +02:00
|
|
|
FT_FRAME_ENTER( gps_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
|
|
|
goto Exit;
|
|
|
|
|
|
|
|
p = stream->cursor;
|
|
|
|
error = pfr_load_bitmap_metrics( &p, stream->limit,
|
|
|
|
advance,
|
|
|
|
&xpos, &ypos,
|
|
|
|
&xsize, &ysize,
|
|
|
|
&advance, &format );
|
2016-03-25 08:47:14 +01:00
|
|
|
if ( error )
|
|
|
|
goto Exit1;
|
2009-07-31 17:32:06 +02:00
|
|
|
|
2015-10-27 21:04:48 +01:00
|
|
|
/*
|
|
|
|
* Before allocating the target bitmap, we check whether the given
|
|
|
|
* bitmap dimensions are valid, depending on the image format.
|
|
|
|
*
|
|
|
|
* Format 0: We have a stream of pixels (with 8 pixels per byte).
|
|
|
|
*
|
|
|
|
* (xsize * ysize + 7) / 8 <= gps_size
|
|
|
|
*
|
|
|
|
* Format 1: Run-length encoding; the high nibble holds the number of
|
|
|
|
* white bits, the low nibble the number of black bits. In
|
|
|
|
* other words, a single byte can represent at most 15
|
|
|
|
* pixels.
|
|
|
|
*
|
|
|
|
* xsize * ysize <= 15 * gps_size
|
|
|
|
*
|
|
|
|
* Format 2: Run-length encoding; the high byte holds the number of
|
|
|
|
* white bits, the low byte the number of black bits. In
|
|
|
|
* other words, two bytes can represent at most 255 pixels.
|
|
|
|
*
|
|
|
|
* xsize * ysize <= 255 * (gps_size + 1) / 2
|
|
|
|
*/
|
|
|
|
switch ( format )
|
|
|
|
{
|
|
|
|
case 0:
|
|
|
|
if ( ( (FT_ULong)xsize * ysize + 7 ) / 8 > gps_size )
|
|
|
|
error = FT_THROW( Invalid_Table );
|
|
|
|
break;
|
|
|
|
case 1:
|
|
|
|
if ( (FT_ULong)xsize * ysize > 15 * gps_size )
|
|
|
|
error = FT_THROW( Invalid_Table );
|
|
|
|
break;
|
|
|
|
case 2:
|
|
|
|
if ( (FT_ULong)xsize * ysize > 255 * ( ( gps_size + 1 ) / 2 ) )
|
|
|
|
error = FT_THROW( Invalid_Table );
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
FT_ERROR(( "pfr_slot_load_bitmap: invalid image type\n" ));
|
|
|
|
error = FT_THROW( Invalid_Table );
|
|
|
|
}
|
|
|
|
|
|
|
|
if ( error )
|
|
|
|
{
|
|
|
|
if ( FT_ERR_EQ( error, Invalid_Table ) )
|
|
|
|
FT_ERROR(( "pfr_slot_load_bitmap: invalid bitmap dimensions\n" ));
|
2016-03-25 08:47:14 +01:00
|
|
|
goto Exit1;
|
2015-10-27 21:04:48 +01:00
|
|
|
}
|
|
|
|
|
2009-07-31 17:32:06 +02:00
|
|
|
/*
|
2015-02-21 09:52:29 +01:00
|
|
|
* XXX: on 16bit systems we return an error for huge bitmaps
|
|
|
|
* that cause size truncation, because truncated
|
|
|
|
* size properties make bitmap glyphs broken.
|
2009-07-31 17:32:06 +02:00
|
|
|
*/
|
2015-02-21 09:52:29 +01:00
|
|
|
if ( xpos > FT_INT_MAX ||
|
|
|
|
xpos < FT_INT_MIN ||
|
|
|
|
ysize > FT_INT_MAX ||
|
|
|
|
ypos > FT_INT_MAX - (FT_Long)ysize ||
|
2014-11-28 08:05:59 +01:00
|
|
|
ypos + (FT_Long)ysize < FT_INT_MIN )
|
2009-07-31 17:32:06 +02:00
|
|
|
{
|
|
|
|
FT_TRACE1(( "pfr_slot_load_bitmap:" ));
|
|
|
|
FT_TRACE1(( "huge bitmap glyph %dx%d over FT_GlyphSlot\n",
|
|
|
|
xpos, ypos ));
|
2013-03-14 10:27:35 +01:00
|
|
|
error = FT_THROW( Invalid_Pixel_Size );
|
2009-07-31 17:32: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
|
|
|
if ( !error )
|
|
|
|
{
|
|
|
|
glyph->root.format = FT_GLYPH_FORMAT_BITMAP;
|
2003-01-31 00:24:18 +01: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
|
|
|
/* Set up glyph bitmap and metrics */
|
2009-07-31 17:32:06 +02:00
|
|
|
|
|
|
|
/* XXX: needs casts to fit FT_Bitmap.{width|rows|pitch} */
|
2015-02-21 09:52:29 +01:00
|
|
|
glyph->root.bitmap.width = xsize;
|
|
|
|
glyph->root.bitmap.rows = ysize;
|
2009-07-31 17:32:06 +02:00
|
|
|
glyph->root.bitmap.pitch = (FT_Int)( xsize + 7 ) >> 3;
|
* 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
|
|
|
glyph->root.bitmap.pixel_mode = FT_PIXEL_MODE_MONO;
|
|
|
|
|
2009-07-31 17:32:06 +02:00
|
|
|
/* XXX: needs casts to fit FT_Glyph_Metrics.{width|height} */
|
|
|
|
glyph->root.metrics.width = (FT_Pos)xsize << 6;
|
|
|
|
glyph->root.metrics.height = (FT_Pos)ysize << 6;
|
2016-03-25 08:47:14 +01:00
|
|
|
glyph->root.metrics.horiBearingX = xpos * 64;
|
|
|
|
glyph->root.metrics.horiBearingY = ypos * 64;
|
2003-12-24 02:10:46 +01:00
|
|
|
glyph->root.metrics.horiAdvance = FT_PIX_ROUND( ( advance >> 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
|
|
|
glyph->root.metrics.vertBearingX = - glyph->root.metrics.width >> 1;
|
|
|
|
glyph->root.metrics.vertBearingY = 0;
|
|
|
|
glyph->root.metrics.vertAdvance = size->root.metrics.height;
|
|
|
|
|
2009-07-31 17:32:06 +02:00
|
|
|
/* XXX: needs casts fit FT_GlyphSlotRec.bitmap_{left|top} */
|
|
|
|
glyph->root.bitmap_left = (FT_Int)xpos;
|
2015-02-21 09:52:29 +01:00
|
|
|
glyph->root.bitmap_top = (FT_Int)( ypos + (FT_Long)ysize );
|
* 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-11-06 12:32:51 +01:00
|
|
|
if ( metrics_only )
|
|
|
|
goto Exit1;
|
|
|
|
|
* 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
|
|
|
/* Allocate and read bitmap data */
|
|
|
|
{
|
2015-02-21 09:52:29 +01:00
|
|
|
FT_ULong len = (FT_ULong)glyph->root.bitmap.pitch * ysize;
|
2003-04-23 16:14:06 +02:00
|
|
|
|
2002-10-07 12:12:43 +02:00
|
|
|
|
2003-03-20 08:04:40 +01:00
|
|
|
error = ft_glyphslot_alloc_bitmap( &glyph->root, len );
|
|
|
|
if ( !error )
|
2003-09-22 11:53:56 +02:00
|
|
|
error = pfr_load_bitmap_bits(
|
|
|
|
p,
|
|
|
|
stream->limit,
|
|
|
|
format,
|
2016-03-25 10:54:37 +01:00
|
|
|
FT_BOOL( face->header.color_flags &
|
|
|
|
PFR_FLAG_INVERT_BITMAP ),
|
2003-09-22 11:53:56 +02:00
|
|
|
&glyph->root.bitmap );
|
* 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
|
|
|
|
2016-03-25 08:47:14 +01:00
|
|
|
Exit1:
|
* 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_FRAME_EXIT();
|
|
|
|
}
|
|
|
|
|
|
|
|
Exit:
|
|
|
|
return error;
|
|
|
|
}
|
2002-10-07 12:12:43 +02:00
|
|
|
|
2015-10-27 19:27:39 +01:00
|
|
|
|
2002-10-07 12:12:43 +02:00
|
|
|
/* END */
|