2000-06-05 07:26:15 +02:00
|
|
|
/***************************************************************************/
|
|
|
|
/* */
|
|
|
|
/* sfobjs.c */
|
|
|
|
/* */
|
|
|
|
/* SFNT object management (base). */
|
|
|
|
/* */
|
2005-03-01 03:13:50 +01:00
|
|
|
/* Copyright 1996-2001, 2002, 2003, 2004, 2005 by */
|
2000-06-05 07:26:15 +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. */
|
|
|
|
/* */
|
|
|
|
/***************************************************************************/
|
|
|
|
|
2000-12-08 17:17:16 +01:00
|
|
|
|
|
|
|
#include <ft2build.h>
|
2001-03-20 12:14:24 +01:00
|
|
|
#include "sfobjs.h"
|
|
|
|
#include "ttload.h"
|
2004-08-29 18:50:09 +02:00
|
|
|
#include "ttcmap.h"
|
2005-02-26 01:12:04 +01:00
|
|
|
#include "ttkern.h"
|
2000-12-08 17:17:16 +01:00
|
|
|
#include FT_INTERNAL_SFNT_H
|
2001-03-20 15:50:04 +01:00
|
|
|
#include FT_TRUETYPE_IDS_H
|
2000-12-08 17:17:16 +01:00
|
|
|
#include FT_TRUETYPE_TAGS_H
|
* include/freetype/internal/bdftypes.h: removed obsolete header
* include/freetype/internal/cfftypes.h, src/cff/cfftypes.h,
src/cff/cffload.h, src/cff/cffobjs.h, src/cff/cffparse.h,
include/freetype/internal/services/svbdf.h: moving "cfftypes.h" from
'include/freetype/internal' to 'src/cff' since no other modules needs
to known about these types
* include/freetype/internal/t42types.h,
include/freetype/internal/internal.h, src/type42/t42objs.h,
src/type42/t42drivr.c, src/type42/t42types.h: moving "t42types.h" from
'include/freetype/internal' to 'src/type42' since no other modules needs
to known about these types
* src/gzip/infblock.c: removing compiler warning
* include/freetype/internal/services/svpsinfo.h,
include/freetype/internal/ftserv.h, src/cff/cffdrivr.c,
src/cid/ciddrivr.c, src/type1/t1driver.c, src/type42/t42drivr.c,
src/base/fttype1.c: migrating to FT_SERVICE_ID_POSTSCRIPT_INFO defined
in "svpsinfo.h", removing some sad hacks.
2003-10-29 22:43:52 +01:00
|
|
|
#include FT_SERVICE_POSTSCRIPT_CMAPS_H
|
Complete redesign of error codes. Please check ftmoderr.h for more
details.
* include/freetype/internal/cfferrs.h,
include/freetype/internal/tterrors.h,
include/freetype/internal/t1errors.h: Removed. Replaced with files
local to the module. All extra error codes have been moved to
`fterrors.h'.
* src/sfnt/ttpost.h: Move error codes to `fterrors.h'.
* src/autohint/aherrors.h, src/cache/ftcerror.h, src/cff/cfferrs.h,
src/cid/ciderrs.h, src/pcf/pcferror.h, src/psaux/psauxerr.h,
src/psnames/psnamerr.h, src/raster/rasterrs.h, src/sfnt/sferrors.h,
src/smooth/ftsmerrs.h, src/truetype/tterrors.h,
src/type1/t1errors.h, src/winfonts/fnterrs.h: New files defining the
error names for the module it belongs to.
* include/freetype/ftmoderr.h: New file, defining the module error
offsets. Its structure is similar to `fterrors.h'.
* include/freetype/fterrors.h (FT_NOERRORDEF): New macro.
(FT_ERRORDEF): Redefined to use module error offsets.
All internal error codes are now public; unused error codes have
been removed, some are new.
* include/freetype/config/ftheader.h (FT_MODULE_ERRORS_H): New
macro.
* include/freetype/config/ftoption.h
(FT_CONFIG_OPTION_USE_MODULE_ERRORS): New macro.
All other source files have been updated to use the new error codes;
some already existing (internal) error codes local to a module have
been renamed to give them the same name as in the base module.
All make files have been updated to include the local error files.
* src/cid/cidtokens.h: Replaced with...
* src/cid/cidtoken.h: This file for 8+3 consistency.
* src/raster/ftraster.c: Use macros for header file names.
2001-06-06 19:30:41 +02:00
|
|
|
#include "sferrors.h"
|
2000-05-28 19:15:37 +02:00
|
|
|
|
2000-06-05 07:26:15 +02:00
|
|
|
|
2000-06-12 21:36:41 +02:00
|
|
|
/*************************************************************************/
|
|
|
|
/* */
|
|
|
|
/* The macro FT_COMPONENT is used in trace mode. It is an implicit */
|
|
|
|
/* parameter of the FT_TRACE() and FT_ERROR() macros, used to print/log */
|
|
|
|
/* messages during execution. */
|
|
|
|
/* */
|
|
|
|
#undef FT_COMPONENT
|
|
|
|
#define FT_COMPONENT trace_sfobjs
|
|
|
|
|
|
|
|
|
2002-03-30 17:32:47 +01:00
|
|
|
|
2002-03-31 20:48:24 +02:00
|
|
|
/* convert a UTF-16 name entry to ASCII */
|
2002-03-30 17:32:47 +01:00
|
|
|
static FT_String*
|
2002-03-31 20:48:24 +02:00
|
|
|
tt_name_entry_ascii_from_utf16( TT_NameEntry entry,
|
|
|
|
FT_Memory memory )
|
2002-03-30 17:32:47 +01:00
|
|
|
{
|
|
|
|
FT_String* string;
|
|
|
|
FT_UInt len, code, n;
|
2002-03-31 20:48:24 +02:00
|
|
|
FT_Byte* read = (FT_Byte*)entry->string;
|
|
|
|
|
|
|
|
|
|
|
|
len = (FT_UInt)entry->stringLength / 2;
|
|
|
|
|
|
|
|
if ( FT_MEM_NEW_ARRAY( string, len + 1 ) )
|
2002-03-30 17:32:47 +01:00
|
|
|
return NULL;
|
2002-03-31 20:48:24 +02:00
|
|
|
|
2002-03-30 17:32:47 +01:00
|
|
|
for ( n = 0; n < len; n++ )
|
|
|
|
{
|
2002-03-31 20:48:24 +02:00
|
|
|
code = FT_NEXT_USHORT( read );
|
2002-03-30 17:32:47 +01:00
|
|
|
if ( code < 32 || code > 127 )
|
|
|
|
code = '?';
|
2002-03-31 20:48:24 +02:00
|
|
|
|
2002-03-30 17:32:47 +01:00
|
|
|
string[n] = (char)code;
|
|
|
|
}
|
|
|
|
|
|
|
|
string[len] = 0;
|
2002-03-31 20:48:24 +02:00
|
|
|
|
2002-03-30 17:32:47 +01:00
|
|
|
return string;
|
2002-03-31 20:48:24 +02:00
|
|
|
}
|
2002-03-30 17:32:47 +01:00
|
|
|
|
|
|
|
|
2002-03-31 20:48:24 +02:00
|
|
|
/* convert a UCS-4 name entry to ASCII */
|
2002-03-30 17:32:47 +01:00
|
|
|
static FT_String*
|
|
|
|
tt_name_entry_ascii_from_ucs4( TT_NameEntry entry,
|
|
|
|
FT_Memory memory )
|
|
|
|
{
|
|
|
|
FT_String* string;
|
|
|
|
FT_UInt len, code, n;
|
2002-03-31 20:48:24 +02:00
|
|
|
FT_Byte* read = (FT_Byte*)entry->string;
|
|
|
|
|
|
|
|
|
|
|
|
len = (FT_UInt)entry->stringLength / 4;
|
|
|
|
|
|
|
|
if ( FT_MEM_NEW_ARRAY( string, len + 1 ) )
|
2002-03-30 17:32:47 +01:00
|
|
|
return NULL;
|
2002-03-31 20:48:24 +02:00
|
|
|
|
2002-03-30 17:32:47 +01:00
|
|
|
for ( n = 0; n < len; n++ )
|
|
|
|
{
|
2002-09-28 18:40:57 +02:00
|
|
|
code = (FT_UInt)FT_NEXT_ULONG( read );
|
2002-03-30 17:32:47 +01:00
|
|
|
if ( code < 32 || code > 127 )
|
|
|
|
code = '?';
|
2002-03-31 20:48:24 +02:00
|
|
|
|
2002-03-30 17:32:47 +01:00
|
|
|
string[n] = (char)code;
|
|
|
|
}
|
|
|
|
|
|
|
|
string[len] = 0;
|
2002-03-31 20:48:24 +02:00
|
|
|
|
2002-03-30 17:32:47 +01:00
|
|
|
return string;
|
2002-03-31 20:48:24 +02:00
|
|
|
}
|
2002-03-30 17:32:47 +01:00
|
|
|
|
|
|
|
|
2002-03-31 20:48:24 +02:00
|
|
|
/* convert an Apple Roman or symbol name entry to ASCII */
|
2002-03-30 17:32:47 +01:00
|
|
|
static FT_String*
|
|
|
|
tt_name_entry_ascii_from_other( TT_NameEntry entry,
|
|
|
|
FT_Memory memory )
|
|
|
|
{
|
|
|
|
FT_String* string;
|
|
|
|
FT_UInt len, code, n;
|
2002-03-31 20:48:24 +02:00
|
|
|
FT_Byte* read = (FT_Byte*)entry->string;
|
|
|
|
|
|
|
|
|
|
|
|
len = (FT_UInt)entry->stringLength;
|
|
|
|
|
|
|
|
if ( FT_MEM_NEW_ARRAY( string, len + 1 ) )
|
2002-03-30 17:32:47 +01:00
|
|
|
return NULL;
|
2002-03-31 20:48:24 +02:00
|
|
|
|
2002-03-30 17:32:47 +01:00
|
|
|
for ( n = 0; n < len; n++ )
|
|
|
|
{
|
|
|
|
code = *read++;
|
|
|
|
if ( code < 32 || code > 127 )
|
|
|
|
code = '?';
|
2002-03-31 20:48:24 +02:00
|
|
|
|
2002-03-30 17:32:47 +01:00
|
|
|
string[n] = (char)code;
|
|
|
|
}
|
|
|
|
|
|
|
|
string[len] = 0;
|
2002-03-31 20:48:24 +02:00
|
|
|
|
2002-03-30 17:32:47 +01:00
|
|
|
return string;
|
2002-03-31 20:48:24 +02:00
|
|
|
}
|
2002-03-30 17:32:47 +01:00
|
|
|
|
|
|
|
|
2002-05-28 01:52:01 +02:00
|
|
|
typedef FT_String* (*TT_NameEntry_ConvertFunc)( TT_NameEntry entry,
|
|
|
|
FT_Memory memory );
|
|
|
|
|
2002-05-28 08:03:10 +02:00
|
|
|
|
2000-05-28 19:15:37 +02:00
|
|
|
/*************************************************************************/
|
|
|
|
/* */
|
|
|
|
/* <Function> */
|
2002-03-22 16:02:38 +01:00
|
|
|
/* tt_face_get_name */
|
2000-05-28 19:15:37 +02:00
|
|
|
/* */
|
|
|
|
/* <Description> */
|
|
|
|
/* Returns a given ENGLISH name record in ASCII. */
|
|
|
|
/* */
|
|
|
|
/* <Input> */
|
|
|
|
/* face :: A handle to the source face object. */
|
|
|
|
/* */
|
|
|
|
/* nameid :: The name id of the name record to return. */
|
|
|
|
/* */
|
|
|
|
/* <Return> */
|
2000-06-05 07:26:15 +02:00
|
|
|
/* Character string. NULL if no name is present. */
|
2000-05-28 19:15:37 +02:00
|
|
|
/* */
|
2001-06-28 01:25:46 +02:00
|
|
|
static FT_String*
|
2002-03-22 16:02:38 +01:00
|
|
|
tt_face_get_name( TT_Face face,
|
2002-03-30 17:32:47 +01:00
|
|
|
FT_UShort nameid )
|
2000-05-28 19:15:37 +02:00
|
|
|
{
|
2002-03-30 17:32:47 +01:00
|
|
|
FT_Memory memory = face->root.memory;
|
|
|
|
FT_String* result = NULL;
|
|
|
|
FT_UShort n;
|
2002-03-14 12:26:29 +01:00
|
|
|
TT_NameEntryRec* rec;
|
2002-03-30 17:32:47 +01:00
|
|
|
FT_Int found_apple = -1;
|
|
|
|
FT_Int found_win = -1;
|
|
|
|
FT_Int found_unicode = -1;
|
2000-05-28 19:15:37 +02:00
|
|
|
|
2004-06-09 22:18:35 +02:00
|
|
|
FT_Bool is_english = 0;
|
2004-06-02 23:22:32 +02:00
|
|
|
|
2002-05-28 01:52:01 +02:00
|
|
|
TT_NameEntry_ConvertFunc convert;
|
2000-06-05 07:26:15 +02:00
|
|
|
|
2002-05-28 08:03:10 +02:00
|
|
|
|
2000-05-28 19:15:37 +02:00
|
|
|
rec = face->name_table.names;
|
2002-05-01 10:36:12 +02:00
|
|
|
for ( n = 0; n < face->num_names; n++, rec++ )
|
2000-05-28 19:15:37 +02:00
|
|
|
{
|
2002-03-31 20:48:24 +02:00
|
|
|
/* According to the OpenType 1.3 specification, only Microsoft or */
|
|
|
|
/* Apple platform IDs might be used in the `name' table. The */
|
|
|
|
/* `Unicode' platform is reserved for the `cmap' table, and the */
|
|
|
|
/* `Iso' one is deprecated. */
|
|
|
|
/* */
|
|
|
|
/* However, the Apple TrueType specification doesn't say the same */
|
|
|
|
/* thing and goes to suggest that all Unicode `name' table entries */
|
|
|
|
/* should be coded in UTF-16 (in big-endian format I suppose). */
|
2002-03-30 17:32:47 +01:00
|
|
|
/* */
|
2002-05-28 01:52:01 +02:00
|
|
|
if ( rec->nameID == nameid && rec->stringLength > 0 )
|
2000-05-28 19:15:37 +02:00
|
|
|
{
|
2002-03-05 17:12:57 +01:00
|
|
|
switch ( rec->platformID )
|
2000-05-28 19:15:37 +02:00
|
|
|
{
|
2002-03-31 20:48:24 +02:00
|
|
|
case TT_PLATFORM_APPLE_UNICODE:
|
|
|
|
case TT_PLATFORM_ISO:
|
|
|
|
/* there is `languageID' to check there. We should use this */
|
|
|
|
/* field only as a last solution when nothing else is */
|
|
|
|
/* available. */
|
|
|
|
/* */
|
|
|
|
found_unicode = n;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case TT_PLATFORM_MACINTOSH:
|
|
|
|
if ( rec->languageID == TT_MAC_LANGID_ENGLISH )
|
|
|
|
found_apple = n;
|
|
|
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
case TT_PLATFORM_MICROSOFT:
|
|
|
|
/* we only take a non-English name when there is nothing */
|
|
|
|
/* else available in the font */
|
|
|
|
/* */
|
|
|
|
if ( found_win == -1 || ( rec->languageID & 0x3FF ) == 0x009 )
|
|
|
|
{
|
|
|
|
switch ( rec->encodingID )
|
2002-03-05 17:12:57 +01:00
|
|
|
{
|
2002-03-31 20:48:24 +02:00
|
|
|
case TT_MS_ID_SYMBOL_CS:
|
|
|
|
case TT_MS_ID_UNICODE_CS:
|
|
|
|
case TT_MS_ID_UCS_4:
|
2005-05-10 00:11:36 +02:00
|
|
|
is_english = FT_BOOL( ( rec->languageID & 0x3FF ) == 0x009 );
|
2004-06-02 23:22:32 +02:00
|
|
|
found_win = n;
|
2002-03-05 17:12:57 +01:00
|
|
|
break;
|
2002-03-31 20:48:24 +02:00
|
|
|
|
|
|
|
default:
|
|
|
|
;
|
2002-03-05 17:12:57 +01:00
|
|
|
}
|
2002-03-31 20:48:24 +02:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
|
|
|
default:
|
|
|
|
;
|
2000-05-28 19:15:37 +02:00
|
|
|
}
|
2002-03-05 17:12:57 +01:00
|
|
|
}
|
|
|
|
}
|
2000-05-28 19:15:37 +02:00
|
|
|
|
2002-03-31 20:48:24 +02:00
|
|
|
/* some fonts contain invalid Unicode or Macintosh formatted entries; */
|
|
|
|
/* we will thus favor names encoded in Windows formats if available */
|
2004-06-02 23:22:32 +02:00
|
|
|
/* (provided it is an English name) */
|
2002-03-31 20:48:24 +02:00
|
|
|
/* */
|
2002-05-28 01:52:01 +02:00
|
|
|
convert = NULL;
|
2004-06-02 23:22:32 +02:00
|
|
|
if ( found_win >= 0 && !( found_apple >= 0 && !is_english ) )
|
2002-03-05 17:12:57 +01:00
|
|
|
{
|
2002-03-30 17:32:47 +01:00
|
|
|
rec = face->name_table.names + found_win;
|
|
|
|
switch ( rec->encodingID )
|
2002-03-05 17:12:57 +01:00
|
|
|
{
|
2002-03-31 20:48:24 +02:00
|
|
|
case TT_MS_ID_UNICODE_CS:
|
|
|
|
case TT_MS_ID_SYMBOL_CS:
|
2002-05-28 01:52:01 +02:00
|
|
|
convert = tt_name_entry_ascii_from_utf16;
|
2002-03-31 20:48:24 +02:00
|
|
|
break;
|
|
|
|
|
|
|
|
case TT_MS_ID_UCS_4:
|
2002-05-28 01:52:01 +02:00
|
|
|
convert = tt_name_entry_ascii_from_ucs4;
|
2002-03-31 20:48:24 +02:00
|
|
|
break;
|
|
|
|
|
|
|
|
default:
|
|
|
|
;
|
2000-05-28 19:15:37 +02:00
|
|
|
}
|
|
|
|
}
|
2002-03-30 17:32:47 +01:00
|
|
|
else if ( found_apple >= 0 )
|
|
|
|
{
|
2002-05-28 01:52:01 +02:00
|
|
|
rec = face->name_table.names + found_apple;
|
|
|
|
convert = tt_name_entry_ascii_from_other;
|
2002-03-30 17:32:47 +01:00
|
|
|
}
|
|
|
|
else if ( found_unicode >= 0 )
|
|
|
|
{
|
2002-05-28 01:52:01 +02:00
|
|
|
rec = face->name_table.names + found_unicode;
|
|
|
|
convert = tt_name_entry_ascii_from_utf16;
|
|
|
|
}
|
|
|
|
|
|
|
|
if ( rec && convert )
|
|
|
|
{
|
|
|
|
if ( rec->string == NULL )
|
|
|
|
{
|
* 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
|
|
|
FT_Error error = SFNT_Err_Ok;
|
2002-05-28 01:52:01 +02:00
|
|
|
FT_Stream stream = face->name_table.stream;
|
|
|
|
|
2003-04-23 21:48:24 +02:00
|
|
|
FT_UNUSED( error );
|
|
|
|
|
2002-05-28 01:52:01 +02:00
|
|
|
|
2004-06-23 17:44:03 +02:00
|
|
|
if ( FT_QNEW_ARRAY ( rec->string, rec->stringLength ) ||
|
2002-05-28 01:52:01 +02:00
|
|
|
FT_STREAM_SEEK( rec->stringOffset ) ||
|
|
|
|
FT_STREAM_READ( rec->string, rec->stringLength ) )
|
|
|
|
{
|
|
|
|
FT_FREE( rec->string );
|
|
|
|
rec->stringLength = 0;
|
|
|
|
result = NULL;
|
|
|
|
goto Exit;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
result = convert( rec, memory );
|
2002-03-30 17:32:47 +01:00
|
|
|
}
|
2002-03-31 20:48:24 +02:00
|
|
|
|
2002-05-28 01:52:01 +02:00
|
|
|
Exit:
|
2002-03-30 17:32:47 +01:00
|
|
|
return result;
|
2000-05-28 19:15:37 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2001-06-28 01:25:46 +02:00
|
|
|
static FT_Encoding
|
2002-03-22 16:02:38 +01:00
|
|
|
sfnt_find_encoding( int platform_id,
|
|
|
|
int encoding_id )
|
2000-05-28 19:15:37 +02:00
|
|
|
{
|
|
|
|
typedef struct TEncoding
|
|
|
|
{
|
|
|
|
int platform_id;
|
|
|
|
int encoding_id;
|
|
|
|
FT_Encoding encoding;
|
|
|
|
|
|
|
|
} TEncoding;
|
|
|
|
|
2000-07-01 16:06:46 +02:00
|
|
|
static
|
|
|
|
const TEncoding tt_encodings[] =
|
2000-05-28 19:15:37 +02:00
|
|
|
{
|
* 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
|
|
|
{ TT_PLATFORM_ISO, -1, FT_ENCODING_UNICODE },
|
2000-05-28 19:15:37 +02:00
|
|
|
|
* 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
|
|
|
{ TT_PLATFORM_APPLE_UNICODE, -1, FT_ENCODING_UNICODE },
|
2000-05-28 19:15:37 +02:00
|
|
|
|
* 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
|
|
|
{ TT_PLATFORM_MACINTOSH, TT_MAC_ID_ROMAN, FT_ENCODING_APPLE_ROMAN },
|
2000-05-28 19:15:37 +02:00
|
|
|
|
* 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
|
|
|
{ TT_PLATFORM_MICROSOFT, TT_MS_ID_SYMBOL_CS, FT_ENCODING_MS_SYMBOL },
|
|
|
|
{ TT_PLATFORM_MICROSOFT, TT_MS_ID_UCS_4, FT_ENCODING_UNICODE },
|
|
|
|
{ TT_PLATFORM_MICROSOFT, TT_MS_ID_UNICODE_CS, FT_ENCODING_UNICODE },
|
2003-09-01 09:06:06 +02:00
|
|
|
{ TT_PLATFORM_MICROSOFT, TT_MS_ID_SJIS, FT_ENCODING_SJIS },
|
|
|
|
{ TT_PLATFORM_MICROSOFT, TT_MS_ID_GB2312, FT_ENCODING_GB2312 },
|
|
|
|
{ TT_PLATFORM_MICROSOFT, TT_MS_ID_BIG_5, FT_ENCODING_BIG5 },
|
|
|
|
{ TT_PLATFORM_MICROSOFT, TT_MS_ID_WANSUNG, FT_ENCODING_WANSUNG },
|
|
|
|
{ TT_PLATFORM_MICROSOFT, TT_MS_ID_JOHAB, FT_ENCODING_JOHAB }
|
2000-05-28 19:15:37 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
const TEncoding *cur, *limit;
|
|
|
|
|
2000-06-05 07:26:15 +02:00
|
|
|
|
2000-05-28 19:15:37 +02:00
|
|
|
cur = tt_encodings;
|
2000-06-05 07:26:15 +02:00
|
|
|
limit = cur + sizeof ( tt_encodings ) / sizeof ( tt_encodings[0] );
|
2000-05-28 19:15:37 +02:00
|
|
|
|
|
|
|
for ( ; cur < limit; cur++ )
|
|
|
|
{
|
2000-06-05 07:26:15 +02:00
|
|
|
if ( cur->platform_id == platform_id )
|
2000-05-28 19:15:37 +02:00
|
|
|
{
|
2000-06-05 07:26:15 +02:00
|
|
|
if ( cur->encoding_id == encoding_id ||
|
|
|
|
cur->encoding_id == -1 )
|
2000-05-28 19:15:37 +02:00
|
|
|
return cur->encoding;
|
|
|
|
}
|
|
|
|
}
|
2000-06-05 07:26:15 +02:00
|
|
|
|
* 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
|
|
|
return FT_ENCODING_NONE;
|
2000-05-28 19:15:37 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2002-03-01 03:26:22 +01:00
|
|
|
FT_LOCAL_DEF( FT_Error )
|
* 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
|
|
|
sfnt_init_face( FT_Stream stream,
|
2001-06-28 01:25:46 +02:00
|
|
|
TT_Face face,
|
|
|
|
FT_Int face_index,
|
|
|
|
FT_Int num_params,
|
|
|
|
FT_Parameter* params )
|
2000-05-28 19:15:37 +02:00
|
|
|
{
|
2002-02-28 17:10:29 +01:00
|
|
|
FT_Error error;
|
|
|
|
FT_Library library = face->root.driver->root.library;
|
|
|
|
SFNT_Service sfnt;
|
2002-03-31 20:48:24 +02:00
|
|
|
SFNT_HeaderRec sfnt_header;
|
2000-05-28 19:15:37 +02:00
|
|
|
|
|
|
|
/* for now, parameters are unused */
|
2000-07-04 20:12:13 +02:00
|
|
|
FT_UNUSED( num_params );
|
|
|
|
FT_UNUSED( params );
|
2000-06-05 07:26:15 +02:00
|
|
|
|
2002-03-31 20:48:24 +02:00
|
|
|
|
2002-02-28 17:10:29 +01:00
|
|
|
sfnt = (SFNT_Service)face->sfnt;
|
2000-06-05 07:26:15 +02:00
|
|
|
if ( !sfnt )
|
2000-05-28 19:15:37 +02:00
|
|
|
{
|
2002-02-28 17:10:29 +01:00
|
|
|
sfnt = (SFNT_Service)FT_Get_Module_Interface( library, "sfnt" );
|
2000-06-05 07:26:15 +02:00
|
|
|
if ( !sfnt )
|
2000-05-28 19:15:37 +02:00
|
|
|
{
|
Complete redesign of error codes. Please check ftmoderr.h for more
details.
* include/freetype/internal/cfferrs.h,
include/freetype/internal/tterrors.h,
include/freetype/internal/t1errors.h: Removed. Replaced with files
local to the module. All extra error codes have been moved to
`fterrors.h'.
* src/sfnt/ttpost.h: Move error codes to `fterrors.h'.
* src/autohint/aherrors.h, src/cache/ftcerror.h, src/cff/cfferrs.h,
src/cid/ciderrs.h, src/pcf/pcferror.h, src/psaux/psauxerr.h,
src/psnames/psnamerr.h, src/raster/rasterrs.h, src/sfnt/sferrors.h,
src/smooth/ftsmerrs.h, src/truetype/tterrors.h,
src/type1/t1errors.h, src/winfonts/fnterrs.h: New files defining the
error names for the module it belongs to.
* include/freetype/ftmoderr.h: New file, defining the module error
offsets. Its structure is similar to `fterrors.h'.
* include/freetype/fterrors.h (FT_NOERRORDEF): New macro.
(FT_ERRORDEF): Redefined to use module error offsets.
All internal error codes are now public; unused error codes have
been removed, some are new.
* include/freetype/config/ftheader.h (FT_MODULE_ERRORS_H): New
macro.
* include/freetype/config/ftoption.h
(FT_CONFIG_OPTION_USE_MODULE_ERRORS): New macro.
All other source files have been updated to use the new error codes;
some already existing (internal) error codes local to a module have
been renamed to give them the same name as in the base module.
All make files have been updated to include the local error files.
* src/cid/cidtokens.h: Replaced with...
* src/cid/cidtoken.h: This file for 8+3 consistency.
* src/raster/ftraster.c: Use macros for header file names.
2001-06-06 19:30:41 +02:00
|
|
|
error = SFNT_Err_Invalid_File_Format;
|
2000-05-28 19:15:37 +02:00
|
|
|
goto Exit;
|
|
|
|
}
|
|
|
|
|
|
|
|
face->sfnt = sfnt;
|
|
|
|
face->goto_table = sfnt->goto_table;
|
|
|
|
}
|
|
|
|
|
* include/freetype/internal/bdftypes.h: removed obsolete header
* include/freetype/internal/cfftypes.h, src/cff/cfftypes.h,
src/cff/cffload.h, src/cff/cffobjs.h, src/cff/cffparse.h,
include/freetype/internal/services/svbdf.h: moving "cfftypes.h" from
'include/freetype/internal' to 'src/cff' since no other modules needs
to known about these types
* include/freetype/internal/t42types.h,
include/freetype/internal/internal.h, src/type42/t42objs.h,
src/type42/t42drivr.c, src/type42/t42types.h: moving "t42types.h" from
'include/freetype/internal' to 'src/type42' since no other modules needs
to known about these types
* src/gzip/infblock.c: removing compiler warning
* include/freetype/internal/services/svpsinfo.h,
include/freetype/internal/ftserv.h, src/cff/cffdrivr.c,
src/cid/ciddrivr.c, src/type1/t1driver.c, src/type42/t42drivr.c,
src/base/fttype1.c: migrating to FT_SERVICE_ID_POSTSCRIPT_INFO defined
in "svpsinfo.h", removing some sad hacks.
2003-10-29 22:43:52 +01:00
|
|
|
FT_FACE_FIND_GLOBAL_SERVICE( face, face->psnames, POSTSCRIPT_CMAPS );
|
2000-05-28 19:15:37 +02:00
|
|
|
|
|
|
|
/* check that we have a valid TrueType file */
|
2000-05-29 22:37:41 +02:00
|
|
|
error = sfnt->load_sfnt_header( face, stream, face_index, &sfnt_header );
|
2000-06-05 07:26:15 +02:00
|
|
|
if ( error )
|
2000-06-05 16:32:32 +02:00
|
|
|
goto Exit;
|
2000-05-28 19:15:37 +02:00
|
|
|
|
2000-05-29 22:37:41 +02:00
|
|
|
face->format_tag = sfnt_header.format_tag;
|
|
|
|
face->num_tables = sfnt_header.num_tables;
|
|
|
|
|
2000-05-28 19:15:37 +02:00
|
|
|
/* Load font directory */
|
2000-05-29 22:37:41 +02:00
|
|
|
error = sfnt->load_directory( face, stream, &sfnt_header );
|
2000-06-05 07:26:15 +02:00
|
|
|
if ( error )
|
|
|
|
goto Exit;
|
2000-05-28 19:15:37 +02:00
|
|
|
|
2000-07-19 08:25:56 +02:00
|
|
|
face->root.num_faces = face->ttc_header.count;
|
2000-05-28 19:15:37 +02:00
|
|
|
if ( face->root.num_faces < 1 )
|
|
|
|
face->root.num_faces = 1;
|
|
|
|
|
|
|
|
Exit:
|
|
|
|
return error;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
#undef LOAD_
|
2000-07-01 16:06:46 +02:00
|
|
|
#define LOAD_( x ) ( ( error = sfnt->load_##x( face, stream ) ) \
|
Complete redesign of error codes. Please check ftmoderr.h for more
details.
* include/freetype/internal/cfferrs.h,
include/freetype/internal/tterrors.h,
include/freetype/internal/t1errors.h: Removed. Replaced with files
local to the module. All extra error codes have been moved to
`fterrors.h'.
* src/sfnt/ttpost.h: Move error codes to `fterrors.h'.
* src/autohint/aherrors.h, src/cache/ftcerror.h, src/cff/cfferrs.h,
src/cid/ciderrs.h, src/pcf/pcferror.h, src/psaux/psauxerr.h,
src/psnames/psnamerr.h, src/raster/rasterrs.h, src/sfnt/sferrors.h,
src/smooth/ftsmerrs.h, src/truetype/tterrors.h,
src/type1/t1errors.h, src/winfonts/fnterrs.h: New files defining the
error names for the module it belongs to.
* include/freetype/ftmoderr.h: New file, defining the module error
offsets. Its structure is similar to `fterrors.h'.
* include/freetype/fterrors.h (FT_NOERRORDEF): New macro.
(FT_ERRORDEF): Redefined to use module error offsets.
All internal error codes are now public; unused error codes have
been removed, some are new.
* include/freetype/config/ftheader.h (FT_MODULE_ERRORS_H): New
macro.
* include/freetype/config/ftoption.h
(FT_CONFIG_OPTION_USE_MODULE_ERRORS): New macro.
All other source files have been updated to use the new error codes;
some already existing (internal) error codes local to a module have
been renamed to give them the same name as in the base module.
All make files have been updated to include the local error files.
* src/cid/cidtokens.h: Replaced with...
* src/cid/cidtoken.h: This file for 8+3 consistency.
* src/raster/ftraster.c: Use macros for header file names.
2001-06-06 19:30:41 +02:00
|
|
|
!= SFNT_Err_Ok )
|
2000-05-28 19:15:37 +02:00
|
|
|
|
|
|
|
|
2002-03-01 03:26:22 +01:00
|
|
|
FT_LOCAL_DEF( FT_Error )
|
* 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
|
|
|
sfnt_load_face( FT_Stream stream,
|
2001-06-28 01:25:46 +02:00
|
|
|
TT_Face face,
|
|
|
|
FT_Int face_index,
|
|
|
|
FT_Int num_params,
|
|
|
|
FT_Parameter* params )
|
2000-05-28 19:15:37 +02:00
|
|
|
{
|
2003-12-10 21:04:50 +01:00
|
|
|
FT_Error error, psnames_error;
|
2002-03-31 20:48:24 +02:00
|
|
|
FT_Bool has_outline;
|
|
|
|
FT_Bool is_apple_sbit;
|
2000-11-07 00:07:51 +01:00
|
|
|
|
2002-02-28 17:10:29 +01:00
|
|
|
SFNT_Service sfnt = (SFNT_Service)face->sfnt;
|
2000-06-05 07:26:15 +02:00
|
|
|
|
2000-07-04 20:12:13 +02:00
|
|
|
FT_UNUSED( face_index );
|
|
|
|
FT_UNUSED( num_params );
|
|
|
|
FT_UNUSED( params );
|
2000-06-29 05:14:25 +02:00
|
|
|
|
2000-05-28 19:15:37 +02:00
|
|
|
|
|
|
|
/* Load tables */
|
|
|
|
|
2000-11-07 07:30:29 +01:00
|
|
|
/* We now support two SFNT-based bitmapped font formats. They */
|
|
|
|
/* are recognized easily as they do not include a `glyf' */
|
|
|
|
/* table. */
|
2000-11-07 00:07:51 +01:00
|
|
|
/* */
|
2000-11-07 07:30:29 +01:00
|
|
|
/* The first format comes from Apple, and uses a table named */
|
|
|
|
/* `bhed' instead of `head' to store the font header (using */
|
|
|
|
/* the same format). It also doesn't include horizontal and */
|
|
|
|
/* vertical metrics tables (i.e. `hhea' and `vhea' tables are */
|
|
|
|
/* missing). */
|
2000-11-07 00:07:51 +01:00
|
|
|
/* */
|
2000-11-07 07:30:29 +01:00
|
|
|
/* The other format comes from Microsoft, and is used with */
|
|
|
|
/* WinCE/PocketPC. It looks like a standard TTF, except that */
|
|
|
|
/* it doesn't contain outlines. */
|
2000-11-07 00:07:51 +01:00
|
|
|
/* */
|
|
|
|
|
2000-11-07 07:30:29 +01:00
|
|
|
/* do we have outlines in there? */
|
2002-07-18 18:38:07 +02:00
|
|
|
#ifdef FT_CONFIG_OPTION_INCREMENTAL
|
2002-08-01 17:29:17 +02:00
|
|
|
has_outline = FT_BOOL( face->root.internal->incremental_interface != 0 ||
|
* src/pcf/pcfdrivr.c: Revert change from 2004-04-17.
* src/pcf/pcfutil.c: Use FT_LOCAL_DEF.
* src/pcf/pcfutil.h: Include FT_CONFIG_CONFIG_H.
Use FT_BEGIN_HEADER and FT_END_HEADER.
Use FT_LOCAL.
2004-04-24 George Williams <gww@silcom.com>
Add support for Apple's distortable font technology (in GX fonts).
* devel/ftoption.h, include/freetype/config/ftoption.h
(TT_CONFIG_OPTION_GX_VAR_SUPPORT): New macro.
* include/freetype/ftmm.h (FT_Var_Axis, FT_Var_Named_Style,
FT_MM_Var): New structures.
(FT_Get_MM_Var, FT_Set_Var_Design_Coordinates,
FT_Set_Var_Blend_Coordinates): New function declarations.
* include/freetype/internal/services/svmm.h (FT_Get_MM_Var_Func,
FT_Set_Var_Design_Func): New typedefs.
Update MultiMasters service.
* include/freetype/internal/tttypes.h
[TT_CONFIG_OPTION_GX_VAR_SUPPORT]: Include FT_MULTIPLE_MASTERS_H.
(GX_Blend) [TT_CONFIG_OPTION_GX_VAR_SUPPORT]: New typedef.
(TT_Face) [TT_CONFIG_OPTION_GX_VAR_SUPPORT]: New members `doblend'
and `blend'.
* include/freetype/tttags.h (TTAG_avar, TTAG_cvar, TTAG_gvar): New
macros.
* include/freetype/internal/fttrace.h: Add `ttgxvar'.
* src/base/ftmm.c (FT_Get_MM_Var, FT_Set_Var_Design_Coordinates,
FT_Set_Var_Blend_Coordinates): New functions.
* src/sfnt/sfobjs.c (sfnt_load_face)
[TT_CONFIG_OPTION_GX_VAR_SUPPORT]: Set FT_FACE_FLAG_MULTIPLE_MASTERS
flag for GX var fonts.
* src/truetype/ttgxvar.c, src/truetype/ttgxvar.h: New files.
* src/truetype/truetype.c [TT_CONFIG_OPTION_GX_VAR_SUPPORT]: Include
ttgxvar.c.
* src/truetype/ttdriver.c [TT_CONFIG_OPTION_GX_VAR_SUPPORT]: Include
FT_MULTIPLE_MASTERS_H, FT_SERVICE_MULTIPLE_MASTERS_H, and ttgxvar.h.
(tt_service_gx_multi_masters) [TT_CONFIG_OPTION_GX_VAR_SUPPORT]:
New service.
(tt_services) [TT_CONFIG_OPTION_GX_VAR_SUPPORT]: Updated.
* src/truetype/ttgload.c [TT_CONFIG_OPTION_GX_VAR_SUPPORT]: Include
ttgxvar.h.
(TT_Process_Simple_Glyph, load_truetype_glyph)
[TT_CONFIG_OPTION_GX_VAR_SUPPORT] :Support GX var fonts.
* src/truetype/ttobjs.c [TT_CONFIG_OPTION_GX_VAR_SUPPORT]: Include
ttgxvar.h.
(tt_done_face) [TT_CONFIG_OPTION_GX_VAR_SUPPORT]: Call
tt_done_blend.
* src/truetype/ttpload.c [TT_CONFIG_OPTION_GX_VAR_SUPPORT]: Include
ttgxvar.h.
(tt_face_load_cvt) [TT_CONFIG_OPTION_GX_VAR_SUPPORT]: Call
tt_face_vary_cvt.
* src/truetype/rules.mk (TT_DRV_SRC): Add ttgxvar.c.
* src/type1/t1driver.c (t1_service_multi_masters): Add T1_Get_MM_Var
and T1_Set_Var_Design.
* src/type1/t1load.c (FT_INT_TO_FIXED, FT_FIXED_TO_INT): New macros.
(T1_Get_MM_Var, T1_Set_Var_Design): New functions.
* src/type1/t1load.h (T1_Get_MM_Var, T1_Set_Var_Design): New
function declarations.
2004-04-25 22:15:11 +02:00
|
|
|
tt_face_lookup_table( face, TTAG_glyf ) != 0 ||
|
|
|
|
tt_face_lookup_table( face, TTAG_CFF ) != 0 );
|
2002-07-18 18:38:07 +02:00
|
|
|
#else
|
* 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
|
|
|
has_outline = FT_BOOL( tt_face_lookup_table( face, TTAG_glyf ) != 0 ||
|
* src/pcf/pcfdrivr.c: Revert change from 2004-04-17.
* src/pcf/pcfutil.c: Use FT_LOCAL_DEF.
* src/pcf/pcfutil.h: Include FT_CONFIG_CONFIG_H.
Use FT_BEGIN_HEADER and FT_END_HEADER.
Use FT_LOCAL.
2004-04-24 George Williams <gww@silcom.com>
Add support for Apple's distortable font technology (in GX fonts).
* devel/ftoption.h, include/freetype/config/ftoption.h
(TT_CONFIG_OPTION_GX_VAR_SUPPORT): New macro.
* include/freetype/ftmm.h (FT_Var_Axis, FT_Var_Named_Style,
FT_MM_Var): New structures.
(FT_Get_MM_Var, FT_Set_Var_Design_Coordinates,
FT_Set_Var_Blend_Coordinates): New function declarations.
* include/freetype/internal/services/svmm.h (FT_Get_MM_Var_Func,
FT_Set_Var_Design_Func): New typedefs.
Update MultiMasters service.
* include/freetype/internal/tttypes.h
[TT_CONFIG_OPTION_GX_VAR_SUPPORT]: Include FT_MULTIPLE_MASTERS_H.
(GX_Blend) [TT_CONFIG_OPTION_GX_VAR_SUPPORT]: New typedef.
(TT_Face) [TT_CONFIG_OPTION_GX_VAR_SUPPORT]: New members `doblend'
and `blend'.
* include/freetype/tttags.h (TTAG_avar, TTAG_cvar, TTAG_gvar): New
macros.
* include/freetype/internal/fttrace.h: Add `ttgxvar'.
* src/base/ftmm.c (FT_Get_MM_Var, FT_Set_Var_Design_Coordinates,
FT_Set_Var_Blend_Coordinates): New functions.
* src/sfnt/sfobjs.c (sfnt_load_face)
[TT_CONFIG_OPTION_GX_VAR_SUPPORT]: Set FT_FACE_FLAG_MULTIPLE_MASTERS
flag for GX var fonts.
* src/truetype/ttgxvar.c, src/truetype/ttgxvar.h: New files.
* src/truetype/truetype.c [TT_CONFIG_OPTION_GX_VAR_SUPPORT]: Include
ttgxvar.c.
* src/truetype/ttdriver.c [TT_CONFIG_OPTION_GX_VAR_SUPPORT]: Include
FT_MULTIPLE_MASTERS_H, FT_SERVICE_MULTIPLE_MASTERS_H, and ttgxvar.h.
(tt_service_gx_multi_masters) [TT_CONFIG_OPTION_GX_VAR_SUPPORT]:
New service.
(tt_services) [TT_CONFIG_OPTION_GX_VAR_SUPPORT]: Updated.
* src/truetype/ttgload.c [TT_CONFIG_OPTION_GX_VAR_SUPPORT]: Include
ttgxvar.h.
(TT_Process_Simple_Glyph, load_truetype_glyph)
[TT_CONFIG_OPTION_GX_VAR_SUPPORT] :Support GX var fonts.
* src/truetype/ttobjs.c [TT_CONFIG_OPTION_GX_VAR_SUPPORT]: Include
ttgxvar.h.
(tt_done_face) [TT_CONFIG_OPTION_GX_VAR_SUPPORT]: Call
tt_done_blend.
* src/truetype/ttpload.c [TT_CONFIG_OPTION_GX_VAR_SUPPORT]: Include
ttgxvar.h.
(tt_face_load_cvt) [TT_CONFIG_OPTION_GX_VAR_SUPPORT]: Call
tt_face_vary_cvt.
* src/truetype/rules.mk (TT_DRV_SRC): Add ttgxvar.c.
* src/type1/t1driver.c (t1_service_multi_masters): Add T1_Get_MM_Var
and T1_Set_Var_Design.
* src/type1/t1load.c (FT_INT_TO_FIXED, FT_FIXED_TO_INT): New macros.
(T1_Get_MM_Var, T1_Set_Var_Design): New functions.
* src/type1/t1load.h (T1_Get_MM_Var, T1_Set_Var_Design): New
function declarations.
2004-04-25 22:15:11 +02:00
|
|
|
tt_face_lookup_table( face, TTAG_CFF ) != 0 );
|
2002-07-18 18:38:07 +02:00
|
|
|
#endif
|
|
|
|
|
2000-11-07 00:07:51 +01:00
|
|
|
is_apple_sbit = 0;
|
2001-06-28 19:49:10 +02:00
|
|
|
|
2000-08-06 21:48:47 +02:00
|
|
|
#ifdef TT_CONFIG_OPTION_EMBEDDED_BITMAPS
|
2000-11-07 00:07:51 +01:00
|
|
|
|
2000-11-07 07:30:29 +01:00
|
|
|
/* if this font doesn't contain outlines, we try to load */
|
|
|
|
/* a `bhed' table */
|
2000-11-07 00:07:51 +01:00
|
|
|
if ( !has_outline )
|
2001-06-20 01:03:41 +02:00
|
|
|
is_apple_sbit = FT_BOOL( !LOAD_( bitmap_header ) );
|
2000-11-07 00:07:51 +01:00
|
|
|
|
2000-11-07 07:30:29 +01:00
|
|
|
#endif /* TT_CONFIG_OPTION_EMBEDDED_BITMAPS */
|
2000-05-28 19:15:37 +02:00
|
|
|
|
2000-11-07 07:30:29 +01:00
|
|
|
/* load the font header (`head' table) if this isn't an Apple */
|
|
|
|
/* sbit font file */
|
|
|
|
if ( !is_apple_sbit && LOAD_( header ) )
|
2000-11-07 00:07:51 +01:00
|
|
|
goto Exit;
|
2000-08-06 21:48:47 +02:00
|
|
|
|
2002-02-08 07:23:50 +01:00
|
|
|
/* the following tables are often not present in embedded TrueType */
|
|
|
|
/* fonts within PDF documents, so don't check for them. */
|
2002-02-06 14:59:25 +01:00
|
|
|
(void)LOAD_( max_profile );
|
|
|
|
(void)LOAD_( charmaps );
|
2002-02-27 22:25:47 +01:00
|
|
|
|
2001-12-19 23:26:12 +01:00
|
|
|
/* the following tables are optional in PCL fonts -- */
|
|
|
|
/* don't check for errors */
|
|
|
|
(void)LOAD_( names );
|
2003-12-10 21:04:50 +01:00
|
|
|
psnames_error = LOAD_( psnames );
|
2000-08-06 21:48:47 +02:00
|
|
|
|
2000-11-07 00:07:51 +01:00
|
|
|
/* do not load the metrics headers and tables if this is an Apple */
|
2000-11-07 07:30:29 +01:00
|
|
|
/* sbit font file */
|
2000-11-07 00:07:51 +01:00
|
|
|
if ( !is_apple_sbit )
|
2000-08-06 21:48:47 +02:00
|
|
|
{
|
2000-11-07 07:30:29 +01:00
|
|
|
/* load the `hhea' and `hmtx' tables at once */
|
2000-11-07 00:07:51 +01:00
|
|
|
error = sfnt->load_metrics( face, stream, 0 );
|
2000-11-07 07:30:29 +01:00
|
|
|
if ( error )
|
2000-11-07 00:07:51 +01:00
|
|
|
goto Exit;
|
2001-06-28 19:49:10 +02:00
|
|
|
|
2000-11-07 07:30:29 +01:00
|
|
|
/* try to load the `vhea' and `vmtx' tables at once */
|
2000-11-07 00:07:51 +01:00
|
|
|
error = sfnt->load_metrics( face, stream, 1 );
|
2000-11-07 07:30:29 +01:00
|
|
|
if ( error )
|
2000-11-07 00:07:51 +01:00
|
|
|
goto Exit;
|
2001-06-28 19:49:10 +02:00
|
|
|
|
2000-11-07 07:30:29 +01:00
|
|
|
if ( LOAD_( os2 ) )
|
2000-11-07 00:07:51 +01:00
|
|
|
goto Exit;
|
2000-08-06 21:48:47 +02:00
|
|
|
}
|
2000-05-28 19:15:37 +02:00
|
|
|
|
|
|
|
/* the optional tables */
|
|
|
|
|
|
|
|
#ifdef TT_CONFIG_OPTION_EMBEDDED_BITMAPS
|
2000-08-06 21:48:47 +02:00
|
|
|
|
2000-06-05 07:26:15 +02:00
|
|
|
/* embedded bitmap support. */
|
|
|
|
if ( sfnt->load_sbits && LOAD_( sbits ) )
|
2000-08-06 21:48:47 +02:00
|
|
|
{
|
2000-11-07 00:07:51 +01:00
|
|
|
/* return an error if this font file has no outlines */
|
Complete redesign of error codes. Please check ftmoderr.h for more
details.
* include/freetype/internal/cfferrs.h,
include/freetype/internal/tterrors.h,
include/freetype/internal/t1errors.h: Removed. Replaced with files
local to the module. All extra error codes have been moved to
`fterrors.h'.
* src/sfnt/ttpost.h: Move error codes to `fterrors.h'.
* src/autohint/aherrors.h, src/cache/ftcerror.h, src/cff/cfferrs.h,
src/cid/ciderrs.h, src/pcf/pcferror.h, src/psaux/psauxerr.h,
src/psnames/psnamerr.h, src/raster/rasterrs.h, src/sfnt/sferrors.h,
src/smooth/ftsmerrs.h, src/truetype/tterrors.h,
src/type1/t1errors.h, src/winfonts/fnterrs.h: New files defining the
error names for the module it belongs to.
* include/freetype/ftmoderr.h: New file, defining the module error
offsets. Its structure is similar to `fterrors.h'.
* include/freetype/fterrors.h (FT_NOERRORDEF): New macro.
(FT_ERRORDEF): Redefined to use module error offsets.
All internal error codes are now public; unused error codes have
been removed, some are new.
* include/freetype/config/ftheader.h (FT_MODULE_ERRORS_H): New
macro.
* include/freetype/config/ftoption.h
(FT_CONFIG_OPTION_USE_MODULE_ERRORS): New macro.
All other source files have been updated to use the new error codes;
some already existing (internal) error codes local to a module have
been renamed to give them the same name as in the base module.
All make files have been updated to include the local error files.
* src/cid/cidtokens.h: Replaced with...
* src/cid/cidtoken.h: This file for 8+3 consistency.
* src/raster/ftraster.c: Use macros for header file names.
2001-06-06 19:30:41 +02:00
|
|
|
if ( error == SFNT_Err_Table_Missing && has_outline )
|
|
|
|
error = SFNT_Err_Ok;
|
2000-11-07 00:07:51 +01:00
|
|
|
else
|
2000-08-06 21:48:47 +02:00
|
|
|
goto Exit;
|
|
|
|
}
|
2002-03-31 20:48:24 +02:00
|
|
|
|
2000-06-05 07:26:15 +02:00
|
|
|
#endif /* TT_CONFIG_OPTION_EMBEDDED_BITMAPS */
|
2000-05-28 19:15:37 +02:00
|
|
|
|
2000-08-06 21:48:47 +02:00
|
|
|
if ( LOAD_( hdmx ) ||
|
|
|
|
LOAD_( pclt ) )
|
2000-05-28 19:15:37 +02:00
|
|
|
goto Exit;
|
|
|
|
|
2005-02-26 01:12:04 +01:00
|
|
|
/* consider the kerning and gasp tables as optional */
|
|
|
|
(void)LOAD_( gasp );
|
|
|
|
(void)LOAD_( kerning );
|
|
|
|
|
2005-03-01 03:13:50 +01:00
|
|
|
error = SFNT_Err_Ok;
|
2005-02-28 23:09:07 +01:00
|
|
|
|
2002-03-31 20:48:24 +02:00
|
|
|
face->root.family_name = tt_face_get_name( face,
|
2004-07-25 10:43:35 +02:00
|
|
|
TT_NAME_ID_PREFERRED_FAMILY );
|
|
|
|
if ( !face->root.family_name )
|
|
|
|
face->root.family_name = tt_face_get_name( face,
|
|
|
|
TT_NAME_ID_FONT_FAMILY );
|
|
|
|
|
|
|
|
face->root.style_name = tt_face_get_name( face,
|
|
|
|
TT_NAME_ID_PREFERRED_SUBFAMILY );
|
|
|
|
if ( !face->root.style_name )
|
|
|
|
face->root.style_name = tt_face_get_name( face,
|
|
|
|
TT_NAME_ID_FONT_SUBFAMILY );
|
2000-05-28 19:15:37 +02:00
|
|
|
|
|
|
|
/* now set up root fields */
|
|
|
|
{
|
2002-03-31 20:48:24 +02:00
|
|
|
FT_Face root = &face->root;
|
2005-02-28 23:09:07 +01:00
|
|
|
FT_Int32 flags = root->face_flags;
|
2000-05-28 19:15:37 +02:00
|
|
|
|
2000-06-05 07:26:15 +02:00
|
|
|
|
|
|
|
/*********************************************************************/
|
|
|
|
/* */
|
|
|
|
/* Compute face flags. */
|
|
|
|
/* */
|
2000-11-07 00:07:51 +01:00
|
|
|
if ( has_outline == TRUE )
|
2005-02-28 23:09:07 +01:00
|
|
|
flags |= FT_FACE_FLAG_SCALABLE; /* scalable outlines */
|
2000-08-06 21:48:47 +02:00
|
|
|
|
|
|
|
flags |= FT_FACE_FLAG_SFNT | /* SFNT file format */
|
|
|
|
FT_FACE_FLAG_HORIZONTAL; /* horizontal data */
|
2000-05-28 19:15:37 +02:00
|
|
|
|
2000-07-19 19:13:03 +02:00
|
|
|
#ifdef TT_CONFIG_OPTION_POSTSCRIPT_NAMES
|
2003-12-17 22:57:56 +01:00
|
|
|
if ( psnames_error == SFNT_Err_Ok &&
|
|
|
|
face->postscript.FormatType != 0x00030000L )
|
2003-12-10 21:04:50 +01:00
|
|
|
flags |= FT_FACE_FLAG_GLYPH_NAMES;
|
2000-07-19 19:13:03 +02:00
|
|
|
#endif
|
|
|
|
|
2000-06-05 07:26:15 +02:00
|
|
|
/* fixed width font? */
|
2000-05-28 19:15:37 +02:00
|
|
|
if ( face->postscript.isFixedPitch )
|
|
|
|
flags |= FT_FACE_FLAG_FIXED_WIDTH;
|
|
|
|
|
2000-06-05 07:26:15 +02:00
|
|
|
/* vertical information? */
|
2000-05-28 19:15:37 +02:00
|
|
|
if ( face->vertical_info )
|
|
|
|
flags |= FT_FACE_FLAG_VERTICAL;
|
|
|
|
|
|
|
|
/* kerning available ? */
|
2005-03-01 03:13:50 +01:00
|
|
|
if ( TT_FACE_HAS_KERNING( face ) )
|
2000-05-28 19:15:37 +02:00
|
|
|
flags |= FT_FACE_FLAG_KERNING;
|
|
|
|
|
* src/pcf/pcfdrivr.c: Revert change from 2004-04-17.
* src/pcf/pcfutil.c: Use FT_LOCAL_DEF.
* src/pcf/pcfutil.h: Include FT_CONFIG_CONFIG_H.
Use FT_BEGIN_HEADER and FT_END_HEADER.
Use FT_LOCAL.
2004-04-24 George Williams <gww@silcom.com>
Add support for Apple's distortable font technology (in GX fonts).
* devel/ftoption.h, include/freetype/config/ftoption.h
(TT_CONFIG_OPTION_GX_VAR_SUPPORT): New macro.
* include/freetype/ftmm.h (FT_Var_Axis, FT_Var_Named_Style,
FT_MM_Var): New structures.
(FT_Get_MM_Var, FT_Set_Var_Design_Coordinates,
FT_Set_Var_Blend_Coordinates): New function declarations.
* include/freetype/internal/services/svmm.h (FT_Get_MM_Var_Func,
FT_Set_Var_Design_Func): New typedefs.
Update MultiMasters service.
* include/freetype/internal/tttypes.h
[TT_CONFIG_OPTION_GX_VAR_SUPPORT]: Include FT_MULTIPLE_MASTERS_H.
(GX_Blend) [TT_CONFIG_OPTION_GX_VAR_SUPPORT]: New typedef.
(TT_Face) [TT_CONFIG_OPTION_GX_VAR_SUPPORT]: New members `doblend'
and `blend'.
* include/freetype/tttags.h (TTAG_avar, TTAG_cvar, TTAG_gvar): New
macros.
* include/freetype/internal/fttrace.h: Add `ttgxvar'.
* src/base/ftmm.c (FT_Get_MM_Var, FT_Set_Var_Design_Coordinates,
FT_Set_Var_Blend_Coordinates): New functions.
* src/sfnt/sfobjs.c (sfnt_load_face)
[TT_CONFIG_OPTION_GX_VAR_SUPPORT]: Set FT_FACE_FLAG_MULTIPLE_MASTERS
flag for GX var fonts.
* src/truetype/ttgxvar.c, src/truetype/ttgxvar.h: New files.
* src/truetype/truetype.c [TT_CONFIG_OPTION_GX_VAR_SUPPORT]: Include
ttgxvar.c.
* src/truetype/ttdriver.c [TT_CONFIG_OPTION_GX_VAR_SUPPORT]: Include
FT_MULTIPLE_MASTERS_H, FT_SERVICE_MULTIPLE_MASTERS_H, and ttgxvar.h.
(tt_service_gx_multi_masters) [TT_CONFIG_OPTION_GX_VAR_SUPPORT]:
New service.
(tt_services) [TT_CONFIG_OPTION_GX_VAR_SUPPORT]: Updated.
* src/truetype/ttgload.c [TT_CONFIG_OPTION_GX_VAR_SUPPORT]: Include
ttgxvar.h.
(TT_Process_Simple_Glyph, load_truetype_glyph)
[TT_CONFIG_OPTION_GX_VAR_SUPPORT] :Support GX var fonts.
* src/truetype/ttobjs.c [TT_CONFIG_OPTION_GX_VAR_SUPPORT]: Include
ttgxvar.h.
(tt_done_face) [TT_CONFIG_OPTION_GX_VAR_SUPPORT]: Call
tt_done_blend.
* src/truetype/ttpload.c [TT_CONFIG_OPTION_GX_VAR_SUPPORT]: Include
ttgxvar.h.
(tt_face_load_cvt) [TT_CONFIG_OPTION_GX_VAR_SUPPORT]: Call
tt_face_vary_cvt.
* src/truetype/rules.mk (TT_DRV_SRC): Add ttgxvar.c.
* src/type1/t1driver.c (t1_service_multi_masters): Add T1_Get_MM_Var
and T1_Set_Var_Design.
* src/type1/t1load.c (FT_INT_TO_FIXED, FT_FIXED_TO_INT): New macros.
(T1_Get_MM_Var, T1_Set_Var_Design): New functions.
* src/type1/t1load.h (T1_Get_MM_Var, T1_Set_Var_Design): New
function declarations.
2004-04-25 22:15:11 +02:00
|
|
|
#ifdef TT_CONFIG_OPTION_GX_VAR_SUPPORT
|
|
|
|
/* Don't bother to load the tables unless somebody asks for them. */
|
|
|
|
/* No need to do work which will (probably) not be used. */
|
|
|
|
if ( tt_face_lookup_table( face, TTAG_glyf ) != 0 &&
|
|
|
|
tt_face_lookup_table( face, TTAG_fvar ) != 0 &&
|
|
|
|
tt_face_lookup_table( face, TTAG_gvar ) != 0 )
|
|
|
|
flags |= FT_FACE_FLAG_MULTIPLE_MASTERS;
|
|
|
|
#endif
|
|
|
|
|
2000-05-28 19:15:37 +02:00
|
|
|
root->face_flags = flags;
|
|
|
|
|
2000-06-05 07:26:15 +02:00
|
|
|
/*********************************************************************/
|
|
|
|
/* */
|
|
|
|
/* Compute style flags. */
|
|
|
|
/* */
|
2000-05-28 19:15:37 +02:00
|
|
|
flags = 0;
|
2003-06-23 21:26:53 +02:00
|
|
|
if ( has_outline == TRUE && face->os2.version != 0xFFFFU )
|
2000-05-28 19:15:37 +02:00
|
|
|
{
|
2000-11-07 00:07:51 +01:00
|
|
|
/* we have an OS/2 table; use the `fsSelection' field */
|
|
|
|
if ( face->os2.fsSelection & 1 )
|
|
|
|
flags |= FT_STYLE_FLAG_ITALIC;
|
2000-05-28 19:15:37 +02:00
|
|
|
|
2000-11-07 00:07:51 +01:00
|
|
|
if ( face->os2.fsSelection & 32 )
|
|
|
|
flags |= FT_STYLE_FLAG_BOLD;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
/* this is an old Mac font, use the header field */
|
|
|
|
if ( face->header.Mac_Style & 1 )
|
|
|
|
flags |= FT_STYLE_FLAG_BOLD;
|
2000-05-28 19:15:37 +02:00
|
|
|
|
2000-11-07 00:07:51 +01:00
|
|
|
if ( face->header.Mac_Style & 2 )
|
|
|
|
flags |= FT_STYLE_FLAG_ITALIC;
|
2000-05-28 19:15:37 +02:00
|
|
|
}
|
|
|
|
|
2000-07-05 06:32:02 +02:00
|
|
|
root->style_flags = flags;
|
2000-05-28 19:15:37 +02:00
|
|
|
|
2000-06-05 07:26:15 +02:00
|
|
|
/*********************************************************************/
|
|
|
|
/* */
|
|
|
|
/* Polish the charmaps. */
|
|
|
|
/* */
|
|
|
|
/* Try to set the charmap encoding according to the platform & */
|
|
|
|
/* encoding ID of each charmap. */
|
|
|
|
/* */
|
2002-03-22 16:02:38 +01:00
|
|
|
|
* 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
|
|
|
tt_face_build_cmaps( face ); /* ignore errors */
|
2002-03-31 20:48:24 +02:00
|
|
|
|
|
|
|
|
2002-03-22 16:02:38 +01:00
|
|
|
/* set the encoding fields */
|
|
|
|
{
|
2002-03-26 03:38:39 +01:00
|
|
|
FT_Int m;
|
2002-03-31 20:48:24 +02:00
|
|
|
|
|
|
|
|
2002-03-26 03:38:39 +01:00
|
|
|
for ( m = 0; m < root->num_charmaps; m++ )
|
2002-03-22 16:02:38 +01:00
|
|
|
{
|
2002-03-26 03:38:39 +01:00
|
|
|
FT_CharMap charmap = root->charmaps[m];
|
2002-03-31 20:48:24 +02:00
|
|
|
|
|
|
|
|
2002-03-22 16:02:38 +01:00
|
|
|
charmap->encoding = sfnt_find_encoding( charmap->platform_id,
|
|
|
|
charmap->encoding_id );
|
2002-03-31 20:48:24 +02:00
|
|
|
|
2002-07-18 00:51:06 +02:00
|
|
|
#if 0
|
2002-03-22 16:02:38 +01:00
|
|
|
if ( root->charmap == NULL &&
|
* 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
|
|
|
charmap->encoding == FT_ENCODING_UNICODE )
|
2002-03-22 16:02:38 +01:00
|
|
|
{
|
|
|
|
/* set 'root->charmap' to the first Unicode encoding we find */
|
|
|
|
root->charmap = charmap;
|
|
|
|
}
|
2002-07-18 00:51:06 +02:00
|
|
|
#endif
|
2002-03-22 16:02:38 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2000-06-05 07:26:15 +02:00
|
|
|
/*********************************************************************/
|
|
|
|
/* */
|
|
|
|
/* Set up metrics. */
|
|
|
|
/* */
|
2000-11-07 00:07:51 +01:00
|
|
|
if ( has_outline == TRUE )
|
2000-05-28 19:15:37 +02:00
|
|
|
{
|
2000-08-06 21:48:47 +02:00
|
|
|
/* XXX What about if outline header is missing */
|
2003-07-01 09:28:55 +02:00
|
|
|
/* (e.g. sfnt wrapped bitmap)? */
|
2000-08-06 21:48:47 +02:00
|
|
|
root->bbox.xMin = face->header.xMin;
|
|
|
|
root->bbox.yMin = face->header.yMin;
|
|
|
|
root->bbox.xMax = face->header.xMax;
|
|
|
|
root->bbox.yMax = face->header.yMax;
|
|
|
|
root->units_per_EM = face->header.Units_Per_EM;
|
|
|
|
|
2000-08-29 18:03:01 +02:00
|
|
|
|
2000-08-29 20:37:25 +02:00
|
|
|
/* XXX: Computing the ascender/descender/height is very different */
|
|
|
|
/* from what the specification tells you. Apparently, we */
|
|
|
|
/* must be careful because */
|
|
|
|
/* */
|
|
|
|
/* - not all fonts have an OS/2 table; in this case, we take */
|
|
|
|
/* the values in the horizontal header. However, these */
|
|
|
|
/* values very often are not reliable. */
|
|
|
|
/* */
|
|
|
|
/* - otherwise, the correct typographic values are in the */
|
|
|
|
/* sTypoAscender, sTypoDescender & sTypoLineGap fields. */
|
|
|
|
/* */
|
|
|
|
/* However, certains fonts have these fields set to 0. */
|
|
|
|
/* Rather, they have usWinAscent & usWinDescent correctly */
|
|
|
|
/* set (but with different values). */
|
|
|
|
/* */
|
|
|
|
/* As an example, Arial Narrow is implemented through four */
|
|
|
|
/* files ARIALN.TTF, ARIALNI.TTF, ARIALNB.TTF & ARIALNBI.TTF */
|
|
|
|
/* */
|
|
|
|
/* Strangely, all fonts have the same values in their */
|
|
|
|
/* sTypoXXX fields, except ARIALNB which sets them to 0. */
|
|
|
|
/* */
|
|
|
|
/* On the other hand, they all have different */
|
|
|
|
/* usWinAscent/Descent values -- as a conclusion, the OS/2 */
|
|
|
|
/* table cannot be used to compute the text height reliably! */
|
|
|
|
/* */
|
2000-08-29 18:03:01 +02:00
|
|
|
|
2000-08-06 21:48:47 +02:00
|
|
|
/* The ascender/descender/height are computed from the OS/2 table */
|
|
|
|
/* when found. Otherwise, they're taken from the horizontal */
|
|
|
|
/* header. */
|
|
|
|
/* */
|
2000-08-29 18:03:01 +02:00
|
|
|
|
|
|
|
root->ascender = face->horizontal.Ascender;
|
|
|
|
root->descender = face->horizontal.Descender;
|
2000-10-31 21:42:18 +01:00
|
|
|
|
2001-06-19 10:28:24 +02:00
|
|
|
root->height = (FT_Short)( root->ascender - root->descender +
|
|
|
|
face->horizontal.Line_Gap );
|
2000-10-31 21:42:18 +01:00
|
|
|
|
2003-06-03 13:51:43 +02:00
|
|
|
#if 0
|
2000-08-29 20:37:25 +02:00
|
|
|
/* if the line_gap is 0, we add an extra 15% to the text height -- */
|
2000-08-29 18:03:01 +02:00
|
|
|
/* this computation is based on various versions of Times New Roman */
|
2000-08-29 20:37:25 +02:00
|
|
|
if ( face->horizontal.Line_Gap == 0 )
|
2001-06-20 01:03:41 +02:00
|
|
|
root->height = (FT_Short)( ( root->height * 115 + 50 ) / 100 );
|
2003-06-03 13:51:43 +02:00
|
|
|
#endif
|
2000-10-31 21:42:18 +01:00
|
|
|
|
2000-08-29 18:03:01 +02:00
|
|
|
#if 0
|
2000-08-29 20:37:25 +02:00
|
|
|
|
2000-08-29 18:03:01 +02:00
|
|
|
/* some fonts have the OS/2 "sTypoAscender", "sTypoDescender" & */
|
|
|
|
/* "sTypoLineGap" fields set to 0, like ARIALNB.TTF */
|
2003-06-23 21:26:53 +02:00
|
|
|
if ( face->os2.version != 0xFFFFU && root->ascender )
|
2000-08-06 21:48:47 +02:00
|
|
|
{
|
2000-08-29 18:03:01 +02:00
|
|
|
FT_Int height;
|
2000-10-31 21:42:18 +01:00
|
|
|
|
2000-08-29 20:37:25 +02:00
|
|
|
|
2000-08-06 21:48:47 +02:00
|
|
|
root->ascender = face->os2.sTypoAscender;
|
|
|
|
root->descender = -face->os2.sTypoDescender;
|
2000-10-31 21:42:18 +01:00
|
|
|
|
2000-08-29 18:03:01 +02:00
|
|
|
height = root->ascender + root->descender + face->os2.sTypoLineGap;
|
2000-08-29 20:37:25 +02:00
|
|
|
if ( height > root->height )
|
2000-08-29 18:03:01 +02:00
|
|
|
root->height = height;
|
2000-08-06 21:48:47 +02:00
|
|
|
}
|
2000-08-29 20:37:25 +02:00
|
|
|
|
|
|
|
#endif /* 0 */
|
|
|
|
|
2000-08-06 21:48:47 +02:00
|
|
|
root->max_advance_width = face->horizontal.advance_Width_Max;
|
2000-05-28 19:15:37 +02:00
|
|
|
|
2001-06-19 10:28:24 +02:00
|
|
|
root->max_advance_height = (FT_Short)( face->vertical_info
|
2000-08-06 21:48:47 +02:00
|
|
|
? face->vertical.advance_Height_Max
|
2001-06-19 10:28:24 +02:00
|
|
|
: root->height );
|
2000-05-28 19:15:37 +02:00
|
|
|
|
2000-08-06 21:48:47 +02:00
|
|
|
root->underline_position = face->postscript.underlinePosition;
|
|
|
|
root->underline_thickness = face->postscript.underlineThickness;
|
2000-05-28 19:15:37 +02:00
|
|
|
|
2000-08-29 20:37:25 +02:00
|
|
|
/* root->max_points -- already set up */
|
|
|
|
/* root->max_contours -- already set up */
|
2000-08-06 21:48:47 +02:00
|
|
|
}
|
2000-05-28 19:15:37 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
Exit:
|
|
|
|
return error;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
#undef LOAD_
|
|
|
|
|
|
|
|
|
2002-03-01 03:26:22 +01:00
|
|
|
FT_LOCAL_DEF( void )
|
* 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
|
|
|
sfnt_done_face( TT_Face face )
|
2000-05-28 19:15:37 +02:00
|
|
|
{
|
2002-03-31 20:48:24 +02:00
|
|
|
FT_Memory memory = face->root.memory;
|
2002-02-28 17:10:29 +01:00
|
|
|
SFNT_Service sfnt = (SFNT_Service)face->sfnt;
|
2000-05-28 19:15:37 +02:00
|
|
|
|
2000-06-05 07:26:15 +02:00
|
|
|
|
|
|
|
if ( sfnt )
|
2000-05-28 19:15:37 +02:00
|
|
|
{
|
2000-06-05 07:26:15 +02:00
|
|
|
/* destroy the postscript names table if it is loaded */
|
|
|
|
if ( sfnt->free_psnames )
|
2000-05-28 19:15:37 +02:00
|
|
|
sfnt->free_psnames( face );
|
|
|
|
|
2000-06-05 07:26:15 +02:00
|
|
|
/* destroy the embedded bitmaps table if it is loaded */
|
|
|
|
if ( sfnt->free_sbits )
|
2000-05-28 19:15:37 +02:00
|
|
|
sfnt->free_sbits( face );
|
|
|
|
}
|
|
|
|
|
|
|
|
/* freeing the kerning table */
|
2005-02-26 01:12:04 +01:00
|
|
|
tt_face_done_kern( face );
|
2000-05-28 19:15:37 +02:00
|
|
|
|
|
|
|
/* freeing the collection table */
|
2002-03-22 14:52:37 +01:00
|
|
|
FT_FREE( face->ttc_header.offsets );
|
2000-07-19 08:25:56 +02:00
|
|
|
face->ttc_header.count = 0;
|
2000-05-28 19:15:37 +02:00
|
|
|
|
|
|
|
/* freeing table directory */
|
2002-03-22 14:52:37 +01:00
|
|
|
FT_FREE( face->dir_tables );
|
2000-05-28 19:15:37 +02:00
|
|
|
face->num_tables = 0;
|
|
|
|
|
2002-03-22 16:02:38 +01:00
|
|
|
{
|
2002-03-31 20:48:24 +02:00
|
|
|
FT_Stream stream = FT_FACE_STREAM( face );
|
|
|
|
|
|
|
|
|
2002-03-22 16:02:38 +01:00
|
|
|
/* simply release the 'cmap' table frame */
|
|
|
|
FT_FRAME_RELEASE( face->cmap_table );
|
|
|
|
face->cmap_size = 0;
|
|
|
|
}
|
|
|
|
|
2000-05-28 19:15:37 +02:00
|
|
|
/* freeing the horizontal metrics */
|
2005-02-26 01:12:04 +01:00
|
|
|
#ifdef FT_OPTIMIZE_MEMORY
|
|
|
|
{
|
|
|
|
FT_Stream stream = FT_FACE_STREAM( face );
|
2005-02-28 23:09:07 +01:00
|
|
|
|
2005-03-01 03:13:50 +01:00
|
|
|
|
2005-02-26 01:12:04 +01:00
|
|
|
FT_FRAME_RELEASE( face->horz_metrics );
|
|
|
|
FT_FRAME_RELEASE( face->vert_metrics );
|
|
|
|
face->horz_metrics_size = 0;
|
|
|
|
face->vert_metrics_size = 0;
|
|
|
|
}
|
|
|
|
#else
|
2002-03-22 14:52:37 +01:00
|
|
|
FT_FREE( face->horizontal.long_metrics );
|
|
|
|
FT_FREE( face->horizontal.short_metrics );
|
2005-02-26 01:12:04 +01:00
|
|
|
#endif
|
2000-05-28 19:15:37 +02:00
|
|
|
|
|
|
|
/* freeing the vertical ones, if any */
|
|
|
|
if ( face->vertical_info )
|
|
|
|
{
|
2002-03-22 14:52:37 +01:00
|
|
|
FT_FREE( face->vertical.long_metrics );
|
|
|
|
FT_FREE( face->vertical.short_metrics );
|
2000-05-28 19:15:37 +02:00
|
|
|
face->vertical_info = 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* freeing the gasp table */
|
2002-03-22 14:52:37 +01:00
|
|
|
FT_FREE( face->gasp.gaspRanges );
|
2000-05-28 19:15:37 +02:00
|
|
|
face->gasp.numRanges = 0;
|
|
|
|
|
|
|
|
/* freeing the name table */
|
|
|
|
sfnt->free_names( face );
|
|
|
|
|
|
|
|
/* freeing the hdmx table */
|
|
|
|
sfnt->free_hdmx( face );
|
|
|
|
|
|
|
|
/* freeing family and style name */
|
2002-03-22 14:52:37 +01:00
|
|
|
FT_FREE( face->root.family_name );
|
|
|
|
FT_FREE( face->root.style_name );
|
2000-05-28 19:15:37 +02:00
|
|
|
|
|
|
|
/* freeing sbit size table */
|
2004-05-18 22:16:04 +02:00
|
|
|
FT_FREE( face->root.available_sizes );
|
2000-05-28 19:15:37 +02:00
|
|
|
face->root.num_fixed_sizes = 0;
|
2004-05-18 22:16:04 +02:00
|
|
|
|
|
|
|
FT_FREE( face->postscript_name );
|
2000-05-28 19:15:37 +02:00
|
|
|
|
|
|
|
face->sfnt = 0;
|
|
|
|
}
|
|
|
|
|
2000-06-05 07:26:15 +02:00
|
|
|
|
|
|
|
/* END */
|