* src/cache/ftccmap.c: the cmap cache now supports UCS-4 charmaps

when available in Asian fonts

    * src/sfnt/ttload.c, src/base/ftobjs.c: changed "asian" to "Asian" in
    comments

    * src/truetype/ttdriver.c (Set_Char_Sizes): fixed a rounding bug when
    computing the scale factors for a given character size in points with
    resolution.
This commit is contained in:
David Turner 2003-02-25 20:37:50 +00:00
parent fd37c4b8ac
commit 0ba973dadf
5 changed files with 68 additions and 12 deletions

View File

@ -1,27 +1,38 @@
2003-02-25 Anthony Fok <anthony@thizlinux.com>
* src/cache/ftccmap.c: the cmap cache now supports UCS-4 charmaps
when available in Asian fonts
* src/sfnt/ttload.c, src/base/ftobjs.c: changed "asian" to "Asian" in
comments
2003-02-25 David Turner <david@freetype.org>
* src/gzip/ftgzip.c: fixed a bug that caused FreeType to loop endlessly
when trying to read certain compressed gzip files. The following test
could be used to reveal the bug:
touch 0123456789 ; gzip 0123456789 ; ftdump 0123456789.gz
* src/pfr/pfrobjs.c, src/pfr/pfrload.c, src/pfr/pfrtypes.h: several
fixes to the PFR font driver:
- the list of available embedded bitmaps was not correctly set
in the root FT_FaceRec structure describing the face
- the glyph loader always tried to load the outlines when
FT_LOAD_SBITS_ONLY was specified
- the table loaded now scans for *undocumented* elements of a
physical font's auxiliary data record, this is necessary to
retrieve the "real" family and style names.
NOTE THAT THIS CHANGES THE FAMILY NAME OF MANY PFR FONTS !!
* src/truetype/ttdriver.c (Set_Char_Sizes): fixed a rounding bug when
computing the scale factors for a given character size in points with
resolution.
2003-02-18 David Turner <david@freetype.org>

View File

@ -739,7 +739,7 @@
* however, recent updates to the Apple and OpenType specifications
* introduced new formats that are capable of mapping 32-bit character
* codes as well. And these are already used on some fonts, mainly to
* map non-BMP asian ideographs as defined in Unicode.
* map non-BMP Asian ideographs as defined in Unicode.
*
* for compatibility purposes, these fonts generally come with
* *several* Unicode charmaps:

51
src/cache/ftccmap.c vendored
View File

@ -23,6 +23,7 @@
#include FT_CACHE_MANAGER_H
#include FT_INTERNAL_MEMORY_H
#include FT_INTERNAL_DEBUG_H
#include FT_TRUETYPE_IDS_H
#include "ftcerror.h"
@ -189,10 +190,54 @@
break;
case FTC_CMAP_BY_ENCODING:
for ( idx = 0; idx < count; idx++, cur++ )
if ( cur[0]->encoding == desc->u.encoding )
break;
if (desc->u.encoding == FT_ENCODING_UNICODE)
{
/* since the `interesting' table, with id's 3,10, is normally the
* last one, we loop backwards. This looses with type1 fonts with
* non-BMP characters (<.0001%), this wins with .ttf with non-BMP
* chars (.01% ?), and this is the same about 99.99% of the time!
*/
FT_UInt unicmap_idx = count; /* some UCS-2 map, if we found it */
cur += count - 1;
for ( idx = 0; idx < count; idx++, cur-- )
{
if ( cur[0]->encoding == FT_ENCODING_UNICODE )
{
unicmap_idx = idx; /* record we found a Unicode charmap */
/* XXX If some new encodings to represent UCS-4 are added,
* they should be added here.
*/
if ( ( cur[0]->platform_id == TT_PLATFORM_MICROSOFT &&
cur[0]->encoding_id == TT_MS_ID_UCS_4 ) ||
( cur[0]->platform_id == TT_PLATFORM_APPLE_UNICODE &&
cur[0]->encoding_id == TT_APPLE_ID_UNICODE_32 ) )
/* Hurray! We found a UCS-4 charmap. We can stop the scan! */
{
idx = count - 1 - idx;
goto Found_idx_for_FTC_CMAP_BY_ENCODING;
}
}
}
/* We do not have any UCS-4 charmap. Sigh.
* Let's see if we have some other kind of Unicode charmap, though.
*/
if ( unicmap_idx < count )
idx = count - 1 - unicmap_idx;
}
else
{
for ( idx = 0; idx < count; idx++, cur++ )
if ( cur[0]->encoding == desc->u.encoding )
break;
}
Found_idx_for_FTC_CMAP_BY_ENCODING:
hash = idx * 67;
break;

View File

@ -1106,7 +1106,7 @@
if ( FT_STREAM_READ_FIELDS( name_table_fields, table ) )
goto Exit;
/* Some popular asian fonts have an invalid `storageOffset' value */
/* Some popular Asian fonts have an invalid `storageOffset' value */
/* (it should be at least "6 + 12*num_names"). However, the string */
/* offsets, computed as "storageOffset + entry->stringOffset", are */
/* valid pointers within the name table... */

View File

@ -208,8 +208,8 @@
/* we need to use rounding in the following computations. Otherwise,
* the resulting hinted outlines will be very slightly distorted
*/
dim_x = ( ( ( char_width * horz_resolution ) / 72 ) + 32 ) & -64;
dim_y = ( ( ( char_height * vert_resolution ) / 72 ) + 32 ) & -64;
dim_x = ( char_width * horz_resolution + 36 ) / 72;
dim_y = ( char_height * vert_resolution + 36 ) / 72;
metrics2->x_ppem = (FT_UShort)( dim_x >> 6 );
metrics2->y_ppem = (FT_UShort)( dim_y >> 6 );