2018-06-03 09:01:17 +02:00
|
|
|
/****************************************************************************
|
|
|
|
*
|
|
|
|
* psmodule.c
|
|
|
|
*
|
2018-09-03 09:08:47 +02:00
|
|
|
* psnames module implementation (body).
|
2018-06-03 09:01:17 +02:00
|
|
|
*
|
|
|
|
* Copyright 1996-2018 by
|
|
|
|
* 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-06-25 08:47:11 +02:00
|
|
|
|
2000-12-08 17:17:16 +01:00
|
|
|
|
2000-12-08 03:42:29 +01:00
|
|
|
#include <ft2build.h>
|
2013-03-14 10:27:35 +01:00
|
|
|
#include FT_INTERNAL_DEBUG_H
|
2000-12-08 03:42:29 +01:00
|
|
|
#include FT_INTERNAL_OBJECTS_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
|
|
|
|
2001-03-20 12:14:24 +01:00
|
|
|
#include "psmodule.h"
|
2016-12-28 22:23:33 +01:00
|
|
|
|
2017-08-09 07:45:12 +02:00
|
|
|
/*
|
2018-06-03 09:01:17 +02:00
|
|
|
* The file `pstables.h' with its arrays and its function
|
|
|
|
* `ft_get_adobe_glyph_index' is useful for other projects also (for
|
|
|
|
* example, `pdfium' is using it). However, if used as a C++ header,
|
|
|
|
* including it in two different source files makes it necessary to use
|
|
|
|
* `extern const' for the declaration of its arrays, otherwise the data
|
|
|
|
* would be duplicated as mandated by the C++ standard.
|
2017-08-09 07:45:12 +02:00
|
|
|
*
|
2018-06-03 09:01:17 +02:00
|
|
|
* For this reason, we use `DEFINE_PS_TABLES' to guard the function
|
|
|
|
* definitions, and `DEFINE_PS_TABLES_DATA' to provide both proper array
|
|
|
|
* declarations and definitions.
|
2017-08-09 07:45:12 +02:00
|
|
|
*/
|
2017-01-03 00:27:07 +01:00
|
|
|
#include "pstables.h"
|
2016-12-28 22:23:33 +01:00
|
|
|
#define DEFINE_PS_TABLES
|
2017-08-09 07:45:12 +02:00
|
|
|
#define DEFINE_PS_TABLES_DATA
|
2001-03-20 12:14:24 +01:00
|
|
|
#include "pstables.h"
|
2000-12-08 17:17:16 +01: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
|
|
|
#include "psnamerr.h"
|
|
|
|
|
2000-06-22 02:27:15 +02:00
|
|
|
|
2007-08-03 00:03:30 +02:00
|
|
|
#ifdef FT_CONFIG_OPTION_POSTSCRIPT_NAMES
|
2000-06-22 02:27:15 +02:00
|
|
|
|
2000-06-25 08:47:11 +02:00
|
|
|
|
2000-06-22 02:27:15 +02:00
|
|
|
#ifdef FT_CONFIG_OPTION_ADOBE_GLYPH_LIST
|
2000-06-25 08:47:11 +02:00
|
|
|
|
|
|
|
|
2007-05-15 08:49:37 +02:00
|
|
|
#define VARIANT_BIT 0x80000000UL
|
2009-07-31 17:30:17 +02:00
|
|
|
#define BASE_GLYPH( code ) ( (FT_UInt32)( (code) & ~VARIANT_BIT ) )
|
2006-01-11 11:08:49 +01:00
|
|
|
|
|
|
|
|
2005-03-10 07:28:07 +01:00
|
|
|
/* Return the Unicode value corresponding to a given glyph. Note that */
|
2000-06-25 08:47:11 +02:00
|
|
|
/* we do deal with glyph variants by detecting a non-initial dot in */
|
2006-01-11 11:08:49 +01:00
|
|
|
/* the name, as in `A.swash' or `e.final'; in this case, the */
|
|
|
|
/* VARIANT_BIT is set in the return value. */
|
2000-06-25 08:47:11 +02:00
|
|
|
/* */
|
* src/sfnt/ttpost.c (load_post_names, tt_face_free_ps_names,
tt_face_get_ps_name): Replace switch statement with if clauses to
make it more portable.
* src/cff/cffobjs.c (cff_face_init): Ditto.
* include/freetype/ftmodule.h (FT_Module_Class): Use `FT_Long' for
`module_size'.
* include/freetype/ftrender.h (FT_Glyph_Class_): Use `FT_Long' for
`glyph_size'.
* src/base/ftobjs.c (FT_Render_Glyph): Change second parameter to
`FT_Render_Mode'.
(FT_Render_Glyph_Internal): Change third parameter to
`FT_Render_Mode'.
* src/base/ftglyph.c (FT_Glyph_To_Bitmap): Change second parameter
to `FT_Render_Mode'.
* src/raster/ftrend1.c (ft_raster1_render): Change third parameter
to `FT_Render_Mode'.
* src/smooth/ftsmooth.c (ft_smooth_render, ft_smooth_render_lcd,
ft_smooth_render_lcd_v): Ditto.
(ft_smooth_render_generic): Change third and fifth parameter to
`FT_Render_Mode'.
* include/freetype/freetype.h, include/freetype/internal/ftobjs.h,
include/freetype/ftglyph.h: Updated.
* src/cff/cffdrivr.c (Load_Glyph), src/pcf/pcfdriver.c
(PCF_Glyph_Load), src/pfr/pfrobjs.c (pfr_slot_load),
src/winfonts/winfnt.c (FNT_Load_Glyph), src/t42/t42objs.c
(T42_GlyphSlot_Load), src/bdf/bdfdrivr.c (BDF_Glyph_Load): Change
fourth parameter to `FT_Int32'.
* src/pfr/pfrobjs.c (pfr_face_init): Add two missing parameters
and declare them as unused.
* src/cid/cidparse.h (CID_Parser): Use FT_Long for `postscript_len'.
* src/psnames/psnames.h (PS_Unicode_Value_Func): Change return
value to FT_UInt32.
* src/psnames/psmodule.c (ps_unicode_value, ps_build_unicode_table):
Updated accordingly.
* src/cff/cffdrivr.c (Get_Kerning): Use FT_Long for `middle'.
(cff_get_glyph_name): Use cast for result of ft_strlen.
* src/cff/cffparse.c (cff_parse_real): User cast for assigning
`exp'.
* src/cff/cffload.c (cff_index_get_pointers): Use FT_ULong for
some local variables.
(cff_charset_load, cff_encoding_load): Use casts to FT_UInt for some
switch statements.
(cff_font_load): Use cast in call to CFF_Load_FD_Select.
* src/cff/cffobjs.c (cff_size_init): Use more casts.
(cff_face_init): Use FT_Int32 for `flags'.
* src/cff/cffgload.c (cff_operator_seac): Use cast for assigning
`adx' and `ady'.
(cff_decoder_parse_charstrings): Use FT_ULong for third parameter.
Use more casts.
* src/cff/cffcmap.c (cff_cmap_unicode_init): Use cast for `count'.
* src/cid/cidload.c (cid_read_subrs): Use FT_ULong for `len'.
* src/cid/cidgload.c (cid_load_glyph): Add missing cast for
`cid_get_offset'.
* src/psaux/t1decode.c (t1_decoder_parse_charstrings) <18>: Use
cast for `num_points'.
(t1_decoder_init): Use cast for assigning `decoder->num_glyphs'.
* src/base/ftdebug.c (ft_debug_init): Use FT_Int.
* include/freetype/internal/ftdriver.h (FT_Slot_LoadFunc): Use
`FT_Int32' for fourth parameter.
* src/base/ftobjs.c (open_face): Use cast for calling
clazz->init_face.
* src/raster/ftraster.c (Set_High_Precision): Use `1' instead of
`1L'.
(Finalize_Profile_Table, Line_Up, ft_black_init): Use casts.
* src/raster/ftrend1.c (ft_raster1_render): Ditto.
* src/sfnt/sfnt_dir_check: Compare `magic' with unsigned long
constant.
* builds/amiga/include/freetype/config/ftmodule.h: Updated.
2002-09-27 13:09:23 +02:00
|
|
|
static FT_UInt32
|
* 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
|
|
|
ps_unicode_value( const char* glyph_name )
|
2000-06-22 02:27:15 +02:00
|
|
|
{
|
2003-06-20 09:33:20 +02:00
|
|
|
/* If the name begins with `uni', then the glyph name may be a */
|
2000-06-25 08:47:11 +02:00
|
|
|
/* hard-coded unicode character code. */
|
2000-06-22 02:27:15 +02:00
|
|
|
if ( glyph_name[0] == 'u' &&
|
|
|
|
glyph_name[1] == 'n' &&
|
|
|
|
glyph_name[2] == 'i' )
|
|
|
|
{
|
2000-07-01 16:06:46 +02:00
|
|
|
/* determine whether the next four characters following are */
|
|
|
|
/* hexadecimal. */
|
|
|
|
|
|
|
|
/* XXX: Add code to deal with ligatures, i.e. glyph names like */
|
|
|
|
/* `uniXXXXYYYYZZZZ'... */
|
|
|
|
|
2000-06-25 08:47:11 +02:00
|
|
|
FT_Int count;
|
2009-07-31 17:30:17 +02:00
|
|
|
FT_UInt32 value = 0;
|
2001-10-05 11:42:50 +02:00
|
|
|
const char* p = glyph_name + 3;
|
2000-06-25 08:47:11 +02:00
|
|
|
|
2000-06-22 02:27:15 +02:00
|
|
|
|
2000-06-25 08:47:11 +02:00
|
|
|
for ( count = 4; count > 0; count--, p++ )
|
2000-06-22 02:27:15 +02:00
|
|
|
{
|
2001-12-05 02:22:05 +01:00
|
|
|
char c = *p;
|
|
|
|
unsigned int d;
|
2000-06-22 02:27:15 +02:00
|
|
|
|
2000-06-25 08:47:11 +02:00
|
|
|
|
|
|
|
d = (unsigned char)c - '0';
|
|
|
|
if ( d >= 10 )
|
2000-06-22 02:27:15 +02:00
|
|
|
{
|
|
|
|
d = (unsigned char)c - 'A';
|
|
|
|
if ( d >= 6 )
|
|
|
|
d = 16;
|
|
|
|
else
|
|
|
|
d += 10;
|
|
|
|
}
|
2000-07-01 16:06:46 +02:00
|
|
|
|
2006-01-11 11:08:49 +01:00
|
|
|
/* Exit if a non-uppercase hexadecimal character was found */
|
|
|
|
/* -- this also catches character codes below `0' since such */
|
|
|
|
/* negative numbers cast to `unsigned int' are far too big. */
|
2000-06-25 08:47:11 +02:00
|
|
|
if ( d >= 16 )
|
2000-06-22 02:27:15 +02:00
|
|
|
break;
|
|
|
|
|
2000-06-25 08:47:11 +02:00
|
|
|
value = ( value << 4 ) + d;
|
2000-06-22 02:27:15 +02:00
|
|
|
}
|
2003-06-20 09:33:20 +02:00
|
|
|
|
|
|
|
/* there must be exactly four hex digits */
|
2006-01-11 11:08:49 +01:00
|
|
|
if ( count == 0 )
|
|
|
|
{
|
|
|
|
if ( *p == '\0' )
|
|
|
|
return value;
|
|
|
|
if ( *p == '.' )
|
2009-07-31 17:30:17 +02:00
|
|
|
return (FT_UInt32)( value | VARIANT_BIT );
|
2006-01-11 11:08:49 +01:00
|
|
|
}
|
2003-06-20 09:33:20 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
/* If the name begins with `u', followed by four to six uppercase */
|
2007-01-26 23:18:56 +01:00
|
|
|
/* hexadecimal digits, it is a hard-coded unicode character code. */
|
2003-06-20 09:33:20 +02:00
|
|
|
if ( glyph_name[0] == 'u' )
|
|
|
|
{
|
|
|
|
FT_Int count;
|
2009-07-31 17:30:17 +02:00
|
|
|
FT_UInt32 value = 0;
|
2003-06-20 09:33:20 +02:00
|
|
|
const char* p = glyph_name + 1;
|
|
|
|
|
|
|
|
|
|
|
|
for ( count = 6; count > 0; count--, p++ )
|
|
|
|
{
|
|
|
|
char c = *p;
|
|
|
|
unsigned int d;
|
|
|
|
|
|
|
|
|
|
|
|
d = (unsigned char)c - '0';
|
|
|
|
if ( d >= 10 )
|
|
|
|
{
|
|
|
|
d = (unsigned char)c - 'A';
|
|
|
|
if ( d >= 6 )
|
|
|
|
d = 16;
|
|
|
|
else
|
|
|
|
d += 10;
|
|
|
|
}
|
|
|
|
|
|
|
|
if ( d >= 16 )
|
|
|
|
break;
|
|
|
|
|
|
|
|
value = ( value << 4 ) + d;
|
|
|
|
}
|
|
|
|
|
2006-01-11 11:08:49 +01:00
|
|
|
if ( count <= 2 )
|
|
|
|
{
|
|
|
|
if ( *p == '\0' )
|
|
|
|
return value;
|
|
|
|
if ( *p == '.' )
|
2009-07-31 17:30:17 +02:00
|
|
|
return (FT_UInt32)( value | VARIANT_BIT );
|
2006-01-11 11:08:49 +01:00
|
|
|
}
|
2000-06-22 02:27:15 +02:00
|
|
|
}
|
|
|
|
|
2006-01-11 11:08:49 +01:00
|
|
|
/* Look for a non-initial dot in the glyph name in order to */
|
|
|
|
/* find variants like `A.swash', `e.final', etc. */
|
2000-06-22 02:27:15 +02:00
|
|
|
{
|
2005-03-09 18:33:03 +01:00
|
|
|
const char* p = glyph_name;
|
|
|
|
const char* dot = NULL;
|
2000-06-25 08:47:11 +02:00
|
|
|
|
2000-07-01 16:06:46 +02:00
|
|
|
|
2005-03-09 18:33:03 +01:00
|
|
|
for ( ; *p; p++ )
|
2000-06-22 02:27:15 +02:00
|
|
|
{
|
2006-01-11 11:08:49 +01:00
|
|
|
if ( *p == '.' && p > glyph_name )
|
|
|
|
{
|
2005-03-09 18:33:03 +01:00
|
|
|
dot = p;
|
2006-01-11 11:08:49 +01:00
|
|
|
break;
|
|
|
|
}
|
2000-06-22 02:27:15 +02:00
|
|
|
}
|
|
|
|
|
2006-01-11 11:08:49 +01:00
|
|
|
/* now look up the glyph in the Adobe Glyph List */
|
2005-03-09 18:33:03 +01:00
|
|
|
if ( !dot )
|
2009-07-31 17:30:17 +02:00
|
|
|
return (FT_UInt32)ft_get_adobe_glyph_index( glyph_name, p );
|
2006-01-11 11:08:49 +01:00
|
|
|
else
|
2009-07-31 17:30:17 +02:00
|
|
|
return (FT_UInt32)( ft_get_adobe_glyph_index( glyph_name, dot ) |
|
|
|
|
VARIANT_BIT );
|
2000-06-22 02:27:15 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
* README.UNX: updated the Unix-specific quick-compilation guide to
warn about the GNU Make requirement at compile time..
* include/freetype/config/ftstdlib.h,
include/freetype/config/ftconfig.h,
include/freetype/config/ftheader.h,
include/freetype/internal/ftmemory.h,
include/freetype/internal/ftobjs.h,
src/autohint/ahoptim.c,
src/base/ftdbgmem.c, src/base/ftdebug.c,
src/base/ftmac.c, src/base/ftobjs.c,
src/base/ftsystem.c,
src/cache/ftcimage.c, src/cache/ftcsbits.c,
src/cff/cffdriver.c, src/cff/cffload.c, src/cff/cffobjs.c,
src/cid/cidload.c, src/cid/cidparse.c, src/cid/cidriver.c,
src/pcf/pcfdriver.c, src/pcf/pcfread.c,
src/psaux/t1cmap.c, src/psaux/t1decode.c,
src/pshinter/pshalgo1.c, src/pshinter/pshalgo2.c,
src/pshinter/pshrec.c,
src/psnames/psmodule.c,
src/raster/ftraster.c,
src/sfnt/sfdriver.c, src/sfnt/ttload.c, src/sfnt/ttpost.c,
src/smooth/ftgrays.c,
src/type1/t1afm.c, src/type1/t1driver.c, src/type1/t1gload.c,
src/type1/t1load.c, src/type1/t1objs.c, src/type1/t1parse.c:
added the new configuration file "ftstdlib.h" used to define
aliases for all ISO C library functions used by the engine
(e.g. strlen, qsort, setjmp, etc...)
this eases the porting of FreeType 2 to exotic environments like
XFree86 modules/extensions..
also removed many #include <string.h>, #include <stdlib.h>, etc...
from the engine's sources where they're not needed..
2002-04-12 11:31:48 +02:00
|
|
|
/* ft_qsort callback to sort the unicode map */
|
2001-06-28 01:25:46 +02:00
|
|
|
FT_CALLBACK_DEF( int )
|
2001-06-27 11:26:46 +02:00
|
|
|
compare_uni_maps( const void* a,
|
|
|
|
const void* b )
|
2000-06-22 02:27:15 +02:00
|
|
|
{
|
|
|
|
PS_UniMap* map1 = (PS_UniMap*)a;
|
|
|
|
PS_UniMap* map2 = (PS_UniMap*)b;
|
2006-01-11 11:08:49 +01:00
|
|
|
FT_UInt32 unicode1 = BASE_GLYPH( map1->unicode );
|
|
|
|
FT_UInt32 unicode2 = BASE_GLYPH( map2->unicode );
|
2000-06-22 02:27:15 +02:00
|
|
|
|
2000-06-25 08:47:11 +02:00
|
|
|
|
2006-01-11 11:08:49 +01:00
|
|
|
/* sort base glyphs before glyph variants */
|
|
|
|
if ( unicode1 == unicode2 )
|
2008-08-23 21:54:06 +02:00
|
|
|
{
|
|
|
|
if ( map1->unicode > map2->unicode )
|
|
|
|
return 1;
|
|
|
|
else if ( map1->unicode < map2->unicode )
|
|
|
|
return -1;
|
|
|
|
else
|
|
|
|
return 0;
|
|
|
|
}
|
2006-01-11 11:08:49 +01:00
|
|
|
else
|
2008-08-23 21:54:06 +02:00
|
|
|
{
|
|
|
|
if ( unicode1 > unicode2 )
|
|
|
|
return 1;
|
|
|
|
else if ( unicode1 < unicode2 )
|
|
|
|
return -1;
|
|
|
|
else
|
|
|
|
return 0;
|
|
|
|
}
|
2000-06-22 02:27:15 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2008-07-27 07:43:59 +02:00
|
|
|
/* support for extra glyphs not handled (well) in AGL; */
|
|
|
|
/* we add extra mappings for them if necessary */
|
2008-05-17 12:01:45 +02:00
|
|
|
|
2008-07-27 07:43:59 +02:00
|
|
|
#define EXTRA_GLYPH_LIST_SIZE 10
|
2008-05-17 12:01:45 +02:00
|
|
|
|
2008-07-27 07:43:59 +02:00
|
|
|
static const FT_UInt32 ft_extra_glyph_unicodes[EXTRA_GLYPH_LIST_SIZE] =
|
2008-05-17 12:01:45 +02:00
|
|
|
{
|
2008-07-27 07:43:59 +02:00
|
|
|
/* WGL 4 */
|
2008-05-17 12:01:45 +02:00
|
|
|
0x0394,
|
|
|
|
0x03A9,
|
|
|
|
0x2215,
|
|
|
|
0x00AD,
|
|
|
|
0x02C9,
|
|
|
|
0x03BC,
|
|
|
|
0x2219,
|
2008-07-27 07:43:59 +02:00
|
|
|
0x00A0,
|
|
|
|
/* Romanian */
|
|
|
|
0x021A,
|
|
|
|
0x021B
|
2008-05-17 12:01:45 +02:00
|
|
|
};
|
|
|
|
|
2008-07-27 07:43:59 +02:00
|
|
|
static const char ft_extra_glyph_names[] =
|
2008-05-17 12:01:45 +02:00
|
|
|
{
|
|
|
|
'D','e','l','t','a',0,
|
|
|
|
'O','m','e','g','a',0,
|
|
|
|
'f','r','a','c','t','i','o','n',0,
|
|
|
|
'h','y','p','h','e','n',0,
|
|
|
|
'm','a','c','r','o','n',0,
|
|
|
|
'm','u',0,
|
|
|
|
'p','e','r','i','o','d','c','e','n','t','e','r','e','d',0,
|
2008-07-27 07:43:59 +02:00
|
|
|
's','p','a','c','e',0,
|
|
|
|
'T','c','o','m','m','a','a','c','c','e','n','t',0,
|
|
|
|
't','c','o','m','m','a','a','c','c','e','n','t',0
|
2008-05-17 12:01:45 +02:00
|
|
|
};
|
|
|
|
|
2008-05-18 16:08:57 +02:00
|
|
|
static const FT_Int
|
2008-07-27 07:43:59 +02:00
|
|
|
ft_extra_glyph_name_offsets[EXTRA_GLYPH_LIST_SIZE] =
|
2008-05-17 12:01:45 +02:00
|
|
|
{
|
|
|
|
0,
|
|
|
|
6,
|
|
|
|
12,
|
|
|
|
21,
|
|
|
|
28,
|
|
|
|
35,
|
|
|
|
38,
|
2008-07-27 07:43:59 +02:00
|
|
|
53,
|
|
|
|
59,
|
|
|
|
72
|
2008-05-17 12:01:45 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
|
2008-05-18 16:08:57 +02:00
|
|
|
static void
|
2008-07-27 07:43:59 +02:00
|
|
|
ps_check_extra_glyph_name( const char* gname,
|
|
|
|
FT_UInt glyph,
|
|
|
|
FT_UInt* extra_glyphs,
|
|
|
|
FT_UInt *states )
|
2008-05-17 12:01:45 +02:00
|
|
|
{
|
|
|
|
FT_UInt n;
|
|
|
|
|
|
|
|
|
2008-07-27 07:43:59 +02:00
|
|
|
for ( n = 0; n < EXTRA_GLYPH_LIST_SIZE; n++ )
|
2008-05-17 12:01:45 +02:00
|
|
|
{
|
2008-07-27 07:43:59 +02:00
|
|
|
if ( ft_strcmp( ft_extra_glyph_names +
|
|
|
|
ft_extra_glyph_name_offsets[n], gname ) == 0 )
|
2008-05-17 12:01:45 +02:00
|
|
|
{
|
|
|
|
if ( states[n] == 0 )
|
|
|
|
{
|
2008-07-27 07:43:59 +02:00
|
|
|
/* mark this extra glyph as a candidate for the cmap */
|
2008-05-17 12:01:45 +02:00
|
|
|
states[n] = 1;
|
2008-07-27 07:43:59 +02:00
|
|
|
extra_glyphs[n] = glyph;
|
2008-05-17 12:01:45 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2008-05-18 16:08:57 +02:00
|
|
|
static void
|
2008-07-27 07:43:59 +02:00
|
|
|
ps_check_extra_glyph_unicode( FT_UInt32 uni_char,
|
|
|
|
FT_UInt *states )
|
2008-05-17 12:01:45 +02:00
|
|
|
{
|
|
|
|
FT_UInt n;
|
|
|
|
|
|
|
|
|
2008-07-27 07:43:59 +02:00
|
|
|
for ( n = 0; n < EXTRA_GLYPH_LIST_SIZE; n++ )
|
2008-05-17 12:01:45 +02:00
|
|
|
{
|
2008-07-27 07:43:59 +02:00
|
|
|
if ( uni_char == ft_extra_glyph_unicodes[n] )
|
2008-05-17 12:01:45 +02:00
|
|
|
{
|
2008-07-27 07:43:59 +02:00
|
|
|
/* disable this extra glyph from being added to the cmap */
|
2008-05-17 12:01:45 +02:00
|
|
|
states[n] = 2;
|
|
|
|
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2006-01-11 11:08:49 +01:00
|
|
|
/* Build a table that maps Unicode values to glyph indices. */
|
2001-06-28 01:25:46 +02:00
|
|
|
static FT_Error
|
2006-06-06 10:14:14 +02:00
|
|
|
ps_unicodes_init( FT_Memory memory,
|
|
|
|
PS_Unicodes table,
|
|
|
|
FT_UInt num_glyphs,
|
|
|
|
PS_GetGlyphNameFunc get_glyph_name,
|
|
|
|
PS_FreeGlyphNameFunc free_glyph_name,
|
|
|
|
FT_Pointer glyph_data )
|
2000-06-22 02:27:15 +02:00
|
|
|
{
|
|
|
|
FT_Error error;
|
|
|
|
|
2008-07-27 07:43:59 +02:00
|
|
|
FT_UInt extra_glyph_list_states[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 };
|
|
|
|
FT_UInt extra_glyphs[EXTRA_GLYPH_LIST_SIZE];
|
2008-05-17 12:01:45 +02:00
|
|
|
|
2000-06-25 08:47:11 +02:00
|
|
|
|
2000-06-22 02:27:15 +02:00
|
|
|
/* we first allocate the table */
|
|
|
|
table->num_maps = 0;
|
2015-04-13 05:16:48 +02:00
|
|
|
table->maps = NULL;
|
2000-06-22 02:27:15 +02:00
|
|
|
|
2008-07-27 07:43:59 +02:00
|
|
|
if ( !FT_NEW_ARRAY( table->maps, num_glyphs + EXTRA_GLYPH_LIST_SIZE ) )
|
2000-06-22 02:27:15 +02:00
|
|
|
{
|
|
|
|
FT_UInt n;
|
|
|
|
FT_UInt count;
|
|
|
|
PS_UniMap* map;
|
* src/sfnt/ttpost.c (load_post_names, tt_face_free_ps_names,
tt_face_get_ps_name): Replace switch statement with if clauses to
make it more portable.
* src/cff/cffobjs.c (cff_face_init): Ditto.
* include/freetype/ftmodule.h (FT_Module_Class): Use `FT_Long' for
`module_size'.
* include/freetype/ftrender.h (FT_Glyph_Class_): Use `FT_Long' for
`glyph_size'.
* src/base/ftobjs.c (FT_Render_Glyph): Change second parameter to
`FT_Render_Mode'.
(FT_Render_Glyph_Internal): Change third parameter to
`FT_Render_Mode'.
* src/base/ftglyph.c (FT_Glyph_To_Bitmap): Change second parameter
to `FT_Render_Mode'.
* src/raster/ftrend1.c (ft_raster1_render): Change third parameter
to `FT_Render_Mode'.
* src/smooth/ftsmooth.c (ft_smooth_render, ft_smooth_render_lcd,
ft_smooth_render_lcd_v): Ditto.
(ft_smooth_render_generic): Change third and fifth parameter to
`FT_Render_Mode'.
* include/freetype/freetype.h, include/freetype/internal/ftobjs.h,
include/freetype/ftglyph.h: Updated.
* src/cff/cffdrivr.c (Load_Glyph), src/pcf/pcfdriver.c
(PCF_Glyph_Load), src/pfr/pfrobjs.c (pfr_slot_load),
src/winfonts/winfnt.c (FNT_Load_Glyph), src/t42/t42objs.c
(T42_GlyphSlot_Load), src/bdf/bdfdrivr.c (BDF_Glyph_Load): Change
fourth parameter to `FT_Int32'.
* src/pfr/pfrobjs.c (pfr_face_init): Add two missing parameters
and declare them as unused.
* src/cid/cidparse.h (CID_Parser): Use FT_Long for `postscript_len'.
* src/psnames/psnames.h (PS_Unicode_Value_Func): Change return
value to FT_UInt32.
* src/psnames/psmodule.c (ps_unicode_value, ps_build_unicode_table):
Updated accordingly.
* src/cff/cffdrivr.c (Get_Kerning): Use FT_Long for `middle'.
(cff_get_glyph_name): Use cast for result of ft_strlen.
* src/cff/cffparse.c (cff_parse_real): User cast for assigning
`exp'.
* src/cff/cffload.c (cff_index_get_pointers): Use FT_ULong for
some local variables.
(cff_charset_load, cff_encoding_load): Use casts to FT_UInt for some
switch statements.
(cff_font_load): Use cast in call to CFF_Load_FD_Select.
* src/cff/cffobjs.c (cff_size_init): Use more casts.
(cff_face_init): Use FT_Int32 for `flags'.
* src/cff/cffgload.c (cff_operator_seac): Use cast for assigning
`adx' and `ady'.
(cff_decoder_parse_charstrings): Use FT_ULong for third parameter.
Use more casts.
* src/cff/cffcmap.c (cff_cmap_unicode_init): Use cast for `count'.
* src/cid/cidload.c (cid_read_subrs): Use FT_ULong for `len'.
* src/cid/cidgload.c (cid_load_glyph): Add missing cast for
`cid_get_offset'.
* src/psaux/t1decode.c (t1_decoder_parse_charstrings) <18>: Use
cast for `num_points'.
(t1_decoder_init): Use cast for assigning `decoder->num_glyphs'.
* src/base/ftdebug.c (ft_debug_init): Use FT_Int.
* include/freetype/internal/ftdriver.h (FT_Slot_LoadFunc): Use
`FT_Int32' for fourth parameter.
* src/base/ftobjs.c (open_face): Use cast for calling
clazz->init_face.
* src/raster/ftraster.c (Set_High_Precision): Use `1' instead of
`1L'.
(Finalize_Profile_Table, Line_Up, ft_black_init): Use casts.
* src/raster/ftrend1.c (ft_raster1_render): Ditto.
* src/sfnt/sfnt_dir_check: Compare `magic' with unsigned long
constant.
* builds/amiga/include/freetype/config/ftmodule.h: Updated.
2002-09-27 13:09:23 +02:00
|
|
|
FT_UInt32 uni_char;
|
2000-06-22 02:27:15 +02:00
|
|
|
|
2000-06-25 08:47:11 +02:00
|
|
|
|
2000-06-22 02:27:15 +02:00
|
|
|
map = table->maps;
|
2000-07-01 16:06:46 +02:00
|
|
|
|
2000-06-22 02:27:15 +02:00
|
|
|
for ( n = 0; n < num_glyphs; n++ )
|
|
|
|
{
|
2006-01-12 09:12:27 +01:00
|
|
|
const char* gname = get_glyph_name( glyph_data, n );
|
2000-06-25 08:47:11 +02:00
|
|
|
|
|
|
|
|
|
|
|
if ( gname )
|
2000-06-22 02:27:15 +02:00
|
|
|
{
|
2008-07-27 07:43:59 +02:00
|
|
|
ps_check_extra_glyph_name( gname, n,
|
|
|
|
extra_glyphs, extra_glyph_list_states );
|
* 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
|
|
|
uni_char = ps_unicode_value( gname );
|
2000-07-01 16:06:46 +02:00
|
|
|
|
2006-01-11 11:08:49 +01:00
|
|
|
if ( BASE_GLYPH( uni_char ) != 0 )
|
2000-06-22 02:27:15 +02:00
|
|
|
{
|
2008-07-27 07:43:59 +02:00
|
|
|
ps_check_extra_glyph_unicode( uni_char,
|
|
|
|
extra_glyph_list_states );
|
2006-01-11 11:08:49 +01:00
|
|
|
map->unicode = uni_char;
|
2000-06-22 02:27:15 +02:00
|
|
|
map->glyph_index = n;
|
|
|
|
map++;
|
|
|
|
}
|
2006-06-06 10:14:14 +02:00
|
|
|
|
|
|
|
if ( free_glyph_name )
|
|
|
|
free_glyph_name( glyph_data, gname );
|
2000-06-22 02:27:15 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2008-07-27 07:43:59 +02:00
|
|
|
for ( n = 0; n < EXTRA_GLYPH_LIST_SIZE; n++ )
|
2008-05-17 12:01:45 +02:00
|
|
|
{
|
2008-07-27 07:43:59 +02:00
|
|
|
if ( extra_glyph_list_states[n] == 1 )
|
2008-05-17 12:01:45 +02:00
|
|
|
{
|
2008-07-27 07:43:59 +02:00
|
|
|
/* This glyph name has an additional representation. */
|
|
|
|
/* Add it to the cmap. */
|
2008-05-17 12:01:45 +02:00
|
|
|
|
2008-07-27 07:43:59 +02:00
|
|
|
map->unicode = ft_extra_glyph_unicodes[n];
|
|
|
|
map->glyph_index = extra_glyphs[n];
|
2008-05-17 12:01:45 +02:00
|
|
|
map++;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2006-01-11 11:08:49 +01:00
|
|
|
/* now compress the table a bit */
|
2001-03-10 18:07:42 +01:00
|
|
|
count = (FT_UInt)( map - table->maps );
|
2000-07-01 16:06:46 +02:00
|
|
|
|
2000-06-25 08:47:11 +02:00
|
|
|
if ( count == 0 )
|
2000-06-22 02:27:15 +02:00
|
|
|
{
|
2010-07-09 04:36:00 +02:00
|
|
|
/* No unicode chars here! */
|
2002-03-22 14:52:37 +01:00
|
|
|
FT_FREE( table->maps );
|
2000-06-25 08:47:11 +02:00
|
|
|
if ( !error )
|
2013-03-14 10:27:35 +01:00
|
|
|
error = FT_THROW( No_Unicode_Glyph_Name );
|
2006-01-11 11:08:49 +01:00
|
|
|
}
|
2010-06-08 08:37:11 +02:00
|
|
|
else
|
|
|
|
{
|
2006-01-11 11:08:49 +01:00
|
|
|
/* Reallocate if the number of used entries is much smaller. */
|
|
|
|
if ( count < num_glyphs / 2 )
|
|
|
|
{
|
2018-07-02 22:27:57 +02:00
|
|
|
(void)FT_RENEW_ARRAY( table->maps,
|
|
|
|
num_glyphs + EXTRA_GLYPH_LIST_SIZE,
|
|
|
|
count );
|
2013-03-14 11:21:17 +01:00
|
|
|
error = FT_Err_Ok;
|
2006-01-11 11:08:49 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
/* Sort the table in increasing order of unicode values, */
|
|
|
|
/* taking care of glyph variants. */
|
|
|
|
ft_qsort( table->maps, count, sizeof ( PS_UniMap ),
|
|
|
|
compare_uni_maps );
|
2000-06-22 02:27:15 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
table->num_maps = count;
|
|
|
|
}
|
2000-06-25 08:47:11 +02:00
|
|
|
|
2000-06-22 02:27:15 +02:00
|
|
|
return error;
|
|
|
|
}
|
|
|
|
|
2000-06-25 08:47:11 +02:00
|
|
|
|
2001-06-28 01:25:46 +02:00
|
|
|
static FT_UInt
|
2006-01-12 09:12:27 +01:00
|
|
|
ps_unicodes_char_index( PS_Unicodes table,
|
|
|
|
FT_UInt32 unicode )
|
2000-06-22 02:27:15 +02:00
|
|
|
{
|
2006-01-11 11:08:49 +01:00
|
|
|
PS_UniMap *min, *max, *mid, *result = NULL;
|
2000-06-25 08:47:11 +02:00
|
|
|
|
|
|
|
|
2006-01-11 11:08:49 +01:00
|
|
|
/* Perform a binary search on the table. */
|
2000-07-01 16:06:46 +02:00
|
|
|
|
2000-06-22 02:27:15 +02:00
|
|
|
min = table->maps;
|
|
|
|
max = min + table->num_maps - 1;
|
|
|
|
|
2000-06-25 08:47:11 +02:00
|
|
|
while ( min <= max )
|
2000-06-22 02:27:15 +02:00
|
|
|
{
|
2006-01-11 11:08:49 +01:00
|
|
|
FT_UInt32 base_glyph;
|
|
|
|
|
|
|
|
|
|
|
|
mid = min + ( ( max - min ) >> 1 );
|
|
|
|
|
2000-06-22 02:27:15 +02:00
|
|
|
if ( mid->unicode == unicode )
|
2006-01-11 11:08:49 +01:00
|
|
|
{
|
|
|
|
result = mid;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
base_glyph = BASE_GLYPH( mid->unicode );
|
|
|
|
|
|
|
|
if ( base_glyph == unicode )
|
|
|
|
result = mid; /* remember match but continue search for base glyph */
|
2000-06-22 02:27:15 +02:00
|
|
|
|
2000-06-25 08:47:11 +02:00
|
|
|
if ( min == max )
|
2000-06-22 02:27:15 +02:00
|
|
|
break;
|
|
|
|
|
2006-01-11 11:08:49 +01:00
|
|
|
if ( base_glyph < unicode )
|
2000-06-25 08:47:11 +02:00
|
|
|
min = mid + 1;
|
|
|
|
else
|
|
|
|
max = mid - 1;
|
2000-06-22 02:27:15 +02:00
|
|
|
}
|
|
|
|
|
2006-01-11 11:08:49 +01:00
|
|
|
if ( result )
|
|
|
|
return result->glyph_index;
|
|
|
|
else
|
|
|
|
return 0;
|
2000-06-22 02:27:15 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2009-07-31 17:32:09 +02:00
|
|
|
static FT_UInt32
|
2006-01-12 09:12:27 +01:00
|
|
|
ps_unicodes_char_next( PS_Unicodes table,
|
|
|
|
FT_UInt32 *unicode )
|
2002-02-04 21:55:58 +01:00
|
|
|
{
|
2006-01-11 11:08:49 +01:00
|
|
|
FT_UInt result = 0;
|
|
|
|
FT_UInt32 char_code = *unicode + 1;
|
2002-02-04 21:55:58 +01:00
|
|
|
|
|
|
|
|
2006-01-11 11:08:49 +01:00
|
|
|
{
|
|
|
|
FT_UInt min = 0;
|
|
|
|
FT_UInt max = table->num_maps;
|
|
|
|
FT_UInt mid;
|
|
|
|
PS_UniMap* map;
|
|
|
|
FT_UInt32 base_glyph;
|
2002-02-04 21:55:58 +01:00
|
|
|
|
|
|
|
|
2006-01-11 11:08:49 +01:00
|
|
|
while ( min < max )
|
|
|
|
{
|
|
|
|
mid = min + ( ( max - min ) >> 1 );
|
|
|
|
map = table->maps + mid;
|
2002-02-04 21:55:58 +01:00
|
|
|
|
2006-01-11 11:08:49 +01:00
|
|
|
if ( map->unicode == char_code )
|
|
|
|
{
|
|
|
|
result = map->glyph_index;
|
|
|
|
goto Exit;
|
|
|
|
}
|
2002-02-04 21:55:58 +01:00
|
|
|
|
2006-01-11 11:08:49 +01:00
|
|
|
base_glyph = BASE_GLYPH( map->unicode );
|
2002-02-04 21:55:58 +01:00
|
|
|
|
2006-01-11 11:08:49 +01:00
|
|
|
if ( base_glyph == char_code )
|
|
|
|
result = map->glyph_index;
|
* 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
|
|
|
|
2006-01-11 11:08:49 +01:00
|
|
|
if ( base_glyph < char_code )
|
|
|
|
min = mid + 1;
|
|
|
|
else
|
|
|
|
max = mid;
|
|
|
|
}
|
|
|
|
|
|
|
|
if ( result )
|
|
|
|
goto Exit; /* we have a variant glyph */
|
|
|
|
|
|
|
|
/* we didn't find it; check whether we have a map just above it */
|
|
|
|
char_code = 0;
|
|
|
|
|
|
|
|
if ( min < table->num_maps )
|
|
|
|
{
|
2006-01-17 17:55:32 +01:00
|
|
|
map = table->maps + min;
|
|
|
|
result = map->glyph_index;
|
|
|
|
char_code = BASE_GLYPH( map->unicode );
|
2006-01-11 11:08:49 +01:00
|
|
|
}
|
2002-02-04 21:55:58 +01:00
|
|
|
}
|
|
|
|
|
2006-01-11 11:08:49 +01:00
|
|
|
Exit:
|
|
|
|
*unicode = char_code;
|
|
|
|
return result;
|
2002-02-04 21:55:58 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2000-06-25 08:47:11 +02:00
|
|
|
#endif /* FT_CONFIG_OPTION_ADOBE_GLYPH_LIST */
|
2000-06-22 02:27:15 +02:00
|
|
|
|
|
|
|
|
2001-06-28 01:25:46 +02:00
|
|
|
static const char*
|
* 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
|
|
|
ps_get_macintosh_name( FT_UInt name_index )
|
2000-06-22 02:27:15 +02:00
|
|
|
{
|
2005-03-09 18:33:03 +01:00
|
|
|
if ( name_index >= FT_NUM_MAC_NAMES )
|
2000-06-22 02:27:15 +02:00
|
|
|
name_index = 0;
|
|
|
|
|
2005-03-09 18:33:03 +01:00
|
|
|
return ft_standard_glyph_names + ft_mac_names[name_index];
|
2000-06-22 02:27:15 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2001-06-28 01:25:46 +02:00
|
|
|
static const char*
|
* 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
|
|
|
ps_get_standard_strings( FT_UInt sid )
|
2000-06-22 02:27:15 +02:00
|
|
|
{
|
2005-03-09 18:33:03 +01:00
|
|
|
if ( sid >= FT_NUM_SID_NAMES )
|
|
|
|
return 0;
|
|
|
|
|
|
|
|
return ft_standard_glyph_names + ft_sid_names[sid];
|
2000-06-22 02:27:15 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
#ifdef FT_CONFIG_OPTION_ADOBE_GLYPH_LIST
|
2012-08-23 14:50:00 +02:00
|
|
|
|
|
|
|
FT_DEFINE_SERVICE_PSCMAPSREC(
|
|
|
|
pscmaps_interface,
|
2016-09-17 17:12:50 +02:00
|
|
|
|
2015-10-30 08:07:56 +01:00
|
|
|
(PS_Unicode_ValueFunc) ps_unicode_value, /* unicode_value */
|
|
|
|
(PS_Unicodes_InitFunc) ps_unicodes_init, /* unicodes_init */
|
|
|
|
(PS_Unicodes_CharIndexFunc)ps_unicodes_char_index, /* unicodes_char_index */
|
|
|
|
(PS_Unicodes_CharNextFunc) ps_unicodes_char_next, /* unicodes_char_next */
|
2000-06-25 08:47:11 +02:00
|
|
|
|
2015-10-30 08:07:56 +01:00
|
|
|
(PS_Macintosh_NameFunc) ps_get_macintosh_name, /* macintosh_name */
|
|
|
|
(PS_Adobe_Std_StringsFunc) ps_get_standard_strings, /* adobe_std_strings */
|
2009-04-05 17:18:03 +02:00
|
|
|
|
2015-10-30 08:07:56 +01:00
|
|
|
t1_standard_encoding, /* adobe_std_encoding */
|
2016-09-17 17:12:50 +02:00
|
|
|
t1_expert_encoding /* adobe_expert_encoding */
|
|
|
|
)
|
2009-04-05 17:18:03 +02:00
|
|
|
|
2000-06-22 02:27:15 +02:00
|
|
|
#else
|
2000-06-25 08:47:11 +02:00
|
|
|
|
2012-08-23 14:50:00 +02:00
|
|
|
FT_DEFINE_SERVICE_PSCMAPSREC(
|
|
|
|
pscmaps_interface,
|
2016-09-17 17:12:50 +02:00
|
|
|
|
2015-10-30 08:07:56 +01:00
|
|
|
NULL, /* unicode_value */
|
|
|
|
NULL, /* unicodes_init */
|
|
|
|
NULL, /* unicodes_char_index */
|
|
|
|
NULL, /* unicodes_char_next */
|
2000-06-22 02:27:15 +02:00
|
|
|
|
2015-10-30 08:07:56 +01:00
|
|
|
(PS_Macintosh_NameFunc) ps_get_macintosh_name, /* macintosh_name */
|
|
|
|
(PS_Adobe_Std_StringsFunc) ps_get_standard_strings, /* adobe_std_strings */
|
2000-06-22 02:27:15 +02:00
|
|
|
|
2015-10-30 08:07:56 +01:00
|
|
|
t1_standard_encoding, /* adobe_std_encoding */
|
2016-09-17 17:12:50 +02:00
|
|
|
t1_expert_encoding /* adobe_expert_encoding */
|
|
|
|
)
|
2009-04-05 17:18:03 +02:00
|
|
|
|
|
|
|
#endif /* FT_CONFIG_OPTION_ADOBE_GLYPH_LIST */
|
|
|
|
|
|
|
|
|
2012-08-23 14:50:00 +02:00
|
|
|
FT_DEFINE_SERVICEDESCREC1(
|
|
|
|
pscmaps_services,
|
2016-09-17 17:12:50 +02:00
|
|
|
|
Remove FT_CONFIG_OPTION_PIC and related code.
*/* [FT_CONFIG_OPTION_PIC]: Remove all code guarded by this
preprocessor symbol.
*/*: Replace `XXX_GET' macros (which could be either a function in
PIC mode or an array in non-PIC mode) with `xxx' arrays.
* include/freetype/internal/ftpic.h, src/autofit/afpic.c,
src/autofit/afpic.h, src/base/basepic.c, src/base/basepic.h,
src/base/ftpic.c, src/cff/cffpic.c, src/cff/cffpic.h,
src/pshinter/pshpic.c, src/pshinter/pshpic.h, src/psnames/pspic.c,
src/psnames/pspic.h, src/raster/rastpic.c, src/raster/rastpic.h,
src/sfnt/sfntpic.c, src/sfnt/sfntpic.h, src/smooth/ftspic.c,
src/smooth/ftspic.h, src/truetype/ttpic.c, src/truetype/ttpic.h:
Removed.
2018-05-02 20:27:48 +02:00
|
|
|
FT_SERVICE_ID_POSTSCRIPT_CMAPS, &pscmaps_interface )
|
2000-06-22 02:27:15 +02:00
|
|
|
|
2003-09-30 07:39:35 +02:00
|
|
|
|
2003-09-29 22:33:37 +02:00
|
|
|
static FT_Pointer
|
|
|
|
psnames_get_service( FT_Module module,
|
|
|
|
const char* service_id )
|
|
|
|
{
|
2010-02-04 18:58:24 +01:00
|
|
|
FT_UNUSED( module );
|
2003-09-29 22:33:37 +02:00
|
|
|
|
Remove FT_CONFIG_OPTION_PIC and related code.
*/* [FT_CONFIG_OPTION_PIC]: Remove all code guarded by this
preprocessor symbol.
*/*: Replace `XXX_GET' macros (which could be either a function in
PIC mode or an array in non-PIC mode) with `xxx' arrays.
* include/freetype/internal/ftpic.h, src/autofit/afpic.c,
src/autofit/afpic.h, src/base/basepic.c, src/base/basepic.h,
src/base/ftpic.c, src/cff/cffpic.c, src/cff/cffpic.h,
src/pshinter/pshpic.c, src/pshinter/pshpic.h, src/psnames/pspic.c,
src/psnames/pspic.h, src/raster/rastpic.c, src/raster/rastpic.h,
src/sfnt/sfntpic.c, src/sfnt/sfntpic.h, src/smooth/ftspic.c,
src/smooth/ftspic.h, src/truetype/ttpic.c, src/truetype/ttpic.h:
Removed.
2018-05-02 20:27:48 +02:00
|
|
|
return ft_service_list_lookup( pscmaps_services, service_id );
|
2003-09-29 22:33:37 +02:00
|
|
|
}
|
2000-06-22 02:27:15 +02:00
|
|
|
|
2007-08-03 00:03:30 +02:00
|
|
|
#endif /* FT_CONFIG_OPTION_POSTSCRIPT_NAMES */
|
2000-06-22 02:27:15 +02:00
|
|
|
|
|
|
|
|
2009-04-05 17:18:03 +02:00
|
|
|
#ifndef FT_CONFIG_OPTION_POSTSCRIPT_NAMES
|
2012-08-23 14:50:00 +02:00
|
|
|
#define PUT_PS_NAMES_SERVICE( a ) NULL
|
2009-04-05 17:18:03 +02:00
|
|
|
#else
|
2012-08-23 14:50:00 +02:00
|
|
|
#define PUT_PS_NAMES_SERVICE( a ) a
|
2009-04-05 17:18:03 +02:00
|
|
|
#endif
|
2003-09-29 22:33:37 +02:00
|
|
|
|
2012-08-23 14:50:00 +02:00
|
|
|
FT_DEFINE_MODULE(
|
|
|
|
psnames_module_class,
|
2012-01-16 18:00:24 +01:00
|
|
|
|
2000-06-22 02:27:15 +02:00
|
|
|
0, /* this is not a font driver, nor a renderer */
|
2001-12-05 02:22:05 +01:00
|
|
|
sizeof ( FT_ModuleRec ),
|
2000-06-22 02:27:15 +02:00
|
|
|
|
|
|
|
"psnames", /* driver name */
|
2000-07-01 16:06:46 +02:00
|
|
|
0x10000L, /* driver version */
|
|
|
|
0x20000L, /* driver requires FreeType 2 or above */
|
2000-06-22 02:27:15 +02:00
|
|
|
|
2012-08-23 14:50:00 +02:00
|
|
|
PUT_PS_NAMES_SERVICE(
|
Remove FT_CONFIG_OPTION_PIC and related code.
*/* [FT_CONFIG_OPTION_PIC]: Remove all code guarded by this
preprocessor symbol.
*/*: Replace `XXX_GET' macros (which could be either a function in
PIC mode or an array in non-PIC mode) with `xxx' arrays.
* include/freetype/internal/ftpic.h, src/autofit/afpic.c,
src/autofit/afpic.h, src/base/basepic.c, src/base/basepic.h,
src/base/ftpic.c, src/cff/cffpic.c, src/cff/cffpic.h,
src/pshinter/pshpic.c, src/pshinter/pshpic.h, src/psnames/pspic.c,
src/psnames/pspic.h, src/raster/rastpic.c, src/raster/rastpic.h,
src/sfnt/sfntpic.c, src/sfnt/sfntpic.h, src/smooth/ftspic.c,
src/smooth/ftspic.h, src/truetype/ttpic.c, src/truetype/ttpic.h:
Removed.
2018-05-02 20:27:48 +02:00
|
|
|
(void*)&pscmaps_interface ), /* module specific interface */
|
2016-09-17 17:12:50 +02:00
|
|
|
|
|
|
|
(FT_Module_Constructor)NULL, /* module_init */
|
|
|
|
(FT_Module_Destructor) NULL, /* module_done */
|
|
|
|
(FT_Module_Requester) PUT_PS_NAMES_SERVICE( psnames_get_service ) /* get_interface */
|
|
|
|
)
|
2000-06-22 02:27:15 +02:00
|
|
|
|
2000-06-25 08:47:11 +02:00
|
|
|
|
|
|
|
/* END */
|