From 5225402a527e9f35283a3b3db595d41df1c67e1d Mon Sep 17 00:00:00 2001 From: Werner Lemberg Date: Wed, 15 Feb 2006 06:05:52 +0000 Subject: [PATCH] * include/freetype/ftoutln.h (FT_Outline_Embolden): Mention in documentation that negative strength values are possible. Give an example call. * include/freetype/freetype.h (FT_GlyphSlotRec): Improve documentation of `outline' field. * src/sfnt/sfobjc.s: Inckude FT_INTERNAL_DEBUG_H. * src/sfnt/sfdriver.c: Include ttmtx.h. * src/autofit/afcjk.c: Include aftypes.h and aflatin.h. --- ChangeLog | 45 +++++++++++++++++++---------- include/freetype/freetype.h | 5 +++- include/freetype/ftoutln.h | 17 ++++++++++- include/freetype/internal/fttrace.h | 2 +- include/freetype/internal/sfnt.h | 20 ++++++------- src/autofit/afcjk.c | 4 +++ src/sfnt/rules.mk | 2 +- src/sfnt/sfdriver.c | 1 + src/sfnt/sfnt.c | 2 +- src/sfnt/sfobjs.c | 3 +- src/sfnt/ttload.c | 8 ++--- src/sfnt/ttload.h | 6 ++-- src/sfnt/ttmtx.c | 14 ++++----- src/truetype/ttpload.c | 21 +++++++------- src/type1/t1load.c | 6 ++-- 15 files changed, 96 insertions(+), 60 deletions(-) diff --git a/ChangeLog b/ChangeLog index fff1dffff..5a0ccee85 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,17 @@ +2006-02-14 Werner Lemberg + + * include/freetype/ftoutln.h (FT_Outline_Embolden): Mention in + documentation that negative strength values are possible. + Give an example call. + + * include/freetype/freetype.h (FT_GlyphSlotRec): Improve + documentation of `outline' field. + + * src/sfnt/sfobjc.s: Inckude FT_INTERNAL_DEBUG_H. + * src/sfnt/sfdriver.c: Include ttmtx.h. + + * src/autofit/afcjk.c: Include aftypes.h and aflatin.h. + 2006-02-14 Chia-I Wu * src/sfnt/ttmtx.c (tt_face_get_metrics): Typo. @@ -9,11 +23,11 @@ Check table length in non-FT_OPTIMIZE_MEMORY'ed `tt_face_load_hmtx'. * src/sfnt/sfobjs.c (sfnt_load_face): Take care of missing metrics - tables. The last change makes Mac bitmap-only font not load and this - fixes it. + tables. The last change makes Mac bitmap-only font not load and + this fixes it. - * src/truetype/ttgload.c (load_truetype_glyph): Fix compilation error - when FT_CONFIG_OPTION_INCREMENTAL is defined. + * src/truetype/ttgload.c (load_truetype_glyph): Fix compilation + error when FT_CONFIG_OPTION_INCREMENTAL is defined. 2006-02-13 Chia-I Wu @@ -32,10 +46,10 @@ 2006-02-13 Chia-I Wu - Clean up the SFNT_Interface. In this pass, we want to treat the font - directory (offset table and table directory) as a normal table like - the others. This also means that TTC is no longer recognized there, - but in `init_face'. + Clean up the SFNT_Interface. In this pass, we want to treat the + font directory (offset table and table directory) as a normal table + like the others. This also means that TTCs are no longer recognized + there but in `init_face'. * include/freetype/internal/sfnt.h (SFNT_Interface), src/sfnt/sfdriver.c: `load_sfnt_header' and `load_directory' are @@ -52,9 +66,10 @@ 2006-02-13 Chia-I Wu Clean up the SFNT_Interface. Table loading functions are now named - after the tables' tags; `hdmx' is TrueType-specific and thus the code - is moved to the truetype module; `get_metrics' is moved here from the - truetype module so that the code can be shared with the cff module. + after the tables' tags; `hdmx' is TrueType-specific and thus the + code is moved to the truetype module; `get_metrics' is moved here + from the truetype module so that the code can be shared with the cff + module. This pass involves no real changes. That is, the code is moved verbatim mostly. The only exception is the return value of @@ -65,10 +80,10 @@ src/sfnt/ttload.c, src/sfnt/ttload.h, src/sfnt/ttsbit.c, src/sfnt/ttsbit.h, src/sfnt/ttsbit0.c: Clean up the SFNT_Interface. - * src/sfnt/ttmtx.c, src/sfnt/ttmtx.h: Metrics-related tables' loading - and parsing code is moved here. - Move `tt_face_get_metrics' here from the truetype module. The return - value is changed from `void' to `FT_Error'. + * src/sfnt/ttmtx.c, src/sfnt/ttmtx.h: New files. Metrics-related + tables' loading and parsing code is moved to here. + Move `tt_face_get_metrics' here from the truetype module. The + return value is changed from `void' to `FT_Error'. * include/freetype/internal/fttrace.h: New trace: ttmtx. diff --git a/include/freetype/freetype.h b/include/freetype/freetype.h index 131a1c577..66550e8ff 100644 --- a/include/freetype/freetype.h +++ b/include/freetype/freetype.h @@ -1428,7 +1428,10 @@ FT_BEGIN_HEADER /* */ /* outline :: The outline descriptor for the current glyph */ /* image if its format is */ - /* FT_GLYPH_FORMAT_OUTLINE. */ + /* FT_GLYPH_FORMAT_OUTLINE. Once a glyph is */ + /* loaded, `outline' can be transformed, */ + /* distorted, embolded, etc. However, it must */ + /* not be freed. */ /* */ /* num_subglyphs :: The number of subglyphs in a composite glyph. */ /* This field is only valid for the composite */ diff --git a/include/freetype/ftoutln.h b/include/freetype/ftoutln.h index b647500bb..dbe8edc8a 100644 --- a/include/freetype/ftoutln.h +++ b/include/freetype/ftoutln.h @@ -5,7 +5,7 @@ /* Support for the FT_Outline type used to store glyph shapes of */ /* most scalable font formats (specification). */ /* */ -/* Copyright 1996-2001, 2002, 2003, 2005 by */ +/* Copyright 1996-2001, 2002, 2003, 2005, 2006 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -314,6 +314,9 @@ FT_BEGIN_HEADER /* `strength' pixels wider and higher. You may think of the left and */ /* bottom borders as unchanged. */ /* */ + /* Negative `strength' values to reduce the outline thickness are */ + /* possible also. */ + /* */ /* */ /* outline :: A handle to the target outline. */ /* */ @@ -324,6 +327,18 @@ FT_BEGIN_HEADER /* */ /* FreeType error code. 0 means success. */ /* */ + /* */ + /* The used algorithm to increase or decrease the thickness of the */ + /* glyph doesn't change the number of points; this means that certain */ + /* situations like acute angles or intersections are sometimes */ + /* handled incorrectly. */ + /* */ + /* Example call: */ + /* */ + /* FT_Load_Glyph( face, index, FT_LOAD_DEFAULT ); */ + /* if ( face->slot->format == FT_GLYPH_FORMAT_OUTLINE ) */ + /* FT_Outline_Embolden( &face->slot->outline, strength ); */ + /* */ FT_EXPORT( FT_Error ) FT_Outline_Embolden( FT_Outline* outline, FT_Pos strength ); diff --git a/include/freetype/internal/fttrace.h b/include/freetype/internal/fttrace.h index b5ebd92cc..81916fc6a 100644 --- a/include/freetype/internal/fttrace.h +++ b/include/freetype/internal/fttrace.h @@ -4,7 +4,7 @@ /* */ /* Tracing handling (specification only). */ /* */ -/* Copyright 2002, 2004, 2005 by */ +/* Copyright 2002, 2004, 2005, 2006 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ diff --git a/include/freetype/internal/sfnt.h b/include/freetype/internal/sfnt.h index e49e023b2..1da799fc2 100644 --- a/include/freetype/internal/sfnt.h +++ b/include/freetype/internal/sfnt.h @@ -34,7 +34,7 @@ FT_BEGIN_HEADER /* TT_Init_Face_Func */ /* */ /* */ - /* First part of the SFNT face object initialization. This will find */ + /* First part of the SFNT face object initialization. This finds */ /* the face in a SFNT file or collection, and load its format tag in */ /* face->format_tag. */ /* */ @@ -77,9 +77,9 @@ FT_BEGIN_HEADER /* TT_Load_Face_Func */ /* */ /* */ - /* Second part of the SFNT face object initialization. This will */ - /* load the common SFNT tables (head, OS/2, maxp, metrics, etc.) in */ - /* the face object. */ + /* Second part of the SFNT face object initialization. This loads */ + /* the common SFNT tables (head, OS/2, maxp, metrics, etc.) in the */ + /* face object. */ /* */ /* */ /* stream :: The input stream. */ @@ -375,8 +375,8 @@ FT_BEGIN_HEADER /* TT_Load_Metrics_Func */ /* */ /* */ - /* Load a metrics table, which is a table comes with a horizontal */ - /* and a vertical version. */ + /* Load a metrics table, which is a table with a horizontal and a */ + /* vertical version. */ /* */ /* */ /* face :: A handle to the target face object. */ @@ -437,8 +437,8 @@ FT_BEGIN_HEADER /* FreeType error code. 0 means success. */ /* */ /* */ - /* The function will use `face->goto_table' to seek the stream to */ - /* the start of the table, except in loading font directory. */ + /* The function uses `face->goto_table' to seek the stream to the */ + /* start of the table, except while loading the font directory. */ /* */ typedef FT_Error (*TT_Load_Table_Func)( TT_Face face, @@ -504,8 +504,8 @@ FT_BEGIN_HEADER TT_Load_Any_Func load_any; - /* load the font directory, i.e. the offset table and */ - /* the table directory */ + /* load the font directory, i.e., the offset table and */ + /* the table directory */ TT_Load_Table_Func load_font_dir; /* these functions are called by `load_face' but they can also */ diff --git a/src/autofit/afcjk.c b/src/autofit/afcjk.c index cff98c539..d549da52b 100644 --- a/src/autofit/afcjk.c +++ b/src/autofit/afcjk.c @@ -22,6 +22,10 @@ * */ +#include "aftypes.h" +#include "aflatin.h" + + #ifdef AF_CONFIG_OPTION_CJK #include "afcjk.h" diff --git a/src/sfnt/rules.mk b/src/sfnt/rules.mk index 24f38cbb6..c65f8abdd 100644 --- a/src/sfnt/rules.mk +++ b/src/sfnt/rules.mk @@ -3,7 +3,7 @@ # -# Copyright 1996-2000, 2002, 2003, 2004, 2005 by +# Copyright 1996-2000, 2002, 2003, 2004, 2005, 2006 by # David Turner, Robert Wilhelm, and Werner Lemberg. # # This file is part of the FreeType project, and may only be used, modified, diff --git a/src/sfnt/sfdriver.c b/src/sfnt/sfdriver.c index 8a8b3e8b8..df142a541 100644 --- a/src/sfnt/sfdriver.c +++ b/src/sfnt/sfdriver.c @@ -41,6 +41,7 @@ #include "ttcmap.h" #include "ttkern.h" +#include "ttmtx.h" #include FT_SERVICE_GLYPH_DICT_H #include FT_SERVICE_POSTSCRIPT_NAME_H diff --git a/src/sfnt/sfnt.c b/src/sfnt/sfnt.c index bba25ca65..45a820b71 100644 --- a/src/sfnt/sfnt.c +++ b/src/sfnt/sfnt.c @@ -4,7 +4,7 @@ /* */ /* Single object library component. */ /* */ -/* Copyright 1996-2001, 2002, 2003, 2004, 2005 by */ +/* Copyright 1996-2001, 2002, 2003, 2004, 2005, 2006 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ diff --git a/src/sfnt/sfobjs.c b/src/sfnt/sfobjs.c index 53a09dd73..6c0b7fab8 100644 --- a/src/sfnt/sfobjs.c +++ b/src/sfnt/sfobjs.c @@ -22,6 +22,7 @@ #include "ttcmap.h" #include "ttkern.h" #include FT_INTERNAL_SFNT_H +#include FT_INTERNAL_DEBUG_H #include FT_TRUETYPE_IDS_H #include FT_TRUETYPE_TAGS_H #include FT_SERVICE_POSTSCRIPT_CMAPS_H @@ -588,7 +589,7 @@ /* No `hhea' table necessary for SFNT Mac fonts. */ if ( face->format_tag == TTAG_true ) { - FT_TRACE2(( "This is an SFNT Mac font.\n")); + FT_TRACE2(( "This is an SFNT Mac font.\n" )); error = SFNT_Err_Ok; } else diff --git a/src/sfnt/ttload.c b/src/sfnt/ttload.c index adfb0b924..db0e6bba0 100644 --- a/src/sfnt/ttload.c +++ b/src/sfnt/ttload.c @@ -5,7 +5,7 @@ /* Load the basic TrueType tables, i.e., tables that can be either in */ /* TTF or OTF fonts (body). */ /* */ -/* Copyright 1996-2001, 2002, 2003, 2004, 2005 by */ +/* Copyright 1996-2001, 2002, 2003, 2004, 2005, 2006 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -259,8 +259,8 @@ /* The stream cursor must be at the beginning of the font directory. */ /* */ FT_LOCAL_DEF( FT_Error ) - tt_face_load_font_dir( TT_Face face, - FT_Stream stream ) + tt_face_load_font_dir( TT_Face face, + FT_Stream stream ) { SFNT_HeaderRec sfnt; FT_Error error; @@ -294,7 +294,7 @@ /* many fonts don't have these fields set correctly */ #if 0 - if ( sfnt.search_range != 1 << ( sfnt.entry_selector + 4 ) || + if ( sfnt.search_range != 1 << ( sfnt.entry_selector + 4 ) || sfnt.search_range + sfnt.range_shift != sfnt.num_tables << 4 ) return SFNT_Err_Unknown_File_Format; #endif diff --git a/src/sfnt/ttload.h b/src/sfnt/ttload.h index b665711ee..49a1aee16 100644 --- a/src/sfnt/ttload.h +++ b/src/sfnt/ttload.h @@ -5,7 +5,7 @@ /* Load the basic TrueType tables, i.e., tables that can be either in */ /* TTF or OTF fonts (specification). */ /* */ -/* Copyright 1996-2001, 2002, 2005 by */ +/* Copyright 1996-2001, 2002, 2005, 2006 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -41,8 +41,8 @@ FT_BEGIN_HEADER FT_LOCAL( FT_Error ) - tt_face_load_font_dir( TT_Face face, - FT_Stream stream ); + tt_face_load_font_dir( TT_Face face, + FT_Stream stream ); FT_LOCAL( FT_Error ) diff --git a/src/sfnt/ttmtx.c b/src/sfnt/ttmtx.c index 929c55dca..9928f30ee 100644 --- a/src/sfnt/ttmtx.c +++ b/src/sfnt/ttmtx.c @@ -140,8 +140,8 @@ face->vertical.number_Of_VMetrics = num_longs; } - longs = (TT_LongMetrics *)&face->vertical.long_metrics; - shorts = (TT_ShortMetrics**)&face->vertical.short_metrics; + longs = (TT_LongMetrics *) &face->vertical.long_metrics; + shorts = (TT_ShortMetrics**)&face->vertical.short_metrics; } else { @@ -160,8 +160,8 @@ face->horizontal.number_Of_HMetrics = num_longs; } - longs = (TT_LongMetrics *)&face->horizontal.long_metrics; - shorts = (TT_ShortMetrics**)&face->horizontal.short_metrics; + longs = (TT_LongMetrics *) &face->horizontal.long_metrics; + shorts = (TT_ShortMetrics**)&face->horizontal.short_metrics; } /* never trust derived values */ @@ -358,10 +358,6 @@ /* */ /* advance :: The advance width resp. advance height. */ /* */ - /* */ - /* This function will much probably move to another component in the */ - /* near future, but I haven't decided which yet. */ - /* */ #ifdef FT_OPTIMIZE_MEMORY FT_LOCAL_DEF( FT_Error ) @@ -439,7 +435,7 @@ TT_HoriHeader* header = vertical ? (TT_HoriHeader*)&face->vertical : &face->horizontal; TT_LongMetrics longs_m; - FT_UShort k = header->number_Of_HMetrics; + FT_UShort k = header->number_Of_HMetrics; if ( k == 0 || gindex >= (FT_UInt)face->max_profile.numGlyphs ) diff --git a/src/truetype/ttpload.c b/src/truetype/ttpload.c index a7b393cdc..04c2031e6 100644 --- a/src/truetype/ttpload.c +++ b/src/truetype/ttpload.c @@ -47,7 +47,7 @@ /* tt_face_load_loca */ /* */ /* */ - /* Loads the locations table. */ + /* Load the locations table. */ /* */ /* */ /* face :: A handle to the target face object. */ @@ -319,7 +319,7 @@ /* tt_face_load_cvt */ /* */ /* */ - /* Loads the control value table into a face object. */ + /* Load the control value table into a face object. */ /* */ /* */ /* face :: A handle to the target face object. */ @@ -400,7 +400,7 @@ /* tt_face_load_fpgm */ /* */ /* */ - /* Loads the font program. */ + /* Load the font program. */ /* */ /* */ /* face :: A handle to the target face object. */ @@ -417,8 +417,8 @@ { #ifdef TT_CONFIG_OPTION_BYTECODE_INTERPRETER - FT_Error error; - FT_ULong table_len; + FT_Error error; + FT_ULong table_len; FT_TRACE2(( "Font program " )); @@ -462,7 +462,7 @@ /* tt_face_load_prep */ /* */ /* */ - /* Loads the cvt program. */ + /* Load the cvt program. */ /* */ /* */ /* face :: A handle to the target face object. */ @@ -479,8 +479,8 @@ { #ifdef TT_CONFIG_OPTION_BYTECODE_INTERPRETER - FT_Error error; - FT_ULong table_len; + FT_Error error; + FT_ULong table_len; FT_TRACE2(( "Prep program " )); @@ -523,7 +523,7 @@ /* tt_face_load_hdmx */ /* */ /* */ - /* Loads the `hdmx' table into the face object. */ + /* Load the `hdmx' table into the face object. */ /* */ /* */ /* face :: A handle to the target face object. */ @@ -699,9 +699,10 @@ #endif /* !OPTIMIZE_MEMORY */ + /*************************************************************************/ /* */ - /* Returns the advance width table for a given pixel size if it is found */ + /* Return the advance width table for a given pixel size if it is found */ /* in the font's `hdmx' table (if any). */ /* */ FT_LOCAL_DEF( FT_Byte* ) diff --git a/src/type1/t1load.c b/src/type1/t1load.c index 6af52797d..75c0e9523 100644 --- a/src/type1/t1load.c +++ b/src/type1/t1load.c @@ -1856,9 +1856,9 @@ /* field to deal adequately with synthetic */ /* fonts; /Subrs and /CharStrings are */ /* handled specially. */ - if ( keyword_flag[0] == 0 || - ft_strcmp( (const char*)name, "Subrs" ) == 0 || - ft_strcmp( (const char*)name, "CharStrings") == 0 ) + if ( keyword_flag[0] == 0 || + ft_strcmp( (const char*)name, "Subrs" ) == 0 || + ft_strcmp( (const char*)name, "CharStrings" ) == 0 ) { parser->root.error = t1_load_keyword( face, loader,