T168_111\appl\Text\Agfa:第83~87

ital.txt  、、、、、、、、、、、、、、、、、、、、、

/* Copyright (C) 2003 Agfa Monotype Corporation. All rights reserved. */

/* $Header:   I:/BULL/URIP/RTS/COR/ITAL.C_V   1.10   Aug 21 2003 17:03:38   Galejs  $ */
/* $Log:   I:/BULL/URIP/RTS/COR/ITAL.C_V  $ 
 * 
 *    Rev 1.10   Aug 21 2003 17:03:38   Galejs
 * update copyright notice
 * 
 *    Rev 1.9   Jun 23 2003 14:17:30   Galejs
 * ufstport.h
 * 
 *    Rev 1.8   Aug 13 1999 15:07:02   galejs
 * include-file changes
 * 
 *    Rev 1.7   22 Jun 1998 19:00:56   GALEJS
 * make Intellifont reentrant too
 * 
 *    Rev 1.6   24 Mar 1998 15:20:06   GALEJS
 * include-file changes
 * 
 *    Rev 1.5   06 Apr 1995 15:10:58   LISA
 * Changed copyright from Miles Inc. to Bayer Corp.
 * 
 *    Rev 1.4   22 Apr 1994 09:28:20   LISA
 * Modified copyright/disclaimer notice for 1994.
 * 
 *    Rev 1.3   12 Feb 1993 11:38:06   JOE
 * VXWorks support.
 * 
 *    Rev 1.2   07 Jan 1993 11:04:56   JOE
 * ANSI C function declaration changes.
 * 
 *    Rev 1.1   14 Dec 1992 09:35:14   LISA
 * Made change to Log keyword
 * 
 *    Rev 1.0   10 Dec 1992 08:37:44   LISA
 * Initial revision.
*/
/* $Date:   Aug 21 2003 17:03:38  $ */
/* ital.c */
/*
 *
 *
 *
 * HISTORY:
 * 
 *  30-Jan-91  dET  Added function prototyping for MSC.
 *  31-Jan-91  dET  multi-model compilation for MSC.
 *   8_Feb-91  awr  Made x_skel[] and y_skel[] parameters instead of
 *                  EXTERNs
 *   2-Jun-91  awr  HQ4 changes
 *  17-Jun-91  jfd  Moved "debug.h" after "port.h".
 *                  Added "cgconfig.h" before "port.h".
 *  24-Aug-91  awr  Moved function decls to include file
 *  04-Mar-92  tbh  Added .baseproj to support standard STANDARD dimensions
 *  03-Apr-92  rs   Portability cleanup (see port.h).
 *   6 May 92  ss   Added casts in italic() to help porting.
 *  15-Sep-92 jfd  Conditionally compile entire module based on IF_RDR.
 *  17-Nov-92 rs    Mac port -> rename italic() -> cgitalic().
 *  07-Jan-93 jfd   ANSI C function declaration changes.
 *  08-Feb-93 jfd   VXWorks support.
 */

#include "cgconfig.h"

#if IF_RDR

#ifdef VXWORKS
#include "vxWorks.h"
#endif

#include <stdio.h>
#include "ufstport.h"
#include "dbg_ufst.h"

#include "shareinc.h"

#include "adj_skel.h"


#if defined (ANSI_DEFS)
GLOBAL VOID  cgitalic(FSP PADJUSTED_SKEL x_skel, PADJUSTED_SKEL y_skel)
#else
GLOBAL VOID
cgitalic(x_skel, y_skel)
    PADJUSTED_SKEL  x_skel;
    PADJUSTED_SKEL  y_skel;
#endif
{
    PADJUSTED_SKEL xskel;
    PADJUSTED_SKEL yskel;

    LPUB8 x_num_skel_loop;
    LPUB8 y_num_skel_loop;

    LPUW16 x_skel_to_contr;
    LPUW16 y_skel_to_contr;

    UW16  loopct;
    LOOP   loop;

    UW16  x_vecnum;
    UW16  y_vecnum;

    SW16  x_nsk;      /*  Number of skeletal points in loop */
    SW16  y_nsk;
    SW16  xnum;       /*  Number of skel pts processed so far */
    SW16  ynum;

    SW16  yold,  ynew;
    SW16  yold0, yold1, yold_first;
    SW16  ynew0, ynew1, ynew_first;
    SW16  num, den;
    SW16  xadj;


    DBG("cgitalic()\n");

    xskel = x_skel;
    yskel = y_skel;

         /* added casts, seems to help with assignment on SPARC -ss 5/6/92 */
    x_num_skel_loop = (LPUB8)if_state.xskel.num_skel_loop;
    y_num_skel_loop = (LPUB8)if_state.yskel.num_skel_loop;

    x_skel_to_contr = if_state.xskel.skel_to_contr;
    y_skel_to_contr = if_state.yskel.skel_to_contr;

    x_vecnum = *x_skel_to_contr++;

    /*  For each loop in the character */
    first_loop(FSA0);
    for(loopct = 0; loopct < if_state.num_loops; loopct++)
    {
        next_loop(FSA &loop);

        x_nsk = *(x_num_skel_loop++);
        y_nsk = *(y_num_skel_loop++);
        DBG3("loop %d has %d xskels and %d yskels\n", loopct, x_nsk, y_nsk);

        xnum  = 0;
        
        yold_first = yskel->original;
        ynew_first = yskel->adjusted;

        yold1 = (yskel + y_nsk - 1)->original;
        ynew1 = (yskel + y_nsk - 1)->adjusted;

        DBG1("\n    0th yskel pair has start index y_vecnum = %d\n",
                                           *(y_skel_to_contr + y_nsk - 1));

      /*  For each y skel scaling segment in this loop  */

        for(ynum=0; ynum<=y_nsk; ynum++)
        {
          /*  Next pair of y skeletal points along loop  */

            yold0 = yold1;
            ynew0 = ynew1;

          /*  If at end of loop, the last y skeletal is the first  */

            if(ynum == y_nsk)
            {
                y_vecnum = loop.ncoords; /* To stop x at the end of loop */
                yold1 = yold_first;
                ynew1 = ynew_first;
            }
            else
            {
                y_vecnum = *y_skel_to_contr++;
                yold1 = yskel->original;
                ynew1 = yskel->adjusted;
                yskel++;
            }
            DBG2("\n    %dth yskel pair has ending index y_vecnum = %d\n",
                                                            ynum, y_vecnum);
            DBG2("    yold0, yold1 %d %d\n", yold0, yold1);
            DBG2("    ynew0, ynew1 %d %d\n", ynew0, ynew1);

            num = ynew1 - ynew0;
            den = yold1 - yold0;
            DBG2("    num, den%d %d\n", num, den);

            while((x_vecnum < y_vecnum) && (xnum<x_nsk))
            {
                DBG2("\n        %dth xskel has index x_vecnum = %d\n",
                                                         xnum, x_vecnum);

                yold = (loop.cv + x_vecnum)->y;

              /*  Scale y coordinate of this x skeletal */
                if(den)
                    ynew = (SW16)(((SL32)(yold - yold0)*(SL32)num)
                                                           /den) + ynew0;
                else
                    ynew = yold - yold0 + ynew0;
                DBG2("        yold, ynew   %d %d\n", yold, ynew);

              /*  Adjust x coordinate based on angle */
                if(if_state.glob_ital_ang && !if_state.italic_flag)
                {
                    DBG1("        Adjust by global %d\n", if_state.glob_ital_ang);
                    xadj = (SW16)
                         (
                           (
                               ( (SL32)if_state.glob_ital_ang * (SL32)ynew ) -
                                 ( (SL32)yold * (SL32)if_state.loc_ital_ang )
                           ) >> 15
                         );
                }
                else
                {
                    DBG1("        Adjust by local %d\n", if_state.loc_ital_ang);
                    xadj = (SW16)
                         (
                           ((SL32)if_state.loc_ital_ang * (SL32)(ynew - yold)) >> 15
                         );
                }
                DBG1("        xadj = %d\n", xadj);
                xskel->intermed += xadj;
                xskel->adjusted = xskel->intermed;
              /* project coord to baseline ! */
                xskel->baseproj -= (SW16)(((SL32)yold * (SL32)if_state.loc_ital_ang) >> 15);

              /*  Bump to next x skeletal */

                xnum++;
                x_vecnum = *x_skel_to_contr++;
                xskel++;
            }
        }
    }
}
#endif  /* IF_RDR */

 

ix.c  、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、

/* 
 * Copyright (C) 2005 Monotype Imaging Inc. All rights reserved.
 */

/* $Header:   I:/BULL/URIP/RTS/DA/IX.C_V   1.99   Dec 14 2004 14:17:46   galejss  $ */
/* $Log:   I:/BULL/URIP/RTS/DA/IX.C_V  $ 
 * 
 *    Rev 1.99   Dec 14 2004 14:17:46   galejss
 * make all DBG calls 16-bit-compatible
 * 
 *    Rev 1.98   Oct 25 2004 18:01:06   galejss
 * share as much ROM/disk code as possible in IXinit (fix TT_QUERY_DIRECT crash for Disk mode)
 * 
 *    Rev 1.97   Oct 14 2004 12:04:44   galejss
 * fix build problem in IXinit (for reentrant internal-memory build)
 * 
 *    Rev 1.96   Sep 27 2004 16:27:04   dugganj
 * Added multithread support.
 * 
 *    Rev 1.95   Aug 10 2004 15:17:18   galejss
 * always call SYMinit / SYMexit (because no-symset-mapping is a runtime option now)
 * 
 *    Rev 1.94   Jul 16 2004 13:41:42   galejss
 * changes for extended disk/rom support; BOOLEAN type cleanup
 * 
 *    Rev 1.93   Apr 27 2004 11:41:08   GalejsS
 * fix compiler warning
 * 
 *    Rev 1.92   Oct 17 2003 16:51:22   Galejs
 * compile fixes for DIRECT_TT_TABLE_ACCESS & MEM_TRACE
 * 
 *    Rev 1.91   Aug 22 2003 08:53:40   LynchR
 * Updated copyright notice.
 * 
 *    Rev 1.90   Aug 20 2003 15:18:04   Joe
 * Added "FSA0" argument to ttTBLexit() call in IXexit().
 * 
 *    Rev 1.89   Aug 19 2003 13:21:52   Joe
 * Added "table-by-reference" support.
 * 
 *    Rev 1.88   Aug 05 2003 16:14:30   Galejs
 * add IXinit_error_cleanup (restructure to get rid of gotos and compiler warnings)
 * 
 *    Rev 1.87   Jul 21 2003 18:44:02   Galejs
 * test UFST_get_debug, not trace_sw
 * 
 *    Rev 1.86   Jul 07 2003 11:32:20   Galejs
 * fix conflict between DYNAMIC_FONTS & DIMM_DISK (bug # 124)
 * 
 *    Rev 1.85   Jun 19 2003 18:41:50   Galejs
 * get rid of NON_IF_FONT; clean up debug & printfs
 * 
 *    Rev 1.84   Nov 26 2002 17:49:12   Galejs
 * add casts to all MEMptr() references
 * 
 *    Rev 1.83   Sep 23 2002 20:29:02   Galejs
 * add DIMM_DISK option (bug # 92) (for awr)
 * 
 *    Rev 1.82   27 Aug 2001 08:40:24   JOE
 * Alpha changes (by dz).
 * 
 *    Rev 1.81   24 Aug 2001 14:01:00   JOE
 * DISK / ROM changes (by jwd).
 * 
 *    Rev 1.80   Jul 26 2001 10:33:00   Galejs
 * merge some identical NAT_ALIGN==4, ==8 cases as NAT_ALIGN >= 4
 * 
 *    Rev 1.79   Jun 28 2001 18:32:38   Galejs
 * add NAT_ALIGN==8 cases for 64-bit Intellifont support
 * 
 *    Rev 1.78   May 21 2001 18:48:12   Galejs
 * add or-PST1_RAM case to CFF_ROM test
 * 
 *    Rev 1.77   May 03 2001 19:48:58   Galejs
 * data-type cleanup (+ tighter conditional compiles)
 * 
 *    Rev 1.76   Mar 24 2000 17:37:56   galejs
 * DISK_FONTS tests need to be IF_DISK
 * 
 *    Rev 1.75   10 Feb 2000 15:31:32   AL
 * Removed PST1_ROM
 * 
 *    Rev 1.74   Jan 28 2000 15:46:26   galejs
 * use PATHNAMELEN (from port.h) rather than MAXNAME for buffersize
 * 
 *    Rev 1.73   Aug 16 1999 13:10:26   galejs
 * include-file changes; USING_16_BIT_DOS test
 * 
 *    Rev 1.72   29 Jul 1999 17:14:18   JOE
 * Changed DEBUG directive to AGFADEBUG (by ks).
 * 
 *    Rev 1.71   25 Feb 1999 09:32:38   JOE
 * Declared 'plugin_list' as type SL32 (by ks).
 * 
 *    Rev 1.70   08 Feb 1999 17:05:22   GALEJS
 * fix crash if missing SS files, PST1_DISK, and !IF_DISK
 * 
 *    Rev 1.69   26 Jan 1999 11:28:46   JOE
 * Revised handling of font_type variable to allow FORMAT16
 * and ASIAN_ENCODING independence (by jwd).
 * 
 *    Rev 1.68   21 Jan 1999 13:54:06   GALEJS
 * standardize #include tests
 * 
 *    Rev 1.67   13 Jan 1999 16:12:24   MARTIN
 * Modified rom_font and extern_font to resolve MSVC warning.
 * 
 *    Rev 1.66   12 Jan 1999 17:13:14   GALEJS
 * use CONST for read-only data; move EXTERN dcls
 * 
 *    Rev 1.65   15 Dec 1998 14:04:48   JOE
 * Revised IXinit() handling of entry_ct (by jwd).
 * 
 *    Rev 1.64   09 Dec 1998 17:02:48   JOE
 * Upgraded character allocation code for CFF (by jwd).
 * 
 *    Rev 1.63   06 Aug 1998 15:47:18   AL
 * CFF Rom support
 * 
 *    Rev 1.62   15 Jun 1998 15:55:00   GALEJS
 * reentrancy parm-passing changes
 * 
 *    Rev 1.61   15 Apr 1998 18:04:20   GALEJS
 * hchar_buf in IF_STATE now
 * 
 *    Rev 1.60   14 Apr 1998 18:31:12   GALEJS
 * move GLOBAL fontindex into IF_STATE
 * 
 *    Rev 1.59   02 Apr 1998 18:36:22   GALEJS
 * move extern to if_state
 * 
 *    Rev 1.58   01 Apr 1998 18:51:04   GALEJS
 * CGIFinitstate is now in IF_STATE
 * 
 *    Rev 1.57   26 Mar 1998 16:50:28   GALEJS
 * kanji.h now included in shareinc.h
 * 
 *    Rev 1.56   24 Mar 1998 15:50:52   GALEJS
 * include-file changes
 * 
 *    Rev 1.55   20 Mar 1998 11:50:56   GALEJS
 * 64-bit port
 * 
 *    Rev 1.54   30 Jan 1998 16:28:12   GALEJS
 * delete obsolete TT plugin options
 * 
 *    Rev 1.53   16 Sep 1997 12:46:16   GALEJS
 * support ARM/Helios compilation
 * 
 *    Rev 1.52   18 Jun 1997 18:38:54   GALEJS 
 * allow compile for PTV_OS
 * 
 *    Rev 1.51   16 Jun 1997 17:15:34   GALEJS
 * compile under PSOS
 * 
 *    Rev 1.50   13 Jan 1997 16:13:04   DAVID
 * Removed CONVERGENT_FONTS option as part of project to trim ufst.
 * 
 *    Rev 1.49   10 Jan 1997 11:47:24   DAVID
 * Removed SCREEN_FONTS option as part of project to trim ufst.
 * 
 *    Rev 1.48   30 Aug 1996 16:45:04   MIKE
 * In fontindex "fcoMakeNewSrchPath" replaces "fcoSearchPath_on"
 * 
 *    Rev 1.47   27 Jun 1996 09:29:50   DBK
 * Made ifdef changes based on NO_SYMSET_MAPPING.
 * 
 *    Rev 1.45   14 Jun 1996 17:00:42   JOE
 * Changed "//" comment delimiter to "slash-asterisk ... asterisk-slash".
 * 
 *    Rev 1.44   13 Jun 1996 17:06:02   JWD
 * Revised definitions of extern_font and font_type flags, to allow
 * full support of FORMAT16 data.
 * 
 *    Rev 1.43   22 Apr 1996 18:01:26   MIKE
 * OS9 support.
 * 
 *    Rev 1.42   20 Mar 1996 11:29:50   MERRILL
 * nops for have_... when FCO_RDR
 * 
 *    Rev 1.41   29 Feb 1996 10:07:02   MIKE
 * Made "hchar_buf" conditional (IF, PS) to save BUFFER pool memory
 * 
 *    Rev 1.40   12 Jan 1996 11:49:24   DBK
 * Moved prototype for init_font_index() to resolve compiler error.
 * 
 *    Rev 1.39   07 Dec 1995 16:07:00   MERRILL
 * take hchar_buf assigment out of conditional
 * 
 *    Rev 1.38   06 Apr 1995 15:14:38   LISA
 * Changed copyright from Miles Inc. to Bayer Corp.
 * 
 *    Rev 1.37   26 Jan 1995 16:41:40   JOE
 * Moved declaration of "if_state" outside of conditional compile
 * for CONVERGENT_FONTS.
 * 
 *    Rev 1.36   23 Jan 1995 08:07:18   JOE
 * In IXinit(), corrected earlier change regarding setting of "entry_ct".
 * 
 *    Rev 1.35   11 Jan 1995 11:02:02   JOE
 * In IXinit(), changed conditional compile statement so that "entry_ct"
 * is set to 0 if FCO_RDR.
 * 
 *    Rev 1.34   30 Nov 1994 11:09:12   JOE
 * In init_font_index(), if FCO_RDR is enabled, add case check for
 * plug count = 0 since it is now valid to build font index file
 * without IF plugins.
 * 
 *    Rev 1.33   26 Sep 1994 09:40:50   JOE
 * In IXget_fnt_index(), when checking if IF ROM or DISK, also check
 * that it is not a foreign bitmap.
 * 
 *    Rev 1.32   02 Sep 1994 12:57:02   MIKE
 * In IXget_fnt_index() set fontindex.fcoSearchPath_on = 0.
 * 
 *    Rev 1.31   05 Aug 1994 16:02:38   MIKE
 * Added FCO changes from 1.22.1.2
 * 
 *    Rev 1.30   25 Apr 1994 13:50:12   MIKE
 * No change.
 * 
 *    Rev 1.29   22 Apr 1994 15:45:30   JOE
 * Changed conditional compile statement prior to including <hif.h> to
 * #if (_AM29K && !UNIX) to resolve UNIX Metaware compiler error.
 * 
 *    Rev 1.28   22 Apr 1994 13:55:18   LISA
 * Made modifications to copyright/disclaimer notice.
 * 
 *    Rev 1.27   06 Mar 1994 15:19:46   MIKE
 * Changes to support AWT4 format in Convergent Fonts.
 * 
 *    Rev 1.26   09 Feb 1994 15:04:54   JOE
 * Did not fully implement bug fix for IXset_search_path() mentioned
 * above. In addition to returning SUCCESS, no longer setting "fontindex.
 * cur_tf_num" to 0 before returning SUCCESS.
 * 
 *    Rev 1.25   09 Feb 1994 11:59:12   JOE
 * More _AM29K changes.
 * 
 *    Rev 1.24   03 Feb 1994 19:44:18   MIKE
 * Convergent Fonts II. Reads AWT4 header, which holds italic angle and
 * horizontal offset information.
 * 
 *    Rev 1.23   02 Feb 1994 08:48:14   JOE
 * AM29K changes.
 * In IXset_search_path(), fixed problem with fixed-pitch plugin processing
 * (return SUCCESS if the 2 weight-sensitive plugins are neither LETTER_GOTHIC
 * nor COURIER).
 * 
 *    Rev 1.22   10 Jan 1994 15:36:10   MIKE
 * Added constants AWT_ITAL & AWT_NHOC for AWT3 table.
 * 
 *    Rev 1.21   08 Dec 1993 18:58:58   ROB
 * General cleanup for MSDOS, FLAT, OS2.
 * 
 *    Rev 1.20   06 Dec 1993 12:07:06   MIKE
 * Change awt code to read em resolution from bytes 22-23.
 * 
 *    Rev 1.19   01 Dec 1993 08:35:22   JOE
 * Changed KANJI_ENCODING to ASIAN_ENCODING.
 * 
 *    Rev 1.18   28 Oct 1993 16:29:48   JOE
 * In !LINT_ARGS function prototype for set_tt_universal(), removed argument
 * type to resolve compiler error.
 * 
 *    Rev 1.17   27 Oct 1993 09:59:46   MIKE
 * Fix convergent font bug with chars missing from AWT. fsearch_awt()
 * 
 *    Rev 1.16   11 Oct 1993 13:28:18   MIKE
 * Added CVFget_fnt_index(). Restructured CVFsearch_awt().
 * 
 *    Rev 1.15   10 Sep 1993 16:04:04   MIKE
 * CONVERGENT_FONTS: Optimize fsearch_awt() for linear search on Intel machine
 * 
 *    Rev 1.14   30 Aug 1993 10:51:00   MIKE
 * Changed convergent fonts to use AWT2 format (Motorola).
 * 
 *    Rev 1.13   16 Aug 1993 13:38:50   JOE
 * In ROM version of IXinit(), set "fontindex.entry_ct" to 0 if IF is
 * disabled. This is done to avoid using a null pointer "fontindex.pfnt_index"
 * to calculate this value.
 * 
 *    Rev 1.12   12 Aug 1993 10:26:08   MIKE
 * Modified CVsearch_awt() (used to be CVread_awt_header).
 * 
 *    Rev 1.11   02 Aug 1993 09:27:42   JOE
 * Support for PS ROM - In ROM version of IXinit(), if processing PS ROM,
 * BUFFalloc 'CHARBUFSIZE' bytes instead of 'EXPBUFSIZE' bytes.
 * 
 *    Rev 1.10   15 Jul 1993 11:37:44   MIKE
 * Put code in init_font_index() to init TT plugin in IF format.
 * CONVERGENT_FONTS: Added CVread_awt_header().
 * 
 *    Rev 1.9   28 Jun 1993 14:04:12   JOE
 * In IXget_fnt_index(), generalized the code which tests if the font index
 * entry has changed. Replaced "0x3c00" with "FC..." definitions.
 * 
 *    Rev 1.8   24 Jun 1993 14:17:22   JOE
 * In IXget_fnt_index(), if processing KANJI fonts, check encoding value in
 * addition to pathname before determining that TFS font has not changed.
 * This fixes a bug when switching from JIS to SJIS encoding and vice versa.
 * Included "kanji.h".
 * 
 *    Rev 1.7   15 Jun 1993 10:34:04   JOE
 * Moved "vxWorks.h" before "port.h" to resolve conflicts.
 * 
 *    Rev 1.6   12 May 1993 15:59:14   ROB
 * Conditionalize 'core_list[]', save 32 bytes.
 * 
 *    Rev 1.5   06 May 1993 16:50:38   JOE
 * In !DYNAMIC_FONTS version of IXget_fnt_index(), conditionally compiled
 * references to font_hdr field of font context to resolve compiler error.
 * 
 *    Rev 1.4   22 Apr 1993 11:15:04   MIKE
 * Rewrite IXget_fnt_index() to support IF dynamic fonts.
 * 
 *    Rev 1.3   12 Feb 1993 13:25:30   JOE
 * VXWorks support.
 * 
 *    Rev 1.2   06 Jan 1993 15:34:52   JOE
 * ANSI C function declaration changes.
 * 
 *    Rev 1.1   14 Dec 1992 15:56:50   LISA
 * Made change to Log keyword
 * 
 *    Rev 1.0   09 Dec 1992 15:38:46   LISA
 * Initial revision.
*/
/* $Date:   Dec 14 2004 14:17:46  $ */
/* ix.c */
/*
 *
 *  HISTORY:
 *
 *   12-Apr-90   jfd   In routine IXget_fnt_index, filter out bit 2
 *                     (italic/nonitalic flag) of "bucket_num" because
 *                     it is being used as an index into "hplugin"
 *    05-May-90  awr   Character buffer is fixed size- allocated once
 *    28-May-90  awr   if.fnt and if.ss are in directory ufstPath[].
 *    01-Jul-90  awr   Add "screen_fnt_ct" to determine if generic
 *                     screen fonts were installed.
 *    22-Jul-90  awr   Initialized ufstPath = "" for multicaller.
 *    23-Jul-90  awr   Merged Blake's default typeface path code in
 *    29-Jul-90  awr   changed conditional compile on MEMstat() from DEBUG
 *                     to MEM_TRACE
 *    18-Aug-90  awr   Correct buildpath() to not insert a "\" at the
 *                     beginning if source1 is null.
 *    04-Sep-90  awr   Removed find_compound()- no longer referenced.
 *    04-Dec-90  jfd   Moved "include" statement for  "cgconfig.h" to line
 *                     following "port.h"
 *    19-Dec-90  jfd   IFB on a Printer changes:
 *                     1.) In IXget_fnt_index(), change argument from
 *                         (LONG) to (FONTCONTEXT *).
 *                         Changed references of "hp" to "hix".
 *                         Changed references of "p" to "ix".
 *                     2.) Replace CC elements with fields from CHR_DEF_HDR
 *                         structure.
 *     7 Jan 91  ss    Added PCLEO_RDR support
 *    28-Jan-91  tnc   Window-ized file "close" and "read".
 *
 *    28-Jan-91  jfd   Made size arg of MEMalloc() LONG
 *    30-Jan-91  dET   Added function prototyping for MSC
 *    31-Jan-91  dET   Modify for MSC multi-model compilation.
 *     4-Feb-91  awr   Split off symbolset code to symmap.c.
 *    04-Mar-91  jfd   Conditionally declared FIpath (#if !ROM).
 *                     In FIentry(), fixed bug when comparing "j" to
 *                     MAX_UWORD.
 *    15 May 91  ss    Deleted references to COMPRESS.  This includes updating
 *                     references to FMalloc_rd() for 2 less parameters.
 *                     Added support for SLIM_FONTS and 15 plugins.
 *    06-Jun-91  jfd   SUN support.
 *                     (FIX FROM EARLIER VERSION)
 *
 *                     Moved debug.h after port.h
 *                     (FIX FROM EARLIER VERSION)
 *     5 Jun 91  ss    Added FIXED_PITCH support.
 *                     Deleted defines ZERO and NO_CMP, no longer needed.
 *    26-Aug-91  jfd   In IXget_fnt_index(), declaring "w" conditionally
 *                     based on FIXED_PITCH | SLIM_FONTS to get rid of
 *                     compiler warning.
 *    17 Sep 91  ss    Added line to set chr_def_hdr.font_hdr vs ix_extra->p_r
 *                     in IXget_fnt_index() for PCLEO_RDR and disk (!ROM).
 *    20 Sep 91  ss    Reordered plugin_list[] SLIM top level typeface
 *                     numbers to correctly match bucket_num settings.
 *    29-Sep-91  awr   IXinit() and IXexit() use CGIFinitstatus
 *     3 Oct 91  ss    Put is_fpitch back into IXget_fnt_index() since it
 *                     was incorrectly "cleaned up."
 *     4 Oct 91  ss    Added SPARC support.
 *    14-Oct-91  jfd   In IXinit() (ROM version), changed "got" to "goto"
 *                     to correct a compiler error. In same routine, 
 *                     removed call to BUFfree() with argument
 *                     "fontindex.hfnt_index" because it was unnecessary.
 *                     In same routine, changed "goto err3" to "goto err2"
 *                     because label "err3" was removed.
 *    28-Oct-91  jfd   Changed argument of function prototype for PCLmapLS()
 *                     from (HPFH *) to (PHPFH) to get rid of compiler
 *                     warning when building medium model.
 *     6-Jan-92  awr   UFST support added to IXgetfnt_index()
 *    15-Jan-92  jfd   Added functofin prototype for IXset_search_path().
 *    24-Feb-92  jfd   In IXget_fnt_index(), conditionally compiled
 *                     setting of "fontindex.cur_font_hdr" based on
 *                     EXTERN_FONT.
 *     8-Mar-92  awr   Added core font substitution for PS and TT
 *    13-Mar-92  jfd   In init_font_index(), add check for compatability
 *                     between plugin and fonts.
 *    19-Mar-92  jfd   Changed list of "core_list" fonts to agree with top
 *                     level of slim fonts
 *    03-Apr-92  rs    Portability cleanup (see port.h).
 *    06-Apr-92  rs    Change 'FIXED_PITCH' to 'CGFIXED_PITCH' (portability).
 *    23 Apr 92  ss    In IXset_search_path(), now initialize elements of
 *                     fontindex.icur_index array before filling it in.
 *                     - Added code to fontindex.num_searches field based
 *                     on new scheme which doesn't set icur_index[0] to
 *                     typeface sensitive but does use it for the core
 *                     typeface needed for PS & TT.
 *                     Added set of new field fontindex.media.
 *    11 May 92  ss    In IXset_search_path(), only set icur_index entries
 *                     which are relevant.  Moved set of num_searches to
 *                     only set when actually add to a search level.
 *    21 May 92  ss    Cleaned up code for FIXED_PITCH including code for
 *                     Letter Gothic plugins now available.
 *    19-Jun-92  ss    In init_font_index(), if don't have Letter Gothic or
 *                     Courier plugins, set plugin values to MAX_UWORD.
 *   1 Jul 92  ss       Moved port.h to top to access defines earlier.
 *                      Changed conditional on SUN to UNIX to be more general.
 *  08-Jul-92  rs       Code cleanup.
 *  21-Jul-92  awr      Conditional compile changes.
 *   5-Aug-92  jfd      Removed function prototypes for "clear_mem()".
 *                      Never references here.
 *  10-Aug-92  rs       Change args in IXmak_font_index() from SW16 to int,
 *                      SL32 to long for 32 bit systems (Watcom C386).
 *  23-Sep-92  jfd      INTEL960 conditional compile changes.
 *  28-Sep-92  awr      Removed fontindex.media.
 *                      Changed FIentry() parameter to int.
 *  30-Sep-92  jfd      Removed conditional compiles based on SPARC and
 *                      replaced with conditional compiles based on
 *                      (NAT_ALIGN == 4) wherever possible.
 *  08-Oct-92  jfd      In IXget_fnt_index(), conditionally compiled line
 *                      which retrieved font_hdr from font context.
 *  10-Oct-92  rs       Add #include <string.h>.
 *  12-Oct-92  mby     In IXget_fnt_index() fix bug with fontindex.pathname
 *  12-Oct-92  awr      Added not_intellifont bit to CGIFinitstate
 *  14-Oct-92  awr      Added cur_ssnum to font matching list
 *                      Conditionally compiled out Intellifont
 *  16-Oct-92  jfd      In init_font_index(), resetting the 'not_intellifont'
 *                      bit if ROM.
 *  02-Nov-92  jfd      Changed conditional compiled from IF_RDR to
 *                      (IF_RDR || PS_IFPLUG || TT_IFPLUG).
 *  15-Nov-92  rs       Port to Mac -> include <unix.h> instead of <io.h>.
 *  06-Jan-93  jfd      ANSI C function declaration changes.
 *  08-Feb-93  jfd      VXWorks support.
 *  01-Apr-93  mby      Rewrite IXget_fnt_index() for dynamic fonts support.
 *  06-May-93  jfd      In !DYNAMIC_FONTS version of IXget_fnt_index(),
 *                      conditionally compiled references to font_hdr field
 *                      of font context to resolve compiler error.
 *  12-May-93  rs       Save 32 bytes by conditionalizing 'core_list[]' on
 *                      (NON_IF_FONT && (PS_IFPLUG || TT_IFPLUG)).
 *  15-Jun-93  jfd      Moved "vxWorks.h" before "port.h" to resolve conflicts.
 *  24-Jun-93  jfd      In IXget_fnt_index(), if processing KANJI fonts,
 *                      check encoding value in addition to pathname before
 *                      determining that TFS font has not changed. This fixes
 *                      a bug when switching from JIS to SJIS encoding and 
 *                      vice versa.
 *                      Included "kanji.h".
 *  28-Jun-93  jfd      In IXget_fnt_index() (both versions), generalized the
 *                      code which tests if the font index entry has changed.
 *                      For PS, TT or KANJI fonts, the symbolset is checked 
 *                      in addition to the pathname before determine that 
 *                      the font index has not changed.
 *                      In IXget_fnt_index() (both versions), replaced 
 *                      "0x3c00" with "(FC_FONTTYPE_MASK | FC_EXTERN_TYPE | 
 *                      FC_ROM_TYPE)".
 *  12-Jul-93  mby      In init_font_index(), code to initialize TT plugin in IF format.
 *  15-Jul-93  mby      CONVERGENT_FONTS: Moved CVread_awt_header() to this module.
 *  29-Jul-93  jfd      Support for PS ROM font - In ROM version of IXinit(),
 *                      if processing PS ROM font, BUFalloc 'CHARBUFSIZE' 
 *                      bytes instead of 'EXPBUFSIZE' bytes.
 *  12-Aug-93  mby      Modified CVsearch_awt() (used to be CVread_awt_header).
 *  16-Aug-93  jfd      In ROM version of IXinit(), set "fontindex.entry_ct"
 *                      to 0 if IF is disabled. This is done to avoid
 *                      using a null pointer "fontindex.pfnt_index" to
 *                      calculate this value.
 *  24-Aug-93  mby      Made changes in CVsearch_awt() & fsearch_awt() to read
 *                      AWT data in Motorola-only format, so code can be platform
 *                      independent. Added improved SWAPW and SWAPL macros.
 *  09-Sep-93  mby      Optimize fsearch_awt() for linear search on INTEL platforms.
 *  06-Oct-93  mby      CVsearch_awt -> CVFsearch_awt(). Restructured.
 *                      Added CVFget_fnt_index().
 *                  **  awtData.scaleFactor is hard-coded to 8782. In the
 *                      future it should be read from the awt file.
 *                      In IXset_search_path(), put fst_type code inside
 *                      NON_IF_FONT && (PS_IFPLUG || TT_IFPLUG).
 *  25-Oct-93  mby      fsearch_awt() to return a width of 0 if charnum isn't
 *                      found in the AWT table.
 *  28-Oct-93  jfd      In !LINT_ARGS function prototype for set_tt_universal(),
 *                      removed argument type to resolve compiler error.
 *  01-Dec-93  jfd      Changed KANJI_ENCODING to ASIAN_ENCODING.
 *  02-Dec-93  mby      Change awt code to read em resolution from bytes 22-23.
 *  08-Dec-93  rs       General cleanup - DOS & FLAT -> CGFLAT32.
 *  06-Jan-94  mby      Added constants AWT_ITAL & AWT_NHOC for AWT3 table. Not implemented yet.
 *  26-Jan-94  jfd      Conditionally compiled out #include for unistd.h .
 *                      Conditionally compiled #include for fcntl.h (if 
 *                      !defined(_AM29K) || (defined(_AM29K) && defined(UNIX) ).
 *                      In IXset_search_path(), fixed problem with fixed
 *                      pitch plugin processing (return SUCCESS if the 2
 *                      weight sensitive plugins are neither B_LETTER_GOTHIC
 *                      nor B_COURIER ).
 *  02-Feb-94  mby      AWT table header extended to 48 bytes (AWT4).
 *                      Read italic angle and horizontal offsets from AWT
 *                      table to support Convergent Fonts II (obliqued).
 *                      Added binary search routine CVF_bsearch().
 *                      Renamed fsearch_awt() => CVF_lsearch() [linear].
 *  04-Feb-94  jfd      Conditionally compiled #include for io.h (if !_AM29K).
 *                      Including "hif.h" if _AM29K.
 *  09-Feb-94  jfd      Did not fully implement bug fix for IXset_search_path()
 *                      which was mentioned above. In addition to returning
 *                      SUCCESS, no longer setting "fontindex.cur_tf_num" to
 *                      0.
 *  06-Mar-94  mby      Changes to support AWT4 format. Got rid of
 *                      CVF_lsearch(), replaced by CVF_bsearch().
 *  22-Apr-94  jfd      Changed conditional compile statement prior to
 *                      including <hif.h> to #if (_AM29K && !UNIX) to
 *                      resolve UNIX Metaware compiler error.
 *  23-Sep-94  jfd      In IXget_fnt_index(), when checking if IF ROM or
 *                      disk, also check that it is not a foreign bitmap.
 * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
 *  FCO Changes from 1.25.1.2:
 *  15-Mar-94  mby      In IXget_fnt_index(), has_path should make itself 0
 *                      for FCO font type.
 *  18-Jul-94  mby     In IXget_fnt_index (DYNAMIC_FONTS) add FCO test
 *                     in ROM code.
 * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
 *  02-Sep-94  mby     In IXget_fnt_index() set fontindex.fcoSearchPath_on=0.
 *  29-Nov-94  jfd     In init_font_index(), if FCO_RDR is enabled, add case
 *                     check for plug count = 0 since it is now valid to
 *                     build font index file without plugins.
 *  11-Jan-95  jfd/dbk In IXinit(), changed conditional compile statement
 *                     so that "entry_ct" is set to 0 if FCO_RDR.
 *  23-Jan-95  jfd/dah In IXinit(), corrected earlier change regarding
 *                     setting of "entry_ct".
 *  26-Jan-95  jfd     Moved declaration of "if_state" outside of
 *                     conditional compile for CONVERGENT_FONTS.
 *  12-Jan-96  dbk     Moved prototype for init_font_index() to resolve
 *                     compiler error.
 *  27-Feb-96  mby     Made references to "hchar_buf" conditional on
 *                     IF_RDR || PST1_RDR. BUFFER pool saves 2K for ROM, 4K for disk.
 *  22-Apr-96  mby     Conditionalize <fcntl.h> for OS9 port.
 *  13-Jun-96  jwd     Revised definitions of extern_font and font_type flags,
 *                     to allow full support of FORMAT16 data.
 *  17-Jun-96  dbk     Made ifdef changes based on NO_SYMSET_MAPPING.
 *  26-Aug-96  mby     fontindex.fcoMakeNewSrchPath replaces "fcoSearchPath_on".
 *  10-Jan-97  dlk     Removed SCREEN_FONTS option as part of project to
 *                     trim ufst.
 *  13-Jan-97  dlk     Removed CONVERGENT_FONTS option as part of project to
 *                     trim ufst.
 *                     This eliminated CVFget_fnt_index(),CVF_bsearch(), and
 *                     CVF_lsearch().
 *  16-Jun-97  slg     allow PSOS compilation
 *  18-Jun-97  slg     Allow PTV_OS compilation
 *  16-Sep-97  slg     Allow ARM/Helios compilation
 *     30-Jan-98  slg     Delete code for unused TT plugin options.
 *     11-Mar-98  slg     Don't use "long" dcls (incorrect if 64-bit platform);
 *                     also integrate Jim's Alpha-port change
 *     01-Apr-98  slg     Move some referenced GLOBALs into IF_STATE.
 *     14-Apr-98  slg     Move GLOBAL fontindex into IF_STATE.
 *  08-Dec-98  jwd     Upgraded character buffer allocation code for CFF, to
 *                     ensure enough memory available for raw character data.
 *  12-Dec-98  jwd     Revised IXinit() handling of entry_ct to not use fc_ macros,
 *                     as no valid fontcontext structure present here. Key off of
 *                     IF ROM pointer instead (CGIFinitROMinfo()).
 *  25-Jan-99  jwd     Revised handling of font_type variable to allow FORMAT16 
 *                     and ASIAN_ENCODING independence
 *  08-Feb-99  slg        In IXinit(), only free "fontindex.hfnt_index" if
 *                        (IF_RDR || PS_IFPLUG) - fixes crash at startup time if
 *                        PST1_DISK and SS files not found.
 *  28-July-99 ks       Changed DEBUG compiler directive to AGFADEBUG. 
 *    28-Jan-00  slg        Use PATHNAMELEN (from port.h) rather than locally-defined (and
 *                          incorrect) MAXNAME; replace some !ROM tests by DISK_FONTS. 
 *  10-Feb-00  awr     Removed PST1_ROM
 *  24-Aug-01  jwd   DISK/ROM changes.
 *  15-Aug-02  awr     Added DIMM_DISK
 *  13-Aug-03  jfd     Added "table-by-reference" support.
 *  20-Aug-03  jfd     Added "FSA0" argument to ttTBLexit() call in IXexit().
 *
*/

