Home | History | Annotate | Download | only in mp
      1 /*
      2  * CDDL HEADER START
      3  *
      4  * The contents of this file are subject to the terms of the
      5  * Common Development and Distribution License (the "License").
      6  * You may not use this file except in compliance with the License.
      7  *
      8  * You can obtain a copy of the license at src/OPENSOLARIS.LICENSE
      9  * or http://www.opensolaris.org/os/licensing.
     10  * See the License for the specific language governing permissions
     11  * and limitations under the License.
     12  *
     13  * When distributing Covered Code, include this CDDL HEADER in each
     14  * file and include the License file at src/OPENSOLARIS.LICENSE.
     15  * If applicable, add the following below this CDDL HEADER, with the
     16  * fields enclosed by brackets "[]" replaced with your own identifying
     17  * information: Portions Copyright [yyyy] [name of copyright owner]
     18  *
     19  * CDDL HEADER END
     20  */
     21 /*
     22  * Copyright (c) 1999 by Sun Microsystems, Inc.
     23  * All rights reserved.
     24  */
     25 
     26 #pragma ident   "@(#)configuration.h	1.1 99/07/26 SMI"
     27 
     28 #ifndef _CONFIGURATION_H
     29 #define _CONFIGURATION_H
     30 
     31 #include <string.h>
     32 #include <sys/types.h>
     33 #include "general_header.h"
     34 #define CONF_FILE	"mp.conf"
     35 #define DEFAULT_CONF_PATH	"/usr/lib/lp/locale/C/mp"
     36 #define KEYWORD_PRESENTFORM	"PresentationForm"
     37 #define KEYWORD_ORIENT		"Orientation"
     38 #define KEYWORD_NUMERALS	"Numerals"
     39 #define KEYWORD_TEXTSHAPE	"TextShaping"
     40 #define KEYWORD_CONTEXT		"context"
     41 #define KEYWORD_SWAPPING	"swapping"
     42 #define KEYWORD_FONTNAMEALIAS	"FontNameAlias"
     43 #define KEYWORD_FONTGROUP	"FontGroup"
     44 #define KEYWORD_AFMFILE		"AFMfile"
     45 #define KEYWORD_MAPCODE2FONT	"MapCode2Font"
     46 #define KEYWORD_CNVCODE2FONT	"CnvCode2Font"
     47 #define KEYWORD_PCF		"PCF"
     48 #define KEYWORD_TTF		"TrueType"
     49 #define KEYWORD_TP1		"Type1"
     50 #define CMNT_CHAR               '#'
     51 #define TYPE_PCF                0
     52 #define TYPE_TTF                1
     53 #define TYPE_TP1                2
     54 
     55 #define ROMAN_INDEX		0
     56 #define BOLD_INDEX		1
     57 #define ITALIC_INDEX		2
     58 #define BOLDITALIC_INDEX	3
     59 
     60 #define ROMAN			0
     61 #define BOLD			1
     62 #define ITALIC			2
     63 #define BOLDITALIC		3
     64 
     65 #define TOT_INDEX		4
     66 #define TOT_FONT_TYPES		3
     67 
     68 #define XU_IGNORE               -2
     69 #define XU_UCS4UNDEF            -4
     70 #define XU_MOTION_CHAR          1
     71 #define XU_PSBM_CACHED          2
     72 #define XU_PSBM_NOTCACHED       3
     73 
     74 
     75 typedef struct conf conf_t;
     76 typedef struct fontgroup fontgroup_t;
     77 typedef struct mapcode2font mapcode2font_t;
     78 typedef struct cnvcode2font cnvcode2font_t;
     79 typedef struct ucs4fontndx ucs4fontndx_t;
     80 typedef struct cparam cparam_t;
     81 
     82 enum pform_t { INVALID, WC , PLSOutput };
     83 /*
     84  * This struct holds values of one time parameters in the configuration
     85  * file
     86  */
     87 
     88 struct cparam {
     89 	enum pform_t pform;
     90 	unsigned int orient;
     91 	unsigned int numeral;
     92 	unsigned int textshape;
     93 	unsigned int swapping;
     94 	unsigned int context;
     95 };
     96 /*
     97  * struct fontgroup contains scanned information
     98  * from the "FontGroup" keyword entries in the
     99  * CONF_FILE. type indicates PCF/TrueType/Type1
    100  * fonts, name is alias name given for groups,
    101  * gndx is an array of 4 indices pointing to
    102  * Roman, Bold, Italic and BoldItalic font entries
    103  * entries in the corresponding list of PCF/TrueType/Type1
    104  * font structures.
    105  */
    106 
    107 struct fontgroup {
    108 	int  type;
    109 	char *name;
    110 	int  gndx[4];
    111 };
    112 
    113 /*
    114  * struct mapcode2font contains scanned information
    115  * from the "MapCode2Font" entries in the configuration file.
    116  * n1, n2 are the presentation form range to which the
    117  * fontgroups are mapped. pcf_name, ttf_name & tp1_name
    118  * are the PCF/TrueType/Type1 font group alias names to which
    119  * the range is mapped.
    120  */
    121 
    122 struct mapcode2font {
    123 	unsigned int n1;
    124 	unsigned int n2;
    125 	char *pcf_name;
    126 	char *ttf_name;
    127 	char *tp1_name;
    128 };
    129 
    130 /*
    131  * struct cnvcode2font contains scanned information
    132  * from  the "CnvCode2Font" entries in the configuration file.
    133  * Information about the function which will convert the
    134  * presentation form of each coderange to the index of the
    135  * font to which it is mapped is stored in this struct.
    136  * file - path of the .so file.
    137  * name - alias name of the font file to which the shared module
    138  * is mapped.
    139  * fsym - The function within the shared object which does the
    140  * conversion.
    141  */
    142 
    143 struct cnvcode2font {
    144 	char *file;
    145 	char *name;
    146 	char *fsym;
    147 };
    148 
    149 /*
    150  * struct conf holds the information about
    151  * the total number of FontGroup entries
    152  * in the file in gmapN, MapCode2Font entries
    153  * in mmapN, CnvCode2Font entries in cmapN
    154  * scanned information from FontGroup, MapCode2Font
    155  * and CnvCode2Font entries are stored in FontGroup_t,
    156  * MapCode2Font_t and CnvCode2Font_t structures
    157  * respectively.
    158  */
    159 struct conf {
    160 	int gmapN;
    161 	int mmapN;
    162 	int cmapN;
    163 	fontgroup_t *gmap;
    164 	mapcode2font_t *mmap;
    165 	cnvcode2font_t *cmap;
    166 };
    167 
    168 /*
    169  * holds scanned info from the configuration file
    170  * about the presentation code ranges and the fonts
    171  * mapped to those ranges.
    172  */
    173 
    174 struct ucs4fontndx {
    175 	unsigned int n1;
    176 	unsigned int n2;
    177 	int pcf_ndx[4];                     /* index into pcf fontlist */
    178 	int ttf_ndx[4];                     /* index into TTfont list */
    179 	int tp1_ndx[4];                     /* index into printer fontlist */
    180 	char group_order[TOT_FONT_TYPES];
    181 };
    182 
    183 
    184 #endif /* _CONFIGURATION_H */
    185