2002-04-20 07:38:33 +02:00
|
|
|
/***************************************************************************/
|
|
|
|
/* */
|
|
|
|
/* pfrobjs.c */
|
|
|
|
/* */
|
|
|
|
/* FreeType PFR object methods (body). */
|
|
|
|
/* */
|
2008-10-02 00:39:05 +02:00
|
|
|
/* Copyright 2002, 2003, 2004, 2005, 2006, 2007, 2008 by */
|
2002-04-20 07:38:33 +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-19 17:13:47 +02:00
|
|
|
#include "pfrobjs.h"
|
|
|
|
#include "pfrload.h"
|
|
|
|
#include "pfrgload.h"
|
|
|
|
#include "pfrcmap.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 "pfrsbit.h"
|
2002-04-19 17:13:47 +02:00
|
|
|
#include FT_OUTLINE_H
|
|
|
|
#include FT_INTERNAL_DEBUG_H
|
|
|
|
|
2002-04-28 12:25:55 +02:00
|
|
|
#include "pfrerror.h"
|
|
|
|
|
2002-04-19 17:13:47 +02:00
|
|
|
#undef FT_COMPONENT
|
|
|
|
#define FT_COMPONENT trace_pfr
|
|
|
|
|
2002-04-20 07:38:33 +02:00
|
|
|
|
|
|
|
/*************************************************************************/
|
|
|
|
/*************************************************************************/
|
|
|
|
/***** *****/
|
|
|
|
/***** FACE OBJECT METHODS *****/
|
|
|
|
/***** *****/
|
|
|
|
/*************************************************************************/
|
|
|
|
/*************************************************************************/
|
2002-04-19 17:13:47 +02:00
|
|
|
|
|
|
|
FT_LOCAL_DEF( void )
|
* src/pfr/pfrobjs.c, src/pfr/pfrobjs.h (pfr_face_init,
pfr_face_done, pfr_face_get_kerning, pfr_slot_init, pfr_slot_done,
pfr_slot_load): Don't use PFR_XXX but FT_XXX arguments which are
typecast to the proper PFR_XXX types within the function.
Update code accordingly.
* src/pfr/pfrdrivr.c (pfr_get_kerning, pfr_get_advance,
pfr_get_metrics, pfr_get_service): Don't use PFR_XXX but FT_XXX
arguments which are typecast to the proper PFR_XXX types within the
function.
Update code accordingly.
Use FT_CALLBACK_DEF throughout.
(pfr_metrics_service_rec, pfr_driver_class): Remove casts.
2004-05-08 09:00:23 +02:00
|
|
|
pfr_face_done( FT_Face pfrface ) /* PFR_Face */
|
2002-04-19 17:13:47 +02:00
|
|
|
{
|
2008-10-02 00:39:05 +02:00
|
|
|
PFR_Face face = (PFR_Face)pfrface;
|
|
|
|
FT_Memory memory;
|
2003-04-23 16:14:06 +02:00
|
|
|
|
2003-03-13 22:07:51 +01:00
|
|
|
|
2008-10-02 00:39:05 +02:00
|
|
|
if ( !face )
|
|
|
|
return;
|
|
|
|
|
|
|
|
memory = pfrface->driver->root.memory;
|
|
|
|
|
2003-02-25 20:20:12 +01:00
|
|
|
/* we don't want dangling pointers */
|
* src/pfr/pfrobjs.c, src/pfr/pfrobjs.h (pfr_face_init,
pfr_face_done, pfr_face_get_kerning, pfr_slot_init, pfr_slot_done,
pfr_slot_load): Don't use PFR_XXX but FT_XXX arguments which are
typecast to the proper PFR_XXX types within the function.
Update code accordingly.
* src/pfr/pfrdrivr.c (pfr_get_kerning, pfr_get_advance,
pfr_get_metrics, pfr_get_service): Don't use PFR_XXX but FT_XXX
arguments which are typecast to the proper PFR_XXX types within the
function.
Update code accordingly.
Use FT_CALLBACK_DEF throughout.
(pfr_metrics_service_rec, pfr_driver_class): Remove casts.
2004-05-08 09:00:23 +02:00
|
|
|
pfrface->family_name = NULL;
|
|
|
|
pfrface->style_name = NULL;
|
2005-03-03 15:00:23 +01:00
|
|
|
|
2002-04-19 17:13:47 +02:00
|
|
|
/* finalize the physical font record */
|
2002-04-20 07:38:33 +02:00
|
|
|
pfr_phy_font_done( &face->phy_font, FT_FACE_MEMORY( face ) );
|
2002-04-19 17:13:47 +02:00
|
|
|
|
|
|
|
/* no need to finalize the logical font or the header */
|
* src/pfr/pfrobjs.c, src/pfr/pfrobjs.h (pfr_face_init,
pfr_face_done, pfr_face_get_kerning, pfr_slot_init, pfr_slot_done,
pfr_slot_load): Don't use PFR_XXX but FT_XXX arguments which are
typecast to the proper PFR_XXX types within the function.
Update code accordingly.
* src/pfr/pfrdrivr.c (pfr_get_kerning, pfr_get_advance,
pfr_get_metrics, pfr_get_service): Don't use PFR_XXX but FT_XXX
arguments which are typecast to the proper PFR_XXX types within the
function.
Update code accordingly.
Use FT_CALLBACK_DEF throughout.
(pfr_metrics_service_rec, pfr_driver_class): Remove casts.
2004-05-08 09:00:23 +02:00
|
|
|
FT_FREE( pfrface->available_sizes );
|
2002-04-19 17:13:47 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
FT_LOCAL_DEF( FT_Error )
|
* src/sfnt/ttpost.c (load_post_names, tt_face_free_ps_names,
tt_face_get_ps_name): Replace switch statement with if clauses to
make it more portable.
* src/cff/cffobjs.c (cff_face_init): Ditto.
* include/freetype/ftmodule.h (FT_Module_Class): Use `FT_Long' for
`module_size'.
* include/freetype/ftrender.h (FT_Glyph_Class_): Use `FT_Long' for
`glyph_size'.
* src/base/ftobjs.c (FT_Render_Glyph): Change second parameter to
`FT_Render_Mode'.
(FT_Render_Glyph_Internal): Change third parameter to
`FT_Render_Mode'.
* src/base/ftglyph.c (FT_Glyph_To_Bitmap): Change second parameter
to `FT_Render_Mode'.
* src/raster/ftrend1.c (ft_raster1_render): Change third parameter
to `FT_Render_Mode'.
* src/smooth/ftsmooth.c (ft_smooth_render, ft_smooth_render_lcd,
ft_smooth_render_lcd_v): Ditto.
(ft_smooth_render_generic): Change third and fifth parameter to
`FT_Render_Mode'.
* include/freetype/freetype.h, include/freetype/internal/ftobjs.h,
include/freetype/ftglyph.h: Updated.
* src/cff/cffdrivr.c (Load_Glyph), src/pcf/pcfdriver.c
(PCF_Glyph_Load), src/pfr/pfrobjs.c (pfr_slot_load),
src/winfonts/winfnt.c (FNT_Load_Glyph), src/t42/t42objs.c
(T42_GlyphSlot_Load), src/bdf/bdfdrivr.c (BDF_Glyph_Load): Change
fourth parameter to `FT_Int32'.
* src/pfr/pfrobjs.c (pfr_face_init): Add two missing parameters
and declare them as unused.
* src/cid/cidparse.h (CID_Parser): Use FT_Long for `postscript_len'.
* src/psnames/psnames.h (PS_Unicode_Value_Func): Change return
value to FT_UInt32.
* src/psnames/psmodule.c (ps_unicode_value, ps_build_unicode_table):
Updated accordingly.
* src/cff/cffdrivr.c (Get_Kerning): Use FT_Long for `middle'.
(cff_get_glyph_name): Use cast for result of ft_strlen.
* src/cff/cffparse.c (cff_parse_real): User cast for assigning
`exp'.
* src/cff/cffload.c (cff_index_get_pointers): Use FT_ULong for
some local variables.
(cff_charset_load, cff_encoding_load): Use casts to FT_UInt for some
switch statements.
(cff_font_load): Use cast in call to CFF_Load_FD_Select.
* src/cff/cffobjs.c (cff_size_init): Use more casts.
(cff_face_init): Use FT_Int32 for `flags'.
* src/cff/cffgload.c (cff_operator_seac): Use cast for assigning
`adx' and `ady'.
(cff_decoder_parse_charstrings): Use FT_ULong for third parameter.
Use more casts.
* src/cff/cffcmap.c (cff_cmap_unicode_init): Use cast for `count'.
* src/cid/cidload.c (cid_read_subrs): Use FT_ULong for `len'.
* src/cid/cidgload.c (cid_load_glyph): Add missing cast for
`cid_get_offset'.
* src/psaux/t1decode.c (t1_decoder_parse_charstrings) <18>: Use
cast for `num_points'.
(t1_decoder_init): Use cast for assigning `decoder->num_glyphs'.
* src/base/ftdebug.c (ft_debug_init): Use FT_Int.
* include/freetype/internal/ftdriver.h (FT_Slot_LoadFunc): Use
`FT_Int32' for fourth parameter.
* src/base/ftobjs.c (open_face): Use cast for calling
clazz->init_face.
* src/raster/ftraster.c (Set_High_Precision): Use `1' instead of
`1L'.
(Finalize_Profile_Table, Line_Up, ft_black_init): Use casts.
* src/raster/ftrend1.c (ft_raster1_render): Ditto.
* src/sfnt/sfnt_dir_check: Compare `magic' with unsigned long
constant.
* builds/amiga/include/freetype/config/ftmodule.h: Updated.
2002-09-27 13:09:23 +02:00
|
|
|
pfr_face_init( FT_Stream stream,
|
* src/pfr/pfrobjs.c, src/pfr/pfrobjs.h (pfr_face_init,
pfr_face_done, pfr_face_get_kerning, pfr_slot_init, pfr_slot_done,
pfr_slot_load): Don't use PFR_XXX but FT_XXX arguments which are
typecast to the proper PFR_XXX types within the function.
Update code accordingly.
* src/pfr/pfrdrivr.c (pfr_get_kerning, pfr_get_advance,
pfr_get_metrics, pfr_get_service): Don't use PFR_XXX but FT_XXX
arguments which are typecast to the proper PFR_XXX types within the
function.
Update code accordingly.
Use FT_CALLBACK_DEF throughout.
(pfr_metrics_service_rec, pfr_driver_class): Remove casts.
2004-05-08 09:00:23 +02:00
|
|
|
FT_Face pfrface,
|
* src/sfnt/ttpost.c (load_post_names, tt_face_free_ps_names,
tt_face_get_ps_name): Replace switch statement with if clauses to
make it more portable.
* src/cff/cffobjs.c (cff_face_init): Ditto.
* include/freetype/ftmodule.h (FT_Module_Class): Use `FT_Long' for
`module_size'.
* include/freetype/ftrender.h (FT_Glyph_Class_): Use `FT_Long' for
`glyph_size'.
* src/base/ftobjs.c (FT_Render_Glyph): Change second parameter to
`FT_Render_Mode'.
(FT_Render_Glyph_Internal): Change third parameter to
`FT_Render_Mode'.
* src/base/ftglyph.c (FT_Glyph_To_Bitmap): Change second parameter
to `FT_Render_Mode'.
* src/raster/ftrend1.c (ft_raster1_render): Change third parameter
to `FT_Render_Mode'.
* src/smooth/ftsmooth.c (ft_smooth_render, ft_smooth_render_lcd,
ft_smooth_render_lcd_v): Ditto.
(ft_smooth_render_generic): Change third and fifth parameter to
`FT_Render_Mode'.
* include/freetype/freetype.h, include/freetype/internal/ftobjs.h,
include/freetype/ftglyph.h: Updated.
* src/cff/cffdrivr.c (Load_Glyph), src/pcf/pcfdriver.c
(PCF_Glyph_Load), src/pfr/pfrobjs.c (pfr_slot_load),
src/winfonts/winfnt.c (FNT_Load_Glyph), src/t42/t42objs.c
(T42_GlyphSlot_Load), src/bdf/bdfdrivr.c (BDF_Glyph_Load): Change
fourth parameter to `FT_Int32'.
* src/pfr/pfrobjs.c (pfr_face_init): Add two missing parameters
and declare them as unused.
* src/cid/cidparse.h (CID_Parser): Use FT_Long for `postscript_len'.
* src/psnames/psnames.h (PS_Unicode_Value_Func): Change return
value to FT_UInt32.
* src/psnames/psmodule.c (ps_unicode_value, ps_build_unicode_table):
Updated accordingly.
* src/cff/cffdrivr.c (Get_Kerning): Use FT_Long for `middle'.
(cff_get_glyph_name): Use cast for result of ft_strlen.
* src/cff/cffparse.c (cff_parse_real): User cast for assigning
`exp'.
* src/cff/cffload.c (cff_index_get_pointers): Use FT_ULong for
some local variables.
(cff_charset_load, cff_encoding_load): Use casts to FT_UInt for some
switch statements.
(cff_font_load): Use cast in call to CFF_Load_FD_Select.
* src/cff/cffobjs.c (cff_size_init): Use more casts.
(cff_face_init): Use FT_Int32 for `flags'.
* src/cff/cffgload.c (cff_operator_seac): Use cast for assigning
`adx' and `ady'.
(cff_decoder_parse_charstrings): Use FT_ULong for third parameter.
Use more casts.
* src/cff/cffcmap.c (cff_cmap_unicode_init): Use cast for `count'.
* src/cid/cidload.c (cid_read_subrs): Use FT_ULong for `len'.
* src/cid/cidgload.c (cid_load_glyph): Add missing cast for
`cid_get_offset'.
* src/psaux/t1decode.c (t1_decoder_parse_charstrings) <18>: Use
cast for `num_points'.
(t1_decoder_init): Use cast for assigning `decoder->num_glyphs'.
* src/base/ftdebug.c (ft_debug_init): Use FT_Int.
* include/freetype/internal/ftdriver.h (FT_Slot_LoadFunc): Use
`FT_Int32' for fourth parameter.
* src/base/ftobjs.c (open_face): Use cast for calling
clazz->init_face.
* src/raster/ftraster.c (Set_High_Precision): Use `1' instead of
`1L'.
(Finalize_Profile_Table, Line_Up, ft_black_init): Use casts.
* src/raster/ftrend1.c (ft_raster1_render): Ditto.
* src/sfnt/sfnt_dir_check: Compare `magic' with unsigned long
constant.
* builds/amiga/include/freetype/config/ftmodule.h: Updated.
2002-09-27 13:09:23 +02:00
|
|
|
FT_Int face_index,
|
|
|
|
FT_Int num_params,
|
|
|
|
FT_Parameter* params )
|
2002-04-19 17:13:47 +02:00
|
|
|
{
|
* src/pfr/pfrobjs.c, src/pfr/pfrobjs.h (pfr_face_init,
pfr_face_done, pfr_face_get_kerning, pfr_slot_init, pfr_slot_done,
pfr_slot_load): Don't use PFR_XXX but FT_XXX arguments which are
typecast to the proper PFR_XXX types within the function.
Update code accordingly.
* src/pfr/pfrdrivr.c (pfr_get_kerning, pfr_get_advance,
pfr_get_metrics, pfr_get_service): Don't use PFR_XXX but FT_XXX
arguments which are typecast to the proper PFR_XXX types within the
function.
Update code accordingly.
Use FT_CALLBACK_DEF throughout.
(pfr_metrics_service_rec, pfr_driver_class): Remove casts.
2004-05-08 09:00:23 +02:00
|
|
|
PFR_Face face = (PFR_Face)pfrface;
|
2002-04-19 17:13:47 +02:00
|
|
|
FT_Error error;
|
|
|
|
|
* src/sfnt/ttpost.c (load_post_names, tt_face_free_ps_names,
tt_face_get_ps_name): Replace switch statement with if clauses to
make it more portable.
* src/cff/cffobjs.c (cff_face_init): Ditto.
* include/freetype/ftmodule.h (FT_Module_Class): Use `FT_Long' for
`module_size'.
* include/freetype/ftrender.h (FT_Glyph_Class_): Use `FT_Long' for
`glyph_size'.
* src/base/ftobjs.c (FT_Render_Glyph): Change second parameter to
`FT_Render_Mode'.
(FT_Render_Glyph_Internal): Change third parameter to
`FT_Render_Mode'.
* src/base/ftglyph.c (FT_Glyph_To_Bitmap): Change second parameter
to `FT_Render_Mode'.
* src/raster/ftrend1.c (ft_raster1_render): Change third parameter
to `FT_Render_Mode'.
* src/smooth/ftsmooth.c (ft_smooth_render, ft_smooth_render_lcd,
ft_smooth_render_lcd_v): Ditto.
(ft_smooth_render_generic): Change third and fifth parameter to
`FT_Render_Mode'.
* include/freetype/freetype.h, include/freetype/internal/ftobjs.h,
include/freetype/ftglyph.h: Updated.
* src/cff/cffdrivr.c (Load_Glyph), src/pcf/pcfdriver.c
(PCF_Glyph_Load), src/pfr/pfrobjs.c (pfr_slot_load),
src/winfonts/winfnt.c (FNT_Load_Glyph), src/t42/t42objs.c
(T42_GlyphSlot_Load), src/bdf/bdfdrivr.c (BDF_Glyph_Load): Change
fourth parameter to `FT_Int32'.
* src/pfr/pfrobjs.c (pfr_face_init): Add two missing parameters
and declare them as unused.
* src/cid/cidparse.h (CID_Parser): Use FT_Long for `postscript_len'.
* src/psnames/psnames.h (PS_Unicode_Value_Func): Change return
value to FT_UInt32.
* src/psnames/psmodule.c (ps_unicode_value, ps_build_unicode_table):
Updated accordingly.
* src/cff/cffdrivr.c (Get_Kerning): Use FT_Long for `middle'.
(cff_get_glyph_name): Use cast for result of ft_strlen.
* src/cff/cffparse.c (cff_parse_real): User cast for assigning
`exp'.
* src/cff/cffload.c (cff_index_get_pointers): Use FT_ULong for
some local variables.
(cff_charset_load, cff_encoding_load): Use casts to FT_UInt for some
switch statements.
(cff_font_load): Use cast in call to CFF_Load_FD_Select.
* src/cff/cffobjs.c (cff_size_init): Use more casts.
(cff_face_init): Use FT_Int32 for `flags'.
* src/cff/cffgload.c (cff_operator_seac): Use cast for assigning
`adx' and `ady'.
(cff_decoder_parse_charstrings): Use FT_ULong for third parameter.
Use more casts.
* src/cff/cffcmap.c (cff_cmap_unicode_init): Use cast for `count'.
* src/cid/cidload.c (cid_read_subrs): Use FT_ULong for `len'.
* src/cid/cidgload.c (cid_load_glyph): Add missing cast for
`cid_get_offset'.
* src/psaux/t1decode.c (t1_decoder_parse_charstrings) <18>: Use
cast for `num_points'.
(t1_decoder_init): Use cast for assigning `decoder->num_glyphs'.
* src/base/ftdebug.c (ft_debug_init): Use FT_Int.
* include/freetype/internal/ftdriver.h (FT_Slot_LoadFunc): Use
`FT_Int32' for fourth parameter.
* src/base/ftobjs.c (open_face): Use cast for calling
clazz->init_face.
* src/raster/ftraster.c (Set_High_Precision): Use `1' instead of
`1L'.
(Finalize_Profile_Table, Line_Up, ft_black_init): Use casts.
* src/raster/ftrend1.c (ft_raster1_render): Ditto.
* src/sfnt/sfnt_dir_check: Compare `magic' with unsigned long
constant.
* builds/amiga/include/freetype/config/ftmodule.h: Updated.
2002-09-27 13:09:23 +02:00
|
|
|
FT_UNUSED( num_params );
|
|
|
|
FT_UNUSED( params );
|
|
|
|
|
2002-04-20 07:38:33 +02:00
|
|
|
|
2002-04-19 17:13:47 +02:00
|
|
|
/* load the header and check it */
|
|
|
|
error = pfr_header_load( &face->header, stream );
|
2002-04-20 07:38:33 +02:00
|
|
|
if ( error )
|
|
|
|
goto Exit;
|
2002-04-19 17:13:47 +02:00
|
|
|
|
|
|
|
if ( !pfr_header_check( &face->header ) )
|
|
|
|
{
|
2002-04-20 07:38:33 +02:00
|
|
|
FT_TRACE4(( "pfr_face_init: not a valid PFR font\n" ));
|
2002-04-28 12:25:55 +02:00
|
|
|
error = PFR_Err_Unknown_File_Format;
|
2002-04-19 17:13:47 +02:00
|
|
|
goto Exit;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* check face index */
|
|
|
|
{
|
|
|
|
FT_UInt num_faces;
|
|
|
|
|
2002-04-20 07:38:33 +02:00
|
|
|
|
2002-04-19 17:13:47 +02:00
|
|
|
error = pfr_log_font_count( stream,
|
|
|
|
face->header.log_dir_offset,
|
|
|
|
&num_faces );
|
2002-04-20 07:38:33 +02:00
|
|
|
if ( error )
|
|
|
|
goto Exit;
|
2002-04-19 17:13:47 +02:00
|
|
|
|
* src/pfr/pfrobjs.c, src/pfr/pfrobjs.h (pfr_face_init,
pfr_face_done, pfr_face_get_kerning, pfr_slot_init, pfr_slot_done,
pfr_slot_load): Don't use PFR_XXX but FT_XXX arguments which are
typecast to the proper PFR_XXX types within the function.
Update code accordingly.
* src/pfr/pfrdrivr.c (pfr_get_kerning, pfr_get_advance,
pfr_get_metrics, pfr_get_service): Don't use PFR_XXX but FT_XXX
arguments which are typecast to the proper PFR_XXX types within the
function.
Update code accordingly.
Use FT_CALLBACK_DEF throughout.
(pfr_metrics_service_rec, pfr_driver_class): Remove casts.
2004-05-08 09:00:23 +02:00
|
|
|
pfrface->num_faces = num_faces;
|
2002-04-19 17:13:47 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
if ( face_index < 0 )
|
|
|
|
goto Exit;
|
|
|
|
|
* src/pfr/pfrobjs.c, src/pfr/pfrobjs.h (pfr_face_init,
pfr_face_done, pfr_face_get_kerning, pfr_slot_init, pfr_slot_done,
pfr_slot_load): Don't use PFR_XXX but FT_XXX arguments which are
typecast to the proper PFR_XXX types within the function.
Update code accordingly.
* src/pfr/pfrdrivr.c (pfr_get_kerning, pfr_get_advance,
pfr_get_metrics, pfr_get_service): Don't use PFR_XXX but FT_XXX
arguments which are typecast to the proper PFR_XXX types within the
function.
Update code accordingly.
Use FT_CALLBACK_DEF throughout.
(pfr_metrics_service_rec, pfr_driver_class): Remove casts.
2004-05-08 09:00:23 +02:00
|
|
|
if ( face_index >= pfrface->num_faces )
|
2002-04-19 17:13:47 +02:00
|
|
|
{
|
2002-04-20 07:38:33 +02:00
|
|
|
FT_ERROR(( "pfr_face_init: invalid face index\n" ));
|
2002-04-28 12:25:55 +02:00
|
|
|
error = PFR_Err_Invalid_Argument;
|
2002-04-19 17:13:47 +02:00
|
|
|
goto Exit;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* load the face */
|
|
|
|
error = pfr_log_font_load(
|
|
|
|
&face->log_font, stream, face_index,
|
|
|
|
face->header.log_dir_offset,
|
|
|
|
FT_BOOL( face->header.phy_font_max_size_high != 0 ) );
|
|
|
|
if ( error )
|
|
|
|
goto Exit;
|
|
|
|
|
|
|
|
/* now load the physical font descriptor */
|
2003-06-14 09:40:09 +02:00
|
|
|
error = pfr_phy_font_load( &face->phy_font, stream,
|
|
|
|
face->log_font.phys_offset,
|
|
|
|
face->log_font.phys_size );
|
|
|
|
if ( error )
|
|
|
|
goto Exit;
|
|
|
|
|
2007-01-06 08:47:45 +01:00
|
|
|
/* now set up all root face fields */
|
2003-06-14 09:40:09 +02:00
|
|
|
{
|
|
|
|
PFR_PhyFont phy_font = &face->phy_font;
|
|
|
|
|
|
|
|
|
* src/pfr/pfrobjs.c, src/pfr/pfrobjs.h (pfr_face_init,
pfr_face_done, pfr_face_get_kerning, pfr_slot_init, pfr_slot_done,
pfr_slot_load): Don't use PFR_XXX but FT_XXX arguments which are
typecast to the proper PFR_XXX types within the function.
Update code accordingly.
* src/pfr/pfrdrivr.c (pfr_get_kerning, pfr_get_advance,
pfr_get_metrics, pfr_get_service): Don't use PFR_XXX but FT_XXX
arguments which are typecast to the proper PFR_XXX types within the
function.
Update code accordingly.
Use FT_CALLBACK_DEF throughout.
(pfr_metrics_service_rec, pfr_driver_class): Remove casts.
2004-05-08 09:00:23 +02:00
|
|
|
pfrface->face_index = face_index;
|
2006-06-04 16:33:08 +02:00
|
|
|
pfrface->num_glyphs = phy_font->num_chars + 1;
|
* src/pfr/pfrobjs.c, src/pfr/pfrobjs.h (pfr_face_init,
pfr_face_done, pfr_face_get_kerning, pfr_slot_init, pfr_slot_done,
pfr_slot_load): Don't use PFR_XXX but FT_XXX arguments which are
typecast to the proper PFR_XXX types within the function.
Update code accordingly.
* src/pfr/pfrdrivr.c (pfr_get_kerning, pfr_get_advance,
pfr_get_metrics, pfr_get_service): Don't use PFR_XXX but FT_XXX
arguments which are typecast to the proper PFR_XXX types within the
function.
Update code accordingly.
Use FT_CALLBACK_DEF throughout.
(pfr_metrics_service_rec, pfr_driver_class): Remove casts.
2004-05-08 09:00:23 +02:00
|
|
|
pfrface->face_flags = FT_FACE_FLAG_SCALABLE;
|
2003-06-14 09:40:09 +02:00
|
|
|
|
2007-01-05 16:55:59 +01:00
|
|
|
/* if all characters point to the same gps_offset 0, we */
|
2007-01-06 08:47:45 +01:00
|
|
|
/* assume that the font only contains bitmaps */
|
2007-01-05 16:55:59 +01:00
|
|
|
{
|
|
|
|
FT_UInt nn;
|
|
|
|
|
2007-01-06 08:47:45 +01:00
|
|
|
|
2007-01-05 16:55:59 +01:00
|
|
|
for ( nn = 0; nn < phy_font->num_chars; nn++ )
|
|
|
|
if ( phy_font->chars[nn].gps_offset != 0 )
|
|
|
|
break;
|
|
|
|
|
|
|
|
if ( nn == phy_font->num_chars )
|
2007-01-06 08:47:45 +01:00
|
|
|
pfrface->face_flags = 0; /* not scalable */
|
2007-01-05 16:55:59 +01:00
|
|
|
}
|
|
|
|
|
2003-06-14 09:40:09 +02:00
|
|
|
if ( (phy_font->flags & PFR_PHY_PROPORTIONAL) == 0 )
|
* src/pfr/pfrobjs.c, src/pfr/pfrobjs.h (pfr_face_init,
pfr_face_done, pfr_face_get_kerning, pfr_slot_init, pfr_slot_done,
pfr_slot_load): Don't use PFR_XXX but FT_XXX arguments which are
typecast to the proper PFR_XXX types within the function.
Update code accordingly.
* src/pfr/pfrdrivr.c (pfr_get_kerning, pfr_get_advance,
pfr_get_metrics, pfr_get_service): Don't use PFR_XXX but FT_XXX
arguments which are typecast to the proper PFR_XXX types within the
function.
Update code accordingly.
Use FT_CALLBACK_DEF throughout.
(pfr_metrics_service_rec, pfr_driver_class): Remove casts.
2004-05-08 09:00:23 +02:00
|
|
|
pfrface->face_flags |= FT_FACE_FLAG_FIXED_WIDTH;
|
2003-06-14 09:40:09 +02:00
|
|
|
|
|
|
|
if ( phy_font->flags & PFR_PHY_VERTICAL )
|
* src/pfr/pfrobjs.c, src/pfr/pfrobjs.h (pfr_face_init,
pfr_face_done, pfr_face_get_kerning, pfr_slot_init, pfr_slot_done,
pfr_slot_load): Don't use PFR_XXX but FT_XXX arguments which are
typecast to the proper PFR_XXX types within the function.
Update code accordingly.
* src/pfr/pfrdrivr.c (pfr_get_kerning, pfr_get_advance,
pfr_get_metrics, pfr_get_service): Don't use PFR_XXX but FT_XXX
arguments which are typecast to the proper PFR_XXX types within the
function.
Update code accordingly.
Use FT_CALLBACK_DEF throughout.
(pfr_metrics_service_rec, pfr_driver_class): Remove casts.
2004-05-08 09:00:23 +02:00
|
|
|
pfrface->face_flags |= FT_FACE_FLAG_VERTICAL;
|
2003-06-14 09:40:09 +02:00
|
|
|
else
|
* src/pfr/pfrobjs.c, src/pfr/pfrobjs.h (pfr_face_init,
pfr_face_done, pfr_face_get_kerning, pfr_slot_init, pfr_slot_done,
pfr_slot_load): Don't use PFR_XXX but FT_XXX arguments which are
typecast to the proper PFR_XXX types within the function.
Update code accordingly.
* src/pfr/pfrdrivr.c (pfr_get_kerning, pfr_get_advance,
pfr_get_metrics, pfr_get_service): Don't use PFR_XXX but FT_XXX
arguments which are typecast to the proper PFR_XXX types within the
function.
Update code accordingly.
Use FT_CALLBACK_DEF throughout.
(pfr_metrics_service_rec, pfr_driver_class): Remove casts.
2004-05-08 09:00:23 +02:00
|
|
|
pfrface->face_flags |= FT_FACE_FLAG_HORIZONTAL;
|
2003-06-14 09:40:09 +02:00
|
|
|
|
|
|
|
if ( phy_font->num_strikes > 0 )
|
* src/pfr/pfrobjs.c, src/pfr/pfrobjs.h (pfr_face_init,
pfr_face_done, pfr_face_get_kerning, pfr_slot_init, pfr_slot_done,
pfr_slot_load): Don't use PFR_XXX but FT_XXX arguments which are
typecast to the proper PFR_XXX types within the function.
Update code accordingly.
* src/pfr/pfrdrivr.c (pfr_get_kerning, pfr_get_advance,
pfr_get_metrics, pfr_get_service): Don't use PFR_XXX but FT_XXX
arguments which are typecast to the proper PFR_XXX types within the
function.
Update code accordingly.
Use FT_CALLBACK_DEF throughout.
(pfr_metrics_service_rec, pfr_driver_class): Remove casts.
2004-05-08 09:00:23 +02:00
|
|
|
pfrface->face_flags |= FT_FACE_FLAG_FIXED_SIZES;
|
2003-06-14 09:40:09 +02:00
|
|
|
|
|
|
|
if ( phy_font->num_kern_pairs > 0 )
|
* src/pfr/pfrobjs.c, src/pfr/pfrobjs.h (pfr_face_init,
pfr_face_done, pfr_face_get_kerning, pfr_slot_init, pfr_slot_done,
pfr_slot_load): Don't use PFR_XXX but FT_XXX arguments which are
typecast to the proper PFR_XXX types within the function.
Update code accordingly.
* src/pfr/pfrdrivr.c (pfr_get_kerning, pfr_get_advance,
pfr_get_metrics, pfr_get_service): Don't use PFR_XXX but FT_XXX
arguments which are typecast to the proper PFR_XXX types within the
function.
Update code accordingly.
Use FT_CALLBACK_DEF throughout.
(pfr_metrics_service_rec, pfr_driver_class): Remove casts.
2004-05-08 09:00:23 +02:00
|
|
|
pfrface->face_flags |= FT_FACE_FLAG_KERNING;
|
2003-06-14 09:40:09 +02:00
|
|
|
|
|
|
|
/* If no family name was found in the "undocumented" auxiliary
|
|
|
|
* data, use the font ID instead. This sucks but is better than
|
|
|
|
* nothing.
|
|
|
|
*/
|
* src/pfr/pfrobjs.c, src/pfr/pfrobjs.h (pfr_face_init,
pfr_face_done, pfr_face_get_kerning, pfr_slot_init, pfr_slot_done,
pfr_slot_load): Don't use PFR_XXX but FT_XXX arguments which are
typecast to the proper PFR_XXX types within the function.
Update code accordingly.
* src/pfr/pfrdrivr.c (pfr_get_kerning, pfr_get_advance,
pfr_get_metrics, pfr_get_service): Don't use PFR_XXX but FT_XXX
arguments which are typecast to the proper PFR_XXX types within the
function.
Update code accordingly.
Use FT_CALLBACK_DEF throughout.
(pfr_metrics_service_rec, pfr_driver_class): Remove casts.
2004-05-08 09:00:23 +02:00
|
|
|
pfrface->family_name = phy_font->family_name;
|
|
|
|
if ( pfrface->family_name == NULL )
|
|
|
|
pfrface->family_name = phy_font->font_id;
|
2003-06-14 09:40:09 +02:00
|
|
|
|
|
|
|
/* note that the style name can be NULL in certain PFR fonts,
|
|
|
|
* probably meaning "Regular"
|
|
|
|
*/
|
* src/pfr/pfrobjs.c, src/pfr/pfrobjs.h (pfr_face_init,
pfr_face_done, pfr_face_get_kerning, pfr_slot_init, pfr_slot_done,
pfr_slot_load): Don't use PFR_XXX but FT_XXX arguments which are
typecast to the proper PFR_XXX types within the function.
Update code accordingly.
* src/pfr/pfrdrivr.c (pfr_get_kerning, pfr_get_advance,
pfr_get_metrics, pfr_get_service): Don't use PFR_XXX but FT_XXX
arguments which are typecast to the proper PFR_XXX types within the
function.
Update code accordingly.
Use FT_CALLBACK_DEF throughout.
(pfr_metrics_service_rec, pfr_driver_class): Remove casts.
2004-05-08 09:00:23 +02:00
|
|
|
pfrface->style_name = phy_font->style_name;
|
2003-06-14 09:40:09 +02:00
|
|
|
|
* src/pfr/pfrobjs.c, src/pfr/pfrobjs.h (pfr_face_init,
pfr_face_done, pfr_face_get_kerning, pfr_slot_init, pfr_slot_done,
pfr_slot_load): Don't use PFR_XXX but FT_XXX arguments which are
typecast to the proper PFR_XXX types within the function.
Update code accordingly.
* src/pfr/pfrdrivr.c (pfr_get_kerning, pfr_get_advance,
pfr_get_metrics, pfr_get_service): Don't use PFR_XXX but FT_XXX
arguments which are typecast to the proper PFR_XXX types within the
function.
Update code accordingly.
Use FT_CALLBACK_DEF throughout.
(pfr_metrics_service_rec, pfr_driver_class): Remove casts.
2004-05-08 09:00:23 +02:00
|
|
|
pfrface->num_fixed_sizes = 0;
|
|
|
|
pfrface->available_sizes = 0;
|
2003-06-14 09:40:09 +02:00
|
|
|
|
* src/pfr/pfrobjs.c, src/pfr/pfrobjs.h (pfr_face_init,
pfr_face_done, pfr_face_get_kerning, pfr_slot_init, pfr_slot_done,
pfr_slot_load): Don't use PFR_XXX but FT_XXX arguments which are
typecast to the proper PFR_XXX types within the function.
Update code accordingly.
* src/pfr/pfrdrivr.c (pfr_get_kerning, pfr_get_advance,
pfr_get_metrics, pfr_get_service): Don't use PFR_XXX but FT_XXX
arguments which are typecast to the proper PFR_XXX types within the
function.
Update code accordingly.
Use FT_CALLBACK_DEF throughout.
(pfr_metrics_service_rec, pfr_driver_class): Remove casts.
2004-05-08 09:00:23 +02:00
|
|
|
pfrface->bbox = phy_font->bbox;
|
|
|
|
pfrface->units_per_EM = (FT_UShort)phy_font->outline_resolution;
|
|
|
|
pfrface->ascender = (FT_Short) phy_font->bbox.yMax;
|
|
|
|
pfrface->descender = (FT_Short) phy_font->bbox.yMin;
|
2006-01-31 11:29:44 +01:00
|
|
|
|
|
|
|
pfrface->height = (FT_Short)( ( pfrface->units_per_EM * 12 ) / 10 );
|
|
|
|
if ( pfrface->height < pfrface->ascender - pfrface->descender )
|
* builds/win32/visualc/freetype.dsp: updating the project file, adding
missing base source files (e.g. ftstroke.c, ftxf86.c, etc...)
* src/autofit/afcjk.c, src/autofit/aflatin.c, src/base/ftobjs.c,
src/cff/cffobjs.c, src/cid/cidobjs.c, src/pfr/pfrobjs.c,
src/sfnt/sfobjs.c, src/sfnt/ttmtx.c, src/truetype/ttpload.c,
src/truetype/ttpload.h, src/type1/t1afm.c, src/type1/t1objs.c:
removing compiler warnings when building with Visual C++ 6 and /W4
2006-03-20 14:32:33 +01:00
|
|
|
pfrface->height = (FT_Short)(pfrface->ascender - pfrface->descender);
|
2003-06-14 09:40:09 +02:00
|
|
|
|
|
|
|
if ( phy_font->num_strikes > 0 )
|
|
|
|
{
|
|
|
|
FT_UInt n, count = phy_font->num_strikes;
|
|
|
|
FT_Bitmap_Size* size;
|
|
|
|
PFR_Strike strike;
|
* src/pfr/pfrobjs.c, src/pfr/pfrobjs.h (pfr_face_init,
pfr_face_done, pfr_face_get_kerning, pfr_slot_init, pfr_slot_done,
pfr_slot_load): Don't use PFR_XXX but FT_XXX arguments which are
typecast to the proper PFR_XXX types within the function.
Update code accordingly.
* src/pfr/pfrdrivr.c (pfr_get_kerning, pfr_get_advance,
pfr_get_metrics, pfr_get_service): Don't use PFR_XXX but FT_XXX
arguments which are typecast to the proper PFR_XXX types within the
function.
Update code accordingly.
Use FT_CALLBACK_DEF throughout.
(pfr_metrics_service_rec, pfr_driver_class): Remove casts.
2004-05-08 09:00:23 +02:00
|
|
|
FT_Memory memory = pfrface->stream->memory;
|
2005-03-03 15:00:23 +01:00
|
|
|
|
|
|
|
|
* src/pfr/pfrobjs.c, src/pfr/pfrobjs.h (pfr_face_init,
pfr_face_done, pfr_face_get_kerning, pfr_slot_init, pfr_slot_done,
pfr_slot_load): Don't use PFR_XXX but FT_XXX arguments which are
typecast to the proper PFR_XXX types within the function.
Update code accordingly.
* src/pfr/pfrdrivr.c (pfr_get_kerning, pfr_get_advance,
pfr_get_metrics, pfr_get_service): Don't use PFR_XXX but FT_XXX
arguments which are typecast to the proper PFR_XXX types within the
function.
Update code accordingly.
Use FT_CALLBACK_DEF throughout.
(pfr_metrics_service_rec, pfr_driver_class): Remove casts.
2004-05-08 09:00:23 +02:00
|
|
|
if ( FT_NEW_ARRAY( pfrface->available_sizes, count ) )
|
2003-06-14 09:40:09 +02:00
|
|
|
goto Exit;
|
2005-03-03 15:00:23 +01:00
|
|
|
|
* src/pfr/pfrobjs.c, src/pfr/pfrobjs.h (pfr_face_init,
pfr_face_done, pfr_face_get_kerning, pfr_slot_init, pfr_slot_done,
pfr_slot_load): Don't use PFR_XXX but FT_XXX arguments which are
typecast to the proper PFR_XXX types within the function.
Update code accordingly.
* src/pfr/pfrdrivr.c (pfr_get_kerning, pfr_get_advance,
pfr_get_metrics, pfr_get_service): Don't use PFR_XXX but FT_XXX
arguments which are typecast to the proper PFR_XXX types within the
function.
Update code accordingly.
Use FT_CALLBACK_DEF throughout.
(pfr_metrics_service_rec, pfr_driver_class): Remove casts.
2004-05-08 09:00:23 +02:00
|
|
|
size = pfrface->available_sizes;
|
2003-06-14 09:40:09 +02:00
|
|
|
strike = phy_font->strikes;
|
|
|
|
for ( n = 0; n < count; n++, size++, strike++ )
|
|
|
|
{
|
|
|
|
size->height = (FT_UShort)strike->y_ppm;
|
|
|
|
size->width = (FT_UShort)strike->x_ppm;
|
* include/freetype/internal/sfnt.h (SFNT_Interface): New method
`load_strike_metrics' used to load the strike's metrics.
* src/sfnt/sfdriver.c, src/sfnt/ttsbit.c, src/sfnt/ttsbit.h,
src/sfnt/ttsbit0.c: New function `tt_face_load_strike_metrics'.
* src/pfr/pfrobjs.c (pfr_face_init): Set FT_Bitmap_Size correctly.
* src/winfonts/winfnt.c (FNT_Face_Init): Use `nominal_point_size' for
nominal size unless it is obviously incorrect.
* include/freetype/freetype.h (FT_Bitmap_Size): Update the comments on
FNT driver.
Introduce new size selection interface.
* include/freetype/internal/ftdriver.h (struct FT_Driver_ClassRec_):
Replace `set_char_sizes' and `set_pixel_sizes' by `request_size' and
`select_size'.
* include/freetype/freetype.h (FT_Select_Size, FT_Size_Request_Type,
FT_Size_Request, FT_Request_Size, FT_Select_Size), src/base/ftobjs.c
(FT_Select_Size, FT_Request_Size): API additions to export the new
size selection interface.
* src/base/ftobjs.c (FT_Set_Char_Size, FT_Set_Pixel_Sizes): Use
`FT_Request_Size'.
* include/freetype/internal/ftobjs.h (FT_Match_Size),
src/base/ftobjs.c (FT_Match_Size): New function to match a size
request against `available_sizes'. Drivers supporting bitmap strikes
can use this function to implement `request_size'.
* src/bdf/bdfdrivr.c, src/cid/cidobjs.c, src/cid/cidobjs.h,
src/cid/cidriver.c, src/pcf/pcfdrivr.c, src/type1/t1driver.c,
src/type1/t1objs.c, src/type1/t1objs.h, src/type42/t42drivr.c,
src/type42/t42objs.c, src/type42/t42objs.h, src/winfonts/winfnt.c:
Update to new size selection interface.
* src/cff/cffdrivr.c, src/cff/cffgload.c, src/cff/cffobjs.c,
src/cff/cffobjs.h, src/truetype/ttdriver.c, src/truetype/ttgload.c,
src/truetype/ttobjs.c, src/truetype/ttobjs.h: Update to new size
selection interface.
Make `strike_index' FT_ULong and always defined.
Use `load_strike_metrics' provided by SFNT interface.
2006-01-13 13:21:31 +01:00
|
|
|
size->size = strike->y_ppm << 6;
|
|
|
|
size->x_ppem = strike->x_ppm << 6;
|
|
|
|
size->y_ppem = strike->y_ppm << 6;
|
2003-06-14 09:40:09 +02:00
|
|
|
}
|
* src/pfr/pfrobjs.c, src/pfr/pfrobjs.h (pfr_face_init,
pfr_face_done, pfr_face_get_kerning, pfr_slot_init, pfr_slot_done,
pfr_slot_load): Don't use PFR_XXX but FT_XXX arguments which are
typecast to the proper PFR_XXX types within the function.
Update code accordingly.
* src/pfr/pfrdrivr.c (pfr_get_kerning, pfr_get_advance,
pfr_get_metrics, pfr_get_service): Don't use PFR_XXX but FT_XXX
arguments which are typecast to the proper PFR_XXX types within the
function.
Update code accordingly.
Use FT_CALLBACK_DEF throughout.
(pfr_metrics_service_rec, pfr_driver_class): Remove casts.
2004-05-08 09:00:23 +02:00
|
|
|
pfrface->num_fixed_sizes = count;
|
2003-06-14 09:40:09 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
/* now compute maximum advance width */
|
|
|
|
if ( ( phy_font->flags & PFR_PHY_PROPORTIONAL ) == 0 )
|
* src/pfr/pfrobjs.c, src/pfr/pfrobjs.h (pfr_face_init,
pfr_face_done, pfr_face_get_kerning, pfr_slot_init, pfr_slot_done,
pfr_slot_load): Don't use PFR_XXX but FT_XXX arguments which are
typecast to the proper PFR_XXX types within the function.
Update code accordingly.
* src/pfr/pfrdrivr.c (pfr_get_kerning, pfr_get_advance,
pfr_get_metrics, pfr_get_service): Don't use PFR_XXX but FT_XXX
arguments which are typecast to the proper PFR_XXX types within the
function.
Update code accordingly.
Use FT_CALLBACK_DEF throughout.
(pfr_metrics_service_rec, pfr_driver_class): Remove casts.
2004-05-08 09:00:23 +02:00
|
|
|
pfrface->max_advance_width = (FT_Short)phy_font->standard_advance;
|
2003-06-14 09:40:09 +02:00
|
|
|
else
|
|
|
|
{
|
|
|
|
FT_Int max = 0;
|
|
|
|
FT_UInt count = phy_font->num_chars;
|
|
|
|
PFR_Char gchar = phy_font->chars;
|
2002-04-19 17:13:47 +02:00
|
|
|
|
2002-04-20 07:38:33 +02:00
|
|
|
|
2003-06-14 09:40:09 +02:00
|
|
|
for ( ; count > 0; count--, gchar++ )
|
|
|
|
{
|
|
|
|
if ( max < gchar->advance )
|
|
|
|
max = gchar->advance;
|
|
|
|
}
|
2002-04-19 17:13:47 +02:00
|
|
|
|
* src/pfr/pfrobjs.c, src/pfr/pfrobjs.h (pfr_face_init,
pfr_face_done, pfr_face_get_kerning, pfr_slot_init, pfr_slot_done,
pfr_slot_load): Don't use PFR_XXX but FT_XXX arguments which are
typecast to the proper PFR_XXX types within the function.
Update code accordingly.
* src/pfr/pfrdrivr.c (pfr_get_kerning, pfr_get_advance,
pfr_get_metrics, pfr_get_service): Don't use PFR_XXX but FT_XXX
arguments which are typecast to the proper PFR_XXX types within the
function.
Update code accordingly.
Use FT_CALLBACK_DEF throughout.
(pfr_metrics_service_rec, pfr_driver_class): Remove casts.
2004-05-08 09:00:23 +02:00
|
|
|
pfrface->max_advance_width = (FT_Short)max;
|
2003-06-14 09:40:09 +02:00
|
|
|
}
|
2002-04-19 17:13:47 +02:00
|
|
|
|
* src/pfr/pfrobjs.c, src/pfr/pfrobjs.h (pfr_face_init,
pfr_face_done, pfr_face_get_kerning, pfr_slot_init, pfr_slot_done,
pfr_slot_load): Don't use PFR_XXX but FT_XXX arguments which are
typecast to the proper PFR_XXX types within the function.
Update code accordingly.
* src/pfr/pfrdrivr.c (pfr_get_kerning, pfr_get_advance,
pfr_get_metrics, pfr_get_service): Don't use PFR_XXX but FT_XXX
arguments which are typecast to the proper PFR_XXX types within the
function.
Update code accordingly.
Use FT_CALLBACK_DEF throughout.
(pfr_metrics_service_rec, pfr_driver_class): Remove casts.
2004-05-08 09:00:23 +02:00
|
|
|
pfrface->max_advance_height = pfrface->height;
|
2002-04-19 17:13:47 +02:00
|
|
|
|
* src/pfr/pfrobjs.c, src/pfr/pfrobjs.h (pfr_face_init,
pfr_face_done, pfr_face_get_kerning, pfr_slot_init, pfr_slot_done,
pfr_slot_load): Don't use PFR_XXX but FT_XXX arguments which are
typecast to the proper PFR_XXX types within the function.
Update code accordingly.
* src/pfr/pfrdrivr.c (pfr_get_kerning, pfr_get_advance,
pfr_get_metrics, pfr_get_service): Don't use PFR_XXX but FT_XXX
arguments which are typecast to the proper PFR_XXX types within the
function.
Update code accordingly.
Use FT_CALLBACK_DEF throughout.
(pfr_metrics_service_rec, pfr_driver_class): Remove casts.
2004-05-08 09:00:23 +02:00
|
|
|
pfrface->underline_position = (FT_Short)( -pfrface->units_per_EM / 10 );
|
|
|
|
pfrface->underline_thickness = (FT_Short)( pfrface->units_per_EM / 30 );
|
2002-04-19 17:13:47 +02:00
|
|
|
|
2003-06-14 09:40:09 +02:00
|
|
|
/* create charmap */
|
|
|
|
{
|
|
|
|
FT_CharMapRec charmap;
|
2002-07-18 00:51:06 +02:00
|
|
|
|
2002-04-20 07:38:33 +02:00
|
|
|
|
* src/pfr/pfrobjs.c, src/pfr/pfrobjs.h (pfr_face_init,
pfr_face_done, pfr_face_get_kerning, pfr_slot_init, pfr_slot_done,
pfr_slot_load): Don't use PFR_XXX but FT_XXX arguments which are
typecast to the proper PFR_XXX types within the function.
Update code accordingly.
* src/pfr/pfrdrivr.c (pfr_get_kerning, pfr_get_advance,
pfr_get_metrics, pfr_get_service): Don't use PFR_XXX but FT_XXX
arguments which are typecast to the proper PFR_XXX types within the
function.
Update code accordingly.
Use FT_CALLBACK_DEF throughout.
(pfr_metrics_service_rec, pfr_driver_class): Remove casts.
2004-05-08 09:00:23 +02:00
|
|
|
charmap.face = pfrface;
|
2003-06-14 09:40:09 +02:00
|
|
|
charmap.platform_id = 3;
|
|
|
|
charmap.encoding_id = 1;
|
|
|
|
charmap.encoding = FT_ENCODING_UNICODE;
|
2002-07-18 00:51:06 +02:00
|
|
|
|
2003-06-14 09:40:09 +02:00
|
|
|
FT_CMap_New( &pfr_cmap_class_rec, NULL, &charmap, NULL );
|
2002-06-19 17:57:55 +02:00
|
|
|
|
2002-07-18 00:51:06 +02:00
|
|
|
#if 0
|
2003-06-14 09:40:09 +02:00
|
|
|
/* Select default charmap */
|
* src/pfr/pfrobjs.c, src/pfr/pfrobjs.h (pfr_face_init,
pfr_face_done, pfr_face_get_kerning, pfr_slot_init, pfr_slot_done,
pfr_slot_load): Don't use PFR_XXX but FT_XXX arguments which are
typecast to the proper PFR_XXX types within the function.
Update code accordingly.
* src/pfr/pfrdrivr.c (pfr_get_kerning, pfr_get_advance,
pfr_get_metrics, pfr_get_service): Don't use PFR_XXX but FT_XXX
arguments which are typecast to the proper PFR_XXX types within the
function.
Update code accordingly.
Use FT_CALLBACK_DEF throughout.
(pfr_metrics_service_rec, pfr_driver_class): Remove casts.
2004-05-08 09:00:23 +02:00
|
|
|
if ( pfrface->num_charmaps )
|
|
|
|
pfrface->charmap = pfrface->charmaps[0];
|
2002-07-18 00:51:06 +02:00
|
|
|
#endif
|
2003-06-14 09:40:09 +02:00
|
|
|
}
|
2002-06-21 09:33:23 +02:00
|
|
|
|
2003-06-14 09:40:09 +02:00
|
|
|
/* check whether we've loaded any kerning pairs */
|
|
|
|
if ( phy_font->num_kern_pairs )
|
* src/pfr/pfrobjs.c, src/pfr/pfrobjs.h (pfr_face_init,
pfr_face_done, pfr_face_get_kerning, pfr_slot_init, pfr_slot_done,
pfr_slot_load): Don't use PFR_XXX but FT_XXX arguments which are
typecast to the proper PFR_XXX types within the function.
Update code accordingly.
* src/pfr/pfrdrivr.c (pfr_get_kerning, pfr_get_advance,
pfr_get_metrics, pfr_get_service): Don't use PFR_XXX but FT_XXX
arguments which are typecast to the proper PFR_XXX types within the
function.
Update code accordingly.
Use FT_CALLBACK_DEF throughout.
(pfr_metrics_service_rec, pfr_driver_class): Remove casts.
2004-05-08 09:00:23 +02:00
|
|
|
pfrface->face_flags |= FT_FACE_FLAG_KERNING;
|
2003-06-14 09:40:09 +02:00
|
|
|
}
|
2002-04-19 17:13:47 +02:00
|
|
|
|
|
|
|
Exit:
|
|
|
|
return error;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2002-04-20 07:38:33 +02:00
|
|
|
/*************************************************************************/
|
|
|
|
/*************************************************************************/
|
|
|
|
/***** *****/
|
|
|
|
/***** SLOT OBJECT METHOD *****/
|
|
|
|
/***** *****/
|
|
|
|
/*************************************************************************/
|
|
|
|
/*************************************************************************/
|
2002-04-19 17:13:47 +02:00
|
|
|
|
|
|
|
FT_LOCAL_DEF( FT_Error )
|
* src/pfr/pfrobjs.c, src/pfr/pfrobjs.h (pfr_face_init,
pfr_face_done, pfr_face_get_kerning, pfr_slot_init, pfr_slot_done,
pfr_slot_load): Don't use PFR_XXX but FT_XXX arguments which are
typecast to the proper PFR_XXX types within the function.
Update code accordingly.
* src/pfr/pfrdrivr.c (pfr_get_kerning, pfr_get_advance,
pfr_get_metrics, pfr_get_service): Don't use PFR_XXX but FT_XXX
arguments which are typecast to the proper PFR_XXX types within the
function.
Update code accordingly.
Use FT_CALLBACK_DEF throughout.
(pfr_metrics_service_rec, pfr_driver_class): Remove casts.
2004-05-08 09:00:23 +02:00
|
|
|
pfr_slot_init( FT_GlyphSlot pfrslot ) /* PFR_Slot */
|
2002-04-19 17:13:47 +02:00
|
|
|
{
|
* src/pfr/pfrobjs.c, src/pfr/pfrobjs.h (pfr_face_init,
pfr_face_done, pfr_face_get_kerning, pfr_slot_init, pfr_slot_done,
pfr_slot_load): Don't use PFR_XXX but FT_XXX arguments which are
typecast to the proper PFR_XXX types within the function.
Update code accordingly.
* src/pfr/pfrdrivr.c (pfr_get_kerning, pfr_get_advance,
pfr_get_metrics, pfr_get_service): Don't use PFR_XXX but FT_XXX
arguments which are typecast to the proper PFR_XXX types within the
function.
Update code accordingly.
Use FT_CALLBACK_DEF throughout.
(pfr_metrics_service_rec, pfr_driver_class): Remove casts.
2004-05-08 09:00:23 +02:00
|
|
|
PFR_Slot slot = (PFR_Slot)pfrslot;
|
|
|
|
FT_GlyphLoader loader = pfrslot->internal->loader;
|
|
|
|
|
2002-04-19 17:13:47 +02:00
|
|
|
|
|
|
|
pfr_glyph_init( &slot->glyph, loader );
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
FT_LOCAL_DEF( void )
|
* src/pfr/pfrobjs.c, src/pfr/pfrobjs.h (pfr_face_init,
pfr_face_done, pfr_face_get_kerning, pfr_slot_init, pfr_slot_done,
pfr_slot_load): Don't use PFR_XXX but FT_XXX arguments which are
typecast to the proper PFR_XXX types within the function.
Update code accordingly.
* src/pfr/pfrdrivr.c (pfr_get_kerning, pfr_get_advance,
pfr_get_metrics, pfr_get_service): Don't use PFR_XXX but FT_XXX
arguments which are typecast to the proper PFR_XXX types within the
function.
Update code accordingly.
Use FT_CALLBACK_DEF throughout.
(pfr_metrics_service_rec, pfr_driver_class): Remove casts.
2004-05-08 09:00:23 +02:00
|
|
|
pfr_slot_done( FT_GlyphSlot pfrslot ) /* PFR_Slot */
|
2002-04-19 17:13:47 +02:00
|
|
|
{
|
* src/pfr/pfrobjs.c, src/pfr/pfrobjs.h (pfr_face_init,
pfr_face_done, pfr_face_get_kerning, pfr_slot_init, pfr_slot_done,
pfr_slot_load): Don't use PFR_XXX but FT_XXX arguments which are
typecast to the proper PFR_XXX types within the function.
Update code accordingly.
* src/pfr/pfrdrivr.c (pfr_get_kerning, pfr_get_advance,
pfr_get_metrics, pfr_get_service): Don't use PFR_XXX but FT_XXX
arguments which are typecast to the proper PFR_XXX types within the
function.
Update code accordingly.
Use FT_CALLBACK_DEF throughout.
(pfr_metrics_service_rec, pfr_driver_class): Remove casts.
2004-05-08 09:00:23 +02:00
|
|
|
PFR_Slot slot = (PFR_Slot)pfrslot;
|
|
|
|
|
|
|
|
|
2002-04-19 17:13:47 +02:00
|
|
|
pfr_glyph_done( &slot->glyph );
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
FT_LOCAL_DEF( FT_Error )
|
* src/pfr/pfrobjs.c, src/pfr/pfrobjs.h (pfr_face_init,
pfr_face_done, pfr_face_get_kerning, pfr_slot_init, pfr_slot_done,
pfr_slot_load): Don't use PFR_XXX but FT_XXX arguments which are
typecast to the proper PFR_XXX types within the function.
Update code accordingly.
* src/pfr/pfrdrivr.c (pfr_get_kerning, pfr_get_advance,
pfr_get_metrics, pfr_get_service): Don't use PFR_XXX but FT_XXX
arguments which are typecast to the proper PFR_XXX types within the
function.
Update code accordingly.
Use FT_CALLBACK_DEF throughout.
(pfr_metrics_service_rec, pfr_driver_class): Remove casts.
2004-05-08 09:00:23 +02:00
|
|
|
pfr_slot_load( FT_GlyphSlot pfrslot, /* PFR_Slot */
|
|
|
|
FT_Size pfrsize, /* PFR_Size */
|
|
|
|
FT_UInt gindex,
|
|
|
|
FT_Int32 load_flags )
|
2002-04-19 17:13:47 +02:00
|
|
|
{
|
* src/pfr/pfrobjs.c, src/pfr/pfrobjs.h (pfr_face_init,
pfr_face_done, pfr_face_get_kerning, pfr_slot_init, pfr_slot_done,
pfr_slot_load): Don't use PFR_XXX but FT_XXX arguments which are
typecast to the proper PFR_XXX types within the function.
Update code accordingly.
* src/pfr/pfrdrivr.c (pfr_get_kerning, pfr_get_advance,
pfr_get_metrics, pfr_get_service): Don't use PFR_XXX but FT_XXX
arguments which are typecast to the proper PFR_XXX types within the
function.
Update code accordingly.
Use FT_CALLBACK_DEF throughout.
(pfr_metrics_service_rec, pfr_driver_class): Remove casts.
2004-05-08 09:00:23 +02:00
|
|
|
PFR_Slot slot = (PFR_Slot)pfrslot;
|
|
|
|
PFR_Size size = (PFR_Size)pfrsize;
|
2002-04-19 17:13:47 +02:00
|
|
|
FT_Error error;
|
* src/pfr/pfrobjs.c, src/pfr/pfrobjs.h (pfr_face_init,
pfr_face_done, pfr_face_get_kerning, pfr_slot_init, pfr_slot_done,
pfr_slot_load): Don't use PFR_XXX but FT_XXX arguments which are
typecast to the proper PFR_XXX types within the function.
Update code accordingly.
* src/pfr/pfrdrivr.c (pfr_get_kerning, pfr_get_advance,
pfr_get_metrics, pfr_get_service): Don't use PFR_XXX but FT_XXX
arguments which are typecast to the proper PFR_XXX types within the
function.
Update code accordingly.
Use FT_CALLBACK_DEF throughout.
(pfr_metrics_service_rec, pfr_driver_class): Remove casts.
2004-05-08 09:00:23 +02:00
|
|
|
PFR_Face face = (PFR_Face)pfrslot->face;
|
2002-06-17 10:01:32 +02:00
|
|
|
PFR_Char gchar;
|
* src/pfr/pfrobjs.c, src/pfr/pfrobjs.h (pfr_face_init,
pfr_face_done, pfr_face_get_kerning, pfr_slot_init, pfr_slot_done,
pfr_slot_load): Don't use PFR_XXX but FT_XXX arguments which are
typecast to the proper PFR_XXX types within the function.
Update code accordingly.
* src/pfr/pfrdrivr.c (pfr_get_kerning, pfr_get_advance,
pfr_get_metrics, pfr_get_service): Don't use PFR_XXX but FT_XXX
arguments which are typecast to the proper PFR_XXX types within the
function.
Update code accordingly.
Use FT_CALLBACK_DEF throughout.
(pfr_metrics_service_rec, pfr_driver_class): Remove casts.
2004-05-08 09:00:23 +02:00
|
|
|
FT_Outline* outline = &pfrslot->outline;
|
2002-04-19 17:13:47 +02:00
|
|
|
FT_ULong gps_offset;
|
|
|
|
|
2003-04-23 16:14:06 +02:00
|
|
|
|
|
|
|
if ( gindex > 0 )
|
2002-06-17 10:01:32 +02:00
|
|
|
gindex--;
|
2002-04-20 07:38:33 +02:00
|
|
|
|
2006-11-19 10:19:17 +01:00
|
|
|
if ( !face || gindex >= face->phy_font.num_chars )
|
|
|
|
{
|
|
|
|
error = PFR_Err_Invalid_Argument;
|
|
|
|
goto Exit;
|
|
|
|
}
|
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
|
|
|
/* try to load an embedded bitmap */
|
2002-10-07 12:12:43 +02:00
|
|
|
if ( ( load_flags & ( FT_LOAD_NO_SCALE | FT_LOAD_NO_BITMAP ) ) == 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
|
|
|
{
|
|
|
|
error = pfr_slot_load_bitmap( slot, size, gindex );
|
|
|
|
if ( error == 0 )
|
|
|
|
goto Exit;
|
|
|
|
}
|
|
|
|
|
2003-02-25 20:20:12 +01:00
|
|
|
if ( load_flags & FT_LOAD_SBITS_ONLY )
|
|
|
|
{
|
* src/winfonts/winfnt.c (FNT_Load_Glyph): Use first_char in
computation of glyph_index.
(FNT_Size_Set_Pixels): To find a strike, first check pixel_height
only, then try to find a better hit by comparing pixel_width also.
Without this fix it isn't possible to access all strikes.
Also compute metrics.max_advance to be in sync with other bitmap
drivers.
* src/base/ftobjs.c (FT_Set_Char_Size): Remove redundant code.
(FT_Set_Pixel_Size): Assign value to `metrics' after validation of
arguments.
Synchronize computation of height and width for bitmap strikes. The
`width' field in the FT_Bitmap_Size structure is now only useful to
enumerate different strikes. The `max_advance' field of the
FT_Size_Metrics structure should be used to get the (maximum) width
of a strike.
* src/bdf/bdfdrivr.c (BDF_Face_Init): Don't use AVERAGE_WIDTH for
computing `available_sizes->width' but make it always equal to
`available_sizes->height'.
* src/pcf/pcfread.c (pcf_load_font): Don't use RESOLUTION_X for
computing `available_sizes->width' but make it always equal to
`available_sizes->height'.
* src/truetype/ttdriver.c (Set_Pixel_Sizes): Pass only single
argument to function.
* src/psnames/psmodule.c (ps_unicode_value): Handle `.' after
`uniXXXX' and `uXXXX[X[X]]'.
* src/bdf/bdfdrivr.c: s/FT_Err_/BDF_Err/.
* src/cache/ftccache.c, src/cache/ftcsbits.c, src/cache/ftlru.c:
s/FT_Err_/FTC_Err_/.
* src/cff/cffcmap.c: s/FT_Err_/CFF_Err_/.
* src/pcf/pcfdrivr.c: s/FT_Err_/PCF_Err_/.
* src/psaux/t1cmap.c: Include psauxerr.h.
s/FT_Err_/PSaux_Err_/.
* src/pshinter/pshnterr.h: New file.
* src/pshinter/rules.mk: Updated.
* src/pshinter/pshalgo.c, src/pshinter/pshrec.c: Include pshnterr.h.
s/FT_Err_/PSH_Err_/.
* src/pfr/pfrdrivr.c, src/pfr/pfrobjs.c, src/pfr/pfrsbit.c:
s/FT_Err_/PFR_Err_/.
* src/sfnt/sfdriver.c, src/sfnt/sfobjs.c, src/sfnt/ttcmap0.c,
src/sfnt/ttload.c: s/FT_Err_/SFNT_Err_/.
* src/truetype/ttgload.c: s/FT_Err_/TT_Err_/.
* src/gzip/ftgzip.c: Load FT_MODULE_ERRORS_H and define
FT_ERR_PREFIX and FT_ERR_BASE.
s/FT_Err_/Gzip_Err_/.
2003-06-22 17:33:53 +02:00
|
|
|
error = PFR_Err_Invalid_Argument;
|
2003-02-25 20:20:12 +01:00
|
|
|
goto Exit;
|
|
|
|
}
|
|
|
|
|
2002-06-17 10:01:32 +02:00
|
|
|
gchar = face->phy_font.chars + gindex;
|
* src/pfr/pfrobjs.c, src/pfr/pfrobjs.h (pfr_face_init,
pfr_face_done, pfr_face_get_kerning, pfr_slot_init, pfr_slot_done,
pfr_slot_load): Don't use PFR_XXX but FT_XXX arguments which are
typecast to the proper PFR_XXX types within the function.
Update code accordingly.
* src/pfr/pfrdrivr.c (pfr_get_kerning, pfr_get_advance,
pfr_get_metrics, pfr_get_service): Don't use PFR_XXX but FT_XXX
arguments which are typecast to the proper PFR_XXX types within the
function.
Update code accordingly.
Use FT_CALLBACK_DEF throughout.
(pfr_metrics_service_rec, pfr_driver_class): Remove casts.
2004-05-08 09:00:23 +02:00
|
|
|
pfrslot->format = FT_GLYPH_FORMAT_OUTLINE;
|
2002-04-19 17:13:47 +02:00
|
|
|
outline->n_points = 0;
|
|
|
|
outline->n_contours = 0;
|
|
|
|
gps_offset = face->header.gps_section_offset;
|
|
|
|
|
2002-04-20 07:38:33 +02:00
|
|
|
/* load the glyph outline (FT_LOAD_NO_RECURSE isn't supported) */
|
2002-04-19 17:13:47 +02:00
|
|
|
error = pfr_glyph_load( &slot->glyph, face->root.stream,
|
|
|
|
gps_offset, gchar->gps_offset, gchar->gps_size );
|
|
|
|
|
2002-04-20 07:38:33 +02:00
|
|
|
if ( !error )
|
2002-04-19 17:13:47 +02:00
|
|
|
{
|
|
|
|
FT_BBox cbox;
|
* src/pfr/pfrobjs.c, src/pfr/pfrobjs.h (pfr_face_init,
pfr_face_done, pfr_face_get_kerning, pfr_slot_init, pfr_slot_done,
pfr_slot_load): Don't use PFR_XXX but FT_XXX arguments which are
typecast to the proper PFR_XXX types within the function.
Update code accordingly.
* src/pfr/pfrdrivr.c (pfr_get_kerning, pfr_get_advance,
pfr_get_metrics, pfr_get_service): Don't use PFR_XXX but FT_XXX
arguments which are typecast to the proper PFR_XXX types within the
function.
Update code accordingly.
Use FT_CALLBACK_DEF throughout.
(pfr_metrics_service_rec, pfr_driver_class): Remove casts.
2004-05-08 09:00:23 +02:00
|
|
|
FT_Glyph_Metrics* metrics = &pfrslot->metrics;
|
2002-04-19 17:13:47 +02:00
|
|
|
FT_Pos advance;
|
|
|
|
FT_Int em_metrics, em_outline;
|
|
|
|
FT_Bool scaling;
|
|
|
|
|
2002-04-20 07:38:33 +02:00
|
|
|
|
|
|
|
scaling = FT_BOOL( ( load_flags & FT_LOAD_NO_SCALE ) == 0 );
|
2002-04-19 17:13:47 +02:00
|
|
|
|
|
|
|
/* copy outline data */
|
|
|
|
*outline = slot->glyph.loader->base.outline;
|
|
|
|
|
* massive re-formatting changes to many, many source files. I don't
want to list them all here. The operations performed were all logical
transformations of the sources:
- trying to convert all enums and constants to CAPITALIZED_STYLE, with
#define definitions like
#define my_old_constants MY_NEW_CONSTANT
- big, big update of the documentation comments
* include/freetype/freetype.h, src/base/ftobjs.c, src/smooth/ftsmooth.c,
include/freetype/ftimage.h: adding support for LCD-optimized rendering
though the new constants/enums:
FT_RENDER_MODE_LCD, FT_RENDER_MODE_LCD_V
FT_PIXEL_MODE_LCD, FT_PIXEL_MODE_LCD_V
this is still work in progress, don't expect everything to work correctly
though most of the features have been implemented.
* adding new FT_LOAD_XXX flags, used to specify both hinting and rendering
targets:
FT_LOAD_TARGET_NORMAL :: anti-aliased hinting & rendering
FT_LOAD_TARGET_MONO :: monochrome bitmaps
FT_LOAD_TARGET_LCD :: horizontal RGB/BGR decimated hinting & rendering
FT_LOAD_TARGET_LCD_V :: vertical RGB/BGR decimated hinting & rendering
note that FT_LOAD_TARGET_NORMAL is 0, which means that the default
behaviour of the font engine is _unchanged_.
2002-08-27 22:20:29 +02:00
|
|
|
outline->flags &= ~FT_OUTLINE_OWNER;
|
|
|
|
outline->flags |= FT_OUTLINE_REVERSE_FILL;
|
2002-04-19 17:13:47 +02:00
|
|
|
|
* src/pfr/pfrobjs.c, src/pfr/pfrobjs.h (pfr_face_init,
pfr_face_done, pfr_face_get_kerning, pfr_slot_init, pfr_slot_done,
pfr_slot_load): Don't use PFR_XXX but FT_XXX arguments which are
typecast to the proper PFR_XXX types within the function.
Update code accordingly.
* src/pfr/pfrdrivr.c (pfr_get_kerning, pfr_get_advance,
pfr_get_metrics, pfr_get_service): Don't use PFR_XXX but FT_XXX
arguments which are typecast to the proper PFR_XXX types within the
function.
Update code accordingly.
Use FT_CALLBACK_DEF throughout.
(pfr_metrics_service_rec, pfr_driver_class): Remove casts.
2004-05-08 09:00:23 +02:00
|
|
|
if ( size && pfrsize->metrics.y_ppem < 24 )
|
* massive re-formatting changes to many, many source files. I don't
want to list them all here. The operations performed were all logical
transformations of the sources:
- trying to convert all enums and constants to CAPITALIZED_STYLE, with
#define definitions like
#define my_old_constants MY_NEW_CONSTANT
- big, big update of the documentation comments
* include/freetype/freetype.h, src/base/ftobjs.c, src/smooth/ftsmooth.c,
include/freetype/ftimage.h: adding support for LCD-optimized rendering
though the new constants/enums:
FT_RENDER_MODE_LCD, FT_RENDER_MODE_LCD_V
FT_PIXEL_MODE_LCD, FT_PIXEL_MODE_LCD_V
this is still work in progress, don't expect everything to work correctly
though most of the features have been implemented.
* adding new FT_LOAD_XXX flags, used to specify both hinting and rendering
targets:
FT_LOAD_TARGET_NORMAL :: anti-aliased hinting & rendering
FT_LOAD_TARGET_MONO :: monochrome bitmaps
FT_LOAD_TARGET_LCD :: horizontal RGB/BGR decimated hinting & rendering
FT_LOAD_TARGET_LCD_V :: vertical RGB/BGR decimated hinting & rendering
note that FT_LOAD_TARGET_NORMAL is 0, which means that the default
behaviour of the font engine is _unchanged_.
2002-08-27 22:20:29 +02:00
|
|
|
outline->flags |= FT_OUTLINE_HIGH_PRECISION;
|
2002-04-19 17:13:47 +02:00
|
|
|
|
|
|
|
/* compute the advance vector */
|
|
|
|
metrics->horiAdvance = 0;
|
|
|
|
metrics->vertAdvance = 0;
|
|
|
|
|
|
|
|
advance = gchar->advance;
|
|
|
|
em_metrics = face->phy_font.metrics_resolution;
|
|
|
|
em_outline = face->phy_font.outline_resolution;
|
|
|
|
|
|
|
|
if ( em_metrics != em_outline )
|
|
|
|
advance = FT_MulDiv( advance, em_outline, em_metrics );
|
|
|
|
|
|
|
|
if ( face->phy_font.flags & PFR_PHY_VERTICAL )
|
2002-07-05 17:54:26 +02:00
|
|
|
metrics->vertAdvance = advance;
|
2002-04-19 17:13:47 +02:00
|
|
|
else
|
2002-07-05 17:54:26 +02:00
|
|
|
metrics->horiAdvance = advance;
|
2002-04-19 17:13:47 +02:00
|
|
|
|
* src/pfr/pfrobjs.c, src/pfr/pfrobjs.h (pfr_face_init,
pfr_face_done, pfr_face_get_kerning, pfr_slot_init, pfr_slot_done,
pfr_slot_load): Don't use PFR_XXX but FT_XXX arguments which are
typecast to the proper PFR_XXX types within the function.
Update code accordingly.
* src/pfr/pfrdrivr.c (pfr_get_kerning, pfr_get_advance,
pfr_get_metrics, pfr_get_service): Don't use PFR_XXX but FT_XXX
arguments which are typecast to the proper PFR_XXX types within the
function.
Update code accordingly.
Use FT_CALLBACK_DEF throughout.
(pfr_metrics_service_rec, pfr_driver_class): Remove casts.
2004-05-08 09:00:23 +02:00
|
|
|
pfrslot->linearHoriAdvance = metrics->horiAdvance;
|
|
|
|
pfrslot->linearVertAdvance = metrics->vertAdvance;
|
2002-04-19 17:13:47 +02:00
|
|
|
|
2002-04-20 07:38:33 +02:00
|
|
|
/* make-up vertical metrics(?) */
|
2002-04-19 17:13:47 +02:00
|
|
|
metrics->vertBearingX = 0;
|
|
|
|
metrics->vertBearingY = 0;
|
|
|
|
|
2005-03-04 00:05:29 +01:00
|
|
|
#if 0 /* some fonts seem to be broken here! */
|
2005-03-03 15:00:23 +01:00
|
|
|
|
2003-06-14 09:40:09 +02:00
|
|
|
/* Apply the font matrix, if any. */
|
|
|
|
/* TODO: Test existing fonts with unusual matrix */
|
|
|
|
/* whether we have to adjust Units per EM. */
|
|
|
|
{
|
|
|
|
FT_Matrix font_matrix;
|
|
|
|
|
|
|
|
|
|
|
|
font_matrix.xx = face->log_font.matrix[0] << 8;
|
|
|
|
font_matrix.yx = face->log_font.matrix[1] << 8;
|
|
|
|
font_matrix.xy = face->log_font.matrix[2] << 8;
|
|
|
|
font_matrix.yy = face->log_font.matrix[3] << 8;
|
|
|
|
|
|
|
|
FT_Outline_Transform( outline, &font_matrix );
|
|
|
|
}
|
2005-03-03 15:00:23 +01:00
|
|
|
#endif
|
2003-06-14 09:40:09 +02:00
|
|
|
|
2002-04-19 17:13:47 +02:00
|
|
|
/* scale when needed */
|
|
|
|
if ( scaling )
|
|
|
|
{
|
|
|
|
FT_Int n;
|
* src/pfr/pfrobjs.c, src/pfr/pfrobjs.h (pfr_face_init,
pfr_face_done, pfr_face_get_kerning, pfr_slot_init, pfr_slot_done,
pfr_slot_load): Don't use PFR_XXX but FT_XXX arguments which are
typecast to the proper PFR_XXX types within the function.
Update code accordingly.
* src/pfr/pfrdrivr.c (pfr_get_kerning, pfr_get_advance,
pfr_get_metrics, pfr_get_service): Don't use PFR_XXX but FT_XXX
arguments which are typecast to the proper PFR_XXX types within the
function.
Update code accordingly.
Use FT_CALLBACK_DEF throughout.
(pfr_metrics_service_rec, pfr_driver_class): Remove casts.
2004-05-08 09:00:23 +02:00
|
|
|
FT_Fixed x_scale = pfrsize->metrics.x_scale;
|
|
|
|
FT_Fixed y_scale = pfrsize->metrics.y_scale;
|
2002-04-19 17:13:47 +02:00
|
|
|
FT_Vector* vec = outline->points;
|
|
|
|
|
2002-04-20 07:38:33 +02:00
|
|
|
|
2002-04-19 17:13:47 +02:00
|
|
|
/* scale outline points */
|
|
|
|
for ( n = 0; n < outline->n_points; n++, vec++ )
|
|
|
|
{
|
|
|
|
vec->x = FT_MulFix( vec->x, x_scale );
|
|
|
|
vec->y = FT_MulFix( vec->y, y_scale );
|
|
|
|
}
|
|
|
|
|
|
|
|
/* scale the advance */
|
|
|
|
metrics->horiAdvance = FT_MulFix( metrics->horiAdvance, x_scale );
|
|
|
|
metrics->vertAdvance = FT_MulFix( metrics->vertAdvance, y_scale );
|
|
|
|
}
|
|
|
|
|
|
|
|
/* compute the rest of the metrics */
|
|
|
|
FT_Outline_Get_CBox( outline, &cbox );
|
|
|
|
|
|
|
|
metrics->width = cbox.xMax - cbox.xMin;
|
|
|
|
metrics->height = cbox.yMax - cbox.yMin;
|
|
|
|
metrics->horiBearingX = cbox.xMin;
|
|
|
|
metrics->horiBearingY = cbox.yMax - metrics->height;
|
|
|
|
}
|
|
|
|
|
* 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
|
|
|
Exit:
|
2002-04-19 17:13:47 +02:00
|
|
|
return error;
|
|
|
|
}
|
2002-04-20 07:38:33 +02:00
|
|
|
|
|
|
|
|
2002-06-21 09:33:23 +02:00
|
|
|
/*************************************************************************/
|
|
|
|
/*************************************************************************/
|
|
|
|
/***** *****/
|
|
|
|
/***** KERNING METHOD *****/
|
|
|
|
/***** *****/
|
|
|
|
/*************************************************************************/
|
|
|
|
/*************************************************************************/
|
|
|
|
|
2005-03-03 15:00:23 +01:00
|
|
|
FT_LOCAL_DEF( FT_Error )
|
|
|
|
pfr_face_get_kerning( FT_Face pfrface, /* PFR_Face */
|
|
|
|
FT_UInt glyph1,
|
|
|
|
FT_UInt glyph2,
|
|
|
|
FT_Vector* kerning )
|
|
|
|
{
|
2005-03-04 00:05:29 +01:00
|
|
|
PFR_Face face = (PFR_Face)pfrface;
|
|
|
|
FT_Error error = PFR_Err_Ok;
|
|
|
|
PFR_PhyFont phy_font = &face->phy_font;
|
|
|
|
FT_UInt32 code1, code2, pair;
|
|
|
|
|
2005-03-03 15:00:23 +01:00
|
|
|
|
|
|
|
kerning->x = 0;
|
|
|
|
kerning->y = 0;
|
|
|
|
|
|
|
|
if ( glyph1 > 0 )
|
|
|
|
glyph1--;
|
|
|
|
|
|
|
|
if ( glyph2 > 0 )
|
|
|
|
glyph2--;
|
|
|
|
|
|
|
|
/* convert glyph indices to character codes */
|
|
|
|
if ( glyph1 > phy_font->num_chars ||
|
|
|
|
glyph2 > phy_font->num_chars )
|
|
|
|
goto Exit;
|
|
|
|
|
|
|
|
code1 = phy_font->chars[glyph1].char_code;
|
|
|
|
code2 = phy_font->chars[glyph2].char_code;
|
2005-03-04 00:05:29 +01:00
|
|
|
pair = PFR_KERN_INDEX( code1, code2 );
|
2005-03-03 15:00:23 +01:00
|
|
|
|
|
|
|
/* now search the list of kerning items */
|
|
|
|
{
|
|
|
|
PFR_KernItem item = phy_font->kern_items;
|
|
|
|
FT_Stream stream = pfrface->stream;
|
|
|
|
|
2005-03-04 00:05:29 +01:00
|
|
|
|
2005-03-03 15:00:23 +01:00
|
|
|
for ( ; item; item = item->next )
|
|
|
|
{
|
|
|
|
if ( pair >= item->pair1 && pair <= item->pair2 )
|
|
|
|
goto FoundPair;
|
|
|
|
}
|
|
|
|
goto Exit;
|
|
|
|
|
|
|
|
FoundPair: /* we found an item, now parse it and find the value if any */
|
2005-03-04 00:05:29 +01:00
|
|
|
if ( FT_STREAM_SEEK( item->offset ) ||
|
|
|
|
FT_FRAME_ENTER( item->pair_count * item->pair_size ) )
|
2005-03-03 15:00:23 +01:00
|
|
|
goto Exit;
|
|
|
|
|
|
|
|
{
|
2006-09-27 08:29:21 +02:00
|
|
|
FT_UInt count = item->pair_count;
|
|
|
|
FT_UInt size = item->pair_size;
|
|
|
|
FT_UInt power = (FT_UInt)ft_highpow2( (FT_UInt32)count );
|
|
|
|
FT_UInt probe = power * size;
|
|
|
|
FT_UInt extra = count - power;
|
|
|
|
FT_Byte* base = stream->cursor;
|
|
|
|
FT_Bool twobytes = FT_BOOL( item->flags & 1 );
|
|
|
|
FT_Bool twobyte_adj = FT_BOOL( item->flags & 2 );
|
2005-03-04 00:05:29 +01:00
|
|
|
FT_Byte* p;
|
|
|
|
FT_UInt32 cpair;
|
|
|
|
|
2005-03-03 15:00:23 +01:00
|
|
|
|
|
|
|
if ( extra > 0 )
|
|
|
|
{
|
2005-03-04 00:05:29 +01:00
|
|
|
p = base + extra * size;
|
|
|
|
|
2005-03-03 15:00:23 +01:00
|
|
|
if ( twobytes )
|
2005-03-04 00:05:29 +01:00
|
|
|
cpair = FT_NEXT_ULONG( p );
|
2005-03-03 15:00:23 +01:00
|
|
|
else
|
2005-03-04 00:05:29 +01:00
|
|
|
cpair = PFR_NEXT_KPAIR( p );
|
2005-03-03 15:00:23 +01:00
|
|
|
|
|
|
|
if ( cpair == pair )
|
|
|
|
goto Found;
|
|
|
|
|
|
|
|
if ( cpair < pair )
|
2006-09-27 08:29:21 +02:00
|
|
|
{
|
|
|
|
if ( twobyte_adj )
|
|
|
|
p += 2;
|
|
|
|
else
|
|
|
|
p++;
|
2005-03-03 15:00:23 +01:00
|
|
|
base = p;
|
2006-09-27 08:29:21 +02:00
|
|
|
}
|
2005-03-03 15:00:23 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
while ( probe > size )
|
|
|
|
{
|
|
|
|
probe >>= 1;
|
|
|
|
p = base + probe;
|
2005-03-04 00:05:29 +01:00
|
|
|
|
2005-03-03 15:00:23 +01:00
|
|
|
if ( twobytes )
|
2005-03-04 00:05:29 +01:00
|
|
|
cpair = FT_NEXT_ULONG( p );
|
2005-03-03 15:00:23 +01:00
|
|
|
else
|
2005-03-04 00:05:29 +01:00
|
|
|
cpair = PFR_NEXT_KPAIR( p );
|
2005-03-03 15:00:23 +01:00
|
|
|
|
|
|
|
if ( cpair == pair )
|
|
|
|
goto Found;
|
|
|
|
|
|
|
|
if ( cpair < pair )
|
|
|
|
base += probe;
|
|
|
|
}
|
|
|
|
|
|
|
|
p = base;
|
2005-03-04 00:05:29 +01:00
|
|
|
|
2005-03-03 15:00:23 +01:00
|
|
|
if ( twobytes )
|
2005-03-04 00:05:29 +01:00
|
|
|
cpair = FT_NEXT_ULONG( p );
|
2005-03-03 15:00:23 +01:00
|
|
|
else
|
2005-03-04 00:05:29 +01:00
|
|
|
cpair = PFR_NEXT_KPAIR( p );
|
2005-03-03 15:00:23 +01:00
|
|
|
|
|
|
|
if ( cpair == pair )
|
|
|
|
{
|
|
|
|
FT_Int value;
|
|
|
|
|
2005-03-04 00:05:29 +01:00
|
|
|
|
2005-03-03 15:00:23 +01:00
|
|
|
Found:
|
2006-09-27 08:29:21 +02:00
|
|
|
if ( twobyte_adj )
|
2005-03-04 00:05:29 +01:00
|
|
|
value = FT_PEEK_SHORT( p );
|
2005-03-03 15:00:23 +01:00
|
|
|
else
|
|
|
|
value = p[0];
|
|
|
|
|
|
|
|
kerning->x = item->base_adj + value;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
FT_FRAME_EXIT();
|
|
|
|
}
|
|
|
|
|
|
|
|
Exit:
|
|
|
|
return error;
|
|
|
|
}
|
|
|
|
|
2002-04-20 07:38:33 +02:00
|
|
|
/* END */
|