#include "cgconfig.h"

#ifdef VXWORKS
#include "vxWorks.h"
#endif

#include "ufstport.h"

#include <stdio.h>

#if MAYBE_FCNTL_H
#include <fcntl.h>
#endif

#if MAYBE_FCNTL_HIF_H
#include <fcntl.h>
#include <hif.h>  /* 2-7-94 jfd */
#endif

#include <string.h>

#if MAYBE_UNISTD_H
#include <unistd.h>
#endif

#if MAYBE_IO_H
#include <io.h>
#endif

#include "dbg_ufst.h"
#include "shareinc.h"
#include "mixmodel.h"


#if IF_RDR
#ifdef LINT_ARGS
MLOCAL UW16        init_font_index(FSP0);
#else
MLOCAL UW16        init_font_index();
#endif    /* LINT_ARGS  */
#endif    /* IF_RDR */


#if (IF_RDR || PS_IFPLUG)   /*  Intellifont plugins  */

/*------------------*/
/*     FIBUF       */
/*------------------*/
/*  Macro to return a LPSB8 to the fontindex buffer. This
 *  pointer is obtained differently for ROM and disk based systems.
 */
#if (NAT_ALIGN == 4)  
#define ENTRY_CT_SIZE sizeof(SL32)
#elif (NAT_ALIGN == 8)
#define ENTRY_CT_SIZE sizeof(SL64)
#else
#define ENTRY_CT_SIZE sizeof(SW16)
#endif

#if IF_ROM
#define FIBUF (if_state.fontindex.pfnt_index + ENTRY_CT_SIZE)
#else
#define FIBUF (((LPSB8)MEMptr(if_state.fontindex.hfnt_index)) + ENTRY_CT_SIZE)
#endif  /* IF_ROM */

/*------------------*/
/*     FIentry      */
/*------------------*/
/*  Return a pointer to a font index entry corresponding to the "i th"
 *  search level.
 *  NOTE: The array icur_index[] contains the index numbers into the
 *        array FIBUF of library font files.
 */
#if defined (ANSI_DEFS)
GLOBAL PINDEX_ENTRY FIentry(FSP SL32 buck_search_lvl)
#else
GLOBAL PINDEX_ENTRY
FIentry(buck_search_lvl)
    SL32 buck_search_lvl;
#endif
{
        return (PINDEX_ENTRY)FIBUF + if_state.fontindex.icur_index[buck_search_lvl];
}

#if IF_DISK || ((DISK_FONTS && !ROM) && IF_PCLEOI)

/*------------------*/
/*     FIpath       */
/*------------------*/
#if defined (ANSI_DEFS)
GLOBAL LPSB8 FIpath(FSP PINDEX_ENTRY ix)
#else
GLOBAL LPSB8
FIpath(ix)
    PINDEX_ENTRY ix;
#endif
{
    return FIBUF + if_state.fontindex.olibnames + ix->name_off;
}

/*------------------*/
/* IXmak_font_index */
/*------------------*/
#if defined (ANSI_DEFS)
GLOBAL UW16  IXmak_font_index(FSP LPSB8 fname)
#else
GLOBAL UW16
IXmak_font_index(fname)
    LPSB8 fname;        /*  file name of font index file     */
#endif
{
    SL32        f; /* SW16 to int - 8/10/92 - rs */
#if USING_16_BIT_DOS        /* 16 bit platform */
    UW16      index_size;
#else                         /* 32 bit platform */
    SL32       index_size; /* UW16 to int - 8/10/92 */
#endif
    MEM_HANDLE  hbuf;
    SB8        pathname[PATHNAMELEN];
#ifdef AGFADEBUG
    SW16           i;
    PINDEX_ENTRY   p;
#endif

    DBG1("IXmak_font_index(%s)\n", fname);

  /* Build full pathname */

    buildpath (pathname, if_state.ufstPath, fname);
    
  /* Read font index table */

    if ((f = OPEN(pathname, O_READFLAGS)) == -1)
    {
        DBG1("Font index file %s not found\n", pathname);
        return ERR_no_font_index;
    }

#if USING_16_BIT_DOS         /* 16 bit platform */
    index_size = (UW16)LSEEK(f, 0L, SEEK_END);
    DBG1("index_size = %d\n", index_size);
#else                         /* 32 bit platform */
    index_size = (SL32)LSEEK(f, 0L, SEEK_END);
    DBG1("index_size = %ld\n", index_size);
#endif

    hbuf = FMalloc_rd(FSA f, index_size, 0L);
    CLOSE(f);
    if(!hbuf)
    {
        DBG("read font index failed\n");
        return ERR_rd_font_index;
    }

/* Initialize fontindex */
    if_state.fontindex.hfnt_index = hbuf;
#if (NAT_ALIGN >= 4)    /* wrote out as long, but only need word  -ss 8/27/91 */
    if_state.fontindex.entry_ct = (SW16)*((LPSL32)MEMptr(hbuf));
#else
    if_state.fontindex.entry_ct = *((LPSW16)MEMptr(hbuf));
#endif
    if_state.fontindex.olibnames  = if_state.fontindex.entry_ct * sizeof(INDEX_ENTRY);
    if_state.fontindex.cur_tf_num = 0;
    if_state.fontindex.cur_font_hdr = (LPUB8)NULL;
    if_state.fontindex.font_type    = 0;
    if_state.fontindex.cur_ssnum    = (UW16)0;
#if DISK_FONTS
    if_state.fontindex.has_path     = FALSE;
#endif

#ifdef AGFADEBUG
    if(UFST_get_debug(FSA0))
    {
        DBG("\n\nF o n t    I n d e x\n");
        DBG1("entry_ct = %d\n", if_state.fontindex.entry_ct);
        DBG1("    size of entry = %d\n", sizeof(INDEX_ENTRY));
        for(i = 0, p = (PINDEX_ENTRY)FIBUF; i<if_state.fontindex.entry_ct;  i++, p++)
#if (defined(M_I86SM) || defined(M_I86MM) || defined (M_I86TM))
            DBG5("%ld %Fs %lu %u %d\n", p->tfnum,
                                    FIpath(FSA p),
                                    p->fhoff, p->fhcount, p->bucket_num);
#else
            DBG5("%ld %s %lu %u %d\n", p->tfnum,
                                     FIpath(FSA p),
                                     p->fhoff, p->fhcount, p->bucket_num);
#endif

    }
#endif  /* AGFADEBUG */

    return SUCCESS;
}
#endif  /*  IF_DISK || ((DISK_FONTS && !ROM) && IF_PCLEOI)  */


#if (PS_IFPLUG)
CONST SL32 core_list[8]={
                 92500L, 92504L, 94021L, 94023L, 92501L, 92505L,
                 94022L, 94024L};
#endif

CONST SL32 plugin_list[ NMAX_PLUGINS ] = {
#if SLIM_FONTS      /*  reordered PSW #'s to match bucket_num -ss 9/30/91 */
  6305, 6309, 6307, 6311,  /* Top level - posture, weight, serif sensitive */
  6306, 6310, 6308, 6312,
#endif
  5720, 5721, 5723, 5724,  /* Originals - weight & serif sensitive         */
#if SLIM_FONTS
  5717, 5718,              /* Weight sensitive                             */
#endif
  5719                 };  /* Universals                                   */

/*  masks for checking if all correct typefaces are loaded.  The values   */
/* vary depending on how plugin_list is compiled.                         */
#if SLIM_FONTS
#define FULL_PLUGIN_SET   0x7FFF      /* all 15 buckets  */
#define MED_PLUGIN_SET    0x7F00      /* missing top level - 7 buckets    */
#define ORIG_PLUGIN_SET   0x4F00      /* original 2 level, 5 buckets      */
#define SMALL_PLUGIN_SET  0x4300      /* original small_plugins, 3 buckets*/
#else
#define ORIG_PLUGIN_SET   0x001F      /* original 2 level, 5 buckets      */
#define SMALL_PLUGIN_SET  0x0013      /* original small_plugins, 3 buckets*/
#endif

#if IF_RDR
/*------------------*/
/*  init_font_index */
/*------------------*/
#if defined (ANSI_DEFS)
MLOCAL UW16 init_font_index(FSP0)
#else
MLOCAL UW16
init_font_index()
#endif
{
#if IF_DISK
    UW16         status;
#endif
    SW16          i, j;
    PINDEX_ENTRY  ix;
    UW16         plug_ct;
    UL32         plugin_mask = 0L;
#if CGFIXED_PITCH
    UW16         courier_mask = 0,
                  lgothic_mask = 0;
#endif
    BOOLEAN       have_fat_plugins = TRUE;  /* 3-13-92 */
    BOOLEAN       have_slim_fonts = FALSE;  /* 3-13-92 */

    DBG("init_font_index\n");

  /* Allocate and read font index table */
#if IF_DISK            /*  already set this up for ROM        */
    status = IXmak_font_index(FSA (LPSB8)"if.fnt");
    if (status)
    {
        if(status != ERR_no_font_index)
            return status;
    }
    else
        if_state.CGIFinitstate &= ~not_intellifont;
#else
        if_state.CGIFinitstate &= ~not_intellifont;
#endif

  /* Find plugins */

    plug_ct = 0;
    if_state.fontindex.plugin_set = 0;     /* initialize -ss 5/11/92 */
    ix      = (PINDEX_ENTRY)FIBUF;
    for( i = 0; i < if_state.fontindex.entry_ct; i++, ix++ )
    {

#if CGFIXED_PITCH
        if( B_ISFPITCH(ix) )
        {
           if( (ix->bucket_num & B_COURIER) == B_COURIER )
           {
              j = -1;
              if( ix->tfnum == 4415 )       /* Courier roman     */
                j = 0;
              else if( ix->tfnum == 4416 )  /* Courier bold      */
                j = 1;
              else if( ix->tfnum == 4414 )  /* Courier universal */
                j = 2;
              else continue;

              if( j >= 0 )     /* found a plugin, log it -ss 5/19/92 */
              {
                 if_state.fontindex.courier_iplugin[ j ] = i;
                 courier_mask |= 1 << j;
              }
              continue;
           }
           if( (ix->bucket_num & B_LETTER_GOTHIC) == B_LETTER_GOTHIC )
           {
              j = -1;
              if( ix->tfnum == 4938 )   /* Letter Gothic roman     */
                j = 0;
              if( ix->tfnum == 4939 )   /* Letter Gothic bold      */
                j = 1;
              if( ix->tfnum == 4941 )   /* Letter Gothic universal */
                j = 2;

              if( j >= 0 )     /* found a plugin, log it -ss 5/19/92 */
              {
                 if_state.fontindex.lgothic_iplugin[ j ] = i;
                 lgothic_mask |= 1 << j;
              }
              continue;
           }
        }
#endif  /*  CGFIXED_PITCH  */

      /* search for tfnum in list of plugins to order iplugin */
      for( j = 0; j < NMAX_PLUGINS; j++ )
      {
         if( ix->tfnum == plugin_list[j] )
         {
            if_state.fontindex.iplugin[j] = i;
            plug_ct++;

            have_fat_plugins = ((ix->bucket_num & FILEORG_MASK) == D_LIB);  /* 3-13-92 */

            plugin_mask |= 1 << j;   /* turn on bit representing this tfnum */
            break;
         }
         else
            if ((ix->bucket_num & FILEORG_MASK) != D_LIB)
               have_slim_fonts = TRUE; /* 3-13-92 */
      }  /*  end - for j  */

/* If using IF core to augment TT or PS */
#if (PS_IFPLUG)
    /* Set up icore[], the font index entries for the core 8. This array
     * is parallel to the static array core_list[8] defined above. The
     * low three bits of bucket_num can be used to index directly into
     * these arrays to find the matching Intellifont face to augment
     * PostScript and TrueType character sets.
     */
        for(j=0; j<8; j++)
            if(ix->tfnum == core_list[j])
                if_state.fontindex.icore[j] = i;
#endif

    }  /*  end - for i  */

    /* check for incompatability between plugins and fonts  3-13-92 */
#if !FCO_RDR
    if (have_fat_plugins && have_slim_fonts)
    {
       DBG("    plugins incompatable with fonts\n");
       return ERR_incompatable_plugin;
    }
#else
    have_slim_fonts=have_slim_fonts;
    have_fat_plugins=have_fat_plugins;
#endif

    /* match exactly the tfnums required for a particular plugin scheme */
    switch( plug_ct )
    {
#if SLIM_FONTS
      case 15: if( plugin_mask != FULL_PLUGIN_SET )  /* all 15 typefaces  */
               {
                  DBG("    missing plugin\n");
                  return ERR_missing_plugin;
               }
               if_state.fontindex.plugin_set = FULL_PLUGIN_SET;
               break;
      case  7: if( plugin_mask != MED_PLUGIN_SET )      /* 7 typefaces    */
               {
                  DBG("    missing plugin\n");
                  return ERR_missing_plugin;
               }
               if_state.fontindex.plugin_set = MED_PLUGIN_SET;
               break;
#endif  /*  SLIM_FONTS  */
      case  5: if( plugin_mask != ORIG_PLUGIN_SET )     /*  5 typefaces   */
               {
                  DBG("    missing plugin\n");
                  return ERR_missing_plugin;
               }
               if_state.fontindex.plugin_set = ORIG_PLUGIN_SET;
               break;
      case  3: if( plugin_mask != SMALL_PLUGIN_SET )    /* 3 typefaces    */
               {
                  DBG("    missing plugin\n");
                  return ERR_missing_plugin;
               }
               if_state.fontindex.plugin_set = SMALL_PLUGIN_SET;
               break;
#if FCO_RDR
      case  0: break;
#endif
      default: DBG("    plugins incompatable with fonts\n");  /* 3-13-92 */
               return ERR_incompatable_plugin;
    }   /*  end - switch plug_ct */

#if CGFIXED_PITCH
    /* check that have 3 plugins for each typeface   */
    /*  Can have zero plugins or exactly 3 plugins   */
    if( courier_mask != 0x07 && courier_mask != 0 )
    {
         DBG("    missing fixed pitch plugin (courier)\n");
         return ERR_missing_plugin;
    }
    /*  Can have zero plugins or exactly 3 plugins   */
    if( lgothic_mask != 0x07 && lgothic_mask != 0 )
    {
         DBG("    missing fixed pitch plugin (lgothic)\n");
         return ERR_missing_plugin;
    }
    if( courier_mask == 0 )
       if_state.fontindex.courier_iplugin[0] = 
       if_state.fontindex.courier_iplugin[1] = 
       if_state.fontindex.courier_iplugin[2] = MAX_UWORD; 
    if( lgothic_mask == 0 )
       if_state.fontindex.lgothic_iplugin[0] = 
       if_state.fontindex.lgothic_iplugin[1] = 
       if_state.fontindex.lgothic_iplugin[2] = MAX_UWORD; 
#endif  /*  CGFIXED_PITCH  */

    return SUCCESS;
}
#endif    /* IF_RDR */


/*---------------------*/
/*  IXset_search_path  */
/*---------------------*/
/*  Set up the plugin search path for the current TFS typeface.
 *  It is only called to set up the search path when using Intellifont
 *  plugins.
 *
 *  The search path is a list of typeface library files that are to
 *  be searched in order to find any particular character in the font
 *  defined by the FONTCONTEXT. The current search path is an array in
 *  the FONTINDEX called fontindex.icur_index[].  Each element in the
 *  array is the index number of an INDEX_ENTRY in the font index
 *  file (if.fnt or ROM equivalent).
 */
#if defined (ANSI_DEFS)
GLOBAL UW16  IXset_search_path(FSP SW16 bucket_num)
#else
GLOBAL UW16
IXset_search_path(bucket_num)
    SW16 bucket_num;
#endif
{
    LPUW16         ci;                   /* pointer to icur_index   */
    SL32            i;
    LPUW16         sw,
                   u;
#if (CGFIXED_PITCH | SLIM_FONTS)
    LPUW16         w;
#endif
#if SLIM_FONTS
    LPUW16         psw;
#endif

    if(if_state.CGIFinitstate & not_intellifont)   /* Intellifont not active */
        return SUCCESS;


     /* clear indexes to plugin path */
     ci  = if_state.fontindex.icur_index;   /* list of current indexes to build  */
     for( i = 0; i < NBUCKET_LEVELS; i++ )
       *ci++ = MAX_UWORD;          /* initialize to an invalid value    */
     ci  = if_state.fontindex.icur_index;   /* rewind for next use               */

#if (PS_IFPLUG)
     /* If not IF type, have want to reference a core typeface for missing */
     /*  characters before checking the plugins. Set the first level in    */
     /*  the plugin array to one of the 8 core typefaces that matches.     */
    {
     SL32 fst_type = if_state.fontindex.font_type & FC_FONTTYPE_MASK;  /* mby 10-06-93 */
     if(fst_type == FC_PST1_TYPE && PS_IFPLUG)
     {
        *ci++ = if_state.fontindex.icore[bucket_num & 7];
        if_state.fontindex.num_searches++;            /* added another search level */
     }
    }
#endif


#if CGFIXED_PITCH
     if(bucket_num & B_FP_PLUGIN_MASK)
     {
       /* next are the 2 weight sensitive plugins                */
       if( (bucket_num & B_LETTER_GOTHIC) == B_LETTER_GOTHIC )
          w = if_state.fontindex.lgothic_iplugin;
       else if( (bucket_num & B_COURIER) == B_COURIER )
          w = if_state.fontindex.courier_iplugin;
       else
       {
       /*   if_state.fontindex.cur_tf_num = 0;   invalid font */
          return SUCCESS;  /* JPK */
       }

       /*  universal is 3rd  */
       u = w + 2;

       *ci++ = w[ bucket_num & 0x01 ];  /* use only low 1 bit   */
       *ci   = *u;
       if_state.fontindex.num_searches += 2;
       return SUCCESS;
     }
#endif  /*  CGFIXED_PITCH  */

    /*  If(small_plugins) the bolds aren't loaded so use normals
     *  instead.
     */
     if(if_state.fontindex.plugin_set == SMALL_PLUGIN_SET)
       bucket_num &= 2;

#if SLIM_FONTS
    psw = if_state.fontindex.iplugin;      /* posture/serif/weight at beginning */
    sw  = psw + NPSW_FACES;       /* serif/weight faces after PSW      */
    w   = sw  + NSW_FACES;        /* weight faces after SW faces       */
    u   = w   + NW_FACES;         /* Universal after W faces           */
#else
    sw  = if_state.fontindex.iplugin;      /* serif/weight                      */
    u   = sw  + NSW_FACES;        /* Universal                         */
#endif


#if SLIM_FONTS
    if(if_state.fontindex.plugin_set == FULL_PLUGIN_SET)
    {
       *ci++ = psw[ bucket_num & 0x07 ];  /* Lim Sensitive:       */
        if_state.fontindex.num_searches++;
    }
#endif
    *ci++ = sw[ bucket_num & 0x03 ];   /*    low 2 bits only   */
#if SLIM_FONTS
    if(if_state.fontindex.plugin_set == FULL_PLUGIN_SET 
                   || if_state.fontindex.plugin_set == MED_PLUGIN_SET )
    {
       *ci++ = w[ bucket_num & 0x01  ];   /*    low 1 bit only    */
        if_state.fontindex.num_searches++;
    }
#endif
    *ci   = *u;                        /* universal            */
    if_state.fontindex.num_searches += 2;       /* add 2 for sw & u     */

    return SUCCESS;
}
#endif /* (IF_RDR || PS_IFPLUG) */


/* error cleanup that was previously accessed by "goto err2" within IXinit */
#if defined (ANSI_DEFS)
MLOCAL VOID IXinit_error_cleanup(FSP0)
#else
MLOCAL VOID IXinit_error_cleanup()
#endif
{
#if IF_RDR || PST1_RDR
    BUFfree(FSA if_state.hchar_buf);
#endif
    BUCKexit(FSA0);
}


/*------------------*/
/*  IXinit          */
/*------------------*/
#if defined (ANSI_DEFS)
GLOBAL UW16  IXinit(FSP0)
#else
GLOBAL UW16
IXinit()
#endif
{
    UW16         status;

    if(!(if_state.CGIFinitstate & not_buf))
        return ERR_IXinit;    /* font buckets already initialized */

      /* Otherwise, initialize font buckets */
    if ((status = BUCKinit(FSA0)) != 0)
        return status;

#if ROM

  /* Allocate character buffer */

    /* Printer will not need the full character buffer since the char     */
    /*  data will already be in ROM or RAM (PCLEO) so only allocate       */
    /*  enuf for the expansion buffer.                                    */

#if IF_RDR || PST1_RDR
#if CFF_ROM || PST1_RAM
    if(!(if_state.hchar_buf = BUFalloc(FSA (SL32)CHARBUFSIZE)))   /* 7-29-93 jfd */
#else
    if(!(if_state.hchar_buf = BUFalloc(FSA (SL32)EXPBUFSIZE)))
#endif
    {
        BUCKexit(FSA0);
        return ERR_mem_char_buf;
    }
#endif    /* IF_RDR || PST1_RDR */


#if (IF_ROM || PS_IFPLUG)  /*  Intellifont plugins  */

   /* If Intellifont ROM is actually being used, the pointer to the ROM block  */
   /* ( fontindex.pfnt_index ) should have a valid value in it; this data item */
   /* gets loaded up by CGFinitROMInfo(). If IF_ROM is not being used the font */
   /* index value should be NULL, when passed in by the application.           */

   if (if_state.fontindex.pfnt_index)
#if (NAT_ALIGN >= 4)   /* wrote out as long, but only need word -ss 8/27/91 */
      if_state.fontindex.entry_ct     = (SW16)*((LPSL32)(if_state.fontindex.pfnt_index));
#else
      if_state.fontindex.entry_ct     = *((LPSW16)(if_state.fontindex.pfnt_index));
#endif
   else
      if_state.fontindex.entry_ct     = 0;
#else
   if_state.fontindex.entry_ct     = 0;
#endif  /* (IF_ROM || PS_IFPLUG)  */

   if_state.fontindex.cur_tf_num   = 0;
   if_state.fontindex.cur_font_hdr = (LPUB8)NULL;
   if_state.fontindex.font_type    = 0;
   if_state.fontindex.cur_ssnum    = (UW16)0;
#if DISK_FONTS
   if_state.fontindex.has_path     = FALSE;
#endif

#else       /* !ROM */

#if IF_RDR || PST1_RDR
    if_state.hchar_buf = BUFalloc(FSA (SL32)CHARBUFSIZE);
    if(!(if_state.hchar_buf))     /* character buffer */
    {
        BUCKexit(FSA0);
        return ERR_mem_char_buf;
    }
    if_state.char_buf = MEMptr(if_state.hchar_buf);
#endif

#endif  /*  ROM  */

#if IF_RDR
    status = init_font_index(FSA0);           /* Set up FONTINDEX */
    if (status)
    {
        IXinit_error_cleanup(FSA0);
        return status;
    }
#endif

#if (CACHE || CHAR_HANDLE) && DIRECT_TT_TABLE_ACCESS && TT_RDR
    if ((status = ttTBLinit(FSA0)) != 0)
    {
        IXinit_error_cleanup(FSA0);
        return status;
    }
#endif

    status = SYMinit(FSA0);          /* Load symbol set directory */
    if(status)
    {
#if ((IF_RDR || PS_IFPLUG) && !ROM) 
        BUFfree(FSA if_state.fontindex.hfnt_index);
#endif
        IXinit_error_cleanup(FSA0);
        return status;
    }

    if_state.CGIFinitstate &= ~not_buf;        /* turn off not initialized bit */
    return status;    /* success */
}


/*------------------*/
/*  IXexit          */
/*------------------*/
#if defined (ANSI_DEFS)
GLOBAL VOID  IXexit(FSP0)
#else
GLOBAL VOID
IXexit()
#endif
{
    DBG("\n\nIXexit()\n");

    if(if_state.CGIFinitstate & not_buf) return;   /* not initialized */

#if IF_RDR || PST1_RDR
    BUFfree(FSA if_state.hchar_buf);    /* free the character buffer      */
#endif
    BUCKexit(FSA0);            /* close down the bucket lru list */

#if (IF_DISK) /* jwd, 08/16/01 */
    if(!(if_state.CGIFinitstate & not_intellifont))
    {
        BUFfree(FSA if_state.fontindex.hfnt_index);     /* free the FONTINDEX */
        if_state.CGIFinitstate |= not_intellifont;
    }
#endif

#if (CACHE || CHAR_HANDLE) && DIRECT_TT_TABLE_ACCESS && (TT_ROM || TT_DISK || TT_ROM_ACT)
    ttTBLexit(FSA0);
#endif

    SYMexit(FSA0);              /* free the symbol set directory */

    if_state.CGIFinitstate |= not_buf;    /* set not initialized bit */

#if MEM_TRACE
    MEMstat(FSA BUFFER_POOL);
#endif
}


/*------------------*/
/*  IXget_fnt_index */
/*------------------*/
/*  Set current TypeFace Sensitive (TFS) font. */
/*
 *  There are 2 versions, compiled with DYNAMIC_FONTS = 0 or 1.
 *  If DYNAMIC_FONTS is 0, these are the possibilities:
 *   (1) For Intellifont ROM or disk, if the typeface number (fc->font_id)
 *       or the symbol set from the fontcontext has changed, then we
 *       search if.fnt until we find a matching TF number.
 *   (2) For a TT or PS font or IF PCLEO, fc->font_hdr is a pointer either
 *       to a pathname or to a PCLEO header or to the font in ROM. This
 *       is stored in fontindex along with the symbol set and TF number.
 *       We do not search if.fnt.
 *
 *  If DYNAMIC_FONT is 1, these are the possibilities:
 *   (1) and (2) behave exactly as described above.
 *   (3) The Intellifont face is specified by a pathname in fc->font_hdr.
 *       fc->font_id must be 0.
 *       First, test to see if nothing has changed.
 *       Next, try to match the path to one of the fonts in if.fnt.
 *       If this works, set the INDEX_ENTRY pointer in fontindex.
 *       Otherwise the pathname is passed along in fontindex.cur_font_hdr.
 *   (4) The IF face is specified by a pointer to ROM in fc->font_hdr.
 *       Same as (3) but with pointer instead of pathname.
 *   We can tell the difference betw. (3) and (4) by looking at fc->format.
 */

#if defined (ANSI_DEFS)
GLOBAL UW16  IXget_fnt_index(FSP PFONTCONTEXT fc)
#else
GLOBAL UW16
IXget_fnt_index(fc)
    PFONTCONTEXT fc;
#endif
{
    SL32           cur_tf_num;
    UW16           cur_ssnum;
    SL32            font_type;
    LPUB8          cur_font_hdr=0;
    BOOLEAN            has_path=FALSE;
    SL32            rom_font=0;
    SL32            extern_font=0;
#if IF_RDR
    SL32            i;
    PINDEX_ENTRY   ix;
#endif

    DBG("\nIXget_fnt_index()\n");

/*  If we've changed type faces, then find the font index entry
 *  for the new face.
 */

    font_type = (SL32)(fc->format & (FC_FONTTYPE_MASK | FC_EXTERN_TYPE | FC_ROM_TYPE)) +
                (SL32)(fc->ExtndFlags & EF_FORMAT16_TYPE);

    cur_ssnum    = fc->ssnum;
    cur_tf_num   = fc->font_id;
    cur_font_hdr = fc->font_hdr;
    
/*** DYNAMIC_FONTS=0 version of the code ***/
#if !(DYNAMIC_FONTS && IF_RDR) 

#if (PST1_DISK || TT_DISK || CFF_DISK)    /* add CFF_DISK to be consistent with other tests */
    rom_font     = (SL32)(font_type & FC_ROM_TYPE);

    extern_font  = ((font_type & FC_EXTERN_TYPE) == FC_EXTERN_TYPE) +
                   ((fc->ExtndFlags & EF_FORMAT16_TYPE) == EF_FORMAT16_TYPE);

    has_path = !extern_font && !rom_font && (FC_ISPST1(fc) || FC_ISTT(fc));
                                /* disk-based: PS or TT */
#if DIMM_DISK
    if(FC_ISDIMM_DISK(fc))
        has_path = FALSE;
#endif

    if(has_path)
    {
        if(if_state.fontindex.has_path)
        {
            if( (STRNCMP((FILECHAR *)if_state.fontindex.pathname,
                          (FILECHAR *)cur_font_hdr, PATHNAMELEN) == 0) &&
                   (cur_ssnum == if_state.fontindex.cur_ssnum))  /* 6-28-93 */
                    return SUCCESS;
        }
        STRCPY(if_state.fontindex.pathname, (FILECHAR *)cur_font_hdr);
    }
    else
#endif  /* (PST1_DISK || TT_DISK || CFF_DISK) */
      if ( (if_state.fontindex.font_type    == font_type   )  &&
             (if_state.fontindex.cur_ssnum    == cur_ssnum   )  &&
             (if_state.fontindex.cur_tf_num   == cur_tf_num  )  &&
             (if_state.fontindex.cur_font_hdr == cur_font_hdr))
          return SUCCESS;    /* haven't changed */

#if IF_RDR
    if ( !FC_ISEXTERN(fc) && FC_ISIF(fc) && !FC_ISAPPGEN(fc) ) /* IF ROM or disk, not ALIEN */
    {
        /*  Search if.fnt for INDEX_ENTRY  */
        if_state.fontindex.cur_pix = 0;          /* initialize to 0 */
        for (i=0, ix=(PINDEX_ENTRY)FIBUF;  i<if_state.fontindex.entry_ct;  i++, ix++)
            if (cur_tf_num == ix->tfnum)
               break;

        if (i >= if_state.fontindex.entry_ct)
        {
            DBG("    ERR_no_fi_entry\n");
            if_state.fontindex.cur_tf_num = 0;   /* To avoid a false match later. */
            return ERR_no_fi_entry;
        }
        if_state.fontindex.cur_pix = ix;     /* TFS INDEX_ENTRY pointer */
    } /* endif ( !FC_ISEXTERN(fc) && FC_ISIF(fc) && !FC_ISAPPGEN(fc) ) */

#endif  /* IF_RDR */

/*** DYNAMIC_FONTS=1 version of the code ***/
#else   /* DYNAMIC_FONTS && IF_RDR */

    rom_font     = (SL32)(font_type & FC_ROM_TYPE);

    extern_font  = ((font_type & FC_EXTERN_TYPE) == FC_EXTERN_TYPE) +
                   ((fc->ExtndFlags & EF_FORMAT16_TYPE) == EF_FORMAT16_TYPE);

    has_path = !extern_font && !rom_font && !cur_tf_num
#if FCO_RDR
               && !FC_ISFCO(fc)
#endif
               ;  /* disk-based: PS, TT, or IF/dynamic; not FCO */

#if DIMM_DISK
    if(FC_ISDIMM_DISK(fc))
        has_path = FALSE;
#endif

/* First, see if nothing has changed */
#if DISK_FONTS
    if (has_path)
    {                           /* TT/PST1 disk, IF disk (dynamic) */
        if(if_state.fontindex.has_path)
        {
            if( (STRNCMP((FILECHAR *)if_state.fontindex.pathname,
                          (FILECHAR *)cur_font_hdr, PATHNAMELEN) == 0) &&
                   (cur_ssnum == if_state.fontindex.cur_ssnum))  /* 6-28-93 */
            {
                    DBG("    disk: has_path OK\n");
                    return SUCCESS;     /* pathnames match */
            }
        }
        STRCPY(if_state.fontindex.pathname, (FILECHAR *)cur_font_hdr);
        goto IXgfi1;
    }
#endif /* DISK_FONTS */

#if ROM
    if (rom_font && !cur_tf_num
#if FCO_RDR
                                && !FC_ISFCO(fc)    /* 07-18-94, mby */
#endif
       )
    {                           /* TT ROM, IF ROM (dynamic) */
        if (if_state.fontindex.cur_font_hdr == cur_font_hdr)
        {
            DBG("    ROM: cur_font_hdr OK\n");
            return SUCCESS;     /* ROM pointers match */
        }
        goto IXgfi1;
    }
#endif  /* (ROM) */

    if ( (if_state.fontindex.font_type    == font_type   )  &&
             (if_state.fontindex.cur_ssnum    == cur_ssnum   )  &&
             (if_state.fontindex.cur_tf_num   == cur_tf_num  )  &&
             (if_state.fontindex.cur_font_hdr == cur_font_hdr))
        return SUCCESS;         /* IF disk/ROM, any PCLExO */

IXgfi1:

    if ( !extern_font && FC_ISIF(fc) && !FC_ISAPPGEN(fc) ) /* IF rom or disk, not ALIEN */
    {
#if IF_ROM
        LPUB8 romBlkPtr = if_state.fontindex.pfnt_index;
#endif
        if_state.fontindex.cur_pix = 0;          /* initialize to 0 */
        for (i=0, ix=(PINDEX_ENTRY)FIBUF;  i<if_state.fontindex.entry_ct;  i++, ix++)
        {
/* The following code may be unnecessary. The idea is that a dynamic font
   could also be registered in "if.fnt", so we should first search there
   for a pathname or rom pointer. This will save a call to FMprocess_face()
   later. If if.fnt only contains plugins, then we don't need
   "if (!cur_tf_num) { ... }".
*/
            if (!cur_tf_num)    /* dynamic font or not? */
            {
            /* Need to set cur_tf_num to avoid duplicate buckets. */
            /* Assumes ROM & disk mutually exclusive */
#if !IF_ROM    /* disk-based */
                if (STRCMP( (FILECHAR *)if_state.fontindex.pathname, (FILECHAR *)FIpath(FSA ix) ) == 0)
                {
                    cur_tf_num = ix->tfnum;
                    break;
                }
#else   /* ROM */
                if ((romBlkPtr + ix->p_r.lib_offset) == cur_font_hdr)
                {
                    cur_tf_num = ix->tfnum;
                    break;
                }
#endif
            }
            else    /* IF font, not dynamic. Search if.fnt for INDEX_ENTRY  */
                if (cur_tf_num == ix->tfnum) break;
        }  /* for (... ) */

        if (cur_tf_num)
        {                                   /* not dynamic */
            if (i >= if_state.fontindex.entry_ct)
            {
                DBG("    ERR_no_fi_entry\n");
                if_state.fontindex.cur_tf_num = 0;   /* avoids a false match later. */
                return ERR_no_fi_entry;
            }
            if_state.fontindex.cur_pix = ix;         /* TFS INDEX_ENTRY pointer */
            cur_font_hdr = (LPUB8)NULL;     /* always */
        }

    } /* endif ( !FC_ISEXTERN(fc) && FC_ISIF(fc) && !FC_ISAPPGEN(fc) ) */

#endif  /* DYNAMIC_FONTS && IF_RDR */

/*** shared code (for both DYNAMIC_FONTS=0, DYNAMIC_FONTS=1) ***/
  /*  Current TFS font has changed  */

    if_state.fontindex.font_type    = font_type;
    if_state.fontindex.cur_tf_num   = cur_tf_num;
    if_state.fontindex.cur_font_hdr = cur_font_hdr;
    if_state.fontindex.cur_ssnum    = cur_ssnum;
    if_state.fontindex.has_path     = has_path;
    if_state.fontindex.num_searches = 1;   /* only 1 level valid so far */

#if FCO_RDR
    if_state.fontindex.fcoMakeNewSrchPath = 1;
#endif

//    DBG1("    fontindex.font_type = %04lx\n", if_state.fontindex.font_type);
//    DBG1("    fontindex.cur_tf_num = %ld\n", if_state.fontindex.cur_tf_num);
//    DBG1("    fontindex.cur_font_hdr = %lx\n", if_state.fontindex.cur_font_hdr);
//    DBG1("    fontindex.cur_ssnum = %d\n", if_state.fontindex.cur_ssnum);

#if DISK_FONTS
    DBG1("    fontindex.pathname = %s\n", (if_state.fontindex.has_path ? if_state.fontindex.pathname : "") );
#endif

    return SUCCESS;

} /* IXget_fnt_index() */
 

ix.h  、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、

/* 
 * Copyright (C) 2004 Agfa Monotype Corporation. All rights reserved.
 */
/* $Header:   I:/BULL/URIP/SYS/INC/IX.H_V   1.145   Oct 26 2004 12:52:18   dugganj  $ */
/* $Log:   I:/BULL/URIP/SYS/INC/IX.H_V  $ 
 * 
 *    Rev 1.145   Oct 26 2004 12:52:18   dugganj
 * Multithreading changes.
 * 
 *    Rev 1.144   Oct 19 2004 11:59:52   galejss
 * add new data for CID-in-CFF processing (cft.fontdict, isCID, FDidx_cur, hFDSelect)
 * 
 *    Rev 1.143   Sep 27 2004 16:25:10   dugganj
 * Added multithread support.
 * 
 *    Rev 1.142   Sep 08 2004 14:15:16   indreliunaiter
 * Joe changes for Bold/Normal embedded bitmaps.
 * 
 *    Rev 1.141   Aug 26 2004 15:12:18   wuq
 * Removed GET_VERTICAL_METRICS conditional
 * from non output structure.
 * 
 * Changes for supporting v7 CCC.
 * 
 *    Rev 1.140   Jul 16 2004 13:17:32   galejss
 * changes for IFdisk/rom support; BOOLEAN type cleanup
 * 
 *    Rev 1.139   Jun 08 2004 18:32:04   GalejsS
 * add support for Coverage 2 GSUB processing (for keb) (bug # 145)
 * 
 *    Rev 1.138   Apr 27 2004 11:01:12   GalejsS
 * remove obsolete Type0 code; NEW_PS_HINTS is only option now
 * 
 *    Rev 1.137   Oct 09 2003 14:56:54   IndrelR
 * Changes for Vertical Writing.
 * 
 *    Rev 1.136   Aug 22 2003 09:43:52   LynchR
 * Updated copyright notice.
 * 
 *    Rev 1.135   Aug 13 2003 09:51:04   IndrelR
 *    Rev 1.134   Aug 12 2003 16:08:16   IndrelR
 * In the structure "TT_BUCK" was added variable:
 * UL32        vmtxTableOffset; 
 * 
 *    Rev 1.133   Aug 12 2003 15:43:20   Behringe
 * added definition for verticalMetricsExist
 * 
 *    Rev 1.132   Aug 12 2003 13:32:38   JardimA
 * Added UL32 VertRotSegSize, MEM_HANDLE VertRotSegHndl, and UL32 verticalMetricsExist to the #if TT_PCLEOI section. These were needed for the new method of reading the PCLEOI font header segments.
 * 
 *    Rev 1.131   Aug 08 2003 12:28:44   Galejs
 * move hexasc enum from if_type.h to ix.h (fix wrong-order compile error)
 * 
 *    Rev 1.130   Aug 01 2003 15:46:34   Galejs
 * get rid of unused PSROMFILE, psrom
 * 
 *    Rev 1.129   Jul 21 2003 19:15:58   Galejs
 * "hexascii" in PS bucket is now an enum value, not a 2-valued field
 * 
 *    Rev 1.128   Jul 07 2003 11:23:00   Galejs
 * DYNAMIC_FONTS option only useful for IF_RDR
 * 
 *    Rev 1.127   Jun 25 2003 11:38:50   Galejs
 * fc_ExtndFlags becomes 32 bits wide
 * 
 *    Rev 1.126   Jun 23 2003 11:44:48   Galejs
 * get rid of NON_IF_FONT
 * 
 *    Rev 1.125   Oct 29 2002 07:44:00   Joe
 * In INDEXSUBTABLE structure, replaced pointer variables
 * with arrays to resolve ALPHA alignment problems.
 * 
 *    Rev 1.124   Sep 27 2002 18:31:32   Doolittl
 * Changes for TT_SCREENRES to return fractional pixel advance information.
 * 
 *    Rev 1.123   Sep 25 2002 19:59:56   Galejs
 * change a couple of #ifdefs to #ifs
 * 
 *    Rev 1.120   Sep 25 2002 16:07:50   WuQ
 * changes for CCC
 * 
 *    Rev 1.119   Sep 23 2002 19:46:34   Galejs
 * add DIMM_DISK option (bug # 92) (for awr)
 * 
 *    Rev 1.118   Sep 09 2002 17:05:32   Galejs
 * test for multiple includes (part of bug # 76)
 * 
 *    Rev 1.117   Jun 18 2001 20:34:10   Galejs
 * some PS_BUCK vbls are needed for both old and new PS hinting
 * 
 *    Rev 1.116   Jun 18 2001 10:44:42   Paul
 * changes for PS_NEW_HINTS
 * 
 *    Rev 1.115   04 Jun 2001 10:34:16   JOE
 * OpenType changes.
 * 
 *    Rev 1.114   May 21 2001 20:53:50   Galejs
 * get rid of "rom_length" field for CFF_ROM option
 * 
 *    Rev 1.113   May 04 2001 16:38:46   Galejs
 * data-type cleanup; get rid of AGFATOOLS
 * 
 *    Rev 1.112   Nov 28 2000 17:57:28   Galejs
 * make embedded-bitmap conditional-compile consistent
 * 
 *    Rev 1.111   Nov 15 2000 15:17:04   Joe
 * Added "CMAP_offset" field to TT_BUCK structure.
 * 
 *    Rev 1.110   Oct 23 2000 16:02:40   Joe
 * More embedded bitmap changes
 * 
 *    Rev 1.109   04 Oct 2000 10:05:32   JOE
 * Added new embedded bitmap data structures.
 * In TT_BUCK, added EMBEDDED_BITMAP_FONT and EMBEDDED_BITMAP fields and
 * added a flag which indicates whether a bitmap tables is embedded in
 * the font.
 * 
 *    Rev 1.108   19 Apr 2000 11:09:46   JOE
 * Added advanceHeight to CHAR_STATS to support vertical writing (by keb).
 * 
 *    Rev 1.107   10 Feb 2000 15:40:48   AL
 * Removed PST1_ROM
 * 
 *    Rev 1.106   Feb 02 2000 11:28:58   galejs
 * add FONT_TYPE_DISK_ACT define (for future use)
 * 
 *    Rev 1.105   Jan 26 2000 17:13:52   galejs
 * compile fix for vertical-writing changes
 * 
 *    Rev 1.104   Jan 24 2000 15:16:46   galejs
 * vertical-writing changes (for keb), plus TT cleanup
 * 
 *    Rev 1.103   Dec 14 1999 13:04:58   galejs
 * remove TT_ROM1 references, add useCmapTable flag
 * 
 *    Rev 1.102   Nov 15 1999 12:02:08   galejs
 * add fields to TT_BUCK structure (for TTC processing)
 * 
 *    Rev 1.101   Aug 17 1999 17:56:38   galejs
 * change type of "plugin_set" from BOOLEAN to SW16 (compile error)
 * 
 *    Rev 1.100   Aug 09 1999 16:56:42   galejs
 * remove obsolete itme "plugintt_pix"
 * 
 *    Rev 1.99   Jun 10 1999 15:19:48   galejs
 * add "pixelWidth" field to CHAR_STATS struct (non-linear width)
 * 
 *    Rev 1.98   07 Jun 1999 14:17:32   JOE
 * Conditionally compiled definitions for MAXSTEMS and MAXWEIGHTS based on
 * #ifndef to resolve compiler warnings.
 * 
 *    Rev 1.97   18 Feb 1999 17:57:32   DAVID
 * Uncoupled CFF processing from USE_UFST_MAPPING.
 * 
 *    Rev 1.96   16 Feb 1999 13:28:44   JOE
 * Added 'v' intellifont format library definition V_LIB (by ks).
 * 
 *    Rev 1.95   29 Jan 1999 10:54:20   DAVID
 * Added hcffencodearray to PS_BUCK for 2 Byte wide CFF
 * Encoding Arrays.
 * 
 *    Rev 1.94   26 Jan 1999 11:30:50   JOE
 * Revised conditionals for Vertical Substitution variables to
 * allow FORMAT16 and ASIAN_ENCODING independence (by jwd).
 * 
 *    Rev 1.93   20 Jan 1999 10:27:38   DAVID
 * Added 'hcharsetarray', then 'charset' to cft structure for
 * support of PS CFF glyph access by SID.
 * 
 *    Rev 1.92   11 Dec 1998 11:40:54   JOE
 * Added code to support ASIANVERT for XLfonts (by keb).
 * 
 *    Rev 1.91   09 Dec 1998 17:05:18   JOE
 * Upgraded character allocation buffer for CFF to 8000 (by jwd).
 * 
 *    Rev 1.90   31 Aug 1998 14:01:16   JOE
 * Modified for xl2.0 font proccessing support (by keb).
 * 
 *    Rev 1.89   24 Aug 1998 13:44:00   AL
 * Removed test code
 * 
 *    Rev 1.88   06 Aug 1998 15:27:22   AL
 * CFF ROM support
 * 
 *    Rev 1.87   29 Jul 1998 23:40:24   DAVID
 * Added T1 and CFF Multiple Master members to PS_BUCK structure.
 * 
 *    Rev 1.86   27 Jul 1998 15:25:30   AL
 * cff cleanup
 * 
 *    Rev 1.85   23 Jul 1998 15:39:32   AL
 * 
 *    Rev 1.84   21 Jul 1998 16:05:48   AL
 * Added inputDV[] to PS_BUCK for BUCKfind()
 * 
 *    Rev 1.83   20 Jul 1998 15:15:52   AL
 * Added multiple master support (per Dave K)
 * 
 *    Rev 1.82   09 Jul 1998 10:26:10   DAVID
 * Integrated new CFF processing support into UFST
 * code base.  Changed copyright notice dates.
 * 
 *    Rev 1.81   17 Jun 1998 16:25:40   GALEJS
 * change (*transptr) type for reentrancy
 * 
 *    Rev 1.80   12 Jun 1998 13:15:30   GALEJS
 * move all fn prototypes to shareinc.h
 * 
 *    Rev 1.79   29 May 1998 17:20:48   GALEJS
 * delete unused extern
 * 
 *    Rev 1.78   17 Apr 1998 10:32:06   JOE
 * Redefined pathname in BUCKET structure (by kb).
 * 
 *    Rev 1.77   20 Mar 1998 11:52:28   GALEJS
 * 64-bit port
 * 
 *    Rev 1.76   10 Feb 1998 17:27:12   GALEJS
 * shouldn't use pathname unless Disk mode
 * 
 *    Rev 1.75   03 Feb 1998 22:27:32   DAVID
 * Added fc_ExtndFlags to BUCKET struct for HP4000 emulation.
 * 
 *    Rev 1.74   28 Jan 1998 12:02:42   AL 
 * Very large character support in CHAR_STATS
 * 
 *    Rev 1.73   14 Jan 1998 14:00:38   GALEJS
 * delete unused extern
 * 
 *    Rev 1.72   18 Dec 1997 16:39:54   GALEJS
 * delete if-0 code
 * 
 *    Rev 1.71   08 Dec 1997 20:52:22   DAVID
 * Added further conditionals to TT_BUCK structure for 'GSUB' Vertical Substit
 * 
 *    Rev 1.70   21 Nov 1997 16:04:34   MIKE
 * Made 'oblMatrix', 'cvf...' members of FCO_BUCK conditional
 * 
 *    Rev 1.69   31 Oct 1997 08:33:14   DAVID
 * Added 'GSUB' fields to TT_BUCK structure to support access to
 * 'vert' feature of 'GSUB' Table (conditionally on ASIAN_ENCODING).
 * 
 *    Rev 1.68   22 Sep 1997 12:24:46   MIKE
 * Added "FontState" member to FCO_BUCK structure
 * 
 *    Rev 1.67   04 Sep 1997 17:05:38   MARTIN
 * Modified references to AGFA Compressed TrueType (ACT).
 * 
 *    Rev 1.66   31 Jul 1997 17:23:44   DAVID
 * No change.
 * 
 *    Rev 1.65   15 Jul 1997 17:13:22   DAVID
 * Changed 'pGalleySegStart' pointer back to a mem handle 'GalleySegHndl'.
 * 
 *    Rev 1.64   15 Jul 1997 10:21:10   AL
 * Pseudo bold via changing th outline at render time
 * 
 *    Rev 1.63   30 May 1997 09:46:32   MARTIN
 * Added TrueType ROM ACT (compressed random access).
 * 
 *    Rev 1.62   19 May 1997 23:41:06   DAVID
 * Changed 'GalleySegHndl' to a pointer 'LPUB8 pGalleySegStart'.
 * 
 *    Rev 1.61   25 Mar 1997 08:15:36   DAVID
 * Updated comment for 'GalleySegSize'.
 * 
 *    Rev 1.60   24 Mar 1997 16:37:52   MIKE
 * In TT_BUCK, conditionally compile "
 * "GalleySegHndl" and "GalleySegSize"
 * 
 *    Rev 1.59   24 Mar 1997 11:52:38   DAVID
 * Changed names of GalleyTTHndl and GalleyTTSize to GalleySegHndl and
 * GalleySegSize respectively in TT_BUCK structure.
 * 
 *    Rev 1.58   12 Mar 1997 14:16:10   DAVID
 * Added GalleyTTHndl and GalleyTTSize to TT_BUCK structure for Galley
 * Character support in format 15 & 16 PCLETTOs.
 * 
 *    Rev 1.57   11 Mar 1997 13:38:38   MIKE
 * Removed fontindex.fcoSearchPathType
 * 
 *    Rev 1.56   13 Jan 1997 12:44:06   DAVID
 * Removed CONVERGENT_FONTS option as part of project to trim ufst.
 * 
 *    Rev 1.55   10 Jan 1997 10:17:16   DAVID
 * Deleted SCREEN_FONTS option as part of project to trim ufst.
 * 
 *    Rev 1.54   09 Jan 1997 14:34:46   DAVID
 * Added langId field to TT_BUCK structure to help distinguish GB from
 * BIG5 Aaian encoded fonts.
 * 
 *    Rev 1.53   18 Nov 1996 19:08:28   MIKE
 * Modified TT_BUCK struct, if FNT_METRICS is on.
 * 
 *    Rev 1.52   06 Nov 1996 14:00:42   MIKE
 * Added function prototypes for xx_get_FontMetrics
 * 
 *    Rev 1.51   29 Aug 1996 14:20:20   MIKE
 * PCL 6 emulation support; BOLD_FCO.
 * 
 *    Rev 1.49   14 Jun 1996 17:01:32   JOE
 * Changed "//" comment delimiter to "slash-asterisk ... asterisk-slash".
 * 
 *    Rev 1.48   13 Jun 1996 17:36:14   JWD
 * FORMAT16 changes
 * 
 *    Rev 1.47   23 Jan 1996 17:27:06   MIKE
 * Added cvfChangeScale, cvfScale1, cvfScale2 to FCO_BUCK structure.
 * 
 *    Rev 1.46   27 Jul 1995 11:36:22   MIKE
 * Added "FCO_BUCK.matrixType" for othogonal rotation support
 * 
 *    Rev 1.45   22 Jun 1995 19:45:34   MIKE
 * Added FCO_BUCK.identityMatrix. Conditionally compiled BUCKET.p.xx
 * 
 *    Rev 1.44   01 Jun 1995 17:09:04   MIKE
 * Removed "fcoFontSh" from FCO_BUCK structure
 * 
 *    Rev 1.43   24 May 1995 19:03:54   MIKE
 * Added argument to declaration of fco_get_FontBBox()
 * 
 *    Rev 1.42   24 May 1995 18:43:04   MIKE
 * Added FCO_BUCK.oblMatrix[] for Convergent Fonts.
 * 
 *    Rev 1.41   07 Apr 1995 11:31:14   LISA
 * Changed copyright information from Miles Inc. to Bayer Corp.
 * 
 *    Rev 1.40   26 Feb 1995 14:35:14   JOE
 * In DISK version of INDEX_ENTRY structure, if WATCOM, added pad word
 * following "name_off" field to resolve alignment problem introduced
 * when NAT_ALIGN was changed from 2 to 4.
 * 
 *    Rev 1.39   10 Feb 1995 11:26:52   JOE
 * In FCO_BUCK structure, added fields ThinSpace, ENSpace and EMSpace.
 * 
 *    Rev 1.38   11 Dec 1994 17:20:42   MIKE
 * Changed CHAR_STATS.origin_cs from SW16VECTOR to SL32VECTOR
 * 
 *    Rev 1.37   14 Oct 1994 14:45:00   MIKE
 * Added orThreshold to FCO_BUCK.
 * 
 *    Rev 1.36   21 Sep 1994 18:14:30   MIKE
 * Added 'FONTCONTEXT fcoFC' to FCO_BUCK structure.
 * 
 *    Rev 1.35   13 Sep 1994 19:24:38   MIKE
 * Added FCO_BUCK.fcoFontSh for outline sharing.
 * 
 *    Rev 1.34   02 Sep 1994 12:49:58   MIKE
 * Added new items to FONTINDEX for FCO plugins.
 * 
 *    Rev 1.33   31 Aug 1994 17:44:02   MIKE
 * Added 'spaceBand', 'compositionFlag' to FCO_BUCK.
 * 
 *    Rev 1.32   03 Aug 1994 19:14:06   MIKE
 * Added FCO changes from 1.27.1.3
 * 
 *    Rev 1.31   22 Apr 1994 15:31:32   LISA
 * Made modifications to copyright/disclaimer notice.
 * 
 *    Rev 1.30   22 Mar 1994 09:55:16   JOE
 * In structure PS_BUCK, added fields hCOD_Offset and hCSA_Offset for
 * ASIAN ROM support.
 * 
 *    Rev 1.29   06 Mar 1994 12:50:38   MIKE
 * If CONVERGENT_FONTS == 1, use AWT4 format; if == 3, use AWT3 format.
 * 
 *    Rev 1.28   03 Feb 1994 11:57:08   MIKE
 * Changes to support italicized Convergent Fonts. AWT4.
 * 
 *    Rev 1.27   10 Jan 1994 15:40:14   MIKE
 * Changed AWT_ID to 'A' 'W' 'T' '3'
 * 
 *    Rev 1.26   01 Dec 1993 08:23:52   JOE
 * Changed KANJI_ENCODING to ASIAN_ENCODING.
 * 
 *    Rev 1.25   11 Oct 1993 12:47:18   MIKE
 * Added "scaleFactor" to AWT_TABLE struct. Added "FontBBox[4]" to TT_BUCK str
 * Added #defines CVF_NO_INDEX, CVF_REQU_FNT, CVF_SUBST_FNT.
 * 
 *    Rev 1.24   29 Sep 1993 11:37:00   JOE
 * Added field "FontBBox[4]" to PS_BUCK structure.
 * 
 *    Rev 1.23   23 Sep 1993 12:08:56   MIKE
 * Added BUCKET.usePlugins; restructured TT_BUCK; ifxxx() declaration cleanup.
 * 
 *    Rev 1.22   30 Aug 1993 10:50:12   MIKE
 * Changed AWT_ID to 'A' 'W' 'T' '2'.
 * 
 *    Rev 1.21   26 Aug 1993 10:31:18   MAIB
 * Added spotsize field to TT_BUCK struct 
 * 
 *    Rev 1.20   12 Aug 1993 10:07:54   MIKE
 * For CONVERGENT_FONTS: Added awtsub_on to FONTINDEX; reorganized AWT_TABLE.
 * 
 *    Rev 1.19   02 Aug 1993 09:08:30   JOE
 * In PS_BUCK structure, added field "ocharnames" to get to char names
 * data for PS ROM input.
 * 
 *    Rev 1.18   27 Jul 1993 13:11:22   AL
 * Non-zero winding changes
 * 
 *    Rev 1.17   15 Jul 1993 11:39:54   MIKE
 * Moved CONVERGENT_FONT #defines and AWT_TABLE structure here.
 * 
 *    Rev 1.16   15 Jul 1993 09:26:14   MIKE
 * Convergent font changes: added noTFS, plugintt_pix to FONTINDEX;
 * Used bit 6 in bucket_num for plugin font type.
 * 
 *    Rev 1.15   15 Jun 1993 11:55:48   ROB
 * Add entry to type 1 bucket 'hexascii', replaces global 'hexasciiflg'.
 * 
 *    Rev 1.14   14 Jun 1993 17:17:46   ROB
 * Type 1 encoding array support.
 * 
 *    Rev 1.13   08 Jun 1993 15:48:42   ROB
 * Changes for type 1 quality improvements and multimaster support.
 * 
 *    Rev 1.12   22 Apr 1993 10:58:06   MIKE
 * Remove rom_font_ptr from fontindex structure.
 * 
 *    Rev 1.11   15 Apr 1993 18:24:52   MIKE
 * Made changes for DYNAMIC_FONTS. Added "dynIFActive" flag to BUCKET.
 * Added "rom_font_ptr" and "dynix" to fontindex.
 * 
 *    Rev 1.10   06 Apr 1993 15:47:42   ROB
 * Change CHARBUFSIZE from 6000 to 8000 because 4 chars would not rasterize.
 * 
 *    Rev 1.9   31 Mar 1993 09:49:36   ROB
 * Conditionally make CHARBUF 6000 bytes if KANJI_ENCODING is enabled.
 * 
 *    Rev 1.8   29 Mar 1993 10:43:40   ROB
 * Change defines for Kanji support (KANJI_ENCODING).
 * 
 *    Rev 1.7   17 Mar 1993 18:06:28   ROB
 * Changes to support PostScript Kanji fonts (PS_BUCK).
 * 
 *    Rev 1.6   03 Mar 1993 19:32:48   ROB
 * Add 'StemSnapH[]' & 'StemSnapV[]' to 'PS_BUCK' for stem hint processing.
 * 
 *    Rev 1.5   05 Feb 1993 13:54:02   MIKE
 * Added BBoxRes structure.
 * Added function prototypes for xxget_FontBBox()  (if FONTBBOX = 1).
 * 
 *    Rev 1.4   29 Jan 1993 08:58:16   JOE
 * Added em box size fields to CHAR_STATS structure.
 * 
 *    Rev 1.3   14 Jan 1993 11:13:58   LISA
 * Removed CntrlZ character
 * 
 *    Rev 1.1   14 Dec 1992 08:45:36   LISA
 * Made change to Log keyword
 * 
 *    Rev 1.0   09 Dec 1992 11:38:24   LISA
 * Initial revision.
*/
/* $Date:   Oct 26 2004 12:52:18  $ */
/* ix.h */

/*  01-Apr-90  awr  Expanded SS_DIRECTORY to include pcleo info
 *  12-Apr-90  jfd  Added handles for Typeface Header and Font
 *                    Alias segments to BUCKET structure
 *  07-Jun-90  dah  Added input_filetype to INDEX_ENTRY and BUCKET structs.
 *  01-Jul-90  awr  Corrected comments, added bit flag definitions and
 *                  screen font definitions.
 *  15-Aug-90  awr  added BUCKET's handle to BUCKET structure.
 *  17-Sep-90  jfd  Changed CHARBUFSIZE from 2048 to 4096
 *  02-Jan-91  jfd  Added struct CHR_DEF_HDR
 *  02-Jan 91  ss   Added (ROM defined) lib_offset field to INDEX_ENTRY struct
 *                  Added lib_handle in BUCKET struct
 *                  Added EXPBUFSIZE for expansion buffer size only
 *  08-Jan-91  ss   Changed INDEX_ENTRY to union lib_offset with font_hdr and
 *                  Added pgif field to CHR_DEF for PCLEO_RDR
 *  09 Jan 91  ss   Added B_ISPCLEO, B_ISROM macros
 *  14-Jan-91  awr  Added font_hdr field and ssnum field to FONTINDEX
 *  24-Jan-91  awr  Changed INDEX_ENTRY structure (#if ROM) so that it
 *                  will be LONG-aligned.
 *  29-Jan-91  jfd  Added description for bits 8-9 of format field.
 *  31-Jan-91  dET  Add support for MSC multi-model compilation.
 *  23-Feb-91  awr  Changed bucket sub-segment handles to offsets.
 *  19-May-91  awr  Changed CHARBUFSIZE to 6000
 *  14 May 91  ss   Added support for new plugin scheme w/ 15 buckets
 *                   at 3 levels of limited sensitive
 *  19-May-91  awr  Changed CHARBUFSIZE to 6000
 *   3 Jun 91  ss   Added SLIM_FONTS mirror flags to CHR_DEF_HDR struct.
 *   5-Jun-91  jfd  Changed HUGE define to MSHUGE to avoid conflict 
 *                  w/Sun system define
 *                  (FIX FROM EARLIER VERSION)
 *   6-Jun-91  jfd  In macros CD_ISPCLEO and CD_ISROM, changed FILETYPE_MASK
 *                  to FC_FILETYPE_MASK
 *   5 Jun 91  ss   Added Fixed Pitch defines.
 *                  Deleted COMPRESS define, no longer needed.
 *  19 Jun 91  ss   Cleaned up defines not used. Added MIRROR mask defines.
 *                  Changed CHR_DEF element name from bucknum to
 *                  buck_search_lvl
 *  21 Jun 91  ss   Moved prototype for fgseg() to modules that actually
 *                  use it due to problem with prototypes on SUN3.
 *  24 Jun 91  ss   Changed PBYTE fontindex.pfnt_index to PUBYTE.
 *                  Changed PBYTE bucket.plibfont to PUBYTE.
 *   4-Jul-91  awr  changed types in CHR_DEF to WORDVECTOR
 *  10 Aug 91  ss   Changed CHR_DEF_HDR.mirror flags to one word.
 *                  Added and corrected defines for CHR_DEF_HDR.mirror_flags.
 *  16 Sep 91  ss   Added font_hdr field in CHR_DEF_HDR for PCLEO_RDR and disk
 *   1 Oct 91  ss   Made EXPBUFSIZE larger.
 *   7 Oct 91  jfd  Changed typedef statements for PCHR_DEF and PCHR_DEF_HDR
 *                  to "... FARPTR * ... ".
 *  01-Nov-91  jfd  Changed CHARBUFSIZE to from 6000 to 4096.
 *   7 Nov 91  ss   Conditionally compiled EXPBUFSIZE cuz SUN seems to need
 *                  a bigger buffer.
 *   3-Jan-92  awr  Removed font_open field from BUCKET
 *   8-Jan-92  rs   Modify BUCKET for the unions (ps, tt, if).
 *  13-Jan-92  rs   Add ptr to charstring to PS_BUCK when char is selected.
 *                  Stored in 'VOID *pthis_charstring'. Add 'fontmatrix[6]'
 *                  to PS_BUCK.
 *  14-Jan-92  rs   Add 'CHAR_STATS' struct definition.
 *  22-Jan-92  rs   Set up 'IF_FUNC_TBL' & 'IF_RAS_TBL' structures to call
 *                  font + rasterizer functions through ptrs.
 *  23-Jan-92  rs   Add 'overshoot' to ps bucket.
 *  28-Jan-92  rs   Add 'PIF_FUNC_TBL pft' to external font bucket.
 *  22-Jan-92  mby  Defined TT_BUCK structure.
 *  31-Jan-92  mby  Added emResolution to TT_BUCK.
 *  06-Feb-92  rs   Add 'last_seek', 'last_key' & 'curr_char' to 'ps_buck'.
 *  10-Feb-92  awr  Added "locked" field to BUCKET structure.
 *  26-Feb-92  bg   Changed EXPBUFSIZE (ifndef SUN) from 700 to 2096
 *                  (4096 - 2000).
 *   4 Mar 92  ss   Added !LINT_ARGS prototypes for functions in structs
 *                  IF_FUNC_TBL and IF_RAS_TBL.
 *   7-Mar-92  awr  added compound character design unit bounding box
 *                  to if_state.
 *   8-Mar-92  awr  added has_path field to BUCKET
 *  13-Mar-92  rs   Change 'last_key' in PS_BUCK from ULONG to UWORD
 *  17-Mar-92  mby  declared elements of TT_BUCK as MEM_HANDLE instead of
 *                  pointers.
 *  02-Apr-92  rs   Portability cleanup (see port.h).
 *  06-Apr-92  rs   Change 'FIXED_PITCH' to 'CGFIXED_PITCH' (portability).
 *  20-Apr-92  awr  Added pix_bound field to CHR_DEF structure
 *  11 May 92  ss   Changed FONTINDEX.small_plugins to plugin_set to use
 *                  as a flag for different plugin sets that can be loaded
 *                  in addition to the small_plugin set.
 *  21-May-92  jfd  Added prototypes for outline functions to support
 *                  function table.
 *                  Changed function prototype for bmras_start_char()
 *                  and _olstartchar() so that argument is PVOID.
 *  21 May 92  ss   Cleaned up references to Letter Gothic to implement
 *                  the plugins now available.
 *  29 May 92  jfd  Disabled old "CHAR_STATS" structure. Replaced with
 *                  "CHAR_STATS" which is combination of old CHAR_STATS 
 *                  and OLSTATS.
 *  17-Jun-92  awr  Changed CHAR_STATS.olbox to an INTRBOX type
 *  24-Jun-92  mby  Modified TT_BUCK structure for PCLEO support
 *   6-Jul-92  jfd  Added "get_width" to IF_FUNC_TBL structure.
 *   6-Jul-92  mby  Removed GlobalTTPtr from TT_BUCK structure.
 *  21-Jul-92  awr  Conditional compile changes.
 *  16-Aug-92  rs   Fix typo for 'USE_UFST_MAPPING'.
 *  23-Sep-92  awr  Added "platID" & "specID" to TT_BUCK.
 *                  Removed media in FONTINDEX and BUCKET
 *                  Changed CHR_DEF.buck_search_lvl to int.
 *                  Changed FONTINDEX.num_searches to int.
 *                  Added font_type field in FONTCONTEXT and BUCKET
 *  14-Oct-92  awr  Added cur_ssnum filed to BUCKET
 *  15-Oct-92  mby  Added "FONTCONTEXT TTfc" to TT_BUCK.
 *  25-Jan-93  jfd  Added fields "du_emx" and "du_emy" to CHAR_STATS 
 *                  structure
 *  04-Feb-93  mby  Added BBoxRes structure. Added get_FontBBox() function
 *                  prototype declarations (FONTBBOX must be set)
 *  02-Mar-93  rs   Add StemSnapV[] & StemSnapH[] to PS_BUCK.
 *  15-Mar-93  rs   Modify PS_BUCK for type 0 fonts.
 *  27-Mar-93  rs   Add define for 'KANJI_ENCODING'.
 *  30-Mar-93  rs   Make CHARBUFSIZE 6000 if 'KANJI_ENCODING'.
 *  06-Apr-93  rs   Make CHARBUFSIZE 8000 if 'KANJI_ENCODING' (there were
 *                  still 4 chars which could not rasterize).
 *  12-Apr-93  mby  Changes for DYNAMIC_FONTS. Added "dynIFActive" flag to
 *                  BUCKET. Added "rom_font_ptr" and "dynix" to fontindex.
 *  21-Apr-93  mby  Remove rom_font_ptr from fontindex structure.
 *  14-May-93  rs   Pipeline upgrade - type 1 quality improvements.
 *  03-Jun-93  jfd  In PS_BUCK struct, changed conditional compile statement
 *                  for hencodearray to "#if !USE_UFST_MAPPING || 
 *                  (USE_UFST_MAPPING == 2)"
 *  06-Jun-93  rs   MultiMaster support 'T1MMASTER'.
 *  15-Jun-93  rs   Add 'hexascii' to type 1 bucket.
 *  12-Jul-93  mby  Added noTFS to FONTINDEX for CONVERGENT_FONTS.
 *                  Added plugintt_pix to FONTINDEX for TT_PLUG_IF.
 *                  Use bit 6 in bucket_num (MULTIFORMAT only). UFST uses
 *                  this to decide if plugin font type is IF or TT. 
 *  15-Jul-93  mby  Moved CONVERGENT_FONT #defines and AWT_TABLE structure
 *                  into this module.
 *  23-Jul-93  awr  Added tran_run_ct field to CHAR_STATS structure to
 *                  support non-zero winding bitmap fill
 *  02-Aug-93  jfd  In PS_BUCK structure, added field "ocharnames" (offset
 *                  to char names table) based on PST1_ROM.
 *  12-Aug-93  mby  Added 'awtsub_on' to FONTINDEX structure for CONVERGENT_FONTS.
 *                  Reorganized AWT_TABLE structure.
 *  26-Aug-93 maib  Added spotsize field to TT_BUCK struct.
 *  26-Aug-93  mby  Changed AWT_ID to 'A' 'W' 'T' '2'.
 *  23-Sep-93  mby  Replaced fontHndl by diskHndl & ROMHndl in TT_BUCK.
 *                  Put conditional compiles in TT_BUCK; added ROM1 support.
 *                  Added BUCKET.usePlugins.
 *                  Made ifxxx() function declarations conditional on IF_RDR.
 *  29-Sep-93  jfd  Added field "FontBBox[4]" to PS_BUCK structure.
 *  01-Oct-93  mby  Added "scaleFactor" to AWT_TABLE structure.
 *                  Added FontBBox[4] to TT_BUCK.
 *  05-Oct-93  mby  Added #defines CVF_NO_INDEX, CVF_REQU_FNT, CVF_SUBST_FNT
 *  01-Dec-93  jfd  Changed KANJI_ENCODING to ASIAN_ENCODING.
 *  06-Jan-94  mby  Changed AWT_ID to 'A' 'W' 'T' '3'.
 *  03-Feb-94  mby  Convergent font changes. 'AWT3' -> 'AWT4'. Moved awtsub_on
 *                  to IF_STATE (see if_type.h). Added font italic angle,
 *                  horizontal offset data, and prohibit italic information
 *                  to AWT_TABLE structure.
 *  06-Mar-94  mby  Convergent fonts: Build UFST to use either AWT3 or AWT4
 *                  format. AWT_ID -> AWT_ID3 and AWT_ID4. Part of AWT_TABLE
 *                  is conditionally compiled.
 *  22-Mar-94  jfd  In structure PS_BUCK, added fields hCOD_Offset and
 *                  hCSA_Offset for ASIAN ROM support.
 * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
 * FCO Changes from 1.27.1.3:
 *  14-Mar-94  mby  Added function prototypes for pointer callable "fco_"
 *                   UFST functions - fco_load_font, etc.
 *                  Added FCO_BUCK structure inside BUCKET.
 *                  Added FCObject to FONTINDEX structure.
 *  26-May-94  mby  Removed FCObject from FONTINDEX. It's now in IF_STATE.
 *  03-Jun-94  mby  Added 'design_EmRes' to FCO_BUCK.
 *  03-Aug-94  mby  Added 'fcoChar' and 'charCloseFlag' to FCO_BUCK.
 * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
 *  31-Aug-94  mby  Added 'spaceBand' and 'compositionFlag' to FCO_BUCK.
 *  02-Sep-94  mby  Added fcoSearchPath_on, fcoSearchPath, fcoPlugHndl to
 *                  FONTINDEX. They're used in BUCKfind().
 *  13-Sep-94  mby  For outline sharing, added MEM_HANDLE fcoFontSh to FCO_BUCK.
 *  21-Sep-94  mby  Added 'FONTCONTEXT fcoFC' to FCO_BUCK structure.
 *  13-Oct-94  mby  Added 'orThreshold' to FCO_BUCK.
 *  11-Dec-94  mby  Changed SW16VECTOR CHAR_STATS.origin to
 *                  SL32VECTOR CHAR_STATS.origin_cs to fix 16-bit origin
 *                  overflow at very large sizes.
 *  09-Feb-95  jfd  In FCO_BUCK structure, added fields ThinSpace, ENSpace
 *                  and EMSpace.
 *  26-Feb-95  jfd  In DISK version of INDEX_ENTRY structure, if WATCOM,
 *                  added pad word following "name_off" field to resolve
 *                  alignment problem introduced when NAT_ALIGN was
 *                  changed from 2 to 4 for WATCOM.
 *  24-May-95  mby  Added FCO_BUCK.oblMatrix[] obliqued transformation matrix
 *                  for Convergent Fonts. Added FCO_BUCK.xbold, ybold
 *                  for experimental pseudobold.
 *  23-May-95  mby  Add argument to declaration of fco_get_FontBBox().
 *  01-Jun-95  mby  Removed "fcoFontSh" from FCO_BUCK structure.
 *  14-Jun-95  mby  Added FCO_BUCK.identityMatrix. In BUCKET.p union,
 *                  conditionally compiled, "in", "ps", "tt", "fco".
 *  26-Jul-95  mby  Added 'FCO_BUCK.matrixType' for orthogonal rotation support.
 *  23-Jan-96  mby  Added cvfChangeScale, cvfScale1, cvScale2 to FCO_BUCK.
 *  13-Jun-96  jwd  Expanded meaning of FONTINDEX.font_type, to include font
 *                  input bits from FONTCONTEXT.ExtendFlags member. Changed
 *                  meaning of BUCKET.extern_font to int from BOOLEAN, due to
 *                  different TT external font formats; we need to distinguish
 *                  between format 15 & format 16 TT PCLETTOs. Added Vert Subs
 *                  data  items to the TT_BUCK structure,  to handle format 16
 *                  downloads containing a Vertical Substitution table.
 *  26-Aug-96  mby  Replaced #if PSEUDO_BOLD_FCO with #if BOLD_FCO (MicroType emboldening).
 *  26-Aug-96  mby  PCL 6 emulation support:
 *                  - In bucket structure, removed "rom_font"; added
 *                  "fc_format". This is used for looking at both the
 *                  ROM/DISK and PCL6 bits rather than storing them as
 *                  separate items in the structure.
 *                  - Added 1 to fcoSearchPath[] array for the new plugin
 *                  search algorithm.
 *                  - removed fontindex.fcoPlugHndl ( => if_state.FCO_PluginH)
 *                  - fontindex.fcoMakeNewSrchPath replaces "fcoSearchPath_on"
 *                  - added fontindex.fcoSearchPathType
 *  01-Nov-96  mby  Added function prototypes for xx_get_FontMetrics().
 *  18-Nov-96  mby  In TT_BUCK structure, added "FontBBox" and "emResolution"
 *                  if FNT_METRICS is on.
 *  09-Jan-97  dlk  Added langId to TT_BUCK structure to help distinguish GB
 *                  from BIG5 Asian encoded fonts.
 *  10-Jan-97  dlk  Deleted SCREEN_FONT option as part of project to trim ufst.
 *  13-Jan-97  dlk  Removed CONVERGENT_FONTS option as part of project to trim
 *                  ufst.  Consequently, removed noTFS and awtsub_on from
 *                  FONTINDEX structure, and removed AWT_TABLE.
 *  11-Mar-97  mby  Removed fontindex.fcoSearchPathType (see 8/26/96)
 *  12-Mar-97  dlk  Added GalleyTTHndl, and GalleyTTSize to TT_BUCK structure
 *                  support Galley Character Segment processing in format 15 &
 *                  format 16 PCLETTOs (when they occur).
 *  24-Mar-97  dlk  Changed name of GalleyTTHndl and GalleyTTSize in TT_BUCK
 *                  structure to GalleySegHndl and GalleySegSize respectively.
 *  24-Mar-97  mby  In TT_BUCK, conditionally compiled 'GalleySegHndl' and
 *                  'GalleySegSize' with TT_PCLEOI.
 *  25-Mar-97  dlk  Updated comment for 'GalleySegSize'.
 *  19-May-97  dlk  Changed 'GalleySegHndl' to a pointer 'LPUB8 pGalleySegStart'.
 *  29-May-97  sbm  Add TT_ROM_ACT functionality.
 *  15-Jul-97  dlk  Changed 'pGalleySegStart' pointer back to 'GalleySegHndl'
 *                  memory handle now that memory error has been found in 
 *                  'pcleomgt.c', and not here.
 *  19-Sep-97  mby  Added "FontState" to FCO_BUCK structure.
 *  31-Oct-97  dlk  Added 'GSUB' support fields to TT_BUCK structure (condit-
 *                  ionally compiled for ASIAN_ENCODING.  This is only for
 *                  support of Vertical substitution ('vert' feature).
 *  21-Nov-97  mby  Made 'oblMatrix', 'cvfChangeScale', 'cvfScale1',
 *                  'cvfScale2' members of FCO_BUCK conditional.
 *  08-Dec-97  dlk  Added conditionals (TT_DISK, TT_ROM1, TT_ROM, and TT_ROM_
 *                  ACT to TT_BUCK structure for 'GSUB' Vertical Substitution
 *                  capabilities.
 *  29-Jan-98   awr Added very large character support in CHAR_STATS
 *  03-Feb-98  dlk  Added fc_ExtndFlags to BUCKET struct for HP4000 emulation.
 *    10-Feb-98  slg    pathname shouldn't be in FONTINDEX or BUCKET structs if ROM
 *    09-Mar-98  slg    long last_seek => SL32 last_seek
 *  15-Apr-98  keb  redefined pathname in BUCKET structure
 *    12-Jun-98  slg    Move fn prototypes to shareinc.h
 *  09-Jul-98  dlk  Integrated new CFF processing support (by dek) into UFST
 *                  code base.  Changed copyright notice dates.
 *  29-Jul-98  dlk  Added fields to PS_BUCK str for T1 and CFF MM.
 *  31-Aug-98  keb  modified for xl2.0 font processing support
 *  08-Dec-98  jwd  Upgraded CHARBUFSIZE value for CFF to 8000, to ensure 
 *                  enough memory available for raw character data.
 *  11-Dec-98  keb  Added code to support ASIANVERT for XLfonts
 *  20-Jan-99  dlk  Added 'hcharsetarray', and then 'charset' to 'cft'
 *                  structure for support of PS CFF glyph access by SID.
 *  25-Jan-99  jwd  Revised conditionals for Vertical Substitution variables to 
 *                  allow FORMAT16 and ASIAN_ENCODING independence.
 *  29-Jan-99  dlk  Added 'hcffencodearray' to PS_BUCK.
 *  16-Feb-99  ks   Added 'V' intellifont format library definition V_LIB 
 *  18-Feb-99  dlk  Un-coupled CFF hcffencodearray and CFF hcharsetarray from
 *                  USE_UFST_MAPPING compile time logic - in PS_BUCK structure.
 *  07-Jun-99  jfd  Conditionally compiled definitions for MAXSTEMS and
 *                  MAXWEIGHTS based on #ifndef to resolve compiler warnings.
 *  15-Nov-99  slg    Add 'ttc_index' and 'fontStartOffset' fields to TT_BUCK
 *                    structure (for TrueTypeCollections processing)
 *    24-Jan-00  slg    Vertical-writing changes (for keb), plus TT cleanup:
 *                    add baseGlyphAW, font_type_TT, xl_char_class, FONT_TYPE_*
 *                    defines; delete lookInROM, entityACT, top_bearing.  
 *    26-Jan-00  slg    Define "FontBBox" and "emResolution" unconditionally in
 *                    TT_BUCK, since they are used by the vertical-writing code.
 *  10-Feb-00  awr  Removed PST1_ROM
 *  14-Apr-00  keb  Added advanceHeight to CHAR_STATS to support vertical writing
 *  28-Sep-00  jfd  Added new embedded bitmap data structures;
 *                  In TT_BUCK, added EMBEDDED_BITMAP_FONT and EMBEDDED_BITMAP
 *                  fields and added flag to indicate whether bitmap tables
 *                  are embedded in the font.
 *  19-Oct-00 jfd   In EMBEDDED_BITMAP_FONT struct, removed EBLCTableHndl
 *                  and EBDTTableHndl fields; added EBLCOffset, EBDTOffset,
 *                  bst_hndl, ista_hndl and ist_hndl fields.
 *                  In EMBEDDED_BITMAP struct, removed embedded_bitmap_size
 *                  field; added emb_bmp_hndl field.
 *  13-Nov-00 jfd   Added 'CMAP_offset' field to TT_BUCK structure.
 *    04-May-01 slg    Non-UFST data-type cleanup; get rid of AGFATOOLS hack;
 *                    tighten up conditional compile for embedded bitmaps.
 *  23-May-01 jfd   OpenType changes:
 *                  Added macros B_OSOTCFF() and GET_pBUCKET().
 *                  Added fields CFFTableOffset, CFFTableSize and private_DICT_offset
 *                  to cft structure.
 *                  Added fields CFFTableOffset and CFFTableSize to TT_BUCK structure.
 *                  Added fields potcff and otcff_font to BUCKET structure.
 *  24-May-01 swp    Lots of changes in the way hints, bluevalues, and standard
 *                    stems are stored and processed.  Enabled by #define NEW_PS_HINTS
 *  15-Aug-02 awr   Added DIMM_DISK
 *  29-Oct-02  jfd    In INDEXSUBTABLE structure, replaced pointer variables with arrays to resolve ALPHA
 *                         alignment problems.
*/

#ifndef __IX__
#define __IX__


#define MAX_CC_PARTS  10    /* maximum number of parts in a compound ch. */

#if ASIAN_ENCODING || CFF_RDR         /* add CFF, 12/8/98 jwd  */
#define CHARBUFSIZE  8000             /* character buffer size */
#else
#define CHARBUFSIZE  4096             /* character buffer size */
#endif

#ifdef SUN
#define EXPBUFSIZE   2048  /* expansion buffer size, chg'd size -ss 11/7/91 */
#else
#define EXPBUFSIZE   2096  /* expansion buffer size, changed size -bg 02/26/92 */
#endif

/* Bucket Types */
#define  TF_SENSITIVE    0      /* Always the first bucket in icur_index */
#define  CREATE_BUCKET   0      /* Argument for BUCKfind()               */
#define  PURGE_BUCKET    1      /*    "      "      "                    */

/*  Typeface number definitions for generic screen faces and plugin faces */
#define FACE_S_SCR       5500L  /* serif screen font                     */
#define FACE_SS_SCR      5501L  /* sans serif screen font                */


/*--------------------------------*/
/*       font index entry         */
/*--------------------------------*/

/*  Definitions and macros for the file type bits within bucket_num   */

#define EXTERN_TYPE    0x0400   /* External vs. Internal              */
#define ROM_TYPE       0x0800   /* ROM based file vs. Disk            */

#define FILEORG_MASK   0x3000   /* file org bits                      */
#define D_LIB          0x0000   /* "D" standard typeface library      */
#define S_LIB          0x1000   /* "S" slim library                   */
#define U_LIB          0x2000   /* "U" ultraslim library              */
#define V_LIB           0x4000    /* "V" library   ks - 15/02/99  */

/* These macros can be used for both INDEX_ENTRY & BUCKET bucket_num fields */

#define B_ISROM(b)   ((b)->bucket_num & ROM_TYPE)
#define B_ISEXTERN(b) ((b)->bucket_num & EXTERN_TYPE)
#define B_U_LIB(b)   (( (b)->bucket_num & FILEORG_MASK ) == U_LIB)

#define B_LS_MASK       0x0007     /* low 3 bits of bucket_num is lim sens */
#define B_BOLD          0x0001
#define B_SANS_SERIF    0x0002
#define B_ITALIC        0x0004

#if CGFIXED_PITCH                       /* added  -ss 6/5/91    */
#define NFP_BUCKET_LEVELS    3
#define B_FP_PLUGIN_MASK     0x0038   /* 3 fixed pitch bits in IX.bucknum */
#define B_FIXED_PITCH        0x0008   /* FP, no plugins                   */
#define B_COURIER            0x0010   /* courier plugins                  */
#define B_LETTER_GOTHIC      0x0020   /* letter gothic plugins            */

#define COURIER_WIDTH        5291
#define LETTER_GOTHIC_WIDTH  4409
#define B_ISFPITCH(b) ((b)->bucket_num & B_FP_PLUGIN_MASK )
#endif

#if TT_RDR && CFF_RDR    /* 05-23-01 jfd */
#define B_ISOTCFF(b)  ((b)->otcff_font)
#define GET_pBUCKET(b) ( B_ISOTCFF(b) ? (b)->potcff : b )
#else
#define GET_pBUCKET(b) ( b )
#endif    /* TT_RDR && CFF_RDR */

#define B_PLUGIN_TYPE_TT     0x0040   /* for MULTIFORMAT in cgconfig.h */

#if IF_ROM
typedef struct
{
    SL32    tfnum;        /* typeface number                          */
    UL32   fhoff;        /* offset in library file for face header   */
   union {
      UL32  lib_offset;  /* offset to appropriate lib within a font block  */
      LPUB8 font_hdr;    /*  Used for PCLEO - pointer to font header       */
   } p_r;  /* pcleo-rom pointers to beginning of lib or pcleo data          */

    UW16   fhcount;      /* BYTE count of face header                */
    SW16    bucket_num;   /* Bit flags
                           *
                           * Bit 15      Compressed Library Flag
                           *  Value:
                           *    0    Normal library file
                           *    1    Compressed library file
                           *
                           * Bit 10  Internal / External flag
                           *
                           *    0    (0x0000)  Internal font
                           *    1    (0x0400)  PCLEO (external) font
                           *
                           * Bit 11  Physical media for internal fonts
                           *
                           *    0    (0x0000)  Disk based
                           *    1    (0x0800)  ROM based
                           *
                           * Bits 12-13  Font data organization
                           *
                           *    0    (0x0000)  "D" standard library file
                           *    1    (0x1000)  "S" slim font library
                           *    2    (0x2000)  "U" ultra-slim font library
                           *
                           * Bits 9-7    Reserved
                           *
                           * Bit 6   Used only #if MULTIFORMAT = 1
                           *    0      Use IF compatible plugins
                           *    1      Use TT compatible plugins
                           *
                           * Bits 5-3    Fixed Pitch plugin description
                           *   Value   Meaning
                           * (3 bits)
                           *    000     Proportional
                           *  >0 is a fixed pitch typeface
                           *    001     no plugins, all chars in TFS
                           *    010     Courier plugins, pitch =
                           *    100     Letter Gothic plugins, pitch =
                           *
                           *
                           * Bits 2-0  Typeface characteristics
                           *      bit/value    0           1     
                           *       0         normal      bold
                           *       1         serif       sans-serif
                           *       2         non-italic  italic
                           *
                           */
} INDEX_ENTRY;
#else
typedef struct
{
    SL32    tfnum;        /* typeface number                          */
    UW16   name_off;     /* offset to full path name of library file */
#if defined(__WATCOMC__)
    UW16   watpad;       /* pad word for WATCOM only */
#endif
    UL32   fhoff;        /* offset in library file for face header   */
    UW16   fhcount;      /* BYTE count of face header                */
    SW16    bucket_num;   /* Bit flags 
                           *   SAME AS bucket_num description ABOVE.  */
} INDEX_ENTRY;
#endif

typedef INDEX_ENTRY FARPTR * PINDEX_ENTRY;


/*--------------------------------*/
/*     FONTINDEX                  */
/*--------------------------------*/

/*  Defines for Limited Sensitive Buckets                                 */
#define NPSW_FACES           8     /* # of posture/serif/weight LS faces  */
#define NSW_FACES            4     /* # of serif/weight LS faces          */
#define NW_FACES             2     /* # of weight only LS faces           */

#if SLIM_FONTS
#define NBUCKET_LEVELS       5
#define NMAX_PLUGINS        15     /* 14 lim sensitive, universal         */

#define MIRROR_MASK          0x7000
#define ROT90_MASK           (0x1000 >> 12)
#define MIRROR_X_MASK        (0x2000 >> 12)
#define MIRROR_Y_MASK        (0x4000 >> 12)
#define NPARTS_MASK          0x07FF
                                  /* shift over to fit in a byte -ss 8/12/91*/
#define MIRROR_FLAGS( num_parts )  ( (num_parts & MIRROR_MASK) >> 12 )
#define NUM_PARTS( num_parts )     (  num_parts & NPARTS_MASK )

/* defines for mirror flag mapping used in comp_pix.c                     */
#define MIRROR_ROT0          0
#define MIRROR_ROT90         1
#define MIRROR_ROT180        6
#define MIRROR_ROT270        7
#define MIRROR_NEGROT0       2
#define MIRROR_NEGROT90      3
#define MIRROR_NEGROT180     4
#define MIRROR_NEGROT270     5
#else
#define NBUCKET_LEVELS       3
#define NMAX_PLUGINS         5     /* 4 lim sensitive, universal          */
#endif  /* SLIM_FONTS  */

#if CGFIXED_PITCH
#define NFP_PLUGINS          3 /* exact # of plugins for each FP typeface */
#endif
#if FCO_RDR
#define FCO_NPLUGIN_LEVELS   4
#endif

typedef struct
{
#if IF_ROM
    LPUB8       pfnt_index;      /* pointer: font index buffer            */
#else
    MEM_HANDLE  hfnt_index;      /* handle font index buffer              */
#endif

    SW16        entry_ct;        /* number of entries in index            */
    UW16        olibnames;       /* path names of library files in index  */

  /*  The current typeface. */

    SL32         font_type;       /* FONTCONTEXT format field bits 10-13;  */
                                 /* In addition,  for Asian TT, Format 16 */
                                 /* support, ExtendFlags, bits 0-3.       */

    LPUB8       cur_font_hdr;    /* current pcleo header                 */
    UW16        cur_ssnum;       /* current symbol set number            */
    SL32        cur_tf_num;      /* current type face number             */
    PINDEX_ENTRY cur_pix;        /* TFS INDEX_ENTRY                      */
    BOOLEAN        has_path;
#if DISK_FONTS
    PATHNAME    pathname;
#endif
#if DYNAMIC_FONTS && IF_RDR
    INDEX_ENTRY dynix;           /* passes info for dynamically loaded IF */
#endif

#if PLUGINS
    SL32         plug_type;
#endif

    PINDEX_ENTRY pix;            /* INDEX_ENTRY for search level */
    SL32          num_searches;   /* # searches possible. TFS + LS + U      */
                                 /* PS,TT have an extra level for core.    */

    UW16        icur_index[NBUCKET_LEVELS]; /* Indexes to the buckets of the
                                             * current typeface.
                                             */
                                   /*  indexes of plugin INDEX_ENTRY's    */
    UW16        iplugin[NMAX_PLUGINS]; 
    SW16        plugin_set;       /*  Describes the set of plugins loaded.
                                   *  #defines given in ix.c
                                   */

#if CGFIXED_PITCH
    UW16        courier_iplugin[ NFP_PLUGINS ];  /*  Courier plugins     */
    UW16        lgothic_iplugin[ NFP_PLUGINS ];  /* LetterGothic plugins */
#endif

    SL32 icore[8];     /* font index indices to core fonts. This arrary is
                       *  parallel to core_list[] in ix.c. It is used to
                       *  substitute the core 8 for PS and TT.
                       */
#if FCO_RDR
    UB8   fcoMakeNewSrchPath;   /* if nonzero, call fco_pluginSearchPath() */
    UB8   fcoSearchPath[FCO_NPLUGIN_LEVELS+1];
                                /* indices of plugin faces */
#endif

} FONTINDEX;
typedef FONTINDEX FARPTR * PFONTINDEX;

typedef MEM_HANDLE HBUCKET;

/*-------------------------------*/
/*    union stuff                */
/*-------------------------------*/
typedef struct
{
    UL32 items;    /* count of items indexed by header                        */
    UL32 step;    /* bytes per seek(offset from 0); also, zbase = &stt.      */
    UL32 stt;    /* &step, stt is the base for offset to data offset pointer*/
    UL32 zbase; /* base for offset to next index on chained indexes        */  
} cfix;
typedef struct
{
    UL32 headsize;
    UL32 aos;        /* absolute offset size: bytes to hold pos from top of file */
    UL32 name;            /* type face name index                    */
    UL32 CFFTableOffset;/* offset to CFF table in disk/ROM font */     /* 05-23-01 jfd */
    UL32 CFFTableSize;  /* size of CFF table in disk/ROM font   */     /* 05-23-01 jfd */
    UL32 private_DICT_offset;    /* offset to start of private DICT */  /* 05-23-01 jfd */
    cfix fonts;
    cfix dict;
    cfix strings;
    cfix globalsubrs;
    cfix charset;       /* pos to start of charset (SIDs) - NOT a full cfix  */
    cfix encoding;      /* pos to start of encoding - NOT a full cfix        */
    cfix charstrings;    /* pos to start of charstrings            */
    cfix localsubrs;    /* pos to start of local subroutines.    */
    cfix fontdict;        /* pos to start of FontDict Index (CID only) */
    FILECHAR nameInSet[CFFNAMELEN]; /* name of font in the font set */
} cft;

typedef  LPSB8  PFONT_DES; /* ptr to font path name */

#ifndef MAXSTEMS          /* 06-07-99 jfd        */
#define MAXSTEMS    12    /* from the White Book */
#endif                    /* 06-07-99 jfd        */

#ifndef MAXWEIGHTS        /* 06-07-99 jfd        */
#define MAXWEIGHTS  16    /* from Pipeline       */
#endif                    /* 06-07-99 jfd        */

#define BOTBLUES    12    /* from the White Book */
#define TOPBLUES    12    /* from the White Book */
#define MAXAXES      4    /* four design axes */

typedef struct {
  SL32  intval;  /* or size of string or name */
  FPNUM  realval;
  SW16  type;
  SW16  len;
} TOKENSTR;

/* The following structure "psi_wrk" pulls together lots of working vbls used
in /psi, with not-very-unique names like "x" and "miny". This technique should
probably be used more often, in order to make sense of the mass of newly-global
variables within "if_type". (Sandra, 26 May 98) */

typedef struct {

    TOKENSTR elt;

/*  5/14/93 - rs
   The following variables were move from 'type1char()' in order to
   integrate the Pipeline upgrade. They are now shared among multiple funcs.
*/
        SL32  ex;
        SL32  ey;
        SL32  epx;
        SL32  epy;
        SL32  curx; /* init to 0 - 4/14/93 - rs */
        SL32  cury; /* init to 0 - 4/14/93 - rs */
        SL32  x; /* init to 0 - 4/14/93 - rs */
        SL32  y; /* init to 0 - 4/14/93 - rs */

/* MLOCALs moved here from /psi/t1ihints.c */
        SL32 startx;
        SL32 starty;
        SL32 minx;
        SL32 miny;
        SL32 maxx;
        SL32 maxy;
/*
Add following vbls to interface w/'raster()' - 10/15/91 - rs
Type 1 local variables
*/
        LPUB8 pvert;          /* ptr to vertex codes in work buff */ 
        LPSL32 pxy;             /* ptr to XY coords in work buff */  /* 6-29-92 */

        LPSW16 p_vloop;        /* ptr to start of loop in expand buff */ 
        LPSL32 p_xyloop;       /* ptr to start of loop in expand buff */ 

        LPUB8 t1bufptr;   /* start of this 'POST' resource */
        LPUB8 t1bufend;   /* end of this 'POST' resource */

#if NON_Z_WIND
        SL32   yprev;               /* 10-07-93 jfd */
#endif

        INTR    p0x; /* p0x, p0y = current locs while rasterizing */
        INTR    p0y;

        SL32   savec;
        SL32   unputflag;
        SL32   decoding;  /* until we see currentfile eexec */
        UW16   code_decrypt;

#if NON_Z_WIND
        SW16   y_goes_up;           /* 10-07-93 jfd */
#endif
        SL32  movetocalled;      /* detect bad chars with path not starting with a moveto() */
        UW16 code;
        SW16 num_vects;          /* # of vectors in contour */
        SW16 num_bez;                /* # of bezier curves in contour */

        UB8  buf[128];
        UB8  token[1025];

} PSI_WORKING;
enum hexasc { T2ASCII, T1HEXFONT, CFF };

typedef struct {

#if USE_PS_ARRAY
/* only enable for non-UFST (ie PostScript encoding) - 5/22/92 - rs */
   MEM_HANDLE  hencodearray; /* sometimes needed with T1 */
#endif

#if CFF_RDR
   MEM_HANDLE  hcffencodearray; /* always needed with CFF, not for T1 */
   MEM_HANDLE  hcharsetarray; /* always needed with CFF, not for T1 */
   cft   cft;   /* so we don't have to BUFalloc() it */

    /* new fields used for processing of CID-in-CFF fonts*/

   BOOLEAN isCID;        /* set when ROS opcode (12:30) is encountered in a CFF font */
   SW16 FDidx_cur;        /* current FontDICT that's been read in for CID CFF font */
   MEM_HANDLE    hFDSelect;    /* holds FDSelect data for current CID CFF font */

#endif    /* CFF_RDR */

   MEM_HANDLE  hcharstrings;
   MEM_HANDLE  hsubrs;
   SW16 CharstringType;        /* std type 1 or cff type 2 */
   SW16 defaultWidthX;
   SW16 normalWidthX;
   SW16 stemhints;
   SW16 nsubs;       /* number of subs */
   SW16 n_chars;     /* number of chars in font */
   SW16 curr_char;   /* next char to read from font */
   SW16 StdHW;
   SW16 StdVW;
   SW16 lenIV;
   SW16 inStdHW;
   SW16 inStdVW;
   SW16 numStemSnapH;
   SW16 numStemSnapV;
   SW16 StemSnapH[MAXSTEMS];     /* add 3/2/93 - rs */
   SW16 StemSnapV[MAXSTEMS];     /* add 3/2/93 - rs */
   
   /* re-do scaled stems */
   SW16 num_x_stems;
   SW16 num_y_stems;
   SL32 scaled_x_stems[MAXSTEMS];
   SL32 scaled_y_stems[MAXSTEMS];

   /* re-do blue value processing */
   SW16 num_blues;
#define MAXBLUES 12
   SW16 round_blues[MAXBLUES];
   SW16 square_blues[MAXBLUES];
   SL32 scaled_round_blues[MAXBLUES];
   SL32 scaled_square_blues[MAXBLUES];
#undef MAXBLUES

   /* re-do hint processing */
#define MAXHINTS 96    /* as per CFF spec */

#if CFF_RDR   /* these hold the raw-unprocessed CFF hints */
   SL32 cff_v1[MAXHINTS];
   SL32 cff_v2[MAXHINTS];
   SW16 cff_type[MAXHINTS];
   SW16 cff_num_hints;
   SW16 cff_hintmask;
#endif

   /* these are the active, processed hints 
   * from a CFF or from a regular TYPE1 font */
   SW16 num_x_hints;
   SW16 num_y_hints;
   SW16 is_sorted;
   SL32 x_pixels[MAXHINTS];
   SL32 y_pixels[MAXHINTS];
   SL32 x_frus[MAXHINTS];
   SL32 y_frus[MAXHINTS];
   SL32 x_scales[MAXHINTS];
   SL32 y_scales[MAXHINTS];
   SL32 t1xtrans;
   SL32 t1ytrans;

/* the following 3 values are used in NEW_PS_HINTS, if T1MMASTER is set */
   SW16 numbblues;
   SW16 numtblues;
   SW16 bot_blues[BOTBLUES];
/* the following value is used in NEW_PS_HINTS, if T1MMASTER is not set */
   SW16 top_blues[TOPBLUES];
   
   SL32 Transform[4];
   SL32 iBlueScale;
   SW16 useblues;               /* !0 -> use BlueScale and BlueShift */
   SW16 iBlueShift;
   SW16 BlueFuzz;                /* 4-May-93 upgrade - rs */
   SW16 trans;
   SW16 overshoot;               /* suppress overshoots < this amount */
   SW16 stem_min;                /* 4-May-93 upgrade - rs */
   SW16 stem_adjust;             /* 4-May-93 upgrade - rs */
   SW16 stem_match;              /* 4-May-93 upgrade - rs */
   SW16 hint_gravity;            /* 4-May-93 upgrade - rs */
   SW16 FontBBox[4];             /* 28-Sep-93 jfd         */
   SL32 ForceBoldThreshold;      /* 29-Jul-98 dlk         */
   SW16 ForceBold;               /* 29-Jul-98 dlk         */

#if (T1MMASTER )
   SW16 inputDV[MAXAXES];        /* UDV from FONTCONTEXT- can be different
                                    from UserDV[] below if contains out of
                                    range values. awr 21-Jul-98 */
   SW16 MMnaxes;                 /* 6/6/93 - rs */
   SW16 Weightvals;              /* 4-May-93 upgrade - rs */
   SL32 weights[MAXWEIGHTS];     /* excess 16 fixed - 4-May-93 upgrade - rs */
   SL32 weights_default[MAXWEIGHTS];
   SL32 NormDV[MAXAXES];         /* Normalized design vector - CFF - 6/98 dek    */
   SL32 UserDV[MAXAXES];         /* User design vector - CFF - 6/98 dek            */
   SW16 MMnstdvw;                /* 6/6/93 - rs */
   SW16 MMstdvw[MAXAXES];        /* 6/6/93 - rs */
   SW16 MMnstdhw;                /* 6/6/93 - rs */
   SW16 MMstdhw[MAXAXES];        /* 6/6/93 - rs */
   SW16 MMnblendmap;             /* 6/6/93 - rs */
   MEM_HANDLE hMMblendmap;       /* 6/6/93 - rs */
   SW16 MMnblues;                /* 6/6/93 - rs */
   MEM_HANDLE hMMblues;          /* 6/6/93 - rs */
   SW16 MMnotherblues;           /* 6/6/93 - rs */
   MEM_HANDLE hMMotherblues;     /* 6/6/93 - rs */
   SW16 MMnbluescales;           /* 7/29/98 - dlk */
   MEM_HANDLE hMMbluescales;     /* 7/29/98 - dlk */
   SW16 MMnblueshifts;           /* 7/29/98 - dlk */
   MEM_HANDLE hMMblueshifts;     /* 7/29/98 - dlk */
   SW16 MMnstemsnapsH;           /* 7/29/98 - dlk */
   MEM_HANDLE hMMstemsnapsH;     /* 7/29/98 - dlk */
   SW16 MMnstemsnapsV;           /* 7/29/98 - dlk */
   MEM_HANDLE hMMstemsnapsV;     /* 7/29/98 - dlk */
   SW16 MMnfontbbox;             /* 7/29/98 - dlk */
   MEM_HANDLE hMMfontbbox;       /* 7/29/98 - dlk */
   SW16 MMnblendpos;             /* 6/24/98 - dlk */
   MEM_HANDLE hMMblendpos;       /* 6/24/98 - dlk */
   SW16 MMnforcebold;            /* 7/29/98 - dlk */
   MEM_HANDLE hMMforcebold;      /* 7/29/98 - dlk */
#endif /* T1MMASTER */
   FPNUM fontmatrix[6];          /* from original font */
#ifdef LINT_ARGS
   VOID (*transptr) (FSPvoid SL32, SL32, LPSL32, LPSL32);
#else
   VOID (*transptr) ();
#endif /* LINT_ARGS */
/*
Info stored by 'psset_char()'
NOTE: Memory WARANTEED NOT TO MOVE BETWEEN 'set_char()' & 'make_gaso...()'!
PCDATASTR not defined up to here, use VOID for now & fix later
*/
   VOID  *pthis_charstring;/* PCDATASTR - ptr to this charstring */
   SL32   last_seek;/* last position seeked to */
   UW16 last_key; /* last decryption key UL32 to UW16 3/13/92 rs*/
   enum hexasc hexascii; /* formerly (0 - binary, 1 - hex ascii) - now an enum value */
    PSI_WORKING psiw;
} PS_BUCK;
typedef PS_BUCK FARPTR *PPS_BUCK;

typedef struct {
  /*  character directory  (face header segment) */

    LPSB8          pface_header_seg;
    MEM_HANDLE     hface_header_seg;
    UW16          ch_count;             /* Number of characters */

  /*  FACE GLOBAL SEGMENT.  Subsegments are broken out by offsets
   *  from start of face global segment and size in bytes
   */

    LPSB8      pfgseg;           /* Pointer to face global segment */
    MEM_HANDLE hfgseg;           /* Handle of    "     "      "    */
    UW16      sfgseg;             
    UW16      ogif;              /* Global Intellifont segment */
    UW16      gifct;
    UW16      otrack_kern_seg;   /* track kerning              */
    UW16      strack_kern_seg;
    UW16      otext_kern_seg;    /* text kerning               */
    UW16      stext_kern_seg;
    UW16      odesign_kern_seg;  /* designer kerning           */
    UW16      sdesign_kern_seg;
    UW16      owidth_seg;        /* character width segment    */
    UW16      swidth_seg;
    UW16      oattribute;        /* Attribute header           */
    UW16      sattribute;
    UW16      orast;             /* Raster parameter           */
    UW16      srast;
    UW16      otf_header_seg;    /* Typeface Header segment    */
    UW16      stf_header_seg;
    UW16      ocompound_seg;     /* Compound character         */
    UW16      scompound_seg;
    UW16      odisplay;          /* Display header             */
    UW16      sdisplay;
    UW16      ofont_alias_seg;   /* Font Alias segment         */
    UW16      sfont_alias_seg;
    UW16      ocopy;             /* Copyright notice           */
    UW16      scopy;

#if ROM
    LPUB8      plibfont;         /* "pointer" to lib in font block */
#endif
} IF_BUCK;

#define TT_PLUGPLID  3           /* platformID default for TT plugin   */
#define TT_PLUGSPID  1           /* specificID default for TT plugin   */
                                 /*   Microsoft Unicode, UGL           */
/* moved from ttload_font */
#define  FONT_TYPE_DISK      1
#define  FONT_TYPE_EXTERN    2
#define  FONT_TYPE_ROM       3
#define  FONT_TYPE_DISK_ACT  4          /* to be implemented */
#define  FONT_TYPE_ROM_ACT   5

#if EMBEDDED_BITMAPS && TT_RDR && CGBITMAP
typedef struct {
    SB8        ascender;
    SB8        descender;
    UB8        widthMax;
    SB8        caretSlopeNumerator;
    SB8        caretSlopeDenominator;
    SB8        caretOffset;
    SB8        minOriginSB;
    SB8        minAdvanceSB;
    SB8        maxBeforeBL;
    SB8        minAfterBL;
    SB8        pad1;
    SB8        pad2;
} SBITLINEMETRICS;

typedef struct {
    UW16    glyphCode;
    SB8        xOffset;
    SB8        yOffset;
} EBDTCOMPONENT;
typedef EBDTCOMPONENT FARPTR * PEBDTCOMPONENT;
typedef EBDTCOMPONENT FARPTR * FARPTR * PPEBDTCOMPONENT;

typedef struct {
    UW16    firstGlyphIndex;
    UW16    lastGlyphIndex;
    UL32    additionalOffsetToIndexSubtable;
} INDEXSUBTABLEARRAY;
typedef INDEXSUBTABLEARRAY FARPTR * PINDEXSUBTABLEARRAY;
typedef INDEXSUBTABLEARRAY FARPTR * FARPTR * PPINDEXSUBTABLEARRAY;

typedef struct {
    UB8    height;
    UB8    width;
    SB8    horiBearingX;
    SB8    horiBearingY;
    UB8    horiAdvance;
    SB8    vertBearingX;
    SB8    vertBearingY;
    UB8    vertAdvance;
} BIGGLYPHMETRICS;
typedef BIGGLYPHMETRICS FARPTR * PBIGGLYPHMETRICS;

typedef struct {
    UB8    height;
    UB8    width;
    SB8    BearingX;
    SB8    BearingY;
    UB8    Advance;
} SMALLGLYPHMETRICS;
typedef SMALLGLYPHMETRICS FARPTR * PSMALLGLYPHMETRICS;

typedef struct {
    UW16    glyphCode;
    UW16    offset;
} CODEOFFSETPAIR;
typedef CODEOFFSETPAIR FARPTR * PCODEOFFSETPAIR;

typedef struct {
    UW16    indexFormat;
    UW16    imageFormat;
    UL32    imageDataOffset;

    union {
        struct {
            UL32            offsetArray[1];
        } INDEXSUBTABLE1;

        struct {
            UL32            imageSize;
            BIGGLYPHMETRICS    bigMetrics;
        } INDEXSUBTABLE2;

        struct {
            UW16            offsetArray[1];
        } INDEXSUBTABLE3;

        struct {
            UL32            numGlyphs;
            CODEOFFSETPAIR    glyphArray[1];
        } INDEXSUBTABLE4;

        struct {
            UL32            imageSize;
            BIGGLYPHMETRICS    bigMetrics;
            UL32            numGlyphs;
            UW16            glyphCodeArray[1];
        } INDEXSUBTABLE5;
    } u;
} INDEXSUBTABLE;
typedef INDEXSUBTABLE FARPTR * PINDEXSUBTABLE;
typedef INDEXSUBTABLE FARPTR * FARPTR * PPINDEXSUBTABLE;

typedef struct {
    UW16                indexFormat;
    UW16                imageFormat;
    UL32                imageDataOffset;
} INDEXSUBHEADER;
typedef INDEXSUBHEADER FARPTR * PINDEXSUBHEADER;

#if 1    /* 01-15-04 jfd (from SWP) */
/* NOTE: we use the BOLD and OBLIQUE extensions only in STIK fonts, where we */
/* may need embedded bitmaps for Normal, Bold, Oblique, and Bold-Oblique: they use */
/* currently 'undefined' bits of the <flags> field of the BITMAPSIZETABLE */
#endif    /* 01-15-04 jfd */

typedef struct {
    UL32                indexSubTableArrayOffset;
    UL32                indexTableSize;
    UL32                numberOfIndexSubTables;
    UL32                colorRef;
    SBITLINEMETRICS        hori;
    SBITLINEMETRICS        vert;
    UW16                startGlyphIndex;
    UW16                endGlyphIndex;
    UB8                    ppemX;
    UB8                    ppemY;
    UB8                    bitDepth;
    SB8                    flags;
} BITMAPSIZETABLE;
typedef BITMAPSIZETABLE FARPTR * PBITMAPSIZETABLE;
typedef BITMAPSIZETABLE FARPTR * FARPTR * PPBITMAPSIZETABLE;

typedef struct {
    LPUB8                EBLCTable;        /* ptr to EBLC Table                        */
    UL32                EBLCSize;        /* size of EBLC table                        */
                                        /*   0= table NOT in font                    */
    UL32                EBLCOffset;        /* offset to EBLC Table (10-05-00)            */
    LPUB8                EBDTTable;        /* ptr to EBDT Table                        */
    UL32                EBDTSize;        /* size of EBDT table                        */
                                        /*   0 = table NOT in font                    */
    UL32                EBDTOffset;        /* offset to EBDT Table (10-05-00)            */
    UL32                numbitmapSizeTables;
                                        /* number of bitmapSizeTable tables in font    */
    PBITMAPSIZETABLE    pbitmapSizeTable;
                                        /* pointer to bitmapSizeTable elemenet        */
                                        /* to which requested glyph belongs            */
    MEM_HANDLE            bst_hndl;        /* handle to bitmapSizeTable element above    */
    PINDEXSUBTABLEARRAY    pindexSubTableArray;
                                        /* pointer to indexSubTableArray element    */
                                        /* to which requested glyph belongs            */
    MEM_HANDLE            ista_hndl;        /* handle to indexSubTableArray element above */
    PINDEXSUBTABLE        pindexSubTable;
                                        /* pointer to indexSubTable element to which*/
                                        /* requested glyph belongs                    */
    MEM_HANDLE            ist_hndl;        /* handle to indexSubTable element above    */
} EMBEDDED_BITMAP_FONT;
typedef EMBEDDED_BITMAP_FONT FARPTR * PEMBEDDED_BITMAP_FONT;

typedef struct {
    LPUB8        embedded_bitmap_data;
                                /* pointer to bitmap data for requested char*/
                                /* (format based on 'imageFormat' value in    */
                                /* indexSubTable struct                        */
    MEM_HANDLE    emb_bmp_hndl;    /* handle to bitmap data for req char above    */
} EMBEDDED_BITMAP;
typedef EMBEDDED_BITMAP FARPTR * PEMBEDDED_BITMAP;
#endif    /* EMBEDDED_BITMAPS && TT_RDR && CGBITMAP */

/* for CCC font */
#if CCC
typedef struct {
    SL32 numBits_LOCA;  /* number of bits used for LOCA */
    /* for v7 CCC, qwu 08-20-04 */
    /* SW16 minVal_LSB, numBits_HMTX;*/    /* mimium value for LSB and number of bits for HMTX */
    SW16 minVal_LSB, numBits_LSB;    /* mimium value and number of bits for LSB */
    SW16 minVal_AW, numBits_AW;    /* mimium value and number of bits for AW */
    SW16 minVal_TSB, numBits_TSB;    /* mimium value and number of bits for TSB */
    SW16 minVal_AH, numBits_AH;    /* mimium value and number of bits for AH */
    
    UL32 numBits_GLYF;                /* number of bits for GLYF */
    /* for v7 CCC, qwu 08-20-04 */
    BOOLEAN cccVersion7;
} CCC_INFO;
#endif

typedef struct {
    MEM_HANDLE buffInfo;         /* fs_GlyphInfoType structure         */
    MEM_HANDLE buffInput;        /* fs_GlyphInputType structure        */
    MEM_HANDLE trMatrix;         /* 3x3 transformation matrix          */
    MEM_HANDLE GlobalTTHndl;     /* memory handle for global TT data   */
#if TT_PCLEOI
    MEM_HANDLE GalleySegHndl;    /* memory handle to Galley Segment    */
                                 /*   NIL_MH= Segment NOT in font      */
    UL32 GalleySegSize;          /* size of Galley Segment             */
                                 /*   0= Segment NOT in font           */
    UL32 VertRotSegSize;         /* size of Vert Rotation Seg. AJ   8-12-03 */
    MEM_HANDLE VertRotSegHndl;   /* memory handle to Vertical Rotate AJ   */
    MEM_HANDLE VertExSegHndl;       /* memory handle to Vertical Exclude Segment */
    UL32 VertExSegSize;             /* size of VE Segment*/
#endif /* TT_PCLEOI */
#if (ASIAN_ENCODING && (TT_DISK || TT_ROM || TT_ROM_ACT)) /*GSUB*/
    MEM_HANDLE GSUBTableHndl;    /* memory handle for DISK font GSUB Table */
                                 /*   DISK File:  NIL_MH=table NOT in font */
                                 /*   ROM File:   Always NIL_MH            */
    UL32       GSUBSize;         /* size of GSUB table                     */
                                 /*   0= table NOT in font                 */       
    UW16       GSUBVrtGCount;    /* count of 'GSUB' glyph substitution     */
                                 /*   pairs                                */
    LPUB8      pGSUBHorGIndxs;   /* pointer to start of horizontal         */
                                 /*   'GSUB' glyph indexes                 */
    LPUB8      pGSUBVrtGIndxs;   /* pointer to start of vertical sub.      */
                                 /*   'GSUB' glyph indexes                 */
    UW16       GSUBCoverageFormat; /* format of the coverage table            */ 
    UW16       GSUBHorRangeCount;  /* # of ranges if fmt of coverage tbl is 2 */
#endif /* (ASIAN_ENCODING && (TT_DISK || TT_ROM || TT_ROM_ACT))  */
#if EMBEDDED_BITMAPS && TT_RDR && CGBITMAP
    /* EBLC */
    EMBEDDED_BITMAP_FONT    embf;
    EMBEDDED_BITMAP            emb;
    BOOLEAN                    BitmapTablesEmbedded;    /* Embedded bitmap tables exist in font */
#endif    /* EMBEDDED_BITMAPS && TT_RDR && CGBITMAP */
#if  (TT_ROM || TT_ROM_ACT)
    LPUB8      ROMHndl;          /* pointer to font data in ROM        */
#endif
#if TT_PCLEOI
    LPUB8      baseGlyphPtr;     /* PCLEO: saves ptr to glyph data     */
    UW16       baseGlyphID;      /* Distinguishes comp char ID from components */
    UW16       baseGlyphLen;     /* Size of glyph data                 */
    /* keb 8/99 */
    UW16       baseGlyphAW;
    MEM_HANDLE VrtSubTTHndl;     /* memory handle, Vert Subs. table    */
    UL32       VrtSubTTSize;     /* size of Vertical Substitution tbl. */
#endif
    UL32       glyphTableOffset; /* offset to glyph table in disk/ROM font */
    UL32       glyphTableSize;   /* size of glyph table in disk/ROM font */
    UL32       GlobalTTSize;     /* size of global font data           */
    UW16       platId;           /* platform id (for character mapping)*/
    UW16       specId;           /* specific id   "      "        "    */
    UW16       langId;           /* language id (to distinguish GB from BIG5)*/
    CGFIXED    spotsize;
    UL32       fontStartOffset;     /* offset to fontstart - 0 unless TTC */
    UL32       font_type_TT;     /* used to be local font_type in ttload_font */            
    SW16       ttc_index;         /* index of font within TTC (TrueTypeCollection) file. */
    BOOLEAN       useCmapTable;     /* whether to use CMAP table to get glyph
                                    index - if FALSE, set glyphIndex directly */
    SW16       FontBBox[4];      /* xmin,ymin,xmax,ymax                */
    UW16       emResolution;     /* font resolution in design units    */
    /* keb 7/03 */
    BOOLEAN    verticalMetricsExist;  /* indicated the presence of the vhea table */
#if TT_TTPLUG
    FONTCONTEXT  TTfc;           /* FC for each TrueType font          */
#endif
#if 1        /* 11-13-00 jfd */
    UL32       CMAP_offset;      /* offset to CMAP table from start of font */
#endif    /* 11-13-00 jfd */
#if TT_RDR && CFF_RDR            /* 05-23-01 jfd */
    UL32       CFFTableOffset;   /* offset to OTCFF table in disk/ROM font */
    UL32       CFFTableSize;     /* size of OTCFF table in disk/ROM font */
#endif    /* TT_RDR && CFF_RDR */

/* for CCC font */
#if CCC
    CCC_INFO        ccc_info;
#endif

#if DIMM_DISK
    UL32        locaTableOffset;    /* ROM address */
    UL32        locaTableSize;
    UL32        hmtxTableOffset;    /* ROM address */
    UL32        hmtxTableSize;
    UL32        vmtxTableOffset;  
#endif /* DIMM_DISK */
} TT_BUCK;

#define NOFONT 0                 /* definitions applicable to         */
#define FONT_LOADED 1            /* 'FontState' in FCO_BUCK structure */

#if FCO_RDR
typedef struct {
    MEM_HANDLE fcoFont;          /* Handle to FONTTYPE object */
    MEM_HANDLE fcoChar;          /* Handle to CHARTYPE object */
    MEM_HANDLE fcoTrans;         /* Handle to PIXEL_DATA object (x and y) */
    SL32       tMatrix[4];       /* Transformation matrix     */
    UW16       matrixType;       /* identity, orthogonal, or arbitrary */
    UW16       design_EmRes;     /* Design unit resolution per em */
    UW16       spaceBand;        /* Width of spaceband in design units */
    UW16       unicode;          /* Unicode of current character */
    UW16       orThreshold;      /* orThreshold from TTFONTINFOTYPE  */
   FONTCONTEXT fcoFC;            /* Save fontcontext of each bucket. */
    SB8        compositionFlag;  /* 0=IF compatible; 1=TT compatible */
    SB8        charCloseFlag;    /* Tells us if FCcharNew() has been called but not FCcharClose() */
    UB8        FontState;        /* Set to FONT_LOADED after FCfontNew() has executed successfully */
    UW16       ThinSpace;        /* Width of Thin space in design units */
    UW16       ENSpace;          /* Width of EN space in design units */
    UW16       EMSpace;          /* Width of EM space in design units */
#if FCO_CONVERGENTFONT
    SL32       oblMatrix[4];     /* Obliqued matrix for Convergent Fonts */
    SB8        cvfChangeScale;   /* if converged font uses different scale factor */
    UW16       cvfScale1;        /* scale factor of base font */
    UW16       cvfScale2;        /* scale factor of alternate font */
#endif  /* FCO_CONVERGENTFONT */
#if BOLD_FCO
    SW16       xbold;
    SW16       ybold;
#endif
}  FCO_BUCK;
#endif


/*--------------------------------*/
/*     BUCKET                     */
/*--------------------------------*/

#if UFST_MULTITHREAD
#define MAX_THREADS 16
#endif
typedef struct
{
    DLL       link;
    HBUCKET   my_handle;      /* memory handle of this structure */
    BOOLEAN   locked;         /* BUFalloc() can't free if locked */
    SW16      bucket_num;     /* See INDEX_ENTRY.bucket_num. Used
                               * by IF_RDR, TT_IFPLUG, PS_IFPLUG */
    SL32      tfnum;          /* Typeface number                 */
    SL32       fh;             /* File handle, -1 if no open file */
#if DIMM_DISK
    SL32    curpos;             /* Current position in DIMM "file" */
#endif

    UW16      cur_ssnum;      /* current symbol set number       */
    UW16      usePlugins;     /* 1 = character set Augmentation with buckets;
                               * 0 = no plugins                  */
    UW16      fc_format;      /* format word in fontcontext structure */
    UL32      fc_ExtndFlags;  /* ExtndFlags word in fontcontext structure */
    SL32       font_type;      /* FONTCONTEXT format field bits 10-13  */
    SL32       extern_font;    /* FC_EXTERN_TYPE | EF_FORMAT16_TYPE bit */
    UW16      fst_type;       /* FC_IF_TYPE    0x0000  Intellifont
                               * FC_PST1_TYPE  0x1000  PostScript Type 1
                               * FC_TT_TYPE    0x2000  TrueType
                               * FC_FCO_TYPE   0x3000  MicroType */
    LPUB8     cur_font_hdr;   /* current pcleo header              */
    BOOLEAN   has_path;       /* Use pathname to identify the font */
#if DISK_FONTS
    PATHNAME  pathname;
#endif
#if DYNAMIC_FONTS && IF_RDR
    BOOLEAN        dynIFActive;    /* Dynamic font (Intellifont)      */
#endif

#if CFF_RDR    && TT_RDR    /* 05-23-01 jfd */
    VOID      *potcff;        /* ptr to OpenType CFF bucket (if applicable) */
    BOOLEAN    otcff_font;    /* indicates whether font is OpenType CFF font */
#endif    /* CFF_RDR */

#if UFST_MULTITHREAD
    UL32 thread_ids[MAX_THREADS];
#endif

    VOID     *pft;            /* ptr to struct of functions to handle font */

    union {                   /* FST specific */
#if PST1_RDR
        PS_BUCK  ps;
#endif
#if IF_RDR
        IF_BUCK  in;
#endif
#if TT_RDR
        TT_BUCK  tt;
#endif
#if FCO_RDR
        FCO_BUCK fco;
#endif
    } p;
} BUCKET;
typedef BUCKET FARPTR * PBUCKET;
typedef BUCKET FARPTR * FARPTR * PPBUCKET;

/*------------------------------*/
/*   Per Character Definition   */
/*------------------------------*/

typedef struct
{
     SW16VECTOR origin;
     SW16VECTOR escape;

     SW16    num_parts;      /* number of parts in the character    */
     BOOLEAN is_compound;    /*  Flag this character as compound    */
#if SLIM_FONTS
     UB8   mirror_flags;   /* flags from num_parts to describe mirroring */
#endif /* SLIM_FONTS */
}  CHR_DEF_HDR;
typedef CHR_DEF_HDR FARPTR * PCHR_DEF_HDR;

/*------------------------------*/
/*  Character (Part) Definition */
/*------------------------------*/

typedef struct
{
    UW16 cgnum;
    SL32  buck_search_lvl;       /* bucket level where this part "lives" */
    SW16  index;
    SW16VECTOR   offset;
    SW16VECTOR   bmorigin;
    BOX          pix_bound;
#if PCLEO_RDR
    LPUB8       pgif;           /*  ptr to global IF data in PCLEO hdr */
#endif
} CHR_DEF;
typedef CHR_DEF FARPTR * PCHR_DEF;


typedef struct
{
    SW16   format;      /* 1, 2, 3 for linear, quadra, cubic             */
    SW16   nloop;       /* Number of contour loops in character          */
    UW16   est_pnts;    /* estimated number of vector points             */
    UW16   est_segs;    /* estimated number of segments                  */
    SL32   est_size;    /* Estimated outline size including OLHEADERISIZ */

    SW16   xscale;  /* Did not conditionally compile on !VLCOUTPUT becaues */
    SW16   yscale;  /* these values appear in so many modules. The extra */
                    /* space they take up is not significant */
#if VLCOUTPUT
    SW16   VLCpower;  /* power of two to scale up in output processors */
#endif
    SW16   escapement;
    INTRBOX olbox;
    SL32VECTOR origin_cs;  /* char origin in fops; changed to SL32VECTOR, mby 12-11-94 */

    COUNTER  tran_run_ct;   /* number of transition runs = number of
                             * changes in y direction in character outline
                             */

   /* The following fields were added from old CHAR_STATS structure. */

    SL32  xmin, xmax, ymin, ymax;       /* char bbox in fops */
    SL32   ct_lineto;
    SL32   ct_quadto;
    SL32   ct_cubeto;
    SW16VECTOR dorigin;               /* char origin in design units       */
    SL32   dxmin, dxmax, dymin, dymax; /* char bounding box in design units */

   /* The following fields were added to support the new compile option    */
   /* DU_ESCAPEMENT.                                                       */

    SW16 du_emx;               /* x-size of em box in font design units    */
    SW16 du_emy;               /* y-size of em box in font design units    */
    /* keb 4/00 */
#if TT_RDR
    SW16 xl_char_class;
    SW16 yDescender;
#endif
/* #if GET_VERTICAL_METRICS        08-20-04 qwu */  
    UW16 advanceHeight;
    SW16 topSideBearing;      /* JWD, 04-22-03. */
/* #endif        08-20-04 qwu */ 
#if TT_SCREENRES
    SW16    pixelWidth;   /* "devAdvWidth", shifted to 1/16th pixel    */
                              /* however, this should be INTEGRAL # pixels */
    CGPOINTFX advanceWidth;   /* Scaled escapement, 16.16. jwd, 08/18/02.  */    
#endif

} CHAR_STATS;
typedef CHAR_STATS FARPTR * PCHAR_STATS;

typedef struct {
    SL32  BBox[4];
    SL32  emRes;
} BBoxRes;

#endif    /* __IX__ */

kanji.h   、、、、、、、、、、、、、、、、、、、、、、、、、、、、、

/* 
 * Copyright (C) 2004 Agfa Monotype Corporation. All rights reserved.
 */
/* $Header:   I:/BULL/URIP/SYS/INC/KANJI.H_V   1.34   Nov 24 2004 16:35:42   galejss  $ */
/* $Log:   I:/BULL/URIP/SYS/INC/KANJI.H_V  $ 
 * 
 *    Rev 1.34   Nov 24 2004 16:35:42   galejss
 * add special ssnum value USER_CMAP
 * 
 *    Rev 1.33   Apr 26 2004 14:47:34   GalejsS
 * move errorcodes to cgif.h (for one set of consistent values across UFST)
 * 
 *    Rev 1.32   Aug 22 2003 09:43:52   LynchR
 * Updated copyright notice.
 * 
 *    Rev 1.31   Sep 30 2002 14:51:00   Galejs
 * add UCS4 0xff12 define (for jfd)
 * 
 *    Rev 1.30   Sep 26 2002 16:44:36   Joe
 * Added new define SYMBOL.
 * 
 *    Rev 1.29   Sep 23 2002 14:27:34   Galejs
 * test for multiple includes (part of bug # 76)
 * 
 *    Rev 1.28   Dec 22 2000 10:22:26   Song
 * Revert 13-Nov-00 change.
 * 
 *    Rev 1.27   Dec 04 2000 15:48:40   Galejs
 * add special RAW_GLYPH symbolset & is_it_Asian() macro
 * 
 *    Rev 1.26   Nov 28 2000 18:00:56   Galejs
 * get rid of CP936 / CP949 / CP950
 * 
 *    Rev 1.25   Nov 16 2000 15:47:00   Joe
 * Removed earlier added mapping structures KSCUNIMAP, 
 * BIG5UNIMAP and GBUNIMAP.
 * Removed earlier added mapping pointers PKSUNIMAP,
 * PBIG5UNIMAP and PGBUNIMAP.
 * (Not needed after all)
 * 
 *    Rev 1.24   Nov 15 2000 15:15:34   Joe
 * Added new data structures to support mapping function bug fixes.
 * 
 *    Rev 1.23   22 Jun 1998 16:44:26   GALEJS
 * move all fn prototypes to shareinc.h
 * 
 *    Rev 1.22   04 Jun 1997 16:31:12   DAVID
 * Added defines for WANSUNG and JOHAB Korean encodings.
 * 
 *    Rev 1.21   19 Feb 1997 21:36:52   DAVID
 * No Change.
 * 
 *    Rev 1.20   19 Feb 1997 20:42:32   DAVID
 * Added defines for CP936, CP949, and CP950 to enable  updated 'newtext'
 * program, and a new 'dot file' generator for Asian tests called 'makadot'.
 * 
 *    Rev 1.19   09 Jan 1997 15:20:02   DAVID
 * Added support for GB, BIG5, and KSC.
 * 
 *    Rev 1.18   04 Oct 1996 08:30:28   JOE
 * Removed CTRL-Z at end of file.
 * 
 *    Rev 1.17   01 Oct 1996 16:34:06   JOE
 * Added prototype for ASIANexit().
 * 
 *    Rev 1.16   06 Aug 1996 15:29:36   MIKE
 * #define MASK_ASIAN_ENC 0xFF00
 * 
 *    Rev 1.15   07 Apr 1995 11:31:12   LISA
 * Changed copyright information from Miles Inc. to Bayer Corp.
 * 
 *    Rev 1.14   02 Dec 1994 20:54:00   YAN
 * KSC
 * 
 *    Rev 1.13   11 Jul 1994 14:38:56   JOE
 * Moved #define for KJ here from TTKAN.C .
 * 
 *    Rev 1.12   22 Apr 1994 15:31:30   LISA
 * Made modifications to copyright/disclaimer notice.
 * 
 *    Rev 1.11   17 Feb 1994 14:02:36   MAIB
 * Added error codes for JIS and Unicode mappings
 * 
 *    Rev 1.10   05 Jan 1994 18:55:00   ROB
 * Add support for "GB" encoding.
 * 
 *    Rev 1.9   08 Dec 1993 12:35:52   MAIB
 * Modified Unicode mappings
 * 
 *    Rev 1.8   07 Dec 1993 13:07:00   MAIB
 * Enabled Jis-Unicode mappings
 * 
 *    Rev 1.7   30 Nov 1993 14:49:36   ROB
 * Add BIG5 support and TCA hooks.
 * 
 *    Rev 1.6   24 Nov 1993 08:47:58   JOE
 * Enabled function prototype SJisToJis().
 * Added new function prototypes EucToJis(), JisToEuc() and SJisToEuc().
 * 
 *    Rev 1.5   09 Nov 1993 10:34:58   MIKE
 * Add #define for UNICODE encoding.
 * 
 *    Rev 1.4   26 Jul 1993 11:53:06   ROB
 * Add extern prototype for 'EucToSJis()'.
 * 
 *    Rev 1.3   01 Jul 1993 15:54:00   JOE
 * Added #define for EUC encoding.
 * 
 *    Rev 1.2   23 Jun 1993 10:22:50   JOE
 * Corrected function prototype for JisToSJis().
 * 
 *    Rev 1.1   14 Jun 1993 10:41:50   ROB
 * Changes for 'JIS' mapping.
 * 
 *    Rev 1.0   17 Mar 1993 09:27:36   LISA
 * Initial revision.
 * 
*/
/* $Date:   Nov 24 2004 16:35:42  $ */

/* kanji.h */
/*
 *
 * REVISION HISTORY
 *_____________________________________________________________________
 * 11-Mar-93 maib Created this file
 * 11-Jun-93 rs   Add JistoSJis() & SJisToJis() externs.
 * 16-Jun-93 jfd  Corrected function prototype for JisToSJis().
 * 30-Jun-93 jfd/gy Added #define for EUC encoding.
 * 23-Jul-93 rs   Add extern prototype for 'EucToSJis()'.
 * 09-Nov-93 gy/my  Add #define for UNICODE encoding.
 * 17-Nov-93 jfd  Added new function prototypes: EucToJis(), JisToEuc() and 
 *                SJisToEuc().
 *                Enabled function prototype SJisToJis().
 * 23-Nov-93 rs   Add define for BIG5 & TCA encoding.
 * 07-Dec-93 maib Added JIS and Unicode mapping support
 * 08-Dec-93 maib Modified method for mapping to Unicode
 * 05-Jan-94 rs   Add support for "GB" encoding.
 * 18-Feb-94 maib Error codes for invalid mappings and mapping table errors added
 * 11-Jul-94 jfd  Moved #define for KJ here from TTKAN.C .
 * 08-Aug-96 mby  #define MASK_ASIAN_ENC 0xFF00
 * 01-Oct-96 jfd  Added prototype for ASIANexit().
 * 18-Nov-96 dlk  Added typedefs for BIG5 and GB mapping, and added function
 *                prototypes for Unicode to BIG5, Unicode to GB, as well as
 *                BIG5 to Unicode, and GB to Unicode.
 * 19-Feb-97 dlk  Added defines for CP936, CP949, and CP950 so that updated
 *                version of 'newtext', and a new 'dot file' generator called
 *                'makadot' will work.  Also began to add support for CODE
 *                PAGE encoded Asian fonts by defining CP9362UNI_MAP,
 *                CP9492UNI_MAP, and CP9502UNI_MAP. 
 * 21-May-97 dlk  Added defines for WANSUNG and JOHAB Korean character encoding.
 * 13-Nov-00 jfd  Added structure JISUNIMAP.
 *                Added pointer PJISUNIMAP.
 * 01-Dec-00 slg  Added "special" symbolset value RAW_GLYPH, to be used for
 *                  raw-glyph-index mode in TrueType (i.e. don't use the cmap
 *                  table). This symbolset needs to be treated as an "Asian"
 *                  symbolset, because there may be more than 255 values.
 *                  Also added a #define to test whether a symbol set is Asian,
 *                  to replace the numerous multiple-SS tests in various places
 *                  (no need to modify it if we add a new Asian encoding).
 * 22-Dec-00 ks      Removed JISUNIMAP, PJISUNIMAP definitions. 
 * 25-Sep-02 jfd        Added define for SYMBOL encoding.
*/

#ifndef __KANJI__
#define __KANJI__

#define JIS                   0xFFFF   /* JIS character encoding */
#define SHIFT_JIS             0xFFFE   /* Shift-JIS character encoding */
#define EUC                   0xFFFD   /* EUC character encoding */
#define UNICODE               0xFFFC   /* UNICODE character encoding */
#define BIG5                  0xFFFB   /* BIG5 character encoding */
#define TCA                   0xFFFA   /* TCA character encoding */
#define GB                    0xFFF9   /* GB character encoding */
#define KSC                   0xFFF8   /* K character encoding */
#define WANSUNG               0xFFF4   /* WANSUNG character encoding - KOREAN */
#define JOHAB                 0xFFF3   /* JOHAB character encoding - KOREAN */
#define SYMBOL                0xFFF2   /* SYMBOL character encoding */    /* 08-29-02 jfd */

#define RAW_GLYPH              0xFF11   /* special symbol-set value for raw-glyph-index mode */
                                       /* currently only relevant for TrueType */
#define UCS4                  0xFF12   /* UCS-4 character encoding  03-05-02 jfd */
#define USER_CMAP              0xFF13   /* use passedin user platId / specId values */

#define MASK_ASIAN_ENC        0xFF00   /* mask for any Asian encoding */

#define is_it_Asian(ss) ((ss & MASK_ASIAN_ENC) == MASK_ASIAN_ENC)

/*
 * Unicode mapping tables, values correspond with possible
 * values for UNICODE_MAPPING in cgconfig.h
 */
#define JIS2UNI_MAP           0x01
#define BIG52UNI_MAP          0x02
#define GB2UNI_MAP            0x04
#define KSC2UNI_MAP           0x08

#if (UNICODE_IN || (UNICODE_MAPPING & JIS2UNI_MAP))
typedef struct {
  UW16 unicode;
  UW16 jis;
} UNIJISMAP;
typedef UNIJISMAP * PUNIJISMAP;
#endif /* (UNICODE_IN || (UNICODE_MAPPING & JIS2UNI_MAP)) */

#if (UNICODE_IN || (UNICODE_MAPPING & KSC2UNI_MAP))
typedef struct {
  UW16 unicode;
  UW16 ksc;
} UNIKSCMAP;
typedef UNIKSCMAP * PUNIKSCMAP;
#endif /* (UNICODE_IN || (UNICODE_MAPPING & KSC2UNI_MAP)) */

#if (UNICODE_IN || (UNICODE_MAPPING & BIG52UNI_MAP))
typedef struct {
  UW16 unicode;
  UW16 big5;
} UNIBIG5MAP;
typedef UNIBIG5MAP * PUNIBIG5MAP;
#endif /* (UNICODE_IN || (UNICODE_MAPPING & BIG52UNI_MAP)) */

#if (UNICODE_IN || (UNICODE_MAPPING & GB2UNI_MAP))
typedef struct {
  UW16 unicode;
  UW16 gb;
} UNIGBMAP;
typedef UNIGBMAP * PUNIGBMAP;
#endif /* (UNICODE_IN || (UNICODE_MAPPING & GB2UNI_MAP)) */

#endif    /* __KANJI__ */
 

kanmap.txt  、、、、、、、、、、、、、、、、、、、、、、、、、、

/* 
 * Copyright (C) 2004 Agfa Monotype Corporation. All rights reserved.
 */
/* $Header:   I:/BULL/URIP/RTS/DA/KANMAP.C_V   1.51   Oct 25 2004 17:06:58   galejss  $ */
/* $Log:   I:/BULL/URIP/RTS/DA/KANMAP.C_V  $ 
 * 
 *    Rev 1.51   Oct 25 2004 17:06:58   galejss
 * multithreading changes (CGIF functions become CGIFF)
 * 
 *    Rev 1.50   Aug 22 2003 08:53:40   LynchR
 * Updated copyright notice.
 * 
 *    Rev 1.49   Jun 19 2003 18:51:10   Galejs
 * size_t becomes UL32
 * 
 *    Rev 1.48   Dec 02 2002 18:03:32   Galejs
 * add cast to ReadMappingTable return
 * 
 *    Rev 1.47   Nov 26 2002 19:05:20   Galejs
 * add casts to all MEMptr() calls
 * 
 *    Rev 1.46   Oct 03 2002 18:14:16   Galejs
 * remove unneeded non-LINT_ARGS cases
 * 
 *    Rev 1.45   Sep 09 2002 17:01:42   Galejs
 * use UFST datatypes only (part of bug # 76)
 * 
 *    Rev 1.44   Jun 29 2001 17:53:18   Galejs
 * const should be CONST (for portability)
 * 
 *    Rev 1.43   May 03 2001 19:51:30   Galejs
 * data-type cleanup
 * 
 *    Rev 1.42   Dec 22 2000 10:17:32   Song
 * Revert 13-Nov-00 change.
 * 
 *    Rev 1.41   Nov 28 2000 18:50:30   Galejs
 * minor compile-warning fixes
 * 
 *    Rev 1.40   Nov 16 2000 15:29:52   Joe
 * Undid some of the mapping function changes entered earlier.
 * 
 *    Rev 1.39   Nov 15 2000 15:08:44   Joe
 * Fixed mapping function bugs.
 * 
 *    Rev 1.38   13 Jun 2000 15:02:12   JOE
 * Modified JisToSJis() for half-width characters in Kanji (by dz).
 * 
 *    Rev 1.37   Apr 11 2000 15:46:22   galejs
 * ReadMappingTable fix (for ks)
 * 
 *    Rev 1.36   Feb 02 2000 13:11:06   galejs
 * change all !ROM to DISK_FONTS
 * 
 *    Rev 1.35   Dec 10 1999 15:49:46   galejs
 * SWAPW defined in cgmacros.h now
 * 
 *    Rev 1.34   Aug 18 1999 17:15:38   galejs
 * fix weird problem with parsing of continuation lines
 * 
 *    Rev 1.33   Aug 16 1999 13:10:28   galejs
 * include-file changes; USING_16_BIT_DOS test
 * 
 *    Rev 1.32   24 Jun 1999 11:39:58   JOE
 * In CGIFinitUnicodeToJisTbl() and CGIFinitJisToUnicodeTbl(), 
 * conditionally compiled local variable to resolve compiler warning.
 * 
 *    Rev 1.31   21 Jan 1999 13:56:26   GALEJS
 * standardize #include tests
 * 
 *    Rev 1.30   12 Jan 1999 18:18:58   GALEJS
 * move EXTERN dcls
 * 
 *    Rev 1.29   16 Sep 1998 20:10:38   GALEJS
 * get rid of obsolete MIPS code
 * 
 *    Rev 1.28   22 Jun 1998 18:12:02   GALEJS
 * make Kanji routines reentrant too
 * 
 *    Rev 1.27   15 Jun 1998 15:17:08   GALEJS
 * reentrancy parm-passing changes
 * 
 *    Rev 1.26   02 Apr 1998 18:32:46   GALEJS
 * move extern to if_state
 * 
 *    Rev 1.25   31 Mar 1998 18:05:22   GALEJS
 * shareinc.h now requires <stdio.h>
 * 
 *    Rev 1.24   30 Mar 1998 13:05:40   GALEJS
 * move all MLOCALs into IF_STATE
 * 
 *    Rev 1.23   20 Mar 1998 11:54:14   GALEJS
 * 64-bit port
 * 
 *    Rev 1.22   22 Oct 1997 17:05:10   MARTIN
 * Fixed bug in ReadMappingTable, arg mismatch in call to
 * FMalloc_rd causing memory overrun error using MSVC compiler.
 * 
 *    Rev 1.21   23 Jun 1997 13:57:16   MIKE
 * Changed #if (_PSOS || PTV_OS) to #if defined( ...
 * 
 *    Rev 1.20   18 Jun 1997 18:39:20   GALEJS
 * allow compile for PTV_OS
 * 
 *    Rev 1.19   16 Jun 1997 17:14:08   GALEJS
 * compile under PSOS
 * 
 *    Rev 1.18   02 Jan 1997 15:07:10   DAVID
 * Modified various functions to support GB, BIG5, and KSC Asian Encodings.
 * 
 *    Rev 1.17   31 Oct 1996 10:27:40   JOE
 * Allowed glyph ID's less than 255 for Kanji Data (by dbk).
 * 
 *    Rev 1.16   07 Oct 1996 08:59:28   JOE
 * Changed the way global variables "UnicodeToKscTbl", "hUnicodeToKscTbl"
 * and "u2kSize" are conditionally compiled to resolve compiler error.
 * 
 *    Rev 1.15   04 Oct 1996 09:17:24   JOE
 * Removed CTRL-Z at end of file.
 * 
 *    Rev 1.14   01 Oct 1996 16:47:26   JOE
 * Added PMEM_HANDLE arg to ReadMappingTable().
 * Added function ASIANexit().
 * Added global handles to various ASIAN mapping tables: hUnicodeToJisTbl,
 * hUnicodeToKscTbl, hJisToUnicodeTbl and hKscToUnicodeTbl.
 * 
 *    Rev 1.13   09 Aug 1996 10:27:14   MIKE
 * Conditionalize <fcntl.h> for OS9 port.
 * 
 *    Rev 1.11   06 Apr 1995 15:14:54   LISA
 * Changed copyright from Miles Inc. to Bayer Corp.
 * 
 *    Rev 1.10   02 Dec 1994 21:25:20   YAN
 * KSC
 * 
 *    Rev 1.9   22 Apr 1994 13:55:14   LISA
 * Made modifications to copyright/disclaimer notice.
 * 
 *    Rev 1.8   17 Feb 1994 14:04:00   MAIB
 * Updated error codes for JIS and Unicode mapping functions
 * 
 *    Rev 1.7   08 Dec 1993 12:31:44   MAIB
 * Modified Unicode mappings
 * 
 *    Rev 1.6   07 Dec 1993 13:05:54   MAIB
 * Enabled Jis-Unicode mappings
 * 
 *    Rev 1.5   01 Dec 1993 08:54:22   JOE
 * Changed KANJI_ENCODING to ASIAN_ENCODING.
 * 
 *    Rev 1.4   24 Nov 1993 08:55:10   JOE
 * Enabled function SJisToJis().
 * Added new functions EucToJis(), JisToEuc() and SJisToEuc().
 * 
 *    Rev 1.3   12 Jul 1993 15:06:22   JOE
 * In EucToSJis(), removed print statement used for debugging.
 * 
 *    Rev 1.2   01 Jul 1993 15:45:04   JOE
 * EUC KANJI support.
 * 
 *    Rev 1.1   21 Jun 1993 09:13:08   JOE
 * Corrected function prototype for JisToSJis().
 * Moved "vxWorks.h" before "port.h".
 * 
 *    Rev 1.0   14 Jun 1993 11:05:58   ROB
 * Initial revision.
 * 
*/
/* $Date:   Oct 25 2004 17:06:58  $ */
/* kanmap.c */
 

/*
REVISION HISTORY
-----------------------------------------------------------------------
  11-Jun-93 rs    Original file created.
  16-Jun-93 jfd   Corrected function prototype for JisToSJis().
                  Moved "vxWorks.h" before "port.h".
  30-Jun-93 jfd/gy  EUC KANJI support.
  12-Jul-93 gy    In EucToSJis(), removed print statement used for debugging.
  17-Nov-93 jfd   Added new functions: EucToJis(), JisToEuc() and SJisToEuc().
                  Enabled function SJisToJis().
  01-Dec-93 jfd   Changed KANJI_ENCODING to ASIAN_ENCODING.
  07-Dec-93 maib  Added JIS and Unicode mapping support.
  08-Dec-93 maib  Modified method for mapping to Unicode.
  18-Feb-94 maib  Changed errors returned when unable to read JIS and Unicode
                  mapping tables.
  01-Aug-96 mby   Conditionalize <fcntl.h> for OS9 port.
  09-Aug-96 mby   Added extra set of parens in 1st line of SJisToJis().
  01-Oct-96 jfd   Added PMEM_HANDLE arg to ReadMappingTable() (needed for
                  later freeing by ASIANexit() ).
                  Added function ASIANexit().
                  Added global handles to various ASIAN mapping tables:
                  hUnicodeToJisTbl, hUnicodeToKscTbl, hJisToUnicodeTbl
                  and hKscToUnicodeTbl.
  07-Oct-96 jfd   Changed the way global variables "UnicodeToKscTbl",
                  "hUnicodeToKscTbl" and "u2kSize" are conditionally
                  compiled to resolve compiler error.
  29-Oct-96 dbk   Allowed glyph ID's less than 255 for Kanji Data. This allows
                  half-width characters to be supported.
  18-Nov-96 dlk   Fixed spelling for local Korean mapping table kscCmp() funct.
                  Changed it from "KscCmp" to "kscCmp".
  18-Nov-96 dlk   Added mapping support for BIG5 and GB.  Added new functions:
                  UnicodeToBig5(), Big5ToUnicode(), UnicodeToGb(), and
                  GbToUnicode().
  01-Jan-97 dlk   Added mapping support for KSC.  Modified code so that more
                  than one encoding can be activeate at one time (instead of
                  having the 1st defined encoding exclude capability to handle
                  others.  Split out 'unicodeCmp' function so that each encod-
                  ing has its own 'cmp' function.
  16-Jun-97 slg   Allow PSOS compilation
  18-Jun-97 slg   Allow PTV_OS compilation
  09-Mar-98 slg      Don't use "long" dcls (incorrect if 64-bit platform)
  30-Mar-98 slg      Move all MLOCALs into if_state.
  24-Jun-99 jfd   In CGIFinitUnicodeToJisTbl() and CGIFinitJisToUnicodeTbl(),
                  conditionally compiled local variable to resolve compiler
                  warning.
  16-Aug-99 slg   Actually, ALL the CGIF...Tbl() functions need the same
                  conditional compile of "size", not just the two above.
                  Also: include-file changes, USING_16_BIT_DOS test.
  18-Aug-99 slg      Fix weird problem with continuation lines when compiling with
                  MSVC: lines ending with ")\" don't parse correctly, but they
                  are handled correctly when changed to ") \".
  02-Feb-99 slg      Disk/ROM changes (for jd): change all !ROM to DISK_FONTS. 
  11-Apr-00 ks    Modify ReadMappingTable to handle tables larger than 64k in a 
                  16 bit environment.  Replaced int with uint32.
  13-Jun-00 dz    Modify JisToSJis() to support half-width characters for Kanji.
  13-Nov-00 jfd   Changed param types for JisCmp() from PUNIJISMAP to PJISUNIMAP.
                  Changed param types for gbCmp() from PUNIGBCMP to PGBUNICMP.
                  In JisToUnicode(), changed all "UNIJISMAP" and "PUNIJISMAP" references
                  to "JISUNIMAP" and "PJISUNIMAP" respectively.
  16-Nov-00 jfd   Undid some of the mapping function changes entered earlier.
  22-Dec-00 ks    Revert change from 13-Nov-00.
*/

/*
This file contains code which maps among various Kanji systems. In general,
the font will be arranged according to one particular system (ie. SJIS). If
the caller wishes to supply character codes in a different system (ie. JIS),
we need to map to the font's native code.
*/

#include "cgconfig.h"

#if (PST1_RDR || TT_RDR) && ASIAN_ENCODING /* conditional compile entire module */

#ifdef VXWORKS
#include "vxWorks.h"
#endif
#include <stdio.h>

#include "ufstport.h"
#include "dbg_ufst.h"

#include "shareinc.h"
#include "cgmacros.h"

#include <stdlib.h>

#if MAYBE_IO_H
#include <io.h>
#endif

#if MAYBE_UNISTD_H
#include <unistd.h>
#endif

#if MAYBE_FCNTL_H
#include <fcntl.h>
#endif

#if MAYBE_FCNTL_HIF_H
#include <fcntl.h>
#endif

#include "mixmodel.h"

#ifdef LINT_ARGS

#if UNICODE_IN
#if K_ENCODING
MLOCAL SL32 unicodeKCmp(PUNIKSCMAP, PUNIKSCMAP);
#endif
#if JIS_ENCODING
MLOCAL SL32 unicodeJISCmp(PUNIJISMAP, PUNIJISMAP);
#endif
#if BIG5_ENCODING
MLOCAL SL32 unicodeBIG5Cmp(PUNIBIG5MAP, PUNIBIG5MAP);
#endif
#if GB_ENCODING
MLOCAL SL32 unicodeGBCmp(PUNIGBMAP, PUNIGBMAP);
#endif
#endif /* UNICODE_IN */

#if (UNICODE_MAPPING & JIS2UNI_MAP)
MLOCAL SL32   jisCmp(PUNIJISMAP, PUNIJISMAP);
#endif /* (UNICODE_MAPPING & JIS2UNI_MAP) */

#if (UNICODE_MAPPING & KSC2UNI_MAP)
MLOCAL SL32   kscCmp(PUNIKSCMAP, PUNIKSCMAP); /* changed "KscCmp" to "kscCmp" - 11-Nov-96, dlk */
#endif /* (UNICODE_MAPPING & KSC2UNI_MAP) */

#if (UNICODE_MAPPING & BIG52UNI_MAP)
MLOCAL SL32   big5Cmp(PUNIBIG5MAP, PUNIBIG5MAP);
#endif /* (UNICODE_MAPPING & BIG52UNI_MAP) */

#if (UNICODE_MAPPING & GB2UNI_MAP)
MLOCAL SL32   gbCmp(PUNIGBMAP, PUNIGBMAP);
#endif /* (UNICODE_MAPPING & GB2UNI_MAP) */


#if ((UNICODE_IN || (UNICODE_MAPPING & JIS2UNI_MAP) \
                 || (UNICODE_MAPPING & KSC2UNI_MAP) \
                 || (UNICODE_MAPPING & BIG52UNI_MAP) \
                 || (UNICODE_MAPPING & GB2UNI_MAP) ) && DISK_FONTS)
MLOCAL LPSB8 ReadMappingTable(FSP LPSB8, UL32 *, MEM_HANDLE *);
#endif /* ((UNICODE_IN || (UNICODE_MAPPING & JIS2UNI_MAP)
                       || (UNICODE_MAPPING & KSC2UNI_MAP)
                       || (UNICODE_MAPPING & BIG52UNI_MAP)
                       || (UNICODE_MAPPING & GB2UNI_MAP) ) && DISK_FONTS) */

#else /* !LINT_ARGS */

#if UNICODE_IN
#if JIS_ENCODING
MLOCAL SL32   unicodeJISCmp();
#endif
#if K_ENCODING
MLOCAL SL32   unicodeKCmp();
#endif
#if BIG5_ENCODING
MLOCAL SL32   unicodeBIG5Cmp();
#endif
#if GB_ENCODING
MLOCAL SL32   unicodeGBCmp();
#endif
#endif /* UNICODE_IN */

#if (UNICODE_MAPPING & JIS2UNI_MAP)
MLOCAL SL32   jisCmp();
#endif /* (UNICODE_MAPPING & JIS2UNI_MAP) */

#if (UNICODE_MAPPING & KSC2UNI_MAP)
MLOCAL SL32   kscCmp(); /* changed "KscCmp" to "kscCmp" - 18-Nov-96, dlk */
#endif /* (UNICODE_MAPPING & KSC2UNI_MAP) */

#if (UNICODE_MAPPING & BIG52UNI_MAP)
MLOCAL SL32   big5Cmp();
#endif /* (UNICODE_MAPPING & BIG52UNI_MAP) */

#if (UNICODE_MAPPING & GB2UNI_MAP)
MLOCAL SL32   gbCmp();
#endif /* (UNICODE_MAPPING & GB2UNI_MAP) */


#if ((UNICODE_IN || (UNICODE_MAPPING & JIS2UNI_MAP) \
                 || (UNICODE_MAPPING & KSC2UNI_MAP) \
                 || (UNICODE_MAPPING & BIG52UNI_MAP) \
                 || (UNICODE_MAPPING & GB2UNI_MAP) ) && DISK_FONTS)
MLOCAL LPSB8 ReadMappingTable();
#endif /* ((UNICODE_IN || (UNICODE_MAPPING & JIS2UNI_MAP)
                       || (UNICODE_MAPPING & KSC2UNI_MAP)
                       || (UNICODE_MAPPING & BIG52UNI_MAP)
                       || (UNICODE_MAPPING & GB2UNI_MAP) ) && DISK_FONTS) */

#endif /* LINT_ARGS */


#if defined (ANSI_DEFS)
GLOBAL UW16 JisToSJis (UW16 jiscode)
#else
GLOBAL UW16 JisToSJis (jiscode)
UW16 jiscode;
#endif
{
register UB8  c1 = jiscode >> 8;
register UB8  c2 = jiscode & 0xff;
register SL32 RowOffset = c1 < 95 ? 112 : 176;
register SL32 CellOffset = c1 % 2 ? 31 + (c2 > 95) : 126;
UW16 sjiscode;
    if (jiscode<256)            /* 6-13-00 dz */
        return (jiscode);        

    sjiscode = ((((c1 + 1) >> 1) + RowOffset) << 8)
                   | (c2 + CellOffset);

    return (sjiscode);
}


#if defined (ANSI_DEFS)
GLOBAL UW16  SJisToJis (UW16 sjiscode)
#else
GLOBAL UW16  SJisToJis (sjiscode)
UW16 sjiscode;
#endif
{
register UB8  c1 = sjiscode >> 8;
register UB8  c2 = sjiscode & 0xff;
register SL32 Adjust = c2 < 159;
register SL32 RowOffset = c1 < 160 ? 112 : 176;
register SL32 CellOffset = Adjust ? (31 + (c2 > 127)) : 126;
UW16 jiscode;
if (sjiscode<255)
   return (sjiscode); /*dbk*/

    jiscode = ((((c1 - RowOffset) << 1) - Adjust) << 8)
                  | (c2 -= CellOffset);
    return (jiscode);
}


#if defined (ANSI_DEFS)
GLOBAL UW16  EucToSJis (UW16 eucode)
#else
GLOBAL UW16  EucToSJis (eucode)
UW16 eucode;
#endif
{
UW16 jiscode;

    if (eucode < 0x8000) 
        return (eucode >> 8);
    else {
        if ((eucode & 0xff00) == 0x8e00)
            jiscode = eucode & 0x007f;
        else  {
            if ((eucode & 0xff00) == 0x8f00) 
                return 0xffff;
            else
                jiscode = eucode & 0x7f7f;
        }
    }
    return (JisToSJis(jiscode));
}


#if defined (ANSI_DEFS)
GLOBAL UW16  EucToJis (UW16 eucode)
#else
GLOBAL UW16  EucToJis (eucode)
UW16 eucode;
#endif
{
    if (eucode < 0x8000) 
        return (eucode >> 8);
    else {
        if ((eucode & 0xff00) == 0x8f00) 
           return 0xffff;
        else
           return (eucode & 0x7f7f);
    }
}


#if defined (ANSI_DEFS)
GLOBAL UW16  JisToEuc (UW16 jiscode)
#else
GLOBAL UW16  JisToEuc (jiscode)
UW16 jiscode;
#endif
{
    return (jiscode | 0x8080);
}


#if defined (ANSI_DEFS)
GLOBAL UW16  SJisToEuc (UW16 sjiscode)
#else
GLOBAL UW16  SJisToEuc (sjiscode)
UW16 sjiscode;
#endif
{
UW16 jiscode;

    jiscode = SJisToJis(sjiscode);
    return (JisToEuc(jiscode));
}


/*
 * 12/7/93 maib, Unicode to JIS support
 */
#if UNICODE_IN

#if K_ENCODING
#if defined (ANSI_DEFS)
MLOCAL SL32 unicodeKCmp(PUNIKSCMAP target, PUNIKSCMAP entry)
#else
MLOCAL SL32 unicodeKCmp(target, entry)
   PUNIKSCMAP target, entry;
#endif
{
  UW16 unicode = SWAPW(entry->unicode);

  if (target->unicode < unicode)
    return -1;
  else if (target->unicode == unicode)
    return 0;
  else
    return 1;
} /* unicodeKCmp() */
#endif


#if JIS_ENCODING
#if defined (ANSI_DEFS)
MLOCAL SL32 unicodeJISCmp(PUNIJISMAP target, PUNIJISMAP entry)
#else
MLOCAL SL32 unicodeJISCmp(target, entry)
  PUNIJISMAP target, entry;
#endif
{
  UW16 unicode = SWAPW(entry->unicode);

  if (target->unicode < unicode)
    return -1;
  else if (target->unicode == unicode)
    return 0;
  else
    return 1;
} /* unicodeJISCmp() */
#endif

#if BIG5_ENCODING
#if defined (ANSI_DEFS)
MLOCAL SL32 unicodeBIG5Cmp(PUNIBIG5MAP target, PUNIBIG5MAP entry)
#else
MLOCAL SL32 unicodeBIG5Cmp(target, entry)
  PUNIBIG5MAP target, entry;
#endif
{
  UW16 unicode = SWAPW(entry->unicode);

  if (target->unicode < unicode)
    return -1;
  else if (target->unicode == unicode)
    return 0;
  else
    return 1;
} /* unicodeBIG5Cmp() */
#endif

#if GB_ENCODING
#if defined (ANSI_DEFS)
MLOCAL SL32 unicodeGBCmp(PUNIGBMAP target, PUNIGBMAP entry)
#else
MLOCAL SL32 unicodeGBCmp(target, entry)
  PUNIGBMAP target, entry;
#endif
{
  UW16 unicode = SWAPW(entry->unicode);

  if (target->unicode < unicode)
    return -1;
  else if (target->unicode == unicode)
    return 0;
  else
    return 1;
} /* unicodeGBCmp() */
#endif


#if JIS_ENCODING
#if defined (ANSI_DEFS)
GLOBAL UW16 UnicodeToJis(FSP UW16 unicode)
#else
GLOBAL UW16 UnicodeToJis(unicode)
  UW16 unicode;
#endif
{
  UNIJISMAP u2jArg;
  PUNIJISMAP u2jPtr;

  if (!if_state.UnicodeToJisTbl)
    return 0;

  u2jArg.unicode = unicode;
  if ((u2jPtr = (PUNIJISMAP)bsearch((void *)(&u2jArg), (void *)if_state.UnicodeToJisTbl, 
                            (UL32)if_state.u2jSize, (UL32)sizeof(UNIJISMAP), 
                            (SL32 (*)(CONST void *, CONST void *))unicodeJISCmp)) != NULL)
    return (SWAPW(u2jPtr->jis));

  return 0;
}
#endif /* JIS_ENCODING */

#if K_ENCODING
#if defined (ANSI_DEFS)
GLOBAL UW16 UnicodeToKsc(FSP UW16 unicode)
#else
GLOBAL UW16 UnicodeToKsc(unicode)
  UW16 unicode;
#endif
{
  UNIKSCMAP u2kArg;
  PUNIKSCMAP u2kPtr;

  if (!if_state.UnicodeToKscTbl)
    return 0;

  u2kArg.unicode = unicode;
  if ((u2kPtr = (PUNIKSCMAP)bsearch((void *)(&u2kArg), (void*)if_state.UnicodeToKscTbl, 
                            (UL32)if_state.u2kSize, (UL32)sizeof(UNIKSCMAP), 
                            (SL32 (*)(CONST void *, CONST void *))unicodeKCmp)) != NULL)
    return (SWAPW(u2kPtr->ksc));

  return 0;
}
#endif  /* K_ENCODING */


#if BIG5_ENCODING
#if defined (ANSI_DEFS)
GLOBAL UW16 UnicodeToBig5(FSP UW16 unicode)
#else
GLOBAL UW16 UnicodeToBig5(unicode)
  UW16 unicode;
#endif
{
  UNIBIG5MAP u2big5Arg;
  PUNIBIG5MAP u2big5Ptr;

  if (!if_state.UnicodeToBig5Tbl)
    return 0;

  u2big5Arg.unicode = unicode;
  if ((u2big5Ptr = (PUNIBIG5MAP)bsearch((void *)(&u2big5Arg), (void*)if_state.UnicodeToBig5Tbl, 
                            (UL32)if_state.u2big5Size, (UL32)sizeof(UNIBIG5MAP), 
                            (SL32 (*)(CONST void *, CONST void *))unicodeBIG5Cmp)) != NULL)
    return (SWAPW(u2big5Ptr->big5));

  return 0;
}
#endif  /* BIG5_ENCODING */

#if GB_ENCODING
#if defined (ANSI_DEFS)
GLOBAL UW16 UnicodeToGb(FSP UW16 unicode)
#else
GLOBAL UW16 UnicodeToGb(unicode)
  UW16 unicode;
#endif
{
  UNIGBMAP u2gbArg;
  PUNIGBMAP u2gbPtr;

  if (!if_state.UnicodeToGbTbl)
    return 0;

  u2gbArg.unicode = unicode;
  if ((u2gbPtr = (PUNIGBMAP)bsearch((void *)(&u2gbArg), (void*)if_state.UnicodeToGbTbl, 
                            (UL32)if_state.u2gbSize, (UL32)sizeof(UNIGBMAP), 
                            (SL32 (*)(CONST void *, CONST void *))unicodeGBCmp)) != NULL)
    return (SWAPW(u2gbPtr->gb));

  return 0;
}
#endif  /* GB_ENCODING */

#if JIS_ENCODING
#if defined (ANSI_DEFS)
GLOBAL UW16 CGIFFinitUnicodeToJisTbl(FSP LPSB8 tblPtr, UL32 tblSize)
#else
GLOBAL UW16 CGIFFinitUnicodeToJisTbl(tblPtr, tblSize)
  LPSB8 tblPtr;
  UL32 tblSize;
#endif
{
#if !ROM
  UL32 size;
#endif

  /*
   * in a ROM configuration, tblPtr points to the location where the
   * Unicode to Jis mapping table is located. in a non ROM config,
   * this points to the path where the disk file for this mapping
   * is found
   */
#if (ROM)
  if_state.UnicodeToJisTbl = tblPtr;
  if_state.u2jSize = tblSize / sizeof(UNIJISMAP);
#else /* DISK_FONTS */
  if ((if_state.UnicodeToJisTbl = ReadMappingTable(FSA tblPtr, &size, 
          &if_state.hUnicodeToJisTbl)) == NULL)
  {
    if_state.u2jSize = 0;
    return ERR_UNITOJIS_READ;
  }
  if_state.u2jSize = size / sizeof(UNIJISMAP);
#endif /* ROM */

  return SUCCESS;
}
#endif  /* JIS_ENCODING */

#if K_ENCODING
#if defined (ANSI_DEFS)
GLOBAL UW16 CGIFFinitUnicodeToKscTbl(FSP LPSB8 tblPtr, UL32 tblSize)
#else
GLOBAL UW16 CGIFFinitUnicodeToKscTbl(tblPtr, tblSize)
  LPSB8 tblPtr;
  UL32 tblSize;
#endif
{
#if !ROM
  UL32 size;
#endif

  /*
   * in a ROM configuration, tblPtr points to the location where the
   * Unicode to Ksc mapping table is located. in a non ROM config,
   * this points to the path where the disk file for this mapping
   * is found
   */
#if (ROM)
  if_state.UnicodeToKscTbl = tblPtr;
  if_state.u2kSize = tblSize / sizeof(UNIKSCMAP);
#else /* DISK_FONTS */
 if ((if_state.UnicodeToKscTbl = ReadMappingTable(FSA tblPtr, &size, 
        &if_state.hUnicodeToKscTbl)) == NULL)
  {
    if_state.u2kSize = 0;
    return ERR_UNITOKSC_READ;
  }
  if_state.u2kSize = size / sizeof(UNIKSCMAP);
#endif /* ROM */

  return SUCCESS;
}
#endif   /*  K_ENCODING  */


#if BIG5_ENCODING
#if defined (ANSI_DEFS)
GLOBAL UW16 CGIFFinitUnicodeToBig5Tbl(FSP LPSB8 tblPtr, UL32 tblSize)
#else
GLOBAL UW16 CGIFFinitUnicodeToBig5Tbl(tblPtr, tblSize)
  LPSB8 tblPtr;
  UL32 tblSize;
#endif
{
#if !ROM
  UL32 size;
#endif

  /*
   * in a ROM configuration, tblPtr points to the location where the
   * Unicode to BIG5 mapping table is located. in a non ROM config,
   * this points to the path where the disk file for this mapping
   * is found
   */
#if (ROM)
  if_state.UnicodeToBig5Tbl = tblPtr;
  if_state.u2big5Size = tblSize / sizeof(UNIBIG5MAP);
#else /* DISK_FONTS */
 if ((if_state.UnicodeToBig5Tbl = ReadMappingTable(FSA tblPtr, &size, 
        &if_state.hUnicodeToBig5Tbl)) == NULL)
  {
    if_state.u2big5Size = 0;
    return ERR_UNITOBIG5_READ;
  }
  if_state.u2big5Size = size / sizeof(UNIBIG5MAP);
#endif /* ROM */

  return SUCCESS;
}
#endif   /*  BIG5_ENCODING  */


#if GB_ENCODING
#if defined (ANSI_DEFS)
GLOBAL UW16 CGIFFinitUnicodeToGbTbl(FSP LPSB8 tblPtr, UL32 tblSize)
#else
GLOBAL UW16 CGIFFinitUnicodeToGbTbl(tblPtr, tblSize)
  LPSB8 tblPtr;
  UL32 tblSize;
#endif
{
#if !ROM
  UL32 size;
#endif

  /*
   * in a ROM configuration, tblPtr points to the location where the
   * Unicode to GB mapping table is located. in a non ROM config,
   * this points to the path where the disk file for this mapping
   * is found
   */
#if (ROM)
  if_state.UnicodeToGbTbl = tblPtr;
  if_state.u2gbSize = tblSize / sizeof(UNIGBMAP);
#else /* DISK_FONTS */
 if ((if_state.UnicodeToGbTbl = ReadMappingTable(FSA tblPtr, &size, 
        &if_state.hUnicodeToGbTbl)) == NULL)
  {
    if_state.u2gbSize = 0;
    return ERR_UNITOGB_READ;
  }
  if_state.u2gbSize = size / sizeof(UNIGBMAP);
#endif /* ROM */

  return SUCCESS;
}
#endif   /*  GB_ENCODING  */


#endif /* UNICODE_IN */


/*
 * 12/7/93 maib, JIS to Unicode support 
 */
#if (UNICODE_MAPPING & JIS2UNI_MAP)

/* Changed param types from "PUNIJISMAP" to "PJISUNIMAP" - 11-13-00 jfd */
/* Changed param types back to "PUNIJISMAP" - 12-22-00 ks */ 
#if defined (ANSI_DEFS)
MLOCAL SL32 jisCmp(PUNIJISMAP target, PUNIJISMAP entry)
#else
MLOCAL SL32 jisCmp(target, entry)
  PUNIJISMAP target, entry;
#endif
{
  UW16 jis = SWAPW(entry->jis);

  if (target->jis < jis)
    return -1;
  else if (target->jis == jis)
    return 0;
  else
    return 1;
}


#if defined (ANSI_DEFS)
GLOBAL UW16 JisToUnicode(FSP UW16 jis)
#else
GLOBAL UW16 JisToUnicode(jis)
  UW16 jis;
#endif
{
  UNIJISMAP j2uArg;
  PUNIJISMAP j2uPtr;

  if (!if_state.JisToUnicodeTbl)
    return 0;

  j2uArg.jis = jis;
  if ((j2uPtr = (PUNIJISMAP)bsearch((void *)(&j2uArg), (void *)if_state.JisToUnicodeTbl,
                           (UL32)if_state.j2uSize, (UL32)sizeof(UNIJISMAP), 
                           (SL32 (*)(CONST void *, CONST void *))jisCmp)) != NULL)
    return (SWAPW(j2uPtr->unicode));

  return 0;
}


#if defined (ANSI_DEFS)
GLOBAL UW16 CGIFFinitJisToUnicodeTbl(FSP LPSB8 tblPtr, UL32 tblSize)
#else
GLOBAL UW16 CGIFFinitJisToUnicodeTbl(tblPtr, tblSize)
  LPSB8 tblPtr;
  UL32 tblSize;
#endif
{
#if !ROM
  UL32 size;
#endif

  /*
   * in a ROM configuration, tblPtr points to the location where the
   * Jis to Unicode mapping table is located. in a non ROM config,
   * this points to the path where the disk file for this mapping
   * is found
   */
#if (ROM)
  if_state.JisToUnicodeTbl = tblPtr;
  if_state.j2uSize = tblSize / sizeof(UNIJISMAP);
#else /* DISK_FONTS */
  if ((if_state.JisToUnicodeTbl = ReadMappingTable(FSA tblPtr, &size,
          &if_state.hJisToUnicodeTbl)) == NULL)
  {
    if_state.j2uSize = 0;
    return ERR_JISTOUNI_READ;
  }
  if_state.j2uSize = size / sizeof(UNIJISMAP);
#endif /* ROM */

  return SUCCESS;
}

#endif /* (UNICODE_MAPPING & JIS2UNI_MAP) */


#if (UNICODE_MAPPING & KSC2UNI_MAP)
#if defined (ANSI_DEFS)
MLOCAL SL32 kscCmp(PUNIKSCMAP target, PUNIKSCMAP entry)
#else
MLOCAL SL32 kscCmp(target, entry)
  PUNIKSCMAP target, entry;
#endif
{
  UW16 ksc = SWAPW(entry->ksc);

  if (target->ksc < ksc)
    return -1;
  else if (target->ksc == ksc)
    return 0;
  else
    return 1;
}


#if defined (ANSI_DEFS)
GLOBAL UW16 KscToUnicode(FSP UW16 ksc)
#else
GLOBAL UW16 KscToUnicode(ksc)
  UW16 ksc;
#endif
{
  UNIKSCMAP k2uArg;
  PUNIKSCMAP k2uPtr;

  if (!if_state.KscToUnicodeTbl)
    return 0;

  k2uArg.ksc = ksc;
  if ((k2uPtr = (PUNIKSCMAP)bsearch((void *)(&k2uArg), (void *)if_state.KscToUnicodeTbl,
                           (UL32)if_state.k2uSize, (UL32)sizeof(UNIKSCMAP), 
                           (SL32 (*)(CONST void *, CONST void *))kscCmp)) != NULL)
{
    return (SWAPW(k2uPtr->unicode));
}

  return 0;
}


#if defined (ANSI_DEFS)
GLOBAL UW16 CGIFFinitKscToUnicodeTbl(FSP LPSB8 tblPtr, UL32 tblSize)
#else
GLOBAL UW16 CGIFFinitKscToUnicodeTbl(tblPtr, tblSize)
  LPSB8 tblPtr;
  UL32 tblSize;
#endif
{
#if !ROM
  UL32 size;
#endif

  /*
   * in a ROM configuration, tblPtr points to the location where the
   * Ksc to Unicode mapping table is located. in a non ROM config,
   * this points to the path where the disk file for this mapping
   * is found
   */
#if (ROM)
  if_state.KscToUnicodeTbl = tblPtr;
  if_state.k2uSize = tblSize / sizeof(UNIKSCMAP);
#else /* DISK_FONTS */
  if ((if_state.KscToUnicodeTbl = ReadMappingTable(FSA tblPtr, &size,
          &if_state.hKscToUnicodeTbl)) == NULL)
  {
    if_state.k2uSize = 0;
    return ERR_KSCTOUNI_READ;
  }
  if_state.k2uSize = size / sizeof(UNIKSCMAP);  /* changed to "UNIKSCMAP" from "UNIJISMAP" - 11-Nov-96, dlk */
#endif /* ROM */

  return SUCCESS;
}

#endif /* (UNICODE_MAPPING & KSC2UNI_MAP) */

#if (UNICODE_MAPPING & BIG52UNI_MAP)
#if defined (ANSI_DEFS)
MLOCAL SL32 big5Cmp(PUNIBIG5MAP target, PUNIBIG5MAP entry)
#else
MLOCAL SL32 big5Cmp(target, entry)
  PUNIBIG5MAP target, entry;
#endif
{
  UW16 big5 = SWAPW(entry->big5);

  if (target->big5 < big5)
    return -1;
  else if (target->big5 == big5)
    return 0;
  else
    return 1;
}

#if defined (ANSI_DEFS)
GLOBAL UW16 Big5ToUnicode(FSP UW16 big5)
#else
GLOBAL UW16 Big5ToUnicode(big5)
  UW16 big5;
#endif
{
  UNIBIG5MAP big52uArg;
  PUNIBIG5MAP big52uPtr;

  if (!if_state.Big5ToUnicodeTbl)
    return 0;
  big52uArg.big5 = big5;
  if ((big52uPtr = (PUNIBIG5MAP)bsearch((void *)(&big52uArg), (void *)if_state.Big5ToUnicodeTbl,
                           (UL32)if_state.big52uSize, (UL32)sizeof(UNIBIG5MAP), 
                           (SL32 (*)(CONST void *, CONST void *))big5Cmp)) != NULL)
    return (SWAPW(big52uPtr->unicode));

  return 0;
}

#if defined (ANSI_DEFS)
GLOBAL UW16 CGIFFinitBig5ToUnicodeTbl(FSP LPSB8 tblPtr, UL32 tblSize)
#else
GLOBAL UW16 CGIFFinitBig5ToUnicodeTbl(tblPtr, tblSize)
  LPSB8 tblPtr;
  UL32 tblSize;
#endif
{
#if !ROM
  UL32 size;
#endif

  /*
   * in a ROM configuration, tblPtr points to the location where the
   * BIG5 to Unicode mapping table is located. in a non ROM config,
   * this points to the path where the disk file for this mapping
   * is found
   */
#if (ROM)
  if_state.Big5ToUnicodeTbl = tblPtr;
  if_state.big52uSize = tblSize / sizeof(UNIBIG5MAP);
#else /* DISK_FONTS */
  if ((if_state.Big5ToUnicodeTbl = ReadMappingTable(FSA tblPtr, &size,
          &if_state.hBig5ToUnicodeTbl)) == NULL)
  {
    if_state.big52uSize = 0;
    return ERR_BIG5TOUNI_READ;
  }
  if_state.big52uSize = size / sizeof(UNIBIG5MAP);
#endif /* ROM */

  return SUCCESS;
}

#endif /* (UNICODE_MAPPING & BIG52UNI_MAP) */

#if (UNICODE_MAPPING & GB2UNI_MAP)
#if defined (ANSI_DEFS)
MLOCAL SL32 gbCmp(PUNIGBMAP target, PUNIGBMAP entry)
#else
MLOCAL SL32 gbCmp(target, entry)
  PUNIGBMAP target, entry;
#endif
{
  UW16 gb = SWAPW(entry->gb);

  if (target->gb < gb)
    return -1;
  else if (target->gb == gb)
    return 0;
  else
    return 1;
}

#if defined (ANSI_DEFS)
GLOBAL UW16 GbToUnicode(FSP UW16 gb)
#else
GLOBAL UW16 GbToUnicode(gb)
  UW16 gb;
#endif
{
  UNIGBMAP gb2uArg;
  PUNIGBMAP gb2uPtr;

  if (!if_state.GbToUnicodeTbl)
    return 0;

  gb2uArg.gb = gb;
  if ((gb2uPtr = (PUNIGBMAP)bsearch((void *)(&gb2uArg), (void *)if_state.GbToUnicodeTbl,
                           (UL32)if_state.gb2uSize, (UL32)sizeof(UNIGBMAP), 
                           (SL32 (*)(CONST void *, CONST void *))gbCmp)) != NULL)
    return (SWAPW(gb2uPtr->unicode));

  return 0;
}


#if defined (ANSI_DEFS)
GLOBAL UW16 CGIFFinitGbToUnicodeTbl(FSP LPSB8 tblPtr, UL32 tblSize)
#else
GLOBAL UW16 CGIFFinitGbToUnicodeTbl(tblPtr, tblSize)
  LPSB8 tblPtr;
  UL32 tblSize;
#endif
{
#if !ROM
  UL32 size;
#endif

  /*
   * in a ROM configuration, tblPtr points to the location where the
   * GB to Unicode mapping table is located. in a non ROM config,
   * this points to the path where the disk file for this mapping
   * is found
   */
#if (ROM)
  if_state.GbToUnicodeTbl = tblPtr;
  if_state.gb2uSize = tblSize / sizeof(UNIGBMAP);
#else /* DISK_FONTS */
  if ((if_state.GbToUnicodeTbl = ReadMappingTable(FSA tblPtr, &size,
          &if_state.hGbToUnicodeTbl)) == NULL)
  {
    if_state.gb2uSize = 0;
    return ERR_GBTOUNI_READ;
  }
  if_state.gb2uSize = size / sizeof(UNIGBMAP);
#endif /* ROM */

  return SUCCESS;
}

#endif /* (UNICODE_MAPPING & GB2UNI_MAP) */

#if ((UNICODE_IN || (UNICODE_MAPPING & JIS2UNI_MAP) \
                 || (UNICODE_MAPPING & KSC2UNI_MAP) \
                 || (UNICODE_MAPPING & BIG52UNI_MAP) \
                 || (UNICODE_MAPPING & GB2UNI_MAP) ) && DISK_FONTS)


#if defined (ANSI_DEFS)
MLOCAL LPSB8 ReadMappingTable(FSP LPSB8 fname, UL32 *size, MEM_HANDLE *phbuf)
#else
MLOCAL LPSB8
ReadMappingTable(fname, size, phbuf)
  LPSB8 fname;
  UL32 *size;
  MEM_HANDLE *phbuf;  /* 9-26-96 */
#endif
{
  SL32 fd;
#if USING_16_BIT_DOS    /* 16 bit platform */
  UW16 table_size;
#else                     /* 32 bit platform */
  UL32 table_size;    /* ks - changed table_size from SL32 */
#endif
  MEM_HANDLE hbuf;
  SB8 pathname[80];

  /* Build full pathname */
  buildpath(pathname, if_state.ufstPath, fname);
    
  if ((fd = OPEN(pathname, O_READFLAGS)) == -1)
    return (LPSB8)0;

#if USING_16_BIT_DOS        /* 16 bit platform */
  table_size = (UW16)LSEEK(fd, 0L, SEEK_END);
#else                         /* 32 bit platform */
  table_size = (UL32)LSEEK(fd, 0L, SEEK_END);
#endif

  hbuf = FMalloc_rd(FSA fd, table_size, 0L);
  *phbuf = hbuf;  /* 9-26-96 */
  *size = (UL32)table_size;
  CLOSE(fd);
  return (LPSB8)MEMptr(hbuf);
}

GLOBAL VOID ASIANexit(FSP0)
{
#if JIS_ENCODING
   if (if_state.UnicodeToJisTbl)
      BUFfree(FSA if_state.hUnicodeToJisTbl);
#endif
#if K_ENCODING
   if (if_state.UnicodeToKscTbl)
      BUFfree(FSA if_state.hUnicodeToKscTbl);
#endif
#if BIG5_ENCODING
   if (if_state.UnicodeToBig5Tbl)
      BUFfree(FSA if_state.hUnicodeToBig5Tbl);
#endif
#if GB_ENCODING
   if (if_state.UnicodeToGbTbl)
      BUFfree(FSA if_state.hUnicodeToGbTbl);
#endif

#if (UNICODE_MAPPING & JIS2UNI_MAP)
   if (if_state.JisToUnicodeTbl)
      BUFfree(FSA if_state.hJisToUnicodeTbl);
#endif
#if (UNICODE_MAPPING & KSC2UNI_MAP)
   if (if_state.KscToUnicodeTbl)
      BUFfree(FSA if_state.hKscToUnicodeTbl);
#endif
#if (UNICODE_MAPPING & BIG52UNI_MAP)
   if (if_state.Big5ToUnicodeTbl)
      BUFfree(FSA if_state.hBig5ToUnicodeTbl);
#endif
#if (UNICODE_MAPPING & GB2UNI_MAP)
   if (if_state.GbToUnicodeTbl)
      BUFfree(FSA if_state.hGbToUnicodeTbl);
#endif
}

#endif /* ((UNICODE_IN || (UNICODE_MAPPING & JIS2UNI_MAP)
                       || (UNICODE_MAPPING & KSC2UNI_MAP)
                       || (UNICODE_MAPPING & BIG52UNI_MAP)
                       || (UNICODE_MAPPING & GB2UNI_MAP) ) && DISK_FONTS) */

#endif /* (PST1_RDR || TT_RDR) && ASIAN_ENCODING */

  • 13
    点赞
  • 6
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值