forked from minhngoc25a/freetype2
* src/sfnt/ttcmap.c: 16bit fixes (0xFFFF -> 0xFFFFU).
* src/sfnt/ttcmap0.c: 16bit fixes. (TT_Build_CMaps): Simplify debug messages. (tt_cmap12_char_next): Fix offset. * src/sfnt/ttload.c (TT_Load_Names, TT_Load_CMap): Fix debug messages. (TT_Load_OS2): 16bit fix.
This commit is contained in:
parent
259d88edbc
commit
4cf900afa3
15
ChangeLog
15
ChangeLog
|
@ -6,12 +6,23 @@
|
|||
|
||||
* src/otlayout/otlcommn.c, src/otlayout/otlcommn.h: s/index/idx/.
|
||||
* src/psaux/t1cmap.c: Ditto.
|
||||
* src/sfnt/ttcmap0.c: Ditto.
|
||||
|
||||
* include/freetype/internal/tttypes.h,
|
||||
include/freetype/internal/sfnt.h (TT_Goto_Table_Func): Renamed to ...
|
||||
(TT_Loader_GotoTableFunc): This.
|
||||
* src/psaux/t1decode.c (T1_Decoder_Parse_Charstrings): Fix debug
|
||||
messages.
|
||||
* src/psnames/psmodule.c (psnames_interface)
|
||||
[!FT_CONFIG_OPTION_ADOBE_GLYPH_LIST]: Fix typo.
|
||||
* src/sfnt/sfdriver.c (get_sfnt_table): 16bit fix.
|
||||
* src/sfnt/ttcmap.c: 16bit fixes (0xFFFF -> 0xFFFFU).
|
||||
* src/sfnt/ttcmap0.c: 16bit fixes.
|
||||
(TT_Build_CMaps): Simplify debug messages.
|
||||
(tt_cmap12_char_next): Fix offset.
|
||||
* src/sfnt/ttload.c (TT_Load_Names, TT_Load_CMap): Fix debug
|
||||
messages.
|
||||
(TT_Load_OS2): 16bit fix.
|
||||
|
||||
2002-03-30 David Turner <david@freetype.org>
|
||||
|
||||
|
@ -439,8 +450,8 @@
|
|||
* src/type1/t1cmap.h, src/type1/t1cmap.c: Adding (still
|
||||
experimental) code for Type 1 charmap processing.
|
||||
|
||||
* src/sfnt/ttcmap0.c: Completing the experimental SFNT charmap
|
||||
processing.
|
||||
* src/sfnt/ttcmap0.c: New file. It contains a new, still
|
||||
experimental SFNT charmap processing support.
|
||||
|
||||
* include/freetype/internal/ftobjs.h: Adding validation support as
|
||||
well as internal charmap object definitions (FT_CMap != FT_CharMap).
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
#
|
||||
|
||||
|
||||
# Copyright 2001 by
|
||||
# Copyright 2001, 2002 by
|
||||
# David Turner, Robert Wilhelm, and Werner Lemberg.
|
||||
#
|
||||
# This file is part of the FreeType project, and may only be used, modified,
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
/* */
|
||||
/* PostScript hinting algorithm 1 (body). */
|
||||
/* */
|
||||
/* Copyright 2001 by */
|
||||
/* Copyright 2001, 2002 by */
|
||||
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
|
||||
/* */
|
||||
/* This file is part of the FreeType project, and may only be used */
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
/* */
|
||||
/* PostScript hinting algorithm 2 (body). */
|
||||
/* */
|
||||
/* Copyright 2001 by */
|
||||
/* Copyright 2001, 2002 by */
|
||||
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
|
||||
/* */
|
||||
/* This file is part of the FreeType project, and may only be used */
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
/* PostScript hinter global hinting management (body). */
|
||||
/* Inspired by the new auto-hinter module. */
|
||||
/* */
|
||||
/* Copyright 2001 by */
|
||||
/* Copyright 2001, 2002 by */
|
||||
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
|
||||
/* */
|
||||
/* This file is part of the FreeType project, and may only be used */
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
/* */
|
||||
/* PostScript hinter global hinting management. */
|
||||
/* */
|
||||
/* Copyright 2001 by */
|
||||
/* Copyright 2001, 2002 by */
|
||||
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
|
||||
/* */
|
||||
/* This file is part of the FreeType project, and may only be used, */
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
/* */
|
||||
/* FreeType PostScript hinter module implementation (body). */
|
||||
/* */
|
||||
/* Copyright 2001 by */
|
||||
/* Copyright 2001, 2002 by */
|
||||
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
|
||||
/* */
|
||||
/* This file is part of the FreeType project, and may only be used, */
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
/* */
|
||||
/* FreeType PostScript hints recorder (body). */
|
||||
/* */
|
||||
/* Copyright 2001 by */
|
||||
/* Copyright 2001, 2002 by */
|
||||
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
|
||||
/* */
|
||||
/* This file is part of the FreeType project, and may only be used, */
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
/* */
|
||||
/* Postscript (Type1/Type2) hints recorder (specification). */
|
||||
/* */
|
||||
/* Copyright 2001 by */
|
||||
/* Copyright 2001, 2002 by */
|
||||
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
|
||||
/* */
|
||||
/* This file is part of the FreeType project, and may only be used, */
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
#
|
||||
|
||||
|
||||
# Copyright 2001 by
|
||||
# Copyright 2001, 2002 by
|
||||
# David Turner, Robert Wilhelm, and Werner Lemberg.
|
||||
#
|
||||
# This file is part of the FreeType project, and may only be used, modified,
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
/* */
|
||||
/* PSNames module implementation (body). */
|
||||
/* */
|
||||
/* Copyright 1996-2001 by */
|
||||
/* Copyright 1996-2001, 2002 by */
|
||||
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
|
||||
/* */
|
||||
/* This file is part of the FreeType project, and may only be used, */
|
||||
|
@ -186,8 +186,8 @@
|
|||
count = (FT_UInt)( map - table->maps );
|
||||
|
||||
if ( count > 0 && FT_REALLOC( table->maps,
|
||||
num_glyphs * sizeof ( PS_UniMap ),
|
||||
count * sizeof ( PS_UniMap ) ) )
|
||||
num_glyphs * sizeof ( PS_UniMap ),
|
||||
count * sizeof ( PS_UniMap ) ) )
|
||||
count = 0;
|
||||
|
||||
if ( count == 0 )
|
||||
|
@ -314,7 +314,6 @@
|
|||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
|
||||
#endif /* FT_CONFIG_OPTION_ADOBE_GLYPH_LIST */
|
||||
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
#
|
||||
|
||||
|
||||
# Copyright 1996-2000 by
|
||||
# Copyright 1996-2000, 2001 by
|
||||
# David Turner, Robert Wilhelm, and Werner Lemberg.
|
||||
#
|
||||
# This file is part of the FreeType project, and may only be used, modified,
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
/* */
|
||||
/* The FreeType glyph rasterizer (body). */
|
||||
/* */
|
||||
/* Copyright 1996-2001 by */
|
||||
/* Copyright 1996-2001, 2002 by */
|
||||
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
|
||||
/* */
|
||||
/* This file is part of the FreeType project, and may only be used, */
|
||||
|
@ -3211,9 +3211,9 @@
|
|||
|
||||
|
||||
static void
|
||||
ft_black_set_mode( TRaster_Instance* raster,
|
||||
unsigned long mode,
|
||||
const char* palette )
|
||||
ft_black_set_mode( TRaster_Instance* raster,
|
||||
unsigned long mode,
|
||||
const char* palette )
|
||||
{
|
||||
#ifdef FT_RASTER_OPTION_ANTI_ALIASING
|
||||
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
/* */
|
||||
/* The FreeType glyph rasterizer interface (body). */
|
||||
/* */
|
||||
/* Copyright 1996-2001 by */
|
||||
/* Copyright 1996-2001, 2002 by */
|
||||
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
|
||||
/* */
|
||||
/* This file is part of the FreeType project, and may only be used, */
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
#
|
||||
|
||||
|
||||
# Copyright 1996-2000 by
|
||||
# Copyright 1996-2000, 2001 by
|
||||
# David Turner, Robert Wilhelm, and Werner Lemberg.
|
||||
#
|
||||
# This file is part of the FreeType project, and may only be used, modified,
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
# FreeType 2 src/sfnt Jamfile (c) 2001 David Turner
|
||||
# FreeType 2 src/sfnt Jamfile (c) 2001, 2002 David Turner
|
||||
#
|
||||
|
||||
SubDir FT2_TOP src sfnt ;
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
#
|
||||
|
||||
|
||||
# Copyright 2001 by
|
||||
# Copyright 2001, 2002 by
|
||||
# David Turner, Robert Wilhelm, and Werner Lemberg.
|
||||
#
|
||||
# This file is part of the FreeType project, and may only be used, modified,
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
#
|
||||
|
||||
|
||||
# Copyright 1996-2000 by
|
||||
# Copyright 1996-2000, 2002 by
|
||||
# David Turner, Robert Wilhelm, and Werner Lemberg.
|
||||
#
|
||||
# This file is part of the FreeType project, and may only be used, modified,
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
/* */
|
||||
/* High-level SFNT driver interface (body). */
|
||||
/* */
|
||||
/* Copyright 1996-2001 by */
|
||||
/* Copyright 1996-2001, 2002 by */
|
||||
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
|
||||
/* */
|
||||
/* This file is part of the FreeType project, and may only be used, */
|
||||
|
@ -58,7 +58,7 @@
|
|||
break;
|
||||
|
||||
case ft_sfnt_os2:
|
||||
table = face->os2.version == 0xFFFF ? 0 : &face->os2;
|
||||
table = face->os2.version == 0xFFFFU ? 0 : &face->os2;
|
||||
break;
|
||||
|
||||
case ft_sfnt_post:
|
||||
|
@ -114,7 +114,7 @@
|
|||
static const char*
|
||||
get_sfnt_postscript_name( TT_Face face )
|
||||
{
|
||||
FT_Int n, found_win, found_apple;
|
||||
FT_Int n, found_win, found_apple;
|
||||
const char* result = NULL;
|
||||
|
||||
|
||||
|
@ -124,8 +124,8 @@
|
|||
|
||||
/* scan the name table to see whether we have a Postscript name here, */
|
||||
/* either in Macintosh or Windows platform encodings */
|
||||
found_win = -1;
|
||||
found_apple = -1;
|
||||
found_win = -1;
|
||||
found_apple = -1;
|
||||
|
||||
for ( n = 0; n < face->num_names; n++ )
|
||||
{
|
||||
|
@ -148,16 +148,18 @@
|
|||
|
||||
if ( found_win != -1 )
|
||||
{
|
||||
FT_Memory memory = face->root.memory;
|
||||
FT_Memory memory = face->root.memory;
|
||||
TT_NameEntryRec* name = face->name_table.names + found_win;
|
||||
FT_UInt len = name->stringLength/2;
|
||||
FT_Error error;
|
||||
FT_UInt len = name->stringLength / 2;
|
||||
FT_Error error;
|
||||
|
||||
if ( !FT_ALLOC( result, len+1 ) )
|
||||
|
||||
if ( !FT_ALLOC( result, len + 1 ) )
|
||||
{
|
||||
FT_String* r = (FT_String*)result;
|
||||
FT_Byte* p = (FT_Byte*) name->string;
|
||||
FT_Byte* p = (FT_Byte*)name->string;
|
||||
|
||||
|
||||
for ( ; len > 0; len--, p += 2 )
|
||||
{
|
||||
if ( p[0] == 0 && p[1] >= 32 && p[1] < 128 )
|
||||
|
@ -175,7 +177,8 @@
|
|||
FT_UInt len = name->stringLength;
|
||||
FT_Error error;
|
||||
|
||||
if ( !FT_ALLOC( result, len+1 ) )
|
||||
|
||||
if ( !FT_ALLOC( result, len + 1 ) )
|
||||
{
|
||||
FT_MEM_COPY( (char*)result, name->string, len );
|
||||
((char*)result)[len] = '\0';
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
/* */
|
||||
/* Single object library component. */
|
||||
/* */
|
||||
/* Copyright 1996-2001 by */
|
||||
/* Copyright 1996-2001, 2002 by */
|
||||
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
|
||||
/* */
|
||||
/* This file is part of the FreeType project, and may only be used, */
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
/* */
|
||||
/* SFNT object management (base). */
|
||||
/* */
|
||||
/* Copyright 1996-2001 by */
|
||||
/* Copyright 1996-2001, 2002 by */
|
||||
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
|
||||
/* */
|
||||
/* This file is part of the FreeType project, and may only be used, */
|
||||
|
@ -39,91 +39,94 @@
|
|||
|
||||
|
||||
|
||||
/* convert a UTF-16 name entry to ASCII */
|
||||
/* convert a UTF-16 name entry to ASCII */
|
||||
static FT_String*
|
||||
tt_name_entry_ascii_from_utf16( TT_NameEntry entry,
|
||||
FT_Memory memory )
|
||||
tt_name_entry_ascii_from_utf16( TT_NameEntry entry,
|
||||
FT_Memory memory )
|
||||
{
|
||||
FT_String* string;
|
||||
FT_UInt len, code, n;
|
||||
FT_Byte* read = (FT_Byte*) entry->string;
|
||||
|
||||
len = (FT_UInt) entry->stringLength/2;
|
||||
|
||||
if ( FT_MEM_NEW_ARRAY( string, len+1 ) )
|
||||
FT_Byte* read = (FT_Byte*)entry->string;
|
||||
|
||||
|
||||
len = (FT_UInt)entry->stringLength / 2;
|
||||
|
||||
if ( FT_MEM_NEW_ARRAY( string, len + 1 ) )
|
||||
return NULL;
|
||||
|
||||
|
||||
for ( n = 0; n < len; n++ )
|
||||
{
|
||||
code = FT_NEXT_USHORT(read);
|
||||
code = FT_NEXT_USHORT( read );
|
||||
if ( code < 32 || code > 127 )
|
||||
code = '?';
|
||||
|
||||
|
||||
string[n] = (char)code;
|
||||
}
|
||||
|
||||
string[len] = 0;
|
||||
|
||||
|
||||
return string;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/* convert a UCS-4 name entry to ASCII */
|
||||
/* convert a UCS-4 name entry to ASCII */
|
||||
static FT_String*
|
||||
tt_name_entry_ascii_from_ucs4( TT_NameEntry entry,
|
||||
FT_Memory memory )
|
||||
{
|
||||
FT_String* string;
|
||||
FT_UInt len, code, n;
|
||||
FT_Byte* read = (FT_Byte*) entry->string;
|
||||
|
||||
len = (FT_UInt) entry->stringLength/4;
|
||||
|
||||
if ( FT_MEM_NEW_ARRAY( string, len+1 ) )
|
||||
FT_Byte* read = (FT_Byte*)entry->string;
|
||||
|
||||
|
||||
len = (FT_UInt)entry->stringLength / 4;
|
||||
|
||||
if ( FT_MEM_NEW_ARRAY( string, len + 1 ) )
|
||||
return NULL;
|
||||
|
||||
|
||||
for ( n = 0; n < len; n++ )
|
||||
{
|
||||
code = FT_NEXT_ULONG(read);
|
||||
code = FT_NEXT_ULONG( read );
|
||||
if ( code < 32 || code > 127 )
|
||||
code = '?';
|
||||
|
||||
|
||||
string[n] = (char)code;
|
||||
}
|
||||
|
||||
string[len] = 0;
|
||||
|
||||
|
||||
return string;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/* convert an Apple Roman or symbol name entry to ASCII */
|
||||
/* convert an Apple Roman or symbol name entry to ASCII */
|
||||
static FT_String*
|
||||
tt_name_entry_ascii_from_other( TT_NameEntry entry,
|
||||
FT_Memory memory )
|
||||
{
|
||||
FT_String* string;
|
||||
FT_UInt len, code, n;
|
||||
FT_Byte* read = (FT_Byte*) entry->string;
|
||||
|
||||
len = (FT_UInt) entry->stringLength;
|
||||
|
||||
if ( FT_MEM_NEW_ARRAY( string, len+1 ) )
|
||||
FT_Byte* read = (FT_Byte*)entry->string;
|
||||
|
||||
|
||||
len = (FT_UInt)entry->stringLength;
|
||||
|
||||
if ( FT_MEM_NEW_ARRAY( string, len + 1 ) )
|
||||
return NULL;
|
||||
|
||||
|
||||
for ( n = 0; n < len; n++ )
|
||||
{
|
||||
code = *read++;
|
||||
if ( code < 32 || code > 127 )
|
||||
code = '?';
|
||||
|
||||
|
||||
string[n] = (char)code;
|
||||
}
|
||||
|
||||
string[len] = 0;
|
||||
|
||||
|
||||
return string;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*************************************************************************/
|
||||
|
@ -158,91 +161,79 @@
|
|||
rec = face->name_table.names;
|
||||
for ( n = 0; n < face->name_table.numNameRecords; n++, rec++ )
|
||||
{
|
||||
/* according to the OpenType 1.3 specification, only Microsoft of */
|
||||
/* 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 says 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) */
|
||||
/* 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). */
|
||||
/* */
|
||||
if ( rec->nameID == nameid && rec->string )
|
||||
{
|
||||
switch ( rec->platformID )
|
||||
{
|
||||
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_APPLE_UNICODE:
|
||||
case TT_PLATFORM_ISO:
|
||||
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 )
|
||||
{
|
||||
/* there is 'languageID' to check there. We should use this */
|
||||
/* field only as a last solution when nothing else is */
|
||||
/* available.. */
|
||||
/* */
|
||||
found_unicode = n;
|
||||
case TT_MS_ID_SYMBOL_CS:
|
||||
case TT_MS_ID_UNICODE_CS:
|
||||
case TT_MS_ID_UCS_4:
|
||||
found_win = n;
|
||||
break;
|
||||
|
||||
default:
|
||||
;
|
||||
}
|
||||
|
||||
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 )
|
||||
{
|
||||
case TT_MS_ID_SYMBOL_CS:
|
||||
case TT_MS_ID_UNICODE_CS:
|
||||
case TT_MS_ID_UCS_4:
|
||||
found_win = n;
|
||||
break;
|
||||
|
||||
default:
|
||||
;
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
default:
|
||||
;
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* some fonts contain invalid Unicode or Macintosh formatted entries */
|
||||
/* we will thus favor name encoded in Windows formats when they're */
|
||||
/* available.. */
|
||||
/* */
|
||||
/* some fonts contain invalid Unicode or Macintosh formatted entries; */
|
||||
/* we will thus favor names encoded in Windows formats if available */
|
||||
/* */
|
||||
if ( found_win >= 0 )
|
||||
{
|
||||
rec = face->name_table.names + found_win;
|
||||
switch ( rec->encodingID )
|
||||
{
|
||||
case TT_MS_ID_UNICODE_CS:
|
||||
case TT_MS_ID_SYMBOL_CS:
|
||||
{
|
||||
result = tt_name_entry_ascii_from_utf16( rec, memory );
|
||||
break;
|
||||
}
|
||||
|
||||
case TT_MS_ID_UCS_4:
|
||||
{
|
||||
result = tt_name_entry_ascii_from_ucs4( rec, memory );
|
||||
break;
|
||||
}
|
||||
|
||||
default:
|
||||
;
|
||||
case TT_MS_ID_UNICODE_CS:
|
||||
case TT_MS_ID_SYMBOL_CS:
|
||||
result = tt_name_entry_ascii_from_utf16( rec, memory );
|
||||
break;
|
||||
|
||||
case TT_MS_ID_UCS_4:
|
||||
result = tt_name_entry_ascii_from_ucs4( rec, memory );
|
||||
break;
|
||||
|
||||
default:
|
||||
;
|
||||
}
|
||||
}
|
||||
else if ( found_apple >= 0 )
|
||||
|
@ -255,7 +246,7 @@
|
|||
rec = face->name_table.names + found_unicode;
|
||||
result = tt_name_entry_ascii_from_utf16( rec, memory );
|
||||
}
|
||||
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
|
@ -321,12 +312,13 @@
|
|||
FT_Error error;
|
||||
FT_Library library = face->root.driver->root.library;
|
||||
SFNT_Service sfnt;
|
||||
SFNT_HeaderRec sfnt_header;
|
||||
SFNT_HeaderRec sfnt_header;
|
||||
|
||||
/* for now, parameters are unused */
|
||||
FT_UNUSED( num_params );
|
||||
FT_UNUSED( params );
|
||||
|
||||
|
||||
sfnt = (SFNT_Service)face->sfnt;
|
||||
if ( !sfnt )
|
||||
{
|
||||
|
@ -344,7 +336,7 @@
|
|||
if ( !face->psnames )
|
||||
{
|
||||
face->psnames = (PSNames_Service)
|
||||
FT_Get_Module_Interface( library, "psnames" );
|
||||
FT_Get_Module_Interface( library, "psnames" );
|
||||
}
|
||||
|
||||
/* check that we have a valid TrueType file */
|
||||
|
@ -381,9 +373,9 @@
|
|||
FT_Int num_params,
|
||||
FT_Parameter* params )
|
||||
{
|
||||
FT_Error error;
|
||||
FT_Bool has_outline;
|
||||
FT_Bool is_apple_sbit;
|
||||
FT_Error error;
|
||||
FT_Bool has_outline;
|
||||
FT_Bool is_apple_sbit;
|
||||
|
||||
SFNT_Service sfnt = (SFNT_Service)face->sfnt;
|
||||
|
||||
|
@ -433,7 +425,6 @@
|
|||
(void)LOAD_( max_profile );
|
||||
(void)LOAD_( charmaps );
|
||||
|
||||
|
||||
/* the following tables are optional in PCL fonts -- */
|
||||
/* don't check for errors */
|
||||
(void)LOAD_( names );
|
||||
|
@ -470,6 +461,7 @@
|
|||
else
|
||||
goto Exit;
|
||||
}
|
||||
|
||||
#endif /* TT_CONFIG_OPTION_EMBEDDED_BITMAPS */
|
||||
|
||||
if ( LOAD_( hdmx ) ||
|
||||
|
@ -478,15 +470,17 @@
|
|||
LOAD_( pclt ) )
|
||||
goto Exit;
|
||||
|
||||
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_FONT_SUBFAMILY );
|
||||
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_FONT_SUBFAMILY );
|
||||
|
||||
/* now set up root fields */
|
||||
{
|
||||
FT_Face root = &face->root;
|
||||
FT_Int flags = 0;
|
||||
FT_Int n;
|
||||
FT_Memory memory;
|
||||
FT_Face root = &face->root;
|
||||
FT_Int flags = 0;
|
||||
FT_Int n;
|
||||
FT_Memory memory;
|
||||
|
||||
|
||||
memory = root->memory;
|
||||
|
@ -557,19 +551,21 @@
|
|||
#ifdef FT_CONFIG_OPTION_USE_CMAPS
|
||||
|
||||
TT_Build_CMaps( face ); /* ignore errors */
|
||||
|
||||
|
||||
|
||||
|
||||
/* set the encoding fields */
|
||||
{
|
||||
FT_Int m;
|
||||
|
||||
|
||||
|
||||
for ( m = 0; m < root->num_charmaps; m++ )
|
||||
{
|
||||
FT_CharMap charmap = root->charmaps[m];
|
||||
|
||||
|
||||
|
||||
charmap->encoding = sfnt_find_encoding( charmap->platform_id,
|
||||
charmap->encoding_id );
|
||||
|
||||
|
||||
if ( root->charmap == NULL &&
|
||||
charmap->encoding == ft_encoding_unicode )
|
||||
{
|
||||
|
@ -580,34 +576,35 @@
|
|||
}
|
||||
|
||||
#else /* !FT_CONFIG_OPTION_USE_CMAPS */
|
||||
|
||||
|
||||
{
|
||||
TT_CharMap charmap = face->charmaps;
|
||||
|
||||
|
||||
|
||||
charmap = face->charmaps;
|
||||
root->num_charmaps = face->num_charmaps;
|
||||
|
||||
|
||||
/* allocate table of pointers */
|
||||
if ( FT_NEW_ARRAY( root->charmaps, root->num_charmaps ) )
|
||||
goto Exit;
|
||||
|
||||
|
||||
for ( n = 0; n < root->num_charmaps; n++, charmap++ )
|
||||
{
|
||||
FT_Int platform = charmap->cmap.platformID;
|
||||
FT_Int encoding = charmap->cmap.platformEncodingID;
|
||||
|
||||
|
||||
|
||||
|
||||
charmap->root.face = (FT_Face)face;
|
||||
charmap->root.platform_id = (FT_UShort)platform;
|
||||
charmap->root.encoding_id = (FT_UShort)encoding;
|
||||
charmap->root.encoding = sfnt_find_encoding( platform, encoding );
|
||||
|
||||
|
||||
/* now, set root->charmap with a unicode charmap */
|
||||
/* wherever available */
|
||||
if ( !root->charmap &&
|
||||
charmap->root.encoding == ft_encoding_unicode )
|
||||
root->charmap = (FT_CharMap)charmap;
|
||||
|
||||
|
||||
root->charmaps[n] = (FT_CharMap)charmap;
|
||||
}
|
||||
}
|
||||
|
@ -622,7 +619,8 @@
|
|||
root->face_flags |= FT_FACE_FLAG_FIXED_SIZES;
|
||||
|
||||
#if 0
|
||||
/* I don't know criteria whether layout is horizontal or vertical */
|
||||
/* XXX: I don't know criteria whether layout is horizontal */
|
||||
/* or vertical. */
|
||||
if ( has_outline.... )
|
||||
{
|
||||
...
|
||||
|
@ -753,7 +751,7 @@
|
|||
FT_LOCAL_DEF( void )
|
||||
SFNT_Done_Face( TT_Face face )
|
||||
{
|
||||
FT_Memory memory = face->root.memory;
|
||||
FT_Memory memory = face->root.memory;
|
||||
SFNT_Service sfnt = (SFNT_Service)face->sfnt;
|
||||
|
||||
|
||||
|
@ -783,8 +781,9 @@
|
|||
#ifdef FT_CONFIG_OPTION_USE_CMAPS
|
||||
|
||||
{
|
||||
FT_Stream stream = FT_FACE_STREAM(face);
|
||||
|
||||
FT_Stream stream = FT_FACE_STREAM( face );
|
||||
|
||||
|
||||
/* simply release the 'cmap' table frame */
|
||||
FT_FRAME_RELEASE( face->cmap_table );
|
||||
face->cmap_size = 0;
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
/* */
|
||||
/* SFNT object management (specification). */
|
||||
/* */
|
||||
/* Copyright 1996-2001 by */
|
||||
/* Copyright 1996-2001, 2002 by */
|
||||
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
|
||||
/* */
|
||||
/* This file is part of the FreeType project, and may only be used, */
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
/* */
|
||||
/* TrueType character mapping table (cmap) support (body). */
|
||||
/* */
|
||||
/* Copyright 1996-2001 by */
|
||||
/* Copyright 1996-2001, 2002 by */
|
||||
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
|
||||
/* */
|
||||
/* This file is part of the FreeType project, and may only be used, */
|
||||
|
@ -35,52 +35,52 @@
|
|||
|
||||
|
||||
FT_CALLBACK_DEF( FT_UInt )
|
||||
code_to_index0( TT_CMapTable charmap,
|
||||
FT_ULong char_code );
|
||||
code_to_index0( TT_CMapTable charmap,
|
||||
FT_ULong char_code );
|
||||
|
||||
FT_CALLBACK_DEF( FT_ULong )
|
||||
code_to_next0( TT_CMapTable charmap,
|
||||
FT_ULong char_code );
|
||||
code_to_next0( TT_CMapTable charmap,
|
||||
FT_ULong char_code );
|
||||
|
||||
FT_CALLBACK_DEF( FT_UInt )
|
||||
code_to_index2( TT_CMapTable charmap,
|
||||
FT_ULong char_code );
|
||||
code_to_index2( TT_CMapTable charmap,
|
||||
FT_ULong char_code );
|
||||
|
||||
FT_CALLBACK_DEF( FT_ULong )
|
||||
code_to_next2( TT_CMapTable charmap,
|
||||
FT_ULong char_code );
|
||||
code_to_next2( TT_CMapTable charmap,
|
||||
FT_ULong char_code );
|
||||
|
||||
FT_CALLBACK_DEF( FT_UInt )
|
||||
code_to_index4( TT_CMapTable charmap,
|
||||
FT_ULong char_code );
|
||||
code_to_index4( TT_CMapTable charmap,
|
||||
FT_ULong char_code );
|
||||
|
||||
FT_CALLBACK_DEF( FT_ULong )
|
||||
code_to_next4( TT_CMapTable charmap,
|
||||
FT_ULong char_code );
|
||||
code_to_next4( TT_CMapTable charmap,
|
||||
FT_ULong char_code );
|
||||
|
||||
FT_CALLBACK_DEF( FT_UInt )
|
||||
code_to_index6( TT_CMapTable charmap,
|
||||
FT_ULong char_code );
|
||||
code_to_index6( TT_CMapTable charmap,
|
||||
FT_ULong char_code );
|
||||
|
||||
FT_CALLBACK_DEF( FT_ULong )
|
||||
code_to_next6( TT_CMapTable charmap,
|
||||
FT_ULong char_code );
|
||||
code_to_next6( TT_CMapTable charmap,
|
||||
FT_ULong char_code );
|
||||
|
||||
FT_CALLBACK_DEF( FT_UInt )
|
||||
code_to_index8_12( TT_CMapTable charmap,
|
||||
FT_ULong char_code );
|
||||
code_to_index8_12( TT_CMapTable charmap,
|
||||
FT_ULong char_code );
|
||||
|
||||
FT_CALLBACK_DEF( FT_ULong )
|
||||
code_to_next8_12( TT_CMapTable charmap,
|
||||
FT_ULong char_code );
|
||||
code_to_next8_12( TT_CMapTable charmap,
|
||||
FT_ULong char_code );
|
||||
|
||||
FT_CALLBACK_DEF( FT_UInt )
|
||||
code_to_index10( TT_CMapTable charmap,
|
||||
FT_ULong char_code );
|
||||
code_to_index10( TT_CMapTable charmap,
|
||||
FT_ULong char_code );
|
||||
|
||||
FT_CALLBACK_DEF( FT_ULong )
|
||||
code_to_next10( TT_CMapTable charmap,
|
||||
FT_ULong char_code );
|
||||
code_to_next10( TT_CMapTable charmap,
|
||||
FT_ULong char_code );
|
||||
|
||||
|
||||
/*************************************************************************/
|
||||
|
@ -93,6 +93,7 @@
|
|||
/* */
|
||||
/* <Input> */
|
||||
/* face :: A handle to the parent face object. */
|
||||
/* */
|
||||
/* stream :: A handle to the current stream object. */
|
||||
/* */
|
||||
/* <InOut> */
|
||||
|
@ -107,27 +108,27 @@
|
|||
/* released. */
|
||||
/* */
|
||||
FT_LOCAL_DEF( FT_Error )
|
||||
TT_CharMap_Load( TT_Face face,
|
||||
TT_CMapTable cmap,
|
||||
FT_Stream stream )
|
||||
TT_CharMap_Load( TT_Face face,
|
||||
TT_CMapTable cmap,
|
||||
FT_Stream stream )
|
||||
{
|
||||
FT_Error error;
|
||||
FT_Memory memory;
|
||||
FT_UShort num_SH, num_Seg, i;
|
||||
FT_ULong j, n;
|
||||
FT_Error error;
|
||||
FT_Memory memory;
|
||||
FT_UShort num_SH, num_Seg, i;
|
||||
FT_ULong j, n;
|
||||
|
||||
FT_UShort u, l;
|
||||
FT_UShort u, l;
|
||||
|
||||
TT_CMap0 cmap0;
|
||||
TT_CMap2 cmap2;
|
||||
TT_CMap4 cmap4;
|
||||
TT_CMap6 cmap6;
|
||||
TT_CMap0 cmap0;
|
||||
TT_CMap2 cmap2;
|
||||
TT_CMap4 cmap4;
|
||||
TT_CMap6 cmap6;
|
||||
TT_CMap8_12 cmap8_12;
|
||||
TT_CMap10 cmap10;
|
||||
|
||||
TT_CMap2SubHeader cmap2sub;
|
||||
TT_CMap4Segment segments;
|
||||
TT_CMapGroup groups;
|
||||
TT_CMap2SubHeader cmap2sub;
|
||||
TT_CMap4Segment segments;
|
||||
TT_CMapGroup groups;
|
||||
|
||||
|
||||
if ( cmap->loaded )
|
||||
|
@ -143,12 +144,12 @@
|
|||
case 0:
|
||||
cmap0 = &cmap->c.cmap0;
|
||||
|
||||
if ( FT_READ_USHORT( cmap0->language ) ||
|
||||
FT_ALLOC( cmap0->glyphIdArray, 256L ) ||
|
||||
if ( FT_READ_USHORT( cmap0->language ) ||
|
||||
FT_ALLOC( cmap0->glyphIdArray, 256L ) ||
|
||||
FT_STREAM_READ( cmap0->glyphIdArray, 256L ) )
|
||||
goto Fail;
|
||||
|
||||
cmap->get_index = code_to_index0;
|
||||
cmap->get_index = code_to_index0;
|
||||
cmap->get_next_char = code_to_next0;
|
||||
break;
|
||||
|
||||
|
@ -159,7 +160,7 @@
|
|||
/* allocate subheader keys */
|
||||
|
||||
if ( FT_NEW_ARRAY( cmap2->subHeaderKeys, 256 ) ||
|
||||
FT_FRAME_ENTER( 2L + 512L ) )
|
||||
FT_FRAME_ENTER( 2L + 512L ) )
|
||||
goto Fail;
|
||||
|
||||
cmap2->language = FT_GET_USHORT();
|
||||
|
@ -178,10 +179,10 @@
|
|||
/* load subheaders */
|
||||
|
||||
cmap2->numGlyphId = l = (FT_UShort)(
|
||||
( ( cmap->length - 2L * ( 256 + 3 ) - num_SH * 8L ) & 0xFFFF ) / 2 );
|
||||
( ( cmap->length - 2L * ( 256 + 3 ) - num_SH * 8L ) & 0xFFFFU ) / 2 );
|
||||
|
||||
if ( FT_NEW_ARRAY( cmap2->subHeaders, num_SH + 1 ) ||
|
||||
FT_FRAME_ENTER( ( num_SH + 1 ) * 8L ) )
|
||||
if ( FT_NEW_ARRAY( cmap2->subHeaders, num_SH + 1 ) ||
|
||||
FT_FRAME_ENTER( ( num_SH + 1 ) * 8L ) )
|
||||
{
|
||||
FT_FREE( cmap2->subHeaderKeys );
|
||||
goto Fail;
|
||||
|
@ -249,15 +250,15 @@
|
|||
segments = cmap4->segments;
|
||||
|
||||
for ( i = 0; i < num_Seg; i++ )
|
||||
segments[i].endCount = FT_GET_USHORT();
|
||||
segments[i].endCount = FT_GET_USHORT();
|
||||
|
||||
(void)FT_GET_USHORT();
|
||||
|
||||
for ( i = 0; i < num_Seg; i++ )
|
||||
segments[i].startCount = FT_GET_USHORT();
|
||||
segments[i].startCount = FT_GET_USHORT();
|
||||
|
||||
for ( i = 0; i < num_Seg; i++ )
|
||||
segments[i].idDelta = FT_GET_SHORT();
|
||||
segments[i].idDelta = FT_GET_SHORT();
|
||||
|
||||
for ( i = 0; i < num_Seg; i++ )
|
||||
segments[i].idRangeOffset = FT_GET_USHORT();
|
||||
|
@ -265,7 +266,7 @@
|
|||
FT_FRAME_EXIT();
|
||||
|
||||
cmap4->numGlyphId = l = (FT_UShort)(
|
||||
( ( cmap->length - ( 16L + 8L * num_Seg ) ) & 0xFFFF ) / 2 );
|
||||
( ( cmap->length - ( 16L + 8L * num_Seg ) ) & 0xFFFFU ) / 2 );
|
||||
|
||||
/* load IDs */
|
||||
|
||||
|
@ -283,7 +284,7 @@
|
|||
|
||||
cmap4->last_segment = cmap4->segments;
|
||||
|
||||
cmap->get_index = code_to_index4;
|
||||
cmap->get_index = code_to_index4;
|
||||
cmap->get_next_char = code_to_next4;
|
||||
break;
|
||||
|
||||
|
@ -309,7 +310,7 @@
|
|||
cmap6->glyphIdArray[i] = FT_GET_USHORT();
|
||||
|
||||
FT_FRAME_EXIT();
|
||||
cmap->get_index = code_to_index6;
|
||||
cmap->get_index = code_to_index6;
|
||||
cmap->get_next_char = code_to_next6;
|
||||
break;
|
||||
|
||||
|
@ -351,7 +352,7 @@
|
|||
|
||||
cmap8_12->last_group = cmap8_12->groups;
|
||||
|
||||
cmap->get_index = code_to_index8_12;
|
||||
cmap->get_index = code_to_index8_12;
|
||||
cmap->get_next_char = code_to_next8_12;
|
||||
break;
|
||||
|
||||
|
@ -378,7 +379,7 @@
|
|||
cmap10->glyphs[j] = FT_GET_USHORT();
|
||||
|
||||
FT_FRAME_EXIT();
|
||||
cmap->get_index = code_to_index10;
|
||||
cmap->get_index = code_to_index10;
|
||||
cmap->get_next_char = code_to_next10;
|
||||
break;
|
||||
|
||||
|
@ -405,14 +406,15 @@
|
|||
/* */
|
||||
/* <Input> */
|
||||
/* face :: A handle to the parent face object. */
|
||||
/* */
|
||||
/* cmap :: A handle to a cmap object. */
|
||||
/* */
|
||||
/* <Return> */
|
||||
/* FreeType error code. 0 means success. */
|
||||
/* */
|
||||
FT_LOCAL_DEF( FT_Error )
|
||||
TT_CharMap_Free( TT_Face face,
|
||||
TT_CMapTable cmap )
|
||||
TT_CharMap_Free( TT_Face face,
|
||||
TT_CMapTable cmap )
|
||||
{
|
||||
FT_Memory memory;
|
||||
|
||||
|
@ -478,16 +480,17 @@
|
|||
/* */
|
||||
/* <Input> */
|
||||
/* charCode :: The wanted character code. */
|
||||
/* */
|
||||
/* cmap0 :: A pointer to a cmap table in format 0. */
|
||||
/* */
|
||||
/* <Return> */
|
||||
/* Glyph index into the glyphs array. 0 if the glyph does not exist. */
|
||||
/* */
|
||||
FT_CALLBACK_DEF( FT_UInt )
|
||||
code_to_index0( TT_CMapTable cmap,
|
||||
FT_ULong charCode )
|
||||
code_to_index0( TT_CMapTable cmap,
|
||||
FT_ULong charCode )
|
||||
{
|
||||
TT_CMap0 cmap0 = &cmap->c.cmap0;
|
||||
TT_CMap0 cmap0 = &cmap->c.cmap0;
|
||||
|
||||
|
||||
return ( charCode <= 0xFF ? cmap0->glyphIdArray[charCode] : 0 );
|
||||
|
@ -506,16 +509,17 @@
|
|||
/* */
|
||||
/* <Input> */
|
||||
/* charCode :: The wanted character code. */
|
||||
/* */
|
||||
/* cmap0 :: A pointer to a cmap table in format 0. */
|
||||
/* */
|
||||
/* <Return> */
|
||||
/* Next char code. 0 if no higher one is encoded. */
|
||||
/* */
|
||||
FT_CALLBACK_DEF( FT_ULong )
|
||||
code_to_next0( TT_CMapTable cmap,
|
||||
FT_ULong charCode )
|
||||
code_to_next0( TT_CMapTable cmap,
|
||||
FT_ULong charCode )
|
||||
{
|
||||
TT_CMap0 cmap0 = &cmap->c.cmap0;
|
||||
TT_CMap0 cmap0 = &cmap->c.cmap0;
|
||||
|
||||
|
||||
while ( ++charCode <= 0xFF )
|
||||
|
@ -535,20 +539,21 @@
|
|||
/* */
|
||||
/* <Input> */
|
||||
/* charCode :: The wanted character code. */
|
||||
/* */
|
||||
/* cmap2 :: A pointer to a cmap table in format 2. */
|
||||
/* */
|
||||
/* <Return> */
|
||||
/* Glyph index into the glyphs array. 0 if the glyph does not exist. */
|
||||
/* */
|
||||
FT_CALLBACK_DEF( FT_UInt )
|
||||
code_to_index2( TT_CMapTable cmap,
|
||||
FT_ULong charCode )
|
||||
code_to_index2( TT_CMapTable cmap,
|
||||
FT_ULong charCode )
|
||||
{
|
||||
FT_UInt result, index1, offset;
|
||||
FT_UInt char_lo;
|
||||
FT_ULong char_hi;
|
||||
TT_CMap2SubHeader sh2;
|
||||
TT_CMap2 cmap2;
|
||||
FT_UInt result, index1, offset;
|
||||
FT_UInt char_lo;
|
||||
FT_ULong char_hi;
|
||||
TT_CMap2SubHeader sh2;
|
||||
TT_CMap2 cmap2;
|
||||
|
||||
|
||||
cmap2 = &cmap->c.cmap2;
|
||||
|
@ -582,7 +587,7 @@
|
|||
{
|
||||
result = cmap2->glyphIdArray[offset];
|
||||
if ( result )
|
||||
result = ( result + sh2->idDelta ) & 0xFFFF;
|
||||
result = ( result + sh2->idDelta ) & 0xFFFFU;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -600,20 +605,21 @@
|
|||
/* */
|
||||
/* <Input> */
|
||||
/* charCode :: The wanted character code. */
|
||||
/* */
|
||||
/* cmap2 :: A pointer to a cmap table in format 2. */
|
||||
/* */
|
||||
/* <Return> */
|
||||
/* Next encoded character. 0 if none exists. */
|
||||
/* */
|
||||
FT_CALLBACK_DEF( FT_ULong )
|
||||
code_to_next2( TT_CMapTable cmap,
|
||||
FT_ULong charCode )
|
||||
code_to_next2( TT_CMapTable cmap,
|
||||
FT_ULong charCode )
|
||||
{
|
||||
FT_UInt index1, offset;
|
||||
FT_UInt char_lo;
|
||||
FT_ULong char_hi;
|
||||
TT_CMap2SubHeader sh2;
|
||||
TT_CMap2 cmap2;
|
||||
FT_UInt index1, offset;
|
||||
FT_UInt char_lo;
|
||||
FT_ULong char_hi;
|
||||
TT_CMap2SubHeader sh2;
|
||||
TT_CMap2 cmap2;
|
||||
|
||||
|
||||
cmap2 = &cmap->c.cmap2;
|
||||
|
@ -683,17 +689,18 @@
|
|||
/* */
|
||||
/* <Input> */
|
||||
/* charCode :: The wanted character code. */
|
||||
/* */
|
||||
/* cmap4 :: A pointer to a cmap table in format 4. */
|
||||
/* */
|
||||
/* <Return> */
|
||||
/* Glyph index into the glyphs array. 0 if the glyph does not exist. */
|
||||
/* */
|
||||
FT_CALLBACK_DEF( FT_UInt )
|
||||
code_to_index4( TT_CMapTable cmap,
|
||||
FT_ULong charCode )
|
||||
code_to_index4( TT_CMapTable cmap,
|
||||
FT_ULong charCode )
|
||||
{
|
||||
FT_UInt result, index1, segCount;
|
||||
TT_CMap4 cmap4;
|
||||
FT_UInt result, index1, segCount;
|
||||
TT_CMap4 cmap4;
|
||||
TT_CMap4SegmentRec *seg4, *limit;
|
||||
|
||||
|
||||
|
@ -739,7 +746,7 @@
|
|||
/* directly */
|
||||
|
||||
if ( seg4->idRangeOffset == 0 )
|
||||
result = ( charCode + seg4->idDelta ) & 0xFFFF;
|
||||
result = ( charCode + seg4->idDelta ) & 0xFFFFU;
|
||||
else
|
||||
{
|
||||
/* otherwise, we must use the glyphIdArray to do it */
|
||||
|
@ -750,7 +757,7 @@
|
|||
|
||||
if ( index1 < (FT_UInt)cmap4->numGlyphId &&
|
||||
cmap4->glyphIdArray[index1] != 0 )
|
||||
result = ( cmap4->glyphIdArray[index1] + seg4->idDelta ) & 0xFFFF;
|
||||
result = ( cmap4->glyphIdArray[index1] + seg4->idDelta ) & 0xFFFFU;
|
||||
}
|
||||
|
||||
return result;
|
||||
|
@ -767,17 +774,18 @@
|
|||
/* */
|
||||
/* <Input> */
|
||||
/* charCode :: The wanted character code. */
|
||||
/* */
|
||||
/* cmap :: A pointer to a cmap table in format 4. */
|
||||
/* */
|
||||
/* <Return> */
|
||||
/* Next encoded character. 0 if none exists. */
|
||||
/* */
|
||||
FT_CALLBACK_DEF( FT_ULong )
|
||||
code_to_next4( TT_CMapTable cmap,
|
||||
FT_ULong charCode )
|
||||
code_to_next4( TT_CMapTable cmap,
|
||||
FT_ULong charCode )
|
||||
{
|
||||
FT_UInt index1, segCount;
|
||||
TT_CMap4 cmap4;
|
||||
FT_UInt index1, segCount;
|
||||
TT_CMap4 cmap4;
|
||||
TT_CMap4SegmentRec *seg4, *limit;
|
||||
|
||||
|
||||
|
@ -834,17 +842,18 @@
|
|||
/* */
|
||||
/* <Input> */
|
||||
/* charCode :: The wanted character code. */
|
||||
/* */
|
||||
/* cmap6 :: A pointer to a cmap table in format 6. */
|
||||
/* */
|
||||
/* <Return> */
|
||||
/* Glyph index into the glyphs array. 0 if the glyph does not exist. */
|
||||
/* */
|
||||
FT_CALLBACK_DEF( FT_UInt )
|
||||
code_to_index6( TT_CMapTable cmap,
|
||||
FT_ULong charCode )
|
||||
code_to_index6( TT_CMapTable cmap,
|
||||
FT_ULong charCode )
|
||||
{
|
||||
TT_CMap6 cmap6;
|
||||
FT_UInt result = 0;
|
||||
TT_CMap6 cmap6;
|
||||
FT_UInt result = 0;
|
||||
|
||||
|
||||
cmap6 = &cmap->c.cmap6;
|
||||
|
@ -867,16 +876,17 @@
|
|||
/* */
|
||||
/* <Input> */
|
||||
/* charCode :: The wanted character code. */
|
||||
/* */
|
||||
/* cmap :: A pointer to a cmap table in format 6. */
|
||||
/* */
|
||||
/* <Return> */
|
||||
/* Next encoded character. 0 if none exists. */
|
||||
/* */
|
||||
FT_CALLBACK_DEF( FT_ULong )
|
||||
code_to_next6( TT_CMapTable cmap,
|
||||
FT_ULong charCode )
|
||||
code_to_next6( TT_CMapTable cmap,
|
||||
FT_ULong charCode )
|
||||
{
|
||||
TT_CMap6 cmap6;
|
||||
TT_CMap6 cmap6;
|
||||
|
||||
|
||||
charCode++;
|
||||
|
@ -910,16 +920,17 @@
|
|||
/* */
|
||||
/* <Input> */
|
||||
/* charCode :: The wanted character code. */
|
||||
/* */
|
||||
/* cmap8_12 :: A pointer to a cmap table in format 8 or 12. */
|
||||
/* */
|
||||
/* <Return> */
|
||||
/* Glyph index into the glyphs array. 0 if the glyph does not exist. */
|
||||
/* */
|
||||
FT_CALLBACK_DEF( FT_UInt )
|
||||
code_to_index8_12( TT_CMapTable cmap,
|
||||
FT_ULong charCode )
|
||||
code_to_index8_12( TT_CMapTable cmap,
|
||||
FT_ULong charCode )
|
||||
{
|
||||
TT_CMap8_12 cmap8_12;
|
||||
TT_CMap8_12 cmap8_12;
|
||||
TT_CMapGroupRec *group, *limit;
|
||||
|
||||
|
||||
|
@ -974,16 +985,17 @@
|
|||
/* */
|
||||
/* <Input> */
|
||||
/* charCode :: The wanted character code. */
|
||||
/* */
|
||||
/* cmap :: A pointer to a cmap table in format 8 or 12. */
|
||||
/* */
|
||||
/* <Return> */
|
||||
/* Next encoded character. 0 if none exists. */
|
||||
/* */
|
||||
FT_CALLBACK_DEF( FT_ULong )
|
||||
code_to_next8_12( TT_CMapTable cmap,
|
||||
FT_ULong charCode )
|
||||
code_to_next8_12( TT_CMapTable cmap,
|
||||
FT_ULong charCode )
|
||||
{
|
||||
TT_CMap8_12 cmap8_12;
|
||||
TT_CMap8_12 cmap8_12;
|
||||
TT_CMapGroupRec *group, *limit;
|
||||
|
||||
|
||||
|
@ -1020,17 +1032,18 @@
|
|||
/* */
|
||||
/* <Input> */
|
||||
/* charCode :: The wanted character code. */
|
||||
/* */
|
||||
/* cmap10 :: A pointer to a cmap table in format 10. */
|
||||
/* */
|
||||
/* <Return> */
|
||||
/* Glyph index into the glyphs array. 0 if the glyph does not exist. */
|
||||
/* */
|
||||
FT_CALLBACK_DEF( FT_UInt )
|
||||
code_to_index10( TT_CMapTable cmap,
|
||||
FT_ULong charCode )
|
||||
code_to_index10( TT_CMapTable cmap,
|
||||
FT_ULong charCode )
|
||||
{
|
||||
TT_CMap10 cmap10;
|
||||
FT_UInt result = 0;
|
||||
FT_UInt result = 0;
|
||||
|
||||
|
||||
cmap10 = &cmap->c.cmap10;
|
||||
|
@ -1057,14 +1070,15 @@
|
|||
/* */
|
||||
/* <Input> */
|
||||
/* charCode :: The wanted character code. */
|
||||
/* */
|
||||
/* cmap :: A pointer to a cmap table in format 10. */
|
||||
/* */
|
||||
/* <Return> */
|
||||
/* Next encoded character. 0 if none exists. */
|
||||
/* */
|
||||
FT_CALLBACK_DEF( FT_ULong )
|
||||
code_to_next10( TT_CMapTable cmap,
|
||||
FT_ULong charCode )
|
||||
code_to_next10( TT_CMapTable cmap,
|
||||
FT_ULong charCode )
|
||||
{
|
||||
TT_CMap10 cmap10;
|
||||
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
/* */
|
||||
/* TrueType character mapping table (cmap) support (specification). */
|
||||
/* */
|
||||
/* Copyright 1996-2001 by */
|
||||
/* Copyright 1996-2001, 2002 by */
|
||||
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
|
||||
/* */
|
||||
/* This file is part of the FreeType project, and may only be used, */
|
||||
|
@ -28,13 +28,13 @@ FT_BEGIN_HEADER
|
|||
|
||||
|
||||
FT_LOCAL( FT_Error )
|
||||
TT_CharMap_Load( TT_Face face,
|
||||
TT_CMapTable cmap,
|
||||
FT_Stream input );
|
||||
TT_CharMap_Load( TT_Face face,
|
||||
TT_CMapTable cmap,
|
||||
FT_Stream input );
|
||||
|
||||
FT_LOCAL( FT_Error )
|
||||
TT_CharMap_Free( TT_Face face,
|
||||
TT_CMapTable cmap );
|
||||
TT_CharMap_Free( TT_Face face,
|
||||
TT_CMapTable cmap );
|
||||
|
||||
|
||||
FT_END_HEADER
|
||||
|
|
1263
src/sfnt/ttcmap0.c
1263
src/sfnt/ttcmap0.c
File diff suppressed because it is too large
Load Diff
|
@ -1,10 +1,10 @@
|
|||
/***************************************************************************/
|
||||
/* */
|
||||
/* ttcmap.h */
|
||||
/* ttcmap0.h */
|
||||
/* */
|
||||
/* TrueType character mapping table (cmap) support (specification). */
|
||||
/* TrueType new character mapping table (cmap) support (specification). */
|
||||
/* */
|
||||
/* Copyright 1996-2001 by */
|
||||
/* Copyright 2002 by */
|
||||
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
|
||||
/* */
|
||||
/* This file is part of the FreeType project, and may only be used, */
|
||||
|
@ -27,19 +27,21 @@
|
|||
|
||||
FT_BEGIN_HEADER
|
||||
|
||||
typedef struct TT_CMapRec_
|
||||
typedef struct TT_CMapRec_
|
||||
{
|
||||
FT_CMapRec cmap;
|
||||
FT_Byte* data; /* pointer to in-memory cmap table */
|
||||
FT_Byte* data; /* pointer to in-memory cmap table */
|
||||
|
||||
} TT_CMapRec, *TT_CMap;
|
||||
|
||||
typedef const struct TT_CMap_ClassRec_* TT_CMap_Class;
|
||||
typedef const struct TT_CMap_ClassRec_* TT_CMap_Class;
|
||||
|
||||
typedef FT_Error (*TT_CMap_ValidateFunc)( FT_Byte* data,
|
||||
FT_Validator valid );
|
||||
|
||||
typedef struct TT_CMap_ClassRec_
|
||||
typedef FT_Error
|
||||
(*TT_CMap_ValidateFunc)( FT_Byte* data,
|
||||
FT_Validator valid );
|
||||
|
||||
typedef struct TT_CMap_ClassRec_
|
||||
{
|
||||
FT_CMap_ClassRec clazz;
|
||||
FT_UInt format;
|
||||
|
@ -47,19 +49,21 @@ FT_BEGIN_HEADER
|
|||
|
||||
} TT_CMap_ClassRec;
|
||||
|
||||
typedef struct TT_ValidatorRec_
|
||||
|
||||
typedef struct TT_ValidatorRec_
|
||||
{
|
||||
FT_ValidatorRec validator;
|
||||
FT_UInt num_glyphs;
|
||||
|
||||
} TT_ValidatorRec, *TT_Validator;
|
||||
|
||||
#define TT_VALIDATOR(x) ((TT_Validator)(x))
|
||||
#define TT_VALID_GLYPH_COUNT(v) TT_VALIDATOR(v)->num_glyphs
|
||||
|
||||
#define TT_VALIDATOR( x ) ((TT_Validator)( x ))
|
||||
#define TT_VALID_GLYPH_COUNT( x ) TT_VALIDATOR( x )->num_glyphs
|
||||
|
||||
|
||||
FT_LOCAL( FT_Error )
|
||||
TT_Build_CMaps( TT_Face face );
|
||||
TT_Build_CMaps( TT_Face face );
|
||||
|
||||
|
||||
FT_END_HEADER
|
||||
|
|
|
@ -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 by */
|
||||
/* Copyright 1996-2001, 2002 by */
|
||||
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
|
||||
/* */
|
||||
/* This file is part of the FreeType project, and may only be used, */
|
||||
|
@ -28,6 +28,7 @@
|
|||
|
||||
#include <stdlib.h> /* for qsort */
|
||||
|
||||
|
||||
/*************************************************************************/
|
||||
/* */
|
||||
/* The macro FT_COMPONENT is used in trace mode. It is an implicit */
|
||||
|
@ -48,6 +49,7 @@
|
|||
/* */
|
||||
/* <Input> */
|
||||
/* face :: A face object handle. */
|
||||
/* */
|
||||
/* tag :: The searched tag. */
|
||||
/* */
|
||||
/* <Return> */
|
||||
|
@ -57,8 +59,8 @@
|
|||
TT_LookUp_Table( TT_Face face,
|
||||
FT_ULong tag )
|
||||
{
|
||||
TT_Table entry;
|
||||
TT_Table limit;
|
||||
TT_Table entry;
|
||||
TT_Table limit;
|
||||
|
||||
|
||||
FT_TRACE3(( "TT_LookUp_Table: %08p, `%c%c%c%c' -- ",
|
||||
|
@ -95,7 +97,9 @@
|
|||
/* */
|
||||
/* <Input> */
|
||||
/* face :: A face object handle. */
|
||||
/* */
|
||||
/* tag :: The searched tag. */
|
||||
/* */
|
||||
/* stream :: The stream to seek when the table is found. */
|
||||
/* */
|
||||
/* <Output> */
|
||||
|
@ -110,8 +114,8 @@
|
|||
FT_Stream stream,
|
||||
FT_ULong* length )
|
||||
{
|
||||
TT_Table table;
|
||||
FT_Error error;
|
||||
TT_Table table;
|
||||
FT_Error error;
|
||||
|
||||
|
||||
table = TT_LookUp_Table( face, tag );
|
||||
|
@ -134,14 +138,16 @@
|
|||
/*************************************************************************/
|
||||
/* */
|
||||
/* <Function> */
|
||||
/* TT_Load_SFNT_HeaderRec */
|
||||
/* TT_Load_SFNT_HeaderRec */
|
||||
/* */
|
||||
/* <Description> */
|
||||
/* Loads the header of a SFNT font file. Supports collections. */
|
||||
/* */
|
||||
/* <Input> */
|
||||
/* face :: A handle to the target face object. */
|
||||
/* */
|
||||
/* stream :: The input stream. */
|
||||
/* */
|
||||
/* face_index :: If the font is a collection, the number of the font */
|
||||
/* in the collection, ignored otherwise. */
|
||||
/* */
|
||||
|
@ -161,9 +167,9 @@
|
|||
/* */
|
||||
FT_LOCAL_DEF( FT_Error )
|
||||
TT_Load_SFNT_HeaderRec( TT_Face face,
|
||||
FT_Stream stream,
|
||||
FT_Long face_index,
|
||||
SFNT_Header sfnt )
|
||||
FT_Stream stream,
|
||||
FT_Long face_index,
|
||||
SFNT_Header sfnt )
|
||||
{
|
||||
FT_Error error;
|
||||
FT_ULong format_tag;
|
||||
|
@ -190,21 +196,23 @@
|
|||
FT_FRAME_START( 8 ),
|
||||
FT_FRAME_LONG( version ),
|
||||
FT_FRAME_LONG( count ),
|
||||
FT_FRAME_END };
|
||||
FT_FRAME_END
|
||||
};
|
||||
|
||||
|
||||
FT_TRACE2(( "TT_Load_SFNT_HeaderRec: %08p, %ld\n",
|
||||
face, face_index ));
|
||||
|
||||
face->ttc_header.tag = 0;
|
||||
face->ttc_header.version = 0;
|
||||
face->ttc_header.count = 0;
|
||||
face->ttc_header.tag = 0;
|
||||
face->ttc_header.version = 0;
|
||||
face->ttc_header.count = 0;
|
||||
|
||||
face->num_tables = 0;
|
||||
|
||||
/* first of all, read the first 4 bytes. If it is `ttcf', then the */
|
||||
/* file is a TrueType collection, otherwise it can be any other */
|
||||
/* kind of font. */
|
||||
/* */
|
||||
if ( FT_READ_ULONG( format_tag ) )
|
||||
goto Exit;
|
||||
|
||||
|
@ -215,8 +223,8 @@
|
|||
|
||||
FT_TRACE3(( "TT_Load_SFNT_HeaderRec: file is a collection\n" ));
|
||||
|
||||
/* it's a TrueType collection, i.e. a file containing several */
|
||||
/* font files. Read the font directory now */
|
||||
/* It is a TrueType collection, i.e. a file containing several */
|
||||
/* font files. Read the font directory now */
|
||||
if ( FT_STREAM_READ_FIELDS( ttc_header_fields, &face->ttc_header ) )
|
||||
goto Exit;
|
||||
|
||||
|
@ -239,7 +247,7 @@
|
|||
|
||||
/* seek to the appropriate TrueType file, then read tag */
|
||||
if ( FT_STREAM_SEEK( face->ttc_header.offsets[face_index] ) ||
|
||||
FT_READ_LONG( format_tag ) )
|
||||
FT_READ_LONG( format_tag ) )
|
||||
goto Exit;
|
||||
}
|
||||
|
||||
|
@ -284,6 +292,7 @@
|
|||
/* */
|
||||
/* <Input> */
|
||||
/* stream :: The input stream. */
|
||||
/* */
|
||||
/* sfnt :: The SFNT directory header. */
|
||||
/* */
|
||||
/* <Return> */
|
||||
|
@ -293,14 +302,14 @@
|
|||
/* The stream cursor must be at the font file's origin. */
|
||||
/* */
|
||||
FT_LOCAL_DEF( FT_Error )
|
||||
TT_Load_Directory( TT_Face face,
|
||||
FT_Stream stream,
|
||||
SFNT_Header sfnt )
|
||||
TT_Load_Directory( TT_Face face,
|
||||
FT_Stream stream,
|
||||
SFNT_Header sfnt )
|
||||
{
|
||||
FT_Error error;
|
||||
FT_Memory memory = stream->memory;
|
||||
FT_Error error;
|
||||
FT_Memory memory = stream->memory;
|
||||
|
||||
TT_TableRec *entry, *limit;
|
||||
TT_TableRec *entry, *limit;
|
||||
|
||||
|
||||
FT_TRACE2(( "TT_Load_Directory: %08p\n", face ));
|
||||
|
@ -444,6 +453,7 @@
|
|||
/* */
|
||||
/* <Input> */
|
||||
/* face :: A handle to the target face object. */
|
||||
/* */
|
||||
/* stream :: The input stream. */
|
||||
/* */
|
||||
/* <Return> */
|
||||
|
@ -545,6 +555,7 @@
|
|||
/* */
|
||||
/* <Input> */
|
||||
/* face :: A handle to the target face object. */
|
||||
/* */
|
||||
/* stream :: The input stream. */
|
||||
/* */
|
||||
/* <Return> */
|
||||
|
@ -666,7 +677,9 @@
|
|||
/* */
|
||||
/* <Input> */
|
||||
/* face :: A handle to the target face object. */
|
||||
/* */
|
||||
/* stream :: The input stream. */
|
||||
/* */
|
||||
/* vertical :: A boolean flag. If set, load vertical metrics. */
|
||||
/* */
|
||||
/* <Return> */
|
||||
|
@ -694,6 +707,7 @@
|
|||
if ( vertical )
|
||||
{
|
||||
/* The table is optional, quit silently if it wasn't found */
|
||||
/* */
|
||||
/* XXX: Some fonts have a valid vertical header with a non-null */
|
||||
/* `number_of_VMetrics' fields, but no corresponding `vmtx' */
|
||||
/* table to get the metrics from (e.g. mingliu). */
|
||||
|
@ -753,8 +767,8 @@
|
|||
goto Exit;
|
||||
|
||||
{
|
||||
TT_LongMetrics cur = *longs;
|
||||
TT_LongMetrics limit = cur + num_longs;
|
||||
TT_LongMetrics cur = *longs;
|
||||
TT_LongMetrics limit = cur + num_longs;
|
||||
|
||||
|
||||
for ( ; cur < limit; cur++ )
|
||||
|
@ -806,7 +820,9 @@
|
|||
/* */
|
||||
/* <Input> */
|
||||
/* face :: A handle to the target face object. */
|
||||
/* */
|
||||
/* stream :: The input stream. */
|
||||
/* */
|
||||
/* vertical :: A boolean flag. If set, load vertical metrics. */
|
||||
/* */
|
||||
/* <Return> */
|
||||
|
@ -906,6 +922,7 @@
|
|||
/* */
|
||||
/* <Input> */
|
||||
/* face :: A handle to the target face object. */
|
||||
/* */
|
||||
/* stream :: The input stream. */
|
||||
/* */
|
||||
/* <Return> */
|
||||
|
@ -915,14 +932,14 @@
|
|||
TT_Load_Names( TT_Face face,
|
||||
FT_Stream stream )
|
||||
{
|
||||
FT_Error error;
|
||||
FT_Memory memory = stream->memory;
|
||||
FT_Error error;
|
||||
FT_Memory memory = stream->memory;
|
||||
|
||||
FT_ULong table_pos, table_len;
|
||||
FT_ULong storageOffset, storageSize;
|
||||
FT_Byte* storage;
|
||||
FT_ULong table_pos, table_len;
|
||||
FT_ULong storageOffset, storageSize;
|
||||
FT_Byte* storage;
|
||||
|
||||
TT_NameTable names;
|
||||
TT_NameTable names;
|
||||
|
||||
const FT_Frame_Field name_table_fields[] =
|
||||
{
|
||||
|
@ -972,10 +989,10 @@
|
|||
|
||||
/* check the 'storageOffset' field */
|
||||
storageOffset = names->storageOffset;
|
||||
if ( storageOffset < (FT_ULong)(6 + 12*names->numNameRecords) ||
|
||||
table_len <= storageOffset )
|
||||
if ( storageOffset < (FT_ULong)( 6 + 12 * names->numNameRecords ) ||
|
||||
table_len <= storageOffset )
|
||||
{
|
||||
FT_ERROR(( "TT.load_names: invalid 'name' table\n" ));
|
||||
FT_ERROR(( "TT_Load_Names: invalid `name' table\n" ));
|
||||
error = SFNT_Err_Name_Table_Missing;
|
||||
goto Exit;
|
||||
}
|
||||
|
@ -984,11 +1001,12 @@
|
|||
|
||||
/* Allocate the array of name records. */
|
||||
if ( FT_ALLOC( names->names,
|
||||
names->numNameRecords*sizeof(TT_NameEntryRec) + storageSize ) ||
|
||||
FT_FRAME_ENTER( names->numNameRecords * 12L ) )
|
||||
names->numNameRecords * sizeof ( TT_NameEntryRec ) +
|
||||
storageSize ) ||
|
||||
FT_FRAME_ENTER( names->numNameRecords * 12L ) )
|
||||
goto Exit;
|
||||
|
||||
storage = (FT_Byte*)(names->names + names->numNameRecords);
|
||||
storage = (FT_Byte*)( names->names + names->numNameRecords );
|
||||
|
||||
/* Load the name records and determine how much storage is needed */
|
||||
/* to hold the strings themselves. */
|
||||
|
@ -1002,8 +1020,8 @@
|
|||
if ( FT_STREAM_READ_FIELDS( name_record_fields, cur ) )
|
||||
break;
|
||||
|
||||
/* invalid name entries will have "cur->string" set to NULL !! */
|
||||
if ( (FT_ULong)(cur->stringOffset + cur->stringLength) < storageSize )
|
||||
/* invalid name entries will have "cur->string" set to NULL! */
|
||||
if ( (FT_ULong)( cur->stringOffset + cur->stringLength ) < storageSize )
|
||||
cur->string = storage + cur->stringOffset;
|
||||
else
|
||||
{
|
||||
|
@ -1016,18 +1034,17 @@
|
|||
|
||||
FT_FRAME_EXIT();
|
||||
|
||||
if (error)
|
||||
if ( error )
|
||||
goto Exit;
|
||||
|
||||
storageOffset -= 6 + 12*names->numNameRecords;
|
||||
storageOffset -= 6 + 12 * names->numNameRecords;
|
||||
if ( FT_STREAM_SKIP( storageOffset ) ||
|
||||
FT_STREAM_READ( storage, storageSize ) )
|
||||
goto Exit;
|
||||
|
||||
|
||||
#ifdef FT_DEBUG_LEVEL_TRACE
|
||||
|
||||
/* Print Name Record Table in case of debugging */
|
||||
/* print Name Record Table in case of debugging */
|
||||
{
|
||||
TT_NameEntryRec* cur = names->names;
|
||||
TT_NameEntryRec* limit = cur + names->numNameRecords;
|
||||
|
@ -1039,24 +1056,24 @@
|
|||
|
||||
|
||||
FT_TRACE3(( "(%2d %2d %4x %2d) ",
|
||||
cur->platformID,
|
||||
cur->encodingID,
|
||||
cur->languageID,
|
||||
cur->nameID ));
|
||||
cur->platformID,
|
||||
cur->encodingID,
|
||||
cur->languageID,
|
||||
cur->nameID ));
|
||||
|
||||
/* I know that M$ encoded strings are Unicode, */
|
||||
/* but this works reasonable well for debugging purposes. */
|
||||
if ( cur->string )
|
||||
for ( j = 0; j < (FT_UInt)cur->stringLength; j++ )
|
||||
{
|
||||
FT_Byte c = *(FT_Byte*)(cur->string + j);
|
||||
FT_Byte c = *(FT_Byte*)( cur->string + j );
|
||||
|
||||
|
||||
if ( c >= 32 && c < 128 )
|
||||
FT_TRACE3(( "%c", c ));
|
||||
}
|
||||
else
|
||||
FT_TRACE3(( "INVALID ENTRY !!\n" ));
|
||||
FT_TRACE3(( "Invalid entry!\n" ));
|
||||
|
||||
FT_TRACE3(( "\n" ));
|
||||
}
|
||||
|
@ -1088,8 +1105,8 @@
|
|||
FT_LOCAL_DEF( void )
|
||||
TT_Free_Names( TT_Face face )
|
||||
{
|
||||
FT_Memory memory = face->root.driver->root.memory;
|
||||
TT_NameTable names = &face->name_table;
|
||||
FT_Memory memory = face->root.driver->root.memory;
|
||||
TT_NameTable names = &face->name_table;
|
||||
|
||||
|
||||
/* free strings table */
|
||||
|
@ -1115,6 +1132,7 @@
|
|||
/* */
|
||||
/* <Input> */
|
||||
/* face :: A handle to the target face object. */
|
||||
/* */
|
||||
/* stream :: A handle to the input stream. */
|
||||
/* */
|
||||
/* <Return> */
|
||||
|
@ -1127,21 +1145,22 @@
|
|||
TT_Load_CMap( TT_Face face,
|
||||
FT_Stream stream )
|
||||
{
|
||||
FT_Error error;
|
||||
FT_Error error;
|
||||
|
||||
|
||||
error = face->goto_table( face, TTAG_cmap, stream, &face->cmap_size );
|
||||
if ( error )
|
||||
{
|
||||
FT_TRACE2(( "No 'cmap' table in font !\n" ));
|
||||
FT_TRACE2(( "No `cmap' table in font !\n" ));
|
||||
error = SFNT_Err_CMap_Table_Missing;
|
||||
goto Exit;
|
||||
}
|
||||
|
||||
if ( !FT_FRAME_EXTRACT( face->cmap_size, face->cmap_table ) )
|
||||
FT_TRACE2(( "'cmap' table loaded\n" ));
|
||||
FT_TRACE2(( "`cmap' table loaded\n" ));
|
||||
else
|
||||
{
|
||||
FT_ERROR(( "'cmap' table is too short !!\n" ));
|
||||
FT_ERROR(( "`cmap' table is too short!\n" ));
|
||||
face->cmap_size = 0;
|
||||
}
|
||||
|
||||
|
@ -1213,7 +1232,7 @@
|
|||
|
||||
for ( ; charmap < limit; charmap++ )
|
||||
{
|
||||
TT_CMapTable cmap;
|
||||
TT_CMapTable cmap;
|
||||
|
||||
|
||||
charmap->root.face = (FT_Face)face;
|
||||
|
@ -1234,7 +1253,7 @@
|
|||
|
||||
|
||||
if ( FT_STREAM_SEEK( table_start + (FT_Long)cmap->offset ) ||
|
||||
FT_STREAM_READ_FIELDS( cmap_rec_fields, cmap ) )
|
||||
FT_STREAM_READ_FIELDS( cmap_rec_fields, cmap ) )
|
||||
goto Exit;
|
||||
|
||||
cmap->offset = FT_STREAM_POS();
|
||||
|
@ -1249,6 +1268,7 @@
|
|||
|
||||
#endif /* !FT_CONFIG_OPTION_USE_CMAPS */
|
||||
|
||||
|
||||
/*************************************************************************/
|
||||
/* */
|
||||
/* <Function> */
|
||||
|
@ -1259,6 +1279,7 @@
|
|||
/* */
|
||||
/* <Input> */
|
||||
/* face :: A handle to the target face object. */
|
||||
/* */
|
||||
/* stream :: A handle to the input stream. */
|
||||
/* */
|
||||
/* <Return> */
|
||||
|
@ -1352,7 +1373,7 @@
|
|||
if ( error )
|
||||
{
|
||||
FT_TRACE2(( "is missing!\n" ));
|
||||
face->os2.version = 0xFFFF;
|
||||
face->os2.version = 0xFFFFU;
|
||||
error = SFNT_Err_Ok;
|
||||
goto Exit;
|
||||
}
|
||||
|
@ -1401,6 +1422,7 @@
|
|||
/* */
|
||||
/* <Input> */
|
||||
/* face :: A handle to the target face object. */
|
||||
/* */
|
||||
/* stream :: A handle to the input stream. */
|
||||
/* */
|
||||
/* <Return> */
|
||||
|
@ -1459,6 +1481,7 @@
|
|||
/* */
|
||||
/* <Input> */
|
||||
/* face :: A handle to the target face object. */
|
||||
/* */
|
||||
/* stream :: A handle to the input stream. */
|
||||
/* */
|
||||
/* <Return> */
|
||||
|
@ -1526,6 +1549,7 @@
|
|||
/* */
|
||||
/* <Input> */
|
||||
/* face :: A handle to the target face object. */
|
||||
/* */
|
||||
/* stream :: The input stream. */
|
||||
/* */
|
||||
/* <Return> */
|
||||
|
@ -1603,6 +1627,7 @@
|
|||
/* */
|
||||
/* <Input> */
|
||||
/* face :: A handle to the target face object. */
|
||||
/* */
|
||||
/* stream :: The input stream. */
|
||||
/* */
|
||||
/* <Return> */
|
||||
|
@ -1648,7 +1673,7 @@
|
|||
|
||||
if ( coverage == 0x0001 )
|
||||
{
|
||||
FT_UInt num_pairs;
|
||||
FT_UInt num_pairs;
|
||||
TT_Kern0_Pair pair;
|
||||
TT_Kern0_Pair limit;
|
||||
|
||||
|
@ -1685,7 +1710,7 @@
|
|||
/* ensure that the kerning pair table is sorted (yes, some */
|
||||
/* fonts have unsorted tables!) */
|
||||
{
|
||||
FT_UInt i;
|
||||
FT_UInt i;
|
||||
TT_Kern0_Pair pair0;
|
||||
|
||||
|
||||
|
@ -1722,6 +1747,7 @@
|
|||
#undef TT_KERN_INDEX
|
||||
#define TT_KERN_INDEX( g1, g2 ) ( ( (FT_ULong)g1 << 16 ) | g2 )
|
||||
|
||||
|
||||
FT_CALLBACK_DEF( int )
|
||||
tt_kern_pair_compare( const void* a,
|
||||
const void* b )
|
||||
|
@ -1737,6 +1763,7 @@
|
|||
( index1 > index2 ? 1 : 0 ));
|
||||
}
|
||||
|
||||
|
||||
#undef TT_KERN_INDEX
|
||||
|
||||
|
||||
|
@ -1750,6 +1777,7 @@
|
|||
/* */
|
||||
/* <Input> */
|
||||
/* face :: A handle to the target face object. */
|
||||
/* */
|
||||
/* stream :: A handle to the input stream. */
|
||||
/* */
|
||||
/* <Return> */
|
||||
|
@ -1759,12 +1787,12 @@
|
|||
TT_Load_Hdmx( TT_Face face,
|
||||
FT_Stream stream )
|
||||
{
|
||||
FT_Error error;
|
||||
FT_Memory memory = stream->memory;
|
||||
FT_Error error;
|
||||
FT_Memory memory = stream->memory;
|
||||
|
||||
TT_Hdmx hdmx = &face->hdmx;
|
||||
FT_Long num_glyphs;
|
||||
FT_Long record_size;
|
||||
TT_Hdmx hdmx = &face->hdmx;
|
||||
FT_Long num_glyphs;
|
||||
FT_Long record_size;
|
||||
|
||||
|
||||
hdmx->version = 0;
|
||||
|
@ -1807,7 +1835,7 @@
|
|||
FT_READ_BYTE( cur->max_width ) )
|
||||
goto Exit;
|
||||
|
||||
if ( FT_ALLOC( cur->widths, num_glyphs ) ||
|
||||
if ( FT_ALLOC( cur->widths, num_glyphs ) ||
|
||||
FT_STREAM_READ( cur->widths, num_glyphs ) )
|
||||
goto Exit;
|
||||
|
||||
|
|
|
@ -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 by */
|
||||
/* Copyright 1996-2001, 2002 by */
|
||||
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
|
||||
/* */
|
||||
/* This file is part of the FreeType project, and may only be used, */
|
||||
|
@ -42,9 +42,9 @@ FT_BEGIN_HEADER
|
|||
|
||||
FT_LOCAL( FT_Error )
|
||||
TT_Load_SFNT_HeaderRec( TT_Face face,
|
||||
FT_Stream stream,
|
||||
FT_Long face_index,
|
||||
SFNT_Header sfnt );
|
||||
FT_Stream stream,
|
||||
FT_Long face_index,
|
||||
SFNT_Header sfnt );
|
||||
|
||||
FT_LOCAL( FT_Error )
|
||||
TT_Load_Directory( TT_Face face,
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
/* Postcript name table processing for TrueType and OpenType fonts */
|
||||
/* (body). */
|
||||
/* */
|
||||
/* Copyright 1996-2001 by */
|
||||
/* Copyright 1996-2001, 2002 by */
|
||||
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
|
||||
/* */
|
||||
/* This file is part of the FreeType project, and may only be used, */
|
||||
|
@ -33,6 +33,7 @@
|
|||
|
||||
#include "sferrors.h"
|
||||
|
||||
|
||||
/*************************************************************************/
|
||||
/* */
|
||||
/* The macro FT_COMPONENT is used in trace mode. It is an implicit */
|
||||
|
@ -155,14 +156,14 @@
|
|||
Load_Format_20( TT_Face face,
|
||||
FT_Stream stream )
|
||||
{
|
||||
FT_Memory memory = stream->memory;
|
||||
FT_Error error;
|
||||
FT_Memory memory = stream->memory;
|
||||
FT_Error error;
|
||||
|
||||
FT_Int num_glyphs;
|
||||
FT_UShort num_names;
|
||||
FT_Int num_glyphs;
|
||||
FT_UShort num_names;
|
||||
|
||||
FT_UShort* glyph_indices = 0;
|
||||
FT_Char** name_strings = 0;
|
||||
FT_UShort* glyph_indices = 0;
|
||||
FT_Char** name_strings = 0;
|
||||
|
||||
|
||||
if ( FT_READ_USHORT( num_glyphs ) )
|
||||
|
@ -241,7 +242,7 @@
|
|||
|
||||
/* all right, set table fields and exit successfuly */
|
||||
{
|
||||
TT_Post_20 table = &face->postscript_names.names.format_20;
|
||||
TT_Post_20 table = &face->postscript_names.names.format_20;
|
||||
|
||||
|
||||
table->num_glyphs = (FT_UShort)num_glyphs;
|
||||
|
@ -251,7 +252,6 @@
|
|||
}
|
||||
return SFNT_Err_Ok;
|
||||
|
||||
|
||||
Fail1:
|
||||
{
|
||||
FT_UShort n;
|
||||
|
@ -292,7 +292,7 @@
|
|||
goto Exit;
|
||||
}
|
||||
|
||||
if ( FT_ALLOC ( offset_table, num_glyphs ) ||
|
||||
if ( FT_ALLOC( offset_table, num_glyphs ) ||
|
||||
FT_STREAM_READ( offset_table, num_glyphs ) )
|
||||
goto Fail;
|
||||
|
||||
|
@ -316,7 +316,7 @@
|
|||
|
||||
/* OK, set table fields and exit successfuly */
|
||||
{
|
||||
TT_Post_25 table = &face->postscript_names.names.format_25;
|
||||
TT_Post_25 table = &face->postscript_names.names.format_25;
|
||||
|
||||
|
||||
table->num_glyphs = (FT_UShort)num_glyphs;
|
||||
|
@ -380,8 +380,8 @@
|
|||
FT_LOCAL_DEF( void )
|
||||
TT_Free_Post_Names( TT_Face face )
|
||||
{
|
||||
FT_Memory memory = face->root.memory;
|
||||
TT_Post_Names names = &face->postscript_names;
|
||||
FT_Memory memory = face->root.memory;
|
||||
TT_Post_Names names = &face->postscript_names;
|
||||
|
||||
|
||||
if ( names->loaded )
|
||||
|
@ -390,8 +390,8 @@
|
|||
{
|
||||
case 0x00020000L:
|
||||
{
|
||||
TT_Post_20 table = &names->names.format_20;
|
||||
FT_UShort n;
|
||||
TT_Post_20 table = &names->names.format_20;
|
||||
FT_UShort n;
|
||||
|
||||
|
||||
FT_FREE( table->glyph_indices );
|
||||
|
@ -407,7 +407,7 @@
|
|||
|
||||
case 0x00028000L:
|
||||
{
|
||||
TT_Post_25 table = &names->names.format_25;
|
||||
TT_Post_25 table = &names->names.format_25;
|
||||
|
||||
|
||||
FT_FREE( table->offsets );
|
||||
|
@ -446,8 +446,8 @@
|
|||
FT_UInt idx,
|
||||
FT_String** PSname )
|
||||
{
|
||||
FT_Error error;
|
||||
TT_Post_Names names;
|
||||
FT_Error error;
|
||||
TT_Post_Names names;
|
||||
|
||||
#ifdef FT_CONFIG_OPTION_POSTSCRIPT_NAMES
|
||||
PSNames_Service psnames;
|
||||
|
@ -480,7 +480,7 @@
|
|||
|
||||
case 0x00020000L:
|
||||
{
|
||||
TT_Post_20 table = &names->names.format_20;
|
||||
TT_Post_20 table = &names->names.format_20;
|
||||
|
||||
|
||||
if ( !names->loaded )
|
||||
|
@ -505,7 +505,7 @@
|
|||
|
||||
case 0x00028000L:
|
||||
{
|
||||
TT_Post_25 table = &names->names.format_25;
|
||||
TT_Post_25 table = &names->names.format_25;
|
||||
|
||||
|
||||
if ( !names->loaded )
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
/* Postcript name table processing for TrueType and OpenType fonts */
|
||||
/* (specification). */
|
||||
/* */
|
||||
/* Copyright 1996-2001 by */
|
||||
/* Copyright 1996-2001, 2002 by */
|
||||
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
|
||||
/* */
|
||||
/* This file is part of the FreeType project, and may only be used, */
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
/* */
|
||||
/* TrueType and OpenType embedded bitmap support (body). */
|
||||
/* */
|
||||
/* Copyright 1996-2001 by */
|
||||
/* Copyright 1996-2001, 2002 by */
|
||||
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
|
||||
/* */
|
||||
/* This file is part of the FreeType project, and may only be used, */
|
||||
|
@ -222,8 +222,8 @@
|
|||
/* FreeType error code. 0 means success. */
|
||||
/* */
|
||||
static FT_Error
|
||||
Load_SBit_Const_Metrics( TT_SBit_Range range,
|
||||
FT_Stream stream )
|
||||
Load_SBit_Const_Metrics( TT_SBit_Range range,
|
||||
FT_Stream stream )
|
||||
{
|
||||
FT_Error error;
|
||||
|
||||
|
@ -254,9 +254,9 @@
|
|||
/* FreeType error code. 0 means success. */
|
||||
/* */
|
||||
static FT_Error
|
||||
Load_SBit_Range_Codes( TT_SBit_Range range,
|
||||
FT_Stream stream,
|
||||
FT_Bool load_offsets )
|
||||
Load_SBit_Range_Codes( TT_SBit_Range range,
|
||||
FT_Stream stream,
|
||||
FT_Bool load_offsets )
|
||||
{
|
||||
FT_Error error;
|
||||
FT_ULong count, n, size;
|
||||
|
@ -317,8 +317,8 @@
|
|||
/* FreeType error code. 0 means success. */
|
||||
/* */
|
||||
static FT_Error
|
||||
Load_SBit_Range( TT_SBit_Range range,
|
||||
FT_Stream stream )
|
||||
Load_SBit_Range( TT_SBit_Range range,
|
||||
FT_Stream stream )
|
||||
{
|
||||
FT_Error error;
|
||||
FT_Memory memory = stream->memory;
|
||||
|
@ -346,8 +346,8 @@
|
|||
|
||||
for ( n = 0; n < num_glyphs; n++ )
|
||||
range->glyph_offsets[n] = (FT_ULong)( range->image_offset +
|
||||
( large ? FT_GET_ULONG()
|
||||
: FT_GET_USHORT() ) );
|
||||
( large ? FT_GET_ULONG()
|
||||
: FT_GET_USHORT() ) );
|
||||
FT_FRAME_EXIT();
|
||||
}
|
||||
break;
|
||||
|
@ -361,8 +361,8 @@
|
|||
break;
|
||||
|
||||
case 5:
|
||||
error = Load_SBit_Const_Metrics( range, stream ) ||
|
||||
Load_SBit_Range_Codes( range, stream, 0 );
|
||||
error = Load_SBit_Const_Metrics( range, stream ) ||
|
||||
Load_SBit_Range_Codes( range, stream, 0 );
|
||||
break;
|
||||
|
||||
default:
|
||||
|
@ -485,8 +485,8 @@
|
|||
|
||||
/* now read each strike table separately */
|
||||
{
|
||||
TT_SBit_Strike strike = face->sbit_strikes;
|
||||
FT_ULong count = num_strikes;
|
||||
TT_SBit_Strike strike = face->sbit_strikes;
|
||||
FT_ULong count = num_strikes;
|
||||
|
||||
|
||||
if ( FT_FRAME_ENTER( 48L * num_strikes ) )
|
||||
|
@ -509,14 +509,14 @@
|
|||
|
||||
/* allocate the index ranges for each strike table */
|
||||
{
|
||||
TT_SBit_Strike strike = face->sbit_strikes;
|
||||
FT_ULong count = num_strikes;
|
||||
TT_SBit_Strike strike = face->sbit_strikes;
|
||||
FT_ULong count = num_strikes;
|
||||
|
||||
|
||||
while ( count > 0 )
|
||||
{
|
||||
TT_SBit_Range range;
|
||||
FT_ULong count2 = strike->num_ranges;
|
||||
TT_SBit_Range range;
|
||||
FT_ULong count2 = strike->num_ranges;
|
||||
|
||||
|
||||
if ( FT_NEW_ARRAY( strike->sbit_ranges, strike->num_ranges ) )
|
||||
|
@ -524,7 +524,7 @@
|
|||
|
||||
/* read each range */
|
||||
if ( FT_STREAM_SEEK( table_base + strike->ranges_offset ) ||
|
||||
FT_FRAME_ENTER( strike->num_ranges * 8L ) )
|
||||
FT_FRAME_ENTER( strike->num_ranges * 8L ) )
|
||||
goto Exit;
|
||||
|
||||
range = strike->sbit_ranges;
|
||||
|
@ -532,8 +532,8 @@
|
|||
{
|
||||
range->first_glyph = FT_GET_USHORT();
|
||||
range->last_glyph = FT_GET_USHORT();
|
||||
range->table_offset = table_base + strike->ranges_offset
|
||||
+ FT_GET_ULONG();
|
||||
range->table_offset = table_base + strike->ranges_offset +
|
||||
FT_GET_ULONG();
|
||||
count2--;
|
||||
range++;
|
||||
}
|
||||
|
@ -547,7 +547,7 @@
|
|||
{
|
||||
/* Read the header */
|
||||
if ( FT_STREAM_SEEK( range->table_offset ) ||
|
||||
FT_FRAME_ENTER( 8L ) )
|
||||
FT_FRAME_ENTER( 8L ) )
|
||||
goto Exit;
|
||||
|
||||
range->index_format = FT_GET_USHORT();
|
||||
|
@ -588,17 +588,17 @@
|
|||
FT_LOCAL_DEF( void )
|
||||
TT_Free_SBit_Strikes( TT_Face face )
|
||||
{
|
||||
FT_Memory memory = face->root.memory;
|
||||
TT_SBit_Strike strike = face->sbit_strikes;
|
||||
TT_SBit_Strike strike_limit = strike + face->num_sbit_strikes;
|
||||
FT_Memory memory = face->root.memory;
|
||||
TT_SBit_Strike strike = face->sbit_strikes;
|
||||
TT_SBit_Strike strike_limit = strike + face->num_sbit_strikes;
|
||||
|
||||
|
||||
if ( strike )
|
||||
{
|
||||
for ( ; strike < strike_limit; strike++ )
|
||||
{
|
||||
TT_SBit_Range range = strike->sbit_ranges;
|
||||
TT_SBit_Range range_limit = range + strike->num_ranges;
|
||||
TT_SBit_Range range = strike->sbit_ranges;
|
||||
TT_SBit_Range range_limit = range + strike->num_ranges;
|
||||
|
||||
|
||||
if ( range )
|
||||
|
@ -635,8 +635,8 @@
|
|||
|
||||
for ( i = 0; i < face->num_sbit_strikes; i++ )
|
||||
{
|
||||
if ( ( face->sbit_strikes[i].y_ppem == y_ppem ) &&
|
||||
( ( x_ppem == 0 ) ||
|
||||
if ( ( face->sbit_strikes[i].y_ppem == y_ppem ) &&
|
||||
( ( x_ppem == 0 ) ||
|
||||
( face->sbit_strikes[i].x_ppem == x_ppem ) ) )
|
||||
{
|
||||
*astrike_index = i;
|
||||
|
@ -673,8 +673,8 @@
|
|||
static FT_Error
|
||||
Find_SBit_Range( FT_UInt glyph_index,
|
||||
TT_SBit_Strike strike,
|
||||
TT_SBit_Range * arange,
|
||||
FT_ULong* aglyph_offset )
|
||||
TT_SBit_Range *arange,
|
||||
FT_ULong *aglyph_offset )
|
||||
{
|
||||
TT_SBit_RangeRec *range, *range_limit;
|
||||
|
||||
|
@ -731,12 +731,12 @@
|
|||
}
|
||||
}
|
||||
|
||||
/* fall-through */
|
||||
default:
|
||||
goto Fail;
|
||||
/* fall-through */
|
||||
default:
|
||||
goto Fail;
|
||||
}
|
||||
|
||||
Found:
|
||||
Found:
|
||||
/* return successfully! */
|
||||
*arange = range;
|
||||
return 0;
|
||||
|
@ -780,18 +780,18 @@
|
|||
/* glyph. */
|
||||
/* */
|
||||
static FT_Error
|
||||
Find_SBit_Image( TT_Face face,
|
||||
FT_UInt glyph_index,
|
||||
FT_ULong strike_index,
|
||||
TT_SBit_Range *arange,
|
||||
TT_SBit_Strike *astrike,
|
||||
FT_ULong *aglyph_offset )
|
||||
Find_SBit_Image( TT_Face face,
|
||||
FT_UInt glyph_index,
|
||||
FT_ULong strike_index,
|
||||
TT_SBit_Range *arange,
|
||||
TT_SBit_Strike *astrike,
|
||||
FT_ULong *aglyph_offset )
|
||||
{
|
||||
FT_Error error;
|
||||
TT_SBit_Strike strike;
|
||||
FT_Error error;
|
||||
TT_SBit_Strike strike;
|
||||
|
||||
|
||||
if ( !face->sbit_strikes ||
|
||||
if ( !face->sbit_strikes ||
|
||||
( face->num_sbit_strikes <= (FT_Int)strike_index ) )
|
||||
goto Fail;
|
||||
|
||||
|
@ -844,9 +844,9 @@
|
|||
/* function exit. */
|
||||
/* */
|
||||
static FT_Error
|
||||
Load_SBit_Metrics( FT_Stream stream,
|
||||
TT_SBit_Range range,
|
||||
TT_SBit_Metrics metrics )
|
||||
Load_SBit_Metrics( FT_Stream stream,
|
||||
TT_SBit_Range range,
|
||||
TT_SBit_Metrics metrics )
|
||||
{
|
||||
FT_Error error = SFNT_Err_Ok;
|
||||
|
||||
|
@ -930,8 +930,8 @@
|
|||
/* metrics :: The corresponding metrics structure. */
|
||||
/* */
|
||||
static void
|
||||
Crop_Bitmap( FT_Bitmap* map,
|
||||
TT_SBit_Metrics metrics )
|
||||
Crop_Bitmap( FT_Bitmap* map,
|
||||
TT_SBit_Metrics metrics )
|
||||
{
|
||||
/***********************************************************************/
|
||||
/* */
|
||||
|
@ -991,7 +991,7 @@
|
|||
line = (FT_Byte*)map->buffer;
|
||||
|
||||
FT_MEM_MOVE( line, line + count * line_len,
|
||||
( rows - count ) * line_len );
|
||||
( rows - count ) * line_len );
|
||||
|
||||
metrics->height = (FT_Byte)( metrics->height - count );
|
||||
metrics->horiBearingY = (FT_Char)( metrics->horiBearingY - count );
|
||||
|
@ -1121,13 +1121,13 @@
|
|||
|
||||
|
||||
static FT_Error
|
||||
Load_SBit_Single( FT_Bitmap* map,
|
||||
FT_Int x_offset,
|
||||
FT_Int y_offset,
|
||||
FT_Int pix_bits,
|
||||
FT_UShort image_format,
|
||||
TT_SBit_Metrics metrics,
|
||||
FT_Stream stream )
|
||||
Load_SBit_Single( FT_Bitmap* map,
|
||||
FT_Int x_offset,
|
||||
FT_Int y_offset,
|
||||
FT_Int pix_bits,
|
||||
FT_UShort image_format,
|
||||
TT_SBit_Metrics metrics,
|
||||
FT_Stream stream )
|
||||
{
|
||||
FT_Error error;
|
||||
|
||||
|
@ -1142,11 +1142,11 @@
|
|||
}
|
||||
|
||||
{
|
||||
FT_Int glyph_width = metrics->width;
|
||||
FT_Int glyph_height = metrics->height;
|
||||
FT_Int glyph_size;
|
||||
FT_Int line_bits = pix_bits * glyph_width;
|
||||
FT_Bool pad_bytes = 0;
|
||||
FT_Int glyph_width = metrics->width;
|
||||
FT_Int glyph_height = metrics->height;
|
||||
FT_Int glyph_size;
|
||||
FT_Int line_bits = pix_bits * glyph_width;
|
||||
FT_Bool pad_bytes = 0;
|
||||
|
||||
|
||||
/* compute size of glyph image */
|
||||
|
@ -1160,10 +1160,17 @@
|
|||
|
||||
switch ( pix_bits )
|
||||
{
|
||||
case 1: line_length = ( glyph_width + 7 ) >> 3; break;
|
||||
case 2: line_length = ( glyph_width + 3 ) >> 2; break;
|
||||
case 4: line_length = ( glyph_width + 1 ) >> 1; break;
|
||||
default: line_length = glyph_width;
|
||||
case 1:
|
||||
line_length = ( glyph_width + 7 ) >> 3;
|
||||
break;
|
||||
case 2:
|
||||
line_length = ( glyph_width + 3 ) >> 2;
|
||||
break;
|
||||
case 4:
|
||||
line_length = ( glyph_width + 1 ) >> 1;
|
||||
break;
|
||||
default:
|
||||
line_length = glyph_width;
|
||||
}
|
||||
|
||||
glyph_size = glyph_height * line_length;
|
||||
|
@ -1201,15 +1208,15 @@
|
|||
|
||||
|
||||
static FT_Error
|
||||
Load_SBit_Image( TT_SBit_Strike strike,
|
||||
TT_SBit_Range range,
|
||||
FT_ULong ebdt_pos,
|
||||
FT_ULong glyph_offset,
|
||||
FT_Bitmap* map,
|
||||
FT_Int x_offset,
|
||||
FT_Int y_offset,
|
||||
FT_Stream stream,
|
||||
TT_SBit_Metrics metrics )
|
||||
Load_SBit_Image( TT_SBit_Strike strike,
|
||||
TT_SBit_Range range,
|
||||
FT_ULong ebdt_pos,
|
||||
FT_ULong glyph_offset,
|
||||
FT_Bitmap* map,
|
||||
FT_Int x_offset,
|
||||
FT_Int y_offset,
|
||||
FT_Stream stream,
|
||||
TT_SBit_Metrics metrics )
|
||||
{
|
||||
FT_Memory memory = stream->memory;
|
||||
FT_Error error;
|
||||
|
@ -1295,9 +1302,9 @@
|
|||
/* All right, we have a compound format. First of all, read */
|
||||
/* the array of elements. */
|
||||
{
|
||||
TT_SBit_Component components;
|
||||
TT_SBit_Component comp;
|
||||
FT_UShort num_components, count;
|
||||
TT_SBit_Component components;
|
||||
TT_SBit_Component comp;
|
||||
FT_UShort num_components, count;
|
||||
|
||||
|
||||
if ( FT_READ_USHORT( num_components ) ||
|
||||
|
@ -1323,9 +1330,9 @@
|
|||
comp = components;
|
||||
for ( ; count > 0; count--, comp++ )
|
||||
{
|
||||
TT_SBit_Range elem_range;
|
||||
TT_SBit_Range elem_range;
|
||||
TT_SBit_MetricsRec elem_metrics;
|
||||
FT_ULong elem_offset;
|
||||
FT_ULong elem_offset;
|
||||
|
||||
|
||||
/* find the range for this element */
|
||||
|
@ -1393,20 +1400,20 @@
|
|||
/* The `map.buffer' field is always freed before the glyph is loaded. */
|
||||
/* */
|
||||
FT_LOCAL_DEF( FT_Error )
|
||||
TT_Load_SBit_Image( TT_Face face,
|
||||
FT_ULong strike_index,
|
||||
FT_UInt glyph_index,
|
||||
FT_UInt load_flags,
|
||||
FT_Stream stream,
|
||||
FT_Bitmap *map,
|
||||
TT_Load_SBit_Image( TT_Face face,
|
||||
FT_ULong strike_index,
|
||||
FT_UInt glyph_index,
|
||||
FT_UInt load_flags,
|
||||
FT_Stream stream,
|
||||
FT_Bitmap *map,
|
||||
TT_SBit_MetricsRec *metrics )
|
||||
{
|
||||
FT_Error error;
|
||||
FT_Memory memory = stream->memory;
|
||||
FT_ULong ebdt_pos, glyph_offset;
|
||||
FT_Error error;
|
||||
FT_Memory memory = stream->memory;
|
||||
FT_ULong ebdt_pos, glyph_offset;
|
||||
|
||||
TT_SBit_Strike strike;
|
||||
TT_SBit_Range range;
|
||||
TT_SBit_Strike strike;
|
||||
TT_SBit_Range range;
|
||||
|
||||
|
||||
/* Check whether there is a glyph sbit for the current index */
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
/* */
|
||||
/* TrueType and OpenType embedded bitmap support (specification). */
|
||||
/* */
|
||||
/* Copyright 1996-2001 by */
|
||||
/* Copyright 1996-2001, 2002 by */
|
||||
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
|
||||
/* */
|
||||
/* This file is part of the FreeType project, and may only be used, */
|
||||
|
@ -42,12 +42,12 @@ FT_BEGIN_HEADER
|
|||
FT_ULong *astrike_index );
|
||||
|
||||
FT_LOCAL( FT_Error )
|
||||
TT_Load_SBit_Image( TT_Face face,
|
||||
FT_ULong strike_index,
|
||||
FT_UInt glyph_index,
|
||||
FT_UInt load_flags,
|
||||
FT_Stream stream,
|
||||
FT_Bitmap *map,
|
||||
TT_Load_SBit_Image( TT_Face face,
|
||||
FT_ULong strike_index,
|
||||
FT_UInt glyph_index,
|
||||
FT_UInt load_flags,
|
||||
FT_Stream stream,
|
||||
FT_Bitmap *map,
|
||||
TT_SBit_MetricsRec *metrics );
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue