summaryrefslogtreecommitdiff
path: root/Build/source/texk/web2c/luatexdir/luafontloader/fontforge/fontforge
diff options
context:
space:
mode:
authorDenis Bitouzé <dbitouze@wanadoo.fr>2021-02-25 18:23:07 +0000
committerDenis Bitouzé <dbitouze@wanadoo.fr>2021-02-25 18:23:07 +0000
commitc6101f91d071883b48b1b4b51e5eba0f36d9a78d (patch)
tree1bf7f5a881d7a4f5c5bf59d0b2821943dd822372 /Build/source/texk/web2c/luatexdir/luafontloader/fontforge/fontforge
parent07ee7222e389b0777456b427a55c22d0e6ffd267 (diff)
French translation for tlmgr updated
git-svn-id: svn://tug.org/texlive/trunk@57912 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Build/source/texk/web2c/luatexdir/luafontloader/fontforge/fontforge')
-rw-r--r--Build/source/texk/web2c/luatexdir/luafontloader/fontforge/fontforge/PfEd.h218
-rw-r--r--Build/source/texk/web2c/luatexdir/luafontloader/fontforge/fontforge/autohint.c2148
-rw-r--r--Build/source/texk/web2c/luatexdir/luafontloader/fontforge/fontforge/baseviews.h541
-rw-r--r--Build/source/texk/web2c/luatexdir/luafontloader/fontforge/fontforge/clipnoui.c68
-rw-r--r--Build/source/texk/web2c/luatexdir/luafontloader/fontforge/fontforge/configure-pfaedit.h301
-rw-r--r--Build/source/texk/web2c/luatexdir/luafontloader/fontforge/fontforge/cvundoes.c134
-rw-r--r--Build/source/texk/web2c/luatexdir/luafontloader/fontforge/fontforge/dumppfa.c218
-rw-r--r--Build/source/texk/web2c/luatexdir/luafontloader/fontforge/fontforge/edgelist.h149
-rw-r--r--Build/source/texk/web2c/luatexdir/luafontloader/fontforge/fontforge/edgelist2.h49
-rw-r--r--Build/source/texk/web2c/luatexdir/luafontloader/fontforge/fontforge/encoding.c943
-rw-r--r--Build/source/texk/web2c/luatexdir/luafontloader/fontforge/fontforge/encoding.h18
-rw-r--r--Build/source/texk/web2c/luatexdir/luafontloader/fontforge/fontforge/featurefile.c4208
-rw-r--r--Build/source/texk/web2c/luatexdir/luafontloader/fontforge/fontforge/fontforgevw.h34
-rw-r--r--Build/source/texk/web2c/luatexdir/luafontloader/fontforge/fontforge/fontviewbase.c287
-rw-r--r--Build/source/texk/web2c/luatexdir/luafontloader/fontforge/fontforge/fvcomposit.c160
-rw-r--r--Build/source/texk/web2c/luatexdir/luafontloader/fontforge/fontforge/fvfonts.c572
-rw-r--r--Build/source/texk/web2c/luatexdir/luafontloader/fontforge/fontforge/lookups.c3987
-rw-r--r--Build/source/texk/web2c/luatexdir/luafontloader/fontforge/fontforge/lookups.h2
-rw-r--r--Build/source/texk/web2c/luatexdir/luafontloader/fontforge/fontforge/macbinary.c1543
-rw-r--r--Build/source/texk/web2c/luatexdir/luafontloader/fontforge/fontforge/macenc.c1416
-rw-r--r--Build/source/texk/web2c/luatexdir/luafontloader/fontforge/fontforge/mathconstants.c99
-rw-r--r--Build/source/texk/web2c/luatexdir/luafontloader/fontforge/fontforge/memory.c101
-rw-r--r--Build/source/texk/web2c/luatexdir/luafontloader/fontforge/fontforge/mm.c198
-rw-r--r--Build/source/texk/web2c/luatexdir/luafontloader/fontforge/fontforge/mm.h32
-rw-r--r--Build/source/texk/web2c/luatexdir/luafontloader/fontforge/fontforge/namelist.c19808
-rw-r--r--Build/source/texk/web2c/luatexdir/luafontloader/fontforge/fontforge/noprefs.c452
-rw-r--r--Build/source/texk/web2c/luatexdir/luafontloader/fontforge/fontforge/nouiutil.c203
-rw-r--r--Build/source/texk/web2c/luatexdir/luafontloader/fontforge/fontforge/parsepfa.c2739
-rw-r--r--Build/source/texk/web2c/luatexdir/luafontloader/fontforge/fontforge/parsettf.c6234
-rw-r--r--Build/source/texk/web2c/luatexdir/luafontloader/fontforge/fontforge/parsettfatt.c3737
-rw-r--r--Build/source/texk/web2c/luatexdir/luafontloader/fontforge/fontforge/pfaedit.h80
-rw-r--r--Build/source/texk/web2c/luatexdir/luafontloader/fontforge/fontforge/plugins.h99
-rw-r--r--Build/source/texk/web2c/luatexdir/luafontloader/fontforge/fontforge/psfont.h191
-rw-r--r--Build/source/texk/web2c/luatexdir/luafontloader/fontforge/fontforge/psread.c4799
-rw-r--r--Build/source/texk/web2c/luatexdir/luafontloader/fontforge/fontforge/pua.c1612
-rw-r--r--Build/source/texk/web2c/luatexdir/luafontloader/fontforge/fontforge/python.c320
-rw-r--r--Build/source/texk/web2c/luatexdir/luafontloader/fontforge/fontforge/scripting.h140
-rw-r--r--Build/source/texk/web2c/luatexdir/luafontloader/fontforge/fontforge/sd.h163
-rw-r--r--Build/source/texk/web2c/luatexdir/luafontloader/fontforge/fontforge/sfd1.c48
-rw-r--r--Build/source/texk/web2c/luatexdir/luafontloader/fontforge/fontforge/sfd1.h105
-rw-r--r--Build/source/texk/web2c/luatexdir/luafontloader/fontforge/fontforge/splinechar.c246
-rw-r--r--Build/source/texk/web2c/luatexdir/luafontloader/fontforge/fontforge/splinefill.c532
-rw-r--r--Build/source/texk/web2c/luatexdir/luafontloader/fontforge/fontforge/splinefont.c655
-rw-r--r--Build/source/texk/web2c/luatexdir/luafontloader/fontforge/fontforge/splinefont.h2913
-rw-r--r--Build/source/texk/web2c/luatexdir/luafontloader/fontforge/fontforge/splineorder2.c1508
-rw-r--r--Build/source/texk/web2c/luatexdir/luafontloader/fontforge/fontforge/splineoverlap.c2394
-rw-r--r--Build/source/texk/web2c/luatexdir/luafontloader/fontforge/fontforge/splinerefigure.c101
-rw-r--r--Build/source/texk/web2c/luatexdir/luafontloader/fontforge/fontforge/splinesave.c2011
-rw-r--r--Build/source/texk/web2c/luatexdir/luafontloader/fontforge/fontforge/splinesaveafm.c261
-rw-r--r--Build/source/texk/web2c/luatexdir/luafontloader/fontforge/fontforge/splinestroke.c1874
-rw-r--r--Build/source/texk/web2c/luatexdir/luafontloader/fontforge/fontforge/splineutil.c4576
-rw-r--r--Build/source/texk/web2c/luatexdir/luafontloader/fontforge/fontforge/splineutil2.c2328
-rw-r--r--Build/source/texk/web2c/luatexdir/luafontloader/fontforge/fontforge/start.c77
-rw-r--r--Build/source/texk/web2c/luatexdir/luafontloader/fontforge/fontforge/stemdb.c40
-rw-r--r--Build/source/texk/web2c/luatexdir/luafontloader/fontforge/fontforge/stemdb.h210
-rw-r--r--Build/source/texk/web2c/luatexdir/luafontloader/fontforge/fontforge/tottf.c2032
-rw-r--r--Build/source/texk/web2c/luatexdir/luafontloader/fontforge/fontforge/tottfgpos.c366
-rw-r--r--Build/source/texk/web2c/luatexdir/luafontloader/fontforge/fontforge/ttf.h762
-rw-r--r--Build/source/texk/web2c/luatexdir/luafontloader/fontforge/fontforge/ttfspecial.c903
-rw-r--r--Build/source/texk/web2c/luatexdir/luafontloader/fontforge/fontforge/uiinterface.h511
-rw-r--r--Build/source/texk/web2c/luatexdir/luafontloader/fontforge/fontforge/unicoderange.h38
61 files changed, 0 insertions, 82494 deletions
diff --git a/Build/source/texk/web2c/luatexdir/luafontloader/fontforge/fontforge/PfEd.h b/Build/source/texk/web2c/luatexdir/luafontloader/fontforge/fontforge/PfEd.h
deleted file mode 100644
index d7d5d8fa670..00000000000
--- a/Build/source/texk/web2c/luatexdir/luafontloader/fontforge/fontforge/PfEd.h
+++ /dev/null
@@ -1,218 +0,0 @@
-/* Copyright (C) 2008 by George Williams */
-/*
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are met:
-
- * Redistributions of source code must retain the above copyright notice, this
- * list of conditions and the following disclaimer.
-
- * Redistributions in binary form must reproduce the above copyright notice,
- * this list of conditions and the following disclaimer in the documentation
- * and/or other materials provided with the distribution.
-
- * The name of the author may not be used to endorse or promote products
- * derived from this software without specific prior written permission.
-
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
- * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
- * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
- * EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
- * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
- * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
- * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
- * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#ifndef _PFED_H
-# define _PFED_H
-/* The PfEd table (from PfaEdit, former name of FontForge) is designed to */
-/* store information useful for editing the font. This includes stuff like */
-/* guidelines, background layers, spiro layers, comments, lookup names, etc*/
-/* The idea is that much useful information can be retrieved even after the */
-/* font has been generated into its final form: ttf/otf */
-/* It is something of a catch all table composed of many subtables, each of */
-/* which preserves one particular item. I expect more subtables will be */
-/* added as I, or others, think of more things worth preserving. */
-
-
-# ifndef CHR
-# define CHR(ch1,ch2,ch3,ch4) (((ch1)<<24)|((ch2)<<16)|((ch3)<<8)|(ch4))
-# endif
-
-/* 'PfEd' table format is as follows... */
-/* uint32 version number 0x00010000 */
-/* uint32 subtable count */
-/* struct { uint32 tab, offset } tag/offset for first subtable */
-/* struct { uint32 tab, offset } tag/offset for second subtable */
-/* ... */
-
-/* 'PfEd' 'fcmt' font comment subtable format */
-/* short version number 0/1 */
-/* short string length */
-/* version 0=>String in latin1 (should be ASCII), version 1=>utf8*/
-
- /* 'PfEd' 'cmnt' glyph comment subtable format */
- /* THIS VERSION IS DEPRECATED IN FAVOR OF VERSION 1 DESCRIBED BELOW */
- /* short version number 0 */
- /* short count-of-ranges */
- /* struct { short start-glyph, end-glyph, short offset } */
- /* ... */
- /* foreach glyph >=start-glyph, <=end-glyph(+1) */
- /* uint32 offset to glyph comment string (in UCS2)*/
- /* ... */
- /* And one last offset pointing beyong the end of the last string to enable length calculations */
- /* String table in UCS2 (NUL terminated). All offsets from start*/
- /* of subtable */
-
-/* 'PfEd' 'cmnt' glyph comment subtable format */
-/* New version of 'cmnt' which uses utf8 rather than UCS2 */
-/* short version number 1 */
-/* short count-of-ranges */
-/* struct { short start-glyph, end-glyph, short offset } */
-/* ... */
-/* foreach glyph >=start-glyph, <=end-glyph(+1) */
-/* uint32 offset to glyph comment string (in utf8)*/
-/* ... */
-/* And one last offset pointing beyong the end of the last string to enable length calculations */
-/* String table in utf8 (NUL terminated). All offsets from start*/
-/* of subtable */
-
-/* 'PfEd' 'cvt ' cvt comment subtable format */
-/* short version number 0 */
-/* short size of cvt comment array (might be less that cvt) */
-/* ushort offset[size] to utf8 strings describing cvt entries */
-/* (strings are NUL terminated) */
-/* String table in utf8 (NUL terminated). All offsets from start*/
-/* of subtable */
-
-/* 'PfEd' 'colr' glyph colour subtable */
-/* short version number 0 */
-/* short count-of-ranges */
-/* struct { short start-glyph, end-glyph, uint32 colour (rgb) } */
-
-/* 'PfEd' 'GPOS' GPOS lookup/subtable/anchor names */
-/* short version number 0 */
-/* short count-of-lookups */
-/* struct { short offset name, offset subtables; } */
-/* A subtable: */
-/* short count-of-subtables */
-/* struct { short offset name, offset anchors; } */
-/* An anchor */
-/* short count-of-anchors */
-/* struct { short offset name; } */
-/* string data (utf8, nul terminated) */
-/* (all offsets from start of subtable) */
-
-/* 'PfEd' 'GSUB' GSUB lookup/subtable names */
-/* Same as GPOS (anchors will always be NULL) */
-
-/* The next two tables 'guid' and 'layr' will make use of the */
-/* following data type. The glyph_layer. */
-/* short contour-count */
-/* short image-count (always 0 for now) */
-/* struct { ushort offset; ushort name-off}[contour-count] */
-/* struct { ??? }[image-count] */
-/* Each contour consists of one byte of command and a random */
-/* amount of data dependant on the command. */
-/* See below for a description of the command verbs */
-/* string data in utf8 */
-/* (offsets relative to start of glyph_layer structure ) */
-
-/* 'PfEd' 'guid' Horizontal/Vertical guideline data */
-/* short version number 0 */
-/* short # vertical guidelines */
-/* short # horizontal guidelines */
-/* short mbz */
-/* offset guide spline data -- specifies all guides as splines */
-/* May be NULL */
-/* struct[# vert guidelines] { short x; short offset name} */
-/* struct[# h guidelines] { short y; short offset name} */
-/* a glyph_layer (includes all guides, even those listed above) */
-/* (all offsets, except those in the glyph_layer, relative to start of subtable) */
-
-/* 'PfEd' 'layr' layer data */
-/* short version number 0 */
-/* short layer-count */
-/* struct { short typeflags; short offset-name; uint32 offset-to-layer-data; } */
-/* the layer type is 2=>quadratic, 3=>PostScript, 1=>spiro */
-/* 0x102=>quadratic fore, 0x103=>PS fore */
-/* A layer: */
-/* short count-of-ranges */
-/* struct { short start-glyph, end-glyph, uint32 offset } */
-/* ... */
-/* foreach glyph >=start-glyph, <=end-glyph */
-/* uint32 offset to per-glyph outline data */
-/* many glyph_layers */
-/* (all offsets, except those in the glyph_layers, relative to start of subtable) */
-
- /* Main table tag */
-# define PfEd_TAG CHR('P','f','E','d')
-
- /* Subtable tags */
-# define fcmt_TAG CHR('f','c','m','t') /* Font Comment */
-# define flog_TAG CHR('f','l','o','g') /* Font Log */
-# define cmnt_TAG CHR('c','m','n','t') /* Glyph Comments */
-# define cvtc_TAG CHR('c','v','t','c') /* Comments for each cvt entry */
-# define colr_TAG CHR('c','o','l','r') /* Glyph color flags */
-# ifndef GPOS_TAG
-# define GPOS_TAG CHR('G','P','O','S') /* Names for GPOS lookups */
-# define GSUB_TAG CHR('G','S','U','B') /* Names for GSUB lookups */
-# endif
-# define guid_TAG CHR('g','u','i','d') /* Guideline data */
-# define layr_TAG CHR('l','a','y','r') /* Any layers which aren't part of the font */
- /* Backgrounds, spiros, etc. */
-
-
-/* The layer commands used to draw quadratic and cubic layers have two */
-/* componants: A verb, which says what to do, and a modifier which says */
-/* how the data are stored. So a command looks like (verb)|(modifier) */
-/* A moveto command with byte data looks like (V_MoveTo|V_B) */
-/* The two commands to end a contour (V_Close and V_End) take no data */
-/* and use no modifier */
-
-/* layr subtable contour construction verb modifiers specifying data types */
-# define V_B 0 /* data are signed bytes */
-# define V_S 1 /* data are signed shorts */
-# define V_F 2 /* data are fixed longs, divide by 256.0 */
-
-/* layr subtable contour construction verbs */
-# define V_MoveTo 0 /* Start contour, absolute data (2 coords) */
-# define V_LineTo 4 /* Straight line, relative data (2 coords) */
-# define V_HLineTo 8 /* Horizontal line, relative (1 coord, x-off) */
-# define V_VLineTo 12 /* Vertical line, relative (1 coord, y-off) */
-
-# define V_QCurveTo 16 /* Quadratic spline, rel, rel (4 coords, cp, p) */
-# define V_QImplicit 20 /* Quadratic spline, rel (2 coords, cp) */
- /* May only occur after a V_QCurveTo or V_QImplicit (may not start contour) */
- /* Must be followed by a V_QCurveTo or V_QImplicit (this may end contour) */
- /* The on-curve point is implicit by averaging the given cp with the cp in the next verb */
-# define V_QHImplicit 24 /* Quadratic spline, rel (1 coord, cp.x) */
-# define V_QVImplicit 28 /* Quadratic spline, rel (1 coord, cp.y) */
-
-# define V_CurveTo 32 /* Cubic spline, rel, rel (6 coords, cp1, cp2, p) */
-# define V_VHCurveTo 36 /* Cubic spline, rel, rel (4 coords, cp1.y cp2.* p.x) */
- /* cp1.x == current.y, p.y == cp2.y */
-# define V_HVCurveTo 40 /* Cubic spline, rel, rel (4 coords, cp1.x cp2.* p.y) */
-
-# define V_Close 44 /* Close path (optionally adding a line) no data */
-# define V_End 45 /* End path (leave open) no data */
-
-#define COM_MOD(com) ((com)&3)
-#define COM_VERB(com) ((com)&~3)
-
-/* the layer commands used to draw spiro layers are the standard spiro verbs */
-/* these will always take fixed long data (V_L) as described above */
-# ifndef SPIRO_OPEN_CONTOUR
-# define SPIRO_OPEN_CONTOUR '{'
-# define SPIRO_CORNER 'v'
-# define SPIRO_G4 'o'
-# define SPIRO_G2 'c'
-# define SPIRO_LEFT '['
-# define SPIRO_RIGHT ']'
-# define SPIRO_END 'z'
-# endif
-# define SPIRO_CLOSE_CONTOUR '}'
-
-#endif /* _PFED_H */
diff --git a/Build/source/texk/web2c/luatexdir/luafontloader/fontforge/fontforge/autohint.c b/Build/source/texk/web2c/luatexdir/luafontloader/fontforge/fontforge/autohint.c
deleted file mode 100644
index 6619bd1f762..00000000000
--- a/Build/source/texk/web2c/luatexdir/luafontloader/fontforge/fontforge/autohint.c
+++ /dev/null
@@ -1,2148 +0,0 @@
-/* Copyright (C) 2000-2008 by George Williams */
-/*
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are met:
-
- * Redistributions of source code must retain the above copyright notice, this
- * list of conditions and the following disclaimer.
-
- * Redistributions in binary form must reproduce the above copyright notice,
- * this list of conditions and the following disclaimer in the documentation
- * and/or other materials provided with the distribution.
-
- * The name of the author may not be used to endorse or promote products
- * derived from this software without specific prior written permission.
-
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
- * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
- * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
- * EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
- * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
- * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
- * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
- * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-#include "pfaedit.h"
-#include <stdio.h>
-#include <math.h>
-#include "splinefont.h"
-#include "stemdb.h"
-#include <utype.h>
-#include <chardata.h>
-#include "edgelist.h"
-
-/* to create a type 1 font we must come up with the following entries for the
- private dictionary:
- BlueValues -- an array of 2n entries where Blue[2i]<Blue[2i+1] max n=7, Blue[i]>0
- OtherBlues -- (optional) OtherBlue[i]<0
- (blue zones should be at least 3 units appart)
- StdHW -- (o) array with one entry, standard hstem height
- StdVW -- (o) ditto vstem width
- StemSnapH -- (o) up to 12 numbers containing various hstem heights (includes StdHW), small widths first
- StemSnapV -- (o) ditto, vstem
-This file has routines to figure out at least some of these
-
-Also other routines to guess at good per-character hints
-*/
-
-static void AddBlue(real val, real array[5], int force) {
- val = rint(val);
- if ( !force && (val<array[0]-array[1] || val >array[0]+array[1] ))
-return; /* Outside of one sd */
- if ( array[3]==0 && array[4]==0 )
- array[3] = array[4] = val;
- else if ( val>array[4] )
- array[4] = val;
- else if ( val<array[3] )
- array[3] = val;
-}
-
-static void MergeZones(real zone1[5], real zone2[5]) {
- if ( zone1[2]!=0 && zone2[2]!=0 &&
- ((zone1[4]+3>zone2[3] && zone1[3]<=zone2[3]) ||
- (zone2[4]+3>zone1[3] && zone2[3]<=zone1[3]) )) {
- if (( zone2[0]<zone1[0]-zone1[1] || zone2[0] >zone1[0]+zone1[1] ) &&
- ( zone1[0]<zone2[0]-zone2[1] || zone1[0] >zone2[0]+zone2[1] ))
- /* the means of the zones are too far appart, don't merge em */;
- else {
- if ( zone1[0]<zone2[0] ) zone2[0] = zone1[0];
- if ( zone1[1]>zone2[1] ) zone2[1] = zone1[1];
- }
- zone1[2] = 0;
- }
-}
-
-/* I can deal with latin, greek and cyrillic because the they all come from */
-/* the same set of letter shapes and have all evolved together and have */
-/* various common features (ascenders, descenders, lower case, etc.). Other */
-/* scripts don't fit */
-void FindBlues( SplineFont *sf, int layer, real blues[14], real otherblues[10]) {
- real caph[5], xh[5], ascenth[5], digith[5], descenth[5], base[5];
- real otherdigits[5];
- int i, j, k;
- DBounds b;
-
- /* Go through once to get some idea of the average value so we can weed */
- /* out undesireables */
- caph[0] = caph[1] = caph[2] = xh[0] = xh[1] = xh[2] = 0;
- ascenth[0] = ascenth[1] = ascenth[2] = digith[0] = digith[1] = digith[2] = 0;
- descenth[0] = descenth[1] = descenth[2] = base[0] = base[1] = base[2] = 0;
- otherdigits[0] = otherdigits[1] = otherdigits[2] = 0;
- for ( i=0; i<sf->glyphcnt; ++i ) {
- if ( sf->glyphs[i]!=NULL && sf->glyphs[i]->layers[layer].splines!=NULL ) {
- int enc = sf->glyphs[i]->unicodeenc;
-#ifndef LUA_FF_LIB
- const unichar_t *upt;
-#endif
- if ( enc<0x10000 && isalnum(enc) &&
- ((enc>=32 && enc<128 ) || enc == 0xfe || enc==0xf0 || enc==0xdf ||
- enc==0x131 ||
- (enc>=0x391 && enc<=0x3f3 ) ||
- (enc>=0x400 && enc<=0x4e9 ) )) {
- /* no accented characters (or ligatures) */
-#ifndef LUA_FF_LIB
- if ( unicode_alternates[enc>>8]!=NULL &&
- (upt =unicode_alternates[enc>>8][enc&0xff])!=NULL &&
- upt[1]!='\0' )
- continue;
-#endif
- SplineCharFindBounds(sf->glyphs[i],&b);
- if ( b.miny==0 && b.maxy==0 )
- continue;
- if ( enc=='g' || enc=='j' || enc=='p' || enc=='q' || enc=='y' ||
- enc==0xfe ||
- enc==0x3c1 /* rho */ ||
- enc==0x3c6 /* phi */ ||
- enc==0x3c7 /* chi */ ||
- enc==0x3c8 /* psi */ ||
- enc==0x440 /* cyr er */ ||
- enc==0x443 /* cyr u */ ||
- enc==0x444 /* cyr ef */) {
- descenth[0] += b.miny;
- descenth[1] += b.miny*b.miny;
- ++descenth[2];
- } else if ( enc=='x' || enc=='r' || enc=='o' || enc=='e' ||
- enc=='s' || enc=='c' || enc=='h' || enc=='k' ||
- enc=='l' || enc=='m' || enc=='n' ||
- enc==0x3b5 /* epsilon */ ||
- enc==0x3b9 /* iota */ ||
- enc==0x3ba /* kappa */ ||
- enc==0x3bf /* omicron */ ||
- enc==0x3c3 /* sigma */ ||
- enc==0x3c5 /* upsilon */ ||
- enc==0x430 /* cyr a */ ||
- enc==0x432 /* cyr ve */ ||
- enc==0x433 /* cyr ge */ ||
- enc==0x435 /* cyr e */ ||
- enc==0x436 /* cyr zhe */ ||
- enc==0x438 /* cyr i */ ||
- enc==0x43a /* cyr ka */ ||
- enc==0x43d /* cyr en */ ||
- enc==0x43e /* cyr o */ ||
- enc==0x441 /* cyr es */ ||
- enc==0x445 /* cyr ha */ ||
- enc==0x447 /* cyr che */ ||
- enc==0x448 /* cyr sha */ ||
- enc==0x44f /* cyr ya */ ){
- base[0] += b.miny;
- base[1] += b.miny*b.miny;
- ++base[2];
- }
- /* careful of lowercase digits, 6 and 8 should be ascenders */
- if ( enc=='6' || enc=='8' ) {
- digith[0] += b.maxy;
- digith[1] += b.maxy*b.maxy;
- ++digith[2];
- } else if ( enc<0x10000 && isdigit(enc) ) {
- otherdigits[0] += b.maxy;
- otherdigits[1] += b.maxy*b.maxy;
- ++otherdigits[2];
- } else if ( enc<0x10000 && isupper(enc) && enc!=0x462 && enc!=0x490 ) {
- caph[0] += b.maxy;
- caph[1] += b.maxy*b.maxy;
- ++caph[2];
- } else if ( enc=='b' || enc=='d' || enc=='f' || enc=='h' || enc=='k' ||
- enc == 'l' || enc==0xf0 || enc==0xfe || enc == 0xdf ||
- enc == 0x3b2 || enc==0x3b6 || enc==0x3b8 || enc==0x3bb ||
- enc == 0x3be ||
- enc == 0x431 /* cyr be */ /* || enc == 0x444 - ef may have varible height */) {
- ascenth[0] += b.maxy;
- ascenth[1] += b.maxy*b.maxy;
- ++ascenth[2];
- } else if ( enc=='c' || enc=='e' || enc=='o' || enc=='s' || enc=='u' ||
- enc=='u' || enc=='v' || enc=='w' || enc=='x' || enc=='y' ||
- enc=='z' ||
- enc==0x3b5 /* epsilon */ ||
- enc==0x3b9 /* iota */ ||
- enc==0x3ba /* kappa */ ||
- enc==0x3bc /* mu */ ||
- enc==0x3bd /* nu */ ||
- enc==0x3bf /* omicron */ ||
- enc==0x3c0 /* pi */ ||
- enc==0x3c1 /* rho */ ||
- enc==0x3c5 /* upsilon */ ||
- enc==0x433 /* cyr ge */ ||
- enc==0x435 /* cyr e */ ||
- enc==0x436 /* cyr zhe */ ||
- enc==0x438 /* cyr i */ ||
- enc==0x43b /* cyr el */ ||
- enc==0x43d /* cyr en */ ||
- enc==0x43e /* cyr o */ ||
- enc==0x43f /* cyr pe */ ||
- enc==0x440 /* cyr er */ ||
- enc==0x441 /* cyr es */ ||
- enc==0x442 /* cyr te */ ||
- enc==0x443 /* cyr u */ ||
- enc==0x445 /* cyr ha */ ||
- enc==0x446 /* cyr tse */ ||
- enc==0x447 /* cyr che */ ||
- enc==0x448 /* cyr sha */ ||
- enc==0x449 /* cyr shcha */ ||
- enc==0x44a /* cyr hard sign */ ||
- enc==0x44b /* cyr yery */ ||
- enc==0x44c /* cyr soft sign */ ||
- enc==0x44d /* cyr reversed e */ ||
- enc==0x44f /* cyr ya */ ) {
- xh[0] += b.maxy;
- xh[1] += b.maxy*b.maxy;
- ++xh[2];
- }
- }
- }
- if ( !ff_progress_next())
- break;
- }
- if ( otherdigits[2]>0 && digith[2]>0 ) {
- if ( otherdigits[0]/otherdigits[2] >= .95*digith[0]/digith[2] ) {
- /* all digits are about the same height, not lowercase */
- digith[0] += otherdigits[0];
- digith[1] += otherdigits[1];
- digith[2] += otherdigits[2];
- }
- }
-
- if ( xh[2]>1 ) {
- xh[1] = sqrt((xh[1]-xh[0]*xh[0]/xh[2])/(xh[2]-1));
- xh[0] /= xh[2];
- }
- if ( ascenth[2]>1 ) {
- ascenth[1] = sqrt((ascenth[1]-ascenth[0]*ascenth[0]/ascenth[2])/(ascenth[2]-1));
- ascenth[0] /= ascenth[2];
- }
- if ( caph[2]>1 ) {
- caph[1] = sqrt((caph[1]-caph[0]*caph[0]/caph[2])/(caph[2]-1));
- caph[0] /= caph[2];
- }
- if ( digith[2]>1 ) {
- digith[1] = sqrt((digith[1]-digith[0]*digith[0]/digith[2])/(digith[2]-1));
- digith[0] /= digith[2];
- }
- if ( base[2]>1 ) {
- base[1] = sqrt((base[1]-base[0]*base[0]/base[2])/(base[2]-1));
- base[0] /= base[2];
- }
- if ( descenth[2]>1 ) {
- descenth[1] = sqrt((descenth[1]-descenth[0]*descenth[0]/descenth[2])/(descenth[2]-1));
- descenth[0] /= descenth[2];
- }
-
- /* we'll accept values between +/- 1sd of the mean */
- /* array[0] == mean, array[1] == sd, array[2] == cnt, array[3]=min, array[4]==max */
- if ( base[0]+base[1]<0 ) base[1] = -base[0]; /* Make sure 0 is within the base bluezone */
- caph[3] = caph[4] = 0;
- xh[3] = xh[4] = 0;
- ascenth[3] = ascenth[4] = 0;
- digith[3] = digith[4] = 0;
- descenth[3] = descenth[4] = 0;
- base[3] = base[4] = 0;
- for ( i=0; i<sf->glyphcnt; ++i ) if ( sf->glyphs[i]!=NULL ) {
- int enc = sf->glyphs[i]->unicodeenc;
-#ifndef LUA_FF_LIB
- const unichar_t *upt;
-#endif
- if ( enc<0x10000 && isalnum(enc) &&
- ((enc>=32 && enc<128 ) || enc == 0xfe || enc==0xf0 || enc==0xdf ||
- (enc>=0x391 && enc<=0x3f3 ) ||
- (enc>=0x400 && enc<=0x4e9 ) )) {
- /* no accented characters (or ligatures) */
-#ifndef LUA_FF_LIB
- if ( unicode_alternates[enc>>8]!=NULL &&
- (upt =unicode_alternates[enc>>8][enc&0xff])!=NULL &&
- upt[1]!='\0' )
- continue;
-#endif
- SplineCharFindBounds(sf->glyphs[i],&b);
- if ( b.miny==0 && b.maxy==0 )
- continue;
- if ( enc=='g' || enc=='j' || enc=='p' || enc=='q' || enc=='y' ||
- enc==0xfe || enc == 0x3c6 || enc==0x3c8 ||
- enc==0x440 || enc==0x443 || enc==0x444) {
- AddBlue(b.miny,descenth,false);
- } else {
- /* O and o get forced into the baseline blue value even if they*/
- /* are beyond 1 sd */
- AddBlue(b.miny,base,enc=='O' || enc=='o');
- }
- if ( enc<0x10000 && isdigit(enc)) {
- AddBlue(b.maxy,digith,false);
- } else if ( enc<0x10000 && isupper(enc)) {
- AddBlue(b.maxy,caph,enc=='O');
- } else if ( enc=='b' || enc=='d' || enc=='f' || enc=='h' || enc=='k' ||
- enc == 'l' || enc=='t' || enc==0xf0 || enc==0xfe || enc == 0xdf ||
- enc == 0x3b2 || enc==0x3b6 || enc==0x3b8 || enc==0x3bb ||
- enc == 0x3be ||
- enc == 0x431 ) {
- AddBlue(b.maxy,ascenth,false);
- } else if ( enc=='c' || enc=='e' || enc=='o' || enc=='s' || enc=='u' ||
- enc=='u' || enc=='v' || enc=='w' || enc=='x' || enc=='y' ||
- enc=='z' ||
- enc==0x3b5 /* epsilon */ ||
- enc==0x3b9 /* iota */ ||
- enc==0x3ba /* kappa */ ||
- enc==0x3bc /* mu */ ||
- enc==0x3bd /* nu */ ||
- enc==0x3bf /* omicron */ ||
- enc==0x3c0 /* pi */ ||
- enc==0x3c1 /* rho */ ||
- enc==0x3c5 /* upsilon */ ||
- enc==0x433 /* cyr ge */ ||
- enc==0x435 /* cyr e */ ||
- enc==0x436 /* cyr zhe */ ||
- enc==0x438 /* cyr i */ ||
- enc==0x43b /* cyr el */ ||
- enc==0x43d /* cyr en */ ||
- enc==0x43e /* cyr o */ ||
- enc==0x43f /* cyr pe */ ||
- enc==0x440 /* cyr er */ ||
- enc==0x441 /* cyr es */ ||
- enc==0x442 /* cyr te */ ||
- enc==0x443 /* cyr u */ ||
- enc==0x445 /* cyr ha */ ||
- enc==0x446 /* cyr tse */ ||
- enc==0x447 /* cyr che */ ||
- enc==0x448 /* cyr sha */ ||
- enc==0x449 /* cyr shcha */ ||
- enc==0x44a /* cyr hard sign */ ||
- enc==0x44b /* cyr yery */ ||
- enc==0x44c /* cyr soft sign */ ||
- enc==0x44d /* cyr reversed e */ ||
- enc==0x44f /* cyr ya */ ) {
- AddBlue(b.maxy,xh,enc=='o' || enc=='x');
- }
- }
- }
-
- /* the descent blue zone merges into the base zone */
- MergeZones(descenth,base);
- MergeZones(xh,base);
- MergeZones(ascenth,caph);
- MergeZones(digith,caph);
- MergeZones(xh,caph);
- MergeZones(ascenth,digith);
- MergeZones(xh,digith);
-
- if ( otherblues!=NULL )
- for ( i=0; i<10; ++i )
- otherblues[i] = 0;
- for ( i=0; i<14; ++i )
- blues[i] = 0;
-
- if ( otherblues!=NULL && descenth[2]!=0 ) {
- otherblues[0] = descenth[3];
- otherblues[1] = descenth[4];
- }
- i = 0;
- if ( base[2]==0 && (xh[2]!=0 || ascenth[2]!=0 || caph[2]!=0 || digith[2]!=0 )) {
- /* base line blue value must be present if any other value is */
- /* make one up if we don't have one */
- blues[0] = -20;
- blues[1] = 0;
- i = 2;
- } else if ( base[2]!=0 ) {
- blues[0] = base[3];
- blues[1] = base[4];
- i = 2;
- }
- if ( xh[2]!=0 ) {
- blues[i++] = xh[3];
- blues[i++] = xh[4];
- }
- if ( caph[2]!=0 ) {
- blues[i++] = caph[3];
- blues[i++] = caph[4];
- }
- if ( digith[2]!=0 ) {
- blues[i++] = digith[3];
- blues[i++] = digith[4];
- }
- if ( ascenth[2]!=0 ) {
- blues[i++] = ascenth[3];
- blues[i++] = ascenth[4];
- }
-
- for ( j=0; j<i; j+=2 ) for ( k=j+2; k<i; k+=2 ) {
- if ( blues[j]>blues[k] ) {
- real temp = blues[j];
- blues[j]=blues[k];
- blues[k] = temp;
- temp = blues[j+1];
- blues[j+1] = blues[k+1];
- blues[k+1] = temp;
- }
- }
-}
-
-void ElFreeEI(EIList *el) {
- EI *e, *next;
-
- for ( e = el->edges; e!=NULL; e = next ) {
- next = e->next;
- free(e);
- }
-}
-
-static int EIAddEdge(Spline *spline, real tmin, real tmax, EIList *el) {
- EI *new = gcalloc(1,sizeof(EI));
- real min, max, temp;
- Spline1D *s;
- real dxdtmin, dxdtmax, dydtmin, dydtmax;
-
- new->spline = spline;
- new->tmin = tmin;
- new->tmax = tmax;
-
- s = &spline->splines[1];
- if (( dydtmin = (3*s->a*tmin + 2*s->b)*tmin + s->c )<0 ) dydtmin = -dydtmin;
- if (( dydtmax = (3*s->a*tmax + 2*s->b)*tmax + s->c )<0 ) dydtmax = -dydtmax;
- s = &spline->splines[0];
- if (( dxdtmin = (3*s->a*tmin + 2*s->b)*tmin + s->c )<0 ) dxdtmin = -dxdtmin;
- if (( dxdtmax = (3*s->a*tmax + 2*s->b)*tmax + s->c )<0 ) dxdtmax = -dxdtmax;
-
- /*s = &spline->splines[0];*/
- min = ((s->a * tmin + s->b)* tmin + s->c)* tmin + s->d;
- max = ((s->a * tmax + s->b)* tmax + s->c)* tmax + s->d;
- if ( tmax==1 ) max = spline->to->me.x; /* beware rounding errors */
- if ( !el->leavetiny && floor(min)==floor(max) ) { /* If it doesn't cross a pixel boundary then it might as well be vertical */
- if ( tmin==0 ) max = min;
- else if ( tmax==1 ) min = max;
- else max = min;
- }
- if ( min==max )
- new->vert = true;
- else if ( min<max )
- new->hup = true;
- else {
- temp = min; min = max; max=temp;
- }
- if ( !el->leavetiny && min+1>max ) new->almostvert = true;
- if ( 40*dxdtmin<dydtmin ) new->vertattmin = true;
- if ( 40*dxdtmax<dydtmax ) new->vertattmax = true;
- /*if ( new->vertattmin && new->vertattmax && s->a==0 && s->b==0 ) new->almostvert = true;*/
- new->coordmin[0] = min; new->coordmax[0] = max;
- if ( el->coordmin[0]>min )
- el->coordmin[0] = min;
- if ( el->coordmax[0]<max )
- el->coordmax[0] = max;
-
- s = &spline->splines[1];
- min = ((s->a * tmin + s->b)* tmin + s->c)* tmin + s->d;
- max = ((s->a * tmax + s->b)* tmax + s->c)* tmax + s->d;
- if ( tmax==1 ) max = spline->to->me.y;
- if ( !el->leavetiny && floor(min)==floor(max) ) { /* If it doesn't cross a pixel boundary then it might as well be horizontal */
- if ( tmin==0 ) max = min;
- else if ( tmax==1 ) min = max;
- else max = min;
- }
- if ( min==max )
- new->hor = true;
- else if ( min<max )
- new->vup = true;
- else {
- temp = min; min = max; max=temp;
- }
- if ( !el->leavetiny && min+1>max ) new->almosthor = true;
- if ( 40*dydtmin<dxdtmin ) new->horattmin = true;
- if ( 40*dydtmax<dxdtmax ) new->horattmax = true;
- /*if ( new->horattmin && new->horattmax && s->a==0 && s->b==0 ) new->almosthor = true;*/
- new->coordmin[1] = min; new->coordmax[1] = max;
- if ( el->coordmin[1]>min )
- el->coordmin[1] = min;
- if ( el->coordmax[1]<max )
- el->coordmax[1] = max;
-
- if ( new->hor && new->vert ) {
- /* This spline is too small for us to notice */
- free(new);
-return( false );
- } else {
- new->next = el->edges;
- el->edges = new;
-
- if ( el->splinelast!=NULL )
- el->splinelast->splinenext = new;
- el->splinelast = new;
- if ( el->splinefirst==NULL )
- el->splinefirst = new;
-
-return( true );
- }
-}
-
-static void EIAddSpline(Spline *spline, EIList *el) {
- extended ts[6], temp;
- int i, j, base, last;
-
- ts[0] = 0; ts[5] = 1.0;
- SplineFindExtrema(&spline->splines[0],&ts[1],&ts[2]);
- SplineFindExtrema(&spline->splines[1],&ts[3],&ts[4]);
- /* avoid teeny tiny segments, they just confuse us */
- SplineRemoveExtremaTooClose(&spline->splines[0],&ts[1],&ts[2]);
- SplineRemoveExtremaTooClose(&spline->splines[1],&ts[3],&ts[4]);
- for ( i=0; i<4; ++i ) for ( j=i+1; j<5; ++j ) {
- if ( ts[i]>ts[j] ) {
- temp = ts[i];
- ts[i] = ts[j];
- ts[j] = temp;
- }
- }
- for ( base=0; ts[base]==-1; ++base);
- for ( i=5; i>base ; --i ) {
- if ( ts[i]==ts[i-1] ) {
- for ( j=i-1; j>base; --j )
- ts[j] = ts[j-1];
- ts[j] = -1;
- ++base;
- }
- }
- last = base;
- for ( i=base; i<5 ; ++i )
- if ( EIAddEdge(spline,ts[last],ts[i+1],el) )
- last = i+1;
-}
-
-void ELFindEdges(SplineChar *sc, EIList *el) {
- Spline *spline, *first;
- SplineSet *spl;
-
- el->sc = sc;
- if ( sc->layers[el->layer].splines==NULL )
-return;
-
- el->coordmin[0] = el->coordmax[0] = sc->layers[el->layer].splines->first->me.x;
- el->coordmin[1] = el->coordmax[1] = sc->layers[el->layer].splines->first->me.y;
-
- for ( spl = sc->layers[el->layer].splines; spl!=NULL; spl = spl->next ) if ( spl->first->prev!=NULL && spl->first->prev->from!=spl->first ) {
- first = NULL;
- for ( spline = spl->first->next; spline!=NULL && spline!=first; spline=spline->to->next ) {
- EIAddSpline(spline,el);
- if ( first==NULL ) first = spline;
- }
- if ( el->splinefirst!=NULL && spl->first->prev!=NULL )
- el->splinelast->splinenext = el->splinefirst;
- el->splinelast = NULL; el->splinefirst = NULL;
- }
-}
-
-static int IsBiggerSlope(EI *test, EI *base, int major) {
- int other = !major;
- real tdo, tdm, bdo, bdm, t;
-
- if (( major && test->vup ) || (!major && test->hup))
- t = test->tmin;
- else
- t = test->tmax;
- tdm = (3*test->spline->splines[major].a*t + 2*test->spline->splines[major].b)*t + test->spline->splines[major].c;
- tdo = (3*test->spline->splines[other].a*t + 2*test->spline->splines[other].b)*t + test->spline->splines[other].c;
-
- if (( major && base->vup ) || (!major && base->hup))
- t = base->tmin;
- else
- t = base->tmax;
- bdm = (3*base->spline->splines[major].a*t + 2*base->spline->splines[major].b)*t + base->spline->splines[major].c;
- bdo = (3*base->spline->splines[other].a*t + 2*base->spline->splines[other].b)*t + base->spline->splines[other].c;
-
- if ( tdm==0 && bdm==0 )
-return( tdo > bdo );
- if ( tdo==0 )
-return( tdo>0 );
- else if ( bdo==0 )
-return( bdo>0 );
-
-return( tdo/tdm > bdo/bdm );
-}
-
-void ELOrder(EIList *el, int major ) {
- int other = !major;
- int pos;
- EI *ei, *prev, *test;
-
- el->low = floor(el->coordmin[major]); el->high = ceil(el->coordmax[major]);
- el->cnt = el->high-el->low+1;
- el->ordered = gcalloc(el->cnt,sizeof(EI *));
- el->ends = gcalloc(el->cnt,1);
-
- for ( ei = el->edges; ei!=NULL ; ei=ei->next ) {
- pos = ceil(ei->coordmax[major])-el->low;
- el->ends[pos] = true;
- pos = floor(ei->coordmin[major])-el->low;
- ei->ocur = (ei->hup == ei->vup)?ei->coordmin[other]:ei->coordmax[other];
- ei->tcur = ((major && ei->vup) || (!major && ei->hup)) ?
- ei->tmin: ei->tmax;
- if ( major ) {
- ei->up = ei->vup;
- ei->hv = (ei->vert || ei->almostvert);
- ei->hvbottom = ei->vup ? ei->vertattmin : ei->vertattmax;
- ei->hvtop =!ei->vup ? ei->vertattmin : ei->vertattmax;
- if ( ei->hor || ei->almosthor)
- continue;
- } else {
- ei->up = ei->hup;
- ei->hv = (ei->hor || ei->almosthor);
- ei->hvbottom = ei->hup ? ei->horattmin : ei->horattmax;
- ei->hvtop =!ei->hup ? ei->horattmin : ei->horattmax;
- if ( ei->vert || ei->almostvert)
- continue;
- }
- if ( el->ordered[pos]==NULL || ei->ocur<el->ordered[pos]->ocur ) {
- ei->ordered = el->ordered[pos];
- el->ordered[pos] = ei;
- } else {
- for ( prev=el->ordered[pos], test = prev->ordered; test!=NULL;
- prev = test, test = test->ordered ) {
- if ( test->ocur>ei->ocur ||
- (test->ocur==ei->ocur && IsBiggerSlope(test,ei,major)))
- break;
- }
- ei->ordered = test;
- prev->ordered = ei;
- }
- }
-}
-
-static HintInstance *HIMerge(HintInstance *into, HintInstance *hi) {
- HintInstance *n, *first = NULL, *last = NULL;
-
- while ( into!=NULL && hi!=NULL ) {
- if ( into->begin<hi->begin ) {
- n = into;
- into = into->next;
- } else {
- n = hi;
- hi = hi->next;
- }
- if ( first==NULL )
- first = n;
- else
- last->next = n;
- last = n;
- }
- if ( into!=NULL ) {
- if ( first==NULL )
- first = into;
- else
- last->next = into;
- } else if ( hi!=NULL ) {
- if ( first==NULL )
- first = hi;
- else
- last->next = hi;
- }
-return( first );
-}
-
-StemInfo *HintCleanup(StemInfo *stem,int dosort,int instance_count) {
- StemInfo *s, *p=NULL, *t, *pt, *sn;
- int swap;
-
- for ( s=stem; s!=NULL; p=s, s=s->next ) {
- if ( s->width<0 ) {
- s->start += s->width;
- s->width = -s->width;
- s->ghost = true;
- }
- s->reordered = false;
- if ( p!=NULL && p->start> s->start )
- dosort = true;
- }
- if ( dosort ) {
- for ( p=NULL, s=stem; s!=NULL; p=s, s = sn ) {
- sn = s->next;
- for ( pt=s, t=sn; t!=NULL; pt=t, t=t->next ) {
- if ( instance_count>1 &&
- t->u.unblended!=NULL && s->u.unblended!=NULL ) {
- int temp = UnblendedCompare((*t->u.unblended)[0],(*s->u.unblended)[0],instance_count);
- if ( temp==0 )
- swap = UnblendedCompare((*t->u.unblended)[1],(*s->u.unblended)[1],instance_count);
- else
- swap = temp<0;
- } else if ( t->start<s->start )
- swap=true;
- else if ( t->start>s->start )
- swap = false;
- else
- swap = (t->width<s->width);
- if ( swap ) {
- s->next = t->next;
- if ( pt==s ) {
- t->next = s;
- sn = s;
- } else {
- t->next = sn;
- pt->next = s;
- }
- if ( p==NULL )
- stem = t;
- else
- p->next = t;
- pt = s; /* swap s and t */
- s = t;
- t = pt;
- }
- }
- }
- /* Remove duplicates */
- if ( stem!=NULL ) for ( p=stem, s=stem->next; s!=NULL; s = sn ) {
- sn = s->next;
- if ( p->start==s->start && p->width==s->width && p->hintnumber==s->hintnumber ) {
- p->where = HIMerge(p->where,s->where);
- s->where = NULL;
- p->next = sn;
- StemInfoFree(s);
- } else
- p = s;
- }
- }
-return( stem );
-}
-
-real EITOfNextMajor(EI *e, EIList *el, real sought_m ) {
- /* We want to find t so that Mspline(t) = sought_m */
- /* the curve is monotonic */
- Spline1D *msp = &e->spline->splines[el->major];
- real new_t;
- real found_m;
- real t_mmax, t_mmin;
-
- if ( msp->a==0 && msp->b==0 ) {
- if ( msp->c == 0 ) {
- IError("Hor/Vert line when not expected");
-return( 0 );
- }
- new_t = (sought_m-msp->d)/(msp->c);
-return( new_t );
- }
-
- t_mmax = e->up?e->tmax:e->tmin;
- t_mmin = e->up?e->tmin:e->tmax;
- /* sought_m += el->low; */
-
- while ( 1 ) {
- new_t = (t_mmin+t_mmax)/2;
- found_m = ( ((msp->a*new_t+msp->b)*new_t+msp->c)*new_t + msp->d );
- if ( found_m>sought_m-.001 && found_m<sought_m+.001 )
-return( new_t );
- if ( found_m > sought_m ) {
- t_mmax = new_t;
- } else {
- t_mmin = new_t;
- }
- if ( t_mmax==t_mmin ) {
- IError("EITOfNextMajor failed! on %s", el->sc!=NULL?el->sc->name:"Unknown" );
-return( new_t );
- }
- }
-}
-
-EI *EIActiveListReorder(EI *active,int *change) {
- int any;
- EI *pr, *apt;
-
- *change = false;
- if ( active!=NULL ) {
- any = true;
- while ( any ) {
- any = false;
- for ( pr=NULL, apt=active; apt->aenext!=NULL; ) {
- if ( apt->ocur <= apt->aenext->ocur ) {
- /* still ordered */;
- pr = apt;
- apt = apt->aenext;
- } else if ( pr==NULL ) {
- active = apt->aenext;
- apt->aenext = apt->aenext->aenext;
- active->aenext = apt;
- *change = true;
- /* don't need to set any, since this reorder can't disorder the list */
- pr = active;
- } else {
- pr->aenext = apt->aenext;
- apt->aenext = apt->aenext->aenext;
- pr->aenext->aenext = apt;
- any = *change = true;
- pr = pr->aenext;
- }
- }
- }
- }
-return( active );
-}
-
-EI *EIActiveEdgesRefigure(EIList *el, EI *active,real i,int major, int *_change) {
- EI *apt, *pr, *npt;
- int change = false, subchange;
- int other = !major;
-
- /* first remove any entry which doesn't intersect the new scan line */
- /* (ie. stopped on last line) */
- for ( pr=NULL, apt=active; apt!=NULL; apt = apt->aenext ) {
- if ( apt->coordmax[major]<i+el->low ) {
- if ( pr==NULL )
- active = apt->aenext;
- else
- pr->aenext = apt->aenext;
- change = true;
- } else
- pr = apt;
- }
- /* then move the active list to the next line */
- for ( apt=active; apt!=NULL; apt = apt->aenext ) {
- Spline1D *osp = &apt->spline->splines[other];
- apt->tcur = EITOfNextMajor(apt,el,i+el->low);
- apt->ocur = ( ((osp->a*apt->tcur+osp->b)*apt->tcur+osp->c)*apt->tcur + osp->d );
- }
- /* reorder list */
- active = EIActiveListReorder(active,&subchange);
- if ( subchange ) change = true;
-
- /* Insert new nodes */
- if ( el->ordered[(int) i]!=NULL ) change = true;
- for ( pr=NULL, apt=active, npt=el->ordered[(int) i]; apt!=NULL && npt!=NULL; ) {
- if ( npt->ocur<apt->ocur ) {
- npt->aenext = apt;
- if ( pr==NULL )
- active = npt;
- else
- pr->aenext = npt;
- pr = npt;
- npt = npt->ordered;
- } else {
- pr = apt;
- apt = apt->aenext;
- }
- }
- while ( npt!=NULL ) {
- npt->aenext = NULL;
- if ( pr==NULL )
- active = npt;
- else
- pr->aenext = npt;
- pr = npt;
- npt = npt->ordered;
- }
- *_change = change;
-return( active );
-}
-
-
-int EISkipExtremum(EI *e, real i, int major) {
- EI *n = e->aenext, *t;
-
- if ( n==NULL )
-return( false );
- if (
- (ceil(e->coordmin[major])==i || floor(e->coordmin[major])==i || floor(e->coordmax[major])==i || ceil(e->coordmax[major])==i) &&
- (ceil(n->coordmin[major])==i || floor(n->coordmin[major])==i || floor(n->coordmax[major])==i || ceil(n->coordmax[major])==i) ) {
- if (
- (n==e->splinenext && n->tmin==e->tmax &&
- n->tcur<n->tmin+.2 && e->tcur>e->tmax-.2 ) ||
- (n->splinenext==e && n->tmax==e->tmin &&
- n->tcur>n->tmax-.2 && e->tcur<e->tmin+.2 ) )
-return( n->up!=e->up );
- /* can be separated by a horizontal/vertical line in the other direction */
- if ( n->tmax==1 && e->tmin==0 && n->tcur>.8 && e->tcur<.2) {
- t = n;
- while ( (t = t->splinenext)!=e ) {
- if ( t==NULL || t==n ||
- (major && !t->hor) || ( !major && !t->vert ))
-return( false );
- }
-return( n->up!=e->up );
- } else if ( n->tmin==0 && e->tmax==1 && n->tcur<.2 && e->tcur>.8) {
- t = e;
- while ( (t = t->splinenext)!=n ) {
- if ( t==NULL || t==e ||
- (major && !t->hor) || ( !major && !t->vert ))
-return( false );
- }
-return( n->up!=e->up );
- }
- }
-return( false );
-}
-
-
-real HIlen( StemInfo *stems) {
- HintInstance *hi;
- real len = 0;
-
- for ( hi=stems->where; hi!=NULL; hi = hi->next )
- len += hi->end-hi->begin;
-return( len );
-}
-
-real HIoverlap( HintInstance *mhi, HintInstance *thi) {
- HintInstance *hi;
- real len = 0;
- real s, e;
-
- for ( ; mhi!=NULL; mhi = mhi->next ) {
- for ( hi = thi; hi!=NULL && hi->begin<=mhi->end; hi = hi->next ) {
- if ( hi->end<mhi->begin ) {
- thi = hi;
- continue;
- }
- s = hi->begin<mhi->begin?mhi->begin:hi->begin;
- e = hi->end>mhi->end?mhi->end:hi->end;
- if ( e<s )
- continue; /* Shouldn't happen */
- len += e-s;
- }
- }
-return( len );
-}
-
-
-int StemListAnyConflicts(StemInfo *stems) {
- StemInfo *s;
- int any= false;
- double end;
-
- for ( s=stems; s!=NULL ; s=s->next )
- s->hasconflicts = false;
- while ( stems!=NULL ) {
- end = stems->width<0 ? stems->start : stems->start+stems->width;
- for ( s=stems->next; s!=NULL && (s->width>0 ? s->start : s->start+s->width)<end; s=s->next ) {
- stems->hasconflicts = true;
- s->hasconflicts = true;
- any = true;
- }
- stems = stems->next;
- }
-return( any );
-}
-
-static HintInstance *SCGuessHintPoints(SplineChar *sc, int layer, StemInfo *stem,int major, int off) {
- SplinePoint *starts[20], *ends[20];
- int spt=0, ept=0;
- SplinePointList *spl;
- SplinePoint *sp, *np;
- int sm, wm, i, j, val;
- real coord;
- HintInstance *head, *test, *cur, *prev;
-
- for ( spl=sc->layers[layer].splines; spl!=NULL; spl=spl->next ) {
- for ( sp=spl->first; ; sp = np ) {
- coord = (major?sp->me.x:sp->me.y);
- sm = coord>=stem->start-off && coord<=stem->start+off;
- wm = coord>=stem->start+stem->width-off && coord<=stem->start+stem->width+off;
- if ( sm && spt<20 )
- starts[spt++] = sp;
- if ( wm && ept<20 )
- ends[ept++] = sp;
- if ( sp->next==NULL )
- break;
- np = sp->next->to;
- if ( np==spl->first )
- break;
- }
- }
-
- head = NULL;
- for ( i=0; i<spt; ++i ) {
- val = 0x80000000;
- for ( j=0; j<ept; ++j ) {
- if ( major && starts[i]->me.y>=ends[j]->me.y-1 && starts[i]->me.y<=ends[j]->me.y+1 ) {
- val = starts[i]->me.y;
- break;
- } else if ( !major && starts[i]->me.x>=ends[j]->me.x-1 && starts[i]->me.x<=ends[j]->me.x+1 ) {
- val = starts[i]->me.x;
- break;
- }
- }
- if ( (unsigned)val!=0x80000000 ) {
- for ( prev=NULL, test=head; test!=NULL && val>test->begin; prev=test, test=test->next );
- if ( test==NULL || val!=test->begin ) {
- cur = chunkalloc(sizeof(HintInstance));
- cur->begin = cur->end = val;
- cur->next = test;
- if ( prev==NULL ) head = cur;
- else prev->next = cur;
- }
- }
- }
-return( head );
-}
-
-static void SCGuessHintInstancesLight(SplineChar *sc, int layer, StemInfo *stem,int major) {
- SplinePointList *spl;
- SplinePoint *sp, *np;
- int sm, wm, off;
- real ob, oe;
- HintInstance *s=NULL, *w=NULL, *cur, *p, *t, *n, *w2;
- /* We've got a hint (from somewhere, old data, reading in a font, user specified etc.) */
- /* but we don't have HintInstance info. So see if we can find those data */
- /* Will get confused by stems with holes in them (for example if you make */
- /* a hint from one side of an H to the other, it will get the whole thing */
- /* not just the cross stem) */
-
- for ( spl=sc->layers[layer].splines; spl!=NULL; spl=spl->next ) {
- for ( sp=spl->first; ; sp = np ) {
- sm = (major?sp->me.x:sp->me.y)==stem->start;
- wm = (major?sp->me.x:sp->me.y)==stem->start+stem->width;
- if ( sp->next==NULL )
- break;
- np = sp->next->to;
- if ( sm || wm ) {
- if ( !major ) {
- if ( np->me.y==sp->me.y ) {
- ob = sp->me.x; oe = np->me.x;
- } else if ( sp->nextcp.y==sp->me.y ) {
- ob = sp->me.x; oe = (sp->me.x+sp->nextcp.x)/2;
- if ( sp->prevcp.y==sp->me.y )
- ob = (sp->prevcp.x+sp->me.x)/2;
- } else if ( sp->prevcp.y==sp->me.y ) {
- ob = sp->me.x; oe = (sp->prevcp.x+sp->me.x)/2;
- } else
- sm = wm = false;
- } else {
- if ( np->me.x==sp->me.x ) {
- ob = sp->me.y; oe = np->me.y;
- } else if ( sp->nextcp.x==sp->me.x ) {
- ob = sp->me.y; oe = (sp->nextcp.y+sp->me.y)/2;
- if ( sp->prevcp.x==sp->me.x )
- ob = (sp->prevcp.y+sp->me.y)/2;
- } else if ( sp->prevcp.x==sp->me.x ) {
- ob = sp->me.y; oe = (sp->prevcp.y+sp->me.y)/2;
- } else
- sm = wm = false;
- }
- }
- if ( sm || wm ) {
- cur = chunkalloc(sizeof(HintInstance));
- if ( ob>oe ) { real temp=ob; ob=oe; oe=temp;}
- cur->begin = ob;
- cur->end = oe;
- if ( sm ) {
- if ( s==NULL || s->begin>cur->begin ) {
- cur->next = s;
- s = cur;
- } else {
- p = s;
- for ( t=s->next; t!=NULL && t->begin<cur->begin; p=t, t=t->next );
- p->next = cur; cur->next = t;
- }
- } else {
- if ( w==NULL || w->begin>cur->begin ) {
- cur->next = w;
- w = cur;
- } else {
- p = w;
- for ( t=w->next; t!=NULL && t->begin<cur->begin; p=t, t=t->next );
- p->next = cur; cur->next = t;
- }
- }
- }
- if ( np==spl->first )
- break;
- }
- }
-
- /* Now we know what the right side of the stem looks like, and we know */
- /* what the left side looks like. They may not look the same (H for example) */
- /* Figure out the set where both are active */
- /* Unless it's a ghost hint */
- if ( stem->width==20 && s==NULL && w!=NULL ) {
- s = w;
- w = NULL;
- } else if ( stem->width==21 && s!=NULL && w==NULL) {
- /* Just use s */;
- } else for ( p=NULL, t=s; t!=NULL; t=n ) {
- n = t->next;
- for ( w2=w; w2!=NULL && w2->begin<t->end ; w2=w2->next ) {
- if ( w2->end<=t->begin )
- continue;
- if ( w2->begin<=t->begin && w2->end>=t->end ) {
- /* Perfect match */
- break;
- }
- if ( w2->begin>=t->begin )
- t->begin = w2->begin;
- if ( w2->end<=t->end ) {
- cur = chunkalloc(sizeof(HintInstance));
- cur->begin = w2->end;
- cur->end = t->end;
- cur->next = n;
- t->next = cur;
- n = cur;
- t->end = w2->end;
- }
- break;
- }
- if ( w2!=NULL && w2->begin>=t->end )
- w2 = NULL;
- if ( w2==NULL && w!=NULL ) {
- HintInstance *best = NULL;
- double best_off=1e10, off;
- for ( w2=w; w2!=NULL ; w2=w2->next ) {
- if ( w2->end<=t->begin )
- off = t->begin - w2->end;
- else
- off = w2->begin - t->end;
- if ( best==NULL && off<best_off ) {
- best = w2;
- best_off = off;
- }
- }
- if ( best!=NULL && best_off<stem->width ) {
- w2 = best;
- if( w2->begin<t->begin )
- t->begin = w2->begin;
- if ( w2->end>t->end )
- t->end = w2->end;
- }
- }
- if ( w2==NULL ) {
- /* No match for t (or if there were it wasn't complete) get rid */
- /* of what's left of t */
- chunkfree(t,sizeof(*t));
- if ( p==NULL )
- s = n;
- else
- p->next = n;
- } else
- p = t;
- }
- while ( w!=NULL ) {
- n = w->next;
- chunkfree(w,sizeof(*w));
- w=n;
- }
-
- /* If we couldn't find anything, then see if there are two points which */
- /* have the same x or y value and whose other coordinates match those of */
- /* the hint */
- /* Surprisingly many fonts have hints which don't accurately match the */
- /* points. Perhaps BlueFuzz (default 1) applies here too */
- for ( off=0; off<1 && s==NULL; ++off )
- s = SCGuessHintPoints(sc,layer, stem,major,off);
-
- stem->where = s;
-}
-
-void SCGuessHHintInstancesList(SplineChar *sc,int layer) {
- StemInfo *h;
- for ( h= sc->hstem; h!=NULL; h=h->next ) {
- if ( h->where==NULL ) {
- SCGuessHintInstancesLight( sc,layer,h,false );
- }
- }
-}
-
-void SCGuessVHintInstancesList(SplineChar *sc,int layer) {
- StemInfo *h;
- for ( h= sc->vstem; h!=NULL; h=h->next ) {
- if ( h->where==NULL ) {
- SCGuessHintInstancesLight( sc,layer,h,true );
- }
- }
-}
-
-
-static void _SCClearHintMasks(SplineChar *sc,int layer, int counterstoo) {
- SplineSet *spl;
- SplinePoint *sp;
- RefChar *ref;
-
- if ( counterstoo ) {
- free(sc->countermasks);
- sc->countermasks = NULL; sc->countermask_cnt = 0;
- }
-
- for ( spl = sc->layers[layer].splines; spl!=NULL; spl=spl->next ) {
- for ( sp = spl->first ; ; ) {
- chunkfree(sp->hintmask,sizeof(HintMask));
- sp->hintmask = NULL;
- if ( sp->next==NULL )
- break;
- sp = sp->next->to;
- if ( sp==spl->first )
- break;
- }
- }
-
- for ( ref = sc->layers[layer].refs; ref!=NULL; ref=ref->next ) {
- for ( spl = ref->layers[0].splines; spl!=NULL; spl=spl->next ) {
- for ( sp = spl->first ; ; ) {
- chunkfree(sp->hintmask,sizeof(HintMask));
- sp->hintmask = NULL;
- if ( sp->next==NULL )
- break;
- sp = sp->next->to;
- if ( sp==spl->first )
- break;
- }
- }
- }
-}
-
-
-static void SCFigureSimpleCounterMasks(SplineChar *sc) {
- SplineChar *scs[MmMax];
- int hadh3, hadv3, i, vbase;
- HintMask mask;
- StemInfo *h;
-
- if ( sc->countermask_cnt!=0 )
-return;
-
- scs[0] = sc;
- hadh3 = CvtPsStem3(NULL,scs,1,true,false);
- hadv3 = CvtPsStem3(NULL,scs,1,false,false);
- if ( hadh3 || hadv3 ) {
- memset(mask,0,sizeof(mask));
- if ( hadh3 ) mask[0] = 0x80|0x40|0x20;
- if ( hadv3 ) {
- for ( h=sc->hstem, vbase=0; h!=NULL; h=h->next, ++vbase );
- for ( i=0; i<3 ; ++i ) {
- int j = i+vbase;
- mask[j>>3] |= (0x80>>(j&7));
- }
- }
- sc->countermask_cnt = 1;
- sc->countermasks = galloc(sizeof(HintMask));
- memcpy(sc->countermasks[0],mask,sizeof(HintMask));
-return;
- }
-}
-
-void SCClearHintMasks(SplineChar *sc,int layer,int counterstoo) {
- MMSet *mm = sc->parent->mm;
- int i;
-
- if ( mm==NULL )
- _SCClearHintMasks(sc,layer,counterstoo);
- else {
- for ( i=0; i<mm->instance_count; ++i ) {
- if ( sc->orig_pos<mm->instances[i]->glyphcnt )
- _SCClearHintMasks(mm->instances[i]->glyphs[sc->orig_pos],layer,counterstoo);
- }
- if ( sc->orig_pos<mm->normal->glyphcnt )
- _SCClearHintMasks(mm->normal->glyphs[sc->orig_pos],layer,counterstoo);
- }
-}
-
-static StemInfo *OnHHint(SplinePoint *sp, StemInfo *s) {
- StemInfo *possible=NULL;
- HintInstance *hi;
-
- if ( sp==NULL )
-return( NULL );
-
- for ( ; s!=NULL; s=s->next ) {
- if ( sp->me.y<s->start )
-return( possible );
- if ( s->start==sp->me.y || s->start+s->width==sp->me.y ) {
- if ( !s->hasconflicts )
-return( s );
- for ( hi=s->where; hi!=NULL; hi=hi->next ) {
- if ( hi->begin<=sp->me.x && hi->end>=sp->me.x )
-return( s );
- }
- if ( !s->used )
- possible = s;
- }
- }
-return( possible );
-}
-
-static StemInfo *OnVHint(SplinePoint *sp, StemInfo *s) {
- StemInfo *possible=NULL;
- HintInstance *hi;
-
- if ( sp==NULL )
-return( NULL );
-
- for ( ; s!=NULL; s=s->next ) {
- if ( sp->me.x<s->start )
-return( possible );
- if ( s->start==sp->me.x || s->start+s->width==sp->me.x ) {
- if ( !s->hasconflicts )
-return( s );
- for ( hi=s->where; hi!=NULL; hi=hi->next ) {
- if ( hi->begin<=sp->me.y && hi->end>=sp->me.y )
-return( s );
- }
- if ( !s->used )
- possible = s;
- }
- }
-return( possible );
-}
-
-/* Does h have a conflict with any of the stems in the list which have bits */
-/* set in the mask */
-static int ConflictsWithMask(StemInfo *stems, HintMask mask,StemInfo *h) {
- while ( stems!=NULL && stems->start<h->start+h->width ) {
- if ( stems->start+stems->width>=h->start && stems!=h ) {
- if ( stems->hintnumber!=-1 &&
- (mask[stems->hintnumber>>3]&(0x80>>(stems->hintnumber&7))) )
-return( true );
- }
- stems = stems->next;
- }
-return( false );
-}
-
-/* All instances of a MM set must have the same hint mask at all points */
-static void FigureHintMask(SplineChar *scs[MmMax], SplinePoint *to[MmMax], int instance_count,
- HintMask mask) {
- StemInfo *s;
- int i;
- SplinePoint *sp;
-
- memset(mask,'\0',sizeof(HintMask));
-
- /* Install all hints that are always active */
- i=0; {
- SplineChar *sc = scs[i];
-
- if ( sc==NULL )
-return;
-
- for ( s=sc->hstem; s!=NULL; s=s->next )
- if ( s->hintnumber!=-1 && !s->hasconflicts )
- mask[s->hintnumber>>3] |= (0x80>>(s->hintnumber&7));
- for ( s=sc->vstem; s!=NULL; s=s->next )
- if ( s->hintnumber!=-1 && !s->hasconflicts )
- mask[s->hintnumber>>3] |= (0x80>>(s->hintnumber&7));
-
- if ( sc->hconflicts ) {
- for ( sp=to[i]; sp!=NULL; ) {
- s = OnHHint(sp,sc->hstem);
- if ( s!=NULL && s->hintnumber!=-1 ) {
- if ( ConflictsWithMask(scs[i]->hstem,mask,s))
- break;
- mask[s->hintnumber>>3] |= (0x80>>(s->hintnumber&7));
- }
- if ( sp->next==NULL )
- break;
- sp = sp->next->to;
- if ( to[i]==sp )
- break;
- }
- }
- if ( sc->vconflicts ) {
- for ( sp=to[i]; sp!=NULL; ) {
- s = OnVHint(sp,sc->vstem);
- if ( s!=NULL && s->hintnumber!=-1 ) {
- if ( ConflictsWithMask(scs[i]->vstem,mask,s))
- break;
- mask[s->hintnumber>>3] |= (0x80>>(s->hintnumber&7));
- }
- if ( sp->next==NULL )
- break;
- sp = sp->next->to;
- if ( to[i]==sp )
- break;
- }
- }
- }
- for ( i=0; i<instance_count; ++i ) if ( to[i]!=NULL ) {
- chunkfree(to[i]->hintmask,sizeof(HintMask));
- to[i]->hintmask = chunkalloc(sizeof(HintMask));
- memcpy(to[i]->hintmask,mask,sizeof(HintMask));
- }
-}
-
-static int TestHintMask(SplineChar *scs[MmMax], SplinePoint *to[MmMax], int instance_count,
- HintMask mask) {
- StemInfo *h=NULL, *v=NULL;
- int i;
-
- for ( i=0; i<instance_count; ++i ) {
- SplineChar *sc = scs[i];
-
- if ( sc==NULL || (!sc->hconflicts && !sc->vconflicts ))
- continue;
-
- /* Does this point lie on any hints? */
- if ( scs[i]->hconflicts )
- h = OnHHint(to[i],sc->hstem);
- if ( scs[i]->vconflicts )
- v = OnVHint(to[i],sc->vstem);
-
- /* Need to set this hint */
- if ( (h!=NULL && h->hintnumber!=-1 && (mask[h->hintnumber>>3]&(0x80>>(h->hintnumber&7)))==0 ) ||
- (v!=NULL && v->hintnumber!=-1 && (mask[v->hintnumber>>3]&(0x80>>(v->hintnumber&7)))==0 ))
- break;
- }
- if ( i==instance_count ) /* All hint masks were ok */
-return( false );
-
- FigureHintMask(scs,to,instance_count,mask);
-return( true );
-}
-
-static void UnnumberHints(SplineChar *sc) {
- StemInfo *h;
-
- for ( h=sc->hstem; h!=NULL; h=h->next )
- h->hintnumber = -1;
- for ( h=sc->vstem; h!=NULL; h=h->next )
- h->hintnumber = -1;
-}
-
-static int NumberHints(SplineChar *sc) {
- StemInfo *h;
- int hcnt=0;
-
- for ( h=sc->hstem; h!=NULL; h=h->next )
- h->hintnumber = hcnt>=HntMax ? -1 : hcnt++;
- for ( h=sc->vstem; h!=NULL; h=h->next )
- h->hintnumber = hcnt>=HntMax ? -1 : hcnt++;
-return( hcnt );
-}
-
-static void UntickHints(SplineChar *sc) {
- StemInfo *h;
-
- for ( h=sc->hstem; h!=NULL; h=h->next )
- h->used = false;
- for ( h=sc->vstem; h!=NULL; h=h->next )
- h->used = false;
-}
-
-struct coords {
- real coords[MmMax];
- struct coords *next;
-};
-
-typedef struct mmh {
- StemInfo *hints[MmMax], *map[MmMax];
- struct coords *where;
- struct mmh *next;
-} MMH;
-
-static void AddCoord(MMH *mmh,SplinePoint *sps[MmMax],int instance_count, int ish) {
- struct coords *coords;
- int i;
-
- coords = chunkalloc(sizeof(struct coords));
- coords->next = mmh->where;
- mmh->where = coords;
- if ( ish )
- for ( i=0; i<instance_count; ++i )
- coords->coords[i] = sps[i]->me.x;
- else
- for ( i=0; i<instance_count; ++i )
- coords->coords[i] = sps[i]->me.y;
-}
-
-static MMH *AddHintSet(MMH *hints,StemInfo *h[MmMax], int instance_count,
- SplinePoint *sps[MmMax], int ish) {
- int i, cnt, bestc;
- MMH *test, *best;
-
- for ( i=0; i<instance_count; ++i )
- if ( h[i]==NULL )
-return( hints );
-
- best = NULL; bestc = 0;
- for ( test=hints; test!=NULL; test=test->next ) {
- cnt = 0;
- for ( i=0; i<instance_count; ++i )
- if ( test->hints[i]==h[i] )
- ++cnt;
- if ( cnt==instance_count ) {
- AddCoord(test,sps,instance_count,ish);
-return( hints );
- }
- if ( cnt>bestc ) {
- bestc = cnt;
- best = test;
- }
- }
- test = chunkalloc(sizeof(MMH));
- test->next = hints;
- AddCoord(test,sps,instance_count,ish);
- for ( i=0; i<instance_count; ++i )
- test->hints[i]=h[i];
- if ( bestc!=0 ) {
- for ( i=0; i<instance_count; ++i ) {
- if ( best->hints[i]==h[i] ) {
- h[i]->hasconflicts = true;
- test->map[i] = chunkalloc(sizeof(StemInfo));
- *test->map[i] = *h[i];
- test->map[i]->where = NULL;
- test->map[i]->used = true;
- h[i]->next = test->map[i];
- } else
- test->map[i] = h[i];
- }
- } else {
- for ( i=0; i<instance_count; ++i )
- test->map[i]=h[i];
- }
-return( test );
-}
-
-static int CompareMMH(MMH *mmh1,MMH *mmh2, int instance_count) {
- int i;
-
- if ( mmh1->map[0]==NULL )
-return( 1 );
- if ( mmh2->map[0]==NULL )
-return( -1 );
-
- for ( i=0; i<instance_count; ++i ) {
- if ( mmh1->map[i]->start!=mmh2->map[i]->start ) {
- if ( mmh1->map[i]->start > mmh2->map[i]->start )
-return( 1 );
- else
-return( -1 );
- }
- }
- for ( i=0; i<instance_count; ++i ) {
- if ( mmh1->map[i]->width!=mmh2->map[i]->width ) {
- if ( mmh1->map[i]->width > mmh2->map[i]->width )
-return( 1 );
- else
-return( -1 );
- }
- }
-return( 0 );
-}
-
-static MMH *SortMMH(MMH *head,int instance_count) {
- MMH *mmh, *p, *smallest, *psmallest, *test, *ptest;
-
- for ( mmh = head, p=NULL; mmh!=NULL ; ) {
- smallest = mmh; psmallest = p;
- ptest = mmh; test = mmh->next;
- while ( test!=NULL ) {
- if ( CompareMMH(test,smallest,instance_count)<0 ) {
- smallest = test;
- psmallest = ptest;
- }
- ptest = test;
- test = test->next;
- }
- if ( smallest!=mmh ) {
- if ( p==NULL )
- head = smallest;
- else
- p->next = smallest;
- if ( mmh->next==smallest ) {
- mmh->next = smallest->next;
- smallest->next = mmh;
- } else {
- test = mmh->next;
- mmh->next = smallest->next;
- smallest->next = test;
- psmallest->next = mmh;
- }
- }
- p = smallest;
- mmh = smallest->next;
- }
-return( head );
-}
-
-static int NumberMMH(MMH *mmh,int hstart,int instance_count) {
- int i;
- HintInstance *hi, *n;
- struct coords *coords;
-
- while ( mmh!=NULL ) {
- for ( i=0; i<instance_count; ++i ) {
- StemInfo *h = mmh->map[i];
- if ( h==NULL )
- continue;
-
- h->hintnumber = hstart;
-
- for ( hi=h->where; hi!=NULL; hi=n ) {
- n = hi->next;
- chunkfree(hi,sizeof(HintInstance));
- }
- h->where = NULL;
- for ( coords=mmh->where; coords!=NULL; coords = coords->next ) {
- hi = chunkalloc(sizeof(HintInstance));
- hi->next = h->where;
- h->where = hi;
- hi->begin = coords->coords[i]-1;
- hi->end = coords->coords[i]+1;
- }
- }
- if ( mmh->map[0]!=NULL ) ++hstart;
- mmh = mmh->next;
- }
-return( hstart );
-}
-
-static void SortMMH2(SplineChar *scs[MmMax],MMH *mmh,int instance_count,int ish) {
- int i;
- StemInfo *h, *n;
- MMH *m;
-
- for ( i=0; i<instance_count; ++i ) {
- for ( h= ish ? scs[i]->hstem : scs[i]->vstem; h!=NULL; h=n ) {
- n = h->next;
- if ( h->hintnumber==-1 )
- StemInfoFree(h);
- }
- n = NULL;
- for ( m = mmh ; m!=NULL; m=m->next ) {
- h = m->map[i];
- if ( n!=NULL )
- n->next = h;
- else if ( ish )
- scs[i]->hstem = h;
- else
- scs[i]->vstem = h;
- n = h;
- }
- if ( n!=NULL )
- n->next = NULL;
- else if ( ish )
- scs[i]->hstem = NULL;
- else
- scs[i]->vstem = NULL;
- }
-}
-
-static void MMHFreeList(MMH *mmh) {
- MMH *mn;
- struct coords *c, *n;
-
- for ( ; mmh!=NULL; mmh = mn ) {
- mn = mmh->next;
- for ( c=mmh->where; c!=NULL; c=n ) {
- n = c->next;
- chunkfree(c,sizeof(struct coords));
- }
- chunkfree(mmh,sizeof(struct coords));
- }
-}
-
-static void SplResolveSplitHints(SplineChar *scs[MmMax], SplineSet *spl[MmMax],
- int instance_count, MMH **hs, MMH **vs) {
- SplinePoint *to[MmMax];
- StemInfo *h[MmMax], *v[MmMax];
- int i, anymore;
-
- forever {
- for ( i=0; i<instance_count; ++i ) {
- if ( spl[i]!=NULL )
- to[i] = spl[i]->first;
- else
- to[i] = NULL;
- }
- forever {
- for ( i=0; i<instance_count; ++i ) {
- h[i] = OnHHint(to[i],scs[i]->hstem);
- v[i] = OnVHint(to[i],scs[i]->vstem);
- }
- *hs = AddHintSet(*hs,h,instance_count,to,true);
- *vs = AddHintSet(*vs,v,instance_count,to,false);
- anymore = false;
- for ( i=0; i<instance_count; ++i ) if ( to[i]!=NULL ) {
- if ( to[i]->next==NULL ) to[i] = NULL;
- else {
- to[i] = to[i]->next->to;
- if ( to[i]==spl[i]->first ) to[i] = NULL;
- }
- if ( to[i]!=NULL ) anymore = true;
- }
- if ( !anymore )
- break;
- }
- anymore = false;
- for ( i=0; i<instance_count; ++i ) {
- if ( spl[i]!=NULL )
- spl[i] = spl[i]->next;
- if ( spl[i]!=NULL ) anymore = true;
- }
- if ( !anymore )
- break;
- }
-}
-
-static void ResolveSplitHints(SplineChar *scs[16],int layer,int instance_count) {
- /* It is possible for a single hint in one mm instance to split into two */
- /* in a different MM set. For example, we have two stems which happen */
- /* to line up in one instance but which do not in another instance. */
- /* It is even possible that there could be no instance with any conflicts */
- /* but some of the intermediate forms might conflict. */
- /* We can't deal (nor can postscript) with the case where hints change order*/
- SplinePointList *spl[MmMax];
- RefChar *ref[MmMax];
- int i, hcnt, hmax=0, anymore;
- MMH *hs=NULL, *vs=NULL;
-
- for ( i=0; i<instance_count; ++i ) {
- hcnt = NumberHints(scs[i]);
- UntickHints(scs[i]);
- if ( hcnt>hmax ) hmax = hcnt;
- spl[i] = scs[i]->layers[layer].splines;
- }
- if ( hmax==0 )
-return;
-
- SplResolveSplitHints(scs,spl,instance_count,&hs,&vs);
- anymore = false;
- for ( i=0; i<instance_count; ++i ) {
- ref[i] = scs[i]->layers[layer].refs;
- if ( ref[i]!=NULL ) anymore = true;
- }
- while ( anymore ) {
- for ( i=0; i<instance_count; ++i )
- spl[i] = ( ref[i]!=NULL ) ? ref[i]->layers[0].splines : NULL;
- SplResolveSplitHints(scs,spl,instance_count,&hs,&vs);
- anymore = false;
- for ( i=0; i<instance_count; ++i ) {
- if ( ref[i]!=NULL ) {
- ref[i] = ref[i]->next;
- if ( ref[i]!=NULL ) anymore = true;
- }
- }
- }
-
- for ( i=0; i<instance_count; ++i )
- UnnumberHints(scs[i]);
- hs = SortMMH(hs,instance_count);
- vs = SortMMH(vs,instance_count);
- hcnt = NumberMMH(hs,0,instance_count);
- hcnt = NumberMMH(vs,hcnt,instance_count);
- SortMMH2(scs,hs,instance_count,true);
- SortMMH2(scs,vs,instance_count,false);
- MMHFreeList(hs);
- MMHFreeList(vs);
-}
-
-static int SplFigureHintMasks(SplineChar *scs[MmMax], SplineSet *spl[MmMax],
- int instance_count, HintMask mask, int inited) {
- SplinePoint *to[MmMax];
- int i, anymore;
-
- anymore = false;
- for ( i=0; i<instance_count; ++i ) {
- if ( spl[i]!=NULL ) {
- SplineSetReverse(spl[i]);
- to[i] = spl[i]->first;
- anymore = true;
- } else
- to[i] = NULL;
- }
-
- /* Assign the initial hint mask */
- if ( anymore && !inited ) {
- FigureHintMask(scs,to,instance_count,mask);
- inited = true;
- }
-
- forever {
- for ( i=0; i<instance_count; ++i ) {
- if ( spl[i]!=NULL )
- to[i] = spl[i]->first;
- else
- to[i] = NULL;
- }
- forever {
- TestHintMask(scs,to,instance_count,mask);
- anymore = false;
- for ( i=0; i<instance_count; ++i ) if ( to[i]!=NULL ) {
- if ( to[i]->next==NULL ) to[i] = NULL;
- else {
- to[i] = to[i]->next->to;
- if ( to[i]==spl[i]->first ) to[i] = NULL;
- }
- if ( to[i]!=NULL ) anymore = true;
- }
- if ( !anymore )
- break;
- }
- anymore = false;
- for ( i=0; i<instance_count; ++i ) {
- if ( spl[i]!=NULL ) {
- SplineSetReverse(spl[i]);
- spl[i] = spl[i]->next;
- }
- if ( spl[i]!=NULL ) {
- anymore = true;
- SplineSetReverse(spl[i]);
- }
- }
- if ( !anymore )
- break;
- }
-return( inited );
-}
-
-void SCFigureHintMasks(SplineChar *sc,int layer) {
- SplineChar *scs[MmMax];
- SplinePointList *spl[MmMax];
- RefChar *ref[MmMax];
- MMSet *mm = sc->parent->mm;
- int i, instance_count, conflicts, anymore, inited;
- HintMask mask;
-
- if ( mm==NULL ) {
- scs[0] = sc;
- instance_count = 1;
- SCClearHintMasks(sc,layer,false);
- } else {
- instance_count = mm->instance_count;
- for ( i=0; i<instance_count; ++i )
- if ( sc->orig_pos < mm->instances[i]->glyphcnt ) {
- scs[i] = mm->instances[i]->glyphs[sc->orig_pos];
- SCClearHintMasks(scs[i],layer,false);
- }
- ResolveSplitHints(scs,layer,instance_count);
- }
- conflicts = false;
- for ( i=0; i<instance_count; ++i ) {
- NumberHints(scs[i]);
- if ( scs[i]->hconflicts || scs[i]->vconflicts )
- conflicts = true;
- }
- if ( !conflicts && instance_count==1 ) { /* All hints always active */
- SCFigureSimpleCounterMasks(sc);
-return; /* In an MM font we may still need to resolve things like different numbers of hints */
- }
-
- for ( i=0; i<instance_count; ++i ) {
- spl[i] = scs[i]->layers[layer].splines;
- ref[i] = scs[i]->layers[layer].refs;
- }
- inited = SplFigureHintMasks(scs,spl,instance_count,mask,false);
- forever {
- for ( i=0; i<instance_count; ++i ) {
- if ( ref[i]!=NULL )
- spl[i] = ref[i]->layers[0].splines;
- }
- inited = SplFigureHintMasks(scs,spl,instance_count,mask,inited);
- anymore = false;
- for ( i=0; i<instance_count; ++i ) {
- if ( ref[i]!=NULL ) {
- ref[i] = ref[i]->next;
- if ( ref[i]!=NULL ) anymore = true;
- }
- }
- if ( !anymore )
- break;
- }
- if ( instance_count==1 )
- SCFigureSimpleCounterMasks(sc);
-}
-
-
-
-static void FigureStems( SplineFont *sf, real snaps[12], real cnts[12],
- int which ) {
- int i, j, k, cnt, smax=0, smin=2000;
- real stemwidths[2000];
- StemInfo *stems, *test;
- int len;
- HintInstance *hi;
-
- memset(stemwidths,'\0',sizeof(stemwidths));
-
- for ( i=0; i<sf->glyphcnt; ++i ) if ( sf->glyphs[i]!=NULL ) {
- stems = which?sf->glyphs[i]->hstem:sf->glyphs[i]->vstem;
- for ( test=stems; test!=NULL; test = test->next ) if ( !test->ghost ) {
- if ( (j=test->width)<0 ) j= -j;
- if ( j<2000 ) {
- len = 0;
- for ( hi=test->where; hi!=NULL; hi=hi->next )
- len += hi->end-hi->begin;
- if ( len==0 ) len = 100;
- stemwidths[j] += len;
- if ( smax<j ) smax=j;
- if ( smin>j ) smin=j;
- }
- }
- }
-
- for ( i=smin, cnt=0; i<=smax; ++i ) {
- if ( stemwidths[i]!=0 )
- ++cnt;
- }
-
- if ( cnt>12 ) {
- /* Merge width windows */
- int windsize=3, j;
- for ( i=smin; i<=smax; ++i ) if ( stemwidths[i]!=0 ) {
- if ( (j = i-windsize)<0 ) j=0;
- for ( ; j<smax && j<=i+windsize; ++j )
- if ( stemwidths[i]<stemwidths[j] )
- break;
- if ( j==smax || j>i+windsize ) {
- if ( (j = i-windsize)<0 ) j=0;
- for ( ; j<smax && j<=i+windsize; ++j ) if ( j!=i ) {
- stemwidths[i] += stemwidths[j];
- stemwidths[j] = 0;
- }
- }
- }
- /* Merge adjacent widths */
- for ( i=smin; i<=smax; ++i ) {
- if ( stemwidths[i]!=0 && i<=smax-1 && stemwidths[i+1]!=0 ) {
- if ( stemwidths[i]>stemwidths[i+1] ) {
- stemwidths[i] += stemwidths[i+1];
- stemwidths[i+1] = 0;
- } else {
- if ( i<=smax-2 && stemwidths[i+2] && stemwidths[i+2]<stemwidths[i+1] ) {
- stemwidths[i+1] += stemwidths[i+2];
- stemwidths[i+2] = 0;
- }
- stemwidths[i+1] += stemwidths[i];
- stemwidths[i] = 0;
- ++i;
- }
- }
- }
- for ( i=smin, cnt=0; i<=smax; ++i ) {
- if ( stemwidths[i]!=0 )
- ++cnt;
- }
- }
- if ( cnt<=12 ) {
- for ( i=smin, cnt=0; i<=smax; ++i ) {
- if ( stemwidths[i]!=0 ) {
- snaps[cnt] = i;
- cnts[cnt++] = stemwidths[i];
- }
- }
- } else { real firstbiggest=0;
- for ( cnt = 0; cnt<12; ++cnt ) {
- int biggesti=0;
- real biggest=0;
- for ( i=smin; i<=smax; ++i ) {
- if ( stemwidths[i]>biggest ) { biggest = stemwidths[i]; biggesti=i; }
- }
- /* array must be sorted */
- if ( biggest<firstbiggest/6 )
- break;
- for ( j=0; j<cnt; ++j )
- if ( snaps[j]>biggesti )
- break;
- for ( k=cnt-1; k>=j; --k ) {
- snaps[k+1] = snaps[k];
- cnts[k+1]=cnts[k];
- }
- snaps[j] = biggesti;
- cnts[j] = biggest;
- stemwidths[biggesti] = 0;
- if ( firstbiggest==0 ) firstbiggest = biggest;
- }
- }
- for ( ; cnt<12; ++cnt ) {
- snaps[cnt] = 0;
- cnts[cnt] = 0;
- }
-}
-
-void FindHStems( SplineFont *sf, real snaps[12], real cnt[12]) {
- FigureStems(sf,snaps,cnt,1);
-}
-
-void FindVStems( SplineFont *sf, real snaps[12], real cnt[12]) {
- FigureStems(sf,snaps,cnt,0);
-}
-
-static int IsFlexSmooth(SplinePoint *sp) {
- BasePoint nvec, pvec;
- double proj_same, proj_normal;
-
- if ( sp->nonextcp || sp->noprevcp )
-return( false ); /* No continuity of slopes */
-
- nvec.x = sp->nextcp.x - sp->me.x; nvec.y = sp->nextcp.y - sp->me.y;
- pvec.x = sp->me.x - sp->prevcp.x; pvec.y = sp->me.y - sp->prevcp.y;
-
- /* Avoid cases where the slopes are 180 out of phase */
- if ( (proj_same = nvec.x*pvec.x + nvec.y*pvec.y)<=0 )
-return( false );
- if ( (proj_normal = nvec.x*pvec.y - nvec.y*pvec.x)<0 )
- proj_normal = -proj_normal;
-
- /* Something is smooth if the normal projection is 0. Let's allow for */
- /* some rounding errors */
- if ( proj_same >= 16*proj_normal )
-return( true );
-
-return( false );
-}
-
-static int _SplineCharIsFlexible(SplineChar *sc, int layer, int blueshift) {
- /* Need two splines
- outer endpoints have same x (or y) values
- inner point must be less than 20 horizontal (v) units from the outer points
- inner point must also be less than BlueShift units (defaults to 7=>6)
- (can increase BlueShift up to 21)
- the inner point must be a local extremum
- the inner point's cps must be at the x (or y) value as the extremum
- (I think)
- */
- /* We want long, nearly straight stems. If the end-points should not have
- continuous slopes, or if they do, they must be horizontal/vertical.
- This is an heuristic requirement, not part of Adobe's spec.
- */
- SplineSet *spl;
- SplinePoint *sp, *np, *pp;
- int max=0, val;
- RefChar *r;
-
- if ( sc==NULL )
-return(false);
-
- for ( spl = sc->layers[layer].splines; spl!=NULL; spl=spl->next ) {
- if ( spl->first->prev==NULL ) {
- /* Mark everything on the open path as inflexible */
- sp=spl->first;
- while ( 1 ) {
- sp->flexx = sp->flexy = false;
- if ( sp->next==NULL )
- break;
- sp = sp->next->to;
- }
- continue; /* Ignore open paths */
- }
- sp=spl->first;
- do {
- if ( sp->next==NULL || sp->prev==NULL )
- break;
- np = sp->next->to;
- pp = sp->prev->from;
- if ( !pp->flexx && !pp->flexy ) {
- sp->flexy = sp->flexx = 0;
- val = 0;
- if ( RealNear(sp->nextcp.x,sp->me.x) &&
- RealNear(sp->prevcp.x,sp->me.x) &&
- RealNear(np->me.x,pp->me.x) &&
- !RealNear(np->me.x,sp->me.x) &&
- (!IsFlexSmooth(pp) || RealNear(pp->nextcp.x,pp->me.x)) &&
- (!IsFlexSmooth(np) || RealNear(np->prevcp.x,np->me.x)) &&
- np->me.x-sp->me.x < blueshift &&
- np->me.x-sp->me.x > -blueshift ) {
- if ( (np->me.x>sp->me.x &&
- np->prevcp.x<=np->me.x && np->prevcp.x>=sp->me.x &&
- pp->nextcp.x<=pp->me.x && pp->prevcp.x>=sp->me.x ) ||
- (np->me.x<sp->me.x &&
- np->prevcp.x>=np->me.x && np->prevcp.x<=sp->me.x &&
- pp->nextcp.x>=pp->me.x && pp->prevcp.x<=sp->me.x )) {
- sp->flexx = true;
- val = np->me.x-sp->me.x;
- }
- }
- if ( RealNear(sp->nextcp.y,sp->me.y) &&
- RealNear(sp->prevcp.y,sp->me.y) &&
- RealNear(np->me.y,pp->me.y) &&
- !RealNear(np->me.y,sp->me.y) &&
- (!IsFlexSmooth(pp) || RealNear(pp->nextcp.y,pp->me.y)) &&
- (!IsFlexSmooth(np) || RealNear(np->prevcp.y,np->me.y)) &&
- np->me.y-sp->me.y < blueshift &&
- np->me.y-sp->me.y > -blueshift ) {
- if ( (np->me.y>sp->me.y &&
- np->prevcp.y<=np->me.y && np->prevcp.y>=sp->me.y &&
- pp->nextcp.y<=pp->me.y && pp->nextcp.y>=sp->me.y ) ||
- (np->me.y<sp->me.y &&
- np->prevcp.y>=np->me.y && np->prevcp.y<=sp->me.y &&
- pp->nextcp.y>=pp->me.y && pp->nextcp.y<=sp->me.y )) {
- sp->flexy = true;
- val = np->me.y-sp->me.y;
- }
- }
- if ( val<0 ) val = -val;
- if ( val>max ) max = val;
- }
- sp = np;
- } while ( sp!=spl->first );
- }
- sc->layers[layer].anyflexes = max>0;
- if ( max==0 )
- for ( r = sc->layers[layer].refs; r!=NULL ; r=r->next )
- if ( r->sc->layers[layer].anyflexes ) {
- sc->layers[layer].anyflexes = true;
- break;
- }
-return( max );
-}
-
-
-
-static void SCUnflex(SplineChar *sc, int layer) {
- SplineSet *spl;
- SplinePoint *sp;
-
- for ( spl = sc->layers[layer].splines; spl!=NULL; spl=spl->next ) {
- /* Mark everything on the path as inflexible */
- sp=spl->first;
- while ( 1 ) {
- sp->flexx = sp->flexy = false;
- if ( sp->next==NULL )
- break;
- sp = sp->next->to;
- if ( sp==spl->first )
- break;
- }
- }
- sc->layers[layer].anyflexes = false;
-}
-
-static void FlexDependents(SplineChar *sc,int layer) {
- struct splinecharlist *scl;
-
- sc->layers[layer].anyflexes = true;
- for ( scl = sc->dependents; scl!=NULL; scl=scl->next )
- FlexDependents(scl->sc,layer);
-}
-
-int SplineFontIsFlexible(SplineFont *sf,int layer, int flags) {
- int i;
- int max=0, val;
- char *pt;
- int blueshift;
- /* if the return value is bigger than 6 and we don't have a BlueShift */
- /* then we must set BlueShift to ret+1 before saving private dictionary */
- /* If the first point in a spline set is flexible, then we must rotate */
- /* the splineset */
-
- if ( flags&(ps_flag_nohints|ps_flag_noflex)) {
- for ( i=0; i<sf->glyphcnt; ++i ) if ( sf->glyphs[i]!=NULL )
- SCUnflex(sf->glyphs[i],layer);
-return( 0 );
- }
-
- pt = PSDictHasEntry(sf->private,"BlueShift");
- blueshift = 21; /* maximum posible flex, not default */
- if ( pt!=NULL ) {
- blueshift = strtol(pt,NULL,10);
- if ( blueshift>21 ) blueshift = 21;
- } else if ( PSDictHasEntry(sf->private,"BlueValues")!=NULL )
- blueshift = 7; /* The BlueValues array may depend on BlueShift having its default value */
-
- for ( i=0; i<sf->glyphcnt; ++i )
- if ( sf->glyphs[i]!=NULL ) if ( sf->glyphs[i]!=NULL ) {
- val = _SplineCharIsFlexible(sf->glyphs[i],layer,blueshift);
- if ( val>max ) max = val;
- if ( sf->glyphs[i]->layers[layer].anyflexes )
- FlexDependents(sf->glyphs[i],layer);
- }
-return( max );
-}
-
-
diff --git a/Build/source/texk/web2c/luatexdir/luafontloader/fontforge/fontforge/baseviews.h b/Build/source/texk/web2c/luatexdir/luafontloader/fontforge/fontforge/baseviews.h
deleted file mode 100644
index 530542634b0..00000000000
--- a/Build/source/texk/web2c/luatexdir/luafontloader/fontforge/fontforge/baseviews.h
+++ /dev/null
@@ -1,541 +0,0 @@
-/* Copyright (C) 2000-2008 by George Williams */
-/*
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are met:
-
- * Redistributions of source code must retain the above copyright notice, this
- * list of conditions and the following disclaimer.
-
- * Redistributions in binary form must reproduce the above copyright notice,
- * this list of conditions and the following disclaimer in the documentation
- * and/or other materials provided with the distribution.
-
- * The name of the author may not be used to endorse or promote products
- * derived from this software without specific prior written permission.
-
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
- * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
- * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
- * EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
- * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
- * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
- * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
- * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-#ifndef _BASEVIEWS_H
-#define _BASEVIEWS_H
-
-/* cross-compiler woes */
-#if defined (small)
-#undef small
-#endif
-
-#include "splinefont.h"
-
-enum widthtype { wt_width, wt_lbearing, wt_rbearing, wt_vwidth };
-
-enum fvtrans_flags { fvt_dobackground=1, fvt_round_to_int=2,
- fvt_dontsetwidth=4, fvt_dontmovewidth=8, fvt_scalekernclasses=0x10,
- fvt_scalepstpos=0x20, fvt_dogrid=0x40, fvt_partialreftrans=0x80 };
-
-typedef struct drect {
- real x, y;
- real width, height;
-} DRect;
-
-/* Note: These are ordered as they are displayed in the tools palette */
-enum cvtools { cvt_pointer, cvt_magnify,
- cvt_freehand, cvt_hand,
- cvt_curve, cvt_hvcurve,
- cvt_corner, cvt_tangent,
- cvt_pen, cvt_spiro,
- cvt_knife, cvt_ruler,
- cvt_scale, cvt_flip,
- cvt_rotate, cvt_skew,
- cvt_3d_rotate, cvt_perspective,
- cvt_rect, cvt_poly,
- cvt_elipse, cvt_star,
- cvt_minify, cvt_max=cvt_minify,
- cvt_none = -1,
- cvt_spirog4=cvt_curve, cvt_spirog2=cvt_hvcurve,
- cvt_spirocorner=cvt_corner, cvt_spiroleft=cvt_tangent,
- cvt_spiroright=cvt_pen};
-
-enum bvtools { bvt_pointer, bvt_magnify,
- bvt_pencil, bvt_line,
- bvt_shift, bvt_hand,
- bvt_minify, bvt_eyedropper, bvt_max=bvt_eyedropper,
- bvt_setwidth, bvt_setvwidth,
- bvt_rect, bvt_filledrect,
- bvt_elipse, bvt_filledelipse,
- bvt_max2 = bvt_filledelipse,
- bvt_none = -1,
- bvt_fliph=0, bvt_flipv, bvt_rotate90cw, bvt_rotate90ccw, bvt_rotate180, bvt_skew, bvt_transmove };
-enum drawmode { dm_grid, dm_back, dm_fore, dm_max };
-
-typedef struct bvtfunc {
- enum bvtools func;
- int x,y; /* used by skew and move */
-} BVTFunc;
-
-struct freetype_raster {
- int16 rows, cols;
- int16 as, lb;
- int16 bytes_per_row;
- int16 num_greys;
- uint8 *bitmap;
-};
-
-struct cvcontainer {
- struct cvcontainer_funcs *funcs;
-};
-
-enum nav_type { nt_prevdef, nt_prev, nt_goto, nt_next, nt_nextdef };
-struct cvcontainer_funcs {
- enum cv_container_type { cvc_searcher, cvc_mathkern, cvc_tilepath,
- cvc_gradient, cvc_multiplepattern } type;
- void (*activateMe)(struct cvcontainer *cvc,struct charviewbase *cv);
- void (*charEvent)(struct cvcontainer *cvc,void *event);
- int (*canNavigate)(struct cvcontainer *cvc,enum nav_type type);
- void (*doNavigate)(struct cvcontainer *cvc,enum nav_type type);
- int (*canOpen)(struct cvcontainer *cvc);
- void (*doClose)(struct cvcontainer *cvc);
- SplineFont *(*sf_of_container)(struct cvcontainer *cvc);
-};
-
-typedef struct charviewbase {
- struct charviewbase *next;
- struct fontviewbase *fv;
- SplineChar *sc;
- Layer *layerheads[dm_max];
- uint8 drawmode;
- uint16 ft_gridfitwidth;
- SplineSet *gridfit;
- struct cvcontainer *container; /* The sv (or whatever) within which this view is embedded (if it is embedded) */
-} CharViewBase;
-
-typedef struct fontviewbase {
- struct fontviewbase *next; /* Next on list of open fontviews */
- struct fontviewbase *nextsame; /* Next fv looking at this font */
- EncMap *map; /* Current encoding info */
- EncMap *normal; /* If this is not NULL then we have a compacted encoding in map, and this is the original */
- SplineFont *sf; /* Current font */
- SplineFont *cidmaster; /* If CID keyed, contains master font */
- int active_layer;
- BDFFont *active_bitmap; /* Set if the fontview displays a bitmap strike */
- uint8 *selected; /* Current selection */
-#ifndef _NO_FFSCRIPT
- struct dictionary *fontvars; /* Scripting */
-#endif
-#ifndef _NO_PYTHON
- void *python_fv_object;
-#endif
-} FontViewBase;
-
-enum origins { or_zero, or_center, or_lastpress, or_value, or_undefined };
-struct pov_data {
- enum origins xorigin, yorigin;
- double x, y, z;
- double direction; /* Direction of gaze projected into xy plane */
- double tilt; /* Angle which drawing plane is tilted with respect to projection plane */
- double d; /* Distance to projection plane */
- double sintilt; /* Used internally */
-};
-
-typedef struct {
- SplineFont *sf;
- char *pathspec; /* In utf8, not necessarily local encoding */
- char *username, *password;
- char *name;
- char *description;
- char *tags;
- char *artists;
- int notsafeforwork;
- int oflicense;
- char *previewimage; /* NULL => No image */
- uint8 upload_license;
- uint8 upload_fontlog;
- char *upload_id; /* Way to manipulate upload on OFLib */
-} OFLibData;
-
-struct lcg_zones {
- /* info for unhinted processing */
- /* everything abvoe this should be moved down (default xheight/2) */
- int top_zone;
- /* everything below this should be moved up (default xheight/2) */
- /* anything in between should be stationary */
- int bottom_zone;
-
- /* info for hinted processing */
- /* everything above & at this should be moved down */
- /* also anything on the other side of a hint from this should be moved down */
- int top_bound;
- /* everything below & at this should be moved down */
- /* also anything on the other side of a hint from this should be moved down */
- int bottom_bound;
-
- enum counter_type { ct_squish, ct_retain, ct_auto } counter_type;
-
- SplineSet *(*embolden_hook)(SplineSet *,struct lcg_zones *,SplineChar *,int layer);
- int wants_hints;
- double serif_height, serif_fuzz;
-
- double stroke_width; /* negative number to lighten, positive to embolden */
- int removeoverlap;
-
- BlueData bd;
- double stdvw;
-};
-/* This order is the same order as the radio buttons in the embolden dlg */
-enum embolden_type { embolden_lcg, embolden_cjk, embolden_auto, embolden_custom, embolden_error };
-
-struct counterinfo {
- double c_factor, c_add; /* For counters */
- double sb_factor, sb_add; /* For side bearings */
- int correct_italic;
-
- BlueData bd;
- double stdvw;
-
- SplineChar *sc;
- int layer;
- DBounds bb; /* Value before change */
- double top_y, bottom_y, boundry;
- int has_two_zones;
-#define TOP_Z 0
-#define BOT_Z 1
- int cnts[2];
- int maxes[2];
- struct ci_zones {
- double start, width;
- double moveto, newwidth; /* Only change width for diagonal stems*/
- } *zones[2];
-};
-
-enum fvformats { fv_bdf, fv_ttf, fv_pk, fv_pcf, fv_mac, fv_win, fv_palm,
- fv_image, fv_imgtemplate,
- fv_eps, fv_epstemplate,
- fv_pdf, fv_pdftemplate,
- fv_plate, fv_platetemplate,
- fv_svg, fv_svgtemplate,
- fv_glif, fv_gliftemplate,
- fv_fig,
- fv_pythonbase = 0x100 };
-
-extern enum undotype CopyUndoType(void);
-extern int CopyContainsSomething(void);
-extern int CopyContainsBitmap(void);
-extern const Undoes *CopyBufferGet(void);
-extern RefChar *CopyContainsRef(SplineFont *);
-extern char **CopyGetPosSubData(enum possub_type *type,SplineFont **copied_from,
- int pst_depth);
-extern void CopyReference(SplineChar *sc);
-extern void SCCopyLookupData(SplineChar *sc);
-extern void PasteRemoveSFAnchors(SplineFont *);
-extern void PasteAnchorClassMerge(SplineFont *sf,AnchorClass *into,AnchorClass *from);
-extern void PasteRemoveAnchorClass(SplineFont *sf,AnchorClass *dying);
-extern void ClipboardClear(void);
-extern SplineSet *ClipBoardToSplineSet(void);
-extern void BCCopySelected(BDFChar *bc,int pixelsize,int depth);
-extern void PasteToBC(BDFChar *bc,int pixelsize,int depth);
-extern void FVCopyWidth(FontViewBase *fv,enum undotype ut);
-extern void FVCopyAnchors(FontViewBase *fv);
-enum fvcopy_type { ct_fullcopy, ct_reference, ct_lookups, ct_unlinkrefs };
-extern void FVCopy(FontViewBase *fv, enum fvcopy_type copytype);
-extern void PasteIntoFV(FontViewBase *fv, int pasteinto, real trans[6]);
-extern void FVCopyFgtoBg(FontViewBase *fv);
-extern void FVSameGlyphAs(FontViewBase *fv);
-extern void FVClearBackground(FontViewBase *fv);
-extern void FVClear(FontViewBase *fv);
-extern void FVUnlinkRef(FontViewBase *fv);
-extern void FVUndo(FontViewBase *fv);
-extern void FVRedo(FontViewBase *fv);
-extern void FVJoin(FontViewBase *fv);
-extern void FVBuildDuplicate(FontViewBase *fv);
-extern void FVTrans(FontViewBase *fv,SplineChar *sc,real transform[6],uint8 *sel,
- enum fvtrans_flags);
-extern void FVTransFunc(void *_fv,real transform[6],int otype, BVTFunc *bvts,
- enum fvtrans_flags );
-extern void FVReencode(FontViewBase *fv,Encoding *enc);
-extern void FVOverlap(FontViewBase *fv,enum overlap_type ot);
-extern void FVAddExtrema(FontViewBase *fv);
-extern void FVCorrectDir(FontViewBase *fv);
-extern void FVRound2Int(FontViewBase *fv,real factor);
-extern void FVCanonicalStart(FontViewBase *fv);
-extern void FVCanonicalContours(FontViewBase *fv);
-extern void FVCluster(FontViewBase *fv);
-extern void CIDSetEncMap(FontViewBase *fv, SplineFont *new );
-extern void FVInsertInCID(FontViewBase *fv,SplineFont *sf);
-
-extern void FVAutoHint(FontViewBase *fv);
-extern void FVAutoHintSubs(FontViewBase *fv);
-extern void FVAutoCounter(FontViewBase *fv);
-extern void FVDontAutoHint(FontViewBase *fv);
-extern void FVAutoInstr(FontViewBase *fv);
-extern void FVClearInstrs(FontViewBase *fv);
-extern void FVClearHints(FontViewBase *fv);
-extern void SCAutoTrace(SplineChar *sc,int layer, int ask);
-extern char *FindAutoTraceName(void);
-extern void *GetAutoTraceArgs(void);
-extern void SetAutoTraceArgs(void *a);
-extern char *FindMFName(void);
-extern char *ProgramExists(char *prog,char *buffer);
-extern void MfArgsInit(void);
-extern void FVAutoTrace(FontViewBase *fv,int ask);
-extern void FVAddEncodingSlot(FontViewBase *fv,int gid);
-extern int FVImportMult(FontViewBase *fv, char *filename,int toback,int bf);
-extern int FVImportBDF(FontViewBase *fv, char *filename,int ispk, int toback);
-extern void MergeFont(FontViewBase *fv,SplineFont *other,int preserveCrossFontKerning);
-extern int FVImportImages(FontViewBase *fv,char *path,int isimage,int toback,int flags);
-extern int FVImportImageTemplate(FontViewBase *fv,char *path,int isimage,int toback,int flags);
-extern void ScriptPrint(FontViewBase *fv,int type,int32 *pointsizes,char *samplefile,
- unichar_t *sample, char *outputfile);
-extern int FVBParseSelectByPST(FontViewBase *fv,struct lookup_subtable *sub,
- int search_type);
-extern int SFScaleToEm(SplineFont *sf, int ascent, int descent);
-extern void TransHints(StemInfo *stem,real mul1, real off1, real mul2, real off2, int round_to_int );
-extern void TransDStemHints(DStemInfo *ds,real xmul, real xoff, real ymul, real yoff, int round_to_int );
-extern void VrTrans(struct vr *vr,real transform[6]);
-extern int SFNLTrans(FontViewBase *fv,char *x_expr,char *y_expr);
-extern void FVPointOfView(FontViewBase *fv,struct pov_data *);
-extern void FVStrokeItScript(void *fv, StrokeInfo *si);
-extern void FVOutline(struct fontviewbase *fv, real width);
-extern void FVInline(struct fontviewbase *fv, real width, real inset);
-extern void FVShadow(struct fontviewbase *fv,real angle, real outline_width,
- real shadow_length,int wireframe);
-extern void CI_Init(struct counterinfo *ci,SplineFont *sf);
-extern void FVEmbolden(struct fontviewbase *fv,enum embolden_type type,struct lcg_zones *zones);
-extern void FVCondenseExtend(struct fontviewbase *fv,struct counterinfo *ci);
-extern void ScriptSCCondenseExtend(SplineChar *sc,struct counterinfo *ci);
-
-struct smallcaps {
- double lc_stem_width, uc_stem_width;
- double stem_factor, v_stem_factor;
- double xheight, scheight, capheight;
- double vscale, hscale;
- char *extension_for_letters, *extension_for_symbols;
- int dosymbols;
- SplineFont *sf;
- int layer;
- double italic_angle, tan_ia;
-};
-
-extern void SmallCapsFindConstants(struct smallcaps *small, SplineFont *sf,
- int layer );
-
-enum glyphchange_type { gc_generic, gc_smallcaps, gc_subsuper, gc_max };
-
-struct genericchange {
- enum glyphchange_type gc;
- uint32 feature_tag;
- char *glyph_extension;
- char *extension_for_letters, *extension_for_symbols;
- double stem_height_scale, stem_width_scale;
- double stem_height_add , stem_width_add ;
- double serif_height_scale, serif_width_scale;
- double seirf_height_add , serif_width_add ;
- double hcounter_scale, hcounter_add;
- double lsb_scale, lsb_add;
- double rsb_scale, rsb_add;
- uint8 center_in_hor_advance;
- uint8 use_vert_mapping;
- uint8 do_smallcap_symbols;
- uint8 petite; /* generate petite caps rather than smallcaps */
- double vcounter_scale, vcounter_add; /* If not using mapping */
- double v_scale; /* If using mapping */
- struct fixed_maps {
- int cnt;
- struct position_maps {
- double current , desired;
- double cur_width, des_width;
- int overlap_index;
- } *maps;
- } m;
- struct fixed_maps g; /* Adjusted for each glyph */
- double vertical_offset;
- unsigned int dstem_control, serif_control;
- struct smallcaps *small;
-/* Filled in by called routine */
- SplineFont *sf;
- int layer;
- double italic_angle, tan_ia;
-};
-
-extern void FVAddSmallCaps(FontViewBase *fv,struct genericchange *genchange);
-extern void FVGenericChange(FontViewBase *fv,struct genericchange *genchange);
-extern void CVGenericChange(CharViewBase *cv,struct genericchange *genchange);
-
-struct xheightinfo {
- double xheight_current, xheight_desired;
- double serif_height;
-};
-
-extern void InitXHeightInfo(SplineFont *sf, int layer, struct xheightinfo *xi);
-extern void ChangeXHeight(FontViewBase *fv,CharViewBase *cv, struct xheightinfo *xi);
-extern SplineSet *SSControlStems(SplineSet *ss,
- double stemwidthscale, double stemheightscale,
- double hscale, double vscale, double xheight);
-extern void MakeItalic(FontViewBase *fv,CharViewBase *cv,ItalicInfo *ii);
-extern int FVReplaceAll( FontViewBase *fv, SplineSet *find, SplineSet *rpl, double fudge, int flags );
-extern void FVBReplaceOutlineWithReference( FontViewBase *fv, double fudge );
-extern void FVCorrectReferences(FontViewBase *fv);
-extern void _FVSimplify(FontViewBase *fv,struct simplifyinfo *smpl);
-extern void UnlinkThisReference(FontViewBase *fv,SplineChar *sc,int layer);
-extern FontViewBase *ViewPostscriptFont(char *filename,int openflags);
-extern void FVBuildAccent(FontViewBase *fv,int onlyaccents);
-extern void FVRemoveKerns(FontViewBase *fv);
-extern void FVRemoveVKerns(FontViewBase *fv);
-extern void FVVKernFromHKern(FontViewBase *fv);
-extern void FVAddUnencoded(FontViewBase *fv, int cnt);
-extern void FVRemoveUnused(FontViewBase *fv);
-extern void FVCompact(FontViewBase *fv);
-extern void FVDetachGlyphs(FontViewBase *fv);
-extern void FVDetachAndRemoveGlyphs(FontViewBase *fv);
-extern int AutoWidthScript(FontViewBase *fv,int spacing);
-extern int AutoKernScript(FontViewBase *fv,int spacing, int threshold,
- struct lookup_subtable *sub, char *kernfile);
-
-#ifndef _NO_FFSCRIPT
-extern void DictionaryFree(struct dictionary *dica);
-#endif
-
-extern void BCTrans(BDFFont *bdf,BDFChar *bc,BVTFunc *bvts,FontViewBase *fv );
-extern void BCSetPoint(BDFChar *bc, int x, int y, int color);
-extern void BCTransFunc(BDFChar *bc,enum bvtools type,int xoff,int yoff);
-extern void skewselect(BVTFunc *bvtf,real t);
-extern void BCExpandBitmapToEmBox(BDFChar *bc, int xmin, int ymin, int xmax, int ymax);
-
-extern BDFFloat *BDFFloatCreate(BDFChar *bc,int xmin,int xmax,int ymin,int ymax, int clear);
-extern BDFFloat *BDFFloatCopy(BDFFloat *sel);
-extern BDFFloat *BDFFloatConvert(BDFFloat *sel,int newdepth, int olddepth);
-extern void BDFFloatFree(BDFFloat *sel);
-
-extern int CVLayer(CharViewBase *cv);
-extern Undoes *CVPreserveStateHints(CharViewBase *cv);
-extern Undoes *CVPreserveState(CharViewBase *cv);
-extern Undoes *CVPreserveWidth(CharViewBase *cv,int width);
-extern Undoes *CVPreserveVWidth(CharViewBase *cv,int vwidth);
-extern void CVDoRedo(CharViewBase *cv);
-extern void CVDoUndo(CharViewBase *cv);
-extern void CVRemoveTopUndo(CharViewBase *cv);
-extern void CopySelected(CharViewBase *cv,int doanchors);
-extern void CVCopyGridFit(CharViewBase *cv);
-extern void CopyWidth(CharViewBase *cv,enum undotype);
-extern void PasteToCV(CharViewBase *cv);
-extern void CVYPerspective(CharViewBase *cv,double x_vanish, double y_vanish);
-extern void ScriptSCEmbolden(SplineChar *sc,int layer,enum embolden_type type,struct lcg_zones *zones);
-extern void CVEmbolden(CharViewBase *cv,enum embolden_type type,struct lcg_zones *zones);
-extern void SCCondenseExtend(struct counterinfo *ci,SplineChar *sc, int layer,
- int do_undoes);
-extern void SCClearSelPt(SplineChar *sc);
-extern void SC_MoreLayers(SplineChar *,Layer *old);
-extern void SCLayersChange(SplineChar *sc);
-extern void SFLayerChange(SplineFont *sf);
-extern void SCTile(SplineChar *sc,int layer);
-extern void _CVMenuMakeLine(CharViewBase *cv,int do_arc,int ellipse_to_back);
- /* Ellipse to back is a debugging flag and adds the generated ellipse to */
- /* the background layer so we can look at it. I thought it might actually*/
- /* be useful, so I left it in. Activated with the Alt key in the menu */
-
-extern void MVCopyChar(FontViewBase *fv, BDFFont *bdf, SplineChar *sc, enum fvcopy_type fullcopy);
-extern void PasteIntoMV(FontViewBase *fv, BDFFont *bdf,SplineChar *sc, int doclear);
-
-extern void ExecuteScriptFile(FontViewBase *fv, SplineChar *sc, char *filename);
-
-extern int HasLicense(SplineFont *,FILE *);
-extern int OFLibUploadFont(OFLibData *);
-
-enum search_flags { sv_reverse = 0x1, sv_flips = 0x2, sv_rotate = 0x4,
- sv_scale = 0x8, sv_endpoints=0x10 };
-typedef struct searchdata {
- SplineChar sc_srch, sc_rpl;
- SplineSet *path, *revpath, *replacepath, *revreplace;
- int pointcnt, rpointcnt;
- real fudge;
- real fudge_percent; /* a value of .05 here represents 5% (we don't store the integer) */
- unsigned int tryreverse: 1;
- unsigned int tryflips: 1;
- unsigned int tryrotate: 1;
- unsigned int tryscale: 1;
- unsigned int endpoints: 1; /* Don't match endpoints, use them for direction only */
- unsigned int onlyselected: 1;
- unsigned int subpatternsearch: 1;
- unsigned int doreplace: 1;
- unsigned int replaceall: 1;
- unsigned int findall: 1;
- unsigned int searchback: 1;
- unsigned int wrap: 1;
- unsigned int wasreversed: 1;
- unsigned int replacewithref: 1;
- unsigned int already_complained: 1; /* User has already been alerted to the fact that we've converted splines to refs and lost the instructions */
- SplineSet *matched_spl;
- SplinePoint *matched_sp, *last_sp;
- real matched_rot, matched_scale;
- real matched_x, matched_y;
- double matched_co, matched_si; /* Precomputed sin, cos */
- enum flipset { flip_none = 0, flip_x, flip_y, flip_xy } matched_flip;
-#ifdef _HAS_LONGLONG
- unsigned long long matched_refs; /* Bit map of which refs in the char were matched */
- unsigned long long matched_ss; /* Bit map of which splines in the char were matched */
- /* In multi-path mode */
- unsigned long long matched_ss_start;/* Bit map of which splines we tried to start matches with */
-#else
- unsigned long matched_refs;
- unsigned long matched_ss;
- unsigned long matched_ss_start;
-#endif
- FontViewBase *fv;
- SplineChar *curchar;
- int last_gid;
-} SearchData;
-
-extern struct searchdata *SDFromContour( FontViewBase *fv, SplineSet *find, double fudge, int flags );
-extern SplineChar *SDFindNext(struct searchdata *sv);
-
-extern struct python_import_export {
- struct _object *import; /* None becomes NULL */
- struct _object *export; /* None becomes NULL */
- struct _object *data; /* None stays None */
- char *name;
- char *extension;
- char *all_extensions;
-} *py_ie;
-extern void PyFF_SCExport(SplineChar *sc,int ie_index,char *filename,
- int layer);
-extern void PyFF_SCImport(SplineChar *sc,int ie_index,char *filename,
- int layer, int clear);
-extern void PyFF_InitFontHook(FontViewBase *fv);
-
-extern void LookupInit(void);
-extern int UserFeaturesDiffer(void);
-extern uint32 *StdFeaturesOfScript(uint32 script);
-
-enum byte_types { bt_instr, bt_cnt, bt_byte, bt_wordhi, bt_wordlo, bt_impliedreturn };
-struct instrdata {
- uint8 *instrs;
- int instr_cnt, max;
- uint8 *bts;
- unsigned int changed: 1;
- unsigned int in_composit: 1;
- SplineFont *sf;
- SplineChar *sc;
- uint32 tag;
- struct instrdlg *id;
- struct instrdata *next;
-};
-
-extern uint8 *_IVParse(SplineFont *sf, char *text, int *len,
- void (*IVError)(void *,char *, int), void *iv);
-extern char *_IVUnParseInstrs(uint8 *instrs,int instr_cnt);
-
-extern int BitmapControl(FontViewBase *fv,int32 *sizes,int isavail,int rasterize);
-extern void FVSetWidthScript(FontViewBase *fv,enum widthtype wtype,int val,int incr);
-extern void FVMetricsCenter(FontViewBase *fv,int docenter);
-extern void FVRevert(FontViewBase *fv);
-extern void FVRevertBackup(FontViewBase *fv);
-extern void FVRevertGlyph(FontViewBase *fv);
-extern int MMReblend(FontViewBase *fv, MMSet *mm);
-extern FontViewBase *MMCreateBlendedFont(MMSet *mm,FontViewBase *fv,real blends[MmMax],int tonew );
-#endif
diff --git a/Build/source/texk/web2c/luatexdir/luafontloader/fontforge/fontforge/clipnoui.c b/Build/source/texk/web2c/luatexdir/luafontloader/fontforge/fontforge/clipnoui.c
deleted file mode 100644
index a6b38f970b8..00000000000
--- a/Build/source/texk/web2c/luatexdir/luafontloader/fontforge/fontforge/clipnoui.c
+++ /dev/null
@@ -1,68 +0,0 @@
-/* Copyright (C) 2007,2008 by George Williams */
-/*
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are met:
-
- * Redistributions of source code must retain the above copyright notice, this
- * list of conditions and the following disclaimer.
-
- * Redistributions in binary form must reproduce the above copyright notice,
- * this list of conditions and the following disclaimer in the documentation
- * and/or other materials provided with the distribution.
-
- * The name of the author may not be used to endorse or promote products
- * derived from this software without specific prior written permission.
-
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
- * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
- * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
- * EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
- * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
- * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
- * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
- * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include "pfaedit.h"
-#include "uiinterface.h"
-
-static void NClipboard_Grab(void) {
-}
-
-static void NClipboard_AddDataType(const char *type, void *data, int cnt, int size,
- void *(*gendata)(void *,int32 *len), void (*freedata)(void *)) {
- (void)type;
- (void)cnt;
- (void)size;
- (void)gendata;
- if ( freedata!=NULL && data !=NULL )
- (freedata)(data);
-}
-
-/* Asks for the clip and waits for the response. */
-static void *NClipboard_Request(const char *mimetype,int *len) {
- *len = 0;
- (void)mimetype;
-return( NULL );
-}
-
-static int NClipboard_HasType(const char *mimetype) {
- (void)mimetype;
-return( 0 );
-}
-
-static struct clip_interface noui_clip_interface = {
- NClipboard_Grab,
- NClipboard_AddDataType,
- NClipboard_HasType,
- NClipboard_Request
-};
-
-struct clip_interface *clip_interface = &noui_clip_interface;
-
-void FF_SetClipInterface(struct clip_interface *clipi) {
- clip_interface = clipi;
-}
-
diff --git a/Build/source/texk/web2c/luatexdir/luafontloader/fontforge/fontforge/configure-pfaedit.h b/Build/source/texk/web2c/luatexdir/luafontloader/fontforge/fontforge/configure-pfaedit.h
deleted file mode 100644
index 3126010ac55..00000000000
--- a/Build/source/texk/web2c/luatexdir/luafontloader/fontforge/fontforge/configure-pfaedit.h
+++ /dev/null
@@ -1,301 +0,0 @@
-/* Copyright (C) 2002-2008 by George Williams */
-/*
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are met:
-
- * Redistributions of source code must retain the above copyright notice, this
- * list of conditions and the following disclaimer.
-
- * Redistributions in binary form must reproduce the above copyright notice,
- * this list of conditions and the following disclaimer in the documentation
- * and/or other materials provided with the distribution.
-
- * The name of the author may not be used to endorse or promote products
- * derived from this software without specific prior written permission.
-
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
- * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
- * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
- * EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
- * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
- * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
- * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
- * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-#ifndef _CONFIG_FONTFORGE_H_
-#define _CONFIG_FONTFORGE_H_
-
-
-#include "ff-config.h"
-
-/* Making FontForge handle more of the capabilities of type3 & svg fonts is not*/
-/* something most people will want. It wastes space too. So I thought I'd */
-/* make it conditional. */
-/* */
-/* #define FONTFORGE_CONFIG_TYPE3 */
-/* */
-/* It allows people to have images in a font, multiple layers, strokes, fills */
-/* transparencies, etc. (type3 doesn't support transparency, svg doesn't do */
-/* images) */
-/* Can be set from configure --with-multilayer */
-
-
-/* Making FontForge handle device tables uses up more space, so I want */
-/* people to be able to turn it off if space is an issue and device tables */
-/* (ability to correct rounding errors in spacing, ie. kerning, at small */
-/* point sizes) aren't important. */
-/* */
-/* #define FONTFORGE_CONFIG_DEVICETABLES */
-/* */
-/* Can be set from configure --with-devicetables */
-
-
-/* Apple suggests using a sfnt version of 'true' for fonts designed for use */
-/* only on a mac (windows refuses such fonts). I generally prefer to have a */
-/* font work everywhere, so normally ff produces fonts with version 1.0 */
-/* Set this if you want Apple only fonts (produced when Apple mode is set and*/
-/* Opentype mode is unset in the Generate Fonts-Options dialog). */
-/* */
-/* #define FONTFORGE_CONFIG_APPLE_ONLY_TTF */
-/* */
-
-
-/* Nobody else puts apple unicode encodings into the name table. So I probably*/
-/* shouldn't either. But if someone wants them... */
-/* */
-/* #define FONTFORGE_CONFIG_APPLE_UNICODE_NAMES */
-/* */
-
-
-/* Sometimes I want to create a glyph which is a word, and this command */
-/* makes that easy */
-/* */
-/* #define FONTFORGE_CONFIG_PASTEAFTER */
-/* */
-/* The paste after command pastes the contents of the clipboard into the */
-/* current glyph, translates that by the advance width of the current glyph */
-/* and increments the advance width by the advance width of the clipboard */
-/* */
-/* Can be set from configure --enable-pasteafter */
-
-
-
-/* Someone asked for encoding GB12345. Neither libiconv nor iconv supports it.*/
-/* */
-/* #define FONTFORGE_CONFIG_GB12345 */
-/* */
-/* Can be set from configure --enable-gb12345 */
-
-
-/* I doubt anyone but me will be interested in the tile path command, so I */
-/* don't include code for it by default, but if you do want it simply define */
-/* the following macro */
-/* */
-/* #define FONTFORGE_CONFIG_TILEPATH */
-/* */
-/* The tile path command lets you specify a tile which will then be laid out */
-/* along a path. It could be used to make a font whose stems were filled with*/
-/* celtic knotwork, or bamboo segments, for example. */
-/* It's sort of an extension to the Expand Stroke command, only it strokes */
-/* with a pattern */
-/* */
-/* Can be set from configure --enable-tilepath */
-
-
-/* There used to be a property _XFREE86_GLYPH_RANGES (in bdf/pcf) fonts which */
-/* gave a quick view about what glyphs were in a bdf font. From what I gather*/
-/* this property has been dropped because it was redundant. If you would */
-/* like FontForge to generate it */
-/* */
-/* #define FONTFORGE_CONFIG_BDF_GLYPH_RANGES */
-/* */
-
-
-/* I used to use an approximation method when converting cubic to quadratic */
-/* splines which was non-symmetric. In some cases it produced better results */
-/* than the current approach. This flag restores the old algorithm. */
-/* */
-/* #define FONTFORGE_CONFIG_NON_SYMMETRIC_QUADRATIC_CONVERSION */
-/* */
-
-
-/* Harald Harders would like to be able to generate a PFM file without */
-/* creating a font along with it. I don't see the need for this, but he pro- */
-/* vided a patch. Setting this flag will enable his patch */
-/* */
-/* #define FONTFORGE_CONFIG_WRITE_PFM */
-/* */
-
-
-/* Prior to late Sept of 2003 FontForge converted certain mac feature/settings*/
-/* into opentype-like tags. Some features could be converted directly but for*/
-/* a few I made up tags. Now FontForge is capable of using the mac feature */
-/* settings directly. If you set this flag then when FontForge loads in an sfd*/
-/* file with these non-standard opentype tags, it will convert them into the */
-/* appropriate mac feature/setting combinations. */
-/* */
-/* #define FONTFORGE_CONFIG_CVT_OLD_MAC_FEATURES */
-/* */
-
-
-/* Normally fontforge uses float (32 bit real data type) to store position */
-/* and transformation data. If you prefer you may use double (64 bit real) */
-/* instead. The extra precision is usually not needed, but the extra space */
-/* can be a problem with large (CJK, UNICODE) fonts. */
-/* */
-#define FONTFORGE_CONFIG_USE_DOUBLE
-/* #define FONTFORGE_CONFIG_USE_LONGDOUBLE */
-/* */
-
-
-/* In addition to placing snippets of charstrings into subrs, I tried adding */
-/* whole glyphs (when that was possible). To my surprise, it made things */
-/* worse in one of my test cases, and barely registered an improvement in */
-/* another. So I think we're better off without it. But I don't understand */
-/* why things are worse so I'm leaving the code in to play with */
-/* */
-/* #define FONTFORGE_CONFIG_PS_REFS_GET_SUBRS */
-/* */
-
-
-/* Werner wants to be able to see the raw (unscaled) data for the location of */
-/* points (in the points window of the debugger). I'm not sure that is */
-/* generally a good idea (I think it makes the dlg look unsymetric). */
-/* */
-/* #define FONTFORGE_CONFIG_SHOW_RAW_POINTS */
-/* */
-
-/* On most systems fontforge uses the alt or meta key as a mouse press modifier*/
-/* on the mac that would mean the option key. But the mac usually uses option*/
-/* keypress to mean mouse button 2, and so option isn't available. Let's use */
-/* capslock instead. */
-/* */
-/* #define FONTFORGE_CONFIG_CAPSLOCK_FOR_ALT */
-/* */
-/* This has three states: */
-/* Undefined (or 0) => use meta/alt key */
-/* 2 => Use either meta/alt or capslock */
-/* otherwise => use capslock */
-/* */
-/* Can be set from configure --with-capslock-for-alt */
-
-
-/* Use horizontal, rather than vertical, tabsets for the Font and glyph Info */
-/* dialogs. This is what things used to look like. */
-/* */
-/* #define FONTFORGE_CONFIG_INFO_HORIZONTAL */
-/* */
-
-/* ************************************************************************** */
-/* *********************** Set by configure script ************************** */
-/* ************************************************************************** */
-
-/* The following are expected to be set by the configure script, but I suppose*/
-/* you could set them here too */
-
-/* If your system does not have a working ldopen (to do dynamic binding of */
-/* shared libaries) then set NODYNAMIC */
-
-/* If you are on a Mac then set __Mac */
-/* If you are on a windows box with cygwin set __CygWin */
-
-/* If you are on a Mac where cursors are restricted to 16x16 pixel boxes then */
-/* set _CursorsMustBe16x16 */
-
-/* If you are on cygwin where even the modifier keys autorepeat then set */
-/* _ModKeysAutoRepeat */
-
-/* If you are on cygwin where some of the drawmode funtions (like AND) don't */
-/* work then set _BrokenBitmapImages */
-
-/* FontForge knows about 4 different keyboard settings, a windows keyboard, a */
-/* mac keyboard, a mac keyboard under SUSE linux, and a sun keyboard */
-/* When it starts up FontForge assumes that the keyboard is some default type*/
-/* You can override the type by setting _Keyboard to */
-/* 0 -- windows */
-/* 1 -- mac running mac osx */
-/* 3 -- mac running SUSE linux (7.1) */
-/* 2 -- sparc */
-/* Basically this affects the text that appears in menus. The sun keyboard */
-/* uses meta where the windows one uses alt, and the mac use command and */
-/* option. */
-
-/* If there are no freetype header files then define _NO_FREETYPE */
-/* If the freetype library has the bytecode debugger then define FREETYPE_HAS_DEBUGGER */
-/* If there is no mmap system call then define _NO_MMAP */
-
-/* If there is no ungif library (or if it is out of date) define _NO_LIBUNGIF */
-/* If there is no png (or z) library define _NO_LIBPNG */
-/* If there libpng is version 1.2 define _LIBPNG12 */
-/* If there is no jpeg library define _NO_LIBJPEG */
-/* If there is no tiff library define _NO_LIBTIFF */
-/* If there is no xml2 library define _NO_LIBXML */
-/* If there is no uninameslist library define _NO_LIBUNINAMESLIST */
-
-/* If any of the above libraries exists, but only in static form (on a system */
-/* with a dynamic loader) then define _STATIC_LIBUNGIF, etc. */
-
-/* If there is no snprintf define _NO_SNPRINTF */
-
-/* If the XInput extension is not available define _NO_XINPUT */
-/* If the Xkb extension is not available define _NO_XKB */
-
-/* If the compiler supports long long define _HAS_LONGLONG */
-
-
-/* ************************************************************************** */
-/* ******************************** Obsolete ******************************** */
-/* ************************************************************************** */
-
-/******* I decided to turn this on and remove all uses of the flag ************/
-/* I thought it would be fun to write a generalized non linear transformation */
-/* routine. I'm not sure that it's very useful though. It can be used to do */
-/* perspective transformations and such */
-/* */
-/* #define FONTFORGE_CONFIG_NONLINEAR */
-/* */
-/* This command takes two strings which specify general expressions in x and y*/
-/* and applies the specified transformations to the splines. Note: Each */
-/* spline is transformed into a new spline, but some transformations require */
-/* that a spline be broken into components and each of those transformed eg: */
-/* "x' = x, y' = y+sin(x)" would not produce anything useful when applied to */
-/* a long line segment like [0,100]...[100,100], but if that were broken up */
-/* into sub-segments each pi long the results would be much better */
-
-
-/******* Don't need this any longer as copy layer 2 layer is always available */
-/* Yoshiki Hayashi wants a copy background to foreground command in the */
-/* outline view. Setting this flag will enable his patch */
-/* */
-/* #define FONTFORGE_CONFIG_COPY_BG_TO_FG */
-/* */
-
-
-/* ************************************************************************** */
-/* **************************** Numeric Settings **************************** */
-/* ************************************************************************** */
-
-
-/* The number of files displayed in the "File->Recent" menu */
-#define RECENT_MAX 10
-
-/* The number of tabs allowed in the outline glyph view of former glyphs */
-#define FORMER_MAX 10
-
-/* The maximum number of layers allowed in a normal font (this includes the */
-/* default foreground and background layers) -- this does not limit type3 */
-/* fonts */
-#define BACK_LAYER_MAX 256
-
-
-
-#ifdef _WIN32
-#include <stdio.h>
-extern FILE *_cairo_win_tmpfile( void );
-#define tmpfile() _cairo_win_tmpfile()
-#endif /* _WIN32 */
-
-
-#endif
diff --git a/Build/source/texk/web2c/luatexdir/luafontloader/fontforge/fontforge/cvundoes.c b/Build/source/texk/web2c/luatexdir/luafontloader/fontforge/fontforge/cvundoes.c
deleted file mode 100644
index a19bcb9a4c0..00000000000
--- a/Build/source/texk/web2c/luatexdir/luafontloader/fontforge/fontforge/cvundoes.c
+++ /dev/null
@@ -1,134 +0,0 @@
-/* Copyright (C) 2000-2008 by George Williams */
-/*
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are met:
-
- * Redistributions of source code must retain the above copyright notice, this
- * list of conditions and the following disclaimer.
-
- * Redistributions in binary form must reproduce the above copyright notice,
- * this list of conditions and the following disclaimer in the documentation
- * and/or other materials provided with the distribution.
-
- * The name of the author may not be used to endorse or promote products
- * derived from this software without specific prior written permission.
-
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
- * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
- * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
- * EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
- * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
- * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
- * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
- * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-#define _DEFINE_SEARCHVIEW_
-#include "fontforgevw.h"
-#include <math.h>
-#include <ustring.h>
-#include <utype.h>
-
-extern char *coord_sep;
-
-int onlycopydisplayed = 0;
-int copymetadata = 0;
-int copyttfinstr = 0;
-
-/* ********************************* Undoes ********************************* */
-
-int maxundoes = 0; /* -1 is infinite */
-
-static void UHintListFree(void *hints) {
- StemInfo *h, *t, *p;
-
- if ( hints==NULL )
-return;
- if ( ((StemInfo *) hints)->hinttype==ht_d )
- DStemInfosFree(hints);
- else {
- h = t = hints;
- p = NULL;
- while ( t!=NULL && t->hinttype!=ht_d ) {
- p = t;
- t = t->next;
- }
- p->next = NULL;
- StemInfosFree(h);
- DStemInfosFree((DStemInfo *) t);
- }
-}
-
-void UndoesFree(Undoes *undo) {
- Undoes *unext;
-
- while ( undo!=NULL ) {
- unext = undo->next;
- switch ( undo->undotype ) {
- case ut_noop:
- case ut_width: case ut_vwidth: case ut_lbearing: case ut_rbearing:
- /* Nothing else to free */;
- break;
- case ut_state: case ut_tstate: case ut_statehint: case ut_statename:
- case ut_hints: case ut_anchors: case ut_statelookup:
- SplinePointListsFree(undo->u.state.splines);
- RefCharsFree(undo->u.state.refs);
- UHintListFree(undo->u.state.hints);
- free(undo->u.state.instrs);
- ImageListsFree(undo->u.state.images);
- if ( undo->undotype==ut_statename ) {
- free( undo->u.state.charname );
- free( undo->u.state.comment );
- PSTFree( undo->u.state.possub );
- }
- AnchorPointsFree(undo->u.state.anchor);
- break;
- case ut_bitmap:
- free(undo->u.bmpstate.bitmap);
- break;
- case ut_multiple: case ut_layers:
- UndoesFree( undo->u.multiple.mult );
- break;
- case ut_composit:
- UndoesFree(undo->u.composit.state);
- UndoesFree(undo->u.composit.bitmaps);
- break;
- default:
- IError( "Unknown undo type in UndoesFree: %d", undo->undotype );
- break;
- }
- chunkfree(undo,sizeof(Undoes));
- undo = unext;
- }
-}
-
-int getAdobeEnc(char *name) {
- extern char *AdobeStandardEncoding[256];
- int i;
-
- for ( i=0; i<256; ++i )
- if ( strcmp(name,AdobeStandardEncoding[i])==0 )
- break;
- if ( i==256 ) i = -1;
-return( i );
-}
-
-int SCWasEmpty(SplineChar *sc, int skip_this_layer) {
- int i;
-
- for ( i=ly_fore; i<sc->layer_cnt; ++i ) if ( i!=skip_this_layer && !sc->layers[i].background ) {
- if ( sc->layers[i].refs!=NULL )
-return( false );
- else if ( sc->layers[i].splines!=NULL ) {
- SplineSet *ss;
- for ( ss = sc->layers[i].splines; ss!=NULL; ss=ss->next ) {
- if ( ss->first->prev!=NULL )
-return( false ); /* Closed contour */
- }
- }
- }
-return( true );
-}
-
-
diff --git a/Build/source/texk/web2c/luatexdir/luafontloader/fontforge/fontforge/dumppfa.c b/Build/source/texk/web2c/luatexdir/luafontloader/fontforge/fontforge/dumppfa.c
deleted file mode 100644
index 6f7b03430b9..00000000000
--- a/Build/source/texk/web2c/luatexdir/luafontloader/fontforge/fontforge/dumppfa.c
+++ /dev/null
@@ -1,218 +0,0 @@
-/* Copyright (C) 2000-2008 by George Williams */
-/*
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are met:
-
- * Redistributions of source code must retain the above copyright notice, this
- * list of conditions and the following disclaimer.
-
- * Redistributions in binary form must reproduce the above copyright notice,
- * this list of conditions and the following disclaimer in the documentation
- * and/or other materials provided with the distribution.
-
- * The name of the author may not be used to endorse or promote products
- * derived from this software without specific prior written permission.
-
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
- * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
- * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
- * EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
- * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
- * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
- * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
- * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-#include "pfaedit.h"
-#include <stdio.h>
-#include <math.h>
-#include <stdlib.h>
-#include <string.h>
-#include <ustring.h>
-#include <utype.h>
-#include <unistd.h>
-#include <locale.h>
-#ifndef _WIN32
-# include <pwd.h>
-#endif
-#include <stdarg.h>
-#include <time.h>
-#include "psfont.h"
-#include "splinefont.h"
-
-#ifdef __CygWin
- #include <sys/types.h>
- #include <sys/stat.h>
- #include <unistd.h>
-#endif
-
-extern int autohint_before_generate;
-char *xuid=NULL;
-
-typedef void (*DumpChar)(int ch,void *data);
-struct fileencryptdata {
- DumpChar olddump;
- void *olddata;
- unsigned short r;
- int hexline;
-};
-#define c1 52845
-#define c2 22719
-
-struct psdict *PSDictCopy(struct psdict *dict) {
- struct psdict *ret;
- int i;
-
- if ( dict==NULL )
-return( NULL );
-
- ret = gcalloc(1,sizeof(struct psdict));
- ret->cnt = dict->cnt; ret->next = dict->next;
- ret->keys = gcalloc(ret->cnt,sizeof(char *));
- ret->values = gcalloc(ret->cnt,sizeof(char *));
- for ( i=0; i<dict->next; ++i ) {
- ret->keys[i] = copy(dict->keys[i]);
- ret->values[i] = copy(dict->values[i]);
- }
-
-return( ret );
-}
-
-int PSDictFindEntry(struct psdict *dict, char *key) {
- int i;
-
- if ( dict==NULL )
-return( -1 );
-
- for ( i=0; i<dict->next; ++i )
- if ( strcmp(dict->keys[i],key)==0 )
-return( i );
-
-return( -1 );
-}
-
-char *PSDictHasEntry(struct psdict *dict, char *key) {
- int i;
-
- if ( dict==NULL )
-return( NULL );
-
- for ( i=0; i<dict->next; ++i )
- if ( strcmp(dict->keys[i],key)==0 )
-return( dict->values[i] );
-
-return( NULL );
-}
-
-int PSDictRemoveEntry(struct psdict *dict, char *key) {
- int i;
-
- if ( dict==NULL )
-return( false );
-
- for ( i=0; i<dict->next; ++i )
- if ( strcmp(dict->keys[i],key)==0 )
- break;
- if ( i==dict->next )
-return( false );
- free( dict->keys[i]);
- free( dict->values[i] );
- --dict->next;
- while ( i<dict->next ) {
- dict->keys[i] = dict->keys[i+1];
- dict->values[i] = dict->values[i+1];
- ++i;
- }
-
-return( true );
-}
-
-int PSDictChangeEntry(struct psdict *dict, char *key, char *newval) {
- int i;
-
- if ( dict==NULL )
-return( -1 );
-
- for ( i=0; i<dict->next; ++i )
- if ( strcmp(dict->keys[i],key)==0 )
- break;
- if ( i==dict->next ) {
- if ( dict->next>=dict->cnt ) {
- dict->cnt += 10;
- dict->keys = grealloc(dict->keys,dict->cnt*sizeof(char *));
- dict->values = grealloc(dict->values,dict->cnt*sizeof(char *));
- }
- dict->keys[dict->next] = copy(key);
- dict->values[dict->next] = NULL;
- ++dict->next;
- }
- free(dict->values[i]);
- dict->values[i] = copy(newval);
-return( i );
-}
-
-
-static double FindMaxDiffOfBlues(char *pt, double max_diff) {
- char *end;
- double p1, p2;
-
- while ( *pt==' ' || *pt=='[' ) ++pt;
- forever {
- p1 = strtod(pt,&end);
- if ( end==pt )
- break;
- pt = end;
- p2 = strtod(pt,&end);
- if ( end==pt )
- break;
- if ( p2-p1 >max_diff ) max_diff = p2-p1;
- pt = end;
- }
-return( max_diff );
-}
-
-double BlueScaleFigureForced(struct psdict *private,real bluevalues[], real otherblues[]) {
- double max_diff=0;
- char *pt;
- int i;
-
- pt = PSDictHasEntry(private,"BlueValues");
- if ( pt!=NULL ) {
- max_diff = FindMaxDiffOfBlues(pt,max_diff);
- } else if ( bluevalues!=NULL ) {
- for ( i=0; i<14 && (bluevalues[i]!=0 || bluevalues[i+1])!=0; i+=2 ) {
- if ( bluevalues[i+1] - bluevalues[i]>=max_diff )
- max_diff = bluevalues[i+1] - bluevalues[i];
- }
- }
- pt = PSDictHasEntry(private,"FamilyBlues");
- if ( pt!=NULL )
- max_diff = FindMaxDiffOfBlues(pt,max_diff);
-
- pt = PSDictHasEntry(private,"OtherBlues");
- if ( pt!=NULL )
- max_diff = FindMaxDiffOfBlues(pt,max_diff);
- else if ( otherblues!=NULL ) {
- for ( i=0; i<10 && (otherblues[i]!=0 || otherblues[i+1]!=0); i+=2 ) {
- if ( otherblues[i+1] - otherblues[i]>=max_diff )
- max_diff = otherblues[i+1] - otherblues[i];
- }
- }
- pt = PSDictHasEntry(private,"FamilyOtherBlues");
- if ( pt!=NULL )
- max_diff = FindMaxDiffOfBlues(pt,max_diff);
- if ( max_diff<=0 )
-return( -1 );
- if ( 1/max_diff > .039625 )
-return( -1 );
-
-return( .99/max_diff );
-}
-
-double BlueScaleFigure(struct psdict *private,real bluevalues[], real otherblues[]) {
- if ( PSDictHasEntry(private,"BlueScale")!=NULL )
-return( -1 );
- return BlueScaleFigureForced(private, bluevalues, otherblues);
-}
-
diff --git a/Build/source/texk/web2c/luatexdir/luafontloader/fontforge/fontforge/edgelist.h b/Build/source/texk/web2c/luatexdir/luafontloader/fontforge/fontforge/edgelist.h
deleted file mode 100644
index ded484f40ff..00000000000
--- a/Build/source/texk/web2c/luatexdir/luafontloader/fontforge/fontforge/edgelist.h
+++ /dev/null
@@ -1,149 +0,0 @@
-/* Copyright (C) 2000-2008 by George Williams */
-/*
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are met:
-
- * Redistributions of source code must retain the above copyright notice, this
- * list of conditions and the following disclaimer.
-
- * Redistributions in binary form must reproduce the above copyright notice,
- * this list of conditions and the following disclaimer in the documentation
- * and/or other materials provided with the distribution.
-
- * The name of the author may not be used to endorse or promote products
- * derived from this software without specific prior written permission.
-
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
- * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
- * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
- * EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
- * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
- * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
- * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
- * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-#ifndef _EDGELIST_H
-#define _EDGELIST_H
-#include "splinefont.h"
-
-typedef struct hints {
- real base, width;
- real b1, b2, e1, e2;
- real ab, ae;
- unsigned int adjustb: 1;
- unsigned int adjuste: 1;
- struct hints *next;
-} Hints;
-
-/* Instead of y and x coordinates these are based on major and other */
-/* major maybe either x or y depending on what we're interested in */
-/* at the moment, and other will be the other one. Of course it's */
-/* consistant accross the datastructure at any given time */
-typedef struct edge {
- real mmin, mmax; /* relative to es->mmin */
- real t_mmin, t_mmax;
- real tmin, tmax;
- real o_mmin, o_mmax;
- real t_cur, o_cur, m_cur;
- unsigned int up: 1; /* line is directed up in the spline list */
- unsigned int max_adjusted: 1; /* by hstem hints */
- unsigned int min_adjusted: 1;
- Spline *spline; /* spline which generated this segment */
- struct edge *esnext, *aenext;
- struct edge *before, *after;
- int last_opos, last_mpos;
- real oldt; /* only used for FindIntersections of RemoveOverlap */
-} Edge;
-
-typedef struct edgelist {
- Edge **edges;
- int cnt;
- real mmin, mmax;
- real omin, omax;
- real scale;
- int bytes_per_line;
- uint8 *bitmap;
- Edge *last, *splinesetfirst;
- SplineChar *sc;
- int layer;
- char *interesting;
- int major, other;
- unsigned int genmajoredges: 1; /* generate a list of edges parallel to the major axis */
- Edge *majors; /* ordered so that lowest edge is first */
- Edge *majorhold; /* to hold major edges as we pass them and they become useless */
- Hints *hhints, *vhints;
- int is_overlap;
- DBounds bbox; /* Not always set. {m,o}{min,max} a provide scaled bbox, this is in glyph units */
-} EdgeList;
-
-extern void FreeEdges(EdgeList *es);
-extern double TOfNextMajor(Edge *e, EdgeList *es, double sought_y );
-extern void FindEdgesSplineSet(SplinePointList *spl, EdgeList *es, int ignore_clip);
-extern Edge *ActiveEdgesInsertNew(EdgeList *es, Edge *active,int i);
-extern Edge *ActiveEdgesRefigure(EdgeList *es, Edge *active,real i);
-extern Edge *ActiveEdgesFindStem(Edge *apt, Edge **prev, real i);
-
-/* Version which is better for everything other than rasterization */
-/* (I think) */
-typedef struct edgeinfo {
- /* The spline is broken up at all extrema. So... */
- /* The spline between tmin and tmax is monotonic in both coordinates */
- /* If the spline becomes vert/horizontal that will be at one of the */
- /* end points too */
- Spline *spline;
- real tmin, tmax;
- real coordmin[2];
- real coordmax[2];
- unsigned int up: 1;
- unsigned int hv: 1;
- unsigned int hvbottom: 1;
- unsigned int hvtop: 1;
- unsigned int hor: 1;
- unsigned int vert: 1;
- unsigned int almosthor: 1;
- unsigned int almostvert: 1;
- unsigned int horattmin: 1;
- unsigned int horattmax: 1;
- unsigned int vertattmin: 1;
- unsigned int vertattmax: 1;
- unsigned hup: 1;
- unsigned vup: 1;
- real tcur; /* Value of t for current major coord */
- real ocur; /* Value of the other coord for current major coord */
- struct edgeinfo *next;
- struct edgeinfo *ordered;
- struct edgeinfo *aenext;
- struct edgeinfo *splinenext;
- SplineChar *sc;
- int major;
-} EI;
-
-typedef struct eilist {
- EI *edges;
- real coordmin[2];
- real coordmax[2];
- int low, high, cnt;
- EI **ordered;
- char *ends; /* flag to say an edge ends on this line */
- SplineChar *sc;
- int layer;
- int major;
- EI *splinelast, *splinefirst;
- EI **bottoms, **tops; /* Used only be FindNeeded in RemoveOverlap */
- unsigned leavetiny: 1;
- enum overlap_type ot;
-} EIList;
-
-extern void ElFreeEI(EIList *el);
-extern void ELFindEdges(SplineChar *sc, EIList *el);
-extern void ELOrder(EIList *el, int major );
-extern real EITOfNextMajor(EI *e, EIList *el, real sought_m );
-extern int EISameLine(EI *e, EI *n, real i, int major);
-extern int EISkipExtremum(EI *e, real i, int major);
-extern EI *EIActiveEdgesFindStem(EI *apt, real i, int major);
-extern EI *EIActiveListReorder(EI *active,int *change);
-extern EI *EIActiveEdgesRefigure(EIList *el, EI *active,real i,int major,
- int *_change);
-#endif
diff --git a/Build/source/texk/web2c/luatexdir/luafontloader/fontforge/fontforge/edgelist2.h b/Build/source/texk/web2c/luatexdir/luafontloader/fontforge/fontforge/edgelist2.h
deleted file mode 100644
index d84925bbde7..00000000000
--- a/Build/source/texk/web2c/luatexdir/luafontloader/fontforge/fontforge/edgelist2.h
+++ /dev/null
@@ -1,49 +0,0 @@
-/* Copyright (C) 2004-2008 by George Williams */
-/*
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are met:
-
- * Redistributions of source code must retain the above copyright notice, this
- * list of conditions and the following disclaimer.
-
- * Redistributions in binary form must reproduce the above copyright notice,
- * this list of conditions and the following disclaimer in the documentation
- * and/or other materials provided with the distribution.
-
- * The name of the author may not be used to endorse or promote products
- * derived from this software without specific prior written permission.
-
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
- * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
- * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
- * EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
- * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
- * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
- * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
- * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-#ifndef _EDGELIST2_H
-#define _EDGELIST2_H
-#include "splinefont.h"
-
-typedef struct monotonic {
- Spline *s;
- extended tstart, tend;
- struct monotonic *next, *prev; /* along original contour */
- uint8 xup; /* increasing t => increasing x */
- uint8 yup;
- unsigned int isneeded : 1;
- unsigned int isunneeded : 1;
- unsigned int exclude : 1;
- struct intersection *start;
- struct intersection *end;
- DBounds b;
- extended other, t;
- struct monotonic *linked; /* singly linked list of all monotonic*/
- /* segments, no contour indication */
- double when_set; /* Debugging */
-} Monotonic;
-
-#endif /* _EDGELIST2_H */
diff --git a/Build/source/texk/web2c/luatexdir/luafontloader/fontforge/fontforge/encoding.c b/Build/source/texk/web2c/luatexdir/luafontloader/fontforge/fontforge/encoding.c
deleted file mode 100644
index 8b42a186b2b..00000000000
--- a/Build/source/texk/web2c/luatexdir/luafontloader/fontforge/fontforge/encoding.c
+++ /dev/null
@@ -1,943 +0,0 @@
-/* Copyright (C) 2000-2008 by George Williams */
-/*
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are met:
-
- * Redistributions of source code must retain the above copyright notice, this
- * list of conditions and the following disclaimer.
-
- * Redistributions in binary form must reproduce the above copyright notice,
- * this list of conditions and the following disclaimer in the documentation
- * and/or other materials provided with the distribution.
-
- * The name of the author may not be used to endorse or promote products
- * derived from this software without specific prior written permission.
-
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
- * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
- * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
- * EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
- * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
- * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
- * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
- * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include "fontforgevw.h"
-#include <ustring.h>
-#include <utype.h>
-#include <math.h>
-#include <unistd.h>
-#include <sys/types.h>
-#include <dirent.h>
-#include <gfile.h>
-#include "plugins.h"
-#include "encoding.h"
-
-Encoding *default_encoding = NULL;
-
-static int32 tex_base_encoding[] = {
- 0x0000, 0x02d9, 0xfb01, 0xfb02, 0x2044, 0x02dd, 0x0141, 0x0142,
- 0x02db, 0x02da, 0x000a, 0x02d8, 0x2212, 0x000d, 0x017d, 0x017e,
- 0x02c7, 0x0131, 0xf6be, 0xfb00, 0xfb03, 0xfb04, 0x2260, 0x221e,
- 0x2264, 0x2265, 0x2202, 0x2211, 0x220f, 0x03c0, 0x0060, 0x0027,
- 0x0020, 0x0021, 0x0022, 0x0023, 0x0024, 0x0025, 0x0026, 0x2019,
- 0x0028, 0x0029, 0x002a, 0x002b, 0x002c, 0x002d, 0x002e, 0x002f,
- 0x0030, 0x0031, 0x0032, 0x0033, 0x0034, 0x0035, 0x0036, 0x0037,
- 0x0038, 0x0039, 0x003a, 0x003b, 0x003c, 0x003d, 0x003e, 0x003f,
- 0x0040, 0x0041, 0x0042, 0x0043, 0x0044, 0x0045, 0x0046, 0x0047,
- 0x0048, 0x0049, 0x004a, 0x004b, 0x004c, 0x004d, 0x004e, 0x004f,
- 0x0050, 0x0051, 0x0052, 0x0053, 0x0054, 0x0055, 0x0056, 0x0057,
- 0x0058, 0x0059, 0x005a, 0x005b, 0x005c, 0x005d, 0x005e, 0x005f,
- 0x2018, 0x0061, 0x0062, 0x0063, 0x0064, 0x0065, 0x0066, 0x0067,
- 0x0068, 0x0069, 0x006a, 0x006b, 0x006c, 0x006d, 0x006e, 0x006f,
- 0x0070, 0x0071, 0x0072, 0x0073, 0x0074, 0x0075, 0x0076, 0x0077,
- 0x0078, 0x0079, 0x007a, 0x007b, 0x007c, 0x007d, 0x007e, 0x007f,
- 0x20ac, 0x222b, 0x201a, 0x0192, 0x201e, 0x2026, 0x2020, 0x2021,
- 0x02c6, 0x2030, 0x0160, 0x2039, 0x0152, 0x2126, 0x221a, 0x2248,
- 0x0090, 0x0091, 0x0092, 0x201c, 0x201d, 0x2022, 0x2013, 0x2014,
- 0x02dc, 0x2122, 0x0161, 0x203a, 0x0153, 0x2206, 0x25ca, 0x0178,
- 0x0000, 0x00a1, 0x00a2, 0x00a3, 0x00a4, 0x00a5, 0x00a6, 0x00a7,
- 0x00a8, 0x00a9, 0x00aa, 0x00ab, 0x00ac, 0x002d, 0x00ae, 0x00af,
- 0x00b0, 0x00b1, 0x00b2, 0x00b3, 0x00b4, 0x00b5, 0x00b6, 0x00b7,
- 0x00b8, 0x00b9, 0x00ba, 0x00bb, 0x00bc, 0x00bd, 0x00be, 0x00bf,
- 0x00c0, 0x00c1, 0x00c2, 0x00c3, 0x00c4, 0x00c5, 0x00c6, 0x00c7,
- 0x00c8, 0x00c9, 0x00ca, 0x00cb, 0x00cc, 0x00cd, 0x00ce, 0x00cf,
- 0x00d0, 0x00d1, 0x00d2, 0x00d3, 0x00d4, 0x00d5, 0x00d6, 0x00d7,
- 0x00d8, 0x00d9, 0x00da, 0x00db, 0x00dc, 0x00dd, 0x00de, 0x00df,
- 0x00e0, 0x00e1, 0x00e2, 0x00e3, 0x00e4, 0x00e5, 0x00e6, 0x00e7,
- 0x00e8, 0x00e9, 0x00ea, 0x00eb, 0x00ec, 0x00ed, 0x00ee, 0x00ef,
- 0x00f0, 0x00f1, 0x00f2, 0x00f3, 0x00f4, 0x00f5, 0x00f6, 0x00f7,
- 0x00f8, 0x00f9, 0x00fa, 0x00fb, 0x00fc, 0x00fd, 0x00fe, 0x00ff
-};
-
-static int32 unicode_from_MacSymbol[] = {
- 0x0000, 0x0001, 0x0002, 0x0003, 0x0004, 0x0005, 0x0006, 0x0007,
- 0x0008, 0x0009, 0x000a, 0x000b, 0x000c, 0x000d, 0x000e, 0x000f,
- 0x0010, 0x0011, 0x0012, 0x0013, 0x0014, 0x0015, 0x0016, 0x0017,
- 0x0018, 0x0019, 0x001a, 0x001b, 0x001c, 0x001d, 0x001e, 0x001f,
- 0x0020, 0x0021, 0x2200, 0x0023, 0x2203, 0x0025, 0x0026, 0x220d,
- 0x0028, 0x0029, 0x2217, 0x002b, 0x002c, 0x2212, 0x002e, 0x002f,
- 0x0030, 0x0031, 0x0032, 0x0033, 0x0034, 0x0035, 0x0036, 0x0037,
- 0x0038, 0x0039, 0x003a, 0x003b, 0x003c, 0x003d, 0x003e, 0x003f,
- 0x2245, 0x0391, 0x0392, 0x03a7, 0x0394, 0x0395, 0x03a6, 0x0393,
- 0x0397, 0x0399, 0x03d1, 0x039a, 0x039b, 0x039c, 0x039d, 0x039f,
- 0x03a0, 0x0398, 0x03a1, 0x03a3, 0x03a4, 0x03a5, 0x03c2, 0x03a9,
- 0x039e, 0x03a8, 0x0396, 0x005b, 0x2234, 0x005d, 0x22a5, 0x005f,
- 0xf8e5, 0x03b1, 0x03b2, 0x03c7, 0x03b4, 0x03b5, 0x03c6, 0x03b3,
- 0x03b7, 0x03b9, 0x03d5, 0x03ba, 0x03bb, 0x03bc, 0x03bd, 0x03bf,
- 0x03c0, 0x03b8, 0x03c1, 0x03c3, 0x03c4, 0x03c5, 0x03d6, 0x03c9,
- 0x03be, 0x03c8, 0x03b6, 0x007b, 0x007c, 0x007d, 0x223c, 0x007f,
- 0x0080, 0x0081, 0x0082, 0x0083, 0x0084, 0x0085, 0x0086, 0x0087,
- 0x0088, 0x0089, 0x008a, 0x008b, 0x008c, 0x008d, 0x008e, 0x008f,
- 0x0090, 0x0091, 0x0092, 0x0093, 0x0094, 0x0095, 0x0096, 0x0097,
- 0x0098, 0x0099, 0x009a, 0x009b, 0x009c, 0x009d, 0x009e, 0x009f,
- 0x0000, 0x03d2, 0x2032, 0x2264, 0x2044, 0x221e, 0x0192, 0x2663,
- 0x2666, 0x2665, 0x2660, 0x2194, 0x2190, 0x2191, 0x2192, 0x2193,
- 0x00b0, 0x00b1, 0x2033, 0x2265, 0x00d7, 0x221d, 0x2202, 0x2022,
- 0x00f7, 0x2260, 0x2261, 0x2248, 0x2026, 0xf8e6, 0xf8e7, 0x21b5,
- 0x2135, 0x2111, 0x211c, 0x2118, 0x2297, 0x2295, 0x2205, 0x2229,
- 0x222a, 0x2283, 0x2287, 0x2284, 0x2282, 0x2286, 0x2208, 0x2209,
- 0x2220, 0x2207, 0x00ae, 0x00a9, 0x2122, 0x220f, 0x221a, 0x22c5,
- 0x00ac, 0x2227, 0x2228, 0x21d4, 0x21d0, 0x21d1, 0x21d2, 0x21d3,
- 0x22c4, 0x2329, 0xf8e8, 0xf8e9, 0xf8ea, 0x2211, 0xf8eb, 0xf8ec,
- 0xf8ed, 0xf8ee, 0xf8ef, 0xf8f0, 0xf8f1, 0xf8f2, 0xf8f3, 0xf8f4,
- 0xf8ff, 0x232a, 0x222b, 0x2320, 0xf8f5, 0x2321, 0xf8f6, 0xf8f7,
- 0xf8f8, 0xf8f9, 0xf8fa, 0xf8fb, 0xf8fc, 0xf8fd, 0xf8fe, 0x02c7
-};
-
-/* I don't think iconv provides encodings for zapfdingbats nor jis201 */
-/* Perhaps I should list them here for compatability, but I think I'll just */
-/* leave them out. I doubt they get used. */
-static Encoding texbase = { "TeX-Base-Encoding", 256, tex_base_encoding, NULL, NULL, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, { 0, 0 }, 0, 0, 0, NULL, NULL, NULL, NULL, NULL, 0, 0 };
- Encoding custom = { "Custom", 0, NULL, NULL, &texbase, 1, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, { 0, 0 }, 0, 0, 0, NULL, NULL, NULL, NULL, NULL, 0, 0 };
-static Encoding original = { "Original", 0, NULL, NULL, &custom, 1, 1, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, { 0, 0 }, 0, 0, 0, NULL, NULL, NULL, NULL, NULL, 0, 0 };
-static Encoding unicodebmp = { "UnicodeBmp", 65536, NULL, NULL, &original, 1, 1, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, { 0, 0 }, 0, 0, 0, NULL, NULL, NULL, NULL, NULL, 0, 0 };
-static Encoding unicodefull = { "UnicodeFull", 17*65536, NULL, NULL, &unicodebmp, 1, 1, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0, { 0, 0 }, 0, 0, 0, NULL, NULL, NULL, NULL, NULL, 0, 0 };
-static Encoding adobestd = { "AdobeStandard", 256, unicode_from_adobestd, AdobeStandardEncoding, &unicodefull,
- 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, { 0, 0 }, 0, 0, 0, NULL, NULL, NULL, NULL, NULL, 0, 0 };
-static Encoding symbol = { "Symbol", 256, unicode_from_MacSymbol, NULL, &adobestd,1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, { 0, 0 }, 0, 0, 0, NULL, NULL, NULL, NULL, NULL, 0, 0 };
-
-Encoding *enclist = &symbol;
-
-const char *FindUnicharName(void) {
- /* Iconv and libiconv use different names for UCS2. Just great. Perhaps */
- /* different versions of each use still different names? */
- /* Even worse, both accept UCS-2, but under iconv it means native byte */
- /* ordering and under libiconv it means big-endian */
- iconv_t test;
- static char *goodname = NULL;
-#ifdef UNICHAR_16
- static char *names[] = { "UCS-2-INTERNAL", "UCS-2", "UCS2", "ISO-10646/UCS2", "UNICODE", NULL };
- static char *namesle[] = { "UCS-2LE", "UNICODELITTLE", NULL };
- static char *namesbe[] = { "UCS-2BE", "UNICODEBIG", NULL };
-#else
- static char *names[] = { "UCS-4-INTERNAL", "UCS-4", "UCS4", "ISO-10646-UCS-4", "UTF-32", NULL };
- static char *namesle[] = { "UCS-4LE", "UTF-32LE", NULL };
- static char *namesbe[] = { "UCS-4BE", "UTF-32BE", NULL };
-#endif
- char **testnames;
- int i;
- union {
- short s;
- char c[2];
- } u;
-
- if ( goodname!=NULL )
-return( goodname );
-
- u.c[0] = 0x1; u.c[1] = 0x2;
- if ( u.s==0x201 ) { /* Little endian */
- testnames = namesle;
- } else {
- testnames = namesbe;
- }
- for ( i=0; testnames[i]!=NULL; ++i ) {
- test = iconv_open(testnames[i],"ISO-8859-1");
- if ( test!=(iconv_t) -1 && test!=NULL ) {
- iconv_close(test);
- goodname = testnames[i];
- break;
- }
- }
-
- if ( goodname==NULL ) {
- for ( i=0; names[i]!=NULL; ++i ) {
- test = iconv_open(names[i],"ISO-8859-1");
- if ( test!=(iconv_t) -1 && test!=NULL ) {
- iconv_close(test);
- goodname = names[i];
- break;
- }
- }
- }
-
- if ( goodname==NULL ) {
-#ifdef UNICHAR_16
- IError( "I can't figure out your version of iconv(). I need a name for the UCS-2 encoding and I can't find one. Reconfigure --without-iconv. Bye.");
-#else
- IError( "I can't figure out your version of iconv(). I need a name for the UCS-4 encoding and I can't find one. Reconfigure --without-iconv. Bye.");
-#endif
- exit( 1 );
- }
-
- test = iconv_open(goodname,"Mac");
- if ( test==(iconv_t) -1 || test==NULL ) {
- IError( "Your version of iconv does not support the \"Mac Roman\" encoding.\nIf this causes problems, reconfigure --without-iconv." );
- } else
- iconv_close(test);
-
- /* I really should check for ISO-2022-JP, KR, CN, and all the other encodings */
- /* I might find in a ttf 'name' table. But those tables take too long to build */
-return( goodname );
-}
-
-static int TryEscape( Encoding *enc,char *escape_sequence ) {
- char from[20], ucs[20];
- size_t fromlen, tolen;
- ICONV_CONST char *fpt;
- char *upt;
- int i, j, low;
- int esc_len = strlen(escape_sequence);
-
- strcpy(from,escape_sequence);
-
- enc->has_2byte = false;
- low = -1;
- for ( i=0; i<256; ++i ) if ( i!=escape_sequence[0] ) {
- for ( j=0; j<256; ++j ) {
- from[esc_len] = i; from[esc_len+1] = j; from[esc_len+2] = 0;
- fromlen = esc_len+2;
- fpt = from;
- upt = ucs;
- tolen = sizeof(ucs);
- if ( iconv( enc->tounicode , &fpt, &fromlen, &upt, &tolen )!= (size_t) (-1) &&
- upt-ucs==sizeof(unichar_t) /* Exactly one character */ ) {
- if ( low==-1 ) {
- enc->low_page = low = i;
- enc->has_2byte = true;
- }
- enc->high_page = i;
- break;
- }
- }
- }
- if ( enc->low_page==enc->high_page )
- enc->has_2byte = false;
- if ( enc->has_2byte ) {
- strcpy(enc->iso_2022_escape, escape_sequence);
- enc->iso_2022_escape_len = esc_len;
- }
-return( enc->has_2byte );
-}
-
-Encoding *_FindOrMakeEncoding(const char *name,int make_it) {
- Encoding *enc;
- char buffer[20];
- const char *iconv_name;
- Encoding temp;
- uint8 good[256];
- int i, j, any, all;
- char from[8], ucs[20];
- size_t fromlen, tolen;
- ICONV_CONST char *fpt;
- char *upt;
- /* iconv is not case sensitive */
-
- if ( strncasecmp(name,"iso8859_",8)==0 || strncasecmp(name,"koi8_",5)==0 ) {
- /* Fixup for old naming conventions */
- strncpy(buffer,name,sizeof(buffer));
- *strchr(buffer,'_') = '-';
- name = buffer;
- } else if ( strcasecmp(name,"iso-8859")==0 ) {
- /* Fixup for old naming conventions */
- strncpy(buffer,name,3);
- strncpy(buffer+3,name+4,sizeof(buffer)-3);
- name = buffer;
- } else if ( strcasecmp(name,"isolatin1")==0 ) {
- name = "iso8859-1";
- } else if ( strcasecmp(name,"isocyrillic")==0 ) {
- name = "iso8859-5";
- } else if ( strcasecmp(name,"isoarabic")==0 ) {
- name = "iso8859-6";
- } else if ( strcasecmp(name,"isogreek")==0 ) {
- name = "iso8859-7";
- } else if ( strcasecmp(name,"isohebrew")==0 ) {
- name = "iso8859-8";
- } else if ( strcasecmp(name,"isothai")==0 ) {
- name = "tis-620"; /* TIS doesn't define non-breaking space in 0xA0 */
- } else if ( strcasecmp(name,"latin0")==0 || strcasecmp(name,"latin9")==0 ) {
- name = "iso8859-15"; /* "latin-9" is supported (libiconv bug?) */
- } else if ( strcasecmp(name,"koi8r")==0 ) {
- name = "koi8-r";
- } else if ( strncasecmp(name,"jis201",6)==0 || strncasecmp(name,"jisx0201",8)==0 ) {
- name = "jis_x0201";
- } else if ( strcasecmp(name,"AdobeStandardEncoding")==0 || strcasecmp(name,"Adobe")==0 )
- name = "AdobeStandard";
- for ( enc=enclist; enc!=NULL; enc=enc->next )
- if ( strmatch(name,enc->enc_name)==0 ||
- (enc->iconv_name!=NULL && strmatch(name,enc->iconv_name)==0))
-return( enc );
- if ( strmatch(name,"unicode")==0 || strmatch(name,"iso10646")==0 || strmatch(name,"iso10646-1")==0 )
-return( &unicodebmp );
- if ( strmatch(name,"unicode4")==0 || strmatch(name,"ucs4")==0 )
-return( &unicodefull );
-
- iconv_name = name;
- /* Mac seems to work ok */
- if ( strcasecmp(name,"win")==0 || strcasecmp(name,"ansi")==0 )
- iconv_name = "MS-ANSI"; /* "WINDOWS-1252";*/
- else if ( strcasecmp(name,"gb2312pk")==0 || strcasecmp(name,"gb2312packed")==0 )
- iconv_name = "EUC-CN";
- else if ( strcasecmp(name,"wansung")==0 )
- iconv_name = "EUC-KR";
- else if ( strcasecmp(name,"EUC-CN")==0 ) {
- iconv_name = name;
- name = "gb2312pk";
- } else if ( strcasecmp(name,"EUC-KR")==0 ) {
- iconv_name = name;
- name = "wansung";
- }
-
-/* Escape sequences: */
-/* ISO-2022-CN: \e $ ) A ^N */
-/* ISO-2022-KR: \e $ ) C ^N */
-/* ISO-2022-JP: \e $ B */
-/* ISO-2022-JP-2: \e $ ( D */
-/* ISO-2022-JP-3: \e $ ( O */ /* Capital "O", not zero */
-/* ISO-2022-CN-EXT: \e $ ) E ^N */ /* Not sure about this, also uses CN escape */
-
- memset(&temp,0,sizeof(temp));
- temp.builtin = true;
- temp.tounicode = iconv_open(FindUnicharName(),iconv_name);
- if ( temp.tounicode==(iconv_t) -1 || temp.tounicode==NULL )
-return( NULL ); /* Iconv doesn't recognize this name */
- temp.fromunicode = iconv_open(iconv_name,FindUnicharName());
- if ( temp.fromunicode==(iconv_t) -1 || temp.fromunicode==NULL ) {
- /* This should never happen, but if it does... */
- iconv_close(temp.tounicode);
-return( NULL );
- }
-
- memset(good,0,sizeof(good));
- any = false; all = true;
- for ( i=1; i<256; ++i ) {
- from[0] = i; from[1] = 0;
- fromlen = 1;
- fpt = from;
- upt = ucs;
- tolen = sizeof(ucs);
- if ( iconv( temp.tounicode , &fpt, &fromlen, &upt, &tolen )!= (size_t) (-1)) {
- good[i] = true;
- any = true;
- } else
- all = false;
- }
- if ( any )
- temp.has_1byte = true;
- if ( all )
- temp.only_1byte = true;
-
- if ( !all ) {
- if ( strstr(iconv_name,"2022")==NULL ) {
- for ( i=temp.has_1byte; i<256; ++i ) if ( !good[i] ) {
- for ( j=0; j<256; ++j ) {
- from[0] = i; from[1] = j; from[2] = 0;
- fromlen = 2;
- fpt = from;
- upt = ucs;
- tolen = sizeof(ucs);
- if ( iconv( temp.tounicode , &fpt, &fromlen, &upt, &tolen )!= (size_t) (-1) &&
- upt-ucs==sizeof(unichar_t) /* Exactly one character */ ) {
- if ( temp.low_page==-1 )
- temp.low_page = i;
- temp.high_page = i;
- temp.has_2byte = true;
- break;
- }
- }
- }
- if ( temp.low_page==temp.high_page ) {
- temp.has_2byte = false;
- temp.low_page = temp.high_page = -1;
- }
- }
- if ( !temp.has_2byte && !good[033]/* escape */ ) {
- if ( strstr(iconv_name,"2022")!=NULL &&
- strstr(iconv_name,"JP3")!=NULL &&
- TryEscape( &temp,"\33$(O" )) {
- ;
- }
- else if ( strstr(iconv_name,"2022")!=NULL &&
- strstr(iconv_name,"JP2")!=NULL &&
- TryEscape( &temp,"\33$(D" )) {
- ;
- }
- else if ( strstr(iconv_name,"2022")!=NULL &&
- strstr(iconv_name,"JP")!=NULL &&
- TryEscape( &temp,"\33$B" )) {
- ;
- }
- else if ( strstr(iconv_name,"2022")!=NULL &&
- strstr(iconv_name,"KR")!=NULL &&
- TryEscape( &temp,"\33$)C\16" )) {
- ;
- }
- else if ( strstr(iconv_name,"2022")!=NULL &&
- strstr(iconv_name,"CN")!=NULL &&
- TryEscape( &temp,"\33$)A\16" )) {
- ;
- }
- }
- }
- if ( !temp.has_1byte && !temp.has_2byte )
-return( NULL );
- if ( !make_it )
-return( NULL );
-
- enc = chunkalloc(sizeof(Encoding));
- *enc = temp;
- enc->enc_name = copy(name);
- if ( iconv_name!=name )
- enc->iconv_name = copy(iconv_name);
- enc->next = enclist;
- enc->builtin = true;
- enclist = enc;
- if ( enc->has_2byte )
- enc->char_cnt = (enc->high_page<<8) + 256;
- else {
- enc->char_cnt = 256;
- enc->only_1byte = true;
- }
- if ( strstrmatch(iconv_name,"JP")!=NULL ||
- strstrmatch(iconv_name,"sjis")!=NULL ||
- strstrmatch(iconv_name,"cp932")!=NULL )
- enc->is_japanese = true;
- else if ( strstrmatch(iconv_name,"KR")!=NULL )
- enc->is_korean = true;
- else if ( strstrmatch(iconv_name,"CN")!=NULL )
- enc->is_simplechinese = true;
- else if ( strstrmatch(iconv_name,"BIG")!=NULL && strstrmatch(iconv_name,"5")!=NULL )
- enc->is_tradchinese = true;
-
- if ( strstrmatch(name,"ISO8859")!=NULL &&
- strtol(name+strlen(name)-2,NULL,10)>=16 )
- /* Not in our menu, don't hide */;
- else if ( iconv_name!=name || strmatch(name,"mac")==0 || strstrmatch(name,"ISO8859")!=NULL ||
- strmatch(name,"koi8-r")==0 || strmatch(name,"sjis")==0 ||
- strmatch(name,"big5")==0 || strmatch(name,"big5hkscs")==0 )
- enc->hidden = true;
-
-return( enc );
-}
-
-Encoding *FindOrMakeEncoding(const char *name) {
-return( _FindOrMakeEncoding(name,true));
-}
-
-
-/* ************************************************************************** */
-/* ****************************** CID Encodings ***************************** */
-/* ************************************************************************** */
-struct cidmap *cidmaps = NULL;
-
-int CID2NameUni(struct cidmap *map,int cid, char *buffer, int len) {
- int enc = -1;
- const char *temp;
-
-#if defined( _NO_SNPRINTF ) || defined( __VMS )
- if ( map==NULL )
- sprintf(buffer,"cid-%d", cid);
- else if ( cid<map->namemax && map->name[cid]!=NULL )
- strncpy(buffer,map->name[cid],len);
- else if ( cid==0 || (cid<map->namemax && map->unicode[cid]!=0 )) {
- if ( map->unicode==NULL || map->namemax==0 )
- enc = 0;
- else
- enc = map->unicode[cid];
- temp = StdGlyphName(buffer,enc,ui_none,(NameList *) -1);
- if ( temp!=buffer )
- strcpy(buffer,temp);
- } else
- sprintf(buffer,"%s.%d", map->ordering, cid);
-#else
- if ( map==NULL )
- snprintf(buffer,len,"cid-%d", cid);
- else if ( cid<map->namemax && map->name[cid]!=NULL )
- strncpy(buffer,map->name[cid],len);
- else if ( cid==0 )
- strcpy(buffer,".notdef");
- else if ( cid<map->namemax && map->unicode[cid]!=0 ) {
- if ( map->unicode==NULL || map->namemax==0 )
- enc = 0;
- else
- enc = map->unicode[cid];
- temp = StdGlyphName(buffer,enc,ui_none,(NameList *) -1);
- if ( temp!=buffer )
- strcpy(buffer,temp);
- } else
- snprintf(buffer,len,"%s.%d", map->ordering, cid);
-#endif
-return( enc );
-}
-
-int NameUni2CID(struct cidmap *map,int uni, const char *name) {
- int i;
-
- if ( map==NULL )
-return( -1 );
- if ( uni!=-1 ) {
- for ( i=0; i<map->namemax; ++i )
- if ( map->unicode[i]==(unsigned)uni )
-return( i );
- } else {
- for ( i=0; i<map->namemax; ++i )
- if ( map->name[i]!=NULL && strcmp(map->name[i],name)==0 )
-return( i );
- }
-return( -1 );
-}
-
-int MaxCID(struct cidmap *map) {
-return( map->cidmax );
-}
-
-static struct cidmap *MakeDummyMap(char *registry,char *ordering,int supplement) {
- struct cidmap *ret = galloc(sizeof(struct cidmap));
-
- ret->registry = copy(registry);
- ret->ordering = copy(ordering);
- ret->supplement = ret->maxsupple = supplement;
- ret->cidmax = ret->namemax = 0;
- ret->unicode = NULL; ret->name = NULL;
- ret->next = cidmaps;
- cidmaps = ret;
-return( ret );
-}
-
-struct cidmap *FindCidMap(char *registry,char *ordering,int supplement,SplineFont *sf) {
-return( MakeDummyMap(registry,ordering,supplement));
-}
-
-/* ************************** Reencoding routines ************************** */
-
-
-EncMap *EncMapFromEncoding(SplineFont *sf,Encoding *enc) {
- int i,j, extras, found, base, unmax;
- int *encoded, *unencoded;
- EncMap *map;
- struct altuni *altuni;
- SplineChar *sc;
-
- if ( enc==NULL )
-return( NULL );
-
- base = enc->char_cnt;
- if ( enc->is_original )
- base = 0;
- else if ( enc->char_cnt<=256 )
- base = 256;
- else if ( enc->char_cnt<=0x10000 )
- base = 0x10000;
- if (base==0)
-return( NULL );
- encoded = galloc(base*sizeof(int));
- memset(encoded,-1,base*sizeof(int));
- unencoded = galloc(sf->glyphcnt*sizeof(int));
- unmax = sf->glyphcnt;
-
- for ( i=extras=0; i<sf->glyphcnt; ++i ) if ( (sc=sf->glyphs[i])!=NULL ) {
- found = false;
- if ( enc->psnames!=NULL ) {
- for ( j=enc->char_cnt-1; j>=0; --j ) {
- if ( enc->psnames[j]!=NULL &&
- strcmp(enc->psnames[j],sc->name)==0 ) {
- found = true;
- encoded[j] = i;
- }
- }
- }
- if ( !found ) {
- if ( sc->unicodeenc!=-1 &&
- sc->unicodeenc<unicode4_size &&
- (j = EncFromUni(sc->unicodeenc,enc))!= -1 )
- encoded[j] = i;
- else {
- /* I don't think extras can surpass unmax now, but it doesn't */
- /* hurt to leave the code (it's from when we encoded duplicates see below) */
- if ( extras>=unmax ) unencoded = grealloc(unencoded,(unmax+=300)*sizeof(int));
- unencoded[extras++] = i;
- }
- for ( altuni=sc->altuni; altuni!=NULL; altuni=altuni->next ) {
- if ( altuni->unienc!=-1 &&
- altuni->unienc<unicode4_size &&
- altuni->vs==-1 &&
- altuni->fid==0 &&
- (j = EncFromUni(altuni->unienc,enc))!= -1 )
- encoded[j] = i;
- /* I used to have code here to add these unencoded duplicates */
- /* but I don't really see any reason to do so. The main unicode */
- /* will occur, and any encoded duplicates so the glyph won't */
- /* vanish */
- }
- }
- }
-
- /* Some glyphs have both a pua encoding and an encoding in a non-bmp */
- /* plane. Big5HK does and the AMS glyphs do */
- if ( enc->is_unicodefull && (sf->uni_interp == ui_trad_chinese ||
- sf->uni_interp == ui_ams )) {
- extern const int cns14pua[], amspua[];
- const int *pua = sf->uni_interp == ui_ams? amspua : cns14pua;
- for ( i=0xe000; i<0xf8ff; ++i ) {
- if ( pua[i-0xe000]!=0 )
- encoded[pua[i-0xe000]] = encoded[i];
- }
- }
-
- if ( enc->psnames != NULL ) {
- /* Names are more important than unicode code points for some encodings */
- /* AdobeStandard for instance which won't work if you have a glyph */
- /* named "f_i" (must be "fi") even though the code point is correct */
- /* The code above would match f_i where AS requires fi, so force the */
- /* names to be correct. */
- for ( j=0; j<enc->char_cnt; ++j ) {
- if ( encoded[j]!=-1 && enc->psnames[j]!=NULL &&
- strcmp(sf->glyphs[encoded[j]]->name,enc->psnames[j])!=0 ) {
- free(sf->glyphs[encoded[j]]->name);
- sf->glyphs[encoded[j]]->name = copy(enc->psnames[j]);
- }
- }
- }
-
- map = chunkalloc(sizeof(EncMap));
- map->enccount = map->encmax = base + extras;
- map->map = galloc(map->enccount*sizeof(int));
- memcpy(map->map,encoded,base*sizeof(int));
- memcpy(map->map+base,unencoded,extras*sizeof(int));
- map->backmax = sf->glyphcnt;
- map->backmap = galloc(sf->glyphcnt*sizeof(int));
- memset(map->backmap,-1,sf->glyphcnt*sizeof(int)); /* Just in case there are some unencoded glyphs (duplicates perhaps) */
- for ( i = map->enccount-1; i>=0; --i ) if ( map->map[i]!=-1 )
- map->backmap[map->map[i]] = i;
- map->enc = enc;
-
- free(encoded);
- free(unencoded);
-
-return( map );
-}
-
-EncMap *CompactEncMap(EncMap *map, SplineFont *sf) {
- int i, inuse, gid;
- int32 *newmap;
-
- for ( i=inuse=0; i<map->enccount ; ++i )
- if ( (gid = map->map[i])!=-1 && SCWorthOutputting(sf->glyphs[gid]))
- ++inuse;
- newmap = galloc(inuse*sizeof(int32));
- for ( i=inuse=0; i<map->enccount ; ++i )
- if ( (gid = map->map[i])!=-1 && SCWorthOutputting(sf->glyphs[gid]))
- newmap[inuse++] = gid;
- free(map->map);
- map->map = newmap;
- map->enccount = inuse;
- map->encmax = inuse;
- map->enc = &custom;
- memset(map->backmap,-1,sf->glyphcnt*sizeof(int));
- for ( i=inuse-1; i>=0; --i )
- if ( (gid=map->map[i])!=-1 )
- map->backmap[gid] = i;
-return( map );
-}
-
-
-static int MapAddEncodingSlot(EncMap *map,int gid) {
- int enc;
-
- if ( map->enccount>=map->encmax )
- map->map = grealloc(map->map,(map->encmax+=10)*sizeof(int));
- enc = map->enccount++;
- map->map[enc] = gid;
- map->backmap[gid] = enc;
-return( enc );
-}
-
-void FVAddEncodingSlot(FontViewBase *fv,int gid) {
- EncMap *map = fv->map;
- int enc;
-
- enc = MapAddEncodingSlot(map,gid);
-
- fv->selected = grealloc(fv->selected,map->enccount);
- fv->selected[enc] = 0;
- FVAdjustScrollBarRows(fv,enc);
-}
-
-static int MapAddEnc(SplineFont *sf,SplineChar *sc,EncMap *basemap, EncMap *map,int baseenc, int gid, FontViewBase *fv) {
- int any = false, enc;
-
- if ( gid>=map->backmax ) {
- map->backmap = grealloc(map->backmap,(map->backmax+=10)*sizeof(int));
- memset(map->backmap+map->backmax-10,-1,10*sizeof(int));
- }
- if ( map->enc->psnames!=NULL ) {
- /* Check for multiple encodings */
- for ( enc = map->enc->char_cnt-1; enc>=0; --enc ) {
- if ( map->enc->psnames[enc]!=NULL && strcmp(sc->name,map->enc->psnames[enc])==0 ) {
- if ( !any ) {
- map->backmap[gid] = enc;
- any = true;
- }
- map->map[enc] = gid;
- }
- }
- } else {
- enc = SFFindSlot(sf,map,sc->unicodeenc,sc->name);
- if ( enc!=-1 ) {
- map->map[enc] = gid;
- map->backmap[gid] = enc;
- any = true;
- }
- }
- if ( basemap!=NULL && map->enc==basemap->enc && baseenc!=-1 ) {
- if ( baseenc>=map->enccount ) {
- if ( map==fv->map )
- FVAddEncodingSlot(fv,gid);
- else
- MapAddEncodingSlot(map,gid);
- } else {
- map->map[baseenc] = gid;
- if ( map->backmap[gid]==-1 )
- map->backmap[gid] = baseenc;
- }
- any = true;
- }
-return( any );
-}
-
-void SFAddGlyphAndEncode(SplineFont *sf,SplineChar *sc,EncMap *basemap, int baseenc) {
- int gid, mapfound = false;
- FontViewBase *fv;
- BDFFont *bdf;
-
- if ( sf->cidmaster==NULL ) {
- if ( sf->glyphcnt+1>=sf->glyphmax )
- sf->glyphs = grealloc(sf->glyphs,(sf->glyphmax+=10)*sizeof(SplineChar *));
- gid = sf->glyphcnt++;
- for ( bdf = sf->bitmaps; bdf!=NULL; bdf=bdf->next ) {
- if ( sf->glyphcnt+1>=bdf->glyphmax )
- bdf->glyphs = grealloc(bdf->glyphs,(bdf->glyphmax=sf->glyphmax)*sizeof(BDFChar *));
- if ( sf->glyphcnt>bdf->glyphcnt ) {
- memset(bdf->glyphs+bdf->glyphcnt,0,(sf->glyphcnt-bdf->glyphcnt)*sizeof(BDFChar *));
- bdf->glyphcnt = sf->glyphcnt;
- }
- }
- for ( fv=sf->fv; fv!=NULL; fv = fv->nextsame ) {
- EncMap *map = fv->map;
- if ( gid>=map->backmax )
- map->backmap = grealloc(map->backmap,(map->backmax=gid+10)*sizeof(int));
- map->backmap[gid] = -1;
- }
- } else {
- gid = baseenc;
- if ( baseenc+1>=sf->glyphmax )
- sf->glyphs = grealloc(sf->glyphs,(sf->glyphmax = baseenc+10)*sizeof(SplineChar *));
- if ( baseenc>=sf->glyphcnt ) {
- memset(sf->glyphs+sf->glyphcnt,0,(baseenc+1-sf->glyphcnt)*sizeof(SplineChar *));
- sf->glyphcnt = baseenc+1;
- for ( bdf = sf->cidmaster->bitmaps; bdf!=NULL; bdf=bdf->next ) {
- if ( baseenc+1>=bdf->glyphmax )
- bdf->glyphs = grealloc(bdf->glyphs,(bdf->glyphmax=baseenc+10)*sizeof(BDFChar *));
- if ( baseenc+1>bdf->glyphcnt ) {
- memset(bdf->glyphs+bdf->glyphcnt,0,(baseenc+1-bdf->glyphcnt)*sizeof(BDFChar *));
- bdf->glyphcnt = baseenc+1;
- }
- }
- for ( fv=sf->fv; fv!=NULL; fv = fv->nextsame ) if ( fv->sf==sf ) {
- EncMap *map = fv->map;
- if ( gid>=map->backmax )
- map->backmap = grealloc(map->backmap,(map->backmax=gid+10)*sizeof(int));
- map->backmap[gid] = -1;
- }
- }
- }
- sf->glyphs[gid] = NULL;
- for ( fv=sf->fv; fv!=NULL; fv = fv->nextsame ) {
- EncMap *map = fv->map;
-
- FVBiggerGlyphCache(fv,gid);
-
- if ( !MapAddEnc(sf,sc,basemap,map,baseenc,gid,fv) )
- FVAddEncodingSlot(fv,gid);
- if ( map==basemap ) mapfound = true;
- if ( fv->normal!=NULL ) {
- if ( !MapAddEnc(sf,sc,basemap,fv->normal,baseenc,gid,fv))
- MapAddEncodingSlot(fv->normal,gid);
- }
- }
- if ( !mapfound && basemap!=NULL )
- MapAddEnc(sf,sc,basemap,basemap,baseenc,gid,fv);
- sf->glyphs[gid] = sc;
- sc->orig_pos = gid;
- sc->parent = sf;
- SFHashGlyph(sf,sc);
-}
-
-
-int32 UniFromEnc(int enc, Encoding *encname) {
- char from[20];
- unichar_t to[20];
- ICONV_CONST char *fpt;
- char *tpt;
- size_t fromlen, tolen;
-
- if ( encname->is_custom || encname->is_original )
-return( -1 );
- if ( enc>=encname->char_cnt )
-return( -1 );
- if ( encname->is_unicodebmp || encname->is_unicodefull )
-return( enc );
- if ( encname->unicode!=NULL )
-return( encname->unicode[enc] );
- else if ( encname->tounicode ) {
- /* To my surprise, on RH9, doing a reset on conversion of CP1258->UCS2 */
- /* causes subsequent calls to return garbage */
- if ( encname->iso_2022_escape_len ) {
- tolen = sizeof(to); fromlen = 0;
- iconv(encname->tounicode,NULL,&fromlen,NULL,&tolen); /* Reset state */
- }
- fpt = from; tpt = (char *) to; tolen = sizeof(to);
- if ( encname->has_1byte && enc<256 ) {
- *(char *) fpt = enc;
- fromlen = 1;
- } else if ( encname->has_2byte ) {
- if ( encname->iso_2022_escape_len )
- strncpy(from,encname->iso_2022_escape,encname->iso_2022_escape_len );
- fromlen = encname->iso_2022_escape_len;
- from[fromlen++] = enc>>8;
- from[fromlen++] = enc&0xff;
- }
- if ( iconv(encname->tounicode,&fpt,&fromlen,&tpt,&tolen)==(size_t) -1 )
-return( -1 );
- if ( tpt-(char *) to == 0 ) {
- /* This strange call appears to be what we need to make CP1258->UCS2 */
- /* work. It's supposed to reset the state and give us the shift */
- /* out. As there is no state, and no shift out I have no idea why*/
- /* this works, but it does. */
- if ( iconv(encname->tounicode,NULL,&fromlen,&tpt,&tolen)==(size_t) -1 )
-return( -1 );
- }
- if ( tpt-(char *) to == sizeof(unichar_t) )
-return( to[0] );
-#ifdef UNICHAR_16
- else if ( tpt-(char *) to == 4 && to[0]>=0xd800 && to[0]<0xdc00 && to[1]>=0xdc00 )
-return( ((to[0]-0xd800)<<10) + (to[1]-0xdc00) + 0x10000 );
-#endif
- } else if ( encname->tounicode_func!=NULL ) {
-return( (encname->tounicode_func)(enc) );
- }
-return( -1 );
-}
-
-int32 EncFromUni(int32 uni, Encoding *enc) {
- unichar_t from[20];
- unsigned char to[20];
- ICONV_CONST char *fpt;
- char *tpt;
- size_t fromlen, tolen;
- int i;
-
- if ( enc->is_custom || enc->is_original || enc->is_compact || uni==-1 )
-return( -1 );
- if ( enc->is_unicodebmp || enc->is_unicodefull )
-return( uni<enc->char_cnt ? uni : -1 );
-
- if ( enc->unicode!=NULL ) {
- for ( i=0; i<enc->char_cnt; ++i ) {
- if ( enc->unicode[i]==uni )
-return( i );
- }
-return( -1 );
- } else if ( enc->fromunicode!=NULL ) {
- /* I don't see how there can be any state to reset in this direction */
- /* So I don't reset it */
-#ifdef UNICHAR_16
- if ( uni<0x10000 ) {
- from[0] = uni;
- fromlen = sizeof(unichar_t);
- } else {
- uni -= 0x10000;
- from[0] = 0xd800 + (uni>>10);
- from[1] = 0xdc00 + (uni&0x3ff);
- fromlen = 2*sizeof(unichar_t);
- }
-#else
- from[0] = uni;
- fromlen = sizeof(unichar_t);
-#endif
- fpt = (char *) from; tpt = (char *) to; tolen = sizeof(to);
- iconv(enc->fromunicode,NULL,NULL,NULL,NULL); /* reset shift in/out, etc. */
- if ( iconv(enc->fromunicode,&fpt,&fromlen,&tpt,&tolen)==(size_t) -1 )
-return( -1 );
- if ( tpt-(char *) to == 1 )
-return( to[0] );
- if ( enc->iso_2022_escape_len!=0 ) {
- if ( tpt-(char *) to == enc->iso_2022_escape_len+2 &&
- strncmp((char *) to,enc->iso_2022_escape,enc->iso_2022_escape_len)==0 )
-return( (to[enc->iso_2022_escape_len]<<8) | to[enc->iso_2022_escape_len+1] );
- } else {
- if ( tpt-(char *) to == sizeof(unichar_t) )
-return( (to[0]<<8) | to[1] );
- }
- } else if ( enc->fromunicode_func!=NULL ) {
-return( (enc->fromunicode_func)(uni) );
- }
-return( -1 );
-}
-
-int32 EncFromName(const char *name,enum uni_interp interp,Encoding *encname) {
- int i;
- if ( encname->psnames!=NULL ) {
- for ( i=0; i<encname->char_cnt; ++i )
- if ( encname->psnames[i]!=NULL && strcmp(name,encname->psnames[i])==0 )
-return( i );
- }
- i = UniFromName(name,interp,encname);
- if ( i==-1 && strlen(name)==4 ) {
- /* MS says use this kind of name, Adobe says use the one above */
- char *end;
- i = strtol(name,&end,16);
- if ( i<0 || i>0xffff || *end!='\0' )
-return( -1 );
- }
-return( EncFromUni(i,encname));
-}
-
-void SFExpandGlyphCount(SplineFont *sf, int newcnt) {
- int old = sf->glyphcnt;
- FontViewBase *fv;
-
- if ( old>=newcnt )
-return;
- if ( sf->glyphmax<newcnt ) {
- sf->glyphs = grealloc(sf->glyphs,newcnt*sizeof(SplineChar *));
- sf->glyphmax = newcnt;
- }
- memset(sf->glyphs+sf->glyphcnt,0,(newcnt-sf->glyphcnt)*sizeof(SplineChar *));
- sf->glyphcnt = newcnt;
-
- for ( fv=sf->fv; fv!=NULL; fv=fv->nextsame ) {
- if ( fv->sf==sf ) { /* Beware of cid keyed fonts which might look at a different subfont */
- if ( fv->normal!=NULL )
- continue; /* If compacted then we haven't added any glyphs so haven't changed anything */
- /* Don't display any of these guys, so not mapped. */
- /* No change to selection, or to map->map, but change to backmap */
- if ( newcnt>fv->map->backmax )
- fv->map->backmap = grealloc(fv->map->backmap,(fv->map->backmax = newcnt+5)*sizeof(int32));
- memset(fv->map->backmap+old,-1,(newcnt-old)*sizeof(int32));
- }
- }
-}
diff --git a/Build/source/texk/web2c/luatexdir/luafontloader/fontforge/fontforge/encoding.h b/Build/source/texk/web2c/luatexdir/luafontloader/fontforge/fontforge/encoding.h
deleted file mode 100644
index c272c6d2ff7..00000000000
--- a/Build/source/texk/web2c/luatexdir/luafontloader/fontforge/fontforge/encoding.h
+++ /dev/null
@@ -1,18 +0,0 @@
-#ifndef _ENCODING_H
-#define _ENCODING_H
-
-struct cidmap {
- char *registry, *ordering;
- int supplement, maxsupple;
- int cidmax; /* Max cid found in the charset */
- int namemax; /* Max cid with useful info */
- uint32 *unicode;
- char **name;
- struct cidmap *next;
-};
-
-extern struct cidmap *cidmaps;
-
-extern void DeleteEncoding(Encoding *me);
-extern void RemoveMultiples(Encoding *item);
-#endif
diff --git a/Build/source/texk/web2c/luatexdir/luafontloader/fontforge/fontforge/featurefile.c b/Build/source/texk/web2c/luatexdir/luafontloader/fontforge/fontforge/featurefile.c
deleted file mode 100644
index bf89c45f6ca..00000000000
--- a/Build/source/texk/web2c/luatexdir/luafontloader/fontforge/fontforge/featurefile.c
+++ /dev/null
@@ -1,4208 +0,0 @@
-/* Copyright (C) 2000-2008 by George Williams */
-/*
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are met:
-
- * Redistributions of source code must retain the above copyright notice, this
- * list of conditions and the following disclaimer.
-
- * Redistributions in binary form must reproduce the above copyright notice,
- * this list of conditions and the following disclaimer in the documentation
- * and/or other materials provided with the distribution.
-
- * The name of the author may not be used to endorse or promote products
- * derived from this software without specific prior written permission.
-
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
- * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
- * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
- * EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
- * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
- * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
- * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
- * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-#include "fontforgevw.h"
-#include "ttf.h"
-#include <stdio.h>
-#include <math.h>
-#include <stdlib.h>
-#ifdef __need_size_t
-/* This is a bug on the mac, someone defines this and leaves it defined */
-/* that means when I load stddef.h it only defines size_t and doesn't */
-/* do offset_of, which is what I need */
-# undef __need_size_t
-#endif
-#include <stddef.h>
-#include <string.h>
-#include <utype.h>
-#include <ustring.h>
-
-
-
-/* ************************************************************************** */
-/* ******************************* Parse feat ******************************* */
-/* ************************************************************************** */
-
-#include <gfile.h>
-
-struct nameid {
- uint16 strid;
- uint16 platform, specific, language;
- char *utf8_str;
- struct nameid *next;
-};
-
-struct tablekeywords {
- char *name;
- int size; /* 1=>byte, 2=>short, 4=>int32 */
- int cnt; /* normally 1, but 10 for panose, -1 for infinite */
- int offset; /* -1 => parse but don't store */
-};
-
-struct tablevalues {
- int index; /* in the table key structure above */
- int value;
- uint8 panose_vals[10];
- struct tablevalues *next;
-};
-
-enum feat_type { ft_lookup_start, ft_lookup_end, ft_feat_start, ft_feat_end,
- ft_table, ft_names, ft_gdefclasses, ft_lcaret, ft_tablekeys,
- ft_sizeparams,
- ft_subtable, ft_script, ft_lang, ft_lookupflags, ft_langsys,
- ft_pst, ft_pstclass, ft_fpst, ft_ap, ft_lookup_ref };
-struct feat_item {
- uint16 /* enum feat_type */ type;
- uint8 ticked;
- union {
- SplineChar *sc; /* For psts, aps */
- char *class; /* List of glyph names for kerning by class, lcarets */
- char *lookup_name; /* for lookup_start/ lookup_ref */
- uint32 tag; /* for feature/script/lang tag */
- int *params; /* size params */
- struct tablekeywords *offsets;
- char **gdef_classes;
- } u1;
- union {
- PST *pst;
- /* For kerning by class we'll generate an invalid pst with the class as the "paired" field */
- FPST *fpst;
- AnchorPoint *ap;
- int lookupflags;
- struct scriptlanglist *sl; /* Default langsyses for features/langsys */
- int exclude_dflt; /* for lang tags */
- struct nameid *names; /* size params */
- struct tablevalues *tvals;
- int16 *lcaret;
- } u2;
- char *mark_class; /* For mark to base-ligature-mark, names of all marks which attach to this anchor */
- struct feat_item *next, *lookup_next;
-};
-
-static int strcmpD(const void *_str1, const void *_str2) {
- const char *str1 = *(const char **)_str1, *str2 = *(const char **) _str2;
-return( strcmp(str1,str2));
-}
-
-/* Order glyph classes just so we can do a simple string compare to check for */
-/* class match. So the order doesn't really matter, just so it is consistent */
-static char *fea_canonicalClassOrder(char *class) {
- int name_cnt, i;
- char *pt, **names, *cpt;
- char *temp = copy(class);
-
- name_cnt = 0;
- for ( pt = class; ; ) {
- while ( *pt==' ' ) ++pt;
- if ( *pt=='\0' )
- break;
- for ( ; *pt!=' ' && *pt!='\0'; ++pt );
- ++name_cnt;
- }
-
- names = galloc(name_cnt*sizeof(char *));
- name_cnt = 0;
- for ( pt = temp; ; ) {
- while ( *pt==' ' ) ++pt;
- if ( *pt=='\0' )
- break;
- for ( names[name_cnt++]=pt ; *pt!=' ' && *pt!='\0'; ++pt );
- if ( *pt==' ' )
- *pt++ = '\0';
- }
-
- qsort(names,name_cnt,sizeof(char *),strcmpD);
- cpt = class;
- for ( i=0; i<name_cnt; ++i ) {
- strcpy(cpt,names[i]);
- cpt += strlen(cpt);
- *cpt++ = ' ';
- }
- if ( name_cnt!=0 )
- cpt[-1] = '\0';
- free(names);
- free(temp);
-
-return( class );
-}
-
-static int fea_classesIntersect(char *class1, char *class2) {
- char *pt1, *start1, *pt2, *start2;
- int ch1, ch2;
-
- for ( pt1=class1 ; ; ) {
- while ( *pt1==' ' ) ++pt1;
- if ( *pt1=='\0' )
- return( 0 );
- for ( start1 = pt1; *pt1!=' ' && *pt1!='\0'; ++pt1 );
- ch1 = *pt1; *pt1 = '\0';
- for ( pt2=class2 ; ; ) {
- while ( *pt2==' ' ) ++pt2;
- if ( *pt2=='\0' )
- break;
- for ( start2 = pt2; *pt2!=' ' && *pt2!='\0'; ++pt2 );
- ch2 = *pt2; *pt2 = '\0';
- if ( strcmp(start1,start2)==0 ) {
- *pt2 = ch2; *pt1 = ch1;
- return( 1 );
- }
- *pt2 = ch2;
- }
- *pt1 = ch1;
- }
-}
-
-
-#define SKIP_SPACES(s, i) \
- do { \
- while ((s)[i] == ' ') \
- i++; \
- } \
- while (0)
-
-#define FIND_SPACE(s, i) \
- do { \
- while ((s)[i] != ' ' && (s)[i] != '\0') \
- i++; \
- } \
- while (0)
-
-
-static char *fea_classesSplit(char *class1, char *class2) {
- char *intersection;
- int len = strlen(class1), len2 = strlen(class2);
- int ix;
- int i, j, i_end, j_end;
- int length;
- int match_found;
-
- if ( len2>len ) len = len2;
- intersection = galloc(len+1);
- ix = 0;
-
- i = 0;
- SKIP_SPACES(class1, i);
- while (class1[i] != '\0') {
- i_end = i;
- FIND_SPACE(class1, i_end);
-
- length = i_end - i;
-
- match_found = 0;
- j = 0;
- SKIP_SPACES(class2, j);
- while (!match_found && class2[j] != '\0') {
- j_end = j;
- FIND_SPACE(class2, j_end);
-
- if (length == j_end - j && strncmp(class1 + i, class2 + j, length) == 0) {
- match_found = 1;
-
- if (ix != 0) {
- intersection[ix] = ' ';
- ix++;
- }
- memcpy(intersection + ix, class1 + i, length * sizeof (char));
- ix += length;
-
- SKIP_SPACES(class1, i_end);
- memmove(class1 + i, class1 + i_end, (strlen(class1 + i_end) + 1) * sizeof (char));
- SKIP_SPACES(class2, j_end);
- memmove(class2 + j, class2 + j_end, (strlen(class2 + j_end) + 1) * sizeof (char));
- } else {
- j = j_end;
- SKIP_SPACES(class2, j);
- }
- }
- if (!match_found) {
- i = i_end;
- SKIP_SPACES(class1, i);
- }
- }
- intersection[ix] = '\0';
- return( intersection );
-}
-
-#define MAXT 40
-#define MAXI 5
-struct parseState {
- char tokbuf[MAXT+1];
- long value;
- enum toktype { tk_name, tk_class, tk_int, tk_char, tk_cid, tk_eof,
-/* keywords */
- tk_firstkey,
- tk_anchor=tk_firstkey, tk_anonymous, tk_by, tk_caret, tk_cursive, tk_device,
- tk_enumerate, tk_excludeDFLT, tk_exclude_dflt, tk_feature, tk_from,
- tk_ignore, tk_ignoreDFLT, tk_ignoredflt, tk_IgnoreBaseGlyphs,
- tk_IgnoreLigatures, tk_IgnoreMarks, tk_include, tk_includeDFLT,
- tk_include_dflt, tk_language, tk_languagesystem, tk_lookup,
- tk_lookupflag, tk_mark, tk_nameid, tk_NULL, tk_parameters, tk_position,
- tk_required, tk_RightToLeft, tk_script, tk_substitute, tk_subtable,
- tk_table, tk_useExtension
- } type;
- uint32 tag;
- int could_be_tag;
- FILE *inlist[MAXI];
- int inc_depth;
- int line[MAXI];
- char *filename[MAXI];
- int err_count;
- unsigned int warned_about_not_cid: 1;
- unsigned int lookup_in_sf_warned: 1;
- unsigned int in_vkrn: 1;
- unsigned int backedup: 1;
- unsigned int skipping: 1;
- SplineFont *sf;
- struct scriptlanglist *def_langsyses;
- struct glyphclasses { char *classname, *glyphs; struct glyphclasses *next; } *classes;
- struct feat_item *sofar;
- int base; /* normally numbers are base 10, but in the case of languages in stringids, they can be octal or hex */
- OTLookup *created, *last; /* Ordered, but not sorted into GSUB, GPOS yet */
- AnchorClass *accreated;
-};
-
-static struct keywords {
- char *name;
- enum toktype tok;
-} fea_keywords[] = {
-/* list must be in toktype order */
- { "name", tk_name }, { "glyphclass", tk_class }, { "integer", tk_int },
- { "random character", tk_char}, { "cid", tk_cid }, { "EOF", tk_eof },
-/* keywords now */
- { "anchor", tk_anchor },
- { "anonymous", tk_anonymous },
- { "by", tk_by },
- { "caret", tk_caret },
- { "cursive", tk_cursive },
- { "device", tk_device },
- { "enumerate", tk_enumerate },
- { "excludeDFLT", tk_excludeDFLT },
- { "exclude_dflt", tk_exclude_dflt },
- { "feature", tk_feature },
- { "from", tk_from },
- { "ignore", tk_ignore },
- { "IgnoreBaseGlyphs", tk_IgnoreBaseGlyphs },
- { "IgnoreLigatures", tk_IgnoreLigatures },
- { "IgnoreMarks", tk_IgnoreMarks },
- { "include", tk_include },
- { "includeDFLT", tk_includeDFLT },
- { "include_dflt", tk_include_dflt },
- { "language", tk_language },
- { "languagesystem", tk_languagesystem },
- { "lookup", tk_lookup },
- { "lookupflag", tk_lookupflag },
- { "mark", tk_mark },
- { "nameid", tk_nameid },
- { "NULL", tk_NULL },
- { "parameters", tk_parameters },
- { "position", tk_position },
- { "required", tk_required },
- { "RightToLeft", tk_RightToLeft },
- { "script", tk_script },
- { "substitute", tk_substitute },
- { "subtable", tk_subtable },
- { "table", tk_table },
- { "useExtension", tk_useExtension },
-/* synonyms */
- { "sub", tk_substitute },
- { "pos", tk_position },
- { "enum", tk_enumerate },
- { "anon", tk_anonymous },
- { NULL, 0 }
-};
-
-static struct tablekeywords hhead_keys[] = {
- { "CaretOffset", sizeof(short), 1, -1 }, /* Don't even know what this is! */
- { "Ascender", sizeof(short), 1, offsetof(struct pfminfo,hhead_ascent)+offsetof(SplineFont,pfminfo) },
- { "Descender", sizeof(short), 1, offsetof(struct pfminfo,hhead_descent)+offsetof(SplineFont,pfminfo) },
- { "LineGap", sizeof(short), 1, offsetof(struct pfminfo,linegap)+offsetof(SplineFont,pfminfo) },
- { NULL, 0, 0, 0 }
-};
-
-static struct tablekeywords vhead_keys[] = {
- { "VertTypoAscender", sizeof(short), 1, -1 },
- { "VertTypoDescender", sizeof(short), 1, -1 },
- { "VertTypoLineGap", sizeof(short), 1, offsetof(struct pfminfo,vlinegap)+offsetof(SplineFont,pfminfo) },
- { NULL, 0, 0, 0 }
-};
-
-static struct tablekeywords os2_keys[] = {
- { "FSType", sizeof(short), 1, offsetof(struct pfminfo,fstype)+offsetof(SplineFont,pfminfo) },
- { "Panose", sizeof(uint8), 10, offsetof(struct pfminfo,panose)+offsetof(SplineFont,pfminfo) },
- { "UnicodeRange", sizeof(short), -1, -1 },
- { "CodePageRange", sizeof(short), -1, -1 },
- { "TypoAscender", sizeof(short), 1, offsetof(struct pfminfo,os2_typoascent)+offsetof(SplineFont,pfminfo) },
- { "TypoDescender", sizeof(short), 1, offsetof(struct pfminfo,os2_typodescent)+offsetof(SplineFont,pfminfo) },
- { "TypoLineGap", sizeof(short), 1, offsetof(struct pfminfo,os2_typolinegap)+offsetof(SplineFont,pfminfo) },
- { "winAscent", sizeof(short), 1, offsetof(struct pfminfo,os2_winascent)+offsetof(SplineFont,pfminfo) },
- { "winDescent", sizeof(short), 1, offsetof(struct pfminfo,os2_windescent)+offsetof(SplineFont,pfminfo) },
- { "XHeight", sizeof(short), 1, -1 },
- { "CapHeight", sizeof(short), 1, -1 },
- { "WeightClass", sizeof(short), 1, offsetof(struct pfminfo,weight)+offsetof(SplineFont,pfminfo) },
- { "WidthClass", sizeof(short), 1, offsetof(struct pfminfo,width)+offsetof(SplineFont,pfminfo) },
- { "Vendor", sizeof(short), 1, offsetof(struct pfminfo,os2_vendor)+offsetof(SplineFont,pfminfo) },
- { NULL, 0, 0, 0 }
-};
-
-
-static void fea_ParseTok(struct parseState *tok);
-
-static void fea_handle_include(struct parseState *tok) {
- FILE *in;
- char namebuf[1025], *pt, *filename;
- int ch;
-
- fea_ParseTok(tok);
- if ( tok->type!=tk_char || tok->tokbuf[0]!='(' ) {
- LogError(_("Unparseable include on line %d of %s"), tok->line[tok->inc_depth], tok->filename[tok->inc_depth] );
- ++tok->err_count;
-return;
- }
-
- in = tok->inlist[tok->inc_depth];
- ch = getc(in);
- while ( isspace(ch))
- ch = getc(in);
- pt = namebuf;
- while ( ch!=EOF && ch!=')' && pt<namebuf+sizeof(namebuf)-1 ) {
- *pt++ = ch;
- ch = getc(in);
- }
- if ( ch!=EOF && ch!=')' ) {
- while ( ch!=EOF && ch!=')' )
- ch = getc(in);
- LogError(_("Include filename too long on line %d of %s"), tok->line[tok->inc_depth], tok->filename[tok->inc_depth] );
- ++tok->err_count;
- }
- while ( pt>=namebuf+1 && isspace(pt[-1]) )
- --pt;
- *pt = '\0';
- if ( ch!=')' ) {
- if ( ch==EOF )
- LogError(_("End of file in include on line %d of %s"), tok->line[tok->inc_depth], tok->filename[tok->inc_depth] );
- else
- LogError(_("Missing close parenthesis in include on line %d of %s"), tok->line[tok->inc_depth], tok->filename[tok->inc_depth] );
- ++tok->err_count;
-return;
- }
-
- if ( pt==namebuf ) {
- LogError(_("No filename specified in include on line %d of %s"), tok->line[tok->inc_depth], tok->filename[tok->inc_depth] );
- ++tok->err_count;
-return;
- }
-
- if ( tok->inc_depth>=MAXI-1 ) {
- LogError(_("Includes nested too deeply on line %d of %s"), tok->line[tok->inc_depth], tok->filename[tok->inc_depth] );
- ++tok->err_count;
-return;
- }
-
- if ( *namebuf=='/' ||
- ( pt = strrchr(tok->filename[tok->inc_depth],'/') )==NULL )
- filename=copy(namebuf);
- else {
- *pt = '\0';
- filename = GFileAppendFile(tok->filename[tok->inc_depth],namebuf,false);
- *pt = '/';
- }
- in = fopen(filename,"r");
- if ( in==NULL ) {
- LogError(_("Could not open include file (%s) on line %d of %s"),
- filename, tok->line[tok->inc_depth], tok->filename[tok->inc_depth] );
- ++tok->err_count;
- free(filename);
-return;
- }
-
- ++tok->inc_depth;
- tok->filename[tok->inc_depth] = filename;
- tok->inlist[tok->inc_depth] = in;
- tok->line[tok->inc_depth] = 1;
- fea_ParseTok(tok);
-}
-
-static void fea_ParseTok(struct parseState *tok) {
- FILE *in = tok->inlist[tok->inc_depth];
- int ch, peekch = 0;
- char *pt, *start;
-
- if ( tok->backedup ) {
- tok->backedup = false;
-return;
- }
-
- skip_whitespace:
- ch = getc(in);
- while ( isspace(ch) || ch=='#' ) {
- if ( ch=='#' )
- while ( (ch=getc(in))!=EOF && ch!='\n' && ch!='\r' );
- if ( ch=='\n' || ch=='\r' ) {
- if ( ch=='\r' ) {
- ch = getc(in);
- if ( ch!='\n' )
- ungetc(ch,in);
- }
- ++tok->line[tok->inc_depth];
- }
- ch = getc(in);
- }
-
- tok->could_be_tag = 0;
- if ( ch==EOF ) {
- if ( tok->inc_depth>0 ) {
- fclose(tok->inlist[tok->inc_depth]);
- free(tok->filename[tok->inc_depth]);
- in = tok->inlist[--tok->inc_depth];
- goto skip_whitespace;
- }
- tok->type = tk_eof;
- strcpy(tok->tokbuf,"EOF");
-return;
- }
-
- start = pt = tok->tokbuf;
- if ( ch=='\\' || ch=='-' ) {
- peekch=getc(in);
- ungetc(peekch,in);
- }
-
- if ( isdigit(ch) || ch=='+' || ((ch=='-' || ch=='\\') && isdigit(peekch)) ) {
- tok->type = tk_int;
- if ( ch=='-' || ch=='+' ) {
- if ( ch=='-' ) {
- *pt++ = ch;
- start = pt;
- }
- ch = getc(in);
- } else if ( ch=='\\' ) {
- ch = getc(in);
- tok->type = tk_cid;
- }
- while ( (isdigit( ch ) ||
- (tok->base==0 && (ch=='x' || ch=='X' || (ch>='a' && ch<='f') || (ch>='A' && ch<='F'))))
- && pt<tok->tokbuf+15 ) {
- *pt++ = ch;
- ch = getc(in);
- }
- if ( isdigit(ch)) {
- LogError(_("Number too long on line %d of %s"), tok->line[tok->inc_depth], tok->filename[tok->inc_depth] );
- ++tok->err_count;
- } else if ( pt==start ) {
- LogError(_("Missing number on line %d of %s"), tok->line[tok->inc_depth], tok->filename[tok->inc_depth] );
- ++tok->err_count;
- }
- ungetc(ch,in);
- *pt = '\0';
- tok->value = strtol(tok->tokbuf,NULL,tok->base);
-return;
- } else if ( ch=='@' || ch=='_' || ch=='\\' || isalnum(ch)) { /* Names can't start with dot */
- int check_keywords = true;
- tok->type = tk_name;
- if ( ch=='@' ) {
- tok->type = tk_class;
- *pt++ = ch;
- start = pt;
- ch = getc(in);
- check_keywords = false;
- } else if ( ch=='\\' ) {
- ch = getc(in);
- check_keywords = false;
- }
- while (( isalnum(ch) || ch=='_' || ch=='.' ) && pt<start+31 ) {
- *pt++ = ch;
- ch = getc(in);
- }
- *pt = '\0';
- ungetc(ch,in);
- if ( isalnum(ch) || ch=='_' || ch=='.' ) {
- LogError(_("Name too long on line %d of %s"), tok->line[tok->inc_depth], tok->filename[tok->inc_depth] );
- ++tok->err_count;
- } else if ( pt==start ) {
- LogError(_("Missing name on line %d of %s"), tok->line[tok->inc_depth], tok->filename[tok->inc_depth] );
- ++tok->err_count;
- }
-
- if ( check_keywords ) {
- int i;
- for ( i=tk_firstkey; fea_keywords[i].name!=NULL; ++i ) {
- if ( strcmp(fea_keywords[i].name,tok->tokbuf)==0 ) {
- tok->type = fea_keywords[i].tok;
- break;
- }
- }
- if ( tok->type==tk_include )
- fea_handle_include(tok);
- }
- if ( tok->type==tk_name && pt-tok->tokbuf<=4 && pt!=tok->tokbuf ) {
- unsigned char tag[4];
- tok->could_be_tag = true;
- memset(tag,' ',4);
- tag[0] = tok->tokbuf[0];
- if ( tok->tokbuf[1]!='\0' ) {
- tag[1] = tok->tokbuf[1];
- if ( tok->tokbuf[2]!='\0' ) {
- tag[2] = tok->tokbuf[2];
- if ( tok->tokbuf[3]!='\0' )
- tag[3] = tok->tokbuf[3];
- }
- }
- tok->tag = (tag[0]<<24) | (tag[1]<<16) | (tag[2]<<8) | tag[3];
- }
- } else {
- /* I've already handled the special characters # @ and \ */
- /* so don't treat them as errors here, if they occur they will be out of context */
- if ( ch==';' || ch==',' || ch=='-' || ch=='=' || ch=='\'' || ch=='"' ||
- ch=='{' || ch=='}' ||
- ch=='[' || ch==']' ||
- ch=='<' || ch=='>' ||
- ch=='(' || ch==')' ) {
- tok->type = tk_char;
- tok->tokbuf[0] = ch;
- tok->tokbuf[1] = '\0';
- } else {
- if ( !tok->skipping ) {
- LogError(_("Unexpected character (0x%02X) on line %d of %s"), ch, tok->line[tok->inc_depth], tok->filename[tok->inc_depth] );
- ++tok->err_count;
- }
- goto skip_whitespace;
- }
- }
-}
-
-static void fea_ParseTag(struct parseState *tok) {
- /* The tag used for OS/2 doesn't get parsed properly */
- /* So if we know we are looking for a tag do some fixups */
-
- fea_ParseTok(tok);
- if ( tok->type==tk_name && tok->could_be_tag &&
- tok->tag==CHR('O','S',' ',' ') ) {
- FILE *in = tok->inlist[tok->inc_depth];
- int ch;
- ch = getc(in);
- if ( ch=='/' ) {
- ch = getc(in);
- if ( ch=='2' ) {
- tok->tag = CHR('O','S','/','2');
- } else {
- tok->tag = CHR('O','S','/',' ');
- ungetc(ch,in);
- }
- } else
- ungetc(ch,in);
- }
-}
-
-static void fea_UnParseTok(struct parseState *tok) {
- tok->backedup = true;
-}
-
-static int fea_ParseDeciPoints(struct parseState *tok) {
- /* When parsing size features floating point numbers are allowed */
- /* but they should be converted to ints by multiplying by 10 */
- /* (not my convention) */
-
- fea_ParseTok(tok);
- if ( tok->type==tk_int ) {
- FILE *in = tok->inlist[tok->inc_depth];
- char *pt = tok->tokbuf + strlen(tok->tokbuf);
- int ch;
- ch = getc(in);
- if ( ch=='.' ) {
- *pt++ = ch;
- while ( (ch = getc(in))!=EOF && isdigit(ch)) {
- if ( pt<tok->tokbuf+sizeof(tok->tokbuf)-1 )
- *pt++ = ch;
- }
- *pt = '\0';
- tok->value = rint(strtod(tok->tokbuf,NULL)*10.0);
- }
- if ( ch!=EOF )
- ungetc(ch,in);
- } else {
- LogError(_("Expected '%s' on line %d of %s"), fea_keywords[tk_int],
- tok->line[tok->inc_depth], tok->filename[tok->inc_depth] );
- ++tok->err_count;
- tok->value = -1;
- }
-return( tok->value );
-}
-
-static void fea_TokenMustBe(struct parseState *tok, enum toktype type, int ch) {
- fea_ParseTok(tok);
- if ( type==tk_char && (tok->type!=type || tok->tokbuf[0]!=ch) ) {
- LogError(_("Expected '%c' on line %d of %s"), ch, tok->line[tok->inc_depth], tok->filename[tok->inc_depth] );
- ++tok->err_count;
- } else if ( type!=tk_char && tok->type!=type ) {
- LogError(_("Expected '%s' on line %d of %s"), fea_keywords[type],
- tok->line[tok->inc_depth], tok->filename[tok->inc_depth] );
- ++tok->err_count;
- }
-}
-
-static void fea_skip_to_semi(struct parseState *tok) {
- int nest=0;
-
- while ( tok->type!=tk_char || tok->tokbuf[0]!=';' || nest>0 ) {
- fea_ParseTok(tok);
- if ( tok->type==tk_char ) {
- if ( tok->tokbuf[0]=='{' ) ++nest;
- else if ( tok->tokbuf[0]=='}' ) --nest;
- if ( nest<0 )
- break;
- }
- if ( tok->type==tk_eof )
- break;
- }
-}
-
-static void fea_skip_to_close_curly(struct parseState *tok) {
- int nest=0;
-
- tok->skipping = true;
- /* The table blocks have slightly different syntaxes and can take strings */
- /* and floating point numbers. So don't complain about unknown chars when */
- /* in a table (that's skipping) */
- while ( tok->type!=tk_char || tok->tokbuf[0]!='}' || nest>0 ) {
- fea_ParseTok(tok);
- if ( tok->type==tk_char ) {
- if ( tok->tokbuf[0]=='{' ) ++nest;
- else if ( tok->tokbuf[0]=='}' ) --nest;
- }
- if ( tok->type==tk_eof )
- break;
- }
- tok->skipping = false;
-}
-
-static void fea_now_semi(struct parseState *tok) {
- if ( tok->type!=tk_char || tok->tokbuf[0]!=';' ) {
- LogError(_("Expected ';' at statement end on line %d of %s"), tok->line[tok->inc_depth], tok->filename[tok->inc_depth] );
- fea_skip_to_semi(tok);
- ++tok->err_count;
-return;
- }
-}
-
-static void fea_end_statement(struct parseState *tok) {
- fea_ParseTok(tok);
- fea_now_semi(tok);
-}
-
-static struct glyphclasses *fea_lookup_class(struct parseState *tok,char *classname) {
- struct glyphclasses *test;
-
- for ( test=tok->classes; test!=NULL; test=test->next ) {
- if ( strcmp(classname,test->classname)==0 )
-return( test );
- }
-return( NULL );
-}
-
-static char *fea_lookup_class_complain(struct parseState *tok,char *classname) {
- struct glyphclasses *test;
-
- for ( test=tok->classes; test!=NULL; test=test->next ) {
- if ( strcmp(classname,test->classname)==0 )
-return( copy( test->glyphs) );
- }
- LogError(_("Use of undefined glyph class, %s, on line %d of %s"), classname, tok->line[tok->inc_depth], tok->filename[tok->inc_depth] );
- ++tok->err_count;
-return( NULL );
-}
-
-static void fea_AddClassDef(struct parseState *tok,char *classname,char *contents) {
- struct glyphclasses *test;
-
- test = fea_lookup_class(tok,classname);
- if ( test==NULL ) {
- test=chunkalloc(sizeof(struct glyphclasses));
- test->classname = classname;
- test->next = tok->classes;
- tok->classes = test;
- } else {
- free(classname);
- free(test->glyphs);
- }
- test->glyphs = contents;
-}
-
-static int fea_AddGlyphs(char **_glyphs, int *_max, int cnt, char *contents ) {
- int len = strlen(contents);
- char *glyphs = *_glyphs;
- /* Append a glyph name, etc. to a glyph class */
-
- if ( glyphs==NULL ) {
- glyphs = copy(contents);
- cnt = *_max = len;
- } else {
- if ( *_max-cnt <= len+1 )
- glyphs = grealloc(glyphs,(*_max+=200+len+1)+1);
- glyphs[cnt++] = ' ';
- strcpy(glyphs+cnt,contents);
- cnt += strlen(contents);
- }
- free(contents);
- *_glyphs = glyphs;
-return( cnt );
-}
-
-static char *fea_cid_validate(struct parseState *tok,int cid) {
- int i, max;
- SplineFont *maxsf;
- SplineChar *sc;
- EncMap *map;
-
- if ( tok->sf->subfontcnt==0 ) {
- if ( !tok->warned_about_not_cid ) {
- LogError(_("Reference to a CID in a non-CID-keyed font on line %d of %s"), tok->line[tok->inc_depth], tok->filename[tok->inc_depth] );
- tok->warned_about_not_cid = true;
- }
- ++tok->err_count;
-return(NULL);
- }
- max = 0; maxsf = NULL;
- for ( i=0; i<tok->sf->subfontcnt; ++i ) {
- SplineFont *sub = tok->sf->subfonts[i];
- if ( cid<sub->glyphcnt && sub->glyphs[cid]!=NULL )
-return( sub->glyphs[cid]->name );
- if ( sub->glyphcnt>max ) {
- max = sub->glyphcnt;
- maxsf = sub;
- }
- }
- /* Not defined, try to create it */
- if ( maxsf==NULL ) /* No subfonts */
-return( NULL );
- if ( cid>=maxsf->glyphcnt ) {
- struct cidmap *cidmap = FindCidMap(tok->sf->cidregistry,tok->sf->ordering,tok->sf->supplement,tok->sf);
- if ( cidmap==NULL || cid>=MaxCID(cidmap) )
-return( NULL );
- SFExpandGlyphCount(maxsf,MaxCID(cidmap));
- }
- if ( cid>=maxsf->glyphcnt )
-return( NULL );
- map = EncMap1to1(maxsf->glyphcnt);
- sc = SFMakeChar(maxsf,map,cid);
- EncMapFree(map);
- if ( sc==NULL )
-return( NULL );
-return( copy( sc->name ));
-}
-
-static SplineChar *fea_glyphname_get(struct parseState *tok,char *name) {
- SplineFont *sf = tok->sf;
- SplineChar *sc = SFGetChar(sf,-1,name);
- int enc, gid;
-
- if ( sf->subfontcnt!=0 ) {
- LogError(_("Reference to a glyph name in a CID-keyed font on line %d of %s"), tok->line[tok->inc_depth], tok->filename[tok->inc_depth] );
- ++tok->err_count;
-return(sc);
- }
-
- if ( sc!=NULL || strcmp(name,"NULL")==0 )
-return( sc );
- enc = SFFindSlot(sf,sf->fv->map,-1,name);
- if ( enc!=-1 ) {
- sc = SFMakeChar(sf,sf->fv->map,enc);
- if ( sc!=NULL ) {
- sc->widthset = true;
- free(sc->name);
- sc->name = copy(name);
- }
-return( sc );
- }
-
- for ( gid=sf->glyphcnt-1; gid>=0; --gid ) if ( (sc=sf->glyphs[gid])!=NULL ) {
- if ( strcmp(sc->name,name)==0 )
-return( sc );
- }
-
-/* Don't encode it (not in current encoding), just add it, so we needn't */
-/* mess with maps or selections */
- SFExpandGlyphCount(sf,sf->glyphcnt+1);
- sc = SFSplineCharCreate(sf);
- sc->name = copy(name);
- sc->unicodeenc = UniFromName(name,ui_none,&custom);
- sc->parent = sf;
- sc->vwidth = (sf->ascent+sf->descent);
- sc->width = 6*sc->vwidth/10;
- sc->widthset = true; /* So we don't lose the glyph */
- sc->orig_pos = sf->glyphcnt-1;
- sf->glyphs[sc->orig_pos] = sc;
-return( sc );
-}
-
-static char *fea_glyphname_validate(struct parseState *tok,char *name) {
- SplineChar *sc = fea_glyphname_get(tok,name);
-
- if ( sc==NULL )
-return( NULL );
-
-return( copy( sc->name ));
-}
-
-static char *fea_ParseGlyphClass(struct parseState *tok) {
- char *glyphs = NULL;
-
- if ( tok->type==tk_class ) {
- glyphs = fea_lookup_class_complain(tok,tok->tokbuf);
- } else if ( tok->type!=tk_char || tok->tokbuf[0]!='[' ) {
- LogError(_("Expected '[' in glyph class definition on line %d of %s"), tok->line[tok->inc_depth], tok->filename[tok->inc_depth] );
- ++tok->err_count;
-return( NULL );
- } else {
- char *contents = NULL;
- int cnt=0, max=0;
- int last_val = 0, range_type, range_len = 0;
- char last_glyph[MAXT+1];
- char *pt1, *start1, *pt2, *start2 = NULL;
- int v1, v2;
-
- forever {
- fea_ParseTok(tok);
- if ( tok->type==tk_char && tok->tokbuf[0]==']' )
- break;
- if ( tok->type==tk_class ) {
- contents = fea_lookup_class_complain(tok,tok->tokbuf);
- last_val=-1; last_glyph[0] = '\0';
- } else if ( tok->type==tk_cid ) {
- last_val = tok->value; last_glyph[0] = '\0';
- contents = fea_cid_validate(tok,tok->value);
- } else if ( tok->type==tk_name ) {
- strcpy(last_glyph,tok->tokbuf); last_val = -1;
- contents = fea_glyphname_validate(tok,tok->tokbuf);
- } else if ( tok->type==tk_char && tok->tokbuf[0]=='-' ) {
- fea_ParseTok(tok);
- if ( last_val!=-1 && tok->type==tk_cid ) {
- if ( last_val>=tok->value ) {
- LogError(_("Invalid CID range in glyph class on line %d of %s"), tok->line[tok->inc_depth], tok->filename[tok->inc_depth] );
- ++tok->err_count;
- }
- /* Last val has already been added to the class */
- /* and we'll add the current value later */
- for ( ++last_val; last_val<tok->value; ++last_val ) {
- contents = fea_cid_validate(tok,last_val);
- if ( contents!=NULL )
- cnt = fea_AddGlyphs(&glyphs,&max,cnt,contents);
- }
- contents = fea_cid_validate(tok,tok->value);
- } else if ( last_glyph[0]!='\0' && tok->type==tk_name ) {
- range_type=0;
- if ( strlen(last_glyph)==strlen(tok->tokbuf) &&
- strcmp(last_glyph,tok->tokbuf)<0 ) {
- start1=NULL;
- for ( pt1=last_glyph, pt2=tok->tokbuf;
- *pt1!='\0'; ++pt1, ++pt2 ) {
- if ( *pt1!=*pt2 ) {
- if ( start1!=NULL ) {
- range_type=0;
- break;
- }
- start1 = pt1; start2 = pt2;
- if ( !isdigit(*pt1) || !isdigit(*pt2))
- range_type = 1;
- else {
- for ( range_len=0; range_len<3 && isdigit(*pt1) && isdigit(*pt2);
- ++range_len, ++pt1, ++pt2 );
- range_type = 2;
- --pt1; --pt2;
- }
- }
- }
- }
- if ( range_type==0 ) {
- LogError(_("Invalid glyph name range in glyph class on line %d of %s"), tok->line[tok->inc_depth], tok->filename[tok->inc_depth] );
- ++tok->err_count;
- } else if ( range_type==1 || range_len==1 ) {
- /* Single letter changes */
- v1 = *start1; v2 = *start2;
- for ( ++v1; v1<=v2; ++v1 ) {
- *start1 = v1;
- contents = fea_glyphname_validate(tok,start1);
- if ( v1==v2 )
- break;
- if ( contents!=NULL )
- cnt = fea_AddGlyphs(&glyphs,&max,cnt,contents);
- }
- } else {
- v1 = strtol(start1,NULL,10);
- v2 = strtol(start2,NULL,10);
- for ( ++v1; v1<=v2; ++v1 ) {
- if ( range_len==2 )
- sprintf( last_glyph, "%.*s%02d%s", (int) (start2-tok->tokbuf),
- tok->tokbuf, v1, start2+2 );
- else
- sprintf( last_glyph, "%.*s%03d%s", (int) (start2-tok->tokbuf),
- tok->tokbuf, v1, start2+3 );
- contents = fea_glyphname_validate(tok,last_glyph);
- if ( v1==v2 )
- break;
- if ( contents!=NULL )
- cnt = fea_AddGlyphs(&glyphs,&max,cnt,contents);
- }
- }
- } else {
- LogError(_("Unexpected token in glyph class range on line %d of %s"), tok->line[tok->inc_depth], tok->filename[tok->inc_depth] );
- ++tok->err_count;
- if ( tok->type==tk_char && tok->tokbuf[0]==']' )
- break;
- }
- last_val=-1; last_glyph[0] = '\0';
- } else if ( tok->type == tk_NULL ) {
- contents = copy("NULL");
- } else {
- LogError(_("Expected glyph name, cid, or class in glyph class definition on line %d of %s"), tok->line[tok->inc_depth], tok->filename[tok->inc_depth] );
- ++tok->err_count;
- break;
- }
- if ( contents!=NULL )
- cnt = fea_AddGlyphs(&glyphs,&max,cnt,contents);
- }
- if ( glyphs==NULL )
- glyphs = copy(""); /* Is it legal to have an empty class? I can't think of any use for one */
- }
-return( glyphs );
-}
-
-static char *fea_ParseGlyphClassGuarded(struct parseState *tok) {
- char *ret = fea_ParseGlyphClass(tok);
- if ( ret==NULL )
- ret = copy("");
-return( ret );
-}
-
-static void fea_ParseLookupFlags(struct parseState *tok) {
- int val = 0;
- struct feat_item *item;
-
- fea_ParseTok(tok);
- if ( tok->type==tk_int ) {
- val = tok->value;
- fea_end_statement(tok);
- } else {
- while ( tok->type==tk_RightToLeft || tok->type==tk_IgnoreBaseGlyphs ||
- tok->type==tk_IgnoreMarks || tok->type==tk_IgnoreLigatures ) {
- if ( tok->type == tk_RightToLeft )
- val |= pst_r2l;
- else if ( tok->type == tk_IgnoreBaseGlyphs )
- val |= pst_ignorebaseglyphs;
- else if ( tok->type == tk_IgnoreMarks )
- val |= pst_ignorecombiningmarks;
- else if ( tok->type == tk_IgnoreLigatures )
- val |= pst_ignoreligatures;
- fea_ParseTok(tok);
- if ( tok->type == tk_char && tok->tokbuf[0]==';' )
- break;
- else if ( tok->type==tk_char && tok->tokbuf[0]!=',' ) {
- LogError(_("Expected ';' in lookupflags on line %d of %s"), tok->line[tok->inc_depth], tok->filename[tok->inc_depth] );
- ++tok->err_count;
- fea_skip_to_semi(tok);
- break;
- }
- fea_ParseTok(tok);
- }
- if ( tok->type != tk_char || tok->tokbuf[0]!=';' ) {
- LogError(_("Unexpected token in lookupflags on line %d of %s"), tok->line[tok->inc_depth], tok->filename[tok->inc_depth] );
- ++tok->err_count;
- fea_skip_to_semi(tok);
- } else if ( val==0 ) {
- LogError(_("No flags specified in lookupflags on line %d of %s"), tok->line[tok->inc_depth], tok->filename[tok->inc_depth] );
- ++tok->err_count;
- }
- }
-
- item = chunkalloc(sizeof(struct feat_item));
- item->type = ft_lookupflags;
- item->u2.lookupflags = val;
- item->next = tok->sofar;
- tok->sofar = item;
-}
-
-static void fea_ParseGlyphClassDef(struct parseState *tok) {
- char *classname = copy(tok->tokbuf );
- char *contents;
-
- fea_ParseTok(tok);
- if ( tok->type!=tk_char || tok->tokbuf[0]!='=' ) {
- LogError(_("Expected '=' in glyph class definition on line %d of %s"), tok->line[tok->inc_depth], tok->filename[tok->inc_depth] );
- ++tok->err_count;
- fea_skip_to_semi(tok);
-return;
- }
- fea_ParseTok(tok);
- contents = fea_ParseGlyphClass(tok);
- if ( contents==NULL ) {
- fea_skip_to_semi(tok);
-return;
- }
- fea_AddClassDef(tok,classname,copy(contents));
- fea_end_statement(tok);
-}
-
-static void fea_ParseLangSys(struct parseState *tok, int inside_feat) {
- uint32 script, lang;
- struct scriptlanglist *sl;
- int l;
-
- fea_ParseTok(tok);
- if ( tok->type!=tk_name || !tok->could_be_tag ) {
- LogError(_("Expected tag in languagesystem on line %d of %s"), tok->line[tok->inc_depth], tok->filename[tok->inc_depth] );
- ++tok->err_count;
- fea_skip_to_semi(tok);
-return;
- }
- script = tok->tag;
-
- fea_ParseTok(tok);
- if ( tok->type!=tk_name || !tok->could_be_tag ) {
- LogError(_("Expected tag in languagesystem on line %d of %s"), tok->line[tok->inc_depth], tok->filename[tok->inc_depth] );
- ++tok->err_count;
- fea_skip_to_semi(tok);
-return;
- }
- lang = tok->tag;
-
- for ( sl=tok->def_langsyses; sl!=NULL && sl->script!=script; sl=sl->next );
- if ( sl==NULL ) {
- sl = chunkalloc(sizeof(struct scriptlanglist));
- sl->script = script;
- sl->next = tok->def_langsyses;
- tok->def_langsyses = sl;
- }
- for ( l=0; l<sl->lang_cnt; ++l ) {
- uint32 language = l<MAX_LANG ? sl->langs[l] : sl->morelangs[l-MAX_LANG];
- if ( language==lang )
- break;
- }
- if ( l<sl->lang_cnt )
- /* Er... this combination is already in the list. I guess that's ok */;
- else if ( sl->lang_cnt<MAX_LANG )
- sl->langs[sl->lang_cnt++] = lang;
- else {
- sl->morelangs = grealloc(sl->morelangs,(sl->lang_cnt+1)*sizeof(uint32));
- sl->morelangs[sl->lang_cnt++ - MAX_LANG] = lang;
- }
- fea_end_statement(tok);
-
- if ( inside_feat ) {
- struct feat_item *item = chunkalloc(sizeof(struct feat_item));
- item->type = ft_langsys;
- item->u2.sl = SListCopy(tok->def_langsyses);
- item->next = tok->sofar;
- tok->sofar = item;
- }
-}
-
-struct markedglyphs {
- unsigned int has_marks: 1; /* Are there any marked glyphs in the entire sequence? */
- unsigned int is_cursive: 1; /* Only in a position sequence */
- unsigned int is_mark: 1; /* Only in a position sequence/mark keyword=>mark2mark */
- unsigned int is_name: 1; /* Otherwise a class */
- unsigned int is_lookup: 1; /* Or a lookup when parsing a subs replacement list */
- uint16 mark_count; /* 0=>unmarked, 1=>first mark, etc. */
- char *name_or_class; /* Glyph name / class contents */
- struct vr *vr; /* A value record. Only in position sequences */
- int ap_cnt; /* Number of anchor points */
- AnchorPoint **anchors;
- char *lookupname;
- struct markedglyphs *next;
-};
-
-#ifdef FONTFORGE_CONFIG_DEVICETABLES
-static void fea_ParseDeviceTable(struct parseState *tok,DeviceTable *adjust)
-#else
-static void fea_ParseDeviceTable(struct parseState *tok)
-#endif
- {
- int first = true;
-#ifdef FONTFORGE_CONFIG_DEVICETABLES
- int min=0, max= -1;
- int8 values[512];
-
- memset(values,0,sizeof(values));
-#endif
-
- fea_TokenMustBe(tok,tk_device,'\0');
- if ( tok->type!=tk_device )
-return;
-
- forever {
- fea_ParseTok(tok);
- if ( first && tok->type==tk_NULL ) {
- fea_TokenMustBe(tok,tk_char,'>');
- break;
- } else if ( tok->type==tk_char && tok->tokbuf[0]=='>' ) {
- break;
- } else if ( tok->type!=tk_int ) {
- LogError(_("Expected integer in device table on line %d of %s"), tok->line[tok->inc_depth], tok->filename[tok->inc_depth] );
- ++tok->err_count;
- } else {
-#ifdef FONTFORGE_CONFIG_DEVICETABLES
- int pixel = tok->value;
-#endif
- fea_TokenMustBe(tok,tk_int,'\0');
-#ifdef FONTFORGE_CONFIG_DEVICETABLES
- if ( pixel>=sizeof(values) || pixel<0 )
- LogError(_("Pixel size too big in device table on line %d of %s"), tok->line[tok->inc_depth], tok->filename[tok->inc_depth] );
- else {
- values[pixel] = tok->value;
- if ( max==-1 )
- min=max=pixel;
- else if ( pixel<min ) min = pixel;
- else if ( pixel>max ) max = pixel;
- }
-#endif
- }
- first = false;
- }
-#ifdef FONTFORGE_CONFIG_DEVICETABLES
- if ( max!=-1 ) {
- int i;
- adjust->first_pixel_size = min;
- adjust->last_pixel_size = max;
- adjust->corrections = galloc(max-min+1);
- for ( i=min; i<=max; ++i )
- adjust->corrections[i-min] = values[i];
- }
-#endif
-}
-
-static void fea_ParseCaret(struct parseState *tok) {
- int val=0;
-
- fea_TokenMustBe(tok,tk_caret,'\0');
- if ( tok->type!=tk_caret )
-return;
- fea_ParseTok(tok);
- if ( tok->type!=tk_int ) {
- LogError(_("Expected integer in caret on line %d of %s"), tok->line[tok->inc_depth], tok->filename[tok->inc_depth] );
- ++tok->err_count;
- } else
- val = tok->value;
- fea_ParseTok(tok);
- if ( tok->type!=tk_char || tok->tokbuf[0]!='>' ) {
- LogError(_("Expected '>' in caret on line %d of %s"), tok->line[tok->inc_depth], tok->filename[tok->inc_depth] );
- ++tok->err_count;
- }
- tok->value = val;
-}
-
-static AnchorPoint *fea_ParseAnchor(struct parseState *tok) {
- AnchorPoint *ap = NULL;
-
- if ( tok->type==tk_anchor ) {
- fea_ParseTok(tok);
- if ( tok->type==tk_NULL )
- ap = NULL;
- else if ( tok->type==tk_int ) {
- ap = chunkalloc(sizeof(AnchorPoint));
- ap->me.x = tok->value;
- fea_TokenMustBe(tok,tk_int,'\0');
- ap->me.y = tok->value;
- fea_ParseTok(tok);
- if ( tok->type==tk_int ) {
- ap->ttf_pt_index = tok->value;
- ap->has_ttf_pt = true;
- fea_TokenMustBe(tok,tk_char,'>');
- } else if ( tok->type==tk_char && tok->tokbuf[0]=='<' ) {
-#ifdef FONTFORGE_CONFIG_DEVICETABLES
- fea_ParseDeviceTable(tok,&ap->xadjust);
- fea_TokenMustBe(tok,tk_char,'<');
- fea_ParseDeviceTable(tok,&ap->yadjust);
-#else
- fea_ParseDeviceTable(tok);
- fea_TokenMustBe(tok,tk_char,'<');
- fea_ParseDeviceTable(tok);
-#endif
- fea_TokenMustBe(tok,tk_char,'>');
- } else if ( tok->type!=tk_char || tok->tokbuf[0]!='>' ) {
- LogError(_("Expected '>' in anchor on line %d of %s"), tok->line[tok->inc_depth], tok->filename[tok->inc_depth] );
- ++tok->err_count;
- }
- } else {
- LogError(_("Expected integer in anchor on line %d of %s"), tok->line[tok->inc_depth], tok->filename[tok->inc_depth] );
- ++tok->err_count;
- }
- } else {
- LogError(_("Expected 'anchor' keyword in anchor on line %d of %s"), tok->line[tok->inc_depth], tok->filename[tok->inc_depth] );
- ++tok->err_count;
- }
-return( ap );
-}
-
-static int fea_findLookup(struct parseState *tok,char *name ) {
- struct feat_item *feat;
-
- for ( feat=tok->sofar; feat!=NULL; feat=feat->next ) {
- if ( feat->type==ft_lookup_start && strcmp(name,feat->u1.lookup_name)==0 )
-return( true );
- }
-
- if ( SFFindLookup(tok->sf,name)!=NULL ) {
- if ( !tok->lookup_in_sf_warned ) {
- ff_post_notice(_("Refers to Font"),_("Reference to a lookup which is not in the feature file but which is in the font, %.50s"), name );
- tok->lookup_in_sf_warned = true;
- }
-return( true );
- }
-
-return( false );
-}
-
-static void fea_ParseBroket(struct parseState *tok,struct markedglyphs *last) {
- /* We've read the open broket. Might find: value record, anchor, lookup */
- /* (lookups are my extension) */
- struct vr *vr;
-
- fea_ParseTok(tok);
- if ( tok->type==tk_lookup ) {
- fea_TokenMustBe(tok,tk_name,'\0');
- if ( last->mark_count==0 ) {
- LogError(_("Lookups may only be specified after marked glyphs on line %d of %s"), tok->line[tok->inc_depth], tok->filename[tok->inc_depth] );
- ++tok->err_count;
- }
- if ( !fea_findLookup(tok,tok->tokbuf) ) {
- LogError(_("Lookups must be defined before being used on line %d of %s"), tok->line[tok->inc_depth], tok->filename[tok->inc_depth] );
- ++tok->err_count;
- } else
- last->lookupname = copy(tok->tokbuf);
- fea_TokenMustBe(tok,tk_char,'>');
- } else if ( tok->type==tk_anchor ) {
- last->anchors = grealloc(last->anchors,(++last->ap_cnt)*sizeof(AnchorPoint *));
- last->anchors[last->ap_cnt-1] = fea_ParseAnchor(tok);
- } else if ( tok->type==tk_NULL ) {
- /* NULL value record. Adobe documents it and doesn't implement it */
- /* Not sure what it's good for */
- fea_TokenMustBe(tok,tk_char,'>');
- } else if ( tok->type==tk_int ) {
- last->vr = vr = chunkalloc(sizeof( struct vr ));
- vr->xoff = tok->value;
- fea_ParseTok(tok);
- if ( tok->type==tk_char && tok->tokbuf[0]=='>' ) {
- if ( tok->in_vkrn )
- vr->v_adv_off = vr->xoff;
- else
- vr->h_adv_off = vr->xoff;
- vr->xoff = 0;
- } else if ( tok->type!=tk_int ) {
- LogError(_("Expected integer in value record on line %d of %s"), tok->line[tok->inc_depth], tok->filename[tok->inc_depth] );
- ++tok->err_count;
- } else {
- vr->yoff = tok->value;
- fea_TokenMustBe(tok,tk_int,'\0');
- vr->h_adv_off = tok->value;
- fea_TokenMustBe(tok,tk_int,'\0');
- vr->v_adv_off = tok->value;
- fea_ParseTok(tok);
- if ( tok->type==tk_char && tok->tokbuf[0]=='<' ) {
-#ifdef FONTFORGE_CONFIG_DEVICETABLES
- vr->adjust = chunkalloc(sizeof(struct valdev));
- fea_ParseDeviceTable(tok,&vr->adjust->xadjust);
- fea_TokenMustBe(tok,tk_char,'<');
- fea_ParseDeviceTable(tok,&vr->adjust->yadjust);
- fea_TokenMustBe(tok,tk_char,'<');
- fea_ParseDeviceTable(tok,&vr->adjust->xadv);
- fea_TokenMustBe(tok,tk_char,'<');
- fea_ParseDeviceTable(tok,&vr->adjust->yadv);
-#else
- fea_ParseDeviceTable(tok);
- fea_TokenMustBe(tok,tk_char,'<');
- fea_ParseDeviceTable(tok);
- fea_TokenMustBe(tok,tk_char,'<');
- fea_ParseDeviceTable(tok);
- fea_TokenMustBe(tok,tk_char,'<');
- fea_ParseDeviceTable(tok);
-#endif
- fea_TokenMustBe(tok,tk_char,'>');
- } else if ( tok->type!=tk_char || tok->tokbuf[0]!='>' ) {
- LogError(_("Expected '>' in value record on line %d of %s"), tok->line[tok->inc_depth], tok->filename[tok->inc_depth] );
- ++tok->err_count;
- }
- }
- }
-}
-
-static struct markedglyphs *fea_ParseMarkedGlyphs(struct parseState *tok,
- int is_pos, int allow_marks, int allow_lookups) {
- int mark_cnt = 0, last_mark=0, is_cursive = false, is_mark=false;
- struct markedglyphs *head=NULL, *last=NULL, *prev=NULL, *cur;
- int first = true;
- char *contents;
-
- forever {
- fea_ParseTok(tok);
- cur = NULL;
- if ( first && is_pos && tok->type == tk_cursive )
- is_cursive = true;
- else if ( first && is_pos && tok->type == tk_mark )
- is_mark = true;
- else if ( tok->type==tk_name || tok->type == tk_cid ) {
- if ( tok->type == tk_name )
- contents = fea_glyphname_validate(tok,tok->tokbuf);
- else
- contents = fea_cid_validate(tok,tok->value);
- if ( contents!=NULL ) {
- cur = chunkalloc(sizeof(struct markedglyphs));
- cur->is_cursive = is_cursive;
- cur->is_mark = is_mark;
- cur->is_name = true;
- cur->name_or_class = contents;
- }
- } else if ( tok->type == tk_class || (tok->type==tk_char && tok->tokbuf[0]=='[')) {
- cur = chunkalloc(sizeof(struct markedglyphs));
- cur->is_cursive = is_cursive;
- cur->is_mark = is_mark;
- cur->is_name = false;
- cur->name_or_class = fea_ParseGlyphClassGuarded(tok);
- } else if ( allow_marks && tok->type==tk_char &&
- (tok->tokbuf[0]=='\'' || tok->tokbuf[0]=='"') && last!=NULL ) {
- if ( last_mark!=tok->tokbuf[0] || (prev!=NULL && prev->mark_count==0)) {
- ++mark_cnt;
- last_mark = tok->tokbuf[0];
- }
- last->mark_count = mark_cnt;
- } else if ( is_pos && last!=NULL && last->vr==NULL && tok->type == tk_int ) {
- last->vr = chunkalloc(sizeof(struct vr));
- if ( tok->in_vkrn )
- last->vr->v_adv_off = tok->value;
- else
- last->vr->h_adv_off = tok->value;
- } else if ( is_pos && last!=NULL && tok->type == tk_char && tok->tokbuf[0]=='<' ) {
- fea_ParseBroket(tok,last);
- } else if ( !is_pos && allow_lookups && tok->type == tk_char && tok->tokbuf[0]=='<' ) {
- fea_TokenMustBe(tok,tk_lookup,'\0');
- fea_TokenMustBe(tok,tk_name,'\0');
- cur = chunkalloc(sizeof(struct markedglyphs));
- cur->is_name = false;
- cur->is_lookup = true;
- cur->lookupname = copy(tok->tokbuf);
- fea_TokenMustBe(tok,tk_char,'>');
- } else
- break;
- if ( cur!=NULL ) {
- prev = last;
- if ( last==NULL )
- head = cur;
- else
- last->next = cur;
- last = cur;
- }
- first = false;
- }
- if ( head!=NULL && mark_cnt!=0 )
- head->has_marks = true;
- fea_UnParseTok(tok);
-return( head );
-}
-
-static void fea_markedglyphsFree(struct markedglyphs *gl) {
- struct markedglyphs *next;
- int i;
-
- while ( gl!=NULL ) {
- next = gl->next;
- free(gl->name_or_class);
- free(gl->lookupname);
- for ( i=0; i<gl->ap_cnt; ++i )
- AnchorPointsFree(gl->anchors[i]);
- free(gl->anchors);
- if ( gl->vr!=NULL ) {
-#ifdef FONTFORGE_CONFIG_DEVICETABLES
- ValDevFree(gl->vr->adjust);
-#endif
- chunkfree(gl->vr,sizeof(struct vr));
- }
- gl = next;
- }
-}
-
-static struct feat_item *fea_AddAllLigPosibilities(struct parseState *tok,struct markedglyphs *glyphs,
- SplineChar *sc,char *sequence_start,char *next, struct feat_item *sofar) {
- char *start, *pt, ch;
- SplineChar *temp;
- char *after;
- struct feat_item *item;
-
- start = glyphs->name_or_class;
- forever {
- while ( *start==' ' ) ++start;
- if ( *start=='\0' )
- break;
- for ( pt=start; *pt!='\0' && *pt!=' '; ++pt );
- ch = *pt; *pt = '\0';
- temp = fea_glyphname_get(tok,start);
- *pt = ch; start = pt;
- if ( temp==NULL )
- continue;
- strcpy(next,temp->name);
- after = next+strlen(next);
- if ( glyphs->next!=NULL ) {
- *after++ = ' ';
- sofar = fea_AddAllLigPosibilities(tok,glyphs->next,sc,sequence_start,after,sofar);
- } else {
- *after = '\0';
- item = chunkalloc(sizeof(struct feat_item));
- item->type = ft_pst;
- item->next = sofar;
- sofar = item;
- item->u1.sc = sc;
- item->u2.pst = chunkalloc(sizeof(PST));
- item->u2.pst->type = pst_ligature;
- item->u2.pst->u.lig.components = copy(sequence_start);
- item->u2.pst->u.lig.lig = sc;
- }
- }
-return( sofar );
-}
-
-static struct markedglyphs *fea_glyphs_to_names(struct markedglyphs *glyphs,
- int cnt,char **to) {
- struct markedglyphs *g;
- int len, i;
- char *names, *pt;
-
- len = 0;
- for ( g=glyphs, i=0; i<cnt; ++i, g=g->next )
- len += strlen( g->name_or_class ) +1;
- names = pt = galloc(len+1);
- for ( g=glyphs, i=0; i<cnt; ++i, g=g->next ) {
- strcpy(pt,g->name_or_class);
- pt += strlen( pt );
- *pt++ = ' ';
- }
- if ( pt!=names )
- pt[-1] = '\0';
- else
- *pt = '\0';
- *to = names;
-return( g );
-}
-
-static struct feat_item *fea_process_pos_single(struct parseState *tok,
- struct markedglyphs *glyphs, struct feat_item *sofar) {
- char *start, *pt, ch;
- struct feat_item *item;
- SplineChar *sc;
-
- start = glyphs->name_or_class;
- forever {
- while ( *start==' ' ) ++start;
- if ( *start=='\0' )
- break;
- for ( pt=start; *pt!='\0' && *pt!=' '; ++pt );
- ch = *pt; *pt = '\0';
- sc = fea_glyphname_get(tok,start);
- *pt = ch; start = pt;
- if ( sc!=NULL ) {
- item = chunkalloc(sizeof(struct feat_item));
- item->type = ft_pst;
- item->next = sofar;
- sofar = item;
- item->u1.sc = sc;
- item->u2.pst = chunkalloc(sizeof(PST));
- item->u2.pst->type = pst_position;
- item->u2.pst->u.pos = glyphs->vr[0];
- }
- }
-return( sofar );
-}
-
-static struct feat_item *fea_process_pos_pair(struct parseState *tok,
- struct markedglyphs *glyphs, struct feat_item *sofar, int enumer) {
- char *start, *pt, ch, *start2, *pt2, ch2;
- struct feat_item *item;
- struct vr vr[2];
- SplineChar *sc, *sc2;
-
- memset(vr,0,sizeof(vr));
- if ( glyphs->vr==NULL )
- vr[0] = *glyphs->next->vr;
- else {
- vr[0] = *glyphs->vr;
- if ( glyphs->next->vr!=NULL )
- vr[1] = *glyphs->next->vr;
- }
- if ( enumer || (glyphs->is_name && glyphs->next->is_name)) {
- start = glyphs->name_or_class;
- forever {
- while ( *start==' ' ) ++start;
- if ( *start=='\0' )
- break;
- for ( pt=start; *pt!='\0' && *pt!=' '; ++pt );
- ch = *pt; *pt = '\0';
- sc = fea_glyphname_get(tok,start);
- *pt = ch; start = pt;
- if ( sc!=NULL ) {
- start2 = glyphs->next->name_or_class;
- forever {
- while ( *start2==' ' ) ++start2;
- if ( *start2=='\0' )
- break;
- for ( pt2=start2; *pt2!='\0' && *pt2!=' '; ++pt2 );
- ch2 = *pt2; *pt2 = '\0';
- sc2 = fea_glyphname_get(tok,start2);
- *pt2 = ch2; start2 = pt2;
- if ( sc2!=NULL ) {
- item = chunkalloc(sizeof(struct feat_item));
- item->type = ft_pst;
- item->next = sofar;
- sofar = item;
- item->u1.sc = sc;
- item->u2.pst = chunkalloc(sizeof(PST));
- item->u2.pst->type = pst_pair;
- item->u2.pst->u.pair.paired = copy(sc2->name);
- item->u2.pst->u.pair.vr = chunkalloc(sizeof( struct vr[2]));
- memcpy(item->u2.pst->u.pair.vr,vr,sizeof(vr));
- }
- }
- }
- }
- } else {
- item = chunkalloc(sizeof(struct feat_item));
- item->type = ft_pstclass;
- item->next = sofar;
- sofar = item;
- item->u1.class = copy(glyphs->name_or_class);
- item->u2.pst = chunkalloc(sizeof(PST));
- item->u2.pst->type = pst_pair;
- item->u2.pst->u.pair.paired = copy(glyphs->next->name_or_class);
- item->u2.pst->u.pair.vr = chunkalloc(sizeof( struct vr[2]));
- memcpy(item->u2.pst->u.pair.vr,vr,sizeof(vr));
- }
-return( sofar );
-}
-
-static struct feat_item *fea_process_sub_single(struct parseState *tok,
- struct markedglyphs *glyphs, struct markedglyphs *rpl,
- struct feat_item *sofar ) {
- char *start, *pt, ch, *start2, *pt2, ch2;
- struct feat_item *item;
- SplineChar *sc, *temp;
-
- if ( rpl->is_name ) {
- temp = fea_glyphname_get(tok,rpl->name_or_class);
- if ( temp!=NULL ) {
- start = glyphs->name_or_class;
- if ( start==NULL ) {
- LogError(_("Internal state messed up on line %d of %s"), tok->line[tok->inc_depth], tok->filename[tok->inc_depth] );
- ++tok->err_count;
-return( sofar );
- }
- forever {
- while ( *start==' ' ) ++start;
- if ( *start=='\0' )
- break;
- for ( pt=start; *pt!='\0' && *pt!=' '; ++pt );
- ch = *pt; *pt = '\0';
- sc = fea_glyphname_get(tok,start);
- *pt = ch; start = pt;
- if ( sc!=NULL ) {
- item = chunkalloc(sizeof(struct feat_item));
- item->type = ft_pst;
- item->next = sofar;
- sofar = item;
- item->u1.sc = sc;
- item->u2.pst = chunkalloc(sizeof(PST));
- item->u2.pst->type = pst_substitution;
- item->u2.pst->u.subs.variant = copy(temp->name);
- }
- }
- }
- } else if ( !glyphs->is_name ) {
- start = glyphs->name_or_class;
- start2 = rpl->name_or_class;
- forever {
- while ( *start==' ' ) ++start;
- while ( *start2==' ' ) ++start2;
- if ( *start=='\0' && *start2=='\0' )
- break;
- else if ( *start=='\0' || *start2=='\0' ) {
- LogError(_("When a single substitution is specified by glyph classes, those classes must be of the same length on line %d of %s"), tok->line[tok->inc_depth], tok->filename[tok->inc_depth] );
- ++tok->err_count;
- break;
- }
- for ( pt=start; *pt!='\0' && *pt!=' '; ++pt );
- ch = *pt; *pt = '\0';
- for ( pt2=start2; *pt2!='\0' && *pt2!=' '; ++pt2 );
- ch2 = *pt2; *pt2 = '\0';
- sc = fea_glyphname_get(tok,start);
- temp = fea_glyphname_get(tok,start2);
- *pt = ch; start = pt;
- *pt2 = ch2; start2 = pt2;
- if ( sc==NULL || temp==NULL )
- continue;
- item = chunkalloc(sizeof(struct feat_item));
- item->type = ft_pst;
- item->next = sofar;
- sofar = item;
- item->u1.sc = sc;
- item->u2.pst = chunkalloc(sizeof(PST));
- item->u2.pst->type = pst_substitution;
- item->u2.pst->u.subs.variant = copy(temp->name);
- }
- } else {
- LogError(_("When a single substitution's replacement is specified by a glyph class, the thing being replaced must also be a class on line %d of %s"), tok->line[tok->inc_depth], tok->filename[tok->inc_depth] );
- ++tok->err_count;
- }
-return( sofar );
-}
-
-static struct feat_item *fea_process_sub_ligature(struct parseState *tok,
- struct markedglyphs *glyphs, struct markedglyphs *rpl,
- struct feat_item *sofar ) {
- SplineChar *sc;
- struct markedglyphs *g;
-
- /* I store ligatures backwards, in the ligature glyph not the glyphs being substituted */
- sc = fea_glyphname_get(tok,rpl->name_or_class);
- if ( sc!=NULL ) {
- int len=0;
- char *space;
- for ( g=glyphs; g!=NULL && g->mark_count==glyphs->mark_count; g=g->next )
- len += strlen(g->name_or_class)+1;
- space = galloc(len+1);
- sofar = fea_AddAllLigPosibilities(tok,glyphs,sc,space,space,sofar);
- free(space);
- }
-return( sofar );
-}
-
-static FPST *fea_markedglyphs_to_fpst(struct parseState *tok,struct markedglyphs *glyphs,
- int is_pos,int is_ignore) {
- struct markedglyphs *g;
- int bcnt=0, ncnt=0, fcnt=0, cnt;
- int all_single=true;
- int mmax = 0;
- int i;
- FPST *fpst;
- struct fpst_rule *r;
- struct feat_item *item, *head = NULL;
-
- for ( g=glyphs; g!=NULL && g->mark_count==0; g=g->next ) {
- ++bcnt;
- if ( !g->is_name ) all_single = false;
- }
- for ( ; g!=NULL ; g=g->next ) {
- if ( !g->is_name ) all_single = false;
- if ( g->mark_count==0 )
- ++fcnt;
- else {
- /* if we found some unmarked glyphs between two runs of marked */
- /* they don't count as lookaheads */
- ncnt += fcnt + 1;
- fcnt = 0;
- if ( g->mark_count>mmax ) mmax = g->mark_count;
- }
- }
-
- fpst = chunkalloc(sizeof(FPST));
- fpst->type = is_pos ? pst_chainpos : pst_chainsub;
- fpst->format = all_single ? pst_glyphs : pst_coverage;
- fpst->rule_cnt = 1;
- fpst->rules = r = gcalloc(1,sizeof(struct fpst_rule));
- if ( is_ignore )
- mmax = 0;
- r->lookup_cnt = mmax;
- r->lookups = gcalloc(mmax,sizeof(struct seqlookup));
- for ( i=0; i<mmax; ++i )
- r->lookups[i].seq = i;
-
- if ( all_single ) {
- g = fea_glyphs_to_names(glyphs,bcnt,&r->u.glyph.back);
- g = fea_glyphs_to_names(g,ncnt,&r->u.glyph.names);
- g = fea_glyphs_to_names(g,fcnt,&r->u.glyph.fore);
- } else {
- r->u.coverage.ncnt = ncnt;
- r->u.coverage.bcnt = bcnt;
- r->u.coverage.fcnt = fcnt;
- r->u.coverage.ncovers = galloc(ncnt*sizeof(char*));
- r->u.coverage.bcovers = galloc(bcnt*sizeof(char*));
- r->u.coverage.fcovers = galloc(fcnt*sizeof(char*));
- for ( i=0, g=glyphs; i<bcnt; ++i, g=g->next )
- r->u.coverage.bcovers[i] = copy(g->name_or_class);
- for ( i=0; i<ncnt; ++i, g=g->next )
- r->u.coverage.ncovers[i] = copy(g->name_or_class);
- for ( i=0; i<fcnt; ++i, g=g->next )
- r->u.coverage.fcovers[i] = copy(g->name_or_class);
- }
-
- item = chunkalloc(sizeof(struct feat_item));
- item->type = ft_fpst;
- item->next = tok->sofar;
- tok->sofar = item;
- item->u2.fpst = fpst;
-
- if ( is_pos ) {
- for ( g=glyphs; g!=NULL && g->mark_count==0; g=g->next );
- for ( i=0; g!=NULL; ++i ) {
- head = NULL;
- if ( g->lookupname!=NULL ) {
- head = chunkalloc(sizeof(struct feat_item));
- head->type = ft_lookup_ref;
- head->u1.lookup_name = copy(g->lookupname);
- } else if ( (g->next==NULL || g->next->mark_count!=g->mark_count) &&
- g->vr!=NULL ) {
- head = fea_process_pos_single(tok,g,NULL);
- } else if ( g->next!=NULL && g->mark_count==g->next->mark_count &&
- (g->vr!=NULL || g->next->vr!=NULL ) &&
- ( g->next->next==NULL || g->next->next->mark_count!=g->mark_count)) {
- head = fea_process_pos_pair(tok,g,NULL,false);
- } else {
- LogError(_("Unparseable contextual sequence on line %d of %s"), tok->line[tok->inc_depth], tok->filename[tok->inc_depth] );
- ++tok->err_count;
- }
- r->lookups[i].lookup = (OTLookup *) head;
- cnt = g->mark_count;
- while ( g!=NULL && g->mark_count == cnt ) /* skip everything involved here */
- g=g->next;
- for ( ; g!=NULL && g->mark_count==0; g=g->next ); /* skip any uninvolved glyphs */
- }
- }
-
-return( fpst );
-}
-
-static void fea_ParseIgnore(struct parseState *tok) {
- struct markedglyphs *glyphs;
- int is_pos;
- FPST *fpst;
- /* ignore [pos|sub] <marked glyph sequence> (, <marked g sequence>)* */
-
- fea_ParseTok(tok);
- if ( tok->type==tk_position )
- is_pos = true;
- else if ( tok->type == tk_substitute )
- is_pos = false;
- else {
- LogError(_("The ignore keyword must be followed by either position or substitute on line %d of %s"), tok->line[tok->inc_depth], tok->filename[tok->inc_depth] );
- ++tok->err_count;
- is_pos = true;
- }
- forever {
- glyphs = fea_ParseMarkedGlyphs(tok,false/* don't parse value records, etc*/,
- true/*allow marks*/,false/* no lookups */);
- fpst = fea_markedglyphs_to_fpst(tok,glyphs,false,true);
- if ( is_pos )
- fpst->type = pst_chainpos;
- fea_markedglyphsFree(glyphs);
- fea_ParseTok(tok);
- if ( tok->type!=tk_char || tok->tokbuf[0]!=',' )
- break;
- }
-
- fea_now_semi(tok);
-}
-
-static void fea_ParseSubstitute(struct parseState *tok) {
- /* name by name => single subs */
- /* class by name => single subs */
- /* class by class => single subs */
- /* name by <glyph sequence> => multiple subs */
- /* name from <class> => alternate subs */
- /* <glyph sequence> by name => ligature */
- /* <marked glyph sequence> by <name> => context chaining */
- /* <marked glyph sequence> by <lookup name>* => context chaining */
- /* [ignore sub] <marked glyph sequence> (, <marked g sequence>)* */
- struct markedglyphs *glyphs = fea_ParseMarkedGlyphs(tok,false,true,false),
- *g, *rpl, *rp;
- int cnt, i;
- SplineChar *sc;
- struct feat_item *item, *head;
-
- fea_ParseTok(tok);
- for ( cnt=0, g=glyphs; g!=NULL; g=g->next, ++cnt );
- if ( glyphs==NULL ) {
- LogError(_("Empty subsitute on line %d of %s"), tok->line[tok->inc_depth], tok->filename[tok->inc_depth] );
- ++tok->err_count;
- } else if ( !glyphs->has_marks ) {
- /* Non-contextual */
- if ( cnt==1 && glyphs->is_name && tok->type==tk_from ) {
- /* Alternate subs */
- char *alts;
- fea_ParseTok(tok);
- alts = fea_ParseGlyphClassGuarded(tok);
- sc = fea_glyphname_get(tok,glyphs->name_or_class);
- if ( sc!=NULL ) {
- item = chunkalloc(sizeof(struct feat_item));
- item->type = ft_pst;
- item->next = tok->sofar;
- tok->sofar = item;
- item->u1.sc = sc;
- item->u2.pst = chunkalloc(sizeof(PST));
- item->u2.pst->type = pst_alternate;
- item->u2.pst->u.alt.components = alts;
- }
- } else if ( cnt>=1 && tok->type==tk_by ) {
- rpl = fea_ParseMarkedGlyphs(tok,false,false,false);
- if ( rpl==NULL ) {
- LogError(_("No substitution specified on line %d of %s"), tok->line[tok->inc_depth], tok->filename[tok->inc_depth] );
- ++tok->err_count;
- } else if ( rpl->has_marks ) {
- LogError(_("No marked glyphs allowed in replacement on line %d of %s"), tok->line[tok->inc_depth], tok->filename[tok->inc_depth] );
- ++tok->err_count;
- } else {
- if ( cnt==1 && rpl->next==NULL ) {
- tok->sofar = fea_process_sub_single(tok,glyphs,rpl,tok->sofar);
- } else if ( cnt==1 && glyphs->is_name && rpl->next!=NULL && rpl->is_name ) {
- /* Multiple substitution */
- int len=0;
- char *mult;
- for ( g=rpl; g!=NULL; g=g->next )
- len += strlen(g->name_or_class)+1;
- mult = galloc(len+1);
- len = 0;
- for ( g=rpl; g!=NULL; g=g->next ) {
- strcpy(mult+len,g->name_or_class);
- len += strlen(g->name_or_class);
- mult[len++] = ' ';
- }
- mult[len-1] = '\0';
- sc = fea_glyphname_get(tok,glyphs->name_or_class);
- if ( sc!=NULL ) {
- item = chunkalloc(sizeof(struct feat_item));
- item->type = ft_pst;
- item->next = tok->sofar;
- tok->sofar = item;
- item->u1.sc = sc;
- item->u2.pst = chunkalloc(sizeof(PST));
- item->u2.pst->type = pst_multiple;
- item->u2.pst->u.mult.components = mult;
- }
- } else if ( cnt>1 && rpl->is_name && rpl->next==NULL ) {
- tok->sofar = fea_process_sub_ligature(tok,glyphs,rpl,tok->sofar);
- /* Ligature */
- } else {
- LogError(_("Unparseable glyph sequence in substitution on line %d of %s"), tok->line[tok->inc_depth], tok->filename[tok->inc_depth] );
- ++tok->err_count;
- }
- }
- fea_markedglyphsFree(rpl);
- } else {
- LogError(_("Expected 'by' or 'from' keywords in substitution on line %d of %s"), tok->line[tok->inc_depth], tok->filename[tok->inc_depth] );
- ++tok->err_count;
- }
- } else {
- /* Contextual */
- FPST *fpst = fea_markedglyphs_to_fpst(tok,glyphs,false,false);
- struct fpst_rule *r = fpst->rules;
- if ( tok->type!=tk_by ) {
- LogError(_("Expected 'by' keyword in substitution on line %d of %s"), tok->line[tok->inc_depth], tok->filename[tok->inc_depth] );
- ++tok->err_count;
- }
- rpl = fea_ParseMarkedGlyphs(tok,false,false,true);
- for ( g=glyphs; g!=NULL && g->mark_count==0; g=g->next );
- for ( i=0, rp=rpl; g!=NULL && rp!=NULL; ++i, rp=rp->next ) {
- if ( rp->lookupname!=NULL ) {
- head = chunkalloc(sizeof(struct feat_item));
- head->type = ft_lookup_ref;
- head->u1.lookup_name = copy(rp->lookupname);
- } else if ( g->next==NULL || g->next->mark_count!=g->mark_count ) {
- head = fea_process_sub_single(tok,g,rp,NULL);
- } else if ( g->next!=NULL && g->mark_count==g->next->mark_count ) {
- head = fea_process_sub_ligature(tok,g,rpl,NULL);
- } else {
- LogError(_("Unparseable contextual sequence on line %d of %s"), tok->line[tok->inc_depth], tok->filename[tok->inc_depth] );
- ++tok->err_count;
- }
- r->lookups[i].lookup = (OTLookup *) head;
- cnt = g->mark_count;
- while ( g!=NULL && g->mark_count == cnt ) /* skip everything involved here */
- g=g->next;
- for ( ; g!=NULL && g->mark_count!=0; g=g->next ); /* skip any uninvolved glyphs */
- }
-
- fea_markedglyphsFree(rpl);
- }
-
- fea_end_statement(tok);
- fea_markedglyphsFree(glyphs);
-}
-
-static void fea_ParseMarks(struct parseState *tok) {
- /* mark name|class <anchor> */
- char *contents = NULL;
- SplineChar *sc = NULL;
- AnchorPoint *ap;
- char *start, *pt;
- int ch;
-
- fea_ParseTok(tok);
- if ( tok->type==tk_name )
- sc = fea_glyphname_get(tok,tok->tokbuf);
- else if ( tok->type==tk_class )
- contents = fea_lookup_class_complain(tok,tok->tokbuf);
- else if ( tok->type==tk_char && tok->tokbuf[0]=='[' )
- contents = fea_ParseGlyphClass(tok);
- else {
- LogError(_("Expected glyph name or class in mark statement on line %d of %s"), tok->line[tok->inc_depth], tok->filename[tok->inc_depth] );
- ++tok->err_count;
- fea_skip_to_semi(tok);
-return;
- }
- if ( sc==NULL && contents==NULL ) {
- fea_skip_to_semi(tok);
-return;
- }
-
- fea_TokenMustBe(tok,tk_char,'<');
- fea_TokenMustBe(tok,tk_anchor,'\0');
- ap = fea_ParseAnchor(tok);
- ap->type = at_mark;
- fea_end_statement(tok);
-
- if ( ap!=NULL ) {
- pt = contents;
- forever {
- struct feat_item *item = chunkalloc(sizeof(struct feat_item));
- item->type = ft_ap;
- item->u2.ap = ap;
- item->next = tok->sofar;
- tok->sofar = item;
- start = pt;
- if ( contents==NULL ) {
- item->u1.sc = sc;
- break;
- }
- while ( *pt!='\0' && *pt!=' ' )
- ++pt;
- ch = *pt; *pt = '\0';
- sc = fea_glyphname_get(tok,start);
- *pt = ch;
- while ( isspace(*pt)) ++pt;
- if ( sc==NULL ) {
- tok->sofar = item->next; /* Oops, remove it */
- chunkfree(item,sizeof(*item));
- if ( *pt=='\0' ) {
- AnchorPointsFree(ap);
- break;
- }
- } else {
- item->u1.sc = sc;
- if ( *pt=='\0' )
- break;
- ap = AnchorPointsCopy(ap);
- }
- }
- }
- free(contents);
-}
-
-static void fea_ParsePosition(struct parseState *tok, int enumer) {
- /* name <vr> => single pos */
- /* class <vr> => single pos */
- /* name|class <vr> name|class <vr> => pair pos */
- /* name|class name|class <vr> => pair pos */
- /* cursive name|class <anchor> <anchor> => cursive positioning */
- /* name|class <anchor> mark name|class => mark to base pos */
- /* Must be preceded by a mark statement */
- /* name|class <anchor> <anchor>+ mark name|class => mark to ligature pos */
- /* Must be preceded by a mark statement */
- /* mark name|class <anchor> mark name|class => mark to base pos */
- /* Must be preceded by a mark statement */
- /* <marked glyph pos sequence> => context chaining */
- /* [ignore pos] <marked glyph sequence> (, <marked g sequence>)* */
- struct markedglyphs *glyphs = fea_ParseMarkedGlyphs(tok,true,true,false), *g;
- int cnt, i;
- struct feat_item *item;
- char *start, *pt, ch;
- SplineChar *sc;
-
- fea_ParseTok(tok);
- for ( cnt=0, g=glyphs; g!=NULL; g=g->next, ++cnt );
- if ( glyphs==NULL ) {
- LogError(_("Empty position on line %d of %s"), tok->line[tok->inc_depth], tok->filename[tok->inc_depth] );
- ++tok->err_count;
- } else if ( !glyphs->has_marks ) {
- /* Non-contextual */
- if ( glyphs->is_cursive ) {
- if ( cnt!=1 || glyphs->ap_cnt!=2 ) {
- LogError(_("Invalid cursive position on line %d of %s"), tok->line[tok->inc_depth], tok->filename[tok->inc_depth] );
- ++tok->err_count;
- } else {
- start = glyphs->name_or_class;
- if ( glyphs->anchors[1]!=NULL )
- glyphs->anchors[1]->type = at_cexit;
- forever {
- while ( *start==' ' ) ++start;
- if ( *start=='\0' )
- break;
- for ( pt=start; *pt!='\0' && *pt!=' '; ++pt );
- ch = *pt; *pt = '\0';
- sc = fea_glyphname_get(tok,start);
- *pt = ch; start = pt;
- if ( sc!=NULL ) {
- item = chunkalloc(sizeof(struct feat_item));
- item->type = ft_ap;
- item->next = tok->sofar;
- tok->sofar = item;
- item->u1.sc = sc;
- if ( glyphs->anchors[0]!=NULL ) {
- glyphs->anchors[0]->type = at_centry;
- glyphs->anchors[0]->next = glyphs->anchors[1];
- item->u2.ap = AnchorPointsCopy(glyphs->anchors[0]);
- } else
- item->u2.ap = AnchorPointsCopy(glyphs->anchors[1]);
- }
- }
- }
- } else if ( cnt==1 && glyphs->vr!=NULL ) {
- tok->sofar = fea_process_pos_single(tok,glyphs,tok->sofar);
- } else if ( cnt==2 && (glyphs->vr!=NULL || glyphs->next->vr!=NULL) ) {
- tok->sofar = fea_process_pos_pair(tok,glyphs,tok->sofar, enumer);
- } else if ( cnt==1 && glyphs->ap_cnt>=1 && tok->type == tk_mark ) {
- /* Mark to base, mark to mark, mark to ligature */
- char *mark_class;
- AnchorPoint *head=NULL, *last=NULL;
- if ( tok->type!=tk_mark ) {
- LogError(_("A mark glyph (or class of marks) must be specified here on line %d of %s"), tok->line[tok->inc_depth], tok->filename[tok->inc_depth] );
- ++tok->err_count;
- }
- fea_ParseTok(tok);
- if ( tok->type==tk_name )
- mark_class = copy(tok->tokbuf);
- else
- mark_class = fea_canonicalClassOrder(fea_ParseGlyphClassGuarded(tok));
- fea_ParseTok(tok);
- if ( glyphs->is_mark && glyphs->ap_cnt>1 ) {
- LogError(_("Mark to base anchor statements may only have one anchor on line %d of %s"), tok->line[tok->inc_depth], tok->filename[tok->inc_depth] );
- ++tok->err_count;
- }
- if ( mark_class!=NULL ) {
- for ( i=0; i<glyphs->ap_cnt; ++i ) {
- if ( glyphs->anchors[i]==NULL )
- /* Nothing to be done */;
- else {
- if ( glyphs->ap_cnt>1 ) {
- glyphs->anchors[i]->type = at_baselig;
- glyphs->anchors[i]->lig_index = i;
- } else if ( glyphs->is_mark )
- glyphs->anchors[i]->type = at_basemark;
- else
- glyphs->anchors[i]->type = at_basechar;
- if ( head==NULL )
- head = glyphs->anchors[i];
- else
- last->next = glyphs->anchors[i];
- last = glyphs->anchors[i];
- }
- }
-
- start = glyphs->name_or_class;
- forever {
- while ( *start==' ' ) ++start;
- if ( *start=='\0' )
- break;
- for ( pt=start; *pt!='\0' && *pt!=' '; ++pt );
- ch = *pt; *pt = '\0';
- sc = fea_glyphname_get(tok,start);
- *pt = ch; start = pt;
- if ( sc!=NULL ) {
- item = chunkalloc(sizeof(struct feat_item));
- item->type = ft_ap;
- item->next = tok->sofar;
- tok->sofar = item;
- item->u1.sc = sc;
- item->u2.ap = AnchorPointsCopy(head);
- item->mark_class = copy(mark_class);
- }
- }
-
- /* So we can free them properly */
- for ( ; head!=NULL; head = last ) {
- last = head->next;
- head->next = NULL;
- }
- }
- } else {
- LogError(_("Unparseable glyph sequence in position on line %d of %s"), tok->line[tok->inc_depth], tok->filename[tok->inc_depth] );
- ++tok->err_count;
- }
- } else {
- /* Contextual */
- (void) fea_markedglyphs_to_fpst(tok,glyphs,true,false);
- }
- fea_now_semi(tok);
- fea_markedglyphsFree(glyphs);
-}
-
-static enum otlookup_type fea_LookupTypeFromItem(struct feat_item *item) {
- switch ( item->type ) {
- case ft_pst: case ft_pstclass:
- switch ( item->u2.pst->type ) {
- case pst_position:
-return( gpos_single );
- case pst_pair:
-return( gpos_pair );
- case pst_substitution:
-return( gsub_single );
- case pst_alternate:
-return( gsub_alternate );
- case pst_multiple:
-return( gsub_multiple );
- case pst_ligature:
-return( gsub_ligature );
- default:
-return( ot_undef ); /* Can't happen */
- }
- break;
- case ft_ap:
- switch( item->u2.ap->type ) {
- case at_centry: case at_cexit:
-return( gpos_cursive );
- case at_mark:
-return( ot_undef ); /* Can be used in three different lookups. Not enough info */
- case at_basechar:
-return( gpos_mark2base );
- case at_baselig:
-return( gpos_mark2ligature );
- case at_basemark:
-return( gpos_mark2mark );
- default:
-return( ot_undef ); /* Can't happen */
- }
- break;
- case ft_fpst:
- switch( item->u2.fpst->type ) {
- case pst_chainpos:
-return( gpos_contextchain );
- case pst_chainsub:
-return( gsub_contextchain );
- default:
-return( ot_undef ); /* Can't happen */
- }
- break;
- default:
-return( ot_undef ); /* Can happen */
- }
-}
-
-static struct feat_item *fea_AddFeatItem(struct parseState *tok,enum feat_type type,uint32 tag) {
- struct feat_item *item;
-
- item = chunkalloc(sizeof(struct feat_item));
- item->type = type;
- item->u1.tag = tag;
- item->next = tok->sofar;
- tok->sofar = item;
-return( item );
-}
-
-static int fea_LookupSwitch(struct parseState *tok) {
- int enumer = false;
-
- switch ( tok->type ) {
- case tk_class:
- fea_ParseGlyphClassDef(tok);
- break;
- case tk_lookupflag:
- fea_ParseLookupFlags(tok);
- break;
- case tk_mark:
- fea_ParseMarks(tok);
- break;
- case tk_ignore:
- fea_ParseIgnore(tok);
- break;
- case tk_enumerate:
- fea_TokenMustBe(tok,tk_position,'\0');
- enumer = true;
- /* Fall through */;
- case tk_position:
- fea_ParsePosition(tok,enumer);
- break;
- case tk_substitute:
- fea_ParseSubstitute(tok);
- enumer = false;
- break;
- case tk_subtable:
- fea_AddFeatItem(tok,ft_subtable,0);
- fea_TokenMustBe(tok,tk_char,';');
- break;
- case tk_char:
- if ( tok->tokbuf[0]=='}' )
-return( 2 );
- /* Fall through */
- default:
-return( 0 );
- }
-return( 1 );
-}
-
-static void fea_ParseLookupDef(struct parseState *tok, int could_be_stat ) {
- char *lookup_name;
- struct feat_item *item, *first_after_mark;
- enum otlookup_type lookuptype;
- int has_marks;
- int ret;
-
- fea_ParseTok(tok);
- if ( tok->type!=tk_name ) {
- LogError(_("Expected name in lookup on line %d of %s"), tok->line[tok->inc_depth], tok->filename[tok->inc_depth] );
- ++tok->err_count;
- fea_skip_to_semi(tok);
-return;
- }
- lookup_name = copy(tok->tokbuf);
- fea_ParseTok(tok);
- if ( could_be_stat && tok->type==tk_char && tok->tokbuf[0]==';' ) {
- item = chunkalloc(sizeof(struct feat_item));
- item->type = ft_lookup_ref;
- item->u1.lookup_name = lookup_name;
- item->next = tok->sofar;
- tok->sofar = item;
-return;
- } else if ( tok->type==tk_useExtension ) /* I just ignore this */
- fea_ParseTok(tok);
- if ( tok->type!=tk_char || tok->tokbuf[0]!='{' ) {
- LogError(_("Expected '{' in feature definition on line %d of %s"), tok->line[tok->inc_depth], tok->filename[tok->inc_depth] );
- ++tok->err_count;
- fea_skip_to_semi(tok);
-return;
- }
-
- item = chunkalloc(sizeof(struct feat_item));
- item->type = ft_lookup_start;
- item->u1.lookup_name = lookup_name;
- item->next = tok->sofar;
- tok->sofar = item;
-
- first_after_mark = NULL;
- forever {
- fea_ParseTok(tok);
- if ( tok->err_count>100 )
- break;
- if ( tok->type==tk_eof ) {
- LogError(_("Unexpected end of file in lookup definition on line %d of %s"), tok->line[tok->inc_depth], tok->filename[tok->inc_depth] );
- ++tok->err_count;
-return;
- } else if ( (ret = fea_LookupSwitch(tok))==0 ) {
- LogError(_("Unexpected token, %s, in lookup definition on line %d of %s"), tok->tokbuf, tok->line[tok->inc_depth], tok->filename[tok->inc_depth] );
- if ( tok->type==tk_name && strcmp(tok->tokbuf,"subs")==0 )
- LogError(_(" Perhaps you meant to use the keyword 'sub' rather than 'subs'?") );
- ++tok->err_count;
-return;
- } else if ( ret==2 )
- break;
- /* Ok, mark classes must either contain exactly the same glyphs, or */
- /* they may not intersect at all */
- /* Mark2* lookups are not well documented (because adobe FDK doesn't */
- /* support them) but I'm going to assume that if I have some mark */
- /* statements, then some pos statement, then another mark statement */
- /* that I begin a new subtable with the second set of marks (and a */
- /* different set of mark classes) */
- if ( tok->sofar!=NULL && tok->sofar->type==ft_subtable )
- first_after_mark = NULL;
- else if ( tok->sofar!=NULL && tok->sofar->type==ft_ap ) {
- if ( tok->sofar->u2.ap->type == at_mark )
- first_after_mark = NULL;
- else if ( tok->sofar->mark_class==NULL )
- /* we don't have to worry about Cursive connections */;
- else if ( first_after_mark == NULL )
- first_after_mark = tok->sofar;
- else {
- struct feat_item *f;
- for ( f = tok->sofar->next; f!=NULL; f=f->next ) {
- if ( f->type==ft_lookup_start || f->type==ft_subtable )
- break;
- if ( f->type!=ft_ap || f->mark_class==NULL )
- continue;
- if ( strcmp(tok->sofar->mark_class,f->mark_class)==0 )
- continue; /* same glyphs, that's ok */
- else if ( fea_classesIntersect(tok->sofar->mark_class,f->mark_class)) {
- LogError(_("Mark classes must either be exactly the same or contain no common glyphs\n But the class on line %d of %s contains a match."),
- tok->line[tok->inc_depth], tok->filename[tok->inc_depth] );
- ++tok->err_count;
- }
- if ( f==first_after_mark )
- break;
- }
- }
- }
- }
- fea_ParseTok(tok);
- if ( tok->type!=tk_name || strcmp(tok->tokbuf,lookup_name)!=0 ) {
- LogError(_("Expected %s in lookup definition on line %d of %s"),
- lookup_name, tok->line[tok->inc_depth], tok->filename[tok->inc_depth] );
- ++tok->err_count;
- }
- fea_end_statement(tok);
-
- /* Make sure all entries in this lookup of the same lookup type */
- lookuptype = ot_undef;
- has_marks = false;
- for ( item=tok->sofar ; item!=NULL && item->type!=ft_lookup_start; item=item->next ) {
- enum otlookup_type cur = fea_LookupTypeFromItem(item);
- if ( item->type==ft_ap && item->u2.ap->type == at_mark )
- has_marks = true;
- if ( cur==ot_undef ) /* Some entries in the list (lookupflags) have no type */
- /* Tum, ty, tum tum */;
- else if ( lookuptype==ot_undef )
- lookuptype = cur;
- else if ( lookuptype!=cur ) {
- LogError(_("All entries in a lookup must have the same type on line %d of %s"),
- tok->line[tok->inc_depth], tok->filename[tok->inc_depth] );
- ++tok->err_count;
- break;
- }
- }
- if ( lookuptype==ot_undef ) {
- LogError(_("This lookup has no effect, I can't figure out its type on line %d of %s"),
- tok->line[tok->inc_depth], tok->filename[tok->inc_depth] );
- ++tok->err_count;
- } else if ( has_marks && lookuptype!=gpos_mark2base &&
- lookuptype!=gpos_mark2mark &&
- lookuptype!=gpos_mark2ligature ) {
- LogError(_("Mark glyphs may not be specified with this type of lookup on line %d of %s"),
- tok->line[tok->inc_depth], tok->filename[tok->inc_depth] );
- ++tok->err_count;
- }
-
- item = chunkalloc(sizeof(struct feat_item));
- item->type = ft_lookup_end;
- /* item->u1.lookup_name = lookup_name; */
- item->next = tok->sofar;
- tok->sofar = item;
-}
-
-static struct nameid *fea_ParseNameId(struct parseState *tok,int strid) {
- int platform = 3, specific = 1, language = 0x409;
- struct nameid *nm;
- char *start, *pt;
- int max, ch, value;
- FILE *in = tok->inlist[tok->inc_depth];
- /* nameid <id> [<string attibute>] string; */
- /* "nameid" and <id> will already have been parsed when we get here */
- /* <string attribute> := <platform> | <platform> <specific> <language> */
- /* <patform>==3 => <specific>=1 <language>=0x409 */
- /* <platform>==1 => <specific>=0 <lang>=0 */
- /* string in double quotes \XXXX escapes to UCS2 (for 3) */
- /* string in double quotes \XX escapes to MacLatin (for 1) */
- /* I only store 3,1 strings */
-
- fea_ParseTok(tok);
- if ( tok->type == tk_int ) {
- if ( tok->value!=3 && tok->value!=1 ) {
- LogError(_("Invalid platform for string on line %d of %s"),
- tok->line[tok->inc_depth], tok->filename[tok->inc_depth] );
- ++tok->err_count;
- } else if ( tok->value==1 ) {
- specific = language = 0;
- }
- fea_ParseTok(tok);
- if ( tok->type == tk_int ) {
- specific = tok->value;
- tok->base = 0;
- fea_TokenMustBe(tok,tk_int,'\0');
- language = tok->value;
- tok->base = 10;
- fea_ParseTok(tok);
- }
- }
- if ( tok->type!=tk_char || tok->tokbuf[0]!='"' ) {
- LogError(_("Expected string on line %d of %s"),
- tok->line[tok->inc_depth], tok->filename[tok->inc_depth] );
- ++tok->err_count;
- fea_skip_to_semi(tok);
- nm = NULL;
- } else {
- if ( platform==3 && specific==1 ) {
- nm = chunkalloc(sizeof(struct nameid));
- nm->strid = strid;
- nm->platform = platform;
- nm->specific = specific;
- nm->language = language;
- } else
- nm = NULL;
- max = 0;
- pt = start = NULL;
- while ( (ch=getc(in))!=EOF && ch!='"' ) {
- if ( ch=='\n' || ch=='\r' )
- continue; /* Newline characters are ignored here */
- /* may be specified with backslashes */
- if ( ch=='\\' ) {
- int i, dmax = platform==3 ? 4 : 2;
- value = 0;
- for ( i=0; i<dmax; ++i ) {
- ch = getc(in);
- if ( !ishexdigit(ch)) {
- ungetc(ch,in);
- break;
- }
- if ( ch>='a' && ch<='f' )
- ch -= ('a'-10);
- else if ( ch>='A' && ch<='F' )
- ch -= ('A'-10);
- else
- ch -= '0';
- value <<= 4;
- value |= ch;
- }
- } else
- value = ch;
- if ( nm!=NULL ) {
- if ( pt-start+3>=max ) {
- int off = pt-start;
- start = grealloc(start,(max+=100)+1);
- pt = start+off;
- }
- pt = utf8_idpb(pt,value);
- }
- }
- if ( nm!=NULL ) {
- if ( pt==NULL )
- nm->utf8_str = copy("");
- else {
- *pt = '\0';
- nm->utf8_str = copy(start);
- free(start);
- }
- }
- if ( tok->type!=tk_char || tok->tokbuf[0]!='"' ) {
- LogError(_("End of file found in string on line %d of %s"),
- tok->line[tok->inc_depth], tok->filename[tok->inc_depth] );
- ++tok->err_count;
- } else
- fea_end_statement(tok);
- }
-return( nm );
-}
-
-static struct feat_item *fea_ParseParameters(struct parseState *tok, struct feat_item *feat) {
- /* Ok. The only time a parameter keyword may be used is inside a 'size' */
- /* feature and then it takes 4 numbers */
- /* The first, third and fourth are in decipoints and may be either */
- /* integers or floats (in which case we must multiply them by 10) */
- int params[4];
- int i;
-
- memset(params,0,sizeof(params));
- for ( i=0; i<4; ++i ) {
- params[i] = fea_ParseDeciPoints(tok);
- if ( tok->type==tk_char && tok->tokbuf[0]==';' )
- break;
- }
- fea_end_statement(tok);
-
- if ( feat==NULL ) {
- feat = chunkalloc(sizeof(struct feat_item));
- feat->type = ft_sizeparams;
- feat->next = tok->sofar;
- tok->sofar = feat;
- }
- feat->u1.params = galloc(sizeof(params));
- memcpy(feat->u1.params,params,sizeof(params));
-return( feat );
-}
-
-static struct feat_item *fea_ParseSizeMenuName(struct parseState *tok, struct feat_item *feat) {
- /* Sizemenuname takes either 0, 1 or 3 numbers and a string */
- /* if no numbers are given (or the first number is 3) then the string is */
- /* unicode. Otherwise a mac encoding, treated as single byte */
- /* Since fontforge only supports windows strings here I shall parse and */
- /* ignore mac strings */
- struct nameid *string;
-
- string = fea_ParseNameId(tok,-1);
-
- if ( string!=NULL ) {
- if ( feat==NULL ) {
- feat = chunkalloc(sizeof(struct feat_item));
- feat->type = ft_sizeparams;
- feat->next = tok->sofar;
- tok->sofar = feat;
- }
- string->next = feat->u2.names;
- feat->u2.names = string;
- }
-return( feat );
-}
-
-static void fea_ParseFeatureDef(struct parseState *tok) {
- uint32 feat_tag;
- struct feat_item *item, *size_item = NULL;
- int type, ret;
-
- fea_ParseTok(tok);
- if ( tok->type!=tk_name || !tok->could_be_tag ) {
- LogError(_("Expected tag in feature on line %d of %s"), tok->line[tok->inc_depth], tok->filename[tok->inc_depth] );
- ++tok->err_count;
- fea_skip_to_semi(tok);
-return;
- }
- feat_tag = tok->tag;
- tok->in_vkrn = feat_tag == CHR('v','k','r','n');
-
- item = chunkalloc(sizeof(struct feat_item));
- item->type = ft_feat_start;
- item->u1.tag = feat_tag;
- if ( tok->def_langsyses!=NULL )
- item->u2.sl = SListCopy(tok->def_langsyses);
- else {
- item->u2.sl = chunkalloc(sizeof(struct scriptlanglist));
- item->u2.sl->script = DEFAULT_SCRIPT;
- item->u2.sl->lang_cnt = 1;
- item->u2.sl->langs[0] = DEFAULT_LANG;
- }
- item->next = tok->sofar;
- tok->sofar = item;
-
- fea_ParseTok(tok);
- if ( tok->type!=tk_char || tok->tokbuf[0]!='{' ) {
- LogError(_("Expected '{' in feature definition on line %d of %s"), tok->line[tok->inc_depth], tok->filename[tok->inc_depth] );
- ++tok->err_count;
- fea_skip_to_semi(tok);
-return;
- }
-
- forever {
- fea_ParseTok(tok);
- if ( tok->err_count>100 )
- break;
- if ( tok->type==tk_eof ) {
- LogError(_("Unexpected end of file in feature definition on line %d of %s"), tok->line[tok->inc_depth], tok->filename[tok->inc_depth] );
- ++tok->err_count;
-return;
- } else if ( (ret = fea_LookupSwitch(tok))==0 ) {
- switch ( tok->type ) {
- case tk_lookup:
- fea_ParseLookupDef(tok,true);
- break;
- case tk_languagesystem:
- fea_ParseLangSys(tok,true);
- break;
- case tk_feature:
- /* can appear inside an 'aalt' feature. I don't support it, but */
- /* just parse and ignore it */
- if ( feat_tag!=CHR('a','a','l','t')) {
- LogError(_("Features inside of other features are only permitted for 'aalt' features on line %d of %s"), tok->line[tok->inc_depth], tok->filename[tok->inc_depth] );
- ++tok->err_count;
- }
- fea_ParseTok(tok);
- if ( tok->type!=tk_name || !tok->could_be_tag ) {
- LogError(_("Expected tag on line %d of %s"), tok->line[tok->inc_depth], tok->filename[tok->inc_depth] );
- ++tok->err_count;
- }
- fea_end_statement(tok);
- break;
- case tk_script:
- case tk_language:
- /* If no lang specified after script use 'dflt', if no script specified before a language use 'latn' */
- type = tok->type==tk_script ? ft_script : ft_lang;
- fea_ParseTok(tok);
- if ( tok->type!=tk_name || !tok->could_be_tag ) {
- LogError(_("Expected tag on line %d of %s"), tok->line[tok->inc_depth], tok->filename[tok->inc_depth] );
- ++tok->err_count;
- } else {
- item = fea_AddFeatItem(tok,type,tok->tag);
- if ( type==ft_lang ) {
- forever {
- fea_ParseTok(tok);
- if ( tok->type==tk_include_dflt )
- /* Unneeded */;
- else if ( tok->type==tk_exclude_dflt )
- item->u2.exclude_dflt = true;
- else if ( tok->type==tk_required )
- /* Not supported by adobe (or me) */;
- else if ( tok->type==tk_char && tok->tokbuf[0]==';' )
- break;
- else {
- LogError(_("Expected ';' on line %d of %s"), tok->line[tok->inc_depth], tok->filename[tok->inc_depth] );
- ++tok->err_count;
- break;
- }
- }
- } else
- fea_end_statement(tok);
- }
- break;
- case tk_parameters:
- if ( feat_tag==CHR('s','i','z','e') ) {
- size_item = fea_ParseParameters(tok, size_item);
- break;
- }
- /* Fall on through */
- case tk_name:
- if ( feat_tag==CHR('s','i','z','e') && strcmp(tok->tokbuf,"sizemenuname")==0 ) {
- size_item = fea_ParseSizeMenuName(tok, size_item);
- break;
- }
- /* Fall on through */
- default:
- LogError(_("Unexpected token, %s, in feature definition on line %d of %s"), tok->tokbuf, tok->line[tok->inc_depth], tok->filename[tok->inc_depth] );
- ++tok->err_count;
-return;
- }
- } else if ( ret==2 )
- break;
- }
-
- fea_ParseTok(tok);
- if ( tok->type!=tk_name || !tok->could_be_tag || tok->tag!=feat_tag ) {
- LogError(_("Expected '%c%c%c%c' in lookup definition on line %d of %s"),
- feat_tag>>24, feat_tag>>16, feat_tag>>8, feat_tag,
- tok->line[tok->inc_depth], tok->filename[tok->inc_depth] );
- ++tok->err_count;
- }
- fea_end_statement(tok);
-
- item = chunkalloc(sizeof(struct feat_item));
- item->type = ft_feat_end;
- item->u1.tag = feat_tag;
- item->next = tok->sofar;
- tok->sofar = item;
-
- tok->in_vkrn = false;
-}
-
-static void fea_ParseNameTable(struct parseState *tok) {
- struct nameid *head=NULL, *string;
- struct feat_item *item;
- /* nameid <id> [<string attibute>] string; */
-
- forever {
- fea_ParseTok(tok);
- if ( tok->type != tk_nameid )
- break;
- fea_TokenMustBe(tok,tk_int,'\0');
- string = fea_ParseNameId(tok,tok->value);
- if ( string!=NULL ) {
- string->next = head;
- head = string;
- }
- }
-
- if ( head!=NULL ) {
- item = chunkalloc(sizeof(struct feat_item));
- item->type = ft_names;
- item->next = tok->sofar;
- tok->sofar = item;
- item->u2.names = head;
- }
- if ( tok->type!=tk_char || tok->tokbuf[0]!='}' ) {
- LogError(_("Expected closing curly brace on line %d of %s"), tok->line[tok->inc_depth], tok->filename[tok->inc_depth] );
- ++tok->err_count;
- }
-}
-
-static void fea_ParseTableKeywords(struct parseState *tok, struct tablekeywords *keys) {
- int index;
- struct tablevalues *tv, *head = NULL;
- int i;
- struct feat_item *item;
-
- forever {
- fea_ParseTok(tok);
- if ( tok->type != tk_name )
- break;
- for ( index=0; keys[index].name!=NULL; ++index ) {
- if ( strcmp(keys[index].name,tok->tokbuf)==0 )
- break;
- }
- if ( keys[index].name==NULL ) {
- LogError(_("Unknown field %s on line %d of %s"), tok->tokbuf, tok->line[tok->inc_depth], tok->filename[tok->inc_depth] );
- ++tok->err_count;
- index = -1;
- }
- if ( index!=-1 && keys[index].offset!=-1 ) {
- tv = chunkalloc(sizeof(struct tablevalues));
- tv->index = index;
- } else
- tv = NULL;
- fea_ParseTok(tok);
- if ( strcmp(tok->tokbuf,"Vendor")==0 && tv!=NULL) {
- /* This takes a 4 character string */
- /* of course strings aren't part of the syntax, but it takes one anyway */
- if ( tok->type==tk_name && tok->could_be_tag )
- /* Accept a normal tag, since that's what it really is */
- tv->value = tok->tag;
- else if ( tok->type==tk_char && tok->tokbuf[0]=='"' ) {
- uint8 foo[4]; int ch;
- FILE *in = tok->inlist[tok->inc_depth];
- memset(foo,' ',sizeof(foo));
- for ( i=0; i<4; ++i ) {
- ch = getc(in);
- if ( ch==EOF )
- break;
- else if ( ch=='"' ) {
- ungetc(ch,in);
- break;
- }
- foo[i] = ch;
- }
- while ( (ch=getc(in))!=EOF && ch!='"' );
- tok->value=(foo[0]<<24) | (foo[1]<<16) | (foo[2]<<8) | foo[3];
- } else {
- LogError(_("Expected string on line %d of %s"),
- tok->line[tok->inc_depth], tok->filename[tok->inc_depth] );
- ++tok->err_count;
- chunkfree(tv,sizeof(*tv));
- tv = NULL;
- }
- fea_ParseTok(tok);
- } else {
- if ( tok->type!=tk_int ) {
- LogError(_("Expected integer on line %d of %s"),
- tok->line[tok->inc_depth], tok->filename[tok->inc_depth] );
- ++tok->err_count;
- chunkfree(tv,sizeof(*tv));
- tv = NULL;
- fea_ParseTok(tok);
- } else {
- if ( tv!=NULL )
- tv->value = tok->value;
- if ( strcmp(keys[index].name,"FontRevision")==0 ) {
- /* Can take a float */
- FILE *in = tok->inlist[tok->inc_depth];
- int ch = getc(in);
- if ( ch=='.' )
- for ( ch=getc(in); isdigit(ch); ch=getc(in));
- ungetc(ch,in);
- }
- if ( index!=-1 && keys[index].cnt!=1 ) {
- int is_panose = strcmp(keys[index].name,"Panose")==0 && tv!=NULL;
- if ( is_panose )
- tv->panose_vals[0] = tv->value;
- for ( i=1; ; ++i ) {
- fea_ParseTok(tok);
- if ( tok->type!=tk_int )
- break;
- if ( is_panose && i<10 && tv!=NULL )
- tv->panose_vals[i] = tok->value;
- }
- } else
- fea_ParseTok(tok);
- }
- }
- if ( tok->type!=tk_char || tok->tokbuf[0]!=';' ) {
- LogError(_("Expected semicolon on line %d of %s"),
- tok->line[tok->inc_depth], tok->filename[tok->inc_depth] );
- ++tok->err_count;
- fea_skip_to_close_curly(tok);
- chunkfree(tv,sizeof(*tv));
- break;
- }
- if ( tv!=NULL ) {
- tv->next = head;
- head = tv;
- }
- }
- if ( tok->type!=tk_char || tok->tokbuf[0]!='}' ) {
- LogError(_("Expected '}' on line %d of %s"),
- tok->line[tok->inc_depth], tok->filename[tok->inc_depth] );
- ++tok->err_count;
- fea_skip_to_close_curly(tok);
- }
- if ( head!=NULL ) {
- item = chunkalloc(sizeof(struct feat_item));
- item->type = ft_tablekeys;
- item->u1.offsets = keys;
- item->u2.tvals = head;
- item->next = tok->sofar;
- tok->sofar = item;
- }
-}
-
-static void fea_ParseGDEFTable(struct parseState *tok) {
- /* GlyphClassDef <base> <lig> <mark> <component>; */
- /* Attach <glyph>|<glyph class> <number>+; */ /* parse & ignore */
- /* LigatureCaret <glyph>|<glyph class> <caret value>+ */
- int i;
- struct feat_item *item;
- int16 *carets=NULL; int len=0, max=0;
-
- forever {
- fea_ParseTok(tok);
- if ( tok->type!=tk_name )
- break;
- if ( strcmp(tok->tokbuf,"Attach")==0 ) {
- fea_ParseTok(tok);
- /* Bug. Not parsing inline classes */
- if ( tok->type!=tk_class && tok->type!=tk_name ) {
- LogError(_("Expected name or class on line %d of %s"), tok->line[tok->inc_depth], tok->filename[tok->inc_depth] );
- ++tok->err_count;
- fea_skip_to_semi(tok);
- } else {
- forever {
- fea_ParseTok(tok);
- if ( tok->type!=tk_int )
- break;
- }
- }
- } else if ( strcmp(tok->tokbuf,"LigatureCaret")==0 ) {
- item = chunkalloc(sizeof(struct feat_item));
- item->type = ft_lcaret;
- item->next = tok->sofar;
- tok->sofar = item;
-
- fea_ParseTok(tok);
- if ( tok->type==tk_name )
- item->u1.class = fea_glyphname_validate(tok,tok->tokbuf);
- else if ( tok->type==tk_cid )
- item->u1.class = fea_cid_validate(tok,tok->value);
- else if ( tok->type == tk_class || (tok->type==tk_char && tok->tokbuf[0]=='['))
- item->u1.class = fea_ParseGlyphClassGuarded(tok);
- else {
- LogError(_("Expected name or class on line %d of %s"), tok->line[tok->inc_depth], tok->filename[tok->inc_depth] );
- ++tok->err_count;
- fea_skip_to_semi(tok);
- continue;
- }
- forever {
- fea_ParseTok(tok);
- if ( tok->type==tk_int )
- /* Not strictly cricket, but I'll accept it */;
- else if ( tok->type==tk_char && tok->tokbuf[0]=='<' )
- fea_ParseCaret(tok);
- else
- break;
- if ( len>=max )
- carets = grealloc(carets,(max+=10)*sizeof(int16));
- carets[len++] = tok->value;
- }
- if ( tok->type!=tk_char || tok->tokbuf[0]!=';' ) {
- LogError(_("Expected semicolon on line %d of %s"), tok->line[tok->inc_depth], tok->filename[tok->inc_depth] );
- ++tok->err_count;
- fea_skip_to_semi(tok);
- }
- item->u2.lcaret = galloc((len+1)*sizeof(int16));
- memcpy(item->u2.lcaret,carets,len*sizeof(int16));
- item->u2.lcaret[len] = 0;
- } else if ( strcmp(tok->tokbuf,"GlyphClassDef")==0 ) {
- item = chunkalloc(sizeof(struct feat_item));
- item->type = ft_gdefclasses;
- item->u1.gdef_classes = chunkalloc(sizeof(char *[4]));
- item->next = tok->sofar;
- tok->sofar = item;
- for ( i=0; i<4; ++i ) {
- fea_ParseTok(tok);
- item->u1.gdef_classes[i] = fea_ParseGlyphClassGuarded(tok);
- }
- fea_ParseTok(tok);
- } else {
- LogError(_("Expected Attach or LigatureCaret or GlyphClassDef on line %d of %s"), tok->line[tok->inc_depth], tok->filename[tok->inc_depth] );
- ++tok->err_count;
- break;
- }
- }
- if ( tok->type!=tk_char || tok->tokbuf[0]!='}' ) {
- LogError(_("Unexpected token in GDEF on line %d of %s"), tok->line[tok->inc_depth], tok->filename[tok->inc_depth] );
- ++tok->err_count;
- fea_skip_to_close_curly(tok);
- }
- free(carets);
-}
-
-static void fea_ParseTableDef(struct parseState *tok) {
- uint32 table_tag;
- struct feat_item *item;
-
- fea_ParseTag(tok);
- if ( tok->type!=tk_name || !tok->could_be_tag ) {
- LogError(_("Expected tag in table on line %d of %s"), tok->line[tok->inc_depth], tok->filename[tok->inc_depth] );
- ++tok->err_count;
- fea_skip_to_semi(tok);
-return;
- }
- table_tag = tok->tag;
-
- item = chunkalloc(sizeof(struct feat_item));
- item->type = ft_table;
- item->u1.tag = table_tag;
- item->next = tok->sofar;
- tok->sofar = item;
- fea_TokenMustBe(tok,tk_char,'{');
- switch ( table_tag ) {
- case CHR('G','D','E','F'):
- fea_ParseGDEFTable(tok);
- break;
- case CHR('n','a','m','e'):
- fea_ParseNameTable(tok);
- break;
-
- case CHR('h','h','e','a'):
- fea_ParseTableKeywords(tok,hhead_keys);
- break;
- case CHR('v','h','e','a'):
- fea_ParseTableKeywords(tok,vhead_keys);
- break;
- case CHR('O','S','/','2'):
- fea_ParseTableKeywords(tok,os2_keys);
- break;
-
- case CHR('h','e','a','d'):
- /* FontRevision <number>.<number>; */
- /* Only one field here, and I don't really support it */
- case CHR('v','m','t','x'):
- /* I don't support 'vmtx' tables */
- case CHR('B','A','S','E'):
- /* I don't support 'BASE' tables */
- default:
- fea_skip_to_close_curly(tok);
- break;
- }
-
- fea_ParseTag(tok);
- if ( tok->type!=tk_name || !tok->could_be_tag || tok->tag!=table_tag ) {
- LogError(_("Expected matching tag in table on line %d of %s"), tok->line[tok->inc_depth], tok->filename[tok->inc_depth] );
- ++tok->err_count;
- fea_skip_to_semi(tok);
-return;
- }
- fea_end_statement(tok);
-}
-
-/* ************************************************************************** */
-/* ******************************* Free feat ******************************** */
-/* ************************************************************************** */
-
-static void NameIdFree(struct nameid *nm) {
- struct nameid *nmnext;
-
- while ( nm!=NULL ) {
- nmnext = nm->next;
- free( nm->utf8_str );
- chunkfree(nm,sizeof(*nm));
- nm = nmnext;
- }
-}
-
-static void TableValsFree(struct tablevalues *tb) {
- struct tablevalues *tbnext;
-
- while ( tb!=NULL ) {
- tbnext = tb->next;
- chunkfree(tb,sizeof(*tb));
- tb = tbnext;
- }
-}
-
-static void fea_featitemFree(struct feat_item *item) {
- struct feat_item *next;
- int i,j;
-
- while ( item!=NULL ) {
- next = item->next;
- switch ( item->type ) {
- case ft_lookup_end:
- case ft_feat_end:
- case ft_table:
- case ft_subtable:
- case ft_script:
- case ft_lang:
- case ft_lookupflags:
- /* Nothing needs freeing */;
- break;
- case ft_feat_start:
- case ft_langsys:
- ScriptLangListFree( item->u2.sl);
- break;
- case ft_lookup_start:
- case ft_lookup_ref:
- free( item->u1.lookup_name );
- break;
- case ft_sizeparams:
- free( item->u1.params );
- NameIdFree( item->u2.names );
- break;
- case ft_names:
- NameIdFree( item->u2.names );
- break;
- case ft_gdefclasses:
- for ( i=0; i<4; ++i )
- free(item->u1.gdef_classes[i]);
- chunkfree(item->u1.gdef_classes,sizeof(char *[4]));
- break;
- case ft_lcaret:
- free( item->u2.lcaret );
- break;
- case ft_tablekeys:
- TableValsFree( item->u2.tvals );
- break;
- case ft_pst:
- PSTFree( item->u2.pst );
- break;
- case ft_pstclass:
- free( item->u1.class );
- PSTFree( item->u2.pst );
- break;
- case ft_ap:
- AnchorPointsFree( item->u2.ap );
- free( item->mark_class );
- break;
- case ft_fpst:
- if ( item->u2.fpst!=NULL ) {
- for ( i=0; i<item->u2.fpst->rule_cnt; ++i ) {
- struct fpst_rule *r = &item->u2.fpst->rules[i];
- for ( j=0; j<r->lookup_cnt; ++j ) {
- if ( r->lookups[j].lookup!=NULL ) {
- struct feat_item *nested = (struct feat_item *) (r->lookups[j].lookup);
- fea_featitemFree(nested);
- r->lookups[j].lookup = NULL;
- }
- }
- }
- FPSTFree(item->u2.fpst);
- }
- break;
- default:
- IError("Don't know how to free a feat_item of type %d", item->type );
- break;
- }
- chunkfree(item,sizeof(*item));
- item = next;
- }
-}
-
-static void fea_ParseFeatureFile(struct parseState *tok) {
-
- forever {
- fea_ParseTok(tok);
- if ( tok->err_count>100 )
- break;
- switch ( tok->type ) {
- case tk_class:
- fea_ParseGlyphClassDef(tok);
- break;
- case tk_lookup:
- fea_ParseLookupDef(tok,false);
- break;
- case tk_languagesystem:
- fea_ParseLangSys(tok,false);
- break;
- case tk_feature:
- fea_ParseFeatureDef(tok);
- break;
- case tk_table:
- fea_ParseTableDef(tok);
- break;
- case tk_anonymous:
- LogError(_("FontForge does not support anonymous tables on line %d of %s"), tok->line[tok->inc_depth], tok->filename[tok->inc_depth] );
- fea_skip_to_close_curly(tok);
- break;
- case tk_eof:
- goto end_loop;
- default:
- LogError(_("Unexpected token, %s, on line %d of %s"), tok->tokbuf, tok->line[tok->inc_depth], tok->filename[tok->inc_depth] );
- ++tok->err_count;
- goto end_loop;
- }
- }
- end_loop:;
-}
-
-/* ************************************************************************** */
-/* ******************************* Apply feat ******************************* */
-/* ************************************************************************** */
-static int fea_FeatItemEndsLookup(enum feat_type type) {
-return( type==ft_lookup_end || type == ft_feat_end ||
- type == ft_table || type == ft_script ||
- type == ft_lang || type == ft_langsys ||
- type == ft_lookup_ref );
-}
-
-static struct feat_item *fea_SetLookupLink(struct feat_item *nested,
- enum otlookup_type type) {
- struct feat_item *prev = NULL;
- enum otlookup_type found_type;
-
- while ( nested!=NULL ) {
- /* Stop when we find something which forces a new lookup */
- if ( fea_FeatItemEndsLookup(nested->type) )
- break;
- if ( nested->ticked ) {
- nested = nested->next;
- continue;
- }
- found_type = fea_LookupTypeFromItem(nested);
- if ( type==ot_undef || found_type == ot_undef || found_type == type ) {
- if ( nested->type!=ft_ap || nested->u2.ap->type!=at_mark )
- nested->ticked = true; /* Marks might get used in more than one lookup */
- if ( prev!=NULL )
- prev->lookup_next = nested;
- prev = nested;
- }
- nested = nested->next;
- }
-return( nested );
-}
-
-static void fea_ApplyLookupListPST(struct parseState *tok,
- struct feat_item *lookup_data,OTLookup *otl) {
- struct lookup_subtable *sub = NULL, *last=NULL;
- struct feat_item *l;
- (void)tok;
- /* Simple pst's are easy. We just attach them to their proper glyphs */
- /* and then clear the feat_item pst slot (so we don't free them later) */
- /* There might be a subtable break */
- /* There might be a lookupflags */
-
- for ( l = lookup_data; l!=NULL; l=l->lookup_next ) {
- switch ( l->type ) {
- case ft_lookup_start:
- case ft_lookupflags:
- /* Ignore these, already handled them */;
- break;
- case ft_subtable:
- sub = NULL;
- break;
- case ft_pst:
- if ( sub==NULL ) {
- sub = chunkalloc(sizeof(struct lookup_subtable));
- sub->lookup = otl;
- sub->per_glyph_pst_or_kern = true;
- if ( last==NULL )
- otl->subtables = sub;
- else
- last->next = sub;
- last = sub;
- }
- l->u2.pst->subtable = sub;
- l->u2.pst->next = l->u1.sc->possub;
- l->u1.sc->possub = l->u2.pst;
- l->u2.pst = NULL; /* So we don't free it later */
- break;
- default:
- IError("Unexpected feature type %d in a PST feature", l->type );
- break;
- }
- }
-}
-
-static OTLookup *fea_ApplyLookupList(struct parseState *tok,
- struct feat_item *lookup_data,int lookup_flag);
-
-static void fea_ApplyLookupListContextual(struct parseState *tok,
- struct feat_item *lookup_data,OTLookup *otl) {
- struct lookup_subtable *sub = NULL, *last=NULL;
- struct feat_item *l;
- int i,j;
- /* Fpst's are almost as easy as psts. We don't worry about subtables */
- /* (every fpst gets a new subtable, so the statement is irrelevant) */
- /* the only complication is that we must recursively handle a lookup list */
- /* There might be a lookupflags */
-
- for ( l = lookup_data; l!=NULL; l=l->lookup_next ) {
- switch ( l->type ) {
- case ft_lookup_start:
- case ft_lookupflags:
- case ft_subtable:
- /* Ignore these, already handled them */;
- break;
- case ft_fpst:
- sub = chunkalloc(sizeof(struct lookup_subtable));
- sub->lookup = otl;
- if ( last==NULL )
- otl->subtables = sub;
- else
- last->next = sub;
- last = sub;
- sub->fpst = l->u2.fpst;
- l->u2.fpst->next = tok->sf->possub;
- tok->sf->possub = l->u2.fpst;
- l->u2.fpst = NULL;
- sub->fpst->subtable = sub;
- for ( i=0; i<sub->fpst->rule_cnt; ++i ) {
- struct fpst_rule *r = &sub->fpst->rules[i];
- for ( j=0; j<r->lookup_cnt; ++j ) {
- if ( r->lookups[j].lookup!=NULL ) {
- struct feat_item *nested = (struct feat_item *) (r->lookups[j].lookup);
- fea_SetLookupLink(nested,ot_undef);
- r->lookups[j].lookup = fea_ApplyLookupList(tok,nested,otl->lookup_flags); /* Not really sure what the lookup flag should be here. */
- fea_featitemFree(nested);
- }
- }
- }
- break;
- default:
- IError("Unexpected feature type %d in a FPST feature", l->type );
- break;
- }
- }
-}
-
-static void fea_ApplyLookupListCursive(struct parseState *tok,
- struct feat_item *lookup_data,OTLookup *otl) {
- struct lookup_subtable *sub = NULL, *last=NULL;
- struct feat_item *l;
- AnchorPoint *aplast, *ap;
- AnchorClass *ac = NULL;
- /* Cursive's are also easy. There might be two ap's in the list so slight */
- /* care needed when adding them to a glyph, and we must create an anchorclass */
- /* There might be a subtable break */
- /* There might be a lookupflags */
-
- for ( l = lookup_data; l!=NULL; l=l->lookup_next ) {
- switch ( l->type ) {
- case ft_lookup_start:
- case ft_lookupflags:
- /* Ignore these, already handled them */;
- break;
- case ft_subtable:
- sub = NULL;
- break;
- case ft_ap:
- if ( sub==NULL ) {
- sub = chunkalloc(sizeof(struct lookup_subtable));
- sub->lookup = otl;
- sub->anchor_classes = true;
- if ( last==NULL )
- otl->subtables = sub;
- else
- last->next = sub;
- last = sub;
- ac = chunkalloc(sizeof(AnchorClass));
- ac->subtable = sub;
- ac->type = act_curs;
- ac->next = tok->accreated;
- tok->accreated = ac;
- }
- aplast = NULL;
- for ( ap=l->u2.ap; ap!=NULL; ap=ap->next ) {
- aplast = ap;
- ap->anchor = ac;
- }
- aplast->next = l->u1.sc->anchor;
- l->u1.sc->anchor = l->u2.ap;
- l->u2.ap = NULL; /* So we don't free them later */
- break;
- default:
- IError("Unexpected feature type %d in a cursive feature", l->type );
- break;
- }
- }
-}
-
-static void fea_ApplyLookupListMark2(struct parseState *tok,
- struct feat_item *lookup_data,int mcnt,OTLookup *otl) {
- /* Mark2* lookups are not well documented (because adobe FDK doesn't */
- /* support them) but I'm going to assume that if I have some mark */
- /* statements, then some pos statement, then another mark statement */
- /* that I begin a new subtable with the second set of marks (and a */
- /* different set of mark classes) */
- char **classes;
- AnchorClass **acs;
- int ac_cnt, i;
- struct lookup_subtable *sub = NULL, *last=NULL;
- struct feat_item *mark_start, *l;
- AnchorPoint *ap, *aplast;
-
- classes = galloc(mcnt*sizeof(char *));
- acs = galloc(mcnt*sizeof(AnchorClass *));
- ac_cnt = 0;
- while ( lookup_data != NULL && lookup_data->type!=ft_lookup_end ) {
- struct feat_item *orig = lookup_data;
- sub = NULL;
- /* Skip any subtable marks */
- while ( lookup_data!=NULL &&
- (lookup_data->type==ft_subtable ||
- lookup_data->type==ft_lookup_start ||
- lookup_data->type==ft_lookupflags ) )
- lookup_data = lookup_data->lookup_next;
-
- /* Skip over the marks, we'll deal with them after we know the mark classes */
- mark_start = lookup_data;
- while ( lookup_data!=NULL &&
- ((lookup_data->type==ft_ap && lookup_data->u2.ap->type==at_mark) ||
- lookup_data->type==ft_lookup_start ||
- lookup_data->type==ft_lookupflags ) )
- lookup_data = lookup_data->lookup_next;
-
- /* Now process the base glyphs and figure out the mark classes */
- while ( lookup_data!=NULL &&
- ((lookup_data->type==ft_ap && lookup_data->mark_class!=NULL) ||
- lookup_data->type==ft_lookup_start ||
- lookup_data->type==ft_lookupflags ) ) {
- if ( lookup_data->type == ft_ap ) {
- for ( i=0; i<ac_cnt; ++i ) {
- if ( strcmp(lookup_data->mark_class,classes[i])==0 )
- break;
- }
- if ( i==ac_cnt ) {
- ++ac_cnt;
- classes[i] = lookup_data->mark_class;
- acs[i] = chunkalloc(sizeof(AnchorClass));
- if ( sub==NULL ) {
- sub = chunkalloc(sizeof(struct lookup_subtable));
- sub->lookup = otl;
- sub->anchor_classes = true;
- if ( last==NULL )
- otl->subtables = sub;
- else
- last->next = sub;
- last = sub;
- }
- acs[i]->subtable = sub;
- acs[i]->type = otl->lookup_type==gpos_mark2mark ? act_mkmk :
- otl->lookup_type==gpos_mark2base ? act_mark :
- act_mklg;
- acs[i]->next = tok->accreated;
- tok->accreated = acs[i];
- }
- aplast = NULL;
- for ( ap=lookup_data->u2.ap; ap!=NULL; ap=ap->next ) {
- aplast = ap;
- ap->anchor = acs[i];
- }
- aplast->next = lookup_data->u1.sc->anchor;
- lookup_data->u1.sc->anchor = lookup_data->u2.ap;
- lookup_data->u2.ap = NULL; /* So we don't free them later */
- }
- lookup_data = lookup_data->next;
- }
-
- /* Now go back and assign the marks to the correct anchor classes */
- for ( l=mark_start; l!=NULL &&
- /* The base aps will have been set to NULL above */
- ((l->type==ft_ap && l->u2.ap!=NULL && l->u2.ap->type==at_mark) ||
- l->type==ft_lookup_start ||
- l->type==ft_lookupflags ) ;
- l = l->lookup_next ) {
- if ( l->type==ft_ap ) {
- for ( i=0; i<ac_cnt; ++i ) {
- if ( fea_classesIntersect(l->u1.sc->name,classes[i])) {
- AnchorPoint *ap = AnchorPointsCopy(l->u2.ap);
- /* We make a copy of this anchor point because marks */
- /* might be used in more than one lookup. It makes */
- /* sense for a user to define a set of marks to be */
- /* used with both a m2base and a m2lig lookup within */
- /* a feature */
- ap->anchor = acs[i];
- ap->next = l->u1.sc->anchor;
- l->u1.sc->anchor = ap;
- break;
- }
- }
- }
- }
- if ( lookup_data==orig )
- break;
- }
-}
-
-
-static int is_blank(const char *s) {
- int i;
-
- i = 0;
- while (s[i] != '\0' && s[i] == ' ')
- i++;
- return( s[i] == '\0');
-}
-
-struct class_set {
- char **classes;
- int cnt, max;
-};
-
-/* We've got a set of glyph classes -- but they are the classes that make sense */
-/* to the user and so there's no guarantee that there aren't two classes with */
-/* the same glyph(s) */
-/* Simplify the list so that: There are no duplicates classes and each name */
-/* appears in at most one class. This is what we need */
-static void fea_canonicalClassSet(struct class_set *set) {
- int i,j,k;
-
- /* Remove any duplicate classes */
- qsort(set->classes,set->cnt,sizeof(char *), strcmpD);
- for ( i=0; i<set->cnt; ++i ) {
- for ( j=i+1; j<set->cnt; ++j )
- if ( strcmp(set->classes[i],set->classes[j])!=0 )
- break;
- if ( j>i+1 ) {
- int off = j-(i+1);
- for ( k=i+1; k<j; ++k )
- free(set->classes[k]);
- for ( k=j ; k<set->cnt; ++k )
- set->classes[k-off] = set->classes[k];
- set->cnt -= off;
- }
- }
-
- for ( i=0; i < set->cnt - 1; ++i ) {
- for ( j=i+1; j < set->cnt; ++j ) {
- if ( fea_classesIntersect(set->classes[i],set->classes[j]) ) {
- if ( set->cnt>=set->max )
- set->classes = grealloc(set->classes,(set->max+=20)*sizeof(char *));
- set->classes[set->cnt++] = fea_classesSplit(set->classes[i],set->classes[j]);
- }
- }
- }
-
- /* Remove empty classes */
- i = 0;
- while (i < set->cnt) {
- if (is_blank(set->classes[i])) {
- free(set->classes[i]);
- for ( k=i+1 ; k < set->cnt; ++k )
- set->classes[k-1] = set->classes[k];
- set->cnt -= 1;
- } else {
- i++;
- }
- }
-}
-
-#ifdef FONTFORGE_CONFIG_DEVICETABLES
-static void KCFillDevTab(KernClass *kc,int index,DeviceTable *dt) {
- if ( dt==NULL || dt->corrections == NULL )
-return;
- if ( kc->adjusts == NULL )
- kc->adjusts = gcalloc(kc->first_cnt*kc->second_cnt,sizeof(DeviceTable));
- kc->adjusts[index] = *dt;
- kc->adjusts[index].corrections = galloc(dt->last_pixel_size-dt->first_pixel_size+1);
- memcpy(kc->adjusts[index].corrections,dt->corrections,dt->last_pixel_size-dt->first_pixel_size+1);
-
-}
-
-static void KPFillDevTab(KernPair *kp,DeviceTable *dt) {
- if ( dt==NULL || dt->corrections == NULL )
-return;
- kp->adjust = chunkalloc(sizeof(DeviceTable));
- *kp->adjust = *dt;
- kp->adjust->corrections = galloc(dt->last_pixel_size-dt->first_pixel_size+1);
- memcpy(kp->adjust->corrections,dt->corrections,dt->last_pixel_size-dt->first_pixel_size+1);
-}
-#endif
-
-static void fea_fillKernClass(KernClass *kc,struct feat_item *l) {
- int i,j;
- PST *pst;
-
- while ( l!=NULL && l->type!=ft_subtable ) {
- if ( l->type==ft_pstclass ) {
- pst = l->u2.pst;
- for ( i=1; i<kc->first_cnt; ++i ) {
- if ( fea_classesIntersect(kc->firsts[i],l->u1.class) ) {
- for ( j=1; j<kc->second_cnt; ++j ) {
- if ( fea_classesIntersect(kc->seconds[j],pst->u.pair.paired) ) {
- /* FontForge only supports kerning classes in one direction at a time, not full value records */
- if ( pst->u.pair.vr[0].h_adv_off != 0 ) {
- kc->offsets[i*kc->second_cnt+j] = pst->u.pair.vr[0].h_adv_off;
-#ifdef FONTFORGE_CONFIG_DEVICETABLES
- if ( pst->u.pair.vr[0].adjust!=NULL )
- KCFillDevTab(kc,i*kc->second_cnt+j,&pst->u.pair.vr[0].adjust->xadv);
-#endif
- } else if ( pst->u.pair.vr[0].v_adv_off != 0 ) {
- kc->offsets[i*kc->second_cnt+j] = pst->u.pair.vr[0].v_adv_off;
-#ifdef FONTFORGE_CONFIG_DEVICETABLES
- if ( pst->u.pair.vr[0].adjust!=NULL )
- KCFillDevTab(kc,i*kc->second_cnt+j,&pst->u.pair.vr[0].adjust->yadv);
-#endif
- } else if ( pst->u.pair.vr[1].h_adv_off != 0 ) {
- kc->offsets[i*kc->second_cnt+j] = pst->u.pair.vr[1].h_adv_off;
-#ifdef FONTFORGE_CONFIG_DEVICETABLES
- if ( pst->u.pair.vr[1].adjust!=NULL )
- KCFillDevTab(kc,i*kc->second_cnt+j,&pst->u.pair.vr[1].adjust->xadv);
-#endif
- }
- if ( strcmp(kc->seconds[j],pst->u.pair.paired)==0 )
- break;
- }
- }
- if ( strcmp(kc->firsts[i],l->u1.class)==0 )
- break;
- }
- }
- }
- l = l->lookup_next;
- }
-}
-
-static void SFKernClassRemoveFree(SplineFont *sf,KernClass *kc) {
- KernClass *prev;
-
- if ( sf->kerns==kc )
- sf->kerns = kc->next;
- else if ( sf->vkerns==kc )
- sf->vkerns = kc->next;
- else {
- prev = NULL;
- if ( sf->kerns!=NULL )
- for ( prev=sf->kerns; prev!=NULL && prev->next!=kc; prev=prev->next );
- if ( prev==NULL && sf->vkerns!=NULL )
- for ( prev=sf->vkerns; prev!=NULL && prev->next!=kc; prev=prev->next );
- if ( prev!=NULL )
- prev->next = kc->next;
- }
- kc->next = NULL;
- KernClassListFree(kc);
-}
-
-static void fea_ApplyLookupListPair(struct parseState *tok,
- struct feat_item *lookup_data,int kmax,OTLookup *otl) {
- /* kcnt is the number of left/right glyph-name-lists we must sort into classes */
- struct feat_item *l, *first;
- struct class_set lefts, rights;
- struct lookup_subtable *sub = NULL, *lastsub=NULL;
- SplineChar *sc, *other;
- PST *pst;
- KernPair *kp;
- KernClass *kc;
- int vkern, kcnt, i;
-
- memset(&lefts,0,sizeof(lefts));
- memset(&rights,0,sizeof(rights));
- if ( kmax!=0 ) {
- lefts.classes = galloc(kmax*sizeof(char *));
- rights.classes = galloc(kmax*sizeof(char *));
- lefts.max = rights.max = kmax;
- }
- vkern = false;
- for ( l = lookup_data; l!=NULL; ) {
- first = l;
- kcnt = 0;
- while ( l!=NULL && l->type!=ft_subtable ) {
- if ( l->type == ft_pst ) {
- if ( sub==NULL ) {
- sub = chunkalloc(sizeof(struct lookup_subtable));
- sub->lookup = otl;
- sub->per_glyph_pst_or_kern = true;
- if ( lastsub==NULL )
- otl->subtables = sub;
- else
- lastsub->next = sub;
- lastsub = sub;
- }
- pst = l->u2.pst;
- sc = l->u1.sc;
- l->u2.pst = NULL;
- kp = NULL;
- other = SFGetChar(sc->parent,-1,pst->u.pair.paired);
- if ( pst->u.pair.vr[0].xoff==0 && pst->u.pair.vr[0].yoff==0 &&
- pst->u.pair.vr[1].xoff==0 && pst->u.pair.vr[1].yoff==0 &&
- pst->u.pair.vr[1].v_adv_off==0 &&
- other!=NULL ) {
- if ( (otl->lookup_flags&pst_r2l) &&
- (pst->u.pair.vr[0].h_adv_off==0 && pst->u.pair.vr[0].v_adv_off==0 )) {
- kp = chunkalloc(sizeof(KernPair));
- kp->off = pst->u.pair.vr[1].h_adv_off;
-#ifdef FONTFORGE_CONFIG_DEVICETABLES
- if ( pst->u.pair.vr[1].adjust!=NULL )
- KPFillDevTab(kp,&pst->u.pair.vr[1].adjust->xadv);
-#endif
- } else if ( !(otl->lookup_flags&pst_r2l) &&
- (pst->u.pair.vr[1].h_adv_off==0 && pst->u.pair.vr[0].v_adv_off==0 )) {
- kp = chunkalloc(sizeof(KernPair));
- kp->off = pst->u.pair.vr[0].h_adv_off;
-#ifdef FONTFORGE_CONFIG_DEVICETABLES
- if ( pst->u.pair.vr[0].adjust!=NULL )
- KPFillDevTab(kp,&pst->u.pair.vr[0].adjust->xadv);
-#endif
- } else if ( (pst->u.pair.vr[0].h_adv_off==0 && pst->u.pair.vr[1].h_adv_off==0 )) {
- vkern = sub->vertical_kerning = true;
- kp = chunkalloc(sizeof(KernPair));
- kp->off = pst->u.pair.vr[0].v_adv_off;
-#ifdef FONTFORGE_CONFIG_DEVICETABLES
- if ( pst->u.pair.vr[0].adjust!=NULL )
- KPFillDevTab(kp,&pst->u.pair.vr[0].adjust->yadv);
-#endif
- }
- }
- if ( kp!=NULL ) {
- kp->sc = other;
- kp->subtable = sub;
- if ( vkern ) {
- kp->next = sc->vkerns;
- sc->vkerns = kp;
- } else {
- kp->next = sc->kerns;
- sc->kerns = kp;
- }
- PSTFree(pst);
- } else {
- pst->subtable = sub;
- pst->next = sc->possub;
- sc->possub = pst;
- }
- } else if ( l->type == ft_pstclass ) {
- lefts.classes[kcnt] = copy(fea_canonicalClassOrder(l->u1.class));
- rights.classes[kcnt++] = copy(fea_canonicalClassOrder(l->u2.pst->u.pair.paired));
- }
- l = l->lookup_next;
- }
- if ( kcnt!=0 ) {
- lefts.cnt = rights.cnt = kcnt;
- fea_canonicalClassSet(&lefts);
- fea_canonicalClassSet(&rights);
-
- sub = chunkalloc(sizeof(struct lookup_subtable));
- sub->lookup = otl;
- if ( lastsub==NULL )
- otl->subtables = sub;
- else
- lastsub->next = sub;
- lastsub = sub;
-
- if ( sub->kc!=NULL )
- SFKernClassRemoveFree(tok->sf,sub->kc);
- sub->kc = kc = chunkalloc(sizeof(KernClass));
- kc->first_cnt = lefts.cnt+1; kc->second_cnt = rights.cnt+1;
- kc->firsts = galloc(kc->first_cnt*sizeof(char *));
- kc->seconds = galloc(kc->second_cnt*sizeof(char *));
- kc->firsts[0] = kc->seconds[0] = NULL;
- for ( i=0; i<lefts.cnt; ++i )
- kc->firsts[i+1] = lefts.classes[i];
- for ( i=0; i<rights.cnt; ++i )
- kc->seconds[i+1] = rights.classes[i];
- kc->subtable = sub;
- kc->offsets = gcalloc(kc->first_cnt*kc->second_cnt,sizeof(int16));
-#ifdef FONTFORGE_CONFIG_DEVICETABLES
- kc->adjusts = gcalloc(kc->first_cnt*kc->second_cnt,sizeof(DeviceTable));
-#endif
- fea_fillKernClass(kc,first);
- if ( sub->vertical_kerning ) {
- kc->next = tok->sf->vkerns;
- tok->sf->vkerns = kc;
- } else {
- kc->next = tok->sf->kerns;
- tok->sf->kerns = kc;
- }
- }
- sub = NULL;
- while ( l!=NULL && l->type==ft_subtable )
- l = l->lookup_next;
- }
- if ( kmax!=0 ) {
- free(lefts.classes);
- free(rights.classes);
- }
-}
-
-static OTLookup *fea_ApplyLookupList(struct parseState *tok,
- struct feat_item *lookup_data,int lookup_flag) {
- /* A lookup list might consist just of a lookup_ref so find the lookup named u1.lookup_name */
- /* A lookup_start is optional and provides the lookup name */
- /* A lookupflags is optional and may occur anywhere u2.lookupflags */
- /* An ap is for mark2 types for the mark u1.sc and u2.ap (not grouped in anchor classes yet) */
- /* A fpst is for contextuals u2.fpst (rule.lookups[i].lookup are lookup lists in their own rights that need to become lookups) */
- /* A subtable means a subtable break, make up a new name, ignore multiple subtable entries */
- /* A pst is for simple things u1.sc, u2.pst */
- /* A pstclass is for kerning classes u1.class, u2.pst (paired may be a class list too) */
- /* An ap is for cursive types for the u1.sc and u2.ap (an entry and an exit ap) */
- /* An ap is for mark2 types for the base u1.sc and u2.ap and mark_class */
- OTLookup *otl;
- int kcnt, mcnt;
- struct feat_item *l;
- enum otlookup_type temp;
-
- if ( lookup_data->type == ft_lookup_ref ) {
- for ( otl=tok->created; otl!=NULL; otl=otl->next )
- if ( otl->lookup_name!=NULL &&
- strcmp(otl->lookup_name,lookup_data->u1.lookup_name)==0)
-return( otl );
- otl = SFFindLookup(tok->sf,lookup_data->u1.lookup_name);
- if ( otl==NULL )
- LogError( _("No lookup named %s"),lookup_data->u1.lookup_name );
- /* Can't give a line number, this is second pass */
-return( otl );
- }
-
- otl = chunkalloc(sizeof(OTLookup));
- otl->lookup_flags = lookup_flag;
- otl->lookup_type = ot_undef;
- if ( tok->last==NULL )
- tok->created = otl;
- else
- tok->last->next = otl;
- tok->last = otl;
-
- /* Search first for class counts */
- kcnt = mcnt = 0;
- for ( l = lookup_data; l!=NULL; l=l->lookup_next ) {
- if ( l->type == ft_ap && l->mark_class!=NULL )
- ++mcnt;
- else if ( l->type == ft_pstclass )
- ++kcnt;
- else if ( l->type == ft_lookupflags )
- otl->lookup_flags = l->u2.lookupflags;
- else if ( l->type == ft_lookup_start ) {
- otl->lookup_name = l->u1.lookup_name;
- l->u1.lookup_name = NULL; /* So we don't free it later */
- }
- temp = fea_LookupTypeFromItem(l);
- if ( temp==ot_undef )
- /* Tum ty tum tum. No information */;
- else if ( otl->lookup_type == ot_undef )
- otl->lookup_type = temp;
- else if ( otl->lookup_type != temp )
- IError(_("Mismatch lookup types inside a parsed lookup"));
- }
- if ( otl->lookup_type==gpos_mark2base ||
- otl->lookup_type==gpos_mark2ligature ||
- otl->lookup_type==gpos_mark2mark )
- fea_ApplyLookupListMark2(tok,lookup_data,mcnt,otl);
- else if ( mcnt!=0 )
- IError(_("Mark anchors provided when nothing can use them"));
- else if ( otl->lookup_type==gpos_cursive )
- fea_ApplyLookupListCursive(tok,lookup_data,otl);
- else if ( otl->lookup_type==gpos_pair )
- fea_ApplyLookupListPair(tok,lookup_data,kcnt,otl);
- else if ( otl->lookup_type==gpos_contextchain ||
- otl->lookup_type==gsub_contextchain )
- fea_ApplyLookupListContextual(tok,lookup_data,otl);
- else
- fea_ApplyLookupListPST(tok,lookup_data,otl);
-return( otl );
-}
-
-static struct otfname *fea_NameID2OTFName(struct nameid *names) {
- struct otfname *head=NULL, *cur;
-
- while ( names!=NULL ) {
- cur = chunkalloc(sizeof(struct otfname));
- cur->lang = names->language;
- cur->name = names->utf8_str;
- names->utf8_str = NULL;
- cur->next = head;
- head = cur;
- names = names->next;
- }
-return( head );
-}
-
-static void fea_AttachFeatureToLookup(OTLookup *otl,uint32 feat_tag,
- struct scriptlanglist *sl) {
- FeatureScriptLangList *fl;
-
- if ( otl==NULL )
-return;
-
- for ( fl = otl->features; fl!=NULL && fl->featuretag!=feat_tag; fl=fl->next );
- if ( fl==NULL ) {
- fl = chunkalloc(sizeof(FeatureScriptLangList));
- fl->next = otl->features;
- otl->features = fl;
- fl->featuretag = feat_tag;
- fl->scripts = SListCopy(sl);
- } else
- SLMerge(fl,sl);
-}
-
-static void fea_NameID2NameTable(SplineFont *sf, struct nameid *names) {
- struct ttflangname *cur;
-
- while ( names!=NULL ) {
- for ( cur = sf->names; cur!=NULL && cur->lang!=names->language; cur=cur->next );
- if ( cur==NULL ) {
- cur = chunkalloc(sizeof(struct ttflangname));
- cur->lang = names->language;
- cur->next = sf->names;
- sf->names = cur;
- }
- free(cur->names[names->strid]);
- cur->names[names->strid] = names->utf8_str;
- names->utf8_str = NULL;
- names = names->next;
- }
-}
-
-static void fea_TableByKeywords(SplineFont *sf, struct feat_item *f) {
- struct tablevalues *tv;
- struct tablekeywords *offsets = f->u1.offsets, *cur;
- int i;
-
- if ( !sf->pfminfo.pfmset ) {
- SFDefaultOS2Info(&sf->pfminfo,sf,sf->fontname);
- sf->pfminfo.pfmset = sf->pfminfo.subsuper_set = sf->pfminfo.panose_set =
- sf->pfminfo.hheadset = sf->pfminfo.vheadset = true;
- }
- for ( tv = f->u2.tvals; tv!=NULL; tv=tv->next ) {
- cur = &offsets[tv->index];
- if ( cur->offset==-1 )
- /* We don't support this guy, whatever he may be, but we did parse it */;
- else if ( cur->cnt==1 ) {
- if ( cur->size==4 )
- *((uint32 *) (((uint8 *) sf) + cur->offset)) = tv->value;
- else if ( cur->size==2 )
- *((uint16 *) (((uint8 *) sf) + cur->offset)) = tv->value;
- else
- *((uint8 *) (((uint8 *) sf) + cur->offset)) = tv->value;
- if ( strcmp(cur->name,"Ascender")==0 )
- sf->pfminfo.hheadascent_add = false;
- else if ( strcmp(cur->name,"Descender")==0 )
- sf->pfminfo.hheaddescent_add = false;
- else if ( strcmp(cur->name,"winAscent")==0 )
- sf->pfminfo.winascent_add = false;
- else if ( strcmp(cur->name,"winDescent")==0 )
- sf->pfminfo.windescent_add = false;
- else if ( strcmp(cur->name,"TypoAscender")==0 )
- sf->pfminfo.typoascent_add = false;
- else if ( strcmp(cur->name,"TypoDescender")==0 )
- sf->pfminfo.typodescent_add = false;
- } else if ( cur->cnt==10 && cur->size==1 ) {
- for ( i=0; i<10; ++i )
- (((uint8 *) sf) + cur->offset)[i] = tv->panose_vals[i];
- }
- }
-}
-
-static void fea_GDefGlyphClasses(SplineFont *sf, struct feat_item *f) {
- int i, ch;
- char *pt, *start;
- SplineChar *sc;
-
- for ( i=0; i<4; ++i ) if ( f->u1.gdef_classes[i]!=NULL ) {
- for ( pt=f->u1.gdef_classes[i]; ; ) {
- while ( *pt==' ' ) ++pt;
- if ( *pt=='\0' )
- break;
- for ( start = pt; *pt!=' ' && *pt!='\0'; ++pt );
- ch = *pt; *pt = '\0';
- sc = SFGetChar(sf,-1,start);
- *pt = ch;
- if ( sc!=NULL )
- sc->glyph_class = i+1;
- }
- }
-}
-
-static void fea_GDefLigCarets(SplineFont *sf, struct feat_item *f) {
- int i, ch;
- char *pt, *start;
- SplineChar *sc;
- PST *pst, *prev, *next;
-
- for ( pt=f->u1.class; ; ) {
- while ( *pt==' ' ) ++pt;
- if ( *pt=='\0' )
- break;
- for ( start = pt; *pt!=' ' && *pt!='\0'; ++pt );
- ch = *pt; *pt = '\0';
- sc = SFGetChar(sf,-1,start);
- *pt = ch;
- if ( sc!=NULL ) {
- for ( prev=NULL, pst=sc->possub; pst!=NULL; pst=next ) {
- next = pst->next;
- if ( pst->type!=pst_lcaret )
- prev = pst;
- else {
- if ( prev==NULL )
- sc->possub = next;
- else
- prev->next = next;
- pst->next = NULL;
- PSTFree(pst);
- }
- }
- for ( i=0; f->u2.lcaret[i]!=0; ++i );
- pst = chunkalloc(sizeof(PST));
- pst->next = sc->possub;
- sc->possub = pst;
- pst->type = pst_lcaret;
- pst->u.lcaret.cnt = i;
- pst->u.lcaret.carets = f->u2.lcaret;
- f->u2.lcaret = NULL;
- }
- }
-}
-
-static struct feat_item *fea_ApplyFeatureList(struct parseState *tok,
- struct feat_item *feat_data) {
- int lookup_flags = 0;
- uint32 feature_tag = feat_data->u1.tag;
- struct scriptlanglist *sl = feat_data->u2.sl;
- struct feat_item *f, *start;
- OTLookup *otl;
- int saw_script = false;
- enum otlookup_type ltype;
-
- feat_data->u2.sl = NULL;
-
- for ( f=feat_data->next; f!=NULL && f->type!=ft_feat_end ; ) {
- if ( f->ticked ) {
- f = f->next;
- continue;
- }
- switch ( f->type ) {
- case ft_lookupflags:
- lookup_flags = f->u2.lookupflags;
- f = f->next;
- continue;
- case ft_lookup_ref:
- otl = fea_ApplyLookupList(tok,f,lookup_flags);
- fea_AttachFeatureToLookup(otl,feature_tag,sl);
- f = f->next;
- continue;
- case ft_lookup_start:
- start = f;
- start->lookup_next = f->next;
- f = fea_SetLookupLink(start->next,ot_undef);
- if ( f!=NULL && f->type == ft_lookup_end )
- f = f->next;
- otl = fea_ApplyLookupList(tok,start,lookup_flags);
- fea_AttachFeatureToLookup(otl,feature_tag,sl);
- continue;
- case ft_script:
- ScriptLangListFree(sl);
- sl = chunkalloc(sizeof(struct scriptlanglist));
- sl->script = f->u1.tag;
- sl->lang_cnt = 1;
- sl->langs[0] = DEFAULT_LANG;
- saw_script = true;
- f = f->next;
- continue;
- case ft_lang:
- if ( !saw_script ) {
- ScriptLangListFree(sl);
- sl = chunkalloc(sizeof(struct scriptlanglist));
- sl->script = CHR('l','a','t','n');
- }
- sl->langs[0] = f->u1.tag;
- sl->lang_cnt = 1;
- if ( !f->u2.exclude_dflt ) {
- if ( sl->langs[0]!=DEFAULT_LANG ) {
- sl->langs[1] = DEFAULT_LANG;
- sl->lang_cnt = 2;
- }
- }
- f = f->next;
- continue;
- case ft_langsys:
- ScriptLangListFree(sl);
- saw_script = false;
- sl = f->u2.sl;
- f->u2.sl = NULL;
- f = f->next;
- continue;
- case ft_sizeparams:
- if ( f->u1.params!=NULL ) {
- tok->sf->design_size = f->u1.params[0];
- tok->sf->fontstyle_id = f->u1.params[1];
- tok->sf->design_range_bottom = f->u1.params[2];
- tok->sf->design_range_top = f->u1.params[3];
- }
- OtfNameListFree(tok->sf->fontstyle_name);
- tok->sf->fontstyle_name = fea_NameID2OTFName(f->u2.names);
- f = f->next;
- continue;
- case ft_subtable:
- f = f->next;
- continue;
- case ft_pst:
- case ft_pstclass:
- case ft_ap:
- case ft_fpst:
- if ( f->type==ft_ap && f->u2.ap->type==at_mark ) {
- struct feat_item *n, *a;
- /* skip over the marks */
- for ( n=f; n!=NULL && n->type == ft_ap && n->u2.ap->type==at_mark; n=n->next );
- /* find the next thing which can use those marks (might not be anything) */
- for ( a=n; a!=NULL; a=a->next ) {
- if ( a->ticked )
- continue;
- if ( fea_FeatItemEndsLookup(a->type) ||
- a->type==ft_subtable || a->type==ft_ap )
- break;
- }
- if ( a==NULL || fea_FeatItemEndsLookup(a->type) || a->type==ft_subtable ||
- (a->type==ft_ap && a->u2.ap->type == at_mark )) {
- /* There's nothing else that can use these marks so we are */
- /* done with them. Skip over all of them */
- f = n;
- continue;
- }
- ltype = fea_LookupTypeFromItem(a);
- } else
- ltype = fea_LookupTypeFromItem(f);
- start = f;
- f = fea_SetLookupLink(start,ltype);
- otl = fea_ApplyLookupList(tok,start,lookup_flags);
- fea_AttachFeatureToLookup(otl,feature_tag,sl);
- continue;
- default:
- IError("Unexpected feature item in feature definition %d", f->type );
- f = f->next;
- }
- }
- if ( f!=NULL && f->type == ft_feat_end )
- f = f->next;
-return( f );
-}
-
-static void fea_ApplyFile(struct parseState *tok, struct feat_item *item) {
- struct feat_item *f, *start;
-
- for ( f=item; f!=NULL ; ) {
- switch ( f->type ) {
- case ft_lookup_start:
- start = f;
- start->lookup_next = f->next;
- f = fea_SetLookupLink(start->next,ot_undef);
- if ( f!=NULL && f->type == ft_lookup_end )
- f = f->next;
- fea_ApplyLookupList(tok,start,0);
- continue;
- case ft_feat_start:
- f = fea_ApplyFeatureList(tok,f);
- continue;
- case ft_table:
- /* I store things all mushed together, so this tag is useless to me*/
- /* ignore it. The stuff inside the table matters though... */
- f = f->next;
- continue;
- case ft_names:
- fea_NameID2NameTable(tok->sf,f->u2.names);
- f = f->next;
- continue;
- case ft_tablekeys:
- fea_TableByKeywords(tok->sf,f);
- f = f->next;
- continue;
- case ft_gdefclasses:
- fea_GDefGlyphClasses(tok->sf,f);
- f = f->next;
- continue;
- case ft_lcaret:
- fea_GDefLigCarets(tok->sf,f);
- f = f->next;
- continue;
- default:
- IError("Unexpected feature item in feature file %d", f->type );
- f = f->next;
- }
- }
-}
-
-static struct feat_item *fea_reverseList(struct feat_item *f) {
- struct feat_item *n = NULL, *p = NULL;
-
- p = NULL;
- while ( f!=NULL ) {
- n = f->next;
- f->next = p;
- p = f;
- f = n;
- }
-return( p );
-}
-
-static void fea_NameLookups(struct parseState *tok) {
- SplineFont *sf = tok->sf;
- OTLookup *gpos_last=NULL, *gsub_last=NULL, *otl, *otlnext;
- int gp_cnt=0, gs_cnt=0, acnt;
- AnchorClass *ac, *acnext, *an;
-
- for ( otl = sf->gpos_lookups; otl!=NULL; otl=otl->next ) {
- otl->lookup_index = gp_cnt++;
- gpos_last = otl;
- }
- for ( otl = sf->gsub_lookups; otl!=NULL; otl=otl->next ) {
- otl->lookup_index = gs_cnt++;
- gsub_last = otl;
- }
-
- for ( otl = tok->created; otl!=NULL; otl=otlnext ) {
- otlnext = otl->next;
- otl->next = NULL;
- if ( otl->lookup_name!=NULL && SFFindLookup(sf,otl->lookup_name)!=NULL ) {
- int cnt=0;
- char *namebuf = galloc(strlen( otl->lookup_name )+8 );
- /* Name already in use, modify it */
- do {
- sprintf(namebuf,"%s-%d", otl->lookup_name, cnt++ );
- } while ( SFFindLookup(sf,namebuf)!=NULL );
- free(otl->lookup_name);
- otl->lookup_name = namebuf;
- }
- if ( otl->lookup_type < gpos_start ) {
- if ( gsub_last==NULL )
- sf->gsub_lookups = otl;
- else
- gsub_last->next = otl;
- gsub_last = otl;
- otl->lookup_index = gs_cnt++;
- } else {
- if ( gpos_last==NULL )
- sf->gpos_lookups = otl;
- else
- gpos_last->next = otl;
- gpos_last = otl;
- otl->lookup_index = gp_cnt++;
- }
- NameOTLookup(otl,sf); /* But only if it has no name */
- }
-
- /* Now name and attach any unnamed anchor classes (order here doesn't matter) */
- acnt = 0;
- for ( ac=tok->accreated; ac!=NULL; ac=acnext ) {
- acnext = ac->next;
- if ( ac->name==NULL ) {
- char buf[50];
- do {
- snprintf(buf,sizeof(buf),_("Anchor-%d"), acnt++ );
- for ( an=sf->anchor; an!=NULL && strcmp(an->name,buf)!=0; an=an->next );
- } while ( an!=NULL );
- ac->name = copy(buf);
- }
- ac->next = sf->anchor;
- sf->anchor = ac;
- }
-
- sf->changed = true;
- FVSetTitles(sf);
- FVRefreshAll(sf);
-}
-
-void SFApplyFeatureFile(SplineFont *sf,FILE *file,char *filename) {
- struct parseState tok;
- struct glyphclasses *gc, *gcnext;
-
- memset(&tok,0,sizeof(tok));
- tok.line[0] = 1;
- tok.filename[0] = filename;
- tok.inlist[0] = file;
- tok.base = 10;
- if ( sf->cidmaster ) sf = sf->cidmaster;
- tok.sf = sf;
-
- fea_ParseFeatureFile(&tok);
- if ( tok.err_count==0 ) {
- tok.sofar = fea_reverseList(tok.sofar);
- fea_ApplyFile(&tok, tok.sofar);
- fea_NameLookups(&tok);
- } else
- ff_post_error("Not applied","There were errors when parsing the feature file and the features have not been applied");
- fea_featitemFree(tok.sofar);
- ScriptLangListFree(tok.def_langsyses);
- for ( gc = tok.classes; gc!=NULL; gc=gcnext ) {
- gcnext = gc->next;
- free(gc->classname); free(gc->glyphs);
- chunkfree(gc,sizeof(struct glyphclasses));
- }
-}
-
-void SFApplyFeatureFilename(SplineFont *sf,char *filename) {
- FILE *in = fopen(filename,"r");
-
- if ( in==NULL ) {
- ff_post_error(_("Cannot open file"),_("Cannot open feature file %.120s"), filename );
-return;
- }
- SFApplyFeatureFile(sf,in,filename);
- fclose(in);
-}
diff --git a/Build/source/texk/web2c/luatexdir/luafontloader/fontforge/fontforge/fontforgevw.h b/Build/source/texk/web2c/luatexdir/luafontloader/fontforge/fontforge/fontforgevw.h
deleted file mode 100644
index 2d3fa3207b8..00000000000
--- a/Build/source/texk/web2c/luatexdir/luafontloader/fontforge/fontforge/fontforgevw.h
+++ /dev/null
@@ -1,34 +0,0 @@
-/* Copyright (C) 2007,2008 by George Williams */
-/*
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are met:
-
- * Redistributions of source code must retain the above copyright notice, this
- * list of conditions and the following disclaimer.
-
- * Redistributions in binary form must reproduce the above copyright notice,
- * this list of conditions and the following disclaimer in the documentation
- * and/or other materials provided with the distribution.
-
- * The name of the author may not be used to endorse or promote products
- * derived from this software without specific prior written permission.
-
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
- * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
- * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
- * EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
- * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
- * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
- * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
- * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-#ifndef _FONTFORGEVW_H_
-#define _FONTFORGEVW_H_
-
-#include "pfaedit.h"
-#include "gimage.h"
-#include "baseviews.h"
-
-#endif
diff --git a/Build/source/texk/web2c/luatexdir/luafontloader/fontforge/fontforge/fontviewbase.c b/Build/source/texk/web2c/luatexdir/luafontloader/fontforge/fontforge/fontviewbase.c
deleted file mode 100644
index aa0ed46aeb8..00000000000
--- a/Build/source/texk/web2c/luatexdir/luafontloader/fontforge/fontforge/fontviewbase.c
+++ /dev/null
@@ -1,287 +0,0 @@
-/* Copyright (C) 2000-2008 by George Williams */
-/*
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are met:
-
- * Redistributions of source code must retain the above copyright notice, this
- * list of conditions and the following disclaimer.
-
- * Redistributions in binary form must reproduce the above copyright notice,
- * this list of conditions and the following disclaimer in the documentation
- * and/or other materials provided with the distribution.
-
- * The name of the author may not be used to endorse or promote products
- * derived from this software without specific prior written permission.
-
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
- * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
- * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
- * EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
- * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
- * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
- * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
- * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-#include "pfaedit.h"
-#include "baseviews.h"
-#include "psfont.h"
-#include <ustring.h>
-#include <utype.h>
-#include <chardata.h>
-#include <math.h>
-#include <unistd.h>
-#include <gfile.h>
-
-static FontViewBase *fv_list=NULL;
-
-extern int onlycopydisplayed;
-float joinsnap=0;
-
-
-/* FV Interface */
-
-static FontViewBase *_FontViewBaseCreate(SplineFont *sf) {
- FontViewBase *fv = gcalloc(1,sizeof(FontViewBase));
- int i;
-
- fv->nextsame = sf->fv;
- fv->active_layer = ly_fore;
- sf->fv = fv;
- if ( sf->mm!=NULL ) {
- sf->mm->normal->fv = fv;
- for ( i = 0; i<sf->mm->instance_count; ++i )
- sf->mm->instances[i]->fv = fv;
- }
- if ( sf->subfontcnt==0 ) {
- fv->sf = sf;
- if ( fv->nextsame!=NULL ) {
- fv->map = EncMapCopy(fv->nextsame->map);
- fv->normal = fv->nextsame->normal==NULL ? NULL : EncMapCopy(fv->nextsame->normal);
- } else if ( sf->compacted ) {
- fv->normal = sf->map;
- fv->map = CompactEncMap(EncMapCopy(sf->map),sf);
- } else {
- fv->map = sf->map;
- fv->normal = NULL;
- }
- } else {
- fv->cidmaster = sf;
- for ( i=0; i<sf->subfontcnt; ++i )
- sf->subfonts[i]->fv = fv;
- for ( i=0; i<sf->subfontcnt; ++i ) /* Search for a subfont that contains more than ".notdef" (most significant in .gai fonts) */
- if ( sf->subfonts[i]->glyphcnt>1 ) {
- fv->sf = sf->subfonts[i];
- break;
- }
- if ( fv->sf==NULL )
- fv->sf = sf->subfonts[0];
- sf = fv->sf;
- if ( fv->nextsame==NULL ) EncMapFree(sf->map);
- fv->map = EncMap1to1(sf->glyphcnt);
- }
- fv->selected = gcalloc(fv->map->enccount,sizeof(char));
-
-#ifndef _NO_PYTHON
- PyFF_InitFontHook(fv);
-#endif
-return( fv );
-}
-
-static FontViewBase *FontViewBase_Create(SplineFont *sf,int hide) {
- FontViewBase *fv = _FontViewBaseCreate(sf);
- (void)hide;
-return( fv );
-}
-
-static FontViewBase *FontViewBase_Append(FontViewBase *fv) {
- /* Normally fontviews get added to the fv list when their windows are */
- /* created. but we don't create any windows here, so... */
- FontViewBase *test;
-
- if ( fv_list==NULL ) fv_list = fv;
- else {
- for ( test = fv_list; test->next!=NULL; test=test->next );
- test->next = fv;
- }
-return( fv );
-}
-
-static void FontViewBase_Free(FontViewBase *fv) {
- int i;
- FontViewBase *prev;
-
- if (fv->cidmaster)
- EncMapFree(fv->cidmaster->map);
-
- if ( fv->nextsame==NULL && fv->sf->fv==fv ) {
- EncMapFree(fv->map);
- SplineFontFree(fv->cidmaster?fv->cidmaster:fv->sf);
- } else {
- EncMapFree(fv->map);
- if ( fv->sf->fv==fv ) {
- if ( fv->cidmaster==NULL )
- fv->sf->fv = fv->nextsame;
- else {
- fv->cidmaster->fv = fv->nextsame;
- for ( i=0; i<fv->cidmaster->subfontcnt; ++i )
- fv->cidmaster->subfonts[i]->fv = fv->nextsame;
- }
- } else {
- for ( prev = fv->sf->fv; prev->nextsame!=fv; prev=prev->nextsame );
- prev->nextsame = fv->nextsame;
- }
- }
-#ifndef _NO_FFSCRIPT
- DictionaryFree(fv->fontvars);
- free(fv->fontvars);
-#endif
- free(fv->selected);
-#ifndef _NO_PYTHON
- PyFF_FreeFV(fv);
-#endif
- free(fv);
-}
-
-static int FontViewBaseWinInfo(FontViewBase *fv, int *cc, int *rc) {
- (void)fv;
- *cc = 16; *rc = 4;
-return( -1 );
-}
-
-static void FontViewBaseSetTitle(FontViewBase *foo) { (void)foo; }
-static void FontViewBaseSetTitles(SplineFont *foo) { (void)foo; }
-static void FontViewBaseRefreshAll(SplineFont *foo) { (void)foo; }
-static void FontViewBaseReformatOne(FontViewBase *foo) { (void)foo; }
-static void FontViewBaseReformatAll(SplineFont *foo) { (void)foo; }
-static void FontViewBaseLayerChanged(FontViewBase *foo) {(void)foo; }
-static void FV_ToggleCharChanged(SplineChar *foo) {(void)foo; }
-static FontViewBase *FVAny(void) { return fv_list; }
-static int FontIsActive(SplineFont *sf) {
- FontViewBase *fv;
-
- for ( fv=fv_list; fv!=NULL; fv=fv->next )
- if ( fv->sf == sf )
-return( true );
-
-return( false );
-}
-
-static SplineFont *FontOfFilename(const char *filename) {
- char buffer[1025];
- FontViewBase *fv;
-
- GFileGetAbsoluteName((char *) filename,buffer,sizeof(buffer));
- for ( fv=fv_list; fv!=NULL ; fv=fv->next ) {
- if ( fv->sf->filename!=NULL && strcmp(fv->sf->filename,buffer)==0 )
-return( fv->sf );
- else if ( fv->sf->origname!=NULL && strcmp(fv->sf->origname,buffer)==0 )
-return( fv->sf );
- }
-return( NULL );
-}
-
-static void FVExtraEncSlots(FontViewBase *fv, int encmax) {
- (void)fv;
- (void)encmax;
-}
-
-static void FontViewBase_Close(FontViewBase *fv) {
- if ( fv_list==fv )
- fv_list = fv->next;
- else {
- FontViewBase *n;
- for ( n=fv_list; n->next!=fv; n=n->next );
- n->next = fv->next;
- }
- FontViewFree(fv);
-}
-
-static void FVB_ChangeDisplayBitmap(FontViewBase *fv, BDFFont *bdf) {
- fv->active_bitmap = bdf;
-}
-
-static void FVB_ShowFilled(FontViewBase *fv) {
- fv->active_bitmap = NULL;
-}
-
-static void FVB_ReattachCVs(SplineFont *old, SplineFont *new) {
- (void)old;
- (void)new;
-}
-
-static void FVB_DeselectAll(FontViewBase *fv) {
- memset(fv->selected,0,fv->map->encmax);
-}
-
-static void FVB_DisplayChar(FontViewBase *fv,int gid) {
- (void)fv;
- (void)gid;
-}
-
-static int SFB_CloseAllInstrs(SplineFont *sf) {
- (void)sf;
-return( true );
-}
-
-struct fv_interface noui_fv = {
- FontViewBase_Create,
- _FontViewBaseCreate,
- FontViewBase_Close,
- FontViewBase_Free,
- FontViewBaseSetTitle,
- FontViewBaseSetTitles,
- FontViewBaseRefreshAll,
- FontViewBaseReformatOne,
- FontViewBaseReformatAll,
- FontViewBaseLayerChanged,
- FV_ToggleCharChanged,
- FontViewBaseWinInfo,
- FontIsActive,
- FVAny,
- FontViewBase_Append,
- FontOfFilename,
- FVExtraEncSlots,
- FVExtraEncSlots,
- FVB_ChangeDisplayBitmap,
- FVB_ShowFilled,
- FVB_ReattachCVs,
- FVB_DeselectAll,
- FVB_DisplayChar,
- FVB_DisplayChar,
- FVB_DisplayChar,
- SFB_CloseAllInstrs
-};
-
-struct fv_interface *fv_interface = &noui_fv;
-
-
-/******************************************************************************/
-static int NoGlyphs(struct metricsview *mv) {
- (void)mv;
-return( 0 );
-}
-
-static SplineChar *Nothing(struct metricsview *mv, int i) {
- (void)mv;
- (void)i;
-return( NULL );
-}
-
-static void NoReKern(struct splinefont *sf) {
- (void)sf;
-}
-
-static void NoCloseAll(struct splinefont *sf) {
- (void)sf;
-}
-
-struct mv_interface noui_mv = {
- NoGlyphs,
- Nothing,
- NoReKern,
- NoCloseAll
-};
-
-struct mv_interface *mv_interface = &noui_mv;
diff --git a/Build/source/texk/web2c/luatexdir/luafontloader/fontforge/fontforge/fvcomposit.c b/Build/source/texk/web2c/luatexdir/luafontloader/fontforge/fontforge/fvcomposit.c
deleted file mode 100644
index 53f6ee81aa7..00000000000
--- a/Build/source/texk/web2c/luatexdir/luafontloader/fontforge/fontforge/fvcomposit.c
+++ /dev/null
@@ -1,160 +0,0 @@
-/* Copyright (C) 2000-2008 by George Williams */
-/*
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are met:
-
- * Redistributions of source code must retain the above copyright notice, this
- * list of conditions and the following disclaimer.
-
- * Redistributions in binary form must reproduce the above copyright notice,
- * this list of conditions and the following disclaimer in the documentation
- * and/or other materials provided with the distribution.
-
- * The name of the author may not be used to endorse or promote products
- * derived from this software without specific prior written permission.
-
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
- * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
- * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
- * EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
- * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
- * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
- * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
- * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-#include "fontforgevw.h"
-#include <chardata.h>
-#include <math.h>
-#include <utype.h>
-#include <ustring.h>
-
-int accent_offset = 6;
-int GraveAcuteCenterBottom = 1;
-int PreferSpacingAccents = true;
-int CharCenterHighest = 1;
-
-#define BottomAccent 0x300
-#define TopAccent 0x345
-
-/* for accents between 0x300 and 345 these are some synonyms */
-/* type1 wants accented chars built with accents in the 0x2c? range */
-/* except for grave and acute which live in iso8859-1 range */
-/* this table is ordered on a best try basis */
-static const unichar_t accents[][4] = {
- { 0x2cb, 0x300, 0x60 }, /* grave */
- { 0x2ca, 0x301, 0xb4 }, /* acute */
- { 0x2c6, 0x302, 0x5e }, /* circumflex */
- { 0x2dc, 0x303, 0x7e }, /* tilde */
- { 0x2c9, 0x304, 0xaf }, /* macron */
- { 0x305, 0xaf }, /* overline, (macron is suggested as a syn, but it's not quite right) */
- { 0x2d8, 0x306 }, /* breve */
- { 0x2d9, 0x307, '.' }, /* dot above */
- { 0xa8, 0x308 }, /* diaeresis */
- { 0x2c0 }, /* hook above */
- { 0x2da, 0xb0 }, /* ring above */
- { 0x2dd }, /* real acute */
- { 0x2c7 }, /* caron */
- { 0x2c8, 0x384, 0x30d, '\'' }, /* vertical line, tonos */
- { 0x30e, '"' }, /* real vertical line */
- { 0 }, /* real grave */
- { 0 }, /* cand... */ /* 310 */
- { 0 }, /* inverted breve */
- { 0x2bb }, /* turned comma */
- { 0x2bc, 0x313, ',' }, /* comma above */
- { 0x2bd }, /* reversed comma */
- { 0x2bc, 0x315, ',' }, /* comma above right */
- { 0x316, 0x60, 0x2cb }, /* grave below */
- { 0x317, 0xb4, 0x2ca }, /* acute below */
- { 0 }, /* left tack */
- { 0 }, /* right tack */
- { 0 }, /* left angle */
- { 0 }, /* horn, sometimes comma but only if nothing better */
- { 0 }, /* half ring */
- { 0x2d4 }, /* up tack */
- { 0x2d5 }, /* down tack */
- { 0x2d6, 0x31f, '+' }, /* plus below */
- { 0x2d7, 0x320, '-' }, /* minus below */ /* 320 */
- { 0x2b2 }, /* hook */
- { 0 }, /* back hook */
- { 0x323, 0x2d9, '.' }, /* dot below */
- { 0x324, 0xa8 }, /* diaeresis below */
- { 0x325, 0x2da, 0xb0 }, /* ring below */
- { 0x326, 0x2bc, ',' }, /* comma below */
- { 0xb8 }, /* cedilla */
- { 0x2db }, /* ogonek */ /* 0x328 */
- { 0x329, 0x2c8, 0x384, '\'' }, /* vertical line below */
- { 0 }, /* bridge below */
- { 0 }, /* real arch below */
- { 0x32c, 0x2c7 }, /* caron below */
- { 0x32d, 0x2c6, 0x52 }, /* circumflex below */
- { 0x32e, 0x2d8 }, /* breve below */
- { 0 }, /* inverted breve below */
- { 0x330, 0x2dc, 0x7e }, /* tilde below */ /* 0x330 */
- { 0x331, 0xaf, 0x2c9 }, /* macron below */
- { 0x332, '_' }, /* low line */
- { 0 }, /* real low line */
- { 0x334, 0x2dc, 0x7e }, /* tilde overstrike */
- { 0x335, '-' }, /* line overstrike */
- { 0x336, '_' }, /* long line overstrike */
- { 0x337, '/' }, /* short solidus overstrike */
- { 0x338, '/' }, /* long solidus overstrike */ /* 0x338 */
- { 0 },
- { 0 },
- { 0 },
- { 0 },
- { 0 },
- { 0 },
- { 0 },
- { 0x340, 0x60, 0x2cb }, /* tone mark, left of circumflex */ /* 0x340 */
- { 0x341, 0xb4, 0x2ca }, /* tone mark, right of circumflex */
- { 0x342, 0x2dc, 0x7e }, /* perispomeni (tilde) */
- { 0x343, 0x2bc, ',' }, /* koronis */
- { 0 }, /* dialytika tonos (two accents) */
- { 0x37a }, /* ypogegrammeni */
- { 0xffff }
-};
-
-int CanonicalCombiner(int uni) {
- /* Translate spacing accents to combiners */
- int j,k;
-
- /* The above table will use these occasionally, but we don't want to */
- /* translate them. They aren't accents */
- if ( uni==',' || uni=='\'' || uni=='"' || uni=='~' || uni=='^' || uni=='-' ||
- uni=='+' || uni=='.' )
-return( uni );
-
- for ( j=0; accents[j][0]!=0xffff; ++j ) {
- for ( k=0; k<4 && accents[j][k]!=0; ++k ) {
- if ( uni==(int)accents[j][k] ) {
- uni = 0x300+j;
- break;
- }
- }
- if ( uni>=0x300 && uni<0x370 )
- break;
- }
-return( uni );
-}
-
-
-
-int isaccent(int uni) {
-
- if ( uni<0x10000 && iscombining(uni) )
-return( true );
- if ( uni>=0x2b0 && uni<0x2ff )
-return( true );
- if ( uni=='.' || uni==',' || uni==0x60 || uni==0x5e || uni==0x7e ||
- uni==0xa8 || uni==0xaf || uni==0xb8 || uni==0x384 || uni==0x385 ||
- (uni>=0x1fbd && uni<=0x1fc1) ||
- (uni>=0x1fcd && uni<=0x1fcf) ||
- (uni>=0x1fed && uni<=0x1fef) ||
- (uni>=0x1ffd && uni<=0x1fff) )
-return( true );
-
-return( false );
-}
-
diff --git a/Build/source/texk/web2c/luatexdir/luafontloader/fontforge/fontforge/fvfonts.c b/Build/source/texk/web2c/luatexdir/luafontloader/fontforge/fontforge/fvfonts.c
deleted file mode 100644
index db709cea56e..00000000000
--- a/Build/source/texk/web2c/luatexdir/luafontloader/fontforge/fontforge/fvfonts.c
+++ /dev/null
@@ -1,572 +0,0 @@
-/* Copyright (C) 2000-2008 by George Williams */
-/*
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are met:
-
- * Redistributions of source code must retain the above copyright notice, this
- * list of conditions and the following disclaimer.
-
- * Redistributions in binary form must reproduce the above copyright notice,
- * this list of conditions and the following disclaimer in the documentation
- * and/or other materials provided with the distribution.
-
- * The name of the author may not be used to endorse or promote products
- * derived from this software without specific prior written permission.
-
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
- * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
- * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
- * EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
- * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
- * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
- * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
- * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-#include "fontforgevw.h"
-#include "ustring.h"
-#include "utype.h"
-#include "gfile.h"
-#include "chardata.h"
-
-RefChar *RefCharsCopy(RefChar *ref) {
- RefChar *rhead=NULL, *last=NULL, *cur;
-
- while ( ref!=NULL ) {
- cur = RefCharCreate();
-#ifdef FONTFORGE_CONFIG_TYPE3
- { struct reflayer *layers = cur->layers; int layer;
- layers = grealloc(layers,ref->layer_cnt*sizeof(struct reflayer));
- memcpy(layers,ref->layers,ref->layer_cnt*sizeof(struct reflayer));
- *cur = *ref;
- cur->layers = layers;
- for ( layer=0; layer<cur->layer_cnt; ++layer ) {
- cur->layers[layer].splines = NULL;
- cur->layers[layer].images = NULL;
- }
- }
-#else
- {struct reflayer *rl = cur->layers;
- *cur = *ref;
- cur->layers = rl;
- }
-#endif
- if ( cur->sc!=NULL )
- cur->orig_pos = cur->sc->orig_pos;
- cur->next = NULL;
- if ( rhead==NULL )
- rhead = cur;
- else
- last->next = cur;
- last = cur;
- ref = ref->next;
- }
-return( rhead );
-}
-
-static OTLookup *MCConvertLookup(struct sfmergecontext *mc,OTLookup *otl) {
- int l;
- OTLookup *newotl;
-
- if ( mc==NULL || mc->sf_from==mc->sf_to )
-return( otl ); /* No translation needed */
-
- for ( l=0; l<mc->lcnt; ++l ) {
- if ( mc->lks[l].from == otl )
- break;
- }
- if ( l==mc->lcnt )
-return( NULL );
- if ( mc->lks[l].to!=NULL )
-return( mc->lks[l].to );
-
- mc->lks[l].to = newotl = chunkalloc(sizeof(struct lookup_subtable));
- newotl->lookup_name = strconcat(mc->prefix,otl->lookup_name);
- newotl->lookup_type = otl->lookup_type;
- newotl->lookup_flags = otl->lookup_flags;
- newotl->features = FeatureListCopy(otl->features);
- newotl->store_in_afm = otl->store_in_afm;
-return( newotl );
-}
-
-struct lookup_subtable *MCConvertSubtable(struct sfmergecontext *mc,struct lookup_subtable *sub) {
- int s;
- struct lookup_subtable *newsub;
-
- if ( mc==NULL || mc->sf_from==mc->sf_to )
-return( sub ); /* No translation needed */
- if ( mc->prefix==NULL ) {
- int lcnt, scnt;
- OTLookup *otl;
- struct lookup_subtable *subs;
- int isgpos, doit;
- char *temp;
-
- /* Not initialized */
- if ( mc->sf_from->cidmaster ) mc->sf_from = mc->sf_from->cidmaster;
- else if ( mc->sf_from->mm!=NULL ) mc->sf_from = mc->sf_from->mm->normal;
- if ( mc->sf_to->cidmaster ) mc->sf_to = mc->sf_to->cidmaster;
- else if ( mc->sf_to->mm!=NULL ) mc->sf_to = mc->sf_to->mm->normal;
- if ( mc->sf_from == mc->sf_to )
-return( sub );
- mc->prefix = strconcat(mc->sf_from->fontname,"-");
- for ( doit = 0; doit<2; ++doit ) {
- lcnt = scnt = 0;
- for ( isgpos=0; isgpos<2; ++isgpos ) {
- for ( otl = isgpos ? mc->sf_from->gpos_lookups : mc->sf_from->gsub_lookups; otl!=NULL; otl=otl->next ) {
- if ( doit ) {
- mc->lks[lcnt].from = otl;
- temp = strconcat(mc->prefix,otl->lookup_name);
- mc->lks[lcnt].to = SFFindLookup(mc->sf_to,temp);
- free(temp);
- mc->lks[lcnt].old = mc->lks[lcnt].to!=NULL;
- }
- ++lcnt;
- for ( subs=otl->subtables; subs!=NULL; subs=subs->next ) {
- if ( doit ) {
- mc->subs[scnt].from = subs;
- temp = strconcat(mc->prefix,subs->subtable_name);
- mc->subs[scnt].to = SFFindLookupSubtable(mc->sf_to,temp);
- free(temp);
- mc->subs[scnt].old = mc->subs[scnt].to!=NULL;
- }
- ++scnt;
- }
- }
- }
- if ( !doit ) {
- mc->lcnt = lcnt; mc->scnt = scnt;
- mc->lks = gcalloc(lcnt,sizeof(struct lookup_cvt));
- mc->subs = gcalloc(scnt,sizeof(struct sub_cvt));
- }
- }
- }
-
- for ( s=0; s<mc->scnt; ++s ) {
- if ( mc->subs[s].from == sub )
- break;
- }
- if ( s==mc->scnt )
-return( NULL );
- if ( mc->subs[s].to!=NULL )
-return( mc->subs[s].to );
-
- mc->subs[s].to = newsub = chunkalloc(sizeof(struct lookup_subtable));
- newsub->subtable_name = strconcat(mc->prefix,sub->subtable_name);
- newsub->lookup = MCConvertLookup(mc,sub->lookup);
- newsub->anchor_classes = sub->anchor_classes;
- newsub->per_glyph_pst_or_kern = sub->per_glyph_pst_or_kern;
-return( newsub );
-}
-
-PST *PSTCopy(PST *base,SplineChar *sc,struct sfmergecontext *mc) {
- PST *head=NULL, *last=NULL, *cur;
-
- for ( ; base!=NULL; base = base->next ) {
- cur = chunkalloc(sizeof(PST));
- *cur = *base;
- cur->subtable = MCConvertSubtable(mc,base->subtable);
- if ( cur->type==pst_ligature ) {
- cur->u.lig.components = copy(cur->u.lig.components);
- cur->u.lig.lig = sc;
- } else if ( cur->type==pst_pair ) {
- cur->u.pair.paired = copy(cur->u.pair.paired);
- cur->u.pair.vr = chunkalloc(sizeof( struct vr [2]));
- memcpy(cur->u.pair.vr,base->u.pair.vr,sizeof(struct vr [2]));
- } else if ( cur->type==pst_lcaret ) {
- cur->u.lcaret.carets = galloc(cur->u.lcaret.cnt*sizeof(uint16));
- memcpy(cur->u.lcaret.carets,base->u.lcaret.carets,cur->u.lcaret.cnt*sizeof(uint16));
- } else if ( cur->type==pst_substitution || cur->type==pst_multiple || cur->type==pst_alternate )
- cur->u.subs.variant = copy(cur->u.subs.variant);
- if ( head==NULL )
- head = cur;
- else
- last->next = cur;
- last = cur;
- }
-return( head );
-}
-
-static AnchorPoint *AnchorPointsDuplicate(AnchorPoint *base,SplineChar *sc) {
- AnchorPoint *head=NULL, *last=NULL, *cur;
- AnchorClass *ac;
-
- for ( ; base!=NULL; base = base->next ) {
- cur = chunkalloc(sizeof(AnchorPoint));
- *cur = *base;
- cur->next = NULL;
- for ( ac=sc->parent->anchor; ac!=NULL; ac=ac->next )
- if ( strcmp(ac->name,base->anchor->name)==0 )
- break;
- cur->anchor = ac;
- if ( ac==NULL ) {
- LogError( "No matching AnchorClass for %s", base->anchor->name);
- chunkfree(cur,sizeof(AnchorPoint));
- } else {
- if ( head==NULL )
- head = cur;
- else
- last->next = cur;
- last = cur;
- }
- }
-return( head );
-}
-
-static struct altuni *AltUniCopy(struct altuni *altuni,SplineFont *noconflicts) {
- struct altuni *head=NULL, *last=NULL, *cur;
-
- while ( altuni!=NULL ) {
- if ( noconflicts==NULL || SFGetChar(noconflicts,altuni->unienc,NULL)==NULL ) {
- cur = chunkalloc(sizeof(struct altuni));
- cur->unienc = altuni->unienc;
- cur->vs = altuni->vs;
- cur->fid = altuni->fid;
- if ( head==NULL )
- head = cur;
- else
- last->next = cur;
- last = cur;
- }
- altuni = altuni->next;
- }
-return( head );
-}
-
-SplineChar *SplineCharCopy(SplineChar *sc,SplineFont *into,struct sfmergecontext *mc) {
- SplineChar *nsc;
- Layer *layers;
- int layer;
- if (into==NULL) {
- nsc = SplineCharCreate(2);
- } else {
- nsc = SFSplineCharCreate(into);
- }
- layers = nsc->layers;
- *nsc = *sc; /* We copy the layers just below */
- if (into==NULL || sc->layer_cnt!=into->layer_cnt )
- layers = grealloc(layers,sc->layer_cnt*sizeof(Layer));
- memcpy(layers,sc->layers,sc->layer_cnt*sizeof(Layer));
- nsc->layers = layers;
- for ( layer = ly_back; layer<sc->layer_cnt; ++layer ) {
- layers[layer].splines = SplinePointListCopy(layers[layer].splines);
- layers[layer].refs = RefCharsCopy(layers[layer].refs);
- layers[layer].images = ImageListCopy(layers[layer].images);
- layers[layer].undoes = NULL;
- layers[layer].redoes = NULL;
- }
- nsc->parent = into;
- nsc->orig_pos = -2;
- nsc->name = copy(sc->name);
- nsc->hstem = StemInfoCopy(nsc->hstem);
- nsc->vstem = StemInfoCopy(nsc->vstem);
- nsc->anchor = AnchorPointsDuplicate(nsc->anchor,nsc);
- nsc->views = NULL;
- nsc->changed = true;
- nsc->dependents = NULL; /* Fix up later when we know more */
- nsc->layers[ly_fore].undoes = nsc->layers[ly_back].undoes = NULL;
- nsc->layers[ly_fore].redoes = nsc->layers[ly_back].redoes = NULL;
- if ( nsc->ttf_instrs_len!=0 ) {
- nsc->ttf_instrs = galloc(nsc->ttf_instrs_len);
- memcpy(nsc->ttf_instrs,sc->ttf_instrs,nsc->ttf_instrs_len);
- }
- nsc->kerns = NULL;
- nsc->possub = PSTCopy(nsc->possub,nsc,mc);
- nsc->altuni = AltUniCopy(nsc->altuni,into);
-return(nsc);
-}
-
-static int _SFFindExistingSlot(SplineFont *sf, int unienc, const char *name );
-
-
-#define GN_HSIZE 257
-
-struct glyphnamebucket {
- SplineChar *sc;
- struct glyphnamebucket *next;
-};
-
-struct glyphnamehash {
- struct glyphnamebucket *table[GN_HSIZE];
-};
-
-#ifndef __GNUC__
-# define __inline__
-#endif
-
-static __inline__ int hashname(const char *pt) {
- int val = 0;
-
- while ( *pt ) {
- val = (val<<3)|((val>>29)&0x7);
- val ^= (unsigned char)(*pt-'!');
- pt++;
- }
- val ^= (val>>16);
- val &= 0xffff;
- val %= GN_HSIZE;
-return( val );
-}
-
-static void _GlyphHashFree(SplineFont *sf) {
- struct glyphnamebucket *test, *next;
- int i;
-
- if ( sf->glyphnames==NULL )
-return;
- for ( i=0; i<GN_HSIZE; ++i ) {
- for ( test = sf->glyphnames->table[i]; test!=NULL; test = next ) {
- next = test->next;
- chunkfree(test,sizeof(struct glyphnamebucket));
- }
- }
- free(sf->glyphnames);
- sf->glyphnames = NULL;
-}
-
-void GlyphHashFree(SplineFont *sf) {
- _GlyphHashFree(sf);
- if ( sf->cidmaster )
- _GlyphHashFree(sf->cidmaster);
-}
-
-static void GlyphHashCreate(SplineFont *sf) {
- int i, k, hash;
- SplineFont *_sf;
- struct glyphnamehash *gnh;
- struct glyphnamebucket *new;
-
- if ( sf->glyphnames!=NULL )
-return;
- sf->glyphnames = gnh = gcalloc(1,sizeof(*gnh));
- k = 0;
- do {
- _sf = k<sf->subfontcnt ? sf->subfonts[k] : sf;
- /* I walk backwards because there are some ttf files where multiple */
- /* glyphs get the same name. In the cases I've seen only one of these */
- /* has an encoding. That's the one we want. It will be earlier in the */
- /* font than the others. If we build the list backwards then it will */
- /* be the top name in the bucket, and will be the one we return */
- for ( i=_sf->glyphcnt-1; i>=0; --i ) if ( _sf->glyphs[i]!=NULL ) {
- new = chunkalloc(sizeof(struct glyphnamebucket));
- new->sc = _sf->glyphs[i];
- hash = hashname(new->sc->name);
- new->next = gnh->table[hash];
- gnh->table[hash] = new;
- }
- ++k;
- } while ( k<sf->subfontcnt );
-}
-
-void SFHashGlyph(SplineFont *sf,SplineChar *sc) {
- /* sc just got added to the font. Put it in the lookup */
- int hash;
- struct glyphnamebucket *new;
-
- if ( sf->glyphnames==NULL )
-return; /* No hash table, nothing to update */
-
- new = chunkalloc(sizeof(struct glyphnamebucket));
- new->sc = sc;
- hash = hashname(sc->name);
- new->next = sf->glyphnames->table[hash];
- sf->glyphnames->table[hash] = new;
-}
-
-SplineChar *SFHashName(SplineFont *sf,const char *name) {
- struct glyphnamebucket *test;
-
- if ( sf->glyphnames==NULL )
- GlyphHashCreate(sf);
-
- for ( test=sf->glyphnames->table[hashname(name)]; test!=NULL; test = test->next )
- if ( strcmp(test->sc->name,name)==0 )
-return( test->sc );
-
-return( NULL );
-}
-
-/* Find the position in the glyph list where this code point/name is found. */
-/* Returns -1 else on error */
-int SFFindGID(SplineFont *sf, int unienc, const char *name ) {
- struct altuni *altuni;
- int gid;
- SplineChar *sc;
-
- if ( unienc!=-1 ) {
- for ( gid=0; gid<sf->glyphcnt; ++gid ) if ( sf->glyphs[gid]!=NULL ) {
- if ( sf->glyphs[gid]->unicodeenc == unienc )
-return( gid );
- for ( altuni = sf->glyphs[gid]->altuni; altuni!=NULL; altuni=altuni->next ) {
- if ( altuni->unienc == unienc && altuni->vs==-1 && altuni->fid==0 )
-return( gid );
- }
- }
- }
- if ( name!=NULL ) {
- sc = SFHashName(sf,name);
- if ( sc!=NULL )
-return( sc->orig_pos );
- }
-
-return ( -1 );
-}
-
-/* Find the position in the current encoding where this code point/name should*/
-/* be found. (or for unencoded glyphs where it is found). Returns -1 else */
-int SFFindSlot(SplineFont *sf, EncMap *map, int unienc, const char *name ) {
- int index=-1, pos;
- struct cidmap *cidmap;
-
- if ( sf->cidmaster!=NULL && !map->enc->is_compact &&
- (cidmap = FindCidMap(sf->cidmaster->cidregistry,
- sf->cidmaster->ordering,
- sf->cidmaster->supplement,
- sf->cidmaster))!=NULL )
- index = NameUni2CID(cidmap,unienc,name);
- if ( index!=-1 )
- /* All done */;
- else if ( (map->enc->is_custom || map->enc->is_compact ||
- map->enc->is_original) && unienc!=-1 ) {
- if ( unienc<map->enccount && map->map[unienc]!=-1 &&
- sf->glyphs[map->map[unienc]]!=NULL &&
- sf->glyphs[map->map[unienc]]->unicodeenc==unienc )
- index = unienc;
- else for ( index = map->enccount-1; index>=0; --index ) {
- if ( (pos = map->map[index])!=-1 && sf->glyphs[pos]!=NULL &&
- sf->glyphs[pos]->unicodeenc==unienc )
- break;
- }
- } else if ( unienc!=-1 &&
- ((unienc<0x10000 && map->enc->is_unicodebmp) ||
- (unienc<0x110000 && map->enc->is_unicodefull))) {
- index = unienc;
- } else if ( unienc!=-1 ) {
- index = EncFromUni(unienc,map->enc);
- if ( index<0 || index>=map->enccount ) {
- for ( index=map->enc->char_cnt; index<map->enccount; ++index )
- if ( (pos = map->map[index])!=-1 && sf->glyphs[pos]!=NULL &&
- sf->glyphs[pos]->unicodeenc==unienc )
- break;
- if ( index>=map->enccount )
- index = -1;
- }
- }
- if ( index==-1 && name!=NULL ) {
- SplineChar *sc = SFHashName(sf,name);
- if ( sc!=NULL ) index = map->backmap[sc->orig_pos];
- if ( index==-1 ) {
- unienc = UniFromName(name,sf->uni_interp,map->enc);
- if ( unienc!=-1 )
-return( SFFindSlot(sf,map,unienc,NULL));
- if ( map->enc->psnames!=NULL ) {
- for ( index = map->enc->char_cnt-1; index>=0; --index )
- if ( map->enc->psnames[index]!=NULL &&
- strcmp(map->enc->psnames[index],name)==0 )
-return( index );
- }
- }
- }
-
-return( index );
-}
-
-int SFCIDFindCID(SplineFont *sf, int unienc, const char *name ) {
- int j,ret;
- struct cidmap *cidmap;
-
- if ( sf->cidmaster!=NULL || sf->subfontcnt!=0 ) {
- if ( sf->cidmaster!=NULL )
- sf=sf->cidmaster;
- cidmap = FindCidMap(sf->cidregistry,sf->ordering,sf->supplement,sf);
- ret = NameUni2CID(cidmap,unienc,name);
- if ( ret!=-1 )
-return( ret );
- }
-
- if ( sf->subfonts==NULL && sf->cidmaster==NULL )
-return( SFFindGID(sf,unienc,name));
-
- if ( sf->cidmaster!=NULL )
- sf=sf->cidmaster;
- for ( j=0; j<sf->subfontcnt; ++j )
- if (( ret = SFFindGID(sf,unienc,name))!=-1 )
-return( ret );
-
-return( -1 );
-}
-
-int SFHasCID(SplineFont *sf,int cid) {
- int i;
- /* What subfont (if any) contains this cid? */
- if ( sf->cidmaster!=NULL )
- sf=sf->cidmaster;
- for ( i=0; i<sf->subfontcnt; ++i )
- if ( cid<sf->subfonts[i]->glyphcnt &&
- SCWorthOutputting(sf->subfonts[i]->glyphs[cid]) )
-return( i );
- for ( i=0; i<sf->subfontcnt; ++i )
- if ( cid<sf->subfonts[i]->glyphcnt && sf->subfonts[i]->glyphs[cid]!=NULL )
-return( i );
-
-return( -1 );
-}
-
-SplineChar *SFGetChar(SplineFont *sf, int unienc, const char *name ) {
- int ind;
- int j;
-
- ind = SFCIDFindCID(sf,unienc,name);
- if ( ind==-1 )
-return( NULL );
-
- if ( sf->subfonts==NULL && sf->cidmaster==NULL )
-return( sf->glyphs[ind]);
-
- if ( sf->cidmaster!=NULL )
- sf=sf->cidmaster;
-
- j = SFHasCID(sf,ind);
- if ( j==-1 )
-return( NULL );
-
-return( sf->subfonts[j]->glyphs[ind] );
-}
-
-static int _SFFindExistingSlot(SplineFont *sf, int unienc, const char *name ) {
- int gid = -1;
- struct altuni *altuni;
-
- if ( unienc!=-1 ) {
- for ( gid=sf->glyphcnt-1; gid>=0; --gid ) if ( sf->glyphs[gid]!=NULL ) {
- if ( sf->glyphs[gid]->unicodeenc==unienc )
- break;
- for ( altuni=sf->glyphs[gid]->altuni ; altuni!=NULL &&
- (altuni->unienc!=unienc || altuni->vs!=-1 || altuni->fid!=0);
- altuni=altuni->next );
- if ( altuni!=NULL )
- break;
- }
- }
- if ( gid==-1 && name!=NULL ) {
- SplineChar *sc = SFHashName(sf,name);
- if ( sc==NULL )
-return( -1 );
- gid = sc->orig_pos;
- if ( gid<0 || gid>=sf->glyphcnt ) {
- IError("Invalid glyph location when searching for %s", name );
-return( -1 );
- }
- }
-return( gid );
-}
-
-int SFFindExistingSlot(SplineFont *sf, int unienc, const char *name ) {
- int gid = _SFFindExistingSlot(sf,unienc,name);
-
- if ( gid==-1 || !SCWorthOutputting(sf->glyphs[gid]) )
-return( -1 );
-
-return( gid );
-}
diff --git a/Build/source/texk/web2c/luatexdir/luafontloader/fontforge/fontforge/lookups.c b/Build/source/texk/web2c/luatexdir/luafontloader/fontforge/fontforge/lookups.c
deleted file mode 100644
index 16f540f1b0b..00000000000
--- a/Build/source/texk/web2c/luatexdir/luafontloader/fontforge/fontforge/lookups.c
+++ /dev/null
@@ -1,3987 +0,0 @@
-/* Copyright (C) 2007,2008 by George Williams */
-/*
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are met:
-
- * Redistributions of source code must retain the above copyright notice, this
- * list of conditions and the following disclaimer.
-
- * Redistributions in binary form must reproduce the above copyright notice,
- * this list of conditions and the following disclaimer in the documentation
- * and/or other materials provided with the distribution.
-
- * The name of the author may not be used to endorse or promote products
- * derived from this software without specific prior written permission.
-
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
- * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
- * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
- * EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
- * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
- * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
- * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
- * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-#include "fontforgevw.h"
-#include <chardata.h>
-#include <utype.h>
-#include <ustring.h>
-#include <math.h>
-#include <locale.h>
-#include <stdlib.h>
-#include "ttf.h"
-#include "lookups.h"
-
-struct opentype_feature_friendlynames friendlies[] = {
-#if 0 /* They get stuffed into the 'MATH' table now */
-/* I added these first three features to allow round-trip conversion of tfm files */
- { CHR('I','T','L','C'), "ITLC", N_("Italic Correction"), gpos_single_mask },
- { CHR('T','C','H','L'), "TCHL", N_("TeX Glyphlist"), gsub_alternate_mask },
- { CHR('T','E','X','L'), "TEXL", N_("TeX Extension List"), gsub_multiple_mask },
-#endif
-/* Normal OpenType features follow */
- { CHR('a','a','l','t'), "aalt", N_("Access All Alternates"), gsub_single_mask|gsub_alternate_mask },
- { CHR('a','b','v','f'), "abvf", N_("Above Base Forms"), gsub_single_mask },
- { CHR('a','b','v','m'), "abvm", N_("Above Base Mark"), gpos_mark2base_mask|gpos_mark2ligature_mask },
- { CHR('a','b','v','s'), "abvs", N_("Above Base Substitutions"), gsub_ligature_mask },
- { CHR('a','f','r','c'), "afrc", N_("Vertical Fractions"), gsub_ligature_mask },
- { CHR('a','k','h','n'), "akhn", N_("Akhand"), gsub_ligature_mask },
- { CHR('a','l','i','g'), "alig", N_("Ancient Ligatures"), gsub_ligature_mask },
- { CHR('b','l','w','f'), "blwf", N_("Below Base Forms"), gsub_ligature_mask },
- { CHR('b','l','w','m'), "blwm", N_("Below Base Mark"), gpos_mark2base_mask|gpos_mark2ligature_mask },
- { CHR('b','l','w','s'), "blws", N_("Below Base Substitutions"), gsub_ligature_mask },
- { CHR('c','2','p','c'), "c2pc", N_("Capitals to Petite Capitals"), gsub_single_mask },
- { CHR('c','2','s','c'), "c2sc", N_("Capitals to Small Capitals"), gsub_single_mask },
- { CHR('c','a','l','t'), "calt", N_("Contextual Alternates"), gsub_context_mask|gsub_contextchain_mask },
- { CHR('c','a','s','e'), "case", N_("Case-Sensitive Forms"), gsub_single_mask|gpos_single_mask },
- { CHR('c','c','m','p'), "ccmp", N_("Glyph Composition/Decomposition"), gsub_multiple_mask|gsub_ligature_mask },
- { CHR('c','l','i','g'), "clig", N_("Contextual Ligatures"), gsub_reversecchain_mask },
- { CHR('c','p','c','t'), "cpct", N_("Centered CJK Punctuation"), gpos_single_mask },
- { CHR('c','p','s','p'), "cpsp", N_("Capital Spacing"), gpos_single_mask },
- { CHR('c','s','w','h'), "cswh", N_("Contextual Swash"), gsub_reversecchain_mask },
- { CHR('c','u','r','s'), "curs", N_("Cursive Attachment"), gpos_cursive_mask },
- { CHR('c','v','0','0'), "cv00", N_("Character Variants 00"), gsub_single_mask },
- { CHR('c','v','0','1'), "cv01", N_("Character Variants 01"), gsub_single_mask },
- { CHR('c','v','0','2'), "cv02", N_("Character Variants 02"), gsub_single_mask },
- { CHR('c','v','0','3'), "cv03", N_("Character Variants 03"), gsub_single_mask },
- { CHR('c','v','0','4'), "cv04", N_("Character Variants 04"), gsub_single_mask },
- { CHR('c','v','0','5'), "cv05", N_("Character Variants 05"), gsub_single_mask },
- { CHR('c','v','0','6'), "cv06", N_("Character Variants 06"), gsub_single_mask },
- { CHR('c','v','0','7'), "cv07", N_("Character Variants 07"), gsub_single_mask },
- { CHR('c','v','0','8'), "cv08", N_("Character Variants 08"), gsub_single_mask },
- { CHR('c','v','0','9'), "cv09", N_("Character Variants 09"), gsub_single_mask },
- { CHR('c','v','1','0'), "cv10", N_("Character Variants 10"), gsub_single_mask },
- { CHR('c','v','9','9'), "cv99", N_("Character Variants 99"), gsub_single_mask },
- { CHR('d','c','a','p'), "dcap", N_("Drop Caps"), gsub_single_mask },
- { CHR('d','i','s','t'), "dist", N_("Distance"), gpos_pair_mask },
- { CHR('d','l','i','g'), "dlig", N_("Discretionary Ligatures"), gsub_ligature_mask },
- { CHR('d','n','o','m'), "dnom", N_("Denominators"), gsub_single_mask },
- { CHR('d','p','n','g'), "dpng", N_("Dipthongs (Obsolete)"), gsub_ligature_mask },
- { CHR('e','x','p','t'), "expt", N_("Expert Forms"), gsub_single_mask },
- { CHR('f','a','l','t'), "falt", N_("Final Glyph On Line"), gsub_alternate_mask },
- { CHR('f','i','n','2'), "fin2", N_("Terminal Forms #2"), gsub_context_mask|gsub_contextchain_mask },
- { CHR('f','i','n','3'), "fin3", N_("Terminal Forms #3"), gsub_context_mask|gsub_contextchain_mask },
- { CHR('f','i','n','a'), "fina", N_("Terminal Forms"), gsub_single_mask },
- { CHR('f','l','a','c'), "flac", N_("Flattened Accents over Capitals"), gsub_single_mask|gsub_ligature_mask },
- { CHR('f','r','a','c'), "frac", N_("Diagonal Fractions"), gsub_single_mask|gsub_ligature_mask },
- { CHR('f','w','i','d'), "fwid", N_("Full Widths"), gsub_single_mask|gpos_single_mask },
- { CHR('h','a','l','f'), "half", N_("Half Forms"), gsub_ligature_mask },
- { CHR('h','a','l','n'), "haln", N_("Halant Forms"), gsub_ligature_mask },
- { CHR('h','a','l','t'), "halt", N_("Alternative Half Widths"), gpos_single_mask },
- { CHR('h','i','s','t'), "hist", N_("Historical Forms"), gsub_single_mask },
- { CHR('h','k','n','a'), "hkna", N_("Horizontal Kana Alternatives"), gsub_single_mask },
- { CHR('h','l','i','g'), "hlig", N_("Historic Ligatures"), gsub_ligature_mask },
- { CHR('h','n','g','l'), "hngl", N_("Hanja to Hangul"), gsub_single_mask|gsub_alternate_mask },
- { CHR('h','o','j','o'), "hojo", N_("Hojo (JIS X 0212-1990) Kanji Forms"), gsub_single_mask },
- { CHR('h','w','i','d'), "hwid", N_("Half Widths"), gsub_single_mask|gpos_single_mask },
- { CHR('i','n','i','t'), "init", N_("Initial Forms"), gsub_single_mask },
- { CHR('i','s','o','l'), "isol", N_("Isolated Forms"), gsub_single_mask },
- { CHR('i','t','a','l'), "ital", N_("Italics"), gsub_single_mask },
- { CHR('j','a','l','t'), "jalt", N_("Justification Alternatives"), gsub_alternate_mask },
- { CHR('j','a','j','p'), "jajp", N_("Japanese Forms (Obsolete"), gsub_single_mask|gsub_alternate_mask },
- { CHR('j','p','7','8'), "jp78", N_("JIS78 Forms"), gsub_single_mask|gsub_alternate_mask },
- { CHR('j','p','8','3'), "jp83", N_("JIS83 Forms"), gsub_single_mask },
- { CHR('j','p','9','0'), "jp90", N_("JIS90 Forms"), gsub_single_mask },
- { CHR('k','e','r','n'), "kern", N_("Horizontal Kerning"), gpos_pair_mask|gpos_context_mask|gpos_contextchain_mask },
- { CHR('l','f','b','d'), "lfbd", N_("Left Bounds"), gpos_single_mask },
- { CHR('l','i','g','a'), "liga", N_("Standard Ligatures"), gsub_ligature_mask },
- { CHR('l','j','m','o'), "ljmo", N_("Leading Jamo Forms"), gsub_ligature_mask },
- { CHR('l','n','u','m'), "lnum", N_("Lining Figures"), gsub_single_mask },
- { CHR('l','o','c','l'), "locl", N_("Localized Forms"), gsub_single_mask },
- { CHR('m','a','r','k'), "mark", N_("Mark Positioning"), gpos_mark2base_mask|gpos_mark2ligature_mask },
- { CHR('m','e','d','2'), "med2", N_("Medial Forms 2"), gsub_context_mask|gsub_contextchain_mask },
- { CHR('m','e','d','i'), "medi", N_("Medial Forms"), gsub_single_mask },
- { CHR('m','g','r','k'), "mgrk", N_("Mathematical Greek"), gsub_single_mask },
- { CHR('m','k','m','k'), "mkmk", N_("Mark to Mark"), gpos_mark2mark_mask },
- { CHR('m','s','e','t'), "mset", N_("Mark Positioning via Substitution"), gsub_context_mask|gsub_contextchain_mask },
- { CHR('n','a','l','t'), "nalt", N_("Alternate Annotation Forms"), gsub_single_mask|gsub_alternate_mask },
- { CHR('n','u','k','t'), "nukt", N_("Nukta Forms"), gsub_ligature_mask },
- { CHR('n','u','m','r'), "numr", N_("Numerators"), gsub_single_mask },
- { CHR('o','n','u','m'), "onum", N_("Oldstyle Figures"), gsub_single_mask },
- { CHR('o','p','b','d'), "opbd", N_("Optical Bounds"), gpos_single_mask },
- { CHR('o','r','d','n'), "ordn", N_("Ordinals"), gsub_ligature_mask|gsub_context_mask|gsub_contextchain_mask },
- { CHR('o','r','n','m'), "ornm", N_("Ornaments"), gsub_single_mask|gsub_alternate_mask },
- { CHR('p','a','l','t'), "palt", N_("Proportional Alternate Metrics"), gpos_single_mask },
- { CHR('p','c','a','p'), "pcap", N_("Lowercase to Petite Capitals"), gsub_single_mask },
- { CHR('p','k','n','a'), "pkna", N_("Proportional Kana"), gpos_single_mask },
- { CHR('p','n','u','m'), "pnum", N_("Proportional Numbers"), gsub_single_mask },
- { CHR('p','r','e','f'), "pref", N_("Pre Base Forms"), gsub_ligature_mask },
- { CHR('p','r','e','s'), "pres", N_("Pre Base Substitutions"), gsub_ligature_mask|gsub_context_mask|gsub_contextchain_mask },
- { CHR('p','s','t','f'), "pstf", N_("Post Base Forms"), gsub_ligature_mask },
- { CHR('p','s','t','s'), "psts", N_("Post Base Substitutions"), gsub_ligature_mask },
- { CHR('p','w','i','d'), "pwid", N_("Proportional Width"), gsub_single_mask },
- { CHR('q','w','i','d'), "qwid", N_("Quarter Widths"), gsub_single_mask|gpos_single_mask },
- { CHR('r','a','n','d'), "rand", N_("Randomize"), gsub_alternate_mask },
- { CHR('r','k','r','f'), "rkrf", N_("Rakar Forms"), gsub_ligature_mask },
- { CHR('r','l','i','g'), "rlig", N_("Required Ligatures"), gsub_ligature_mask },
- { CHR('r','p','h','f'), "rphf", N_("Reph Form"), gsub_ligature_mask },
- { CHR('r','t','b','d'), "rtbd", N_("Right Bounds"), gpos_single_mask },
- { CHR('r','t','l','a'), "rtla", N_("Right to Left Alternates"), gsub_single_mask },
- { CHR('r','u','b','y'), "ruby", N_("Ruby Notational Forms"), gsub_single_mask },
- { CHR('s','a','l','t'), "salt", N_("Stylistic Alternatives"), gsub_single_mask|gsub_alternate_mask },
- { CHR('s','i','n','f'), "sinf", N_("Scientific Inferiors"), gsub_single_mask },
- { CHR('s','m','c','p'), "smcp", N_("Lowercase to Small Capitals"), gsub_single_mask },
- { CHR('s','m','p','l'), "smpl", N_("Simplified Forms"), gsub_single_mask },
- { CHR('s','s','0','1'), "ss01", N_("Style Set 1"), gsub_single_mask },
- { CHR('s','s','0','2'), "ss02", N_("Style Set 2"), gsub_single_mask },
- { CHR('s','s','0','3'), "ss03", N_("Style Set 3"), gsub_single_mask },
- { CHR('s','s','0','4'), "ss04", N_("Style Set 4"), gsub_single_mask },
- { CHR('s','s','0','5'), "ss05", N_("Style Set 5"), gsub_single_mask },
- { CHR('s','s','0','6'), "ss06", N_("Style Set 6"), gsub_single_mask },
- { CHR('s','s','0','7'), "ss07", N_("Style Set 7"), gsub_single_mask },
- { CHR('s','s','0','8'), "ss08", N_("Style Set 8"), gsub_single_mask },
- { CHR('s','s','0','9'), "ss09", N_("Style Set 9"), gsub_single_mask },
- { CHR('s','s','1','0'), "ss10", N_("Style Set 10"), gsub_single_mask },
- { CHR('s','s','1','1'), "ss11", N_("Style Set 11"), gsub_single_mask },
- { CHR('s','s','1','2'), "ss12", N_("Style Set 12"), gsub_single_mask },
- { CHR('s','s','1','3'), "ss13", N_("Style Set 13"), gsub_single_mask },
- { CHR('s','s','1','4'), "ss14", N_("Style Set 14"), gsub_single_mask },
- { CHR('s','s','1','5'), "ss15", N_("Style Set 15"), gsub_single_mask },
- { CHR('s','s','1','6'), "ss16", N_("Style Set 16"), gsub_single_mask },
- { CHR('s','s','1','7'), "ss17", N_("Style Set 17"), gsub_single_mask },
- { CHR('s','s','1','8'), "ss18", N_("Style Set 18"), gsub_single_mask },
- { CHR('s','s','1','9'), "ss19", N_("Style Set 19"), gsub_single_mask },
- { CHR('s','s','2','0'), "ss20", N_("Style Set 20"), gsub_single_mask },
- { CHR('s','s','t','y'), "ssty", N_("Script Style"), gsub_single_mask },
- { CHR('s','u','b','s'), "subs", N_("Subscript"), gsub_single_mask },
- { CHR('s','u','p','s'), "sups", N_("Superscript"), gsub_single_mask },
- { CHR('s','w','s','h'), "swsh", N_("Swash"), gsub_single_mask|gsub_alternate_mask },
- { CHR('t','i','t','l'), "titl", N_("Titling"), gsub_single_mask },
- { CHR('t','j','m','o'), "tjmo", N_("Trailing Jamo Forms"), gsub_ligature_mask },
- { CHR('t','n','a','m'), "tnam", N_("Traditional Name Forms"), gsub_single_mask },
- { CHR('t','n','u','m'), "tnum", N_("Tabular Numbers"), gsub_single_mask },
- { CHR('t','r','a','d'), "trad", N_("Traditional Forms"), gsub_single_mask|gsub_alternate_mask },
- { CHR('t','w','i','d'), "twid", N_("Third Widths"), gsub_single_mask|gpos_single_mask },
- { CHR('u','n','i','c'), "unic", N_("Unicase"), gsub_single_mask },
- { CHR('v','a','l','t'), "valt", N_("Alternate Vertical Metrics"), gpos_single_mask },
- { CHR('v','a','t','u'), "vatu", N_("Vattu Variants"), gsub_ligature_mask },
- { CHR('v','e','r','t'), "vert", N_("Vertical Alternates (obs)"), gsub_single_mask },
- { CHR('v','h','a','l'), "vhal", N_("Alternate Vertical Half Metrics"), gpos_single_mask },
- { CHR('v','j','m','o'), "vjmo", N_("Vowel Jamo Forms"), gsub_ligature_mask },
- { CHR('v','k','n','a'), "vkna", N_("Vertical Kana Alternates"), gsub_single_mask },
- { CHR('v','k','r','n'), "vkrn", N_("Vertical Kerning"), gpos_pair_mask|gpos_context_mask|gpos_contextchain_mask },
- { CHR('v','p','a','l'), "vpal", N_("Proportional Alternate Vertical Metrics"), gpos_single_mask },
- { CHR('v','r','t','2'), "vrt2", N_("Vertical Rotation & Alternates"), gsub_single_mask },
- { CHR('z','e','r','o'), "zero", N_("Slashed Zero"), gsub_single_mask },
-/* This is my hack for setting the "Required feature" field of a script */
- { CHR(' ','R','Q','D'), " RQD", N_("Required feature"), gsub_single_mask|gsub_multiple_mask|gsub_alternate_mask|gsub_ligature_mask|gsub_context_mask|gsub_contextchain_mask|gsub_reversecchain_mask|gpos_single_mask|gpos_pair_mask|gpos_cursive_mask|gpos_mark2base_mask|gpos_mark2ligature_mask|gpos_mark2mark_mask|gpos_context_mask|gpos_contextchain_mask },
- { 0, NULL, 0, 0 }
-};
-
-static int uint32_cmp(const void *_ui1, const void *_ui2) {
- if ( *(uint32 *) _ui1 > *(uint32 *)_ui2 )
-return( 1 );
- if ( *(uint32 *) _ui1 < *(uint32 *)_ui2 )
-return( -1 );
-
-return( 0 );
-}
-
-static int lang_cmp(const void *_ui1, const void *_ui2) {
- /* The default language is magic, and should come first in the list even */
- /* if that is not true alphabetical order */
- if ( *(uint32 *) _ui1 == DEFAULT_LANG )
-return( -1 );
- if ( *(uint32 *) _ui2 == DEFAULT_LANG )
-return( 1 );
-
- if ( *(uint32 *) _ui1 > *(uint32 *)_ui2 )
-return( 1 );
- if ( *(uint32 *) _ui1 < *(uint32 *)_ui2 )
-return( -1 );
-
-return( 0 );
-}
-
-FeatureScriptLangList *FindFeatureTagInFeatureScriptList(uint32 tag, FeatureScriptLangList *fl) {
-
- while ( fl!=NULL ) {
- if ( fl->featuretag==tag )
-return( fl );
- fl = fl->next;
- }
-return( NULL );
-}
-
-int FeatureTagInFeatureScriptList(uint32 tag, FeatureScriptLangList *fl) {
-
- while ( fl!=NULL ) {
- if ( fl->featuretag==tag )
-return( true );
- fl = fl->next;
- }
-return( false );
-}
-
-int ScriptInFeatureScriptList(uint32 script, FeatureScriptLangList *fl) {
- struct scriptlanglist *sl;
-
- if ( fl==NULL ) /* No features bound to lookup? (nested?) don't restrict by script */
-return( true );
-
- while ( fl!=NULL ) {
- for ( sl=fl->scripts; sl!=NULL; sl=sl->next ) {
- if ( sl->script == script )
-return( true );
- }
- fl = fl->next;
- }
-return( false );
-}
-
-int FeatureScriptTagInFeatureScriptList(uint32 feature, uint32 script, FeatureScriptLangList *fl) {
- struct scriptlanglist *sl;
-
- while ( fl!=NULL ) {
- if ( fl->featuretag == feature ) {
- for ( sl=fl->scripts; sl!=NULL; sl=sl->next ) {
- if ( sl->script == script )
-return( true );
- }
- }
- fl = fl->next;
- }
-return( false );
-}
-
-int DefaultLangTagInOneScriptList(struct scriptlanglist *sl) {
- int l;
-
- for ( l=0; l<sl->lang_cnt; ++l ) {
- uint32 lang = l<MAX_LANG ? sl->langs[l] : sl->morelangs[l-MAX_LANG];
- if ( lang==DEFAULT_LANG )
-return( true );
- }
-return( false );
-}
-
-struct scriptlanglist *DefaultLangTagInScriptList(struct scriptlanglist *sl, int DFLT_ok) {
-
- while ( sl!=NULL ) {
- if ( DFLT_ok || sl->script!=DEFAULT_SCRIPT ) {
- if ( DefaultLangTagInOneScriptList(sl))
-return( sl );
- }
- sl = sl->next;
- }
-return( NULL );
-}
-
-uint32 *SFScriptsInLookups(SplineFont *sf,int gpos) {
- /* Presumes that either SFFindUnusedLookups or SFFindClearUnusedLookupBits */
- /* has been called first */
- /* Since MS will sometimes ignore a script if it isn't found in both */
- /* GPOS and GSUB we want to return the same script list no matter */
- /* what the setting of gpos ... so we totally ignore that argument */
- /* and always look at both sets of lookups */
-
-/* Sergey Malkin from MicroSoft tells me:
- Each shaping engine in Uniscribe can decide on its requirements for
- layout tables - some of them require both GSUB and GPOS, in some cases
- any table present is enough, or it can work without any table.
-
- Sometimes, purpose of the check is to determine if font is supporting
- particular script - if required tables are not there font is just
- rejected by this shaping engine. Sometimes, shaping engine can not just
- reject the font because there are fonts using older shaping technologies
- we still have to support, so it uses some logic when to fallback to
- legacy layout code.
-
- In your case this is Hebrew, where both tables are required to use
- OpenType processing. Arabic requires both tables too, Latin requires
- GSUB to execute GPOS. But in general, if you have both tables you should
- be safe with any script to get fully featured OpenType shaping.
-
-In other words, if we have a Hebrew font with just GPOS features they won't work,
-and MS will not use the font at all. We must add a GSUB table. In the unlikely
-event that we had a hebrew font with only GSUB it would not work either.
-
-So if we want our lookups to have a chance of executing under Uniscribe we
-better make sure that both tables have the same script set.
-
-(Sergey says we could optimize a little: A Latin GSUB table will run without
-a GPOS, but he says the GPOS won't work without a GSUB.)
-*/
- int cnt=0, tot=0, i;
- uint32 *scripts = NULL;
- OTLookup *test;
- FeatureScriptLangList *fl;
- struct scriptlanglist *sl;
-
- /* So here always give scripts for both (see comment above) no */
- /* matter what they asked for */
- for ( gpos=0; gpos<2; ++gpos ) {
- for ( test = gpos ? sf->gpos_lookups : sf->gsub_lookups; test!=NULL; test = test->next ) {
- if ( test->unused )
- continue;
- for ( fl=test->features; fl!=NULL; fl=fl->next ) {
- for ( sl=fl->scripts ; sl!=NULL; sl=sl->next ) {
- for ( i=0; i<cnt; ++i ) {
- if ( sl->script==scripts[i] )
- break;
- }
- if ( i==cnt ) {
- if ( cnt>=tot )
- scripts = grealloc(scripts,(tot+=10)*sizeof(uint32));
- scripts[cnt++] = sl->script;
- }
- }
- }
- }
- }
-
- if ( cnt==0 )
-return( NULL );
-
- /* We want our scripts in alphabetic order */
- qsort(scripts,cnt,sizeof(uint32),uint32_cmp);
- /* add a 0 entry to mark the end of the list */
- if ( cnt>=tot )
- scripts = grealloc(scripts,(tot+1)*sizeof(uint32));
- scripts[cnt] = 0;
-return( scripts );
-}
-
-uint32 *SFLangsInScript(SplineFont *sf,int gpos,uint32 script) {
- /* However, the language lists (I think) are distinct */
- /* But giving a value of -1 for gpos will give us the set of languages in */
- /* both tables (for this script) */
- int cnt=0, tot=0, i, g, l;
- uint32 *langs = NULL;
- OTLookup *test;
- FeatureScriptLangList *fl;
- struct scriptlanglist *sl;
-
- for ( g=0; g<2; ++g ) {
- if (( gpos==0 && g==1 ) || ( gpos==1 && g==0 ))
- continue;
- for ( test = gpos ? sf->gpos_lookups : sf->gsub_lookups; test!=NULL; test = test->next ) {
- if ( test->unused )
- continue;
- for ( fl=test->features; fl!=NULL; fl=fl->next ) {
- for ( sl=fl->scripts ; sl!=NULL; sl=sl->next ) {
- if ( sl->script==script ) {
- for ( l=0; l<sl->lang_cnt; ++l ) {
- unsigned lang;
- if ( l<MAX_LANG )
- lang = sl->langs[l];
- else
- lang = sl->morelangs[l-MAX_LANG];
- for ( i=0; i<cnt; ++i ) {
- if ( lang==langs[i] )
- break;
- }
- if ( i==cnt ) {
- if ( cnt>=tot )
- langs = grealloc(langs,(tot+=10)*sizeof(uint32));
- langs[cnt++] = lang;
- }
- }
- }
- }
- }
- }
- }
-
- if ( cnt==0 ) {
- /* We add dummy script entries. Because Uniscribe will refuse to */
- /* process some scripts if they don't have an entry in both GPOS */
- /* an GSUB. So if a script appears in either table, force it to */
- /* appear in both. That means we can get scripts with no lookups */
- /* and hence no languages. It seems that Uniscribe doesn't like */
- /* that either. So give each such script a dummy default language */
- /* entry. This is what VOLT does */
- langs = gcalloc(2,sizeof(uint32));
- langs[0] = DEFAULT_LANG;
-return( langs );
- }
-
- /* We want our languages in alphabetic order */
- qsort(langs,cnt,sizeof(uint32),lang_cmp);
- /* add a 0 entry to mark the end of the list */
- if ( cnt>=tot )
- langs = grealloc(langs,(tot+1)*sizeof(uint32));
- langs[cnt] = 0;
-return( langs );
-}
-
-uint32 *SFFeaturesInScriptLang(SplineFont *sf,int gpos,uint32 script,uint32 lang) {
- int cnt=0, tot=0, i, l, isg;
- uint32 *features = NULL;
- OTLookup *test;
- FeatureScriptLangList *fl;
- struct scriptlanglist *sl;
- /* gpos==0 => GSUB, gpos==1 => GPOS, gpos==-1 => both, gpos==-2 => Both & kern */
-
- if ( sf->cidmaster ) sf=sf->cidmaster;
- for ( isg = 0; isg<2; ++isg ) {
- if ( gpos>=0 && isg!=gpos )
- continue;
- for ( test = isg ? sf->gpos_lookups : sf->gsub_lookups; test!=NULL; test = test->next ) {
- if ( test->unused )
- continue;
- for ( fl=test->features; fl!=NULL; fl=fl->next ) {
- if ( script==0xffffffff ) {
- for ( i=0; i<cnt; ++i ) {
- if ( fl->featuretag==features[i] )
- break;
- }
- if ( i==cnt ) {
- if ( cnt>=tot )
- features = grealloc(features,(tot+=10)*sizeof(uint32));
- features[cnt++] = fl->featuretag;
- }
- } else for ( sl=fl->scripts ; sl!=NULL; sl=sl->next ) {
- if ( sl->script==script ) {
- int matched = false;
- for ( l=0; l<sl->lang_cnt; ++l ) {
- unsigned testlang;
- if ( l<MAX_LANG )
- testlang = sl->langs[l];
- else
- testlang = sl->morelangs[l-MAX_LANG];
- if ( testlang==lang ) {
- matched = true;
- break;
- }
- }
- if ( matched ) {
- for ( i=0; i<cnt; ++i ) {
- if ( fl->featuretag==features[i] )
- break;
- }
- if ( i==cnt ) {
- if ( cnt>=tot )
- features = grealloc(features,(tot+=10)*sizeof(uint32));
- features[cnt++] = fl->featuretag;
- }
- }
- }
- }
- }
- }
- }
-
- if ( sf->design_size!=0 && gpos ) {
- /* The 'size' feature is like no other. It has no lookups and so */
- /* we will never find it in the normal course of events. If the */
- /* user has specified a design size, then every script/lang combo */
- /* gets a 'size' feature which contains no lookups but feature */
- /* params */
- if ( cnt>=tot )
- features = grealloc(features,(tot+=2)*sizeof(uint32));
- features[cnt++] = CHR('s','i','z','e');
- }
-
- if ( cnt==0 )
-return( gcalloc(1,sizeof(uint32)) );
-
- /* We don't care if our features are in alphabetical order here */
- /* all that matters is whether the complete list of features is */
- /* ordering here would be irrelevant */
- /* qsort(features,cnt,sizeof(uint32),uint32_cmp); */
-
- /* add a 0 entry to mark the end of the list */
- if ( cnt>=tot )
- features = grealloc(features,(tot+1)*sizeof(uint32));
- features[cnt] = 0;
-return( features );
-}
-
-OTLookup **SFLookupsInScriptLangFeature(SplineFont *sf,int gpos,uint32 script,uint32 lang, uint32 feature) {
- int cnt=0, tot=0, l;
- OTLookup **lookups = NULL;
- OTLookup *test;
- FeatureScriptLangList *fl;
- struct scriptlanglist *sl;
-
- for ( test = gpos ? sf->gpos_lookups : sf->gsub_lookups; test!=NULL; test = test->next ) {
- if ( test->unused )
- continue;
- for ( fl=test->features; fl!=NULL; fl=fl->next ) {
- if ( fl->featuretag==feature ) {
- for ( sl=fl->scripts ; sl!=NULL; sl=sl->next ) {
- if ( sl->script==script ) {
- for ( l=0; l<sl->lang_cnt; ++l ) {
- unsigned testlang;
- if ( l<MAX_LANG )
- testlang = sl->langs[l];
- else
- testlang = sl->morelangs[l-MAX_LANG];
- if ( testlang==lang ) {
- if ( cnt>=tot )
- lookups = grealloc(lookups,(tot+=10)*sizeof(OTLookup *));
- lookups[cnt++] = test;
- goto found;
- }
- }
- }
- }
- }
- }
- found:;
- }
-
- if ( cnt==0 )
-return( NULL );
-
- /* lookup order is irrelevant here. might as well leave it in invocation order */
- /* add a 0 entry to mark the end of the list */
- if ( cnt>=tot )
- lookups = grealloc(lookups,(tot+1)*sizeof(OTLookup *));
- lookups[cnt] = 0;
-return( lookups );
-}
-
-static int LigaturesFirstComponentGID(SplineFont *sf,char *components) {
- int gid, ch;
- char *pt;
-
- for ( pt = components; *pt!='\0' && *pt!=' '; ++pt );
- ch = *pt; *pt = '\0';
- gid = SFFindExistingSlot(sf,-1,components);
- *pt = ch;
-return( gid );
-}
-
-static int PSTValid(SplineFont *sf,PST *pst) {
- char *start, *pt, ch;
- int ret;
- (void)sf;
- switch ( pst->type ) {
- case pst_position:
-return( true );
- case pst_pair:
-return( SCWorthOutputting(SFGetChar(sf,-1,pst->u.pair.paired)) );
- case pst_substitution: case pst_alternate: case pst_multiple:
- case pst_ligature:
- for ( start = pst->u.mult.components; *start ; ) {
- for ( pt=start; *pt && *pt!=' '; ++pt );
- ch = *pt; *pt = '\0';
- ret = SCWorthOutputting(SFGetChar(sf,-1,start));
- *pt = ch;
- if ( !ret )
-return( false );
- if ( ch==0 )
- start = pt;
- else
- start = pt+1;
- }
- }
-return( true );
-}
-
-SplineChar **SFGlyphsWithPSTinSubtable(SplineFont *sf,struct lookup_subtable *subtable) {
- uint8 *used = gcalloc(sf->glyphcnt,sizeof(uint8));
- SplineChar **glyphs, *sc;
- int i, k, gid, cnt;
- KernPair *kp;
- PST *pst;
- int ispair = subtable->lookup->lookup_type == gpos_pair;
- int isliga = subtable->lookup->lookup_type == gsub_ligature;
- sc = NULL;
- for ( i=0; i<sf->glyphcnt; ++i ) if ( SCWorthOutputting(sc = sf->glyphs[i]) ) {
- if ( ispair ) {
- for ( k=0; k<2; ++k ) {
- for ( kp= k ? sc->kerns : sc->vkerns; kp!=NULL ; kp=kp->next ) {
- if ( !SCWorthOutputting(kp->sc))
- continue;
- if ( kp->subtable == subtable ) {
- used[i] = true;
- goto continue_;
- }
- }
- }
- }
- for ( pst=sc->possub; pst!=NULL; pst=pst->next ) {
- if ( pst->subtable == subtable && PSTValid(sf,pst)) {
- if ( !isliga ) {
- used[i] = true;
- goto continue_;
- } else {
- gid = LigaturesFirstComponentGID(sf,pst->u.lig.components);
- pst->u.lig.lig = sc;
- if ( gid!=-1 )
- used[gid] = true;
- /* can't continue here. ffi might be "f+f+i" and "ff+i" */
- /* and we need to mark both "f" and "ff" as used */
- }
- }
- }
- continue_: ;
- }
-
- for ( i=cnt=0 ; i<sf->glyphcnt; ++i )
- if ( used[i] )
- ++cnt;
-
- if ( cnt==0 ) {
- free(used);
-return( NULL );
- }
- glyphs = galloc((cnt+1)*sizeof(SplineChar *));
- for ( i=cnt=0 ; i<sf->glyphcnt; ++i ) {
- if ( used[i] )
- glyphs[cnt++] = sf->glyphs[i];
- }
- glyphs[cnt] = NULL;
- free(used);
-return( glyphs );
-}
-
-SplineChar **SFGlyphsWithLigatureinLookup(SplineFont *sf,struct lookup_subtable *subtable) {
- uint8 *used = gcalloc(sf->glyphcnt,sizeof(uint8));
- SplineChar **glyphs, *sc;
- int i, cnt;
- PST *pst;
- sc=NULL;
- /* for ( i=0; i<sf->glyphcnt; ++i ) if ( SCWorthOutputting(sc = sf->glyphs[i]) ) { */
- /* for ( pst=sc->possub; pst!=NULL; pst=pst->next ) { */
- /* if ( pst->subtable == subtable ) { */
- /* used[i] = true; */
- /* goto continue_; */
- /* } */
- /* } */
- /* continue_: ; */
- /* } */
- /* Issue 866 : currently #define SCWorthOutputting(a) 1 so we drop it */
- for ( i=0; i<sf->glyphcnt; ++i ) {
- sc = sf->glyphs[i];
- if ( sc ) {
- for ( pst=sc->possub; pst!=NULL; pst=pst->next ) {
- if ( pst->subtable == subtable ) {
- used[i] = true;
- goto continue_;
- }
- }
- continue_: ;
- }/* end if ( sc ) */
- }/*end for */
-
- for ( i=cnt=0 ; i<sf->glyphcnt; ++i )
- if ( used[i] )
- ++cnt;
-
- if ( cnt==0 ) {
- free(used);
-return( NULL );
- }
-
- glyphs = galloc((cnt+1)*sizeof(SplineChar *));
- for ( i=cnt=0 ; i<sf->glyphcnt; ++i ) {
- if ( used[i] )
- glyphs[cnt++] = sf->glyphs[i];
- }
- glyphs[cnt] = NULL;
- free(used);
-return( glyphs );
-}
-
-void SFFindUnusedLookups(SplineFont *sf) {
- OTLookup *test;
- struct lookup_subtable *sub;
- int gpos;
- AnchorClass *ac;
- AnchorPoint *ap;
- SplineChar *sc;
- KernPair *kp;
- PST *pst;
- int k,gid,isv;
- SplineFont *_sf = sf;
- sc=NULL;
- if ( _sf->cidmaster ) _sf = _sf->cidmaster;
-
- /* Some things are obvious. If a subtable consists of a kernclass or some */
- /* such, then obviously it is used. But more distributed info takes more */
- /* work. So mark anything easy as used, and anything difficult as unused */
- /* We'll work on the difficult things later */
- for ( gpos=0; gpos<2; ++gpos ) {
- for ( test = gpos ? _sf->gpos_lookups : _sf->gsub_lookups; test!=NULL; test = test->next ) {
- for ( sub = test->subtables; sub!=NULL; sub=sub->next ) {
- if ( sub->kc!=NULL || sub->fpst!=NULL ) {
- sub->unused = false;
- continue;
- }
- sub->unused = true;
- /* We'll turn the following bit back on if there turns out */
- /* to be an anchor class attached to it -- that is subtly */
- /* different than being unused -- unused will be set if all */
- /* acs are unused, this bit will be on if there are unused */
- /* classes that still refer to us. */
- sub->anchor_classes = false;
- }
- }
- }
-
- /* To be useful an anchor class must have both at least one base and one mark */
- /* (for cursive anchors that means at least one entry and at least one exit) */
- /* Start by assuming the worst */
- for ( ac = _sf->anchor; ac!=NULL; ac=ac->next )
- ac->has_mark = ac->has_base = false;
-
- /* Ok, for each glyph, look at all lookups (or anchor classes) it affects */
- /* and mark the appropriate parts of them as used */
- k = 0;
- do {
- sf = _sf->subfontcnt==0 ? _sf : _sf->subfonts[k];
- for ( gid=0; gid<sf->glyphcnt; ++gid ) if ( SCWorthOutputting(sc = sf->glyphs[gid]) ) {
- for ( ap=sc->anchor; ap!=NULL; ap=ap->next ) {
- switch ( ap->type ) {
- case at_mark: case at_centry:
- ap->anchor->has_mark = true;
- break;
- case at_basechar: case at_baselig: case at_basemark:
- case at_cexit:
- ap->anchor->has_base = true;
- break;
- }
- }
- for ( isv=0; isv<2; ++isv ) {
- for ( kp= isv ? sc->kerns : sc->vkerns ; kp!=NULL; kp=kp->next ) {
- if ( SCWorthOutputting(kp->sc))
- kp->subtable->unused = false;
- }
- }
- for ( pst=sc->possub; pst!=NULL; pst=pst->next ) {
- if ( pst->subtable==NULL )
- continue;
- if ( !PSTValid(sf,pst))
- continue;
- pst->subtable->unused = false;
- }
- }
- ++k;
- } while ( k<_sf->subfontcnt );
-
- /* Finally for any anchor class that has both a mark and a base then it is */
- /* used, and its lookup is also used */
- /* Also, even if unused, as long as the anchor class exists we must keep */
- /* the subtable around */
- for ( ac = _sf->anchor; ac!=NULL; ac=ac->next ) {
- ac->subtable->anchor_classes = true;
- if ( ac->has_mark && ac->has_base )
- ac->subtable->unused = false;
- }
-
- /* Now for each lookup, a lookup is unused if ALL subtables are unused */
- for ( gpos=0; gpos<2; ++gpos ) {
- for ( test = gpos ? _sf->gpos_lookups : _sf->gsub_lookups; test!=NULL; test = test->next ) {
- test->unused = test->empty = true;
- for ( sub=test->subtables; sub!=NULL; sub=sub->next ) {
- if ( !sub->unused )
- test->unused = false;
- if ( !sub->unused && !sub->anchor_classes ) {
- test->empty = false;
- break;
- }
- }
- }
- }
-}
-
-void SFFindClearUnusedLookupBits(SplineFont *sf) {
- OTLookup *test;
- int gpos;
-
- for ( gpos=0; gpos<2; ++gpos ) {
- for ( test = gpos ? sf->gpos_lookups : sf->gsub_lookups; test!=NULL; test = test->next ) {
- test->unused = false;
- test->empty = false;
- test->def_lang_checked = false;
- }
- }
-}
-
-static void SFRemoveAnchorPointsOfAC(SplineFont *sf,AnchorClass *ac) {
- int gid;
- SplineChar *sc;
- AnchorPoint *ap, *prev, *next;
-
- for ( gid=0; gid<sf->glyphcnt; ++gid ) if ( (sc = sf->glyphs[gid])!=NULL ) {
- for ( prev=NULL, ap=sc->anchor; ap!=NULL; ap=next ) {
- next = ap->next;
- if ( ap->anchor!=ac )
- prev = ap;
- else {
- if ( prev==NULL )
- sc->anchor = next;
- else
- prev->next = next;
- ap->next = NULL;
- AnchorPointsFree(ap);
- }
- }
- }
-}
-
-static void RemoveNestedReferences(SplineFont *sf,int isgpos,OTLookup *dying) {
- OTLookup *otl;
- struct lookup_subtable *sub;
- int i,j,k;
- (void)dying;
- for ( otl = isgpos ? sf->gpos_lookups : sf->gsub_lookups; otl!=NULL; otl = otl->next ) {
- /* Reverse chaining tables do not reference lookups. The match pattern*/
- /* is a (exactly one) coverage table, and each glyph in that table */
- /* as an inline replacement. There is no lookup to do the replacement*/
- /* (so we ignore it here) */
- if ( otl->lookup_type==gsub_context || otl->lookup_type==gsub_contextchain ||
- otl->lookup_type==gpos_context || otl->lookup_type==gpos_contextchain ) {
- for ( sub=otl->subtables; sub!=NULL; sub=sub->next ) {
- FPST *fpst = sub->fpst;
- for ( i=0; i<fpst->rule_cnt; ++i ) {
- for ( j=0; j<fpst->rules[i].lookup_cnt; ++j ) {
- if ( fpst->rules[i].lookups[j].lookup == otl ) {
- for ( k=j+1; k<fpst->rules[i].lookup_cnt; ++k )
- fpst->rules[i].lookups[k-1] = fpst->rules[i].lookups[k];
- --fpst->rules[i].lookup_cnt;
- --j;
- }
- }
- }
- }
- }
- }
-}
-
-void SFRemoveUnusedLookupSubTables(SplineFont *sf,
- int remove_incomplete_anchorclasses,
- int remove_unused_lookups) {
- int gpos;
- struct lookup_subtable *sub, *subnext, *prev;
- AnchorClass *ac, *acprev, *acnext;
- OTLookup *otl, *otlprev, *otlnext;
- otlprev=NULL;
- /* Presumes someone has called SFFindUnusedLookups first */
-
- if ( remove_incomplete_anchorclasses ) {
- for ( acprev=NULL, ac=sf->anchor; ac!=NULL; ac=acnext ) {
- acnext = ac->next;
- if ( ac->has_mark && ac->has_base )
- acprev = ac;
- else {
- SFRemoveAnchorPointsOfAC(sf,ac);
- ac->next = NULL;
- AnchorClassesFree(ac);
- if ( acprev==NULL )
- sf->anchor = acnext;
- else
- acprev = acnext;
- }
- }
- }
-
- for ( gpos=0; gpos<2; ++gpos ) {
- for ( otl = gpos ? sf->gpos_lookups : sf->gsub_lookups; otl!=NULL; otl = otlnext ) {
- otlnext = otl->next;
- if ( remove_unused_lookups && (otl->empty ||
- (otl->unused && remove_incomplete_anchorclasses)) ) {
- if ( otlprev!=NULL )
- otlprev->next = otlnext;
- else if ( gpos )
- sf->gpos_lookups = otlnext;
- else
- sf->gsub_lookups = otlnext;
- RemoveNestedReferences(sf,gpos,otl);
- OTLookupFree(otl);
- } else {
- for ( prev=NULL, sub=otl->subtables; sub!=NULL; sub=subnext ) {
- subnext = sub->next;
- if ( sub->unused &&
- (!sub->anchor_classes ||
- remove_incomplete_anchorclasses )) {
- if ( prev==NULL )
- otl->subtables = subnext;
- else
- prev->next = subnext;
- free(sub->subtable_name);
- chunkfree(sub,sizeof(*sub));
- } else
- prev = sub;
- }
- }
- }
- }
-}
-
-void SFRemoveLookupSubTable(SplineFont *sf,struct lookup_subtable *sub) {
- OTLookup *otl = sub->lookup;
- struct lookup_subtable *subprev, *subtest;
-
- if ( sf->cidmaster!=NULL ) sf = sf->cidmaster;
-
- if ( sub->fpst!=NULL ) {
- FPST *prev = NULL, *test;
- for ( test=sf->possub; test!=NULL && test!=sub->fpst; prev=test, test=test->next );
- if ( prev==NULL )
- sf->possub = sub->fpst->next;
- else
- prev->next = sub->fpst->next;
- sub->fpst->next = NULL;
- FPSTFree(sub->fpst);
- sub->fpst = NULL;
- } else if ( sub->kc!=NULL ) {
- KernClass *prev = NULL, *test;
- for ( test=sf->kerns; test!=NULL && test!=sub->kc; prev=test, test=test->next );
- if ( test!=NULL ) {
- if ( prev==NULL )
- sf->kerns = sub->kc->next;
- else
- prev->next = sub->kc->next;
- } else {
- for ( prev=NULL,test=sf->vkerns; test!=NULL && test!=sub->kc; prev=test, test=test->next );
- if ( prev==NULL )
- sf->vkerns = sub->kc->next;
- else
- prev->next = sub->kc->next;
- }
- sub->kc->next = NULL;
- KernClassListFree(sub->kc);
- sub->kc = NULL;
- } else if ( otl->lookup_type==gpos_cursive || otl->lookup_type==gpos_mark2base ||
- otl->lookup_type==gpos_mark2ligature || otl->lookup_type==gpos_mark2mark ) {
- AnchorClass *ac, *acnext;
- for ( ac=sf->anchor; ac!=NULL; ac=acnext ) {
- acnext = ac->next;
- if ( ac->subtable==sub )
- SFRemoveAnchorClass(sf,ac);
- }
- } else {
- int i,k,v;
- SplineChar *sc;
- SplineFont *_sf;
- PST *pst, *prev, *next;
- KernPair *kp, *kpprev, *kpnext;
- k=0; i=0;
- do {
- _sf = sf->subfontcnt==0 ? sf : sf->subfonts[i];
- for ( i=0; i<_sf->glyphcnt; ++i ) if ( (sc=_sf->glyphs[i])!=NULL ) {
- for ( pst=sc->possub, prev=NULL ; pst!=NULL; pst=next ) {
- next = pst->next;
- if ( pst->subtable==sub ) {
- if ( prev==NULL )
- sc->possub = next;
- else
- prev->next = next;
- pst->next = NULL;
- PSTFree(pst);
- } else
- prev = pst;
- }
- for ( v=0; v<2; ++v ) {
- for ( kp=v ? sc->vkerns : sc->kerns, kpprev=NULL ; kp!=NULL; kp=kpnext ) {
- kpnext = kp->next;
- if ( kp->subtable==sub ) {
- if ( kpprev!=NULL )
- kpprev->next = kpnext;
- else if ( v )
- sc->vkerns = kpnext;
- else
- sc->kerns = kpnext;
- kp->next = NULL;
- KernPairsFree(kp);
- } else
- kpprev = kp;
- }
- }
- }
- ++k;
- } while ( k<sf->subfontcnt );
- }
-
- subprev = NULL;
- for ( subtest = otl->subtables; subtest!=NULL && subtest!=sub; subprev = subtest, subtest=subtest->next );
- if ( subprev==NULL )
- otl->subtables = sub->next;
- else
- subprev->next = sub->next;
- free(sub->subtable_name);
- free(sub->suffix);
- chunkfree(sub,sizeof(struct lookup_subtable));
-}
-
-void SFRemoveLookup(SplineFont *sf,OTLookup *otl) {
- OTLookup *test, *prev;
- int isgpos;
- struct lookup_subtable *sub, *subnext;
-
- if ( sf->cidmaster ) sf = sf->cidmaster;
-
- for ( sub = otl->subtables; sub!=NULL; sub=subnext ) {
- subnext = sub->next;
- SFRemoveLookupSubTable(sf,sub);
- }
-
- for ( prev=NULL, test=sf->gpos_lookups; test!=NULL && test!=otl; prev=test, test=test->next );
- if ( test==NULL ) {
- isgpos = false;
- for ( prev=NULL, test=sf->gsub_lookups; test!=NULL && test!=otl; prev=test, test=test->next );
- } else
- isgpos = true;
- if ( prev!=NULL )
- prev->next = otl->next;
- else if ( isgpos )
- sf->gpos_lookups = otl->next;
- else
- sf->gsub_lookups = otl->next;
-
- RemoveNestedReferences(sf,isgpos,otl);
-
- otl->next = NULL;
- OTLookupFree(otl);
-}
-
-struct lookup_subtable *SFFindLookupSubtable(SplineFont *sf,char *name) {
- int isgpos;
- OTLookup *otl;
- struct lookup_subtable *sub;
-
- if ( sf->cidmaster ) sf = sf->cidmaster;
-
- if ( name==NULL )
-return( NULL );
-
- for ( isgpos=0; isgpos<2; ++isgpos ) {
- for ( otl = isgpos ? sf->gpos_lookups : sf->gsub_lookups ; otl!=NULL; otl=otl->next ) {
- for ( sub = otl->subtables; sub!=NULL; sub=sub->next ) {
- if ( strcmp(name,sub->subtable_name)==0 )
-return( sub );
- }
- }
- }
-return( NULL );
-}
-
-struct lookup_subtable *SFFindLookupSubtableAndFreeName(SplineFont *sf,char *name) {
- struct lookup_subtable *sub = SFFindLookupSubtable(sf,name);
- free(name);
-return( sub );
-}
-
-OTLookup *SFFindLookup(SplineFont *sf,char *name) {
- int isgpos;
- OTLookup *otl;
-
- if ( sf->cidmaster ) sf = sf->cidmaster;
-
- if ( name==NULL )
-return( NULL );
-
- for ( isgpos=0; isgpos<2; ++isgpos ) {
- for ( otl = isgpos ? sf->gpos_lookups : sf->gsub_lookups ; otl!=NULL; otl=otl->next ) {
- if ( strcmp(name,otl->lookup_name)==0 )
-return( otl );
- }
- }
-return( NULL );
-}
-
-void FListAppendScriptLang(FeatureScriptLangList *fl,uint32 script_tag,uint32 lang_tag) {
- struct scriptlanglist *sl;
- int l;
-
- for ( sl = fl->scripts; sl!=NULL && sl->script!=script_tag; sl=sl->next );
- if ( sl==NULL ) {
- sl = chunkalloc(sizeof(struct scriptlanglist));
- sl->script = script_tag;
- sl->next = fl->scripts;
- fl->scripts = sl;
- }
- for ( l=0; l<MAX_LANG && l<sl->lang_cnt && sl->langs[l]!=lang_tag; ++l );
- if ( l>=MAX_LANG && l<sl->lang_cnt ) {
- while ( l<sl->lang_cnt && sl->morelangs[l-MAX_LANG]!=lang_tag )
- ++l;
- }
- if ( l>=sl->lang_cnt ) {
- if ( l<MAX_LANG )
- sl->langs[l] = lang_tag;
- else {
- if ( l%MAX_LANG == 0 )
- sl->morelangs = grealloc(sl->morelangs,l*sizeof(uint32));
- /* We've just allocated MAX_LANG-1 more than we need */
- /* so we don't do quite some many allocations */
- sl->morelangs[l-MAX_LANG] = lang_tag;
- }
- ++sl->lang_cnt;
- }
-}
-
-void FListsAppendScriptLang(FeatureScriptLangList *fl,uint32 script_tag,uint32 lang_tag) {
- while ( fl!=NULL ) {
- FListAppendScriptLang(fl,script_tag,lang_tag);
- fl=fl->next;
- }
-}
-
-char *SuffixFromTags(FeatureScriptLangList *fl) {
- static struct { uint32 tag; char *suffix; } tags2suffix[] = {
- { CHR('v','r','t','2'), "vert" }, /* Will check for vrt2 later */
- { CHR('o','n','u','m'), "oldstyle" },
- { CHR('s','u','p','s'), "superior" },
- { CHR('s','u','b','s'), "inferior" },
- { CHR('s','w','s','h'), "swash" },
- { CHR('f','w','i','d'), "full" },
- { CHR('h','w','i','d'), "hw" },
- { 0 , NULL }
- };
- int i;
-
- while ( fl!=NULL ) {
- for ( i=0; tags2suffix[i].tag!=0; ++i )
- if ( tags2suffix[i].tag==fl->featuretag )
-return( copy( tags2suffix[i].suffix ));
- fl = fl->next;
- }
-return( NULL );
-}
-#ifdef LUA_FF_LIB
-/* ma = State Machine, un = Unknown */
-char *lookup_type_names[2][10] =
- { { "us", "ss", "ms", "as", "ls", "cs", "ks", "es", "rk" },
- { "up", "sp", "pp", "ca", "mb", "ml", "mm", "cp", "kp","ep" }};
-#else
-char *lookup_type_names[2][10] =
- { { N_("Undefined substitution"), N_("Single Substitution"), N_("Multiple Substitution"),
- N_("Alternate Substitution"), N_("Ligature Substitution"), N_("Contextual Substitution"),
- N_("Contextual Chaining Substitution"), N_("Extension"),
- N_("Reverse Contextual Chaining Substitution") },
- { N_("Undefined positioning"), N_("Single Positioning"), N_("Pairwise Positioning (kerning)"),
- N_("Cursive attachment"), N_("Mark to base attachment"),
- N_("Mark to Ligature attachment"), N_("Mark to Mark attachment"),
- N_("Contextual Positioning"), N_("Contextual Chaining Positioning"),
- N_("Extension") }};
-#endif
-
-/* This is a non-ui based copy of a similar list in lookupui.c */
-static struct {
- char *text;
- uint32 tag;
-} localscripts[] = {
- { N_("Arabic"), CHR('a','r','a','b') },
- { N_("Aramaic"), CHR('a','r','a','m') }, /* Only in ff */
- { N_("Armenian"), CHR('a','r','m','n') },
- { N_("Avestan"), CHR('a','v','e','s') }, /* Only in ff */
- { N_("Balinese"), CHR('b','a','l','i') },
- { N_("Batak"), CHR('b','a','t','k') },
- { N_("Bengali"), CHR('b','e','n','g') },
- { N_("Bengali2"), CHR('b','n','g','2') },
- { N_("Bliss Symbolics"), CHR('b','l','i','s') }, /* Only in ff */
- { N_("Bopomofo"), CHR('b','o','p','o') },
- { N_("Brāhmī"), CHR('b','r','a','h') },
- { N_("Braille"), CHR('b','r','a','i') },
- { N_("Buginese"), CHR('b','u','g','i') },
- { N_("Buhid"), CHR('b','u','h','d') },
- { N_("Byzantine Music"), CHR('b','y','z','m') },
- { N_("Canadian Syllabics"), CHR('c','a','n','s') },
- { N_("Carian"), CHR('c','a','r','i') },
- { N_("Cherokee"), CHR('c','h','a','m') },
- { N_("Cham"), CHR('c','h','a','m') },
- { N_("Cherokee"), CHR('c','h','e','r') },
- { N_("Cirth"), CHR('c','i','r','t') }, /* Only in ff */
- { N_("CJK Ideographic"), CHR('h','a','n','i') },
- { N_("Coptic"), CHR('c','o','p','t') },
- { N_("Cypro-Minoan"), CHR('c','p','r','t') },
- { N_("Cypriot syllabary"), CHR('c','p','m','n') }, /* Only in ff */
- { N_("Cyrillic"), CHR('c','y','r','l') },
- { N_("Default"), CHR('D','F','L','T') },
- { N_("Deseret (Mormon)"), CHR('d','s','r','t') },
- { N_("Devanagari"), CHR('d','e','v','a') },
- { N_("Devanagari2"), CHR('d','e','v','2') },
-/* { N_("Egyptian demotic"), CHR('e','g','y','d') }, */
-/* { N_("Egyptian hieratic"), CHR('e','g','y','h') }, */
-/* GT: Someone asked if FontForge actually was prepared generate hieroglyph output */
-/* GT: because of this string. No. But OpenType and Unicode have placeholders for */
-/* GT: dealing with these scripts against the day someone wants to use them. So */
-/* GT: FontForge must be prepared to deal with those placeholders if nothing else. */
-/* { N_("Egyptian hieroglyphs"), CHR('e','g','y','p') }, */
- { N_("Ethiopic"), CHR('e','t','h','i') },
- { N_("Georgian"), CHR('g','e','o','r') },
- { N_("Glagolitic"), CHR('g','l','a','g') },
- { N_("Gothic"), CHR('g','o','t','h') },
- { N_("Greek"), CHR('g','r','e','k') },
- { N_("Gujarati"), CHR('g','u','j','r') },
- { N_("Gujarati2"), CHR('g','j','r','2') },
- { N_("Gurmukhi"), CHR('g','u','r','u') },
- { N_("Gurmukhi2"), CHR('g','u','r','2') },
- { N_("Hangul Jamo"), CHR('j','a','m','o') },
- { N_("Hangul"), CHR('h','a','n','g') },
- { N_("Hanunóo"), CHR('h','a','n','o') },
- { N_("Hebrew"), CHR('h','e','b','r') },
-/* { N_("Pahawh Hmong"), CHR('h','m','n','g') },*/
-/* { N_("Indus (Harappan)"), CHR('i','n','d','s') },*/
- { N_("Javanese"), CHR('j','a','v','a') },
- { N_("Kayah Li"), CHR('k','a','l','i') },
- { N_("Hiragana & Katakana"), CHR('k','a','n','a') },
- { N_("Kharoṣṭhī"), CHR('k','h','a','r') },
- { N_("Kannada"), CHR('k','n','d','a') },
- { N_("Kannada2"), CHR('k','n','d','2') },
- { N_("Khmer"), CHR('k','h','m','r') },
- { N_("Kharosthi"), CHR('k','h','a','r') },
- { N_("Lao") , CHR('l','a','o',' ') },
- { N_("Latin"), CHR('l','a','t','n') },
- { N_("Lepcha (Róng)"), CHR('l','e','p','c') },
- { N_("Limbu"), CHR('l','i','m','b') }, /* Not in ISO 15924 !!!!!, just guessing */
- { N_("Linear A"), CHR('l','i','n','a') }, /* Only in ff */
- { N_("Linear B"), CHR('l','i','n','b') },
- { N_("Lycian"), CHR('l','y','c','i') },
- { N_("Lydian"), CHR('l','y','d','i') },
- { N_("Mandaean"), CHR('m','a','n','d') },
-/* { N_("Mayan hieroglyphs"), CHR('m','a','y','a') },*/
- { N_("Malayālam"), CHR('m','l','y','m') },
- { N_("Malayālam2"), CHR('m','l','y','2') }, /* Only in ff, should be mlm2 */
- { N_("Mathematical Alphanumeric Symbols"), CHR('m','a','t','h') },
- { N_("Mongolian"), CHR('m','o','n','g') },
- { N_("Musical"), CHR('m','u','s','i') }, /* Only in ff, should be musc */
- { N_("Myanmar"), CHR('m','y','m','r') },
- { N_("New Tai Lue"), CHR('t','a','l','u') },
- { N_("N'Ko"), CHR('n','k','o',' ') },
- { N_("Ogham"), CHR('o','g','a','m') },
- { N_("Ol Chiki"), CHR('o','l','c','k') },
- { N_("Old Italic (Etruscan, Oscan, etc.)"), CHR('i','t','a','l') },
- { N_("Old Permic"), CHR('p','e','r','m') }, /* Only in ff */
- { N_("Old Persian cuneiform"), CHR('x','p','e','o') },
- { N_("Oriya"), CHR('o','r','y','a') },
- { N_("Oriya2"), CHR('o','r','y','2') },
- { N_("Osmanya"), CHR('o','s','m','a') },
- { N_("Pahlavi"), CHR('p','a','l','v') }, /* Only in ff */
- { N_("Phags-pa"), CHR('p','h','a','g') },
- { N_("Phoenician"), CHR('p','h','n','x') },
- { N_("Phaistos"), CHR('p','h','s','t') }, /* Only in ff */
- { N_("Pollard Phonetic"), CHR('p','l','r','d') }, /* Only in ff */
- { N_("Rejang"), CHR('r','j','n','g') },
- { N_("Rongorongo"), CHR('r','o','r','o') }, /* Only in ff */
- { N_("Runic"), CHR('r','u','n','r') },
- { N_("Saurashtra"), CHR('s','a','u','r') },
- { N_("Shavian"), CHR('s','h','a','w') },
- { N_("Sinhala"), CHR('s','i','n','h') },
- { N_("Sumero-Akkadian Cuneiform"), CHR('x','s','u','x') },
- { N_("Sundanese"), CHR('s','u','n','d') },
- { N_("Syloti Nagri"), CHR('s','y','l','o') },
- { N_("Syriac"), CHR('s','y','r','c') },
- { N_("Tagalog"), CHR('t','g','l','g') },
- { N_("Tagbanwa"), CHR('t','a','g','b') },
- { N_("Tai Le"), CHR('t','a','l','e') }, /* Not in ISO 15924 !!!!!, just guessing */
- { N_("Tai Lu"), CHR('t','a','l','a') }, /* Not in ISO 15924 !!!!!, just guessing */
- { N_("Tamil"), CHR('t','a','m','l') },
- { N_("Tamil2"), CHR('t','m','l','2') },
- { N_("Telugu"), CHR('t','e','l','u') },
- { N_("Telugu2"), CHR('t','e','l','2') },
- { N_("Tengwar"), CHR('t','e','n','g') }, /* Only in ff */
- { N_("Thaana"), CHR('t','h','a','a') },
- { N_("Thai"), CHR('t','h','a','i') },
- { N_("Tibetan"), CHR('t','i','b','t') },
- { N_("Tifinagh (Berber)"), CHR('t','f','n','g') },
- { N_("Ugaritic"), CHR('u','g','r','t') }, /* Only in ff, should be ugar */
- { N_("Vai"), CHR('v','a','i',' ') },
-/* { N_("Visible Speech"), CHR('v','i','s','p') },*/
- { N_("Cuneiform, Ugaritic"), CHR('x','u','g','a') }, /* Only in ff */
- { N_("Yi") , CHR('y','i',' ',' ') },
-/* { N_("Private Use Script 1"), CHR('q','a','a','a') },*/
-/* { N_("Private Use Script 2"), CHR('q','a','a','b') },*/
-/* { N_("Undetermined Script"), CHR('z','y','y','y') },*/
-/* { N_("Uncoded Script"), CHR('z','z','z','z') },*/
- { NULL, 0 }
-};
-
-void LookupInit(void) {
- static int done = false;
- int i, j;
-
- if ( done )
-return;
- done = true;
- for ( j=0; j<2; ++j ) {
- for ( i=0; i<10; ++i )
- if ( lookup_type_names[j][i]!=NULL )
- lookup_type_names[j][i] = _((char *) lookup_type_names[j][i]);
- }
- for ( i=0; localscripts[i].text!=NULL; ++i )
- localscripts[i].text = _(localscripts[i].text);
- for ( i=0; friendlies[i].friendlyname!=NULL; ++i )
- friendlies[i].friendlyname = _(friendlies[i].friendlyname);
-}
-
-char *TagFullName(SplineFont *sf,uint32 tag, int onlyifknown) {
- char ubuf[200], *end = ubuf+sizeof(ubuf);
- int k;
-
- unsigned stag = tag;
- if ( tag==CHR('n','u','t','f') ) /* early name that was standardize later as... */
- stag = CHR('a','f','r','c'); /* Stood for nut fractions. "nut" meaning "fits in an en" in old typography-speak => vertical fractions rather than diagonal ones */
- if ( tag==REQUIRED_FEATURE ) {
- strcpy(ubuf,_("Required Feature"));
- } else {
- LookupInit();
- for ( k=0; friendlies[k].tag!=0; ++k ) {
- if ( friendlies[k].tag == stag )
- break;
- }
- ubuf[0] = '\'';
- ubuf[1] = tag>>24;
- ubuf[2] = (tag>>16)&0xff;
- ubuf[3] = (tag>>8)&0xff;
- ubuf[4] = tag&0xff;
- ubuf[5] = '\'';
- ubuf[6] = ' ';
- if ( friendlies[k].tag!=0 )
- strncpy(ubuf+7, (char *) friendlies[k].friendlyname,end-ubuf-7);
- else if ( onlyifknown )
-return( NULL );
- else
- ubuf[7]='\0';
- }
-return( copy( ubuf ));
-}
-
-
-void NameOTLookup(OTLookup *otl,SplineFont *sf) {
- char *userfriendly = NULL, *script;
- FeatureScriptLangList *fl;
- char *lookuptype;
- char *format;
- struct lookup_subtable *subtable;
- int k;
- (void)sf;
-
- LookupInit();
-
- if ( otl->lookup_name==NULL ) {
- for ( k=0; k<2; ++k ) {
-#ifndef LUA_FF_LIB
- for ( fl=otl->features; fl!=NULL ; fl=fl->next ) {
- /* look first for a feature attached to a default language */
- if ( k==1 || DefaultLangTagInScriptList(fl->scripts,false)!=NULL ) {
- userfriendly = TagFullName(sf,fl->featuretag, true);
- if ( userfriendly!=NULL )
- break;
- }
- }
- if ( userfriendly!=NULL )
- break;
-#endif
- }
- if ( userfriendly==NULL ) {
- if ( (otl->lookup_type>>8)<2 && (otl->lookup_type&0xff)<10 )
- lookuptype = _(lookup_type_names[otl->lookup_type>>8][otl->lookup_type&0xff]);
- else
-#ifdef LUA_FF_LIB
- lookuptype = "un";
-#else
- lookuptype = _("Unknown");
-#endif
- for ( fl=otl->features; fl!=NULL; fl=fl->next );
- if ( fl==NULL )
- userfriendly = copy(lookuptype);
- else {
- userfriendly = galloc( strlen(lookuptype) + 40);
-#ifdef LUA_FF_LIB
- if ( (otl->lookup_type&0xff)>= 0xf0 ) {
- sprintf( userfriendly, "%s_<%d,%d>", lookuptype,
- (fl->featuretag>>16), (fl->featuretag&0xffff));
- } else {
- sprintf( userfriendly, "%s_%c%c%c%c", lookuptype,
- fl->featuretag>>24,
- fl->featuretag>>16,
- fl->featuretag>>8 ,
- fl->featuretag );
- }
-#else
- sprintf( userfriendly, "%s '%c%c%c%c'", lookuptype,
- fl->featuretag>>24,
- fl->featuretag>>16,
- fl->featuretag>>8 ,
- fl->featuretag );
-#endif
- }
- }
- script = NULL;
- if ( fl==NULL ) fl = otl->features;
- if ( fl!=NULL && fl->scripts!=NULL ) {
- char buf[8];
- int j;
- struct scriptlanglist *sl, *found, *found2;
- uint32 script_tag = fl->scripts->script;
- found = found2 = NULL;
- for ( sl = fl->scripts; sl!=NULL; sl=sl->next ) {
- if ( sl->script == DEFAULT_SCRIPT )
- /* Ignore it */;
- else if ( DefaultLangTagInOneScriptList(sl)) {
- if ( found==NULL )
- found = sl;
- else {
- found = found2 = NULL;
- break;
- }
- } else if ( found2 == NULL )
- found2 = sl;
- else
- found2 = (struct scriptlanglist *) -1;
- }
- if ( found==NULL && found2!=NULL && found2 != (struct scriptlanglist *) -1 )
- found = found2;
- if ( found!=NULL ) {
- script_tag = found->script;
- for ( j=0; localscripts[j].text!=NULL && script_tag!=localscripts[j].tag; ++j ) {;}
-#ifdef LUA_FF_LIB
- buf[0] = fl->scripts->script>>24;
- buf[1] = (fl->scripts->script>>16)&0xff;
- buf[2] = (fl->scripts->script>>8)&0xff;
- buf[3] = fl->scripts->script&0xff;
- buf[4] = 0;
- script = copy(buf);
-#else
- if ( localscripts[j].text!=NULL )
- script = copy( _((char *) localscripts[j].text) );
- else {
- buf[0] = '\'';
- buf[1] = fl->scripts->script>>24;
- buf[2] = (fl->scripts->script>>16)&0xff;
- buf[3] = (fl->scripts->script>>8)&0xff;
- buf[4] = fl->scripts->script&0xff;
- buf[5] = '\'';
- buf[6] = 0;
- script = copy(buf);
- }
-#endif
- }
- }
- if ( script!=NULL ) {
-/* GT: This string is used to generate a name for each OpenType lookup. */
-/* GT: The %s will be filled with the user friendly name of the feature used to invoke the lookup */
-/* GT: The second %s (if present) is the script */
-/* GT: While the %d is the index into the lookup list and is used to disambiguate it */
-/* GT: In case that is needed */
-#ifdef LUA_FF_LIB
- format = "%s_%s_l_%d";
-#else
- format = _("%s in %s lookup %d");
-#endif
- otl->lookup_name = galloc( strlen(userfriendly)+strlen(format)+strlen(script)+10 );
- sprintf( otl->lookup_name, format, userfriendly, script, otl->lookup_index );
- } else {
-#ifdef LUA_FF_LIB
- format = "%s_l_%d";
-#else
- format = _("%s lookup %d");
-#endif
- otl->lookup_name = galloc( strlen(userfriendly)+strlen(format)+10 );
- sprintf( otl->lookup_name, format, userfriendly, otl->lookup_index );
- }
- free(script);
- free(userfriendly);
- }
-
- if ( otl->subtables==NULL )
- /* IError( _("Lookup with no subtables"))*/;
- else {
- int cnt = 0;
- for ( subtable = otl->subtables; subtable!=NULL; subtable=subtable->next, ++cnt )
- if ( subtable->subtable_name==NULL ) {
- if ( subtable==otl->subtables && subtable->next==NULL )
-/* GT: This string is used to generate a name for an OpenType lookup subtable. */
-/* GT: %s is the lookup name */
-#ifdef LUA_FF_LIB
- format = "%s_s";
-#else
- format = _("%s subtable");
-#endif
- else if ( subtable->per_glyph_pst_or_kern )
-/* GT: This string is used to generate a name for an OpenType lookup subtable. */
-/* GT: %s is the lookup name, %d is the index of the subtable in the lookup */
-#ifdef LUA_FF_LIB
- format = "%s_g_%d";
-#else
- format = _("%s per glyph data %d");
-#endif
- else if ( subtable->kc!=NULL )
-#ifdef LUA_FF_LIB
- format = "%s_k_%d";
-#else
- format = _("%s kerning class %d");
-#endif
- else if ( subtable->fpst!=NULL )
-#ifdef LUA_FF_LIB
- format = "%s_c_%d";
-#else
- format = _("%s contextual %d");
-#endif
- else if ( subtable->anchor_classes )
-#ifdef LUA_FF_LIB
- format = "%s_a_%d";
-#else
- format = _("%s anchor %d");
-#endif
- else {
- IError("Subtable status not filled in for %dth subtable of %s", cnt, otl->lookup_name );
- format = "%s !!!!!!!! %d";
- }
- subtable->subtable_name = galloc( strlen(otl->lookup_name)+strlen(format)+10 );
- sprintf( subtable->subtable_name, format, otl->lookup_name, cnt );
- }
- }
- if ( otl->lookup_type==gsub_ligature ) {
- for ( fl=otl->features; fl!=NULL; fl=fl->next )
- if ( fl->featuretag==CHR('l','i','g','a') || fl->featuretag==CHR('r','l','i','g'))
- otl->store_in_afm = true;
- }
-
- if ( otl->lookup_type==gsub_single )
- for ( subtable = otl->subtables; subtable!=NULL; subtable=subtable->next )
- subtable->suffix = SuffixFromTags(otl->features);
-}
-
-static void LangOrder(struct scriptlanglist *sl) {
- int i,j;
- uint32 lang, lang2;
-
- for ( i=0; i<sl->lang_cnt; ++i ) {
- lang = i<MAX_LANG ? sl->langs[i] : sl->morelangs[i-MAX_LANG];
- for ( j=i+1; j<sl->lang_cnt; ++j ) {
- lang2 = j<MAX_LANG ? sl->langs[j] : sl->morelangs[j-MAX_LANG];
- if ( lang>lang2 ) {
- if ( i<MAX_LANG )
- sl->langs[i] = lang2;
- else
- sl->morelangs[i-MAX_LANG] = lang2;
- if ( j<MAX_LANG )
- sl->langs[j] = lang;
- else
- sl->morelangs[j-MAX_LANG] = lang;
- lang = lang2;
- }
- }
- }
-}
-
-static struct scriptlanglist *SLOrder(struct scriptlanglist *sl) {
- int i,j, cnt;
- struct scriptlanglist *sl2, *space[30], **allocked=NULL, **test = space;
-
- for ( sl2=sl, cnt=0; sl2!=NULL; sl2=sl2->next, ++cnt )
- LangOrder(sl2);
- if ( cnt<=1 )
-return( sl );
- if ( cnt>30 )
- test = allocked = galloc(cnt*sizeof(struct scriptlanglist *));
- for ( sl2=sl, cnt=0; sl2!=NULL; sl2=sl2->next, ++cnt )
- test[cnt] = sl2;
- for ( i=0; i<cnt; ++i ) for ( j=i+1; j<cnt; ++j ) {
- if ( test[i]->script > test[j]->script ) {
- struct scriptlanglist *temp;
- temp = test[i];
- test[i] = test[j];
- test[j] = temp;
- }
- }
- sl = test[0];
- for ( i=1; i<cnt; ++i )
- test[i-1]->next = test[i];
- test[i-1]->next = NULL;
- free( allocked );
-return( sl );
-}
-
-FeatureScriptLangList *FLOrder(FeatureScriptLangList *fl) {
- int i,j, cnt;
- FeatureScriptLangList *fl2, *space[30], **allocked=NULL, **test = space;
-
- for ( fl2=fl, cnt=0; fl2!=NULL; fl2=fl2->next, ++cnt )
- fl2->scripts = SLOrder(fl2->scripts);
- if ( cnt<=1 )
-return( fl );
- if ( cnt>30 )
- test = allocked = galloc(cnt*sizeof(FeatureScriptLangList *));
- for ( fl2=fl, cnt=0; fl2!=NULL; fl2=fl2->next, ++cnt )
- test[cnt] = fl2;
- for ( i=0; i<cnt; ++i ) for ( j=i+1; j<cnt; ++j ) {
- if ( test[i]->featuretag > test[j]->featuretag ) {
- FeatureScriptLangList *temp;
- temp = test[i];
- test[i] = test[j];
- test[j] = temp;
- }
- }
- fl = test[0];
- for ( i=1; i<cnt; ++i )
- test[i-1]->next = test[i];
- test[i-1]->next = NULL;
- free( allocked );
-return( fl );
-}
-
-struct scriptlanglist *SLCopy(struct scriptlanglist *sl) {
- struct scriptlanglist *newsl;
-
- newsl = chunkalloc(sizeof(struct scriptlanglist));
- *newsl = *sl;
- newsl->next = NULL;
-
- if ( sl->lang_cnt>MAX_LANG ) {
- newsl->morelangs = galloc((newsl->lang_cnt-MAX_LANG)*sizeof(uint32));
- memcpy(newsl->morelangs,sl->morelangs,(newsl->lang_cnt-MAX_LANG)*sizeof(uint32));
- }
-return( newsl );
-}
-
-struct scriptlanglist *SListCopy(struct scriptlanglist *sl) {
- struct scriptlanglist *head=NULL, *last=NULL, *cur;
-
- for ( ; sl!=NULL; sl=sl->next ) {
- cur = SLCopy(sl);
- if ( head==NULL )
- head = cur;
- else
- last->next = cur;
- last = cur;
- }
-return( head );
-}
-
-FeatureScriptLangList *FeatureListCopy(FeatureScriptLangList *fl) {
- FeatureScriptLangList *newfl;
-
- if ( fl==NULL )
-return( NULL );
-
- newfl = chunkalloc(sizeof(FeatureScriptLangList));
- *newfl = *fl;
- newfl->next = NULL;
-
- newfl->scripts = SListCopy(fl->scripts);
-return( newfl );
-}
-
-static void LangMerge(struct scriptlanglist *into, struct scriptlanglist *from) {
- int i,j;
- uint32 flang, tlang;
-
- for ( i=0 ; i<from->lang_cnt; ++i ) {
- flang = i<MAX_LANG ? from->langs[i] : from->morelangs[i-MAX_LANG];
- for ( j=0; j<into->lang_cnt; ++j ) {
- tlang = j<MAX_LANG ? into->langs[j] : into->morelangs[j-MAX_LANG];
- if ( tlang==flang )
- break;
- }
- if ( j==into->lang_cnt ) {
- if ( into->lang_cnt<MAX_LANG )
- into->langs[into->lang_cnt++] = flang;
- else {
- into->morelangs = grealloc(into->morelangs,(into->lang_cnt+1-MAX_LANG)*sizeof(uint32));
- into->morelangs[into->lang_cnt++-MAX_LANG] = flang;
- }
- }
- }
-}
-
-void SLMerge(FeatureScriptLangList *into, struct scriptlanglist *fsl) {
- struct scriptlanglist *isl;
-
- for ( ; fsl!=NULL; fsl = fsl->next ) {
- for ( isl=into->scripts; isl!=NULL; isl=isl->next ) {
- if ( fsl->script==isl->script )
- break;
- }
- if ( isl!=NULL )
- LangMerge(isl,fsl);
- else {
- isl = SLCopy(fsl);
- isl->next = into->scripts;
- into->scripts = isl;
- }
- }
-}
-
-void FLMerge(OTLookup *into, OTLookup *from) {
- /* Merge the feature list from "from" into "into" */
- FeatureScriptLangList *ifl, *ffl;
-
- /* first check for common featuretags and merge the scripts of each */
- for ( ffl = from->features; ffl!=NULL; ffl = ffl->next ) {
- for ( ifl=into->features; ifl!=NULL; ifl=ifl->next ) {
- if ( ffl->featuretag==ifl->featuretag )
- break;
- }
- if ( ifl!=NULL )
- SLMerge(ffl,ifl->scripts);
- else {
- ifl = FeatureListCopy(ffl);
- ifl->next = into->features;
- into->features = ifl;
- }
- }
- into->features = FLOrder(into->features);
-}
-
-void SFSubTablesMerge(SplineFont *_sf,struct lookup_subtable *subfirst,
- struct lookup_subtable *subsecond) {
- unsigned lookup_type = subfirst->lookup->lookup_type;
- int gid,k,isv;
- SplineChar *sc;
- SplineFont *sf = _sf;
- PST *pst, *fpst, *spst, *pstprev, *pstnext;
- KernPair *fkp, *skp, *kpprev, *kpnext;
- AnchorClass *ac;
-
- if ( lookup_type != subsecond->lookup->lookup_type ) {
- IError("Attempt to merge lookup subtables with mismatch types");
-return;
- }
- if ( lookup_type != gsub_single &&
- lookup_type != gsub_multiple &&
- lookup_type != gsub_alternate &&
- lookup_type != gsub_ligature &&
- lookup_type != gpos_single &&
- lookup_type != gpos_pair &&
- lookup_type != gpos_cursive &&
- lookup_type != gpos_mark2base &&
- lookup_type != gpos_mark2ligature &&
- lookup_type != gpos_mark2mark ) {
- IError("Attempt to merge lookup subtables with bad types");
-return;
- } else if ( subfirst->kc!=NULL || subsecond->kc != NULL ) {
- IError("Attempt to merge lookup subtables with kerning classes");
-return;
- }
-
- if ( lookup_type==gpos_cursive || lookup_type==gpos_mark2base ||
- lookup_type==gpos_mark2ligature || lookup_type==gpos_mark2mark ) {
- for ( ac = sf->anchor; ac!=NULL ; ac=ac->next )
- if ( ac->subtable == subsecond )
- ac->subtable = subfirst;
- } else {
- k=0;
- do {
- sf = _sf->subfontcnt==0 ? _sf : _sf->subfonts[k];
- for ( gid=0; gid<sf->glyphcnt; ++gid ) if ( (sc=sf->glyphs[gid])!=NULL ) {
- if ( lookup_type==gsub_single || lookup_type==gsub_multiple ||
- lookup_type==gsub_alternate || lookup_type==gpos_single ) {
- fpst = spst = NULL;
- for ( pst=sc->possub; pst!=NULL; pst=pst->next ) {
- if ( pst->subtable == subfirst ) {
- fpst = pst;
- if ( spst!=NULL )
- break;
- } else if ( pst->subtable == subsecond ) {
- spst = pst;
- if ( fpst!=NULL )
- break;
- }
- }
- if ( fpst==NULL && spst!=NULL )
- spst->subtable = subfirst;
- else if ( spst!=NULL ) {
- LogError(_("The glyph, %s, contains a %s from %s and one from %s.\nThe one from %s will be removed.\n"),
- sc->name,
- lookup_type==gpos_single ? _("positioning") : _("substitution"),
- subfirst->subtable_name, subsecond->subtable_name,
- subsecond->subtable_name );
- pstprev = NULL;
- for ( pst=sc->possub; pst!=NULL && pst!=spst; pstprev=pst, pst=pst->next );
- if ( pstprev==NULL )
- sc->possub = spst->next;
- else
- pstprev = spst->next;
- spst->next = NULL;
- PSTFree(spst);
- }
- } else if ( lookup_type==gsub_ligature || lookup_type==gpos_pair ) {
- pstprev = NULL;
- for ( spst=sc->possub; spst!=NULL ; spst = pstnext ) {
- pstnext = spst->next;
- if ( spst->subtable == subsecond ) {
- for ( fpst=sc->possub; fpst!=NULL; fpst=fpst->next ) {
- if ( fpst->subtable == subfirst &&
- strcmp(fpst->u.lig.components,spst->u.lig.components)==0 )
- break;
- }
- if ( fpst==NULL )
- spst->subtable = subfirst;
- else {
- LogError(_("The glyph, %s, contains the same %s from %s and from %s.\nThe one from %s will be removed.\n"),
- sc->name,
- lookup_type==gsub_ligature ? _("ligature") : _("kern pair"),
- subfirst->subtable_name, subsecond->subtable_name,
- subsecond->subtable_name );
- if ( pstprev==NULL )
- sc->possub = pstnext;
- else
- pstprev->next = pstnext;
- spst->next = NULL;
- PSTFree(spst);
- spst = pstprev;
- }
- }
- pstprev = spst;
- }
- for ( isv=0; isv<2; ++isv ) {
- kpprev = NULL;
- for ( skp=isv ? sc->vkerns : sc->kerns; skp!=NULL ; skp = kpnext ) {
- kpnext = skp->next;
- if ( skp->subtable == subsecond ) {
- for ( fkp=isv ? sc->vkerns : sc->kerns; fkp!=NULL; fkp=fkp->next ) {
- if ( fkp->subtable == subfirst && fkp->sc==skp->sc )
- break;
- }
- if ( fkp==NULL )
- skp->subtable = subfirst;
- else {
- LogError(_("The glyph, %s, contains the same kern pair from %s and from %s.\nThe one from %s will be removed.\n"),
- sc->name,
- subfirst->subtable_name, subsecond->subtable_name,
- subsecond->subtable_name );
- if ( kpprev!=NULL )
- kpprev->next = kpnext;
- else if ( isv )
- sc->vkerns = kpnext;
- else
- sc->kerns = kpnext;
- skp->next = NULL;
- KernPairsFree(skp);
- skp = kpprev;
- }
- }
- kpprev = skp;
- }
- }
- }
- }
- ++k;
- } while ( k<_sf->subfontcnt );
- }
-}
-
-/* ************************************************************************** */
-/* ******************************* copy lookup ****************************** */
-/* ************************************************************************** */
-
-static char **ClassCopy(int class_cnt,char **classes) {
- char **newclasses;
- int i;
-
- if ( classes==NULL || class_cnt==0 )
-return( NULL );
- newclasses = galloc(class_cnt*sizeof(char *));
- for ( i=0; i<class_cnt; ++i )
- newclasses[i] = copy(classes[i]);
-return( newclasses );
-}
-
-static OTLookup *_OTLookupCopyInto(struct sfmergecontext *mc,
- OTLookup *from_otl, OTLookup *before, int do_contents);
-static OTLookup *OTLookupCopyNested(struct sfmergecontext *mc,
- OTLookup *from_otl) {
- char *newname;
- OTLookup *to_nested_otl;
- int l;
-
- if ( from_otl==NULL )
-return( NULL );
-
- for ( l=0; l<mc->lcnt; ++l ) {
- if ( mc->lks[l].from == from_otl )
-return( mc->lks[l].to );
- }
-
- newname = strconcat(mc->prefix,from_otl->lookup_name);
- to_nested_otl = SFFindLookup(mc->sf_to,newname);
- free(newname);
- if ( to_nested_otl==NULL )
- to_nested_otl = _OTLookupCopyInto(mc, from_otl, (OTLookup *) -1, true );
-return( to_nested_otl );
-}
-
-static KernClass *SF_AddKernClass(struct sfmergecontext *mc,KernClass *kc,
- struct lookup_subtable *sub ) {
- KernClass *newkc;
-
- newkc = chunkalloc(sizeof(KernClass));
- *newkc = *kc;
- newkc->subtable = sub;
- if ( sub->vertical_kerning ) {
- newkc->next = mc->sf_to->vkerns;
- mc->sf_to->vkerns = newkc;
- } else {
- newkc->next = mc->sf_to->kerns;
- mc->sf_to->kerns = newkc;
- }
-
- newkc->firsts = ClassCopy(newkc->first_cnt,newkc->firsts);
- newkc->seconds = ClassCopy(newkc->second_cnt,newkc->seconds);
- newkc->offsets = galloc(newkc->first_cnt*newkc->second_cnt*sizeof(int16));
- memcpy(newkc->offsets,kc->offsets,newkc->first_cnt*newkc->second_cnt*sizeof(int16));
-return( newkc );
-}
-
-static FPST *SF_AddFPST(struct sfmergecontext *mc,FPST *fpst,
- struct lookup_subtable *sub ) {
- FPST *newfpst;
- int i, k, cur;
-
- newfpst = chunkalloc(sizeof(FPST));
- *newfpst = *fpst;
- newfpst->subtable = sub;
- newfpst->next = mc->sf_to->possub;
- mc->sf_to->possub = newfpst;
-
- newfpst->nclass = ClassCopy(newfpst->nccnt,newfpst->nclass);
- newfpst->bclass = ClassCopy(newfpst->bccnt,newfpst->bclass);
- newfpst->fclass = ClassCopy(newfpst->fccnt,newfpst->fclass);
-
- newfpst->rules = galloc(newfpst->rule_cnt*sizeof(struct fpst_rule));
- memcpy(newfpst->rules,fpst->rules,newfpst->rule_cnt*sizeof(struct fpst_rule));
-
- cur = 0;
- for ( i=0; i<newfpst->rule_cnt; ++i ) {
- struct fpst_rule *r = &newfpst->rules[i], *oldr = &fpst->rules[i];
-
- r->lookups = galloc(r->lookup_cnt*sizeof(struct seqlookup));
- memcpy(r->lookups,oldr->lookups,r->lookup_cnt*sizeof(struct seqlookup));
- for ( k=0; k<r->lookup_cnt; ++k ) {
- r->lookups[k].lookup = OTLookupCopyNested(mc,
- r->lookups[k].lookup);
- }
-
- switch ( newfpst->format ) {
- case pst_glyphs:
- r->u.glyph.names = copy( r->u.glyph.names );
- r->u.glyph.back = copy( r->u.glyph.back );
- r->u.glyph.fore = copy( r->u.glyph.fore );
- break;
- case pst_class:
- r->u.class.nclasses = galloc( r->u.class.ncnt*sizeof(uint16));
- memcpy(r->u.class.nclasses,oldr->u.class.nclasses, r->u.class.ncnt*sizeof(uint16));
- r->u.class.bclasses = galloc( r->u.class.bcnt*sizeof(uint16));
- memcpy(r->u.class.bclasses,oldr->u.class.bclasses, r->u.class.ncnt*sizeof(uint16));
- r->u.class.fclasses = galloc( r->u.class.fcnt*sizeof(uint16));
- memcpy(r->u.class.fclasses,oldr->u.class.fclasses, r->u.class.fcnt*sizeof(uint16));
- break;
- case pst_coverage:
- r->u.coverage.ncovers = ClassCopy( r->u.coverage.ncnt, r->u.coverage.ncovers );
- r->u.coverage.bcovers = ClassCopy( r->u.coverage.bcnt, r->u.coverage.bcovers );
- r->u.coverage.fcovers = ClassCopy( r->u.coverage.fcnt, r->u.coverage.fcovers );
- break;
- case pst_reversecoverage:
- r->u.rcoverage.ncovers = ClassCopy( r->u.rcoverage.always1, r->u.rcoverage.ncovers );
- r->u.rcoverage.bcovers = ClassCopy( r->u.rcoverage.bcnt, r->u.rcoverage.bcovers );
- r->u.rcoverage.fcovers = ClassCopy( r->u.rcoverage.fcnt, r->u.rcoverage.fcovers );
- r->u.rcoverage.replacements = copy( r->u.rcoverage.replacements );
- break;
- }
- }
-return( newfpst );
-}
-
-static SplineChar *SCFindOrMake(SplineFont *into,SplineChar *fromsc) {
- int to_index;
-
- if ( into->cidmaster==NULL && into->fv!=NULL ) {
- to_index = SFFindSlot(into,into->fv->map,fromsc->unicodeenc,fromsc->name);
- if ( to_index==-1 )
-return( NULL );
-return( SFMakeChar(into,into->fv->map,to_index));
- }
-return( SFGetChar(into,fromsc->unicodeenc,fromsc->name));
-}
-
-static void SF_SCAddAP(SplineChar *tosc,AnchorPoint *ap, AnchorClass *newac) {
- AnchorPoint *newap;
-
- newap = chunkalloc(sizeof(AnchorPoint));
- *newap = *ap;
- newap->anchor = newac;
- newap->next = tosc->anchor;
- tosc->anchor = newap;
-}
-
-static void SF_AddAnchorClasses(struct sfmergecontext *mc,
- struct lookup_subtable *from_sub, struct lookup_subtable *sub ) {
- AnchorClass *ac, *nac;
- int k, gid;
- SplineFont *fsf;
- AnchorPoint *ap;
- SplineChar *fsc, *tsc;
-
- for ( ac=mc->sf_from->anchor; ac!=NULL; ac=ac->next ) if ( ac->subtable==from_sub ) {
- nac = chunkalloc(sizeof(AnchorClass));
- *nac = *ac;
- nac->subtable = sub;
- nac->name = strconcat(mc->prefix,nac->name);
- nac->next = mc->sf_to->anchor;
- mc->sf_to->anchor = nac;
-
- k=0;
- do {
- fsf = mc->sf_from->subfontcnt==0 ? mc->sf_from : mc->sf_from->subfonts[k];
- for ( gid = 0; gid<fsf->glyphcnt; ++gid ) if ( (fsc = fsf->glyphs[gid])!=NULL ) {
- for ( ap=fsc->anchor; ap!=NULL; ap=ap->next ) {
- if ( ap->anchor==ac ) {
- tsc = SCFindOrMake(mc->sf_to,fsc);
- if ( tsc==NULL )
- break;
- SF_SCAddAP(tsc,ap,nac);
- }
- }
- }
- ++k;
- } while ( k<mc->sf_from->subfontcnt );
- }
-}
-
-static int SF_SCAddPST(SplineChar *tosc,PST *pst,struct lookup_subtable *sub) {
- PST *newpst;
-
- newpst = chunkalloc(sizeof(PST));
- *newpst = *pst;
- newpst->subtable = sub;
- newpst->next = tosc->possub;
- tosc->possub = newpst;
-
- switch( newpst->type ) {
- case pst_pair:
- newpst->u.pair.paired = copy(pst->u.pair.paired);
- newpst->u.pair.vr = chunkalloc(sizeof(struct vr [2]));
- memcpy(newpst->u.pair.vr,pst->u.pair.vr,sizeof(struct vr [2]));
- break;
- case pst_ligature:
- newpst->u.lig.lig = tosc;
- /* Fall through */
- case pst_substitution:
- case pst_alternate:
- case pst_multiple:
- newpst->u.subs.variant = copy(pst->u.subs.variant);
- break;
- }
-return( true );
-}
-
-static int SF_SCAddKP(SplineChar *tosc,KernPair *kp,struct lookup_subtable *sub,
- int isvkern, SplineFont *to_sf ) {
- SplineChar *tosecond;
- KernPair *newkp;
-
- tosecond = SFGetChar(to_sf,kp->sc->unicodeenc,kp->sc->name);
- if ( tosecond==NULL )
-return( false );
-
- newkp = chunkalloc(sizeof(KernPair));
- *newkp = *kp;
- newkp->subtable = sub;
- newkp->sc = tosecond;
- if ( isvkern ) {
- newkp->next = tosc->vkerns;
- tosc->vkerns = newkp;
- } else {
- newkp->next = tosc->kerns;
- tosc->kerns = newkp;
- }
-return(true);
-}
-
-static void SF_AddPSTKern(struct sfmergecontext *mc,struct lookup_subtable *from_sub, struct lookup_subtable *sub) {
- int k, gid, isv;
- SplineFont *fsf;
- SplineChar *fsc, *tsc;
- PST *pst;
- KernPair *kp;
- int iskern = sub->lookup->lookup_type==gpos_pair;
-
- k=0;
- do {
- fsf = mc->sf_from->subfontcnt==0 ? mc->sf_from : mc->sf_from->subfonts[k];
- for ( gid = 0; gid<fsf->glyphcnt; ++gid ) if ( (fsc = fsf->glyphs[gid])!=NULL ) {
- tsc = (SplineChar *) -1;
- for ( pst = fsc->possub; pst!=NULL; pst=pst->next ) {
- if ( pst->subtable==from_sub ) {
- if ( tsc==(SplineChar *) -1 ) {
- tsc = SCFindOrMake(mc->sf_to,fsc);
- if ( tsc==NULL )
- break;
- }
- SF_SCAddPST(tsc,pst,sub);
- }
- }
- if ( tsc!=NULL && iskern ) {
- for ( isv=0; isv<2 && tsc!=NULL; ++isv ) {
- for ( kp= isv ? fsc->vkerns : fsc->kerns; kp!=NULL; kp=kp->next ) {
- if ( kp->subtable==sub ) {
- /* Kerning data tend to be individualistic. Only copy if */
- /* glyphs exist */
- if ( tsc==(SplineChar *) -1 ) {
- tsc = SFGetChar(mc->sf_to,fsc->unicodeenc,fsc->name);
- if ( tsc==NULL )
- break;
- }
- SF_SCAddKP(tsc,kp,sub,isv,mc->sf_to);
- }
- }
- }
- }
- }
- ++k;
- } while ( k<mc->sf_from->subfontcnt );
-}
-
-int _FeatureOrderId( int isgpos,uint32 tag ) {
- /* This is the order in which features should be executed */
-
- if ( !isgpos ) switch ( tag ) {
-/* GSUB ordering */
- case CHR('c','c','m','p'): /* Must be first? */
-return( -2 );
- case CHR('l','o','c','l'): /* Language dependent letter forms (serbian uses some different glyphs than russian) */
-return( -1 );
- case CHR('i','s','o','l'):
-return( 0 );
- case CHR('j','a','l','t'): /* must come after 'isol' */
-return( 1 );
- case CHR('f','i','n','a'):
-return( 2 );
- case CHR('f','i','n','2'):
- case CHR('f','a','l','t'): /* must come after 'fina' */
-return( 3 );
- case CHR('f','i','n','3'):
-return( 4 );
- case CHR('m','e','d','i'):
-return( 5 );
- case CHR('m','e','d','2'):
-return( 6 );
- case CHR('i','n','i','t'):
-return( 7 );
-
- case CHR('r','t','l','a'):
-return( 100 );
- case CHR('s','m','c','p'): case CHR('c','2','s','c'):
-return( 200 );
-
- case CHR('r','l','i','g'):
-return( 300 );
- case CHR('c','a','l','t'):
-return( 301 );
- case CHR('l','i','g','a'):
-return( 302 );
- case CHR('d','l','i','g'): case CHR('h','l','i','g'):
-return( 303 );
- case CHR('c','s','w','h'):
-return( 304 );
- case CHR('m','s','e','t'):
-return( 305 );
-
- case CHR('f','r','a','c'):
-return( 306 );
-
-/* Indic processing */
- case CHR('n','u','k','t'):
- case CHR('p','r','e','f'):
-return( 301 );
- case CHR('a','k','h','n'):
-return( 302 );
- case CHR('r','p','h','f'):
-return( 303 );
- case CHR('b','l','w','f'):
-return( 304 );
- case CHR('h','a','l','f'):
- case CHR('a','b','v','f'):
-return( 305 );
- case CHR('p','s','t','f'):
-return( 306 );
- case CHR('v','a','t','u'):
-return( 307 );
-
- case CHR('p','r','e','s'):
-return( 310 );
- case CHR('b','l','w','s'):
-return( 311 );
- case CHR('a','b','v','s'):
-return( 312 );
- case CHR('p','s','t','s'):
-return( 313 );
- case CHR('c','l','i','g'):
-return( 314 );
-
- case CHR('h','a','l','n'):
-return( 320 );
-/* end indic ordering */
-
- case CHR('a','f','r','c'):
- case CHR('l','j','m','o'):
- case CHR('v','j','m','o'):
-return( 350 );
- case CHR('v','r','t','2'): case CHR('v','e','r','t'):
-return( 1010 ); /* Documented to come last */
-
-/* Unknown things come after everything but vert/vrt2 */
- default:
-return( 1000 );
-
- } else switch ( tag ) {
-/* GPOS ordering */
- case CHR('c','u','r','s'):
-return( 0 );
- case CHR('d','i','s','t'):
-return( 100 );
- case CHR('b','l','w','m'):
-return( 201 );
- case CHR('a','b','v','m'):
-return( 202 );
- case CHR('k','e','r','n'):
-return( 300 );
- case CHR('m','a','r','k'):
-return( 400 );
- case CHR('m','k','m','k'):
-return( 500 );
-/* Unknown things come after everything */
- default:
-return( 1000 );
- }
-}
-
-int FeatureOrderId( int isgpos,FeatureScriptLangList *fl ) {
- int pos = 9999, temp;
-
- if ( fl==NULL )
-return( 0 );
-
- while ( fl!=NULL ) {
- temp = _FeatureOrderId(isgpos,fl->featuretag );
- if ( temp<pos ) pos = temp;
- fl = fl->next;
- }
-return( pos );
-}
-
-void SortInsertLookup(SplineFont *sf, OTLookup *newotl) {
- int isgpos = newotl->lookup_type>=gpos_start;
- int pos;
- OTLookup *prev, *otl;
-
- pos = FeatureOrderId(isgpos,newotl->features);
- for ( prev=NULL, otl= isgpos ? sf->gpos_lookups : sf->gsub_lookups ;
- otl!=NULL && FeatureOrderId(isgpos,newotl->features)<pos;
- prev = otl, otl=otl->next );
- newotl->next = otl;
- if ( prev!=NULL )
- prev->next = newotl;
- else if ( isgpos )
- sf->gpos_lookups = newotl;
- else
- sf->gsub_lookups = newotl;
-}
-
-/* Before may be:
- * A lookup in into_sf, in which case insert new lookup before it
- * NULL , in which case insert new lookup at end
- * -1 , in which case insert new lookup at start
- * -2 , try to guess a good position
-*/
-static void OrderNewLookup(SplineFont *into_sf,OTLookup *otl,OTLookup *before) {
- int isgpos = otl->lookup_type>=gpos_start;
- OTLookup **head = isgpos ? &into_sf->gpos_lookups : &into_sf->gsub_lookups;
- OTLookup *prev;
-
- if ( before == (OTLookup *) -2 )
- SortInsertLookup(into_sf,otl);
- else if ( before == (OTLookup *) -1 || *head==NULL || *head==before ) {
- otl->next = *head;
- *head = otl;
- } else {
- for ( prev= *head; prev->next!=NULL && prev->next!=before ; prev=prev->next );
- otl->next = prev->next;
- prev->next = otl;
- }
-}
-
-static OTLookup *_OTLookupCopyInto(struct sfmergecontext *mc,
- OTLookup *from_otl, OTLookup *before, int do_contents) {
- OTLookup *otl;
- struct lookup_subtable *sub, *last, *from_sub;
- int scnt, l;
-
- for ( l=0; l<mc->lcnt; ++l ) {
- if ( mc->lks[l].from == from_otl ) {
- if ( mc->lks[l].old )
-return( mc->lks[l].to );
- else
- break;
- }
- }
-
- if ( l>=mc->lmax )
- mc->lks = grealloc(mc->lks,(mc->lmax += 20)*sizeof(struct lookup_cvt));
- mc->sf_to->changed = true;
-
- if ( l>=mc->lcnt ) {
- otl = chunkalloc(sizeof(OTLookup));
- *otl = *from_otl;
- memset(&mc->lks[l],0,sizeof(mc->lks[l]));
- mc->lks[l].from = from_otl; mc->lks[l].to = otl; ++mc->lcnt;
- otl->lookup_name = strconcat(mc->prefix,from_otl->lookup_name);
- otl->features = FeatureListCopy(from_otl->features);
- otl->next = NULL; otl->subtables = NULL;
- OrderNewLookup(mc->sf_to,otl,before);
- if ( !do_contents )
- FIOTLookupCopyInto(mc->sf_to,mc->sf_from, from_otl, otl, 0, before);
- } else
- otl = mc->lks[l].to;
- if ( !do_contents )
-return( otl );
-
- last = NULL;
- scnt = 0;
- for ( from_sub = from_otl->subtables; from_sub!=NULL; from_sub=from_sub->next ) {
- sub = chunkalloc(sizeof(struct lookup_subtable));
- *sub = *from_sub;
- sub->lookup = otl;
- sub->subtable_name = strconcat(mc->prefix,from_sub->subtable_name);
- sub->suffix = copy(sub->suffix);
- if ( last==NULL )
- otl->subtables = sub;
- else
- last->next = sub;
- last = sub;
- if ( from_sub->kc!=NULL )
- sub->kc = SF_AddKernClass(mc, from_sub->kc, sub);
- else if ( from_sub->fpst!=NULL )
- sub->fpst = SF_AddFPST(mc, from_sub->fpst, sub);
- else if ( from_sub->anchor_classes )
- SF_AddAnchorClasses(mc, from_sub, sub);
- else
- SF_AddPSTKern(mc, from_sub, sub);
- ++scnt;
- }
- FIOTLookupCopyInto(mc->sf_to,mc->sf_from, from_otl, otl, scnt, before);
-return( otl );
-}
-
-static int NeedsPrefix(SplineFont *into_sf,SplineFont *from_sf, OTLookup **list) {
- struct lookup_subtable *from_sub;
- int i,j,k;
- OTLookup *sublist[2];
-
- sublist[1] = NULL;
-
- if ( list==NULL || list[0]==NULL )
-return( false );
- for ( k=0; list[k]!=NULL; ++k ) {
- OTLookup *from_otl = list[k];
- if ( SFFindLookup(into_sf,from_otl->lookup_name)!=NULL )
-return( true );
- for ( from_sub = from_otl->subtables; from_sub!=NULL; from_sub=from_sub->next ) {
- if ( from_sub->fpst!=NULL ) {
- for ( i=0; i<from_sub->fpst->rule_cnt; ++i ) {
- struct fpst_rule *r = &from_sub->fpst->rules[i];
- for ( j=0; j<r->lookup_cnt; ++j ) {
- sublist[0] = r->lookups[j].lookup;
- if ( NeedsPrefix(into_sf,from_sf, sublist))
-return( true );
- }
- }
- }
- }
- }
-return( false );
-}
-
-OTLookup *OTLookupCopyInto(SplineFont *into_sf,SplineFont *from_sf, OTLookup *from_otl) {
- OTLookup *newotl, *list[2];
- struct sfmergecontext mc;
-
- memset(&mc,0,sizeof(mc));
- mc.sf_from = from_sf; mc.sf_to = into_sf;
-
- list[0] = from_otl; list[1] = NULL;
- mc.prefix = NeedsPrefix(into_sf,from_sf,list)
- ? strconcat(from_sf->fontname,"-") : copy("");
- newotl = _OTLookupCopyInto(&mc,from_otl,(OTLookup *) -2,true);
- free(mc.lks);
- free(mc.prefix);
-return( newotl );
-}
-
-void OTLookupsCopyInto(SplineFont *into_sf,SplineFont *from_sf,
- OTLookup **list, OTLookup *before) {
- int i, do_contents;
- struct sfmergecontext mc;
-
- memset(&mc,0,sizeof(mc));
- mc.sf_from = from_sf; mc.sf_to = into_sf;
-
- mc.prefix = NeedsPrefix(into_sf,from_sf,list)
- ? strconcat(from_sf->fontname,"-") : copy("");
- for ( i=0; list[i]!=NULL; ++i );
- mc.lks = galloc((mc.lmax=i+5)*sizeof(struct lookup_cvt));
- /* First create all the lookups and position them in the right order */
- /* then create subtables (which may in turn create some new lookups */
- /* for contextual lookups which invoke other lookups, don't care how */
- /* those nested lookups are ordered) */
- for ( do_contents=0; do_contents<2; ++do_contents )
- for ( i=0; list[i]!=NULL; ++i )
- (void) _OTLookupCopyInto(&mc,list[i],before,do_contents);
- free(mc.lks);
- free(mc.prefix);
-}
-
-/* ************************************************************************** */
-/* ****************************** Apply lookups ***************************** */
-/* ************************************************************************** */
-
-struct lookup_data {
- struct opentype_str *str;
- int cnt, max;
-
- uint32 script;
- SplineFont *sf;
-
- struct lookup_subtable *lig_owner;
- int lcnt, lmax;
- SplineChar ***ligs; /* For each ligature we have an array of SplineChars that are its components preceded by the ligature glyph itself */
- /* NULL terminated */
- int pixelsize;
- double scale;
-};
-
-static int ApplyLookupAtPos(uint32 tag, OTLookup *otl,struct lookup_data *data,int pos);
-
-static int GlyphNameInClass(char *name,char *class ) {
- char *pt;
- int len = strlen(name);
-
- if ( class==NULL )
-return( false );
-
- pt = class;
- while ( (pt=strstr(pt,name))!=NULL ) {
- if ( pt==NULL )
-return( false );
- if ( (pt==class || pt[-1]==' ') && (pt[len]=='\0' || pt[len]==' '))
-return( true );
- pt+=len;
- }
-
-return( false );
-}
-
-/* ************************************************************************** */
-/* ************************* Apply OpenType Lookups ************************* */
-/* ************************************************************************** */
-
-static void LigatureFree(struct lookup_data *data) {
- int i;
-
- if ( data->ligs==NULL )
-return;
- for ( i=0; data->ligs[i]!=NULL; ++i )
- free(data->ligs[i]);
-}
-
-static void LigatureSearch(struct lookup_subtable *sub, struct lookup_data *data) {
- SplineFont *sf = data->sf;
- int gid, ccnt, cnt, ch, err;
- SplineChar *sc;
- PST *pst;
- char *pt, *start;
-
- LigatureFree(data);
- cnt = 0;
- for ( gid=0; gid<sf->glyphcnt; ++gid ) if ( (sc=sf->glyphs[gid])!=NULL ) {
- for ( pst=sc->possub; pst!=NULL; pst=pst->next ) if ( pst->subtable==sub ) {
- for ( pt = pst->u.lig.components, ccnt=0; *pt; ++pt )
- if ( *pt==' ' )
- ++ccnt;
- if ( cnt>=data->lmax )
- data->ligs = grealloc(data->ligs,(data->lmax+=100)*sizeof(SplineChar **));
- data->ligs[cnt] = galloc((ccnt+3)*sizeof(SplineChar *));
- data->ligs[cnt][0] = sc;
- ccnt = 1;
- err = 0;
- for ( pt = pst->u.lig.components; *pt; ) {
- while ( *pt==' ' ) ++pt;
- if ( *pt=='\0' )
- break;
- for ( start=pt; *pt!='\0' && *pt!=' '; ++pt );
- ch = *pt; *pt = '\0';
- data->ligs[cnt][ccnt++] = SFGetChar(sf,-1,start);
- *pt = ch;
- if ( data->ligs[cnt][ccnt-1]==NULL )
- err = 1;
- }
- if ( !err )
- data->ligs[cnt++][ccnt] = NULL;
- }
- }
- if ( cnt>=data->lmax )
- data->ligs = grealloc(data->ligs,(data->lmax+=1)*sizeof(SplineChar **));
- data->ligs[cnt] = NULL;
- data->lcnt = cnt;
-}
-
-static int skipglyphs(int lookup_flags, struct lookup_data *data, int pos) {
- int mc, glyph_class;
- /* The lookup flags tell us what glyphs to ignore. Skip over anything we */
- /* should ignore */
-
- if ( lookup_flags==0 )
-return( pos );
- mc = (lookup_flags>>8);
- if ( mc<0 || mc>=data->sf->mark_class_cnt )
- mc = 0;
- while ( pos<data->cnt ) {
- glyph_class = gdefclass(data->str[pos].sc);
- /* 1=>base, 2=>ligature, 3=>mark, 4=>component?, 0=>.notdef */
- if ( (glyph_class==1 && (lookup_flags&pst_ignorebaseglyphs)) ||
- (glyph_class==2 && (lookup_flags&pst_ignoreligatures)) ||
- (glyph_class==3 && (lookup_flags&pst_ignorecombiningmarks)) ||
- (glyph_class==3 && mc!=0 &&
- !GlyphNameInClass(data->str[pos].sc->name,data->sf->mark_classes[mc])) ) {
- ++pos;
- } else
- break;
- }
-return( pos );
-}
-
-static int bskipmarkglyphs(int lookup_flags, struct lookup_data *data, int pos) {
- int mc, glyph_class;
- /* The lookup flags tell us what glyphs to ignore. Skip over anything we */
- /* should ignore. Here we skip backward */
-
- mc = (lookup_flags>>8);
- if ( mc<0 || mc>=data->sf->mark_class_cnt )
- mc = 0;
- while ( pos>=0 ) {
- glyph_class = gdefclass(data->str[pos].sc);
- /* 1=>base, 2=>ligature, 3=>mark, 4=>component?, 0=>.notdef */
- if ( glyph_class==3 )
- --pos;
- else if ( (glyph_class==1 && (lookup_flags&pst_ignorebaseglyphs)) ||
- (glyph_class==2 && (lookup_flags&pst_ignoreligatures)) ||
- (glyph_class==3 && (lookup_flags&pst_ignorecombiningmarks)) ||
- (glyph_class==3 && mc!=0 &&
- !GlyphNameInClass(data->str[pos].sc->name,data->sf->mark_classes[mc])) ) {
- --pos;
- } else
- break;
- }
-return( pos );
-}
-
-static int bskipglyphs(int lookup_flags, struct lookup_data *data, int pos) {
- int mc, glyph_class;
- /* The lookup flags tell us what glyphs to ignore. Skip over anything we */
- /* should ignore. Here we skip backward */
-
- if ( lookup_flags==0 )
-return( pos );
- mc = (lookup_flags>>8);
- if ( mc<0 || mc>=data->sf->mark_class_cnt )
- mc = 0;
- while ( pos>=0 ) {
- glyph_class = gdefclass(data->str[pos].sc);
- /* 1=>base, 2=>ligature, 3=>mark, 4=>component?, 0=>.notdef */
- if ( (glyph_class==1 && (lookup_flags&pst_ignorebaseglyphs)) ||
- (glyph_class==2 && (lookup_flags&pst_ignoreligatures)) ||
- (glyph_class==3 && (lookup_flags&pst_ignorecombiningmarks)) ||
- (glyph_class==3 && mc!=0 &&
- !GlyphNameInClass(data->str[pos].sc->name,data->sf->mark_classes[mc])) ) {
- --pos;
- } else
- break;
- }
-return( pos );
-}
-
-static int ContextualMatch(struct lookup_subtable *sub,struct lookup_data *data,
- int pos, struct fpst_rule **_rule) {
- int i, cpos, retpos, r;
- FPST *fpst = sub->fpst;
- int lookup_flags = sub->lookup->lookup_flags;
- char *pt;
-
- /* If we should skip the current glyph then don't try for a match here */
- cpos = skipglyphs(lookup_flags,data,pos);
- if ( cpos!=pos )
-return( 0 );
-
- for ( r=0; r<fpst->rule_cnt; ++r ) {
- struct fpst_rule *rule = &fpst->rules[r];
- for ( i=pos; i<data->cnt; ++i )
- data->str[i].context_pos = -1;
-
-/* Handle backtrack (backtrace in the rule is stored in reverse textual order) */
- if ( fpst->type == pst_chainpos || fpst->type == pst_chainsub ) {
- if ( fpst->format==pst_glyphs ) {
- pt = rule->u.glyph.back;
- for ( i=bskipglyphs(lookup_flags,data,pos-1), cpos=0; i>=0; i = bskipglyphs(lookup_flags,data,i-1)) {
- char *name = data->str[i].sc->name;
- int len = strlen( name );
- if ( strncmp(name,pt,len)!=0 || (pt[len]!='\0' && pt[len]!=' '))
- break;
- pt += len;
- while ( *pt==' ' ) ++pt;
- }
- if ( *pt!='\0' )
- continue; /* didn't match */
- } else if ( fpst->format==pst_class ) {
- for ( i=bskipglyphs(lookup_flags,data,pos-1), cpos=0; i>=0 && cpos<rule->u.class.bcnt; i = bskipglyphs(lookup_flags,data,i-1)) {
- if ( !GlyphNameInClass(data->str[i].sc->name,fpst->bclass[rule->u.class.bclasses[cpos]]) )
- break;
- ++cpos;
- }
- if ( cpos!=rule->u.class.bcnt )
- continue; /* didn't match */
- } else if ( fpst->format==pst_coverage ) {
- for ( i=bskipglyphs(lookup_flags,data,pos-1), cpos=0; i>=0 && cpos<rule->u.coverage.bcnt; i = bskipglyphs(lookup_flags,data,i-1)) {
- if ( !GlyphNameInClass(data->str[i].sc->name,rule->u.coverage.bcovers[cpos]) )
- break;
- ++cpos;
- }
- if ( cpos<rule->u.coverage.bcnt )
- continue; /* didn't match */
- }
- }
-/* Handle Match */
- if ( fpst->format==pst_glyphs ) {
- pt = rule->u.glyph.names;
- for ( i=pos, cpos=0; i<data->cnt && *pt!='\0'; i = skipglyphs(lookup_flags,data,i+1)) {
- char *name = data->str[i].sc->name;
- int len = strlen( name );
- if ( strncmp(name,pt,len)!=0 || (pt[len]!='\0' && pt[len]!=' '))
- break;
- data->str[i].context_pos = cpos++;
- pt += len;
- while ( *pt==' ' ) ++pt;
- }
- if ( *pt!='\0' )
- continue; /* didn't match */
- } else if ( fpst->format==pst_class ) {
- for ( i=pos, cpos=0; i<data->cnt && cpos<rule->u.class.ncnt; i = skipglyphs(lookup_flags,data,i+1)) {
- int class = rule->u.class.nclasses[cpos];
- if ( class!=0 ) {
- if ( !GlyphNameInClass(data->str[i].sc->name,fpst->nclass[class]) )
- break;
- } else {
- int c;
- /* Ok, to match class 0 we must fail to match all other classes */
- for ( c=1; c<fpst->nccnt; ++c )
- if ( !GlyphNameInClass(data->str[i].sc->name,fpst->nclass[c]) )
- break;
- if ( c!=fpst->nccnt )
- break; /* It matched another class => not in class 0 */
- }
- data->str[i].context_pos = cpos++;
- }
- if ( cpos<rule->u.class.ncnt )
- continue; /* didn't match */
- } else if ( fpst->format==pst_coverage ) {
- for ( i=pos, cpos=0; i<data->cnt && cpos<rule->u.coverage.ncnt; i = skipglyphs(lookup_flags,data,i+1)) {
- if ( !GlyphNameInClass(data->str[i].sc->name,rule->u.coverage.ncovers[cpos]) )
- break;
- data->str[i].context_pos = cpos++;
- }
- if ( cpos<rule->u.coverage.ncnt )
- continue; /* didn't match */
- } else
-return( 0 ); /* Not ready to deal with reverse chainging */
-
- retpos = i;
-/* Handle lookahead */
- if ( fpst->type == pst_chainpos || fpst->type == pst_chainsub ) {
- if ( fpst->format==pst_glyphs ) {
- pt = rule->u.glyph.fore;
- for ( i=retpos; i<data->cnt && *pt!='\0'; i = skipglyphs(lookup_flags,data,i+1)) {
- char *name = data->str[i].sc->name;
- int len = strlen( name );
- if ( strncmp(name,pt,len)!=0 || (pt[len]!='\0' && pt[len]!=' '))
- break;
- pt += len;
- while ( *pt==' ' ) ++pt;
- }
- if ( *pt!='\0' )
- continue; /* didn't match */
- } else if ( fpst->format==pst_class ) {
- for ( i=retpos, cpos=0; i<data->cnt && cpos<rule->u.class.fcnt; i = skipglyphs(lookup_flags,data,i+1)) {
- if ( !GlyphNameInClass(data->str[i].sc->name,fpst->fclass[rule->u.class.fclasses[cpos]]) )
- break;
- cpos++;
- }
- if ( cpos<rule->u.class.fcnt )
- continue; /* didn't match */
- } else if ( fpst->format==pst_coverage ) {
- for ( i=retpos, cpos=0; i<data->cnt && cpos<rule->u.coverage.fcnt; i = skipglyphs(lookup_flags,data,i+1)) {
- if ( !GlyphNameInClass(data->str[i].sc->name,rule->u.coverage.fcovers[cpos]) )
- break;
- cpos++;
- }
- if ( cpos<rule->u.coverage.fcnt )
- continue; /* didn't match */
- }
- }
- *_rule = rule;
-return( retpos );
- }
-return( 0 );
-}
-
-static int ApplySingleSubsAtPos(struct lookup_subtable *sub,struct lookup_data *data,int pos) {
- PST *pst;
- SplineChar *sc;
-
- for ( pst=data->str[pos].sc->possub; pst!=NULL && pst->subtable!=sub; pst=pst->next );
- if ( pst==NULL )
-return( 0 );
-
- sc = SFGetChar(data->sf,-1,pst->u.subs.variant);
- if ( sc!=NULL ) {
- data->str[pos].sc = sc;
-return( pos+1 );
- } else if ( strcmp(pst->u.subs.variant,MAC_DELETED_GLYPH_NAME)==0 ) {
- /* Under AAT we delete the glyph. But OpenType doesn't have that concept */
- int i;
- for ( i=pos+1; i<data->cnt; ++i )
- data->str[pos-1] = data->str[pos];
- --data->cnt;
-return( pos );
- } else {
-return( 0 );
- }
-}
-
-static int ApplyMultSubsAtPos(struct lookup_subtable *sub,struct lookup_data *data,int pos) {
- PST *pst;
- SplineChar *sc;
- char *start, *pt;
- int mcnt, ch, i;
- SplineChar *mults[20];
-
- for ( pst=data->str[pos].sc->possub; pst!=NULL && pst->subtable!=sub; pst=pst->next );
- if ( pst==NULL )
-return( 0 );
-
- mcnt = 0;
- for ( start = pst->u.alt.components; *start==' '; ++start);
- for ( ; *start; ) {
- for ( pt=start; *pt!='\0' && *pt!=' '; ++pt );
- ch = *pt; *pt = '\0';
- sc = SFGetChar(data->sf,-1,start);
- *pt = ch;
- if ( sc==NULL )
-return( 0 );
- if ( mcnt<20 ) mults[mcnt++] = sc;
- while ( *pt==' ' ) ++pt;
- start = pt;
- }
-
- if ( mcnt==0 ) {
- /* Is this legal? that is can we remove a glyph with an empty multiple? */
- for ( i=pos+1; i<data->cnt; ++i )
- data->str[i-1] = data->str[i];
- --data->cnt;
-return( pos );
- } else if ( mcnt==1 ) {
- data->str[pos].sc = mults[0];
-return( pos+1 );
- } else {
- if ( data->cnt+mcnt-1 >= data->max )
- data->str = grealloc(data->str,(data->max+=mcnt) * sizeof( struct opentype_str ));
- for ( i=data->cnt-1; i>pos; --i )
- data->str[i+mcnt-1] = data->str[i];
- memset(data->str+pos,0,mcnt*sizeof(struct opentype_str));
- for ( i=0; i<mcnt; ++i ) {
- data->str[pos+i].sc = mults[i];
- data->str[pos+i].orig_index = data->str[pos].orig_index;
- }
- data->cnt += (mcnt-1);
-return( pos+mcnt );
- }
-}
-
-static int ApplyAltSubsAtPos(struct lookup_subtable *sub,struct lookup_data *data,int pos) {
- PST *pst;
- SplineChar *sc;
- char *start, *pt, ch;
-
- for ( pst=data->str[pos].sc->possub; pst!=NULL && pst->subtable!=sub; pst=pst->next );
- if ( pst==NULL )
-return( 0 );
-
- for ( start = pst->u.alt.components; *start==' '; ++start);
- for ( ; *start; ) {
- for ( pt=start; *pt!='\0' && *pt!=' '; ++pt );
- ch = *pt; *pt = '\0';
- sc = SFGetChar(data->sf,-1,start);
- *pt = ch;
- if ( sc!=NULL ) {
- data->str[pos].sc = sc;
-return( pos+1 );
- }
- while ( *pt==' ' ) ++pt;
- start = pt;
- }
-return( 0 );
-}
-
-static int ApplyLigatureSubsAtPos(struct lookup_subtable *sub,struct lookup_data *data,int pos) {
- int i,k, lpos, npos;
- int lookup_flags = sub->lookup->lookup_flags;
- int match_found = -1, match_len=0;
-
- if ( data->lig_owner!=sub )
- LigatureSearch(sub,data);
- for ( i=0; i<data->lcnt; ++i ) {
- if ( data->ligs[i][1]==data->str[pos].sc ) {
- lpos = 0;
- npos = pos+1;
- for ( k=2; data->ligs[i][k]!=NULL; ++k ) {
- npos = skipglyphs(lookup_flags,data,npos);
- if ( npos>=data->cnt || data->str[npos].sc != data->ligs[i][k] )
- break;
- ++npos;
- }
- if ( data->ligs[i][k]==NULL ) {
- if ( match_found==-1 || k>match_len ) {
- match_found = i;
- match_len = k;
- }
- }
- }
- }
- if ( match_found!=-1 ) {
- /* Matched. Remove the component glyphs, and note which component */
- /* any intervening marks should be attached to */
- data->str[pos].sc = data->ligs[match_found][0];
- npos = pos+1;
- for ( k=2; data->ligs[match_found][k]!=NULL; ++k ) {
- lpos = skipglyphs(lookup_flags,data,npos);
- for ( ; npos<lpos; ++npos )
- data->str[npos].lig_pos = k-2;
- /* Remove this glyph (copy the final NUL too) */
- for ( ++lpos; lpos<=data->cnt; ++lpos )
- data->str[lpos-1] = data->str[lpos];
- --data->cnt;
- }
- /* Any marks after the last component (which should be attached */
- /* to it) will not have been tagged, so do that now */
- lpos = skipglyphs(lookup_flags,data,npos);
- for ( ; npos<lpos; ++npos )
- data->str[npos].lig_pos = k-2;
-return( pos+1 );
- }
-
-return( 0 );
-}
-
-static int ApplyContextual(struct lookup_subtable *sub,struct lookup_data *data,int pos) {
- /* On this level there is no difference between GPOS/GSUB contextuals */
- /* If the contextual matches, then we apply the lookups, otherwise we */
- /* don't. Now the lookups will be different, but we don't care here */
- struct fpst_rule *rule;
- int retpos, i,j;
-
- retpos = ContextualMatch(sub,data,pos,&rule);
- if ( retpos==0 )
-return( 0 );
- for ( i=0; i<rule->lookup_cnt; ++i ) {
- for ( j=pos; j<data->cnt; ++j ) {
- if ( data->str[j].context_pos == rule->lookups[i].seq ) {
- ApplyLookupAtPos(0,rule->lookups[i].lookup,data,j);
- break;
- }
- }
- }
-return( retpos );
-}
-
-#ifdef FONTFORGE_CONFIG_DEVICETABLES
-static int FigureDeviceTable(DeviceTable *dt,int pixelsize) {
-
- if ( dt==NULL || dt->corrections==NULL || pixelsize<dt->first_pixel_size ||
- pixelsize>dt->last_pixel_size )
-return( 0 );
-
-return( dt->corrections[pixelsize - dt->last_pixel_size] );
-}
-#endif
-
-static int ApplySinglePosAtPos(struct lookup_subtable *sub,struct lookup_data *data,int pos) {
- PST *pst;
-
- for ( pst=data->str[pos].sc->possub; pst!=NULL && pst->subtable!=sub; pst=pst->next );
- if ( pst==NULL )
-return( 0 );
-
- data->str[pos].vr.xoff += rint( pst->u.pos.xoff * data->scale );
- data->str[pos].vr.yoff += rint( pst->u.pos.yoff * data->scale );
- data->str[pos].vr.h_adv_off += rint( pst->u.pos.h_adv_off * data->scale );
- data->str[pos].vr.v_adv_off += rint( pst->u.pos.v_adv_off * data->scale );
-#ifdef FONTFORGE_CONFIG_DEVICETABLES
- if ( pst->u.pos.adjust!=NULL ) {
- data->str[pos].vr.xoff += FigureDeviceTable(&pst->u.pos.adjust->xadjust,data->pixelsize);
- data->str[pos].vr.yoff += FigureDeviceTable(&pst->u.pos.adjust->yadjust,data->pixelsize);
- data->str[pos].vr.h_adv_off += FigureDeviceTable(&pst->u.pos.adjust->xadv,data->pixelsize);
- data->str[pos].vr.v_adv_off += FigureDeviceTable(&pst->u.pos.adjust->yadv,data->pixelsize);
- }
-#endif
-return( pos+1 );
-}
-
-static int ApplyPairPosAtPos(struct lookup_subtable *sub,struct lookup_data *data,int pos) {
- PST *pst;
- int npos, isv, within;
- KernPair *kp;
-
- npos = skipglyphs(sub->lookup->lookup_flags,data,pos+1);
- if ( npos>=data->cnt )
-return( 0 );
- if ( sub->kc!=NULL ) {
- within = KCFindIndex(sub->kc,data->str[pos].sc->name,data->str[npos].sc->name);
- if ( within==-1 )
-return( 0 );
- data->str[pos].kc_index = within;
- data->str[pos].kc = sub->kc;
- if ( sub->vertical_kerning ) {
- data->str[pos].vr.v_adv_off += rint( sub->kc->offsets[within] * data->scale );
-#ifdef FONTFORGE_CONFIG_DEVICETABLES
- data->str[pos].vr.v_adv_off += FigureDeviceTable(&sub->kc->adjusts[within],data->pixelsize);
-#endif
- } else if ( sub->lookup->lookup_flags & pst_r2l ) {
- data->str[npos].vr.h_adv_off += rint( sub->kc->offsets[within] * data->scale );
-#ifdef FONTFORGE_CONFIG_DEVICETABLES
- data->str[npos].vr.h_adv_off += FigureDeviceTable(&sub->kc->adjusts[within],data->pixelsize);
-#endif
- } else {
- data->str[pos].vr.h_adv_off += rint( sub->kc->offsets[within] * data->scale );
-#ifdef FONTFORGE_CONFIG_DEVICETABLES
- data->str[pos].vr.h_adv_off += FigureDeviceTable(&sub->kc->adjusts[within],data->pixelsize);
-#endif
- }
-return( pos+1 );
- } else {
- for ( pst=data->str[pos].sc->possub; pst!=NULL; pst=pst->next ) {
- if ( pst->subtable==sub && strcmp(pst->u.pair.paired,data->str[npos].sc->name)==0 ) {
- data->str[pos].vr.xoff += rint( pst->u.pair.vr[0].xoff * data->scale);
- data->str[pos].vr.yoff += rint( pst->u.pair.vr[0].yoff * data->scale);
- data->str[pos].vr.h_adv_off += rint( pst->u.pair.vr[0].h_adv_off * data->scale);
- data->str[pos].vr.v_adv_off += rint( pst->u.pair.vr[0].v_adv_off * data->scale);
- data->str[npos].vr.xoff += rint( pst->u.pair.vr[1].xoff * data->scale);
- data->str[npos].vr.yoff += rint( pst->u.pair.vr[1].yoff * data->scale);
- data->str[npos].vr.h_adv_off += rint( pst->u.pair.vr[1].h_adv_off * data->scale);
- data->str[npos].vr.v_adv_off += rint( pst->u.pair.vr[1].v_adv_off * data->scale);
-#ifdef FONTFORGE_CONFIG_DEVICETABLES
- /* I got bored. I should do all of them */
- if ( pst->u.pair.vr[0].adjust!=NULL ) {
- data->str[pos].vr.h_adv_off += FigureDeviceTable(&pst->u.pair.vr[0].adjust->xadv,data->pixelsize);
- }
-#endif
-return( pos+1 ); /* We do NOT want to return npos+1 */
- }
- }
- for ( isv = 0; isv<2; ++isv ) {
- for ( kp = isv ? data->str[pos].sc->vkerns : data->str[pos].sc->kerns; kp!=NULL; kp=kp->next ) {
- if ( kp->subtable == sub && kp->sc == data->str[npos].sc ) {
- data->str[pos].kp = kp;
- if ( isv ) {
- data->str[pos].vr.v_adv_off += rint( kp->off * data->scale);
-#ifdef FONTFORGE_CONFIG_DEVICETABLES
- data->str[pos].vr.v_adv_off += FigureDeviceTable(kp->adjust,data->pixelsize);
-#endif
- } else if ( sub->lookup->lookup_flags & pst_r2l ) {
- data->str[npos].vr.h_adv_off += rint( kp->off * data->scale);
-#ifdef FONTFORGE_CONFIG_DEVICETABLES
- data->str[npos].vr.h_adv_off += FigureDeviceTable(kp->adjust,data->pixelsize);
-#endif
- } else {
- data->str[pos].vr.h_adv_off += rint( kp->off * data->scale);
-#ifdef FONTFORGE_CONFIG_DEVICETABLES
- data->str[pos].vr.h_adv_off += FigureDeviceTable(kp->adjust,data->pixelsize);
-#endif
- }
-return( pos+1 );
- }
- }
- }
- }
-
-return( 0 );
-}
-
-static int ApplyAnchorPosAtPos(struct lookup_subtable *sub,struct lookup_data *data,int pos) {
- AnchorPoint *ap1, *ap2;
- int bpos;
-
- /* Anchors do not position the base glyph, but the mark (or second glyph */
- /* of a cursive attachment). This means we don't apply the attachment when*/
- /* we meet the first glyph, but wait until we meet the second, and then */
- /* walk backwards */
- /* The backwards walk is different depending on the lookup type (I think) */
- /* mark to base and mark to ligature lookups will skip all marks even if */
- /* lookup flags don't specify that */
- /* mark to mark, and cursive attachment only skip what the lookup flags */
- /* tell them to skip. */
- for ( ap2=data->str[pos].sc->anchor; ap2!=NULL ; ap2=ap2->next ) {
- if ( ap2->anchor->subtable==sub && (ap2->type == at_mark || ap2->type == at_centry))
- break;
- }
- if ( ap2==NULL ) {
- /* This subtable is not used by this glyph ... at least this glyph is */
- /* neither a mark nor an entry point for this subtable */
-return( 0 );
- }
-
- /* There's only going to be one mark anchor on a glyph in a given subtable*/
- /* And cursive attachments only allow one anchor class per subtable */
- /* in either case we have already found the only attachment site possible */
- /* in the current glyph */
-
- if ( sub->lookup->lookup_type == gpos_mark2base ||
- sub->lookup->lookup_type == gpos_mark2ligature )
- bpos = bskipmarkglyphs(sub->lookup->lookup_flags,data,pos-1);
- else
- bpos = bskipglyphs(sub->lookup->lookup_flags,data,pos-1);
- if ( bpos==-1 )
-return( 0 ); /* No match */
-
- if ( sub->lookup->lookup_type == gpos_cursive ) {
- for ( ap1=data->str[bpos].sc->anchor; ap1!=NULL ; ap1=ap1->next ) {
- if ( ap1->anchor==ap2->anchor && ap1->type==at_cexit )
- break;
- }
- } else if ( sub->lookup->lookup_type == gpos_mark2ligature ) {
- for ( ap1=data->str[bpos].sc->anchor; ap1!=NULL ; ap1=ap1->next ) {
- if ( ap1->anchor==ap2->anchor && ap1->type==at_baselig &&
- ap1->lig_index == data->str[pos].lig_pos )
- break;
- }
- } else {
- for ( ap1=data->str[bpos].sc->anchor; ap1!=NULL ; ap1=ap1->next ) {
- if ( ap1->anchor==ap2->anchor &&
- (ap1->type==at_basechar || ap1->type==at_basemark) )
- break;
- }
- }
- if ( ap1==NULL )
-return( 0 ); /* No match */
-
-/* This probably doesn't work for vertical text */
- data->str[pos].vr.yoff = data->str[bpos].vr.yoff +
- rint((ap1->me.y - ap2->me.y) * data->scale);
-#ifdef FONTFORGE_CONFIG_DEVICETABLES
- data->str[pos].vr.yoff += FigureDeviceTable(&ap1->yadjust,data->pixelsize)-
- FigureDeviceTable(&ap2->yadjust,data->pixelsize);
-#endif
- if ( sub->lookup->lookup_flags&pst_r2l ) {
- data->str[pos].vr.xoff = data->str[bpos].vr.xoff +
- rint( -(ap1->me.x - ap2->me.x)*data->scale );
-#ifdef FONTFORGE_CONFIG_DEVICETABLES
- data->str[pos].vr.xoff -= FigureDeviceTable(&ap1->xadjust,data->pixelsize)-
- FigureDeviceTable(&ap2->xadjust,data->pixelsize);
-#endif
- } else {
- data->str[pos].vr.xoff = data->str[bpos].vr.xoff +
- rint( (ap1->me.x - ap2->me.x - data->str[bpos].sc->width)*data->scale -
- data->str[bpos].vr.h_adv_off);
-#ifdef FONTFORGE_CONFIG_DEVICETABLES
- data->str[pos].vr.xoff += FigureDeviceTable(&ap1->xadjust,data->pixelsize)-
- FigureDeviceTable(&ap2->xadjust,data->pixelsize);
-#endif
- }
-
-return( pos+1 );
-}
-
-static int ConditionalTagOk(uint32 tag, OTLookup *otl,struct lookup_data *data,int pos) {
- int npos, bpos;
- uint32 script;
- int before_in_script, after_in_script;
-
- if ( tag==CHR('i','n','i','t') || tag==CHR('i','s','o','l') ||
- tag==CHR('f','i','n','a') || tag==CHR('m','e','d','i') ) {
- npos = skipglyphs(otl->lookup_flags,data,pos+1);
- bpos = bskipglyphs(otl->lookup_flags,data,pos-1);
- script = SCScriptFromUnicode(data->str[pos].sc);
- before_in_script = (bpos>=0 && SCScriptFromUnicode(data->str[bpos].sc)==script);
- after_in_script = (npos<data->cnt && SCScriptFromUnicode(data->str[npos].sc)==script);
- if ( tag==CHR('i','n','i','t') )
-return( !before_in_script && after_in_script );
- else if ( tag==CHR('i','s','o','l') )
-return( !before_in_script && !after_in_script );
- else if ( tag==CHR('f','i','n','a') )
-return( before_in_script && !after_in_script );
- else
-return( before_in_script && after_in_script );
- }
-
-return( true );
-}
-
-static int ApplyLookupAtPos(uint32 tag, OTLookup *otl,struct lookup_data *data,int pos) {
- struct lookup_subtable *sub;
- int newpos;
-
- /* Some tags imply a conditional check. Do that now */
- if ( !ConditionalTagOk(tag,otl,data,pos))
-return( 0 );
-
- for ( sub=otl->subtables; sub!=NULL; sub=sub->next ) {
- switch ( otl->lookup_type ) {
- case gsub_single:
- newpos = ApplySingleSubsAtPos(sub,data,pos);
- break;
- case gsub_multiple:
- newpos = ApplyMultSubsAtPos(sub,data,pos);
- break;
- case gsub_alternate:
- newpos = ApplyAltSubsAtPos(sub,data,pos);
- break;
- case gsub_ligature:
- newpos = ApplyLigatureSubsAtPos(sub,data,pos);
- break;
- case gsub_context:
- newpos = ApplyContextual(sub,data,pos);
- break;
- case gsub_contextchain:
- newpos = ApplyContextual(sub,data,pos);
- break;
- case gsub_reversecchain:
- newpos = ApplySingleSubsAtPos(sub,data,pos);
- break;
-
- case gpos_single:
- newpos = ApplySinglePosAtPos(sub,data,pos);
- break;
- case gpos_pair:
- newpos = ApplyPairPosAtPos(sub,data,pos);
- break;
- case gpos_cursive:
- newpos = ApplyAnchorPosAtPos(sub,data,pos);
- break;
- case gpos_mark2base:
- newpos = ApplyAnchorPosAtPos(sub,data,pos);
- break;
- case gpos_mark2ligature:
- newpos = ApplyAnchorPosAtPos(sub,data,pos);
- break;
- case gpos_mark2mark:
- newpos = ApplyAnchorPosAtPos(sub,data,pos);
- break;
- case gpos_context:
- newpos = ApplyContextual(sub,data,pos);
- break;
- case gpos_contextchain:
- newpos = ApplyContextual(sub,data,pos);
- break;
- default:
- newpos = 0;
- break;
- }
- /* if a subtable worked, we don't try to apply the next one */
- if ( newpos!=0 )
-return( newpos );
- }
-return( 0 );
-}
-
-static void ApplyLookup(uint32 tag, OTLookup *otl,struct lookup_data *data) {
- int pos, npos;
- /* OpenType */
- for ( pos = 0; pos<data->cnt; ) {
- npos = ApplyLookupAtPos(tag,otl,data,pos);
- if ( npos<=pos) /* !!!!! */
- npos = pos+1;
- pos = npos;
- }
-}
-
-static uint32 FSLLMatches(FeatureScriptLangList *fl,uint32 *flist,uint32 script,uint32 lang) {
- int i,l;
- struct scriptlanglist *sl;
-
- if ( flist==NULL )
-return( 0 );
-
- while ( fl!=NULL ) {
- for ( i=0; flist[i]!=0; ++i ) {
- if ( fl->featuretag==flist[i] )
- break;
- }
- if ( flist[i]!=0 ) {
- for ( sl=fl->scripts; sl!=NULL; sl=sl->next ) {
- if ( sl->script == script ) {
- for ( l=0; l<sl->lang_cnt; ++l )
- if ( (l<MAX_LANG && sl->langs[l]==lang) ||
- (l>=MAX_LANG && sl->morelangs[l-MAX_LANG]==lang))
-return( fl->featuretag );
- }
- }
- }
- fl = fl->next;
- }
-return( 0 );
-}
-
-/* This routine takes a string of glyphs and applies the opentype transformations */
-/* indicated by the features (and script and language) we are passed, it returns */
-/* a transformed string with substitutions applied and containing positioning */
-/* info */
-struct opentype_str *ApplyTickedFeatures(SplineFont *sf,uint32 *flist, uint32 script, uint32 lang,
- int pixelsize, SplineChar **glyphs) {
- int isgpos, cnt;
- OTLookup *otl;
- struct lookup_data data;
- uint32 *langs, templang;
- int i;
-
- memset(&data,0,sizeof(data));
- for ( cnt=0; glyphs[cnt]!=NULL; ++cnt );
- data.str = gcalloc(cnt+1,sizeof(struct opentype_str));
- data.cnt = data.max = cnt;
- for ( cnt=0; glyphs[cnt]!=NULL; ++cnt ) {
- data.str[cnt].sc = glyphs[cnt];
- data.str[cnt].orig_index = cnt;
- data.str[cnt].lig_pos = data.str[cnt].context_pos = -1;
- }
- if ( sf->cidmaster!=NULL ) sf=sf->cidmaster;
- data.sf = sf;
- data.pixelsize = pixelsize;
- data.scale = pixelsize/(double) (sf->ascent+sf->descent);
-
- /* Indic glyph reordering???? */
- for ( isgpos=0; isgpos<2; ++isgpos ) {
- /* Check that this table has an entry for this language */
- /* if it doesn't use the default language */
- /* GPOS/GSUB may have different language sets, so we must be prepared */
- templang = lang;
- langs = SFLangsInScript(sf,isgpos,script);
- for ( i=0; langs[i]!=0 && langs[i]!=lang; ++i );
- if ( langs[i]==0 )
- templang = DEFAULT_LANG;
- free(langs);
-
- for ( otl = isgpos ? sf->gpos_lookups : sf->gsub_lookups; otl!=NULL ; otl = otl->next ) {
- uint32 tag;
- if ( (tag=FSLLMatches(otl->features,flist,script,templang))!=0 )
- ApplyLookup(tag,otl,&data);
- }
- }
- LigatureFree(&data);
- free(data.ligs);
-
- data.str = grealloc(data.str,(data.cnt+1)*sizeof(struct opentype_str));
- memset(&data.str[data.cnt],0,sizeof(struct opentype_str));
-return( data.str );
-}
-
-static void doreplace(char **haystack,char *start,char *search,char *rpl,int slen) {
- int rlen;
- char *pt = start+slen;
- (void)search;
- rlen = strlen(rpl);
- if ( slen>=rlen ) {
- memcpy(start,rpl,rlen);
- if ( slen>rlen ) {
- int diff = slen-rlen;
- for ( ; *pt ; ++pt )
- pt[-diff] = *pt;
- pt[-diff] = '\0';
- }
- } else {
- char *base = *haystack;
- char *new = galloc(pt-base+strlen(pt)+rlen-slen+1);
- memcpy(new,base,start-base);
- memcpy(new+(start-base),rpl,rlen);
- strcpy(new+(start-base)+rlen,pt);
- free( base );
- *haystack = new;
- }
-}
-
-static int rplstr(char **haystack,char *search, char *rpl,int multipleoccurances) {
- char *start, *pt, *base = *haystack;
- int ch, match, slen = strlen(search);
- int any = 0;
-
- if ( base==NULL )
-return( false );
-
- for ( pt=base ; ; ) {
- while ( *pt==' ' ) ++pt;
- if ( *pt=='\0' )
-return( any );
- start=pt;
- while ( *pt!=' ' && *pt!='\0' ) ++pt;
- if ( pt-start!=slen )
- match = -1;
- else {
- ch = *pt; *pt='\0';
- match = strcmp(start,search);
- *pt = ch;
- }
- if ( match==0 ) {
- doreplace(haystack,start,search,rpl,slen);
- if ( !multipleoccurances )
-return( true );
- any = true;
- if ( base!=*haystack ) {
- pt = *haystack + (start-base)+strlen(rpl);
- base = *haystack;
- } else
- pt = start+strlen(rpl);
- }
- }
-}
-
-static int rplglyphname(char **haystack,char *search, char *rpl) {
- /* If we change "f" to "uni0066" then we should also change "f.sc" to */
- /* "uni0066.sc" and "f_f_l" to "uni0066_uni0066_l" */
- char *start, *pt, *base = *haystack;
- int ch, match;
- unsigned slen = strlen(search);
- int any = 0;
-
- if ( slen>=strlen( base ))
-return( false );
-
- for ( pt=base ; ; ) {
- while ( *pt=='_' ) ++pt;
- if ( *pt=='\0' || *pt=='.' )
-return( any );
- start=pt;
- while ( *pt!='_' && *pt!='\0' && *pt!='.' ) ++pt;
- if ( *pt=='\0' && start==base ) /* Don't change any unsegmented names */
-return( false ); /* In particular don't rename ourselves*/
- if ( pt-start!=slen )
- match = -1;
- else {
- ch = *pt; *pt='\0';
- match = strcmp(start,search);
- *pt = ch;
- }
- if ( match==0 ) {
- doreplace(haystack,start,search,rpl,slen);
- any = true;
- if ( base!=*haystack ) {
- pt = *haystack + (start-base) + strlen(rpl);
- base = *haystack;
- } else
- pt = start+strlen(rpl);
- }
- }
-}
-
-static int glyphnameIsComponent(char *haystack,char *search) {
- /* Check for a glyph name in ligature names and dotted names */
- char *start, *pt;
- unsigned slen = strlen(search);
-
- if ( slen>=strlen( haystack ))
-return( false );
-
- for ( pt=haystack ; ; ) {
- while ( *pt=='_' ) ++pt;
- if ( *pt=='\0' || *pt=='.' )
-return( false );
- start=pt;
- while ( *pt!='_' && *pt!='\0' && *pt!='.' ) ++pt;
- if ( *pt=='\0' && start==haystack )/* Don't change any unsegmented names */
-return( false ); /* In particular don't rename ourselves*/
- if ( pt-start==slen && strncmp(start,search,slen)==0 )
-return( true );
- }
-}
-
-static int gvfixup(struct glyphvariants *gv,char *old, char *new) {
- int i;
- int ret=0;
-
- if ( gv==NULL )
-return( false );
- ret = rplstr(&gv->variants,old,new,false);
- for ( i=0; i<gv->part_cnt; ++i ) {
- if ( strcmp(gv->parts[i].component,old)==0 ) {
- free( gv->parts[i].component);
- gv->parts[i].component = copy(new);
- ret = true;
- }
- }
-return( ret );
-}
-
-struct lookup_subtable *SFSubTableFindOrMake(SplineFont *sf,uint32 tag,uint32 script,
- int lookup_type ) {
- OTLookup **base;
- OTLookup *otl, *found=NULL;
- int isgpos = lookup_type>=gpos_start;
- struct lookup_subtable *sub;
- int isnew = false;
-
- if ( sf->cidmaster ) sf = sf->cidmaster;
- base = isgpos ? &sf->gpos_lookups : &sf->gsub_lookups;
- for ( otl= *base; otl!=NULL; otl=otl->next ) {
- if ( otl->lookup_type==(unsigned)lookup_type &&
- FeatureScriptTagInFeatureScriptList(tag,script,otl->features) ) {
- for ( sub = otl->subtables; sub!=NULL; sub=sub->next )
- if ( sub->kc==NULL )
-return( sub );
- found = otl;
- }
- }
-
- if ( found==NULL ) {
- found = chunkalloc(sizeof(OTLookup));
- found->lookup_type = lookup_type;
- found->features = chunkalloc(sizeof(FeatureScriptLangList));
- found->features->featuretag = tag;
- found->features->scripts = chunkalloc(sizeof(struct scriptlanglist));
- found->features->scripts->script = script;
- found->features->scripts->langs[0] = DEFAULT_LANG;
- found->features->scripts->lang_cnt = 1;
-
- SortInsertLookup(sf, found);
- isnew = true;
- }
-
- sub = chunkalloc(sizeof(struct lookup_subtable));
- sub->next = found->subtables;
- found->subtables = sub;
- sub->lookup = found;
- sub->per_glyph_pst_or_kern = true;
-
- NameOTLookup(found,sf);
-return( sub );
-}
-
-struct lookup_subtable *SFSubTableMake(SplineFont *sf,uint32 tag,uint32 script,
- int lookup_type ) {
- OTLookup **base;
- OTLookup *otl, *found=NULL;
- int isgpos = lookup_type>=gpos_start;
- struct lookup_subtable *sub;
- int isnew = false;
-
- if ( sf->cidmaster ) sf = sf->cidmaster;
- base = isgpos ? &sf->gpos_lookups : &sf->gsub_lookups;
- for ( otl= *base; otl!=NULL; otl=otl->next ) {
- if ( otl->lookup_type==(unsigned)lookup_type &&
- FeatureScriptTagInFeatureScriptList(tag,script,otl->features) ) {
- found = otl;
- }
- }
-
- if ( found==NULL ) {
- found = chunkalloc(sizeof(OTLookup));
- found->lookup_type = lookup_type;
- found->features = chunkalloc(sizeof(FeatureScriptLangList));
- found->features->featuretag = tag;
- found->features->scripts = chunkalloc(sizeof(struct scriptlanglist));
- found->features->scripts->script = script;
- found->features->scripts->langs[0] = DEFAULT_LANG;
- found->features->scripts->lang_cnt = 1;
-
- SortInsertLookup(sf, found);
- isnew = true;
- }
-
- sub = chunkalloc(sizeof(struct lookup_subtable));
- sub->next = found->subtables;
- found->subtables = sub;
- sub->lookup = found;
-
- if ( isnew )
- NameOTLookup(found,sf);
-return( sub );
-}
-
-int LookupUsedNested(SplineFont *sf,OTLookup *checkme) {
- OTLookup *otl;
- struct lookup_subtable *sub;
- int r,c;
-
- if ( checkme->lookup_type>=gpos_start )
- otl = sf->gpos_lookups;
- else
- otl = sf->gsub_lookups;
- while ( otl!=NULL ) {
- for ( sub = otl->subtables; sub!=NULL; sub=sub->next ) {
- if ( sub->fpst!=NULL ) {
- for ( r=0; r<sub->fpst->rule_cnt; ++r ) {
- struct fpst_rule *rule = &sub->fpst->rules[r];
- for ( c=0; c<rule->lookup_cnt; ++c ) {
- if ( rule->lookups[c].lookup == checkme )
-return( true );
- }
- }
- }
- }
- }
-return( false );
-}
-
-static void AALTRemoveOld(SplineFont *sf) {
- FeatureScriptLangList *fl, *prev;
- OTLookup *otl, *otlnext;
-
- for ( otl=sf->gsub_lookups; otl!=NULL; otl=otlnext ) {
- otlnext = otl->next;
- prev = NULL;
- for ( fl = otl->features; fl!=NULL; prev=fl, fl=fl->next ) {
- if ( fl->featuretag==CHR('a','a','l','t') ) {
- if ( fl==otl->features && fl->next==NULL && !LookupUsedNested(sf,otl))
- SFRemoveLookup(sf,otl);
- else {
- if ( prev==NULL )
- otl->features = fl->next;
- else
- prev->next = fl->next;
- fl->next = NULL;
- FeatureScriptLangListFree(fl);
- }
- break;
- }
- }
- }
-}
-
-void SllkFree(struct sllk *sllk,int sllk_cnt) {
- int i;
-
- for ( i=0; i<sllk_cnt; ++i ) {
- free( sllk[i].langs );
- free( sllk[i].lookups );
- }
- free(sllk);
-}
-
-static void AddOTLToSllk(struct sllk *sllk, OTLookup *otl, struct scriptlanglist *sl) {
- int i,j,k,l;
-
- if ( otl->lookup_type==gsub_single || otl->lookup_type==gsub_alternate ) {
- for ( i=0; i<sllk->cnt; ++i )
- if ( sllk->lookups[i]==otl )
- break;
- if ( i==sllk->cnt ) {
- if ( sllk->cnt>=sllk->max )
- sllk->lookups = grealloc(sllk->lookups,(sllk->max+=5)*sizeof(OTLookup *));
- sllk->lookups[sllk->cnt++] = otl;
- for ( l=0; l<sl->lang_cnt; ++l ) {
- uint32 lang = l<MAX_LANG ? sl->langs[l] : sl->morelangs[l-MAX_LANG];
- for ( j=0; j<sllk->lcnt; ++j )
- if ( sllk->langs[j]==lang )
- break;
- if ( j==sllk->lcnt ) {
- if ( sllk->lcnt>=sllk->lmax )
- sllk->langs = grealloc(sllk->langs,(sllk->lmax+=sl->lang_cnt+MAX_LANG)*sizeof(uint32));
- sllk->langs[sllk->lcnt++] = lang;
- }
- }
- }
- } else if ( otl->lookup_type==gsub_context || otl->lookup_type==gsub_contextchain ) {
- struct lookup_subtable *sub;
- for ( sub=otl->subtables; sub!=NULL; sub=sub->next ) {
- FPST *fpst = sub->fpst;
- for ( j=0; j<fpst->rule_cnt; ++j ) {
- struct fpst_rule *r = &fpst->rules[j];
- for ( k=0; k<r->lookup_cnt; ++k )
- AddOTLToSllk(sllk,r->lookups[k].lookup,sl);
- }
- }
- }
- /* reverse contextual chaining is weird and I shall ignore it. Adobe does too*/
-}
-
-static char *ComponentsFromPSTs(PST **psts,int pcnt) {
- char **names=NULL;
- int ncnt=0, nmax=0;
- int i,j,len;
- char *ret;
-
- /* First find all the names */
- for ( i=0; i<pcnt; ++i ) {
- char *nlist = psts[i]->u.alt.components;
- char *start, *pt, ch;
-
- for ( start = nlist; ; ) {
- while ( *start==' ' )
- ++start;
- if ( *start=='\0' )
- break;
- for ( pt=start; *pt!=' ' && *pt!='\0'; ++pt );
- ch = *pt; *pt = '\0';
- for ( j=0; j<ncnt; ++j )
- if ( strcmp( start,names[j])==0 )
- break;
- if ( j==ncnt ) {
- if ( ncnt>=nmax )
- names = grealloc(names,(nmax+=10)*sizeof(char *));
- names[ncnt++] = copy(start);
- }
- *pt = ch;
- start = pt;
- }
- }
-
- len = 0;
- for ( i=0; i<ncnt; ++i )
- len += strlen(names[i])+1;
- if ( len==0 ) len=1;
- ret = galloc(len);
- len = 0;
- for ( i=0; i<ncnt; ++i ) {
- strcpy(ret+len,names[i]);
- len += strlen(names[i]);
- ret[len++] = ' ';
- }
- if ( len==0 )
- *ret = '\0';
- else
- ret[len-1] = '\0';
-
- for ( i=0; i<ncnt; ++i )
- free(names[i]);
- free(names);
-return( ret );
-}
-
-static int SllkMatch(struct sllk *sllk,int s1,int s2) {
- int i;
-
- if ( sllk[s1].cnt != sllk[s2].cnt )
-return( false );
-
- for ( i=0; i<sllk[s1].cnt; ++i ) {
- if ( sllk[s1].lookups[i] != sllk[s2].lookups[i] )
-return( false );
- }
-
-return( true );
-}
-
-struct sllk *AddOTLToSllks( OTLookup *otl, struct sllk *sllk,
- int *_sllk_cnt, int *_sllk_max ) {
- FeatureScriptLangList *fl;
- struct scriptlanglist *sl;
- int s;
-
- for ( fl=otl->features; fl!=NULL; fl=fl->next ) {
- for ( sl=fl->scripts; sl!=NULL; sl=sl->next ) {
- for ( s=0; s<*_sllk_cnt; ++s )
- if ( sl->script == sllk[s].script )
- break;
- if ( s==*_sllk_cnt ) {
- if ( *_sllk_cnt>=*_sllk_max )
- sllk = grealloc(sllk,((*_sllk_max)+=10)*sizeof(struct sllk));
- memset(&sllk[*_sllk_cnt],0,sizeof(struct sllk));
- sllk[(*_sllk_cnt)++].script = sl->script;
- }
- AddOTLToSllk(&sllk[s], otl,sl);
- }
- }
-return( sllk );
-}
-
-OTLookup *NewAALTLookup(SplineFont *sf,struct sllk *sllk, int sllk_cnt, int i) {
- OTLookup *otl;
- struct lookup_subtable *sub;
- FeatureScriptLangList *fl;
- struct scriptlanglist *sl;
- PST **psts, *pst;
- int j,k,l;
- int gid,pcnt;
- SplineFont *_sf;
- SplineChar *sc;
-
- /* Make the new lookup (and all its supporting data structures) */
- otl = chunkalloc(sizeof(OTLookup));
- otl->lookup_type = gsub_alternate;
- otl->lookup_flags = sllk[i].lookups[0]->lookup_flags & pst_r2l;
- otl->features = fl = chunkalloc(sizeof(FeatureScriptLangList));
- fl->featuretag = CHR('a','a','l','t');
- /* Any other scripts with the same lookup set? */
- for ( j=i; j<sllk_cnt; ++j ) {
- if ( i==j || SllkMatch(sllk,i,j)) {
- sl = chunkalloc(sizeof(struct scriptlanglist));
- sl->next = fl->scripts;
- fl->scripts = sl;
- sl->script = sllk[j].script;
- sl->lang_cnt = sllk[j].lcnt;
- if ( sl->lang_cnt>MAX_LANG )
- sl->morelangs = galloc((sl->lang_cnt-MAX_LANG)*sizeof(uint32));
- for ( l=0; l<sl->lang_cnt; ++l )
- if ( l<MAX_LANG )
- sl->langs[l] = sllk[j].langs[l];
- else
- sl->morelangs[l-MAX_LANG] = sllk[j].langs[l];
- if ( i!=j ) sllk[j].cnt = 0; /* Mark as processed */
- }
- }
- otl->subtables = sub = chunkalloc(sizeof(struct lookup_subtable));
- sub->lookup = otl;
- sub->per_glyph_pst_or_kern = true;
-
- /* Add it to the various lists it needs to be in */
- otl->next = sf->gsub_lookups;
- sf->gsub_lookups = otl;
-
- /* Now look at every glyph in the font, and see if it has any of the */
- /* lookups we are interested in, and if it does, build a new pst */
- /* containing all posibilities listed on any of them */
- if ( sf->cidmaster ) sf = sf->cidmaster;
- psts = galloc(sllk[i].cnt*sizeof(PST *));
- k=0;
- do {
- _sf = k<sf->subfontcnt ? sf->subfonts[k] : sf;
- for ( gid=0; gid<_sf->glyphcnt; ++gid ) if ( (sc = _sf->glyphs[gid])!=NULL ) {
- pcnt = 0;
- for ( pst=sc->possub; pst!=NULL; pst=pst->next ) {
- if ( pst->subtable==NULL )
- continue;
- for ( j=0; j<sllk[i].cnt; ++j )
- if ( pst->subtable->lookup == sllk[i].lookups[j] )
- break;
- if ( j<sllk[i].cnt )
- psts[pcnt++] = pst;
- }
- if ( pcnt==0 )
- continue;
- pst = chunkalloc(sizeof(PST));
- pst->subtable = sub;
- pst->type = pst_alternate;
- pst->next = sc->possub;
- sc->possub = pst;
- pst->u.alt.components = ComponentsFromPSTs(psts,pcnt);
- }
- ++k;
- } while ( k<sf->subfontcnt );
- free(psts);
- NameOTLookup(otl,sf);
-return( otl );
-}
-
-void AddNewAALTFeatures(SplineFont *sf) {
- /* different script/lang combinations may need different 'aalt' lookups */
- /* well, let's just say different script combinations */
- /* for each script/lang combo find all single/alternate subs for each */
- /* glyph. Merge those choices and create new lookup with that info */
- struct sllk *sllk = NULL;
- int sllk_cnt=0, sllk_max = 0;
- int i;
- OTLookup *otl;
-
- AALTRemoveOld(sf);
-
- /* Find all scripts, and all the single/alternate lookups for each */
- /* and all the languages used for these in each script */
- for ( otl=sf->gsub_lookups; otl!=NULL; otl=otl->next ) {
- sllk = AddOTLToSllks( otl, sllk, &sllk_cnt, &sllk_max );
- }
- /* Each of these gets its own gsub_alternate lookup which gets inserted */
- /* at the head of the lookup list. Each lookup has one subtable */
- for ( i=0; i<sllk_cnt; ++i ) {
- if ( sllk[i].cnt==0 ) /* Script used, but provides no alternates */
- continue;
- NewAALTLookup(sf,sllk,sllk_cnt,i);
- }
-
- SllkFree(sllk,sllk_cnt);
-}
-
-
-int VerticalKernFeature(SplineFont *sf, OTLookup *otl, int ask) {
- FeatureScriptLangList *fl;
- struct lookup_subtable *sub;
- KernClass *kc;
- char *buts[3];
-
- for ( fl=otl->features; fl!=NULL; fl=fl->next ) {
- if ( fl->featuretag==CHR('k','e','r','n') )
-return( false );
- else if ( fl->featuretag==CHR('v','k','r','n') )
-return( true );
- }
-
- for ( sub=otl->subtables; sub!=NULL; sub=sub->next ) {
- if ( sub->kc!=NULL ) {
- for ( kc=sf->kerns; kc!=NULL; kc=kc->next )
- if ( kc==sub->kc )
-return( false );
- for ( kc=sf->vkerns; kc!=NULL; kc=kc->next )
- if ( kc==sub->kc )
-return( true );
- }
- }
-
- if ( !ask )
-return( -1 );
-
- buts[0] = _("_Horizontal"); buts[1] = _("_Vertical"); buts[2] = NULL;
-return( ff_ask(_("Kerning direction"),(const char **) buts,0,1,_("Is this horizontal or vertical kerning data?")) );
-}
-
-int IsAnchorClassUsed(SplineChar *sc,AnchorClass *an) {
- AnchorPoint *ap;
- int waslig=0, sawentry=0, sawexit=0;
-
- for ( ap=sc->anchor; ap!=NULL; ap=ap->next ) {
- if ( ap->anchor==an ) {
- if ( ap->type==at_centry )
- sawentry = true;
- else if ( ap->type==at_cexit )
- sawexit = true;
- else if ( an->type==act_mkmk ) {
- if ( ap->type==at_basemark )
- sawexit = true;
- else
- sawentry = true;
- } else if ( ap->type!=at_baselig )
-return( -1 );
- else if ( waslig<ap->lig_index+1 )
- waslig = ap->lig_index+1;
- }
- }
- if ( sawentry && sawexit )
-return( -1 );
- else if ( sawentry )
-return( -2 );
- else if ( sawexit )
-return( -3 );
-return( waslig );
-}
-
-int PSTContains(const char *components,const char *name) {
- const char *pt;
- int len = strlen(name);
-
- for ( pt = strstr(components,name); pt!=NULL; pt = strstr(pt+len,name)) {
- if (( pt==components || pt[-1]==' ') && (pt[len]==' ' || pt[len]=='\0'))
-return( true );
- }
-return( false );
-}
-
-int KernClassContains(KernClass *kc, char *name1, char *name2, int ordered ) {
- int infirst=0, insecond=0, scpos1=0, kwpos1=0, scpos2=0, kwpos2=0;
- int i;
-
- for ( i=1; i<kc->first_cnt; ++i ) {
- if ( PSTContains(kc->firsts[i],name1) ) {
- scpos1 = i;
- if ( ++infirst>=3 ) /* The name occurs twice??? */
- break;
- } else if ( PSTContains(kc->firsts[i],name2) ) {
- kwpos1 = i;
- if ( (infirst+=2)>=3 )
- break;
- }
- }
- if ( infirst==0 || infirst>3 )
-return( 0 );
- for ( i=1; i<kc->second_cnt; ++i ) {
- if ( PSTContains(kc->seconds[i],name1) ) {
- scpos2 = i;
- if ( ++insecond>=3 )
- break;
- } else if ( PSTContains(kc->seconds[i],name2) ) {
- kwpos2 = i;
- if ( (insecond+=2)>=3 )
- break;
- }
- }
- if ( insecond==0 || insecond>3 )
-return( 0 );
- if ( (infirst&1) && (insecond&2) ) {
- if ( kc->offsets[scpos1*kc->second_cnt+kwpos2]!=0 )
-return( kc->offsets[scpos1*kc->second_cnt+kwpos2] );
- }
- if ( !ordered ) {
- if ( (infirst&2) && (insecond&1) ) {
- if ( kc->offsets[kwpos1*kc->second_cnt+scpos2]!=0 )
-return( kc->offsets[kwpos1*kc->second_cnt+scpos2] );
- }
- }
-return( 0 );
-}
-
-int KCFindName(char *name, char **classnames, int cnt ) {
- int i;
- char *pt, *end, ch;
-
- for ( i=0; i<cnt; ++i ) {
- if ( classnames[i]==NULL )
- continue;
- for ( pt = classnames[i]; *pt; pt=end+1 ) {
- end = strchr(pt,' ');
- if ( end==NULL ) end = pt+strlen(pt);
- ch = *end;
- *end = '\0';
- if ( strcmp(pt,name)==0 ) {
- *end = ch;
-return( i );
- }
- *end = ch;
- if ( ch=='\0' )
- break;
- }
- }
-return( 0 );
-}
-
-int KCFindIndex(KernClass *kc,char *name1, char *name2) {
- int f,l;
-
- f = KCFindName(name1,kc->firsts,kc->first_cnt);
- l = KCFindName(name2,kc->seconds,kc->second_cnt);
- if ( (f!=0 || kc->firsts[0]!=NULL) && l!=0 )
-return( f*kc->second_cnt+l );
-
-return( -1 );
-}
-
-
-static void NOFI_SortInsertLookup(SplineFont *sf, OTLookup *newotl) {
- (void)sf;
- (void)newotl;
-}
-
-static void NOFI_OTLookupCopyInto(SplineFont *into_sf,SplineFont *from_sf,
- OTLookup *from_otl, OTLookup *to_otl, int scnt, OTLookup *before ) {
- (void)into_sf;
- (void)from_sf;
- (void)from_otl;
- (void)to_otl;
- (void)scnt;
- (void)before;
-}
-
-static void NOFI_Destroy(SplineFont *sf) {
- (void)sf;
-}
-
-struct fi_interface noui_fi = {
- NOFI_SortInsertLookup,
- NOFI_OTLookupCopyInto,
- NOFI_Destroy
-};
-
-struct fi_interface *fi_interface = &noui_fi;
-
-void FF_SetFIInterface(struct fi_interface *fii) {
- fi_interface = fii;
-}
diff --git a/Build/source/texk/web2c/luatexdir/luafontloader/fontforge/fontforge/lookups.h b/Build/source/texk/web2c/luatexdir/luafontloader/fontforge/fontforge/lookups.h
deleted file mode 100644
index 2489d0c137c..00000000000
--- a/Build/source/texk/web2c/luatexdir/luafontloader/fontforge/fontforge/lookups.h
+++ /dev/null
@@ -1,2 +0,0 @@
-extern void SortInsertLookup(SplineFont *sf, OTLookup *newotl);
-extern char *SuffixFromTags(FeatureScriptLangList *fl);
diff --git a/Build/source/texk/web2c/luatexdir/luafontloader/fontforge/fontforge/macbinary.c b/Build/source/texk/web2c/luatexdir/luafontloader/fontforge/fontforge/macbinary.c
deleted file mode 100644
index ca8ceed899f..00000000000
--- a/Build/source/texk/web2c/luatexdir/luafontloader/fontforge/fontforge/macbinary.c
+++ /dev/null
@@ -1,1543 +0,0 @@
-/* Copyright (C) 2000-2008 by George Williams */
-/*
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are met:
-
- * Redistributions of source code must retain the above copyright notice, this
- * list of conditions and the following disclaimer.
-
- * Redistributions in binary form must reproduce the above copyright notice,
- * this list of conditions and the following disclaimer in the documentation
- * and/or other materials provided with the distribution.
-
- * The name of the author may not be used to endorse or promote products
- * derived from this software without specific prior written permission.
-
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
- * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
- * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
- * EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
- * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
- * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
- * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
- * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-#include "fontforgevw.h"
-#include <stdlib.h>
-#include <string.h>
-#include <unistd.h>
-#include <math.h>
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <time.h>
-#include <ustring.h>
-#include "ttf.h"
-#include "psfont.h"
-#ifdef LUA_FF_LIB
-# undef __Mac
-#endif
-#if __Mac
-# include <ctype.h>
-# include </Developer/Headers/FlatCarbon/Files.h>
-#else
-# include <utype.h>
-# undef __Mac
-# define __Mac 0
-#endif
-
-const int mac_dpi = 72;
-/* I had always assumed that the mac still believed in 72dpi screens, but I */
-/* see that in geneva under OS/9, the pointsize does not match the pixel */
-/* size of the font. But the dpi is not constant (and the differences */
-/* excede those supplied by rounding errors) varying between 96 and 84dpi */
-
-/* A Mac Resource fork */
-/* http://developer.apple.com/techpubs/mac/MoreToolbox/MoreToolbox-9.html */
-/* begins with a 16 byte header containing: */
-/* resource start offset */
-/* map start offset */
-/* resource length */
-/* map length */
-/* then 256-16 bytes of zeros */
-/* the resource section consists of (many) */
-/* 4 byte length count */
-/* resource data */
-/* the map section contains */
-/* A copy of the 16 byte header */
-/* a 4 byte mac internal value (I hope) */
-/* another 4 bytes of mac internal values (I hope) */
-/* a 2 byte offset from the start of the map section to the list of resource types */
-/* a 2 byte offset from the start of the map section to the list of resource names */
-/* The resource type list consists of */
-/* a 2 byte count of the number of resource types (-1) */
-/* (many copies of) */
-/* a 4 byte resource type ('FOND' for example) */
-/* a 2 byte count of the number of resources of this type (-1) */
-/* a 2 byte offset from the type list start to the resource table */
-/* a resource table looks like */
-/* a 2 byte offset from the resource name table to a pascal */
-/* string containing this resource's name (or 0xffff for none) */
-/* 1 byte of resource flags */
-/* 3 bytes of offset from the resource section to the length & */
-/* data of this instance of the resource type */
-/* 4 bytes of 0 */
-/* The resource name section consists of */
-/* a bunch of pascal strings (ie. preceded by a length byte) */
-
-/* The POST resource isn't noticeably documented, it's pretty much a */
-/* straight copy of the pfb file cut up into 0x800 byte chunks. */
-/* (each section of the pfb file has it's own set of chunks, the last may be smaller than 0x800) */
-/* The NFNT resource http://developer.apple.com/techpubs/mac/Text/Text-250.html */
-/* The FOND resource http://developer.apple.com/techpubs/mac/Text/Text-269.html */
-/* The sfnt resource is basically a copy of the ttf file */
-
-/* A MacBinary file */
-/* http://www.lazerware.com/formats/macbinary.html */
-/* begins with a 128 byte header */
-/* (which specifies lengths for data/resource forks) */
-/* (and contains mac type/creator data) */
-/* (and other stuff) */
-/* (and finally a crc checksum) */
-/* is followed by the data section (padded to a mult of 128 bytes) */
-/* is followed by the resource section (padded to a mult of 128 bytes) */
-
-/* ******************************** Creation ******************************** */
-
-
-struct resource {
- uint32 pos;
- uint8 flags;
- uint16 id;
- char *name;
- uint32 nameloc;
- uint32 nameptloc;
-};
-
-struct resourcetype {
- uint32 tag;
- struct resource *res;
- uint32 resloc;
-};
-
-struct macbinaryheader {
- char *macfilename;
- char *binfilename; /* if macfilename is null and this is set we will figure out macfilename by removing .bin */
- uint32 type;
- uint32 creator;
-};
-
-
-enum psstyle_flags { psf_bold = 1, psf_italic = 2, psf_outline = 4,
- psf_shadow = 0x8, psf_condense = 0x10, psf_extend = 0x20
-};
-
-uint16 _MacStyleCode(char *styles, SplineFont * sf, uint16 * psstylecode)
-{
- unsigned short stylecode = 0, psstyle = 0;
-
- if (strstrmatch(styles, "Bold") || strstrmatch(styles, "Demi") ||
- strstrmatch(styles, "Heav") || strstrmatch(styles, "Blac") ||
-/* A few fonts have German/French styles in their names */
- strstrmatch(styles, "Fett") || strstrmatch(styles, "Gras")) {
- stylecode = sf_bold;
- psstyle = psf_bold;
- } else if (sf != NULL && sf->weight != NULL &&
- (strstrmatch(sf->weight, "Bold")
- || strstrmatch(sf->weight, "Demi")
- || strstrmatch(sf->weight, "Heav")
- || strstrmatch(sf->weight, "Blac")
- || strstrmatch(sf->weight, "Fett")
- || strstrmatch(sf->weight, "Gras"))) {
- stylecode = sf_bold;
- psstyle = psf_bold;
- }
- /* URW uses four leter abbreviations of Italic and Oblique */
- /* Somebody else uses two letter abbrevs */
- if ((sf != NULL && sf->italicangle != 0) ||
- strstrmatch(styles, "Ital") ||
- strstrmatch(styles, "Obli") ||
- strstrmatch(styles, "Slanted") ||
- strstrmatch(styles, "Kurs") || strstr(styles, "It")) {
- stylecode |= sf_italic;
- psstyle |= psf_italic;
- }
- if (strstrmatch(styles, "Underline")) {
- stylecode |= sf_underline;
- }
- if (strstrmatch(styles, "Outl")) {
- stylecode |= sf_outline;
- psstyle |= psf_outline;
- }
- if (strstr(styles, "Shadow") != NULL) {
- stylecode |= sf_shadow;
- psstyle |= psf_shadow;
- }
- if (strstrmatch(styles, "Cond") || strstr(styles, "Cn") ||
- strstrmatch(styles, "Narrow")) {
- stylecode |= sf_condense;
- psstyle |= psf_condense;
- }
- if (strstrmatch(styles, "Exte") || strstr(styles, "Ex")) {
- stylecode |= sf_extend;
- psstyle |= psf_extend;
- }
- if ((psstyle & psf_extend) && (psstyle & psf_condense)) {
- if (sf != NULL)
- LogError(_
- ("Warning: %s(%s) is both extended and condensed. That's impossible.\n"),
- sf->fontname, sf->origname);
- else
- LogError(_
- ("Warning: Both extended and condensed. That's impossible.\n"));
- psstyle &= ~psf_extend;
- stylecode &= ~sf_extend;
- }
- if (psstylecode != NULL)
- *psstylecode = psstyle;
- return (stylecode);
-}
-
-
-
-/* ******************************** Reading ********************************* */
-
-static SplineFont *SearchPostscriptResources(FILE * f, long rlistpos,
- int subcnt, long rdata_pos,
- long name_list, int flags)
-{
- long here = ftell(f);
- long *offsets, lenpos;
- int rname = -1, tmp;
- int ch1, ch2;
- int len, type, i, j, rlen;
- unsigned short id, *rsrcids;
- /* I don't pretend to understand the rational behind the format of a */
- /* postscript font. It appears to be split up into chunks where the */
- /* maximum chunk size is 0x800, each section (ascii, binary, ascii, eof) */
- /* has its own set of chunks (ie chunks don't cross sections) */
- char *buffer = NULL;
- int max = 0;
- FILE *pfb;
- FontDict *fd;
- SplineFont *sf;
- (void) name_list;
- fseek(f, rlistpos, SEEK_SET);
- rsrcids = gcalloc(subcnt, sizeof(short));
- offsets = gcalloc(subcnt, sizeof(long));
- for (i = 0; i < subcnt; ++i) {
- rsrcids[i] = getushort(f);
- tmp = (short) getushort(f);
- if (rname == -1)
- rname = tmp;
- /* flags = */ getc(f);
- ch1 = getc(f);
- ch2 = getc(f);
- offsets[i] = rdata_pos + ((ch1 << 16) | (ch2 << 8) | getc(f));
- /* mbz = */ getlong(f);
- }
-
- pfb = tmpfile();
- if (pfb == NULL) {
- LogError(_("Can't open temporary file for postscript output\n"));
- fseek(f, here, SEEK_SET);
- free(offsets);
- return (NULL);
- }
-
- putc(0x80, pfb);
- putc(1, pfb);
- lenpos = ftell(pfb);
- putc(0, pfb);
- putc(0, pfb);
- putc(0, pfb);
- putc(0, pfb);
- len = 0;
- type = 1;
- id = 501;
- for (i = 0; i < subcnt; ++i) {
- for (j = 0; j < subcnt; ++j)
- if (rsrcids[j] == id)
- break;
- if (j == subcnt) {
- LogError(_("Missing POST resource %u\n"), id);
- break;
- }
- id = id + 1;
- fseek(f, offsets[j], SEEK_SET);
- rlen = getlong(f);
- ch1 = getc(f);
- ch2 = getc(f);
- rlen -= 2; /* those two bytes don't count as real data */
- if (ch1 == type)
- len += rlen;
- else {
- long hold = ftell(pfb);
- fseek(pfb, lenpos, SEEK_SET);
- putc(len >> 24, pfb);
- putc((len >> 16) & 0xff, pfb);
- putc((len >> 8) & 0xff, pfb);
- putc(len & 0xff, pfb);
- fseek(pfb, hold, SEEK_SET);
- if (ch1 == 5) /* end of font mark */
- break;
- putc(0x80, pfb);
- putc(ch1, pfb);
- lenpos = ftell(pfb);
- putc(0, pfb);
- putc(0, pfb);
- putc(0, pfb);
- putc(0, pfb);
- type = ch1;
- len = rlen;
- }
- if (rlen > max) {
- free(buffer);
- max = rlen;
- if (max < 0x800)
- max = 0x800;
- buffer = galloc(max);
- if (buffer == NULL) {
- LogError(_("Out of memory\n"));
- exit(1);
- }
- }
- if(fread(buffer, 1, rlen, f) != ((size_t)rlen) ) {
- LogError(_("Unable to read %u bytes for buffer\n"),rlen);
- exit(1);
- }
- fwrite(buffer, 1, rlen, pfb);
- }
- free(buffer);
- free(offsets);
- free(rsrcids);
- putc(0x80, pfb);
- putc(3, pfb);
- fseek(pfb, lenpos, SEEK_SET);
- putc(len >> 24, pfb);
- putc((len >> 16) & 0xff, pfb);
- putc((len >> 8) & 0xff, pfb);
- putc(len & 0xff, pfb);
- fseek(f, here, SEEK_SET);
- rewind(pfb);
- if (flags & ttf_onlynames)
- return ((SplineFont *) _NamesReadPostscript(pfb)); /* This closes the font for us */
-
- fd = _ReadPSFont(pfb);
- sf = NULL;
- if (fd != NULL) {
- sf = SplineFontFromPSFont(fd);
- PSFontFree(fd);
- /* There is no FOND in a postscript file, so we can't read any kerning */
- }
- fclose(pfb);
- return (sf);
-}
-
-static SplineFont *SearchTtfResources(FILE * f, long rlistpos, int subcnt,
- long rdata_pos, long name_list,
- char *filename, int flags,
- enum openflags openflags)
-{
- long here, start = ftell(f);
- long roff;
- int rname = -1;
- int ch1, ch2;
- int len, i, rlen, ilen;
- /* The sfnt resource is just a copy of the ttf file */
- char *buffer = NULL;
- int max = 0;
- FILE *ttf;
- SplineFont *sf;
- int which = 0;
- char **names;
- char *pt, *lparen, *rparen;
- char *chosenname = NULL;
- (void) name_list;
- fseek(f, rlistpos, SEEK_SET);
- if (subcnt > 1 || (flags & ttf_onlynames)) {
- names = gcalloc(subcnt + 1, sizeof(char *));
- for (i = 0; i < subcnt; ++i) {
- /* resource id = */ getushort(f);
- /* rname = (short) */ getushort(f);
- /* flags = */ getc(f);
- ch1 = getc(f);
- ch2 = getc(f);
- roff = rdata_pos + ((ch1 << 16) | (ch2 << 8) | getc(f));
- /* mbz = */ getlong(f);
- here = ftell(f);
- names[i] = TTFGetFontName(f, roff + 4, roff + 4);
- if (names[i] == NULL) {
- char buffer[32];
- sprintf(buffer, "Nameless%d", i);
- names[i] = copy(buffer);
- }
- fseek(f, here, SEEK_SET);
- }
- if (flags & ttf_onlynames) {
- return ((SplineFont *) names);
- }
- if ((pt = strrchr(filename, '/')) == NULL)
- pt = filename;
- /* Someone gave me a font "Nafees Nastaleeq(Updated).ttf" and complained */
- /* that ff wouldn't open it */
- /* Now someone will complain about "Nafees(Updated).ttc(fo(ob)ar)" */
- if ((lparen = strrchr(pt, '(')) != NULL &&
- (rparen = strrchr(lparen, ')')) != NULL && rparen[1] == '\0') {
- char *find = copy(lparen + 1);
- pt = strchr(find, ')');
- if (pt != NULL)
- *pt = '\0';
- for (which = subcnt - 1; which >= 0; --which)
- if (strcmp(names[which], find) == 0)
- break;
- if (which == -1) {
- char *end;
- which = strtol(find, &end, 10);
- if (*end != '\0')
- which = -1;
- }
- if (which == -1) {
- char *fn = copy(filename);
- fn[lparen - filename] = '\0';
- ff_post_error(_("Not in Collection"), _("%s is not in %.100s"),
- find, fn);
- free(fn);
- }
- free(find);
- } else
- which = 0;
- if (lparen == NULL && which != -1)
- chosenname = copy(names[which]);
- for (i = 0; i < subcnt; ++i)
- free(names[i]);
- free(names);
- fseek(f, rlistpos, SEEK_SET);
- }
-
- for (i = 0; i < subcnt; ++i) {
- /* resource id = */ getushort(f);
- rname = (short) getushort(f);
- /* flags = */ getc(f);
- ch1 = getc(f);
- ch2 = getc(f);
- roff = rdata_pos + ((ch1 << 16) | (ch2 << 8) | getc(f));
- /* mbz = */ getlong(f);
- if (i != which)
- continue;
- here = ftell(f);
-
- ttf = tmpfile();
- if (ttf == NULL) {
- LogError(_("Can't open temporary file for truetype output.\n"));
- continue;
- }
-
- fseek(f, roff, SEEK_SET);
- ilen = rlen = getlong(f);
- if (rlen > 16 * 1024)
- ilen = 16 * 1024;
- if (ilen > max) {
- free(buffer);
- max = ilen;
- if (max < 0x800)
- max = 0x800;
- buffer = malloc(max);
- }
- for (len = 0; len < rlen;) {
- int temp = ilen;
- if (rlen - len < ilen)
- temp = rlen - len;
- temp = fread(buffer, 1, temp, f);
- if (temp == EOF)
- break;
- fwrite(buffer, 1, temp, ttf);
- len += temp;
- }
- rewind(ttf);
- sf = _SFReadTTF(ttf, flags, openflags, NULL, NULL);
- fclose(ttf);
- if (sf != NULL) {
- free(buffer);
- fseek(f, start, SEEK_SET);
- if (sf->chosenname == NULL)
- sf->chosenname = chosenname;
- return (sf);
- }
- fseek(f, here, SEEK_SET);
- }
- free(chosenname);
- free(buffer);
- fseek(f, start, SEEK_SET);
- return (NULL);
-}
-
-typedef struct fond {
- char *fondname;
- int first, last;
- int assoc_cnt;
- struct assoc {
- short size, style, id;
- } *assoc;
- /* size==0 => scalable */
- /* style>>8 is the bit depth (0=>1, 1=>2, 2=>4, 3=>8) */
- /* search order for ID is sfnt, NFNT, FONT */
- int stylewidthcnt;
- struct stylewidths {
- short style;
- short *widthtab; /* 4.12 fixed number with the width specified as a fraction of an em */
- } *stylewidths;
- int stylekerncnt;
- struct stylekerns {
- short style;
- int kernpairs;
- struct kerns {
- unsigned char ch1, ch2;
- short offset; /* 4.12 */
- } *kerns;
- } *stylekerns;
- char *psnames[48];
- struct fond *next;
-} FOND;
-
-struct MacFontRec {
- short fontType;
- short firstChar;
- short lastChar;
- short widthMax;
- short kernMax; /* bb learing */
- short Descent; /* maximum negative distance below baseline */
- short fRectWidth; /* bounding box width */
- short fRectHeight; /* bounding box height */
- unsigned short *offsetWidths; /* offset to start of offset/width table */
- /* 0xffff => undefined, else high byte is offset in locTable, */
- /* low byte is width */
- short ascent;
- short descent;
- short leading;
- short rowWords; /* shorts per row */
- unsigned short *fontImage; /* rowWords*fRectHeight */
- /* Images for all characters plus one extra for undefined */
- unsigned short *locs; /* lastchar-firstchar+3 words */
- /* Horizontal offset to start of n'th character. Note: applies */
- /* to each row. Missing characters have same loc as following */
-};
-
-static void FondListFree(FOND * list)
-{
- FOND *next;
- int i;
-
- while (list != NULL) {
- next = list->next;
- free(list->assoc);
- for (i = 0; i < list->stylewidthcnt; ++i)
- free(list->stylewidths[i].widthtab);
- free(list->stylewidths);
- for (i = 0; i < list->stylekerncnt; ++i)
- free(list->stylekerns[i].kerns);
- free(list->stylekerns);
- for (i = 0; i < 48; ++i)
- free(list->psnames[i]);
- free(list);
- list = next;
- }
-}
-
-/* There's probably only one fond in the file, but there could be more so be */
-/* prepared... */
-/* I want the fond: */
-/* to get the fractional widths for the SWIDTH entry on bdf */
-/* to get the font name */
-/* to get the font association tables */
-/* to get the style flags */
-/* http://developer.apple.com/techpubs/mac/Text/Text-269.html */
-static FOND *BuildFondList(FILE * f, long rlistpos, int subcnt, long rdata_pos,
- long name_list, int flags)
-{
- long here, start = ftell(f);
- long offset;
- int rname = -1;
- char name[300];
- int ch1, ch2;
- int i, j, k, cnt, isfixed;
- FOND *head = NULL, *cur;
- long widoff, kernoff, styleoff;
-
- fseek(f, rlistpos, SEEK_SET);
- for (i = 0; i < subcnt; ++i) {
- /* resource id = */ getushort(f);
- rname = (short) getushort(f);
- /* flags = */ getc(f);
- ch1 = getc(f);
- ch2 = getc(f);
- offset = rdata_pos + ((ch1 << 16) | (ch2 << 8) | getc(f));
- /* mbz = */ getlong(f);
- here = ftell(f);
-
- cur = gcalloc(1, sizeof(FOND));
- cur->next = head;
- head = cur;
-
- if (rname != -1) {
- fseek(f, name_list + rname, SEEK_SET);
- ch1 = getc(f);
- if( fread(name, 1, ch1, f) != ((size_t)ch1)) {
- LogError(_("Unable to read %u bytes for name, but going on.\n"),ch1);
- }
- name[ch1] = '\0';
- cur->fondname = copy(name);
- }
-
- offset += 4;
- fseek(f, offset, SEEK_SET);
- isfixed = getushort(f) & 0x8000 ? 1 : 0;
- /* family id = */ getushort(f);
- cur->first = getushort(f);
- cur->last = getushort(f);
-/* on a 1 point font... */
- /* ascent = */ getushort(f);
- /* descent = (short) */ getushort(f);
- /* leading = */ getushort(f);
- /* widmax = */ getushort(f);
- if ((widoff = getlong(f)) != 0)
- widoff += offset;
- if ((kernoff = getlong(f)) != 0)
- kernoff += offset;
- if ((styleoff = getlong(f)) != 0)
- styleoff += offset;
- for (j = 0; j < 9; ++j)
- getushort(f);
- /* internal & undefined, for international scripts = */ getlong(f);
- /* version = */ getushort(f);
- cur->assoc_cnt = getushort(f) + 1;
- cur->assoc = gcalloc(cur->assoc_cnt, sizeof(struct assoc));
- for (j = 0; j < cur->assoc_cnt; ++j) {
- cur->assoc[j].size = getushort(f);
- cur->assoc[j].style = getushort(f);
- cur->assoc[j].id = getushort(f);
- }
- if (widoff != 0) {
- fseek(f, widoff, SEEK_SET);
- cnt = getushort(f) + 1;
- cur->stylewidthcnt = cnt;
- cur->stylewidths = gcalloc(cnt, sizeof(struct stylewidths));
- for (j = 0; j < cnt; ++j) {
- cur->stylewidths[j].style = getushort(f);
- cur->stylewidths[j].widthtab =
- galloc((cur->last - cur->first + 3) * sizeof(short));
- for (k = cur->first; k <= cur->last + 2; ++k)
- cur->stylewidths[j].widthtab[k] = getushort(f);
- }
- }
- if (kernoff != 0 && (flags & ttf_onlykerns)) {
- fseek(f, kernoff, SEEK_SET);
- cnt = getushort(f) + 1;
- cur->stylekerncnt = cnt;
- cur->stylekerns = gcalloc(cnt, sizeof(struct stylekerns));
- for (j = 0; j < cnt; ++j) {
- cur->stylekerns[j].style = getushort(f);
- cur->stylekerns[j].kernpairs = getushort(f);
- cur->stylekerns[j].kerns =
- galloc(cur->stylekerns[j].kernpairs * sizeof(struct kerns));
- for (k = 0; k < cur->stylekerns[j].kernpairs; ++k) {
- cur->stylekerns[j].kerns[k].ch1 = getc(f);
- cur->stylekerns[j].kerns[k].ch2 = getc(f);
- cur->stylekerns[j].kerns[k].offset = getushort(f);
- }
- }
- }
- if (styleoff != 0) {
- uint8 stringoffsets[48];
- int strcnt, stringlen, format;
- char **strings, *pt;
- fseek(f, styleoff, SEEK_SET);
- /* class = */ getushort(f);
- /* glyph encoding offset = */ getlong(f);
- /* reserved = */ getlong(f);
- for (j = 0; j < 48; ++j)
- stringoffsets[j] = getc(f);
- strcnt = getushort(f);
- strings = galloc(strcnt * sizeof(char *));
- for (j = 0; j < strcnt; ++j) {
- stringlen = getc(f);
- strings[j] = galloc(stringlen + 2);
- strings[j][0] = stringlen;
- strings[j][stringlen + 1] = '\0';
- for (k = 0; k < stringlen; ++k)
- strings[j][k + 1] = getc(f);
- }
- for (j = 0; j < 48; ++j) {
- for (k = j - 1; k >= 0; --k)
- if (stringoffsets[j] == stringoffsets[k])
- break;
- if (k != -1)
- continue; /* this style doesn't exist */
- format = stringoffsets[j] - 1;
- stringlen = strings[0][0];
- if (format != 0)
- for (k = 0; k < strings[format][0]; ++k)
- stringlen += strings[strings[format][k + 1] - 1][0];
- pt = cur->psnames[j] = galloc(stringlen + 1);
- strcpy(pt, strings[0] + 1);
- pt += strings[0][0];
- if (format != 0)
- for (k = 0; k < strings[format][0]; ++k) {
- strcpy(pt, strings[strings[format][k + 1] - 1] + 1);
- pt += strings[strings[format][k + 1] - 1][0];
- }
- *pt = '\0';
- }
- for (j = 0; j < strcnt; ++j)
- free(strings[j]);
- free(strings);
- }
- fseek(f, here, SEEK_SET);
- }
- fseek(f, start, SEEK_SET);
- return (head);
-}
-
-static char *BuildName(char *family, int style)
-{
- char buffer[350] = "";
-
- strncpy(buffer, family, 200);
- if (style != 0)
- strcat(buffer, "-");
- if (style & sf_bold)
- strcat(buffer, "Bold");
- if (style & sf_italic)
- strcat(buffer, "Italic");
- if (style & sf_underline)
- strcat(buffer, "Underline");
- if (style & sf_outline)
- strcat(buffer, "Outline");
- if (style & sf_shadow)
- strcat(buffer, "Shadow");
- if (style & sf_condense)
- strcat(buffer, "Condensed");
- if (style & sf_extend)
- strcat(buffer, "Extended");
- return (copy(buffer));
-}
-
-static int GuessStyle(char *fontname, int *styles, int style_cnt)
-{
- int which, style;
- char *stylenames = _GetModifiers(fontname, NULL, NULL);
-
- style = _MacStyleCode(stylenames, NULL, NULL);
- for (which = style_cnt; which >= 0; --which)
- if (styles[which] == style)
- return (which);
-
- return (-1);
-}
-
-static FOND *PickFOND(FOND * fondlist, char *filename, char **name, int *style)
-{
- int i, j;
- FOND *test;
- uint8 stylesused[96];
- char **names;
- FOND **fonds = NULL, *fond = NULL;
- int *styles = NULL;
- int cnt, which;
- char *pt, *lparen;
- char *find = NULL;
-
- if ((pt = strrchr(filename, '/')) != NULL)
- pt = filename;
- if ((lparen = strchr(filename, '(')) != NULL && strchr(lparen, ')') != NULL) {
- find = copy(lparen + 1);
- pt = strchr(find, ')');
- if (pt != NULL)
- *pt = '\0';
- for (test = fondlist; test != NULL; test = test->next) {
- for (i = 0; i < 48; ++i)
- if (test->psnames[i] != NULL
- && strcmp(find, test->psnames[i]) == 0) {
- *style = (i & 3) | ((i & ~3) << 1); /* PS styles skip underline bit */
- *name = copy(test->psnames[i]);
- return (test);
- }
- }
- }
-
- /* The file may contain multiple families, and each family may contain */
- /* multiple styles (and each style may contain multiple sizes, but that's */
- /* not an issue for us here) */
- names = NULL;
- for (i = 0; i < 2; ++i) {
- cnt = 0;
- for (test = fondlist; test != NULL; test = test->next)
- if (test->fondname != NULL) {
- memset(stylesused, 0, sizeof(stylesused));
- for (j = 0; j < test->assoc_cnt; ++j) {
- if (test->assoc[j].size != 0
- && !stylesused[test->assoc[j].style]) {
- stylesused[test->assoc[j].style] = true;
- if (names != NULL) {
- names[cnt] =
- BuildName(test->fondname, test->assoc[j].style);
- styles[cnt] = test->assoc[j].style;
- fonds[cnt] = test;
- }
- ++cnt;
- }
- }
- }
- if (names == NULL) {
- names = gcalloc(cnt + 1, sizeof(char *));
- fonds = galloc(cnt * sizeof(FOND *));
- styles = galloc(cnt * sizeof(int));
- }
- }
-
- if (find != NULL) {
- for (which = cnt - 1; which >= 0; --which)
- if (strcmp(names[which], find) == 0)
- break;
- if (which == -1 && strstrmatch(find, test->fondname) != NULL)
- which = GuessStyle(find, styles, cnt);
- if (which == -1) {
- char *fn = copy(filename);
- fn[lparen - filename] = '\0';
- ff_post_error(_("Not in Collection"), _("%s is not in %.100s"),
- find, fn);
- free(fn);
- }
- free(find);
- } else
- which = 0;
-
- if (which != -1) {
- fond = fonds[which];
- *name = copy(names[which]);
- *style = styles[which];
- }
- for (i = 0; i < cnt; ++i)
- free(names[i]);
- free(names);
- free(fonds);
- free(styles);
- if (which == -1)
- return (NULL);
-
- return (fond);
-}
-
-
-/* Look for kerning info and merge it into the currently existing font "into" */
-static SplineFont *FindFamilyStyleKerns(SplineFont * into, EncMap * map,
- FOND * fondlist, char *filename)
-{
- char *name;
- int style;
- FOND *fond;
- int i, j;
- int ch1, ch2, offset;
- KernPair *kp;
- SplineChar *sc1, *sc2;
-
- fond = PickFOND(fondlist, filename, &name, &style);
- if (fond == NULL || into == NULL)
- return (NULL);
- for (i = 0; i < fond->stylekerncnt; ++i)
- if (fond->stylekerns[i].style == style)
- break;
- if (i == fond->stylekerncnt) {
- LogError(_("No kerning table for %s\n"), name);
- free(name);
- return (NULL);
- }
- for (j = 0; j < fond->stylekerns[i].kernpairs; ++j) {
- ch1 = fond->stylekerns[i].kerns[j].ch1;
- ch2 = fond->stylekerns[i].kerns[j].ch2;
- offset =
- (fond->stylekerns[i].kerns[j].offset *
- (into->ascent + into->descent) + (1 << 11)) >> 12;
- sc1 = SFMakeChar(into, map, ch1);
- sc2 = SFMakeChar(into, map, ch2);
- for (kp = sc1->kerns; kp != NULL; kp = kp->next)
- if (kp->sc == sc2)
- break;
- if (kp == NULL) {
- uint32 script;
- kp = chunkalloc(sizeof(KernPair));
- kp->sc = sc2;
- kp->next = sc1->kerns;
- sc1->kerns = kp;
- script = SCScriptFromUnicode(sc1);
- if (script == DEFAULT_SCRIPT)
- script = SCScriptFromUnicode(sc2);
- kp->subtable =
- SFSubTableFindOrMake(sc1->parent, CHR('k', 'e', 'r', 'n'),
- script, gpos_pair);
- }
- kp->off = offset;
- }
- return (into);
-}
-
-/* Look for a bare truetype font in a binhex/macbinary wrapper */
-static SplineFont *MightBeTrueType(FILE * binary, int32 pos, int32 dlen,
- int flags, enum openflags openflags)
-{
- FILE *temp ;
- char *buffer ;
- int len;
- SplineFont *sf;
-
- if (flags & ttf_onlynames) {
- char **ret;
- char *temp = TTFGetFontName(binary, pos, pos);
- if (temp == NULL)
- return (NULL);
- ret = galloc(2 * sizeof(char *));
- ret[0] = temp;
- ret[1] = NULL;
- return ((SplineFont *) ret);
- }
- temp = tmpfile();
- buffer = galloc(8192);
-
-
- fseek(binary, pos, SEEK_SET);
- while (dlen > 0) {
- len = dlen > 8192 ? 8192 : dlen;
- len = fread(buffer, 1, dlen > 8192 ? 8192 : dlen, binary);
- if (len == 0)
- break;
- fwrite(buffer, 1, len, temp);
- dlen -= len;
- }
- rewind(temp);
- sf = _SFReadTTF(temp, flags, openflags, NULL, NULL);
- fclose(temp);
- free(buffer);
- return (sf);
-}
-
-static SplineFont *IsResourceFork(FILE * f, long offset, char *filename,
- int flags, enum openflags openflags,
- SplineFont * into, EncMap * map)
-{
- /* If it is a good resource fork then the first 16 bytes are repeated */
- /* at the location specified in bytes 4-7 */
- /* We include an offset because if we are looking at a mac binary file */
- /* the resource fork will actually start somewhere in the middle of the */
- /* file, not at the beginning */
- unsigned char buffer[16], buffer2[16];
- long rdata_pos, map_pos, type_list, name_list, rpos;
- int32 rdata_len, map_len;
- uint32 nfnt_pos, font_pos, fond_pos;
- unsigned long tag;
- int i, cnt, subcnt, nfnt_subcnt = 0, font_subcnt = 0, fond_subcnt = 0;
- SplineFont *sf;
- FOND *fondlist = NULL;
- fond_pos = 0;
- fseek(f, offset, SEEK_SET);
- if (fread(buffer, 1, 16, f) != 16)
- return (NULL);
- rdata_pos =
- offset +
- ((buffer[0] << 24) | (buffer[1] << 16) | (buffer[2] << 8) | buffer[3]);
- map_pos =
- offset +
- ((buffer[4] << 24) | (buffer[5] << 16) | (buffer[6] << 8) | buffer[7]);
- rdata_len =
- ((buffer[8] << 24) | (buffer[9] << 16) | (buffer[10] << 8) |
- buffer[11]);
- map_len =
- ((buffer[12] << 24) | (buffer[13] << 16) | (buffer[14] << 8) |
- buffer[15]);
- if (rdata_pos + rdata_len != map_pos || rdata_len == 0)
- return (NULL);
- fseek(f, map_pos, SEEK_SET);
- buffer2[15] = buffer[15] + 1; /* make it be different */
- if (fread(buffer2, 1, 16, f) != 16)
- return (NULL);
-
-/* Apple's data fork resources appear to have a bunch of zeroes here instead */
-/* of a copy of the first 16 bytes */
- for (i = 0; i < 16; ++i)
- if (buffer2[i] != 0)
- break;
- if (i != 16) {
- for (i = 0; i < 16; ++i)
- if (buffer[i] != buffer2[i])
- return (NULL);
- }
- getlong(f); /* skip the handle to the next resource map */
- getushort(f); /* skip the file resource number */
- getushort(f); /* skip the attributes */
- type_list = map_pos + getushort(f);
- name_list = map_pos + getushort(f);
-
- fseek(f, type_list, SEEK_SET);
- cnt = getushort(f) + 1;
- for (i = 0; i < cnt; ++i) {
- tag = getlong(f);
- /* printf( "%c%c%c%c\n", tag>>24, (tag>>16)&0xff, (tag>>8)&0xff, tag&0xff ); */
- subcnt = getushort(f) + 1;
- rpos = type_list + getushort(f);
- sf = NULL;
- if (tag == CHR('P', 'O', 'S', 'T') && !(flags & (ttf_onlystrikes | ttf_onlykerns))) /* No FOND */
- sf = SearchPostscriptResources(f, rpos, subcnt, rdata_pos,
- name_list, flags);
- else if (tag == CHR('s', 'f', 'n', 't') && !(flags & ttf_onlykerns))
- sf = SearchTtfResources(f, rpos, subcnt, rdata_pos, name_list,
- filename, flags, openflags);
- else if (tag == CHR('N', 'F', 'N', 'T')) {
- nfnt_pos = rpos;
- nfnt_subcnt = subcnt;
- } else if (tag == CHR('F', 'O', 'N', 'T')) {
- font_pos = rpos;
- font_subcnt = subcnt;
- } else if (tag == CHR('F', 'O', 'N', 'D')) {
- fond_pos = rpos;
- fond_subcnt = subcnt;
- }
- if (sf != NULL)
- return (sf);
- }
- if (flags & ttf_onlynames) /* Not interested in bitmap resources here */
- return (NULL);
-
- if (flags & ttf_onlykerns) { /* For kerns */
- if (fond_subcnt != 0)
- fondlist =
- BuildFondList(f, fond_pos, fond_subcnt, rdata_pos, name_list,
- flags);
- into = FindFamilyStyleKerns(into, map, fondlist, filename);
- FondListFree(fondlist);
- return (into);
- }
- /* Ok. If no outline font, try for a bitmap */
- if (nfnt_subcnt == 0) {
- nfnt_pos = font_pos;
- nfnt_subcnt = font_subcnt;
- }
- return ((SplineFont *) - 1); /* It's a valid resource file, but just has no fonts */
-}
-
-
-static SplineFont *IsResourceInBinary(FILE * f, char *filename, int flags,
- enum openflags openflags,
- SplineFont * into, EncMap * map)
-{
- unsigned char header[128];
- unsigned long offset, dlen, rlen;
-
- if (fread(header, 1, 128, f) != 128)
- return (NULL);
- if (header[0] != 0 || header[74] != 0 || header[82] != 0 || header[1] <= 0
- || header[1] > 33 || header[63] != 0 || header[2 + header[1]] != 0)
- return (NULL);
- dlen =
- ((header[0x53] << 24) | (header[0x54] << 16) | (header[0x55] << 8) |
- header[0x56]);
- rlen =
- ((header[0x57] << 24) | (header[0x58] << 16) | (header[0x59] << 8) |
- header[0x5a]);
- /* 128 bytes for header, then the dlen is padded to a 128 byte boundary */
- offset = 128 + ((dlen + 127) & ~127);
-/* Look for a bare truetype font in a binhex/macbinary wrapper */
- if (dlen != 0 && rlen <= dlen) {
- int pos = ftell(f);
- if (fread(header, 1, 4, f) != ((size_t)4)) {
- LogError(_("Unable to read 4 bytes for header, but going on.\n"));
- }
- header[5] = '\0';
- if (strcmp((char *) header, "OTTO") == 0
- || strcmp((char *) header, "true") == 0
- || strcmp((char *) header, "ttcf") == 0 || (header[0] == 0
- && header[1] == 1
- && header[2] == 0
- && header[3] == 0))
- return (MightBeTrueType(f, pos, dlen, flags, openflags));
- }
- return (IsResourceFork(f, offset, filename, flags, openflags, into, map));
-}
-
-static int lastch = 0, repeat = 0;
-static void outchr(FILE * binary, int ch)
-{
- int i;
-
- if (repeat) {
- if (ch == 0) {
- /* no repeat, output a literal 0x90 (the repeat flag) */
- lastch = 0x90;
- putc(lastch, binary);
- } else {
- for (i = 1; i < ch; ++i)
- putc(lastch, binary);
- }
- repeat = 0;
- } else if (ch == 0x90) {
- repeat = 1;
- } else {
- putc(ch, binary);
- lastch = ch;
- }
-}
-
-static SplineFont *IsResourceInHex(FILE * f, char *filename, int flags,
- enum openflags openflags, SplineFont * into,
- EncMap * map)
-{
- /* convert file from 6bit to 8bit */
- /* interesting data is enclosed between two colons */
- FILE *binary = tmpfile();
- char *sixbit =
- "!\"#$%&'()*+,-012345689@ABCDEFGHIJKLMNPQRSTUVXYZ[`abcdefhijklmpqr";
- int ch, val, cnt, i, dlen, rlen;
- unsigned char header[20];
- char *pt;
- SplineFont *ret;
-
- if (binary == NULL) {
- LogError(_("can't create temporary file\n"));
- return (NULL);
- }
-
- lastch = repeat = 0;
- while ((ch = getc(f)) != ':'); /* There may be comments before file start */
- cnt = val = 0;
- while ((ch = getc(f)) != ':') {
- if (isspace(ch))
- continue;
- for (pt = sixbit; *pt != ch && *pt != '\0'; ++pt);
- if (*pt == '\0') {
- fclose(binary);
- return (NULL);
- }
- val = (val << 6) | (pt - sixbit);
- if (++cnt == 4) {
- outchr(binary, (val >> 16) & 0xff);
- outchr(binary, (val >> 8) & 0xff);
- outchr(binary, val & 0xff);
- val = cnt = 0;
- }
- }
- if (cnt != 0) {
- if (cnt == 1)
- outchr(binary, val << 2);
- else if (cnt == 2) {
- val <<= 4;
- outchr(binary, (val >> 8) & 0xff);
- outchr(binary, val & 0xff);
- } else if (cnt == 3) {
- val <<= 6;
- outchr(binary, (val >> 16) & 0xff);
- outchr(binary, (val >> 8) & 0xff);
- outchr(binary, val & 0xff);
- }
- }
-
- rewind(binary);
- ch = getc(binary); /* Name length */
- /* skip name */
- for (i = 0; i < ch; ++i)
- getc(binary);
- if (getc(binary) != '\0') {
- fclose(binary);
- return (NULL);
- }
- if ( fread(header, 1, 20, binary) != 20 ) {
- LogError(_("Can't read 20 bytes for header\n"));
- return (NULL);
- }
- dlen =
- (header[10] << 24) | (header[11] << 16) | (header[12] << 8) |
- header[13];
- rlen =
- (header[14] << 24) | (header[15] << 16) | (header[16] << 8) |
- header[17];
-/* Look for a bare truetype font in a binhex/macbinary wrapper */
- if (dlen != 0 && rlen < dlen) {
- int pos = ftell(binary);
- if (fread(header, 1, 4, binary) != 4) {
- LogError(_("Can't read 4 bytes for header\n"));
- return (NULL);
- }
- header[5] = '\0';
- if (strcmp((char *) header, "OTTO") == 0
- || strcmp((char *) header, "true") == 0
- || strcmp((char *) header, "ttcf") == 0 || (header[0] == 0
- && header[1] == 1
- && header[2] == 0
- && header[3] == 0)) {
- ret = MightBeTrueType(binary, pos, dlen, flags, openflags);
- fclose(binary);
- return (ret);
- }
- }
- if (rlen == 0) {
- fclose(binary);
- return (NULL);
- }
-
- ret =
- IsResourceFork(binary, ftell(binary) + dlen + 2, filename, flags,
- openflags, into, map);
-
- fclose(binary);
- return (ret);
-}
-
-static SplineFont *IsResourceInFile(char *filename, int flags,
- enum openflags openflags, SplineFont * into,
- EncMap * map)
-{
- FILE *f;
- char *spt, *pt;
- SplineFont *sf;
- char *temp = filename, *lparen;
-
- if ((pt = strrchr(filename, '/')) == NULL)
- pt = filename;
- if ((lparen = strchr(pt, '(')) != NULL && strchr(lparen, ')') != NULL) {
- temp = copy(filename);
- temp[lparen - filename] = '\0';
- }
- f = fopen(temp, "rb");
- if (temp != filename)
- free(temp);
- if (f == NULL)
- return (NULL);
- spt = strrchr(filename, '/');
- if (spt == NULL)
- spt = filename;
- pt = strrchr(spt, '.');
- if (pt != NULL && (pt[1] == 'b' || pt[1] == 'B')
- && (pt[2] == 'i' || pt[2] == 'I') && (pt[3] == 'n' || pt[3] == 'N')
- && (pt[4] == '\0' || pt[4] == '(')) {
- if ((sf = IsResourceInBinary(f, filename, flags, openflags, into, map))) {
- fclose(f);
- return (sf);
- }
- } else if (pt != NULL && (pt[1] == 'h' || pt[1] == 'H')
- && (pt[2] == 'q' || pt[2] == 'Q') && (pt[3] == 'x'
- || pt[3] == 'X')
- && (pt[4] == '\0' || pt[4] == '(')) {
- if ((sf = IsResourceInHex(f, filename, flags, openflags, into, map))) {
- fclose(f);
- return (sf);
- }
- }
-
- sf = IsResourceFork(f, 0, filename, flags, openflags, into, map);
- fclose(f);
-#if __Mac
- if (sf == NULL)
- sf = HasResourceFork(filename, flags, openflags, into, map);
-#endif
- return (sf);
-}
-
-static SplineFont *FindResourceFile(char *filename, int flags,
- enum openflags openflags, SplineFont * into,
- EncMap * map)
-{
- char *spt, *pt, *dpt;
- char buffer[1400];
- SplineFont *sf;
-
- if ((sf = IsResourceInFile(filename, flags, openflags, into, map)))
- return (sf);
-
- /* Well, look in the resource fork directory (if it exists), the resource */
- /* fork is placed there in a seperate file on (some) non-Mac disks */
- strcpy(buffer, filename);
- spt = strrchr(buffer, '/');
- if (spt == NULL) {
- spt = buffer;
- pt = filename;
- } else {
- ++spt;
- pt = filename + (spt - buffer);
- }
- strcpy(spt, "resource.frk/");
- strcat(spt, pt);
- if ((sf = IsResourceInFile(buffer, flags, openflags, into, map)))
- return (sf);
-
- /* however the resource fork does not appear to do long names properly */
- /* names are always lower case 8.3, do some simple things to check */
- spt = strrchr(buffer, '/') + 1;
- for (pt = spt; *pt; ++pt)
- if (isupper(*pt))
- *pt = tolower(*pt);
- dpt = strchr(spt, '.');
- if (dpt == NULL)
- dpt = spt + strlen(spt);
- if (dpt - spt > 8 || strlen(dpt) > 4) {
- char exten[8];
- strncpy(exten, dpt, 7);
- exten[4] = '\0'; /* it includes the dot */
- if (dpt - spt > 6)
- dpt = spt + 6;
- *dpt++ = '~';
- *dpt++ = '1';
- strcpy(dpt, exten);
- }
- return (IsResourceInFile(buffer, flags, openflags, into, map));
-}
-
-
-static char *createtmpfile(char *filename)
-{
- char *p, *tempname;
- p = strrchr(filename,'/');
- if (p != NULL) {
- filename = p+1;
- }
- assert(strlen(filename)>=5);
- tempname = malloc(strlen(filename)+2);
- if (tempname == NULL) {
- LogError(_("Out of memory\n"));
- exit(1);
- }
- strcpy(tempname,filename);
- strcpy(tempname+strlen(tempname)-5,"XXXXXX"); /* dfont -> XXXXXX */
-
-#ifdef HAVE_MKSTEMP
- {
- int i = mkstemp(tempname);
- if (i) {
- close(i);
- }
- }
-#else
- mktemp(tempname);
-#endif
- return tempname;
-}
-
-static char *SearchTtfResourcesFile(FILE * f, long rlistpos, int subcnt,
- long rdata_pos, long name_list,
- char *filename, char *fontname)
-{
- long here;
- long roff;
- int rname = -1;
- int ch1, ch2;
- int len, i, rlen, ilen;
- /* The sfnt resource is just a copy of the ttf file */
- char *buffer = NULL;
- int max = 0;
- FILE *ttf;
- char *sf = NULL;
- int which = 0;
- char **names;
- (void)name_list;
- fseek(f, rlistpos, SEEK_SET);
- if (subcnt > 1) {
- names = gcalloc(subcnt + 1, sizeof(char *));
- for (i = 0; i < subcnt; ++i) {
- /* resource id = */ getushort(f);
- /* rname = (short) */ getushort(f);
- /* flags = */ getc(f);
- ch1 = getc(f);
- ch2 = getc(f);
- roff = rdata_pos + ((ch1 << 16) | (ch2 << 8) | getc(f));
- /* mbz = */ getlong(f);
- here = ftell(f);
- names[i] = TTFGetPSFontName(f, roff + 4, roff + 4);
- if (names[i] == NULL) {
- char buffer[32];
- sprintf(buffer, "Nameless%d", i);
- names[i] = copy(buffer);
- }
- fseek(f, here, SEEK_SET);
- }
- if (1) {
- char *find = fontname;
- for (which = subcnt - 1; which >= 0; --which)
- if (strcmp(names[which], find) == 0)
- break;
- if (which == -1) {
- char *end;
- which = strtol(find, &end, 10);
- if (*end != '\0')
- which = -1;
- }
- if (which == -1) {
- ff_post_error(_("Not in Collection"), _("%s is not in %.100s"),
- find, filename);
- }
- } else {
- which = 0;
- }
- for (i = 0; i < subcnt; ++i)
- free(names[i]);
- free(names);
- fseek(f, rlistpos, SEEK_SET);
- }
-
- for (i = 0; i < subcnt; ++i) {
- /* resource id = */ getushort(f);
- rname = (short) getushort(f);
- /* flags = */ getc(f);
- ch1 = getc(f);
- ch2 = getc(f);
- roff = rdata_pos + ((ch1 << 16) | (ch2 << 8) | getc(f));
- /* mbz = */ getlong(f);
- if (i != which)
- continue;
- here = ftell(f);
-
- sf = createtmpfile(filename);
- ttf = fopen(sf, "wb");
- if (ttf == NULL) {
- LogError(_("Can't open temporary file for truetype output.\n"));
- continue;
- }
-
- fseek(f, roff, SEEK_SET);
- ilen = rlen = getlong(f);
- if (rlen > 16 * 1024)
- ilen = 16 * 1024;
- if (ilen > max) {
- free(buffer);
- max = ilen;
- if (max < 0x800)
- max = 0x800;
- buffer = malloc(max);
- }
- for (len = 0; len < rlen;) {
- int temp = ilen;
- if (rlen - len < ilen)
- temp = rlen - len;
- temp = fread(buffer, 1, temp, f);
- if (temp == EOF)
- break;
- fwrite(buffer, 1, temp, ttf);
- len += temp;
- }
- fclose(ttf);
- }
- free(buffer);
- return sf;
-}
-
-static char *IsResourceForkFile(FILE * f, char *filename, char *fontname)
-{
- /* If it is a good resource fork then the first 16 bytes are repeated */
- /* at the location specified in bytes 4-7 */
- /* We include an offset because if we are looking at a mac binary file */
- /* the resource fork will actually start somewhere in the middle of the */
- /* file, not at the beginning */
- unsigned char buffer[16], buffer2[16];
- long rdata_pos, map_pos, type_list, name_list, rpos;
- int32 rdata_len, map_len;
- uint32 fond_pos;
- unsigned long tag;
- int i, cnt, subcnt;
- char *sf = NULL;
- fond_pos = 0;
- fseek(f, 0, SEEK_SET);
- if (fread(buffer, 1, 16, f) != 16)
- return (NULL);
- rdata_pos =
- ((buffer[0] << 24) | (buffer[1] << 16) | (buffer[2] << 8) | buffer[3]);
- map_pos =
- ((buffer[4] << 24) | (buffer[5] << 16) | (buffer[6] << 8) | buffer[7]);
- rdata_len =
- ((buffer[8] << 24) | (buffer[9] << 16) | (buffer[10] << 8) |
- buffer[11]);
- map_len =
- ((buffer[12] << 24) | (buffer[13] << 16) | (buffer[14] << 8) |
- buffer[15]);
- if (rdata_pos + rdata_len != map_pos || rdata_len == 0)
- return (NULL);
- fseek(f, map_pos, SEEK_SET);
- buffer2[15] = buffer[15] + 1; /* make it be different */
- if (fread(buffer2, 1, 16, f) != 16)
- return (NULL);
- for (i = 0; i < 16; ++i)
- if (buffer2[i] != 0)
- break;
- if (i != 16) {
- for (i = 0; i < 16; ++i)
- if (buffer[i] != buffer2[i])
- return (NULL);
- }
- getlong(f); /* skip the handle to the next resource map */
- getushort(f); /* skip the file resource number */
- getushort(f); /* skip the attributes */
- type_list = map_pos + getushort(f);
- name_list = map_pos + getushort(f);
- fseek(f, type_list, SEEK_SET);
- cnt = getushort(f) + 1;
- for (i = 0; i < cnt; ++i) {
- tag = getlong(f);
- subcnt = getushort(f) + 1;
- rpos = type_list + getushort(f);
- sf = NULL;
- if (tag == CHR('s', 'f', 'n', 't')) {
- sf = SearchTtfResourcesFile(f, rpos, subcnt, rdata_pos, name_list,
- filename, fontname);
- }
- if (sf != NULL)
- return (sf);
- }
- return NULL;
-}
-
-
-/* filename "/opt/tex/texmf-fonts/fonts/data/LucidaGrande.dfont",
- fontname "Lucida Grande Bold"
- */
-char *FindResourceTtfFont(char *filename, char *fontname)
-{
- char *sf = NULL;
- FILE *f = fopen(filename, "rb");
- if (f == NULL)
- return (NULL);
- sf = IsResourceForkFile(f, filename, fontname);
- fclose(f);
- return sf;
-}
-
-SplineFont *SFReadMacBinary(char *filename, int flags, enum openflags openflags)
-{
- SplineFont *sf = FindResourceFile(filename, flags, openflags, NULL, NULL);
-
- if (sf == NULL)
- LogError(_("Couldn't find a font file named %s\n"), filename);
- else if (sf == (SplineFont *) (-1)) {
- LogError(_
- ("%s is a mac resource file but contains no postscript or truetype fonts\n"),
- filename);
- sf = NULL;
- }
- return (sf);
-}
-
-char **NamesReadMacBinary(char *filename)
-{
- return ((char **) FindResourceFile(filename, ttf_onlynames, 0, NULL, NULL));
-}
-
-/* should try to optimize this */
-SplineFont *SFReadMacBinaryInfo(char *filename, int flags,
- enum openflags openflags)
-{
- SplineFont *sf = FindResourceFile(filename, flags, openflags, NULL, NULL);
-
- if (sf == NULL)
- LogError(_("Couldn't find a font file named %s\n"), filename);
- else if (sf == (SplineFont *) (-1)) {
- LogError(_
- ("%s is a mac resource file but contains no postscript or truetype fonts\n"),
- filename);
- sf = NULL;
- }
- return (sf);
-}
diff --git a/Build/source/texk/web2c/luatexdir/luafontloader/fontforge/fontforge/macenc.c b/Build/source/texk/web2c/luatexdir/luafontloader/fontforge/fontforge/macenc.c
deleted file mode 100644
index 7dd59529e7f..00000000000
--- a/Build/source/texk/web2c/luatexdir/luafontloader/fontforge/fontforge/macenc.c
+++ /dev/null
@@ -1,1416 +0,0 @@
-/* Copyright (C) 2003-2008 by George Williams */
-/*
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are met:
-
- * Redistributions of source code must retain the above copyright notice, this
- * list of conditions and the following disclaimer.
-
- * Redistributions in binary form must reproduce the above copyright notice,
- * this list of conditions and the following disclaimer in the documentation
- * and/or other materials provided with the distribution.
-
- * The name of the author may not be used to endorse or promote products
- * derived from this software without specific prior written permission.
-
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
- * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
- * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
- * EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
- * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
- * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
- * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
- * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-#include "fontforgevw.h"
-#include <ustring.h>
-#include "ttf.h"
-
-/*
- The original data for these mappings may be found at
- http://www.unicode.org/Public/MAPPINGS/VENDORS/APPLE/
- unfortunately this site does not contain all the macintosh encodings
- so we leave some blank
-*/
-/* Response (indirectly) from charsets@apple.com when asked about the missing
- encodings:
-
- > I don't believe any of those additional scripts are actually
- > defined as character encodings. He can safely ignore anything
- > that's not in the Apple folder on the Unicode site.
- >
- > I monitor charsets@apple.com and don't recall seeing any e-mail
- > on this subject. It's possible it got lost in the voluminous
- > spam the address receives.
- >
- > Deborah
- I find this perplexing (unless the script is defined but unused, how can
- it fail to have a defined encoding), but will accept it.
-*/
-
-/* Macintosh 1 byte encodings */
-static unichar_t arabic[256] = {
- 0x0000, 0x0001, 0x0002, 0x0003, 0x0004, 0x0005, 0x0006, 0x0007,
- 0x0008, 0x0009, 0x000a, 0x000b, 0x000c, 0x000d, 0x000e, 0x000f,
- 0x0010, 0x0011, 0x0012, 0x0013, 0x0014, 0x0015, 0x0016, 0x0017,
- 0x0018, 0x0019, 0x001a, 0x001b, 0x001c, 0x001d, 0x001e, 0x001f,
- 0x0020, 0x0021, 0x0022, 0x0023, 0x0024, 0x0025, 0x0026, 0x0027,
- 0x0028, 0x0029, 0x002a, 0x002b, 0x002c, 0x002d, 0x002e, 0x002f,
- 0x0030, 0x0031, 0x0032, 0x0033, 0x0034, 0x0035, 0x0036, 0x0037,
- 0x0038, 0x0039, 0x003a, 0x003b, 0x003c, 0x003d, 0x003e, 0x003f,
- 0x0040, 0x0041, 0x0042, 0x0043, 0x0044, 0x0045, 0x0046, 0x0047,
- 0x0048, 0x0049, 0x004a, 0x004b, 0x004c, 0x004d, 0x004e, 0x004f,
- 0x0050, 0x0051, 0x0052, 0x0053, 0x0054, 0x0055, 0x0056, 0x0057,
- 0x0058, 0x0059, 0x005a, 0x005b, 0x005c, 0x005d, 0x005e, 0x005f,
- 0x0060, 0x0061, 0x0062, 0x0063, 0x0064, 0x0065, 0x0066, 0x0067,
- 0x0068, 0x0069, 0x006a, 0x006b, 0x006c, 0x006d, 0x006e, 0x006f,
- 0x0070, 0x0071, 0x0072, 0x0073, 0x0074, 0x0075, 0x0076, 0x0077,
- 0x0078, 0x0079, 0x007a, 0x007b, 0x007c, 0x007d, 0x007e, 0x007f,
- 0x00c4, 0x00a0, 0x00c7, 0x00c9, 0x00d1, 0x00d6, 0x00dc, 0x00e1,
- 0x00e0, 0x00e2, 0x00e4, 0x06ba, 0x00ab, 0x00e7, 0x00e9, 0x00e8,
- 0x00ea, 0x00eb, 0x00ed, 0x2026, 0x00ee, 0x00ef, 0x00f1, 0x00f3,
- 0x00bb, 0x00f4, 0x00f6, 0x00f7, 0x00fa, 0x00f9, 0x00fb, 0x00fc,
- 0x0020, 0x0021, 0x0022, 0x0023, 0x0024, 0x066a, 0x0026, 0x0027,
- 0x0028, 0x0029, 0x002a, 0x002b, 0x060c, 0x002d, 0x002e, 0x002f,
- 0x0660, 0x0661, 0x0662, 0x0663, 0x0664, 0x0665, 0x0666, 0x0667,
- 0x0668, 0x0669, 0x003a, 0x061b, 0x003c, 0x003d, 0x003e, 0x061f,
- 0x274a, 0x0621, 0x0622, 0x0623, 0x0624, 0x0625, 0x0626, 0x0627,
- 0x0628, 0x0629, 0x062a, 0x062b, 0x062c, 0x062d, 0x062e, 0x062f,
- 0x0630, 0x0631, 0x0632, 0x0633, 0x0634, 0x0635, 0x0636, 0x0637,
- 0x0638, 0x0639, 0x063a, 0x005b, 0x005c, 0x005d, 0x005e, 0x005f,
- 0x0640, 0x0641, 0x0642, 0x0643, 0x0644, 0x0645, 0x0646, 0x0647,
- 0x0648, 0x0649, 0x064a, 0x064b, 0x064c, 0x064d, 0x064e, 0x064f,
- 0x0650, 0x0651, 0x0652, 0x067e, 0x0679, 0x0686, 0x06d5, 0x06a4,
- 0x06af, 0x0688, 0x0691, 0x007b, 0x007c, 0x007d, 0x0698, 0x06d2
-};
-
-static unichar_t centeuro[256] = {
- 0x0000, 0x0001, 0x0002, 0x0003, 0x0004, 0x0005, 0x0006, 0x0007,
- 0x0008, 0x0009, 0x000a, 0x000b, 0x000c, 0x000d, 0x000e, 0x000f,
- 0x0010, 0x0011, 0x0012, 0x0013, 0x0014, 0x0015, 0x0016, 0x0017,
- 0x0018, 0x0019, 0x001a, 0x001b, 0x001c, 0x001d, 0x001e, 0x001f,
- 0x0020, 0x0021, 0x0022, 0x0023, 0x0024, 0x0025, 0x0026, 0x0027,
- 0x0028, 0x0029, 0x002a, 0x002b, 0x002c, 0x002d, 0x002e, 0x002f,
- 0x0030, 0x0031, 0x0032, 0x0033, 0x0034, 0x0035, 0x0036, 0x0037,
- 0x0038, 0x0039, 0x003a, 0x003b, 0x003c, 0x003d, 0x003e, 0x003f,
- 0x0040, 0x0041, 0x0042, 0x0043, 0x0044, 0x0045, 0x0046, 0x0047,
- 0x0048, 0x0049, 0x004a, 0x004b, 0x004c, 0x004d, 0x004e, 0x004f,
- 0x0050, 0x0051, 0x0052, 0x0053, 0x0054, 0x0055, 0x0056, 0x0057,
- 0x0058, 0x0059, 0x005a, 0x005b, 0x005c, 0x005d, 0x005e, 0x005f,
- 0x0060, 0x0061, 0x0062, 0x0063, 0x0064, 0x0065, 0x0066, 0x0067,
- 0x0068, 0x0069, 0x006a, 0x006b, 0x006c, 0x006d, 0x006e, 0x006f,
- 0x0070, 0x0071, 0x0072, 0x0073, 0x0074, 0x0075, 0x0076, 0x0077,
- 0x0078, 0x0079, 0x007a, 0x007b, 0x007c, 0x007d, 0x007e, 0x007f,
- 0x00c4, 0x0100, 0x0101, 0x00c9, 0x0104, 0x00d6, 0x00dc, 0x00e1,
- 0x0105, 0x010c, 0x00e4, 0x010d, 0x0106, 0x0107, 0x00e9, 0x0179,
- 0x017a, 0x010e, 0x00ed, 0x010f, 0x0112, 0x0113, 0x0116, 0x00f3,
- 0x0117, 0x00f4, 0x00f6, 0x00f5, 0x00fa, 0x011a, 0x011b, 0x00fc,
- 0x2020, 0x00b0, 0x0118, 0x00a3, 0x00a7, 0x2022, 0x00b6, 0x00df,
- 0x00ae, 0x00a9, 0x2122, 0x0119, 0x00a8, 0x2260, 0x0123, 0x012e,
- 0x012f, 0x012a, 0x2264, 0x2265, 0x012b, 0x0136, 0x2202, 0x2211,
- 0x0142, 0x013b, 0x013c, 0x013d, 0x013e, 0x0139, 0x013a, 0x0145,
- 0x0146, 0x0143, 0x00ac, 0x221a, 0x0144, 0x0147, 0x2206, 0x00ab,
- 0x00bb, 0x2026, 0x00a0, 0x0148, 0x0150, 0x00d5, 0x0151, 0x014c,
- 0x2013, 0x2014, 0x201c, 0x201d, 0x2018, 0x2019, 0x00f7, 0x25ca,
- 0x014d, 0x0154, 0x0155, 0x0158, 0x2039, 0x203a, 0x0159, 0x0156,
- 0x0157, 0x0160, 0x201a, 0x201e, 0x0161, 0x015a, 0x015b, 0x00c1,
- 0x0164, 0x0165, 0x00cd, 0x017d, 0x017e, 0x016a, 0x00d3, 0x00d4,
- 0x016b, 0x016e, 0x00da, 0x016f, 0x0170, 0x0171, 0x0172, 0x0173,
- 0x00dd, 0x00fd, 0x0137, 0x017b, 0x0141, 0x017c, 0x0122, 0x02c7
-};
-
-static unichar_t croatian[256] = {
- 0x0000, 0x0001, 0x0002, 0x0003, 0x0004, 0x0005, 0x0006, 0x0007,
- 0x0008, 0x0009, 0x000a, 0x000b, 0x000c, 0x000d, 0x000e, 0x000f,
- 0x0010, 0x0011, 0x0012, 0x0013, 0x0014, 0x0015, 0x0016, 0x0017,
- 0x0018, 0x0019, 0x001a, 0x001b, 0x001c, 0x001d, 0x001e, 0x001f,
- 0x0020, 0x0021, 0x0022, 0x0023, 0x0024, 0x0025, 0x0026, 0x0027,
- 0x0028, 0x0029, 0x002a, 0x002b, 0x002c, 0x002d, 0x002e, 0x002f,
- 0x0030, 0x0031, 0x0032, 0x0033, 0x0034, 0x0035, 0x0036, 0x0037,
- 0x0038, 0x0039, 0x003a, 0x003b, 0x003c, 0x003d, 0x003e, 0x003f,
- 0x0040, 0x0041, 0x0042, 0x0043, 0x0044, 0x0045, 0x0046, 0x0047,
- 0x0048, 0x0049, 0x004a, 0x004b, 0x004c, 0x004d, 0x004e, 0x004f,
- 0x0050, 0x0051, 0x0052, 0x0053, 0x0054, 0x0055, 0x0056, 0x0057,
- 0x0058, 0x0059, 0x005a, 0x005b, 0x005c, 0x005d, 0x005e, 0x005f,
- 0x0060, 0x0061, 0x0062, 0x0063, 0x0064, 0x0065, 0x0066, 0x0067,
- 0x0068, 0x0069, 0x006a, 0x006b, 0x006c, 0x006d, 0x006e, 0x006f,
- 0x0070, 0x0071, 0x0072, 0x0073, 0x0074, 0x0075, 0x0076, 0x0077,
- 0x0078, 0x0079, 0x007a, 0x007b, 0x007c, 0x007d, 0x007e, 0x007f,
- 0x00c4, 0x00c5, 0x00c7, 0x00c9, 0x00d1, 0x00d6, 0x00dc, 0x00e1,
- 0x00e0, 0x00e2, 0x00e4, 0x00e3, 0x00e5, 0x00e7, 0x00e9, 0x00e8,
- 0x00ea, 0x00eb, 0x00ed, 0x00ec, 0x00ee, 0x00ef, 0x00f1, 0x00f3,
- 0x00f2, 0x00f4, 0x00f6, 0x00f5, 0x00fa, 0x00f9, 0x00fb, 0x00fc,
- 0x2020, 0x00b0, 0x00a2, 0x00a3, 0x00a7, 0x2022, 0x00b6, 0x00df,
- 0x00ae, 0x0160, 0x2122, 0x00b4, 0x00a8, 0x2260, 0x017d, 0x00d8,
- 0x221e, 0x00b1, 0x2264, 0x2265, 0x2206, 0x00b5, 0x2202, 0x2211,
- 0x220f, 0x0161, 0x222b, 0x00aa, 0x00ba, 0x03a9, 0x017e, 0x00f8,
- 0x00bf, 0x00a1, 0x00ac, 0x221a, 0x0192, 0x2248, 0x0106, 0x00ab,
- 0x010c, 0x2026, 0x00a0, 0x00c0, 0x00c3, 0x00d5, 0x0152, 0x0153,
- 0x0110, 0x2014, 0x201c, 0x201d, 0x2018, 0x2019, 0x00f7, 0x25ca,
- 0xf8ff, 0x00a9, 0x2044, 0x20ac, 0x2039, 0x203a, 0x00c6, 0x00bb,
- 0x2013, 0x00b7, 0x201a, 0x201e, 0x2030, 0x00c2, 0x0107, 0x00c1,
- 0x010d, 0x00c8, 0x00cd, 0x00ce, 0x00cf, 0x00cc, 0x00d3, 0x00d4,
- 0x0111, 0x00d2, 0x00da, 0x00db, 0x00d9, 0x0131, 0x02c6, 0x02dc,
- 0x00af, 0x03c0, 0x00cb, 0x02da, 0x00b8, 0x00ca, 0x00e6, 0x02c7
-};
-
-static unichar_t cyrillic[256] = {
- 0x0000, 0x0001, 0x0002, 0x0003, 0x0004, 0x0005, 0x0006, 0x0007,
- 0x0008, 0x0009, 0x000a, 0x000b, 0x000c, 0x000d, 0x000e, 0x000f,
- 0x0010, 0x0011, 0x0012, 0x0013, 0x0014, 0x0015, 0x0016, 0x0017,
- 0x0018, 0x0019, 0x001a, 0x001b, 0x001c, 0x001d, 0x001e, 0x001f,
- 0x0020, 0x0021, 0x0022, 0x0023, 0x0024, 0x0025, 0x0026, 0x0027,
- 0x0028, 0x0029, 0x002a, 0x002b, 0x002c, 0x002d, 0x002e, 0x002f,
- 0x0030, 0x0031, 0x0032, 0x0033, 0x0034, 0x0035, 0x0036, 0x0037,
- 0x0038, 0x0039, 0x003a, 0x003b, 0x003c, 0x003d, 0x003e, 0x003f,
- 0x0040, 0x0041, 0x0042, 0x0043, 0x0044, 0x0045, 0x0046, 0x0047,
- 0x0048, 0x0049, 0x004a, 0x004b, 0x004c, 0x004d, 0x004e, 0x004f,
- 0x0050, 0x0051, 0x0052, 0x0053, 0x0054, 0x0055, 0x0056, 0x0057,
- 0x0058, 0x0059, 0x005a, 0x005b, 0x005c, 0x005d, 0x005e, 0x005f,
- 0x0060, 0x0061, 0x0062, 0x0063, 0x0064, 0x0065, 0x0066, 0x0067,
- 0x0068, 0x0069, 0x006a, 0x006b, 0x006c, 0x006d, 0x006e, 0x006f,
- 0x0070, 0x0071, 0x0072, 0x0073, 0x0074, 0x0075, 0x0076, 0x0077,
- 0x0078, 0x0079, 0x007a, 0x007b, 0x007c, 0x007d, 0x007e, 0x007f,
- 0x0410, 0x0411, 0x0412, 0x0413, 0x0414, 0x0415, 0x0416, 0x0417,
- 0x0418, 0x0419, 0x041a, 0x041b, 0x041c, 0x041d, 0x041e, 0x041f,
- 0x0420, 0x0421, 0x0422, 0x0423, 0x0424, 0x0425, 0x0426, 0x0427,
- 0x0428, 0x0429, 0x042a, 0x042b, 0x042c, 0x042d, 0x042e, 0x042f,
- 0x2020, 0x00b0, 0x0490, 0x00a3, 0x00a7, 0x2022, 0x00b6, 0x0406,
- 0x00ae, 0x00a9, 0x2122, 0x0402, 0x0452, 0x2260, 0x0403, 0x0453,
- 0x221e, 0x00b1, 0x2264, 0x2265, 0x0456, 0x00b5, 0x0491, 0x0408,
- 0x0404, 0x0454, 0x0407, 0x0457, 0x0409, 0x0459, 0x040a, 0x045a,
- 0x0458, 0x0405, 0x00ac, 0x221a, 0x0192, 0x2248, 0x2206, 0x00ab,
- 0x00bb, 0x2026, 0x00a0, 0x040b, 0x045b, 0x040c, 0x045c, 0x0455,
- 0x2013, 0x2014, 0x201c, 0x201d, 0x2018, 0x2019, 0x00f7, 0x201e,
- 0x040e, 0x045e, 0x040f, 0x045f, 0x2116, 0x0401, 0x0451, 0x044f,
- 0x0430, 0x0431, 0x0432, 0x0433, 0x0434, 0x0435, 0x0436, 0x0437,
- 0x0438, 0x0439, 0x043a, 0x043b, 0x043c, 0x043d, 0x043e, 0x043f,
- 0x0440, 0x0441, 0x0442, 0x0443, 0x0444, 0x0445, 0x0446, 0x0447,
- 0x0448, 0x0449, 0x044a, 0x044b, 0x044c, 0x044d, 0x044e, 0x20ac
-};
-
-static unichar_t devanagari[256] = {
- 0x0000, 0x0001, 0x0002, 0x0003, 0x0004, 0x0005, 0x0006, 0x0007,
- 0x0008, 0x0009, 0x000a, 0x000b, 0x000c, 0x000d, 0x000e, 0x000f,
- 0x0010, 0x0011, 0x0012, 0x0013, 0x0014, 0x0015, 0x0016, 0x0017,
- 0x0018, 0x0019, 0x001a, 0x001b, 0x001c, 0x001d, 0x001e, 0x001f,
- 0x0020, 0x0021, 0x0022, 0x0023, 0x0024, 0x0025, 0x0026, 0x0027,
- 0x0028, 0x0029, 0x002a, 0x002b, 0x002c, 0x002d, 0x002e, 0x002f,
- 0x0030, 0x0031, 0x0032, 0x0033, 0x0034, 0x0035, 0x0036, 0x0037,
- 0x0038, 0x0039, 0x003a, 0x003b, 0x003c, 0x003d, 0x003e, 0x003f,
- 0x0040, 0x0041, 0x0042, 0x0043, 0x0044, 0x0045, 0x0046, 0x0047,
- 0x0048, 0x0049, 0x004a, 0x004b, 0x004c, 0x004d, 0x004e, 0x004f,
- 0x0050, 0x0051, 0x0052, 0x0053, 0x0054, 0x0055, 0x0056, 0x0057,
- 0x0058, 0x0059, 0x005a, 0x005b, 0x005c, 0x005d, 0x005e, 0x005f,
- 0x0060, 0x0061, 0x0062, 0x0063, 0x0064, 0x0065, 0x0066, 0x0067,
- 0x0068, 0x0069, 0x006a, 0x006b, 0x006c, 0x006d, 0x006e, 0x006f,
- 0x0070, 0x0071, 0x0072, 0x0073, 0x0074, 0x0075, 0x0076, 0x0077,
- 0x0078, 0x0079, 0x007a, 0x007b, 0x007c, 0x007d, 0x007e, 0x007f,
- 0x00d7, 0x2212, 0x2013, 0x2014, 0x2018, 0x2019, 0x2026, 0x2022,
- 0x00a9, 0x00ae, 0x2122, 0x008b, 0x008c, 0x008d, 0x008e, 0x008f,
- 0x0965, 0x0970, 0x0092, 0x0093, 0x0094, 0x0095, 0x0096, 0x0097,
- 0x0098, 0x0099, 0x009a, 0x009b, 0x009c, 0x009d, 0x009e, 0x009f,
- 0x00a0, 0x0901, 0x0902, 0x0903, 0x0905, 0x0906, 0x0907, 0x0908,
- 0x0909, 0x090a, 0x090b, 0x090e, 0x090f, 0x0910, 0x090d, 0x0912,
- 0x0913, 0x0914, 0x0911, 0x0915, 0x0916, 0x0917, 0x0918, 0x0919,
- 0x091a, 0x091b, 0x091c, 0x091d, 0x091e, 0x091f, 0x0920, 0x0921,
- 0x0922, 0x0923, 0x0924, 0x0925, 0x0926, 0x0927, 0x0928, 0x0929,
- 0x092a, 0x092b, 0x092c, 0x092d, 0x092e, 0x092f, 0x095f, 0x0930,
- 0x0931, 0x0932, 0x0933, 0x0934, 0x0935, 0x0936, 0x0937, 0x0938,
- 0x0939, 0x200e, 0x093e, 0x093f, 0x0940, 0x0941, 0x0942, 0x0943,
- 0x0946, 0x0947, 0x0948, 0x0945, 0x094a, 0x094b, 0x094c, 0x0949,
- 0x094d, 0x093c, 0x0964, 0x00eb, 0x00ec, 0x00ed, 0x00ee, 0x00ef,
- 0x00f0, 0x0966, 0x0967, 0x0968, 0x0969, 0x096a, 0x096b, 0x096c,
- 0x096d, 0x096e, 0x096f,
-};
-
-static unichar_t farsi[256] = {
- 0x0000, 0x0001, 0x0002, 0x0003, 0x0004, 0x0005, 0x0006, 0x0007,
- 0x0008, 0x0009, 0x000a, 0x000b, 0x000c, 0x000d, 0x000e, 0x000f,
- 0x0010, 0x0011, 0x0012, 0x0013, 0x0014, 0x0015, 0x0016, 0x0017,
- 0x0018, 0x0019, 0x001a, 0x001b, 0x001c, 0x001d, 0x001e, 0x001f,
- 0x0020, 0x0021, 0x0022, 0x0023, 0x0024, 0x0025, 0x0026, 0x0027,
- 0x0028, 0x0029, 0x002a, 0x002b, 0x002c, 0x002d, 0x002e, 0x002f,
- 0x0030, 0x0031, 0x0032, 0x0033, 0x0034, 0x0035, 0x0036, 0x0037,
- 0x0038, 0x0039, 0x003a, 0x003b, 0x003c, 0x003d, 0x003e, 0x003f,
- 0x0040, 0x0041, 0x0042, 0x0043, 0x0044, 0x0045, 0x0046, 0x0047,
- 0x0048, 0x0049, 0x004a, 0x004b, 0x004c, 0x004d, 0x004e, 0x004f,
- 0x0050, 0x0051, 0x0052, 0x0053, 0x0054, 0x0055, 0x0056, 0x0057,
- 0x0058, 0x0059, 0x005a, 0x005b, 0x005c, 0x005d, 0x005e, 0x005f,
- 0x0060, 0x0061, 0x0062, 0x0063, 0x0064, 0x0065, 0x0066, 0x0067,
- 0x0068, 0x0069, 0x006a, 0x006b, 0x006c, 0x006d, 0x006e, 0x006f,
- 0x0070, 0x0071, 0x0072, 0x0073, 0x0074, 0x0075, 0x0076, 0x0077,
- 0x0078, 0x0079, 0x007a, 0x007b, 0x007c, 0x007d, 0x007e, 0x007f,
- 0x00c4, 0x00a0, 0x00c7, 0x00c9, 0x00d1, 0x00d6, 0x00dc, 0x00e1,
- 0x00e0, 0x00e2, 0x00e4, 0x06ba, 0x00ab, 0x00e7, 0x00e9, 0x00e8,
- 0x00ea, 0x00eb, 0x00ed, 0x2026, 0x00ee, 0x00ef, 0x00f1, 0x00f3,
- 0x00bb, 0x00f4, 0x00f6, 0x00f7, 0x00fa, 0x00f9, 0x00fb, 0x00fc,
- 0x0020, 0x0021, 0x0022, 0x0023, 0x0024, 0x066a, 0x0026, 0x0027,
- 0x0028, 0x0029, 0x002a, 0x002b, 0x060c, 0x002d, 0x002e, 0x002f,
- 0x06f0, 0x06f1, 0x06f2, 0x06f3, 0x06f4, 0x06f5, 0x06f6, 0x06f7,
- 0x06f8, 0x06f9, 0x003a, 0x061b, 0x003c, 0x003d, 0x003e, 0x061f,
- 0x274a, 0x0621, 0x0622, 0x0623, 0x0624, 0x0625, 0x0626, 0x0627,
- 0x0628, 0x0629, 0x062a, 0x062b, 0x062c, 0x062d, 0x062e, 0x062f,
- 0x0630, 0x0631, 0x0632, 0x0633, 0x0634, 0x0635, 0x0636, 0x0637,
- 0x0638, 0x0639, 0x063a, 0x005b, 0x005c, 0x005d, 0x005e, 0x005f,
- 0x0640, 0x0641, 0x0642, 0x0643, 0x0644, 0x0645, 0x0646, 0x0647,
- 0x0648, 0x0649, 0x064a, 0x064b, 0x064c, 0x064d, 0x064e, 0x064f,
- 0x0650, 0x0651, 0x0652, 0x067e, 0x0679, 0x0686, 0x06d5, 0x06a4,
- 0x06af, 0x0688, 0x0691, 0x007b, 0x007c, 0x007d, 0x0698, 0x06d2
-};
-
-static unichar_t greek[256] = {
- 0x0000, 0x0001, 0x0002, 0x0003, 0x0004, 0x0005, 0x0006, 0x0007,
- 0x0008, 0x0009, 0x000a, 0x000b, 0x000c, 0x000d, 0x000e, 0x000f,
- 0x0010, 0x0011, 0x0012, 0x0013, 0x0014, 0x0015, 0x0016, 0x0017,
- 0x0018, 0x0019, 0x001a, 0x001b, 0x001c, 0x001d, 0x001e, 0x001f,
- 0x0020, 0x0021, 0x0022, 0x0023, 0x0024, 0x0025, 0x0026, 0x0027,
- 0x0028, 0x0029, 0x002a, 0x002b, 0x002c, 0x002d, 0x002e, 0x002f,
- 0x0030, 0x0031, 0x0032, 0x0033, 0x0034, 0x0035, 0x0036, 0x0037,
- 0x0038, 0x0039, 0x003a, 0x003b, 0x003c, 0x003d, 0x003e, 0x003f,
- 0x0040, 0x0041, 0x0042, 0x0043, 0x0044, 0x0045, 0x0046, 0x0047,
- 0x0048, 0x0049, 0x004a, 0x004b, 0x004c, 0x004d, 0x004e, 0x004f,
- 0x0050, 0x0051, 0x0052, 0x0053, 0x0054, 0x0055, 0x0056, 0x0057,
- 0x0058, 0x0059, 0x005a, 0x005b, 0x005c, 0x005d, 0x005e, 0x005f,
- 0x0060, 0x0061, 0x0062, 0x0063, 0x0064, 0x0065, 0x0066, 0x0067,
- 0x0068, 0x0069, 0x006a, 0x006b, 0x006c, 0x006d, 0x006e, 0x006f,
- 0x0070, 0x0071, 0x0072, 0x0073, 0x0074, 0x0075, 0x0076, 0x0077,
- 0x0078, 0x0079, 0x007a, 0x007b, 0x007c, 0x007d, 0x007e, 0x007f,
- 0x00c4, 0x00b9, 0x00b2, 0x00c9, 0x00b3, 0x00d6, 0x00dc, 0x0385,
- 0x00e0, 0x00e2, 0x00e4, 0x0384, 0x00a8, 0x00e7, 0x00e9, 0x00e8,
- 0x00ea, 0x00eb, 0x00a3, 0x2122, 0x00ee, 0x00ef, 0x2022, 0x00bd,
- 0x2030, 0x00f4, 0x00f6, 0x00a6, 0x20ac, 0x00f9, 0x00fb, 0x00fc,
- 0x2020, 0x0393, 0x0394, 0x0398, 0x039b, 0x039e, 0x03a0, 0x00df,
- 0x00ae, 0x00a9, 0x03a3, 0x03aa, 0x00a7, 0x2260, 0x00b0, 0x00b7,
- 0x0391, 0x00b1, 0x2264, 0x2265, 0x00a5, 0x0392, 0x0395, 0x0396,
- 0x0397, 0x0399, 0x039a, 0x039c, 0x03a6, 0x03ab, 0x03a8, 0x03a9,
- 0x03ac, 0x039d, 0x00ac, 0x039f, 0x03a1, 0x2248, 0x03a4, 0x00ab,
- 0x00bb, 0x2026, 0x00a0, 0x03a5, 0x03a7, 0x0386, 0x0388, 0x0153,
- 0x2013, 0x2015, 0x201c, 0x201d, 0x2018, 0x2019, 0x00f7, 0x0389,
- 0x038a, 0x038c, 0x038e, 0x03ad, 0x03ae, 0x03af, 0x03cc, 0x038f,
- 0x03cd, 0x03b1, 0x03b2, 0x03c8, 0x03b4, 0x03b5, 0x03c6, 0x03b3,
- 0x03b7, 0x03b9, 0x03be, 0x03ba, 0x03bb, 0x03bc, 0x03bd, 0x03bf,
- 0x03c0, 0x03ce, 0x03c1, 0x03c3, 0x03c4, 0x03b8, 0x03c9, 0x03c2,
- 0x03c7, 0x03c5, 0x03b6, 0x03ca, 0x03cb, 0x0390, 0x03b0, 0x00ad
-};
-
-static unichar_t gujarati[256] = {
- 0x0000, 0x0001, 0x0002, 0x0003, 0x0004, 0x0005, 0x0006, 0x0007,
- 0x0008, 0x0009, 0x000a, 0x000b, 0x000c, 0x000d, 0x000e, 0x000f,
- 0x0010, 0x0011, 0x0012, 0x0013, 0x0014, 0x0015, 0x0016, 0x0017,
- 0x0018, 0x0019, 0x001a, 0x001b, 0x001c, 0x001d, 0x001e, 0x001f,
- 0x0020, 0x0021, 0x0022, 0x0023, 0x0024, 0x0025, 0x0026, 0x0027,
- 0x0028, 0x0029, 0x002a, 0x002b, 0x002c, 0x002d, 0x002e, 0x002f,
- 0x0030, 0x0031, 0x0032, 0x0033, 0x0034, 0x0035, 0x0036, 0x0037,
- 0x0038, 0x0039, 0x003a, 0x003b, 0x003c, 0x003d, 0x003e, 0x003f,
- 0x0040, 0x0041, 0x0042, 0x0043, 0x0044, 0x0045, 0x0046, 0x0047,
- 0x0048, 0x0049, 0x004a, 0x004b, 0x004c, 0x004d, 0x004e, 0x004f,
- 0x0050, 0x0051, 0x0052, 0x0053, 0x0054, 0x0055, 0x0056, 0x0057,
- 0x0058, 0x0059, 0x005a, 0x005b, 0x005c, 0x005d, 0x005e, 0x005f,
- 0x0060, 0x0061, 0x0062, 0x0063, 0x0064, 0x0065, 0x0066, 0x0067,
- 0x0068, 0x0069, 0x006a, 0x006b, 0x006c, 0x006d, 0x006e, 0x006f,
- 0x0070, 0x0071, 0x0072, 0x0073, 0x0074, 0x0075, 0x0076, 0x0077,
- 0x0078, 0x0079, 0x007a, 0x007b, 0x007c, 0x007d, 0x007e, 0x007f,
- 0x00d7, 0x2212, 0x2013, 0x2014, 0x2018, 0x2019, 0x2026, 0x2022,
- 0x00a9, 0x00ae, 0x2122, 0x008b, 0x008c, 0x008d, 0x008e, 0x008f,
- 0x0965, 0x0091, 0x0092, 0x0093, 0x0094, 0x0095, 0x0096, 0x0097,
- 0x0098, 0x0099, 0x009a, 0x009b, 0x009c, 0x009d, 0x009e, 0x009f,
- 0x00a0, 0x0a81, 0x0a82, 0x0a83, 0x0a85, 0x0a86, 0x0a87, 0x0a88,
- 0x0a89, 0x0a8a, 0x0a8b, 0x00ab, 0x0a8f, 0x0a90, 0x0a8d, 0x00af,
- 0x0a93, 0x0a94, 0x0a91, 0x0a95, 0x0a96, 0x0a97, 0x0a98, 0x0a99,
- 0x0a9a, 0x0a9b, 0x0a9c, 0x0a9d, 0x0a9e, 0x0a9f, 0x0aa0, 0x0aa1,
- 0x0aa2, 0x0aa3, 0x0aa4, 0x0aa5, 0x0aa6, 0x0aa7, 0x0aa8, 0x00c7,
- 0x0aaa, 0x0aab, 0x0aac, 0x0aad, 0x0aae, 0x0aaf, 0x00ce, 0x0ab0,
- 0x00d0, 0x0ab2, 0x0ab3, 0x00d3, 0x0ab5, 0x0ab6, 0x0ab7, 0x0ab8,
- 0x0ab9, 0x200e, 0x0abe, 0x0abf, 0x0ac0, 0x0ac1, 0x0ac2, 0x0ac3,
- 0x00e0, 0x0ac7, 0x0ac8, 0x0ac5, 0x00e4, 0x0acb, 0x0acc, 0x0ac9,
- 0x0acd, 0x0abc, 0x0964, 0x00eb, 0x00ec, 0x00ed, 0x00ee, 0x00ef,
- 0x00f0, 0x0ae6, 0x0ae7, 0x0ae8, 0x0ae9, 0x0aea, 0x0aeb, 0x0aec,
- 0x0aed, 0x0aee, 0x0aef,
-};
-
-static unichar_t gurmukhi[256] = {
- 0x0000, 0x0001, 0x0002, 0x0003, 0x0004, 0x0005, 0x0006, 0x0007,
- 0x0008, 0x0009, 0x000a, 0x000b, 0x000c, 0x000d, 0x000e, 0x000f,
- 0x0010, 0x0011, 0x0012, 0x0013, 0x0014, 0x0015, 0x0016, 0x0017,
- 0x0018, 0x0019, 0x001a, 0x001b, 0x001c, 0x001d, 0x001e, 0x001f,
- 0x0020, 0x0021, 0x0022, 0x0023, 0x0024, 0x0025, 0x0026, 0x0027,
- 0x0028, 0x0029, 0x002a, 0x002b, 0x002c, 0x002d, 0x002e, 0x002f,
- 0x0030, 0x0031, 0x0032, 0x0033, 0x0034, 0x0035, 0x0036, 0x0037,
- 0x0038, 0x0039, 0x003a, 0x003b, 0x003c, 0x003d, 0x003e, 0x003f,
- 0x0040, 0x0041, 0x0042, 0x0043, 0x0044, 0x0045, 0x0046, 0x0047,
- 0x0048, 0x0049, 0x004a, 0x004b, 0x004c, 0x004d, 0x004e, 0x004f,
- 0x0050, 0x0051, 0x0052, 0x0053, 0x0054, 0x0055, 0x0056, 0x0057,
- 0x0058, 0x0059, 0x005a, 0x005b, 0x005c, 0x005d, 0x005e, 0x005f,
- 0x0060, 0x0061, 0x0062, 0x0063, 0x0064, 0x0065, 0x0066, 0x0067,
- 0x0068, 0x0069, 0x006a, 0x006b, 0x006c, 0x006d, 0x006e, 0x006f,
- 0x0070, 0x0071, 0x0072, 0x0073, 0x0074, 0x0075, 0x0076, 0x0077,
- 0x0078, 0x0079, 0x007a, 0x007b, 0x007c, 0x007d, 0x007e, 0x007f,
- 0x00d7, 0x2212, 0x2013, 0x2014, 0x2018, 0x2019, 0x2026, 0x2022,
- 0x00a9, 0x00ae, 0x2122, 0x008b, 0x008c, 0x008d, 0x008e, 0x008f,
- 0x0a71, 0x0a5c, 0x0a73, 0x0a72, 0x0a74, 0x0095, 0x0096, 0x0097,
- 0x0098, 0x0099, 0x009a, 0x009b, 0x009c, 0x009d, 0x009e, 0x009f,
- 0x00a0, 0x00a1, 0x0a02, 0x00a3, 0x0a05, 0x0a06, 0x0a07, 0x0a08,
- 0x0a09, 0x0a0a, 0x00aa, 0x00ab, 0x0a0f, 0x0a10, 0x00ae, 0x00af,
- 0x0a13, 0x0a14, 0x00b2, 0x0a15, 0x0a16, 0x0a17, 0x0a18, 0x0a19,
- 0x0a1a, 0x0a1b, 0x0a1c, 0x0a1d, 0x0a1e, 0x0a1f, 0x0a20, 0x0a21,
- 0x0a22, 0x0a23, 0x0a24, 0x0a25, 0x0a26, 0x0a27, 0x0a28, 0x00c7,
- 0x0a2a, 0x0a2b, 0x0a2c, 0x0a2d, 0x0a2e, 0x0a2f, 0x00ce, 0x0a30,
- 0x00d0, 0x0a32, 0x00d2, 0x00d3, 0x0a35, 0xf860, 0x00d6, 0x0a38,
- 0x0a39, 0x200e, 0x0a3e, 0x0a3f, 0x0a40, 0x0a41, 0x0a42, 0x00df,
- 0x00e0, 0x0a47, 0x0a48, 0x00e3, 0x00e4, 0x0a4b, 0x0a4c, 0x00e7,
- 0x0a4d, 0x0a3c, 0x0964, 0x00eb, 0x00ec, 0x00ed, 0x00ee, 0x00ef,
- 0x00f0, 0x0a66, 0x0a67, 0x0a68, 0x0a69, 0x0a6a, 0x0a6b, 0x0a6c,
- 0x0a6d, 0x0a6e, 0x0a6f,
-};
-
-static unichar_t hebrew[256] = {
- 0x0000, 0x0001, 0x0002, 0x0003, 0x0004, 0x0005, 0x0006, 0x0007,
- 0x0008, 0x0009, 0x000a, 0x000b, 0x000c, 0x000d, 0x000e, 0x000f,
- 0x0010, 0x0011, 0x0012, 0x0013, 0x0014, 0x0015, 0x0016, 0x0017,
- 0x0018, 0x0019, 0x001a, 0x001b, 0x001c, 0x001d, 0x001e, 0x001f,
- 0x0020, 0x0021, 0x0022, 0x0023, 0x0024, 0x0025, 0x0026, 0x0027,
- 0x0028, 0x0029, 0x002a, 0x002b, 0x002c, 0x002d, 0x002e, 0x002f,
- 0x0030, 0x0031, 0x0032, 0x0033, 0x0034, 0x0035, 0x0036, 0x0037,
- 0x0038, 0x0039, 0x003a, 0x003b, 0x003c, 0x003d, 0x003e, 0x003f,
- 0x0040, 0x0041, 0x0042, 0x0043, 0x0044, 0x0045, 0x0046, 0x0047,
- 0x0048, 0x0049, 0x004a, 0x004b, 0x004c, 0x004d, 0x004e, 0x004f,
- 0x0050, 0x0051, 0x0052, 0x0053, 0x0054, 0x0055, 0x0056, 0x0057,
- 0x0058, 0x0059, 0x005a, 0x005b, 0x005c, 0x005d, 0x005e, 0x005f,
- 0x0060, 0x0061, 0x0062, 0x0063, 0x0064, 0x0065, 0x0066, 0x0067,
- 0x0068, 0x0069, 0x006a, 0x006b, 0x006c, 0x006d, 0x006e, 0x006f,
- 0x0070, 0x0071, 0x0072, 0x0073, 0x0074, 0x0075, 0x0076, 0x0077,
- 0x0078, 0x0079, 0x007a, 0x007b, 0x007c, 0x007d, 0x007e, 0x007f,
- 0x00c4, 0x05f2, 0x00c7, 0x00c9, 0x00d1, 0x00d6, 0x00dc, 0x00e1,
- 0x00e0, 0x00e2, 0x00e4, 0x00e3, 0x00e5, 0x00e7, 0x00e9, 0x00e8,
- 0x00ea, 0x00eb, 0x00ed, 0x00ec, 0x00ee, 0x00ef, 0x00f1, 0x00f3,
- 0x00f2, 0x00f4, 0x00f6, 0x00f5, 0x00fa, 0x00f9, 0x00fb, 0x00fc,
- 0x0020, 0x0021, 0x0022, 0x0023, 0x0024, 0x0025, 0x20aa, 0x0027,
- 0x0029, 0x0028, 0x002a, 0x002b, 0x002c, 0x002d, 0x002e, 0x002f,
- 0x0030, 0x0031, 0x0032, 0x0033, 0x0034, 0x0035, 0x0036, 0x0037,
- 0x0038, 0x0039, 0x003a, 0x003b, 0x003c, 0x003d, 0x003e, 0x003f,
- 0xf86a, 0x201e, 0xf89b, 0xf89c, 0xf89d, 0xf89e, 0x05bc, 0xfb4b,
- 0xfb35, 0x2026, 0x00a0, 0x05b8, 0x05b7, 0x05b5, 0x05b6, 0x05b4,
- 0x2013, 0x2014, 0x201c, 0x201d, 0x2018, 0x2019, 0xfb2a, 0xfb2b,
- 0x05bf, 0x05b0, 0x05b2, 0x05b1, 0x05bb, 0x05b9, 0x05b8, 0x05b3,
- 0x05d0, 0x05d1, 0x05d2, 0x05d3, 0x05d4, 0x05d5, 0x05d6, 0x05d7,
- 0x05d8, 0x05d9, 0x05da, 0x05db, 0x05dc, 0x05dd, 0x05de, 0x05df,
- 0x05e0, 0x05e1, 0x05e2, 0x05e3, 0x05e4, 0x05e5, 0x05e6, 0x05e7,
- 0x05e8, 0x05e9, 0x05ea, 0x007d, 0x005d, 0x007b, 0x005b, 0x007c
-};
-
-static unichar_t iceland[256] = {
- 0x0000, 0x0001, 0x0002, 0x0003, 0x0004, 0x0005, 0x0006, 0x0007,
- 0x0008, 0x0009, 0x000a, 0x000b, 0x000c, 0x000d, 0x000e, 0x000f,
- 0x0010, 0x0011, 0x0012, 0x0013, 0x0014, 0x0015, 0x0016, 0x0017,
- 0x0018, 0x0019, 0x001a, 0x001b, 0x001c, 0x001d, 0x001e, 0x001f,
- 0x0020, 0x0021, 0x0022, 0x0023, 0x0024, 0x0025, 0x0026, 0x0027,
- 0x0028, 0x0029, 0x002a, 0x002b, 0x002c, 0x002d, 0x002e, 0x002f,
- 0x0030, 0x0031, 0x0032, 0x0033, 0x0034, 0x0035, 0x0036, 0x0037,
- 0x0038, 0x0039, 0x003a, 0x003b, 0x003c, 0x003d, 0x003e, 0x003f,
- 0x0040, 0x0041, 0x0042, 0x0043, 0x0044, 0x0045, 0x0046, 0x0047,
- 0x0048, 0x0049, 0x004a, 0x004b, 0x004c, 0x004d, 0x004e, 0x004f,
- 0x0050, 0x0051, 0x0052, 0x0053, 0x0054, 0x0055, 0x0056, 0x0057,
- 0x0058, 0x0059, 0x005a, 0x005b, 0x005c, 0x005d, 0x005e, 0x005f,
- 0x0060, 0x0061, 0x0062, 0x0063, 0x0064, 0x0065, 0x0066, 0x0067,
- 0x0068, 0x0069, 0x006a, 0x006b, 0x006c, 0x006d, 0x006e, 0x006f,
- 0x0070, 0x0071, 0x0072, 0x0073, 0x0074, 0x0075, 0x0076, 0x0077,
- 0x0078, 0x0079, 0x007a, 0x007b, 0x007c, 0x007d, 0x007e, 0x007f,
- 0x00c4, 0x00c5, 0x00c7, 0x00c9, 0x00d1, 0x00d6, 0x00dc, 0x00e1,
- 0x00e0, 0x00e2, 0x00e4, 0x00e3, 0x00e5, 0x00e7, 0x00e9, 0x00e8,
- 0x00ea, 0x00eb, 0x00ed, 0x00ec, 0x00ee, 0x00ef, 0x00f1, 0x00f3,
- 0x00f2, 0x00f4, 0x00f6, 0x00f5, 0x00fa, 0x00f9, 0x00fb, 0x00fc,
- 0x00dd, 0x00b0, 0x00a2, 0x00a3, 0x00a7, 0x2022, 0x00b6, 0x00df,
- 0x00ae, 0x00a9, 0x2122, 0x00b4, 0x00a8, 0x2260, 0x00c6, 0x00d8,
- 0x221e, 0x00b1, 0x2264, 0x2265, 0x00a5, 0x00b5, 0x2202, 0x2211,
- 0x220f, 0x03c0, 0x222b, 0x00aa, 0x00ba, 0x03a9, 0x00e6, 0x00f8,
- 0x00bf, 0x00a1, 0x00ac, 0x221a, 0x0192, 0x2248, 0x2206, 0x00ab,
- 0x00bb, 0x2026, 0x00a0, 0x00c0, 0x00c3, 0x00d5, 0x0152, 0x0153,
- 0x2013, 0x2014, 0x201c, 0x201d, 0x2018, 0x2019, 0x00f7, 0x25ca,
- 0x00ff, 0x0178, 0x2044, 0x20ac, 0x00d0, 0x00f0, 0x00de, 0x00fe,
- 0x00fd, 0x00b7, 0x201a, 0x201e, 0x2030, 0x00c2, 0x00ca, 0x00c1,
- 0x00cb, 0x00c8, 0x00cd, 0x00ce, 0x00cf, 0x00cc, 0x00d3, 0x00d4,
- 0xf8ff, 0x00d2, 0x00da, 0x00db, 0x00d9, 0x0131, 0x02c6, 0x02dc,
- 0x00af, 0x02d8, 0x02d9, 0x02da, 0x00b8, 0x02dd, 0x02db, 0x02c7
-};
-
-static unichar_t romanian[256] = {
- 0x0000, 0x0001, 0x0002, 0x0003, 0x0004, 0x0005, 0x0006, 0x0007,
- 0x0008, 0x0009, 0x000a, 0x000b, 0x000c, 0x000d, 0x000e, 0x000f,
- 0x0010, 0x0011, 0x0012, 0x0013, 0x0014, 0x0015, 0x0016, 0x0017,
- 0x0018, 0x0019, 0x001a, 0x001b, 0x001c, 0x001d, 0x001e, 0x001f,
- 0x0020, 0x0021, 0x0022, 0x0023, 0x0024, 0x0025, 0x0026, 0x0027,
- 0x0028, 0x0029, 0x002a, 0x002b, 0x002c, 0x002d, 0x002e, 0x002f,
- 0x0030, 0x0031, 0x0032, 0x0033, 0x0034, 0x0035, 0x0036, 0x0037,
- 0x0038, 0x0039, 0x003a, 0x003b, 0x003c, 0x003d, 0x003e, 0x003f,
- 0x0040, 0x0041, 0x0042, 0x0043, 0x0044, 0x0045, 0x0046, 0x0047,
- 0x0048, 0x0049, 0x004a, 0x004b, 0x004c, 0x004d, 0x004e, 0x004f,
- 0x0050, 0x0051, 0x0052, 0x0053, 0x0054, 0x0055, 0x0056, 0x0057,
- 0x0058, 0x0059, 0x005a, 0x005b, 0x005c, 0x005d, 0x005e, 0x005f,
- 0x0060, 0x0061, 0x0062, 0x0063, 0x0064, 0x0065, 0x0066, 0x0067,
- 0x0068, 0x0069, 0x006a, 0x006b, 0x006c, 0x006d, 0x006e, 0x006f,
- 0x0070, 0x0071, 0x0072, 0x0073, 0x0074, 0x0075, 0x0076, 0x0077,
- 0x0078, 0x0079, 0x007a, 0x007b, 0x007c, 0x007d, 0x007e, 0x007f,
- 0x00c4, 0x00c5, 0x00c7, 0x00c9, 0x00d1, 0x00d6, 0x00dc, 0x00e1,
- 0x00e0, 0x00e2, 0x00e4, 0x00e3, 0x00e5, 0x00e7, 0x00e9, 0x00e8,
- 0x00ea, 0x00eb, 0x00ed, 0x00ec, 0x00ee, 0x00ef, 0x00f1, 0x00f3,
- 0x00f2, 0x00f4, 0x00f6, 0x00f5, 0x00fa, 0x00f9, 0x00fb, 0x00fc,
- 0x2020, 0x00b0, 0x00a2, 0x00a3, 0x00a7, 0x2022, 0x00b6, 0x00df,
- 0x00ae, 0x00a9, 0x2122, 0x00b4, 0x00a8, 0x2260, 0x0102, 0x0218,
- 0x221e, 0x00b1, 0x2264, 0x2265, 0x00a5, 0x00b5, 0x2202, 0x2211,
- 0x220f, 0x03c0, 0x222b, 0x00aa, 0x00ba, 0x03a9, 0x0103, 0x0219,
- 0x00bf, 0x00a1, 0x00ac, 0x221a, 0x0192, 0x2248, 0x2206, 0x00ab,
- 0x00bb, 0x2026, 0x00a0, 0x00c0, 0x00c3, 0x00d5, 0x0152, 0x0153,
- 0x2013, 0x2014, 0x201c, 0x201d, 0x2018, 0x2019, 0x00f7, 0x25ca,
- 0x00ff, 0x0178, 0x2044, 0x20ac, 0x2039, 0x203a, 0x021a, 0x021b,
- 0x2021, 0x00b7, 0x201a, 0x201e, 0x2030, 0x00c2, 0x00ca, 0x00c1,
- 0x00cb, 0x00c8, 0x00cd, 0x00ce, 0x00cf, 0x00cc, 0x00d3, 0x00d4,
- 0xf8ff, 0x00d2, 0x00da, 0x00db, 0x00d9, 0x0131, 0x02c6, 0x02dc,
- 0x00af, 0x02d8, 0x02d9, 0x02da, 0x00b8, 0x02dd, 0x02db, 0x02c7
-};
-
-unichar_t MacRomanEnc[256] = {
- 0x0000, 0x0001, 0x0002, 0x0003, 0x0004, 0x0005, 0x0006, 0x0007,
- 0x0008, 0x0009, 0x000a, 0x000b, 0x000c, 0x000d, 0x000e, 0x000f,
- 0x0010, 0x0011, 0x0012, 0x0013, 0x0014, 0x0015, 0x0016, 0x0017,
- 0x0018, 0x0019, 0x001a, 0x001b, 0x001c, 0x001d, 0x001e, 0x001f,
- 0x0020, 0x0021, 0x0022, 0x0023, 0x0024, 0x0025, 0x0026, 0x0027,
- 0x0028, 0x0029, 0x002a, 0x002b, 0x002c, 0x002d, 0x002e, 0x002f,
- 0x0030, 0x0031, 0x0032, 0x0033, 0x0034, 0x0035, 0x0036, 0x0037,
- 0x0038, 0x0039, 0x003a, 0x003b, 0x003c, 0x003d, 0x003e, 0x003f,
- 0x0040, 0x0041, 0x0042, 0x0043, 0x0044, 0x0045, 0x0046, 0x0047,
- 0x0048, 0x0049, 0x004a, 0x004b, 0x004c, 0x004d, 0x004e, 0x004f,
- 0x0050, 0x0051, 0x0052, 0x0053, 0x0054, 0x0055, 0x0056, 0x0057,
- 0x0058, 0x0059, 0x005a, 0x005b, 0x005c, 0x005d, 0x005e, 0x005f,
- 0x0060, 0x0061, 0x0062, 0x0063, 0x0064, 0x0065, 0x0066, 0x0067,
- 0x0068, 0x0069, 0x006a, 0x006b, 0x006c, 0x006d, 0x006e, 0x006f,
- 0x0070, 0x0071, 0x0072, 0x0073, 0x0074, 0x0075, 0x0076, 0x0077,
- 0x0078, 0x0079, 0x007a, 0x007b, 0x007c, 0x007d, 0x007e, 0x007f,
- 0x00c4, 0x00c5, 0x00c7, 0x00c9, 0x00d1, 0x00d6, 0x00dc, 0x00e1,
- 0x00e0, 0x00e2, 0x00e4, 0x00e3, 0x00e5, 0x00e7, 0x00e9, 0x00e8,
- 0x00ea, 0x00eb, 0x00ed, 0x00ec, 0x00ee, 0x00ef, 0x00f1, 0x00f3,
- 0x00f2, 0x00f4, 0x00f6, 0x00f5, 0x00fa, 0x00f9, 0x00fb, 0x00fc,
- 0x2020, 0x00b0, 0x00a2, 0x00a3, 0x00a7, 0x2022, 0x00b6, 0x00df,
- 0x00ae, 0x00a9, 0x2122, 0x00b4, 0x00a8, 0x2260, 0x00c6, 0x00d8,
- 0x221e, 0x00b1, 0x2264, 0x2265, 0x00a5, 0x00b5, 0x2202, 0x2211,
- 0x220f, 0x03c0, 0x222b, 0x00aa, 0x00ba, 0x03a9, 0x00e6, 0x00f8,
- 0x00bf, 0x00a1, 0x00ac, 0x221a, 0x0192, 0x2248, 0x2206, 0x00ab,
- 0x00bb, 0x2026, 0x00a0, 0x00c0, 0x00c3, 0x00d5, 0x0152, 0x0153,
- 0x2013, 0x2014, 0x201c, 0x201d, 0x2018, 0x2019, 0x00f7, 0x25ca,
- 0x00ff, 0x0178, 0x2044, 0x20ac, 0x2039, 0x203a, 0xfb01, 0xfb02,
- 0x2021, 0x00b7, 0x201a, 0x201e, 0x2030, 0x00c2, 0x00ca, 0x00c1,
- 0x00cb, 0x00c8, 0x00cd, 0x00ce, 0x00cf, 0x00cc, 0x00d3, 0x00d4,
- 0xf8ff, 0x00d2, 0x00da, 0x00db, 0x00d9, 0x0131, 0x02c6, 0x02dc,
- 0x00af, 0x02d8, 0x02d9, 0x02da, 0x00b8, 0x02dd, 0x02db, 0x02c7
-};
-
-static unichar_t thai[256] = {
- 0x0000, 0x0001, 0x0002, 0x0003, 0x0004, 0x0005, 0x0006, 0x0007,
- 0x0008, 0x0009, 0x000a, 0x000b, 0x000c, 0x000d, 0x000e, 0x000f,
- 0x0010, 0x0011, 0x0012, 0x0013, 0x0014, 0x0015, 0x0016, 0x0017,
- 0x0018, 0x0019, 0x001a, 0x001b, 0x001c, 0x001d, 0x001e, 0x001f,
- 0x0020, 0x0021, 0x0022, 0x0023, 0x0024, 0x0025, 0x0026, 0x0027,
- 0x0028, 0x0029, 0x002a, 0x002b, 0x002c, 0x002d, 0x002e, 0x002f,
- 0x0030, 0x0031, 0x0032, 0x0033, 0x0034, 0x0035, 0x0036, 0x0037,
- 0x0038, 0x0039, 0x003a, 0x003b, 0x003c, 0x003d, 0x003e, 0x003f,
- 0x0040, 0x0041, 0x0042, 0x0043, 0x0044, 0x0045, 0x0046, 0x0047,
- 0x0048, 0x0049, 0x004a, 0x004b, 0x004c, 0x004d, 0x004e, 0x004f,
- 0x0050, 0x0051, 0x0052, 0x0053, 0x0054, 0x0055, 0x0056, 0x0057,
- 0x0058, 0x0059, 0x005a, 0x005b, 0x005c, 0x005d, 0x005e, 0x005f,
- 0x0060, 0x0061, 0x0062, 0x0063, 0x0064, 0x0065, 0x0066, 0x0067,
- 0x0068, 0x0069, 0x006a, 0x006b, 0x006c, 0x006d, 0x006e, 0x006f,
- 0x0070, 0x0071, 0x0072, 0x0073, 0x0074, 0x0075, 0x0076, 0x0077,
- 0x0078, 0x0079, 0x007a, 0x007b, 0x007c, 0x007d, 0x007e, 0x007f,
- 0x00ab, 0x00bb, 0x2026, 0x0e48, 0x0e49, 0x0e4a, 0x0e4b, 0x0e4c,
- 0x0e48, 0x0e49, 0x0e4a, 0x0e4b, 0x0e4c, 0x201c, 0x201d, 0x0e4d,
- 0x0090, 0x2022, 0x0e31, 0x0e47, 0x0e34, 0x0e35, 0x0e36, 0x0e37,
- 0x0e48, 0x0e49, 0x0e4a, 0x0e4b, 0x0e4c, 0x2018, 0x2019, 0x009f,
- 0x00a0, 0x0e01, 0x0e02, 0x0e03, 0x0e04, 0x0e05, 0x0e06, 0x0e07,
- 0x0e08, 0x0e09, 0x0e0a, 0x0e0b, 0x0e0c, 0x0e0d, 0x0e0e, 0x0e0f,
- 0x0e10, 0x0e11, 0x0e12, 0x0e13, 0x0e14, 0x0e15, 0x0e16, 0x0e17,
- 0x0e18, 0x0e19, 0x0e1a, 0x0e1b, 0x0e1c, 0x0e1d, 0x0e1e, 0x0e1f,
- 0x0e20, 0x0e21, 0x0e22, 0x0e23, 0x0e24, 0x0e25, 0x0e26, 0x0e27,
- 0x0e28, 0x0e29, 0x0e2a, 0x0e2b, 0x0e2c, 0x0e2d, 0x0e2e, 0x0e2f,
- 0x0e30, 0x0e31, 0x0e32, 0x0e33, 0x0e34, 0x0e35, 0x0e36, 0x0e37,
- 0x0e38, 0x0e39, 0x0e3a, 0x2060, 0x200b, 0x2013, 0x2014, 0x0e3f,
- 0x0e40, 0x0e41, 0x0e42, 0x0e43, 0x0e44, 0x0e45, 0x0e46, 0x0e47,
- 0x0e48, 0x0e49, 0x0e4a, 0x0e4b, 0x0e4c, 0x0e4d, 0x2122, 0x0e4f,
- 0x0e50, 0x0e51, 0x0e52, 0x0e53, 0x0e54, 0x0e55, 0x0e56, 0x0e57,
- 0x0e58, 0x0e59, 0x00ae, 0x00a9,
-};
-
-static unichar_t turkish[256] = {
- 0x0000, 0x0001, 0x0002, 0x0003, 0x0004, 0x0005, 0x0006, 0x0007,
- 0x0008, 0x0009, 0x000a, 0x000b, 0x000c, 0x000d, 0x000e, 0x000f,
- 0x0010, 0x0011, 0x0012, 0x0013, 0x0014, 0x0015, 0x0016, 0x0017,
- 0x0018, 0x0019, 0x001a, 0x001b, 0x001c, 0x001d, 0x001e, 0x001f,
- 0x0020, 0x0021, 0x0022, 0x0023, 0x0024, 0x0025, 0x0026, 0x0027,
- 0x0028, 0x0029, 0x002a, 0x002b, 0x002c, 0x002d, 0x002e, 0x002f,
- 0x0030, 0x0031, 0x0032, 0x0033, 0x0034, 0x0035, 0x0036, 0x0037,
- 0x0038, 0x0039, 0x003a, 0x003b, 0x003c, 0x003d, 0x003e, 0x003f,
- 0x0040, 0x0041, 0x0042, 0x0043, 0x0044, 0x0045, 0x0046, 0x0047,
- 0x0048, 0x0049, 0x004a, 0x004b, 0x004c, 0x004d, 0x004e, 0x004f,
- 0x0050, 0x0051, 0x0052, 0x0053, 0x0054, 0x0055, 0x0056, 0x0057,
- 0x0058, 0x0059, 0x005a, 0x005b, 0x005c, 0x005d, 0x005e, 0x005f,
- 0x0060, 0x0061, 0x0062, 0x0063, 0x0064, 0x0065, 0x0066, 0x0067,
- 0x0068, 0x0069, 0x006a, 0x006b, 0x006c, 0x006d, 0x006e, 0x006f,
- 0x0070, 0x0071, 0x0072, 0x0073, 0x0074, 0x0075, 0x0076, 0x0077,
- 0x0078, 0x0079, 0x007a, 0x007b, 0x007c, 0x007d, 0x007e, 0x007f,
- 0x00c4, 0x00c5, 0x00c7, 0x00c9, 0x00d1, 0x00d6, 0x00dc, 0x00e1,
- 0x00e0, 0x00e2, 0x00e4, 0x00e3, 0x00e5, 0x00e7, 0x00e9, 0x00e8,
- 0x00ea, 0x00eb, 0x00ed, 0x00ec, 0x00ee, 0x00ef, 0x00f1, 0x00f3,
- 0x00f2, 0x00f4, 0x00f6, 0x00f5, 0x00fa, 0x00f9, 0x00fb, 0x00fc,
- 0x2020, 0x00b0, 0x00a2, 0x00a3, 0x00a7, 0x2022, 0x00b6, 0x00df,
- 0x00ae, 0x00a9, 0x2122, 0x00b4, 0x00a8, 0x2260, 0x00c6, 0x00d8,
- 0x221e, 0x00b1, 0x2264, 0x2265, 0x00a5, 0x00b5, 0x2202, 0x2211,
- 0x220f, 0x03c0, 0x222b, 0x00aa, 0x00ba, 0x03a9, 0x00e6, 0x00f8,
- 0x00bf, 0x00a1, 0x00ac, 0x221a, 0x0192, 0x2248, 0x2206, 0x00ab,
- 0x00bb, 0x2026, 0x00a0, 0x00c0, 0x00c3, 0x00d5, 0x0152, 0x0153,
- 0x2013, 0x2014, 0x201c, 0x201d, 0x2018, 0x2019, 0x00f7, 0x25ca,
- 0x00ff, 0x0178, 0x011e, 0x011f, 0x0130, 0x0131, 0x015e, 0x015f,
- 0x2021, 0x00b7, 0x201a, 0x201e, 0x2030, 0x00c2, 0x00ca, 0x00c1,
- 0x00cb, 0x00c8, 0x00cd, 0x00ce, 0x00cf, 0x00cc, 0x00d3, 0x00d4,
- 0xf8ff, 0x00d2, 0x00da, 0x00db, 0x00d9, 0xf8a0, 0x02c6, 0x02dc,
- 0x00af, 0x02d8, 0x02d9, 0x02da, 0x00b8, 0x02dd, 0x02db, 0x02c7
-};
-
-enum script_codes {
- sm_roman, sm_japanese, sm_tradchinese, sm_korean,
- sm_arabic, sm_hebrew, sm_greek, sm_cyrillic,
- sm_rsymbol, sm_devanagari, sm_gurmukhi, sm_gujarati,
- sm_oriya, sm_bengali, sm_tamil, sm_telugu,
- sm_kannada, sm_malayalam, sm_sinhalese, sm_burmese,
- sm_khmer, sm_thai, sm_laotian, sm_georgian,
- sm_armenian, sm_simpchinese, sm_tibetan, sm_mongolian,
- sm_geez, sm_slavic, sm_vietnamese, sm_sindhi,
- sm_max };
-
-static unichar_t *macencodings[] = {
- MacRomanEnc,
- NULL/*Essentially SJIS*/,
- NULL/*Essentially Big 5*/,
- NULL/*Essentially Wansung*/,
- arabic,
- hebrew,
- greek,
- cyrillic,
- NULL, /* rsymbol, whatever that is */
- devanagari,
-/*10*/ gurmukhi,
- gujarati,
- NULL, /* oriya */
- NULL, /* bengali */
- NULL, /* Tamil */
- NULL, /* Telugu */
- NULL, /* Kannada */
- NULL, /* Malayalam */
- NULL, /* Sinhalese */
- NULL, /* Burmese */
-/*20*/ NULL, /* Khmer */
- thai,
- NULL, /* Lao */
- NULL, /* Georgian */
- NULL, /* Armenian */
-/*25*/ NULL,/* SimpChinese, GB2312 offset by 0x8080 to 0xa1a1 */
- NULL, /* Tibetan */
- NULL, /* Mongolian */
- NULL, /* Geex/Ethiopic */
- centeuro, /* Baltic/Slavic */
-/*30*/ NULL, /* Vietnamese */
- NULL, /* Extended Arabic for Sindhi */
- NULL /* Uninterpretted */
-};
-
-/* The icelandic encoding also uses 0 (mac roman) encoding even though it's not*/
-/* The turkish encoding also uses 0 (mac roman) encoding even though it's not*/
-/* The croatian encoding also uses 0 (mac roman) encoding even though it's not*/
-/* The romanian encoding also uses 0 (mac roman) encoding even though it's not*/
-
-/* I've no idea what encoding code farsi uses, it isn't documented to be arabic 4, nor is it documented to have its own code */
-
-static uint8 _MacScriptFromLanguage[] = {
- sm_roman, /* English */
- sm_roman, /* French */
- sm_roman, /* German */
- sm_roman, /* Italian */
- sm_roman, /* Dutch */
- sm_roman, /* Swedish */
- sm_roman, /* Spanish */
- sm_roman, /* Danish */
- sm_roman, /* Portuguese */
- sm_roman, /* Norwegian */
-/*10*/ sm_hebrew, /* Hebrew */
- sm_japanese, /* Japanese */
- sm_arabic, /* Arabic */
- sm_roman, /* Finnish */
- sm_greek, /* Greek */
- sm_roman, /* Icelandic */ /* Modified roman */
- sm_roman, /* Maltese */
- sm_roman, /* Turkish */ /* Modified roman */
- sm_roman, /* Croatian */ /* Modified roman */
- sm_tradchinese, /* Traditional Chinese */
-/*20*/ sm_arabic, /* Urdu (I assume arabic) */
- sm_devanagari, /* Hindi (I assume) */
- sm_thai, /* Thai */
- sm_korean, /* Korean */
- sm_slavic, /* Lithuanian */
- sm_slavic, /* Polish */
- sm_slavic, /* Hungarian */
- sm_slavic, /* Estonian */
- sm_slavic, /* Latvian */
- sm_roman, /* Sami (Lappish) */
-/*30*/ sm_roman, /* Faroese (Icelandic) */ /* Modified roman */
- sm_arabic, /* Farsi/Persian */ /* Modified Arabic */
- sm_cyrillic, /* Russian */
- sm_simpchinese, /* Simplified Chinese */
- sm_roman, /* Flemish */
- sm_roman, /* Irish Gaelic */
- sm_roman, /* albanian (???) */
- sm_roman, /* Romanian */ /* Modified roman */
- sm_slavic, /* Czech */
- sm_slavic, /* Slovak */
-/*40*/ sm_slavic, /* Slovenian */
- sm_roman, /* Yiddish */
- sm_cyrillic, /* Serbian */
- sm_cyrillic, /* Macedonian */
- sm_cyrillic, /* Bulgarian */
- sm_cyrillic, /* Ukrainian */
- sm_cyrillic, /* Byelorussian */
- sm_cyrillic, /* Uzbek */
- sm_cyrillic, /* Kazakh */
- sm_cyrillic, /* Axerbaijani (Cyrillic) */
-/*50*/ sm_arabic, /* Axerbaijani (Arabic) */
- sm_armenian, /* Armenian */
- sm_georgian, /* Georgian */
- sm_cyrillic, /* Moldavian */
- sm_cyrillic, /* Kirghiz */
- sm_cyrillic, /* Tajiki */
- sm_cyrillic, /* Turkmen */
- sm_mongolian, /* Mongolian (Mongolian) */
- sm_cyrillic, /* Mongolian (cyrillic) */
- sm_arabic, /* Pashto */
-/*60*/ sm_arabic, /* Kurdish */
- sm_devanagari, /* Kashmiri (???) */
- sm_sindhi, /* Sindhi */
- sm_tibetan, /* Tibetan */
- sm_tibetan, /* Nepali (???) */
- sm_devanagari, /* Sanskrit */
- sm_devanagari, /* Marathi */
- sm_bengali, /* Bengali */
- sm_bengali, /* Assamese (???) */
- sm_gujarati, /* Gujarati */
-/*70*/ sm_gujarati, /* Punjabi (???) */
- sm_oriya, /* Oriya */
- sm_malayalam, /* Malayalam */
- sm_kannada, /* Kannada */
- sm_tamil, /* Tamil */
- sm_telugu, /* Telugu */
- sm_sinhalese, /* Sinhalese */
- sm_burmese, /* Burmese */
- sm_khmer, /* Khmer */
- sm_laotian, /* Lao */
-/*80*/ sm_vietnamese, /* Vietnamese */
- sm_arabic, /* Indonesian */
- sm_roman, /* Tagalog (???) */
- sm_roman, /* Malay (roman) */
- sm_arabic, /* Malay (arabic) */
- sm_roman, /* Amharic (???) */
- sm_roman, /* Tigrinya (???) */
- sm_roman, /* Galla (???) */
- sm_roman, /* Somali (???) */
- sm_roman, /* Swahili (???) */
-/*90*/ sm_roman, /* Kinyarwanda/Ruanda (???) */
- sm_roman, /* Rundi (???) */
- sm_roman, /* Nyanja/Chewa (???) */
- sm_roman, /* Malagasy */
-/*94*/ sm_roman, /* Esperanto */
- 0xff,
- 0xff,
- 0xff,
- 0xff,
- 0xff,
-/*100*/ 0xff,
- 0xff,
- 0xff,
- 0xff,
- 0xff,
- 0xff,
- 0xff,
- 0xff,
- 0xff,
- 0xff,
-/*110*/ 0xff,
- 0xff,
- 0xff,
- 0xff,
- 0xff,
- 0xff,
- 0xff,
- 0xff,
- 0xff,
- 0xff,
-/*120*/ 0xff,
- 0xff,
- 0xff,
- 0xff,
- 0xff,
- 0xff,
- 0xff,
- 0xff,
-/*128*/ sm_roman, /* Welsh */
- sm_roman, /* Basque */
-/*130*/ sm_roman, /* Catalan */
- sm_roman, /* Latin */
- sm_roman, /* Quechua (???) */
- sm_roman, /* Guarani (???) */
- sm_roman, /* Aymara (???) */
- sm_cyrillic, /* Tatar (???) */
- sm_cyrillic, /* Uighur (???) */
- sm_cyrillic, /* Dzongkha (???) */
- sm_roman, /* Javanese (roman) */
- sm_roman, /* Sundanese (roman) */
-/*140*/ sm_roman, /* Galician */
- sm_roman, /* Afrikaans */
- sm_roman, /* Breton */
- sm_roman, /* Inuktitut */
- sm_roman, /* Scottish Gaelic */
- sm_roman, /* Manx Gaelic */
- sm_roman, /* Irish Gaelic (with dot) */
- sm_roman, /* Tongan */
- sm_greek, /* Greek (polytonic) */
- sm_roman, /* Greenlandic */ /* Presumably icelandic? */
-/*150*/ sm_roman, /* Azebaijani (roman) */
- 0xff
-};
-
-static uint16 _WinLangFromMac[] = {
- 0x409, /* English */
- 0x40c, /* French */
- 0x407, /* German */
- 0x410, /* Italian */
- 0x413, /* Dutch */
- 0x41d, /* Swedish */
- 0x40a, /* Spanish */
- 0x406, /* Danish */
- 0x416, /* Portuguese */
- 0x414, /* Norwegian */
-/*10*/ 0x40d, /* Hebrew */
- 0x411, /* Japanese */
- 0x401, /* Arabic */
- 0x40b, /* Finnish */
- 0x408, /* Greek */
- 0x40f, /* Icelandic */
- 0x43a, /* Maltese */
- 0x41f, /* Turkish */
- 0x41a, /* Croatian */
- 0x404, /* Traditional Chinese */
-/*20*/ 0x420, /* Urdu */
- 0x439, /* Hindi */
- 0x41e, /* Thai */
- 0x412, /* Korean */
- 0x427, /* Lithuanian */
- 0x415, /* Polish */
- 0x40e, /* Hungarian */
- 0x425, /* Estonian */
- 0x426, /* Latvian */
- 0x43b, /* Sami (Lappish) */
-/*30*/ 0x438, /* Faroese (Icelandic) */
- 0x429, /* Farsi/Persian */
- 0x419, /* Russian */
- 0x804, /* Simplified Chinese */
- 0x813, /* Flemish */
- 0x43c, /* Irish Gaelic */
- 0x41c, /* albanian */
- 0x418, /* Romanian */
- 0x405, /* Czech */
- 0x41b, /* Slovak */
-/*40*/ 0x424, /* Slovenian */
- 0x43d, /* Yiddish */
- 0xc1a, /* Serbian */
- 0x42f, /* Macedonian */
- 0x402, /* Bulgarian */
- 0x422, /* Ukrainian */
- 0x423, /* Byelorussian */
- 0x843, /* Uzbek */
- 0x43f, /* Kazakh */
- 0x42c, /* Azerbaijani (Cyrillic) */
-/*50*/ 0x82c, /* Azerbaijani (Arabic) */
- 0x42b, /* Armenian */
- 0x437, /* Georgian */
- 0x818, /* Moldavian */
- 0x440, /* Kirghiz */
- 0x428, /* Tajiki */
- 0x442, /* Turkmen */
- 0x450, /* Mongolian (Mongolian) */
- 0x850, /* Mongolian (cyrillic) */
- 0x463, /* Pashto */
-/*60*/ 0xffff, /* Kurdish */
- 0x860, /* Kashmiri */
- 0x459, /* Sindhi */
- 0xffff, /* Tibetan */
- 0x461, /* Nepali */
- 0x43b, /* Sanskrit */
- 0x44e, /* Marathi */
- 0x445, /* Bengali */
- 0x44d, /* Assamese */
- 0x447, /* Gujarati */
-/*70*/ 0x446, /* Punjabi */
- 0x448, /* Oriya */
- 0x44c, /* Malayalam */
- 0x44b, /* Kannada */
- 0x449, /* Tamil */
- 0x44a, /* Telugu */
- 0x45b, /* Sinhalese */
- 0x455, /* Burmese */
- 0x453, /* Khmer */
- 0x454, /* Lao */
-/*80*/ 0x42a, /* Vietnamese */
- 0x421, /* Indonesian */
- 0x464, /* Tagalog */
- 0x43e, /* Malay (latin) */
- 0x83e, /* Malay (arabic) */
- 0x45e, /* Amharic */
- 0x473, /* Tigrinya */
- 0x472, /* Galla, oromo, afan */
- 0x477, /* Somali */
- 0x441, /* Swahili */
-/*90*/ 0xffff, /* Kinyarwanda/Ruanda */
- 0xffff, /* Rundi/Kirundi */
- 0xffff, /* Nyanja/Chewa */
- 0xffff, /* Malagasy */
-/*94*/ 0xffff, /* Esperanto */
- 0xffff,
- 0xffff,
- 0xffff,
- 0xffff,
- 0xffff,
-/*100*/ 0xffff,
- 0xffff,
- 0xffff,
- 0xffff,
- 0xffff,
- 0xffff,
- 0xffff,
- 0xffff,
- 0xffff,
- 0xffff,
-/*110*/ 0xffff,
- 0xffff,
- 0xffff,
- 0xffff,
- 0xffff,
- 0xffff,
- 0xffff,
- 0xffff,
- 0xffff,
- 0xffff,
-/*120*/ 0xffff,
- 0xffff,
- 0xffff,
- 0xffff,
- 0xffff,
- 0xffff,
- 0xffff,
- 0xffff,
-/*128*/ 0x452, /* Welsh */
- 0x42d, /* Basque */
-/*130*/ 0x403, /* Catalan */
- 0x476, /* Latin */
- 0xffff, /* Quechua */
- 0x474, /* Guarani */
- 0xffff, /* Aymara */
- 0x444, /* Tatar */
- 0xffff, /* Uighur */
- 0xffff, /* Dzongkha/Bhutani */
- 0xffff, /* Javanese (roman) */
- 0xffff, /* Sundanese (roman) */
-/*140*/ 0x456, /* Galician */
- 0x436, /* Afrikaans */
- 0xffff, /* Breton */
- 0x45d, /* Inuktitut */
- 0x43c, /* Scottish Gaelic */
- 0xc3c, /* Manx Gaelic */
- 0x83c, /* Irish Gaelic (with dot) */
- 0xffff, /* Tongan */
- 0xffff, /* Greek (polytonic) */
- 0xffff, /* Greenlandic */ /* Presumably icelandic? */
-/*150*/ 0x42c, /* Azebaijani (roman) */
- 0xffff
-};
-
-static char *LanguageCodesFromMacLang[] = {
- "en", /* English */
- "fr", /* French */
- "de", /* German */
- "it", /* Italian */
- "nl", /* Dutch */
- "sv", /* Swedish */
- "es", /* Spanish */
- "da", /* Danish */
- "pt", /* Portuguese */
- "no", /* Norwegian */
-/*10*/ "he", /* Hebrew */
- "ja", /* Japanese */
- "ar", /* Arabic */
- "fi", /* Finnish */
- "el", /* Greek */
- "is", /* Icelandic */
- "ml", /* Maltese */
- "tr", /* Turkish */
- "hr", /* Croatian */
- "zh_TW", /* Traditional Chinese */ /* zh_HK */
-/*20*/ "ur", /* Urdu */
- "hi", /* Hindi */
- "th", /* Thai */
- "ko", /* Korean */
- "lt", /* Lithuanian */
- "pl", /* Polish */
- "hu", /* Hungarian */
- "et", /* Estonian */
- "lv", /* Latvian */
- "smi", /* Sami (Lappish) */
-/*30*/ "fo", /* Faroese (Icelandic) */
- "fa", /* Farsi/Persian */
- "ru", /* Russian */
- "zh_CN", /* Simplified Chinese */
- "nl_BE", /* Flemish */ /* Flemish doesn't rate a language code, use dutch */
- "ga", /* Irish Gaelic */
- "sq", /* albanian */
- "ro", /* Romanian */
- "cs", /* Czech */
- "sk", /* Slovak */
-/*40*/ "sl", /* Slovenian */
- "yi", /* Yiddish */
- "sr", /* Serbian */
- "mk", /* Macedonian */
- "bg", /* Bulgarian */
- "uk", /* Ukrainian */
- "be", /* Byelorussian */
- "uz", /* Uzbek */
- "kk", /* Kazakh */
- "az", /* Axerbaijani (Cyrillic) */
-/*50*/ "az", /* Axerbaijani (Arabic) */
- "hy", /* Armenian */
- "ka", /* Georgian */
- "mo", /* Moldavian */
- "ky", /* Kirghiz */
- "tg", /* Tajiki */
- "tk", /* Turkmen */
- "mn", /* Mongolian (Mongolian) */
- "mn", /* Mongolian (cyrillic) */
- "ps", /* Pashto */
-/*60*/ "ku", /* Kurdish */
- "ks", /* Kashmiri */
- "sd", /* Sindhi */
- "bo", /* Tibetan */
- "ne", /* Nepali */
- "sa", /* Sanskrit */
- "mr", /* Marathi */
- "bn", /* Bengali */
- "as", /* Assamese */
- "gu", /* Gujarati */
-/*70*/ "pa", /* Punjabi */
- "or", /* Oriya */
- "mal", /* Malayalam */
- "kn", /* Kannada */
- "ta", /* Tamil */
- "te", /* Telugu */
- "si", /* Sinhalese */
- "my", /* Burmese */
- "km", /* Khmer */
- "lo", /* Lao */
-/*80*/ "vi", /* Vietnamese */
- "id", /* Indonesian */
- "tl", /* Tagalog */
- "ms", /* Malay (roman) */
- "ms", /* Malay (arabic) */
- "am", /* Amharic */
- "ti", /* Tigrinya */
- "om", /* Galla */
- "so", /* Somali */
- "sw", /* Swahili */
-/*90*/ "rw", /* Kinyarwanda/Ruanda */
- "rn", /* Rundi */
- "nya", /* Nyanja/Chewa */
- "mg", /* Malagasy */
-/*94*/ "eo", /* Esperanto */
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
-/*100*/ NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
-/*110*/ NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
-/*120*/ NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
-/*128*/ "cy", /* Welsh */
- "eu", /* Basque */
-/*130*/ "ca", /* Catalan */
- "la", /* Latin */
- "qu", /* Quechua */
- "gn", /* Guarani */
- "ay", /* Aymara */
- "tt", /* Tatar */
- "ug", /* Uighur */
- "dz", /* Dzongkha */
- "jv", /* Javanese (roman) */
- "su", /* Sundanese (roman) */
-/*140*/ "gl", /* Galician */
- "af", /* Afrikaans */
- "be", /* Breton */
- "iu", /* Inuktitut */
- "gd", /* Scottish Gaelic */
- "gv", /* Manx Gaelic */
- NULL, /* Irish Gaelic (with dot) */
- "to", /* Tongan */
- "grc", /* Greek (polytonic) */
- "kl", /* Greenlandic */ /* Presumably icelandic? */
-/*150*/ "az", /* Azebaijani (roman) */
- NULL
-};
-
-static const unichar_t *MacEncLangToTable(int macenc,int maclang) {
- const unichar_t *table = macencodings[macenc];
-
- if ( maclang==15 /* Icelandic */ ||
- maclang==30 /* Faroese */ ||
- maclang==149 /* Greenlandic */ )
- table = iceland;
- else if ( maclang == 17 /* turkish */ )
- table = turkish;
- else if ( maclang == 18 /* croatian */ )
- table = croatian;
- else if ( maclang == 37 /* romanian */ )
- table = romanian;
- else if ( maclang == 31 /* Farsi/Persian */ )
- table = farsi;
-return( table );
-}
-
-char *MacStrToUtf8(const char *str,int macenc,int maclang) {
- const unichar_t *table;
- char *ret, *rpt;
- const uint8 *ustr = (uint8 *) str;
-
- if ( str==NULL )
-return( NULL );
-
- if ( macenc==sm_japanese || macenc==sm_korean || macenc==sm_tradchinese ||
- macenc == sm_simpchinese ) {
- Encoding *enc = FindOrMakeEncoding(macenc==sm_japanese ? "Sjis" :
- macenc==sm_korean ? "EUC-KR" :
- macenc==sm_tradchinese ? "Big5" :
- "EUC-CN" );
- iconv_t *toutf8;
- ICONV_CONST char *in;
- char *out;
- size_t inlen, outlen;
- if ( enc==NULL )
-return( NULL );
-#ifdef UNICHAR_16
- toutf8 = iconv_open("UCS2",enc->iconv_name!=NULL?enc->iconv_name:enc->enc_name);
-#else
- toutf8 = iconv_open("UCS4",enc->iconv_name!=NULL?enc->iconv_name:enc->enc_name);
-#endif
- if ( toutf8==(iconv_t) -1 || toutf8==NULL )
-return( NULL );
- in = (char *) str;
- inlen = strlen(in);
- outlen = (inlen+1)*4;
- out = (char *) (ret = galloc(outlen+2));
- if(iconv(toutf8,&in,&inlen,&out,&outlen)==-1){
- if (ret) free(ret) ;
- if (toutf8) iconv_close(toutf8);
-return( NULL );}
- out[0] = '\0';
- iconv_close(toutf8);
-#ifdef UNICHAR_16
- toutf8 = iconv_open("UTF-8","UCS2");
-#else
- toutf8 = iconv_open("UTF-8","UCS4");
-#endif
- if ( toutf8==(iconv_t) -1 || toutf8==NULL ){
- if (ret) free(ret);
- if (toutf8) iconv_close(toutf8);
-return( NULL );}
- in = (char *) strdup(ret);
- inlen = strlen(in);
- outlen = (inlen+1)*4;
- out = (char *) (ret = grealloc(ret,outlen+2));
- if(iconv(toutf8,&in,&inlen,&out,&outlen)==-1)
-return( NULL );
- out[0] = '\0';
- iconv_close(toutf8);
- free(in);
-return( ret );
- }
-
- if ( macenc<0 || macenc>31 ) {
- IError( "Invalid mac encoding %d.\n", macenc );
-return( NULL );
- }
- table = MacEncLangToTable(macenc,maclang);
-
- if ( table==NULL )
-return( NULL );
-
- ret = galloc((strlen(str)+1)*3);
- for ( rpt = ret; *ustr; ++ustr ) {
- int ch = table[*ustr];
- rpt = utf8_idpb(rpt,ch);
- }
- *rpt = '\0';
-return( ret );
-}
-
-uint8 MacEncFromMacLang(int maclang) {
- if ( maclang<0 || maclang>=(int)(sizeof(_MacScriptFromLanguage)/sizeof(_MacScriptFromLanguage[0])))
-return( 0xff );
-
-return( _MacScriptFromLanguage[maclang] );
-}
-
-uint16 WinLangFromMac(int maclang) {
-
- if ( maclang<0 || maclang>=(int)(sizeof(_WinLangFromMac)/sizeof(_WinLangFromMac[0])))
-return( 0xffff );
-
-return( _WinLangFromMac[maclang] );
-}
-
-uint16 WinLangToMac(int winlang) {
- int i;
-
- for ( i=0; i<(int)(sizeof(_WinLangFromMac)/sizeof(_WinLangFromMac[0])); ++i )
- if ( _WinLangFromMac[i] == winlang )
-return( i );
-
- winlang &= 0xff;
- for ( i=0; i<(int)(sizeof(_WinLangFromMac)/sizeof(_WinLangFromMac[0])); ++i )
- if ( (_WinLangFromMac[i]&0xff) == winlang )
-return( i );
-
-return( 0xffff );
-}
-
-int CanEncodingWinLangAsMac(int winlang) {
- int maclang = WinLangToMac(winlang);
- int macenc = MacEncFromMacLang(maclang);
-
- if ( macenc==0xff )
-return( false );
- if ( macencodings[macenc]==NULL )
-return( false );
-
-return( true );
-}
-
-const int32 *MacEncToUnicode(int script,int lang) {
- static int32 temp[256];
- int i;
- const unichar_t *table;
-
- table = MacEncLangToTable(script,lang);
- if ( table==NULL )
-return( NULL );
- for ( i=0; i<256; ++i )
- temp[i] = table[i];
-return( temp );
-}
-
-int MacLangFromLocale(void) {
- /*const char *loc = setlocale(LC_MESSAGES,NULL);*/ /* This always returns "C" for me, even when it shouldn't be */
- const char *loc;
- static int found=-1;
- int i;
-
- if ( found!=-1 )
-return( found );
-
- loc = getenv("LC_ALL");
- if ( loc==NULL ) loc = getenv("LC_MESSAGES");
- if ( loc==NULL ) loc = getenv("LANG");
-
- if ( loc==NULL ) {
- found=0; /* Default to english */
-return(found);
- }
- if ( strncmp(loc,"nl_BE",5)==0 ) {
- found = 34;
-return( found );
- }
- for ( i=0; i<(int)(sizeof(LanguageCodesFromMacLang)/sizeof(LanguageCodesFromMacLang[0])); ++i ) {
- if ( LanguageCodesFromMacLang[i]!=NULL &&
- strncmp(loc,LanguageCodesFromMacLang[i],strlen(LanguageCodesFromMacLang[i]))==0 ) {
- found = i;
-return( found );
- }
- }
- if ( strncmp(loc,"zh_HK",2)==0 ) /* I think there are other traditional locales than Hong Kong and Taiwan (?Singapore?) so any chinese we don't recognize */
- found = 19;
- else
- found = 0;
-return( found );
-}
-
-static struct { char *name; int code; } localmaclang[] = {
- {N_("English"), 0},
- {N_("French"), 1},
- {N_("German"), 2},
- {N_("Italian"), 3},
- {N_("Dutch"), 4},
- {N_("Swedish"), 5},
- {N_("Spanish"), 6},
- {N_("Danish"), 7},
- {N_("Portuguese"), 8},
- {N_("Norwegian"), 9},
- {N_("Hebrew"), 10},
- {N_("Japanese"), 11},
- {N_("Arabic"), 12},
- {N_("Finnish"), 13},
- {N_("Greek"), 14},
- {N_("Icelandic"), 15},
- {N_("Maltese"), 16},
- {N_("Turkish"), 17},
- {N_("Croatian"), 18},
- {N_("Traditional Chinese"), 19},
- {N_("Urdu"), 20},
- {N_("Hindi"), 21},
- {N_("Thai"), 22},
- {N_("Korean"), 23},
- {N_("Lithuanian"), 24},
- {N_("Polish"), 25},
- {N_("Hungarian"), 26},
- {N_("Estonian"), 27},
- {N_("Latvian"), 28},
- {N_("Sami (Lappish)"), 29},
- {N_("Faroese (Icelandic)"), 30},
-/* GT: See the long comment at "Property|New" */
-/* GT: The msgstr should contain a translation of "Farsi/Persian"), ignore "" */
- {N_("Farsi/Persian"), 31},
- {N_("Russian"), 32},
- {N_("Simplified Chinese"), 33},
- {N_("Flemish"), 34},
- {N_("Irish Gaelic"), 35},
- {N_("Albanian"), 36},
- {N_("Romanian"), 37},
- {N_("Czech"), 38},
- {N_("Slovak"), 39},
- {N_("Slovenian"), 40},
- {N_("Yiddish"), 41},
- {N_("Serbian"), 42},
- {N_("Macedonian"), 43},
- {N_("Bulgarian"), 44},
- {N_("Ukrainian"), 45},
- {N_("Byelorussian"), 46},
- {N_("Uzbek"), 47},
- {N_("Kazakh"), 48},
- {N_("Axerbaijani (Cyrillic)"), 49},
- {N_("Axerbaijani (Arabic)"), 50},
- {N_("Armenian"), 51},
- {N_("Georgian"), 52},
- {N_("Moldavian"), 53},
- {N_("Kirghiz"), 54},
- {N_("Tajiki"), 55},
- {N_("Turkmen"), 56},
- {N_("Mongolian (Mongolian)"), 57},
- {N_("Mongolian (cyrillic)"), 58},
- {N_("Pashto"), 59},
- {N_("Kurdish"), 60},
- {N_("Kashmiri"), 61},
- {N_("Sindhi"), 62},
- {N_("Tibetan"), 63},
- {N_("Nepali"), 64},
- {N_("Sanskrit"), 65},
- {N_("Marathi"), 66},
- {N_("Bengali"), 67},
- {N_("Assamese"), 68},
- {N_("Gujarati"), 69},
- {N_("Punjabi"), 70},
- {N_("Oriya"), 71},
- {N_("Malayalam"), 72},
- {N_("Kannada"), 73},
- {N_("Tamil"), 74},
- {N_("Telugu"), 75},
- {N_("Sinhalese"), 76},
- {N_("Burmese"), 77},
- {N_("Khmer"), 78},
- {N_("Lao"), 79},
- {N_("Vietnamese"), 80},
- {N_("Indonesian"), 81},
- {N_("Tagalog"), 82},
- {N_("Malay (roman)"), 83},
- {N_("Malay (arabic)"), 84},
- {N_("Amharic"), 85},
- {N_("Tigrinya"), 86},
- {N_("Galla"), 87},
- {N_("Somali"), 88},
- {N_("Swahili"), 89},
- {N_("Kinyarwanda/Ruanda"), 90},
- {N_("Rundi"), 91},
- {N_("Nyanja/Chewa"), 92},
- {N_("Malagasy"), 93},
- {N_("Esperanto"), 94},
- {N_("Welsh"), 128},
- {N_("Basque"), 129},
- {N_("Catalan"), 130},
- {N_("Latin"), 131},
- {N_("Quechua"), 132},
- {N_("Guarani"), 133},
- {N_("Aymara"), 134},
- {N_("Tatar"), 135},
- {N_("Uighur"), 136},
- {N_("Dzongkha"), 137},
- {N_("Javanese (roman)"), 138},
- {N_("Sundanese (roman)"), 139},
- {N_("Galician"), 140},
- {N_("Afrikaans"), 141},
- {N_("Breton"), 142},
- {N_("Inuktitut"), 143},
- {N_("Scottish Gaelic"), 144},
- {N_("Manx Gaelic"), 145},
- {N_("Irish Gaelic (with dot)"), 146},
- {N_("Tongan"), 147},
- {N_("Greek (polytonic)"), 148},
- {N_("Greenlandic"), 149},
- {N_("Azebaijani (roman)"), 150},
- { NULL, 0 }};
-
-char *MacLanguageFromCode(int code) {
- int i;
-
- if ( code==-1 )
-return( _("Unspecified Language") );
-
- for ( i=0; localmaclang[i].name!=NULL; ++i )
- if ( code == localmaclang[i].code )
-return( _(localmaclang[i].name) );
-
-return( _("Unknown Language"));
-}
diff --git a/Build/source/texk/web2c/luatexdir/luafontloader/fontforge/fontforge/mathconstants.c b/Build/source/texk/web2c/luatexdir/luafontloader/fontforge/fontforge/mathconstants.c
deleted file mode 100644
index 551b4419ecf..00000000000
--- a/Build/source/texk/web2c/luatexdir/luafontloader/fontforge/fontforge/mathconstants.c
+++ /dev/null
@@ -1,99 +0,0 @@
-/* Copyright (C) 2007,2008 by George Williams */
-/*
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are met:
-
- * Redistributions of source code must retain the above copyright notice, this
- * list of conditions and the following disclaimer.
-
- * Redistributions in binary form must reproduce the above copyright notice,
- * this list of conditions and the following disclaimer in the documentation
- * and/or other materials provided with the distribution.
-
- * The name of the author may not be used to endorse or promote products
- * derived from this software without specific prior written permission.
-
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
- * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
- * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
- * EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
- * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
- * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
- * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
- * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include "fontforgevw.h"
-#ifdef __need_size_t
-/* This is a bug on the mac, someone defines this and leaves it defined */
-/* that means when I load stddef.h it only defines size_t and doesn't */
-/* do offset_of, which is what I need */
-# undef __need_size_t
-#endif
-#include <stddef.h>
-
-#define MCD(ui_name,name,msg,np) { ui_name, #name, offsetof(struct MATH,name), -1,msg,np }
-#define MCDD(ui_name,name,devtab_name,msg,np) { ui_name, #name, offsetof(struct MATH,name), -2,msg,np }
-
-struct math_constants_descriptor math_constants_descriptor[] = {
- MCD(N_("ScriptPercentScaleDown:"),ScriptPercentScaleDown,N_("Percentage scale down for script level 1"),0),
- MCD(N_("ScriptScriptPercentScaleDown:"),ScriptScriptPercentScaleDown,N_("Percentage scale down for script level 2"),0),
- MCD(N_("DelimitedSubFormulaMinHeight:"),DelimitedSubFormulaMinHeight,N_("Minimum height at which to treat a delimited\nexpression as a subformula"),0),
- MCD(N_("DisplayOperatorMinHeight:"),DisplayOperatorMinHeight,N_("Minimum height of n-ary operators (integration, summation, etc.)"),0),
- MCDD(N_("MathLeading:"),MathLeading,MathLeading_adjust,N_("White space to be left between math formulae\nto ensure proper line spacing."),0),
- MCDD(N_("AxisHeight:"),AxisHeight,AxisHeight_adjust,N_("Axis height of the font"),0),
- MCDD(N_("AccentBaseHeight:"),AccentBaseHeight,AccentBaseHeight_adjust,N_("Maximum (ink) height of accent base that\ndoes not require raising the accents."),0),
- MCDD(N_("FlattenedAccentBaseHeight:"),FlattenedAccentBaseHeight,FlattenedAccentBaseHeight_adjust,N_("Maximum (ink) height of accent base that\ndoes not require flattening the accents."),0),
- MCDD(N_("SubscriptShiftDown:"),SubscriptShiftDown,SubscriptShiftDown_adjust,N_("The standard shift down applied to subscript elements.\nPositive for moving downward."),1),
- MCDD(N_("SubscriptTopMax:"),SubscriptTopMax,SubscriptTopMax_adjust,N_("Maximum height of the (ink) top of subscripts\nthat does not require moving\nubscripts further down."),0),
- MCDD(N_("SubscriptBaselineDropMin:"),SubscriptBaselineDropMin,SubscriptBaselineDropMin_adjust,N_("Maximum allowed drop of the baseline of\nsubscripts realtive to the bottom of the base.\nUsed for bases that are treated as a box\nor extended shape. Positive for subscript\nbaseline dropped below base bottom."),0),
- MCDD(N_("SuperscriptShiftUp:"),SuperscriptShiftUp,SuperscriptShiftUp_adjust,N_("Standard shift up applied to superscript elements."),0),
- MCDD(N_("SuperscriptShiftUpCramped:"),SuperscriptShiftUpCramped,SuperscriptShiftUpCramped_adjust,N_("Standard shift of superscript relative\nto base in cramped mode."),0),
- MCDD(N_("SuperscriptBottomMin:"),SuperscriptBottomMin,SuperscriptBottomMin_adjust,N_("Minimum allowed hieght of the bottom\nof superscripts that does not require moving\nthem further up."),0),
- MCDD(N_("SuperscriptBaselineDropMax:"),SuperscriptBaselineDropMax,SuperscriptBaselineDropMax_adjust,N_("Maximum allowed drop of the baseline of\nsuperscripts realtive to the top of the base.\nUsed for bases that are treated as a box\nor extended shape. Positive for superscript\nbaseline below base top."),0),
- MCDD(N_("SubSuperscriptGapMin:"),SubSuperscriptGapMin,SubSuperscriptGapMin_adjust,N_("Minimum gap between the supersecript and subscript ink."),0),
- MCDD(N_("SuperscriptBottomMaxWithSubscript:"),SuperscriptBottomMaxWithSubscript,SuperscriptBottomMaxWithSubscript_adjust,N_("The maximum level to which the (ink) bottom\nof superscript can be pushed to increase the\ngap between superscript and subscript, before\nsubscript starts being moved down."),0),
- MCDD(N_("SpaceAfterScript:"),SpaceAfterScript,SpaceAfterScript_adjust,N_("Extra white space to be added after each\nub/superscript."),0),
- MCDD(N_("UpperLimitGapMin:"),UpperLimitGapMin,UpperLimitGapMin_adjust,N_("Minimum gap between the bottom of the\nupper limit, and the top of the base operator."),1),
- MCDD(N_("UpperLimitBaselineRiseMin:"),UpperLimitBaselineRiseMin,UpperLimitBaselineRiseMin_adjust,N_("Minimum distance between the baseline of an upper\nlimit and the bottom of the base operator."),0),
- MCDD(N_("LowerLimitGapMin:"),LowerLimitGapMin,LowerLimitGapMin_adjust,N_("Minimum gap between (ink) top of the lower limit,\nand (ink) bottom of the base operator."),0),
- MCDD(N_("LowerLimitBaselineDropMin:"),LowerLimitBaselineDropMin,LowerLimitBaselineDropMin_adjust,N_("Minimum distance between the baseline of the\nlower limit and bottom of the base operator."),0),
- MCDD(N_("StackTopShiftUp:"),StackTopShiftUp,StackTopShiftUp_adjust,N_("Standard shift up applied to the top element of a stack."),1),
- MCDD(N_("StackTopDisplayStyleShiftUp:"),StackTopDisplayStyleShiftUp,StackTopDisplayStyleShiftUp_adjust,N_("Standard shift up applied to the top element of\na stack in display style."),0),
- MCDD(N_("StackBottomShiftDown:"),StackBottomShiftDown,StackBottomShiftDown_adjust,N_("Standard shift down applied to the bottom element of a stack.\nPositive values indicate downward motion."),0),
- MCDD(N_("StackBottomDisplayStyleShiftDown:"),StackBottomDisplayStyleShiftDown,StackBottomDisplayStyleShiftDown_adjust,N_("Standard shift down applied to the bottom\nelement of a stack in display style.\nPositive values indicate downward motion."),0),
- MCDD(N_("StackGapMin:"),StackGapMin,StackGapMin_adjust,N_("Minimum gap between bottom of the top\nelement of a stack, and the top of the bottom element."),0),
- MCDD(N_("StackDisplayStyleGapMin:"),StackDisplayStyleGapMin,StackDisplayStyleGapMin_adjust,N_("Minimum gap between bottom of the top\nelement of a stack and the top of the bottom\nelement in display style."),0),
- MCDD(N_("StretchStackTopShiftUp:"),StretchStackTopShiftUp,StretchStackTopShiftUp_adjust,N_("Standard shift up applied to the top element of the stretch stack."),0),
- MCDD(N_("StretchStackBottomShiftDown:"),StretchStackBottomShiftDown,StretchStackBottomShiftDown_adjust,N_("Standard shift down applied to the bottom\nelement of the stretch stack.\nPositive values indicate downward motion."),0),
- MCDD(N_("StretchStackGapAboveMin:"),StretchStackGapAboveMin,StretchStackGapAboveMin_adjust,N_("Minimum gap between the ink of the stretched\nelement and the ink bottom of the element\nabove.."),0),
- MCDD(N_("StretchStackGapBelowMin:"),StretchStackGapBelowMin,StretchStackGapBelowMin_adjust,N_("Minimum gap between the ink of the stretched\nelement and the ink top of the element below."),0),
- MCDD(N_("FractionNumeratorShiftUp:"),FractionNumeratorShiftUp,FractionNumeratorShiftUp_adjust,N_("Standard shift up applied to the numerator."),1),
- MCDD(N_("FractionNumeratorDisplayStyleShiftUp:"),FractionNumeratorDisplayStyleShiftUp,FractionNumeratorDisplayStyleShiftUp_adjust,N_("Standard shift up applied to the\nnumerator in display style."),0),
- MCDD(N_("FractionDenominatorShiftDown:"),FractionDenominatorShiftDown,FractionDenominatorShiftDown_adjust,N_("Standard shift down applied to the denominator.\nPostive values indicate downward motion."),0),
- MCDD(N_("FractionDenominatorDisplayStyleShiftDown:"),FractionDenominatorDisplayStyleShiftDown,FractionDenominatorDisplayStyleShiftDown_adjust,N_("Standard shift down applied to the\ndenominator in display style.\nPostive values indicate downward motion."),0),
- MCDD(N_("FractionNumeratorGapMin:"),FractionNumeratorGapMin,FractionNumeratorGapMin_adjust,N_("Minimum tolerated gap between the ink\nbottom of the numerator and the ink of the fraction bar."),0),
- MCDD(N_("FractionNumeratorDisplayStyleGapMin:"),FractionNumeratorDisplayStyleGapMin,FractionNumeratorDisplayStyleGapMin_adjust,N_("Minimum tolerated gap between the ink\nbottom of the numerator and the ink of the fraction\nbar in display style."),0),
- MCDD(N_("FractionRuleThickness:"),FractionRuleThickness,FractionRuleThickness_adjust,N_("Thickness of the fraction bar."),0),
- MCDD(N_("FractionDenominatorGapMin:"),FractionDenominatorGapMin,FractionDenominatorGapMin_adjust,N_("Minimum tolerated gap between the ink top of the denominator\nand the ink of the fraction bar.."),0),
- MCDD(N_("FractionDenominatorDisplayStyleGapMin:"),FractionDenominatorDisplayStyleGapMin,FractionDenominatorDisplayStyleGapMin_adjust,N_("Minimum tolerated gap between the ink top of the denominator\nand the ink of the fraction bar in display style."),0),
- MCDD(N_("SkewedFractionHorizontalGap:"),SkewedFractionHorizontalGap,SkewedFractionHorizontalGap_adjust,N_("Horizontal distance between the top\nand bottom elemnts of a skewed fraction."),0),
- MCDD(N_("SkewedFractionVerticalGap:"),SkewedFractionVerticalGap,SkewedFractionVerticalGap_adjust,N_("Vertical distance between the ink of the top and\nbottom elements of a skewed fraction."),0),
- MCDD(N_("OverbarVerticalGap:"),OverbarVerticalGap,OverbarVerticalGap_adjust,N_("Distance between the overbar and\nthe ink top of the base."),1),
- MCDD(N_("OverbarRuleThickness:"),OverbarRuleThickness,OverbarRuleThickness_adjust,N_("Thickness of the overbar."),0),
- MCDD(N_("OverbarExtraAscender:"),OverbarExtraAscender,OverbarExtraAscender_adjust,N_("Extra white space reserved above the overbar."),0),
- MCDD(N_("UnderbarVerticalGap:"),UnderbarVerticalGap,UnderbarVerticalGap_adjust,N_("Distance between underbar and\nthe (ink) bottom of the base."),0),
- MCDD(N_("UnderbarRuleThickness:"),UnderbarRuleThickness,UnderbarRuleThickness_adjust,N_("Thickness of the underbar."),0),
- MCDD(N_("UnderbarExtraDescender:"),UnderbarExtraDescender,UnderbarExtraDescender_adjust,N_("Extra white space resevered below the underbar."),0),
- MCDD(N_("RadicalVerticalGap:"),RadicalVerticalGap,RadicalVerticalGap_adjust,N_("Space between the ink to of the\nexpression and the bar over it."),1),
- MCDD(N_("RadicalDisplayStyleVerticalGap:"),RadicalDisplayStyleVerticalGap,RadicalDisplayStyleVerticalGap_adjust,N_("Space between the ink top of the\nexpression and the bar over it in display\nstyle."),0),
- MCDD(N_("RadicalRuleThickness:"),RadicalRuleThickness,RadicalRuleThickness_adjust,N_("Thickness of the radical rule in\ndesigned or constructed radical\nsigns."),0),
- MCDD(N_("RadicalExtraAscender:"),RadicalExtraAscender,RadicalExtraAscender_adjust,N_("Extra white space reserved above the radical."),0),
- MCDD(N_("RadicalKernBeforeDegree:"),RadicalKernBeforeDegree,RadicalKernBeforeDegree_adjust,N_("Extra horizontal kern before the degree of a\nradical if such be present."),0),
- MCDD(N_("RadicalKernAfterDegree:"),RadicalKernAfterDegree,RadicalKernAfterDegree_adjust,N_("Negative horizontal kern after the degree of a\nradical if such be present."),0),
- MCD(N_("RadicalDegreeBottomRaisePercent:"),RadicalDegreeBottomRaisePercent,N_("Height of the bottom of the radical degree, if\nsuch be present, in proportion to the ascender\nof the radical sign."),0),
- MCD(N_("MinConnectorOverlap:"),MinConnectorOverlap,N_("Minimum overlap of connecting glyphs during\nglyph construction."),1),
- { NULL, NULL, 0, 0, NULL, 0 }
-};
diff --git a/Build/source/texk/web2c/luatexdir/luafontloader/fontforge/fontforge/memory.c b/Build/source/texk/web2c/luatexdir/luafontloader/fontforge/fontforge/memory.c
deleted file mode 100644
index 3d977672cdb..00000000000
--- a/Build/source/texk/web2c/luatexdir/luafontloader/fontforge/fontforge/memory.c
+++ /dev/null
@@ -1,101 +0,0 @@
-/* Copyright (C) 2000-2012 by George Williams */
-/*
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are met:
-
- * Redistributions of source code must retain the above copyright notice, this
- * list of conditions and the following disclaimer.
-
- * Redistributions in binary form must reproduce the above copyright notice,
- * this list of conditions and the following disclaimer in the documentation
- * and/or other materials provided with the distribution.
-
- * The name of the author may not be used to endorse or promote products
- * derived from this software without specific prior written permission.
-
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
- * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
- * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
- * EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
- * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
- * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
- * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
- * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-#include "basics.h"
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-
-/* wrappers around standard memory routines so we can trap errors. */
-static void default_trap(void) {
- fprintf(stderr, "Attempt to allocate memory failed.\n" );
- abort();
-}
-
-static void (*trap)(void) = default_trap;
-
-void galloc_set_trap(void (*newtrap)(void)) {
- if ( newtrap==NULL ) newtrap = default_trap;
- trap = newtrap;
-}
-
-#ifdef USE_OUR_MEMORY
-void *galloc(long size) {
- void *ret;
- /* Avoid malloc(0) as malloc is allowed to return NULL.
- * If malloc fails, call trap() to allow it to possibly
- * recover memory and try again.
- */
- while (( ret = malloc(size==0 ? sizeof(int) : size))==NULL )
- trap();
- memset(ret,0x3c,size); /* fill with random junk for debugging */
-return( ret );
-}
-
-void *gcalloc(int cnt,long size) {
- void *ret;
- while (( ret = calloc(cnt,size))==NULL )
- trap();
-return( ret );
-}
-
-void *grealloc(void *old,long size) {
- void *ret;
- while (( ret = realloc(old,size))==NULL )
- trap();
-return( ret );
-}
-
-void gfree(void *old) {
- free(old);
-}
-#endif /* USE_OUR_MEMORY */
-
-void NoMoreMemMessage(void) {
-/* Output an 'Out of memory' message, then continue */
- fprintf(stderr, "Out of memory\n" );
-}
-
-char *copy(const char *str) {
- char *ret;
-
- if ( str==NULL )
-return( NULL );
- ret = (char *) galloc(strlen(str)+1);
- strcpy(ret,str);
-return( ret );
-}
-
-char *copyn(const char *str,long n) {
- char *ret;
-
- if ( str==NULL )
-return( NULL );
- ret = (char *) galloc(n+1);
- memcpy(ret,str,n);
- ret[n]='\0';
-return( ret );
-}
diff --git a/Build/source/texk/web2c/luatexdir/luafontloader/fontforge/fontforge/mm.c b/Build/source/texk/web2c/luatexdir/luafontloader/fontforge/fontforge/mm.c
deleted file mode 100644
index db051b7fe54..00000000000
--- a/Build/source/texk/web2c/luatexdir/luafontloader/fontforge/fontforge/mm.c
+++ /dev/null
@@ -1,198 +0,0 @@
-/* Copyright (C) 2003-2008 by George Williams */
-/*
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are met:
-
- * Redistributions of source code must retain the above copyright notice, this
- * list of conditions and the following disclaimer.
-
- * Redistributions in binary form must reproduce the above copyright notice,
- * this list of conditions and the following disclaimer in the documentation
- * and/or other materials provided with the distribution.
-
- * The name of the author may not be used to endorse or promote products
- * derived from this software without specific prior written permission.
-
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
- * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
- * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
- * EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
- * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
- * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
- * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
- * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-#include "fontforgevw.h"
-#include <ustring.h>
-#include <math.h>
-#include <utype.h>
-#include "ttf.h"
-#include "mm.h"
-
-char *MMAxisAbrev(char *axis_name) {
- if ( strcmp(axis_name,"Weight")==0 )
-return( "wt" );
- if ( strcmp(axis_name,"Width")==0 )
-return( "wd" );
- if ( strcmp(axis_name,"OpticalSize")==0 )
-return( "op" );
- if ( strcmp(axis_name,"Slant")==0 )
-return( "sl" );
-
-return( axis_name );
-}
-
-double MMAxisUnmap(MMSet *mm,int axis,double ncv) {
- struct axismap *axismap = &mm->axismaps[axis];
- int j;
-
- if ( ncv<=axismap->blends[0] )
-return(axismap->designs[0]);
-
- for ( j=1; j<axismap->points; ++j ) {
- if ( ncv<=axismap->blends[j]) {
- double t = (ncv-axismap->blends[j-1])/(axismap->blends[j]-axismap->blends[j-1]);
-return( axismap->designs[j-1]+ t*(axismap->designs[j]-axismap->designs[j-1]) );
- }
- }
-
-return(axismap->designs[axismap->points-1]);
-}
-
-static char *_MMMakeFontname(MMSet *mm,real *normalized,char **fullname) {
- char *pt, *pt2, *hyphen=NULL;
- char *ret = NULL;
- int i;
-
- pt = ret = galloc(strlen(mm->normal->familyname)+ mm->axis_count*15 + 1);
- strcpy(pt,mm->normal->familyname);
- pt += strlen(pt);
- *pt++ = '_';
- for ( i=0; i<mm->axis_count; ++i ) {
- sprintf( pt, " %d%s", (int) rint(MMAxisUnmap(mm,i,normalized[i])),
- MMAxisAbrev(mm->axes[i]));
- pt += strlen(pt);
- }
- if ( pt>ret && pt[-1]==' ' )
- --pt;
- *pt = '\0';
-
- *fullname = ret;
-
- ret = copy(ret);
- for ( pt=*fullname, pt2=ret; *pt!='\0'; ++pt )
- if ( pt==hyphen )
- *pt2++ = '-';
- else if ( *pt!=' ' )
- *pt2++ = *pt;
- *pt2 = '\0';
-return( ret );
-}
-
-char *MMMakeMasterFontname(MMSet *mm,int ipos,char **fullname) {
-return( _MMMakeFontname(mm,&mm->positions[ipos*mm->axis_count],fullname));
-}
-
-static char *_MMGuessWeight(MMSet *mm,real *normalized,char *def) {
- int i;
- char *ret;
- real design;
-
- for ( i=0; i<mm->axis_count; ++i ) {
- if ( strcmp(mm->axes[i],"Weight")==0 )
- break;
- }
- if ( i==mm->axis_count )
-return( def );
- design = MMAxisUnmap(mm,i,normalized[i]);
- if ( design<50 || design>1500 ) /* Er... Probably not the 0...1000 range I expect */
-return( def );
- ret = NULL;
- if ( design<150 )
- ret = "Thin";
- else if ( design<350 )
- ret = "Light";
- else if ( design<550 )
- ret = "Medium";
- else if ( design<650 )
- ret = "DemiBold";
- else if ( design<750 )
- ret = "Bold";
- else if ( design<850 )
- ret = "Heavy";
- else
- ret = "Black";
- free( def );
-return( copy(ret) );
-}
-
-char *MMGuessWeight(MMSet *mm,int ipos,char *def) {
-return( _MMGuessWeight(mm,&mm->positions[ipos*mm->axis_count],def));
-}
-
-/* Given a postscript array of scalars, what's the ipos'th element? */
-char *MMExtractNth(char *pt,int ipos) {
- int i;
- char *end;
-
- while ( *pt==' ' ) ++pt;
- if ( *pt=='[' ) ++pt;
- for ( i=0; *pt!=']' && *pt!='\0'; ++i ) {
- while ( *pt==' ' ) ++pt;
- if ( *pt==']' || *pt=='\0' )
-return( NULL );
- for ( end=pt; *end!=' ' && *end!=']' && *end!='\0'; ++end );
- if ( i==ipos )
-return( copyn(pt,end-pt));
- pt = end;
- }
-return( NULL );
-}
-
-/* Given a postscript array of arrays, such as those found in Blend Private BlueValues */
-/* return the array composed of the ipos'th element of each sub-array */
-char *MMExtractArrayNth(char *pt,int ipos) {
- char *hold[40], *ret;
- int i,j,len;
-
- while ( *pt==' ' ) ++pt;
- if ( *pt=='[' ) ++pt;
- i = 0;
- while ( *pt!=']' && *pt!=' ' ) {
- while ( *pt==' ' ) ++pt;
- if ( *pt=='[' ) {
- if ( i<(int)(sizeof(hold)/sizeof(hold[0])) )
- hold[i++] = MMExtractNth(pt,ipos);
- ++pt;
- while ( *pt!=']' && *pt!='\0' ) ++pt;
- }
- if ( *pt!='\0' )
- ++pt;
- }
- if ( i==0 )
-return( NULL );
- for ( j=len=0; j<i; ++j ) {
- if ( hold[j]==NULL ) {
- for ( j=0; j<i; ++j )
- free(hold[j]);
-return( NULL );
- }
- len += strlen( hold[j] )+1;
- }
-
- pt = ret = galloc(len+4);
- *pt++ = '[';
- for ( j=0; j<i; ++j ) {
- strcpy(pt,hold[j]);
- free(hold[j]);
- pt += strlen(pt);
- if ( j!=i-1 )
- *pt++ = ' ';
- }
- *pt++ = ']';
- *pt++ = '\0';
-return( ret );
-}
-
diff --git a/Build/source/texk/web2c/luatexdir/luafontloader/fontforge/fontforge/mm.h b/Build/source/texk/web2c/luatexdir/luafontloader/fontforge/fontforge/mm.h
deleted file mode 100644
index c69449e74c0..00000000000
--- a/Build/source/texk/web2c/luatexdir/luafontloader/fontforge/fontforge/mm.h
+++ /dev/null
@@ -1,32 +0,0 @@
-/* Copyright (C) 2003-2008 by George Williams */
-/*
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are met:
-
- * Redistributions of source code must retain the above copyright notice, this
- * list of conditions and the following disclaimer.
-
- * Redistributions in binary form must reproduce the above copyright notice,
- * this list of conditions and the following disclaimer in the documentation
- * and/or other materials provided with the distribution.
-
- * The name of the author may not be used to endorse or promote products
- * derived from this software without specific prior written permission.
-
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
- * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
- * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
- * EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
- * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
- * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
- * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
- * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-extern void MMWeightsUnMap(real weights[MmMax], real axiscoords[4],
- int axis_count);
-extern double MMAxisUnmap(MMSet *mm,int axis,double ncv);
-extern SplineFont *_MMNewFont(MMSet *mm,int index,char *familyname,real *normalized);
-extern SplineFont *MMNewFont(MMSet *mm,int index,char *familyname);
diff --git a/Build/source/texk/web2c/luatexdir/luafontloader/fontforge/fontforge/namelist.c b/Build/source/texk/web2c/luatexdir/luafontloader/fontforge/fontforge/namelist.c
deleted file mode 100644
index cb88d72d195..00000000000
--- a/Build/source/texk/web2c/luatexdir/luafontloader/fontforge/fontforge/namelist.c
+++ /dev/null
@@ -1,19808 +0,0 @@
-/* Copyright (C) 2000-2008 by George Williams */
-/*
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are met:
-
- * Redistributions of source code must retain the above copyright notice, this
- * list of conditions and the following disclaimer.
-
- * Redistributions in binary form must reproduce the above copyright notice,
- * this list of conditions and the following disclaimer in the documentation
- * and/or other materials provided with the distribution.
-
- * The name of the author may not be used to endorse or promote products
- * derived from this software without specific prior written permission.
-
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
- * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
- * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
- * EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
- * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
- * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
- * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
- * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include "fontforgevw.h"
-#include "ustring.h"
-#include <utype.h>
-
-int recognizePUA = false;
-NameList *force_names_when_opening=NULL;
-NameList *force_names_when_saving=NULL;
-
-static struct psaltnames {
- char *name;
- int unicode;
- int provenance; /* 1=> Adobe PUA, 2=>AMS PUA, 3=>TeX */
-} psaltnames[5488]; /* Explicit dimension specification or initializer
- required for an auto or static array. */
-
-static NameList agl_sans, agl, adobepua, greeksc, tex, ams;
-NameList *namelist_for_new_fonts = &agl;
-
- /* Adobe's standard names are wrong for: */
- /* 0x0162 is named Tcommaaccent, 0x21A should be */
- /* 0x0163 is named tcommaaccent, 0x21B should be */
-/* The following have been corrected (at least by intent) or removed */
- /* 0xf6be is named dotlessj, 0x237 should be */
- /* 0x2206 is named Delta, 0x394 should be */
- /* 0x2126 is named Omega, 0x3A9 should be */
- /* 0x00b5 is named mu, 0x3BC should be */
-
-static int psnamesinited=false;
-#define HASH_SIZE 257
-struct psbucket { const char *name; int uni; struct psbucket *prev; } *psbuckets[HASH_SIZE];
-
-static int hashname(const char *_name) {
- const unsigned char *name = (const unsigned char *) _name;
- int hash=0;
-
- while ( *name ) {
- if ( *name<=' ' )
- break;
- hash = (hash<<3)|((hash>>29)&0x7);
- hash ^= *name++-(' '+1);
- }
- hash ^= (hash>>16);
- hash &= 0xffff;
-return( hash%HASH_SIZE );
-}
-
-static void psaddbucket(const char *name, int uni) {
- int hash = hashname(name);
- struct psbucket *buck = gcalloc(1,sizeof(struct psbucket));
-
- buck->name = name;
- buck->uni = uni;
- buck->prev = psbuckets[hash];
- psbuckets[hash] = buck;
-}
-
-static void NameListHash(NameList *nl) {
- int i,j,k;
- for ( i=0; i<17; ++i ) if ( nl->unicode[i]!=NULL ) {
- for ( j=0; j<256; ++j ) if ( nl->unicode[i][j]!=NULL ) {
- for ( k=0; k<256; ++k ) if ( nl->unicode[i][j][k]!=NULL )
- psaddbucket(nl->unicode[i][j][k],(i<<16)|(j<<8)|k );
- }
- }
-}
-
-static void psinitnames(void) {
- int i;
- NameList *nl;
-
- agl.next = &agl_sans;
- agl_sans.next = &adobepua;
- adobepua.next = &greeksc;
- greeksc.next = &tex;
- tex.next = &ams;
-
- for ( i=0; psaltnames[i].name!=NULL ; ++i )
- psaddbucket(psaltnames[i].name,psaltnames[i].unicode);
- for ( nl=&agl; nl!=NULL; nl=nl->next )
- NameListHash(nl);
- psnamesinited = true;
-}
-
-static void psreinitnames(void) {
- /* If we reread a (loaded) namelist file, then we must remove the old defn*/
- /* which means we must remove all the old hash entries before we can put */
- /* in the new ones */
- int i;
- struct psbucket *cur, *prev;
- NameList *nl;
-
- for ( i=0; i<HASH_SIZE; ++i ) {
- for ( cur = psbuckets[i]; cur!=NULL; cur=prev ) {
- prev = cur->prev;
- chunkfree(cur,sizeof(struct psbucket));
- }
- psbuckets[i] = NULL;
- }
-
- for ( i=0; psaltnames[i].name!=NULL ; ++i )
- psaddbucket(psaltnames[i].name,psaltnames[i].unicode);
- for ( nl=&agl; nl!=NULL; nl=nl->next )
- NameListHash(nl);
-}
-
-int UniFromName(const char *name,enum uni_interp interp,Encoding *encname) {
- int i = -1;
- char *end;
- struct psbucket *buck;
-
- if ( strncmp(name,"uni",3)==0 ) {
- i = strtol(name+3,&end,16);
- if ( *end || end-name!=7 ) /* uniXXXXXXXX means a ligature of uniXXXX and uniXXXX */
- i = -1;
- } else if ( (name[0]=='U' || name[0]=='u') && name[1]=='+' &&
- (strlen(name)==6 || strlen(name)==7)) {
- /* Unifont uses this convention */
- i = strtol(name+2,&end,16);
- if ( *end )
- i = -1;
- } else if ( name[0]=='u' && strlen(name)>=5 ) {
- i = strtol(name+1,&end,16);
- if ( *end )
- i = -1;
- else if ( encname!=NULL && !encname->is_unicodefull &&
- (interp==ui_ams || interp==ui_trad_chinese)) {
- int j;
- extern const int cns14pua[], amspua[];
- const int *pua = interp==ui_ams ? amspua : cns14pua;
- for ( j=0xf8ff-0xe000; j>=0; --j )
- if ( pua[j]==i ) {
- i = j+0xe000;
- break;
- }
- }
- } else if ( name[0]!='\0' && name[1]=='\0' )
- i = ((unsigned char *) name)[0];
- if ( i==-1 ) {
- if ( !psnamesinited )
- psinitnames();
- for ( buck = psbuckets[hashname(name)]; buck!=NULL; buck=buck->prev )
- if ( strcmp(buck->name,name)==0 )
- break;
- if ( buck!=NULL )
- i = buck->uni;
- }
- if ( !recognizePUA && i>=0xe000 && i<=0xf8ff )
- i = -1;
-return( i );
-}
-
-const char *StdGlyphName(char *buffer, int uni,enum uni_interp interp,NameList *for_this_font) {
- const char *name = NULL;
- NameList *nl;
- int up, ub, uc;
-
- if ( for_this_font==NULL )
- for_this_font = namelist_for_new_fonts;
- else if ( for_this_font==(NameList *) -1 )
- for_this_font = &agl;
- if ( (uni>=0 && uni<' ') ||
- (uni>=0x7f && uni<0xa0) )
- /* standard controls */;
- else if ( uni!=-1 ) {
- if ( uni>=0xe000 && uni<=0xf8ff &&
- (interp==ui_trad_chinese || for_this_font==&ams)) {
- extern const int cns14pua[], amspua[];
- const int *pua = interp==ui_trad_chinese ? cns14pua : amspua;
- if ( pua[uni-0xe000]!=0 )
- uni = pua[uni-0xe000];
- }
- up = uni>>16;
- ub = (uni&0xff00)>>8;
- uc = (uni&0xff);
- if ( up<17 )
- for ( nl=for_this_font; nl!=NULL; nl=nl->basedon ) {
- if ( nl->unicode[up]!=NULL && nl->unicode[up][ub]!=NULL &&
- (name = nl->unicode[up][ub][uc])!=NULL )
- break;
- }
- }
- if ( name==NULL ) {
- if ( uni>=0x10000 )
- sprintf( buffer, "u%04X", uni);
- else
- sprintf( buffer, "uni%04X", uni);
- name = buffer;
- }
-return( name );
-}
-
-#define RefMax 40
-
-static int transcmp(RefChar *r1, RefChar *r2) {
- double d1, d2;
-
- if ( r1->transform[4]<r2->transform[4] )
-return( -1 );
- else if ( r1->transform[4]>r2->transform[4] )
-return( 1 );
- if ( (d1 = r1->transform[5])<0 ) d1 = -d1;
- if ( (d2 = r2->transform[5])<0 ) d2 = -d2;
- if ( d1<d2 )
-return( -1 );
- else if ( d1==d2 )
-return( 0 );
- else
-return( 1 );
-}
-
-static int FindAllRefs(SplineChar *sc,SplineChar *rsc[RefMax], int *au) {
- RefChar *refs[RefMax], *alp[RefMax], *out[RefMax];
- RefChar *ref;
- int layer, last, rcnt, acnt, ocnt, i,j;
- int alluni;
- /* We also order the reference. The order stored in the splinechar doesn't*/
- /* mean anything, so try and guess what is intended semantically. */
-
- if ( sc==NULL )
-return( 0 );
- last = ly_fore;
- if ( sc->parent->multilayer )
- last = sc->layer_cnt-1;
- for ( layer=ly_fore; layer<=last; ++layer )
- if ( sc->layers[layer].splines!=NULL || sc->layers[layer].images!=NULL )
-return( 0 );
- rcnt = 0;
- for ( layer=ly_fore; layer<=last; ++layer ) {
- for ( ref = sc->layers[layer].refs; ref!=NULL; ref = ref->next ) {
- if ( rcnt>=RefMax )
-return( 0 );
- refs[rcnt++] = ref;
- }
- }
- alluni = true;
- for ( i=0; i<rcnt; ++i ) {
- if ( refs[i]->sc->unicodeenc==-1 ) {
- alluni = false;
- break;
- }
- }
- if ( !alluni ) {
- /* If not all unicode we can't make any guesses about meaning, so */
- /* order by transformation */
- for ( i=0; i<rcnt; ++i ) for ( j=i+1; j<rcnt; ++j ) {
- if ( transcmp(refs[i],refs[j])>0 ) {
- ref = refs[i];
- refs[i] = refs[j];
- refs[j] = ref;
- }
- }
- } else {
- acnt = 0;
- for ( i=0; i<rcnt; ++i ) {
- if ( isalpha(refs[i]->sc->unicodeenc )) {
- alp[acnt++] = refs[i];
- --rcnt;
- for ( j=i; j<rcnt; ++j )
- refs[j] = refs[j+1];
- --i;
- }
- }
- for ( i=0; i<acnt; ++i ) for ( j=i+1; j<acnt; ++j ) {
- if ( transcmp(alp[i],alp[j])>0 ) {
- ref = alp[i];
- alp[i] = alp[j];
- alp[j] = ref;
- }
- }
- for ( i=0; i<rcnt; ++i ) for ( j=i+1; j<rcnt; ++j ) {
- if ( transcmp(refs[i],refs[j])>0 ) {
- ref = refs[i];
- refs[i] = refs[j];
- refs[j] = ref;
- }
- }
- if ( acnt!=0 ) {
- int a=0, r=0;
- real cutpoint;
- ocnt = 0;
- out[ocnt++] = alp[a++];
- forever {
- if ( a<acnt ) cutpoint = (alp[a]->transform[4]+3*alp[a-1]->transform[4])/4;
- else cutpoint = 1e30;
- while ( r<rcnt && refs[r]->transform[4]<cutpoint )
- out[ocnt++] = refs[r++];
- if ( a>=acnt )
- break;
- out[ocnt++] = alp[a++];
- }
- memcpy(refs,out,ocnt*sizeof(RefChar *));
- rcnt = ocnt;
- }
- }
- for ( i=0; i<rcnt; ++i )
- rsc[i] = refs[i]->sc;
- /* alluni now means can be written as uniXXXX.XXXX.XXXX... */
- for ( i=0; i<rcnt; ++i ) {
- if ( refs[i]->sc->unicodeenc>0x10000 ) {
- alluni = false;
- break;
- }
- }
- *au = alluni;
-return( rcnt );
-}
-
-/* Return a list of all alternate or standard glyph names for this encoding */
-char **AllGlyphNames(int uni, NameList *for_this_font, SplineChar *sc) {
- int cnt, k, j, i, len;
- NameList *nl, *nl2, *nl3;
- char **names = NULL;
- const char *name;
- int up, ub, uc;
- char buffer[40], *pt;
- SplineChar *refs[RefMax];
- int rcnt, alluni = 0;
-
- rcnt = FindAllRefs(sc,refs,&alluni);
-
- up = uni>>16;
- ub = (uni&0xff00)>>8;
- uc = (uni&0xff);
-
- for ( k=0; k<2; ++k ) {
- cnt = 0;
- /* try the default namelist first to put that at the head of the list */
- name = NULL;
- nl = nl3 = NULL;
- if ( uni>=0 && up<17 ) {
- if ( for_this_font!=NULL ) {
- for ( nl3=for_this_font; nl3!=NULL; nl3=nl3->basedon ) {
- if ( nl3->unicode[up]!=NULL && nl3->unicode[up][ub]!=NULL &&
- (name = nl3->unicode[up][ub][uc])!=NULL )
- break;
- }
- if ( name!=NULL ) {
- if ( names )
- names[cnt] = copy(name);
- ++cnt;
- }
- }
- if ( for_this_font!=namelist_for_new_fonts ) {
- for ( nl=namelist_for_new_fonts; nl!=NULL; nl=nl->basedon ) if ( nl!=nl3 ) {
- if ( nl->unicode[up]!=NULL && nl->unicode[up][ub]!=NULL &&
- (name = nl->unicode[up][ub][uc])!=NULL )
- break;
- }
- if ( name!=NULL ) {
- if ( names )
- names[cnt] = copy(name);
- ++cnt;
- }
- }
- for ( nl2 = &agl; nl2!=NULL; nl2=nl2->next ) if ( nl2!=nl && nl2!=nl3) {
- if ( nl2->unicode[up]!=NULL && nl2->unicode[up][ub]!=NULL &&
- (name = nl2->unicode[up][ub][uc])!=NULL ) {
- if ( names )
- names[cnt] = copy(name);
- ++cnt;
- }
- }
- for ( i=0; psaltnames[i].name!=NULL ; ++i ) {
- if ( psaltnames[i].unicode==uni ) {
- if ( names )
- names[cnt] = copy(psaltnames[i].name);
- ++cnt;
- }
- }
- if ( uni<0x10000 ) {
- if ( names ) {
- sprintf( buffer, "uni%04X", uni);
- names[cnt] = copy(buffer);
- }
- ++cnt;
- }
- if ( names ) {
- sprintf( buffer, "u%04X", uni);
- names[cnt] = copy(buffer);
- }
- ++cnt;
- }
- if ( rcnt>1 && alluni && (uni<0 || (uni>=0xe000 && uni<0xf900) || uni>=0xf0000 ) ) {
- if ( names ) {
- names[cnt] = galloc(4+4*rcnt);
- strcpy(names[cnt],"uni");
- pt = names[cnt]+3;
- for ( i=0; i<rcnt; ++i ) {
- if ( refs[i]->unicodeenc==0x131 || refs[i]->unicodeenc==0x237 ||
- refs[i]->unicodeenc==0xf6be )
- sprintf( pt,"%04X", refs[i]->unicodeenc==0x131?'i':'j' );
- else
- sprintf( pt,"%04X", CanonicalCombiner(refs[i]->unicodeenc));
- pt += 4;
- }
- }
- ++cnt;
- }
- if ( rcnt>1 ) {
- if ( names ) {
- for ( i=len=0; i<rcnt; ++i )
- len += strlen( refs[i]->name )+1;
- names[cnt] = pt = galloc(len);
- for ( i=len=0; i<rcnt; ++i ) {
- strcpy(pt,refs[i]->name);
- pt += strlen(pt);
- *pt++ = '_';
- }
- pt[-1] = '\0';
- }
- ++cnt;
- }
- if ( uni<0 || up>=17 ) {
- if ( names )
- names[cnt] = copy(".notdef");
- ++cnt;
- }
- if ( k==0 ) {
- names = galloc((cnt+1)*sizeof(char *));
- names[cnt] = NULL;
- }
- }
- /* Remove any names from multiiple namelists */
- for ( i=0; i<cnt; ++i ) for ( j=i+1; j<cnt; ++j ) {
- if ( strcmp(names[i],names[j])==0 ) {
- for ( k=j+1; k<cnt; ++k )
- names[k-1] = names[k];
- names[--cnt] = NULL;
- --j;
- }
- }
-return( names );
-}
-
-char **AllNamelistNames(void) {
- NameList *nl;
- int cnt;
- char **names;
-
- for ( nl = &agl, cnt=0; nl!=NULL; nl=nl->next, ++cnt );
- names = galloc((cnt+1) *sizeof(char *));
- for ( nl = &agl, cnt=0; nl!=NULL; nl=nl->next, ++cnt )
- names[cnt] = copy(_(nl->title));
- names[cnt] = NULL;
-return( names );
-}
-
-#if 0
-uint8 *AllNamelistUnicodes(void) {
- NameList *nl;
- int cnt;
- uint8 *uses;
-
- for ( nl = &agl, cnt=0; nl!=NULL; nl=nl->next, ++cnt );
- uses = galloc((cnt+1) *sizeof(uint8));
- for ( nl = &agl, cnt=0; nl!=NULL; nl=nl->next, ++cnt )
- uses[cnt] = nl->uses_unicode;
- uses[cnt] = 0xff;
-return( uses );
-}
-#endif
-
-NameList *DefaultNameListForNewFonts(void) {
-return( namelist_for_new_fonts );
-}
-
-NameList *NameListByName(char *name) {
- NameList *nl;
- for ( nl = &agl; nl!=NULL; nl=nl->next ) {
- if ( strcmp(_(nl->title),name)==0 || strcmp(nl->title,name)==0 )
-return( nl );
- }
-return( NULL );
-}
-
-static void NameListFreeContents(NameList *nl) {
- int np, nb, nc, i;
-
- for ( np=0; np<17; ++np ) if ( nl->unicode[np]!=NULL ) {
- for ( nb=0; nb<256; ++nb ) if ( nl->unicode[np][nb]!=NULL ) {
- for ( nc=0; nc<256; ++nc ) if ( nl->unicode[np][nb][nc]!=NULL )
- free((char *)nl->unicode[np][nb][nc] );
- free( (char **) nl->unicode[np][nb]);
- }
- free( (char ***) nl->unicode[np]);
- }
- free( nl->title );
- if ( nl->renames!=NULL ) {
- for ( i=0; nl->renames[i].from!=NULL; ++i ) {
- free(nl->renames[i].from);
- free(nl->renames[i].to);
- }
- free(nl->renames);
- }
- free(nl->a_utf8_name);
-}
-
-static void NameListFree(NameList *nl) {
- NameListFreeContents(nl);
- chunkfree(nl,sizeof(NameList));
-}
-/* ************************************************************************** */
-
-#include <sys/types.h>
-#include <dirent.h>
-
-NameList *LoadNamelist(char *filename) {
- FILE *file = fopen(filename,"r");
- NameList *nl, *nl2;
- char buffer[400];
- char *pt, *end, *test;
- int uni;
- int len;
- int up, ub, uc;
- int rn_cnt=0, rn_max = 0;
- int uses_unicode = false;
-
- if ( file==NULL )
-return( NULL );
-
- if ( !psnamesinited )
- psinitnames();
-
- nl = chunkalloc(sizeof(NameList));
- pt = strrchr(filename,'/');
- if ( pt==NULL ) pt = filename; else ++pt;
- nl->title = copy(pt);
- pt = strrchr(nl->title,'.');
- if ( pt!=NULL ) *pt = '\0';
-
- while ( fgets(buffer,sizeof(buffer),file)!=NULL ) {
- if ( buffer[0]=='#' || buffer[0]=='\n' || buffer[0]=='\r' )
- continue;
- len = strlen( buffer );
- if ( buffer[len-1]=='\n' ) buffer[--len] = '\0';
- if ( buffer[len-1]=='\r' ) buffer[--len] = '\0';
- if ( strncmp(buffer,"Based:",6)==0 ) {
- for ( pt=buffer+6; *pt==' ' || *pt=='\t'; ++pt);
- for ( nl2 = &agl; nl2!=NULL; nl2 = nl2->next )
- if ( strcmp( nl2->title,pt )==0 )
- break;
- if ( nl2==NULL ) {
- ff_post_error(_("NameList base missing"),_("NameList %s based on %s which could not be found"), nl->title, pt );
- NameListFree(nl);
- fclose(file);
-return( NULL );
- } else if ( nl->basedon!=NULL ) {
- ff_post_error(_("NameList based twice"),_("NameList %s based on two NameLists"), nl->title );
- NameListFree(nl);
- fclose(file);
-return( NULL );
- }
- nl->basedon = nl2;
- } else if ( strncmp(buffer,"Rename:",7)==0 ) {
- for ( pt=buffer+7; *pt==' ' || *pt=='\t'; ++pt);
- for ( test=pt; *test!=' ' && *test!='\t' && *test!='\0'; ++test );
- if ( *test=='\0' ) {
- ff_post_error(_("NameList parsing error"),_("Missing rename \"to\" name %s\n%s"), nl->title, buffer );
- NameListFree(nl);
- fclose(file);
-return( NULL );
- }
- *test='\0';
- for ( ++test; *test==' ' || *test=='\t'; ++test);
- if ( (test[0]=='-' || test[0]=='=') && test[1]=='>' )
- for ( test+=2; *test==' ' || *test=='\t'; ++test);
- if ( *test=='\0' ) {
- ff_post_error(_("NameList parsing error"),_("Missing rename \"to\" name %s\n%s"), nl->title, buffer );
- NameListFree(nl);
- fclose(file);
-return( NULL );
- }
- if ( rn_cnt>=rn_max-1 )
- nl->renames = grealloc(nl->renames,(rn_max+=20)*sizeof(struct renames));
- nl->renames[rn_cnt].from = copy(pt);
- nl->renames[rn_cnt].to = copy(test);
- nl->renames[++rn_cnt].from = NULL; /* End mark */
- } else {
- pt = buffer;
- if ( *pt=='0' && (pt[1]=='x' || pt[1]=='X'))
- pt += 2;
- else if (( *pt=='u' || *pt=='U') && pt[1]=='+' )
- pt += 2;
- uni = strtol(pt,&end,16);
- if ( end==pt || uni<0 || uni>=unicode4_size ) {
- ff_post_error(_("NameList parsing error"),_("Bad unicode value when parsing %s\n%s"), nl->title, buffer );
- NameListFree(nl);
- fclose(file);
-return( NULL );
- }
- pt = end;
- while ( *pt==' ' || *pt==';' || *pt=='\t' ) ++pt;
- if ( *pt=='\0' ) {
- ff_post_error(_("NameList parsing error"),_("Missing name when parsing %s for unicode %x"), nl->title, uni );
- NameListFree(nl);
- fclose(file);
-return( NULL );
- }
- for ( test=pt; *test; ++test ) {
- if ( (*test<=' ' && *test>=0) ||
- *test=='(' || *test=='[' || *test=='{' || *test=='<' ||
- *test==')' || *test==']' || *test=='}' || *test=='>' ||
- *test=='%' || *test=='/' ) {
- ff_post_error(_("NameList parsing error"),_("Bad name when parsing %s for unicode %x"), nl->title, uni );
- NameListFree(nl);
- fclose(file);
-return( NULL );
- }
- if ( *test&0x80 ) {
- uses_unicode = true;
- if ( nl->a_utf8_name==NULL )
- nl->a_utf8_name = copy(pt);
- }
- }
- up = uni>>16;
- ub = (uni&0xff00)>>8;
- uc = uni&0xff;
- if ( nl->unicode[up]==NULL )
- nl->unicode[up] = gcalloc(256,sizeof(char **));
- if ( nl->unicode[up][ub]==NULL )
- nl->unicode[up][ub] = gcalloc(256,sizeof(char *));
- if ( nl->unicode[up][ub][uc]==NULL )
- nl->unicode[up][ub][uc]=copy(pt);
- else {
- ff_post_error(_("NameList parsing error"),_("Multiple names when parsing %s for unicode %x"), nl->title, uni );
- NameListFree(nl);
- fclose(file);
-return( NULL );
- }
- }
- }
-
- nl->uses_unicode = uses_unicode;
- if ( nl->basedon!=NULL && nl->basedon->uses_unicode )
- nl->uses_unicode = true;
- fclose(file);
- for ( nl2 = &agl; nl2->next!=NULL; nl2=nl2->next ) {
- if ( strcmp(nl2->title,nl->title)==0 ) { /* Replace old version */
- NameList *next = nl2->next;
- NameListFreeContents(nl2);
- *nl2 = *nl;
- nl2->next = next;
- chunkfree(nl,sizeof(NameList));
- psreinitnames();
-return( nl2 );
- }
- }
- NameListHash(nl);
- nl2->next = nl;
-return( nl );
-}
-
-
-/* ************************************************************************** */
-const char *RenameGlyphToNamelist(char *buffer, SplineChar *sc,NameList *old,NameList *new) {
- int i, up, ub, uc, ch;
- char space[80]; /* glyph names are supposed to be less<=31 chars */
- char tempbuf[32];
- char *pt, *start, *opt, *oend; const char *newsubname;
- SplineChar *tempsc;
- NameList *nl;
-
- if ( sc->unicodeenc!=-1 ) {
- up = sc->unicodeenc>>16;
- ub = (sc->unicodeenc>>8)&0xff;
- uc = (sc->unicodeenc&0xff);
- for ( nl=new; nl!=NULL; nl=nl->basedon )
- if ( nl->unicode[up]!=NULL && nl->unicode[up][ub]!=NULL && nl->unicode[up][ub][uc]!=NULL )
-return( nl->unicode[up][ub][uc] );
- if ( up==0 )
- sprintf( buffer, "uni%04X", sc->unicodeenc );
- else
- sprintf( buffer, "u%04X", sc->unicodeenc );
-return( buffer );
- } else {
- if ( old!=NULL && old->renames!=NULL ) {
- for ( i=0; old->renames[i].from!=NULL; ++i )
- if ( strcmp(sc->name,old->renames[i].from)==0 )
-return( old->renames[i].to );
- }
- if ( new->renames!=NULL ) {
- for ( i=0; new->renames[i].from!=NULL; ++i )
- if ( strcmp(sc->name,new->renames[i].to)==0 )
-return( new->renames[i].from );
- }
- if ( strlen(sc->name)>sizeof(space)-1 )
-return( sc->name );
- strcpy(space,sc->name);
- opt = buffer; oend = buffer+31;
- start = space;
- /* Check for composite names f_i, A.small */
- while ( *start ) {
- for ( pt=start; *pt!='\0' && *pt!='.' && *pt!='_'; ++pt );
- if ( *pt=='\0' && start==space )
-return( sc->name );
- ch = *pt;
- *pt = '\0';
- tempsc = SFGetChar(sc->parent,-1,start);
- if ( tempsc==NULL )
-return( sc->name );
- newsubname = RenameGlyphToNamelist(tempbuf,tempsc,old,new);
- while ( opt<oend && *newsubname )
- *opt++ = *newsubname++;
- if ( *newsubname )
-return( sc->name );
- if ( ch=='\0' ) {
- *opt = '\0';
-return( buffer );
- } else if ( ch=='.' ) {
- /* don't attempt to translate anything after a '.' just copy that litterally */
- while ( opt<oend && *pt )
- *opt++ = *pt++;
- if ( *pt )
-return( sc->name );
- *opt = '\0';
-return( buffer );
- } else { /* _ */
- *opt++ = '_';
- start = pt+1;
- }
- }
- *opt = '\0';
-return( buffer );
- }
-}
-
-void SFRenameGlyphsToNamelist(SplineFont *sf,NameList *new) {
- int gid;
- char buffer[40]; const char *name;
- SplineChar *sc;
-
- if ( new==NULL )
-return;
-
- for ( gid = 0; gid<sf->glyphcnt; ++gid ) if ( (sc=sf->glyphs[gid])!=NULL ) {
- name = RenameGlyphToNamelist(buffer,sc,sf->for_new_glyphs,new);
- if ( name!=sc->name ) {
- free(sc->name);
- sc->name = copy(name);
- }
- }
- sf->for_new_glyphs = new;
-}
-
-char **SFTemporaryRenameGlyphsToNamelist(SplineFont *sf,NameList *new) {
- int gid;
- char buffer[40]; const char *name;
- SplineChar *sc;
- char **ret;
-
- if ( new==NULL )
-return( NULL );
-
- ret = gcalloc(sf->glyphcnt,sizeof(char *));
- for ( gid = 0; gid<sf->glyphcnt; ++gid ) if ( (sc=sf->glyphs[gid])!=NULL ) {
- name = RenameGlyphToNamelist(buffer,sc,sf->for_new_glyphs,new);
- if ( name!=sc->name ) {
- ret[gid] = sc->name;
- sc->name = copy(name);
- }
- }
-return( ret );
-}
-
-void SFTemporaryRestoreGlyphNames(SplineFont *sf,char **former) {
- int gid;
- SplineChar *sc;
-
- for ( gid = 0; gid<sf->glyphcnt; ++gid ) if ( (sc=sf->glyphs[gid])!=NULL ) {
- if ( former[gid]!=NULL ) {
- free(sc->name);
- sc->name = former[gid];
- }
- }
- free(former);
-}
-/* ************************************************************************** */
-static const char *agl_sans_p0_b0[] = {
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- "space",
- "exclam",
- "quotedbl",
- "numbersign",
- "dollar",
- "percent",
- "ampersand",
- "quotesingle",
- "parenleft",
- "parenright",
- "asterisk",
- "plus",
- "comma",
- "hyphen",
- "period",
- "slash",
- "zero",
- "one",
- "two",
- "three",
- "four",
- "five",
- "six",
- "seven",
- "eight",
- "nine",
- "colon",
- "semicolon",
- "less",
- "equal",
- "greater",
- "question",
- "at",
- "A",
- "B",
- "C",
- "D",
- "E",
- "F",
- "G",
- "H",
- "I",
- "J",
- "K",
- "L",
- "M",
- "N",
- "O",
- "P",
- "Q",
- "R",
- "S",
- "T",
- "U",
- "V",
- "W",
- "X",
- "Y",
- "Z",
- "bracketleft",
- "backslash",
- "bracketright",
- "asciicircum",
- "underscore",
- "grave",
- "a",
- "b",
- "c",
- "d",
- "e",
- "f",
- "g",
- "h",
- "i",
- "j",
- "k",
- "l",
- "m",
- "n",
- "o",
- "p",
- "q",
- "r",
- "s",
- "t",
- "u",
- "v",
- "w",
- "x",
- "y",
- "z",
- "braceleft",
- "bar",
- "braceright",
- "asciitilde",
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- "exclamdown",
- "cent",
- "sterling",
- "currency",
- "yen",
- "brokenbar",
- "section",
- "dieresis",
- "copyright",
- "ordfeminine",
- "guillemotleft",
- "logicalnot",
- NULL,
- "registered",
- "macron",
- "degree",
- "plusminus",
- NULL,
- NULL,
- "acute",
- NULL,
- "paragraph",
- "periodcentered",
- "cedilla",
- NULL,
- "ordmasculine",
- "guillemotright",
- "onequarter",
- "onehalf",
- "threequarters",
- "questiondown",
- "Agrave",
- "Aacute",
- "Acircumflex",
- "Atilde",
- "Adieresis",
- "Aring",
- "AE",
- "Ccedilla",
- "Egrave",
- "Eacute",
- "Ecircumflex",
- "Edieresis",
- "Igrave",
- "Iacute",
- "Icircumflex",
- "Idieresis",
- "Eth",
- "Ntilde",
- "Ograve",
- "Oacute",
- "Ocircumflex",
- "Otilde",
- "Odieresis",
- "multiply",
- "Oslash",
- "Ugrave",
- "Uacute",
- "Ucircumflex",
- "Udieresis",
- "Yacute",
- "Thorn",
- "germandbls",
- "agrave",
- "aacute",
- "acircumflex",
- "atilde",
- "adieresis",
- "aring",
- "ae",
- "ccedilla",
- "egrave",
- "eacute",
- "ecircumflex",
- "edieresis",
- "igrave",
- "iacute",
- "icircumflex",
- "idieresis",
- "eth",
- "ntilde",
- "ograve",
- "oacute",
- "ocircumflex",
- "otilde",
- "odieresis",
- "divide",
- "oslash",
- "ugrave",
- "uacute",
- "ucircumflex",
- "udieresis",
- "yacute",
- "thorn",
- "ydieresis"
-};
-
-static const char *agl_sans_p0_b1[] = {
- "Amacron",
- "amacron",
- "Abreve",
- "abreve",
- "Aogonek",
- "aogonek",
- "Cacute",
- "cacute",
- "Ccircumflex",
- "ccircumflex",
- "Cdotaccent",
- "cdotaccent",
- "Ccaron",
- "ccaron",
- "Dcaron",
- "dcaron",
- "Dcroat",
- "dcroat",
- "Emacron",
- "emacron",
- "Ebreve",
- "ebreve",
- "Edotaccent",
- "edotaccent",
- "Eogonek",
- "eogonek",
- "Ecaron",
- "ecaron",
- "Gcircumflex",
- "gcircumflex",
- "Gbreve",
- "gbreve",
- "Gdotaccent",
- "gdotaccent",
- "Gcommaaccent",
- "gcommaaccent",
- "Hcircumflex",
- "hcircumflex",
- "Hbar",
- "hbar",
- "Itilde",
- "itilde",
- "Imacron",
- "imacron",
- "Ibreve",
- "ibreve",
- "Iogonek",
- "iogonek",
- "Idotaccent",
- "dotlessi",
- "IJ",
- "ij",
- "Jcircumflex",
- "jcircumflex",
- "Kcommaaccent",
- "kcommaaccent",
- "kgreenlandic",
- "Lacute",
- "lacute",
- "Lcommaaccent",
- "lcommaaccent",
- "Lcaron",
- "lcaron",
- "Ldot",
- "ldot",
- "Lslash",
- "lslash",
- "Nacute",
- "nacute",
- "Ncommaaccent",
- "ncommaaccent",
- "Ncaron",
- "ncaron",
- "napostrophe",
- "Eng",
- "eng",
- "Omacron",
- "omacron",
- "Obreve",
- "obreve",
- "Ohungarumlaut",
- "ohungarumlaut",
- "OE",
- "oe",
- "Racute",
- "racute",
- "Rcommaaccent",
- "rcommaaccent",
- "Rcaron",
- "rcaron",
- "Sacute",
- "sacute",
- "Scircumflex",
- "scircumflex",
- "Scedilla",
- "scedilla",
- "Scaron",
- "scaron",
- NULL,
- NULL,
- "Tcaron",
- "tcaron",
- "Tbar",
- "tbar",
- "Utilde",
- "utilde",
- "Umacron",
- "umacron",
- "Ubreve",
- "ubreve",
- "Uring",
- "uring",
- "Uhungarumlaut",
- "uhungarumlaut",
- "Uogonek",
- "uogonek",
- "Wcircumflex",
- "wcircumflex",
- "Ycircumflex",
- "ycircumflex",
- "Ydieresis",
- "Zacute",
- "zacute",
- "Zdotaccent",
- "zdotaccent",
- "Zcaron",
- "zcaron",
- "longs",
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- "florin",
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- "Ohorn",
- "ohorn",
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- "Uhorn",
- "uhorn",
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- "Gcaron",
- "gcaron",
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- "Aringacute",
- "aringacute",
- "AEacute",
- "aeacute",
- "Oslashacute",
- "oslashacute"
-};
-
-static const char *agl_sans_p0_b2[] = {
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- "Scommaaccent",
- "scommaaccent",
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- "circumflex",
- "caron",
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- "breve",
- "dotaccent",
- "ring",
- "ogonek",
- "tilde",
- "hungarumlaut",
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL
-};
-
-static const char *agl_sans_p0_b3[] = {
- "gravecomb",
- "acutecomb",
- NULL,
- "tildecomb",
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- "hookabovecomb",
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- "dotbelowcomb",
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- "tonos",
- "dieresistonos",
- "Alphatonos",
- "anoteleia",
- "Epsilontonos",
- "Etatonos",
- "Iotatonos",
- NULL,
- "Omicrontonos",
- NULL,
- "Upsilontonos",
- "Omegatonos",
- "iotadieresistonos",
- "Alpha",
- "Beta",
- "Gamma",
- "Delta",
- "Epsilon",
- "Zeta",
- "Eta",
- "Theta",
- "Iota",
- "Kappa",
- "Lambda",
- "Mu",
- "Nu",
- "Xi",
- "Omicron",
- "Pi",
- "Rho",
- NULL,
- "Sigma",
- "Tau",
- "Upsilon",
- "Phi",
- "Chi",
- "Psi",
- "Omega",
- "Iotadieresis",
- "Upsilondieresis",
- "alphatonos",
- "epsilontonos",
- "etatonos",
- "iotatonos",
- "upsilondieresistonos",
- "alpha",
- "beta",
- "gamma",
- "delta",
- "epsilon",
- "zeta",
- "eta",
- "theta",
- "iota",
- "kappa",
- "lambda",
- "mu",
- "nu",
- "xi",
- "omicron",
- "pi",
- "rho",
- "sigma1",
- "sigma",
- "tau",
- "upsilon",
- "phi",
- "chi",
- "psi",
- "omega",
- "iotadieresis",
- "upsilondieresis",
- "omicrontonos",
- "upsilontonos",
- "omegatonos",
- NULL,
- NULL,
- "theta1",
- "Upsilon1",
- NULL,
- NULL,
- "phi1",
- "omega1",
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL
-};
-
-static const char *agl_sans_p0_b1e[] = {
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- "Wgrave",
- "wgrave",
- "Wacute",
- "wacute",
- "Wdieresis",
- "wdieresis",
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- "Ygrave",
- "ygrave",
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL
-};
-
-static const char *agl_sans_p0_b20[] = {
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- "figuredash",
- "endash",
- "emdash",
- NULL,
- NULL,
- "underscoredbl",
- "quoteleft",
- "quoteright",
- "quotesinglbase",
- "quotereversed",
- "quotedblleft",
- "quotedblright",
- "quotedblbase",
- NULL,
- "dagger",
- "daggerdbl",
- "bullet",
- NULL,
- "onedotenleader",
- "twodotenleader",
- "ellipsis",
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- "perthousand",
- NULL,
- "minute",
- "second",
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- "guilsinglleft",
- "guilsinglright",
- NULL,
- "exclamdbl",
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- "fraction",
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- "colonmonetary",
- NULL,
- "franc",
- "lira",
- NULL,
- NULL,
- "peseta",
- NULL,
- NULL,
- NULL,
- "dong",
- "Euro",
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL
-};
-
-static const char *agl_sans_p0_b21[] = {
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- "Ifraktur",
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- "weierstrass",
- NULL,
- NULL,
- NULL,
- "Rfraktur",
- NULL,
- "prescription",
- NULL,
- NULL,
- NULL,
- "trademark",
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- "estimated",
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- "aleph",
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- "onethird",
- "twothirds",
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- "oneeighth",
- "threeeighths",
- "fiveeighths",
- "seveneighths",
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- "arrowleft",
- "arrowup",
- "arrowright",
- "arrowdown",
- "arrowboth",
- "arrowupdn",
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- "arrowupdnbse",
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- "carriagereturn",
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- "arrowdblleft",
- "arrowdblup",
- "arrowdblright",
- "arrowdbldown",
- "arrowdblboth",
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL
-};
-
-static const char *agl_sans_p0_b22[] = {
- "universal",
- NULL,
- "partialdiff",
- "existential",
- NULL,
- "emptyset",
- NULL,
- "gradient",
- "element",
- "notelement",
- NULL,
- "suchthat",
- NULL,
- NULL,
- NULL,
- "product",
- NULL,
- "summation",
- "minus",
- NULL,
- NULL,
- NULL,
- NULL,
- "asteriskmath",
- NULL,
- NULL,
- "radical",
- NULL,
- NULL,
- "proportional",
- "infinity",
- "orthogonal",
- "angle",
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- "logicaland",
- "logicalor",
- "intersection",
- "union",
- "integral",
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- "therefore",
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- "similar",
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- "congruent",
- NULL,
- NULL,
- "approxequal",
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- "notequal",
- "equivalence",
- NULL,
- NULL,
- "lessequal",
- "greaterequal",
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- "propersubset",
- "propersuperset",
- "notsubset",
- NULL,
- "reflexsubset",
- "reflexsuperset",
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- "circleplus",
- NULL,
- "circlemultiply",
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- "perpendicular",
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- "dotmath",
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL
-};
-
-static const char *agl_sans_p0_b23[] = {
- NULL,
- NULL,
- "house",
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- "revlogicalnot",
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- "integraltp",
- "integralbt",
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- "angleleft",
- "angleright",
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL
-};
-
-static const char *agl_sans_p0_b25[] = {
- "SF100000",
- NULL,
- "SF110000",
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- "SF010000",
- NULL,
- NULL,
- NULL,
- "SF030000",
- NULL,
- NULL,
- NULL,
- "SF020000",
- NULL,
- NULL,
- NULL,
- "SF040000",
- NULL,
- NULL,
- NULL,
- "SF080000",
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- "SF090000",
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- "SF060000",
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- "SF070000",
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- "SF050000",
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- "SF430000",
- "SF240000",
- "SF510000",
- "SF520000",
- "SF390000",
- "SF220000",
- "SF210000",
- "SF250000",
- "SF500000",
- "SF490000",
- "SF380000",
- "SF280000",
- "SF270000",
- "SF260000",
- "SF360000",
- "SF370000",
- "SF420000",
- "SF190000",
- "SF200000",
- "SF230000",
- "SF470000",
- "SF480000",
- "SF410000",
- "SF450000",
- "SF460000",
- "SF400000",
- "SF540000",
- "SF530000",
- "SF440000",
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- "upblock",
- NULL,
- NULL,
- NULL,
- "dnblock",
- NULL,
- NULL,
- NULL,
- "block",
- NULL,
- NULL,
- NULL,
- "lfblock",
- NULL,
- NULL,
- NULL,
- "rtblock",
- "ltshade",
- "shade",
- "dkshade",
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- "filledbox",
- "H22073",
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- "H18543",
- "H18551",
- "filledrect",
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- "triagup",
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- "triagrt",
- NULL,
- "triagdn",
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- "triaglf",
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- "lozenge",
- "circle",
- NULL,
- NULL,
- NULL,
- "H18533",
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- "invbullet",
- "invcircle",
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- "openbullet",
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL
-};
-
-static const char *agl_sans_p0_b26[] = {
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- "smileface",
- "invsmileface",
- "sun",
- NULL,
- NULL,
- NULL,
- "female",
- NULL,
- "male",
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- "spade",
- NULL,
- NULL,
- "club",
- NULL,
- "heart",
- "diamond",
- NULL,
- NULL,
- NULL,
- "musicalnote",
- "musicalnotedbl",
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL
-};
-
-static const char **agl_sans_p0[] = {
- agl_sans_p0_b0,
- agl_sans_p0_b1,
- agl_sans_p0_b2,
- agl_sans_p0_b3,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- agl_sans_p0_b1e,
- NULL,
- agl_sans_p0_b20,
- agl_sans_p0_b21,
- agl_sans_p0_b22,
- agl_sans_p0_b23,
- NULL,
- agl_sans_p0_b25,
- agl_sans_p0_b26,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL
-};
-
-static NameList agl_sans = {
- NULL,
- N_("AGL without afii"),
- { agl_sans_p0, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL },
- NULL, 0, 0, NULL
-};
-/* ************************************************************************** */
-static const char *agl_p0_b1[] = {
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- "Tcommaaccent",
- "tcommaaccent",
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL
-};
-
-static const char *agl_p0_b2[] = {
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- "afii57929",
- "afii64937",
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL
-};
-
-static const char *agl_p0_b4[] = {
- NULL,
- "afii10023",
- "afii10051",
- "afii10052",
- "afii10053",
- "afii10054",
- "afii10055",
- "afii10056",
- "afii10057",
- "afii10058",
- "afii10059",
- "afii10060",
- "afii10061",
- NULL,
- "afii10062",
- "afii10145",
- "afii10017",
- "afii10018",
- "afii10019",
- "afii10020",
- "afii10021",
- "afii10022",
- "afii10024",
- "afii10025",
- "afii10026",
- "afii10027",
- "afii10028",
- "afii10029",
- "afii10030",
- "afii10031",
- "afii10032",
- "afii10033",
- "afii10034",
- "afii10035",
- "afii10036",
- "afii10037",
- "afii10038",
- "afii10039",
- "afii10040",
- "afii10041",
- "afii10042",
- "afii10043",
- "afii10044",
- "afii10045",
- "afii10046",
- "afii10047",
- "afii10048",
- "afii10049",
- "afii10065",
- "afii10066",
- "afii10067",
- "afii10068",
- "afii10069",
- "afii10070",
- "afii10072",
- "afii10073",
- "afii10074",
- "afii10075",
- "afii10076",
- "afii10077",
- "afii10078",
- "afii10079",
- "afii10080",
- "afii10081",
- "afii10082",
- "afii10083",
- "afii10084",
- "afii10085",
- "afii10086",
- "afii10087",
- "afii10088",
- "afii10089",
- "afii10090",
- "afii10091",
- "afii10092",
- "afii10093",
- "afii10094",
- "afii10095",
- "afii10096",
- "afii10097",
- NULL,
- "afii10071",
- "afii10099",
- "afii10100",
- "afii10101",
- "afii10102",
- "afii10103",
- "afii10104",
- "afii10105",
- "afii10106",
- "afii10107",
- "afii10108",
- "afii10109",
- NULL,
- "afii10110",
- "afii10193",
- NULL,
- NULL,
- "afii10146",
- "afii10194",
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- "afii10147",
- "afii10195",
- "afii10148",
- "afii10196",
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- "afii10050",
- "afii10098",
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- "afii10846",
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL
-};
-
-static const char *agl_p0_b5[] = {
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- "afii57799",
- "afii57801",
- "afii57800",
- "afii57802",
- "afii57793",
- "afii57794",
- "afii57795",
- "afii57798",
- "afii57797",
- "afii57806",
- NULL,
- "afii57796",
- "afii57807",
- "afii57839",
- "afii57645",
- "afii57841",
- "afii57842",
- "afii57804",
- "afii57803",
- "afii57658",
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- "afii57664",
- "afii57665",
- "afii57666",
- "afii57667",
- "afii57668",
- "afii57669",
- "afii57670",
- "afii57671",
- "afii57672",
- "afii57673",
- "afii57674",
- "afii57675",
- "afii57676",
- "afii57677",
- "afii57678",
- "afii57679",
- "afii57680",
- "afii57681",
- "afii57682",
- "afii57683",
- "afii57684",
- "afii57685",
- "afii57686",
- "afii57687",
- "afii57688",
- "afii57689",
- "afii57690",
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- "afii57716",
- "afii57717",
- "afii57718",
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL
-};
-
-static const char *agl_p0_b6[] = {
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- "afii57388",
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- "afii57403",
- NULL,
- NULL,
- NULL,
- "afii57407",
- NULL,
- "afii57409",
- "afii57410",
- "afii57411",
- "afii57412",
- "afii57413",
- "afii57414",
- "afii57415",
- "afii57416",
- "afii57417",
- "afii57418",
- "afii57419",
- "afii57420",
- "afii57421",
- "afii57422",
- "afii57423",
- "afii57424",
- "afii57425",
- "afii57426",
- "afii57427",
- "afii57428",
- "afii57429",
- "afii57430",
- "afii57431",
- "afii57432",
- "afii57433",
- "afii57434",
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- "afii57440",
- "afii57441",
- "afii57442",
- "afii57443",
- "afii57444",
- "afii57445",
- "afii57446",
- "afii57470",
- "afii57448",
- "afii57449",
- "afii57450",
- "afii57451",
- "afii57452",
- "afii57453",
- "afii57454",
- "afii57455",
- "afii57456",
- "afii57457",
- "afii57458",
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- "afii57392",
- "afii57393",
- "afii57394",
- "afii57395",
- "afii57396",
- "afii57397",
- "afii57398",
- "afii57399",
- "afii57400",
- "afii57401",
- "afii57381",
- NULL,
- NULL,
- "afii63167",
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- "afii57511",
- NULL,
- NULL,
- NULL,
- NULL,
- "afii57506",
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- "afii57507",
- NULL,
- "afii57512",
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- "afii57513",
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- "afii57508",
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- "afii57505",
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- "afii57509",
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- "afii57514",
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- "afii57519",
- NULL,
- NULL,
- "afii57534",
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL
-};
-
-static const char *agl_p0_b20[] = {
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- "afii61664",
- "afii301",
- "afii299",
- "afii300",
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- "afii00208",
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- "afii61573",
- "afii61574",
- "afii61575",
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- "afii57636",
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL
-};
-
-static const char *agl_p0_b21[] = {
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- "afii61248",
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- "afii61289",
- NULL,
- NULL,
- "afii61352",
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL
-};
-
-static const char **agl_p0[] = {
- NULL,
- agl_p0_b1,
- agl_p0_b2,
- NULL,
- agl_p0_b4,
- agl_p0_b5,
- agl_p0_b6,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- agl_p0_b20,
- agl_p0_b21,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL
-};
-
-static NameList agl = {
- &agl_sans,
- N_("Adobe Glyph List"),
- { agl_p0, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL },
- NULL, 0, 0, NULL
-};
-/* ************************************************************************** */
-static const char *adobepua_p0_bf6[] = {
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- "perthousand.oldstyle",
- "cent.denominator",
- "dollar.denominator",
- "hyphen.denominator",
- "parenleft.denominator",
- "parenright.denominator",
- "cent.numerator",
- "dollar.numerator",
- "hyphen.numerator",
- "parenleft.numerator",
- "parenright.numerator",
- "at.cap",
- "commaaccent.cap",
- "commaaccent.small",
- "pi.math",
- "h.superior",
- "zero.slash",
- "zero.fitted",
- "two.fitted",
- "three.fitted",
- "four.fitted",
- "five.fitted",
- "six.fitted",
- "seven.fitted",
- "eight.fitted",
- "nine.fitted",
- "percent.oldstyle",
- "zero.taboldstyle",
- "one.taboldstyle",
- "two.taboldstyle",
- "three.taboldstyle",
- "four.taboldstyle",
- "five.taboldstyle",
- "six.taboldstyle",
- "seven.taboldstyle",
- "eight.taboldstyle",
- "nine.taboldstyle",
- "colonmonetary.taboldstyle",
- "Euro.taboldstyle",
- "florin.taboldstyle",
- "numbersign.taboldstyle",
- "sterling.taboldstyle",
- "yen.taboldstyle",
- "dollar.taboldstyle",
- "cent.taboldstyle",
- "zero.denominator",
- "one.denominator",
- "two.denominator",
- "three.denominator",
- "four.denominator",
- "five.denominator",
- "six.denominator",
- "seven.denominator",
- "eight.denominator",
- "nine.denominator",
- "comma.denominator",
- "period.denominator",
- "zero.numerator",
- "one.numerator",
- "two.numerator",
- "three.numerator",
- "four.numerator",
- "five.numerator",
- "six.numerator",
- "seven.numerator",
- "eight.numerator",
- "nine.numerator",
- "comma.numerator",
- "period.numerator",
- "Abreve.small",
- "Amacron.small",
- "Aogonek.small",
- "AEacute.small",
- "Cacute.small",
- "Ccaron.small",
- "Ccircumflex.small",
- "Cdotaccent.small",
- "Dcaron.small",
- "Dcroat.small",
- "Ebreve.small",
- "Ecaron.small",
- "Edotaccent.small",
- "Emacron.small",
- "Eng.small",
- "Eogonek.small",
- "Gbreve.small",
- "Gcircumflex.small",
- "Gcommaaccent.small",
- "Gdotaccent.small",
- "Hbar.small",
- "Hcircumflex.small",
- "Ibreve.small",
- "IJ.small",
- "Imacron.small",
- "Iogonek.small",
- "Itilde.small",
- "Jcircumflex.small",
- "Kcommaaccent.small",
- "Lacute.small",
- "Lcaron.small",
- "Lcommaaccent.small",
- "Ldot.small",
- "Nacute.small",
- "Ncaron.small",
- "Ncommaaccent.small",
- "Obreve.small",
- "Ohungarumlaut.small",
- "Omacron.small",
- "Oslashacute.small",
- "Racute.small",
- "Rcaron.small",
- "Rcommaaccent.small",
- "Sacute.small",
- "Scedilla.small",
- "Scircumflex.small",
- "Scommaaccent.small",
- "Tbar.small",
- "Tcaron.small",
- "Tcommaaccent.small",
- "Ubreve.small",
- "Uhungarumlaut.small",
- "Umacron.small",
- "Uogonek.small",
- "Uring.small",
- "Utilde.small",
- "Wacute.small",
- "Wcircumflex.small",
- "Wdieresis.small",
- "Wgrave.small",
- "Ycircumflex.small",
- "Ygrave.small",
- "Zacute.small",
- "Zdotaccent.small",
- "Idotaccent.small",
- "parenleft.cap",
- "parenright.cap",
- "bracketleft.cap",
- "bracketright.cap",
- "braceleft.cap",
- "braceright.cap",
- "exclamdown.cap",
- "questiondown.cap",
- "guillemotleft.cap",
- "guillemotright.cap",
- "guilsinglleft.cap",
- "guilsinglright.cap",
- "hyphen.cap",
- "endash.cap",
- "emdash.cap",
- "periodcentered.cap",
- "j.dotless",
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- "afii10068.ital",
- "afii10066.ital",
- "afii10069.ital",
- "afii10081.ital",
- "afii10084.ital",
- "acute.cap",
- "caron.cap",
- "dieresis.cap",
- "space_uni0308_uni0301.cap",
- "space_uni0308_uni0300.cap",
- "grave.cap",
- "hungarumlaut.cap",
- "macron.cap",
- "breve.cyrcap",
- "circumflex.cyrcap",
- "space_uni030F.cap",
- "breve.cyr",
- "circumflex.cyr",
- "space_uni030F",
- "space_uni0308_uni0301",
- "space_uni0308_uni0300",
- "copyright.serif",
- "registered.serif",
- "trademark.serif",
- "one.fitted",
- "R_p",
- "uni2014.alt",
- "cent.inferior",
- "cent.superior",
- "comma.inferior",
- "comma.superior",
- "dollar.inferior",
- "dollar.superior",
- "hyphen.inferior",
- "hyphen.superior",
- "period.inferior",
- "period.superior",
- "a.superior",
- "b.superior",
- "d.superior",
- "e.superior",
- "i.superior",
- "l.superior",
- "m.superior",
- "o.superior",
- "r.superior",
- "s.superior",
- "t.superior",
- "breve.sc",
- "caron.sc",
- "circumflex.sc",
- "dotaccent.sc",
- "hungarumlaut.sc",
- "lslash.sc",
- "oe.sc",
- "ogonek.sc",
- "ring.sc",
- "scaron.sc",
- "tilde.sc",
- "zcaron.sc"
-};
-
-static const char *adobepua_p0_bf7[] = {
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- "exclam.sc",
- NULL,
- NULL,
- "dollar.oldstyle",
- NULL,
- "ampersand.sc",
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- "zero.oldstyle",
- "one.oldstyle",
- "two.oldstyle",
- "three.oldstyle",
- "four.oldstyle",
- "five.oldstyle",
- "six.oldstyle",
- "seven.oldstyle",
- "eight.oldstyle",
- "nine.oldstyle",
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- "question.sc",
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- "grave.sc",
- "a.sc",
- "b.sc",
- "c.sc",
- "d.sc",
- "e.sc",
- "f.sc",
- "g.sc",
- "h.sc",
- "i.sc",
- "j.sc",
- "k.sc",
- "l.sc",
- "m.sc",
- "n.sc",
- "o.sc",
- "p.sc",
- "q.sc",
- "r.sc",
- "s.sc",
- "t.sc",
- "u.sc",
- "v.sc",
- "w.sc",
- "x.sc",
- "y.sc",
- "z.sc",
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- "exclamdown.sc",
- "cent.oldstyle",
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- "dieresis.sc",
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- "macron.sc",
- NULL,
- NULL,
- NULL,
- NULL,
- "acute.sc",
- NULL,
- NULL,
- NULL,
- "cedilla.sc",
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- "questiondown.sc",
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- "agrave.sc",
- "aacute.sc",
- "acircumflex.sc",
- "atilde.sc",
- "adieresis.sc",
- "aring.sc",
- "ae.sc",
- "ccedilla.sc",
- "egrave.sc",
- "eacute.sc",
- "ecircumflex.sc",
- "edieresis.sc",
- "igrave.sc",
- "iacute.sc",
- "icircumflex.sc",
- "idieresis.sc",
- "eth.sc",
- "ntilde.sc",
- "ograve.sc",
- "oacute.sc",
- "ocircumflex.sc",
- "otilde.sc",
- "odieresis.sc",
- NULL,
- "oslash.sc",
- "ugrave.sc",
- "uacute.sc",
- "ucircumflex.sc",
- "udieresis.sc",
- "yacute.sc",
- "thorn.sc",
- "ydieresis.sc"
-};
-
-static const char *adobepua_p0_bf8[] = {
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- "registered.sans",
- "copyright.sans",
- "trademark.sans",
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL
-};
-
-static const char *adobepua_p0_bfb[] = {
- "f_f",
- "f_i",
- "f_l",
- "f_f_i",
- "f_f_l",
- "longs_t",
- "s_t",
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL
-};
-
-static const char **adobepua_p0[] = {
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- adobepua_p0_bf6,
- adobepua_p0_bf7,
- adobepua_p0_bf8,
- NULL,
- NULL,
- adobepua_p0_bfb,
- NULL,
- NULL,
- NULL,
- NULL
-};
-
-static NameList adobepua = {
- &agl,
- N_("AGL with PUA"),
- { adobepua_p0, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL },
- NULL, 0, 0, NULL
-};
-/* ************************************************************************** */
-static const char *greeksc_p0_bf5[] = {
- "alpha.sc",
- "beta.sc",
- "gamma.sc",
- "delta.sc",
- "epsilon.sc",
- "zeta.sc",
- "eta.sc",
- "theta.sc",
- "iota.sc",
- "kappa.sc",
- "lambda.sc",
- "mu.sc",
- "nu.sc",
- "xi.sc",
- "omicron.sc",
- "pi.sc",
- "rho.sc",
- NULL,
- "sigma.sc",
- "tau.sc",
- "upsilon.sc",
- "phi.sc",
- "chi.sc",
- "psi.sc",
- "omega.sc",
- "iotadieresis.sc",
- "upsilondieresis.sc",
- "alphaiota.sc",
- "etaiota.sc",
- "omegaiota.sc",
- "prosgegrammeni.sc",
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL
-};
-
-static const char **greeksc_p0[] = {
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- greeksc_p0_bf5,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL
-};
-
-static NameList greeksc = {
- &adobepua,
- N_("Greek small caps"),
- { greeksc_p0, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL },
- NULL, 0, 0, NULL
-};
-/* ************************************************************************** */
-static const char *tex_p0_b20[] = {
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- "closure",
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- "leftharpoonaccent",
- "rightharpoonaccent",
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL
-};
-
-static const char *tex_p0_b21[] = {
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- "shortleftarrow",
- "shortuparrow",
- "shortrightarrow",
- "shortdownarrow",
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- "leftwavyarrow",
- "rightwavyarrow",
- NULL,
- "twoheaduparrow",
- NULL,
- "twoheaddownarrow",
- NULL,
- NULL,
- NULL,
- "mapsup",
- NULL,
- "mapsdown",
- "updownarrowbar",
- NULL,
- NULL,
- NULL,
- NULL,
- "leftrightwavyarrow",
- NULL,
- "downzigzagarrow",
- NULL,
- NULL,
- "Ldsh",
- "Rdsh",
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- "acwopencirclearrow",
- "cwopencirclearrow",
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- "updownarrows",
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- "Nwarrow",
- "Nearrow",
- "Searrow",
- "Swarrow",
- NULL,
- NULL,
- "longleftzigzagarrow",
- "rightzigzagarrow",
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- "barleftarrow",
- "rightarrowbar",
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- "downuparrows",
- "rightthreearrows",
- "nvleftarrow",
- "nvrightarrow",
- "nvleftrightarrow",
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL
-};
-
-static const char *tex_p0_b22[] = {
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- "ltrpar",
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- "difference",
- NULL,
- "ac",
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- "approxident",
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- "arceq",
- NULL,
- "veeeq",
- "stareq",
- NULL,
- "eqdef",
- "measeq",
- NULL,
- NULL,
- NULL,
- NULL,
- "Equiv",
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- "prurel",
- "scurel",
- NULL,
- NULL,
- NULL,
- NULL,
- "origof",
- "imageof",
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- "eqless",
- "eqgtr",
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- "disin",
- NULL,
- "isins",
- "isindot",
- NULL,
- NULL,
- "isinvb",
- "isinE",
- "nisd",
- NULL,
- "nis",
- NULL,
- NULL,
- NULL
-};
-
-static const char *tex_p0_b23[] = {
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- "invnot",
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- "turnednot",
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- "solbar",
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- "rangledownzigzagarrow",
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL
-};
-
-static const char *tex_p0_b27[] = {
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- "longrightzigzagarrow"
-};
-
-static const char *tex_p0_b29[] = {
- NULL,
- NULL,
- "nvLeftarrow",
- "nvRightarrow",
- "nvLeftrightarrow",
- "twoheadmapsto",
- NULL,
- NULL,
- "downarrowbarred",
- "uparrowbarred",
- "Uuparrow",
- "Ddownarrow",
- "leftbkarrow",
- "rightbkarrow",
- "leftdbkarrow",
- NULL,
- NULL,
- "rightdotarrow",
- "baruparrow",
- "downarrowbar",
- NULL,
- NULL,
- "twoheadrightarrowtail",
- NULL,
- NULL,
- "lefttail",
- "righttail",
- "leftdbltail",
- "rightdbltail",
- "diamondleftarrow",
- "rightarrowdiamond",
- "diamondleftarrowbar",
- "barrightarrowdiamond",
- "nwsearrow",
- "neswarrow",
- "hknwarrow",
- "hknearrow",
- "hksearrow",
- "hkswarrow",
- NULL,
- NULL,
- NULL,
- NULL,
- "rdiagovfdiag",
- "fdiagovrdiag",
- "seovnearrow",
- "neovsearrow",
- "fdiagovnearrow",
- "rdiagovsearrow",
- "neovnwarrow",
- "nwovnearrow",
- "rightcurvedarrow",
- NULL,
- NULL,
- "leftdowncurvedarrow",
- "rightdowncurvedarrow",
- "cwhalfcirclearrow",
- "acwhalfcirclearrow",
- NULL,
- "acwundercurvearrow",
- "curvearrowrightminus",
- "curvearrowleftplus",
- "cwundercurvearrow",
- NULL,
- NULL,
- NULL,
- "rightarrowshortleftarrow",
- "leftarrowshortrightarrow",
- "shortrightarrowleftarrow",
- "rightarrowplus",
- "leftarrowplus",
- "rightarrowx",
- "leftrightarrowcircle",
- "twoheaduparrowcircle",
- "leftrightharpoonupdown",
- "leftrightharpoondownup",
- "updownharpoonrightleft",
- "updownharpoonleftright",
- "leftrightharpoonupup",
- "updownharpoonrightright",
- "leftrightharpoondowndown",
- "updownharpoonleftleft",
- "barleftharpoonup",
- "rightharpoonupbar",
- "barupharpoonright",
- "downharpoonrightbar",
- "barleftharpoondown",
- "rightharpoondownbar",
- "barupharpoonleft",
- "downharpoonleftbar",
- "leftharpoonupbar",
- "barrightharpoonup",
- "upharpoonrightbar",
- "bardownharpoonright",
- "leftharpoondownbar",
- "barrightharpoondown",
- "upharpoonleftbar",
- "bardownharpoonleft",
- "leftharpoonsupdown",
- "upharpoonsleftright",
- "rightharpoonsupdown",
- "downharpoonsleftright",
- "leftrightharpoonsup",
- "leftrightharpoonsdown",
- "rightleftharpoonsup",
- "rightleftharpoonsdown",
- "leftharpoonupdash",
- "dashleftharpoondown",
- "rightharpoonupdash",
- "dashrightharpoondown",
- "updownharpoonsleftright",
- "downupharpoonsleftright",
- "rightimply",
- "equalrightarrow",
- "similarrightarrow",
- "leftarrowsimilar",
- "rightarrowsimilar",
- "rightarrowapprox",
- "ltlarr",
- "leftarrowless",
- "gtrarr",
- "subrarr",
- "leftarrowsubset",
- "suplarr",
- "leftfishtail",
- "rightfishtail",
- "upfishtail",
- "downfishtail",
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- "rtriltri",
- "ltrivb",
- "vbrtri",
- "lfbowtie",
- "rfbowtie",
- "fbowtie",
- "lftimes",
- "rftimes",
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- "eqvparsl",
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- "ruledelayed",
- NULL,
- "dsol",
- "rsolbar",
- "xsol",
- "xbsol",
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL
-};
-
-static const char *tex_p0_b2a[] = {
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- "congdot",
- NULL,
- NULL,
- "approxeqq",
- NULL,
- NULL,
- "eqqsim",
- "Coloneq",
- "eqeq",
- NULL,
- NULL,
- "equivDD",
- "ltcir",
- "gtcir",
- "ltquest",
- "gtquest",
- NULL,
- NULL,
- "lesdot",
- "gesdot",
- "lesdoto",
- "gesdoto",
- "lesdotor",
- "gesdotol",
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- "lsime",
- "gsime",
- "lsimg",
- "gsiml",
- "lgE",
- "glE",
- "lesges",
- "gesles",
- NULL,
- NULL,
- "elsdot",
- "egsdot",
- NULL,
- NULL,
- NULL,
- NULL,
- "simless",
- "simgtr",
- "simlE",
- "simgE",
- "Lt",
- "Gt",
- NULL,
- "glj",
- "gla",
- "ltcc",
- "gtcc",
- "lescc",
- "gescc",
- "smt",
- "lat",
- "smte",
- "late",
- "bumpeqq",
- NULL,
- NULL,
- NULL,
- NULL,
- "prE",
- "scE",
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- "Pr",
- "Sc",
- "subsetdot",
- "supsetdot",
- "subsetplus",
- "supsetplus",
- "submult",
- "supmult",
- "subedot",
- "supedot",
- NULL,
- NULL,
- "subsim",
- "supsim",
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- "csub",
- "csup",
- "csube",
- "csupe",
- "subsup",
- "supsub",
- "subsub",
- "supsup",
- "suphsub",
- "supdsub",
- "forkv",
- "topfork",
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- "Barv",
- "vBar",
- "vBarv",
- "barV",
- "Vbar",
- "Not",
- "bNot",
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL
-};
-
-static const char *tex_p0_be2[] = {
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- "rightdbkarrow",
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- "nrightwavyarrow",
- NULL,
- "nrightcurvedarrow",
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- "race",
- "acE",
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL
-};
-
-static const char *tex_p0_be3[] = {
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- "lesg",
- "gesl",
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- "smtes",
- "lates",
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- "bsolhsub",
- "suphsol",
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- "congruence",
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL
-};
-
-static const char *tex_p0_be4[] = {
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- "mostpos",
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL
-};
-
-static const char *tex_p0_be6[] = {
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- "varrightfishtail",
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL
-};
-
-static const char **tex_p0[] = {
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- tex_p0_b20,
- tex_p0_b21,
- tex_p0_b22,
- tex_p0_b23,
- NULL,
- NULL,
- NULL,
- tex_p0_b27,
- NULL,
- tex_p0_b29,
- tex_p0_b2a,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- tex_p0_be2,
- tex_p0_be3,
- tex_p0_be4,
- NULL,
- tex_p0_be6,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL
-};
-
-static NameList tex = {
- &agl,
- N_("ΤεΧ Names"),
- { tex_p0, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL },
- NULL, 0, 0, NULL
-};
-/* ************************************************************************** */
-static const char *ams_p0_be2[] = {
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- "uni219D0338",
- NULL,
- "uni29330338",
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- "uni2192.short",
- "uni2190.short",
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- "uni222AFE00",
- "uni2229FE00",
- "uni2294FE00",
- "uni2293FE00",
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- "uni223E0332.reversed",
- "uni223E0333",
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- "uni2269FE00",
- NULL,
- NULL,
- "uni2268FE00",
- "uni22670338",
- "uni2A7E0338",
- "uni2A7D0338",
- "uni22660338",
- NULL,
- "uni2224.short",
- "uni2226.short",
- "uni228220D2",
- "uni228620D2",
- "uni2AC50338",
- "uni228320D2",
- "uni2AC60338",
- "uni228720D2",
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- "uni2ACBFE00",
- "uni228AFE00",
- "uni228BFE00",
- "uni2ACCFE00",
- "uni224B0338",
- NULL,
- NULL,
- NULL,
- NULL,
- "uni226420D2",
- "uni226520D2",
- "uni003C20D2",
- "uni003E20D2",
- "uni2A6D0338",
- "uni224820D2",
- "uni2A700338",
- NULL,
- "uni2AA120D2",
- "uni2AA220D2",
- "uni226A0338",
- "uni226B0338",
- "uni22D80338",
- "uni22D90338",
- "uni22B520D2",
- "uni22B420D2",
- NULL,
- NULL,
- NULL,
- "uni006A.dotless",
- "uni210F.var",
- NULL,
- NULL,
- "uni222020D2",
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL
-};
-
-static const char *ams_p0_be3[] = {
- NULL,
- "uni2223.short",
- "uni2225.short",
- NULL,
- NULL,
- NULL,
- "uni2248.bold",
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- "uni22DAFE00",
- "uni22DBFE00",
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- "uni2AACFE00",
- "uni2AADFE00",
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- "uni220B20D2",
- "uni220D0338",
- NULL,
- NULL,
- "uni220820D2",
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- "uni2A15.up",
- "uni2A16.up",
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- "uni226120E5",
- "uni003D20E5",
- "uni2AFD20E5",
- "uni22500338",
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- "uni22020338",
- NULL,
- NULL,
- NULL,
- NULL,
- "uni2A10.up",
- NULL,
- "uni2A12.up",
- "uni2A13.up",
- "uni2A14.up",
- "uni2A17.up",
- "uni2A11.up",
- NULL,
- "uni22F50338",
- NULL,
- "uni22F90338",
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- "uni2026.em",
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- "uni220A0338",
- "uni227320D2",
- "uni227220D2",
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- "uni223E.reversed",
- NULL,
- NULL,
- NULL,
- NULL,
- "uni0265.superscript",
- "uni0252.superscript",
- NULL,
- NULL,
- NULL,
- "uni2A0F.up",
- NULL,
- NULL,
- NULL,
- NULL,
- "uni2A9B20D2",
- "uni2A9C20D2",
- "uni2A9B0338",
- "uni2A9C0338",
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL
-};
-
-static const char *ams_p0_be4[] = {
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- "uni223E.var",
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- "uni223C20D2",
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL
-};
-
-static const char *ams_p0_be5[] = {
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- "uni2A3CFE00",
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- "uni2AAF0338",
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- "uni224220D2",
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- "uni2AB00338",
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL
-};
-
-static const char *ams_p0_be6[] = {
- NULL,
- NULL,
- NULL,
- NULL,
- "uni228F0338",
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- "uni22900338",
- "uni224E0338",
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- "uni2205.var",
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- "uni0077.subscript",
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- "uni1D0B.reversed",
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- "uni025102DE",
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- "uni025B02DE",
- "uni025402DE",
- NULL,
- "uni03C9.inverted",
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- "uni297D.var",
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- "uni223C.bold",
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL
-};
-
-static const char *ams_p0_be8[] = {
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- "uni227E0338",
- "uni227F0338",
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- "uni2216.var",
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- "uni224F0338",
- "uni22420338",
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL
-};
-
-static const char *ams_p0_bea[] = {
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- "uni00730336",
- NULL,
- "uni006C0321",
- NULL,
- NULL,
- "uni03040304",
- NULL,
- NULL,
- "uni229CFE00",
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- "uni03020302",
- NULL,
- "uni03030303",
- "uni033103310331",
- "uni0331033103310331",
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- "uni03070302",
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- "uni03040303",
- "uni03310330",
- "uni03040308",
- "uni03300331",
- NULL,
- "uni00640321",
- "uni00680321",
- "uni006B0321",
- "uni00780321",
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- "uni00730321",
- "uni007A0321",
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- "uni2034.notsup",
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- "uni2A0B.up",
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- "uni227620D2",
- "uni227720D2",
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL
-};
-
-static const char *ams_p0_bec[] = {
- NULL,
- NULL,
- "uni2A3DFE00",
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL
-};
-
-static const char *ams_p0_bed[] = {
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- "uni220A20D2",
- "uni220D20D2",
- "uni22F60338",
- "uni22FD0338",
- "uni22F620D2",
- "uni22FD20D2",
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- "uni2295FE00",
- "uni2297FE00",
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- "uni224320D2",
- "uni224520D2",
- NULL,
- "uni2A6C0338",
- "uni2A6C20D2",
- "uni2A7020D2",
- "uni224D20D2",
- "uni223F.reversed",
- "uni003D20D2",
- NULL,
- "uni226120D2",
- "uni22630338",
- "uni226320D2",
- NULL,
- NULL,
- "uni2A7D20D2",
- "uni2A7E20D2",
- "uni226620D2",
- "uni226720D2",
- "uni2A950338",
- "uni2A960338",
- "uni2A9520D2",
- "uni2A9620D2",
- NULL,
- NULL,
- NULL,
- NULL,
- "uni2A990338",
- "uni2A9A0338",
- "uni2A9920D2",
- "uni2A9A20D2",
- "uni2272FE00",
- "uni2273FE00",
- "uni2A9DFE00",
- "uni2A9EFE00",
- NULL,
- NULL,
- "uni227A20D2",
- "uni227B20D2",
- "uni227C20D2",
- "uni227D20D2",
- "uni22DE20D2",
- "uni22DF20D2",
- "uni22DE0338",
- "uni22DF0338",
- NULL,
- NULL,
- NULL,
- NULL,
- "uni2AC520D2",
- "uni2AC620D2",
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- "uni2AF40338",
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- "uni2A0A.lgdisplay",
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- "uni220A.narrow",
- "uni220D.narrow",
- NULL,
- "u1D6FB.narrow",
- "uni002820090029",
- "uni002822C50029",
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL
-};
-
-static const char *ams_p0_bee[] = {
- "stixEE00",
- "stixEE01",
- "stixEE02",
- "stixEE03",
- "stixEE04",
- "stixEE05",
- "stixEE06",
- "stixEE07",
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- "stixEE10",
- "stixEE11",
- "stixEE12",
- "stixEE13",
- "stixEE14",
- "stixEE15",
- "stixEE16",
- "stixEE17",
- "stixEE18",
- "stixEE19",
- "stixEE1A",
- "stixEE1B",
- "stixEE1C",
- "stixEE1D",
- "stixEE1E",
- "stixEE1F",
- "stixEE20",
- "stixEE21",
- "stixEE22",
- "stixEE23",
- "stixEE24",
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- "stixEE30",
- "stixEE31",
- "stixEE32",
- "stixEE33",
- "stixEE34",
- "stixEE35",
- "stixEE36",
- "stixEE37",
- "stixEE38",
- "stixEE39",
- "stixEE3A",
- "stixEE3B",
- "stixEE3C",
- "stixEE3D",
- "stixEE3E",
- NULL,
- "stixEE40",
- "stixEE41",
- "stixEE42",
- "stixEE43",
- "stixEE44",
- "stixEE45",
- "stixEE46",
- "stixEE47",
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- "stixEE50",
- "stixEE51",
- "stixEE52",
- "stixEE53",
- "stixEE54",
- "stixEE55",
- "stixEE56",
- "stixEE57",
- "stixEE58",
- "stixEE59",
- "stixEE5A",
- "stixEE5B",
- "stixEE5C",
- "stixEE5D",
- "stixEE5E",
- "stixEE5F",
- "stixEE60",
- "stixEE61",
- "stixEE62",
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- "stixEE70",
- "stixEE71",
- "stixEE72",
- "stixEE73",
- "stixEE74",
- "stixEE75",
- "stixEE76",
- "stixEE77",
- "stixEE78",
- "stixEE79",
- "stixEE7A",
- "stixEE7B",
- "stixEE7C",
- "stixEE7D",
- "stixEE7E",
- "stixEE7F",
- "stixEE80",
- "stixEE81",
- "stixEE82",
- "stixEE83",
- "stixEE84",
- "stixEE85",
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- "stixEE90",
- "stixEE91",
- "stixEE92",
- "stixEE93",
- "stixEE94",
- "stixEE95",
- "stixEE96",
- "stixEE97",
- "stixEE98",
- "stixEE99",
- "stixEE9A",
- "stixEE9B",
- "stixEE9C",
- "stixEE9D",
- "stixEE9E",
- "stixEE9F",
- "stixEEA0",
- "stixEEA1",
- "stixEEA2",
- "stixEEA3",
- "stixEEA4",
- "stixEEA5",
- "stixEEA6",
- "stixEEA7",
- "stixEEA8",
- "stixEEA9",
- "stixEEAA",
- "stixEEAB",
- "stixEEAC",
- NULL,
- NULL,
- NULL,
- "stixEEB0",
- "stixEEB1",
- "stixEEB2",
- "stixEEB3",
- "stixEEB4",
- "stixEEB5",
- "stixEEB6",
- "stixEEB7",
- "stixEEB8",
- "stixEEB9",
- "stixEEBA",
- "stixEEBB",
- "stixEEBC",
- "stixEEBD",
- "stixEEBE",
- "stixEEBF",
- "stixEEC0",
- "stixEEC1",
- "stixEEC2",
- "stixEEC3",
- "stixEEC4",
- "stixEEC5",
- "stixEEC6",
- "stixEEC7",
- "stixEEC8",
- "stixEEC9",
- "stixEECA",
- "stixEECB",
- NULL,
- "stixEECD",
- "stixEECE",
- "stixEECF",
- "stixEED0",
- "stixEED1",
- "stixEED2",
- "stixEED3",
- "stixEED4",
- "stixEED5",
- "stixEED6",
- "stixEED7",
- "stixEED8",
- "stixEED9",
- "stixEEDA",
- "stixEEDB",
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL
-};
-
-static const char *ams_p0_bf4[] = {
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- "uni29CF0338",
- "uni29D00338",
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- "uni2AA10338",
- NULL,
- NULL,
- NULL,
- NULL,
- "uni2AA20338",
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL
-};
-
-static const char *ams_p0_bf5[] = {
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- "uni2191.short",
- "uni2193.short",
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL
-};
-
-static const char **ams_p0[] = {
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- ams_p0_be2,
- ams_p0_be3,
- ams_p0_be4,
- ams_p0_be5,
- ams_p0_be6,
- NULL,
- ams_p0_be8,
- NULL,
- ams_p0_bea,
- NULL,
- ams_p0_bec,
- ams_p0_bed,
- ams_p0_bee,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- ams_p0_bf4,
- ams_p0_bf5,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL
-};
-
-static NameList ams = {
- &tex,
- N_("AMS Names"),
- { ams_p0, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL },
- NULL, 0, 0, NULL
-};
-/* ************************************************************************** */
-static struct psaltnames psaltnames[] = {
- { "AEmacron", 0x01e2 , 0 },
- { "AEsmall", 0xf7e6 , 0 },
- { "Aacutesmall", 0xf7e1 , 0 },
- { "Abreveacute", 0x1eae , 0 },
- { "Abrevecyrillic", 0x04d0 , 0 },
- { "Abrevedotbelow", 0x1eb6 , 0 },
- { "Abrevegrave", 0x1eb0 , 0 },
- { "Abrevehookabove", 0x1eb2 , 0 },
- { "Abrevetilde", 0x1eb4 , 0 },
- { "Acaron", 0x01cd , 0 },
- { "Acircle", 0x24b6 , 0 },
- { "Acircumflexacute", 0x1ea4 , 0 },
- { "Acircumflexdotbelow", 0x1eac , 0 },
- { "Acircumflexgrave", 0x1ea6 , 0 },
- { "Acircumflexhookabove", 0x1ea8 , 0 },
- { "Acircumflexsmall", 0xf7e2 , 0 },
- { "Acircumflextilde", 0x1eaa , 0 },
- { "Acute", 0xf6c9 , 0 },
- { "Acutesmall", 0xf7b4 , 0 },
- { "Acyrillic", 0x0410 , 0 },
- { "Adblgrave", 0x0200 , 0 },
- { "Adieresiscyrillic", 0x04d2 , 0 },
- { "Adieresismacron", 0x01de , 0 },
- { "Adieresissmall", 0xf7e4 , 0 },
- { "Adotbelow", 0x1ea0 , 0 },
- { "Adotmacron", 0x01e0 , 0 },
- { "Agravesmall", 0xf7e0 , 0 },
- { "Ahookabove", 0x1ea2 , 0 },
- { "Aiecyrillic", 0x04d4 , 0 },
- { "Ainvertedbreve", 0x0202 , 0 },
- { "Amonospace", 0xff21 , 0 },
- { "Aringbelow", 0x1e00 , 0 },
- { "Aringsmall", 0xf7e5 , 0 },
- { "Asmall", 0xf761 , 0 },
- { "Atildesmall", 0xf7e3 , 0 },
- { "Aybarmenian", 0x0531 , 0 },
- { "Bcircle", 0x24b7 , 0 },
- { "Bdotaccent", 0x1e02 , 0 },
- { "Bdotbelow", 0x1e04 , 0 },
- { "Becyrillic", 0x0411 , 0 },
- { "Benarmenian", 0x0532 , 0 },
- { "Bhook", 0x0181 , 0 },
- { "Blinebelow", 0x1e06 , 0 },
- { "Bmonospace", 0xff22 , 0 },
- { "Brevesmall", 0xf6f4 , 0 },
- { "Bsmall", 0xf762 , 0 },
- { "Btopbar", 0x0182 , 0 },
- { "Caarmenian", 0x053e , 0 },
- { "Caron", 0xf6ca , 0 },
- { "Caronsmall", 0xf6f5 , 0 },
- { "Ccedillaacute", 0x1e08 , 0 },
- { "Ccedillasmall", 0xf7e7 , 0 },
- { "Ccircle", 0x24b8 , 0 },
- { "Cdot", 0x010a , 0 },
- { "Cedillasmall", 0xf7b8 , 0 },
- { "Chaarmenian", 0x0549 , 0 },
- { "Cheabkhasiancyrillic", 0x04bc , 0 },
- { "Checyrillic", 0x0427 , 0 },
- { "Chedescenderabkhasiancyrillic", 0x04be , 0 },
- { "Chedescendercyrillic", 0x04b6 , 0 },
- { "Chedieresiscyrillic", 0x04f4 , 0 },
- { "Cheharmenian", 0x0543 , 0 },
- { "Chekhakassiancyrillic", 0x04cb , 0 },
- { "Cheverticalstrokecyrillic", 0x04b8 , 0 },
- { "Chook", 0x0187 , 0 },
- { "Circumflexsmall", 0xf6f6 , 0 },
- { "Cmonospace", 0xff23 , 0 },
- { "Coarmenian", 0x0551 , 0 },
- { "Csmall", 0xf763 , 0 },
- { "DZ", 0x01f1 , 0 },
- { "DZcaron", 0x01c4 , 0 },
- { "Daarmenian", 0x0534 , 0 },
- { "Dafrican", 0x0189 , 0 },
- { "Dcedilla", 0x1e10 , 0 },
- { "Dcircle", 0x24b9 , 0 },
- { "Dcircumflexbelow", 0x1e12 , 0 },
- { "Ddotaccent", 0x1e0a , 0 },
- { "Ddotbelow", 0x1e0c , 0 },
- { "Decyrillic", 0x0414 , 0 },
- { "Deicoptic", 0x03ee , 0 },
- { "Deltagreek", 0x0394 , 0 },
- { "Dhook", 0x018a , 0 },
- { "Dieresis", 0xf6cb , 0 },
- { "diaeresis", 0x00a8 , 0 },
- { "Diaeresis", 0xf6cb , 0 },
- { "DieresisAcute", 0xf6cc , 0 },
- { "DieresisGrave", 0xf6cd , 0 },
- { "Dieresissmall", 0xf7a8 , 0 },
- { "Digammagreek", 0x03dc , 0 },
- { "Djecyrillic", 0x0402 , 0 },
- { "Dlinebelow", 0x1e0e , 0 },
- { "Dmonospace", 0xff24 , 0 },
- { "Dotaccentsmall", 0xf6f7 , 0 },
- { "Dslash", 0x0110 , 0 },
- { "Dsmall", 0xf764 , 0 },
- { "Dtopbar", 0x018b , 0 },
- { "Dz", 0x01f2 , 0 },
- { "Dzcaron", 0x01c5 , 0 },
- { "Dzeabkhasiancyrillic", 0x04e0 , 0 },
- { "Dzecyrillic", 0x0405 , 0 },
- { "Dzhecyrillic", 0x040f , 0 },
- { "Eacutesmall", 0xf7e9 , 0 },
- { "Ecedillabreve", 0x1e1c , 0 },
- { "Echarmenian", 0x0535 , 0 },
- { "Ecircle", 0x24ba , 0 },
- { "Ecircumflexacute", 0x1ebe , 0 },
- { "Ecircumflexbelow", 0x1e18 , 0 },
- { "Ecircumflexdotbelow", 0x1ec6 , 0 },
- { "Ecircumflexgrave", 0x1ec0 , 0 },
- { "Ecircumflexhookabove", 0x1ec2 , 0 },
- { "Ecircumflexsmall", 0xf7ea , 0 },
- { "Ecircumflextilde", 0x1ec4 , 0 },
- { "Ecyrillic", 0x0404 , 0 },
- { "Edblgrave", 0x0204 , 0 },
- { "Edieresissmall", 0xf7eb , 0 },
- { "Edot", 0x0116 , 0 },
- { "Edotbelow", 0x1eb8 , 0 },
- { "Efcyrillic", 0x0424 , 0 },
- { "Egravesmall", 0xf7e8 , 0 },
- { "Eharmenian", 0x0537 , 0 },
- { "Ehookabove", 0x1eba , 0 },
- { "Eightroman", 0x2167 , 0 },
- { "Einvertedbreve", 0x0206 , 0 },
- { "Eiotifiedcyrillic", 0x0464 , 0 },
- { "Elcyrillic", 0x041b , 0 },
- { "Elevenroman", 0x216a , 0 },
- { "Emacronacute", 0x1e16 , 0 },
- { "Emacrongrave", 0x1e14 , 0 },
- { "Emcyrillic", 0x041c , 0 },
- { "Emonospace", 0xff25 , 0 },
- { "Encyrillic", 0x041d , 0 },
- { "Endescendercyrillic", 0x04a2 , 0 },
- { "Enghecyrillic", 0x04a4 , 0 },
- { "Enhookcyrillic", 0x04c7 , 0 },
- { "Eopen", 0x0190 , 0 },
- { "Ercyrillic", 0x0420 , 0 },
- { "Ereversed", 0x018e , 0 },
- { "Ereversedcyrillic", 0x042d , 0 },
- { "Escyrillic", 0x0421 , 0 },
- { "Esdescendercyrillic", 0x04aa , 0 },
- { "Esh", 0x01a9 , 0 },
- { "Esmall", 0xf765 , 0 },
- { "Etarmenian", 0x0538 , 0 },
- { "Ethsmall", 0xf7f0 , 0 },
- { "Etilde", 0x1ebc , 0 },
- { "Etildebelow", 0x1e1a , 0 },
- { "Ezh", 0x01b7 , 0 },
- { "Ezhcaron", 0x01ee , 0 },
- { "Ezhreversed", 0x01b8 , 0 },
- { "Fcircle", 0x24bb , 0 },
- { "Fdotaccent", 0x1e1e , 0 },
- { "Feharmenian", 0x0556 , 0 },
- { "Feicoptic", 0x03e4 , 0 },
- { "Fhook", 0x0191 , 0 },
- { "Fitacyrillic", 0x0472 , 0 },
- { "Fiveroman", 0x2164 , 0 },
- { "Fmonospace", 0xff26 , 0 },
- { "Fourroman", 0x2163 , 0 },
- { "Fsmall", 0xf766 , 0 },
- { "GBsquare", 0x3387 , 0 },
- { "Gacute", 0x01f4 , 0 },
- { "Gammaafrican", 0x0194 , 0 },
- { "Gangiacoptic", 0x03ea , 0 },
- { "Gcedilla", 0x0122 , 0 },
- { "Gcircle", 0x24bc , 0 },
- { "Gdot", 0x0120 , 0 },
- { "Gecyrillic", 0x0413 , 0 },
- { "Ghadarmenian", 0x0542 , 0 },
- { "Ghemiddlehookcyrillic", 0x0494 , 0 },
- { "Ghestrokecyrillic", 0x0492 , 0 },
- { "Gheupturncyrillic", 0x0490 , 0 },
- { "Ghook", 0x0193 , 0 },
- { "Gimarmenian", 0x0533 , 0 },
- { "Gjecyrillic", 0x0403 , 0 },
- { "Gmacron", 0x1e20 , 0 },
- { "Gmonospace", 0xff27 , 0 },
- { "Grave", 0xf6ce , 0 },
- { "Gravesmall", 0xf760 , 0 },
- { "Gsmall", 0xf767 , 0 },
- { "Gsmallhook", 0x029b , 0 },
- { "Gstroke", 0x01e4 , 0 },
- { "HPsquare", 0x33cb , 0 },
- { "Haabkhasiancyrillic", 0x04a8 , 0 },
- { "Hadescendercyrillic", 0x04b2 , 0 },
- { "Hardsigncyrillic", 0x042a , 0 },
- { "Hbrevebelow", 0x1e2a , 0 },
- { "Hcedilla", 0x1e28 , 0 },
- { "Hcircle", 0x24bd , 0 },
- { "Hdieresis", 0x1e26 , 0 },
- { "Hdotaccent", 0x1e22 , 0 },
- { "Hdotbelow", 0x1e24 , 0 },
- { "Hmonospace", 0xff28 , 0 },
- { "Hoarmenian", 0x0540 , 0 },
- { "Horicoptic", 0x03e8 , 0 },
- { "Hsmall", 0xf768 , 0 },
- { "Hungarumlaut", 0xf6cf , 0 },
- { "Hungarumlautsmall", 0xf6f8 , 0 },
- { "Hzsquare", 0x3390 , 0 },
- { "IAcyrillic", 0x042f , 0 },
- { "IUcyrillic", 0x042e , 0 },
- { "Iacutesmall", 0xf7ed , 0 },
- { "Icaron", 0x01cf , 0 },
- { "Icircle", 0x24be , 0 },
- { "Icircumflexsmall", 0xf7ee , 0 },
- { "Icyrillic", 0x0406 , 0 },
- { "Idblgrave", 0x0208 , 0 },
- { "Idieresisacute", 0x1e2e , 0 },
- { "Idieresiscyrillic", 0x04e4 , 0 },
- { "Idieresissmall", 0xf7ef , 0 },
- { "Idot", 0x0130 , 0 },
- { "Idotbelow", 0x1eca , 0 },
- { "Iebrevecyrillic", 0x04d6 , 0 },
- { "Iecyrillic", 0x0415 , 0 },
- { "Igravesmall", 0xf7ec , 0 },
- { "Ihookabove", 0x1ec8 , 0 },
- { "Iicyrillic", 0x0418 , 0 },
- { "Iinvertedbreve", 0x020a , 0 },
- { "Iishortcyrillic", 0x0419 , 0 },
- { "Imacroncyrillic", 0x04e2 , 0 },
- { "Imonospace", 0xff29 , 0 },
- { "Iniarmenian", 0x053b , 0 },
- { "Iocyrillic", 0x0401 , 0 },
- { "Iotaafrican", 0x0196 , 0 },
- { "Ismall", 0xf769 , 0 },
- { "Istroke", 0x0197 , 0 },
- { "Itildebelow", 0x1e2c , 0 },
- { "Izhitsacyrillic", 0x0474 , 0 },
- { "Izhitsadblgravecyrillic", 0x0476 , 0 },
- { "Jaarmenian", 0x0541 , 0 },
- { "Jcircle", 0x24bf , 0 },
- { "Jecyrillic", 0x0408 , 0 },
- { "Jheharmenian", 0x054b , 0 },
- { "Jmonospace", 0xff2a , 0 },
- { "Jsmall", 0xf76a , 0 },
- { "KBsquare", 0x3385 , 0 },
- { "KKsquare", 0x33cd , 0 },
- { "Kabashkircyrillic", 0x04a0 , 0 },
- { "Kacute", 0x1e30 , 0 },
- { "Kacyrillic", 0x041a , 0 },
- { "Kadescendercyrillic", 0x049a , 0 },
- { "Kahookcyrillic", 0x04c3 , 0 },
- { "Kastrokecyrillic", 0x049e , 0 },
- { "Kaverticalstrokecyrillic", 0x049c , 0 },
- { "Kcaron", 0x01e8 , 0 },
- { "Kcedilla", 0x0136 , 0 },
- { "Kcircle", 0x24c0 , 0 },
- { "Kdotbelow", 0x1e32 , 0 },
- { "Keharmenian", 0x0554 , 0 },
- { "Kenarmenian", 0x053f , 0 },
- { "Khacyrillic", 0x0425 , 0 },
- { "Kheicoptic", 0x03e6 , 0 },
- { "Khook", 0x0198 , 0 },
- { "Kjecyrillic", 0x040c , 0 },
- { "Klinebelow", 0x1e34 , 0 },
- { "Kmonospace", 0xff2b , 0 },
- { "Koppacyrillic", 0x0480 , 0 },
- { "Koppagreek", 0x03de , 0 },
- { "Ksicyrillic", 0x046e , 0 },
- { "Ksmall", 0xf76b , 0 },
- { "LJ", 0x01c7 , 0 },
- { "LL", 0xf6bf , 0 },
- { "Lcedilla", 0x013b , 0 },
- { "Lcircle", 0x24c1 , 0 },
- { "Lcircumflexbelow", 0x1e3c , 0 },
- { "Ldotaccent", 0x013f , 0 },
- { "Ldotbelow", 0x1e36 , 0 },
- { "Ldotbelowmacron", 0x1e38 , 0 },
- { "Liwnarmenian", 0x053c , 0 },
- { "Lj", 0x01c8 , 0 },
- { "Ljecyrillic", 0x0409 , 0 },
- { "Llinebelow", 0x1e3a , 0 },
- { "Lmonospace", 0xff2c , 0 },
- { "Lslashsmall", 0xf6f9 , 0 },
- { "Lsmall", 0xf76c , 0 },
- { "MBsquare", 0x3386 , 0 },
- { "Macron", 0xf6d0 , 0 },
- { "Macronsmall", 0xf7af , 0 },
- { "Macute", 0x1e3e , 0 },
- { "Mcircle", 0x24c2 , 0 },
- { "Mdotaccent", 0x1e40 , 0 },
- { "Mdotbelow", 0x1e42 , 0 },
- { "Menarmenian", 0x0544 , 0 },
- { "Mmonospace", 0xff2d , 0 },
- { "Msmall", 0xf76d , 0 },
- { "Mturned", 0x019c , 0 },
- { "NJ", 0x01ca , 0 },
- { "Ncedilla", 0x0145 , 0 },
- { "Ncircle", 0x24c3 , 0 },
- { "Ncircumflexbelow", 0x1e4a , 0 },
- { "Ndotaccent", 0x1e44 , 0 },
- { "Ndotbelow", 0x1e46 , 0 },
- { "Nhookleft", 0x019d , 0 },
- { "Nineroman", 0x2168 , 0 },
- { "Nj", 0x01cb , 0 },
- { "Njecyrillic", 0x040a , 0 },
- { "Nlinebelow", 0x1e48 , 0 },
- { "Nmonospace", 0xff2e , 0 },
- { "Nowarmenian", 0x0546 , 0 },
- { "Nsmall", 0xf76e , 0 },
- { "Ntildesmall", 0xf7f1 , 0 },
- { "OEsmall", 0xf6fa , 0 },
- { "Oacutesmall", 0xf7f3 , 0 },
- { "Obarredcyrillic", 0x04e8 , 0 },
- { "Obarreddieresiscyrillic", 0x04ea , 0 },
- { "Ocaron", 0x01d1 , 0 },
- { "Ocenteredtilde", 0x019f , 0 },
- { "Ocircle", 0x24c4 , 0 },
- { "Ocircumflexacute", 0x1ed0 , 0 },
- { "Ocircumflexdotbelow", 0x1ed8 , 0 },
- { "Ocircumflexgrave", 0x1ed2 , 0 },
- { "Ocircumflexhookabove", 0x1ed4 , 0 },
- { "Ocircumflexsmall", 0xf7f4 , 0 },
- { "Ocircumflextilde", 0x1ed6 , 0 },
- { "Ocyrillic", 0x041e , 0 },
- { "Odblacute", 0x0150 , 0 },
- { "Odblgrave", 0x020c , 0 },
- { "Odieresiscyrillic", 0x04e6 , 0 },
- { "Odieresissmall", 0xf7f6 , 0 },
- { "Odotbelow", 0x1ecc , 0 },
- { "Ogoneksmall", 0xf6fb , 0 },
- { "Ogravesmall", 0xf7f2 , 0 },
- { "Oharmenian", 0x0555 , 0 },
- { "Ohm", 0x2126 , 0 },
- { "Ohookabove", 0x1ece , 0 },
- { "Ohornacute", 0x1eda , 0 },
- { "Ohorndotbelow", 0x1ee2 , 0 },
- { "Ohorngrave", 0x1edc , 0 },
- { "Ohornhookabove", 0x1ede , 0 },
- { "Ohorntilde", 0x1ee0 , 0 },
- { "Oi", 0x01a2 , 0 },
- { "Oinvertedbreve", 0x020e , 0 },
- { "Omacronacute", 0x1e52 , 0 },
- { "Omacrongrave", 0x1e50 , 0 },
- { "Omegacyrillic", 0x0460 , 0 },
- { "Omegagreek", 0x03a9 , 0 },
- { "Omegaroundcyrillic", 0x047a , 0 },
- { "Omegatitlocyrillic", 0x047c , 0 },
- { "Omonospace", 0xff2f , 0 },
- { "Oneroman", 0x2160 , 0 },
- { "Oogonek", 0x01ea , 0 },
- { "Oogonekmacron", 0x01ec , 0 },
- { "Oopen", 0x0186 , 0 },
- { "Oslashsmall", 0xf7f8 , 0 },
- { "Osmall", 0xf76f , 0 },
- { "Ostrokeacute", 0x01fe , 0 },
- { "Otcyrillic", 0x047e , 0 },
- { "Otildeacute", 0x1e4c , 0 },
- { "Otildedieresis", 0x1e4e , 0 },
- { "Otildesmall", 0xf7f5 , 0 },
- { "Pacute", 0x1e54 , 0 },
- { "Pcircle", 0x24c5 , 0 },
- { "Pdotaccent", 0x1e56 , 0 },
- { "Pecyrillic", 0x041f , 0 },
- { "Peharmenian", 0x054a , 0 },
- { "Pemiddlehookcyrillic", 0x04a6 , 0 },
- { "Phook", 0x01a4 , 0 },
- { "Piwrarmenian", 0x0553 , 0 },
- { "Pmonospace", 0xff30 , 0 },
- { "Psicyrillic", 0x0470 , 0 },
- { "Psmall", 0xf770 , 0 },
- { "Qcircle", 0x24c6 , 0 },
- { "Qmonospace", 0xff31 , 0 },
- { "Qsmall", 0xf771 , 0 },
- { "Raarmenian", 0x054c , 0 },
- { "Rcedilla", 0x0156 , 0 },
- { "Rcircle", 0x24c7 , 0 },
- { "Rdblgrave", 0x0210 , 0 },
- { "Rdotaccent", 0x1e58 , 0 },
- { "Rdotbelow", 0x1e5a , 0 },
- { "Rdotbelowmacron", 0x1e5c , 0 },
- { "Reharmenian", 0x0550 , 0 },
- { "Ringsmall", 0xf6fc , 0 },
- { "Rinvertedbreve", 0x0212 , 0 },
- { "Rlinebelow", 0x1e5e , 0 },
- { "Rmonospace", 0xff32 , 0 },
- { "Rsmall", 0xf772 , 0 },
- { "Rsmallinverted", 0x0281 , 0 },
- { "Rsmallinvertedsuperior", 0x02b6 , 0 },
- { "Sacutedotaccent", 0x1e64 , 0 },
- { "Sampigreek", 0x03e0 , 0 },
- { "Scarondotaccent", 0x1e66 , 0 },
- { "Scaronsmall", 0xf6fd , 0 },
- { "Schwa", 0x018f , 0 },
- { "Schwacyrillic", 0x04d8 , 0 },
- { "Schwadieresiscyrillic", 0x04da , 0 },
- { "Scircle", 0x24c8 , 0 },
- { "Sdotaccent", 0x1e60 , 0 },
- { "Sdotbelow", 0x1e62 , 0 },
- { "Sdotbelowdotaccent", 0x1e68 , 0 },
- { "Seharmenian", 0x054d , 0 },
- { "Sevenroman", 0x2166 , 0 },
- { "Shaarmenian", 0x0547 , 0 },
- { "Shacyrillic", 0x0428 , 0 },
- { "Shchacyrillic", 0x0429 , 0 },
- { "Sheicoptic", 0x03e2 , 0 },
- { "Shhacyrillic", 0x04ba , 0 },
- { "Shimacoptic", 0x03ec , 0 },
- { "Sixroman", 0x2165 , 0 },
- { "Smonospace", 0xff33 , 0 },
- { "Softsigncyrillic", 0x042c , 0 },
- { "Ssmall", 0xf773 , 0 },
- { "Stigmagreek", 0x03da , 0 },
- { "Tcedilla", 0x0162 , 0 },
- { "Tcircle", 0x24c9 , 0 },
- { "Tcircumflexbelow", 0x1e70 , 0 },
- { "Tdotaccent", 0x1e6a , 0 },
- { "Tdotbelow", 0x1e6c , 0 },
- { "Tecyrillic", 0x0422 , 0 },
- { "Tedescendercyrillic", 0x04ac , 0 },
- { "Tenroman", 0x2169 , 0 },
- { "Tetsecyrillic", 0x04b4 , 0 },
- { "Thook", 0x01ac , 0 },
- { "Thornsmall", 0xf7fe , 0 },
- { "Threeroman", 0x2162 , 0 },
- { "Tildesmall", 0xf6fe , 0 },
- { "Tiwnarmenian", 0x054f , 0 },
- { "Tlinebelow", 0x1e6e , 0 },
- { "Tmonospace", 0xff34 , 0 },
- { "Toarmenian", 0x0539 , 0 },
- { "Tonefive", 0x01bc , 0 },
- { "Tonesix", 0x0184 , 0 },
- { "Tonetwo", 0x01a7 , 0 },
- { "Tretroflexhook", 0x01ae , 0 },
- { "Tsecyrillic", 0x0426 , 0 },
- { "Tshecyrillic", 0x040b , 0 },
- { "Tsmall", 0xf774 , 0 },
- { "Twelveroman", 0x216b , 0 },
- { "Tworoman", 0x2161 , 0 },
- { "Uacutesmall", 0xf7fa , 0 },
- { "Ucaron", 0x01d3 , 0 },
- { "Ucircle", 0x24ca , 0 },
- { "Ucircumflexbelow", 0x1e76 , 0 },
- { "Ucircumflexsmall", 0xf7fb , 0 },
- { "Ucyrillic", 0x0423 , 0 },
- { "Udblacute", 0x0170 , 0 },
- { "Udblgrave", 0x0214 , 0 },
- { "Udieresisacute", 0x01d7 , 0 },
- { "Udieresisbelow", 0x1e72 , 0 },
- { "Udieresiscaron", 0x01d9 , 0 },
- { "Udieresiscyrillic", 0x04f0 , 0 },
- { "Udieresisgrave", 0x01db , 0 },
- { "Udieresismacron", 0x01d5 , 0 },
- { "Udieresissmall", 0xf7fc , 0 },
- { "Udotbelow", 0x1ee4 , 0 },
- { "Ugravesmall", 0xf7f9 , 0 },
- { "Uhookabove", 0x1ee6 , 0 },
- { "Uhornacute", 0x1ee8 , 0 },
- { "Uhorndotbelow", 0x1ef0 , 0 },
- { "Uhorngrave", 0x1eea , 0 },
- { "Uhornhookabove", 0x1eec , 0 },
- { "Uhorntilde", 0x1eee , 0 },
- { "Uhungarumlautcyrillic", 0x04f2 , 0 },
- { "Uinvertedbreve", 0x0216 , 0 },
- { "Ukcyrillic", 0x0478 , 0 },
- { "Umacroncyrillic", 0x04ee , 0 },
- { "Umacrondieresis", 0x1e7a , 0 },
- { "Umonospace", 0xff35 , 0 },
- { "Upsilonacutehooksymbolgreek", 0x03d3 , 0 },
- { "Upsilonafrican", 0x01b1 , 0 },
- { "Upsilondieresishooksymbolgreek", 0x03d4 , 0 },
- { "Upsilonhooksymbol", 0x03d2 , 0 },
- { "Ushortcyrillic", 0x040e , 0 },
- { "Usmall", 0xf775 , 0 },
- { "Ustraightcyrillic", 0x04ae , 0 },
- { "Ustraightstrokecyrillic", 0x04b0 , 0 },
- { "Utildeacute", 0x1e78 , 0 },
- { "Utildebelow", 0x1e74 , 0 },
- { "Vcircle", 0x24cb , 0 },
- { "Vdotbelow", 0x1e7e , 0 },
- { "Vecyrillic", 0x0412 , 0 },
- { "Vewarmenian", 0x054e , 0 },
- { "Vhook", 0x01b2 , 0 },
- { "Vmonospace", 0xff36 , 0 },
- { "Voarmenian", 0x0548 , 0 },
- { "Vsmall", 0xf776 , 0 },
- { "Vtilde", 0x1e7c , 0 },
- { "Wcircle", 0x24cc , 0 },
- { "Wdotaccent", 0x1e86 , 0 },
- { "Wdotbelow", 0x1e88 , 0 },
- { "Wmonospace", 0xff37 , 0 },
- { "Wsmall", 0xf777 , 0 },
- { "Xcircle", 0x24cd , 0 },
- { "Xdieresis", 0x1e8c , 0 },
- { "Xdotaccent", 0x1e8a , 0 },
- { "Xeharmenian", 0x053d , 0 },
- { "Xmonospace", 0xff38 , 0 },
- { "Xsmall", 0xf778 , 0 },
- { "Yacutesmall", 0xf7fd , 0 },
- { "Yatcyrillic", 0x0462 , 0 },
- { "Ycircle", 0x24ce , 0 },
- { "Ydieresissmall", 0xf7ff , 0 },
- { "Ydotaccent", 0x1e8e , 0 },
- { "Ydotbelow", 0x1ef4 , 0 },
- { "Yericyrillic", 0x042b , 0 },
- { "Yerudieresiscyrillic", 0x04f8 , 0 },
- { "Yhook", 0x01b3 , 0 },
- { "Yhookabove", 0x1ef6 , 0 },
- { "Yiarmenian", 0x0545 , 0 },
- { "Yicyrillic", 0x0407 , 0 },
- { "Yiwnarmenian", 0x0552 , 0 },
- { "Ymonospace", 0xff39 , 0 },
- { "Ysmall", 0xf779 , 0 },
- { "Ytilde", 0x1ef8 , 0 },
- { "Yusbigcyrillic", 0x046a , 0 },
- { "Yusbigiotifiedcyrillic", 0x046c , 0 },
- { "Yuslittlecyrillic", 0x0466 , 0 },
- { "Yuslittleiotifiedcyrillic", 0x0468 , 0 },
- { "Zaarmenian", 0x0536 , 0 },
- { "Zcaronsmall", 0xf6ff , 0 },
- { "Zcircle", 0x24cf , 0 },
- { "Zcircumflex", 0x1e90 , 0 },
- { "Zdot", 0x017b , 0 },
- { "Zdotbelow", 0x1e92 , 0 },
- { "Zecyrillic", 0x0417 , 0 },
- { "Zedescendercyrillic", 0x0498 , 0 },
- { "Zedieresiscyrillic", 0x04de , 0 },
- { "Zhearmenian", 0x053a , 0 },
- { "Zhebrevecyrillic", 0x04c1 , 0 },
- { "Zhecyrillic", 0x0416 , 0 },
- { "Zhedescendercyrillic", 0x0496 , 0 },
- { "Zhedieresiscyrillic", 0x04dc , 0 },
- { "Zlinebelow", 0x1e94 , 0 },
- { "Zmonospace", 0xff3a , 0 },
- { "Zsmall", 0xf77a , 0 },
- { "Zstroke", 0x01b5 , 0 },
- { "aabengali", 0x0986 , 0 },
- { "aadeva", 0x0906 , 0 },
- { "aagujarati", 0x0a86 , 0 },
- { "aagurmukhi", 0x0a06 , 0 },
- { "aamatragurmukhi", 0x0a3e , 0 },
- { "aarusquare", 0x3303 , 0 },
- { "aavowelsignbengali", 0x09be , 0 },
- { "aavowelsigndeva", 0x093e , 0 },
- { "aavowelsigngujarati", 0x0abe , 0 },
- { "abbreviationmarkarmenian", 0x055f , 0 },
- { "abbreviationsigndeva", 0x0970 , 0 },
- { "abengali", 0x0985 , 0 },
- { "abopomofo", 0x311a , 0 },
- { "abreveacute", 0x1eaf , 0 },
- { "abrevecyrillic", 0x04d1 , 0 },
- { "abrevedotbelow", 0x1eb7 , 0 },
- { "abrevegrave", 0x1eb1 , 0 },
- { "abrevehookabove", 0x1eb3 , 0 },
- { "abrevetilde", 0x1eb5 , 0 },
- { "acaron", 0x01ce , 0 },
- { "acircle", 0x24d0 , 0 },
- { "acircumflexacute", 0x1ea5 , 0 },
- { "acircumflexdotbelow", 0x1ead , 0 },
- { "acircumflexgrave", 0x1ea7 , 0 },
- { "acircumflexhookabove", 0x1ea9 , 0 },
- { "acircumflextilde", 0x1eab , 0 },
- { "acutebelowcmb", 0x0317 , 0 },
- { "acutecmb", 0x0301 , 0 },
- { "acutedeva", 0x0954 , 0 },
- { "acutelowmod", 0x02cf , 0 },
- { "acutetonecmb", 0x0341 , 0 },
- { "acyrillic", 0x0430 , 0 },
- { "adblgrave", 0x0201 , 0 },
- { "addakgurmukhi", 0x0a71 , 0 },
- { "adeva", 0x0905 , 0 },
- { "adieresiscyrillic", 0x04d3 , 0 },
- { "adieresismacron", 0x01df , 0 },
- { "adotbelow", 0x1ea1 , 0 },
- { "adotmacron", 0x01e1 , 0 },
- { "aekorean", 0x3150 , 0 },
- { "aemacron", 0x01e3 , 0 },
- { "afii08941", 0x20a4 , 0 },
- { "afii10063", 0xf6c4 , 0 },
- { "afii10064", 0xf6c5 , 0 },
- { "afii10192", 0xf6c6 , 0 },
- { "afii10831", 0xf6c7 , 0 },
- { "afii10832", 0xf6c8 , 0 },
- { "afii57694", 0xfb2a , 0 },
- { "afii57695", 0xfb2b , 0 },
- { "afii57700", 0xfb4b , 0 },
- { "afii57705", 0xfb1f , 0 },
- { "afii57723", 0xfb35 , 0 },
- { "agujarati", 0x0a85 , 0 },
- { "agurmukhi", 0x0a05 , 0 },
- { "ahiragana", 0x3042 , 0 },
- { "ahookabove", 0x1ea3 , 0 },
- { "aibengali", 0x0990 , 0 },
- { "aibopomofo", 0x311e , 0 },
- { "aideva", 0x0910 , 0 },
- { "aiecyrillic", 0x04d5 , 0 },
- { "aigujarati", 0x0a90 , 0 },
- { "aigurmukhi", 0x0a10 , 0 },
- { "aimatragurmukhi", 0x0a48 , 0 },
- { "ainarabic", 0x0639 , 0 },
- { "ainfinalarabic", 0xfeca , 0 },
- { "aininitialarabic", 0xfecb , 0 },
- { "ainmedialarabic", 0xfecc , 0 },
- { "ainvertedbreve", 0x0203 , 0 },
- { "aivowelsignbengali", 0x09c8 , 0 },
- { "aivowelsigndeva", 0x0948 , 0 },
- { "aivowelsigngujarati", 0x0ac8 , 0 },
- { "akatakana", 0x30a2 , 0 },
- { "akatakanahalfwidth", 0xff71 , 0 },
- { "akorean", 0x314f , 0 },
- { "alef", 0x05d0 , 0 },
- { "alefarabic", 0x0627 , 0 },
- { "alefdageshhebrew", 0xfb30 , 0 },
- { "aleffinalarabic", 0xfe8e , 0 },
- { "alefhamzaabovearabic", 0x0623 , 0 },
- { "alefhamzaabovefinalarabic", 0xfe84 , 0 },
- { "alefhamzabelowarabic", 0x0625 , 0 },
- { "alefhamzabelowfinalarabic", 0xfe88 , 0 },
- { "alefhebrew", 0x05d0 , 0 },
- { "aleflamedhebrew", 0xfb4f , 0 },
- { "alefmaddaabovearabic", 0x0622 , 0 },
- { "alefmaddaabovefinalarabic", 0xfe82 , 0 },
- { "alefmaksuraarabic", 0x0649 , 0 },
- { "alefmaksurafinalarabic", 0xfef0 , 0 },
- { "alefmaksurainitialarabic", 0xfef3 , 0 },
- { "alefmaksuramedialarabic", 0xfef4 , 0 },
- { "alefpatahhebrew", 0xfb2e , 0 },
- { "alefqamatshebrew", 0xfb2f , 0 },
- { "allequal", 0x224c , 0 },
- { "amonospace", 0xff41 , 0 },
- { "ampersandmonospace", 0xff06 , 0 },
- { "ampersandsmall", 0xf726 , 0 },
- { "amsquare", 0x33c2 , 0 },
- { "anbopomofo", 0x3122 , 0 },
- { "angbopomofo", 0x3124 , 0 },
- { "angkhankhuthai", 0x0e5a , 0 },
- { "anglebracketleft", 0x3008 , 0 },
- { "anglebracketleftvertical", 0xfe3f , 0 },
- { "anglebracketright", 0x3009 , 0 },
- { "anglebracketrightvertical", 0xfe40 , 0 },
- { "angstrom", 0x212b , 0 },
- { "anudattadeva", 0x0952 , 0 },
- { "anusvarabengali", 0x0982 , 0 },
- { "anusvaradeva", 0x0902 , 0 },
- { "anusvaragujarati", 0x0a82 , 0 },
- { "apaatosquare", 0x3300 , 0 },
- { "aparen", 0x249c , 0 },
- { "apostrophearmenian", 0x055a , 0 },
- { "apostrophemod", 0x02bc , 0 },
- { "apple", 0xf8ff , 0 },
- { "approaches", 0x2250 , 0 },
- { "approxequalorimage", 0x2252 , 0 },
- { "approximatelyequal", 0x2245 , 0 },
- { "araeaekorean", 0x318e , 0 },
- { "araeakorean", 0x318d , 0 },
- { "arc", 0x2312 , 0 },
- { "arighthalfring", 0x1e9a , 0 },
- { "aringbelow", 0x1e01 , 0 },
- { "arrowdashdown", 0x21e3 , 0 },
- { "arrowdashleft", 0x21e0 , 0 },
- { "arrowdashright", 0x21e2 , 0 },
- { "arrowdashup", 0x21e1 , 0 },
- { "arrowdownleft", 0x2199 , 0 },
- { "arrowdownright", 0x2198 , 0 },
- { "arrowdownwhite", 0x21e9 , 0 },
- { "arrowheaddownmod", 0x02c5 , 0 },
- { "arrowheadleftmod", 0x02c2 , 0 },
- { "arrowheadrightmod", 0x02c3 , 0 },
- { "arrowheadupmod", 0x02c4 , 0 },
- { "arrowhorizex", 0xf8e7 , 0 },
- { "arrowleftdbl", 0x21d0 , 0 },
- { "arrowleftdblstroke", 0x21cd , 0 },
- { "arrowleftoverright", 0x21c6 , 0 },
- { "arrowleftwhite", 0x21e6 , 0 },
- { "arrowrightdblstroke", 0x21cf , 0 },
- { "arrowrightheavy", 0x279e , 0 },
- { "arrowrightoverleft", 0x21c4 , 0 },
- { "arrowrightwhite", 0x21e8 , 0 },
- { "arrowtableft", 0x21e4 , 0 },
- { "arrowtabright", 0x21e5 , 0 },
- { "arrowupdownbase", 0x21a8 , 0 },
- { "arrowupleft", 0x2196 , 0 },
- { "arrowupleftofdown", 0x21c5 , 0 },
- { "arrowupright", 0x2197 , 0 },
- { "arrowupwhite", 0x21e7 , 0 },
- { "arrowvertex", 0xf8e6 , 0 },
- { "asciicircummonospace", 0xff3e , 0 },
- { "asciitildemonospace", 0xff5e , 0 },
- { "ascript", 0x0251 , 0 },
- { "ascriptturned", 0x0252 , 0 },
- { "asmallhiragana", 0x3041 , 0 },
- { "asmallkatakana", 0x30a1 , 0 },
- { "asmallkatakanahalfwidth", 0xff67 , 0 },
- { "asteriskaltonearabic", 0x066d , 0 },
- { "asteriskarabic", 0x066d , 0 },
- { "asteriskmonospace", 0xff0a , 0 },
- { "asterisksmall", 0xfe61 , 0 },
- { "asterism", 0x2042 , 0 },
- { "asuperior", 0xf6e9 , 0 },
- { "asymptoticallyequal", 0x2243 , 0 },
- { "atmonospace", 0xff20 , 0 },
- { "atsmall", 0xfe6b , 0 },
- { "aturned", 0x0250 , 0 },
- { "aubengali", 0x0994 , 0 },
- { "aubopomofo", 0x3120 , 0 },
- { "audeva", 0x0914 , 0 },
- { "augujarati", 0x0a94 , 0 },
- { "augurmukhi", 0x0a14 , 0 },
- { "aulengthmarkbengali", 0x09d7 , 0 },
- { "aumatragurmukhi", 0x0a4c , 0 },
- { "auvowelsignbengali", 0x09cc , 0 },
- { "auvowelsigndeva", 0x094c , 0 },
- { "auvowelsigngujarati", 0x0acc , 0 },
- { "avagrahadeva", 0x093d , 0 },
- { "aybarmenian", 0x0561 , 0 },
- { "ayin", 0x05e2 , 0 },
- { "ayinaltonehebrew", 0xfb20 , 0 },
- { "ayinhebrew", 0x05e2 , 0 },
- { "babengali", 0x09ac , 0 },
- { "backslashmonospace", 0xff3c , 0 },
- { "badeva", 0x092c , 0 },
- { "bagujarati", 0x0aac , 0 },
- { "bagurmukhi", 0x0a2c , 0 },
- { "bahiragana", 0x3070 , 0 },
- { "bahtthai", 0x0e3f , 0 },
- { "bakatakana", 0x30d0 , 0 },
- { "barmonospace", 0xff5c , 0 },
- { "bbopomofo", 0x3105 , 0 },
- { "bcircle", 0x24d1 , 0 },
- { "bdotaccent", 0x1e03 , 0 },
- { "bdotbelow", 0x1e05 , 0 },
- { "beamedsixteenthnotes", 0x266c , 0 },
- { "because", 0x2235 , 0 },
- { "becyrillic", 0x0431 , 0 },
- { "beharabic", 0x0628 , 0 },
- { "behfinalarabic", 0xfe90 , 0 },
- { "behinitialarabic", 0xfe91 , 0 },
- { "behiragana", 0x3079 , 0 },
- { "behmedialarabic", 0xfe92 , 0 },
- { "behmeeminitialarabic", 0xfc9f , 0 },
- { "behmeemisolatedarabic", 0xfc08 , 0 },
- { "behnoonfinalarabic", 0xfc6d , 0 },
- { "bekatakana", 0x30d9 , 0 },
- { "benarmenian", 0x0562 , 0 },
- { "bet", 0x05d1 , 0 },
- { "betasymbolgreek", 0x03d0 , 0 },
- { "betdagesh", 0xfb31 , 0 },
- { "betdageshhebrew", 0xfb31 , 0 },
- { "bethebrew", 0x05d1 , 0 },
- { "betrafehebrew", 0xfb4c , 0 },
- { "bhabengali", 0x09ad , 0 },
- { "bhadeva", 0x092d , 0 },
- { "bhagujarati", 0x0aad , 0 },
- { "bhagurmukhi", 0x0a2d , 0 },
- { "bhook", 0x0253 , 0 },
- { "bihiragana", 0x3073 , 0 },
- { "bikatakana", 0x30d3 , 0 },
- { "bilabialclick", 0x0298 , 0 },
- { "bindigurmukhi", 0x0a02 , 0 },
- { "birusquare", 0x3331 , 0 },
- { "blackcircle", 0x25cf , 0 },
- { "blackdiamond", 0x25c6 , 0 },
- { "blackdownpointingtriangle", 0x25bc , 0 },
- { "blackleftpointingpointer", 0x25c4 , 0 },
- { "blackleftpointingtriangle", 0x25c0 , 0 },
- { "blacklenticularbracketleft", 0x3010 , 0 },
- { "blacklenticularbracketleftvertical", 0xfe3b , 0 },
- { "blacklenticularbracketright", 0x3011 , 0 },
- { "blacklenticularbracketrightvertical", 0xfe3c , 0 },
- { "blacklowerlefttriangle", 0x25e3 , 0 },
- { "blacklowerrighttriangle", 0x25e2 , 0 },
- { "blackrectangle", 0x25ac , 0 },
- { "blackrightpointingpointer", 0x25ba , 0 },
- { "blackrightpointingtriangle", 0x25b6 , 0 },
- { "blacksmallsquare", 0x25aa , 0 },
- { "blacksmilingface", 0x263b , 0 },
- { "blacksquare", 0x25a0 , 0 },
- { "blackstar", 0x2605 , 0 },
- { "blackupperlefttriangle", 0x25e4 , 0 },
- { "blackupperrighttriangle", 0x25e5 , 0 },
- { "blackuppointingsmalltriangle", 0x25b4 , 0 },
- { "blackuppointingtriangle", 0x25b2 , 0 },
- { "blank", 0x2423 , 0 },
- { "blinebelow", 0x1e07 , 0 },
- { "bmonospace", 0xff42 , 0 },
- { "bobaimaithai", 0x0e1a , 0 },
- { "bohiragana", 0x307c , 0 },
- { "bokatakana", 0x30dc , 0 },
- { "bparen", 0x249d , 0 },
- { "bqsquare", 0x33c3 , 0 },
- { "braceex", 0xf8f4 , 0 },
- { "braceleftbt", 0xf8f3 , 0 },
- { "braceleftmid", 0xf8f2 , 0 },
- { "braceleftmonospace", 0xff5b , 0 },
- { "braceleftsmall", 0xfe5b , 0 },
- { "bracelefttp", 0xf8f1 , 0 },
- { "braceleftvertical", 0xfe37 , 0 },
- { "bracerightbt", 0xf8fe , 0 },
- { "bracerightmid", 0xf8fd , 0 },
- { "bracerightmonospace", 0xff5d , 0 },
- { "bracerightsmall", 0xfe5c , 0 },
- { "bracerighttp", 0xf8fc , 0 },
- { "bracerightvertical", 0xfe38 , 0 },
- { "bracketleftbt", 0xf8f0 , 0 },
- { "bracketleftex", 0xf8ef , 0 },
- { "bracketleftmonospace", 0xff3b , 0 },
- { "bracketlefttp", 0xf8ee , 0 },
- { "bracketrightbt", 0xf8fb , 0 },
- { "bracketrightex", 0xf8fa , 0 },
- { "bracketrightmonospace", 0xff3d , 0 },
- { "bracketrighttp", 0xf8f9 , 0 },
- { "brevebelowcmb", 0x032e , 0 },
- { "brevecmb", 0x0306 , 0 },
- { "breveinvertedbelowcmb", 0x032f , 0 },
- { "breveinvertedcmb", 0x0311 , 0 },
- { "breveinverteddoublecmb", 0x0361 , 0 },
- { "bridgebelowcmb", 0x032a , 0 },
- { "bridgeinvertedbelowcmb", 0x033a , 0 },
- { "bstroke", 0x0180 , 0 },
- { "bsuperior", 0xf6ea , 0 },
- { "btopbar", 0x0183 , 0 },
- { "buhiragana", 0x3076 , 0 },
- { "bukatakana", 0x30d6 , 0 },
- { "bulletinverse", 0x25d8 , 0 },
- { "bulletoperator", 0x2219 , 0 },
- { "bullseye", 0x25ce , 0 },
- { "caarmenian", 0x056e , 0 },
- { "cabengali", 0x099a , 0 },
- { "cadeva", 0x091a , 0 },
- { "cagujarati", 0x0a9a , 0 },
- { "cagurmukhi", 0x0a1a , 0 },
- { "calsquare", 0x3388 , 0 },
- { "candrabindubengali", 0x0981 , 0 },
- { "candrabinducmb", 0x0310 , 0 },
- { "candrabindudeva", 0x0901 , 0 },
- { "candrabindugujarati", 0x0a81 , 0 },
- { "capslock", 0x21ea , 0 },
- { "careof", 0x2105 , 0 },
- { "caronbelowcmb", 0x032c , 0 },
- { "caroncmb", 0x030c , 0 },
- { "cbopomofo", 0x3118 , 0 },
- { "ccedillaacute", 0x1e09 , 0 },
- { "ccircle", 0x24d2 , 0 },
- { "ccurl", 0x0255 , 0 },
- { "cdot", 0x010b , 0 },
- { "cdsquare", 0x33c5 , 0 },
- { "cedillacmb", 0x0327 , 0 },
- { "centigrade", 0x2103 , 0 },
- { "centinferior", 0xf6df , 0 },
- { "centmonospace", 0xffe0 , 0 },
- { "centoldstyle", 0xf7a2 , 0 },
- { "centsuperior", 0xf6e0 , 0 },
- { "chaarmenian", 0x0579 , 0 },
- { "chabengali", 0x099b , 0 },
- { "chadeva", 0x091b , 0 },
- { "chagujarati", 0x0a9b , 0 },
- { "chagurmukhi", 0x0a1b , 0 },
- { "chbopomofo", 0x3114 , 0 },
- { "cheabkhasiancyrillic", 0x04bd , 0 },
- { "checkmark", 0x2713 , 0 },
- { "checyrillic", 0x0447 , 0 },
- { "chedescenderabkhasiancyrillic", 0x04bf , 0 },
- { "chedescendercyrillic", 0x04b7 , 0 },
- { "chedieresiscyrillic", 0x04f5 , 0 },
- { "cheharmenian", 0x0573 , 0 },
- { "chekhakassiancyrillic", 0x04cc , 0 },
- { "cheverticalstrokecyrillic", 0x04b9 , 0 },
- { "chieuchacirclekorean", 0x3277 , 0 },
- { "chieuchaparenkorean", 0x3217 , 0 },
- { "chieuchcirclekorean", 0x3269 , 0 },
- { "chieuchkorean", 0x314a , 0 },
- { "chieuchparenkorean", 0x3209 , 0 },
- { "chochangthai", 0x0e0a , 0 },
- { "chochanthai", 0x0e08 , 0 },
- { "chochingthai", 0x0e09 , 0 },
- { "chochoethai", 0x0e0c , 0 },
- { "chook", 0x0188 , 0 },
- { "cieucacirclekorean", 0x3276 , 0 },
- { "cieucaparenkorean", 0x3216 , 0 },
- { "cieuccirclekorean", 0x3268 , 0 },
- { "cieuckorean", 0x3148 , 0 },
- { "cieucparenkorean", 0x3208 , 0 },
- { "cieucuparenkorean", 0x321c , 0 },
- { "circleot", 0x2299 , 0 }, /* Typo in Adobe's glyphlist */
- { "circledot", 0x2299 , 0 }, /* But same typo exists in acrobat */
- { "circlepostalmark", 0x3036 , 0 },
- { "circlewithlefthalfblack", 0x25d0 , 0 },
- { "circlewithrighthalfblack", 0x25d1 , 0 },
- { "circumflexbelowcmb", 0x032d , 0 },
- { "circumflexcmb", 0x0302 , 0 },
- { "clear", 0x2327 , 0 },
- { "clickalveolar", 0x01c2 , 0 },
- { "clickdental", 0x01c0 , 0 },
- { "clicklateral", 0x01c1 , 0 },
- { "clickretroflex", 0x01c3 , 0 },
- { "clubsuitblack", 0x2663 , 0 },
- { "clubsuitwhite", 0x2667 , 0 },
- { "cmcubedsquare", 0x33a4 , 0 },
- { "cmonospace", 0xff43 , 0 },
- { "cmsquaredsquare", 0x33a0 , 0 },
- { "coarmenian", 0x0581 , 0 },
- { "colonmonospace", 0xff1a , 0 },
- { "colonsign", 0x20a1 , 0 },
- { "colonsmall", 0xfe55 , 0 },
- { "colontriangularhalfmod", 0x02d1 , 0 },
- { "colontriangularmod", 0x02d0 , 0 },
- { "commaabovecmb", 0x0313 , 0 },
- { "commaaboverightcmb", 0x0315 , 0 },
- { "commaaccent", 0xf6c3 , 0 },
- { "commaarabic", 0x060c , 0 },
- { "commaarmenian", 0x055d , 0 },
- { "commainferior", 0xf6e1 , 0 },
- { "commamonospace", 0xff0c , 0 },
- { "commareversedabovecmb", 0x0314 , 0 },
- { "commareversedmod", 0x02bd , 0 },
- { "commasmall", 0xfe50 , 0 },
- { "commasuperior", 0xf6e2 , 0 },
- { "commaturnedabovecmb", 0x0312 , 0 },
- { "commaturnedmod", 0x02bb , 0 },
- { "compass", 0x263c , 0 },
- { "contourintegral", 0x222e , 0 },
- { "control", 0x2303 , 0 },
- { "controlACK", 0x0006 , 0 },
- { "controlBEL", 0x0007 , 0 },
- { "controlBS", 0x0008 , 0 },
- { "controlCAN", 0x0018 , 0 },
- { "controlCR", 0x000d , 0 },
- { "controlDC1", 0x0011 , 0 },
- { "controlDC2", 0x0012 , 0 },
- { "controlDC3", 0x0013 , 0 },
- { "controlDC4", 0x0014 , 0 },
- { "controlDEL", 0x007f , 0 },
- { "controlDLE", 0x0010 , 0 },
- { "controlEM", 0x0019 , 0 },
- { "controlENQ", 0x0005 , 0 },
- { "controlEOT", 0x0004 , 0 },
- { "controlESC", 0x001b , 0 },
- { "controlETB", 0x0017 , 0 },
- { "controlETX", 0x0003 , 0 },
- { "controlFF", 0x000c , 0 },
- { "controlFS", 0x001c , 0 },
- { "controlGS", 0x001d , 0 },
- { "controlHT", 0x0009 , 0 },
- { "controlLF", 0x000a , 0 },
- { "controlNAK", 0x0015 , 0 },
- { "controlRS", 0x001e , 0 },
- { "controlSI", 0x000f , 0 },
- { "controlSO", 0x000e , 0 },
- { "controlSOT", 0x0002 , 0 },
- { "controlSTX", 0x0001 , 0 },
- { "controlSUB", 0x001a , 0 },
- { "controlSYN", 0x0016 , 0 },
- { "controlUS", 0x001f , 0 },
- { "controlVT", 0x000b , 0 },
- { "copyrightsans", 0xf8e9 , 0 },
- { "copyrightserif", 0xf6d9 , 0 },
- { "cornerbracketleft", 0x300c , 0 },
- { "cornerbracketlefthalfwidth", 0xff62 , 0 },
- { "cornerbracketleftvertical", 0xfe41 , 0 },
- { "cornerbracketright", 0x300d , 0 },
- { "cornerbracketrighthalfwidth", 0xff63 , 0 },
- { "cornerbracketrightvertical", 0xfe42 , 0 },
- { "corporationsquare", 0x337f , 0 },
- { "cosquare", 0x33c7 , 0 },
- { "coverkgsquare", 0x33c6 , 0 },
- { "cparen", 0x249e , 0 },
- { "cruzeiro", 0x20a2 , 0 },
- { "cstretched", 0x0297 , 0 },
- { "curlyand", 0x22cf , 0 },
- { "curlyor", 0x22ce , 0 },
- { "cyrBreve", 0xf6d1 , 0 },
- { "cyrFlex", 0xf6d2 , 0 },
- { "cyrbreve", 0xf6d4 , 0 },
- { "cyrflex", 0xf6d5 , 0 },
- { "daarmenian", 0x0564 , 0 },
- { "dabengali", 0x09a6 , 0 },
- { "dadarabic", 0x0636 , 0 },
- { "dadeva", 0x0926 , 0 },
- { "dadfinalarabic", 0xfebe , 0 },
- { "dadinitialarabic", 0xfebf , 0 },
- { "dadmedialarabic", 0xfec0 , 0 },
- { "dagesh", 0x05bc , 0 },
- { "dageshhebrew", 0x05bc , 0 },
- { "dagujarati", 0x0aa6 , 0 },
- { "dagurmukhi", 0x0a26 , 0 },
- { "dahiragana", 0x3060 , 0 },
- { "dakatakana", 0x30c0 , 0 },
- { "dalarabic", 0x062f , 0 },
- { "dalet", 0x05d3 , 0 },
- { "daletdagesh", 0xfb33 , 0 },
- { "daletdageshhebrew", 0xfb33 , 0 },
- { "dalethatafpatah", 0x05d3 , 0 },
- { "dalethatafpatahhebrew", 0x05d3 , 0 },
- { "dalethatafsegol", 0x05d3 , 0 },
- { "dalethatafsegolhebrew", 0x05d3 , 0 },
- { "dalethebrew", 0x05d3 , 0 },
- { "dalethiriq", 0x05d3 , 0 },
- { "dalethiriqhebrew", 0x05d3 , 0 },
- { "daletholam", 0x05d3 , 0 },
- { "daletholamhebrew", 0x05d3 , 0 },
- { "daletpatah", 0x05d3 , 0 },
- { "daletpatahhebrew", 0x05d3 , 0 },
- { "daletqamats", 0x05d3 , 0 },
- { "daletqamatshebrew", 0x05d3 , 0 },
- { "daletqubuts", 0x05d3 , 0 },
- { "daletqubutshebrew", 0x05d3 , 0 },
- { "daletsegol", 0x05d3 , 0 },
- { "daletsegolhebrew", 0x05d3 , 0 },
- { "daletsheva", 0x05d3 , 0 },
- { "daletshevahebrew", 0x05d3 , 0 },
- { "dalettsere", 0x05d3 , 0 },
- { "dalettserehebrew", 0x05d3 , 0 },
- { "dalfinalarabic", 0xfeaa , 0 },
- { "dammaarabic", 0x064f , 0 },
- { "dammalowarabic", 0x064f , 0 },
- { "dammatanaltonearabic", 0x064c , 0 },
- { "dammatanarabic", 0x064c , 0 },
- { "danda", 0x0964 , 0 },
- { "dargahebrew", 0x05a7 , 0 },
- { "dargalefthebrew", 0x05a7 , 0 },
- { "dasiapneumatacyrilliccmb", 0x0485 , 0 },
- { "dblGrave", 0xf6d3 , 0 },
- { "dblanglebracketleft", 0x300a , 0 },
- { "dblanglebracketleftvertical", 0xfe3d , 0 },
- { "dblanglebracketright", 0x300b , 0 },
- { "dblanglebracketrightvertical", 0xfe3e , 0 },
- { "dblarchinvertedbelowcmb", 0x032b , 0 },
- { "dblarrowleft", 0x21d4 , 0 },
- { "dblarrowright", 0x21d2 , 0 },
- { "dbldanda", 0x0965 , 0 },
- { "dblgrave", 0xf6d6 , 0 },
- { "dblgravecmb", 0x030f , 0 },
- { "dblintegral", 0x222c , 0 },
- { "dbllowline", 0x2017 , 0 },
- { "dbllowlinecmb", 0x0333 , 0 },
- { "dbloverlinecmb", 0x033f , 0 },
- { "dblprimemod", 0x02ba , 0 },
- { "dblverticalbar", 0x2016 , 0 },
- { "dblverticallineabovecmb", 0x030e , 0 },
- { "dbopomofo", 0x3109 , 0 },
- { "dbsquare", 0x33c8 , 0 },
- { "dcedilla", 0x1e11 , 0 },
- { "dcircle", 0x24d3 , 0 },
- { "dcircumflexbelow", 0x1e13 , 0 },
- { "ddabengali", 0x09a1 , 0 },
- { "ddadeva", 0x0921 , 0 },
- { "ddagujarati", 0x0aa1 , 0 },
- { "ddagurmukhi", 0x0a21 , 0 },
- { "ddalarabic", 0x0688 , 0 },
- { "ddalfinalarabic", 0xfb89 , 0 },
- { "dddhadeva", 0x095c , 0 },
- { "ddhabengali", 0x09a2 , 0 },
- { "ddhadeva", 0x0922 , 0 },
- { "ddhagujarati", 0x0aa2 , 0 },
- { "ddhagurmukhi", 0x0a22 , 0 },
- { "ddotaccent", 0x1e0b , 0 },
- { "ddotbelow", 0x1e0d , 0 },
- { "decimalseparatorarabic", 0x066b , 0 },
- { "decimalseparatorpersian", 0x066b , 0 },
- { "decyrillic", 0x0434 , 0 },
- { "dehihebrew", 0x05ad , 0 },
- { "dehiragana", 0x3067 , 0 },
- { "deicoptic", 0x03ef , 0 },
- { "dekatakana", 0x30c7 , 0 },
- { "deleteleft", 0x232b , 0 },
- { "deleteright", 0x2326 , 0 },
- { "deltaturned", 0x018d , 0 },
- { "denominatorminusonenumeratorbengali", 0x09f8 , 0 },
- { "dezh", 0x02a4 , 0 },
- { "dhabengali", 0x09a7 , 0 },
- { "dhadeva", 0x0927 , 0 },
- { "dhagujarati", 0x0aa7 , 0 },
- { "dhagurmukhi", 0x0a27 , 0 },
- { "dhook", 0x0257 , 0 },
- { "dialytikatonos", 0x0385 , 0 },
- { "dialytikatonoscmb", 0x0344 , 0 },
- { "diamondsuitwhite", 0x2662 , 0 },
- { "dieresisacute", 0xf6d7 , 0 },
- { "dieresisbelowcmb", 0x0324 , 0 },
- { "dieresiscmb", 0x0308 , 0 },
- { "dieresisgrave", 0xf6d8 , 0 },
- { "dihiragana", 0x3062 , 0 },
- { "dikatakana", 0x30c2 , 0 },
- { "dittomark", 0x3003 , 0 },
- { "divides", 0x2223 , 0 },
- { "divisionslash", 0x2215 , 0 },
- { "djecyrillic", 0x0452 , 0 },
- { "dlinebelow", 0x1e0f , 0 },
- { "dlsquare", 0x3397 , 0 },
- { "dmacron", 0x0111 , 0 },
- { "dmonospace", 0xff44 , 0 },
- { "dochadathai", 0x0e0e , 0 },
- { "dodekthai", 0x0e14 , 0 },
- { "dohiragana", 0x3069 , 0 },
- { "dokatakana", 0x30c9 , 0 },
- { "dollarinferior", 0xf6e3 , 0 },
- { "dollarmonospace", 0xff04 , 0 },
- { "dollaroldstyle", 0xf724 , 0 },
- { "dollarsmall", 0xfe69 , 0 },
- { "dollarsuperior", 0xf6e4 , 0 },
- { "dorusquare", 0x3326 , 0 },
- { "dotaccentcmb", 0x0307 , 0 },
- { "dotbelowcmb", 0x0323 , 0 },
- { "dotkatakana", 0x30fb , 0 },
- { "dotlessj", 0x0237 , 0 }, /* !!!! AGL Still says this is 0xf6be */
- { "dotlessjstrokehook", 0x0284 , 0 },
- { "dottedcircle", 0x25cc , 0 },
- { "doubleyodpatah", 0xfb1f , 0 },
- { "doubleyodpatahhebrew", 0xfb1f , 0 },
- { "downtackbelowcmb", 0x031e , 0 },
- { "downtackmod", 0x02d5 , 0 },
- { "dparen", 0x249f , 0 },
- { "dsuperior", 0xf6eb , 0 },
- { "dtail", 0x0256 , 0 },
- { "dtopbar", 0x018c , 0 },
- { "duhiragana", 0x3065 , 0 },
- { "dukatakana", 0x30c5 , 0 },
- { "dz", 0x01f3 , 0 },
- { "dzaltone", 0x02a3 , 0 },
- { "dzcaron", 0x01c6 , 0 },
- { "dzcurl", 0x02a5 , 0 },
- { "dzeabkhasiancyrillic", 0x04e1 , 0 },
- { "dzecyrillic", 0x0455 , 0 },
- { "dzhecyrillic", 0x045f , 0 },
- { "earth", 0x2641 , 0 },
- { "ebengali", 0x098f , 0 },
- { "ebopomofo", 0x311c , 0 },
- { "ecandradeva", 0x090d , 0 },
- { "ecandragujarati", 0x0a8d , 0 },
- { "ecandravowelsigndeva", 0x0945 , 0 },
- { "ecandravowelsigngujarati", 0x0ac5 , 0 },
- { "ecedillabreve", 0x1e1d , 0 },
- { "echarmenian", 0x0565 , 0 },
- { "echyiwnarmenian", 0x0587 , 0 },
- { "ecircle", 0x24d4 , 0 },
- { "ecircumflexacute", 0x1ebf , 0 },
- { "ecircumflexbelow", 0x1e19 , 0 },
- { "ecircumflexdotbelow", 0x1ec7 , 0 },
- { "ecircumflexgrave", 0x1ec1 , 0 },
- { "ecircumflexhookabove", 0x1ec3 , 0 },
- { "ecircumflextilde", 0x1ec5 , 0 },
- { "ecyrillic", 0x0454 , 0 },
- { "edblgrave", 0x0205 , 0 },
- { "edeva", 0x090f , 0 },
- { "edot", 0x0117 , 0 },
- { "edotbelow", 0x1eb9 , 0 },
- { "eegurmukhi", 0x0a0f , 0 },
- { "eematragurmukhi", 0x0a47 , 0 },
- { "efcyrillic", 0x0444 , 0 },
- { "egujarati", 0x0a8f , 0 },
- { "eharmenian", 0x0567 , 0 },
- { "ehbopomofo", 0x311d , 0 },
- { "ehiragana", 0x3048 , 0 },
- { "ehookabove", 0x1ebb , 0 },
- { "eibopomofo", 0x311f , 0 },
- { "eightarabic", 0x0668 , 0 },
- { "eightbengali", 0x09ee , 0 },
- { "eightcircle", 0x2467 , 0 },
- { "eightcircleinversesansserif", 0x2791 , 0 },
- { "eightdeva", 0x096e , 0 },
- { "eighteencircle", 0x2471 , 0 },
- { "eighteenparen", 0x2485 , 0 },
- { "eighteenperiod", 0x2499 , 0 },
- { "eightgujarati", 0x0aee , 0 },
- { "eightgurmukhi", 0x0a6e , 0 },
- { "eighthackarabic", 0x0668 , 0 },
- { "eighthangzhou", 0x3028 , 0 },
- { "eighthnotebeamed", 0x266b , 0 },
- { "eightideographicparen", 0x3227 , 0 },
- { "eightinferior", 0x2088 , 0 },
- { "eightmonospace", 0xff18 , 0 },
- { "eightoldstyle", 0xf738 , 0 },
- { "eightparen", 0x247b , 0 },
- { "eightperiod", 0x248f , 0 },
- { "eightpersian", 0x06f8 , 0 },
- { "eightroman", 0x2177 , 0 },
- { "eightsuperior", 0x2078 , 0 },
- { "eightthai", 0x0e58 , 0 },
- { "einvertedbreve", 0x0207 , 0 },
- { "eiotifiedcyrillic", 0x0465 , 0 },
- { "ekatakana", 0x30a8 , 0 },
- { "ekatakanahalfwidth", 0xff74 , 0 },
- { "ekonkargurmukhi", 0x0a74 , 0 },
- { "ekorean", 0x3154 , 0 },
- { "elcyrillic", 0x043b , 0 },
- { "elevencircle", 0x246a , 0 },
- { "elevenparen", 0x247e , 0 },
- { "elevenperiod", 0x2492 , 0 },
- { "elevenroman", 0x217a , 0 },
- { "ellipsisvertical", 0x22ee , 0 },
- { "emacronacute", 0x1e17 , 0 },
- { "emacrongrave", 0x1e15 , 0 },
- { "emcyrillic", 0x043c , 0 },
- { "emdashvertical", 0xfe31 , 0 },
- { "emonospace", 0xff45 , 0 },
- { "emphasismarkarmenian", 0x055b , 0 },
- { "enbopomofo", 0x3123 , 0 },
- { "encyrillic", 0x043d , 0 },
- { "endashvertical", 0xfe32 , 0 },
- { "endescendercyrillic", 0x04a3 , 0 },
- { "engbopomofo", 0x3125 , 0 },
- { "enghecyrillic", 0x04a5 , 0 },
- { "enhookcyrillic", 0x04c8 , 0 },
- { "enspace", 0x2002 , 0 },
- { "eokorean", 0x3153 , 0 },
- { "eopen", 0x025b , 0 },
- { "eopenclosed", 0x029a , 0 },
- { "eopenreversed", 0x025c , 0 },
- { "eopenreversedclosed", 0x025e , 0 },
- { "eopenreversedhook", 0x025d , 0 },
- { "eparen", 0x24a0 , 0 },
- { "equalmonospace", 0xff1d , 0 },
- { "equalsmall", 0xfe66 , 0 },
- { "equalsuperior", 0x207c , 0 },
- { "erbopomofo", 0x3126 , 0 },
- { "ercyrillic", 0x0440 , 0 },
- { "ereversed", 0x0258 , 0 },
- { "ereversedcyrillic", 0x044d , 0 },
- { "escyrillic", 0x0441 , 0 },
- { "esdescendercyrillic", 0x04ab , 0 },
- { "esh", 0x0283 , 0 },
- { "eshcurl", 0x0286 , 0 },
- { "eshortdeva", 0x090e , 0 },
- { "eshortvowelsigndeva", 0x0946 , 0 },
- { "eshreversedloop", 0x01aa , 0 },
- { "eshsquatreversed", 0x0285 , 0 },
- { "esmallhiragana", 0x3047 , 0 },
- { "esmallkatakana", 0x30a7 , 0 },
- { "esmallkatakanahalfwidth", 0xff6a , 0 },
- { "esuperior", 0xf6ec , 0 },
- { "etarmenian", 0x0568 , 0 },
- { "etilde", 0x1ebd , 0 },
- { "etildebelow", 0x1e1b , 0 },
- { "etnahtafoukhhebrew", 0x0591 , 0 },
- { "etnahtafoukhlefthebrew", 0x0591 , 0 },
- { "etnahtahebrew", 0x0591 , 0 },
- { "etnahtalefthebrew", 0x0591 , 0 },
- { "eturned", 0x01dd , 0 },
- { "eukorean", 0x3161 , 0 },
- { "euro", 0x20ac , 0 },
- { "evowelsignbengali", 0x09c7 , 0 },
- { "evowelsigndeva", 0x0947 , 0 },
- { "evowelsigngujarati", 0x0ac7 , 0 },
- { "exclamarmenian", 0x055c , 0 },
- { "exclamdownsmall", 0xf7a1 , 0 },
- { "exclammonospace", 0xff01 , 0 },
- { "exclamsmall", 0xf721 , 0 },
- { "ezh", 0x0292 , 0 },
- { "ezhcaron", 0x01ef , 0 },
- { "ezhcurl", 0x0293 , 0 },
- { "ezhreversed", 0x01b9 , 0 },
- { "ezhtail", 0x01ba , 0 },
- { "fadeva", 0x095e , 0 },
- { "fagurmukhi", 0x0a5e , 0 },
- { "fahrenheit", 0x2109 , 0 },
- { "fathaarabic", 0x064e , 0 },
- { "fathalowarabic", 0x064e , 0 },
- { "fathatanarabic", 0x064b , 0 },
- { "fbopomofo", 0x3108 , 0 },
- { "fcircle", 0x24d5 , 0 },
- { "fdotaccent", 0x1e1f , 0 },
- { "feharabic", 0x0641 , 0 },
- { "feharmenian", 0x0586 , 0 },
- { "fehfinalarabic", 0xfed2 , 0 },
- { "fehinitialarabic", 0xfed3 , 0 },
- { "fehmedialarabic", 0xfed4 , 0 },
- { "feicoptic", 0x03e5 , 0 },
- { "ff", 0xfb00 , 0 },
- { "ffi", 0xfb03 , 0 },
- { "ffl", 0xfb04 , 0 },
- { "fi", 0xfb01 , 0 },
- { "fifteencircle", 0x246e , 0 },
- { "fifteenparen", 0x2482 , 0 },
- { "fifteenperiod", 0x2496 , 0 },
- { "finalkaf", 0x05da , 0 },
- { "finalkafdagesh", 0xfb3a , 0 },
- { "finalkafdageshhebrew", 0xfb3a , 0 },
- { "finalkafhebrew", 0x05da , 0 },
- { "finalkafqamats", 0x05da , 0 },
- { "finalkafqamatshebrew", 0x05da , 0 },
- { "finalkafsheva", 0x05da , 0 },
- { "finalkafshevahebrew", 0x05da , 0 },
- { "finalmem", 0x05dd , 0 },
- { "finalmemhebrew", 0x05dd , 0 },
- { "finalnun", 0x05df , 0 },
- { "finalnunhebrew", 0x05df , 0 },
- { "finalpe", 0x05e3 , 0 },
- { "finalpehebrew", 0x05e3 , 0 },
- { "finaltsadi", 0x05e5 , 0 },
- { "finaltsadihebrew", 0x05e5 , 0 },
- { "firsttonechinese", 0x02c9 , 0 },
- { "fisheye", 0x25c9 , 0 },
- { "fitacyrillic", 0x0473 , 0 },
- { "fivearabic", 0x0665 , 0 },
- { "fivebengali", 0x09eb , 0 },
- { "fivecircle", 0x2464 , 0 },
- { "fivecircleinversesansserif", 0x278e , 0 },
- { "fivedeva", 0x096b , 0 },
- { "fivegujarati", 0x0aeb , 0 },
- { "fivegurmukhi", 0x0a6b , 0 },
- { "fivehackarabic", 0x0665 , 0 },
- { "fivehangzhou", 0x3025 , 0 },
- { "fiveideographicparen", 0x3224 , 0 },
- { "fiveinferior", 0x2085 , 0 },
- { "fivemonospace", 0xff15 , 0 },
- { "fiveoldstyle", 0xf735 , 0 },
- { "fiveparen", 0x2478 , 0 },
- { "fiveperiod", 0x248c , 0 },
- { "fivepersian", 0x06f5 , 0 },
- { "fiveroman", 0x2174 , 0 },
- { "fivesuperior", 0x2075 , 0 },
- { "fivethai", 0x0e55 , 0 },
- { "fl", 0xfb02 , 0 },
- { "fmonospace", 0xff46 , 0 },
- { "fmsquare", 0x3399 , 0 },
- { "fofanthai", 0x0e1f , 0 },
- { "fofathai", 0x0e1d , 0 },
- { "fongmanthai", 0x0e4f , 0 },
- { "forall", 0x2200 , 0 },
- { "fourarabic", 0x0664 , 0 },
- { "fourbengali", 0x09ea , 0 },
- { "fourcircle", 0x2463 , 0 },
- { "fourcircleinversesansserif", 0x278d , 0 },
- { "fourdeva", 0x096a , 0 },
- { "fourgujarati", 0x0aea , 0 },
- { "fourgurmukhi", 0x0a6a , 0 },
- { "fourhackarabic", 0x0664 , 0 },
- { "fourhangzhou", 0x3024 , 0 },
- { "fourideographicparen", 0x3223 , 0 },
- { "fourinferior", 0x2084 , 0 },
- { "fourmonospace", 0xff14 , 0 },
- { "fournumeratorbengali", 0x09f7 , 0 },
- { "fouroldstyle", 0xf734 , 0 },
- { "fourparen", 0x2477 , 0 },
- { "fourperiod", 0x248b , 0 },
- { "fourpersian", 0x06f4 , 0 },
- { "fourroman", 0x2173 , 0 },
- { "foursuperior", 0x2074 , 0 },
- { "fourteencircle", 0x246d , 0 },
- { "fourteenparen", 0x2481 , 0 },
- { "fourteenperiod", 0x2495 , 0 },
- { "fourthai", 0x0e54 , 0 },
- { "fourthtonechinese", 0x02cb , 0 },
- { "fparen", 0x24a1 , 0 },
- { "gabengali", 0x0997 , 0 },
- { "gacute", 0x01f5 , 0 },
- { "gadeva", 0x0917 , 0 },
- { "gafarabic", 0x06af , 0 },
- { "gaffinalarabic", 0xfb93 , 0 },
- { "gafinitialarabic", 0xfb94 , 0 },
- { "gafmedialarabic", 0xfb95 , 0 },
- { "gagujarati", 0x0a97 , 0 },
- { "gagurmukhi", 0x0a17 , 0 },
- { "gahiragana", 0x304c , 0 },
- { "gakatakana", 0x30ac , 0 },
- { "gammalatinsmall", 0x0263 , 0 },
- { "gammasuperior", 0x02e0 , 0 },
- { "gangiacoptic", 0x03eb , 0 },
- { "gbopomofo", 0x310d , 0 },
- { "gcedilla", 0x0123 , 0 },
- { "gcircle", 0x24d6 , 0 },
- { "gdot", 0x0121 , 0 },
- { "gecyrillic", 0x0433 , 0 },
- { "gehiragana", 0x3052 , 0 },
- { "gekatakana", 0x30b2 , 0 },
- { "geometricallyequal", 0x2251 , 0 },
- { "gereshaccenthebrew", 0x059c , 0 },
- { "gereshhebrew", 0x05f3 , 0 },
- { "gereshmuqdamhebrew", 0x059d , 0 },
- { "gershayimaccenthebrew", 0x059e , 0 },
- { "gershayimhebrew", 0x05f4 , 0 },
- { "getamark", 0x3013 , 0 },
- { "ghabengali", 0x0998 , 0 },
- { "ghadarmenian", 0x0572 , 0 },
- { "ghadeva", 0x0918 , 0 },
- { "ghagujarati", 0x0a98 , 0 },
- { "ghagurmukhi", 0x0a18 , 0 },
- { "ghainarabic", 0x063a , 0 },
- { "ghainfinalarabic", 0xfece , 0 },
- { "ghaininitialarabic", 0xfecf , 0 },
- { "ghainmedialarabic", 0xfed0 , 0 },
- { "ghemiddlehookcyrillic", 0x0495 , 0 },
- { "ghestrokecyrillic", 0x0493 , 0 },
- { "gheupturncyrillic", 0x0491 , 0 },
- { "ghhadeva", 0x095a , 0 },
- { "ghhagurmukhi", 0x0a5a , 0 },
- { "ghook", 0x0260 , 0 },
- { "ghzsquare", 0x3393 , 0 },
- { "gihiragana", 0x304e , 0 },
- { "gikatakana", 0x30ae , 0 },
- { "gimarmenian", 0x0563 , 0 },
- { "gimel", 0x05d2 , 0 },
- { "gimeldagesh", 0xfb32 , 0 },
- { "gimeldageshhebrew", 0xfb32 , 0 },
- { "gimelhebrew", 0x05d2 , 0 },
- { "gjecyrillic", 0x0453 , 0 },
- { "glottalinvertedstroke", 0x01be , 0 },
- { "glottalstop", 0x0294 , 0 },
- { "glottalstopinverted", 0x0296 , 0 },
- { "glottalstopmod", 0x02c0 , 0 },
- { "glottalstopreversed", 0x0295 , 0 },
- { "glottalstopreversedmod", 0x02c1 , 0 },
- { "glottalstopreversedsuperior", 0x02e4 , 0 },
- { "glottalstopstroke", 0x02a1 , 0 },
- { "glottalstopstrokereversed", 0x02a2 , 0 },
- { "gmacron", 0x1e21 , 0 },
- { "gmonospace", 0xff47 , 0 },
- { "gohiragana", 0x3054 , 0 },
- { "gokatakana", 0x30b4 , 0 },
- { "gparen", 0x24a2 , 0 },
- { "gpasquare", 0x33ac , 0 },
- { "gravebelowcmb", 0x0316 , 0 },
- { "gravecmb", 0x0300 , 0 },
- { "gravedeva", 0x0953 , 0 },
- { "gravelowmod", 0x02ce , 0 },
- { "gravemonospace", 0xff40 , 0 },
- { "gravetonecmb", 0x0340 , 0 },
- { "greaterequalorless", 0x22db , 0 },
- { "greatermonospace", 0xff1e , 0 },
- { "greaterorequivalent", 0x2273 , 0 },
- { "greaterorless", 0x2277 , 0 },
- { "greateroverequal", 0x2267 , 0 },
- { "greatersmall", 0xfe65 , 0 },
- { "gscript", 0x0261 , 0 },
- { "gstroke", 0x01e5 , 0 },
- { "guhiragana", 0x3050 , 0 },
- { "gukatakana", 0x30b0 , 0 },
- { "guramusquare", 0x3318 , 0 },
- { "gysquare", 0x33c9 , 0 },
- { "haabkhasiancyrillic", 0x04a9 , 0 },
- { "haaltonearabic", 0x06c1 , 0 },
- { "habengali", 0x09b9 , 0 },
- { "hadescendercyrillic", 0x04b3 , 0 },
- { "hadeva", 0x0939 , 0 },
- { "hagujarati", 0x0ab9 , 0 },
- { "hagurmukhi", 0x0a39 , 0 },
- { "haharabic", 0x062d , 0 },
- { "hahfinalarabic", 0xfea2 , 0 },
- { "hahinitialarabic", 0xfea3 , 0 },
- { "hahiragana", 0x306f , 0 },
- { "hahmedialarabic", 0xfea4 , 0 },
- { "haitusquare", 0x332a , 0 },
- { "hakatakana", 0x30cf , 0 },
- { "hakatakanahalfwidth", 0xff8a , 0 },
- { "halantgurmukhi", 0x0a4d , 0 },
- { "hamzaarabic", 0x0621 , 0 },
- { "hamzadammaarabic", 0x0621 , 0 },
- { "hamzadammatanarabic", 0x0621 , 0 },
- { "hamzafathaarabic", 0x0621 , 0 },
- { "hamzafathatanarabic", 0x0621 , 0 },
- { "hamzalowarabic", 0x0621 , 0 },
- { "hamzalowkasraarabic", 0x0621 , 0 },
- { "hamzalowkasratanarabic", 0x0621 , 0 },
- { "hamzasukunarabic", 0x0621 , 0 },
- { "hangulfiller", 0x3164 , 0 },
- { "hardsigncyrillic", 0x044a , 0 },
- { "harpoonleftbarbup", 0x21bc , 0 },
- { "harpoonrightbarbup", 0x21c0 , 0 },
- { "hasquare", 0x33ca , 0 },
- { "hatafpatah", 0x05b2 , 0 },
- { "hatafpatah16", 0x05b2 , 0 },
- { "hatafpatah23", 0x05b2 , 0 },
- { "hatafpatah2f", 0x05b2 , 0 },
- { "hatafpatahhebrew", 0x05b2 , 0 },
- { "hatafpatahnarrowhebrew", 0x05b2 , 0 },
- { "hatafpatahquarterhebrew", 0x05b2 , 0 },
- { "hatafpatahwidehebrew", 0x05b2 , 0 },
- { "hatafqamats", 0x05b3 , 0 },
- { "hatafqamats1b", 0x05b3 , 0 },
- { "hatafqamats28", 0x05b3 , 0 },
- { "hatafqamats34", 0x05b3 , 0 },
- { "hatafqamatshebrew", 0x05b3 , 0 },
- { "hatafqamatsnarrowhebrew", 0x05b3 , 0 },
- { "hatafqamatsquarterhebrew", 0x05b3 , 0 },
- { "hatafqamatswidehebrew", 0x05b3 , 0 },
- { "hatafsegol", 0x05b1 , 0 },
- { "hatafsegol17", 0x05b1 , 0 },
- { "hatafsegol24", 0x05b1 , 0 },
- { "hatafsegol30", 0x05b1 , 0 },
- { "hatafsegolhebrew", 0x05b1 , 0 },
- { "hatafsegolnarrowhebrew", 0x05b1 , 0 },
- { "hatafsegolquarterhebrew", 0x05b1 , 0 },
- { "hatafsegolwidehebrew", 0x05b1 , 0 },
- { "hbopomofo", 0x310f , 0 },
- { "hbrevebelow", 0x1e2b , 0 },
- { "hcedilla", 0x1e29 , 0 },
- { "hcircle", 0x24d7 , 0 },
- { "hdieresis", 0x1e27 , 0 },
- { "hdotaccent", 0x1e23 , 0 },
- { "hdotbelow", 0x1e25 , 0 },
- { "he", 0x05d4 , 0 },
- { "heartsuitblack", 0x2665 , 0 },
- { "heartsuitwhite", 0x2661 , 0 },
- { "hedagesh", 0xfb34 , 0 },
- { "hedageshhebrew", 0xfb34 , 0 },
- { "hehaltonearabic", 0x06c1 , 0 },
- { "heharabic", 0x0647 , 0 },
- { "hehebrew", 0x05d4 , 0 },
- { "hehfinalaltonearabic", 0xfba7 , 0 },
- { "hehfinalalttwoarabic", 0xfeea , 0 },
- { "hehfinalarabic", 0xfeea , 0 },
- { "hehhamzaabovefinalarabic", 0xfba5 , 0 },
- { "hehhamzaaboveisolatedarabic", 0xfba4 , 0 },
- { "hehinitialaltonearabic", 0xfba8 , 0 },
- { "hehinitialarabic", 0xfeeb , 0 },
- { "hehiragana", 0x3078 , 0 },
- { "hehmedialaltonearabic", 0xfba9 , 0 },
- { "hehmedialarabic", 0xfeec , 0 },
- { "heiseierasquare", 0x337b , 0 },
- { "hekatakana", 0x30d8 , 0 },
- { "hekatakanahalfwidth", 0xff8d , 0 },
- { "hekutaarusquare", 0x3336 , 0 },
- { "henghook", 0x0267 , 0 },
- { "herutusquare", 0x3339 , 0 },
- { "het", 0x05d7 , 0 },
- { "hethebrew", 0x05d7 , 0 },
- { "hhook", 0x0266 , 0 },
- { "hhooksuperior", 0x02b1 , 0 },
- { "hieuhacirclekorean", 0x327b , 0 },
- { "hieuhaparenkorean", 0x321b , 0 },
- { "hieuhcirclekorean", 0x326d , 0 },
- { "hieuhkorean", 0x314e , 0 },
- { "hieuhparenkorean", 0x320d , 0 },
- { "hihiragana", 0x3072 , 0 },
- { "hikatakana", 0x30d2 , 0 },
- { "hikatakanahalfwidth", 0xff8b , 0 },
- { "hiriq", 0x05b4 , 0 },
- { "hiriq14", 0x05b4 , 0 },
- { "hiriq21", 0x05b4 , 0 },
- { "hiriq2d", 0x05b4 , 0 },
- { "hiriqhebrew", 0x05b4 , 0 },
- { "hiriqnarrowhebrew", 0x05b4 , 0 },
- { "hiriqquarterhebrew", 0x05b4 , 0 },
- { "hiriqwidehebrew", 0x05b4 , 0 },
- { "hlinebelow", 0x1e96 , 0 },
- { "hmonospace", 0xff48 , 0 },
- { "hoarmenian", 0x0570 , 0 },
- { "hohipthai", 0x0e2b , 0 },
- { "hohiragana", 0x307b , 0 },
- { "hokatakana", 0x30db , 0 },
- { "hokatakanahalfwidth", 0xff8e , 0 },
- { "holam", 0x05b9 , 0 },
- { "holam19", 0x05b9 , 0 },
- { "holam26", 0x05b9 , 0 },
- { "holam32", 0x05b9 , 0 },
- { "holamhebrew", 0x05b9 , 0 },
- { "holamnarrowhebrew", 0x05b9 , 0 },
- { "holamquarterhebrew", 0x05b9 , 0 },
- { "holamwidehebrew", 0x05b9 , 0 },
- { "honokhukthai", 0x0e2e , 0 },
- { "hookcmb", 0x0309 , 0 },
- { "hookpalatalizedbelowcmb", 0x0321 , 0 },
- { "hookretroflexbelowcmb", 0x0322 , 0 },
- { "hoonsquare", 0x3342 , 0 },
- { "horicoptic", 0x03e9 , 0 },
- { "horizontalbar", 0x2015 , 0 },
- { "horncmb", 0x031b , 0 },
- { "hotsprings", 0x2668 , 0 },
- { "hparen", 0x24a3 , 0 },
- { "hsuperior", 0x02b0 , 0 },
- { "hturned", 0x0265 , 0 },
- { "huhiragana", 0x3075 , 0 },
- { "huiitosquare", 0x3333 , 0 },
- { "hukatakana", 0x30d5 , 0 },
- { "hukatakanahalfwidth", 0xff8c , 0 },
- { "hungarumlautcmb", 0x030b , 0 },
- { "hv", 0x0195 , 0 },
- { "hypheninferior", 0xf6e5 , 0 },
- { "hyphenmonospace", 0xff0d , 0 },
- { "hyphensmall", 0xfe63 , 0 },
- { "hyphensuperior", 0xf6e6 , 0 },
- { "hyphentwo", 0x2010 , 0 },
- { "iacyrillic", 0x044f , 0 },
- { "ibengali", 0x0987 , 0 },
- { "ibopomofo", 0x3127 , 0 },
- { "icaron", 0x01d0 , 0 },
- { "icircle", 0x24d8 , 0 },
- { "icyrillic", 0x0456 , 0 },
- { "idblgrave", 0x0209 , 0 },
- { "ideographearthcircle", 0x328f , 0 },
- { "ideographfirecircle", 0x328b , 0 },
- { "ideographicallianceparen", 0x323f , 0 },
- { "ideographiccallparen", 0x323a , 0 },
- { "ideographiccentrecircle", 0x32a5 , 0 },
- { "ideographicclose", 0x3006 , 0 },
- { "ideographiccomma", 0x3001 , 0 },
- { "ideographiccommaleft", 0xff64 , 0 },
- { "ideographiccongratulationparen", 0x3237 , 0 },
- { "ideographiccorrectcircle", 0x32a3 , 0 },
- { "ideographicearthparen", 0x322f , 0 },
- { "ideographicenterpriseparen", 0x323d , 0 },
- { "ideographicexcellentcircle", 0x329d , 0 },
- { "ideographicfestivalparen", 0x3240 , 0 },
- { "ideographicfinancialcircle", 0x3296 , 0 },
- { "ideographicfinancialparen", 0x3236 , 0 },
- { "ideographicfireparen", 0x322b , 0 },
- { "ideographichaveparen", 0x3232 , 0 },
- { "ideographichighcircle", 0x32a4 , 0 },
- { "ideographiciterationmark", 0x3005 , 0 },
- { "ideographiclaborcircle", 0x3298 , 0 },
- { "ideographiclaborparen", 0x3238 , 0 },
- { "ideographicleftcircle", 0x32a7 , 0 },
- { "ideographiclowcircle", 0x32a6 , 0 },
- { "ideographicmedicinecircle", 0x32a9 , 0 },
- { "ideographicmetalparen", 0x322e , 0 },
- { "ideographicmoonparen", 0x322a , 0 },
- { "ideographicnameparen", 0x3234 , 0 },
- { "ideographicperiod", 0x3002 , 0 },
- { "ideographicprintcircle", 0x329e , 0 },
- { "ideographicreachparen", 0x3243 , 0 },
- { "ideographicrepresentparen", 0x3239 , 0 },
- { "ideographicresourceparen", 0x323e , 0 },
- { "ideographicrightcircle", 0x32a8 , 0 },
- { "ideographicsecretcircle", 0x3299 , 0 },
- { "ideographicselfparen", 0x3242 , 0 },
- { "ideographicsocietyparen", 0x3233 , 0 },
- { "ideographicspace", 0x3000 , 0 },
- { "ideographicspecialparen", 0x3235 , 0 },
- { "ideographicstockparen", 0x3231 , 0 },
- { "ideographicstudyparen", 0x323b , 0 },
- { "ideographicsunparen", 0x3230 , 0 },
- { "ideographicsuperviseparen", 0x323c , 0 },
- { "ideographicwaterparen", 0x322c , 0 },
- { "ideographicwoodparen", 0x322d , 0 },
- { "ideographiczero", 0x3007 , 0 },
- { "ideographmetalcircle", 0x328e , 0 },
- { "ideographmooncircle", 0x328a , 0 },
- { "ideographnamecircle", 0x3294 , 0 },
- { "ideographsuncircle", 0x3290 , 0 },
- { "ideographwatercircle", 0x328c , 0 },
- { "ideographwoodcircle", 0x328d , 0 },
- { "ideva", 0x0907 , 0 },
- { "idieresisacute", 0x1e2f , 0 },
- { "idieresiscyrillic", 0x04e5 , 0 },
- { "idotbelow", 0x1ecb , 0 },
- { "iebrevecyrillic", 0x04d7 , 0 },
- { "iecyrillic", 0x0435 , 0 },
- { "ieungacirclekorean", 0x3275 , 0 },
- { "ieungaparenkorean", 0x3215 , 0 },
- { "ieungcirclekorean", 0x3267 , 0 },
- { "ieungkorean", 0x3147 , 0 },
- { "ieungparenkorean", 0x3207 , 0 },
- { "igujarati", 0x0a87 , 0 },
- { "igurmukhi", 0x0a07 , 0 },
- { "ihiragana", 0x3044 , 0 },
- { "ihookabove", 0x1ec9 , 0 },
- { "iibengali", 0x0988 , 0 },
- { "iicyrillic", 0x0438 , 0 },
- { "iideva", 0x0908 , 0 },
- { "iigujarati", 0x0a88 , 0 },
- { "iigurmukhi", 0x0a08 , 0 },
- { "iimatragurmukhi", 0x0a40 , 0 },
- { "iinvertedbreve", 0x020b , 0 },
- { "iishortcyrillic", 0x0439 , 0 },
- { "iivowelsignbengali", 0x09c0 , 0 },
- { "iivowelsigndeva", 0x0940 , 0 },
- { "iivowelsigngujarati", 0x0ac0 , 0 },
- { "ikatakana", 0x30a4 , 0 },
- { "ikatakanahalfwidth", 0xff72 , 0 },
- { "ikorean", 0x3163 , 0 },
- { "ilde", 0x02dc , 0 },
- { "iluyhebrew", 0x05ac , 0 },
- { "imacroncyrillic", 0x04e3 , 0 },
- { "imageorapproximatelyequal", 0x2253 , 0 },
- { "imatragurmukhi", 0x0a3f , 0 },
- { "imonospace", 0xff49 , 0 },
- { "increment", 0x2206 , 0 },
- { "iniarmenian", 0x056b , 0 },
- { "integralbottom", 0x2321 , 0 },
- { "integralex", 0xf8f5 , 0 },
- { "integraltop", 0x2320 , 0 },
- { "intisquare", 0x3305 , 0 },
- { "iocyrillic", 0x0451 , 0 },
- { "iotalatin", 0x0269 , 0 },
- { "iparen", 0x24a4 , 0 },
- { "irigurmukhi", 0x0a72 , 0 },
- { "ismallhiragana", 0x3043 , 0 },
- { "ismallkatakana", 0x30a3 , 0 },
- { "ismallkatakanahalfwidth", 0xff68 , 0 },
- { "issharbengali", 0x09fa , 0 },
- { "istroke", 0x0268 , 0 },
- { "isuperior", 0xf6ed , 0 },
- { "iterationhiragana", 0x309d , 0 },
- { "iterationkatakana", 0x30fd , 0 },
- { "itildebelow", 0x1e2d , 0 },
- { "iubopomofo", 0x3129 , 0 },
- { "iucyrillic", 0x044e , 0 },
- { "ivowelsignbengali", 0x09bf , 0 },
- { "ivowelsigndeva", 0x093f , 0 },
- { "ivowelsigngujarati", 0x0abf , 0 },
- { "izhitsacyrillic", 0x0475 , 0 },
- { "izhitsadblgravecyrillic", 0x0477 , 0 },
- { "jaarmenian", 0x0571 , 0 },
- { "jabengali", 0x099c , 0 },
- { "jadeva", 0x091c , 0 },
- { "jagujarati", 0x0a9c , 0 },
- { "jagurmukhi", 0x0a1c , 0 },
- { "jbopomofo", 0x3110 , 0 },
- { "jcaron", 0x01f0 , 0 },
- { "jcircle", 0x24d9 , 0 },
- { "jcrossedtail", 0x029d , 0 },
- { "jdotlessstroke", 0x025f , 0 },
- { "jecyrillic", 0x0458 , 0 },
- { "jeemarabic", 0x062c , 0 },
- { "jeemfinalarabic", 0xfe9e , 0 },
- { "jeeminitialarabic", 0xfe9f , 0 },
- { "jeemmedialarabic", 0xfea0 , 0 },
- { "jeharabic", 0x0698 , 0 },
- { "jehfinalarabic", 0xfb8b , 0 },
- { "jhabengali", 0x099d , 0 },
- { "jhadeva", 0x091d , 0 },
- { "jhagujarati", 0x0a9d , 0 },
- { "jhagurmukhi", 0x0a1d , 0 },
- { "jheharmenian", 0x057b , 0 },
- { "jis", 0x3004 , 0 },
- { "jmonospace", 0xff4a , 0 },
- { "jparen", 0x24a5 , 0 },
- { "jsuperior", 0x02b2 , 0 },
- { "kabashkircyrillic", 0x04a1 , 0 },
- { "kabengali", 0x0995 , 0 },
- { "kacute", 0x1e31 , 0 },
- { "kacyrillic", 0x043a , 0 },
- { "kadescendercyrillic", 0x049b , 0 },
- { "kadeva", 0x0915 , 0 },
- { "kaf", 0x05db , 0 },
- { "kafarabic", 0x0643 , 0 },
- { "kafdagesh", 0xfb3b , 0 },
- { "kafdageshhebrew", 0xfb3b , 0 },
- { "kaffinalarabic", 0xfeda , 0 },
- { "kafhebrew", 0x05db , 0 },
- { "kafinitialarabic", 0xfedb , 0 },
- { "kafmedialarabic", 0xfedc , 0 },
- { "kafrafehebrew", 0xfb4d , 0 },
- { "kagujarati", 0x0a95 , 0 },
- { "kagurmukhi", 0x0a15 , 0 },
- { "kahiragana", 0x304b , 0 },
- { "kahookcyrillic", 0x04c4 , 0 },
- { "kakatakana", 0x30ab , 0 },
- { "kakatakanahalfwidth", 0xff76 , 0 },
- { "kappasymbolgreek", 0x03f0 , 0 },
- { "kapyeounmieumkorean", 0x3171 , 0 },
- { "kapyeounphieuphkorean", 0x3184 , 0 },
- { "kapyeounpieupkorean", 0x3178 , 0 },
- { "kapyeounssangpieupkorean", 0x3179 , 0 },
- { "karoriisquare", 0x330d , 0 },
- { "kashidaautoarabic", 0x0640 , 0 },
- { "kashidaautonosidebearingarabic", 0x0640 , 0 },
- { "kasmallkatakana", 0x30f5 , 0 },
- { "kasquare", 0x3384 , 0 },
- { "kasraarabic", 0x0650 , 0 },
- { "kasratanarabic", 0x064d , 0 },
- { "kastrokecyrillic", 0x049f , 0 },
- { "katahiraprolongmarkhalfwidth", 0xff70 , 0 },
- { "kaverticalstrokecyrillic", 0x049d , 0 },
- { "kbopomofo", 0x310e , 0 },
- { "kcalsquare", 0x3389 , 0 },
- { "kcaron", 0x01e9 , 0 },
- { "kcedilla", 0x0137 , 0 },
- { "kcircle", 0x24da , 0 },
- { "kdotbelow", 0x1e33 , 0 },
- { "keharmenian", 0x0584 , 0 },
- { "kehiragana", 0x3051 , 0 },
- { "kekatakana", 0x30b1 , 0 },
- { "kekatakanahalfwidth", 0xff79 , 0 },
- { "kenarmenian", 0x056f , 0 },
- { "kesmallkatakana", 0x30f6 , 0 },
- { "khabengali", 0x0996 , 0 },
- { "khacyrillic", 0x0445 , 0 },
- { "khadeva", 0x0916 , 0 },
- { "khagujarati", 0x0a96 , 0 },
- { "khagurmukhi", 0x0a16 , 0 },
- { "khaharabic", 0x062e , 0 },
- { "khahfinalarabic", 0xfea6 , 0 },
- { "khahinitialarabic", 0xfea7 , 0 },
- { "khahmedialarabic", 0xfea8 , 0 },
- { "kheicoptic", 0x03e7 , 0 },
- { "khhadeva", 0x0959 , 0 },
- { "khhagurmukhi", 0x0a59 , 0 },
- { "khieukhacirclekorean", 0x3278 , 0 },
- { "khieukhaparenkorean", 0x3218 , 0 },
- { "khieukhcirclekorean", 0x326a , 0 },
- { "khieukhkorean", 0x314b , 0 },
- { "khieukhparenkorean", 0x320a , 0 },
- { "khokhaithai", 0x0e02 , 0 },
- { "khokhonthai", 0x0e05 , 0 },
- { "khokhuatthai", 0x0e03 , 0 },
- { "khokhwaithai", 0x0e04 , 0 },
- { "khomutthai", 0x0e5b , 0 },
- { "khook", 0x0199 , 0 },
- { "khorakhangthai", 0x0e06 , 0 },
- { "khzsquare", 0x3391 , 0 },
- { "kihiragana", 0x304d , 0 },
- { "kikatakana", 0x30ad , 0 },
- { "kikatakanahalfwidth", 0xff77 , 0 },
- { "kiroguramusquare", 0x3315 , 0 },
- { "kiromeetorusquare", 0x3316 , 0 },
- { "kirosquare", 0x3314 , 0 },
- { "kiyeokacirclekorean", 0x326e , 0 },
- { "kiyeokaparenkorean", 0x320e , 0 },
- { "kiyeokcirclekorean", 0x3260 , 0 },
- { "kiyeokkorean", 0x3131 , 0 },
- { "kiyeokparenkorean", 0x3200 , 0 },
- { "kiyeoksioskorean", 0x3133 , 0 },
- { "kjecyrillic", 0x045c , 0 },
- { "klinebelow", 0x1e35 , 0 },
- { "klsquare", 0x3398 , 0 },
- { "kmcubedsquare", 0x33a6 , 0 },
- { "kmonospace", 0xff4b , 0 },
- { "kmsquaredsquare", 0x33a2 , 0 },
- { "kohiragana", 0x3053 , 0 },
- { "kohmsquare", 0x33c0 , 0 },
- { "kokaithai", 0x0e01 , 0 },
- { "kokatakana", 0x30b3 , 0 },
- { "kokatakanahalfwidth", 0xff7a , 0 },
- { "kooposquare", 0x331e , 0 },
- { "koppacyrillic", 0x0481 , 0 },
- { "koreanstandardsymbol", 0x327f , 0 },
- { "koroniscmb", 0x0343 , 0 },
- { "kparen", 0x24a6 , 0 },
- { "kpasquare", 0x33aa , 0 },
- { "ksicyrillic", 0x046f , 0 },
- { "ktsquare", 0x33cf , 0 },
- { "kturned", 0x029e , 0 },
- { "kuhiragana", 0x304f , 0 },
- { "kukatakana", 0x30af , 0 },
- { "kukatakanahalfwidth", 0xff78 , 0 },
- { "kvsquare", 0x33b8 , 0 },
- { "kwsquare", 0x33be , 0 },
- { "labengali", 0x09b2 , 0 },
- { "ladeva", 0x0932 , 0 },
- { "lagujarati", 0x0ab2 , 0 },
- { "lagurmukhi", 0x0a32 , 0 },
- { "lakkhangyaothai", 0x0e45 , 0 },
- { "lamaleffinalarabic", 0xfefc , 0 },
- { "lamalefhamzaabovefinalarabic", 0xfef8 , 0 },
- { "lamalefhamzaaboveisolatedarabic", 0xfef7 , 0 },
- { "lamalefhamzabelowfinalarabic", 0xfefa , 0 },
- { "lamalefhamzabelowisolatedarabic", 0xfef9 , 0 },
- { "lamalefisolatedarabic", 0xfefb , 0 },
- { "lamalefmaddaabovefinalarabic", 0xfef6 , 0 },
- { "lamalefmaddaaboveisolatedarabic", 0xfef5 , 0 },
- { "lamarabic", 0x0644 , 0 },
- { "lambdastroke", 0x019b , 0 },
- { "lamed", 0x05dc , 0 },
- { "lameddagesh", 0xfb3c , 0 },
- { "lameddageshhebrew", 0xfb3c , 0 },
- { "lamedhebrew", 0x05dc , 0 },
- { "lamedholam", 0x05dc , 0 },
- { "lamedholamdagesh", 0x05dc , 0 },
- { "lamedholamdageshhebrew", 0x05dc , 0 },
- { "lamedholamhebrew", 0x05dc , 0 },
- { "lamfinalarabic", 0xfede , 0 },
- { "lamhahinitialarabic", 0xfcca , 0 },
- { "laminitialarabic", 0xfedf , 0 },
- { "lamjeeminitialarabic", 0xfcc9 , 0 },
- { "lamkhahinitialarabic", 0xfccb , 0 },
- { "lamlamhehisolatedarabic", 0xfdf2 , 0 },
- { "lammedialarabic", 0xfee0 , 0 },
- { "lammeemhahinitialarabic", 0xfd88 , 0 },
- { "lammeeminitialarabic", 0xfccc , 0 },
- { "lammeemjeeminitialarabic", 0xfedf , 0 },
- { "lammeemkhahinitialarabic", 0xfedf , 0 },
- { "largecircle", 0x25ef , 0 },
- { "lbar", 0x019a , 0 },
- { "lbelt", 0x026c , 0 },
- { "lbopomofo", 0x310c , 0 },
- { "lcedilla", 0x013c , 0 },
- { "lcircle", 0x24db , 0 },
- { "lcircumflexbelow", 0x1e3d , 0 },
- { "ldotaccent", 0x0140 , 0 },
- { "ldotbelow", 0x1e37 , 0 },
- { "ldotbelowmacron", 0x1e39 , 0 },
- { "leftangleabovecmb", 0x031a , 0 },
- { "lefttackbelowcmb", 0x0318 , 0 },
- { "lessequalorgreater", 0x22da , 0 },
- { "lessmonospace", 0xff1c , 0 },
- { "lessorequivalent", 0x2272 , 0 },
- { "lessorgreater", 0x2276 , 0 },
- { "lessoverequal", 0x2266 , 0 },
- { "lesssmall", 0xfe64 , 0 },
- { "lezh", 0x026e , 0 },
- { "lhookretroflex", 0x026d , 0 },
- { "liwnarmenian", 0x056c , 0 },
- { "lj", 0x01c9 , 0 },
- { "ljecyrillic", 0x0459 , 0 },
- { "ll", 0xf6c0 , 0 },
- { "lladeva", 0x0933 , 0 },
- { "llagujarati", 0x0ab3 , 0 },
- { "llinebelow", 0x1e3b , 0 },
- { "llladeva", 0x0934 , 0 },
- { "llvocalicbengali", 0x09e1 , 0 },
- { "llvocalicdeva", 0x0961 , 0 },
- { "llvocalicvowelsignbengali", 0x09e3 , 0 },
- { "llvocalicvowelsigndeva", 0x0963 , 0 },
- { "lmiddletilde", 0x026b , 0 },
- { "lmonospace", 0xff4c , 0 },
- { "lmsquare", 0x33d0 , 0 },
- { "lochulathai", 0x0e2c , 0 },
- { "logicalnotreversed", 0x2310 , 0 },
- { "lolingthai", 0x0e25 , 0 },
- { "lowlinecenterline", 0xfe4e , 0 },
- { "lowlinecmb", 0x0332 , 0 },
- { "lowlinedashed", 0xfe4d , 0 },
- { "lparen", 0x24a7 , 0 },
- { "lsquare", 0x2113 , 0 },
- { "lsuperior", 0xf6ee , 0 },
- { "luthai", 0x0e26 , 0 },
- { "lvocalicbengali", 0x098c , 0 },
- { "lvocalicdeva", 0x090c , 0 },
- { "lvocalicvowelsignbengali", 0x09e2 , 0 },
- { "lvocalicvowelsigndeva", 0x0962 , 0 },
- { "lxsquare", 0x33d3 , 0 },
- { "mabengali", 0x09ae , 0 },
- { "macronbelowcmb", 0x0331 , 0 },
- { "macroncmb", 0x0304 , 0 },
- { "macronlowmod", 0x02cd , 0 },
- { "macronmonospace", 0xffe3 , 0 },
- { "macute", 0x1e3f , 0 },
- { "madeva", 0x092e , 0 },
- { "magujarati", 0x0aae , 0 },
- { "magurmukhi", 0x0a2e , 0 },
- { "mahapakhhebrew", 0x05a4 , 0 },
- { "mahapakhlefthebrew", 0x05a4 , 0 },
- { "mahiragana", 0x307e , 0 },
- { "maichattawalowleftthai", 0xf895 , 0 },
- { "maichattawalowrightthai", 0xf894 , 0 },
- { "maichattawathai", 0x0e4b , 0 },
- { "maichattawaupperleftthai", 0xf893 , 0 },
- { "maieklowleftthai", 0xf88c , 0 },
- { "maieklowrightthai", 0xf88b , 0 },
- { "maiekthai", 0x0e48 , 0 },
- { "maiekupperleftthai", 0xf88a , 0 },
- { "maihanakatleftthai", 0xf884 , 0 },
- { "maihanakatthai", 0x0e31 , 0 },
- { "maitaikhuleftthai", 0xf889 , 0 },
- { "maitaikhuthai", 0x0e47 , 0 },
- { "maitholowleftthai", 0xf88f , 0 },
- { "maitholowrightthai", 0xf88e , 0 },
- { "maithothai", 0x0e49 , 0 },
- { "maithoupperleftthai", 0xf88d , 0 },
- { "maitrilowleftthai", 0xf892 , 0 },
- { "maitrilowrightthai", 0xf891 , 0 },
- { "maitrithai", 0x0e4a , 0 },
- { "maitriupperleftthai", 0xf890 , 0 },
- { "maiyamokthai", 0x0e46 , 0 },
- { "makatakana", 0x30de , 0 },
- { "makatakanahalfwidth", 0xff8f , 0 },
- { "mansyonsquare", 0x3347 , 0 },
- { "maqafhebrew", 0x05be , 0 },
- { "mars", 0x2642 , 0 },
- { "masoracirclehebrew", 0x05af , 0 },
- { "masquare", 0x3383 , 0 },
- { "mbopomofo", 0x3107 , 0 },
- { "mbsquare", 0x33d4 , 0 },
- { "mcircle", 0x24dc , 0 },
- { "mcubedsquare", 0x33a5 , 0 },
- { "mdotaccent", 0x1e41 , 0 },
- { "mdotbelow", 0x1e43 , 0 },
- { "meemarabic", 0x0645 , 0 },
- { "meemfinalarabic", 0xfee2 , 0 },
- { "meeminitialarabic", 0xfee3 , 0 },
- { "meemmedialarabic", 0xfee4 , 0 },
- { "meemmeeminitialarabic", 0xfcd1 , 0 },
- { "meemmeemisolatedarabic", 0xfc48 , 0 },
- { "meetorusquare", 0x334d , 0 },
- { "mehiragana", 0x3081 , 0 },
- { "meizierasquare", 0x337e , 0 },
- { "mekatakana", 0x30e1 , 0 },
- { "mekatakanahalfwidth", 0xff92 , 0 },
- { "mem", 0x05de , 0 },
- { "memdagesh", 0xfb3e , 0 },
- { "memdageshhebrew", 0xfb3e , 0 },
- { "memhebrew", 0x05de , 0 },
- { "menarmenian", 0x0574 , 0 },
- { "merkhahebrew", 0x05a5 , 0 },
- { "merkhakefulahebrew", 0x05a6 , 0 },
- { "merkhakefulalefthebrew", 0x05a6 , 0 },
- { "merkhalefthebrew", 0x05a5 , 0 },
- { "mhook", 0x0271 , 0 },
- { "mhzsquare", 0x3392 , 0 },
- { "middledotkatakanahalfwidth", 0xff65 , 0 },
- { "middot", 0x00b7 , 0 },
- { "mieumacirclekorean", 0x3272 , 0 },
- { "mieumaparenkorean", 0x3212 , 0 },
- { "mieumcirclekorean", 0x3264 , 0 },
- { "mieumkorean", 0x3141 , 0 },
- { "mieumpansioskorean", 0x3170 , 0 },
- { "mieumparenkorean", 0x3204 , 0 },
- { "mieumpieupkorean", 0x316e , 0 },
- { "mieumsioskorean", 0x316f , 0 },
- { "mihiragana", 0x307f , 0 },
- { "mikatakana", 0x30df , 0 },
- { "mikatakanahalfwidth", 0xff90 , 0 },
- { "minusbelowcmb", 0x0320 , 0 },
- { "minuscircle", 0x2296 , 0 },
- { "minusmod", 0x02d7 , 0 },
- { "minusplus", 0x2213 , 0 },
- { "miribaarusquare", 0x334a , 0 },
- { "mirisquare", 0x3349 , 0 },
- { "mlonglegturned", 0x0270 , 0 },
- { "mlsquare", 0x3396 , 0 },
- { "mmcubedsquare", 0x33a3 , 0 },
- { "mmonospace", 0xff4d , 0 },
- { "mmsquaredsquare", 0x339f , 0 },
- { "mohiragana", 0x3082 , 0 },
- { "mohmsquare", 0x33c1 , 0 },
- { "mokatakana", 0x30e2 , 0 },
- { "mokatakanahalfwidth", 0xff93 , 0 },
- { "molsquare", 0x33d6 , 0 },
- { "momathai", 0x0e21 , 0 },
- { "moverssquare", 0x33a7 , 0 },
- { "moverssquaredsquare", 0x33a8 , 0 },
- { "mparen", 0x24a8 , 0 },
- { "mpasquare", 0x33ab , 0 },
- { "mssquare", 0x33b3 , 0 },
- { "msuperior", 0xf6ef , 0 },
- { "mturned", 0x026f , 0 },
- { "mu1", 0x00b5 , 0 },
- { "muasquare", 0x3382 , 0 },
- { "muchgreater", 0x226b , 0 },
- { "muchless", 0x226a , 0 },
- { "mufsquare", 0x338c , 0 },
- { "mugreek", 0x03bc , 0 },
- { "mugsquare", 0x338d , 0 },
- { "muhiragana", 0x3080 , 0 },
- { "mukatakana", 0x30e0 , 0 },
- { "mukatakanahalfwidth", 0xff91 , 0 },
- { "mulsquare", 0x3395 , 0 },
- { "mumsquare", 0x339b , 0 },
- { "munahhebrew", 0x05a3 , 0 },
- { "munahlefthebrew", 0x05a3 , 0 },
- { "musicflatsign", 0x266d , 0 },
- { "musicsharpsign", 0x266f , 0 },
- { "mussquare", 0x33b2 , 0 },
- { "muvsquare", 0x33b6 , 0 },
- { "muwsquare", 0x33bc , 0 },
- { "mvmegasquare", 0x33b9 , 0 },
- { "mvsquare", 0x33b7 , 0 },
- { "mwmegasquare", 0x33bf , 0 },
- { "mwsquare", 0x33bd , 0 },
- { "nabengali", 0x09a8 , 0 },
- { "nabla", 0x2207 , 0 },
- { "nadeva", 0x0928 , 0 },
- { "nagujarati", 0x0aa8 , 0 },
- { "nagurmukhi", 0x0a28 , 0 },
- { "nahiragana", 0x306a , 0 },
- { "nakatakana", 0x30ca , 0 },
- { "nakatakanahalfwidth", 0xff85 , 0 },
- { "nasquare", 0x3381 , 0 },
- { "nbopomofo", 0x310b , 0 },
- { "nbspace", 0x00a0 , 0 },
- { "ncedilla", 0x0146 , 0 },
- { "ncircle", 0x24dd , 0 },
- { "ncircumflexbelow", 0x1e4b , 0 },
- { "ndotaccent", 0x1e45 , 0 },
- { "ndotbelow", 0x1e47 , 0 },
- { "nehiragana", 0x306d , 0 },
- { "nekatakana", 0x30cd , 0 },
- { "nekatakanahalfwidth", 0xff88 , 0 },
- { "newsheqelsign", 0x20aa , 0 },
- { "nfsquare", 0x338b , 0 },
- { "ngabengali", 0x0999 , 0 },
- { "ngadeva", 0x0919 , 0 },
- { "ngagujarati", 0x0a99 , 0 },
- { "ngagurmukhi", 0x0a19 , 0 },
- { "ngonguthai", 0x0e07 , 0 },
- { "nhiragana", 0x3093 , 0 },
- { "nhookleft", 0x0272 , 0 },
- { "nhookretroflex", 0x0273 , 0 },
- { "nieunacirclekorean", 0x326f , 0 },
- { "nieunaparenkorean", 0x320f , 0 },
- { "nieuncieuckorean", 0x3135 , 0 },
- { "nieuncirclekorean", 0x3261 , 0 },
- { "nieunhieuhkorean", 0x3136 , 0 },
- { "nieunkorean", 0x3134 , 0 },
- { "nieunpansioskorean", 0x3168 , 0 },
- { "nieunparenkorean", 0x3201 , 0 },
- { "nieunsioskorean", 0x3167 , 0 },
- { "nieuntikeutkorean", 0x3166 , 0 },
- { "nihiragana", 0x306b , 0 },
- { "nikatakana", 0x30cb , 0 },
- { "nikatakanahalfwidth", 0xff86 , 0 },
- { "nikhahitleftthai", 0xf899 , 0 },
- { "nikhahitthai", 0x0e4d , 0 },
- { "ninearabic", 0x0669 , 0 },
- { "ninebengali", 0x09ef , 0 },
- { "ninecircle", 0x2468 , 0 },
- { "ninecircleinversesansserif", 0x2792 , 0 },
- { "ninedeva", 0x096f , 0 },
- { "ninegujarati", 0x0aef , 0 },
- { "ninegurmukhi", 0x0a6f , 0 },
- { "ninehackarabic", 0x0669 , 0 },
- { "ninehangzhou", 0x3029 , 0 },
- { "nineideographicparen", 0x3228 , 0 },
- { "nineinferior", 0x2089 , 0 },
- { "ninemonospace", 0xff19 , 0 },
- { "nineoldstyle", 0xf739 , 0 },
- { "nineparen", 0x247c , 0 },
- { "nineperiod", 0x2490 , 0 },
- { "ninepersian", 0x06f9 , 0 },
- { "nineroman", 0x2178 , 0 },
- { "ninesuperior", 0x2079 , 0 },
- { "nineteencircle", 0x2472 , 0 },
- { "nineteenparen", 0x2486 , 0 },
- { "nineteenperiod", 0x249a , 0 },
- { "ninethai", 0x0e59 , 0 },
- { "nj", 0x01cc , 0 },
- { "njecyrillic", 0x045a , 0 },
- { "nkatakana", 0x30f3 , 0 },
- { "nkatakanahalfwidth", 0xff9d , 0 },
- { "nlegrightlong", 0x019e , 0 },
- { "nlinebelow", 0x1e49 , 0 },
- { "nmonospace", 0xff4e , 0 },
- { "nmsquare", 0x339a , 0 },
- { "nnabengali", 0x09a3 , 0 },
- { "nnadeva", 0x0923 , 0 },
- { "nnagujarati", 0x0aa3 , 0 },
- { "nnagurmukhi", 0x0a23 , 0 },
- { "nnnadeva", 0x0929 , 0 },
- { "nohiragana", 0x306e , 0 },
- { "nokatakana", 0x30ce , 0 },
- { "nokatakanahalfwidth", 0xff89 , 0 },
- { "nonbreakingspace", 0x00a0 , 0 },
- { "nonenthai", 0x0e13 , 0 },
- { "nonuthai", 0x0e19 , 0 },
- { "noonarabic", 0x0646 , 0 },
- { "noonfinalarabic", 0xfee6 , 0 },
- { "noonghunnaarabic", 0x06ba , 0 },
- { "noonghunnafinalarabic", 0xfb9f , 0 },
- { "noonhehinitialarabic", 0xfee7 , 0 },
- { "nooninitialarabic", 0xfee7 , 0 },
- { "noonjeeminitialarabic", 0xfcd2 , 0 },
- { "noonjeemisolatedarabic", 0xfc4b , 0 },
- { "noonmedialarabic", 0xfee8 , 0 },
- { "noonmeeminitialarabic", 0xfcd5 , 0 },
- { "noonmeemisolatedarabic", 0xfc4e , 0 },
- { "noonnoonfinalarabic", 0xfc8d , 0 },
- { "notcontains", 0x220c , 0 },
- { "notelementof", 0x2209 , 0 },
- { "notgreater", 0x226f , 0 },
- { "notgreaternorequal", 0x2271 , 0 },
- { "notgreaternorless", 0x2279 , 0 },
- { "notidentical", 0x2262 , 0 },
- { "notless", 0x226e , 0 },
- { "notlessnorequal", 0x2270 , 0 },
- { "notparallel", 0x2226 , 0 },
- { "notprecedes", 0x2280 , 0 },
- { "notsucceeds", 0x2281 , 0 },
- { "notsuperset", 0x2285 , 0 },
- { "nowarmenian", 0x0576 , 0 },
- { "nparen", 0x24a9 , 0 },
- { "nssquare", 0x33b1 , 0 },
- { "nsuperior", 0x207f , 0 },
- { "nuhiragana", 0x306c , 0 },
- { "nukatakana", 0x30cc , 0 },
- { "nukatakanahalfwidth", 0xff87 , 0 },
- { "nuktabengali", 0x09bc , 0 },
- { "nuktadeva", 0x093c , 0 },
- { "nuktagujarati", 0x0abc , 0 },
- { "nuktagurmukhi", 0x0a3c , 0 },
- { "numbersignmonospace", 0xff03 , 0 },
- { "numbersignsmall", 0xfe5f , 0 },
- { "numeralsigngreek", 0x0374 , 0 },
- { "numeralsignlowergreek", 0x0375 , 0 },
- { "numero", 0x2116 , 0 },
- { "nun", 0x05e0 , 0 },
- { "nundagesh", 0xfb40 , 0 },
- { "nundageshhebrew", 0xfb40 , 0 },
- { "nunhebrew", 0x05e0 , 0 },
- { "nvsquare", 0x33b5 , 0 },
- { "nwsquare", 0x33bb , 0 },
- { "nyabengali", 0x099e , 0 },
- { "nyadeva", 0x091e , 0 },
- { "nyagujarati", 0x0a9e , 0 },
- { "nyagurmukhi", 0x0a1e , 0 },
- { "oangthai", 0x0e2d , 0 },
- { "obarred", 0x0275 , 0 },
- { "obarredcyrillic", 0x04e9 , 0 },
- { "obarreddieresiscyrillic", 0x04eb , 0 },
- { "obengali", 0x0993 , 0 },
- { "obopomofo", 0x311b , 0 },
- { "ocandradeva", 0x0911 , 0 },
- { "ocandragujarati", 0x0a91 , 0 },
- { "ocandravowelsigndeva", 0x0949 , 0 },
- { "ocandravowelsigngujarati", 0x0ac9 , 0 },
- { "ocaron", 0x01d2 , 0 },
- { "ocircle", 0x24de , 0 },
- { "ocircumflexacute", 0x1ed1 , 0 },
- { "ocircumflexdotbelow", 0x1ed9 , 0 },
- { "ocircumflexgrave", 0x1ed3 , 0 },
- { "ocircumflexhookabove", 0x1ed5 , 0 },
- { "ocircumflextilde", 0x1ed7 , 0 },
- { "ocyrillic", 0x043e , 0 },
- { "odblacute", 0x0151 , 0 },
- { "odblgrave", 0x020d , 0 },
- { "odeva", 0x0913 , 0 },
- { "odieresiscyrillic", 0x04e7 , 0 },
- { "odotbelow", 0x1ecd , 0 },
- { "oekorean", 0x315a , 0 },
- { "ogonekcmb", 0x0328 , 0 },
- { "ogujarati", 0x0a93 , 0 },
- { "oharmenian", 0x0585 , 0 },
- { "ohiragana", 0x304a , 0 },
- { "ohookabove", 0x1ecf , 0 },
- { "ohornacute", 0x1edb , 0 },
- { "ohorndotbelow", 0x1ee3 , 0 },
- { "ohorngrave", 0x1edd , 0 },
- { "ohornhookabove", 0x1edf , 0 },
- { "ohorntilde", 0x1ee1 , 0 },
- { "oi", 0x01a3 , 0 },
- { "oinvertedbreve", 0x020f , 0 },
- { "okatakana", 0x30aa , 0 },
- { "okatakanahalfwidth", 0xff75 , 0 },
- { "okorean", 0x3157 , 0 },
- { "olehebrew", 0x05ab , 0 },
- { "omacronacute", 0x1e53 , 0 },
- { "omacrongrave", 0x1e51 , 0 },
- { "omdeva", 0x0950 , 0 },
- { "omegacyrillic", 0x0461 , 0 },
- { "omegalatinclosed", 0x0277 , 0 },
- { "omegaroundcyrillic", 0x047b , 0 },
- { "omegatitlocyrillic", 0x047d , 0 },
- { "omgujarati", 0x0ad0 , 0 },
- { "omonospace", 0xff4f , 0 },
- { "onearabic", 0x0661 , 0 },
- { "onebengali", 0x09e7 , 0 },
- { "onecircle", 0x2460 , 0 },
- { "onecircleinversesansserif", 0x278a , 0 },
- { "onedeva", 0x0967 , 0 },
- { "onefitted", 0xf6dc , 0 },
- { "onegujarati", 0x0ae7 , 0 },
- { "onegurmukhi", 0x0a67 , 0 },
- { "onehackarabic", 0x0661 , 0 },
- { "onehangzhou", 0x3021 , 0 },
- { "oneideographicparen", 0x3220 , 0 },
- { "oneinferior", 0x2081 , 0 },
- { "onemonospace", 0xff11 , 0 },
- { "onenumeratorbengali", 0x09f4 , 0 },
- { "oneoldstyle", 0xf731 , 0 },
- { "oneparen", 0x2474 , 0 },
- { "oneperiod", 0x2488 , 0 },
- { "onepersian", 0x06f1 , 0 },
- { "oneroman", 0x2170 , 0 },
- { "onesuperior", 0x00b9 , 0 },
- { "onethai", 0x0e51 , 0 },
- { "oogonek", 0x01eb , 0 },
- { "oogonekmacron", 0x01ed , 0 },
- { "oogurmukhi", 0x0a13 , 0 },
- { "oomatragurmukhi", 0x0a4b , 0 },
- { "oopen", 0x0254 , 0 },
- { "oparen", 0x24aa , 0 },
- { "option", 0x2325 , 0 },
- { "oshortdeva", 0x0912 , 0 },
- { "oshortvowelsigndeva", 0x094a , 0 },
- { "osmallhiragana", 0x3049 , 0 },
- { "osmallkatakana", 0x30a9 , 0 },
- { "osmallkatakanahalfwidth", 0xff6b , 0 },
- { "ostrokeacute", 0x01ff , 0 },
- { "osuperior", 0xf6f0 , 0 },
- { "otcyrillic", 0x047f , 0 },
- { "otildeacute", 0x1e4d , 0 },
- { "otildedieresis", 0x1e4f , 0 },
- { "oubopomofo", 0x3121 , 0 },
- { "overline", 0x203e , 0 },
- { "overlinecenterline", 0xfe4a , 0 },
- { "overlinecmb", 0x0305 , 0 },
- { "overlinedashed", 0xfe49 , 0 },
- { "overlinedblwavy", 0xfe4c , 0 },
- { "overlinewavy", 0xfe4b , 0 },
- { "overscore", 0x00af , 0 },
- { "ovowelsignbengali", 0x09cb , 0 },
- { "ovowelsigndeva", 0x094b , 0 },
- { "ovowelsigngujarati", 0x0acb , 0 },
- { "paampssquare", 0x3380 , 0 },
- { "paasentosquare", 0x332b , 0 },
- { "pabengali", 0x09aa , 0 },
- { "pacute", 0x1e55 , 0 },
- { "padeva", 0x092a , 0 },
- { "pagedown", 0x21df , 0 },
- { "pageup", 0x21de , 0 },
- { "pagujarati", 0x0aaa , 0 },
- { "pagurmukhi", 0x0a2a , 0 },
- { "pahiragana", 0x3071 , 0 },
- { "paiyannoithai", 0x0e2f , 0 },
- { "pakatakana", 0x30d1 , 0 },
- { "palatalizationcyrilliccmb", 0x0484 , 0 },
- { "palochkacyrillic", 0x04c0 , 0 },
- { "pansioskorean", 0x317f , 0 },
- { "parallel", 0x2225 , 0 },
- { "parenleftaltonearabic", 0xfd3e , 0 },
- { "parenleftbt", 0xf8ed , 0 },
- { "parenleftex", 0xf8ec , 0 },
- { "parenleftinferior", 0x208d , 0 },
- { "parenleftmonospace", 0xff08 , 0 },
- { "parenleftsmall", 0xfe59 , 0 },
- { "parenleftsuperior", 0x207d , 0 },
- { "parenlefttp", 0xf8eb , 0 },
- { "parenleftvertical", 0xfe35 , 0 },
- { "parenrightaltonearabic", 0xfd3f , 0 },
- { "parenrightbt", 0xf8f8 , 0 },
- { "parenrightex", 0xf8f7 , 0 },
- { "parenrightinferior", 0x208e , 0 },
- { "parenrightmonospace", 0xff09 , 0 },
- { "parenrightsmall", 0xfe5a , 0 },
- { "parenrightsuperior", 0x207e , 0 },
- { "parenrighttp", 0xf8f6 , 0 },
- { "parenrightvertical", 0xfe36 , 0 },
- { "paseqhebrew", 0x05c0 , 0 },
- { "pashtahebrew", 0x0599 , 0 },
- { "pasquare", 0x33a9 , 0 },
- { "patah", 0x05b7 , 0 },
- { "patah11", 0x05b7 , 0 },
- { "patah1d", 0x05b7 , 0 },
- { "patah2a", 0x05b7 , 0 },
- { "patahhebrew", 0x05b7 , 0 },
- { "patahnarrowhebrew", 0x05b7 , 0 },
- { "patahquarterhebrew", 0x05b7 , 0 },
- { "patahwidehebrew", 0x05b7 , 0 },
- { "pazerhebrew", 0x05a1 , 0 },
- { "pbopomofo", 0x3106 , 0 },
- { "pcircle", 0x24df , 0 },
- { "pdotaccent", 0x1e57 , 0 },
- { "pe", 0x05e4 , 0 },
- { "pecyrillic", 0x043f , 0 },
- { "pedagesh", 0xfb44 , 0 },
- { "pedageshhebrew", 0xfb44 , 0 },
- { "peezisquare", 0x333b , 0 },
- { "pefinaldageshhebrew", 0xfb43 , 0 },
- { "peharabic", 0x067e , 0 },
- { "peharmenian", 0x057a , 0 },
- { "pehebrew", 0x05e4 , 0 },
- { "pehfinalarabic", 0xfb57 , 0 },
- { "pehinitialarabic", 0xfb58 , 0 },
- { "pehiragana", 0x307a , 0 },
- { "pehmedialarabic", 0xfb59 , 0 },
- { "pekatakana", 0x30da , 0 },
- { "pemiddlehookcyrillic", 0x04a7 , 0 },
- { "perafehebrew", 0xfb4e , 0 },
- { "percentarabic", 0x066a , 0 },
- { "percentmonospace", 0xff05 , 0 },
- { "percentsmall", 0xfe6a , 0 },
- { "periodarmenian", 0x0589 , 0 },
- { "periodhalfwidth", 0xff61 , 0 },
- { "periodinferior", 0xf6e7 , 0 },
- { "periodmonospace", 0xff0e , 0 },
- { "periodsmall", 0xfe52 , 0 },
- { "periodsuperior", 0xf6e8 , 0 },
- { "perispomenigreekcmb", 0x0342 , 0 },
- { "pfsquare", 0x338a , 0 },
- { "phabengali", 0x09ab , 0 },
- { "phadeva", 0x092b , 0 },
- { "phagujarati", 0x0aab , 0 },
- { "phagurmukhi", 0x0a2b , 0 },
- { "phieuphacirclekorean", 0x327a , 0 },
- { "phieuphaparenkorean", 0x321a , 0 },
- { "phieuphcirclekorean", 0x326c , 0 },
- { "phieuphkorean", 0x314d , 0 },
- { "phieuphparenkorean", 0x320c , 0 },
- { "philatin", 0x0278 , 0 },
- { "phinthuthai", 0x0e3a , 0 },
- { "phisymbolgreek", 0x03d5 , 0 },
- { "phook", 0x01a5 , 0 },
- { "phophanthai", 0x0e1e , 0 },
- { "phophungthai", 0x0e1c , 0 },
- { "phosamphaothai", 0x0e20 , 0 },
- { "pieupacirclekorean", 0x3273 , 0 },
- { "pieupaparenkorean", 0x3213 , 0 },
- { "pieupcieuckorean", 0x3176 , 0 },
- { "pieupcirclekorean", 0x3265 , 0 },
- { "pieupkiyeokkorean", 0x3172 , 0 },
- { "pieupkorean", 0x3142 , 0 },
- { "pieupparenkorean", 0x3205 , 0 },
- { "pieupsioskiyeokkorean", 0x3174 , 0 },
- { "pieupsioskorean", 0x3144 , 0 },
- { "pieupsiostikeutkorean", 0x3175 , 0 },
- { "pieupthieuthkorean", 0x3177 , 0 },
- { "pieuptikeutkorean", 0x3173 , 0 },
- { "pihiragana", 0x3074 , 0 },
- { "pikatakana", 0x30d4 , 0 },
- { "pisymbolgreek", 0x03d6 , 0 },
- { "piwrarmenian", 0x0583 , 0 },
- { "plusbelowcmb", 0x031f , 0 },
- { "pluscircle", 0x2295 , 0 },
- { "plusmod", 0x02d6 , 0 },
- { "plusmonospace", 0xff0b , 0 },
- { "plussmall", 0xfe62 , 0 },
- { "plussuperior", 0x207a , 0 },
- { "pmonospace", 0xff50 , 0 },
- { "pmsquare", 0x33d8 , 0 },
- { "pohiragana", 0x307d , 0 },
- { "pointingindexdownwhite", 0x261f , 0 },
- { "pointingindexleftwhite", 0x261c , 0 },
- { "pointingindexrightwhite", 0x261e , 0 },
- { "pointingindexupwhite", 0x261d , 0 },
- { "pokatakana", 0x30dd , 0 },
- { "poplathai", 0x0e1b , 0 },
- { "postalmark", 0x3012 , 0 },
- { "postalmarkface", 0x3020 , 0 },
- { "pparen", 0x24ab , 0 },
- { "precedes", 0x227a , 0 },
- { "primemod", 0x02b9 , 0 },
- { "primereversed", 0x2035 , 0 },
- { "projective", 0x2305 , 0 },
- { "prolongedkana", 0x30fc , 0 },
- { "propellor", 0x2318 , 0 },
- { "proportion", 0x2237 , 0 },
- { "psicyrillic", 0x0471 , 0 },
- { "psilipneumatacyrilliccmb", 0x0486 , 0 },
- { "pssquare", 0x33b0 , 0 },
- { "puhiragana", 0x3077 , 0 },
- { "pukatakana", 0x30d7 , 0 },
- { "pvsquare", 0x33b4 , 0 },
- { "pwsquare", 0x33ba , 0 },
- { "qadeva", 0x0958 , 0 },
- { "qadmahebrew", 0x05a8 , 0 },
- { "qafarabic", 0x0642 , 0 },
- { "qaffinalarabic", 0xfed6 , 0 },
- { "qafinitialarabic", 0xfed7 , 0 },
- { "qafmedialarabic", 0xfed8 , 0 },
- { "qamats", 0x05b8 , 0 },
- { "qamats10", 0x05b8 , 0 },
- { "qamats1a", 0x05b8 , 0 },
- { "qamats1c", 0x05b8 , 0 },
- { "qamats27", 0x05b8 , 0 },
- { "qamats29", 0x05b8 , 0 },
- { "qamats33", 0x05b8 , 0 },
- { "qamatsde", 0x05b8 , 0 },
- { "qamatshebrew", 0x05b8 , 0 },
- { "qamatsnarrowhebrew", 0x05b8 , 0 },
- { "qamatsqatanhebrew", 0x05b8 , 0 },
- { "qamatsqatannarrowhebrew", 0x05b8 , 0 },
- { "qamatsqatanquarterhebrew", 0x05b8 , 0 },
- { "qamatsqatanwidehebrew", 0x05b8 , 0 },
- { "qamatsquarterhebrew", 0x05b8 , 0 },
- { "qamatswidehebrew", 0x05b8 , 0 },
- { "qarneyparahebrew", 0x059f , 0 },
- { "qbopomofo", 0x3111 , 0 },
- { "qcircle", 0x24e0 , 0 },
- { "qhook", 0x02a0 , 0 },
- { "qmonospace", 0xff51 , 0 },
- { "qof", 0x05e7 , 0 },
- { "qofdagesh", 0xfb47 , 0 },
- { "qofdageshhebrew", 0xfb47 , 0 },
- { "qofhatafpatah", 0x05e7 , 0 },
- { "qofhatafpatahhebrew", 0x05e7 , 0 },
- { "qofhatafsegol", 0x05e7 , 0 },
- { "qofhatafsegolhebrew", 0x05e7 , 0 },
- { "qofhebrew", 0x05e7 , 0 },
- { "qofhiriq", 0x05e7 , 0 },
- { "qofhiriqhebrew", 0x05e7 , 0 },
- { "qofholam", 0x05e7 , 0 },
- { "qofholamhebrew", 0x05e7 , 0 },
- { "qofpatah", 0x05e7 , 0 },
- { "qofpatahhebrew", 0x05e7 , 0 },
- { "qofqamats", 0x05e7 , 0 },
- { "qofqamatshebrew", 0x05e7 , 0 },
- { "qofqubuts", 0x05e7 , 0 },
- { "qofqubutshebrew", 0x05e7 , 0 },
- { "qofsegol", 0x05e7 , 0 },
- { "qofsegolhebrew", 0x05e7 , 0 },
- { "qofsheva", 0x05e7 , 0 },
- { "qofshevahebrew", 0x05e7 , 0 },
- { "qoftsere", 0x05e7 , 0 },
- { "qoftserehebrew", 0x05e7 , 0 },
- { "qparen", 0x24ac , 0 },
- { "quarternote", 0x2669 , 0 },
- { "qubuts", 0x05bb , 0 },
- { "qubuts18", 0x05bb , 0 },
- { "qubuts25", 0x05bb , 0 },
- { "qubuts31", 0x05bb , 0 },
- { "qubutshebrew", 0x05bb , 0 },
- { "qubutsnarrowhebrew", 0x05bb , 0 },
- { "qubutsquarterhebrew", 0x05bb , 0 },
- { "qubutswidehebrew", 0x05bb , 0 },
- { "questionarabic", 0x061f , 0 },
- { "questionarmenian", 0x055e , 0 },
- { "questiondownsmall", 0xf7bf , 0 },
- { "questiongreek", 0x037e , 0 },
- { "questionmonospace", 0xff1f , 0 },
- { "questionsmall", 0xf73f , 0 },
- { "quotedblmonospace", 0xff02 , 0 },
- { "quotedblprime", 0x301e , 0 },
- { "quotedblprimereversed", 0x301d , 0 },
- { "quoteleftreversed", 0x201b , 0 },
- { "quoterightn", 0x0149 , 0 },
- { "quotesinglemonospace", 0xff07 , 0 },
- { "raarmenian", 0x057c , 0 },
- { "rabengali", 0x09b0 , 0 },
- { "radeva", 0x0930 , 0 },
- { "radicalex", 0xf8e5 , 0 },
- { "radoverssquare", 0x33ae , 0 },
- { "radoverssquaredsquare", 0x33af , 0 },
- { "radsquare", 0x33ad , 0 },
- { "rafe", 0x05bf , 0 },
- { "rafehebrew", 0x05bf , 0 },
- { "ragujarati", 0x0ab0 , 0 },
- { "ragurmukhi", 0x0a30 , 0 },
- { "rahiragana", 0x3089 , 0 },
- { "rakatakana", 0x30e9 , 0 },
- { "rakatakanahalfwidth", 0xff97 , 0 },
- { "ralowerdiagonalbengali", 0x09f1 , 0 },
- { "ramiddlediagonalbengali", 0x09f0 , 0 },
- { "ramshorn", 0x0264 , 0 },
- { "ratio", 0x2236 , 0 },
- { "rbopomofo", 0x3116 , 0 },
- { "rcedilla", 0x0157 , 0 },
- { "rcircle", 0x24e1 , 0 },
- { "rdblgrave", 0x0211 , 0 },
- { "rdotaccent", 0x1e59 , 0 },
- { "rdotbelow", 0x1e5b , 0 },
- { "rdotbelowmacron", 0x1e5d , 0 },
- { "referencemark", 0x203b , 0 },
- { "registersans", 0xf8e8 , 0 },
- { "registerserif", 0xf6da , 0 },
- { "reharabic", 0x0631 , 0 },
- { "reharmenian", 0x0580 , 0 },
- { "rehfinalarabic", 0xfeae , 0 },
- { "rehiragana", 0x308c , 0 },
- { "rehyehaleflamarabic", 0x0631 , 0 },
- { "rekatakana", 0x30ec , 0 },
- { "rekatakanahalfwidth", 0xff9a , 0 },
- { "resh", 0x05e8 , 0 },
- { "reshdageshhebrew", 0xfb48 , 0 },
- { "reshhatafpatah", 0x05e8 , 0 },
- { "reshhatafpatahhebrew", 0x05e8 , 0 },
- { "reshhatafsegol", 0x05e8 , 0 },
- { "reshhatafsegolhebrew", 0x05e8 , 0 },
- { "reshhebrew", 0x05e8 , 0 },
- { "reshhiriq", 0x05e8 , 0 },
- { "reshhiriqhebrew", 0x05e8 , 0 },
- { "reshholam", 0x05e8 , 0 },
- { "reshholamhebrew", 0x05e8 , 0 },
- { "reshpatah", 0x05e8 , 0 },
- { "reshpatahhebrew", 0x05e8 , 0 },
- { "reshqamats", 0x05e8 , 0 },
- { "reshqamatshebrew", 0x05e8 , 0 },
- { "reshqubuts", 0x05e8 , 0 },
- { "reshqubutshebrew", 0x05e8 , 0 },
- { "reshsegol", 0x05e8 , 0 },
- { "reshsegolhebrew", 0x05e8 , 0 },
- { "reshsheva", 0x05e8 , 0 },
- { "reshshevahebrew", 0x05e8 , 0 },
- { "reshtsere", 0x05e8 , 0 },
- { "reshtserehebrew", 0x05e8 , 0 },
- { "reversedtilde", 0x223d , 0 },
- { "reviahebrew", 0x0597 , 0 },
- { "reviamugrashhebrew", 0x0597 , 0 },
- { "rfishhook", 0x027e , 0 },
- { "rfishhookreversed", 0x027f , 0 },
- { "rhabengali", 0x09dd , 0 },
- { "rhadeva", 0x095d , 0 },
- { "rhook", 0x027d , 0 },
- { "rhookturned", 0x027b , 0 },
- { "rhookturnedsuperior", 0x02b5 , 0 },
- { "rhosymbolgreek", 0x03f1 , 0 },
- { "rhotichookmod", 0x02de , 0 },
- { "rieulacirclekorean", 0x3271 , 0 },
- { "rieulaparenkorean", 0x3211 , 0 },
- { "rieulcirclekorean", 0x3263 , 0 },
- { "rieulhieuhkorean", 0x3140 , 0 },
- { "rieulkiyeokkorean", 0x313a , 0 },
- { "rieulkiyeoksioskorean", 0x3169 , 0 },
- { "rieulkorean", 0x3139 , 0 },
- { "rieulmieumkorean", 0x313b , 0 },
- { "rieulpansioskorean", 0x316c , 0 },
- { "rieulparenkorean", 0x3203 , 0 },
- { "rieulphieuphkorean", 0x313f , 0 },
- { "rieulpieupkorean", 0x313c , 0 },
- { "rieulpieupsioskorean", 0x316b , 0 },
- { "rieulsioskorean", 0x313d , 0 },
- { "rieulthieuthkorean", 0x313e , 0 },
- { "rieultikeutkorean", 0x316a , 0 },
- { "rieulyeorinhieuhkorean", 0x316d , 0 },
- { "rightangle", 0x221f , 0 },
- { "righttackbelowcmb", 0x0319 , 0 },
- { "righttriangle", 0x22bf , 0 },
- { "rihiragana", 0x308a , 0 },
- { "rikatakana", 0x30ea , 0 },
- { "rikatakanahalfwidth", 0xff98 , 0 },
- { "ringbelowcmb", 0x0325 , 0 },
- { "ringcmb", 0x030a , 0 },
- { "ringhalfleft", 0x02bf , 0 },
- { "ringhalfleftarmenian", 0x0559 , 0 },
- { "ringhalfleftbelowcmb", 0x031c , 0 },
- { "ringhalfleftcentered", 0x02d3 , 0 },
- { "ringhalfright", 0x02be , 0 },
- { "ringhalfrightbelowcmb", 0x0339 , 0 },
- { "ringhalfrightcentered", 0x02d2 , 0 },
- { "rinvertedbreve", 0x0213 , 0 },
- { "rittorusquare", 0x3351 , 0 },
- { "rlinebelow", 0x1e5f , 0 },
- { "rlongleg", 0x027c , 0 },
- { "rlonglegturned", 0x027a , 0 },
- { "rmonospace", 0xff52 , 0 },
- { "rohiragana", 0x308d , 0 },
- { "rokatakana", 0x30ed , 0 },
- { "rokatakanahalfwidth", 0xff9b , 0 },
- { "roruathai", 0x0e23 , 0 },
- { "rparen", 0x24ad , 0 },
- { "rrabengali", 0x09dc , 0 },
- { "rradeva", 0x0931 , 0 },
- { "rragurmukhi", 0x0a5c , 0 },
- { "rreharabic", 0x0691 , 0 },
- { "rrehfinalarabic", 0xfb8d , 0 },
- { "rrvocalicbengali", 0x09e0 , 0 },
- { "rrvocalicdeva", 0x0960 , 0 },
- { "rrvocalicgujarati", 0x0ae0 , 0 },
- { "rrvocalicvowelsignbengali", 0x09c4 , 0 },
- { "rrvocalicvowelsigndeva", 0x0944 , 0 },
- { "rrvocalicvowelsigngujarati", 0x0ac4 , 0 },
- { "rsuperior", 0xf6f1 , 0 },
- { "rturned", 0x0279 , 0 },
- { "rturnedsuperior", 0x02b4 , 0 },
- { "ruhiragana", 0x308b , 0 },
- { "rukatakana", 0x30eb , 0 },
- { "rukatakanahalfwidth", 0xff99 , 0 },
- { "rupeemarkbengali", 0x09f2 , 0 },
- { "rupeesignbengali", 0x09f3 , 0 },
- { "rupiah", 0xf6dd , 0 },
- { "ruthai", 0x0e24 , 0 },
- { "rvocalicbengali", 0x098b , 0 },
- { "rvocalicdeva", 0x090b , 0 },
- { "rvocalicgujarati", 0x0a8b , 0 },
- { "rvocalicvowelsignbengali", 0x09c3 , 0 },
- { "rvocalicvowelsigndeva", 0x0943 , 0 },
- { "rvocalicvowelsigngujarati", 0x0ac3 , 0 },
- { "sabengali", 0x09b8 , 0 },
- { "sacutedotaccent", 0x1e65 , 0 },
- { "sadarabic", 0x0635 , 0 },
- { "sadeva", 0x0938 , 0 },
- { "sadfinalarabic", 0xfeba , 0 },
- { "sadinitialarabic", 0xfebb , 0 },
- { "sadmedialarabic", 0xfebc , 0 },
- { "sagujarati", 0x0ab8 , 0 },
- { "sagurmukhi", 0x0a38 , 0 },
- { "sahiragana", 0x3055 , 0 },
- { "sakatakana", 0x30b5 , 0 },
- { "sakatakanahalfwidth", 0xff7b , 0 },
- { "sallallahoualayhewasallamarabic", 0xfdfa , 0 },
- { "samekh", 0x05e1 , 0 },
- { "samekhdagesh", 0xfb41 , 0 },
- { "samekhdageshhebrew", 0xfb41 , 0 },
- { "samekhhebrew", 0x05e1 , 0 },
- { "saraaathai", 0x0e32 , 0 },
- { "saraaethai", 0x0e41 , 0 },
- { "saraaimaimalaithai", 0x0e44 , 0 },
- { "saraaimaimuanthai", 0x0e43 , 0 },
- { "saraamthai", 0x0e33 , 0 },
- { "saraathai", 0x0e30 , 0 },
- { "saraethai", 0x0e40 , 0 },
- { "saraiileftthai", 0xf886 , 0 },
- { "saraiithai", 0x0e35 , 0 },
- { "saraileftthai", 0xf885 , 0 },
- { "saraithai", 0x0e34 , 0 },
- { "saraothai", 0x0e42 , 0 },
- { "saraueeleftthai", 0xf888 , 0 },
- { "saraueethai", 0x0e37 , 0 },
- { "saraueleftthai", 0xf887 , 0 },
- { "sarauethai", 0x0e36 , 0 },
- { "sarauthai", 0x0e38 , 0 },
- { "sarauuthai", 0x0e39 , 0 },
- { "sbopomofo", 0x3119 , 0 },
- { "scarondotaccent", 0x1e67 , 0 },
- { "schwa", 0x0259 , 0 },
- { "schwacyrillic", 0x04d9 , 0 },
- { "schwadieresiscyrillic", 0x04db , 0 },
- { "schwahook", 0x025a , 0 },
- { "scircle", 0x24e2 , 0 },
- { "sdotaccent", 0x1e61 , 0 },
- { "sdotbelow", 0x1e63 , 0 },
- { "sdotbelowdotaccent", 0x1e69 , 0 },
- { "seagullbelowcmb", 0x033c , 0 },
- { "secondtonechinese", 0x02ca , 0 },
- { "seenarabic", 0x0633 , 0 },
- { "seenfinalarabic", 0xfeb2 , 0 },
- { "seeninitialarabic", 0xfeb3 , 0 },
- { "seenmedialarabic", 0xfeb4 , 0 },
- { "segol", 0x05b6 , 0 },
- { "segol13", 0x05b6 , 0 },
- { "segol1f", 0x05b6 , 0 },
- { "segol2c", 0x05b6 , 0 },
- { "segolhebrew", 0x05b6 , 0 },
- { "segolnarrowhebrew", 0x05b6 , 0 },
- { "segolquarterhebrew", 0x05b6 , 0 },
- { "segoltahebrew", 0x0592 , 0 },
- { "segolwidehebrew", 0x05b6 , 0 },
- { "seharmenian", 0x057d , 0 },
- { "sehiragana", 0x305b , 0 },
- { "sekatakana", 0x30bb , 0 },
- { "sekatakanahalfwidth", 0xff7e , 0 },
- { "semicolonarabic", 0x061b , 0 },
- { "semicolonmonospace", 0xff1b , 0 },
- { "semicolonsmall", 0xfe54 , 0 },
- { "semivoicedmarkkana", 0x309c , 0 },
- { "semivoicedmarkkanahalfwidth", 0xff9f , 0 },
- { "sentisquare", 0x3322 , 0 },
- { "sentosquare", 0x3323 , 0 },
- { "sevenarabic", 0x0667 , 0 },
- { "sevenbengali", 0x09ed , 0 },
- { "sevencircle", 0x2466 , 0 },
- { "sevencircleinversesansserif", 0x2790 , 0 },
- { "sevendeva", 0x096d , 0 },
- { "sevengujarati", 0x0aed , 0 },
- { "sevengurmukhi", 0x0a6d , 0 },
- { "sevenhackarabic", 0x0667 , 0 },
- { "sevenhangzhou", 0x3027 , 0 },
- { "sevenideographicparen", 0x3226 , 0 },
- { "seveninferior", 0x2087 , 0 },
- { "sevenmonospace", 0xff17 , 0 },
- { "sevenoldstyle", 0xf737 , 0 },
- { "sevenparen", 0x247a , 0 },
- { "sevenperiod", 0x248e , 0 },
- { "sevenpersian", 0x06f7 , 0 },
- { "sevenroman", 0x2176 , 0 },
- { "sevensuperior", 0x2077 , 0 },
- { "seventeencircle", 0x2470 , 0 },
- { "seventeenparen", 0x2484 , 0 },
- { "seventeenperiod", 0x2498 , 0 },
- { "seventhai", 0x0e57 , 0 },
- { "sfthyphen", 0x00ad , 0 },
- { "shaarmenian", 0x0577 , 0 },
- { "shabengali", 0x09b6 , 0 },
- { "shacyrillic", 0x0448 , 0 },
- { "shaddaarabic", 0x0651 , 0 },
- { "shaddadammaarabic", 0xfc61 , 0 },
- { "shaddadammatanarabic", 0xfc5e , 0 },
- { "shaddafathaarabic", 0xfc60 , 0 },
- { "shaddafathatanarabic", 0x0651 , 0 },
- { "shaddakasraarabic", 0xfc62 , 0 },
- { "shaddakasratanarabic", 0xfc5f , 0 },
- { "shadedark", 0x2593 , 0 },
- { "shadelight", 0x2591 , 0 },
- { "shademedium", 0x2592 , 0 },
- { "shadeva", 0x0936 , 0 },
- { "shagujarati", 0x0ab6 , 0 },
- { "shagurmukhi", 0x0a36 , 0 },
- { "shalshelethebrew", 0x0593 , 0 },
- { "shbopomofo", 0x3115 , 0 },
- { "shchacyrillic", 0x0449 , 0 },
- { "sheenarabic", 0x0634 , 0 },
- { "sheenfinalarabic", 0xfeb6 , 0 },
- { "sheeninitialarabic", 0xfeb7 , 0 },
- { "sheenmedialarabic", 0xfeb8 , 0 },
- { "sheicoptic", 0x03e3 , 0 },
- { "sheqel", 0x20aa , 0 },
- { "sheqelhebrew", 0x20aa , 0 },
- { "sheva", 0x05b0 , 0 },
- { "sheva115", 0x05b0 , 0 },
- { "sheva15", 0x05b0 , 0 },
- { "sheva22", 0x05b0 , 0 },
- { "sheva2e", 0x05b0 , 0 },
- { "shevahebrew", 0x05b0 , 0 },
- { "shevanarrowhebrew", 0x05b0 , 0 },
- { "shevaquarterhebrew", 0x05b0 , 0 },
- { "shevawidehebrew", 0x05b0 , 0 },
- { "shhacyrillic", 0x04bb , 0 },
- { "shimacoptic", 0x03ed , 0 },
- { "shin", 0x05e9 , 0 },
- { "shindagesh", 0xfb49 , 0 },
- { "shindageshhebrew", 0xfb49 , 0 },
- { "shindageshshindot", 0xfb2c , 0 },
- { "shindageshshindothebrew", 0xfb2c , 0 },
- { "shindageshsindot", 0xfb2d , 0 },
- { "shindageshsindothebrew", 0xfb2d , 0 },
- { "shindothebrew", 0x05c1 , 0 },
- { "shinhebrew", 0x05e9 , 0 },
- { "shinshindot", 0xfb2a , 0 },
- { "shinshindothebrew", 0xfb2a , 0 },
- { "shinsindot", 0xfb2b , 0 },
- { "shinsindothebrew", 0xfb2b , 0 },
- { "shook", 0x0282 , 0 },
- { "sigmafinal", 0x03c2 , 0 },
- { "sigmalunatesymbolgreek", 0x03f2 , 0 },
- { "sihiragana", 0x3057 , 0 },
- { "sikatakana", 0x30b7 , 0 },
- { "sikatakanahalfwidth", 0xff7c , 0 },
- { "siluqhebrew", 0x05bd , 0 },
- { "siluqlefthebrew", 0x05bd , 0 },
- { "sindothebrew", 0x05c2 , 0 },
- { "siosacirclekorean", 0x3274 , 0 },
- { "siosaparenkorean", 0x3214 , 0 },
- { "sioscieuckorean", 0x317e , 0 },
- { "sioscirclekorean", 0x3266 , 0 },
- { "sioskiyeokkorean", 0x317a , 0 },
- { "sioskorean", 0x3145 , 0 },
- { "siosnieunkorean", 0x317b , 0 },
- { "siosparenkorean", 0x3206 , 0 },
- { "siospieupkorean", 0x317d , 0 },
- { "siostikeutkorean", 0x317c , 0 },
- { "sixarabic", 0x0666 , 0 },
- { "sixbengali", 0x09ec , 0 },
- { "sixcircle", 0x2465 , 0 },
- { "sixcircleinversesansserif", 0x278f , 0 },
- { "sixdeva", 0x096c , 0 },
- { "sixgujarati", 0x0aec , 0 },
- { "sixgurmukhi", 0x0a6c , 0 },
- { "sixhackarabic", 0x0666 , 0 },
- { "sixhangzhou", 0x3026 , 0 },
- { "sixideographicparen", 0x3225 , 0 },
- { "sixinferior", 0x2086 , 0 },
- { "sixmonospace", 0xff16 , 0 },
- { "sixoldstyle", 0xf736 , 0 },
- { "sixparen", 0x2479 , 0 },
- { "sixperiod", 0x248d , 0 },
- { "sixpersian", 0x06f6 , 0 },
- { "sixroman", 0x2175 , 0 },
- { "sixsuperior", 0x2076 , 0 },
- { "sixteencircle", 0x246f , 0 },
- { "sixteencurrencydenominatorbengali", 0x09f9 , 0 },
- { "sixteenparen", 0x2483 , 0 },
- { "sixteenperiod", 0x2497 , 0 },
- { "sixthai", 0x0e56 , 0 },
- { "slashmonospace", 0xff0f , 0 },
- { "slong", 0x017f , 0 },
- { "slongdotaccent", 0x1e9b , 0 },
- { "smonospace", 0xff53 , 0 },
- { "sofpasuqhebrew", 0x05c3 , 0 },
- { "softhyphen", 0x00ad , 0 },
- { "softsigncyrillic", 0x044c , 0 },
- { "sohiragana", 0x305d , 0 },
- { "sokatakana", 0x30bd , 0 },
- { "sokatakanahalfwidth", 0xff7f , 0 },
- { "soliduslongoverlaycmb", 0x0338 , 0 },
- { "solidusshortoverlaycmb", 0x0337 , 0 },
- { "sorusithai", 0x0e29 , 0 },
- { "sosalathai", 0x0e28 , 0 },
- { "sosothai", 0x0e0b , 0 },
- { "sosuathai", 0x0e2a , 0 },
- { "spacehackarabic", 0x0020 , 0 },
- { "spadesuitblack", 0x2660 , 0 },
- { "spadesuitwhite", 0x2664 , 0 },
- { "sparen", 0x24ae , 0 },
- { "squarebelowcmb", 0x033b , 0 },
- { "squarecc", 0x33c4 , 0 },
- { "squarecm", 0x339d , 0 },
- { "squarediagonalcrosshatchfill", 0x25a9 , 0 },
- { "squarehorizontalfill", 0x25a4 , 0 },
- { "squarekg", 0x338f , 0 },
- { "squarekm", 0x339e , 0 },
- { "squarekmcapital", 0x33ce , 0 },
- { "squareln", 0x33d1 , 0 },
- { "squarelog", 0x33d2 , 0 },
- { "squaremg", 0x338e , 0 },
- { "squaremil", 0x33d5 , 0 },
- { "squaremm", 0x339c , 0 },
- { "squaremsquared", 0x33a1 , 0 },
- { "squareorthogonalcrosshatchfill", 0x25a6 , 0 },
- { "squareupperlefttolowerrightfill", 0x25a7 , 0 },
- { "squareupperrighttolowerleftfill", 0x25a8 , 0 },
- { "squareverticalfill", 0x25a5 , 0 },
- { "squarewhitewithsmallblack", 0x25a3 , 0 },
- { "srsquare", 0x33db , 0 },
- { "ssabengali", 0x09b7 , 0 },
- { "ssadeva", 0x0937 , 0 },
- { "ssagujarati", 0x0ab7 , 0 },
- { "ssangcieuckorean", 0x3149 , 0 },
- { "ssanghieuhkorean", 0x3185 , 0 },
- { "ssangieungkorean", 0x3180 , 0 },
- { "ssangkiyeokkorean", 0x3132 , 0 },
- { "ssangnieunkorean", 0x3165 , 0 },
- { "ssangpieupkorean", 0x3143 , 0 },
- { "ssangsioskorean", 0x3146 , 0 },
- { "ssangtikeutkorean", 0x3138 , 0 },
- { "ssuperior", 0xf6f2 , 0 },
- { "sterlingmonospace", 0xffe1 , 0 },
- { "strokelongoverlaycmb", 0x0336 , 0 },
- { "strokeshortoverlaycmb", 0x0335 , 0 },
- { "subset", 0x2282 , 0 },
- { "subsetnotequal", 0x228a , 0 },
- { "subsetorequal", 0x2286 , 0 },
- { "succeeds", 0x227b , 0 },
- { "suhiragana", 0x3059 , 0 },
- { "sukatakana", 0x30b9 , 0 },
- { "sukatakanahalfwidth", 0xff7d , 0 },
- { "sukunarabic", 0x0652 , 0 },
- { "superset", 0x2283 , 0 },
- { "supersetnotequal", 0x228b , 0 },
- { "supersetorequal", 0x2287 , 0 },
- { "svsquare", 0x33dc , 0 },
- { "syouwaerasquare", 0x337c , 0 },
- { "tabengali", 0x09a4 , 0 },
- { "tackdown", 0x22a4 , 0 },
- { "tackleft", 0x22a3 , 0 },
- { "tadeva", 0x0924 , 0 },
- { "tagujarati", 0x0aa4 , 0 },
- { "tagurmukhi", 0x0a24 , 0 },
- { "taharabic", 0x0637 , 0 },
- { "tahfinalarabic", 0xfec2 , 0 },
- { "tahinitialarabic", 0xfec3 , 0 },
- { "tahiragana", 0x305f , 0 },
- { "tahmedialarabic", 0xfec4 , 0 },
- { "taisyouerasquare", 0x337d , 0 },
- { "takatakana", 0x30bf , 0 },
- { "takatakanahalfwidth", 0xff80 , 0 },
- { "tatweelarabic", 0x0640 , 0 },
- { "tav", 0x05ea , 0 },
- { "tavdages", 0xfb4a , 0 },
- { "tavdagesh", 0xfb4a , 0 },
- { "tavdageshhebrew", 0xfb4a , 0 },
- { "tavhebrew", 0x05ea , 0 },
- { "tbopomofo", 0x310a , 0 },
- { "tccurl", 0x02a8 , 0 },
- { "tcedilla", 0x0163 , 0 },
- { "tcheharabic", 0x0686 , 0 },
- { "tchehfinalarabic", 0xfb7b , 0 },
- { "tchehinitialarabic", 0xfb7c , 0 },
- { "tchehmedialarabic", 0xfb7d , 0 },
- { "tchehmeeminitialarabic", 0xfb7c , 0 },
- { "tcircle", 0x24e3 , 0 },
- { "tcircumflexbelow", 0x1e71 , 0 },
- { "tdieresis", 0x1e97 , 0 },
- { "tdotaccent", 0x1e6b , 0 },
- { "tdotbelow", 0x1e6d , 0 },
- { "tecyrillic", 0x0442 , 0 },
- { "tedescendercyrillic", 0x04ad , 0 },
- { "teharabic", 0x062a , 0 },
- { "tehfinalarabic", 0xfe96 , 0 },
- { "tehhahinitialarabic", 0xfca2 , 0 },
- { "tehhahisolatedarabic", 0xfc0c , 0 },
- { "tehinitialarabic", 0xfe97 , 0 },
- { "tehiragana", 0x3066 , 0 },
- { "tehjeeminitialarabic", 0xfca1 , 0 },
- { "tehjeemisolatedarabic", 0xfc0b , 0 },
- { "tehmarbutaarabic", 0x0629 , 0 },
- { "tehmarbutafinalarabic", 0xfe94 , 0 },
- { "tehmedialarabic", 0xfe98 , 0 },
- { "tehmeeminitialarabic", 0xfca4 , 0 },
- { "tehmeemisolatedarabic", 0xfc0e , 0 },
- { "tehnoonfinalarabic", 0xfc73 , 0 },
- { "tekatakana", 0x30c6 , 0 },
- { "tekatakanahalfwidth", 0xff83 , 0 },
- { "telephone", 0x2121 , 0 },
- { "telephoneblack", 0x260e , 0 },
- { "telishagedolahebrew", 0x05a0 , 0 },
- { "telishaqetanahebrew", 0x05a9 , 0 },
- { "tencircle", 0x2469 , 0 },
- { "tenideographicparen", 0x3229 , 0 },
- { "tenparen", 0x247d , 0 },
- { "tenperiod", 0x2491 , 0 },
- { "tenroman", 0x2179 , 0 },
- { "tesh", 0x02a7 , 0 },
- { "tet", 0x05d8 , 0 },
- { "tetdagesh", 0xfb38 , 0 },
- { "tetdageshhebrew", 0xfb38 , 0 },
- { "tethebrew", 0x05d8 , 0 },
- { "tetsecyrillic", 0x04b5 , 0 },
- { "tevirhebrew", 0x059b , 0 },
- { "tevirlefthebrew", 0x059b , 0 },
- { "thabengali", 0x09a5 , 0 },
- { "thadeva", 0x0925 , 0 },
- { "thagujarati", 0x0aa5 , 0 },
- { "thagurmukhi", 0x0a25 , 0 },
- { "thalarabic", 0x0630 , 0 },
- { "thalfinalarabic", 0xfeac , 0 },
- { "thanthakhatlowleftthai", 0xf898 , 0 },
- { "thanthakhatlowrightthai", 0xf897 , 0 },
- { "thanthakhatthai", 0x0e4c , 0 },
- { "thanthakhatupperleftthai", 0xf896 , 0 },
- { "theharabic", 0x062b , 0 },
- { "thehfinalarabic", 0xfe9a , 0 },
- { "thehinitialarabic", 0xfe9b , 0 },
- { "thehmedialarabic", 0xfe9c , 0 },
- { "thereexists", 0x2203 , 0 },
- { "thetasymbolgreek", 0x03d1 , 0 },
- { "thieuthacirclekorean", 0x3279 , 0 },
- { "thieuthaparenkorean", 0x3219 , 0 },
- { "thieuthcirclekorean", 0x326b , 0 },
- { "thieuthkorean", 0x314c , 0 },
- { "thieuthparenkorean", 0x320b , 0 },
- { "thirteencircle", 0x246c , 0 },
- { "thirteenparen", 0x2480 , 0 },
- { "thirteenperiod", 0x2494 , 0 },
- { "thonangmonthothai", 0x0e11 , 0 },
- { "thook", 0x01ad , 0 },
- { "thophuthaothai", 0x0e12 , 0 },
- { "thothahanthai", 0x0e17 , 0 },
- { "thothanthai", 0x0e10 , 0 },
- { "thothongthai", 0x0e18 , 0 },
- { "thothungthai", 0x0e16 , 0 },
- { "thousandcyrillic", 0x0482 , 0 },
- { "thousandsseparatorarabic", 0x066c , 0 },
- { "thousandsseparatorpersian", 0x066c , 0 },
- { "threearabic", 0x0663 , 0 },
- { "threebengali", 0x09e9 , 0 },
- { "threecircle", 0x2462 , 0 },
- { "threecircleinversesansserif", 0x278c , 0 },
- { "threedeva", 0x0969 , 0 },
- { "threegujarati", 0x0ae9 , 0 },
- { "threegurmukhi", 0x0a69 , 0 },
- { "threehackarabic", 0x0663 , 0 },
- { "threehangzhou", 0x3023 , 0 },
- { "threeideographicparen", 0x3222 , 0 },
- { "threeinferior", 0x2083 , 0 },
- { "threemonospace", 0xff13 , 0 },
- { "threenumeratorbengali", 0x09f6 , 0 },
- { "threeoldstyle", 0xf733 , 0 },
- { "threeparen", 0x2476 , 0 },
- { "threeperiod", 0x248a , 0 },
- { "threepersian", 0x06f3 , 0 },
- { "threequartersemdash", 0xf6de , 0 },
- { "threeroman", 0x2172 , 0 },
- { "threesuperior", 0x00b3 , 0 },
- { "threethai", 0x0e53 , 0 },
- { "thzsquare", 0x3394 , 0 },
- { "tihiragana", 0x3061 , 0 },
- { "tikatakana", 0x30c1 , 0 },
- { "tikatakanahalfwidth", 0xff81 , 0 },
- { "tikeutacirclekorean", 0x3270 , 0 },
- { "tikeutaparenkorean", 0x3210 , 0 },
- { "tikeutcirclekorean", 0x3262 , 0 },
- { "tikeutkorean", 0x3137 , 0 },
- { "tikeutparenkorean", 0x3202 , 0 },
- { "tildebelowcmb", 0x0330 , 0 },
- { "tildecmb", 0x0303 , 0 },
- { "tildedoublecmb", 0x0360 , 0 },
- { "tildeoperator", 0x223c , 0 },
- { "tildeoverlaycmb", 0x0334 , 0 },
- { "tildeverticalcmb", 0x033e , 0 },
- { "timescircle", 0x2297 , 0 },
- { "tipehahebrew", 0x0596 , 0 },
- { "tipehalefthebrew", 0x0596 , 0 },
- { "tippigurmukhi", 0x0a70 , 0 },
- { "titlocyrilliccmb", 0x0483 , 0 },
- { "tiwnarmenian", 0x057f , 0 },
- { "tlinebelow", 0x1e6f , 0 },
- { "tmonospace", 0xff54 , 0 },
- { "toarmenian", 0x0569 , 0 },
- { "tohiragana", 0x3068 , 0 },
- { "tokatakana", 0x30c8 , 0 },
- { "tokatakanahalfwidth", 0xff84 , 0 },
- { "tonebarextrahighmod", 0x02e5 , 0 },
- { "tonebarextralowmod", 0x02e9 , 0 },
- { "tonebarhighmod", 0x02e6 , 0 },
- { "tonebarlowmod", 0x02e8 , 0 },
- { "tonebarmidmod", 0x02e7 , 0 },
- { "tonefive", 0x01bd , 0 },
- { "tonesix", 0x0185 , 0 },
- { "tonetwo", 0x01a8 , 0 },
- { "tonsquare", 0x3327 , 0 },
- { "topatakthai", 0x0e0f , 0 },
- { "tortoiseshellbracketleft", 0x3014 , 0 },
- { "tortoiseshellbracketleftsmall", 0xfe5d , 0 },
- { "tortoiseshellbracketleftvertical", 0xfe39 , 0 },
- { "tortoiseshellbracketright", 0x3015 , 0 },
- { "tortoiseshellbracketrightsmall", 0xfe5e , 0 },
- { "tortoiseshellbracketrightvertical", 0xfe3a , 0 },
- { "totaothai", 0x0e15 , 0 },
- { "tpalatalhook", 0x01ab , 0 },
- { "tparen", 0x24af , 0 },
- { "trademarksans", 0xf8ea , 0 },
- { "trademarkserif", 0xf6db , 0 },
- { "tretroflexhook", 0x0288 , 0 },
- { "ts", 0x02a6 , 0 },
- { "tsadi", 0x05e6 , 0 },
- { "tsadidagesh", 0xfb46 , 0 },
- { "tsadidageshhebrew", 0xfb46 , 0 },
- { "tsadihebrew", 0x05e6 , 0 },
- { "tsecyrillic", 0x0446 , 0 },
- { "tsere", 0x05b5 , 0 },
- { "tsere12", 0x05b5 , 0 },
- { "tsere1e", 0x05b5 , 0 },
- { "tsere2b", 0x05b5 , 0 },
- { "tserehebrew", 0x05b5 , 0 },
- { "tserenarrowhebrew", 0x05b5 , 0 },
- { "tserequarterhebrew", 0x05b5 , 0 },
- { "tserewidehebrew", 0x05b5 , 0 },
- { "tshecyrillic", 0x045b , 0 },
- { "tsuperior", 0xf6f3 , 0 },
- { "ttabengali", 0x099f , 0 },
- { "ttadeva", 0x091f , 0 },
- { "ttagujarati", 0x0a9f , 0 },
- { "ttagurmukhi", 0x0a1f , 0 },
- { "tteharabic", 0x0679 , 0 },
- { "ttehfinalarabic", 0xfb67 , 0 },
- { "ttehinitialarabic", 0xfb68 , 0 },
- { "ttehmedialarabic", 0xfb69 , 0 },
- { "tthabengali", 0x09a0 , 0 },
- { "tthadeva", 0x0920 , 0 },
- { "tthagujarati", 0x0aa0 , 0 },
- { "tthagurmukhi", 0x0a20 , 0 },
- { "tturned", 0x0287 , 0 },
- { "tuhiragana", 0x3064 , 0 },
- { "tukatakana", 0x30c4 , 0 },
- { "tukatakanahalfwidth", 0xff82 , 0 },
- { "tusmallhiragana", 0x3063 , 0 },
- { "tusmallkatakana", 0x30c3 , 0 },
- { "tusmallkatakanahalfwidth", 0xff6f , 0 },
- { "twelvecircle", 0x246b , 0 },
- { "twelveparen", 0x247f , 0 },
- { "twelveperiod", 0x2493 , 0 },
- { "twelveroman", 0x217b , 0 },
- { "twentycircle", 0x2473 , 0 },
- { "twentyhangzhou", 0x5344 , 0 },
- { "twentyparen", 0x2487 , 0 },
- { "twentyperiod", 0x249b , 0 },
- { "twoarabic", 0x0662 , 0 },
- { "twobengali", 0x09e8 , 0 },
- { "twocircle", 0x2461 , 0 },
- { "twocircleinversesansserif", 0x278b , 0 },
- { "twodeva", 0x0968 , 0 },
- { "twodotleader", 0x2025 , 0 },
- { "twodotleadervertical", 0xfe30 , 0 },
- { "twogujarati", 0x0ae8 , 0 },
- { "twogurmukhi", 0x0a68 , 0 },
- { "twohackarabic", 0x0662 , 0 },
- { "twohangzhou", 0x3022 , 0 },
- { "twoideographicparen", 0x3221 , 0 },
- { "twoinferior", 0x2082 , 0 },
- { "twomonospace", 0xff12 , 0 },
- { "twonumeratorbengali", 0x09f5 , 0 },
- { "twooldstyle", 0xf732 , 0 },
- { "twoparen", 0x2475 , 0 },
- { "twoperiod", 0x2489 , 0 },
- { "twopersian", 0x06f2 , 0 },
- { "tworoman", 0x2171 , 0 },
- { "twostroke", 0x01bb , 0 },
- { "twosuperior", 0x00b2 , 0 },
- { "twothai", 0x0e52 , 0 },
- { "ubar", 0x0289 , 0 },
- { "ubengali", 0x0989 , 0 },
- { "ubopomofo", 0x3128 , 0 },
- { "ucaron", 0x01d4 , 0 },
- { "ucircle", 0x24e4 , 0 },
- { "ucircumflexbelow", 0x1e77 , 0 },
- { "ucyrillic", 0x0443 , 0 },
- { "udattadeva", 0x0951 , 0 },
- { "udblacute", 0x0171 , 0 },
- { "udblgrave", 0x0215 , 0 },
- { "udeva", 0x0909 , 0 },
- { "udieresisacute", 0x01d8 , 0 },
- { "udieresisbelow", 0x1e73 , 0 },
- { "udieresiscaron", 0x01da , 0 },
- { "udieresiscyrillic", 0x04f1 , 0 },
- { "udieresisgrave", 0x01dc , 0 },
- { "udieresismacron", 0x01d6 , 0 },
- { "udotbelow", 0x1ee5 , 0 },
- { "ugujarati", 0x0a89 , 0 },
- { "ugurmukhi", 0x0a09 , 0 },
- { "uhiragana", 0x3046 , 0 },
- { "uhookabove", 0x1ee7 , 0 },
- { "uhornacute", 0x1ee9 , 0 },
- { "uhorndotbelow", 0x1ef1 , 0 },
- { "uhorngrave", 0x1eeb , 0 },
- { "uhornhookabove", 0x1eed , 0 },
- { "uhorntilde", 0x1eef , 0 },
- { "uhungarumlautcyrillic", 0x04f3 , 0 },
- { "uinvertedbreve", 0x0217 , 0 },
- { "ukatakana", 0x30a6 , 0 },
- { "ukatakanahalfwidth", 0xff73 , 0 },
- { "ukcyrillic", 0x0479 , 0 },
- { "ukorean", 0x315c , 0 },
- { "umacroncyrillic", 0x04ef , 0 },
- { "umacrondieresis", 0x1e7b , 0 },
- { "umatragurmukhi", 0x0a41 , 0 },
- { "umonospace", 0xff55 , 0 },
- { "underscoremonospace", 0xff3f , 0 },
- { "underscorevertical", 0xfe33 , 0 },
- { "underscorewavy", 0xfe4f , 0 },
- { "uparen", 0x24b0 , 0 },
- { "upperdothebrew", 0x05c4 , 0 },
- { "upsilonlatin", 0x028a , 0 },
- { "uptackbelowcmb", 0x031d , 0 },
- { "uptackmod", 0x02d4 , 0 },
- { "uragurmukhi", 0x0a73 , 0 },
- { "ushortcyrillic", 0x045e , 0 },
- { "usmallhiragana", 0x3045 , 0 },
- { "usmallkatakana", 0x30a5 , 0 },
- { "usmallkatakanahalfwidth", 0xff69 , 0 },
- { "ustraightcyrillic", 0x04af , 0 },
- { "ustraightstrokecyrillic", 0x04b1 , 0 },
- { "utildeacute", 0x1e79 , 0 },
- { "utildebelow", 0x1e75 , 0 },
- { "uubengali", 0x098a , 0 },
- { "uudeva", 0x090a , 0 },
- { "uugujarati", 0x0a8a , 0 },
- { "uugurmukhi", 0x0a0a , 0 },
- { "uumatragurmukhi", 0x0a42 , 0 },
- { "uuvowelsignbengali", 0x09c2 , 0 },
- { "uuvowelsigndeva", 0x0942 , 0 },
- { "uuvowelsigngujarati", 0x0ac2 , 0 },
- { "uvowelsignbengali", 0x09c1 , 0 },
- { "uvowelsigndeva", 0x0941 , 0 },
- { "uvowelsigngujarati", 0x0ac1 , 0 },
- { "vadeva", 0x0935 , 0 },
- { "vagujarati", 0x0ab5 , 0 },
- { "vagurmukhi", 0x0a35 , 0 },
- { "vakatakana", 0x30f7 , 0 },
- { "vav", 0x05d5 , 0 },
- { "vavdagesh", 0xfb35 , 0 },
- { "vavdagesh65", 0xfb35 , 0 },
- { "vavdageshhebrew", 0xfb35 , 0 },
- { "vavhebrew", 0x05d5 , 0 },
- { "vavholam", 0xfb4b , 0 },
- { "vavholamhebrew", 0xfb4b , 0 },
- { "vavvavhebrew", 0x05f0 , 0 },
- { "vavyodhebrew", 0x05f1 , 0 },
- { "vcircle", 0x24e5 , 0 },
- { "vdotbelow", 0x1e7f , 0 },
- { "vecyrillic", 0x0432 , 0 },
- { "veharabic", 0x06a4 , 0 },
- { "vehfinalarabic", 0xfb6b , 0 },
- { "vehinitialarabic", 0xfb6c , 0 },
- { "vehmedialarabic", 0xfb6d , 0 },
- { "vekatakana", 0x30f9 , 0 },
- { "venus", 0x2640 , 0 },
- { "verticalbar", 0x007c , 0 },
- { "verticallineabovecmb", 0x030d , 0 },
- { "verticallinebelowcmb", 0x0329 , 0 },
- { "verticallinelowmod", 0x02cc , 0 },
- { "verticallinemod", 0x02c8 , 0 },
- { "vewarmenian", 0x057e , 0 },
- { "vhook", 0x028b , 0 },
- { "vikatakana", 0x30f8 , 0 },
- { "viramabengali", 0x09cd , 0 },
- { "viramadeva", 0x094d , 0 },
- { "viramagujarati", 0x0acd , 0 },
- { "visargabengali", 0x0983 , 0 },
- { "visargadeva", 0x0903 , 0 },
- { "visargagujarati", 0x0a83 , 0 },
- { "vmonospace", 0xff56 , 0 },
- { "voarmenian", 0x0578 , 0 },
- { "voicediterationhiragana", 0x309e , 0 },
- { "voicediterationkatakana", 0x30fe , 0 },
- { "voicedmarkkana", 0x309b , 0 },
- { "voicedmarkkanahalfwidth", 0xff9e , 0 },
- { "vokatakana", 0x30fa , 0 },
- { "vparen", 0x24b1 , 0 },
- { "vtilde", 0x1e7d , 0 },
- { "vturned", 0x028c , 0 },
- { "vuhiragana", 0x3094 , 0 },
- { "vukatakana", 0x30f4 , 0 },
- { "waekorean", 0x3159 , 0 },
- { "wahiragana", 0x308f , 0 },
- { "wakatakana", 0x30ef , 0 },
- { "wakatakanahalfwidth", 0xff9c , 0 },
- { "wakorean", 0x3158 , 0 },
- { "wasmallhiragana", 0x308e , 0 },
- { "wasmallkatakana", 0x30ee , 0 },
- { "wattosquare", 0x3357 , 0 },
- { "wavedash", 0x301c , 0 },
- { "wavyunderscorevertical", 0xfe34 , 0 },
- { "wawarabic", 0x0648 , 0 },
- { "wawfinalarabic", 0xfeee , 0 },
- { "wawhamzaabovearabic", 0x0624 , 0 },
- { "wawhamzaabovefinalarabic", 0xfe86 , 0 },
- { "wbsquare", 0x33dd , 0 },
- { "wcircle", 0x24e6 , 0 },
- { "wdotaccent", 0x1e87 , 0 },
- { "wdotbelow", 0x1e89 , 0 },
- { "wehiragana", 0x3091 , 0 },
- { "wekatakana", 0x30f1 , 0 },
- { "wekorean", 0x315e , 0 },
- { "weokorean", 0x315d , 0 },
- { "whitebullet", 0x25e6 , 0 },
- { "whitecircle", 0x25cb , 0 },
- { "whitecircleinverse", 0x25d9 , 0 },
- { "whitecornerbracketleft", 0x300e , 0 },
- { "whitecornerbracketleftvertical", 0xfe43 , 0 },
- { "whitecornerbracketright", 0x300f , 0 },
- { "whitecornerbracketrightvertical", 0xfe44 , 0 },
- { "whitediamond", 0x25c7 , 0 },
- { "whitediamondcontainingblacksmalldiamond", 0x25c8 , 0 },
- { "whitedownpointingsmalltriangle", 0x25bf , 0 },
- { "whitedownpointingtriangle", 0x25bd , 0 },
- { "whiteleftpointingsmalltriangle", 0x25c3 , 0 },
- { "whiteleftpointingtriangle", 0x25c1 , 0 },
- { "whitelenticularbracketleft", 0x3016 , 0 },
- { "whitelenticularbracketright", 0x3017 , 0 },
- { "whiterightpointingsmalltriangle", 0x25b9 , 0 },
- { "whiterightpointingtriangle", 0x25b7 , 0 },
- { "whitesmallsquare", 0x25ab , 0 },
- { "whitesmilingface", 0x263a , 0 },
- { "whitesquare", 0x25a1 , 0 },
- { "whitestar", 0x2606 , 0 },
- { "whitetelephone", 0x260f , 0 },
- { "whitetortoiseshellbracketleft", 0x3018 , 0 },
- { "whitetortoiseshellbracketright", 0x3019 , 0 },
- { "whiteuppointingsmalltriangle", 0x25b5 , 0 },
- { "whiteuppointingtriangle", 0x25b3 , 0 },
- { "wihiragana", 0x3090 , 0 },
- { "wikatakana", 0x30f0 , 0 },
- { "wikorean", 0x315f , 0 },
- { "wmonospace", 0xff57 , 0 },
- { "wohiragana", 0x3092 , 0 },
- { "wokatakana", 0x30f2 , 0 },
- { "wokatakanahalfwidth", 0xff66 , 0 },
- { "won", 0x20a9 , 0 },
- { "wonmonospace", 0xffe6 , 0 },
- { "wowaenthai", 0x0e27 , 0 },
- { "wparen", 0x24b2 , 0 },
- { "wring", 0x1e98 , 0 },
- { "wsuperior", 0x02b7 , 0 },
- { "wturned", 0x028d , 0 },
- { "wynn", 0x01bf , 0 },
- { "xabovecmb", 0x033d , 0 },
- { "xbopomofo", 0x3112 , 0 },
- { "xcircle", 0x24e7 , 0 },
- { "xdieresis", 0x1e8d , 0 },
- { "xdotaccent", 0x1e8b , 0 },
- { "xeharmenian", 0x056d , 0 },
- { "xmonospace", 0xff58 , 0 },
- { "xparen", 0x24b3 , 0 },
- { "xsuperior", 0x02e3 , 0 },
- { "yaadosquare", 0x334e , 0 },
- { "yabengali", 0x09af , 0 },
- { "yadeva", 0x092f , 0 },
- { "yaekorean", 0x3152 , 0 },
- { "yagujarati", 0x0aaf , 0 },
- { "yagurmukhi", 0x0a2f , 0 },
- { "yahiragana", 0x3084 , 0 },
- { "yakatakana", 0x30e4 , 0 },
- { "yakatakanahalfwidth", 0xff94 , 0 },
- { "yakorean", 0x3151 , 0 },
- { "yamakkanthai", 0x0e4e , 0 },
- { "yasmallhiragana", 0x3083 , 0 },
- { "yasmallkatakana", 0x30e3 , 0 },
- { "yasmallkatakanahalfwidth", 0xff6c , 0 },
- { "yatcyrillic", 0x0463 , 0 },
- { "ycircle", 0x24e8 , 0 },
- { "ydotaccent", 0x1e8f , 0 },
- { "ydotbelow", 0x1ef5 , 0 },
- { "yeharabic", 0x064a , 0 },
- { "yehbarreearabic", 0x06d2 , 0 },
- { "yehbarreefinalarabic", 0xfbaf , 0 },
- { "yehfinalarabic", 0xfef2 , 0 },
- { "yehhamzaabovearabic", 0x0626 , 0 },
- { "yehhamzaabovefinalarabic", 0xfe8a , 0 },
- { "yehhamzaaboveinitialarabic", 0xfe8b , 0 },
- { "yehhamzaabovemedialarabic", 0xfe8c , 0 },
- { "yehinitialarabic", 0xfef3 , 0 },
- { "yehmedialarabic", 0xfef4 , 0 },
- { "yehmeeminitialarabic", 0xfcdd , 0 },
- { "yehmeemisolatedarabic", 0xfc58 , 0 },
- { "yehnoonfinalarabic", 0xfc94 , 0 },
- { "yehthreedotsbelowarabic", 0x06d1 , 0 },
- { "yekorean", 0x3156 , 0 },
- { "yenmonospace", 0xffe5 , 0 },
- { "yeokorean", 0x3155 , 0 },
- { "yeorinhieuhkorean", 0x3186 , 0 },
- { "yerahbenyomohebrew", 0x05aa , 0 },
- { "yerahbenyomolefthebrew", 0x05aa , 0 },
- { "yericyrillic", 0x044b , 0 },
- { "yerudieresiscyrillic", 0x04f9 , 0 },
- { "yesieungkorean", 0x3181 , 0 },
- { "yesieungpansioskorean", 0x3183 , 0 },
- { "yesieungsioskorean", 0x3182 , 0 },
- { "yetivhebrew", 0x059a , 0 },
- { "yhook", 0x01b4 , 0 },
- { "yhookabove", 0x1ef7 , 0 },
- { "yiarmenian", 0x0575 , 0 },
- { "yicyrillic", 0x0457 , 0 },
- { "yikorean", 0x3162 , 0 },
- { "yinyang", 0x262f , 0 },
- { "yiwnarmenian", 0x0582 , 0 },
- { "ymonospace", 0xff59 , 0 },
- { "yod", 0x05d9 , 0 },
- { "yoddagesh", 0xfb39 , 0 },
- { "yoddageshhebrew", 0xfb39 , 0 },
- { "yodhebrew", 0x05d9 , 0 },
- { "yodyodhebrew", 0x05f2 , 0 },
- { "yodyodpatahhebrew", 0xfb1f , 0 },
- { "yohiragana", 0x3088 , 0 },
- { "yoikorean", 0x3189 , 0 },
- { "yokatakana", 0x30e8 , 0 },
- { "yokatakanahalfwidth", 0xff96 , 0 },
- { "yokorean", 0x315b , 0 },
- { "yosmallhiragana", 0x3087 , 0 },
- { "yosmallkatakana", 0x30e7 , 0 },
- { "yosmallkatakanahalfwidth", 0xff6e , 0 },
- { "yotgreek", 0x03f3 , 0 },
- { "yoyaekorean", 0x3188 , 0 },
- { "yoyakorean", 0x3187 , 0 },
- { "yoyakthai", 0x0e22 , 0 },
- { "yoyingthai", 0x0e0d , 0 },
- { "yparen", 0x24b4 , 0 },
- { "ypogegrammeni", 0x037a , 0 },
- { "ypogegrammenigreekcmb", 0x0345 , 0 },
- { "yr", 0x01a6 , 0 },
- { "yring", 0x1e99 , 0 },
- { "ysuperior", 0x02b8 , 0 },
- { "ytilde", 0x1ef9 , 0 },
- { "yturned", 0x028e , 0 },
- { "yuhiragana", 0x3086 , 0 },
- { "yuikorean", 0x318c , 0 },
- { "yukatakana", 0x30e6 , 0 },
- { "yukatakanahalfwidth", 0xff95 , 0 },
- { "yukorean", 0x3160 , 0 },
- { "yusbigcyrillic", 0x046b , 0 },
- { "yusbigiotifiedcyrillic", 0x046d , 0 },
- { "yuslittlecyrillic", 0x0467 , 0 },
- { "yuslittleiotifiedcyrillic", 0x0469 , 0 },
- { "yusmallhiragana", 0x3085 , 0 },
- { "yusmallkatakana", 0x30e5 , 0 },
- { "yusmallkatakanahalfwidth", 0xff6d , 0 },
- { "yuyekorean", 0x318b , 0 },
- { "yuyeokorean", 0x318a , 0 },
- { "yyabengali", 0x09df , 0 },
- { "yyadeva", 0x095f , 0 },
- { "zaarmenian", 0x0566 , 0 },
- { "zadeva", 0x095b , 0 },
- { "zagurmukhi", 0x0a5b , 0 },
- { "zaharabic", 0x0638 , 0 },
- { "zahfinalarabic", 0xfec6 , 0 },
- { "zahinitialarabic", 0xfec7 , 0 },
- { "zahiragana", 0x3056 , 0 },
- { "zahmedialarabic", 0xfec8 , 0 },
- { "zainarabic", 0x0632 , 0 },
- { "zainfinalarabic", 0xfeb0 , 0 },
- { "zakatakana", 0x30b6 , 0 },
- { "zaqefgadolhebrew", 0x0595 , 0 },
- { "zaqefqatanhebrew", 0x0594 , 0 },
- { "zarqahebrew", 0x0598 , 0 },
- { "zayin", 0x05d6 , 0 },
- { "zayindagesh", 0xfb36 , 0 },
- { "zayindageshhebrew", 0xfb36 , 0 },
- { "zayinhebrew", 0x05d6 , 0 },
- { "zbopomofo", 0x3117 , 0 },
- { "zcircle", 0x24e9 , 0 },
- { "zcircumflex", 0x1e91 , 0 },
- { "zcurl", 0x0291 , 0 },
- { "zdot", 0x017c , 0 },
- { "zdotbelow", 0x1e93 , 0 },
- { "zecyrillic", 0x0437 , 0 },
- { "zedescendercyrillic", 0x0499 , 0 },
- { "zedieresiscyrillic", 0x04df , 0 },
- { "zehiragana", 0x305c , 0 },
- { "zekatakana", 0x30bc , 0 },
- { "zeroarabic", 0x0660 , 0 },
- { "zerobengali", 0x09e6 , 0 },
- { "zerodeva", 0x0966 , 0 },
- { "zerogujarati", 0x0ae6 , 0 },
- { "zerogurmukhi", 0x0a66 , 0 },
- { "zerohackarabic", 0x0660 , 0 },
- { "zeroinferior", 0x2080 , 0 },
- { "zeromonospace", 0xff10 , 0 },
- { "zerooldstyle", 0xf730 , 0 },
- { "zeropersian", 0x06f0 , 0 },
- { "zerosuperior", 0x2070 , 0 },
- { "zerothai", 0x0e50 , 0 },
- { "zerowidthjoiner", 0xfeff , 0 },
- { "zerowidthnonjoiner", 0x200c , 0 },
- { "zerowidthspace", 0x200b , 0 },
- { "zhbopomofo", 0x3113 , 0 },
- { "zhearmenian", 0x056a , 0 },
- { "zhebrevecyrillic", 0x04c2 , 0 },
- { "zhecyrillic", 0x0436 , 0 },
- { "zhedescendercyrillic", 0x0497 , 0 },
- { "zhedieresiscyrillic", 0x04dd , 0 },
- { "zihiragana", 0x3058 , 0 },
- { "zikatakana", 0x30b8 , 0 },
- { "zinorhebrew", 0x05ae , 0 },
- { "zlinebelow", 0x1e95 , 0 },
- { "zmonospace", 0xff5a , 0 },
- { "zohiragana", 0x305e , 0 },
- { "zokatakana", 0x30be , 0 },
- { "zparen", 0x24b5 , 0 },
- { "zretroflexhook", 0x0290 , 0 },
- { "zstroke", 0x01b6 , 0 },
- { "zuhiragana", 0x305a , 0 },
- { "zukatakana", 0x30ba , 0 },
- { "dotaccent.cap", 0xefed , 0 },
- { "breve.cap", 0xefee , 0 },
- { "ogonek.cap", 0xeff1 , 0 },
- { "cedilla.cap", 0xeff2 , 0 },
- { "ring.cap", 0xeff3 , 0 },
- { "tilde.cap", 0xeff5 , 0 },
- { "circumflex.cap", 0xeff7 , 0 },
- { "a1", 0x2701 , 0 },
- { "a2", 0x2702 , 0 },
- { "a202", 0x2703 , 0 },
- { "a3", 0x2704 , 0 },
- { "a4", 0x260e , 0 },
- { "a5", 0x2706 , 0 },
- { "a119", 0x2707 , 0 },
- { "a118", 0x2708 , 0 },
- { "a117", 0x2709 , 0 },
- { "a11", 0x261b , 0 },
- { "a12", 0x261e , 0 },
- { "a13", 0x270c , 0 },
- { "a14", 0x270d , 0 },
- { "a15", 0x270e , 0 },
- { "a16", 0x270f , 0 },
- { "a105", 0x2710 , 0 },
- { "a17", 0x2711 , 0 },
- { "a18", 0x2712 , 0 },
- { "a19", 0x2713 , 0 },
- { "a20", 0x2714 , 0 },
- { "a21", 0x2715 , 0 },
- { "a22", 0x2716 , 0 },
- { "a23", 0x2717 , 0 },
- { "a24", 0x2718 , 0 },
- { "a25", 0x2719 , 0 },
- { "a26", 0x271a , 0 },
- { "a27", 0x271b , 0 },
- { "a28", 0x271c , 0 },
- { "a6", 0x271d , 0 },
- { "a7", 0x271e , 0 },
- { "a8", 0x271f , 0 },
- { "a9", 0x2720 , 0 },
- { "a10", 0x2721 , 0 },
- { "a29", 0x2722 , 0 },
- { "a30", 0x2723 , 0 },
- { "a31", 0x2724 , 0 },
- { "a32", 0x2725 , 0 },
- { "a33", 0x2726 , 0 },
- { "a34", 0x2727 , 0 },
- { "a35", 0x2605 , 0 },
- { "a36", 0x2729 , 0 },
- { "a37", 0x272a , 0 },
- { "a38", 0x272b , 0 },
- { "a39", 0x272c , 0 },
- { "a40", 0x272d , 0 },
- { "a41", 0x272e , 0 },
- { "a42", 0x272f , 0 },
- { "a43", 0x2730 , 0 },
- { "a44", 0x2731 , 0 },
- { "a45", 0x2732 , 0 },
- { "a46", 0x2733 , 0 },
- { "a47", 0x2734 , 0 },
- { "a48", 0x2735 , 0 },
- { "a49", 0x2736 , 0 },
- { "a50", 0x2737 , 0 },
- { "a51", 0x2738 , 0 },
- { "a52", 0x2739 , 0 },
- { "a53", 0x273a , 0 },
- { "a54", 0x273b , 0 },
- { "a55", 0x273c , 0 },
- { "a56", 0x273d , 0 },
- { "a57", 0x273e , 0 },
- { "a58", 0x273f , 0 },
- { "a59", 0x2740 , 0 },
- { "a60", 0x2741 , 0 },
- { "a61", 0x2742 , 0 },
- { "a62", 0x2743 , 0 },
- { "a63", 0x2744 , 0 },
- { "a64", 0x2745 , 0 },
- { "a65", 0x2746 , 0 },
- { "a66", 0x2747 , 0 },
- { "a67", 0x2748 , 0 },
- { "a68", 0x2749 , 0 },
- { "a69", 0x274a , 0 },
- { "a70", 0x274b , 0 },
- { "a71", 0x25cf , 0 },
- { "a72", 0x274d , 0 },
- { "a73", 0x25a0 , 0 },
- { "a74", 0x274f , 0 },
- { "a203", 0x2750 , 0 },
- { "a75", 0x2751 , 0 },
- { "a204", 0x2752 , 0 },
- { "a76", 0x25b2 , 0 },
- { "a77", 0x25bc , 0 },
- { "a78", 0x25c6 , 0 },
- { "a79", 0x2756 , 0 },
- { "a81", 0x25d7 , 0 },
- { "a82", 0x2758 , 0 },
- { "a83", 0x2759 , 0 },
- { "a84", 0x275a , 0 },
- { "a97", 0x275b , 0 },
- { "a98", 0x275c , 0 },
- { "a99", 0x275d , 0 },
- { "a100", 0x275e , 0 },
- { "a89", 0x2768 , 0 },
- { "a90", 0x2769 , 0 },
- { "a93", 0x276a , 0 },
- { "a94", 0x276b , 0 },
- { "a91", 0x276c , 0 },
- { "a92", 0x276d , 0 },
- { "a205", 0x276e , 0 },
- { "a85", 0x276f , 0 },
- { "a206", 0x2770 , 0 },
- { "a86", 0x2771 , 0 },
- { "a87", 0x2772 , 0 },
- { "a88", 0x2773 , 0 },
- { "a95", 0x2774 , 0 },
- { "a96", 0x2775 , 0 },
- { "a101", 0x2761 , 0 },
- { "a102", 0x2762 , 0 },
- { "a103", 0x2763 , 0 },
- { "a104", 0x2764 , 0 },
- { "a106", 0x2765 , 0 },
- { "a107", 0x2766 , 0 },
- { "a108", 0x2767 , 0 },
- { "a112", 0x2663 , 0 },
- { "a111", 0x2666 , 0 },
- { "a110", 0x2665 , 0 },
- { "a109", 0x2660 , 0 },
- { "a120", 0x2460 , 0 },
- { "a121", 0x2461 , 0 },
- { "a122", 0x2462 , 0 },
- { "a123", 0x2463 , 0 },
- { "a124", 0x2464 , 0 },
- { "a125", 0x2465 , 0 },
- { "a126", 0x2466 , 0 },
- { "a127", 0x2467 , 0 },
- { "a128", 0x2468 , 0 },
- { "a129", 0x2469 , 0 },
- { "a130", 0x2776 , 0 },
- { "a131", 0x2777 , 0 },
- { "a132", 0x2778 , 0 },
- { "a133", 0x2779 , 0 },
- { "a134", 0x277a , 0 },
- { "a135", 0x277b , 0 },
- { "a136", 0x277c , 0 },
- { "a137", 0x277d , 0 },
- { "a138", 0x277e , 0 },
- { "a139", 0x277f , 0 },
- { "a140", 0x2780 , 0 },
- { "a141", 0x2781 , 0 },
- { "a142", 0x2782 , 0 },
- { "a143", 0x2783 , 0 },
- { "a144", 0x2784 , 0 },
- { "a145", 0x2785 , 0 },
- { "a146", 0x2786 , 0 },
- { "a147", 0x2787 , 0 },
- { "a148", 0x2788 , 0 },
- { "a149", 0x2789 , 0 },
- { "a150", 0x278a , 0 },
- { "a151", 0x278b , 0 },
- { "a152", 0x278c , 0 },
- { "a153", 0x278d , 0 },
- { "a154", 0x278e , 0 },
- { "a155", 0x278f , 0 },
- { "a156", 0x2790 , 0 },
- { "a157", 0x2791 , 0 },
- { "a158", 0x2792 , 0 },
- { "a159", 0x2793 , 0 },
- { "a160", 0x2794 , 0 },
- { "a161", 0x2192 , 0 },
- { "a163", 0x2194 , 0 },
- { "a164", 0x2195 , 0 },
- { "a196", 0x2798 , 0 },
- { "a165", 0x2799 , 0 },
- { "a192", 0x279a , 0 },
- { "a166", 0x279b , 0 },
- { "a167", 0x279c , 0 },
- { "a168", 0x279d , 0 },
- { "a169", 0x279e , 0 },
- { "a170", 0x279f , 0 },
- { "a171", 0x27a0 , 0 },
- { "a172", 0x27a1 , 0 },
- { "a173", 0x27a2 , 0 },
- { "a162", 0x27a3 , 0 },
- { "a174", 0x27a4 , 0 },
- { "a175", 0x27a5 , 0 },
- { "a176", 0x27a6 , 0 },
- { "a177", 0x27a7 , 0 },
- { "a178", 0x27a8 , 0 },
- { "a179", 0x27a9 , 0 },
- { "a193", 0x27aa , 0 },
- { "a180", 0x27ab , 0 },
- { "a199", 0x27ac , 0 },
- { "a181", 0x27ad , 0 },
- { "a200", 0x27ae , 0 },
- { "a182", 0x27af , 0 },
- { "a201", 0x27b1 , 0 },
- { "a183", 0x27b2 , 0 },
- { "a184", 0x27b3 , 0 },
- { "a197", 0x27b4 , 0 },
- { "a185", 0x27b5 , 0 },
- { "a194", 0x27b6 , 0 },
- { "a198", 0x27b7 , 0 },
- { "a186", 0x27b8 , 0 },
- { "a195", 0x27b9 , 0 },
- { "a187", 0x27ba , 0 },
- { "a188", 0x27bb , 0 },
- { "a189", 0x27bc , 0 },
- { "a190", 0x27bd , 0 },
- { "a191", 0x27be , 0 },
- { "register.sans", 0xf8e8 , 0 },
- { "register.serif", 0xf6da , 0 },
- { "one.superior", 0x00b9 , 0 },
- { "two.superior", 0x00b2 , 0 },
- { "three.superior", 0x00b3 , 0 },
- { "parenleft.superior", 0x207d , 0 },
- { "parenright.superior", 0x207e , 0 },
- { "n.superior", 0x207f , 0 },
- { "parenleft.inferior", 0x208d , 0 },
- { "parenright.inferior", 0x208e , 0 },
- { "zero.superior", 0x2070 , 0 },
- { "four.superior", 0x2074 , 0 },
- { "five.superior", 0x2075 , 0 },
- { "six.superior", 0x2076 , 0 },
- { "seven.superior", 0x2077 , 0 },
- { "eight.superior", 0x2078 , 0 },
- { "nine.superior", 0x2079 , 0 },
- { "zero.inferior", 0x2080 , 0 },
- { "one.inferior", 0x2081 , 0 },
- { "two.inferior", 0x2082 , 0 },
- { "three.inferior", 0x2083 , 0 },
- { "four.inferior", 0x2084 , 0 },
- { "five.inferior", 0x2085 , 0 },
- { "six.inferior", 0x2086 , 0 },
- { "seven.inferior", 0x2087 , 0 },
- { "eight.inferior", 0x2088 , 0 },
- { "nine.inferior", 0x2089 , 0 },
- { "mu.greek", 0x03bc , 0 },
- { "Delta.greek", 0x0394 , 0 },
- { "Omega.greek", 0x03a9 , 0 },
- { "sigma.end", 0x03c2 , 0 },
- { "beta.alt", 0x03d0 , 0 },
- { "kappa.alt", 0x03f0 , 0 },
- { "theta.alt", 0x03d1 , 0 },
- { "Upsilon.alt", 0x03d2 , 0 },
- { "phi.alt", 0x03d5 , 0 },
- { "pi.alt", 0x03d6 , 0 },
- { "A.cyr", 0x0410 , 0 },
- { "Ghe.up", 0x0490 , 0 },
- { "I.cyr", 0x0418 , 0 },
- { "I.short", 0x0419 , 0 },
- { "O.cyr", 0x041e , 0 },
- { "U.cyr", 0x0423 , 0 },
- { "E.cyr", 0x042d , 0 },
- { "Ie.ukran", 0x0404 , 0 },
- { "I.ukran", 0x0406 , 0 },
- { "U.short", 0x040e , 0 },
- { "a.cyr", 0x0430 , 0 },
- { "ghe.up", 0x0491 , 0 },
- { "i.cyr", 0x0438 , 0 },
- { "i.short", 0x0439 , 0 },
- { "o.cyr", 0x043e , 0 },
- { "u.cyr", 0x0443 , 0 },
- { "e.cyr", 0x044d , 0 },
- { "ie.ukran", 0x0454 , 0 },
- { "i.ukran", 0x0456 , 0 },
- { "u.short", 0x045e , 0 },
- { "ghe.ital", 0xf6c4 , 0 },
- { "afii10068.ital", 0xf6c4 , 0 },
- { "afii10066.ital", 0xf6c5 , 0 },
- { "be.alt", 0xf6c5 , 0 },
- { "afii10069.ital", 0xf6c6 , 0 },
- { "de.ital", 0xf6c6 , 0 },
- { "afii10081.ital", 0xf6c7 , 0 },
- { "pe.ital", 0xf6c7 , 0 },
- { "afii10084.ital", 0xf6c8 , 0 },
- { "te.ital", 0xf6c8 , 0 },
- { "Omega.math", 0x2126 , 0 },
- { "Delta.math", 0x2206 , 0 },
- { "afii57689_afii57804", 0xfb2a , 0 },
- { "afii57689_afii57803", 0xfb2b , 0 },
- { "afii57669_afii57806", 0xfb4b , 0 },
- { "afii57718_afii57798", 0xfb1f , 0 },
- { "afii57669_afii57807", 0xfb35 , 0 },
- { ".null", 0x0000 , 0 },
- { "dialytika_perispomeni", 0x1fc1 , 0 },
- { "psili_varia", 0x1fcd , 0 },
- { "psili_oxia", 0x1fce , 0 },
- { "psili_perispomeni", 0x1fcf , 0 },
- { "dasia_varia", 0x1fdd , 0 },
- { "dasia_oxia", 0x1fde , 0 },
- { "dasia_perispomeni", 0x1fdf , 0 },
- { "dialytika_varia", 0x1fed , 0 },
- { "dialytika_oxia", 0x1fee , 0 },
- { "Alphaacute", 0x1fbb , 0 },
- { "Alphaasper", 0x1f09 , 0 },
- { "Alphaasperacute", 0x1f0d , 0 },
- { "Alphaaspergrave", 0x1f0b , 0 },
- { "Alphaaspertilde", 0x1f0f , 0 },
- { "Alphabreve", 0x1fb8 , 0 },
- { "Alphagrave", 0x1fba , 0 },
- { "Alphaiotasub", 0x1fbc , 0 },
- { "Alphaiotasubasper", 0x1f89 , 0 },
- { "Alphaiotasubasperacute", 0x1f8d , 0 },
- { "Alphaiotasubaspergrave", 0x1f8b , 0 },
- { "Alphaiotasubaspertilde", 0x1f8f , 0 },
- { "Alphaiotasublenis", 0x1f88 , 0 },
- { "Alphaiotasublenisacute", 0x1f8c , 0 },
- { "Alphaiotasublenisgrave", 0x1f8a , 0 },
- { "Alphaiotasublenistilde", 0x1f8e , 0 },
- { "Alphalenis", 0x1f08 , 0 },
- { "Alphalenisacute", 0x1f0c , 0 },
- { "Alphalenisgrave", 0x1f0a , 0 },
- { "Alphalenistilde", 0x1f0e , 0 },
- { "Alphamacron", 0x1fb9 , 0 },
- { "Epsilonacute", 0x1fc9 , 0 },
- { "Epsilonasper", 0x1f19 , 0 },
- { "Epsilonasperacute", 0x1f1d , 0 },
- { "Epsilonaspergrave", 0x1f1b , 0 },
- { "Epsilongrave", 0x1fc8 , 0 },
- { "Epsilonlenis", 0x1f18 , 0 },
- { "Epsilonlenisacute", 0x1f1c , 0 },
- { "Epsilonlenisgrave", 0x1f1a , 0 },
- { "Etaacute", 0x1fcb , 0 },
- { "Etaasper", 0x1f29 , 0 },
- { "Etaasperacute", 0x1f2d , 0 },
- { "Etaaspergrave", 0x1f2b , 0 },
- { "Etaaspertilde", 0x1f2f , 0 },
- { "Etagrave", 0x1fca , 0 },
- { "Etaiotasub", 0x1fcc , 0 },
- { "Etaiotasubasper", 0x1f99 , 0 },
- { "Etaiotasubasperacute", 0x1f9d , 0 },
- { "Etaiotasubaspergrave", 0x1f9b , 0 },
- { "Etaiotasubaspertilde", 0x1f9f , 0 },
- { "Etaiotasublenis", 0x1f98 , 0 },
- { "Etaiotasublenisacute", 0x1f9c , 0 },
- { "Etaiotasublenisgrave", 0x1f9a , 0 },
- { "Etaiotasublenistilde", 0x1f9e , 0 },
- { "Etalenis", 0x1f28 , 0 },
- { "Etalenisacute", 0x1f2c , 0 },
- { "Etalenisgrave", 0x1f2a , 0 },
- { "Etalenistilde", 0x1f2e , 0 },
- { "Iotaacute", 0x1fdb , 0 },
- { "Iotaasper", 0x1f39 , 0 },
- { "Iotaasperacute", 0x1f3d , 0 },
- { "Iotaaspergrave", 0x1f3b , 0 },
- { "Iotaaspertilde", 0x1f3f , 0 },
- { "Iotabreve", 0x1fd8 , 0 },
- { "Iotagrave", 0x1fda , 0 },
- { "Iotalenis", 0x1f38 , 0 },
- { "Iotalenisacute", 0x1f3c , 0 },
- { "Iotalenisgrave", 0x1f3a , 0 },
- { "Iotalenistilde", 0x1f3e , 0 },
- { "Iotamacron", 0x1fd9 , 0 },
- { "Omegaacute", 0x1ffb , 0 },
- { "Omegaasper", 0x1f69 , 0 },
- { "Omegaasperacute", 0x1f6d , 0 },
- { "Omegaaspergrave", 0x1f6b , 0 },
- { "Omegaaspertilde", 0x1f6f , 0 },
- { "Omegagrave", 0x1ffa , 0 },
- { "Omegaiotasub", 0x1ffc , 0 },
- { "Omegaiotasubasper", 0x1fa9 , 0 },
- { "Omegaiotasubasperacute", 0x1fad , 0 },
- { "Omegaiotasubaspergrave", 0x1fab , 0 },
- { "Omegaiotasubaspertilde", 0x1faf , 0 },
- { "Omegaiotasublenis", 0x1fa8 , 0 },
- { "Omegaiotasublenisacute", 0x1fac , 0 },
- { "Omegaiotasublenisgrave", 0x1faa , 0 },
- { "Omegaiotasublenistilde", 0x1fae , 0 },
- { "Omegalenis", 0x1f68 , 0 },
- { "Omegalenisacute", 0x1f6c , 0 },
- { "Omegalenisgrave", 0x1f6a , 0 },
- { "Omegalenistilde", 0x1f6e , 0 },
- { "Omicronacute", 0x1ff9 , 0 },
- { "Omicronasper", 0x1f49 , 0 },
- { "Omicronasperacute", 0x1f4d , 0 },
- { "Omicronaspergrave", 0x1f4b , 0 },
- { "Omicrongrave", 0x1ff8 , 0 },
- { "Omicronlenis", 0x1f48 , 0 },
- { "Omicronlenisacute", 0x1f4c , 0 },
- { "Omicronlenisgrave", 0x1f4a , 0 },
- { "Rhoasper", 0x1fec , 0 },
- { "Upsilonacute", 0x1feb , 0 },
- { "Upsilonasper", 0x1f59 , 0 },
- { "Upsilonasperacute", 0x1f5d , 0 },
- { "Upsilonaspergrave", 0x1f5b , 0 },
- { "Upsilonaspertilde", 0x1f5f , 0 },
- { "Upsilonbreve", 0x1fe8 , 0 },
- { "Upsilongrave", 0x1fea , 0 },
- { "Upsilonmacron", 0x1fe9 , 0 },
- { "numeralsign", 0x0374 , 0 },
- { "lownumeralsign", 0x0375 , 0 },
- { "lowcomma", 0x037a , 0 },
- { "stigma", 0x03da , 0 },
- { "koppa", 0x03de , 0 },
- { "sampi", 0x03e0 , 0 },
- { "lenis", 0x1fbd , 0 },
- { "iotasubscript", 0x1fbe , 0 },
- { "dieresistilde", 0x1fc1 , 0 },
- { "lenisgrave", 0x1fcd , 0 },
- { "lenisacute", 0x1fce , 0 },
- { "lenistilde", 0x1fcf , 0 },
- { "aspergrave", 0x1fdd , 0 },
- { "asperacute", 0x1fde , 0 },
- { "aspertilde", 0x1fdf , 0 },
- { "dialytikagrave", 0x1fed , 0 },
- { "dialytikaacute", 0x1fee , 0 },
- { "asper", 0x1ffe , 0 },
- { "alphalenis", 0x1f00 , 0 },
- { "alphaasper", 0x1f01 , 0 },
- { "alphalenisgrave", 0x1f02 , 0 },
- { "alphaaspergrave", 0x1f03 , 0 },
- { "alphalenisacute", 0x1f04 , 0 },
- { "alphaasperacute", 0x1f05 , 0 },
- { "alphalenistilde", 0x1f06 , 0 },
- { "alphaaspertilde", 0x1f07 , 0 },
- { "epsilonlenis", 0x1f10 , 0 },
- { "epsilonasper", 0x1f11 , 0 },
- { "epsilonlenisgrave", 0x1f12 , 0 },
- { "epsilonaspergrave", 0x1f13 , 0 },
- { "epsilonlenisacute", 0x1f14 , 0 },
- { "epsilonasperacute", 0x1f15 , 0 },
- { "etalenis", 0x1f20 , 0 },
- { "etaasper", 0x1f21 , 0 },
- { "etalenisgrave", 0x1f22 , 0 },
- { "etaaspergrave", 0x1f23 , 0 },
- { "etalenisacute", 0x1f24 , 0 },
- { "etaasperacute", 0x1f25 , 0 },
- { "etalenistilde", 0x1f26 , 0 },
- { "etaaspertilde", 0x1f27 , 0 },
- { "iotalenis", 0x1f30 , 0 },
- { "iotaasper", 0x1f31 , 0 },
- { "iotalenisgrave", 0x1f32 , 0 },
- { "iotaaspergrave", 0x1f33 , 0 },
- { "iotalenisacute", 0x1f34 , 0 },
- { "iotaasperacute", 0x1f35 , 0 },
- { "iotalenistilde", 0x1f36 , 0 },
- { "iotaaspertilde", 0x1f37 , 0 },
- { "omicronlenis", 0x1f40 , 0 },
- { "omicronasper", 0x1f41 , 0 },
- { "omicronlenisgrave", 0x1f42 , 0 },
- { "omicronaspergrave", 0x1f43 , 0 },
- { "omicronlenisacute", 0x1f44 , 0 },
- { "omicronasperacute", 0x1f45 , 0 },
- { "upsilonlenis", 0x1f50 , 0 },
- { "upsilonasper", 0x1f51 , 0 },
- { "upsilonlenisgrave", 0x1f52 , 0 },
- { "upsilonaspergrave", 0x1f53 , 0 },
- { "upsilonlenisacute", 0x1f54 , 0 },
- { "upsilonasperacute", 0x1f55 , 0 },
- { "upsilonlenistilde", 0x1f56 , 0 },
- { "upsilonaspertilde", 0x1f57 , 0 },
- { "omegalenis", 0x1f60 , 0 },
- { "omegaasper", 0x1f61 , 0 },
- { "omegalenisgrave", 0x1f62 , 0 },
- { "omegaaspergrave", 0x1f63 , 0 },
- { "omegalenisacute", 0x1f64 , 0 },
- { "omegaasperacute", 0x1f65 , 0 },
- { "omegalenistilde", 0x1f66 , 0 },
- { "omegaaspertilde", 0x1f67 , 0 },
- { "alphagrave", 0x1f70 , 0 },
- { "alphaacute", 0x1f71 , 0 },
- { "epsilongrave", 0x1f72 , 0 },
- { "epsilonacute", 0x1f73 , 0 },
- { "etagrave", 0x1f74 , 0 },
- { "etaacute", 0x1f75 , 0 },
- { "iotagrave", 0x1f76 , 0 },
- { "iotaacute", 0x1f77 , 0 },
- { "omicrongrave", 0x1f78 , 0 },
- { "omicronacute", 0x1f79 , 0 },
- { "upsilongrave", 0x1f7a , 0 },
- { "upsilonacute", 0x1f7b , 0 },
- { "omegagrave", 0x1f7c , 0 },
- { "omegaacute", 0x1f7d , 0 },
- { "alphaiotasublenis", 0x1f80 , 0 },
- { "alphaiotasubasper", 0x1f81 , 0 },
- { "alphaiotasublenisgrave", 0x1f82 , 0 },
- { "alphaiotasubaspergrave", 0x1f83 , 0 },
- { "alphaiotasublenisacute", 0x1f84 , 0 },
- { "alphaiotasubasperacute", 0x1f85 , 0 },
- { "alphaiotasublenistilde", 0x1f86 , 0 },
- { "alphaiotasubaspertilde", 0x1f87 , 0 },
- { "etaiotasublenis", 0x1f90 , 0 },
- { "etaiotasubasper", 0x1f91 , 0 },
- { "etaiotasublenisgrave", 0x1f92 , 0 },
- { "etaiotasubaspergrave", 0x1f93 , 0 },
- { "etaiotasublenisacute", 0x1f94 , 0 },
- { "etaiotasubasperacute", 0x1f95 , 0 },
- { "etaiotasublenistilde", 0x1f96 , 0 },
- { "etaiotasubaspertilde", 0x1f97 , 0 },
- { "omegaiotasublenis", 0x1fa0 , 0 },
- { "omegaiotasubasper", 0x1fa1 , 0 },
- { "omegaiotasublenisgrave", 0x1fa2 , 0 },
- { "omegaiotasubaspergrave", 0x1fa3 , 0 },
- { "omegaiotasublenisacute", 0x1fa4 , 0 },
- { "omegaiotasubasperacute", 0x1fa5 , 0 },
- { "omegaiotasublenistilde", 0x1fa6 , 0 },
- { "omegaiotasubaspertilde", 0x1fa7 , 0 },
- { "alphabreve", 0x1fb0 , 0 },
- { "alphamacron", 0x1fb1 , 0 },
- { "alphaiotasubgrave", 0x1fb2 , 0 },
- { "alphaiotasub", 0x1fb3 , 0 },
- { "alphatilde", 0x1fb6 , 0 },
- { "alphaiotasubtilde", 0x1fb7 , 0 },
- { "etaiotasubgrave", 0x1fc2 , 0 },
- { "etaiotasub", 0x1fc3 , 0 },
- { "etaiotasubacute", 0x1fc4 , 0 },
- { "etatilde", 0x1fc6 , 0 },
- { "etaiotasubtilde", 0x1fc7 , 0 },
- { "iotabreve", 0x1fd0 , 0 },
- { "iotamacron", 0x1fd1 , 0 },
- { "iotadieresisgrave", 0x1fd2 , 0 },
- { "iotadieresisacute", 0x1fd3 , 0 },
- { "iotatilde", 0x1fd6 , 0 },
- { "iotadieresistilde", 0x1fd7 , 0 },
- { "upsilonbreve", 0x1fe0 , 0 },
- { "upsilonmacron", 0x1fe1 , 0 },
- { "upsilondieresisgrave", 0x1fe2 , 0 },
- { "upsilondieresisacute", 0x1fe3 , 0 },
- { "rholenis", 0x1fe4 , 0 },
- { "rhoasper", 0x1fe5 , 0 },
- { "upsilontilde", 0x1fe6 , 0 },
- { "omegaiotasubgrave", 0x1ff2 , 0 },
- { "omegaiotasub", 0x1ff3 , 0 },
- { "omegaiotasubacute", 0x1ff4 , 0 },
- { "omegatilde", 0x1ff6 , 0 },
- { "omegaiotasubtilde", 0x1ff7 , 0 },
- { "alphaiotasubacute", 0x1fb4 , 0 },
- { "upsilondieresistilde", 0x1fe7 , 0 },
- { "digamma", 0xefd5 , 0 },
- { "Be", 0x0411 , 0 },
- { "Ve", 0x0412 , 0 },
- { "Ghe", 0x0413 , 0 },
- { "De", 0x0414 , 0 },
- { "Ie", 0x0415 , 0 },
- { "Zhe", 0x0416 , 0 },
- { "Ze", 0x0417 , 0 },
- { "Ka", 0x041a , 0 },
- { "El", 0x041b , 0 },
- { "Em", 0x041c , 0 },
- { "En", 0x041d , 0 },
- { "Pe", 0x041f , 0 },
- { "Er", 0x0420 , 0 },
- { "Es", 0x0421 , 0 },
- { "Te", 0x0422 , 0 },
- { "Ef", 0x0424 , 0 },
- { "Ha", 0x0425 , 0 },
- { "Tse", 0x0426 , 0 },
- { "Che", 0x0427 , 0 },
- { "Sha", 0x0428 , 0 },
- { "Shcha", 0x0429 , 0 },
- { "Hard", 0x042a , 0 },
- { "Yeru", 0x042b , 0 },
- { "Soft", 0x042c , 0 },
- { "Yu", 0x042e , 0 },
- { "Ya", 0x042f , 0 },
- { "Io", 0x0401 , 0 },
- { "Dje", 0x0402 , 0 },
- { "Gje", 0x0403 , 0 },
- { "Dze", 0x0405 , 0 },
- { "Yi", 0x0407 , 0 },
- { "Je", 0x0408 , 0 },
- { "Lje", 0x0409 , 0 },
- { "Nje", 0x040a , 0 },
- { "Tshe", 0x040b , 0 },
- { "Kje", 0x040c , 0 },
- { "Dzhe", 0x040f , 0 },
- { "Yat", 0x0462 , 0 },
- { "Fita", 0x0472 , 0 },
- { "Izhitsa", 0x0474 , 0 },
- { "be", 0x0431 , 0 },
- { "ve", 0x0432 , 0 },
- { "ghe", 0x0433 , 0 },
- { "de", 0x0434 , 0 },
- { "ie", 0x0435 , 0 },
- { "zhe", 0x0436 , 0 },
- { "ze", 0x0437 , 0 },
- { "ka", 0x043a , 0 },
- { "el", 0x043b , 0 },
- { "em", 0x043c , 0 },
- { "en", 0x043d , 0 },
- { "er", 0x0440 , 0 },
- { "es", 0x0441 , 0 },
- { "te", 0x0442 , 0 },
- { "ef", 0x0444 , 0 },
- { "ha", 0x0445 , 0 },
- { "tse", 0x0446 , 0 },
- { "che", 0x0447 , 0 },
- { "sha", 0x0448 , 0 },
- { "shcha", 0x0449 , 0 },
- { "hard", 0x044a , 0 },
- { "yeru", 0x044b , 0 },
- { "soft", 0x044c , 0 },
- { "yu", 0x044e , 0 },
- { "ya", 0x044f , 0 },
- { "io", 0x0451 , 0 },
- { "dje", 0x0452 , 0 },
- { "gje", 0x0453 , 0 },
- { "dze", 0x0455 , 0 },
- { "yi", 0x0457 , 0 },
- { "je", 0x0458 , 0 },
- { "lje", 0x0459 , 0 },
- { "nje", 0x045a , 0 },
- { "tshe", 0x045b , 0 },
- { "kje", 0x045c , 0 },
- { "dzhe", 0x045f , 0 },
- { "yat", 0x0463 , 0 },
- { "fita", 0x0473 , 0 },
- { "izhitsa", 0x0475 , 0 },
- { "litre", 0x2113 , 0 },
- { "Dotaccent", 0xefed , 0 },
- { "Breve", 0xefee , 0 },
- { "Ogonek", 0xeff1 , 0 },
- { "Cedilla", 0xeff2 , 0 },
- { "Ring", 0xeff3 , 0 },
- { "Tilde", 0xeff5 , 0 },
- { "Circumflex", 0xeff7 , 0 },
- { "dbar", 0x0111 , 0 },
- { "st", 0xfb06 , 0 },
- { "TeXtext32", 0x0337 , 0 },
- { "DD070", 0x2014 , 0 },
- { "monospacedash", 0x2014 , 0 },
- { "Dash1cent", 0x2015 , 0 },
- { "apostrophereverse", 0x201b , 0 },
- { "Pts", 0x20a7 , 0 },
- { "SM760000", 0x2195 , 0 },
- { "SM770000", 0x21a8 , 0 },
- { "SP320000", 0x2219 , 0 },
- { "SD630000", 0x22c5 , 0 },
- { "SM790000", 0x2302 , 0 },
- { "caretinverted", 0x2304 , 0 },
- { "SM680000", 0x2310 , 0 },
- { "SA420000", 0x2319 , 0 },
- { "BorderULCorner1", 0x231c , 0 },
- { "DD010", 0x231c , 0 },
- { "DD101", 0x231c , 0 },
- { "BorderURCorner1", 0x231d , 0 },
- { "DD012", 0x231d , 0 },
- { "DD104", 0x231d , 0 },
- { "BorderLLCorner1", 0x231e , 0 },
- { "DD014", 0x231e , 0 },
- { "DD109", 0x231e , 0 },
- { "BorderLRCorner1", 0x231f , 0 },
- { "DD015", 0x231f , 0 },
- { "DD112", 0x231f , 0 },
- { "SS260000", 0x2320 , 0 },
- { "SS270000", 0x2321 , 0 },
- { "hook", 0x2440 , 0 },
- { "chair", 0x2441 , 0 },
- { "fork", 0x2442 , 0 },
- { "SF600000", 0x2580 , 0 },
- { "BorderLower1", 0x2581 , 0 },
- { "DD011", 0x2581 , 0 },
- { "DD021", 0x2581 , 0 },
- { "DD110", 0x2581 , 0 },
- { "Flower1l", 0x2581 , 0 },
- { "SF570000", 0x2584 , 0 },
- { "SF610000", 0x2588 , 0 },
- { "Tile", 0x2588 , 0 },
- { "HalfTile", 0x258c , 0 },
- { "SF580000", 0x258c , 0 },
- { "BorderLeftVertical1", 0x258f , 0 },
- { "DD013", 0x258f , 0 },
- { "DD034", 0x258f , 0 },
- { "DD105", 0x258f , 0 },
- { "Flower1d", 0x258f , 0 },
- { "SF590000", 0x2590 , 0 },
- { "SF140000", 0x2591 , 0 },
- { "SF150000", 0x2592 , 0 },
- { "SF160000", 0x2593 , 0 },
- { "BorderUpper1", 0x2594 , 0 },
- { "DD024", 0x2594 , 0 },
- { "DD102", 0x2594 , 0 },
- { "BorderRightVertical1", 0x2595 , 0 },
- { "DD031", 0x2595 , 0 },
- { "DD106", 0x2595 , 0 },
- { "Flower2dr", 0x2595 , 0 },
- { "SM600000", 0x25b2 , 0 },
- { "SM590000", 0x25b6 , 0 },
- { "SV040000", 0x25bc , 0 },
- { "SM630000", 0x25c0 , 0 },
- { "SM750000", 0x25cb , 0 },
- { "SM570001", 0x25d8 , 0 },
- { "SM750002", 0x25d9 , 0 },
- { "ShootingStar", 0x2604 , 0 },
- { "DD130", 0x2605 , 0 },
- { "StarDingbat1", 0x2605 , 0 },
- { "TheSun", 0x2609 , 0 },
- { "FleuronLeft", 0x2619 , 0 },
- { "cross", 0x2629 , 0 },
- { "SS000000", 0x263a , 0 },
- { "SS010000", 0x263b , 0 },
- { "SM690000", 0x263c , 0 },
- { "TheMoon", 0x263d , 0 },
- { "Moon", 0x263e , 0 },
- { "Mercury", 0x263f , 0 },
- { "Venus", 0x2640 , 0 },
- { "Earth", 0x2641 , 0 },
- { "Mars", 0x2642 , 0 },
- { "Jupiter", 0x2643 , 0 },
- { "Saturn", 0x2644 , 0 },
- { "Uranus", 0x2645 , 0 },
- { "Neptune", 0x2646 , 0 },
- { "Pluto", 0x2647 , 0 },
- { "Aries", 0x2648 , 0 },
- { "Taurus", 0x2649 , 0 },
- { "Gemini", 0x264a , 0 },
- { "Cancer", 0x264b , 0 },
- { "Leo", 0x264c , 0 },
- { "Virgo", 0x264d , 0 },
- { "Libra", 0x264e , 0 },
- { "Scorpio", 0x264f , 0 },
- { "Sagittarius", 0x2650 , 0 },
- { "Capricorn", 0x2651 , 0 },
- { "Aquarius", 0x2652 , 0 },
- { "Pisces", 0x2653 , 0 },
- { "diamondopen", 0x2662 , 0 },
- { "FleuronCenter", 0x2766 , 0 },
- { "FleuronRight", 0x2767 , 0 },
- { "st1", 0xfb06 , 0 },
- { "zeroslash", 0xf638 , 0 },
- { "pi1", 0x03d6 , 0 },
- { "hyphen-minus", 0x002d , 0 },
- { "hyphenminus", 0x002d , 0 },
- { "nonmarkingreturn", 0x000d , 0 },
- { "micro", 0x00b5 , 0 },
- { "Dmacron", 0x0110 , 0 },
- { "kra", 0x0138 , 0 },
- { "bbar", 0x0180 , 0 },
- { "Dbar", 0x0189 , 0 },
- { "deltaturn", 0x018d , 0 },
- { "Eturn", 0x018e , 0 },
- { "Epsilonlatin", 0x0190 , 0 },
- { "Gammalatin", 0x0194 , 0 },
- { "Iotalatin", 0x0196 , 0 },
- { "Ibar", 0x0197 , 0 },
- { "lambdabar", 0x019b , 0 },
- { "mcapturn", 0x019c , 0 },
- { "Nhook", 0x019d , 0 },
- { "nleg", 0x019e , 0 },
- { "Obar", 0x019f , 0 },
- { "OI", 0x01a2 , 0 },
- { "YR", 0x01a6 , 0 },
- { "eshlooprev", 0x01aa , 0 },
- { "Trthook", 0x01ae , 0 },
- { "Upsilonlatin", 0x01b1 , 0 },
- { "Vcursive", 0x01b2 , 0 },
- { "Zbar", 0x01b5 , 0 },
- { "zbar", 0x01b6 , 0 },
- { "Yogh", 0x01b7 , 0 },
- { "Yoghrev", 0x01b8 , 0 },
- { "yoghrev", 0x01b9 , 0 },
- { "yoghtail", 0x01ba , 0 },
- { "twobar", 0x01bb , 0 },
- { "glottalstopbarinv", 0x01be , 0 },
- { "pipe", 0x01c0 , 0 },
- { "pipedbl", 0x01c1 , 0 },
- { "pipedblbar", 0x01c2 , 0 },
- { "exclamlatin", 0x01c3 , 0 },
- { "DZhacek", 0x01c4 , 0 },
- { "Dzhacek", 0x01c5 , 0 },
- { "dzhacek", 0x01c6 , 0 },
- { "Ahacek", 0x01cd , 0 },
- { "ahacek", 0x01ce , 0 },
- { "Ihacek", 0x01cf , 0 },
- { "ihacek", 0x01d0 , 0 },
- { "Ohacek", 0x01d1 , 0 },
- { "ohacek", 0x01d2 , 0 },
- { "Uhacek", 0x01d3 , 0 },
- { "uhacek", 0x01d4 , 0 },
- { "Udieresishacek", 0x01d9 , 0 },
- { "udieresishacek", 0x01da , 0 },
- { "eturn", 0x01dd , 0 },
- { "Gbar", 0x01e4 , 0 },
- { "gbar", 0x01e5 , 0 },
- { "Ghacek", 0x01e6 , 0 },
- { "ghacek", 0x01e7 , 0 },
- { "Khacek", 0x01e8 , 0 },
- { "khacek", 0x01e9 , 0 },
- { "Yoghhacek", 0x01ee , 0 },
- { "yoghhacek", 0x01ef , 0 },
- { "jhacek", 0x01f0 , 0 },
- { "aturn", 0x0250 , 0 },
- { "ascriptturn", 0x0252 , 0 },
- { "cturn", 0x0254 , 0 },
- { "drthook", 0x0256 , 0 },
- { "erev", 0x0258 , 0 },
- { "epsilonlatin", 0x025b , 0 },
- { "epsilonlatinrev", 0x025c , 0 },
- { "epsilonlatinrevhook", 0x025d , 0 },
- { "epsilonlatinrevclosed", 0x025e , 0 },
- { "jdotlessbar", 0x025f , 0 },
- { "gcursive", 0x0261 , 0 },
- { "Gsmallcap", 0x0262 , 0 },
- { "gammalatin", 0x0263 , 0 },
- { "babygamma", 0x0264 , 0 },
- { "hturn", 0x0265 , 0 },
- { "ibar", 0x0268 , 0 },
- { "Ismallcap", 0x026a , 0 },
- { "lmidtilde", 0x026b , 0 },
- { "lrthook", 0x026d , 0 },
- { "lyogh", 0x026e , 0 },
- { "mturn", 0x026f , 0 },
- { "mturndescend", 0x0270 , 0 },
- { "nlftlfthook", 0x0272 , 0 },
- { "nrthook", 0x0273 , 0 },
- { "Nsmallcap", 0x0274 , 0 },
- { "obar", 0x0275 , 0 },
- { "OEsmallcap", 0x0276 , 0 },
- { "omegaclosed", 0x0277 , 0 },
- { "rturn", 0x0279 , 0 },
- { "rturnascend", 0x027a , 0 },
- { "rturnrthook", 0x027b , 0 },
- { "rdescend", 0x027c , 0 },
- { "rrthook", 0x027d , 0 },
- { "rfishhookrev", 0x027f , 0 },
- { "Rsmallcap", 0x0280 , 0 },
- { "Rsmallcapinv", 0x0281 , 0 },
- { "srthook", 0x0282 , 0 },
- { "jhookdblbar", 0x0284 , 0 },
- { "eshshortrev", 0x0285 , 0 },
- { "tturn", 0x0287 , 0 },
- { "trthook", 0x0288 , 0 },
- { "vscript", 0x028b , 0 },
- { "vturn", 0x028c , 0 },
- { "wturn", 0x028d , 0 },
- { "yturn", 0x028e , 0 },
- { "Ysmallcap", 0x028f , 0 },
- { "zrthook", 0x0290 , 0 },
- { "yogh", 0x0292 , 0 },
- { "yoghcurl", 0x0293 , 0 },
- { "glottalstoprevinv", 0x0295 , 0 },
- { "glottalstopinv", 0x0296 , 0 },
- { "cstretch", 0x0297 , 0 },
- { "kiss", 0x0298 , 0 },
- { "Bsmallcap", 0x0299 , 0 },
- { "epsilonclosed", 0x029a , 0 },
- { "Gsmallcaphook", 0x029b , 0 },
- { "Hsmallcap", 0x029c , 0 },
- { "jcrosstail", 0x029d , 0 },
- { "kturn", 0x029e , 0 },
- { "Lsmallcap", 0x029f , 0 },
- { "glottalstopbar", 0x02a1 , 0 },
- { "glottalstopbarrev", 0x02a2 , 0 },
- { "dyogh", 0x02a4 , 0 },
- { "hsuper", 0x02b0 , 0 },
- { "hhooksuper", 0x02b1 , 0 },
- { "jsuper", 0x02b2 , 0 },
- { "rsuper", 0x02b3 , 0 },
- { "rturnsuper", 0x02b4 , 0 },
- { "rturnrthooksuper", 0x02b5 , 0 },
- { "Rturnsuper", 0x02b6 , 0 },
- { "wsuper", 0x02b7 , 0 },
- { "ysuper", 0x02b8 , 0 },
- { "primedblmod", 0x02ba , 0 },
- { "quoteleftmod", 0x02bb , 0 },
- { "apostrophe", 0x02bc , 0 },
- { "apostropherev", 0x02bd , 0 },
- { "ringrighthalfsuper", 0x02be , 0 },
- { "ringlefthalfsuper", 0x02bf , 0 },
- { "glottal", 0x02c0 , 0 },
- { "glottalrev", 0x02c1 , 0 },
- { "fronted", 0x02c2 , 0 },
- { "backed", 0x02c3 , 0 },
- { "raised", 0x02c4 , 0 },
- { "lowered", 0x02c5 , 0 },
- { "linevert", 0x02c8 , 0 },
- { "macronmodifier", 0x02c9 , 0 },
- { "acutemodifier", 0x02ca , 0 },
- { "gravemodifier", 0x02cb , 0 },
- { "linevertsub", 0x02cc , 0 },
- { "macronsub", 0x02cd , 0 },
- { "gravesub", 0x02ce , 0 },
- { "acutesub", 0x02cf , 0 },
- { "length", 0x02d0 , 0 },
- { "halflength", 0x02d1 , 0 },
- { "ringrighthalfcenter", 0x02d2 , 0 },
- { "ringlefthalfsup", 0x02d3 , 0 },
- { "tackupmid", 0x02d4 , 0 },
- { "tackdownmid", 0x02d5 , 0 },
- { "rhotichook", 0x02de , 0 },
- { "gammasuper", 0x02e0 , 0 },
- { "lsuper", 0x02e1 , 0 },
- { "ssuper", 0x02e2 , 0 },
- { "xsuper", 0x02e3 , 0 },
- { "glottalrevsuper", 0x02e4 , 0 },
- { "toneextrahigh", 0x02e5 , 0 },
- { "tonehigh", 0x02e6 , 0 },
- { "tonemid", 0x02e7 , 0 },
- { "tonelow", 0x02e8 , 0 },
- { "toneextralow", 0x02e9 , 0 },
- { "gravenosp", 0x0300 , 0 },
- { "acutenosp", 0x0301 , 0 },
- { "circumflexnosp", 0x0302 , 0 },
- { "tildenosp", 0x0303 , 0 },
- { "macronnosp", 0x0304 , 0 },
- { "overscorenosp", 0x0305 , 0 },
- { "brevenosp", 0x0306 , 0 },
- { "dotnosp", 0x0307 , 0 },
- { "dieresisnosp", 0x0308 , 0 },
- { "hooksupnosp", 0x0309 , 0 },
- { "ringnosp", 0x030a , 0 },
- { "acutedblnosp", 0x030b , 0 },
- { "haceknosp", 0x030c , 0 },
- { "linevertnosp", 0x030d , 0 },
- { "linevertdblnosp", 0x030e , 0 },
- { "gravedblnosp", 0x030f , 0 },
- { "candrabindunosp", 0x0310 , 0 },
- { "breveinvnosp", 0x0311 , 0 },
- { "commaturnsupnosp", 0x0312 , 0 },
- { "apostrophesupnosp", 0x0313 , 0 },
- { "commasuprevnosp", 0x0314 , 0 },
- { "commasuprightnosp", 0x0315 , 0 },
- { "gravesubnosp", 0x0316 , 0 },
- { "acutesubnosp", 0x0317 , 0 },
- { "tackleftsubnosp", 0x0318 , 0 },
- { "tackrightsubnosp", 0x0319 , 0 },
- { "anglesupnosp", 0x031a , 0 },
- { "hornnosp", 0x031b , 0 },
- { "ringlefthalfsubnosp", 0x031c , 0 },
- { "tackupsubnosp", 0x031d , 0 },
- { "tackdownsubnosp", 0x031e , 0 },
- { "plussubnosp", 0x031f , 0 },
- { "minussubnosp", 0x0320 , 0 },
- { "hooksubpalatnosp", 0x0321 , 0 },
- { "hooksubretronosp", 0x0322 , 0 },
- { "dotsubnosp", 0x0323 , 0 },
- { "dotdblsubnosp", 0x0324 , 0 },
- { "ringsubnosp", 0x0325 , 0 },
- { "commasubnosp", 0x0326 , 0 },
- { "cedillanosp", 0x0327 , 0 },
- { "ogoneknosp", 0x0328 , 0 },
- { "linevertsubnosp", 0x0329 , 0 },
- { "bridgesubnosp", 0x032a , 0 },
- { "archdblsubnosp", 0x032b , 0 },
- { "haceksubnosp", 0x032c , 0 },
- { "circumflexsubnosp", 0x032d , 0 },
- { "brevesubnosp", 0x032e , 0 },
- { "breveinvsubnosp", 0x032f , 0 },
- { "tildesubnosp", 0x0330 , 0 },
- { "macronsubnosp", 0x0331 , 0 },
- { "underscorenosp", 0x0332 , 0 },
- { "underscoredblnosp", 0x0333 , 0 },
- { "tildemidnosp", 0x0334 , 0 },
- { "barmidshortnosp", 0x0335 , 0 },
- { "barmidlongnosp", 0x0336 , 0 },
- { "slashshortnosp", 0x0337 , 0 },
- { "slashlongnosp", 0x0338 , 0 },
- { "ringrighthalfsubnosp", 0x0339 , 0 },
- { "bridgeinvsubnosp", 0x033a , 0 },
- { "squaresubnosp", 0x033b , 0 },
- { "seagullsubnosp", 0x033c , 0 },
- { "xsupnosp", 0x033d , 0 },
- { "tildevertsupnosp", 0x033e , 0 },
- { "overscoredblnosp", 0x033f , 0 },
- { "graveleftnosp", 0x0340 , 0 },
- { "acuterightnosp", 0x0341 , 0 },
- { "wavyoverscorenosp", 0x0342 , 0 },
- { "zigzagoverscorenosp", 0x0343 , 0 },
- { "diaeresistonosnosp", 0x0344 , 0 },
- { "iotasubnosp", 0x0345 , 0 },
- { "iotasub", 0x037a , 0 },
- { "diaeresistonos", 0x0385 , 0 },
- { "iotadiaeresistonos", 0x0390 , 0 },
- { "Iotadiaeresis", 0x03aa , 0 },
- { "Upsilondiaeresis", 0x03ab , 0 },
- { "upsilondiaeresistonos", 0x03b0 , 0 },
- { "iotadiaeresis", 0x03ca , 0 },
- { "upsilondiaeresis", 0x03cb , 0 },
- { "betacurled", 0x03d0 , 0 },
- { "thetascript", 0x03d1 , 0 },
- { "Upsilonhook", 0x03d2 , 0 },
- { "Upsilonhooktonos", 0x03d3 , 0 },
- { "Upsilonhookdiaeresis", 0x03d4 , 0 },
- { "phiscript", 0x03d5 , 0 },
- { "omegapi", 0x03d6 , 0 },
- { "Stigma", 0x03da , 0 },
- { "stigma", 0x03db , 0 },
- { "Digamma", 0x03dc , 0 },
- { "digamma", 0x03dd , 0 },
- { "Koppa", 0x03de , 0 },
- { "koppa", 0x03df , 0 },
- { "Sampi", 0x03e0 , 0 },
- { "sampi", 0x03e1 , 0 },
- { "Shei", 0x03e2 , 0 },
- { "shei", 0x03e3 , 0 },
- { "Fei", 0x03e4 , 0 },
- { "fei", 0x03e5 , 0 },
- { "Khei", 0x03e6 , 0 },
- { "khei", 0x03e7 , 0 },
- { "Hori", 0x03e8 , 0 },
- { "hori", 0x03e9 , 0 },
- { "Gangia", 0x03ea , 0 },
- { "gangia", 0x03eb , 0 },
- { "Shima", 0x03ec , 0 },
- { "shima", 0x03ed , 0 },
- { "Dei", 0x03ee , 0 },
- { "dei", 0x03ef , 0 },
- { "kappascript", 0x03f0 , 0 },
- { "sigmalunate", 0x03f2 , 0 },
- { "Io", 0x0401 , 0 },
- { "Dje", 0x0402 , 0 },
- { "Gje", 0x0403 , 0 },
- { "Ecyril", 0x0404 , 0 },
- { "Dze", 0x0405 , 0 },
- { "Icyril", 0x0406 , 0 },
- { "Yi", 0x0407 , 0 },
- { "Je", 0x0408 , 0 },
- { "Lje", 0x0409 , 0 },
- { "Nje", 0x040a , 0 },
- { "Tshe", 0x040b , 0 },
- { "Kje", 0x040c , 0 },
- { "Ucyrilbreve", 0x040e , 0 },
- { "Dzhe", 0x040f , 0 },
- { "Acyril", 0x0410 , 0 },
- { "Be", 0x0411 , 0 },
- { "Ve", 0x0412 , 0 },
- { "Ge", 0x0413 , 0 },
- { "De", 0x0414 , 0 },
- { "Ie", 0x0415 , 0 },
- { "Zhe", 0x0416 , 0 },
- { "Ze", 0x0417 , 0 },
- { "Ii", 0x0418 , 0 },
- { "Iibreve", 0x0419 , 0 },
- { "Ka", 0x041a , 0 },
- { "El", 0x041b , 0 },
- { "Em", 0x041c , 0 },
- { "En", 0x041d , 0 },
- { "Ocyril", 0x041e , 0 },
- { "Pecyril", 0x041f , 0 },
- { "Er", 0x0420 , 0 },
- { "Es", 0x0421 , 0 },
- { "Te", 0x0422 , 0 },
- { "Ucyril", 0x0423 , 0 },
- { "Ef", 0x0424 , 0 },
- { "Kha", 0x0425 , 0 },
- { "Tse", 0x0426 , 0 },
- { "Che", 0x0427 , 0 },
- { "Sha", 0x0428 , 0 },
- { "Shcha", 0x0429 , 0 },
- { "Hard", 0x042a , 0 },
- { "Yeri", 0x042b , 0 },
- { "Soft", 0x042c , 0 },
- { "Ecyrilrev", 0x042d , 0 },
- { "Iu", 0x042e , 0 },
- { "Ia", 0x042f , 0 },
- { "acyril", 0x0430 , 0 },
- { "be", 0x0431 , 0 },
- { "ve", 0x0432 , 0 },
- { "ge", 0x0433 , 0 },
- { "de", 0x0434 , 0 },
- { "ie", 0x0435 , 0 },
- { "zhe", 0x0436 , 0 },
- { "ze", 0x0437 , 0 },
- { "ii", 0x0438 , 0 },
- { "iibreve", 0x0439 , 0 },
- { "ka", 0x043a , 0 },
- { "el", 0x043b , 0 },
- { "em", 0x043c , 0 },
- { "en", 0x043d , 0 },
- { "ocyril", 0x043e , 0 },
- { "pecyril", 0x043f , 0 },
- { "er", 0x0440 , 0 },
- { "es", 0x0441 , 0 },
- { "te", 0x0442 , 0 },
- { "ucyril", 0x0443 , 0 },
- { "ef", 0x0444 , 0 },
- { "kha", 0x0445 , 0 },
- { "tse", 0x0446 , 0 },
- { "che", 0x0447 , 0 },
- { "sha", 0x0448 , 0 },
- { "shcha", 0x0449 , 0 },
- { "hard", 0x044a , 0 },
- { "yeri", 0x044b , 0 },
- { "soft", 0x044c , 0 },
- { "ecyrilrev", 0x044d , 0 },
- { "iu", 0x044e , 0 },
- { "ia", 0x044f , 0 },
- { "io", 0x0451 , 0 },
- { "dje", 0x0452 , 0 },
- { "gje", 0x0453 , 0 },
- { "ecyril", 0x0454 , 0 },
- { "dze", 0x0455 , 0 },
- { "icyril", 0x0456 , 0 },
- { "yi", 0x0457 , 0 },
- { "je", 0x0458 , 0 },
- { "lje", 0x0459 , 0 },
- { "nje", 0x045a , 0 },
- { "tshe", 0x045b , 0 },
- { "kje", 0x045c , 0 },
- { "ucyrilbreve", 0x045e , 0 },
- { "dzhe", 0x045f , 0 },
- { "Yat", 0x0462 , 0 },
- { "yat", 0x0463 , 0 },
- { "Yusbig", 0x046a , 0 },
- { "yusbig", 0x046b , 0 },
- { "Psicyril", 0x0470 , 0 },
- { "psicyril", 0x0471 , 0 },
- { "Fita", 0x0472 , 0 },
- { "fita", 0x0473 , 0 },
- { "Izhitsa", 0x0474 , 0 },
- { "izhitsa", 0x0475 , 0 },
- { "Izhitsagravedbl", 0x0476 , 0 },
- { "izhitsagravedbl", 0x0477 , 0 },
- { "Digraphuk", 0x0478 , 0 },
- { "digraphuk", 0x0479 , 0 },
- { "Omegaround", 0x047a , 0 },
- { "omegaround", 0x047b , 0 },
- { "Omegatitlo", 0x047c , 0 },
- { "omegatitlo", 0x047d , 0 },
- { "OT", 0x047e , 0 },
- { "ot", 0x047f , 0 },
- { "Geupturn", 0x0490 , 0 },
- { "geupturn", 0x0491 , 0 },
- { "Gebar", 0x0492 , 0 },
- { "gebar", 0x0493 , 0 },
- { "Gehook", 0x0494 , 0 },
- { "gehook", 0x0495 , 0 },
- { "Zhertdes", 0x0496 , 0 },
- { "zhertdes", 0x0497 , 0 },
- { "Zecedilla", 0x0498 , 0 },
- { "zecedilla", 0x0499 , 0 },
- { "Kartdes", 0x049a , 0 },
- { "kartdes", 0x049b , 0 },
- { "Kavertbar", 0x049c , 0 },
- { "kavertbar", 0x049d , 0 },
- { "Kabar", 0x049e , 0 },
- { "kabar", 0x049f , 0 },
- { "GeKarev", 0x04a0 , 0 },
- { "gekarev", 0x04a1 , 0 },
- { "Enrtdes", 0x04a2 , 0 },
- { "enrtdes", 0x04a3 , 0 },
- { "EnGe", 0x04a4 , 0 },
- { "enge", 0x04a5 , 0 },
- { "Pehook", 0x04a6 , 0 },
- { "pehook", 0x04a7 , 0 },
- { "Ohook", 0x04a8 , 0 },
- { "ohook", 0x04a9 , 0 },
- { "Escedilla", 0x04aa , 0 },
- { "escedilla", 0x04ab , 0 },
- { "Tertdes", 0x04ac , 0 },
- { "tertdes", 0x04ad , 0 },
- { "Ustrt", 0x04ae , 0 },
- { "ustrt", 0x04af , 0 },
- { "Ustrtbar", 0x04b0 , 0 },
- { "ustrtbar", 0x04b1 , 0 },
- { "Khartdes", 0x04b2 , 0 },
- { "khartdes", 0x04b3 , 0 },
- { "TeTse", 0x04b4 , 0 },
- { "tetse", 0x04b5 , 0 },
- { "Chertdes", 0x04b6 , 0 },
- { "chertdes", 0x04b7 , 0 },
- { "Chevertbar", 0x04b8 , 0 },
- { "chevertbar", 0x04b9 , 0 },
- { "Hcyril", 0x04ba , 0 },
- { "hcyril", 0x04bb , 0 },
- { "Iehook", 0x04bc , 0 },
- { "iehook", 0x04bd , 0 },
- { "Iehookogonek", 0x04be , 0 },
- { "iehookogonek", 0x04bf , 0 },
- { "Icyril1", 0x04c0 , 0 },
- { "Zhebreve", 0x04c1 , 0 },
- { "zhebreve", 0x04c2 , 0 },
- { "Kahook", 0x04c3 , 0 },
- { "kahook", 0x04c4 , 0 },
- { "Enhook", 0x04c7 , 0 },
- { "enhook", 0x04c8 , 0 },
- { "Cheleftdes", 0x04cb , 0 },
- { "cheleftdes", 0x04cc , 0 },
- { "qibuts", 0x05bb , 0 },
- { "meteg", 0x05bd , 0 },
- { "maqaf", 0x05be , 0 },
- { "paseq", 0x05c0 , 0 },
- { "shindot", 0x05c1 , 0 },
- { "sindot", 0x05c2 , 0 },
- { "sofpasuq", 0x05c3 , 0 },
- { "kaffinal", 0x05da , 0 },
- { "memfinal", 0x05dd , 0 },
- { "nunfinal", 0x05df , 0 },
- { "pefinal", 0x05e3 , 0 },
- { "tsadifinal", 0x05e5 , 0 },
- { "vavdbl", 0x05f0 , 0 },
- { "vavyod", 0x05f1 , 0 },
- { "yoddbl", 0x05f2 , 0 },
- { "geresh", 0x05f3 , 0 },
- { "gershayim", 0x05f4 , 0 },
- { "varika", 0x05f5 , 0 },
- { "enquad", 0x2000 , 0 },
- { "emquad", 0x2001 , 0 },
- { "emspace", 0x2003 , 0 },
- { "threeperemspace", 0x2004 , 0 },
- { "fourperemspace", 0x2005 , 0 },
- { "sixperemspace", 0x2006 , 0 },
- { "figurespace", 0x2007 , 0 },
- { "punctuationspace", 0x2008 , 0 },
- { "thinspace", 0x2009 , 0 },
- { "hairspace", 0x200a , 0 },
- { "zerospace", 0x200b , 0 },
- { "zeronojoin", 0x200c , 0 },
- { "zerojoin", 0x200d , 0 },
- { "hyphennobreak", 0x2011 , 0 },
- { "quotedash", 0x2015 , 0 },
- { "dashdbl", 0x2016 , 0 },
- { "quotesinglrev", 0x201b , 0 },
- { "quotedblrev", 0x201f , 0 },
- { "trianglebullet", 0x2023 , 0 },
- { "onedotlead", 0x2024 , 0 },
- { "twodotlead", 0x2025 , 0 },
- { "hyphendot", 0x2027 , 0 },
- { "lineseparator", 0x2028 , 0 },
- { "paragraphseparator", 0x2029 , 0 },
- { "lre", 0x202a , 0 },
- { "rle", 0x202b , 0 },
- { "pdf", 0x202c , 0 },
- { "lro", 0x202d , 0 },
- { "rlo", 0x202e , 0 },
- { "pertenthousand", 0x2031 , 0 },
- { "prime", 0x2032 , 0 },
- { "primedbl", 0x2033 , 0 },
- { "primetriple", 0x2034 , 0 },
- { "primerev", 0x2035 , 0 },
- { "primedblrev", 0x2036 , 0 },
- { "primetriplerev", 0x2037 , 0 },
- { "caret", 0x2038 , 0 },
- { "refmark", 0x203b , 0 },
- { "interrobang", 0x203d , 0 },
- { "tie", 0x2040 , 0 },
- { "caretinsert", 0x2041 , 0 },
- { "hyphenbullet", 0x2043 , 0 },
- { "minussuperior", 0x207b , 0 },
- { "plusinferior", 0x208a , 0 },
- { "equalinferior", 0x208c , 0 },
- { "eurocurrency", 0x20a0 , 0 },
- { "coloncurrency", 0x20a1 , 0 },
- { "mill", 0x20a5 , 0 },
- { "naira", 0x20a6 , 0 },
- { "pesetas", 0x20a7 , 0 },
- { "rupee", 0x20a8 , 0 },
- { "newsheqel", 0x20aa , 0 },
- { "accountof", 0x2100 , 0 },
- { "addresssubject", 0x2101 , 0 },
- { "Cbb", 0x2102 , 0 },
- { "degreecentigrade", 0x2103 , 0 },
- { "CL", 0x2104 , 0 },
- { "cadauna", 0x2106 , 0 },
- { "Euler", 0x2107 , 0 },
- { "scruple", 0x2108 , 0 },
- { "degreefarenheit", 0x2109 , 0 },
- { "Hscript", 0x210b , 0 },
- { "Hblackletter", 0x210c , 0 },
- { "Hbb", 0x210d , 0 },
- { "planck", 0x210e , 0 },
- { "planckover2pi", 0x210f , 0 },
- { "Iscript", 0x2110 , 0 },
- { "Lscript", 0x2112 , 0 },
- { "lscript", 0x2113 , 0 },
- { "lbbar", 0x2114 , 0 },
- { "Nbb", 0x2115 , 0 },
- { "recordright", 0x2117 , 0 },
- { "Pbb", 0x2119 , 0 },
- { "Qbb", 0x211a , 0 },
- { "Rscript", 0x211b , 0 },
- { "Rfractur", 0x211c , 0 },
- { "Rbb", 0x211d , 0 },
- { "Rx", 0x211e , 0 },
- { "response", 0x211f , 0 },
- { "servicemark", 0x2120 , 0 },
- { "tel", 0x2121 , 0 },
- { "versicle", 0x2123 , 0 },
- { "Zbb", 0x2124 , 0 },
- { "ounce", 0x2125 , 0 },
- { "ohm", 0x2126 , 0 },
- { "mho", 0x2127 , 0 },
- { "Zblackletter", 0x2128 , 0 },
- { "iotaturn", 0x2129 , 0 },
- { "degreekelvin", 0x212a , 0 },
- { "Bscript", 0x212c , 0 },
- { "Cblackletter", 0x212d , 0 },
- { "escript", 0x212f , 0 },
- { "Escript", 0x2130 , 0 },
- { "Fscript", 0x2131 , 0 },
- { "Fturn", 0x2132 , 0 },
- { "Mscript", 0x2133 , 0 },
- { "u0scrip", 0x2134 , 0 },
- { "alephmath", 0x2135 , 0 },
- { "gimelmath", 0x2137 , 0 },
- { "dalethmath", 0x2138 , 0 },
- { "twothird", 0x2154 , 0 },
- { "onefifth", 0x2155 , 0 },
- { "twofifths", 0x2156 , 0 },
- { "threefifths", 0x2157 , 0 },
- { "fourfifths", 0x2158 , 0 },
- { "onesixth", 0x2159 , 0 },
- { "fivesixths", 0x215a , 0 },
- { "onenumerator", 0x215f , 0 },
- { "arrowlongboth", 0x2194 , 0 },
- { "arrowlongbothv", 0x2195 , 0 },
- { "arrownorthwest", 0x2196 , 0 },
- { "arrownortheast", 0x2197 , 0 },
- { "arrowsoutheast", 0x2198 , 0 },
- { "arrowsouthwest", 0x2199 , 0 },
- { "arrowleftnot", 0x219a , 0 },
- { "arrowrightnot", 0x219b , 0 },
- { "arrowwaveleft", 0x219c , 0 },
- { "arrowwaveright", 0x219d , 0 },
- { "dblarrowheadleft", 0x219e , 0 },
- { "dblarrowheadup", 0x219f , 0 },
- { "dblarrowheadright", 0x21a0 , 0 },
- { "dblarrowheaddown", 0x21a1 , 0 },
- { "arrowtailleft", 0x21a2 , 0 },
- { "arrowtailright", 0x21a3 , 0 },
- { "arrowbarleft", 0x21a4 , 0 },
- { "arrowbarup", 0x21a5 , 0 },
- { "arrowbarright", 0x21a6 , 0 },
- { "arrowbardown", 0x21a7 , 0 },
- { "arrowbothvbase", 0x21a8 , 0 },
- { "arrowhookleft", 0x21a9 , 0 },
- { "arrowhookright", 0x21aa , 0 },
- { "arrowloopleft", 0x21ab , 0 },
- { "arrowloopright", 0x21ac , 0 },
- { "arrowwaveboth", 0x21ad , 0 },
- { "arrowlongbothnot", 0x21ae , 0 },
- { "arrowzigzag", 0x21af , 0 },
- { "arrowrightdown", 0x21b4 , 0 },
- { "carriagerreturn", 0x21b5 , 0 },
- { "arrowsemanticlockw", 0x21b6 , 0 },
- { "arrowsemclockw", 0x21b7 , 0 },
- { "home", 0x21b8 , 0 },
- { "tableftright", 0x21b9 , 0 },
- { "arrowanticlockw", 0x21ba , 0 },
- { "arrowclockw", 0x21bb , 0 },
- { "arrowlefttophalf", 0x21bc , 0 },
- { "arrowleftbothalf", 0x21bd , 0 },
- { "harpoonupright", 0x21be , 0 },
- { "harpoonupleft", 0x21bf , 0 },
- { "arrowrighttophalf", 0x21c0 , 0 },
- { "arrowrightbothalf", 0x21c1 , 0 },
- { "harpoondownright", 0x21c2 , 0 },
- { "harpoondownleft", 0x21c3 , 0 },
- { "arrowparrrightleft", 0x21c4 , 0 },
- { "dblarrowupdown", 0x21c5 , 0 },
- { "arrowparrleftright", 0x21c6 , 0 },
- { "dblarrowup", 0x21c8 , 0 },
- { "dblarrowdown", 0x21ca , 0 },
- { "harpoonleftright", 0x21cb , 0 },
- { "harpoonrightleft", 0x21cc , 0 },
- { "arrowdblleftnot", 0x21cd , 0 },
- { "arrowdbllongbothnot", 0x21ce , 0 },
- { "arrowdblrightnot", 0x21cf , 0 },
- { "arrowdbllongboth", 0x21d4 , 0 },
- { "arrowdbllongbothv", 0x21d5 , 0 },
- { "arrowdblnw", 0x21d6 , 0 },
- { "arrowdblne", 0x21d7 , 0 },
- { "arrowdblse", 0x21d8 , 0 },
- { "arrowdblsw", 0x21d9 , 0 },
- { "arrowtripleleft", 0x21da , 0 },
- { "arrowtripleright", 0x21db , 0 },
- { "arrowsquiggleleft", 0x21dc , 0 },
- { "arrowsquiggleright", 0x21dd , 0 },
- { "arrowopenleft", 0x21e6 , 0 },
- { "arrowopenup", 0x21e7 , 0 },
- { "arrowopenright", 0x21e8 , 0 },
- { "arrowopendown", 0x21e9 , 0 },
- { "complement", 0x2201 , 0 },
- { "notexistential", 0x2204 , 0 },
- { "elementsmall", 0x220a , 0 },
- { "owner", 0x220b , 0 },
- { "notowner", 0x220c , 0 },
- { "ownersmall", 0x220d , 0 },
- { "eop", 0x220e , 0 },
- { "coproduct", 0x2210 , 0 },
- { "dotplus", 0x2214 , 0 },
- { "slashmath", 0x2215 , 0 },
- { "backslashmath", 0x2216 , 0 },
- { "ringoperator", 0x2218 , 0 },
- { "bulletmath", 0x2219 , 0 },
- { "cuberoot", 0x221b , 0 },
- { "fourthroot", 0x221c , 0 },
- { "measuredangle", 0x2221 , 0 },
- { "sphericalangle", 0x2222 , 0 },
- { "notbar", 0x2224 , 0 },
- { "parallelto", 0x2225 , 0 },
- { "notbardbl", 0x2226 , 0 },
- { "integraldbl", 0x222c , 0 },
- { "integraltrpl", 0x222d , 0 },
- { "contintegral", 0x222e , 0 },
- { "surfintegral", 0x222f , 0 },
- { "volintegral", 0x2230 , 0 },
- { "clwintegral", 0x2231 , 0 },
- { "clwcontintegral", 0x2232 , 0 },
- { "cclwcontintegral", 0x2233 , 0 },
- { "dotminus", 0x2238 , 0 },
- { "excess", 0x2239 , 0 },
- { "geomproportion", 0x223a , 0 },
- { "homothetic", 0x223b , 0 },
- { "revsimilar", 0x223d , 0 },
- { "lazysinv", 0x223e , 0 },
- { "sine", 0x223f , 0 },
- { "wreathproduct", 0x2240 , 0 },
- { "notsimilar", 0x2241 , 0 },
- { "minustilde", 0x2242 , 0 },
- { "asymptequal", 0x2243 , 0 },
- { "notasymptequal", 0x2244 , 0 },
- { "approxorequal", 0x2245 , 0 },
- { "approxnotequal", 0x2246 , 0 },
- { "notapproxequal", 0x2247 , 0 },
- { "almostequal", 0x2248 , 0 },
- { "notalmostequal", 0x2249 , 0 },
- { "almostorequal", 0x224a , 0 },
- { "tildetrpl", 0x224b , 0 },
- { "equivasymptotic", 0x224d , 0 },
- { "geomequivalent", 0x224e , 0 },
- { "difference", 0x224f , 0 },
- { "approachlimit", 0x2250 , 0 },
- { "geomequal", 0x2251 , 0 },
- { "imageorapproxequal", 0x2253 , 0 },
- { "colonequal", 0x2254 , 0 },
- { "equalcolon", 0x2255 , 0 },
- { "ringinequal", 0x2256 , 0 },
- { "ringequal", 0x2257 , 0 },
- { "corresponds", 0x2258 , 0 },
- { "estimates", 0x2259 , 0 },
- { "equiangular", 0x225a , 0 },
- { "starequal", 0x225b , 0 },
- { "deltaequal", 0x225c , 0 },
- { "definequal", 0x225d , 0 },
- { "measurequal", 0x225e , 0 },
- { "questionequal", 0x225f , 0 },
- { "notequivalence", 0x2262 , 0 },
- { "strictequivalence", 0x2263 , 0 },
- { "lessdblequal", 0x2266 , 0 },
- { "greaterdblequal", 0x2267 , 0 },
- { "lessnotdblequal", 0x2268 , 0 },
- { "greaternotdblequal", 0x2269 , 0 },
- { "lessmuch", 0x226a , 0 },
- { "greatermuch", 0x226b , 0 },
- { "between", 0x226c , 0 },
- { "notequivasymptotic", 0x226d , 0 },
- { "notlessequal", 0x2270 , 0 },
- { "notgreaterequal", 0x2271 , 0 },
- { "lessequivlnt", 0x2272 , 0 },
- { "greaterequivlnt", 0x2273 , 0 },
- { "notlessequivlnt", 0x2274 , 0 },
- { "notgreaterequivlnt", 0x2275 , 0 },
- { "notlessgreater", 0x2278 , 0 },
- { "notgreaterless", 0x2279 , 0 },
- { "follows", 0x227b , 0 },
- { "precedesequal", 0x227c , 0 },
- { "followsequal", 0x227d , 0 },
- { "precedequivlnt", 0x227e , 0 },
- { "followsequivlnt", 0x227f , 0 },
- { "notpreceeds", 0x2280 , 0 },
- { "notfollows", 0x2281 , 0 },
- { "notpropersubset", 0x2284 , 0 },
- { "notpropersuperset", 0x2285 , 0 },
- { "notreflexsubset", 0x2288 , 0 },
- { "notreflexsuperset", 0x2289 , 0 },
- { "multiset", 0x228c , 0 },
- { "multiplymultiset", 0x228d , 0 },
- { "unionmulti", 0x228e , 0 },
- { "squareimage", 0x228f , 0 },
- { "squareoriginal", 0x2290 , 0 },
- { "subsetsqequal", 0x2291 , 0 },
- { "supersetsqequal", 0x2292 , 0 },
- { "intersectionsq", 0x2293 , 0 },
- { "unionsq", 0x2294 , 0 },
- { "circleminus", 0x2296 , 0 },
- { "circledivide", 0x2298 , 0 },
- { "circledot", 0x2299 , 0 },
- { "circlering", 0x229a , 0 },
- { "circleasterisk", 0x229b , 0 },
- { "circleequal", 0x229c , 0 },
- { "circlevertbar", 0x229d , 0 },
- { "squareplus", 0x229e , 0 },
- { "squareminus", 0x229f , 0 },
- { "squaremultiply", 0x22a0 , 0 },
- { "squaredot", 0x22a1 , 0 },
- { "turnstileleft", 0x22a2 , 0 },
- { "turnstileright", 0x22a3 , 0 },
- { "latticetop", 0x22a4 , 0 },
- { "assertion", 0x22a6 , 0 },
- { "truestate", 0x22a7 , 0 },
- { "satisfy", 0x22a8 , 0 },
- { "force", 0x22a9 , 0 },
- { "tacktrpl", 0x22aa , 0 },
- { "forceextr", 0x22ab , 0 },
- { "notturnstileleft", 0x22ac , 0 },
- { "notsatisfy", 0x22ad , 0 },
- { "notforce", 0x22ae , 0 },
- { "notforceextr", 0x22af , 0 },
- { "lowerrank", 0x22b0 , 0 },
- { "higherrank", 0x22b1 , 0 },
- { "triangleright", 0x22b2 , 0 },
- { "triangleleft", 0x22b3 , 0 },
- { "triangleftequal", 0x22b4 , 0 },
- { "triangrightequal", 0x22b5 , 0 },
- { "original", 0x22b6 , 0 },
- { "image", 0x22b7 , 0 },
- { "multimap", 0x22b8 , 0 },
- { "hermitconjmatrix", 0x22b9 , 0 },
- { "intercal", 0x22ba , 0 },
- { "xor", 0x22bb , 0 },
- { "nand", 0x22bc , 0 },
- { "nor", 0x22bd , 0 },
- { "rightanglearc", 0x22be , 0 },
- { "narylogicaland", 0x22c0 , 0 },
- { "narylogicalor", 0x22c1 , 0 },
- { "naryintersection", 0x22c2 , 0 },
- { "naryunion", 0x22c3 , 0 },
- { "diamondmath", 0x22c4 , 0 },
- { "divideonmultiply", 0x22c7 , 0 },
- { "bowtie", 0x22c8 , 0 },
- { "multicloseleft", 0x22c9 , 0 },
- { "multicloseright", 0x22ca , 0 },
- { "multiopenleft", 0x22cb , 0 },
- { "multiopenright", 0x22cc , 0 },
- { "revasymptequal", 0x22cd , 0 },
- { "curlor", 0x22ce , 0 },
- { "curland", 0x22cf , 0 },
- { "subsetdbl", 0x22d0 , 0 },
- { "supersetdbl", 0x22d1 , 0 },
- { "uniondbl", 0x22d2 , 0 },
- { "intersectiondbl", 0x22d3 , 0 },
- { "fork", 0x22d4 , 0 },
- { "equalparallel", 0x22d5 , 0 },
- { "lessdot", 0x22d6 , 0 },
- { "greaterdot", 0x22d7 , 0 },
- { "verymuchless", 0x22d8 , 0 },
- { "verymuchgreater", 0x22d9 , 0 },
- { "lessequalgreater", 0x22da , 0 },
- { "greaterequalless", 0x22db , 0 },
- { "equalless", 0x22dc , 0 },
- { "equalgreater", 0x22dd , 0 },
- { "equalprecedes", 0x22de , 0 },
- { "equalfollows", 0x22df , 0 },
- { "preceedsnotequal", 0x22e0 , 0 },
- { "followsnotequal", 0x22e1 , 0 },
- { "notsubsetsqequal", 0x22e2 , 0 },
- { "notsupersetsqequal", 0x22e3 , 0 },
- { "sqimageornotequal", 0x22e4 , 0 },
- { "sqoriginornotequal", 0x22e5 , 0 },
- { "lessnotequivlnt", 0x22e6 , 0 },
- { "greaternotequivlnt", 0x22e7 , 0 },
- { "preceedsnotsimilar", 0x22e8 , 0 },
- { "followsnotequivlnt", 0x22e9 , 0 },
- { "nottriangleleft", 0x22ea , 0 },
- { "nottriangleright", 0x22eb , 0 },
- { "nottriangleleftequal", 0x22ec , 0 },
- { "nottrianglerightequal", 0x22ed , 0 },
- { "vertellipsis", 0x22ee , 0 },
- { "midhorizellipsis", 0x22ef , 0 },
- { "upslopeellipsis", 0x22f0 , 0 },
- { "downslopeellipsis", 0x22f1 , 0 },
- { "perspcorrespond", 0x2306 , 0 },
- { "ceilingleft", 0x2308 , 0 },
- { "ceilingright", 0x2309 , 0 },
- { "floorleft", 0x230a , 0 },
- { "floorright", 0x230b , 0 },
- { "slurabove", 0x2322 , 0 },
- { "slurbelow", 0x2323 , 0 },
- { "null", 0x2400 , 0 },
- { "startofhead", 0x2401 , 0 },
- { "starttext", 0x2402 , 0 },
- { "endtext", 0x2403 , 0 },
- { "endtrans", 0x2404 , 0 },
- { "enquiry", 0x2405 , 0 },
- { "acknowledge", 0x2406 , 0 },
- { "bell", 0x2407 , 0 },
- { "backspace", 0x2408 , 0 },
- { "horiztab", 0x2409 , 0 },
- { "linefeed", 0x240a , 0 },
- { "verttab", 0x240b , 0 },
- { "formfeed", 0x240c , 0 },
- { "shiftout", 0x240e , 0 },
- { "shiftin", 0x240f , 0 },
- { "datalinkescape", 0x2410 , 0 },
- { "devcon1", 0x2411 , 0 },
- { "devcon2", 0x2412 , 0 },
- { "devcon3", 0x2413 , 0 },
- { "devcon4", 0x2414 , 0 },
- { "negacknowledge", 0x2415 , 0 },
- { "synch", 0x2416 , 0 },
- { "endtransblock", 0x2417 , 0 },
- { "cancel", 0x2418 , 0 },
- { "endmedium", 0x2419 , 0 },
- { "substitute", 0x241a , 0 },
- { "escape", 0x241b , 0 },
- { "fileseparator", 0x241c , 0 },
- { "groupseparator", 0x241d , 0 },
- { "recordseparator", 0x241e , 0 },
- { "unitseparator", 0x241f , 0 },
- { "spaceliteral", 0x2420 , 0 },
- { "delete", 0x2421 , 0 },
- { "blankb", 0x2422 , 0 },
- { "spaceopenbox", 0x2423 , 0 },
- { "newline", 0x2424 , 0 },
- { "lthorizform", 0x2500 , 0 },
- { "hvhorizform", 0x2501 , 0 },
- { "ltvertform", 0x2502 , 0 },
- { "hvvertform", 0x2503 , 0 },
- { "ltdashtriphorizform", 0x2504 , 0 },
- { "hvdashtriphorizform", 0x2505 , 0 },
- { "ltdashtripvertform", 0x2506 , 0 },
- { "hvdashtripvertform", 0x2507 , 0 },
- { "ltdashquadhorizform", 0x2508 , 0 },
- { "hvdashquadhorizform", 0x2509 , 0 },
- { "ltdashquadvertform", 0x250a , 0 },
- { "hvdashquadvertform", 0x250b , 0 },
- { "ltdnrtform", 0x250c , 0 },
- { "dnltrthvform", 0x250d , 0 },
- { "dnhvrtltform", 0x250e , 0 },
- { "hvdnrtform", 0x250f , 0 },
- { "ltdnleftform", 0x2510 , 0 },
- { "dnltlefthvform", 0x2511 , 0 },
- { "dnhvleftltform", 0x2512 , 0 },
- { "hvdnleftform", 0x2513 , 0 },
- { "ltuprtform", 0x2514 , 0 },
- { "upltrthvform", 0x2515 , 0 },
- { "uphvrtltform", 0x2516 , 0 },
- { "hvuprtform", 0x2517 , 0 },
- { "ltupleftform", 0x2518 , 0 },
- { "upltlefthvform", 0x2519 , 0 },
- { "uphvleftltform", 0x251a , 0 },
- { "hvupleftform", 0x251b , 0 },
- { "ltvertrightform", 0x251c , 0 },
- { "vertltrthvform", 0x251d , 0 },
- { "uphvrtdnltform", 0x251e , 0 },
- { "dnhvrtupltform", 0x251f , 0 },
- { "verthvrtltform", 0x2520 , 0 },
- { "dnltrtuphvform", 0x2521 , 0 },
- { "upltrtdnhvform", 0x2522 , 0 },
- { "hvvertrtform", 0x2523 , 0 },
- { "ltvertleftform", 0x2524 , 0 },
- { "vtltlefthvform", 0x2525 , 0 },
- { "uphvleftdnltform", 0x2526 , 0 },
- { "dnhvleftupltform", 0x2527 , 0 },
- { "verthvleftltform", 0x2528 , 0 },
- { "dnltleftuphvform", 0x2529 , 0 },
- { "upltleftdnhvform", 0x252a , 0 },
- { "hvvertleftform", 0x252b , 0 },
- { "ltdnhorizform", 0x252c , 0 },
- { "lefthvrtdnltform", 0x252d , 0 },
- { "rthvleftdnltform", 0x252e , 0 },
- { "dnlthorizhvform", 0x252f , 0 },
- { "dnhvhorizltform", 0x2530 , 0 },
- { "rtltrtdnhvform", 0x2531 , 0 },
- { "leftltrtdnhvform", 0x2532 , 0 },
- { "hvdnhorizform", 0x2533 , 0 },
- { "ltuphorizform", 0x2534 , 0 },
- { "lefthvrtupltform", 0x2535 , 0 },
- { "rthvleftupltform", 0x2536 , 0 },
- { "uplthorizhvform", 0x2537 , 0 },
- { "uphvhorizltform", 0x2538 , 0 },
- { "rtltleftuphvform", 0x2539 , 0 },
- { "leftltrtuphvform", 0x253a , 0 },
- { "hvuphorizform", 0x253b , 0 },
- { "ltverthorizform", 0x253c , 0 },
- { "lefthvrtvertltform", 0x253d , 0 },
- { "rthvleftvertltform", 0x253e , 0 },
- { "vertlthorizhvform", 0x253f , 0 },
- { "uphvdnhorizltform", 0x2540 , 0 },
- { "dnhvuphorizltform", 0x2541 , 0 },
- { "verthvhorizltform", 0x2542 , 0 },
- { "leftuphvrtdnltform", 0x2543 , 0 },
- { "rtuphvleftdnltform", 0x2544 , 0 },
- { "leftdnhvrtupltform", 0x2545 , 0 },
- { "rtdnhvleftupltform", 0x2546 , 0 },
- { "dnltuphorizhvform", 0x2547 , 0 },
- { "upltdnhorizhvform", 0x2548 , 0 },
- { "rtltleftverthvform", 0x2549 , 0 },
- { "leftltrtverthvform", 0x254a , 0 },
- { "hvverthorizform", 0x254b , 0 },
- { "ltdashdblhorizform", 0x254c , 0 },
- { "hvdashdblhorizform", 0x254d , 0 },
- { "ltdashdblvertform", 0x254e , 0 },
- { "hvdashdblvertform", 0x254f , 0 },
- { "horizdblbar", 0x2550 , 0 },
- { "vertdblbar", 0x2551 , 0 },
- { "dnrtdblform", 0x2552 , 0 },
- { "dndblrtform", 0x2553 , 0 },
- { "dbldnrtform", 0x2554 , 0 },
- { "dnleftdblform", 0x2555 , 0 },
- { "dndblleftform", 0x2556 , 0 },
- { "dbldnleftform", 0x2557 , 0 },
- { "uprtdblform", 0x2558 , 0 },
- { "updblrtform", 0x2559 , 0 },
- { "dbluprtform", 0x255a , 0 },
- { "upleftdblform", 0x255b , 0 },
- { "updblleftform", 0x255c , 0 },
- { "dblupleftform", 0x255d , 0 },
- { "vertrtdblform", 0x255e , 0 },
- { "vertdblrtform", 0x255f , 0 },
- { "dblvertrtform", 0x2560 , 0 },
- { "vertleftdblform", 0x2561 , 0 },
- { "vertdblleftform", 0x2562 , 0 },
- { "dblvertleftform", 0x2563 , 0 },
- { "dnhorizdblform", 0x2564 , 0 },
- { "dndblhorizform", 0x2565 , 0 },
- { "dbldnhorizform", 0x2566 , 0 },
- { "uphorizdblform", 0x2567 , 0 },
- { "updblhorizform", 0x2568 , 0 },
- { "dbluphorizform", 0x2569 , 0 },
- { "verthorizdblform", 0x256a , 0 },
- { "vertdblhorizform", 0x256b , 0 },
- { "dblverthorizform", 0x256c , 0 },
- { "ltarcdnrtform", 0x256d , 0 },
- { "ltarcdnleftform", 0x256e , 0 },
- { "ltarcupleftform", 0x256f , 0 },
- { "ltarcuprtform", 0x2570 , 0 },
- { "forwarddiagonal", 0x2571 , 0 },
- { "backwarddiagonal", 0x2572 , 0 },
- { "ltdiagonalcross", 0x2573 , 0 },
- { "dneighthblock", 0x2581 , 0 },
- { "dnquarterblock", 0x2582 , 0 },
- { "dnthreeeighthblock", 0x2583 , 0 },
- { "dnfiveeighthblock", 0x2585 , 0 },
- { "dnthreequarterblock", 0x2586 , 0 },
- { "dnseveneighthblock", 0x2587 , 0 },
- { "lfseveneighthblock", 0x2589 , 0 },
- { "lfthreequarterblock", 0x258a , 0 },
- { "lffiveeighthblock", 0x258b , 0 },
- { "lfthreeeighthblock", 0x258d , 0 },
- { "lfquarterblock", 0x258e , 0 },
- { "lfeighthblock", 0x258f , 0 },
- { "upeighthblock", 0x2594 , 0 },
- { "rteighthblock", 0x2595 , 0 },
- { "box", 0x25a1 , 0 },
- { "boxrounded", 0x25a2 , 0 },
- { "boxnested", 0x25a3 , 0 },
- { "boxhorizhatch", 0x25a4 , 0 },
- { "boxverthatch", 0x25a5 , 0 },
- { "boxcrosshatch", 0x25a6 , 0 },
- { "boxleftdiaghatch", 0x25a7 , 0 },
- { "boxrtdiaghatch", 0x25a8 , 0 },
- { "boxcrossdiaghatch", 0x25a9 , 0 },
- { "smallboxfilled", 0x25aa , 0 },
- { "smallbox", 0x25ab , 0 },
- { "rectangle", 0x25ad , 0 },
- { "filledvertrect", 0x25ae , 0 },
- { "vertrectangle", 0x25af , 0 },
- { "filledparallelogram", 0x25b0 , 0 },
- { "parallelogram", 0x25b1 , 0 },
- { "triangle", 0x25b3 , 0 },
- { "smalltrianglesld", 0x25b4 , 0 },
- { "smalltriangle", 0x25b5 , 0 },
- { "trianglerightsld1", 0x25b6 , 0 },
- { "triangleright1", 0x25b7 , 0 },
- { "smalltrianglerightsld", 0x25b8 , 0 },
- { "smalltriangleright", 0x25b9 , 0 },
- { "triagrtopen", 0x25bb , 0 },
- { "triangleinv", 0x25bd , 0 },
- { "smalltriangleinvsld", 0x25be , 0 },
- { "smalltriangleinv", 0x25bf , 0 },
- { "triangleleftsld1", 0x25c0 , 0 },
- { "triangleleft1", 0x25c1 , 0 },
- { "smalltriangleleftsld", 0x25c2 , 0 },
- { "smalltriangleleft", 0x25c3 , 0 },
- { "triaglfopen", 0x25c5 , 0 },
- { "diamondrhombsolid", 0x25c6 , 0 },
- { "diamondrhomb", 0x25c7 , 0 },
- { "diamondrhombnested", 0x25c8 , 0 },
- { "circledash", 0x25cc , 0 },
- { "circleverthatch", 0x25cd , 0 },
- { "circlesolid", 0x25cf , 0 },
- { "circleleftsld", 0x25d0 , 0 },
- { "circlerightsld", 0x25d1 , 0 },
- { "circlebottomsld", 0x25d2 , 0 },
- { "circletopsld", 0x25d3 , 0 },
- { "circlenesld", 0x25d4 , 0 },
- { "circlenwopen", 0x25d5 , 0 },
- { "semicircleleftsld", 0x25d6 , 0 },
- { "semicirclelertsld", 0x25d7 , 0 },
- { "invsemicircleup", 0x25da , 0 },
- { "invsemicircledn", 0x25db , 0 },
- { "nwquadarc", 0x25dc , 0 },
- { "nequadarc", 0x25dd , 0 },
- { "sequadarc", 0x25de , 0 },
- { "swquadarc", 0x25df , 0 },
- { "toparc", 0x25e0 , 0 },
- { "bottomarc", 0x25e1 , 0 },
- { "trianglesesld", 0x25e2 , 0 },
- { "triangleswsld", 0x25e3 , 0 },
- { "tranglenwsld", 0x25e4 , 0 },
- { "trianglenesld", 0x25e5 , 0 },
- { "squareleftsld", 0x25e7 , 0 },
- { "squarerightsld", 0x25e8 , 0 },
- { "squarenwsld", 0x25e9 , 0 },
- { "squaresesld", 0x25ea , 0 },
- { "squarevertbisect", 0x25eb , 0 },
- { "triangledot", 0x25ec , 0 },
- { "triangleleftsld", 0x25ed , 0 },
- { "trianglerightsld", 0x25ee , 0 },
- { "heartopen", 0x2661 , 0 },
- { "diamondopen", 0x2662 , 0 },
- { "spadeopen", 0x2664 , 0 },
- { "Omegaiotasubleniscircumflex", 0x1fae , 0 },
- { "Omegaleniscircumflex", 0x1f6e , 0 },
- { "Upsilonaspercircumflex", 0x1f5f , 0 },
- { "dieresiscircumflex", 0x1fc1 , 0 },
- { "leniscircumflex", 0x1fcf , 0 },
- { "aspercircumflex", 0x1fdf , 0 },
- { "alphaleniscircumflex", 0x1f06 , 0 },
- { "alphaaspercircumflex", 0x1f07 , 0 },
- { "etaleniscircumflex", 0x1f26 , 0 },
- { "etaaspercircumflex", 0x1f27 , 0 },
- { "iotaleniscircumflex", 0x1f36 , 0 },
- { "iotaaspercircumflex", 0x1f37 , 0 },
- { "upsilonleniscircumflex", 0x1f56 , 0 },
- { "upsilonaspercircumflex", 0x1f57 , 0 },
- { "omegaleniscircumflex", 0x1f66 , 0 },
- { "omegaaspercircumflex", 0x1f67 , 0 },
- { "alphaiotasubleniscircumflex", 0x1f86 , 0 },
- { "alphaiotasubaspercircumflex", 0x1f87 , 0 },
- { "etaiotasubleniscircumflex", 0x1f96 , 0 },
- { "etaiotasubaspercircumflex", 0x1f97 , 0 },
- { "omegaiotasubleniscircumflex", 0x1fa6 , 0 },
- { "omegaiotasubaspercircumflex", 0x1fa7 , 0 },
- { "alphacircumflex", 0x1fb6 , 0 },
- { "alphaiotasubcircumflex", 0x1fb7 , 0 },
- { "etacircumflex", 0x1fc6 , 0 },
- { "etaiotasubcircumflex", 0x1fc7 , 0 },
- { "iotacircumflex", 0x1fd6 , 0 },
- { "iotadieresiscircumflex", 0x1fd7 , 0 },
- { "upsiloncircumflex", 0x1fe6 , 0 },
- { "omegacircumflex", 0x1ff6 , 0 },
- { "omegaiotasubcircumflex", 0x1ff7 , 0 },
- { "upsilondieresiscircumflex", 0x1fe7 , 0 },
- { "dialytika", 0x0308 , 0 },
- { "koronis", 0x1fbd , 0 },
- { "prosgegrammeni", 0x1fbe , 0 },
- { "psili", 0x1fbf , 0 },
- { "perispomeni", 0x1fc0 , 0 },
- { "varia", 0x1fef , 0 },
- { "oxia", 0x1ffd , 0 },
- { "dasia", 0x1ffe , 0 },
- { "Alphasmall", 0xf500 , 0 },
- { "Betasmall", 0xf501 , 0 },
- { "Gammasmall", 0xf502 , 0 },
- { "Deltasmall", 0xf503 , 0 },
- { "Epsilonsmall", 0xf504 , 0 },
- { "Zetasmall", 0xf505 , 0 },
- { "Etasmall", 0xf506 , 0 },
- { "Thetasmall", 0xf507 , 0 },
- { "Iotasmall", 0xf508 , 0 },
- { "Kappasmall", 0xf509 , 0 },
- { "Lambdasmall", 0xf50a , 0 },
- { "Musmall", 0xf50b , 0 },
- { "Nusmall", 0xf50c , 0 },
- { "Xismall", 0xf50d , 0 },
- { "Omicronsmall", 0xf50e , 0 },
- { "Pismall", 0xf50f , 0 },
- { "Rhosmall", 0xf510 , 0 },
- { "Sigmasmall", 0xf512 , 0 },
- { "Tausmall", 0xf513 , 0 },
- { "Upsilonsmall", 0xf514 , 0 },
- { "Phismall", 0xf515 , 0 },
- { "Chismall", 0xf516 , 0 },
- { "Psismall", 0xf517 , 0 },
- { "Omegasmall", 0xf518 , 0 },
- { "Iotadieresissmall", 0xf519 , 0 },
- { "Upsilondieresissmall", 0xf51a , 0 },
- { "uni2A0B.lgdisplay", 0xea57 , 0 },
- { "uni2A0B.uplgdisplay", 0xea57 , 0 },
- { "uni2A15.lgdisplay", 0xe376 , 0 },
- { "uni2A15.uplgdisplay", 0xe376 , 0 },
- { "uni2A16.lgdisplay", 0xe377 , 0 },
- { "uni2A16.uplgdisplay", 0xe377 , 0 },
- { "uni2A10.lgdisplay", 0xe395 , 0 },
- { "uni2A10.uplgdisplay", 0xe395 , 0 },
- { "uni2A12.lgdisplay", 0xe397 , 0 },
- { "uni2A12.uplgdisplay", 0xe397 , 0 },
- { "uni2A13.lgdisplay", 0xe398 , 0 },
- { "uni2A13.uplgdisplay", 0xe398 , 0 },
- { "uni2A14.lgdisplay", 0xe399 , 0 },
- { "uni2A14.uplgdisplay", 0xe399 , 0 },
- { "uni2A17.lgdisplay", 0xe39a , 0 },
- { "uni2A17.uplgdisplay", 0xe39a , 0 },
- { "uni2A11.uplgdisplay", 0xe39b , 0 },
- { "uni2A11.lgdisplay", 0xe39b , 0 },
- { "uni2A0F.lgdisplay", 0xe3d3 , 0 },
- { "uni2A0F.uplgdisplay", 0xe3d3 , 0 },
-/* From Richard Kinch's TeX list of glyph aliases */
- { "fscript", 0x192 , 0 },
- { "fraction1", 0x2215 , 0 },
- { "negationslash", 0x2215 , 0 },
- { "circleR", 0xae , 0 },
- { "circlecopyrt", 0xa9 , 0 },
- { "smile", 0x263a , 0 },
- { "Ifractur", 0x2111 , 0 },
- { "Rfractur", 0x211C , 0 },
- { "Omegainv", 0x2127 , 0 },
- { "mho", 0x2127 , 0 },
- { "alephmath", 0x2135 , 0 },
- { "beth", 0x2136 , 0 },
- { "bethmath", 0x2136 , 0 },
- { "gimelmath", 0x2137 , 0 },
- { "daleth", 0x2138 , 0 },
- { "daletmath", 0x2138 , 0 },
- { "arrowbothv", 0x2195 , 0 },
- { "prime1", 0x2032 , 0 },
- { "primerev1", 0x2035 , 0 },
- { "primereverse", 0x2035 , 0 },
- { "followsequal1", 0x227d , 0 },
- { "similarequal", 0x2243 , 0 },
- { "square", 0x25a1 , 0 },
- { "squaresolid", 0x25a0 , 0 },
- { "squaresmallsolid", 0x25aa , 0 },
- { "diamondsolid", 0x25c6 , 0 },
- { "clockwise", 0x21bb , 0 },
- { "anticlockwise", 0x21ba , 0 },
- { "forces", 0x22a9 , 0 },
- { "forcesbar", 0x22aa , 0 },
- { "satisfies", 0x22a8 , 0 },
- { "dblarrowdwn", 0x21ca , 0 },
- { "shiftleft", 0x2196 , 0 },
- { "shiftright", 0x2197 , 0 },
- { "squiggleright", 0x21dd , 0 },
- { "squiggleleft", 0x21dc , 0 },
- { "squiggleleftright", 0x21ad , 0 },
- { "curlyleft", 0x21ab , 0 },
- { "curlyright", 0x21ac , 0 },
- { "followsorequal", 0x227d , 0 },
- { "equalsdots", 0x2251 , 0 },
- { "defines", 0x225c , 0 },
- { "ng", 0x014b , 0 },
- { "Ng", 0x014a , 0 },
- { "visiblespace", 0x2420 , 0 },
- { "dslash", 0x0111 , 0 },
- { "tie1", 0x2040 , 0 },
- { "arrowdblbothv", 0x21d5 , 0 },
- { "precedesequal1", 0x227c , 0 },
- { "greaterorsimilar", 0x2273 , 0 },
- { "precedesorequal", 0x227e , 0 },
- { "lessorsimilar", 0x2272 , 0 },
- { "equalorgreater", 0x22dd , 0 },
- { "lessorequalslant", 0x2264 , 0 },
- { "equaldotrightleft", 0x2253 , 0 },
- { "equaldotleftright", 0x2252 , 0 },
- { "followsorcurly", 0x227d , 0 },
- { "greaterorequalslant", 0x2265 , 0 },
- { "trianglerightequal", 0x22b5 , 0 },
- { "triangleleftequal", 0x22b4 , 0 },
- { "triangledownsld", 0x25bc , 0 },
- { "arrowaxisright", 0x2192 , 0 },
- { "arrowaxisleft", 0x2190 , 0 },
- { "trianglesolid", 0x25b2 , 0 },
- { "greaterlessequal", 0x22db , 0 },
- { "orunderscore", 0x22bb , 0 },
- { "frown", 0x2322 , 0 },
- { "uprise", 0x22cf , 0 },
- { "downfall", 0x22ce , 0 },
- { "subsetdblequal", 0x2286 , 0 },
- { "supersetdblequal", 0x2287 , 0 },
- { "Finv", 0x2132 , 0 },
- { "notarrowboth", 0x21ae , 0 },
- { "archleftdown", 0x21b6 , 0 },
- { "archrightdown", 0x21b7 , 0 },
- { "notdblarrowleft", 0x21cd , 0 },
- { "notdblarrowboth", 0x21ce , 0 },
- { "notdblarrowright", 0x21cf , 0 },
- { "epsiloninv", 0x220a , 0 },
- { "equalorsimilar", 0x2242 , 0 },
- { "notprecedes", 0x2280 , 0 },
- { "notsubseteql", 0x2288 , 0 },
- { "notsuperseteql", 0x2289 , 0 },
- { "subsetnoteql", 0x228a , 0 },
- { "supersetnoteql", 0x228b , 0 },
- { "notturnstile", 0x22ac , 0 },
- { "notforcesextra", 0x22af , 0 },
- { "dividemultiply", 0x22c7 , 0 },
- { "notprecedesoreql", 0x22e0 , 0 },
- { "notfollowsoreql", 0x22e1 , 0 },
- { "lessornotsimilar", 0x22e6 , 0 },
- { "greaterornotsimilar", 0x22e7 , 0 },
- { "precedeornoteqvlnt", 0x22e8 , 0 },
- { "followornoteqvlnt", 0x22e9 , 0 },
- { "nottriangeqlleft", 0x22ec , 0 },
- { "nottriangeqlright", 0x22ed , 0 },
- { "angbracketleft", 0x3008 , 0 },
- { "angbracketright", 0x3009 , 0 },
- { "check", 0x2713 , 0 },
- { "circleS", 0x24c8 , 0 },
- { "rightanglenw", 0x250c , 0 },
- { "rightanglene", 0x2510 , 0 },
- { "rightanglesw", 0x2514 , 0 },
- { "rightanglese", 0x2518 , 0 },
- { "Yen", 0x00a5 , 0 },
- { "permill", 0x2030 , 0 },
- { "recipe", 0x211e , 0 },
- { "pertenmill", 0x2031 , 0 },
- { "lnot", 0x00ac , 0 },
- { "circleP", 0x2117 , 0 },
- { "surd", 0x221a , 0 },
- { "asciigrave", 0x60 , 0 },
- { "asciigrave", 0x60 , 0 },
- { "asciiacute", 0xb4 , 0 },
- { "asciidieresis", 0xa8 , 0 },
- { "pilcrow", 0xb6 , 0 },
-/* Useful names to use to find glyphs */
- { "circumflexcomb", 0x302 , 0 },
- { "macroncomb", 0x304 , 0 },
- { "brevecomb", 0x306 , 0 },
- { "diaeresiscomb", 0x308 , 0 },
- { "caroncomb", 0x30c , 0 },
- { "vrachycomb", 0x306 , 0 },
- { "psilicomb", 0x313 , 0 },
- { "dasiacomb", 0x314 , 0 },
- { "psilivaria", 0x1fcd , 0 },
- { "psilioxia", 0x1fce , 0 },
- { "psiliperispomeni", 0x1fcf , 0 },
- { "dasiavaria", 0x1fdd , 0 },
- { "dasiaoxia", 0x1fde , 0 },
- { "dasiaperispomeni", 0x1fdf , 0 },
- { "dialytikavaria", 0x1fed , 0 },
- { "dialytikaoxia", 0x1fee , 0 },
- { "dialytikaperispomeni", 0x1fc1 , 0 },
-/* Adobe spells diaeresis the American way, as dieresis */
- { "diaeresis", 0xa8 , 0 },
- { "Adiaeresis", 0xC4 , 0 },
- { "Ediaeresis", 0xCB , 0 },
- { "Idiaeresis", 0xCF , 0 },
- { "Odiaeresis", 0xD6 , 0 },
- { "Udiaeresis", 0xDC , 0 },
- { "adiaeresis", 0xE4 , 0 },
- { "ediaeresis", 0xEB , 0 },
- { "idiaeresis", 0xEF , 0 },
- { "odiaeresis", 0xF6 , 0 },
- { "udiaeresis", 0xFC , 0 },
- { "Ydiaeresis", 0x178 , 0 },
- { "diaeresistonos", 0x385 , 0 },
- { "iotadiaeresistonos", 0x390 , 0 },
- { "Iotadiaeresis", 0x3AA , 0 },
- { "Upsilondiaeresis", 0x3AB , 0 },
- { "upsilondiaeresistonos", 0x3B0 , 0 },
- { "iotadiaeresis", 0x3CA , 0 },
- { "upsilondiaeresis", 0x3CB , 0 },
- { "Wdiaeresis", 0x1e84 , 0 },
- { "wdiaeresis", 0x1e85 , 0 },
- { "ETH", 0xd0 , 0 },
- { "THORN", 0xde , 0 },
- { "ssharp", 0xdf , 0 },
- { "Ooblique", 0xd8 , 0 },
- { "notsign", 0xac , 0 },
-/* Sun has used "masculine" for ordmasculine */
- { NULL, 0, 0 },
-};
diff --git a/Build/source/texk/web2c/luatexdir/luafontloader/fontforge/fontforge/noprefs.c b/Build/source/texk/web2c/luatexdir/luafontloader/fontforge/fontforge/noprefs.c
deleted file mode 100644
index 7fb9545d923..00000000000
--- a/Build/source/texk/web2c/luatexdir/luafontloader/fontforge/fontforge/noprefs.c
+++ /dev/null
@@ -1,452 +0,0 @@
-/* Copyright (C) 2000-2008 by George Williams */
-/*
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are met:
-
- * Redistributions of source code must retain the above copyright notice, this
- * list of conditions and the following disclaimer.
-
- * Redistributions in binary form must reproduce the above copyright notice,
- * this list of conditions and the following disclaimer in the documentation
- * and/or other materials provided with the distribution.
-
- * The name of the author may not be used to endorse or promote products
- * derived from this software without specific prior written permission.
-
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
- * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
- * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
- * EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
- * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
- * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
- * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
- * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-#include "pfaedit.h"
-#include "plugins.h"
-#include <charset.h>
-#include <gfile.h>
-#include <ustring.h>
-
-#include <sys/types.h>
-#include <dirent.h>
-#include <locale.h>
-#include <time.h>
-#include <sys/time.h>
-#include <stdlib.h>
-
-#include "ttf.h"
-
-#if HAVE_LANGINFO_H
-# include <langinfo.h>
-#endif
-
-static char *othersubrsfile = NULL;
-
-extern int adjustwidth;
-extern int adjustlbearing;
-extern Encoding *default_encoding;
-extern int autohint_before_rasterize;
-extern int autohint_before_generate;
-extern int accent_offset;
-extern int GraveAcuteCenterBottom;
-extern int PreferSpacingAccents;
-extern int CharCenterHighest;
-extern int recognizePUA;
-extern int snaptoint;
-extern float joinsnap;
-extern char *BDFFoundry;
-extern char *TTFFoundry;
-extern char *xuid;
-extern char *SaveTablesPref;
-extern int maxundoes; /* in cvundoes */
-extern int prefer_cjk_encodings; /* in parsettf */
-extern int onlycopydisplayed, copymetadata, copyttfinstr;
-extern int oldformatstate; /* in savefontdlg.c */
-extern int oldbitmapstate; /* in savefontdlg.c */
-extern int old_ttf_flags; /* in savefontdlg.c */
-extern int old_ps_flags; /* in savefontdlg.c */
-extern int old_otf_flags; /* in savefontdlg.c */
-extern int preferpotrace; /* in autotrace.c */
-extern int autotrace_ask; /* in autotrace.c */
-extern int mf_ask; /* in autotrace.c */
-extern int mf_clearbackgrounds; /* in autotrace.c */
-extern int mf_showerrors; /* in autotrace.c */
-extern char *mf_args; /* in autotrace.c */
-extern int coverageformatsallowed; /* in tottfgpos.c */
-extern int hint_diagonal_ends; /* in stemdb.c */
-extern int hint_diagonal_intersections; /* in stemdb.c */
-extern int hint_bounding_boxes; /* in stemdb.c */
-extern int detect_diagonal_stems; /* in stemdb.c */
-extern int new_em_size; /* in splineutil2.c */
-extern int new_fonts_are_order2; /* in splineutil2.c */
-extern int loaded_fonts_same_as_new; /* in splineutil2.c */
-extern int use_second_indic_scripts; /* in tottfgpos.c */
-extern int allow_utf8_glyphnames; /* in charinfo.c */
-extern int ask_user_for_cmap; /* in parsettf.c */
-extern NameList *force_names_when_opening;
-extern NameList *force_names_when_saving;
-extern NameList *namelist_for_new_fonts;
-extern int default_fv_row_count; /* in splineutil2.c */
-extern int default_fv_col_count; /* in splineutil2.c */
-extern int use_freetype_to_rasterize_fv; /* in bitmapchar.c */
-
-/* UI preferences which we don't use, but will preserve to so we can read/write */
-/* UI preference files without loss of data */
-static char *xdefs_filename;
-static char *helpdir=NULL; /* in uiutil.c */
-static int splash=1;
-static int cv_auto_goto=1;
-static int OpenCharsInNewWindow=1;
-static float arrowAmount=1;
-static float arrowAccelFactor=10;
-static float snapdistance=3.5;
-static int stop_at_join=0;
-static int updateflex=0; /* in charview.c */
-static int ask_user_for_resolution=1;
-static int default_fv_showhmetrics=0; /* in fontview */
-static int default_fv_showvmetrics=0; /* in fontview */
-static int default_fv_glyphlabel=0; /* in fontview */
-static int save_to_dir=0; /* in fontview, use sfdir rather than sfd */
-static int palettes_docked=1; /* in cvpalettes */
-static int cvvisible[2]={1,1}, bvvisible[3]={1,1,1}; /* in cvpalettes.c */
-static int infowindowdistance=10; /* in cvruler.c */
-static int loacal_markextrema, loacal_markpoi, loacal_showrulers,
- loacal_showcpinfo, loacal_showsidebearings, loacal_showpoints,
- loacal_showfilled, loacal_showtabs, loacal_showrefnames;
-static int oldsystem=100;
-static char *oflib_username;
-static char *oflib_password;
-static int rectelipse=0, polystar=0, regular_star=0; /* from cvpalettes.c */
-static int center_out[2]={0,0}; /* from cvpalettes.c */
-static float rr_radius=0; /* from cvpalettes.c */
-static int ps_pointcnt=5; /* from cvpalettes.c */
-static float star_percent=100; /* from cvpalettes.c */
-static int debug_wins=0; /* in cvdebug.c */
-static int gridfit_dpi=100, gridfit_depth=1; /* in cvgridfit.c */
-static float gridfit_pointsizex=12; /* in cvgridfit.c */
-static float gridfit_pointsizey=12; /* in cvgridfit.c */
-static int gridfit_x_sameas_y=true; /* in cvgridfit.c */
-static int default_font_filter_index=0;
-static int ItalicConstrained = true;
-extern int clear_tt_instructions_when_needed; /* cvundoes.c */
-static int default_cv_width; /* in charview.c */
-static int default_cv_height; /* in charview.c */
-static int mv_width; /* in metricsview.c */
-static int mv_height; /* in metricsview.c */
-static int bv_width; /* in bitmapview.c */
-static int bv_height; /* in bitmapview.c */
-static int mvshowgrid; /* in metricsview.c */
-static int old_validate = true;
-static int old_fontlog = false;
-static int home_char = 'A';
-static int compact_font_on_open=0;
-static int oflib_automagic_preview; /* from oflib.c */
-static int aa_pixelsize; /* from anchorsaway.c */
-
-static int gfc_showhidden, gfc_dirplace;
-static char *gfc_bookmarks=NULL;
-static char *pixmapdir=NULL;
-
-enum pref_types { pr_int, pr_real, pr_bool, pr_enum, pr_encoding, pr_string,
- pr_file, pr_namelist, pr_unicode };
-
-int unused = 0;
-char *unused_string = NULL;
-
-static struct prefs_list {
- char *name;
- /* In the prefs file the untranslated name will always be used, but */
- /* in the UI that name may be translated. */
- enum pref_types type;
- void *val;
- void *(*get)(void);
- void (*set)(void *);
- char mn;
- struct enums *enums;
- unsigned int dontdisplay: 1;
- char *popup;
-} core_list[] = {
- { N_("OtherSubrsFile"), pr_file, &othersubrsfile, NULL, NULL, 'O', NULL, 0, N_("If you wish to replace Adobe's OtherSubrs array (for Type1 fonts)\nwith an array of your own, set this to point to a file containing\na list of up to 14 PostScript subroutines. Each subroutine must\nbe preceded by a line starting with '%%%%' (any text before the\nfirst '%%%%' line will be treated as an initial copyright notice).\nThe first three subroutines are for flex hints, the next for hint\nsubstitution (this MUST be present), the 14th (or 13 as the\nnumbering actually starts with 0) is for counter hints.\nThe subroutines should not be enclosed in a [ ] pair.") },
- { N_("AutoHint"), pr_bool, &unused, NULL, NULL, 'A', NULL, 0, N_("AutoHint before rasterizing") },
- { N_("NewCharset"), pr_encoding, &default_encoding, NULL, NULL, 'N', NULL, 0, N_("Default encoding for\nnew fonts") },
- { N_("NewEmSize"), pr_int, &new_em_size, NULL, NULL, 'S', NULL, 0, N_("The default size of the Em-Square in a newly created font.") },
- { N_("NewFontsQuadratic"), pr_bool, &new_fonts_are_order2, NULL, NULL, 'Q', NULL, 0, N_("Whether new fonts should contain splines of quadratic (truetype)\nor cubic (postscript & opentype).") },
- { N_("FreeTypeInFontView"), pr_bool, &unused, NULL, NULL, 'O', NULL, 0, N_("Use the FreeType rasterizer (when available)\nto rasterize glyphs in the font view.\nThis generally results in better quality.") },
- { N_("LoadedFontsAsNew"), pr_bool, &loaded_fonts_same_as_new, NULL, NULL, 'L', NULL, 0, N_("Whether fonts loaded from the disk should retain their splines\nwith the original order (quadratic or cubic), or whether the\nsplines should be converted to the default order for new fonts\n(see NewFontsQuadratic).") },
- { N_("PreferCJKEncodings"), pr_bool, &prefer_cjk_encodings, NULL, NULL, 'C', NULL, 0, N_("When loading a truetype or opentype font which has both a unicode\nand a CJK encoding table, use this flag to specify which\nshould be loaded for the font.") },
- { N_("AskUserForCMap"), pr_bool, &ask_user_for_cmap, NULL, NULL, 'O', NULL, 0, N_("When loading a font in sfnt format (TrueType, OpenType, etc.),\nask the user to specify which cmap to use initially.") },
- { N_("PreserveTables"), pr_string, &SaveTablesPref, NULL, NULL, 'P', NULL, 0, N_("Enter a list of 4 letter table tags, separated by commas.\nFontForge will make a binary copy of these tables when it\nloads a True/OpenType font, and will output them (unchanged)\nwhen it generates the font. Do not include table tags which\nFontForge thinks it understands.") },
- { N_("ItalicConstrained"), pr_bool, &ItalicConstrained, NULL, NULL, '\0', NULL, 0, N_("In the Outline View, the Shift key constrains motion to be parallel to the ItalicAngle rather than constraining it to be vertical.") },
- { N_("SnapToInt"), pr_bool, &snaptoint, NULL, NULL, '\0', NULL, 0, N_("When the user clicks in the editing window, round the location to the nearest integers.") },
- { N_("JoinSnap"), pr_real, &joinsnap, NULL, NULL, '\0', NULL, 0, N_("The Edit->Join command will join points which are this close together\nA value of 0 means they must be coincident") },
- { N_("CopyMetaData"), pr_bool, &copymetadata, NULL, NULL, '\0', NULL, 0, N_("When copying glyphs from the font view, also copy the\nglyphs' metadata (name, encoding, comment, etc).") },
- { N_("UndoDepth"), pr_int, &maxundoes, NULL, NULL, '\0', NULL, 0, N_("The maximum number of Undoes/Redoes stored in a glyph") },
- { N_("AutoWidthSync"), pr_bool, &adjustwidth, NULL, NULL, '\0', NULL, 0, N_("Changing the width of a glyph\nchanges the widths of all accented\nglyphs based on it.") },
- { N_("AutoLBearingSync"), pr_bool, &adjustlbearing, NULL, NULL, '\0', NULL, 0, N_("Changing the left side bearing\nof a glyph adjusts the lbearing\nof other references in all accented\nglyphs based on it.") },
- { N_("ClearInstrsBigChanges"), pr_bool, &clear_tt_instructions_when_needed, NULL, NULL, 'C', NULL, 0, N_("Instructions in a TrueType font refer to\npoints by number, so if you edit a glyph\nin such a way that some points have different\nnumbers (add points, remove them, etc.) then\nthe instructions will be applied to the wrong\npoints with disasterous results.\n Normally FontForge will remove the instructions\nif it detects that the points have been renumbered\nin order to avoid the above problem. You may turn\nthis behavior off -- but be careful!") },
- { N_("CopyTTFInstrs"), pr_bool, &copyttfinstr, NULL, NULL, '\0', NULL, 0, N_("When copying glyphs from the font view, also copy the\nglyphs' metadata (name, encoding, comment, etc).") },
- { N_("AccentOffsetPercent"), pr_int, &accent_offset, NULL, NULL, '\0', NULL, 0, N_("The percentage of an em by which an accent is offset from its base glyph in Build Accent") },
- { N_("AccentCenterLowest"), pr_bool, &GraveAcuteCenterBottom, NULL, NULL, '\0', NULL, 0, N_("When placing grave and acute accents above letters, should\nFontForge center them based on their full width, or\nshould it just center based on the lowest point\nof the accent.") },
- { N_("CharCenterHighest"), pr_bool, &CharCenterHighest, NULL, NULL, '\0', NULL, 0, N_("When centering an accent over a glyph, should the accent\nbe centered on the highest point(s) of the glyph,\nor the middle of the glyph?") },
- { N_("PreferSpacingAccents"), pr_bool, &PreferSpacingAccents, NULL, NULL, '\0', NULL, 0, N_("Use spacing accents (Unicode: 02C0-02FF) rather than\ncombining accents (Unicode: 0300-036F) when\nbuilding accented glyphs.") },
- { N_("PreferPotrace"), pr_bool, &unused, NULL, NULL, '\0', NULL, 0, N_("FontForge supports two different helper applications to do autotracing\n autotrace and potrace\nIf your system only has one it will use that one, if you have both\nuse this option to tell FontForge which to pick.") },
- { N_("AutotraceArgs"), pr_string, &unused_string, NULL, NULL, '\0', NULL, 0, N_("Extra arguments for configuring the autotrace program\n(either autotrace or potrace)") },
- { N_("AutotraceAsk"), pr_bool, &unused, NULL, NULL, '\0', NULL, 0, N_("Ask the user for autotrace arguments each time autotrace is invoked") },
- { N_("MfArgs"), pr_string, &unused_string, NULL, NULL, '\0', NULL, 0, N_("Commands to pass to mf (metafont) program, the filename will follow these") },
- { N_("MfAsk"), pr_bool, &unused, NULL, NULL, '\0', NULL, 0, N_("Ask the user for mf commands each time mf is invoked") },
- { N_("MfClearBg"), pr_bool, &unused, NULL, NULL, '\0', NULL, 0, N_("FontForge loads large images into the background of each glyph\nprior to autotracing them. You may retain those\nimages to look at after mf processing is complete, or\nremove them to save space") },
- { N_("MfShowErr"), pr_bool, &unused, NULL, NULL, '\0', NULL, 0, N_("MetaFont (mf) generates lots of verbiage to stdout.\nMost of the time I find it an annoyance but it is\nimportant to see if something goes wrong.") },
- { N_("FoundryName"), pr_string, &unused_string, NULL, NULL, 'F', NULL, 0, N_("Name used for foundry field in bdf\nfont generation") },
- { N_("TTFFoundry"), pr_string, &TTFFoundry, NULL, NULL, 'T', NULL, 0, N_("Name used for Vendor ID field in\nttf (OS/2 table) font generation.\nMust be no more than 4 characters") },
- { N_("NewFontNameList"), pr_namelist, &namelist_for_new_fonts, NULL, NULL, '\0', NULL, 0, N_("FontForge will use this namelist when assigning\nglyph names to code points in a new font.") },
- { N_("RecognizePUANames"), pr_bool, &recognizePUA, NULL, NULL, 'U', NULL, 0, N_("Once upon a time, Adobe assigned PUA (public use area) encodings\nfor many stylistic variants of characters (small caps, old style\nnumerals, etc.). Adobe no longer believes this to be a good idea,\nand recommends that these encodings be ignored.\n\n The assignments were originally made because most applications\ncould not handle OpenType features for accessing variants. Adobe\nnow believes that all apps that matter can now do so. Applications\nlike Word and OpenOffice still can't handle these features, so\n fontforge's default behavior is to ignore Adobe's current\nrecommendations.\n\nNote: This does not affect figuring out unicode from the font's encoding,\nit just controls determining unicode from a name.") },
- { N_("UnicodeGlyphNames"), pr_bool, &allow_utf8_glyphnames, NULL, NULL, 'O', NULL, 0, N_("Allow the full unicode character set in glyph names.\nThis does not conform to adobe's glyph name standard.\nSuch names should be for internal use only and\nshould NOT end up in production fonts." ) },
- { N_("XUID-Base"), pr_string, &xuid, NULL, NULL, 'X', NULL, 0, N_("If specified this should be a space separated list of integers each\nless than 16777216 which uniquely identify your organization\nFontForge will generate a random number for the final component.") },
- { N_("AskBDFResolution"), pr_bool, &ask_user_for_resolution, NULL, NULL, 'B', NULL, 0, N_("When generating a set of BDF fonts ask the user\nto specify the screen resolution of the fonts\notherwise FontForge will guess depending on the pixel size.") },
- { N_("HintForGen"), pr_bool, &autohint_before_generate, NULL, NULL, 'H', NULL, 0, N_("AutoHint changed glyphs before generating a font") },
- { N_("HintBoundingBoxes"), pr_bool, &hint_bounding_boxes, NULL, NULL, '\0', NULL, 0, N_("FontForge will place vertical or horizontal hints to describe the bounding boxes of suitable glyphs.") },
- { N_("HintDiagonalEnds"), pr_bool, &hint_diagonal_ends, NULL, NULL, '\0', NULL, 0, N_("FontForge will place vertical or horizontal hints at the ends of diagonal stems.") },
- { N_("HintDiagonalInter"), pr_bool, &hint_diagonal_intersections, NULL, NULL, '\0', NULL, 0, N_("FontForge will place vertical or horizontal hints at the intersections of diagonal stems.") },
- { N_("DetectDiagonalStems"), pr_bool, &detect_diagonal_stems, NULL, NULL, '\0', NULL, 0, N_("FontForge will generate diagonal stem hints, which then can be used by the AutoInstr command.") },
- { N_("UseNewIndicScripts"), pr_bool, &use_second_indic_scripts, NULL, NULL, 'C', NULL, 0, N_("MS has changed (in August 2006) the inner workings of their Indic shaping\nengine, and to disambiguate this change has created a parallel set of script\ntags (generally ending in '2') for Indic writing systems. If you are working\nwith the new system set this flag, if you are working with the old unset it.\n(if you aren't doing Indic work, this flag is irrelevant).") },
- { "AntiAlias", pr_bool, &default_fv_antialias, NULL, NULL, '\0', NULL, 1, NULL },
- { "DefaultFVSize", pr_int, &default_fv_font_size, NULL, NULL, 'S', NULL, 1, NULL },
- { "DefaultFVRowCount", pr_int, &default_fv_row_count, NULL, NULL, 'S', NULL, 1, NULL },
- { "DefaultFVColCount", pr_int, &default_fv_col_count, NULL, NULL, 'S', NULL, 1, NULL },
- { "OnlyCopyDisplayed", pr_bool, &onlycopydisplayed, NULL, NULL, '\0', NULL, 1, NULL },
- { "DefaultOutputFormat", pr_int, &unused, NULL, NULL, '\0', NULL, 1, NULL },
- { "DefaultBitmapFormat", pr_int, &unused, NULL, NULL, '\0', NULL, 1, NULL },
- { "SaveValidate", pr_int, &old_validate, NULL, NULL, '\0', NULL, 1, NULL },
- { "SaveFontLogAsk", pr_int, &old_fontlog, NULL, NULL, '\0', NULL, 1, NULL },
- { "DefaultTTFflags", pr_int, &unused, NULL, NULL, '\0', NULL, 1, NULL },
- { "DefaultPSflags", pr_int, &unused, NULL, NULL, '\0', NULL, 1, NULL },
- { "DefaultOTFflags", pr_int, &unused, NULL, NULL, '\0', NULL, 1, NULL },
- { "PageWidth", pr_int, &unused, NULL, NULL, '\0', NULL, 1, NULL },
- { "PageHeight", pr_int, &unused, NULL, NULL, '\0', NULL, 1, NULL },
- { "PrintType", pr_int, &unused, NULL, NULL, '\0', NULL, 1, NULL },
- { "PrintCommand", pr_string, &unused_string, NULL, NULL, '\0', NULL, 1, NULL },
- { "PageLazyPrinter", pr_string, &unused_string, NULL, NULL, '\0', NULL, 1, NULL },
- { "CoverageFormatsAllowed", pr_int, &coverageformatsallowed, NULL, NULL, '\0', NULL, 1, NULL },
- { "ForceNamesWhenOpening", pr_namelist, &force_names_when_opening, NULL, NULL, '\0', NULL, 1, NULL },
- { "ForceNamesWhenSaving", pr_namelist, &force_names_when_saving, NULL, NULL, '\0', NULL, 1, NULL },
- { NULL, 0, NULL, NULL, NULL, 0, NULL, 0, NULL },
-},
- extras[] = {
- { N_("ResourceFile"), pr_file, &xdefs_filename, NULL, NULL, 'R', NULL, 0, N_("When FontForge starts up, it loads display related resources from a\nproperty on the screen. Sometimes it is useful to be able to store\nthese resources in a file. These resources are only read at start\nup, so changing this has no effect until the next time you start\nFontForge.") },
- { N_("HelpDir"), pr_file, &helpdir, NULL, NULL, 'H', NULL, 0, N_("The directory on your local system in which FontForge will search for help\nfiles. If a file is not found there, then FontForge will look for it on the net.") },
- { N_("SplashScreen"), pr_bool, &splash, NULL, NULL, 'S', NULL, 0, N_("Show splash screen on start-up") },
- { N_("GlyphAutoGoto"), pr_bool, &cv_auto_goto, NULL, NULL, '\0', NULL, 0, N_("Typing a normal character in the glyph view window changes the window to look at that character") },
- { N_("OpenCharsInNewWindow"), pr_bool, &OpenCharsInNewWindow, NULL, NULL, '\0', NULL, 0, N_("When double clicking on a character in the font view\nopen that character in a new window, otherwise\nreuse an existing one.") },
- { N_("ArrowMoveSize"), pr_real, &arrowAmount, NULL, NULL, '\0', NULL, 0, N_("The number of em-units by which an arrow key will move a selected point") },
- { N_("ArrowAccelFactor"), pr_real, &arrowAccelFactor, NULL, NULL, '\0', NULL, 0, N_("Holding down the Alt (or Meta) key will speed up arrow key motion by this factor") },
- { N_("SnapDistance"), pr_real, &snapdistance, NULL, NULL, '\0', NULL, 0, N_("When the mouse pointer is within this many pixels\nof one of the various interesting features (baseline,\nwidth, grid splines, etc.) the pointer will snap\nto that feature.") },
- { N_("StopAtJoin"), pr_bool, &stop_at_join, NULL, NULL, '\0', NULL, 0, N_("When dragging points in the outline view a join may occur\n(two open contours may connect at their endpoints). When\nthis is On a join will cause FontForge to stop moving the\nselection (as if the user had released the mouse button).\nThis is handy if your fingers are inclined to wiggle a bit.") },
- { N_("UpdateFlex"), pr_bool, &updateflex, NULL, NULL, '\0', NULL, 0, N_("Figure out flex hints after every change") },
- { N_("AskBDFResolution"), pr_bool, &ask_user_for_resolution, NULL, NULL, 'B', NULL, 0, N_("When generating a set of BDF fonts ask the user\nto specify the screen resolution of the fonts\notherwise FontForge will guess depending on the pixel size.") },
- { "DefaultFVShowHmetrics", pr_int, &default_fv_showhmetrics, NULL, NULL, '\0', NULL, 1, NULL },
- { "DefaultFVShowVmetrics", pr_int, &default_fv_showvmetrics, NULL, NULL, '\0', NULL, 1, NULL },
- { "DefaultFVGlyphLabel", pr_int, &default_fv_glyphlabel, NULL, NULL, 'S', NULL, 1, NULL },
- { "SaveToDir", pr_int, &save_to_dir, NULL, NULL, 'S', NULL, 1, NULL },
- { "PalettesDocked", pr_bool, &palettes_docked, NULL, NULL, '\0', NULL, 1, NULL },
- { "CVVisible0", pr_bool, &cvvisible[0], NULL, NULL, '\0', NULL, 1, NULL },
- { "CVVisible1", pr_bool, &cvvisible[1], NULL, NULL, '\0', NULL, 1, NULL },
- { "BVVisible0", pr_bool, &bvvisible[0], NULL, NULL, '\0', NULL, 1, NULL },
- { "BVVisible1", pr_bool, &bvvisible[1], NULL, NULL, '\0', NULL, 1, NULL },
- { "BVVisible2", pr_bool, &bvvisible[2], NULL, NULL, '\0', NULL, 1, NULL },
- { "InfoWindowDistance", pr_int, &infowindowdistance, NULL, NULL, '\0', NULL, 1, NULL },
- { "MarkExtrema", pr_int, &loacal_markextrema, NULL, NULL, '\0', NULL, 1, NULL },
- { "MarkPointsOfInflect", pr_int, &loacal_markpoi, NULL, NULL, '\0', NULL, 1, NULL },
- { "ShowRulers", pr_bool, &loacal_showrulers, NULL, NULL, '\0', NULL, 1, N_("Display rulers in the Outline Glyph View") },
- { "ShowCPInfo", pr_int, &loacal_showcpinfo, NULL, NULL, '\0', NULL, 1, NULL },
- { "ShowSideBearings", pr_int, &loacal_showsidebearings, NULL, NULL, '\0', NULL, 1, NULL },
- { "ShowRefNames", pr_int, &loacal_showrefnames, NULL, NULL, '\0', NULL, 1, NULL },
- { "ShowPoints", pr_bool, &loacal_showpoints, NULL, NULL, '\0', NULL, 1, NULL },
- { "ShowFilled", pr_int, &loacal_showfilled, NULL, NULL, '\0', NULL, 1, NULL },
- { "ShowTabs", pr_int, &loacal_showtabs, NULL, NULL, '\0', NULL, 1, NULL },
- { "DefaultScreenDpiSystem", pr_int, &oldsystem, NULL, NULL, '\0', NULL, 1, NULL },
- { "OFLibUsername", pr_string, &oflib_username, NULL, NULL, '\0', NULL, 1, NULL },
- { "OFLibPassword", pr_string, &oflib_password, NULL, NULL, '\0', NULL, 1, NULL },
- { "RegularStar", pr_bool, &regular_star, NULL, NULL, '\0', NULL, 1, NULL },
- { "PolyStar", pr_bool, &polystar, NULL, NULL, '\0', NULL, 1, NULL },
- { "RectEllipse", pr_bool, &rectelipse, NULL, NULL, '\0', NULL, 1, NULL },
- { "RectCenterOut", pr_bool, &center_out[0], NULL, NULL, '\0', NULL, 1, NULL },
- { "EllipseCenterOut", pr_bool, &center_out[1], NULL, NULL, '\0', NULL, 1, NULL },
- { "PolyStartPointCnt", pr_int, &ps_pointcnt, NULL, NULL, '\0', NULL, 1, NULL },
- { "RoundRectRadius", pr_real, &rr_radius, NULL, NULL, '\0', NULL, 1, NULL },
- { "StarPercent", pr_real, &star_percent, NULL, NULL, '\0', NULL, 1, NULL },
- { "DebugWins", pr_int, &debug_wins, NULL, NULL, '\0', NULL, 1, NULL },
- { "GridFitDpi", pr_int, &gridfit_dpi, NULL, NULL, '\0', NULL, 1, NULL },
- { "GridFitDepth", pr_int, &gridfit_depth, NULL, NULL, '\0', NULL, 1, NULL },
- { "GridFitPointSize", pr_real, &gridfit_pointsizey, NULL, NULL, '\0', NULL, 1, NULL },
- { "GridFitPointSizeX", pr_real, &gridfit_pointsizex, NULL, NULL, '\0', NULL, 1, NULL },
- { "GridFitSameAs", pr_int, &gridfit_x_sameas_y, NULL, NULL, '\0', NULL, 1, NULL },
- { "MVShowGrid", pr_int, &mvshowgrid, NULL, NULL, '\0', NULL, 1, NULL },
- { "DefaultFontFilterIndex", pr_int, &default_font_filter_index, NULL, NULL, '\0', NULL, 1, NULL },
- { "SeekChar", pr_unicode, &home_char, NULL, NULL, '\0', NULL, 1, NULL },
- { "CompactOnOpen", pr_bool, &compact_font_on_open, NULL, NULL, '\0', NULL, 1, NULL },
- { "PixmapDir", pr_file, &pixmapdir, NULL, NULL, 'R', NULL, 0, NULL },
- { "DefaultCVWidth", pr_int, &default_cv_width, NULL, NULL, '\0', NULL, 1, NULL },
- { "DefaultCVHeight", pr_int, &default_cv_height, NULL, NULL, '\0', NULL, 1, NULL },
- { "FCShowHidden", pr_bool, &gfc_showhidden, NULL, NULL, '\0', NULL, 1, NULL },
- { "FCDirPlacement", pr_int, &gfc_dirplace, NULL, NULL, '\0', NULL, 1, NULL },
- { "FCBookmarks", pr_string, &gfc_bookmarks, NULL, NULL, '\0', NULL, 1, NULL },
- { "OFLibAutomagicPreview", pr_int, &oflib_automagic_preview, NULL, NULL, '\0', NULL, 1, NULL },
- { "DefaultMVWidth", pr_int, &mv_width, NULL, NULL, '\0', NULL, 1, NULL },
- { "DefaultMVHeight", pr_int, &mv_height, NULL, NULL, '\0', NULL, 1, NULL },
- { "DefaultBVWidth", pr_int, &bv_width, NULL, NULL, '\0', NULL, 1, NULL },
- { "DefaultBVHeight", pr_int, &bv_height, NULL, NULL, '\0', NULL, 1, NULL },
- { "AnchorControlPixelSize", pr_int, &aa_pixelsize, NULL, NULL, '\0', NULL, 1, NULL },
- { NULL, 0, NULL, NULL, NULL, 0, NULL, 0, NULL },
-},
- *prefs_list[] = { core_list, extras, NULL };
-
-static int NOUI_GetPrefs(char *name,Val *val) {
- int i,j;
-
- for ( i=0; prefs_list[i]!=NULL; ++i ) for ( j=0; prefs_list[i][j].name!=NULL; ++j ) {
- if ( strcmp(prefs_list[i][j].name,name)==0 ) {
- struct prefs_list *pf = &prefs_list[i][j];
- if ( pf->type == pr_bool || pf->type == pr_int || pf->type == pr_unicode ) {
- val->type = v_int;
- val->u.ival = *((int *) (pf->val));
- } else if ( pf->type == pr_string || pf->type == pr_file ) {
- val->type = v_str;
- val->u.sval = copy( *((char **) (pf->val)));
- } else if ( pf->type == pr_encoding ) {
- val->type = v_str;
- if ( *((NameList **) (pf->val))==NULL )
- val->u.sval = copy( "NULL" );
- else
- val->u.sval = copy( (*((Encoding **) (pf->val)))->enc_name );
- } else if ( pf->type == pr_namelist ) {
- val->type = v_str;
- val->u.sval = copy( (*((NameList **) (pf->val)))->title );
- } else if ( pf->type == pr_real ) {
- val->type = v_real;
- val->u.fval = *((float *) (pf->val));
- } else
-return( false );
-
-return( true );
- }
- }
-return( false );
-}
-
-static int NOUI_SetPrefs(char *name,Val *val1, Val *val2) {
- int i,j;
-
- for ( i=0; prefs_list[i]!=NULL; ++i ) for ( j=0; prefs_list[i][j].name!=NULL; ++j ) {
- if ( strcmp(prefs_list[i][j].name,name)==0 ) {
- struct prefs_list *pf = &prefs_list[i][j];
- if ( pf->type == pr_bool || pf->type == pr_int || pf->type == pr_unicode ) {
- if ( (val1->type!=v_int && val1->type!=v_unicode) || val2!=NULL )
-return( -1 );
- *((int *) (pf->val)) = val1->u.ival;
- } else if ( pf->type == pr_real ) {
- if ( val1->type==v_real && val2==NULL )
- *((float *) (pf->val)) = val1->u.fval;
- else if ( val1->type!=v_int || (val2!=NULL && val2->type!=v_int ))
-return( -1 );
- else
- *((float *) (pf->val)) = (val2==NULL ? val1->u.ival : val1->u.ival / (double) val2->u.ival);
- } else if ( pf->type == pr_string || pf->type == pr_file ) {
- if ( val1->type!=v_str || val2!=NULL )
-return( -1 );
- if ( pf->set ) {
- pf->set( val1->u.sval );
- } else {
- free( *((char **) (pf->val)));
- *((char **) (pf->val)) = copy( val1->u.sval );
- }
- } else if ( pf->type == pr_encoding ) {
- if ( val2!=NULL )
-return( -1 );
- else if ( val1->type==v_str && pf->val == &default_encoding) {
- Encoding *enc = FindOrMakeEncoding(val1->u.sval);
- if ( enc==NULL )
-return( -1 );
- *((Encoding **) (pf->val)) = enc;
- } else
-return( -1 );
- } else if ( pf->type == pr_namelist ) {
- if ( val2!=NULL )
-return( -1 );
- else if ( val1->type==v_str ) {
- NameList *nl = NameListByName(val1->u.sval);
- if ( strcmp(val1->u.sval,"NULL")==0 && pf->val != &namelist_for_new_fonts )
- nl = NULL;
- else if ( nl==NULL )
-return( -1 );
- *((NameList **) (pf->val)) = nl;
- } else
-return( -1 );
- } else
-return( false );
-
- SavePrefs(true);
-return( true );
- }
- }
-return( false );
-}
-
-static char *NOUI_getFontForgeShareDir(void) {
-#if defined(SHAREDIR)
-return( SHAREDIR "/fontforge" );
-#elif defined(PREFIX)
-return( PREFIX "/share/fontforge" );
-#else
-return( NULL );
-#endif
-}
-
-static void DefaultXUID(void) {
- /* Adobe has assigned PfaEdit a base XUID of 1021. Each new user is going */
- /* to get a couple of random numbers appended to that, hoping that will */
- /* make for a fairly safe system. */
- /* FontForge will use the same scheme */
- int r1, r2;
- char buffer[50];
- struct timeval tv;
-
- gettimeofday(&tv,NULL);
- srand(tv.tv_usec);
- do {
- r1 = rand()&0x3ff;
- } while ( r1==0 ); /* I reserve "0" for me! */
- gettimeofday(&tv,NULL);
- r2 = rand();
- sprintf( buffer, "1021 %d %d", r1, r2 );
- free(xuid);
- xuid = copy(buffer);
-}
-
-static void NOUI_SetDefaults(void) {
- DefaultXUID();
-}
-
-static void NOUI_LoadPrefs(void) {
-}
-
-static void NOUI_SavePrefs(int not_if_script) {
- (void)not_if_script;
-}
-
-static struct prefs_interface prefsnoui = {
- NOUI_SavePrefs,
- NOUI_LoadPrefs,
- NOUI_GetPrefs,
- NOUI_SetPrefs,
- NOUI_getFontForgeShareDir,
- NOUI_SetDefaults
-};
-
-struct prefs_interface *prefs_interface = &prefsnoui;
-
-void FF_SetPrefsInterface(struct prefs_interface *prefsi) {
- prefs_interface = prefsi;
-}
diff --git a/Build/source/texk/web2c/luatexdir/luafontloader/fontforge/fontforge/nouiutil.c b/Build/source/texk/web2c/luatexdir/luafontloader/fontforge/fontforge/nouiutil.c
deleted file mode 100644
index c2298dcf43f..00000000000
--- a/Build/source/texk/web2c/luatexdir/luafontloader/fontforge/fontforge/nouiutil.c
+++ /dev/null
@@ -1,203 +0,0 @@
-/* Copyright (C) 2000-2008 by George Williams */
-/*
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are met:
-
- * Redistributions of source code must retain the above copyright notice, this
- * list of conditions and the following disclaimer.
-
- * Redistributions in binary form must reproduce the above copyright notice,
- * this list of conditions and the following disclaimer in the documentation
- * and/or other materials provided with the distribution.
-
- * The name of the author may not be used to endorse or promote products
- * derived from this software without specific prior written permission.
-
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
- * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
- * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
- * EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
- * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
- * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
- * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
- * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-#include "uiinterface.h"
-#include "splinefont.h"
-#include <stdarg.h>
-#include <stdio.h>
-#include <basics.h>
-#include <ustring.h>
-
-static void NOUI_IError(const char *format,...) {
- va_list ap;
- va_start(ap,format);
- fprintf(stderr, "Internal Error: " );
- vfprintf(stderr,format,ap);
- va_end(ap);
-}
-
-static void NOUI__LogError(const char *format,va_list ap) {
- char buffer[400], *str;
- vsnprintf(buffer,sizeof(buffer),format,ap);
- str = (char *)buffer;
- fprintf(stderr,"%s",str);
- if ( str[strlen(str)-1]!='\n' )
- putc('\n',stderr);
-/* free(str);*/
-}
-
-static void NOUI_LogError(const char *format,...) {
- va_list ap;
-
- va_start(ap,format);
- NOUI__LogError(format,ap);
- va_end(ap);
-}
-
-static void NOUI_post_notice(const char *title,const char *statement,...) {
- va_list ap;
- (void)title;
- va_start(ap,statement);
- NOUI__LogError(statement,ap);
- va_end(ap);
-}
-
-static void NOUI_post_error(const char *title,const char *statement,...) {
- va_list ap;
- (void)title;
- va_start(ap,statement);
- NOUI__LogError(statement,ap);
- va_end(ap);
-}
-
-static int NOUI_ask(const char *title, const char **answers,
- int def, int cancel,const char *question,...) {
- (void)title;
- (void)answers;
- (void)def;
- (void)cancel;
- (void)question;
-return( def );
-}
-
-static int NOUI_choose(const char *title, const char **choices,int cnt, int def,
- const char *question,...) {
- (void)title;
- (void)choices;
- (void)def;
- (void)cnt;
- (void)question;
-return( def );
-}
-
-static int NOUI_choose_multiple(char *title, const char **choices,char *sel,
- int cnt, char *buts[2], const char *question,...) {
- (void)title;
- (void)choices;
- (void)sel;
- (void)cnt;
- (void)buts;
- (void)question;
-return( -1 );
-}
-
-static char *NOUI_ask_string(const char *title, const char *def,
- const char *question,...) {
- (void)title;
- (void)def;
- (void)question;
-return( (char *) def );
-}
-
-static char *NOUI_open_file(const char *title, const char *defaultfile,
- const char *initial_filter) {
- (void)title;
- (void)defaultfile;
- (void)initial_filter;
-return( NULL );
-}
-
-static char *NOUI_saveas_file(const char *title, const char *defaultfile,
- const char *initial_filter) {
- (void)title;
- (void)initial_filter;
-return( copy(defaultfile) );
-}
-
-static void NOUI_progress_start(int delay, const char *title, const char *line1,
- const char *line2, int tot, int stages) {
- (void)delay;
- (void)title;
- (void)line1;
- (void)line2;
- (void)tot;
- (void)stages;
-}
-
-static void NOUI_void_void_noop(void) {
-}
-
-static void NOUI_void_int_noop(int useless) {
- (void)useless;
-}
-
-static int NOUI_int_int_noop(int useless) {
- (void)useless;
-return( true );
-}
-
-static void NOUI_void_str_noop(const char * useless) {
- (void)useless;
-}
-
-static int NOUI_alwaystrue(void) {
-return( true );
-}
-
-static int NOUI_DefaultStrokeFlags(void) {
-return( sf_correctdir );
-}
-
-static struct ui_interface noui_interface = {
- NOUI_IError,
- NOUI_post_error,
- NOUI_LogError,
- NOUI_post_notice,
- NOUI_ask,
- NOUI_choose,
- NOUI_choose_multiple,
- NOUI_ask_string,
- NOUI_ask_string, /* password */
- NOUI_open_file,
- NOUI_saveas_file,
-
- NOUI_progress_start,
- NOUI_void_void_noop,
- NOUI_void_void_noop,
- NOUI_void_int_noop,
- NOUI_alwaystrue,
- NOUI_alwaystrue,
- NOUI_int_int_noop,
- NOUI_void_str_noop,
- NOUI_void_str_noop,
- NOUI_void_void_noop,
- NOUI_void_void_noop,
- NOUI_void_int_noop,
- NOUI_void_int_noop,
- NOUI_alwaystrue,
-
- NOUI_void_void_noop,
-
- NOUI_TTFNameIds,
- NOUI_MSLangString,
-
- NOUI_DefaultStrokeFlags
-};
-struct ui_interface *ui_interface = &noui_interface;
-
-void FF_SetUiInterface(struct ui_interface *uii) {
- ui_interface = uii;
-}
diff --git a/Build/source/texk/web2c/luatexdir/luafontloader/fontforge/fontforge/parsepfa.c b/Build/source/texk/web2c/luatexdir/luafontloader/fontforge/fontforge/parsepfa.c
deleted file mode 100644
index df369b45e6f..00000000000
--- a/Build/source/texk/web2c/luatexdir/luafontloader/fontforge/fontforge/parsepfa.c
+++ /dev/null
@@ -1,2739 +0,0 @@
-/* Copyright (C) 2000-2008 by George Williams */
-/*
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are met:
-
- * Redistributions of source code must retain the above copyright notice, this
- * list of conditions and the following disclaimer.
-
- * Redistributions in binary form must reproduce the above copyright notice,
- * this list of conditions and the following disclaimer in the documentation
- * and/or other materials provided with the distribution.
-
- * The name of the author may not be used to endorse or promote products
- * derived from this software without specific prior written permission.
-
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
- * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
- * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
- * EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
- * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
- * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
- * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
- * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-#include "pfaedit.h"
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <ustring.h>
-#include <utype.h>
-#include <unistd.h>
-#include <sys/types.h>
-#include <sys/stat.h>
-#include "psfont.h"
-#include <locale.h>
-
-struct fontparse {
- FontDict *fd, *mainfd;
- /* always in font data */
- unsigned int infi:1;
- unsigned int inchars:1;
- unsigned int inprivate:1;
- unsigned int insubs:1;
- unsigned int inmetrics: 1;
- unsigned int inmetrics2: 1;
- unsigned int inbb: 1;
- unsigned int inencoding: 1;
- unsigned int simpleencoding: 1;
- unsigned int multiline: 1;
- unsigned int incidsysteminfo: 1;
- unsigned int inblendfi:1;
- unsigned int inblendprivate:1;
- unsigned int skipping_mbf: 1;
- unsigned int inblend: 1;
- unsigned int iscid: 1;
- unsigned int iscff: 1;
- unsigned int useshexstrings: 1;
- unsigned int doneencoding: 1;
- unsigned int ignore: 1;
- int simple_enc_pos;
- int instring;
- int fdindex;
- char **pending_parse;
- FILE *sfnts;
-
- unsigned int alreadycomplained: 1;
-
- char *vbuf, *vmax, *vpt;
- int depth;
-};
-
-static void copyenc(char *encoding[256],char *std[256]) {
- int i;
- for ( i=0; i<256; ++i )
- encoding[i] = copy(std[i]);
-}
-
-char *AdobeStandardEncoding[] = {
-/* 0000 */ ".notdef",
-/* 0001 */ ".notdef",
-/* 0002 */ ".notdef",
-/* 0003 */ ".notdef",
-/* 0004 */ ".notdef",
-/* 0005 */ ".notdef",
-/* 0006 */ ".notdef",
-/* 0007 */ ".notdef",
-/* 0008 */ ".notdef",
-/* 0009 */ ".notdef",
-/* 000a */ ".notdef",
-/* 000b */ ".notdef",
-/* 000c */ ".notdef",
-/* 000d */ ".notdef",
-/* 000e */ ".notdef",
-/* 000f */ ".notdef",
-/* 0010 */ ".notdef",
-/* 0011 */ ".notdef",
-/* 0012 */ ".notdef",
-/* 0013 */ ".notdef",
-/* 0014 */ ".notdef",
-/* 0015 */ ".notdef",
-/* 0016 */ ".notdef",
-/* 0017 */ ".notdef",
-/* 0018 */ ".notdef",
-/* 0019 */ ".notdef",
-/* 001a */ ".notdef",
-/* 001b */ ".notdef",
-/* 001c */ ".notdef",
-/* 001d */ ".notdef",
-/* 001e */ ".notdef",
-/* 001f */ ".notdef",
-/* 0020 */ "space",
-/* 0021 */ "exclam",
-/* 0022 */ "quotedbl",
-/* 0023 */ "numbersign",
-/* 0024 */ "dollar",
-/* 0025 */ "percent",
-/* 0026 */ "ampersand",
-/* 0027 */ "quoteright",
-/* 0028 */ "parenleft",
-/* 0029 */ "parenright",
-/* 002a */ "asterisk",
-/* 002b */ "plus",
-/* 002c */ "comma",
-/* 002d */ "hyphen",
-/* 002e */ "period",
-/* 002f */ "slash",
-/* 0030 */ "zero",
-/* 0031 */ "one",
-/* 0032 */ "two",
-/* 0033 */ "three",
-/* 0034 */ "four",
-/* 0035 */ "five",
-/* 0036 */ "six",
-/* 0037 */ "seven",
-/* 0038 */ "eight",
-/* 0039 */ "nine",
-/* 003a */ "colon",
-/* 003b */ "semicolon",
-/* 003c */ "less",
-/* 003d */ "equal",
-/* 003e */ "greater",
-/* 003f */ "question",
-/* 0040 */ "at",
-/* 0041 */ "A",
-/* 0042 */ "B",
-/* 0043 */ "C",
-/* 0044 */ "D",
-/* 0045 */ "E",
-/* 0046 */ "F",
-/* 0047 */ "G",
-/* 0048 */ "H",
-/* 0049 */ "I",
-/* 004a */ "J",
-/* 004b */ "K",
-/* 004c */ "L",
-/* 004d */ "M",
-/* 004e */ "N",
-/* 004f */ "O",
-/* 0050 */ "P",
-/* 0051 */ "Q",
-/* 0052 */ "R",
-/* 0053 */ "S",
-/* 0054 */ "T",
-/* 0055 */ "U",
-/* 0056 */ "V",
-/* 0057 */ "W",
-/* 0058 */ "X",
-/* 0059 */ "Y",
-/* 005a */ "Z",
-/* 005b */ "bracketleft",
-/* 005c */ "backslash",
-/* 005d */ "bracketright",
-/* 005e */ "asciicircum",
-/* 005f */ "underscore",
-/* 0060 */ "quoteleft",
-/* 0061 */ "a",
-/* 0062 */ "b",
-/* 0063 */ "c",
-/* 0064 */ "d",
-/* 0065 */ "e",
-/* 0066 */ "f",
-/* 0067 */ "g",
-/* 0068 */ "h",
-/* 0069 */ "i",
-/* 006a */ "j",
-/* 006b */ "k",
-/* 006c */ "l",
-/* 006d */ "m",
-/* 006e */ "n",
-/* 006f */ "o",
-/* 0070 */ "p",
-/* 0071 */ "q",
-/* 0072 */ "r",
-/* 0073 */ "s",
-/* 0074 */ "t",
-/* 0075 */ "u",
-/* 0076 */ "v",
-/* 0077 */ "w",
-/* 0078 */ "x",
-/* 0079 */ "y",
-/* 007a */ "z",
-/* 007b */ "braceleft",
-/* 007c */ "bar",
-/* 007d */ "braceright",
-/* 007e */ "asciitilde",
-/* 007f */ ".notdef",
-/* 0080 */ ".notdef",
-/* 0081 */ ".notdef",
-/* 0082 */ ".notdef",
-/* 0083 */ ".notdef",
-/* 0084 */ ".notdef",
-/* 0085 */ ".notdef",
-/* 0086 */ ".notdef",
-/* 0087 */ ".notdef",
-/* 0088 */ ".notdef",
-/* 0089 */ ".notdef",
-/* 008a */ ".notdef",
-/* 008b */ ".notdef",
-/* 008c */ ".notdef",
-/* 008d */ ".notdef",
-/* 008e */ ".notdef",
-/* 008f */ ".notdef",
-/* 0090 */ ".notdef",
-/* 0091 */ ".notdef",
-/* 0092 */ ".notdef",
-/* 0093 */ ".notdef",
-/* 0094 */ ".notdef",
-/* 0095 */ ".notdef",
-/* 0096 */ ".notdef",
-/* 0097 */ ".notdef",
-/* 0098 */ ".notdef",
-/* 0099 */ ".notdef",
-/* 009a */ ".notdef",
-/* 009b */ ".notdef",
-/* 009c */ ".notdef",
-/* 009d */ ".notdef",
-/* 009e */ ".notdef",
-/* 009f */ ".notdef",
-/* 00a0 */ ".notdef",
-/* 00a1 */ "exclamdown",
-/* 00a2 */ "cent",
-/* 00a3 */ "sterling",
-/* 00a4 */ "fraction",
-/* 00a5 */ "yen",
-/* 00a6 */ "florin",
-/* 00a7 */ "section",
-/* 00a8 */ "currency",
-/* 00a9 */ "quotesingle",
-/* 00aa */ "quotedblleft",
-/* 00ab */ "guillemotleft",
-/* 00ac */ "guilsinglleft",
-/* 00ad */ "guilsinglright",
-/* 00ae */ "fi",
-/* 00af */ "fl",
-/* 00b0 */ ".notdef",
-/* 00b1 */ "endash",
-/* 00b2 */ "dagger",
-/* 00b3 */ "daggerdbl",
-/* 00b4 */ "periodcentered",
-/* 00b5 */ ".notdef",
-/* 00b6 */ "paragraph",
-/* 00b7 */ "bullet",
-/* 00b8 */ "quotesinglbase",
-/* 00b9 */ "quotedblbase",
-/* 00ba */ "quotedblright",
-/* 00bb */ "guillemotright",
-/* 00bc */ "ellipsis",
-/* 00bd */ "perthousand",
-/* 00be */ ".notdef",
-/* 00bf */ "questiondown",
-/* 00c0 */ ".notdef",
-/* 00c1 */ "grave",
-/* 00c2 */ "acute",
-/* 00c3 */ "circumflex",
-/* 00c4 */ "tilde",
-/* 00c5 */ "macron",
-/* 00c6 */ "breve",
-/* 00c7 */ "dotaccent",
-/* 00c8 */ "dieresis",
-/* 00c9 */ ".notdef",
-/* 00ca */ "ring",
-/* 00cb */ "cedilla",
-/* 00cc */ ".notdef",
-/* 00cd */ "hungarumlaut",
-/* 00ce */ "ogonek",
-/* 00cf */ "caron",
-/* 00d0 */ "emdash",
-/* 00d1 */ ".notdef",
-/* 00d2 */ ".notdef",
-/* 00d3 */ ".notdef",
-/* 00d4 */ ".notdef",
-/* 00d5 */ ".notdef",
-/* 00d6 */ ".notdef",
-/* 00d7 */ ".notdef",
-/* 00d8 */ ".notdef",
-/* 00d9 */ ".notdef",
-/* 00da */ ".notdef",
-/* 00db */ ".notdef",
-/* 00dc */ ".notdef",
-/* 00dd */ ".notdef",
-/* 00de */ ".notdef",
-/* 00df */ ".notdef",
-/* 00e0 */ ".notdef",
-/* 00e1 */ "AE",
-/* 00e2 */ ".notdef",
-/* 00e3 */ "ordfeminine",
-/* 00e4 */ ".notdef",
-/* 00e5 */ ".notdef",
-/* 00e6 */ ".notdef",
-/* 00e7 */ ".notdef",
-/* 00e8 */ "Lslash",
-/* 00e9 */ "Oslash",
-/* 00ea */ "OE",
-/* 00eb */ "ordmasculine",
-/* 00ec */ ".notdef",
-/* 00ed */ ".notdef",
-/* 00ee */ ".notdef",
-/* 00ef */ ".notdef",
-/* 00f0 */ ".notdef",
-/* 00f1 */ "ae",
-/* 00f2 */ ".notdef",
-/* 00f3 */ ".notdef",
-/* 00f4 */ ".notdef",
-/* 00f5 */ "dotlessi",
-/* 00f6 */ ".notdef",
-/* 00f7 */ ".notdef",
-/* 00f8 */ "lslash",
-/* 00f9 */ "oslash",
-/* 00fa */ "oe",
-/* 00fb */ "germandbls",
-/* 00fc */ ".notdef",
-/* 00fd */ ".notdef",
-/* 00fe */ ".notdef",
-/* 00ff */ ".notdef"
-};
-static void setStdEnc(char *encoding[256]) {
- copyenc(encoding,AdobeStandardEncoding);
-}
-
-static void setLatin1Enc(char *encoding[256]) {
- static char *latin1enc[] = {
-/* 0000 */ ".notdef",
-/* 0001 */ ".notdef",
-/* 0002 */ ".notdef",
-/* 0003 */ ".notdef",
-/* 0004 */ ".notdef",
-/* 0005 */ ".notdef",
-/* 0006 */ ".notdef",
-/* 0007 */ ".notdef",
-/* 0008 */ ".notdef",
-/* 0009 */ ".notdef",
-/* 000a */ ".notdef",
-/* 000b */ ".notdef",
-/* 000c */ ".notdef",
-/* 000d */ ".notdef",
-/* 000e */ ".notdef",
-/* 000f */ ".notdef",
-/* 0010 */ ".notdef",
-/* 0011 */ ".notdef",
-/* 0012 */ ".notdef",
-/* 0013 */ ".notdef",
-/* 0014 */ ".notdef",
-/* 0015 */ ".notdef",
-/* 0016 */ ".notdef",
-/* 0017 */ ".notdef",
-/* 0018 */ ".notdef",
-/* 0019 */ ".notdef",
-/* 001a */ ".notdef",
-/* 001b */ ".notdef",
-/* 001c */ ".notdef",
-/* 001d */ ".notdef",
-/* 001e */ ".notdef",
-/* 001f */ ".notdef",
-/* 0020 */ "space",
-/* 0021 */ "exclam",
-/* 0022 */ "quotedbl",
-/* 0023 */ "numbersign",
-/* 0024 */ "dollar",
-/* 0025 */ "percent",
-/* 0026 */ "ampersand",
-/* 0027 */ "quoteright",
-/* 0028 */ "parenleft",
-/* 0029 */ "parenright",
-/* 002a */ "asterisk",
-/* 002b */ "plus",
-/* 002c */ "comma",
-/* 002d */ "hyphen",
-/* 002e */ "period",
-/* 002f */ "slash",
-/* 0030 */ "zero",
-/* 0031 */ "one",
-/* 0032 */ "two",
-/* 0033 */ "three",
-/* 0034 */ "four",
-/* 0035 */ "five",
-/* 0036 */ "six",
-/* 0037 */ "seven",
-/* 0038 */ "eight",
-/* 0039 */ "nine",
-/* 003a */ "colon",
-/* 003b */ "semicolon",
-/* 003c */ "less",
-/* 003d */ "equal",
-/* 003e */ "greater",
-/* 003f */ "question",
-/* 0040 */ "at",
-/* 0041 */ "A",
-/* 0042 */ "B",
-/* 0043 */ "C",
-/* 0044 */ "D",
-/* 0045 */ "E",
-/* 0046 */ "F",
-/* 0047 */ "G",
-/* 0048 */ "H",
-/* 0049 */ "I",
-/* 004a */ "J",
-/* 004b */ "K",
-/* 004c */ "L",
-/* 004d */ "M",
-/* 004e */ "N",
-/* 004f */ "O",
-/* 0050 */ "P",
-/* 0051 */ "Q",
-/* 0052 */ "R",
-/* 0053 */ "S",
-/* 0054 */ "T",
-/* 0055 */ "U",
-/* 0056 */ "V",
-/* 0057 */ "W",
-/* 0058 */ "X",
-/* 0059 */ "Y",
-/* 005a */ "Z",
-/* 005b */ "bracketleft",
-/* 005c */ "backslash",
-/* 005d */ "bracketright",
-/* 005e */ "asciicircum",
-/* 005f */ "underscore",
-/* 0060 */ "grave",
-/* 0061 */ "a",
-/* 0062 */ "b",
-/* 0063 */ "c",
-/* 0064 */ "d",
-/* 0065 */ "e",
-/* 0066 */ "f",
-/* 0067 */ "g",
-/* 0068 */ "h",
-/* 0069 */ "i",
-/* 006a */ "j",
-/* 006b */ "k",
-/* 006c */ "l",
-/* 006d */ "m",
-/* 006e */ "n",
-/* 006f */ "o",
-/* 0070 */ "p",
-/* 0071 */ "q",
-/* 0072 */ "r",
-/* 0073 */ "s",
-/* 0074 */ "t",
-/* 0075 */ "u",
-/* 0076 */ "v",
-/* 0077 */ "w",
-/* 0078 */ "x",
-/* 0079 */ "y",
-/* 007a */ "z",
-/* 007b */ "braceleft",
-/* 007c */ "bar",
-/* 007d */ "braceright",
-/* 007e */ "asciitilde",
-/* 007f */ ".notdef",
-/* 0080 */ ".notdef",
-/* 0081 */ ".notdef",
-/* 0082 */ ".notdef",
-/* 0083 */ ".notdef",
-/* 0084 */ ".notdef",
-/* 0085 */ ".notdef",
-/* 0086 */ ".notdef",
-/* 0087 */ ".notdef",
-/* 0088 */ ".notdef",
-/* 0089 */ ".notdef",
-/* 008a */ ".notdef",
-/* 008b */ ".notdef",
-/* 008c */ ".notdef",
-/* 008d */ ".notdef",
-/* 008e */ ".notdef",
-/* 008f */ ".notdef",
-/* 0090 */ "dotlessi", /* Um, Adobe's Latin1 has some extra chars */
-/* 0091 */ "grave",
-/* 0092 */ "accute", /* This is a duplicate... */
-/* 0093 */ "circumflex",
-/* 0094 */ "tilde",
-/* 0095 */ "macron",
-/* 0096 */ "breve",
-/* 0097 */ "dotaccent",
-/* 0098 */ "dieresis",
-/* 0099 */ ".notdef",
-/* 009a */ "ring",
-/* 009b */ "cedilla",
-/* 009c */ ".notdef",
-/* 009d */ "hungarumlaut",
-/* 009e */ "ogonek",
-/* 009f */ "caron",
-/* 00a0 */ "space",
-/* 00a1 */ "exclamdown",
-/* 00a2 */ "cent",
-/* 00a3 */ "sterling",
-/* 00a4 */ "currency",
-/* 00a5 */ "yen",
-/* 00a6 */ "brokenbar",
-/* 00a7 */ "section",
-/* 00a8 */ "dieresis",
-/* 00a9 */ "copyright",
-/* 00aa */ "ordfeminine",
-/* 00ab */ "guillemotleft",
-/* 00ac */ "logicalnot",
-/* 00ad */ "hyphen",
-/* 00ae */ "registered",
-/* 00af */ "macron",
-/* 00b0 */ "degree",
-/* 00b1 */ "plusminus",
-/* 00b2 */ "twosuperior",
-/* 00b3 */ "threesuperior",
-/* 00b4 */ "acute",
-/* 00b5 */ "mu",
-/* 00b6 */ "paragraph",
-/* 00b7 */ "periodcentered",
-/* 00b8 */ "cedilla",
-/* 00b9 */ "onesuperior",
-/* 00ba */ "ordmasculine",
-/* 00bb */ "guillemotright",
-/* 00bc */ "onequarter",
-/* 00bd */ "onehalf",
-/* 00be */ "threequarters",
-/* 00bf */ "questiondown",
-/* 00c0 */ "Agrave",
-/* 00c1 */ "Aacute",
-/* 00c2 */ "Acircumflex",
-/* 00c3 */ "Atilde",
-/* 00c4 */ "Adieresis",
-/* 00c5 */ "Aring",
-/* 00c6 */ "AE",
-/* 00c7 */ "Ccedilla",
-/* 00c8 */ "Egrave",
-/* 00c9 */ "Eacute",
-/* 00ca */ "Ecircumflex",
-/* 00cb */ "Edieresis",
-/* 00cc */ "Igrave",
-/* 00cd */ "Iacute",
-/* 00ce */ "Icircumflex",
-/* 00cf */ "Idieresis",
-/* 00d0 */ "Eth",
-/* 00d1 */ "Ntilde",
-/* 00d2 */ "Ograve",
-/* 00d3 */ "Oacute",
-/* 00d4 */ "Ocircumflex",
-/* 00d5 */ "Otilde",
-/* 00d6 */ "Odieresis",
-/* 00d7 */ "multiply",
-/* 00d8 */ "Oslash",
-/* 00d9 */ "Ugrave",
-/* 00da */ "Uacute",
-/* 00db */ "Ucircumflex",
-/* 00dc */ "Udieresis",
-/* 00dd */ "Yacute",
-/* 00de */ "Thorn",
-/* 00df */ "germandbls",
-/* 00e0 */ "agrave",
-/* 00e1 */ "aacute",
-/* 00e2 */ "acircumflex",
-/* 00e3 */ "atilde",
-/* 00e4 */ "adieresis",
-/* 00e5 */ "aring",
-/* 00e6 */ "ae",
-/* 00e7 */ "ccedilla",
-/* 00e8 */ "egrave",
-/* 00e9 */ "eacute",
-/* 00ea */ "ecircumflex",
-/* 00eb */ "edieresis",
-/* 00ec */ "igrave",
-/* 00ed */ "iacute",
-/* 00ee */ "icircumflex",
-/* 00ef */ "idieresis",
-/* 00f0 */ "eth",
-/* 00f1 */ "ntilde",
-/* 00f2 */ "ograve",
-/* 00f3 */ "oacute",
-/* 00f4 */ "ocircumflex",
-/* 00f5 */ "otilde",
-/* 00f6 */ "odieresis",
-/* 00f7 */ "divide",
-/* 00f8 */ "oslash",
-/* 00f9 */ "ugrave",
-/* 00fa */ "uacute",
-/* 00fb */ "ucircumflex",
-/* 00fc */ "udieresis",
-/* 00fd */ "yacute",
-/* 00fe */ "thorn",
-/* 00ff */ "ydieresis"
- };
- copyenc(encoding,latin1enc);
-}
-
-char *AdobeExpertEncoding[] = {
-/* 0000 */ ".notdef",
-/* 0001 */ ".notdef",
-/* 0002 */ ".notdef",
-/* 0003 */ ".notdef",
-/* 0004 */ ".notdef",
-/* 0005 */ ".notdef",
-/* 0006 */ ".notdef",
-/* 0007 */ ".notdef",
-/* 0008 */ ".notdef",
-/* 0009 */ ".notdef",
-/* 000a */ ".notdef",
-/* 000b */ ".notdef",
-/* 000c */ ".notdef",
-/* 000d */ ".notdef",
-/* 000e */ ".notdef",
-/* 000f */ ".notdef",
-/* 0010 */ ".notdef",
-/* 0011 */ ".notdef",
-/* 0012 */ ".notdef",
-/* 0013 */ ".notdef",
-/* 0014 */ ".notdef",
-/* 0015 */ ".notdef",
-/* 0016 */ ".notdef",
-/* 0017 */ ".notdef",
-/* 0018 */ ".notdef",
-/* 0019 */ ".notdef",
-/* 001a */ ".notdef",
-/* 001b */ ".notdef",
-/* 001c */ ".notdef",
-/* 001d */ ".notdef",
-/* 001e */ ".notdef",
-/* 001f */ ".notdef",
-/* 0020 */ "space",
-/* 0021 */ "exclamsmall",
-/* 0022 */ "Hungarumlautsmal",
-/* 0023 */ ".notdef",
-/* 0024 */ "dollaroldstyle",
-/* 0025 */ "dollarsuperior",
-/* 0026 */ "ampersandsmall",
-/* 0027 */ "Acutesmall",
-/* 0028 */ "parenleftsuperior",
-/* 0029 */ "parenrightsuperior",
-/* 002a */ "twodotenleader",
-/* 002b */ "onedotenleader",
-/* 002c */ "comma",
-/* 002d */ "hyphen",
-/* 002e */ "period",
-/* 002f */ "fraction",
-/* 0030 */ "zerooldstyle",
-/* 0031 */ "oneoldstyle",
-/* 0032 */ "twooldstyle",
-/* 0033 */ "threeoldstyle",
-/* 0034 */ "fouroldstyle",
-/* 0035 */ "fiveoldstyle",
-/* 0036 */ "sixoldstyle",
-/* 0037 */ "sevenoldstyle",
-/* 0038 */ "eightoldstyle",
-/* 0039 */ "nineoldstyle",
-/* 003a */ "colon",
-/* 003b */ "semicolon",
-/* 003c */ "commasuperior",
-/* 003d */ "threequartersemdash",
-/* 003e */ "periodsuperior",
-/* 003f */ "questionsmall",
-/* 0040 */ ".notdef",
-/* 0041 */ "asuperior",
-/* 0042 */ "bsuperior",
-/* 0043 */ "centsuperior",
-/* 0044 */ "dsuperior",
-/* 0045 */ "esuperior",
-/* 0046 */ ".notdef",
-/* 0047 */ ".notdef",
-/* 0048 */ ".notdef",
-/* 0049 */ "isuperior",
-/* 004a */ ".notdef",
-/* 004b */ ".notdef",
-/* 004c */ "lsuperior",
-/* 004d */ "msuperior",
-/* 004e */ "nsuperior",
-/* 004f */ "osuperior",
-/* 0050 */ ".notdef",
-/* 0051 */ ".notdef",
-/* 0052 */ "rsuperior",
-/* 0053 */ "ssuperior",
-/* 0054 */ "tsuperior",
-/* 0055 */ ".notdef",
-/* 0056 */ "ff",
-/* 0057 */ "fi",
-/* 0058 */ "fl",
-/* 0059 */ "ffi",
-/* 005a */ "ffl",
-/* 005b */ "parenleftinferior",
-/* 005c */ ".notdef",
-/* 005d */ "parenrightinferior",
-/* 005e */ "Circumflexsmall",
-/* 005f */ "hyphensuperior",
-/* 0060 */ "Gravesmall",
-/* 0061 */ "Asmall",
-/* 0062 */ "Bsmall",
-/* 0063 */ "Csmall",
-/* 0064 */ "Dsmall",
-/* 0065 */ "Esmall",
-/* 0066 */ "Fsmall",
-/* 0067 */ "Gsmall",
-/* 0068 */ "Hsmall",
-/* 0069 */ "Ismall",
-/* 006a */ "Jsmall",
-/* 006b */ "Ksmall",
-/* 006c */ "Lsmall",
-/* 006d */ "Msmall",
-/* 006e */ "Nsmall",
-/* 006f */ "Osmall",
-/* 0070 */ "Psmall",
-/* 0071 */ "Qsmall",
-/* 0072 */ "Rsmall",
-/* 0073 */ "Ssmall",
-/* 0074 */ "Tsmall",
-/* 0075 */ "Usmall",
-/* 0076 */ "Vsmall",
-/* 0077 */ "Wsmall",
-/* 0078 */ "Xsmall",
-/* 0079 */ "Ysmall",
-/* 007a */ "Zsmall",
-/* 007b */ "colonmonetary",
-/* 007c */ "onefitted",
-/* 007d */ "rupiah",
-/* 007e */ "Tildesmall",
-/* 007f */ ".notdef",
-/* 0080 */ ".notdef",
-/* 0081 */ ".notdef",
-/* 0082 */ ".notdef",
-/* 0083 */ ".notdef",
-/* 0084 */ ".notdef",
-/* 0085 */ ".notdef",
-/* 0086 */ ".notdef",
-/* 0087 */ ".notdef",
-/* 0088 */ ".notdef",
-/* 0089 */ ".notdef",
-/* 008a */ ".notdef",
-/* 008b */ ".notdef",
-/* 008c */ ".notdef",
-/* 008d */ ".notdef",
-/* 008e */ ".notdef",
-/* 008f */ ".notdef",
-/* 0090 */ ".notdef",
-/* 0091 */ ".notdef",
-/* 0092 */ ".notdef",
-/* 0093 */ ".notdef",
-/* 0094 */ ".notdef",
-/* 0095 */ ".notdef",
-/* 0096 */ ".notdef",
-/* 0097 */ ".notdef",
-/* 0098 */ ".notdef",
-/* 0099 */ ".notdef",
-/* 009a */ ".notdef",
-/* 009b */ ".notdef",
-/* 009c */ ".notdef",
-/* 009d */ ".notdef",
-/* 009e */ ".notdef",
-/* 009f */ ".notdef",
-/* 00a0 */ ".notdef",
-/* 00a1 */ "exclamdownsmall",
-/* 00a2 */ "centoldstyle",
-/* 00a3 */ "Lslashsmall",
-/* 00a4 */ ".notdef",
-/* 00a5 */ ".notdef",
-/* 00a6 */ "Scaronsmall",
-/* 00a7 */ "Zcaronsmall",
-/* 00a8 */ "Dieresissmall",
-/* 00a9 */ "Brevesmall",
-/* 00aa */ "Caronsmall",
-/* 00ab */ ".notdef",
-/* 00ac */ "Dotaccentsmall",
-/* 00ad */ ".notdef",
-/* 00ae */ ".notdef",
-/* 00af */ "Macronsmall",
-/* 00b0 */ ".notdef",
-/* 00b1 */ ".notdef",
-/* 00b2 */ "figuredash",
-/* 00b3 */ "hypheninferior",
-/* 00b4 */ ".notdef",
-/* 00b5 */ ".notdef",
-/* 00b6 */ "Ogoneksmall",
-/* 00b7 */ "Ringsmall",
-/* 00b8 */ "Cedillasmall",
-/* 00b9 */ ".notdef",
-/* 00ba */ ".notdef",
-/* 00bb */ ".notdef",
-/* 00bc */ "onequarter",
-/* 00bd */ "onehalf",
-/* 00be */ "threequarters",
-/* 00bf */ "questiondownsmall",
-/* 00c0 */ "oneeighth",
-/* 00c1 */ "threeeighths",
-/* 00c2 */ "fiveeighths",
-/* 00c3 */ "seveneighths",
-/* 00c4 */ "onethird",
-/* 00c5 */ "twothirds",
-/* 00c6 */ ".notdef",
-/* 00c7 */ ".notdef",
-/* 00c8 */ "zerosuperior",
-/* 00c9 */ "onesuperior",
-/* 00ca */ "twosuperior",
-/* 00cb */ "threesuperior",
-/* 00cc */ "foursuperior",
-/* 00cd */ "fivesuperior",
-/* 00ce */ "sixsuperior",
-/* 00cf */ "sevensuperior",
-/* 00d0 */ "eightsuperior",
-/* 00d1 */ "ninesuperior",
-/* 00d2 */ "zeroinferior",
-/* 00d3 */ "oneinferior",
-/* 00d4 */ "twoinferior",
-/* 00d5 */ "threeinferior",
-/* 00d6 */ "fourinferior",
-/* 00d7 */ "fiveinferior",
-/* 00d8 */ "sixinferior",
-/* 00d9 */ "seveninferior",
-/* 00da */ "eightinferior",
-/* 00db */ "nineinferior",
-/* 00dc */ "centinferior",
-/* 00dd */ "dollarinferior",
-/* 00de */ "periodinferior",
-/* 00df */ "commainferior",
-/* 00e0 */ "Agravesmall",
-/* 00e1 */ "Aacutesmall",
-/* 00e2 */ "Acircumflexsmall",
-/* 00e3 */ "Atildesmall",
-/* 00e4 */ "Adieresissmall",
-/* 00e5 */ "Aringsmall",
-/* 00e6 */ "AEsmall",
-/* 00e7 */ "Ccedillasmall",
-/* 00e8 */ "Egravesmall",
-/* 00e9 */ "Eacutesmall",
-/* 00ea */ "Ecircumflexsmall",
-/* 00eb */ "Edieresissmall",
-/* 00ec */ "Igravesmall",
-/* 00ed */ "Iacutesmall",
-/* 00ee */ "Icircumflexsmall",
-/* 00ef */ "Idieresissmall",
-/* 00f0 */ "Ethsmall",
-/* 00f1 */ "Ntildesmall",
-/* 00f2 */ "Ogravesmall",
-/* 00f3 */ "Oacutesmall",
-/* 00f4 */ "Ocircumflexsmall",
-/* 00f5 */ "Otildesmall",
-/* 00f6 */ "Odieresissmall",
-/* 00f7 */ "OEsmall",
-/* 00f8 */ "Oslashsmall",
-/* 00f9 */ "Ugravesmall",
-/* 00fa */ "Uacutesmall",
-/* 00fb */ "Ucircumflexsmall",
-/* 00fc */ "Udieresissmall",
-/* 00fd */ "Yacutesmall",
-/* 00fe */ "Thornsmall",
-/* 00ff */ "Ydieresissmall"
-};
-
-static struct fontdict *MakeEmptyFont(void) {
- struct fontdict *ret;
-
- ret = gcalloc(1,sizeof(struct fontdict));
- ret->fontinfo = gcalloc(1,sizeof(struct fontinfo));
- ret->chars = gcalloc(1,sizeof(struct pschars));
- ret->private = gcalloc(1,sizeof(struct private));
- ret->private->subrs = gcalloc(1,sizeof(struct pschars));
- ret->private->private = gcalloc(1,sizeof(struct psdict));
- ret->private->leniv = 4;
- ret->encoding_name = &custom;
- ret->fontinfo->fstype = -1;
-return( ret );
-}
-
-static struct fontdict *PSMakeEmptyFont(void) {
- struct fontdict *ret;
-
- ret = gcalloc(1,sizeof(struct fontdict));
- ret->fontinfo = gcalloc(1,sizeof(struct fontinfo));
- ret->chars = gcalloc(1,sizeof(struct pschars));
- ret->private = gcalloc(1,sizeof(struct private));
- ret->private->subrs = gcalloc(1,sizeof(struct pschars));
- ret->private->private = gcalloc(1,sizeof(struct psdict));
- ret->private->leniv = 4;
- ret->charprocs = gcalloc(1,sizeof(struct charprocs));
- ret->encoding_name = &custom;
- ret->fontinfo->fstype = -1;
-return( ret );
-}
-
-static char *myfgets(char *str, int len, FILE *file) {
- char *pt, *end;
- int ch=0;
-
- for ( pt = str, end = str+len-1; pt<end && (ch=getc(file))!=EOF && ch!='\r' && ch!='\n';
- *pt++ = ch );
- if ( ch=='\n' )
- *pt++ = '\n';
- else if ( ch=='\r' ) {
- *pt++ = '\r';
- if ((ch=getc(file))!='\n' )
- ungetc(ch,file);
- else
- *pt++ = '\n';
- }
- if ( pt==str )
-return( NULL );
- *pt = '\0';
-return( str );
-}
-
-static char *myfgetsNoNulls(char *str, int len, FILE *file) {
- char *pt, *end;
- int ch=0;
-
- for ( pt = str, end = str+len-1; pt<end && (ch=getc(file))!=EOF && ch!='\r' && ch!='\n'; ) {
- if ( ch!='\0' )
- *pt++ = ch;
- }
- if ( ch=='\n' )
- *pt++ = '\n';
- else if ( ch=='\r' ) {
- *pt++ = '\r';
- if ((ch=getc(file))!='\n' )
- ungetc(ch,file);
- else
- *pt++ = '\n';
- }
- if ( pt==str )
-return( NULL );
- *pt = '\0';
-return( str );
-}
-
-static char *getstring(char *start,FILE *in) {
- char *end, *ret;
- int parencnt=0, len=0;
- char buffer[512];
-
- forever {
- while ( *start!='\0' && *start!='(' ) ++start;
- if ( *start=='\0' ) {
- if ( myfgetsNoNulls(buffer,sizeof(buffer),in)==NULL )
-return( copy(""));
- start = buffer;
- } else
- break;
- }
- ++start;
- ret = NULL; len = 1;
- forever {
- for ( end = start; *end!='\0' && (*end!=')' || parencnt>0); ++end ) {
- if ( *end=='\\' && (end[1]=='(' || end[1]==')'))
- ++end;
- else if ( *end=='(' ) ++parencnt;
- else if ( *end==')' ) --parencnt;
- }
- if ( end>start ) {
- if ( ret==NULL )
- ret = galloc(end-start+1);
- else
- ret = grealloc(ret,len+end-start);
- strncpy(ret+len-1,start,end-start);
- len += end-start;
- ret[len-1] = '\0';
- }
- if ( *end!='\0' )
- break;
- if ( myfgetsNoNulls(buffer,sizeof(buffer),in)==NULL )
-return( ret );
- start = buffer;
- }
-return( ret );
-}
-
-static char *gettoken(char *start) {
- char *end, *ret;
-
- while ( *start!='\0' && *start!='/' && *start!='(' ) ++start;
- if ( *start=='/' || *start=='(' ) ++start;
- for ( end = start; *end!='\0' && !isspace(*end) && *end!='[' && *end!='/' && *end!='{' && *end!='(' && *end!=')'; ++end );
- ret = galloc(end-start+1);
- if ( end>start )
- strncpy(ret,start,end-start);
- ret[end-start] = '\0';
-return( ret );
-}
-
-static int getbool(char *start) {
-
- while ( isspace(*start) ) ++start;
- if ( *start=='T' || *start=='t' )
-return( 1 );
-
-return( 0 );
-}
-
-static void fillintarray(int *array,char *start,int maxentries) {
- int i;
- char *end;
-
- while ( *start!='\0' && *start!='[' && *start!='{' ) ++start;
- if ( *start=='[' || *start=='{' ) ++start;
- for ( i=0; i<maxentries && *start!=']' && *start!='}'; ++i ) {
- array[i] = (int) strtod(start,&end);
- if ( start==end )
-return;
- start = end;
- while ( isspace(*start) ) ++start;
- }
-}
-
-static void fillrealarray(real *array,char *start,int maxentries) {
- int i;
- char *end;
-
- while ( *start!='\0' && *start!='[' && *start!='{' ) ++start;
- if ( *start=='[' || *start=='{' ) ++start;
- for ( i=0; i<maxentries && *start!=']' && *start!='}'; ++i ) {
- while ( isspace( *start )) ++start;
- if ( isdigit(*start) || *start=='-' || *start=='.' )
- array[i] = strtod(start,&end);
- else if ( strncmp(start,"div",3)==0 && i>=2 ) {
- /* Some of Luc Devroye's fonts have a "div" in the FontMatrix */
- array[i-2] /= array[i-1];
- i -= 2;
- end = start+3;
- } else
-return;
- if ( start==end )
-return;
- start = end;
- while ( isspace(*start) ) ++start;
- }
-}
-
-static void InitDict(struct psdict *dict,char *line) {
- while ( *line!='/' && *line!='\0' ) ++line;
- while ( !isspace(*line) && *line!='\0' ) ++line;
- dict->cnt += strtol(line,NULL,10);
- if ( dict->next>0 ) { int i; /* Shouldn't happen, but did in a bad file */
- dict->keys = grealloc(dict->keys,dict->cnt*sizeof(char *));
- dict->values = grealloc(dict->values,dict->cnt*sizeof(char *));
- for ( i=dict->next; i<dict->cnt; ++i ) {
- dict->keys[i] = NULL; dict->values[i] = NULL;
- }
- } else {
- dict->keys = gcalloc(dict->cnt,sizeof(char *));
- dict->values = gcalloc(dict->cnt,sizeof(char *));
- }
-}
-
-static void InitChars(struct pschars *chars,char *line) {
- while ( *line!='/' && *line!='\0' ) ++line;
- while ( !isspace(*line) && *line!='\0' ) ++line;
- chars->cnt = strtol(line,NULL,10);
- if ( chars->cnt>0 ) {
- chars->keys = gcalloc(chars->cnt,sizeof(char *));
- chars->values = gcalloc(chars->cnt,sizeof(char *));
- chars->lens = gcalloc(chars->cnt,sizeof(int));
- ff_progress_change_total(chars->cnt);
- }
-}
-
-static void InitCharProcs(struct charprocs *cp, char *line) {
- while ( *line!='/' && *line!='\0' ) ++line;
- while ( !isspace(*line) && *line!='\0' ) ++line;
- cp->cnt = strtol(line,NULL,10);
- if ( cp->cnt>0 ) {
- cp->keys = gcalloc(cp->cnt,sizeof(char *));
- cp->values = gcalloc(cp->cnt,sizeof(SplineChar *));
- ff_progress_change_total(cp->cnt);
- }
-}
-
-static int mycmp(char *str,char *within, char *end ) {
- while ( within<end ) {
- if ( *str!=*within )
-return( *str-*within );
- ++str; ++within;
- }
-return( *str=='\0'?0:1 );
-}
-
-static void ContinueValue(struct fontparse *fp, struct psdict *dict, char *line) {
- int incomment = false;
-
- while ( *line ) {
- if ( !fp->instring && fp->depth==0 &&
- (strncmp(line,"def",3)==0 ||
- strncmp(line,"|-",2)==0 || strncmp(line,"ND",2)==0)) {
- while ( 1 ) {
- while ( fp->vpt>fp->vbuf+1 && isspace(fp->vpt[-1]) )
- --fp->vpt;
- if ( fp->vpt>fp->vbuf+8 && strncmp(fp->vpt-8,"noaccess",8)==0 )
- fp->vpt -= 8;
- else if ( fp->vpt>fp->vbuf+8 && strncmp(fp->vpt-8,"readonly",8)==0 )
- fp->vpt -= 8;
- else if ( fp->vpt>fp->vbuf+4 && strncmp(fp->vpt-4,"bind",4)==0 )
- fp->vpt -= 4;
- else
- break;
- }
- /* In some URW fonts (Nimbus Sans L, n019003l) we get a complex */
- /* expression rather than just an array. This is ok. The expression */
- /* converts itself into an array. We could just truncate to the */
- /* default array, but I don't see any reason to do so */
- if ( fp->pending_parse!=NULL ) {
- *fp->pending_parse = copyn(fp->vbuf,fp->vpt-fp->vbuf);
- fp->pending_parse = NULL;
- } else {
- dict->values[dict->next] = copyn(fp->vbuf,fp->vpt-fp->vbuf);
- ++dict->next;
- }
- fp->vpt = fp->vbuf;
- fp->multiline = false;
-return;
- }
- if ( fp->vpt>=fp->vmax ) {
- int len = fp->vmax-fp->vbuf+1000, off=fp->vpt-fp->vbuf;
- fp->vbuf = grealloc(fp->vbuf,len);
- fp->vpt = fp->vbuf+off;
- fp->vmax = fp->vbuf+len;
- }
- if ( fp->instring ) {
- if ( *line==')' ) --fp->instring;
- } else if ( incomment ) {
- /* Do Nothing */;
- } else if ( *line=='(' )
- ++fp->instring;
- else if ( *line=='%' )
- incomment = true;
- else if ( *line=='[' || *line=='{' )
- ++fp->depth;
- else if ( *line=='}' || *line==']' )
- --fp->depth;
- *fp->vpt++ = *line++;
- }
-}
-
-static void AddValue(struct fontparse *fp, struct psdict *dict, char *line, char *endtok) {
- char *pt;
-
- if ( dict!=NULL ) {
- if ( dict->next>=dict->cnt ) {
- dict->cnt += 10;
- dict->keys = grealloc(dict->keys,dict->cnt*sizeof(char *));
- dict->values = grealloc(dict->values,dict->cnt*sizeof(char *));
- }
- dict->keys[dict->next] = copyn(line+1,endtok-(line+1));
- }
- pt = line+strlen(line)-1;
- while ( isspace(*endtok)) ++endtok;
- while ( pt>endtok && isspace(*pt)) --pt;
- ++pt;
- if ( strncmp(pt-3,"def",3)==0 )
- pt -= 3;
- else if ( strncmp(pt-2,"|-",2)==0 || strncmp(pt-2,"ND",2)==0 )
- pt -= 2;
- else {
- fp->multiline = true;
- ContinueValue(fp,dict,endtok);
-return;
- }
- forever {
- while ( pt-1>endtok && isspace(pt[-1])) --pt;
- if ( pt-8>endtok && strncmp(pt-8,"noaccess",8)==0 )
- pt -= 8;
- else if ( pt-8>endtok && strncmp(pt-8,"readonly",8)==0 )
- pt -= 8;
- else if ( pt-4>endtok && strncmp(pt-4,"bind",4)==0 )
- pt -= 4;
- else
- break;
- }
- if ( dict!=NULL ) {
- dict->values[dict->next] = copyn(endtok,pt-endtok);
- ++dict->next;
- } else {
- *fp->pending_parse = copyn(endtok,pt-endtok);
- fp->pending_parse = NULL;
- }
-}
-
-static int hex(int ch1, int ch2) {
- if ( ch1>='0' && ch1<='9' )
- ch1 -= '0';
- else if ( ch1>='a' )
- ch1 -= 'a'-10;
- else
- ch1 -= 'A'-10;
- if ( ch2>='0' && ch2<='9' )
- ch2 -= '0';
- else if ( ch2>='a' )
- ch2 -= 'a'-10;
- else
- ch2 -= 'A'-10;
-return( (ch1<<4)|ch2 );
-}
-
-unsigned short r;
-#define c1 52845
-#define c2 22719
-
-static void initcode(void) {
- r = 55665;
-}
-
-static int decode(unsigned char cypher) {
- unsigned char plain = ( cypher ^ (r>>8));
- r = (cypher + r) * c1 + c2;
-return( plain );
-}
-
-static void dumpzeros(FILE *out, unsigned char *zeros, int zcnt) {
- while ( --zcnt >= 0 )
- fputc(*zeros++,out);
-}
-
-static void decodestr(unsigned char *str, int len) {
- unsigned short r = 4330;
- unsigned char plain, cypher;
-
- while ( len-->0 ) {
- cypher = *str;
- plain = ( cypher ^ (r>>8));
- r = (cypher + r) * c1 + c2;
- *str++ = plain;
- }
-}
-
-static void findstring(struct fontparse *fp,struct pschars *subrs,int index,char *nametok,char *str) {
- char buffer[1024], *bpt, *bs, *end = buffer+sizeof(buffer)-1;
- int val;
-
- while ( isspace(*str)) ++str;
- if ( *str=='(' ) {
- ++str;
- bpt = buffer;
- while ( *str!=')' && *str!='\0' ) {
- if ( *str!='\\' )
- val = *str++;
- else {
- if ( isdigit( *++str )) {
- val = *str++-'0';
- if ( isdigit( *str )) {
- val = (val<<3) | (*str++-'0');
- if ( isdigit( *str ))
- val = (val<<3) | (*str++-'0');
- }
- } else
- val = *str++;
- }
- if ( bpt<end )
- *bpt++ = val;
- }
- decodestr((unsigned char *) buffer,bpt-buffer);
- bs = buffer + fp->fd->private->leniv;
- if ( bpt<bs ) bs=bpt; /* garbage */
- subrs->lens[index] = bpt-bs;
- subrs->keys[index] = copy(nametok);
- subrs->values[index] = galloc(bpt-bs);
- memcpy(subrs->values[index],bs,bpt-bs);
- if ( index>=subrs->next ) subrs->next = index+1;
- }
-}
-
-/* Type42 charstrings are actually numbers */
-static void findnumbers(struct fontparse *fp,struct pschars *chars,char *str) {
- int val;
- char *end;
- (void)fp;
- forever {
- int index = chars->next;
- char *namestrt;
-
- while ( isspace(*str)) ++str;
- if ( *str!='/' )
- break;
- namestrt = ++str;
- while ( isalnum(*str) || *str=='.' ) ++str;
- *str = '\0';
- index = chars->next;
-
- ++str;
- val = strtol(str,&end,10);
- chars->lens[index] = 0;
- chars->keys[index] = copy(namestrt);
- chars->values[index] = (void *) (intpt) val;
- chars->next = index+1;
- str = end;
- while ( isspace(*str)) ++str;
- if ( str[0]=='d' && str[1]=='e' && str[2]=='f' )
- str += 3;
- }
-}
-
-static char *rmbinary(char *line) {
- char *pt;
-
- for ( pt=line; *pt; ++pt ) {
- if (( *pt<' ' || *pt>=0x7f ) && *pt!='\n' ) {
- if ( strlen(pt)>5 ) {
- pt[0] = '.';
- pt[1] = '.';
- pt[2] = '.';
- pt[3] = '\n';
- pt[4] = '\0';
- } else {
- pt[0] = '\n';
- pt[1] = '\0';
- }
- break;
- }
- }
-return( line );
-}
-
-static void sfnts2tempfile(struct fontparse *fp,FILE *in,char *line) {
- char *pt;
- int instring = false, firstnibble=true, sofar=0, nibble;
- int complained = false;
- int ch=0;
-
- fp->sfnts = tmpfile();
-
- /* first finish off anything in the current line */
- while ( (pt=strpbrk(line,"<]" ))!=NULL ) {
- if ( *pt==']' )
- goto skip_to_eol;
-
- instring = true;
- for ( ++pt; *pt && *pt!='>'; ++pt ) {
- if ( isspace(*pt))
- continue;
- if ( isdigit(*pt))
- nibble = *pt-'0';
- else if ( *pt>='a' && *pt<='f' )
- nibble = *pt-'a'+10;
- else if ( *pt>='A' && *pt<='F' )
- nibble = *pt-'A'+10;
- else {
- if ( !complained ) {
- LogError( _("Invalid hex digit in sfnts array\n") );
- complained = true;
- }
- ++pt;
- continue;
- }
- if ( firstnibble ) {
- sofar = nibble<<4;
- firstnibble = false;
- } else {
- putc(sofar|nibble,fp->sfnts);
- sofar = 0;
- firstnibble = true;
- }
- }
- if ( *pt=='>' ) {
- if ( ftell(fp->sfnts)&1 ) { /* Strings must be contain an even number of bytes */
- /* But may be padded with a trailing NUL */
- fseek(fp->sfnts,-1,SEEK_CUR);
- }
- ++pt;
- instring = false;
- }
- line = pt;
- }
-
- while ( (ch=getc(in))!=EOF ) {
- if ( ch==']' )
- goto skip_to_eol;
- if ( isspace(ch))
- continue;
- if ( !instring && ch=='<' ) {
- instring = true;
- firstnibble = true;
- sofar = 0;
- } else if ( !instring ) {
- if ( !complained ) {
- LogError( _("Invalid character outside of string in sfnts array\n") );
- complained = true;
- }
- } else if ( instring && ch=='>' ) {
- if ( ftell(fp->sfnts)&1 ) { /* Strings must be contain an even number of bytes */
- /* But may be padded with a trailing NUL */
- fseek(fp->sfnts,-1,SEEK_CUR);
- }
- instring = false;
- } else {
- if ( isdigit(ch))
- nibble = ch-'0';
- else if ( ch>='a' && ch<='f' )
- nibble = ch-'a'+10;
- else if ( ch>='A' && ch<='F' )
- nibble = ch-'A'+10;
- else {
- if ( !complained ) {
- LogError( _("Invalid hex digit in sfnts array\n") );
- complained = true;
- }
- continue;
- }
- if ( firstnibble ) {
- sofar = nibble<<4;
- firstnibble = false;
- } else {
- putc(sofar|nibble,fp->sfnts);
- sofar = 0;
- firstnibble = true;
- }
- }
- }
- skip_to_eol:
- while ( ch!=EOF && ch!='\n' && ch!='\r' )
- ch = getc(in);
- rewind(fp->sfnts);
-}
-
-static void ParseSimpleEncoding(struct fontparse *fp,char *line) {
- char tok[200], *pt;
-
- while ( *line!='\0' && *line!=']' ) {
- while ( isspace(*line)) ++line;
- if ( *line==']' )
- break;
- if ( *line!='/' ) {
- ++line;
- continue;
- }
- ++line;
- while ( isspace(*line)) ++line;
- for ( pt=tok; !isspace(*line) && *line!='\0' && *line!='/' && *line!=']'; ) {
- if ( pt<tok+sizeof(tok)-2 )
- *pt++ = *line++;
- else
- ++line;
- }
- *pt = '\0';
- if ( fp->simple_enc_pos<256 )
- fp->fd->encoding[fp->simple_enc_pos++] = copy(tok);
- }
- if ( *line==']' ) {
- fp->simpleencoding = false;
- fp->inencoding = false;
- }
-}
-
-static void parseline(struct fontparse *fp,char *line,FILE *in) {
- char buffer[200], *pt, *endtok;
-
- while ( *line==' ' || *line=='\t' ) ++line;
- if ( line[0]=='%' && !fp->multiline )
-return;
-
- if ( fp->simpleencoding ) {
- ParseSimpleEncoding(fp,line);
-return;
- } else if (( fp->inencoding && strncmp(line,"dup",3)==0 ) ||
- ( strncmp(line,"dup ",4)==0 && isdigit(line[4]) &&
- strstr(line+strlen(line)-6," put")!=NULL && strchr(line,'/')!=NULL )) {
- /* Fontographer's type3 fonts claim to be standard, but then aren't */
- fp->fd->encoding_name = &custom;
- /* Metamorphasis has multiple entries on a line */
- while ( strncmp(line,"dup",3)==0 ) {
- char *end;
- int pos = strtol(line+3,&end,10);
- line = end;
- while ( isspace( *line )) ++line;
- if ( *line=='/' ) ++line;
- for ( pt = buffer; !isspace(*line); *pt++ = *line++ );
- *pt = '\0';
- if ( pos>=0 && pos<256 ) {
- free(fp->fd->encoding[pos]);
- fp->fd->encoding[pos] = copy(buffer);
- }
- while ( isspace(*line)) ++line;
- if ( strncmp(line,"put",3)==0 ) line+=3;
- while ( isspace(*line)) ++line;
- }
-return;
- } else if ( fp->inencoding && strstr(line,"for")!=NULL && strstr(line,"/.notdef")!=NULL ) {
- /* the T1 spec I've got doesn't allow for this, but I've seen it anyway*/
- /* 0 1 255 {1 index exch /.notdef put} for */
- /* 0 1 31 { 1 index exch /.notdef put } bind for */
- int i;
- for ( i=0; i<256; ++i )
- if ( fp->fd->encoding[i]==NULL )
- fp->fd->encoding[i] = copy(".notdef");
-return;
- } else if ( fp->inencoding && strstr(line,"Encoding")!=NULL && strstr(line,"put")!=NULL ) {
- /* Saw a type 3 font with lines like "Encoding 1 /_a0 put" */
- char *end;
- int pos;
- while ( isspace(*line)) ++line;
- if ( strncmp(line,"Encoding ",9)==0 ) {
- line+=9;
- pos = strtol(line,&end,10);
- line = end;
- while ( isspace(*line)) ++line;
- if ( *line=='/' ) {
- ++line;
- for ( pt = buffer; !isspace(*line); *pt++ = *line++ );
- *pt = '\0';
- if ( pos>=0 && pos<256 )
- fp->fd->encoding[pos] = copy(buffer);
- }
- }
-return;
- } else if ( fp->insubs ) {
- struct pschars *subrs = fp->fd->private->subrs;
- while ( isspace(*line)) ++line;
- if ( strncmp(line,"dup ",4)==0 ) {
- int i;
- char *ept;
- for ( line += 4; *line==' '; ++line );
- i = strtol(line,&ept,10);
- if ( fp->ignore )
- /* Do Nothing */;
- else if ( i<subrs->cnt ) {
- findstring(fp,subrs,i,NULL,ept);
- } else if ( !fp->alreadycomplained ) {
- LogError( _("Index too big (must be <%d) \"%s"), subrs->cnt, rmbinary(line));
- fp->alreadycomplained = true;
- }
- } else if ( strncmp(line, "readonly put", 12)==0 || strncmp(line, "ND", 2)==0 || strncmp(line, "|-", 2)==0 ) {
- fp->insubs = false;
- fp->ignore = false;
- } else if ( *line=='\n' || *line=='\0' ) {
- /* Ignore blank lines */;
- } else if ( !fp->alreadycomplained ) {
- LogError( _("Didn't understand \"%s"), rmbinary(line) );
- fp->alreadycomplained = true;
- }
- } else if ( fp->inchars ) {
- struct pschars *chars = fp->fd->chars;
- while ( isspace(*line)) ++line;
- if ( strncmp(line,"end",3)==0 )
- fp->ignore = fp->inchars = false;
- else if ( *line=='\n' || *line=='\0' )
- /* Ignore it */;
- else if ( *line!='/' || !(isalpha(line[1]) || line[1]=='.')) {
- LogError( _("No name for CharStrings dictionary \"%s"), rmbinary(line) );
- fp->alreadycomplained = true;
- } else if ( fp->ignore ) {
- /* Do Nothing */;
- } else if ( chars->next>=chars->cnt )
- LogError( _("Too many entries in CharStrings dictionary \"%s"), rmbinary(line) );
- else if ( fp->fd->fonttype==42 || fp->fd->fonttype==11 || fp->fd->cidfonttype==2 )
- findnumbers(fp,chars,line);
- else {
- int i = chars->next;
- char *namestrt = ++line;
- while ( isalnum(*line) || *line=='.' ) ++line;
- *line = '\0';
- findstring(fp,chars,i,namestrt,line+1);
- ff_progress_next();
- }
-return;
- }
- fp->inencoding = 0;
-
- while ( isspace(*line)) ++line;
- endtok = NULL;
- if ( *line=='/' )
- for ( endtok=line+1; !isspace(*endtok) && *endtok!='(' && *endtok!='/' &&
- *endtok!='{' && *endtok!='[' && *endtok!='\0'; ++endtok );
-
- if ( strstr(line,"/shareddict")!=NULL && strstr(line,"where")!=NULL ) {
- fp->infi = fp->inbb = fp->inmetrics = fp->inmetrics2 = false;
- fp->inprivate = fp->inblendprivate = fp->inblendfi = false;
- fp->skipping_mbf = true;
-return;
- }
-
- if ( mycmp("Encoding",line+1,endtok)==0 && !fp->doneencoding ) {
- if ( strstr(endtok,"StandardEncoding")!=NULL ) {
- fp->fd->encoding_name = FindOrMakeEncoding("AdobeStandard");
- setStdEnc(fp->fd->encoding);
- } else if ( strstr(endtok,"ISOLatin1Encoding")!=NULL ) {
- fp->fd->encoding_name = FindOrMakeEncoding("ISO8859-1");
- setLatin1Enc(fp->fd->encoding);
- } else {
- fp->fd->encoding_name = &custom;
- fp->inencoding = 1;
- }
- if ( fp->fd->encoding_name==NULL )
- fp->fd->encoding_name = &custom;
- fp->infi = fp->inprivate = fp->inbb = fp->inmetrics = fp->inmetrics2 = false;
- fp->doneencoding = true;
- while ( *endtok==' ' || *endtok=='\t' ) ++endtok;
- if ( *endtok=='[' ) { /* It's a literal array */
- fp->simpleencoding = true;
- fp->simple_enc_pos = 0;
- ParseSimpleEncoding(fp,endtok+1);
- }
- } else if ( mycmp("BoundingBoxes",line+1,endtok)==0 ) {
- fp->infi = fp->inprivate = fp->inencoding = fp->inmetrics = fp->inmetrics2 = false;
- fp->inbb = true;
- } else if ( mycmp("Metrics",line+1,endtok)==0 ) {
- fp->infi = fp->inprivate = fp->inbb = fp->inencoding = fp->inmetrics2 = false;
- fp->inmetrics = true;
- fp->fd->metrics = gcalloc(1,sizeof(struct psdict));
- fp->fd->metrics->cnt = strtol(endtok,NULL,10);
- fp->fd->metrics->keys = galloc(fp->fd->metrics->cnt*sizeof(char *));
- fp->fd->metrics->values = galloc(fp->fd->metrics->cnt*sizeof(char *));
- } else if ( strstr(line,"/Private")!=NULL && strstr(line,"/Blend")!=NULL ) {
- fp->infi = fp->inbb = fp->inmetrics = fp->inmetrics2 = false;
- fp->inprivate = fp->inblendprivate = fp->inblendfi = false;
- fp->inblendprivate = 1;
- fp->fd->blendprivate = gcalloc(1,sizeof(struct psdict));
- InitDict(fp->fd->blendprivate,line);
-return;
- } else if ( strstr(line,"/FontInfo")!=NULL && strstr(line,"/Blend")!=NULL ) {
- fp->infi = fp->inbb = fp->inmetrics = fp->inmetrics2 = false;
- fp->inprivate = fp->inblendprivate = fp->inblendfi = false;
- fp->inblendfi = 1;
- fp->fd->blendfontinfo = gcalloc(1,sizeof(struct psdict));
- InitDict(fp->fd->blendfontinfo,line);
-return;
- } else if ( fp->infi ) {
- if ( fp->multiline ) {
- ContinueValue(fp,NULL,line);
-return;
- }
- if ( endtok==NULL && (strncmp(line,"end", 3)==0 || strncmp(line,">>",2)==0)) {
- fp->infi=0;
-return;
- } else if ( endtok==NULL )
-return;
- if ( mycmp("version",line+1,endtok)==0 ) {
- free(fp->fd->fontinfo->version);
- fp->fd->fontinfo->version = getstring(endtok,in);
- } else if ( mycmp("Notice",line+1,endtok)==0 ) {
- if ( fp->fd->fontinfo->notice!=NULL )
- free(fp->fd->fontinfo->notice);
- fp->fd->fontinfo->notice = getstring(endtok,in);
- } else if ( mycmp("Copyright",line+1,endtok)==0 ) { /* cff spec allows for copyright and notice */
- if ( fp->fd->fontinfo->notice!=NULL )
- free(fp->fd->fontinfo->notice);
- fp->fd->fontinfo->notice = getstring(endtok,in);
- } else if ( mycmp("FullName",line+1,endtok)==0 ) {
- if ( fp->fd->fontinfo->fullname==NULL )
- fp->fd->fontinfo->fullname = getstring(endtok,in);
- else
- free(getstring(endtok,in));
- } else if ( mycmp("FamilyName",line+1,endtok)==0 ) {
- free( fp->fd->fontinfo->familyname );
- fp->fd->fontinfo->familyname = getstring(endtok,in);
- } else if ( mycmp("Weight",line+1,endtok)==0 ) {
- free( fp->fd->fontinfo->weight );
- fp->fd->fontinfo->weight = getstring(endtok,in);
- } else if ( mycmp("ItalicAngle",line+1,endtok)==0 )
- fp->fd->fontinfo->italicangle = strtod(endtok,NULL);
- else if ( mycmp("UnderlinePosition",line+1,endtok)==0 )
- fp->fd->fontinfo->underlineposition = strtod(endtok,NULL);
- else if ( mycmp("UnderlineThickness",line+1,endtok)==0 )
- fp->fd->fontinfo->underlinethickness = strtod(endtok,NULL);
- else if ( mycmp("isFixedPitch",line+1,endtok)==0 )
- fp->fd->fontinfo->isfixedpitch = getbool(endtok);
- else if ( mycmp("em",line+1,endtok)==0 )
- fp->fd->fontinfo->em = strtol(endtok,NULL,10);
- else if ( mycmp("ascent",line+1,endtok)==0 )
- fp->fd->fontinfo->ascent = strtol(endtok,NULL,10);
- else if ( mycmp("descent",line+1,endtok)==0 )
- fp->fd->fontinfo->descent = strtol(endtok,NULL,10);
- else if ( mycmp("FSType",line+1,endtok)==0 )
- fp->fd->fontinfo->fstype = strtol(endtok,NULL,10);
- else if ( mycmp("BlendDesignPositions",line+1,endtok)==0 ) {
- fp->pending_parse = &fp->fd->fontinfo->blenddesignpositions;
- AddValue(fp,NULL,line,endtok);
- } else if ( mycmp("BlendDesignMap",line+1,endtok)==0 ) {
- fp->pending_parse = &fp->fd->fontinfo->blenddesignmap;
- AddValue(fp,NULL,line,endtok);
- } else if ( mycmp("BlendAxisTypes",line+1,endtok)==0 ) {
- fp->pending_parse = &fp->fd->fontinfo->blendaxistypes;
- AddValue(fp,NULL,line,endtok);
- } else if ( !fp->alreadycomplained ) {
- LogError( _("Didn't understand \"%s"), rmbinary(line) );
- fp->alreadycomplained = true;
- }
- } else if ( fp->inblend ) {
- if ( endtok==NULL ) {
- if ( *line!='/' && strstr(line,"end")!=NULL )
- fp->inblend = false;
-return;
- }
- /* Ignore anything in the blend dict defn */
- } else if ( fp->inblendprivate || fp->inblendfi ) {
- struct psdict *subdict = fp->inblendfi ? fp->fd->blendfontinfo : fp->fd->blendprivate;
- if ( fp->multiline ) {
- ContinueValue(fp,subdict,line);
-return;
- } else if ( endtok==NULL ) {
- if ( *line!='/' && strstr(line,"end")!=NULL ) {
- fp->inblendprivate = fp->inblendfi = false;
- fp->inprivate = true;
- }
-return;
- } else
- AddValue(fp,subdict,line,endtok);
- } else if ( fp->inprivate ) {
- if ( strstr(line,"/CharStrings")!=NULL && strstr(line,"dict")!=NULL ) {
- if ( fp->fd->chars->next==0 ) {
- InitChars(fp->fd->chars,line);
- fp->ignore = false;
- } else {
- fp->ignore = true;
- LogError( _("Ignoring duplicate /CharStrings entry\n") );
- }
- fp->inchars = 1;
- fp->insubs = 0;
-return;
- } else if ( strstr(line,"/Subrs")!=NULL ) {
- if ( fp->fd->private->subrs->next>0 ) {
- fp->ignore = true;
- LogError( _("Ignoring duplicate /Subrs entry\n") );
- } else {
- InitChars(fp->fd->private->subrs,line);
- fp->ignore = false;
- }
- fp->insubs = 1;
- fp->inchars = 0;
-return;
- } else if ( fp->multiline ) {
- ContinueValue(fp,fp->fd->private->private,line);
-return;
- }
- if ( endtok==NULL ) {
- char *pt = line;
- if ( *pt!='/' ) while ( (pt=strstr(pt,"end"))!=NULL ) {
- if ( fp->inchars ) fp->inchars = false;
- else fp->inprivate = false;
- pt += 3;
- }
-return;
- }
- if ( mycmp("ND",line+1,endtok)==0 || mycmp("|-",line+1,endtok)==0 ||
- mycmp("NP",line+1,endtok)==0 || mycmp("|",line+1,endtok)==0 ||
- mycmp("RD",line+1,endtok)==0 || mycmp("-|",line+1,endtok)==0 ||
- mycmp("password",line+1,endtok)==0 ||
- mycmp("MinFeature",line+1,endtok)==0 )
- /* These conveigh no information, but are required */;
- else if ( mycmp("UniqueID",line+1,endtok)==0 ) {
- if ( fp->fd->uniqueid==0 )
- fp->fd->uniqueid = strtol(endtok,NULL,10);
- } else {
- if ( mycmp("lenIV",line+1,endtok)==0 )
- fp->fd->private->leniv = strtol(endtok,NULL,10); /* We need this value */
- AddValue(fp,fp->fd->private->private,line,endtok);
- }
- } else if ( fp->incidsysteminfo ) {
- if ( endtok==NULL && strncmp(line,"end", 3)==0 ) {
- fp->incidsysteminfo=0;
-return;
- } else if ( endtok==NULL )
-return;
- if ( mycmp("Registry",line+1,endtok)==0 ) {
- free( fp->fd->registry );
- fp->fd->registry = getstring(endtok,in);
- } else if ( mycmp("Ordering",line+1,endtok)==0 ) {
- free( fp->fd->ordering );
- fp->fd->ordering = getstring(endtok,in);
- } else if ( mycmp("Supplement",line+1,endtok)==0 ) /* cff spec allows for copyright and notice */
- fp->fd->supplement = strtol(endtok,NULL,0);
- } else {
- if ( strstr(line,"/Private")!=NULL && (strstr(line,"dict")!=NULL || strstr(line,"<<")!=NULL )) {
- fp->infi = fp->inbb = fp->inmetrics = fp->inmetrics2 = false;
- fp->inprivate = fp->inblendprivate = fp->inblendfi = false;
- if ( strstr(line,"/Blend")!=NULL ) {
- fp->inblendprivate = 1;
- fp->fd->blendprivate = gcalloc(1,sizeof(struct psdict));
- InitDict(fp->fd->blendprivate,line);
- } else {
- fp->inprivate = 1;
- InitDict(fp->fd->private->private,line);
- }
-return;
- } else if ( strstr(line,"/FontInfo")!=NULL && (strstr(line,"dict")!=NULL || strstr(line,"<<")!=NULL)) {
- fp->inprivate = fp->inbb = fp->inmetrics = fp->inmetrics2 = false;
- fp->infi = fp->inblendprivate = fp->inblendfi = false;
- if ( strstr(line,"/Blend")!=NULL ) {
- fp->inblendfi = 1;
- fp->fd->blendfontinfo = gcalloc(1,sizeof(struct psdict));
- InitDict(fp->fd->blendfontinfo,line);
- } else {
- fp->infi = 1;
- }
-return;
- } else if ( strstr(line,"/Blend")!=NULL && strstr(line,"dict")!=NULL ) {
- fp->inprivate = fp->inbb = fp->inmetrics = fp->inmetrics2 = false;
- fp->infi = fp->inblendprivate = fp->inblendfi = false;
- fp->inblend = true;
-return;
- } else if ( strstr(line,"/sfnts")!=NULL && strstr(line,"[")!=NULL ) {
- sfnts2tempfile(fp,in,line);
-return;
- } else if ( strstr(line,"/CharStrings")!=NULL && strstr(line,"dict")!=NULL
- && fp->fd->fonttype!=3 ) {
- if ( fp->fd->chars->next==0 ) {
- InitChars(fp->fd->chars,line);
- fp->ignore = false;
- } else {
- fp->ignore = true;
- LogError( _("Ignoring duplicate /CharStrings entry\n") );
- }
- fp->inchars = 1;
- fp->insubs = 0;
- fp->infi = fp->inprivate = fp->inbb = fp->inmetrics = fp->inmetrics2 = false;
- fp->inblendprivate = fp->inblendfi = false;
-return;
- } else if ( mycmp("/CharProcs",line,endtok)==0 ) {
- InitCharProcs(fp->fd->charprocs,line);
- fp->infi = fp->inprivate = fp->inbb = fp->inmetrics = fp->inmetrics2 = false;
- fp->insubs = 0;
-return;
- } else if ( strstr(line,"/CIDSystemInfo")!=NULL ) {
- fp->incidsysteminfo = 1;
-return;
- } else if ( fp->inmetrics ) {
- if ( endtok!=NULL )
- AddValue(fp,fp->fd->metrics,line,endtok);
-return;
- } else if ( fp->inbb ) {
- /* Ignore it */;
-return;
- }
-
- if ( fp->multiline ) {
- ContinueValue(fp,NULL,line);
-return;
- }
-
- if ( endtok==NULL ) {
- if ( fp->skipping_mbf )
- ;
- else if ( fp->fdindex!=-1 && strstr(line,"end")!=NULL ) {
- if ( ++fp->fdindex>=fp->mainfd->fdcnt )
- fp->fd = fp->mainfd;
- else
- fp->fd = fp->mainfd->fds[fp->fdindex];
- }
-return;
- }
- if ( mycmp("FontName",line+1,endtok)==0 ) {
- if ( fp->fd->fontname==NULL )
- fp->fd->fontname = gettoken(endtok);
- else
- free(gettoken(endtok)); /* skip it */
- } else if ( mycmp("PaintType",line+1,endtok)==0 )
- fp->fd->painttype = strtol(endtok,NULL,10);
- else if ( mycmp("FontType",line+1,endtok)==0 )
- fp->fd->fonttype = strtol(endtok,NULL,10);
- else if ( mycmp("FontMatrix",line+1,endtok)==0 ) {
- if ( fp->fd->fontmatrix[0]==0 )
- fillrealarray(fp->fd->fontmatrix,endtok,6);
- else {
- real temp[6];
- fillrealarray(temp,endtok,6);
- }
- } else if ( mycmp("LanguageLevel",line+1,endtok)==0 )
- fp->fd->languagelevel = strtol(endtok,NULL,10);
- else if ( mycmp("WMode",line+1,endtok)==0 )
- fp->fd->wmode = strtol(endtok,NULL,10);
- else if ( mycmp("FontBBox",line+1,endtok)==0 )
- fillrealarray(fp->fd->fontbb,endtok,4);
- else if ( mycmp("UniqueID",line+1,endtok)==0 ) {
- if ( fp->fd->uniqueid==0 )
- fp->fd->uniqueid = strtol(endtok,NULL,10);
- } else if ( mycmp("UniqueId",line+1,endtok)==0 ) {
- LogError(_("This font contains a \"UniqueId\" variable, but the correct name for it is\n\t\"UniqueID\" (postscript is case concious)\n") );
- if ( fp->fd->uniqueid==0 )
- fp->fd->uniqueid = strtol(endtok,NULL,10);
- } else if ( mycmp("XUID",line+1,endtok)==0 ) {
- if ( fp->fd->xuid[0]==0 )
- fillintarray(fp->fd->xuid,endtok,20);
- } else if ( mycmp("StrokeWidth",line+1,endtok)==0 )
- fp->fd->strokewidth = strtod(endtok,NULL);
- else if ( mycmp("WeightVector",line+1,endtok)==0 ) {
- if ( fp->fd->weightvector==NULL ) {
- fp->pending_parse = &fp->fd->weightvector;
- AddValue(fp,NULL,line,endtok);
- }
- } else if ( mycmp("$Blend",line+1,endtok)==0 ) {
- fp->pending_parse = &fp->fd->blendfunc;
- AddValue(fp,NULL,line,endtok);
- } else if ( strstr( line,"/NormalizeDesignVector" )!=NULL ) {
- fp->pending_parse = &fp->fd->ndv;
- AddValue(fp,NULL,line,endtok);
- } else if ( strstr( line,"/ConvertDesignVector" )!=NULL ) {
- fp->pending_parse = &fp->fd->cdv;
- AddValue(fp,NULL,line,endtok);
- } else if ( mycmp("BuildChar",line+1,endtok)==0 )
- /* Do Nothing */;
- else if ( mycmp("BuildGlyph",line+1,endtok)==0 )
- /* Do Nothing */;
- else if ( mycmp("CIDFontName",line+1,endtok)==0 ) {
- free( fp->fd->cidfontname );
- fp->fd->cidfontname = gettoken(endtok);
- } else if ( mycmp("CIDFontVersion",line+1,endtok)==0 ) {
- fp->fd->cidversion = strtod(endtok,NULL);
-#if 0
- if ( fp->fd->fontinfo->version==NULL ) {
- char temp[40];
- sprintf(temp,"%f", fp->fd->cidversion);
- fp->fd->fontinfo->version = copy(temp);
- }
-#endif
- } else if ( mycmp("CIDFontType",line+1,endtok)==0 )
- fp->fd->cidfonttype = strtol(endtok,NULL,10);
- else if ( mycmp("UIDBase",line+1,endtok)==0 )
- fp->fd->uniqueid = strtol(endtok,NULL,10);
- else if ( mycmp("CIDMapOffset",line+1,endtok)==0 )
- fp->fd->mapoffset = strtol(endtok,NULL,10);
- else if ( mycmp("FDBytes",line+1,endtok)==0 )
- fp->fd->fdbytes = strtol(endtok,NULL,10);
- else if ( mycmp("GDBytes",line+1,endtok)==0 )
- fp->fd->gdbytes = strtol(endtok,NULL,10);
- else if ( mycmp("CIDCount",line+1,endtok)==0 )
- fp->fd->cidcnt = strtol(endtok,NULL,10);
- else if ( mycmp("FDArray",line+1,endtok)==0 ) { int i;
- fp->mainfd = fp->fd;
- fp->fd->fdcnt = strtol(endtok,NULL,10);
- fp->fd->fds = gcalloc(fp->fd->fdcnt,sizeof(struct fontdict *));
- for ( i=0; i<fp->fd->fdcnt; ++i )
- fp->fd->fds[i] = MakeEmptyFont();
- fp->fdindex = 0;
- fp->fd = fp->fd->fds[0];
- } else if ( mycmp("FontSetInit",line+1,endtok)==0 ) {
- fp->iscff = true;
- fp->iscid = false;
- } else if ( mycmp("CIDInit",line+1,endtok)==0 ) {
- fp->iscid = true;
- fp->iscff = false;
- } else if ( fp->skipping_mbf ) { /* Skip over the makeblendedfont defn in a multimaster font */
- /* Do Nothing */
- } else if ( !fp->alreadycomplained ) {
- LogError( _("Didn't understand \"%s"), rmbinary(line) );
- fp->alreadycomplained = true;
- }
- }
-}
-
-static void addinfo(struct fontparse *fp,char *line,char *tok,char *binstart,int binlen,FILE *in) {
- char *pt;
-
- decodestr((unsigned char *) binstart,binlen);
- binstart += fp->fd->private->leniv;
- binlen -= fp->fd->private->leniv;
- if ( binlen<0 ) {
- LogError( _("Bad CharString. Does not include lenIV bytes.\n") );
-return;
- }
-
- retry:
- if ( fp->insubs ) {
- struct pschars *chars = /*fp->insubs ?*/ fp->fd->private->subrs /*: fp->fd->private->othersubrs*/;
- while ( isspace(*line)) ++line;
- if ( strncmp(line,"dup ",4)==0 ) {
- int i = strtol(line+4,NULL,10);
- if ( fp->ignore )
- /* Do Nothing */;
- else if ( i<chars->cnt ) {
- if ( chars->values[i]!=NULL )
- LogError( _("Duplicate definition of subroutine %d\n"), i );
- chars->lens[i] = binlen;
- chars->values[i] = galloc(binlen);
- memcpy(chars->values[i],binstart,binlen);
- if ( i>=chars->next ) chars->next = i+1;
- } else if ( !fp->alreadycomplained ) {
- LogError( _("Index too big (must be <%d) \"%s"), chars->cnt, rmbinary(line));
- fp->alreadycomplained = true;
- }
- } else if ( !fp->alreadycomplained ) {
- LogError( _("Didn't understand \"%s"), rmbinary(line) );
- fp->alreadycomplained = true;
- }
- } else if ( fp->inchars ) {
- struct pschars *chars = fp->fd->chars;
- if ( *tok=='\0' )
- LogError( _("No name for CharStrings dictionary \"%s"), rmbinary(line) );
- else if ( fp->ignore )
- /* Do Nothing */;
- else if ( chars->next>=chars->cnt )
- LogError( _("Too many entries in CharStrings dictionary \"%s"), rmbinary(line) );
- else {
- int i = chars->next;
- chars->lens[i] = binlen;
- chars->keys[i] = copy(tok);
- chars->values[i] = galloc(binlen);
- memcpy(chars->values[i],binstart,binlen);
- ++chars->next;
- ff_progress_next();
- }
- } else if ( !fp->alreadycomplained ) {
- /* Special hacks for known badly formatted fonts */
- if ( strstr(line,"/CharStrings")!=NULL ) {
- for ( pt=line; *pt!='/'; ++pt );
- pt = strchr(pt+1,'/');
- if ( pt!=NULL )
- *pt = '\0';
- parseline(fp,line,in);
- if ( pt!=NULL ) {
- *pt = '/';
- line = pt;
- goto retry;
- }
-return;
- } else if ( strstr(line,"/Subrs")!=NULL ) {
- pt = strstr(line,"dup");
- if ( pt!=NULL )
- *pt = '\0';
- parseline(fp,line,in);
- if ( pt!=NULL ) {
- *pt = 'd';
- line = pt;
- goto retry;
- }
-return;
- }
- LogError( _("Shouldn't be in addinfo \"%s"), rmbinary(line) );
- fp->alreadycomplained = true;
- }
-}
-
-/* In the book the token which starts a character description is always RD but*/
-/* it's just the name of a subroutine which is defined in the private diction*/
-/* and it could be anything. in one case it was "-|" (hyphen bar) so we can't*/
-/* just look for RD we must be a bit smarter and figure out what the token is*/
-/* (oh. I see now. it's allowed to be either one "RD" or "-|", but nothing else*/
-/* right) */
-/* It's defined as {string currentfile exch readstring pop} so look for that */
-/* Except that in gsf files we've also got "/-!{string currentfile exch readhexstring pop} readonly def" */
-/* NOTE: readhexstring!!! */
-/* And in files generated by GNU fontutils */
-static int glorpline(struct fontparse *fp, FILE *temp, char *rdtok) {
- static char *buffer=NULL, *end;
- char *pt, *binstart;
- int binlen;
- int ch;
- int innum, val=0, inbinary, cnt=0, inr, wasspace, nownum, nowr, nowspace, sptok;
- char *rdline = "{string currentfile exch readstring pop}", *rpt;
- char *rdline2 = "{string currentfile exch readhexstring pop}";
- char *tokpt = NULL, *rdpt;
- char temptok[255];
- int intok, first;
- int wasminus=false, isminus, nibble=0, firstnibble=true, inhex;
- int willbehex = false;
-
- ch = getc(temp);
- if ( ch==EOF )
-return( 0 );
- ungetc(ch,temp);
-
- if ( buffer==NULL ) {
- buffer = galloc(3000);
- end = buffer+3000;
- }
- innum = inr = 0; wasspace = 0; inbinary = 0; rpt = NULL; rdpt = NULL;
- inhex = 0;
- pt = buffer; binstart=NULL; binlen = 0; intok=0; sptok=0; first=1;
- temptok[0] = '\0';
- while ( (ch=getc(temp))!=EOF ) {
- if ( pt>=end ) {
- char *old = buffer;
- int len = (end-buffer)+2000;
- buffer = grealloc(buffer,len);
- end = buffer+len;
- pt = buffer+(pt-old);
- if ( binstart!=NULL )
- binstart = buffer+(binstart-old);
- }
- *pt++ = ch;
- isminus = ch=='-' && wasspace;
- nownum = nowspace = nowr = 0;
- if ( rpt!=NULL && ch!=*rpt && ch=='h' && rpt-rdline>25 && rpt-rdline<30 &&
- rdline2[rpt-rdline]=='h' ) {
- rpt = rdline2 + (rpt-rdline);
- willbehex = true;
- }
- if ( inbinary ) {
- if ( --cnt==0 )
- inbinary = 0;
- } else if ( inhex ) {
- if ( ishexdigit(ch)) {
- int h;
- if ( isdigit(ch)) h = ch-'0';
- else if ( ch>='a' && ch<='f' ) h = ch-'a'+10;
- else h = ch-'A'+10;
- if ( firstnibble ) {
- nibble = h;
- --pt;
- } else {
- pt[-1] = (nibble<<4)|h;
- if ( --cnt==0 )
- inbinary = inhex = 0;
- }
- firstnibble = !firstnibble;
- } else {
- --pt;
- /* skip everything not hex */
- }
- } else if ( ch=='/' ) {
- intok = 1;
- tokpt = temptok;
- } else if ( intok && !isspace(ch) && ch!='{' && ch!='[' ) {
- *tokpt++ = ch;
- } else if ( (intok||sptok) && (ch=='{' || ch=='[')) {
- *tokpt = '\0';
- rpt = rdline+1;
- intok = sptok = 0;
- } else if ( intok ) {
- *tokpt = '\0';
- intok = 0;
- sptok = 1;
- } else if ( sptok && isspace(ch)) {
- nowspace = 1;
- if ( ch=='\n' || ch=='\r' )
- break;
- } else if ( sptok && !isdigit(ch))
- sptok = 0;
- else if ( rpt!=NULL && ch==*rpt ) {
- if ( *++rpt=='\0' ) {
- /* it matched the character definition string so this is the */
- /* token we want to search for */
- strcpy(rdtok,temptok);
- fp->useshexstrings = willbehex;
- rpt = NULL;
- }
- } else if ( rpt!=NULL && ch==' ' ) {
- /* Extra spaces are ok */
- } else if ( rpt!=NULL ) {
- rpt = NULL;
- willbehex = false;
- } else if ( isdigit(ch)) {
- sptok = 0;
- nownum = 1;
- if ( innum )
- val = 10*val + ch-'0';
- else
- val = ch-'0';
- } else if ( isspace(ch)) {
- nowspace = 1;
- if ( ch=='\n' || ch=='\r' )
- break;
- } else if ( wasspace && ch==*rdtok ) {
- nowr = 1;
- fp->useshexstrings = willbehex;
- rdpt = rdtok+1;
- } else if ( wasspace && ch=='-' ) { /* fonts produced by type1fix seem to define both "RD" and "-|" which confused me. so just respond to either */
- nowr = 1;
- fp->useshexstrings = false;
- rdpt = "|";
- } else if ( wasspace && ch=='R' ) { /* fonts produced by type1fix seem to define both "RD" and "-|" which confused me. so just respond to either */
- nowr = 1;
- fp->useshexstrings = false;
- rdpt = "D";
- } else if ( inr && ch==*rdpt ) {
- if ( *++rdpt =='\0' ) {
- ch = getc(temp);
- *pt++ = ch;
- if ( isspace(ch) && val!=0 ) {
- inhex = fp->useshexstrings;
- inbinary = !fp->useshexstrings;
- firstnibble = true;
- cnt = val;
- binstart = pt;
- binlen = val;
- }
- } else
- nowr = 1;
- } else if ( wasminus && ch=='!' ) {
- ch = getc(temp);
- *pt++ = ch;
- if ( isspace(ch) && val!=0 ) {
- inhex = 1;
- cnt = val;
- binstart = pt;
- binlen = val;
- firstnibble = true;
- }
- }
- innum = nownum; wasspace = nowspace; inr = nowr;
- wasminus = isminus;
- first = 0;
- }
- *pt = '\0';
- if ( binstart==NULL ) {
- parseline(fp,buffer,temp);
- } else {
- addinfo(fp,buffer,temptok,binstart,binlen,temp);
- }
-return( 1 );
-}
-
-static int nrandombytes[4];
-#define EODMARKLEN 16
-
-#define bgetc(extra,in) (*(extra)=='\0' ? getc(in) : (unsigned char ) *(extra)++ )
-
-static void decrypteexec(FILE *in,FILE *temp, int hassectionheads,char *extra) {
- int ch1, ch2, ch3, ch4, binary;
- int zcnt;
- unsigned char zeros[EODMARKLEN+6+1];
- int sect_len=0x7fffffff;
-
- if ( extra==(void *) 5 ) extra = "";
-
- /* The PLRM defines white space to include form-feed and null. The t1_spec*/
- /* does not. The t1_spec wins here. Someone gave me a font which began */
- /* with a formfeed and that was part of the encrypted body */
- while ( (ch1=bgetc(extra,in))!=EOF && (ch1==' ' || ch1=='\t' || ch1=='\n' || ch1=='\r'));
- if ( ch1==0200 && hassectionheads ) {
- /* skip the 6 byte section header in pfb files that follows eexec */
- ch1 = bgetc(extra,in);
- sect_len = bgetc(extra,in);
- sect_len |= bgetc(extra,in)<<8;
- sect_len |= bgetc(extra,in)<<16;
- sect_len |= bgetc(extra,in)<<24;
- sect_len -= 3;
- ch1 = bgetc(extra,in);
- }
- ch2 = bgetc(extra,in); ch3 = bgetc(extra,in); ch4 = bgetc(extra,in);
- binary = 0;
- if ( ch1<'0' || (ch1>'9' && ch1<'A') || ( ch1>'F' && ch1<'a') || (ch1>'f') ||
- ch2<'0' || (ch2>'9' && ch2<'A') || (ch2>'F' && ch2<'a') || (ch2>'f') ||
- ch3<'0' || (ch3>'9' && ch3<'A') || (ch3>'F' && ch3<'a') || (ch3>'f') ||
- ch4<'0' || (ch4>'9' && ch4<'A') || (ch4>'F' && ch4<'a') || (ch4>'f') )
- binary = 1;
- if ( ch1==EOF || ch2==EOF || ch3==EOF || ch4==EOF ) {
-return;
- }
-
- initcode();
- if ( binary ) {
- nrandombytes[0] = decode(ch1);
- nrandombytes[1] = decode(ch2);
- nrandombytes[2] = decode(ch3);
- nrandombytes[3] = decode(ch4);
- zcnt = 0;
- while (( ch1=bgetc(extra,in))!=EOF ) {
- --sect_len;
- if ( hassectionheads ) {
- if ( sect_len==0 && ch1==0200 ) {
- ch1 = bgetc(extra,in);
- sect_len = bgetc(extra,in);
- sect_len |= bgetc(extra,in)<<8;
- sect_len |= bgetc(extra,in)<<16;
- sect_len |= bgetc(extra,in)<<24;
- sect_len += 1;
- if ( ch1=='\1' )
- break;
- } else {
- dumpzeros(temp,zeros,zcnt);
- zcnt = 0;
- putc(decode(ch1),temp);
- }
- } else {
- if ( ch1=='0' ) ++zcnt; else {dumpzeros(temp,zeros,zcnt); zcnt = 0; }
- if ( zcnt>EODMARKLEN )
- break;
- if ( zcnt==0 )
- putc(decode(ch1),temp);
- else
- zeros[zcnt-1] = decode(ch1);
- }
- }
- } else {
- nrandombytes[0] = decode(hex(ch1,ch2));
- nrandombytes[1] = decode(hex(ch3,ch4));
- ch1 = bgetc(extra,in); ch2 = bgetc(extra,in); ch3 = bgetc(extra,in); ch4 = bgetc(extra,in);
- nrandombytes[2] = decode(hex(ch1,ch2));
- nrandombytes[3] = decode(hex(ch3,ch4));
- zcnt = 0;
- while (( ch1=bgetc(extra,in))!=EOF ) {
- while ( ch1!=EOF && isspace(ch1)) ch1 = bgetc(extra,in);
- while ( (ch2=bgetc(extra,in))!=EOF && isspace(ch2));
- if ( ch1=='0' && ch2=='0' ) ++zcnt; else { dumpzeros(temp,zeros,zcnt); zcnt = 0;}
- if ( zcnt>EODMARKLEN )
- break;
- if ( zcnt==0 )
- putc(decode(hex(ch1,ch2)),temp);
- else
- zeros[zcnt-1] = decode(hex(ch1,ch2));
- }
- }
- while (( ch1=bgetc(extra,in))=='0' || isspace(ch1) );
- if ( ch1!=EOF ) ungetc(ch1,in);
-}
-
-static void decryptagain(struct fontparse *fp,FILE *temp,char *rdtok) {
- while ( glorpline(fp,temp,rdtok));
-}
-
-static void parsetype3(struct fontparse *fp,FILE *in) {
- PSFontInterpretPS(in,fp->fd->charprocs,fp->fd->encoding );
-}
-
-static unsigned char *readt1str(FILE *temp,int offset,int len,int leniv) {
- int i;
- unsigned char *str, *pt;
- unsigned short r = 4330;
- unsigned char plain, cypher;
- /* The CID spec doesn't mention this, but the type 1 strings are all */
- /* eexec encrupted (with the nested encryption). Remember leniv varies */
- /* from fd to fd (potentially) */
- /* I'm told (by Ian Kemmish) that leniv==-1 => no eexec encryption */
-
- fseek(temp,offset,SEEK_SET);
- if ( leniv<0 ) {
- str = pt = galloc(len+1);
- for ( i=0 ; i<len; ++i )
- *pt++ = getc(temp);
- } else {
- for ( i=0; i<leniv; ++i ) {
- cypher = getc(temp);
- plain = ( cypher ^ (r>>8));
- r = (cypher + r) * c1 + c2;
- }
- str = pt = galloc(len-leniv+1);
- for (; i<len; ++i ) {
- cypher = getc(temp);
- plain = ( cypher ^ (r>>8));
- r = (cypher + r) * c1 + c2;
- *pt++ = plain;
- }
- }
- *pt = '\0';
-return( str );
-}
-
-static void figurecids(struct fontparse *fp,FILE *temp) {
- struct fontdict *fd = fp->mainfd;
- int i,j,k,val;
- int *offsets;
- int cidcnt = fd->cidcnt;
- int leniv;
- /* Some cid formats don't have any of these */
-
- fd->cidstrs = galloc(cidcnt*sizeof(uint8 *));
- fd->cidlens = galloc(cidcnt*sizeof(int16));
- fd->cidfds = galloc((cidcnt+1)*sizeof(int16));
- offsets = galloc((cidcnt+1)*sizeof(int));
- ff_progress_change_total(cidcnt);
-
- fseek(temp,fd->mapoffset,SEEK_SET);
- for ( i=0; i<=fd->cidcnt; ++i ) {
- for ( j=val=0; j<fd->fdbytes; ++j )
- val = (val<<8) + getc(temp);
- if ( val >= fd->fdcnt && val!=255 ) { /* 255 is a special mark */
- LogError( _("Invalid FD (%d) assigned to CID %d.\n"), val, i );
- val = 0;
- }
- fd->cidfds[i] = val;
- for ( j=val=0; j<fd->gdbytes; ++j )
- val = (val<<8) + getc(temp);
- offsets[i] = val;
- if ( i!=0 ) {
- fd->cidlens[i-1] = offsets[i]-offsets[i-1];
- if ( fd->cidlens[i-1]<0 ) {
- LogError( _("Bad CID offset for CID %d\n"), i-1 );
- fd->cidlens[i-1] = 0;
- }
- }
- }
-
- for ( i=0; i<fd->cidcnt; ++i ) {
- if ( fd->cidlens[i]== 0 )
- fd->cidstrs[i] = NULL;
- else {
- fd->cidstrs[i] = readt1str(temp,offsets[i],fd->cidlens[i],
- fd->fds[fd->cidfds[i]]->private->leniv);
- fd->cidlens[i] -= fd->fds[fd->cidfds[i]]->private->leniv;
- }
- ff_progress_next();
- }
- free(offsets);
-
- for ( k=0; k<fd->fdcnt; ++k ) {
- struct private *private = fd->fds[k]->private;
- char *ssubroff = PSDictHasEntry(private->private,"SubrMapOffset");
- char *ssdbytes = PSDictHasEntry(private->private,"SDBytes");
- char *ssubrcnt = PSDictHasEntry(private->private,"SubrCount");
- int subroff, sdbytes, subrcnt;
-
- if ( ssubroff!=NULL && ssdbytes!=NULL && ssubrcnt!=NULL &&
- (subroff=strtol(ssubroff,NULL,10))>=0 &&
- (sdbytes=strtol(ssdbytes,NULL,10))>0 &&
- (subrcnt=strtol(ssubrcnt,NULL,10))>0 ) {
- private->subrs->cnt = subrcnt;
- private->subrs->values = gcalloc(subrcnt,sizeof(char *));
- private->subrs->lens = gcalloc(subrcnt,sizeof(int));
- leniv = private->leniv;
- offsets = galloc((subrcnt+1)*sizeof(int));
- fseek(temp,subroff,SEEK_SET);
- for ( i=0; i<=subrcnt; ++i ) {
- for ( j=val=0; j<sdbytes; ++j )
- val = (val<<8) + getc(temp);
- offsets[i] = val;
- if ( i!=0 )
- private->subrs->lens[i-1] = offsets[i]-offsets[i-1];
- }
- for ( i=0; i<subrcnt; ++i ) {
- private->subrs->values[i] = readt1str(temp,offsets[i],
- private->subrs->lens[i],leniv);
- }
- private->subrs->next = i;
- free(offsets);
- }
- PSDictRemoveEntry(private->private,"SubrMapOffset");
- PSDictRemoveEntry(private->private,"SDBytes");
- PSDictRemoveEntry(private->private,"SubrCount");
- }
-}
-
-static void dodata( struct fontparse *fp, FILE *in, FILE *temp) {
- int binary, cnt, len;
- int ch, ch2;
- char *pt;
- char fontsetname[256];
-
- while ( (ch=getc(in))!='(' && ch!='/' && ch!=EOF );
- if ( ch=='/' ) {
- /* There appears to be no provision for a hex encoding here */
- /* Why can't they use the same format for routines with the same name? */
- binary = true;
- for ( pt=fontsetname; (ch=getc(in))!=' ' && ch!=EOF; )
- if ( pt<fontsetname+sizeof(fontsetname)-1 )
- *pt++= ch;
- *pt = '\0';
- } else {
- if ( (ch=getc(in))=='B' || ch=='b' ) binary = true;
- else if ( ch=='H' || ch=='h' ) binary = false;
- else {
- binary = true; /* Who knows? */
- LogError( _("Failed to parse the StartData command properly\n") );
- }
- fontsetname[0] = '\0';
- while ( (ch=getc(in))!=')' && ch!=EOF );
- }
- if ( fscanf( in, "%d", &len )!=1 || len<=0 ) {
- len = 0;
- LogError( _("Failed to parse the StartData command properly, bad count\n") );
- }
- cnt = len;
- while ( isspace(ch=getc(in)) );
- ungetc(ch,in);
- for ( pt="StartData "; *pt; ++pt )
- getc(in); /* And if it didn't match, what could I do about it? */
- if ( binary ) {
- while ( cnt>0 ) {
- ch = getc(in);
- putc(ch,temp);
- --cnt;
- }
- } else {
- while ( cnt>0 ) {
- /* Hex data are allowed to contain whitespace */
- while ( isspace(ch=getc(in)) );
- while ( isspace(ch2=getc(in)) );
- ch = hex(ch,ch2);
- putc(ch,temp);
- --cnt;
- }
- if ( (ch=getc(in))!='>' ) ungetc(ch,in);
- }
- rewind(temp);
- if ( fp->iscid )
- figurecids(fp,temp);
- else {
- fp->fd->sf = _CFFParse(temp,len,fontsetname);
- fp->fd->wascff = true;
- }
-}
-
-static void realdecrypt(struct fontparse *fp,FILE *in, FILE *temp) {
- char buffer[256];
- int first, hassectionheads;
- char rdtok[20];
- int saw_blend = false;
-
- strcpy(rdtok,"RD");
-
- first = 1; hassectionheads = 0;
- while ( myfgets(buffer,sizeof(buffer),in)!=NULL ) {
- if ( strstr(buffer, "Blend")!=NULL )
- saw_blend = true;
- if ( first && buffer[0]=='\200' ) {
- int len = strlen( buffer );
- hassectionheads = 1;
- fp->fd->wasbinary = true;
- /* if there were a newline in the section header (in the length word)*/
- /* we would stop at it, and not read the full header */
- if ( len<6 ) /* eat the header */
- while ( len<6 ) { getc(in); ++len; }
- else /* Otherwise parse anything else on the line */
- parseline(fp,buffer+6,in);
- } else if ( strstr(buffer,"CharProcs")!=NULL && strstr(buffer,"begin")!=NULL ) {
- parsetype3(fp,in);
-return;
- } else if ( fp->fd->fonttype!=42 && strstr(buffer,"CharStrings")!=NULL && strstr(buffer,"begin")!=NULL ) {
- /* Fontographer uses CharStrings even though they aren't */
- parsetype3(fp,in);
-return;
- } else if ( !fp->iscid ) {
- if ( saw_blend )
- parseline(fp,buffer,in);
- /* But if it's a multi master font, don't do the special private hack */
- else if ( strstr(buffer,"/CharStrings")!=NULL &&
- strstr(buffer,"begin")!=NULL &&
- (fp->fd->fonttype!=42 && fp->fd->cidfonttype!=2)) {
- /* gsf files are not eexec encoded, but the charstrings are encoded*/
- InitChars(fp->fd->chars,buffer);
- fp->inchars = 1;
- decryptagain(fp,in,rdtok);
-return;
- } else if ( strstr(buffer,"/Subrs")!=NULL && strstr(buffer,"array")!=NULL ) {
- /* Same case as above */
- InitChars(fp->fd->private->subrs,buffer);
- fp->insubs = 1;
- decryptagain(fp,in,rdtok);
-return;
- } else if ( strstr(buffer,"/Private")!=NULL && (strstr(buffer,"dict")!=NULL || strstr(buffer,"<<")!=NULL )) {
- /* files produced by GNU fontutils have some of the same issues */
- fp->inprivate = 1;
- fp->infi = false;
- decryptagain(fp,in,rdtok);
-return;
- } else
- parseline(fp,buffer,in);
- } else
- parseline(fp,buffer,in);
- first = 0;
- if ( strstr(buffer,"%%BeginData: ")!=NULL )
- break;
- if ( strstr(buffer,"currentfile")!=NULL && strstr(buffer, "eexec")!=NULL ) {
- fp->skipping_mbf = false;
- break;
- }
- /* Hmm. These lines were put in to handle parsing type42 fonts, but */
- /* they break multimaster fonts, and they don't seem to be needed */
- /* for type42s any more either. So... Away with them */
-#if 0
- if ( strstr(buffer,"definefont")!=NULL )
- break;
-#endif
- }
-
- if ( strstr(buffer,"%%BeginData: ")!=NULL ) {
- /* used by both CID fonts and CFF fonts (and chameleons, whatever they are) */
- dodata(fp,in,temp);
- } else if ( strstr(buffer,"eexec")!=NULL ) {
- decrypteexec(in,temp,hassectionheads,strstr(buffer, "eexec")+5);
- rewind(temp);
- decryptagain(fp,temp,rdtok);
- while ( myfgets(buffer,sizeof(buffer),in)!=NULL ) {
- if ( buffer[0]!='\200' || !hassectionheads )
- parseline(fp,buffer,in);
- }
- } else if (( fp->fd->fonttype==42 || fp->fd->cidfonttype==2 ) && fp->sfnts!=NULL ) {
- fp->fd->sf = _SFReadTTF(fp->sfnts,0,0,"<Temp File>",fp->fd);
- fclose(fp->sfnts);
- }
-}
-
-FontDict *_ReadPSFont(FILE *in) {
- FILE *temp;
- struct fontparse fp;
- char *oldloc;
- struct stat b;
-
- temp = tmpfile();
- if ( temp==NULL ) {
- LogError( _("Cannot open a temporary file\n") );
-return(NULL);
- }
-
- oldloc = setlocale(LC_NUMERIC,"C");
- memset(&fp,'\0',sizeof(fp));
- fp.fd = fp.mainfd = PSMakeEmptyFont();
- fp.fdindex = -1;
- realdecrypt(&fp,in,temp);
- free(fp.vbuf);
- setlocale(LC_NUMERIC,oldloc);
-
- fclose(temp);
-
- if ( fstat(fileno(in),&b)!=-1 ) {
- fp.fd->modificationtime = b.st_mtime;
- fp.fd->creationtime = b.st_mtime;
- }
-return( fp.fd );
-}
-
-FontDict *ReadPSFont(char *fontname) {
- FILE *in;
- FontDict *fd;
-
- in = fopen(fontname,"rb");
- if ( in==NULL ) {
- LogError( _("Cannot open %s\n"), fontname );
-return(NULL);
- }
- fd = _ReadPSFont(in);
- fclose(in);
-return( fd );
-}
-
-void PSCharsFree(struct pschars *chrs) {
- int i;
-
- if ( chrs==NULL )
-return;
- for ( i=0; i<chrs->next; ++i ) {
- if ( chrs->keys!=NULL ) free(chrs->keys[i]);
- free(chrs->values[i]);
- }
- free(chrs->lens);
- free(chrs->keys);
- free(chrs->values);
- free(chrs);
-}
-
-void PSDictFree(struct psdict *dict) {
- int i;
-
- if ( dict==NULL )
-return;
- for ( i=0; i<dict->next; ++i ) {
- if ( dict->keys!=NULL ) free(dict->keys[i]);
- free(dict->values[i]);
- }
- free(dict->keys);
- free(dict->values);
- free(dict);
-}
-
-static void PrivateFree(struct private *prv) {
- PSCharsFree(prv->subrs);
-#if 1
- PSDictFree(prv->private);
-#else
- PSCharsFree(prv->othersubrs);
- free(prv->minfeature);
- free(prv->nd);
- free(prv->np);
- free(prv->rd);
-#endif
- free(prv);
-}
-
-static void FontInfoFree(struct fontinfo *fi) {
- free(fi->familyname);
- free(fi->fullname);
- free(fi->notice);
- free(fi->weight);
- free(fi->version);
- free(fi->blenddesignpositions);
- free(fi->blenddesignmap);
- free(fi->blendaxistypes);
- free(fi);
-}
-
-void PSFontFree(FontDict *fd) {
- int i;
-
- /*if ( fd->encoding!=NULL ): useless: fd->encoding is *char[256] */
- for ( i=0; i<256; ++i )
- free( fd->encoding[i]);
- free(fd->fontname);
- free(fd->cidfontname);
- free(fd->registry);
- free(fd->ordering);
- FontInfoFree(fd->fontinfo);
- PSCharsFree(fd->chars);
- PrivateFree(fd->private);
- if ( fd->charprocs!=NULL ) {
- for ( i=0; i<fd->charprocs->cnt; ++i )
- free(fd->charprocs->keys[i]);
- free(fd->charprocs->keys);
- free(fd->charprocs->values);
- free(fd->charprocs);
- }
- if ( fd->cidstrs!=NULL ) {
- for ( i=0; i<fd->cidcnt; ++i )
- free( fd->cidstrs[i]);
- free(fd->cidstrs);
- }
- free(fd->cidlens);
- free(fd->cidfds);
- if ( fd->fds!=NULL ) {
- for ( i=0; i<fd->fdcnt; ++i )
- PSFontFree(fd->fds[i]);
- free(fd->fds);
- }
- free(fd->blendfunc);
- free(fd->weightvector);
- free(fd->cdv);
- free(fd->ndv);
-
- PSDictFree(fd->blendprivate);
- PSDictFree(fd->blendfontinfo);
-
- free(fd);
-}
-
-char **_NamesReadPostscript(FILE *ps) {
- char **ret = NULL;
- char buffer[2000], *pt, *end;
-
- if ( ps!=NULL ) {
- while ( fgets(buffer,sizeof(buffer),ps)!=NULL ) {
- if ( strstr(buffer,"/FontName")!=NULL ||
- strstr(buffer,"/CIDFontName")!=NULL ) {
- pt = strstr(buffer,"FontName");
- pt += strlen("FontName");
- while ( isspace(*pt)) ++pt;
- if ( *pt=='/' ) ++pt;
- for ( end = pt; *end!='\0' && !isspace(*end); ++end );
- ret = galloc(2*sizeof(char *));
- ret[0] = copyn(pt,end-pt);
- ret[1] = NULL;
- break;
- } else if ( strstr(buffer,"currentfile")!=NULL && strstr(buffer,"eexec")!=NULL )
- break;
- else if ( strstr(buffer,"%%BeginData")!=NULL )
- break;
- }
- fclose(ps);
- }
-return( ret );
-}
-
-char **NamesReadPostscript(char *filename) {
-return( _NamesReadPostscript( fopen(filename,"rb")));
-}
diff --git a/Build/source/texk/web2c/luatexdir/luafontloader/fontforge/fontforge/parsettf.c b/Build/source/texk/web2c/luatexdir/luafontloader/fontforge/fontforge/parsettf.c
deleted file mode 100644
index 7d83c4e991c..00000000000
--- a/Build/source/texk/web2c/luatexdir/luafontloader/fontforge/fontforge/parsettf.c
+++ /dev/null
@@ -1,6234 +0,0 @@
-/* Copyright (C) 2000-2008 by George Williams */
-/*
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are met:
-
- * Redistributions of source code must retain the above copyright notice, this
- * list of conditions and the following disclaimer.
-
- * Redistributions in binary form must reproduce the above copyright notice,
- * this list of conditions and the following disclaimer in the documentation
- * and/or other materials provided with the distribution.
-
- * The name of the author may not be used to endorse or promote products
- * derived from this software without specific prior written permission.
-
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
- * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
- * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
- * EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
- * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
- * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
- * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
- * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-#include "pfaedit.h"
-#include <chardata.h>
-#include <utype.h>
-#include <ustring.h>
-#include <math.h>
-#include <locale.h>
-#include "ttf.h"
-
-extern char *AdobeStandardEncoding[], *AdobeExpertEncoding[];
-extern const char *ttfstandardnames[];
-extern int ask_user_for_cmap;
-extern char *SaveTablesPref;
-
-#ifdef LUA_FF_LIB
-SplineFont *_SFReadTTFInfo(FILE *ttf, int flags,enum openflags openflags, char *filename,struct fontdict *fd);
-void THPatchSplineChar(SplineChar *sc);
-#endif
-
-int THtest_duplicate_glyph_names = 0;
-int THread_ttf_glyph_data = 0;
-
-char *SaveTablesPref;
-int ask_user_for_cmap = false;
-
-/* True Type is a really icky format. Nothing is together. It's badly described */
-/* much of the description is misleading */
-/* Apple's version: */
-/* http://fonts.apple.com/TTRefMan/index.html */
-/* MS's version: */
-/* http://www.microsoft.com/typography/tt/tt.htm */
-/* An helpful but incomplete description is given at */
-/* http://www.truetype.demon.co.uk/ttoutln.htm */
-/* For some things I looked at freetype's code to see how they did it */
-/* (I think only for what happens if !ARGS_ARE_XY) */
-/* http://freetype.sourceforge.net/ */
-/* It grows on you though... now that I understand it better it seems better designed */
-/* but the docs remain in conflict. Sometimes badly so */
-
-int prefer_cjk_encodings=false;
-
-/* ************************************************************************** */
-static struct ms_2_locales { char *loc_name; int local_id; } ms_2_locals[] = {
- { "af", 0x436 },
- { "sq_AL", 0x41c },
- { "am", 0x45e },
- { "ar_SA", 0x401 },
- { "ar_IQ", 0x801 },
- { "ar_EG", 0xc01 },
- { "ar_LY", 0x1001 },
- { "ar_DZ", 0x1401 },
- { "ar_MA", 0x1801 },
- { "ar_TN", 0x1C01 },
- { "ar_OM", 0x2001 },
- { "ar_YE", 0x2401 },
- { "ar_SY", 0x2801 },
- { "ar_JO", 0x2c01 },
- { "ar_LB", 0x3001 },
- { "ar_KW", 0x3401 },
- { "ar_AE", 0x3801 },
- { "ar_BH", 0x3c01 },
- { "ar_QA", 0x4001 },
- { "hy", 0x42b },
- { "as", 0x44d },
- { "az", 0x42c },
- { "az", 0x82c },
- { "eu", 0x42d },
- { "be_BY", 0x423 },
- { "bn_IN", 0x445 },
- { "bn_BD", 0x845 },
- { "bg_BG", 0x402 },
- { "my", 0x455 },
- { "ca", 0x403 },
- { "km", 0x453 },
- { "zh_TW", 0x404 }, /* Trad */
- { "zh_CN", 0x804 }, /* Simp */
- { "zh_HK", 0xc04 }, /* Trad */
- { "zh_SG", 0x1004 }, /* Simp */
- { "zh_MO", 0x1404 }, /* Trad */
- { "hr", 0x41a },
- { "hr_BA", 0x101a },
- { "cs_CZ", 0x405 },
- { "da_DK", 0x406 },
- { "div", 0x465 },
- { "nl_NL", 0x413 },
- { "nl_BE", 0x813 },
- { "en_UK", 0x809 },
- { "en_US", 0x409 },
- { "en_CA", 0x1009 },
- { "en_AU", 0xc09 },
- { "en_NZ", 0x1409 },
- { "en_IE", 0x1809 },
- { "en_ZA", 0x1c09 },
- { "en_JM", 0x2009 },
- { "en", 0x2409 },
- { "en_BZ", 0x2809 },
- { "en_TT", 0x2c09 },
- { "en_ZW", 0x3009 },
- { "en_PH", 0x3409 },
- { "en_ID", 0x3809 },
- { "en_HK", 0x3c09 },
- { "en_IN", 0x4009 },
- { "en_MY", 0x4409 },
- { "et_EE", 0x425 },
- { "fo", 0x438 },
-/* No language code for filipino */
- { "fa", 0x429 },
- { "fi_FI", 0x40b },
- { "fr_FR", 0x40c },
- { "fr_BE", 0x80c },
- { "fr_CA", 0xc0c },
- { "fr_CH", 0x100c },
- { "fr_LU", 0x140c },
- { "fr_MC", 0x180c },
- { "fr", 0x1c0c }, /* West Indes */
- { "fr_RE", 0x200c },
- { "fr_CD", 0x240c },
- { "fr_SN", 0x280c },
- { "fr_CM", 0x2c0c },
- { "fr_CI", 0x300c },
- { "fr_ML", 0x340c },
- { "fr_MA", 0x380c },
- { "fr_HT", 0x3c0c },
- { "fr_DZ", 0xe40c }, /* North African is most likely to be Algeria, possibly Tunisia */
- { "fy", 0x462 },
- { "gl", 0x456 },
- { "ka", 0x437 },
- { "de_DE", 0x407 },
- { "de_CH", 0x807 },
- { "de_AT", 0xc07 },
- { "de_LU", 0x1007 },
- { "de_LI", 0x1407 },
- { "el_GR", 0x408 },
- { "ga", 0x83c },
- { "gd", 0x43c },
- { "gn", 0x474 },
- { "gu", 0x447 },
- { "ha", 0x468 },
- { "he_IL", 0x40d },
- { "iw", 0x40d }, /* Obsolete name for Hebrew */
- { "hi", 0x439 },
- { "hu_HU", 0x40e },
- { "is_IS", 0x40f },
- { "id", 0x421 },
- { "in", 0x421 }, /* Obsolete name for Indonesean */
- { "iu", 0x45d },
- { "it_IT", 0x410 },
- { "it_CH", 0x810 },
- { "ja_JP", 0x411 },
- { "kn", 0x44b },
- { "ks_IN", 0x860 },
- { "kk", 0x43f },
- { "ky", 0x440 },
- { "km", 0x453 },
- { "kok", 0x457 },
- { "ko", 0x412 },
- { "ko", 0x812 }, /*Johab */
- { "lo", 0x454 },
- { "la", 0x476 },
- { "lv_LV", 0x426 },
- { "lt_LT", 0x427 },
- { "lt", 0x827 }, /* Classic */
- { "mk", 0x42f },
- { "ms", 0x43e },
- { "ms", 0x83e },
- { "ml", 0x44c },
- { "mt", 0x43a },
- { "mr", 0x44e },
- { "mn", 0x450 },
- { "ne_NP", 0x461 },
- { "ne_IN", 0x861 },
- { "no_NO", 0x414 }, /* Bokmal */
- { "no_NO", 0x814 }, /* Nynorsk */
- { "or", 0x448 },
- { "om", 0x472 },
- { "ps", 0x463 },
- { "pl_PL", 0x415 },
- { "pt_PT", 0x416 },
- { "pt_BR", 0x816 },
- { "pa_IN", 0x446 },
- { "pa_PK", 0x846 },
- { "qu_BO", 0x46b },
- { "qu_EC", 0x86b },
- { "qu_PE", 0xc6b },
- { "rm", 0x417 },
- { "ro_RO", 0x418 },
- { "ro_MD", 0x818 },
- { "ru_RU", 0x419 },
- { "ru_MD", 0x819 },
- { "smi", 0x43b },
- { "sa", 0x43b },
-/* No language code for Sepedi */
- { "sr", 0xc1a }, /* Cyrillic */
- { "sr", 0x81a }, /* Latin */
- { "sd_IN", 0x459 },
- { "sd_PK", 0x859 },
- { "si", 0x45b },
- { "sk_SK", 0x41b },
- { "sl_SI", 0x424 },
- { "wen", 0x42e },
- { "es_ES", 0x40a }, /* traditional spanish */
- { "es_MX", 0x80a },
- { "es_ES", 0xc0a }, /* Modern spanish */
- { "es_GT", 0x100a },
- { "es_CR", 0x140a },
- { "es_PA", 0x180a },
- { "es_DO", 0x1c0a },
- { "es_VE", 0x200a },
- { "es_CO", 0x240a },
- { "es_PE", 0x280a },
- { "es_AR", 0x2c0a },
- { "es_EC", 0x300a },
- { "es_CL", 0x340a },
- { "es_UY", 0x380a },
- { "es_PY", 0x3c0a },
- { "es_BO", 0x400a },
- { "es_SV", 0x440a },
- { "es_HN", 0x480a },
- { "es_NI", 0x4c0a },
- { "es_PR", 0x500a },
- { "es_US", 0x540a },
- { "sutu", 0x430 },
- { "sw_KE", 0x441 },
- { "sv_SE", 0x41d },
- { "sv_FI", 0x81d },
- { "tl", 0x464 },
- { "tg", 0x464 },
- { "ta", 0x449 },
- { "tt", 0x444 },
- { "te", 0x44a },
- { "th", 0x41e },
- { "bo_CN", 0x451 },
- { "bo_BT", 0x451 },
- { "ti_ET", 0x473 },
- { "ti_ER", 0x873 },
- { "ts", 0x431 },
- { "tn", 0x432 },
- { "tr_TR", 0x41f },
- { "tk", 0x442 },
- { "uk_UA", 0x422 },
- { "ug", 0x480 },
- { "ur_PK", 0x420 },
- { "ur_IN", 0x820 },
- { "uz", 0x443 }, /* Latin */
- { "uz", 0x843 }, /* Cyrillic */
- { "ven", 0x433 },
- { "vi", 0x42a },
- { "cy", 0x452 },
- { "xh", 0x434 },
- { "yi", 0x43d },
- { "ji", 0x43d }, /* Obsolete Yiddish */
- { "yo", 0x46a },
- { "zu", 0x435 },
- { NULL, 0 }};
-
-int MSLanguageFromLocale(void) {
- const char *lang=NULL;
- int i, langlen;
- static char *envs[] = { "LC_ALL", "LC_MESSAGES", "LANG", NULL };
- char langcountry[8], language[4];
- int langcode, langlocalecode;
-
- for ( i=0; envs[i]!=NULL; ++i ) {
- lang = getenv(envs[i]);
- if ( lang!=NULL ) {
- langlen = strlen(lang);
- if (( langlen>5 && lang[5]=='.' && lang[2]=='_' ) ||
- (langlen==5 && lang[2]=='_' ) ||
- (langlen==2) ||
- (langlen==3)) /* Some obscure languages have a 3 letter code */
- /* I understand this language */
- break;
- }
- }
- if ( lang==NULL )
- lang = "en_US";
- strncpy(langcountry,lang,5); langcountry[5] = '\0';
- strncpy(language,lang,3); language[3] = '\0';
- if ( language[2]=='_' ) language[2] = '\0';
- langlen = strlen(language);
- langcode = langlocalecode = -1;
- for ( i=0; ms_2_locals[i].loc_name!=NULL; ++i ) {
- if ( strmatch(langcountry,ms_2_locals[i].loc_name)==0 ) {
- langlocalecode = ms_2_locals[i].local_id;
- langcode = langlocalecode&0x3ff;
- break;
- } else if ( strncmp(language,ms_2_locals[i].loc_name,langlen)==0 )
- langcode = ms_2_locals[i].local_id&0x3ff;
- }
- if ( langcode==-1 ) /* Default to English */
- langcode = 0x9;
- return( langlocalecode==-1 ? (langcode|0x400) : langlocalecode );
-}
-/* ************************************************************************** */
-
-int getushort(FILE *ttf) {
- int ch1 = getc(ttf);
- int ch2 = getc(ttf);
- if ( ch2==EOF )
- return( EOF );
- return( (ch1<<8)|ch2 );
-}
-
-int get3byte(FILE *ttf) {
- int ch1 = getc(ttf);
- int ch2 = getc(ttf);
- int ch3 = getc(ttf);
- if ( ch3==EOF )
- return( EOF );
- return( (ch1<<16)|(ch2<<8)|ch3 );
-}
-
-int32 getlong(FILE *ttf) {
- int ch1 = getc(ttf);
- int ch2 = getc(ttf);
- int ch3 = getc(ttf);
- int ch4 = getc(ttf);
- if ( ch4==EOF )
- return( EOF );
- return( (ch1<<24)|(ch2<<16)|(ch3<<8)|ch4 );
-}
-
-static int32 getoffset(FILE *ttf, int offsize) {
- if ( offsize==1 )
- return( getc(ttf));
- else if ( offsize==2 )
- return( getushort(ttf));
- else if ( offsize==3 )
- return( get3byte(ttf));
- else
- return( getlong(ttf));
-}
-
-real getfixed(FILE *ttf) {
- int32 val = getlong(ttf);
- int mant = val&0xffff;
- /* This oddity may be needed to deal with the first 16 bits being signed */
- /* and the low-order bits unsigned */
- return( (real) (val>>16) + (mant/65536.0) );
-}
-
-real get2dot14(FILE *ttf) {
- int32 val = getushort(ttf);
- int mant = val&0x3fff;
- /* This oddity may be needed to deal with the first 2 bits being signed */
- /* and the low-order bits unsigned */
- return( (real) ((val<<16)>>(16+14)) + (mant/16384.0) );
-}
-
-static Encoding *enc_from_platspec(int platform,int specific) {
- char *enc;
- Encoding *e;
-
- enc = "Custom";
- if ( platform==0 ) {
- enc = "Unicode";
- if ( specific==4 )
- enc = "UnicodeFull";
- } else if ( platform==1 ) {
- if ( specific==0 )
- enc = "Mac";
- else if ( specific==1 )
- enc = "Sjis";
- else if ( specific==2 )
- enc = "Big5hkscs"; /* Or should we just guess big5? Both are wrong sometimes */
- else if ( specific==3 )
- enc = "EUC-KR";
- else if ( specific==25 )
- enc = "EUC-CN";
- } else if ( platform==2 ) { /* obselete */
- if ( specific==0 )
- enc = "ASCII";
- else if ( specific==1 )
- enc = "Unicode";
- else if ( specific==2 )
- enc = "ISO8859-1";
- } else if ( platform==3 ) {
- if ( specific==1 || specific==0 ) /* symbol (sp=0) is just unicode (PUA) */
- enc = "Unicode";
- else if ( specific==2 )
- enc = "Sjis";
- else if ( specific==3 )
- enc = "EUC-CN";
- else if ( specific==4 )
- enc = "Big5hkscs";
- else if ( specific==5 )
- enc = "EUC-KR";
- else if ( specific==6 )
- enc = "Johab";
- else if ( specific==10 )
- enc = "UnicodeFull";
- } else if ( platform==7 ) { /* Used internally in freetype, but */
- if ( specific==0 ) /* there's no harm in looking for it */
- enc = "AdobeStandard"; /* even if it never happens */
- else if ( specific==1 ) {
- /* adobe_expert */;
- } else if ( specific==2 ) {
- /* adobe_custom */;
- }
- }
- e = FindOrMakeEncoding(enc);
- if ( e==NULL ) {
- static int p = -1,s = -1;
- if ( p!=platform || s!=specific ) {
- LogError( _("The truetype encoding specified by platform=%d specific=%d (which we map to %s) is not supported by your version of iconv(3).\n"),
- platform, specific, enc );
- p = platform;
- s = specific;
- }
- }
- return( e );
-}
-
-static char *_readencstring(FILE *ttf,int offset,int len,
- int platform,int specific,int language) {
- long pos = ftell(ttf);
- unichar_t *str, *pt;
- char *ret;
- int i, ch;
- Encoding *enc;
-
- fseek(ttf,offset,SEEK_SET);
-
- if ( platform==1 ) {
- /* Mac is screwy, there are several different varients of MacRoman */
- /* depending on the language, they didn't get it right when they */
- /* invented their script system */
- char *cstr, *cpt;
- cstr = cpt = galloc(len+1);
- for ( i=0; i<len; ++i )
- *cpt++ = getc(ttf);
- *cpt = '\0';
- ret = MacStrToUtf8(cstr,specific,language);
- free(cstr);
- } else {
- enc = enc_from_platspec(platform,specific);
- if ( enc==NULL )
- return( NULL );
- if ( enc->is_unicodebmp ) {
- str = pt = galloc((sizeof(unichar_t)/2)*len+sizeof(unichar_t));
- for ( i=0; i<len/2; ++i ) {
- ch = getc(ttf)<<8;
- *pt++ = ch | getc(ttf);
- }
- *pt = 0;
- } else if ( enc->unicode!=NULL ) {
- str = pt = galloc(sizeof(unichar_t)*len+sizeof(unichar_t));
- for ( i=0; i<len; ++i )
- *pt++ = enc->unicode[getc(ttf)];
- *pt = 0;
- } else if ( enc->tounicode!=NULL ) {
- size_t inlen = len+1, outlen = sizeof(unichar_t)*(len+1);
- char *cstr = galloc(inlen);
- ICONV_CONST char *in = cstr;
- char *out;
-#ifdef UNICHAR_16
- str = galloc(outlen+2);
-#else
- str = galloc(outlen+sizeof(unichar_t));
-#endif
- /*str = galloc(outlen+2);*/
- out = (char *) str;
- iconv(enc->tounicode,&in,&inlen,&out,&outlen);
- out[0] = '\0'; out[1] = '\0';
-#ifndef UNICHAR_16
- out[2] = '\0'; out[3] = '\0';
-#endif
- free(cstr);
- } else {
- str = uc_copy("");
- }
- ret = u2utf8_copy(str);
- free(str);
- }
- fseek(ttf,pos,SEEK_SET);
- return( ret );
-}
-
-char *TTFGetFontName(FILE *ttf,int32 offset,int32 off2) {
- int i,num;
- int32 tag, length, stringoffset;
- int plat, spec, lang, name, len, off, val;
- Encoding *enc;
- int32 nameoffset = 0;
- int fullval=0, fullstr=0, fulllen=0, famval=0, famstr=0, famlen=0;
- int fullplat=0, fullspec=0, fulllang=0, famplat=0, famspec=0, famlang=0;
- int locale = MSLanguageFromLocale();
- int maclang = WinLangToMac(locale);
-
- fseek(ttf,offset,SEEK_SET);
- /* version = */ getlong(ttf);
- num = getushort(ttf);
- /* srange = */ getushort(ttf);
- /* esel = */ getushort(ttf);
- /* rshift = */ getushort(ttf);
- for ( i=0; i<num; ++i ) {
- tag = getlong(ttf);
- /* checksum = */ getlong(ttf);
- nameoffset = off2+getlong(ttf);
- length = getlong(ttf);
- if ( tag==CHR('n','a','m','e'))
- break;
- }
- if ( i==num )
- return( NULL );
-
- fseek(ttf,nameoffset,SEEK_SET);
- /* format = */ getushort(ttf);
- num = getushort(ttf);
- stringoffset = nameoffset+getushort(ttf);
- fullval = famval = 0;
- for ( i=0; i<num; ++i ) {
- plat = getushort(ttf);
- spec = getushort(ttf);
- lang = getushort(ttf);
- name = getushort(ttf);
- len = getushort(ttf);
- off = getushort(ttf);
- enc = enc_from_platspec(plat,spec);
- if ( enc==NULL )
- continue;
- val = 0;
- if ( plat==3 && !enc->is_custom && lang==locale )
- val = 15;
- else if ( plat==3 && !enc->is_custom && (lang&0xff)==(locale&0xff) )
- val = 14;
- else if ( (plat==0 || plat==1) && !enc->is_custom && lang==maclang )
- val = 13;
- /* Ok, that didn't work, how about an english name? */
- else if ( plat==3 && !enc->is_custom && lang==0x409 )
- val = 12;
- else if ( plat==3 && !enc->is_custom && (lang&0xff)==0x09 )
- val = 11;
- else if ( (plat==0 || plat==1) && !enc->is_custom && lang==0 )
- val = 10;
- /* failing that I'll take what I can get */
- else if ( !enc->is_custom )
- val = 1;
- if ( name==4 && val>fullval ) {
- fullval = val;
- fullstr = off;
- fulllen = len;
- fullplat = plat;
- fullspec = spec;
- fulllang = lang;
- if ( val==12 )
- break;
- } else if ( name==1 && val>famval ) {
- famval = val;
- famstr = off;
- famlen = len;
- famplat = plat;
- famspec = spec;
- famlang = lang;
- }
- }
- if ( fullval==0 ) {
- if ( famval==0 )
- return( NULL );
- fullstr = famstr;
- fulllen = famlen;
- fullplat = famplat;
- fullspec = famspec;
- fulllang = famlang;
- }
- return( _readencstring(ttf,stringoffset+fullstr,fulllen,fullplat,fullspec,fulllang));
-}
-
-char *TTFGetPSFontName(FILE *ttf,int32 offset,int32 off2) {
- int i,num;
- int32 tag, length, stringoffset;
- int name, len, off;
- int32 nameoffset = 0;
-
- fseek(ttf,offset,SEEK_SET);
- /* version = */ getlong(ttf);
- num = getushort(ttf);
- /* srange = */ getushort(ttf);
- /* esel = */ getushort(ttf);
- /* rshift = */ getushort(ttf);
- for ( i=0; i<num; ++i ) {
- tag = getlong(ttf);
- /* checksum = */ getlong(ttf);
- nameoffset = off2+getlong(ttf);
- length = getlong(ttf);
- if ( tag==CHR('n','a','m','e'))
- break;
- }
- if ( i==num )
- return( NULL );
-
- fseek(ttf,nameoffset,SEEK_SET);
- /* format = */ getushort(ttf);
- num = getushort(ttf);
- stringoffset = nameoffset+getushort(ttf);
-
- for ( i=0; i<num; ++i ) {
- /* plat */ getushort(ttf);
- /* spec */ getushort(ttf);
- /* lang */ getushort(ttf);
- name = getushort(ttf);
- len = getushort(ttf);
- off = getushort(ttf);
- if (name == 6) {
- char *str = malloc(len+1);
- if (str) {
- fseek (ttf, stringoffset+off, SEEK_SET);
- if(fread(str,1,len,ttf)==(size_t)len) {
- str[len] = '\0';
- return str;
- }
- free(str);
- }
- }
- }
- return NULL;
-}
-
-static int PickTTFFont(FILE *ttf,char *filename,char **chosenname) {
- int32 *offsets, cnt, i, choice, j;
- char **names;
- char *pt, *lparen, *rparen;
-
- /* TTCF version = */ getlong(ttf);
- cnt = getlong(ttf);
- if ( cnt==1 ) {
- /* This is easy, don't bother to ask the user, there's no choice */
- int32 offset = getlong(ttf);
- fseek(ttf,offset,SEEK_SET);
- return( true );
- }
- offsets = galloc(cnt*sizeof(int32));
- for ( i=0; i<cnt; ++i )
- offsets[i] = getlong(ttf);
- names = galloc(cnt*sizeof(char *));
- for ( i=j=0; i<cnt; ++i ) {
- names[j] = TTFGetFontName(ttf,offsets[i],0);
- if ( names[j]!=NULL )
- ++j;
- }
- pt = strrchr(filename,'/');
- if ( pt==NULL )
- pt = filename;
- /* Someone gave me a font "Nafees Nastaleeq(Updated).ttf" and complained */
- /* that ff wouldn't open it */
- /* Now someone will complain about "Nafees(Updated).ttc(fo(ob)ar)" */
- if ( (lparen = strrchr(pt,'('))!=NULL && (rparen = strrchr(lparen,')'))!=NULL && rparen[1]=='\0' ) {
- char *find = copy(lparen+1);
- pt = strchr(find,')');
- if ( pt!=NULL ) *pt='\0';
- for ( choice=cnt-1; choice>=0; --choice )
- if ( strcmp(names[choice],find)==0 )
- break;
- if ( choice==-1 ) {
- char *end;
- choice = strtol(find,&end,10);
- if ( *end!='\0' )
- choice = -1;
- }
- if ( choice==-1 ) {
- char *fn = copy(filename);
- fn[lparen-filename] = '\0';
- ff_post_error(_("Not in Collection"),
- /* GT: The user is trying to open a font file which contains multiple fonts and */
- /* GT: has asked for a font which is not in that file. */
- /* GT: The string will look like: <fontname> is not in <filename> */
- _("%1$s is not in %2$.100s"),find,fn);
- free(fn);
- }
- free(find);
- } else
- choice = 0;
- if ( choice!=-1 ) {
- fseek(ttf,offsets[choice],SEEK_SET);
- *chosenname = copy(names[choice]);
- }
- for ( i=0; i<j; ++i )
- free(names[i]);
- free(names);
- free(offsets);
-return( choice!=-1);
-}
-
-static int PickCFFFont(char **fontnames) {
- unichar_t **names;
- int cnt, i, choice;
-
- for ( cnt=0; fontnames[cnt]!=NULL; ++cnt){;}
- names = gcalloc(cnt+1,sizeof(unichar_t *));
- for ( i=0; i<cnt; ++i )
- names[i] = uc_copy(fontnames[i]);
- choice = 0;
- for ( i=0; i<cnt; ++i )
- free(names[i]);
- free(names);
- return( choice );
-}
-
-static void ParseSaveTablesPref(struct ttfinfo *info) {
- char *pt, *spt;
- int cnt;
-
- info->savecnt = 0;
- info->savetab = NULL;
- if ( SaveTablesPref==NULL || *SaveTablesPref=='\0' )
- return;
- for ( pt=SaveTablesPref, cnt=0; *pt; ++pt )
- if ( *pt==',' )
- ++cnt;
- info->savecnt = cnt+1;
- info->savetab = gcalloc(cnt+1,sizeof(struct savetab));
- for ( pt=spt=SaveTablesPref, cnt=0; ; ++pt ) {
- if ( *pt==',' || *pt=='\0' ) {
- uint32 tag;
- tag = ( ( spt <pt )? spt[0] : ' ' )<<24;
- tag |= ( ( spt+1<pt )? spt[1] : ' ' )<<16;
- tag |= ( ( spt+2<pt )? spt[2] : ' ' )<<8 ;
- tag |= ( ( spt+3<pt )? spt[3] : ' ' ) ;
- info->savetab[cnt++].tag = tag;
- if ( *pt )
- spt = pt+1;
- else
- break;
- }
- }
-}
-
-static int32 filechecksum(FILE *file, int start, int len) {
- uint32 sum = 0, chunk;
- fseek(file,start,SEEK_SET);
- if ( len!=-1 )
- len=(len+3)>>2;
- while ( len==-1 || --len>=0 ) {
- chunk = getlong(file);
- if ( feof(file))
- break;
- sum += chunk;
- }
- return( sum );
-}
-
-static void ValidateTTFHead(FILE *ttf,struct ttfinfo *info) {
- /* When doing font lint we want to check the ttf header and make */
- /* sure all the offsets and lengths are valid, and the checksums */
- /* match. Most of the time this is just extra work and we don't */
- /* bather */
- uint32 restore_this_pos = ftell(ttf);
- struct tt_tables {
- uint32 tag;
- uint32 checksum;
- uint32 offset;
- uint32 length;
- } *tabs, temp;
- int i,j;
- uint32 file_len;
- int sr, es, rs, e_sr, e_es, e_rs;
- int hashead, hashhea, hasmaxp, masos2, haspost, hasname, hasos2;
- int hasloca, hascff, hasglyf;
-
- info->numtables = getushort(ttf);
- sr = getushort(ttf);
- es = getushort(ttf);
- rs = getushort(ttf);
- e_sr = (info->numtables<8?4:info->numtables<16?8:info->numtables<32?16:info->numtables<64?32:64)*16;
- e_es = (info->numtables<8?2:info->numtables<16?3:info->numtables<32?4:info->numtables<64?5:6);
- e_rs = info->numtables*16-e_sr;
- if ( e_sr!=sr || e_es!=es || e_rs!=rs ) {
- LogError( _("Unexpected values for binsearch header. Based on the number of tables I\n expect searchRange=%d (not %d), entrySel=%d (not %d) rangeShift=%d (not %d)\n"),
- e_sr, sr, e_es, es, e_rs, rs );
- info->bad_sfnt_header = true;
- }
-
- if ( info->numtables<=0 ) {
- LogError(_("An sfnt file must contain SOME tables, but this one does not."));
- info->bad_sfnt_header = true;
- fseek(ttf,restore_this_pos,SEEK_SET);
- return;
- } else if ( info->numtables>1000 ) {
- LogError(_("An sfnt file may contain a large number of tables, but this one has over 1000\n and that seems like too many\n"));
- info->bad_sfnt_header = true;
- fseek(ttf,restore_this_pos,SEEK_SET);
- return;
- }
-
- tabs = galloc(info->numtables*sizeof(struct tt_tables));
-
- for ( i=0; i<info->numtables; ++i ) {
- tabs[i].tag = getlong(ttf);
- tabs[i].checksum = getlong(ttf);
- tabs[i].offset = getlong(ttf);
- tabs[i].length = getlong(ttf);
- if ( i!=0 && tabs[i].tag<tabs[i-1].tag && !info->bad_sfnt_header ) {
- LogError(_("Table tags should be in alphabetic order in the font header\n but '%c%c%c%c', appears after '%c%c%c%c'."),
- tabs[i-1].tag>>24, tabs[i-1].tag>>16, tabs[i-1].tag>>8, tabs[i-1].tag,
- tabs[i].tag>>24, tabs[i].tag>>16, tabs[i].tag>>8, tabs[i].tag );
- info->bad_sfnt_header = true;
- }
- }
- fseek(ttf,0,SEEK_END);
- file_len = ftell(ttf);
-
- for ( i=0; i<info->numtables; ++i ) for ( j=i+1; j<info->numtables; ++j ) {
- if ( tabs[i].offset>tabs[j].offset ) {
- temp = tabs[i];
- tabs[i] = tabs[j];
- tabs[j] = temp;
- }
- }
- for ( i=0; i<info->numtables-1; ++i ) {
- for ( j=i+1; j<info->numtables; ++j ) {
- if ( tabs[i].tag==tabs[j].tag ) {
- LogError(_("Same table tag, '%c%c%c%c', appears twice in sfnt header"),
- tabs[i].tag>>24, tabs[i].tag>>16, tabs[i].tag>>8, tabs[i].tag );
- info->bad_sfnt_header = true;
- }
- }
- if ( tabs[i].offset+tabs[i].length > tabs[i+1].offset ) {
- LogError(_("Tables '%c%c%c%c' and '%c%c%c%c' overlap"),
- tabs[i].tag>>24, tabs[i].tag>>16, tabs[i].tag>>8, tabs[i].tag,
- tabs[j].tag>>24, tabs[j].tag>>16, tabs[j].tag>>8, tabs[j].tag );
- }
- }
- if ( tabs[i].offset+tabs[i].length > file_len ) {
- LogError(_("Table '%c%c%c%c' extends beyond end of file."),
- tabs[i].tag>>24, tabs[i].tag>>16, tabs[i].tag>>8, tabs[i].tag );
- info->bad_sfnt_header = true;
- }
-
- /* Checksums. First file as a whole, then each table */
- if ( filechecksum(ttf,0,-1)!=(int)0xb1b0afba ) {
- LogError(_("File checksum is incorrect."));
- info->bad_sfnt_header = true;
- }
- for ( i=0; i<info->numtables-1; ++i ) if ( tabs[i].tag!=CHR('h','e','a','d')) {
- if ( filechecksum(ttf,tabs[i].offset,tabs[i].length)!=(int)tabs[i].checksum ) {
- LogError(_("Table '%c%c%c%c' has a bad checksum."),
- tabs[i].tag>>24, tabs[i].tag>>16, tabs[i].tag>>8, tabs[i].tag );
- info->bad_sfnt_header = true;
- }
- }
-
- hashead = hashhea = hasmaxp = masos2 = haspost = hasname = hasos2 = false;
- hasloca = hascff = hasglyf = false;
- for ( i=0; i<info->numtables-1; ++i ) {
- switch ( tabs[i].tag ) {
- case CHR('c','v','t',' '):
- if ( tabs[i].length&1 )
- LogError(_("Table '%c%c%c%c' has a bad length, must be even."),
- tabs[i].tag>>24, tabs[i].tag>>16, tabs[i].tag>>8, tabs[i].tag );
- break;
- case CHR('b','h','e','d'): /* Fonts with bitmaps but no outlines get bhea */
- case CHR('h','e','a','d'):
- if ( tabs[i].length!=54 )
- LogError(_("Table '%c%c%c%c' has a bad length, must be 54 but is %d."),
- tabs[i].tag>>24, tabs[i].tag>>16, tabs[i].tag>>8, tabs[i].tag,
- tabs[i].length );
- hashead = true;
- break;
- case CHR('h','h','e','a'):
- hashhea = true;
- case CHR('v','h','e','a'):
- if ( tabs[i].length!=36 )
- LogError(_("Table '%c%c%c%c' has a bad length, must be 36 but is %d."),
- tabs[i].tag>>24, tabs[i].tag>>16, tabs[i].tag>>8, tabs[i].tag,
- tabs[i].length );
- break;
- case CHR('m','a','x','p'):
- hasmaxp = true;
- if ( tabs[i].length!=32 && tabs[i].length!=6 )
- LogError(_("Table '%c%c%c%c' has a bad length, must be 32 or 6 but is %d."),
- tabs[i].tag>>24, tabs[i].tag>>16, tabs[i].tag>>8, tabs[i].tag,
- tabs[i].length );
- break;
- case CHR('O','S','/','2'):
- hasos2 = true;
- if ( tabs[i].length!=78 && tabs[i].length!=86 && tabs[i].length!=96 )
- LogError(_("Table '%c%c%c%c' has a bad length, must be 78, 86 or 96 but is %d."),
- tabs[i].tag>>24, tabs[i].tag>>16, tabs[i].tag>>8, tabs[i].tag,
- tabs[i].length );
- break;
- case CHR('p','o','s','t'):
- haspost = true;
- break;
- case CHR('n','a','m','e'):
- hasname = true;
- break;
- case CHR('l','o','c','a'):
- hasloca = true;
- break;
- case CHR('g','l','y','f'):
- hasglyf = true;
- break;
- case CHR('C','F','F',' '):
- hascff = true;
- break;
- }
- }
- if ( !hashead )
- LogError(_("Missing required table: \"head\""));
- if ( !hashhea )
- LogError(_("Missing required table: \"hhea\""));
- if ( !hasmaxp )
- LogError(_("Missing required table: \"maxp\""));
- if ( !haspost )
- LogError(_("Missing required table: \"post\""));
- if ( !hasname )
- LogError(_("Missing required table: \"name\""));
- if ( hasglyf && !hasloca )
- LogError(_("Missing required table: \"loca\""));
- if ( !hasos2 )
- LogError(_("Missing \"OS/2\" table"));
- if ( !hasglyf && hasloca )
- LogError(_("Missing required table: \"glyf\""));
- if ( !hasglyf && !hascff )
- LogError(_("This font contains neither \"CFF \" nor \"glyf\"/\"loca\" tables"));
-
- free(tabs);
- fseek(ttf,restore_this_pos,SEEK_SET);
-}
-
-static struct tablenames { uint32 tag; char *name; } stdtables[] = {
- { CHR('a','c','n','t'), N_("accent attachment table") },
- { CHR('a','v','a','r'), N_("axis variation table") },
- { CHR('B','A','S','E'), N_("Baseline table (OT version)") },
- { CHR('b','d','a','t'), N_("bitmap data table (AAT version)") },
- { CHR('B','D','F',' '), N_("BDF bitmap properties table") },
- { CHR('b','h','e','d'), N_("bitmap font header table") },
- { CHR('b','l','o','c'), N_("bitmap location table (AAT version)") },
- { CHR('b','s','l','n'), N_("baseline table (AAT version)") },
- { CHR('C','F','F',' '), N_("PostScript font program (Compact Font Format)") },
- { CHR('C','I','D',' '), N_("Obsolete table for a type1 CID keyed font") },
- { CHR('c','m','a','p'), N_("character code mapping table") },
- { CHR('c','v','a','r'), N_("CVT variation table") },
- { CHR('c','v','t',' '), N_("control value table") },
- { CHR('D','S','I','G'), N_("digital signature table") },
- { CHR('E','B','D','T'), N_("bitmap data table (OT version)") },
- { CHR('E','B','L','C'), N_("bitmap location table (OT version)") },
- { CHR('E','B','S','C'), N_("embedded bitmap scaling control table") },
- { CHR('E','L','U','A'), N_("electronic end user license table") },
- { CHR('f','d','s','c'), N_("font descriptor table") },
- { CHR('f','e','a','t'), N_("layout feature table") },
- { CHR('F','e','a','t'), N_("SIL Graphite layout feature table") },
- { CHR('F','F','T','M'), N_("FontForge time stamp table") },
- { CHR('f','m','t','x'), N_("font metrics table") },
- { CHR('f','p','g','m'), N_("font program table") },
- { CHR('f','v','a','r'), N_("font variation table") },
- { CHR('g','a','s','p'), N_("grid-fitting and scan-conversion procedure table") },
- { CHR('G','D','E','F'), N_("glyph definition table") },
- { CHR('G','l','a','t'), N_("Graphite glyph attribute table") },
- { CHR('G','l','o','c'), N_("Graphite glyph location in Glat table") },
- { CHR('g','l','y','f'), N_("glyph outline table") },
- { CHR('G','P','O','S'), N_("glyph positioning table") },
- { CHR('g','v','a','r'), N_("glyph variation table") },
- { CHR('G','S','U','B'), N_("glyph substitution table") },
- { CHR('h','d','m','x'), N_("horizontal device metrics table") },
- { CHR('h','e','a','d'), N_("font header table") },
- { CHR('h','h','e','a'), N_("horizontal header table") },
- { CHR('h','m','t','x'), N_("horizontal metrics table") },
- { CHR('h','s','t','y'), N_("horizontal style table") },
- { CHR('j','u','s','t'), N_("justification table (AAT version)") },
- { CHR('J','S','T','F'), N_("justification table (OT version)") },
- { CHR('k','e','r','n'), N_("kerning table") },
- { CHR('l','c','a','r'), N_("ligature caret table") },
- { CHR('l','o','c','a'), N_("glyph location table") },
- { CHR('L','T','S','H'), N_("linear threshold table") },
- { CHR('M','A','T','H'), N_("math table") },
- { CHR('m','a','x','p'), N_("maximum profile table") },
- { CHR('M','M','S','D'), N_("Multi-Master table, obsolete") },
- { CHR('M','M','F','X'), N_("Multi-Master table, obsolete") },
- { CHR('m','o','r','t'), N_("metamorphosis table") },
- { CHR('m','o','r','x'), N_("extended metamorphosis table") },
- { CHR('n','a','m','e'), N_("name table") },
- { CHR('o','p','b','d'), N_("optical bounds table") },
- { CHR('O','S','/','2'), N_("OS/2 and Windows specific metrics table") },
- { CHR('P','C','L','T'), N_("PCL 5 data table") },
- { CHR('P','f','E','d'), N_("FontForge font debugging table") },
- { CHR('p','o','s','t'), N_("glyph name and PostScript compatibility table") },
- { CHR('p','r','e','p'), N_("control value program table") },
- { CHR('p','r','o','p'), N_("properties table") },
- { CHR('S','i','l','f'), N_("SIL Graphite rule table") },
- { CHR('S','i','l','l'), N_("(unspecified) SIL Graphite table") },
- { CHR('S','i','l','t'), N_("unknown SIL table") },
- { CHR('T','e','X',' '), N_("TeX table") },
- { CHR('t','r','a','k'), N_("tracking table") },
- { CHR('T','Y','P','1'), N_("Obsolete table for a type1 font") },
- { CHR('V','D','M','X'), N_("vertical device metrics table") },
- { CHR('v','h','e','a'), N_("vertical header table") },
- { CHR('v','m','t','x'), N_("vertical metrics table") },
- { CHR('V','O','R','G'), N_("vertical origin table") },
- { CHR('Z','a','p','f'), N_("glyph reference table") },
- { 0 , NULL }
-};
-
-static int readttfheader(FILE *ttf, struct ttfinfo *info,char *filename,
- char **choosenname) {
- int i, j, k;
- unsigned tag;
- int checksum, offset, length, version;
- int first = true;
-
- version=getlong(ttf);
- if ( version==CHR('t','t','c','f')) {
- /* TrueType font collection */
- info->is_ttc = true;
- if ( !PickTTFFont(ttf,filename,choosenname))
-return( 0 );
- /* If they picked a font, then we should be left pointing at the */
- /* start of the Table Directory for that font */
- info->one_of_many = true;
- version = getlong(ttf);
- }
-
- /* Apple says that 'typ1' is a valid code for a type1 font wrapped up in */
- /* a truetype table structure, but gives no docs on what tables get used */
- /* or how */ /* Turns out to be pretty simple */
- /* typ1 is used for both type1 fonts and CID type1 fonts, I don't think a version of 'CID ' is actually used */
- if ( version==CHR('t','y','p','1') || version==CHR('C','I','D',' ')) {
- LogError( _("Nifty, you've got one of the old Apple/Adobe type1 sfnts here\n") );
- } else if ( version!=0x00010000 && version!=CHR('t','r','u','e') &&
- version!=0x00020000 && /* Windows 3.1 Chinese version used this version for some arphic fonts */
- /* See discussion on freetype list, july 2004 */
- version!=CHR('O','T','T','O'))
-return( 0 ); /* Not version 1 of true type, nor Open Type */
-
- if ( info->openflags & of_fontlint )
- ValidateTTFHead(ttf,info);
-
- info->numtables = getushort(ttf);
- /* searchRange = */ getushort(ttf);
- /* entrySelector = */ getushort(ttf);
- /* rangeshift = */ getushort(ttf);
-
- ParseSaveTablesPref(info);
-
- for ( i=0; i<info->numtables; ++i ) {
- tag = getlong(ttf);
- checksum = getlong(ttf);
- offset = getlong(ttf);
- length = getlong(ttf);
-#ifdef DEBUG
- printf( "%c%c%c%c\n", tag>>24, (tag>>16)&0xff, (tag>>8)&0xff, tag&0xff );
-#endif
- switch ( tag ) {
- case CHR('B','A','S','E'):
- info->base_start = offset;
- break;
- case CHR('C','F','F',' '):
- info->cff_start = offset;
- info->cff_length = length;
- break;
- case CHR('c','m','a','p'):
- info->encoding_start = offset;
- break;
- case CHR('g','a','s','p'):
- info->gasp_start = offset;
- break;
- case CHR('g','l','y','f'):
- info->glyph_start = offset;
- info->glyph_length = length;
- break;
- case CHR('G','D','E','F'):
- info->gdef_start = offset;
- info->gdef_length = length;
- break;
- case CHR('G','P','O','S'):
- info->gpos_start = offset;
- info->gpos_length = length;
- break;
- case CHR('G','S','U','B'):
- info->gsub_start = offset;
- info->gsub_length = length;
- break;
- case CHR('b','d','a','t'): /* Apple/MS use a different tag, but the same format. Great. */
- case CHR('E','B','D','T'):
- info->bitmapdata_start = offset;
- info->bitmapdata_length = length;
- break;
- case CHR('b','l','o','c'): /* Apple/MS use a different tag. Great. */
- case CHR('E','B','L','C'):
- info->bitmaploc_start = offset;
- info->bitmaploc_length = length;
- break;
- case CHR('b','h','e','d'): /* Apple uses bhed for fonts with only bitmaps */
- case CHR('h','e','a','d'):
- info->head_start = offset;
- break;
- case CHR('h','h','e','a'):
- info->hhea_start = offset;
- break;
- case CHR('h','m','t','x'):
- info->hmetrics_start = offset;
- break;
- case CHR('k','e','r','n'):
- info->kern_start = offset;
- break;
- case CHR('l','o','c','a'):
- info->glyphlocations_start = offset;
- info->loca_length = length;
- info->glyph_cnt = length/2-1; /* the minus one is because there is one extra entry to give the length of the last glyph */
- if ( info->glyph_cnt<0 ) info->glyph_cnt = 0;
- break;
- case CHR('m','a','x','p'):
- info->maxp_start = offset;
- info->maxp_len = length;
- break;
- case CHR('n','a','m','e'):
- info->copyright_start = offset;
- break;
- case CHR('p','o','s','t'):
- info->postscript_start = offset;
- break;
- case CHR('O','S','/','2'):
- info->os2_start = offset;
- break;
- case CHR('C','I','D',' '):
- case CHR('T','Y','P','1'):
- info->typ1_start = offset;
- info->typ1_length = length;
- break;
- case CHR('v','h','e','a'):
- info->vhea_start = offset;
- break;
- case CHR('v','m','t','x'):
- info->vmetrics_start = offset;
- break;
- case CHR('M','A','T','H'):
- info->math_start = offset;
- info->math_length = length;
- break;
- /* to make sense of instrs */
- case CHR('c','v','t',' '):
- info->cvt_start = offset;
- info->cvt_len = length;
- break;
- case CHR('p','r','e','p'):
- info->prep_start = offset;
- info->prep_len = length;
- break;
- case CHR('f','p','g','m'):
- info->fpgm_start = offset;
- info->fpgm_len = length;
- break;
-
- /* non-standard tables I've added */
- case CHR('P','f','E','d'):
- info->pfed_start = offset;
- break;
- case CHR('F','F','T','M'):
- info->fftm_start = offset;
- break;
- case CHR('T','e','X',' '):
- info->tex_start = offset;
- break;
- case CHR('B','D','F',' '):
- info->bdf_start = offset;
- break;
-
- default:
- for ( j=0; j<info->savecnt; ++j ) if ( info->savetab[j].tag == tag ) {
- info->savetab[j].offset = offset;
- info->savetab[j].len = length;
- break;
- }
- if ( j==info->savecnt ) {
- if ( first ) {
- LogError( _("The following table(s) in the font have been ignored by FontForge\n") );
- first = false;
- }
- for ( k=0; stdtables[k].tag!=0; ++k )
- if ( stdtables[k].tag == tag )
- break;
- if ( stdtables[k].tag==0 ) {
- LogError( _(" Ignoring '%c%c%c%c'\n"), tag>>24, tag>>16, tag>>8, tag);
- } else {
- LogError( _(" Ignoring '%c%c%c%c' %s\n"), tag>>24, tag>>16, tag>>8, tag,
- _(stdtables[k].name));
- }
- }
- }
- }
- if ( info->glyphlocations_start!=0 && info->cff_start!=0 )
- LogError( _("This font contains both truetype and PostScript glyph descriptions\n only one will be used.\n"));
- else if ( (info->glyphlocations_start!=0) +
- (info->cff_start!=0) +
- (info->typ1_start!=0)>1 )
- LogError( _("This font contains multiple glyph descriptions\n only one will be used.\n"));
- if ( info->gpos_start!=0 && info->kern_start!=0 )
- LogError( _("This font contains both a 'kern' table and a 'GPOS' table.\n The 'kern' table will only be read if there is no 'kern' feature in 'GPOS'.\n"));
-return( true );
-}
-
-static void readdate(FILE *ttf,struct ttfinfo *info,int ismod) {
- int date[4], date1970[4], year[2];
- int i;
- /* Dates in sfnt files are seconds since 1904. I adjust to unix time */
- /* seconds since 1970 by figuring out how many seconds were in between */
-
- date[3] = getushort(ttf);
- date[2] = getushort(ttf);
- date[1] = getushort(ttf);
- date[0] = getushort(ttf);
- memset(date1970,0,sizeof(date1970));
- year[0] = (60*60*24*365L)&0xffff;
- year[1] = (60*60*24*365L)>>16;
- for ( i=1904; i<1970; ++i ) {
- date1970[0] += year[0];
- date1970[1] += year[1];
- if ( (i&3)==0 && (i%100!=0 || i%400==0))
- date1970[0] += 24*60*60L; /* Leap year */
- date1970[1] += (date1970[0]>>16);
- date1970[0] &= 0xffff;
- date1970[2] += date1970[1]>>16;
- date1970[1] &= 0xffff;
- date1970[3] += date1970[2]>>16;
- date1970[2] &= 0xffff;
- }
-
- for ( i=0; i<3; ++i ) {
- date[i] -= date1970[i];
- date[i+1] += date[i]>>16;
- date[i] &= 0xffff;
- }
- date[3] -= date1970[3];
-
- *(ismod ? &info->modificationtime : &info->creationtime) =
-#ifdef _HAS_LONGLONG
- (((long long) date[3])<<48) |
- (((long long) date[2])<<32) |
-#endif
- ( date[1] <<16) |
- date[0];
-}
-
-static void readttfhead(FILE *ttf,struct ttfinfo *info) {
- /* Here I want units per em, and size of loca entries */
- /* oh... also creation/modification times */
- int i, flags;
-
- fseek(ttf,info->head_start+4*4,SEEK_SET); /* skip over the version number and a bunch of junk */
- flags = getushort(ttf);
- info->optimized_for_cleartype = (flags&(1<<13))?1:0;
- info->apply_lsb = !(flags&(1<<1));
- info->emsize = getushort(ttf);
-
- info->ascent = .8*info->emsize;
- info->descent = info->emsize-info->ascent;
-
- for ( i=0; i<12; ++i )
- getushort(ttf);
- info->macstyle = getushort(ttf);
- for ( i=0; i<2; ++i )
- getushort(ttf);
- info->index_to_loc_is_long = getushort(ttf);
- if ( info->index_to_loc_is_long )
- info->glyph_cnt = info->loca_length/4-1;
- if ( info->glyph_cnt<0 ) info->glyph_cnt = 0;
-
- if ( info->fftm_start!=0 ) {
- fseek(ttf,info->fftm_start+3*4,SEEK_SET);
- } else {
- fseek(ttf,info->head_start+4*4+2+2,SEEK_SET);
- }
- readdate(ttf,info,0);
- readdate(ttf,info,1);
-}
-
-static void readttfhhea(FILE *ttf,struct ttfinfo *info) {
- /* Here I want ascent, descent and the number of horizontal metrics */
- int i;
-
- fseek(ttf,info->hhea_start+4,SEEK_SET); /* skip over the version number */
- info->pfminfo.hhead_ascent = getushort(ttf);
- info->pfminfo.hhead_descent = (short) getushort(ttf);
- info->pfminfo.hheadascent_add = info->pfminfo.hheaddescent_add = false;
- info->pfminfo.linegap = getushort(ttf);
- info->pfminfo.hheadset = true;
- /*info->ascent = info->pfminfo.hhead_ascent;*/
-
- for ( i=0; i<12; ++i )
- getushort(ttf);
- info->width_cnt = getushort(ttf);
-}
-
-static void readttfmaxp(FILE *ttf,struct ttfinfo *info) {
- /* All I want here is the number of glyphs */
- int cnt;
- fseek(ttf,info->maxp_start+4,SEEK_SET); /* skip over the version number */
- cnt = getushort(ttf);
- if ( info->glyph_cnt==0 && info->glyph_length==0 && info->loca_length<=4 &&
- info->cff_length==0 && info->typ1_start==0 ) {
- /* X11 OpenType bitmap format */;
- info->onlystrikes = true;
- } else if ( cnt!=info->glyph_cnt && info->loca_length!=0 ) {
- ff_post_notice(_("Bad Glyph Count"), _("Font file has bad glyph count field. maxp says: %d sizeof(loca)=>%d"), cnt, info->glyph_cnt);
- info->bad_glyph_data = true;
- if ( cnt>info->glyph_cnt )
- cnt = info->glyph_cnt; /* Use the smaller of the two values */
- }
- /* Open Type fonts have no loca table, so we can't calculate the glyph */
- /* count from it */
- info->glyph_cnt = cnt;
- if ( cnt<0 ) info->glyph_cnt = 0;
-}
-
-static char *stripspaces(char *str) {
- char *str2 = str, *base = str;
-
- if ( str==NULL )
-return( NULL );
-
- while ( *str ) {
- if ( *str==' ' )
- ++str;
- else
- *str2++ = *str++;
- }
- *str2 = '\0';
-return( base );
-}
-
-static void ValidatePostScriptFontName(struct ttfinfo *info, char *str) {
- char *end, *pt, *npt;
- int complained = false;
-
- /* someone gave me a font where the fontname started with the utf8 byte */
- /* order mark. PLRM says only ASCII encoding is supported. CFF says */
- /* only printable ASCII should be used */
- if ( ((uint8 *) str)[0] == 0xef && ((uint8 *) str)[1]==0xbb && ((uint8 *) str)[2] == 0xbf ) {
- LogError(_("The fontname begins with the utf8 byte order sequence. This is illegal. %s"), str+3 );
- info->bad_ps_fontname = true;
- for ( pt=str+3; *pt; ++pt )
- pt[-3] = *pt; /* ANSI says we can't strcpy overlapping strings */
- }
- strtod(str,&end);
- if ( (*end=='\0' || (isdigit(str[0]) && strchr(str,'#')!=NULL)) &&
- *str!='\0' ) {
- ff_post_error(_("Bad Font Name"),_("A Postscript name may not be a number"));
- info->bad_ps_fontname = true;
- *str = 'a';
- complained = true;
- }
- for ( pt=str; *pt; ++pt ) {
- if ( *pt<=' ' || *pt>=0x7f ||
- *pt=='(' || *pt=='[' || *pt=='{' || *pt=='<' ||
- *pt==')' || *pt==']' || *pt=='}' || *pt=='>' ||
- *pt=='%' || *pt=='/' ) {
- if ( !complained ) {
- ff_post_error(_("Bad Font Name"),_("The Postscript font name \"%.63s\" is invalid.\nIt should be printable ASCII,\nmust not contain (){}[]<>%%/ or space\nand must be shorter than 63 characters"),str);
- info->bad_ps_fontname = true;
- }
- complained = true;
- for ( npt=pt; npt[1]; ++npt )
- *npt = npt[1];
- *npt = '\0';
- --pt;
- }
- }
- if ( strlen(str)>63 ) {
- ff_post_error(_("Bad Font Name"),_("The Postscript font name \"%.63s\" is invalid.\nIt should be printable ASCII,\nmust not contain (){}[]<>%%/ or space\nand must be shorter than 63 characters"),str);
- info->bad_ps_fontname = true;
- str[63] = '\0';
- }
-}
-
-char *EnforcePostScriptName(char *old) {
- char *end, *pt, *npt, *str = copy(old);
-
- if ( old==NULL )
-return( old );
-
- strtod(str,&end);
- if ( (*end=='\0' || (isdigit(str[0]) && strchr(str,'#')!=NULL)) &&
- *str!='\0' ) {
- free(str);
- str=galloc(strlen(old)+2);
- *str = 'a';
- strcpy(str+1,old);
- }
- for ( pt=str; *pt; ++pt ) {
- if ( *pt<=' ' || *pt>=0x7f ||
- *pt=='(' || *pt=='[' || *pt=='{' || *pt=='<' ||
- *pt==')' || *pt==']' || *pt=='}' || *pt=='>' ||
- *pt=='%' || *pt=='/' ) {
- for ( npt=pt; npt[1]; ++npt )
- *npt = npt[1];
- *npt = '\0';
- }
- }
- if ( strlen(str)>63 )
- str[63] = '\0';
-return( str );
-}
-
-static int IsSubSetOf(const char *substr,const char *fullstr ) {
- /* The mac string is often a subset of the unicode string. Certain */
- /* characters can't be expressed in the mac encoding and are omitted */
- /* or turned to question marks or some such */
- const char *pt1, *pt2;
- uint32 ch1, ch2;
-
- for ( pt1=substr, pt2=fullstr, ch1=utf8_ildb(&pt1); ch1!=0 ; ) {
- if ( *pt2=='\0' )
- break;
- ch2 = utf8_ildb(&pt2);
- if ( ch1==ch2 )
- ch1 = utf8_ildb(&pt1);
- }
- if ( ch1=='\0' )
-return( true );
-
- for ( pt1=substr, pt2=fullstr, ch1=utf8_ildb(&pt1); ch1!=0 ; ) {
- if ( *pt2=='\0' )
- break;
- ch2 = utf8_ildb(&pt2);
- if ( ch1==ch2 || ch1=='?' )
- ch1 = utf8_ildb(&pt1);
- }
-return( ch1=='\0' );
-}
-
-static void TTFAddLangStr(FILE *ttf, struct ttfinfo *info, int id,
- int strlen, int stroff,int plat,int spec,int language) {
- struct ttflangname *cur, *prev;
- char *str;
-
- if ( id<0 || id>=ttf_namemax )
-return;
-
- str = _readencstring(ttf,stroff,strlen,plat,spec,language);
- if ( str==NULL ) /* we didn't understand the encoding */
-return;
- if ( id==ttf_postscriptname )
- ValidatePostScriptFontName(info,str);
- if ( *str=='\0' ) {
- free(str);
-return;
- }
-
- if ( plat==1 || plat==0 )
- language = WinLangFromMac(language);
- if ( (language&0xff00)==0 ) language |= 0x400;
-
- for ( prev=NULL, cur=info->names; cur!=NULL && cur->lang!=language; prev = cur, cur=cur->next );
- if ( cur==NULL ) {
- cur = chunkalloc(sizeof(struct ttflangname));
- cur->lang = language;
- if ( prev==NULL )
- info->names = cur;
- else
- prev->next = cur;
- }
- if ( cur->names[id]==NULL ) {
- cur->names[id] = str;
- if ( plat==1 || plat==0 )
- cur->frommac[id/32] |= (1<<(id&0x1f));
-/* There's some wacky bug in gcc. If the optimizer is on then strcmp gets turned */
-/* into some inline call. Which would be fine, except the following line goes */
-/* bluey. "Called object is not a function", etc. Compiles fine if we turn off */
-/* the inlining magic */
-#ifdef strcmp
-# undef strcmp
-#endif
- } else if ( strcmp(str,cur->names[id])==0 ) {
- free(str);
- if ( plat==3 )
- cur->frommac[id/32] &= ~(1<<(id&0x1f));
- } else if ( plat==1 ) {
- /* Mac string doesn't match mac unicode string */
- if ( !IsSubSetOf(str,cur->names[id]) )
- LogError( _("Warning: Mac and Unicode entries in the 'name' table differ for the\n %s string in the language %s\n Mac String: %s\nMac Unicode String: %s\n"),
- TTFNameIds(id),MSLangString(language),
- str,cur->names[id]);
- else
- LogError( _("Warning: Mac string is a subset of the Unicode string in the 'name' table\n for the %s string in the %s language.\n"),
- TTFNameIds(id),MSLangString(language));
- free(str);
- } else if ( plat==3 && (cur->frommac[id/32] & (1<<(id&0x1f))) ) {
- if ( !IsSubSetOf(cur->names[id],str) )
- LogError( _("Warning: Mac and Windows entries in the 'name' table differ for the\n %s string in the language %s\n Mac String: %s\nWindows String: %s\n"),
- TTFNameIds(id),MSLangString(language),
- cur->names[id],str);
- else
- LogError( _("Warning: Mac string is a subset of the Windows string in the 'name' table\n for the %s string in the %s language.\n"),
- TTFNameIds(id),MSLangString(language));
- free(cur->names[id]);
- cur->names[id] = str;
- cur->frommac[id/32] &= ~(1<<(id&0x1f));
- } else {
- int ret;
- if ( info->dupnamestate!=0 )
- ret = info->dupnamestate;
- else
- ret = 3;
- if ( ret==0 || ret==1 )
- free(str);
- else {
- free(cur->names[id]);
- cur->names[id] = str;
- }
- }
-}
-
-static int is_ascii(char *str) { /* isascii is in ctype */
- if ( str==NULL )
-return( false );
- while ( *str && *str<127 && *str>=' ' )
- ++str;
-return( *str=='\0' );
-}
-
-static char *FindLangEntry(struct ttfinfo *info, int id ) {
- /* Look for an entry with string id */
- /* we prefer english, if we can't find english look for something in ascii */
- struct ttflangname *cur;
- char *ret;
-
- for ( cur=info->names; cur!=NULL && cur->lang!=0x409; cur=cur->next );
- if ( cur!=NULL && cur->names[id]==NULL ) cur = NULL;
- if ( cur==NULL )
- for ( cur=info->names; cur!=NULL && (cur->lang&0xf)!=0x09; cur=cur->next );
- if ( cur!=NULL && cur->names[id]==NULL ) cur = NULL;
- if ( cur==NULL )
- for ( cur=info->names; cur!=NULL && !is_ascii(cur->names[id]); cur=cur->next );
- if ( cur==NULL )
- for ( cur=info->names; cur!=NULL && cur->names[id]==NULL; cur=cur->next );
- if ( cur==NULL )
-return( NULL );
- ret = copy(cur->names[id]);
-return( ret );
-}
-
-struct otfname *FindAllLangEntries(FILE *ttf, struct ttfinfo *info, int id ) {
- /* Look for all entries with string id under windows platform */
- int32 here = ftell(ttf);
- int i, cnt, tableoff;
- int platform, specific, language, name, str_len, stroff;
- struct otfname *head=NULL, *cur;
-
- if ( info->copyright_start!=0 && id!=0 ) {
- fseek(ttf,info->copyright_start,SEEK_SET);
- /* format selector = */ getushort(ttf);
- cnt = getushort(ttf);
- tableoff = info->copyright_start+getushort(ttf);
- for ( i=0; i<cnt; ++i ) {
- platform = getushort(ttf);
- specific = getushort(ttf);
- language = getushort(ttf);
- name = getushort(ttf);
- str_len = getushort(ttf);
- stroff = getushort(ttf);
-
- if ( platform==3 && name==id ) {
- char *temp = _readencstring(ttf,tableoff+stroff,str_len,platform,specific,language);
- if ( temp!=NULL ) {
- cur = chunkalloc(sizeof(struct otfname));
- cur->next = head;
- head = cur;
- cur->lang = language;
- cur->name = temp;
- }
- }
- }
- fseek(ttf,here,SEEK_SET);
- }
-return( head );
-}
-
-static void readttfcopyrights(FILE *ttf,struct ttfinfo *info) {
- int i, cnt, tableoff;
- int platform, specific, language, name, str_len, stroff;
-
- if ( info->copyright_start!=0 ) {
- fseek(ttf,info->copyright_start,SEEK_SET);
- /* format selector = */ getushort(ttf);
- cnt = getushort(ttf);
- tableoff = info->copyright_start+getushort(ttf);
- for ( i=0; i<cnt; ++i ) {
- platform = getushort(ttf);
- specific = getushort(ttf);
- language = getushort(ttf);
- name = getushort(ttf);
- str_len = getushort(ttf);
- stroff = getushort(ttf);
-
- TTFAddLangStr(ttf,info,name,str_len,tableoff+stroff,
- platform,specific,language);
- }
- }
-
- if ( info->copyright==NULL )
- info->copyright = FindLangEntry(info,ttf_copyright);
- if ( info->familyname==NULL )
- info->familyname = FindLangEntry(info,ttf_family);
- if ( info->fullname==NULL )
- info->fullname = FindLangEntry(info,ttf_fullname);
- if ( info->version==NULL )
- info->version = FindLangEntry(info,ttf_version);
- if ( info->fontname==NULL )
- info->fontname = FindLangEntry(info,ttf_postscriptname);
-
- if ( info->fontname != NULL && *info->fontname=='\0' ) {
- free(info->fontname);
- info->fontname = NULL;
- }
- if ( info->familyname != NULL && *info->familyname=='\0' ) {
- free(info->familyname);
- info->familyname = NULL;
- }
- if ( info->fullname != NULL && *info->fullname=='\0' ) {
- free(info->fullname);
- info->fullname = NULL;
- }
-
- /* OpenType spec says the version string should begin with "Version " and */
- /* end with a space and have a number in between */
- if ( info->version==NULL ) info->version = copy("1.0");
- else if ( strnmatch(info->version,"Version ",8)==0 ) {
- char *temp = copy(info->version+8);
- if ( temp[strlen(temp)-1]==' ' )
- temp[strlen(temp)-1] = '\0';
- free(info->version);
- info->version = temp;
- }
- if ( info->fontname==NULL ) {
- if ( info->fullname!=NULL )
- info->fontname = stripspaces(copy(info->fullname));
- if ( info->fontname==NULL && info->familyname!=NULL )
- info->fontname = stripspaces(copy(info->familyname));
- if ( info->fontname!=NULL )
- ValidatePostScriptFontName(info,info->fontname);
- }
-}
-
-static void readttfpreglyph(FILE *ttf,struct ttfinfo *info) {
- if ( info->head_start!=0 )
- readttfhead(ttf,info);
- if ( info->hhea_start!=0 )
- readttfhhea(ttf,info);
- if ( info->maxp_start!=0 )
- readttfmaxp(ttf,info);
- readttfcopyrights(ttf,info); /* This one has internal checks */
-}
-
-#define _On_Curve 1
-#define _X_Short 2
-#define _Y_Short 4
-#define _Repeat 8
-#define _X_Same 0x10
-#define _Y_Same 0x20
-
-static void FigureControls(SplinePoint *from, SplinePoint *to, BasePoint *cp,
- int is_order2) {
- /* What are the control points for 2 cp bezier which will provide the same*/
- /* curve as that for the 1 cp bezier specified above */
- real b, c, d;
-
- if ( is_order2 ) {
- from->nextcp = to->prevcp = *cp;
- if ( cp->x==to->me.x && cp->y==to->me.y ) {
- /* I would lose track of the proper location of this cp if I left */
- /* it here (would end up with from->nonextcp, which would mean I'd*/
- /* use from->me rather than to->me in tottf.c:SSAddPoints. So we */
- /* distort it a little */
- BasePoint off;
- double len;
- off.x = from->me.x-to->me.x; off.y = from->me.y-to->me.y;
- len = sqrt(off.x*off.x+off.y*off.y);
- if ( len>3 ) {
- /* move the cp slightly toward from, but on the line between the two */
- from->nextcp.x = (to->prevcp.x += rint(off.x/len));
- from->nextcp.y = (to->prevcp.y += rint(off.y/len));
- }
- }
- } else {
- d = from->me.x;
- c = 2*cp->x - 2*from->me.x;
- b = to->me.x+from->me.x-2*cp->x;
- from->nextcp.x = d+c/3;
- to->prevcp.x = from->nextcp.x + (c+b)/3;
-
- d = from->me.y;
- c = 2*cp->y - 2*from->me.y;
- b = to->me.y+from->me.y-2*cp->y;
- from->nextcp.y = d+c/3;
- to->prevcp.y = from->nextcp.y + (c+b)/3;
- }
-
- if ( from->me.x!=from->nextcp.x || from->me.y!=from->nextcp.y )
- from->nonextcp = false;
- if ( to->me.x!=to->prevcp.x || to->me.y!=to->prevcp.y )
- to->noprevcp = false;
- if ( is_order2 && (to->noprevcp || from->nonextcp)) {
- to->noprevcp = from->nonextcp = true;
- from->nextcp = from->me;
- to->prevcp = to->me;
- }
-}
-
-static SplineSet *ttfbuildcontours(int path_cnt,uint16 *endpt, char *flags,
- BasePoint *pts, int is_order2) {
- SplineSet *head=NULL, *last=NULL, *cur;
- int i, path, start, last_off;
- SplinePoint *sp;
-
- for ( path=i=0; path<path_cnt; ++path ) {
- if ( endpt[path]<i ) /* Sigh. Yes there are fonts with bad endpt info */
- continue;
- cur = chunkalloc(sizeof(SplineSet));
- if ( head==NULL )
- head = cur;
- else
- last->next = cur;
- last = cur;
- last_off = false;
- start = i;
- sp = NULL;
- while ( i<=endpt[path] ) {
- if ( flags[i]&_On_Curve ) {
- sp = chunkalloc(sizeof(SplinePoint));
- sp->me = sp->nextcp = sp->prevcp = pts[i];
- sp->nonextcp = sp->noprevcp = true;
- sp->ttfindex = i;
- sp->nextcpindex = 0xffff;
- if ( last_off && cur->last!=NULL )
- FigureControls(cur->last,sp,&pts[i-1],is_order2);
- last_off = false;
- } else if ( last_off ) {
- /* two off curve points get a third on curve point created */
- /* half-way between them. Now isn't that special */
- sp = chunkalloc(sizeof(SplinePoint));
- sp->me.x = (pts[i].x+pts[i-1].x)/2;
- sp->me.y = (pts[i].y+pts[i-1].y)/2;
- sp->nextcp = sp->prevcp = sp->me;
- sp->nonextcp = true;
- sp->ttfindex = 0xffff;
- sp->nextcpindex = i;
- if ( last_off && cur->last!=NULL )
- FigureControls(cur->last,sp,&pts[i-1],is_order2);
- /* last_off continues to be true */
- } else {
- if ( cur->first!=NULL )
- cur->last->nextcpindex = i;
- last_off = true;
- sp = NULL;
- }
- if ( sp!=NULL ) {
- if ( cur->first==NULL )
- cur->first = sp;
- else
- SplineMake(cur->last,sp,is_order2);
- cur->last = sp;
- }
- ++i;
- }
- if ( start==i-1 ) {
- /* MS chinese fonts have contours consisting of a single off curve*/
- /* point. What on earth do they think that means? */
- /* Oh. I see. It's used to possition marks and such */
- if ( cur->first==NULL ) {
- sp = chunkalloc(sizeof(SplinePoint));
- sp->me.x = pts[start].x;
- sp->me.y = pts[start].y;
- sp->nextcp = sp->prevcp = sp->me;
- sp->nonextcp = sp->noprevcp = true;
- sp->ttfindex = i-1;
- sp->nextcpindex = 0xffff;
- cur->first = cur->last = sp;
- }
- } else if ( !(flags[start]&_On_Curve) && !(flags[i-1]&_On_Curve) ) {
- sp = chunkalloc(sizeof(SplinePoint));
- sp->me.x = (pts[start].x+pts[i-1].x)/2;
- sp->me.y = (pts[start].y+pts[i-1].y)/2;
- sp->nextcp = sp->prevcp = sp->me;
- sp->nonextcp = true;
- sp->ttfindex = 0xffff;
- sp->nextcpindex = start;
- FigureControls(cur->last,sp,&pts[i-1],is_order2);
- SplineMake(cur->last,sp,is_order2);
- cur->last = sp;
- FigureControls(sp,cur->first,&pts[start],is_order2);
- } else if ( !(flags[i-1]&_On_Curve)) {
- FigureControls(cur->last,cur->first,&pts[i-1],is_order2);
- cur->last->nextcpindex = i-1;
- } else if ( !(flags[start]&_On_Curve) ) {
- FigureControls(cur->last,cur->first,&pts[start],is_order2);
- sp->nextcpindex = start;
- }
- if ( cur->last!=cur->first ) {
- SplineMake(cur->last,cur->first,is_order2);
- cur->last = cur->first;
- }
- for ( sp=cur->first; ; ) {
- /*if ( sp->ttfindex!=0xffff && SPInterpolate(sp) )
- sp->dontinterpolate = true;*/ /* TODO: needs checking */
- if ( sp->next==NULL )
- break;
- sp=sp->next->to;
- if ( sp==cur->first )
- break;
- }
- }
-return( head );
-}
-
-static void readttfsimpleglyph(FILE *ttf,struct ttfinfo *info,SplineChar *sc, int path_cnt) {
- uint16 *endpt = galloc((path_cnt+1)*sizeof(uint16));
- uint8 *instructions;
- char *flags;
- BasePoint *pts;
- int i, j, tot, len;
- int last_pos;
-
- for ( i=0; i<path_cnt; ++i ) {
- endpt[i] = getushort(ttf);
- if ( i!=0 && endpt[i]<endpt[i-1] ) {
- info->bad_glyph_data = true;
- LogError( _("Bad tt font: contour ends make no sense in glyph %d.\n"),
- sc->orig_pos );
-return;
- }
- }
- if ( path_cnt==0 ) {
- tot = 0;
- pts = galloc(sizeof(BasePoint));
- } else {
- tot = endpt[path_cnt-1]+1;
- pts = galloc(tot*sizeof(BasePoint));
- }
-
- len = getushort(ttf);
- instructions = galloc(len);
- for ( i=0; i<len; ++i )
- instructions[i] = getc(ttf);
-
- flags = galloc(tot);
- for ( i=0; i<tot; ++i ) {
- flags[i] = getc(ttf);
- if ( flags[i]&_Repeat ) {
- int cnt = getc(ttf);
- if ( i+cnt>=tot ) {
- IError("Flag count is wrong (or total is): %d %d", i+cnt, tot );
- cnt = tot-i-1;
- }
- for ( j=0; j<cnt; ++j )
- flags[i+j+1] = flags[i];
- i += cnt;
- }
- if ( feof(ttf))
- break;
- }
- if ( i!=tot )
- IError("Flag count is wrong (or total is): %d %d in glyph %d", i, tot, sc->orig_pos );
-
- last_pos = 0;
- for ( i=0; i<tot; ++i ) {
- if ( flags[i]&_X_Short ) {
- int off = getc(ttf);
- if ( !(flags[i]&_X_Same ) )
- off = -off;
- pts[i].x = last_pos + off;
- } else if ( flags[i]&_X_Same )
- pts[i].x = last_pos;
- else
- pts[i].x = last_pos + (short) getushort(ttf);
- last_pos = pts[i].x;
- }
-
- last_pos = 0;
- for ( i=0; i<tot; ++i ) {
- if ( flags[i]&_Y_Short ) {
- int off = getc(ttf);
- if ( !(flags[i]&_Y_Same ) )
- off = -off;
- pts[i].y = last_pos + off;
- } else if ( flags[i]&_Y_Same )
- pts[i].y = last_pos;
- else
- pts[i].y = last_pos + (short) getushort(ttf);
- last_pos = pts[i].y;
- }
-
- sc->layers[ly_fore].splines = ttfbuildcontours(path_cnt,endpt,flags,pts,info->to_order2);
- if ( info->to_order2 && len!=0 ) {
- sc->ttf_instrs_len = len;
- sc->ttf_instrs = instructions;
- } else
- free(instructions);
- SCCatagorizePoints(sc);
- free(endpt);
- free(flags);
- free(pts);
- if ( feof(ttf)) {
- LogError( _("Reached end of file when reading simple glyph\n") );
- info->bad_glyph_data = true;
- }
-}
-
-static void readttfcompositglyph(FILE *ttf,struct ttfinfo *info,SplineChar *sc, int32 end) {
- RefChar *head=NULL, *last=NULL, *cur=NULL;
- int flags=0, arg1, arg2;
- int use_my_metrics=0;
-
- if ( ftell(ttf)>=end ) {
- LogError( _("Empty composite %d\n"), sc->orig_pos );
- info->bad_glyph_data = true;
-return;
- }
-
- do {
- if ( ftell(ttf)>=end ) {
- LogError( _("Bad flags value, implied MORE components at end of glyph %d\n"), sc->orig_pos );
- info->bad_glyph_data = true;
- break;
- }
- cur = RefCharCreate();
- flags = getushort(ttf);
- cur->orig_pos = getushort(ttf);
- if ( feof(ttf) || cur->orig_pos>=info->glyph_cnt ) {
- LogError(_("Reference to glyph %d out of bounds when parsing 'glyf' table.\n"), cur->orig_pos );
- info->bad_glyph_data = true;
- cur->orig_pos = 0;
- }
- if ( info->inuse!=NULL )
- info->inuse[cur->orig_pos] = true;
- if ( flags&_ARGS_ARE_WORDS ) {
- arg1 = (short) getushort(ttf);
- arg2 = (short) getushort(ttf);
- } else {
- arg1 = (signed char) getc(ttf);
- arg2 = (signed char) getc(ttf);
- }
- cur->use_my_metrics = (flags & _USE_MY_METRICS) ? 1 : 0;
- if ( cur->use_my_metrics ) {
- if ( use_my_metrics ) {
- LogError( _("Use-my-metrics flag set on at least two components in glyph %d\n"), sc->orig_pos );
- info->bad_glyph_data = true;
- } else
- use_my_metrics = true;
- }
- cur->round_translation_to_grid = (flags & _ROUND) ? 1 : 0;
- if ( flags & _ARGS_ARE_XY ) {
- /* There is some very strange stuff (half-)documented on the apple*/
- /* site about how these should be interpretted when there are */
- /* scale factors, or rotations */
- /* It isn't well enough described to be comprehensible */
- /* http://fonts.apple.com/TTRefMan/RM06/Chap6glyf.html */
- /* Microsoft says nothing about this */
- /* Adobe implies this is a difference between MS and Apple */
- /* MS doesn't do this, Apple does (GRRRGH!!!!) */
- /* Adobe says that setting bit 12 means that this will not happen */
- /* Adobe says that setting bit 11 means that this will happen */
- /* So if either bit is set we know when this happens, if neither */
- /* we guess... But I still don't know how to interpret the */
- /* apple mode under rotation... */
- /* I notice that FreeType does nothing about rotation nor does it */
- /* interpret bits 11&12 */
- /* Ah. It turns out that even Apple does not do what Apple's docs */
- /* claim it does. I think I've worked it out (see below), but... */
- /* Bleah! */
- cur->transform[4] = arg1;
- cur->transform[5] = arg2;
- } else {
- /* Somehow we can get offsets by looking at the points in the */
- /* points so far generated and comparing them to the points in */
- /* the current componant */
- /* How exactly is not described on any of the Apple, MS, Adobe */
- /* freetype looks up arg1 in the set of points we've got so far */
- /* looks up arg2 in the new component (before renumbering) */
- /* offset.x = arg1.x - arg2.x; offset.y = arg1.y - arg2.y; */
- /* This fixup needs to be done later though (after all glyphs */
- /* have been loaded) */
- cur->match_pt_base = arg1;
- cur->match_pt_ref = arg2;
- cur->point_match = true;
- }
- cur->transform[0] = cur->transform[3] = 1.0;
- if ( flags & _SCALE )
- cur->transform[0] = cur->transform[3] = get2dot14(ttf);
- else if ( flags & _XY_SCALE ) {
- cur->transform[0] = get2dot14(ttf);
- cur->transform[3] = get2dot14(ttf);
- } else if ( flags & _MATRIX ) {
- cur->transform[0] = get2dot14(ttf);
- cur->transform[1] = get2dot14(ttf);
- cur->transform[2] = get2dot14(ttf);
- cur->transform[3] = get2dot14(ttf);
- }
- if ( flags & _ARGS_ARE_XY ) { /* Only muck with these guys if they are real offsets and not point matching */
-#ifdef __Mac
- /* On mac assume scaled offsets unless told unscaled explicitly */
- if ( !(flags&_UNSCALED_OFFSETS) &&
-#else
- /* everywhere else assume unscaled offsets unless told scaled explicitly */
- if ( (flags & _SCALED_OFFSETS) &&
-#endif
- (flags & _ARGS_ARE_XY) && (flags&(_SCALE|_XY_SCALE|_MATRIX))) {
- /*static int asked = 0;*/
- /* This is not what Apple documents on their website. But it is */
- /* what appears to match the behavior of their rasterizer */
- /* Apple has changed their documentation (without updating their */
- /* changelog), but I believe they are still incorrect */
- cur->transform[4] *= sqrt(cur->transform[0]*cur->transform[0]+
- cur->transform[1]*cur->transform[1]);
- cur->transform[5] *= sqrt(cur->transform[2]*cur->transform[2]+
- cur->transform[3]*cur->transform[3]);
-#if 0
- /* Apple's Chicago is an example */
- if ( info->fontname!=NULL && strcmp(info->fontname,"CompositeMac")!=0 && !asked ) {
- /* Not interested in the test font I generated myself */
- asked = true;
- fprintf( stderr, "Neat! You've got a font that actually uses Apple's scaled composite offsets.\n" );
- fprintf( stderr, " I've never seen one, could you send me a copy of %s?\n", info->fontname );
- fprintf( stderr, " Thanks. gww@silcom.com\n" );
- }
-#endif
- }
- }
- if ( cur->orig_pos>=info->glyph_cnt ) {
- LogError(_("Glyph %d attempts to reference glyph %d which is outside the font\n"), sc->orig_pos, cur->orig_pos );
- chunkfree(cur,sizeof(*cur));
- } else {
- if ( head==NULL )
- head = cur;
- else
- last->next = cur;
- last = cur;
- }
- if ( feof(ttf)) {
- LogError(_("Reached end of file when reading composit glyph\n") );
- info->bad_glyph_data = true;
- break;
- }
- } while ( flags&_MORE );
- if ( (flags & _INSTR ) && info->to_order2 && ftell(ttf)<end ) {
- sc->ttf_instrs_len = getushort(ttf);
- if ( sc->ttf_instrs_len > 0 && ftell(ttf)+sc->ttf_instrs_len<=end ) {
- uint8 *instructions = galloc(sc->ttf_instrs_len);
- int i;
- for ( i=0; i<sc->ttf_instrs_len; ++i )
- instructions[i] = getc(ttf);
- sc->ttf_instrs = instructions;
- } else
- sc->ttf_instrs_len = 0;
- }
- sc->layers[ly_fore].refs = head;
-}
-
-static SplineChar *readttfglyph(FILE *ttf,struct ttfinfo *info,int start, int end,int gid) {
- int path_cnt;
- SplineChar *sc = SplineCharCreate(2);
-
- sc->unicodeenc = -1;
- sc->vwidth = info->emsize;
- sc->orig_pos = gid;
-
- if ( end>(int)info->glyph_length ) {
- if ( !info->complainedbeyondglyfend )
- LogError(_("Bad glyph (%d), its definition extends beyond the end of the glyf table\n"), gid );
- info->bad_glyph_data = true;
- info->complainedbeyondglyfend = true;
- SplineCharFree(sc);
-return( NULL );
- } else if ( end<start ) {
- LogError(_("Bad glyph (%d), its data length is negative\n"), gid );
- SplineCharFree(sc);
-return( NULL );
- }
-
- if ( start==end ) {
- /* This isn't mentioned, but we seem to get some glyphs with no size,*/
- /* not even a path cnt. They appear to be empty glyphs */
-return( sc );
- }
- fseek(ttf,info->glyph_start+start,SEEK_SET);
- path_cnt = (short) getushort(ttf);
-
-#ifdef LUA_FF_LIB
- sc->xmin = getushort(ttf);
- sc->ymin = getushort(ttf);
- sc->xmax = getushort(ttf);
- sc->ymax = getushort(ttf);
- sc->lsidebearing = sc->xmin;
-#endif
- if (THread_ttf_glyph_data) {
- if ( path_cnt>=0 )
- readttfsimpleglyph(ttf,info,sc,path_cnt);
- else
- readttfcompositglyph(ttf,info,sc,info->glyph_start+end);
- if ( start>end ) {
- LogError(_("Bad glyph (%d), disordered 'loca' table (start comes after end)\n"), gid );
- info->bad_glyph_data = true;
- } else if ( ftell(ttf)>(long)(info->glyph_start+end) ) {
- LogError(_("Bad glyph (%d), its definition extends beyond the space allowed for it\n"), gid );
- info->bad_glyph_data = true;
- }
-
- /* find the bb */
- THPatchSplineChar(sc);
- }
-
-return( sc );
-}
-
-static void readttfencodings(FILE *ttf,struct ttfinfo *info, int justinuse);
-
-static void readttfglyphs(FILE *ttf,struct ttfinfo *info) {
- int i, anyread;
- uint32 *goffsets = galloc((info->glyph_cnt+1)*sizeof(uint32));
-
- /* First we read all the locations. This might not be needed, they may */
- /* just follow one another, but nothing I've noticed says that so let's */
- /* be careful */
- fseek(ttf,info->glyphlocations_start,SEEK_SET);
- if ( info->index_to_loc_is_long ) {
- for ( i=0; i<=info->glyph_cnt ; ++i )
- goffsets[i] = getlong(ttf);
- } else {
- for ( i=0; i<=info->glyph_cnt ; ++i )
- goffsets[i] = 2*getushort(ttf);
- }
-
- info->chars = gcalloc(info->glyph_cnt,sizeof(SplineChar *));
- if ( !info->is_ttc || (info->openflags&of_all_glyphs_in_ttc)) {
- /* read all the glyphs */
- for ( i=0; i<info->glyph_cnt ; ++i ) {
- info->chars[i] = readttfglyph(ttf,info,goffsets[i],goffsets[i+1],i);
- ff_progress_next();
- }
- } else {
- /* only read the glyphs we actually use in this font */
- /* this is complicated by references (and substitutions), */
- /* we can't just rely on the encoding to tell us what is used */
- info->inuse = gcalloc(info->glyph_cnt,sizeof(char));
- readttfencodings(ttf,info,git_justinuse);
- if ( info->gsub_start!=0 ) /* Some glyphs may appear in substitutions and not in the encoding... */
- readttfgsubUsed(ttf,info);
- if ( info->math_start!=0 )
- otf_read_math_used(ttf,info);
- /* I don't bother to read the morx table because mac doesn't */
- /* support ttc files */
- anyread = true;
- while ( anyread ) {
- anyread = false;
- for ( i=0; i<info->glyph_cnt ; ++i ) {
- if ( info->inuse[i] && info->chars[i]==NULL ) {
- info->chars[i] = readttfglyph(ttf,info,goffsets[i],goffsets[i+1],i);
- ff_progress_next();
- anyread = info->chars[i]!=NULL;
- }
- }
- }
- free(info->inuse); info->inuse = NULL;
- }
- free(goffsets);
- for ( i=0; i<info->glyph_cnt ; ++i )
- if ( info->chars[i]!=NULL )
- info->chars[i]->orig_pos = i;
- ff_progress_next_stage();
-}
-
-/* Standard names for cff */
-const char *cffnames[] = {
- ".notdef",
- "space",
- "exclam",
- "quotedbl",
- "numbersign",
- "dollar",
- "percent",
- "ampersand",
- "quoteright",
- "parenleft",
- "parenright",
- "asterisk",
- "plus",
- "comma",
- "hyphen",
- "period",
- "slash",
- "zero",
- "one",
- "two",
- "three",
- "four",
- "five",
- "six",
- "seven",
- "eight",
- "nine",
- "colon",
- "semicolon",
- "less",
- "equal",
- "greater",
- "question",
- "at",
- "A",
- "B",
- "C",
- "D",
- "E",
- "F",
- "G",
- "H",
- "I",
- "J",
- "K",
- "L",
- "M",
- "N",
- "O",
- "P",
- "Q",
- "R",
- "S",
- "T",
- "U",
- "V",
- "W",
- "X",
- "Y",
- "Z",
- "bracketleft",
- "backslash",
- "bracketright",
- "asciicircum",
- "underscore",
- "quoteleft",
- "a",
- "b",
- "c",
- "d",
- "e",
- "f",
- "g",
- "h",
- "i",
- "j",
- "k",
- "l",
- "m",
- "n",
- "o",
- "p",
- "q",
- "r",
- "s",
- "t",
- "u",
- "v",
- "w",
- "x",
- "y",
- "z",
- "braceleft",
- "bar",
- "braceright",
- "asciitilde",
- "exclamdown",
- "cent",
- "sterling",
- "fraction",
- "yen",
- "florin",
- "section",
- "currency",
- "quotesingle",
- "quotedblleft",
- "guillemotleft",
- "guilsinglleft",
- "guilsinglright",
- "fi",
- "fl",
- "endash",
- "dagger",
- "daggerdbl",
- "periodcentered",
- "paragraph",
- "bullet",
- "quotesinglbase",
- "quotedblbase",
- "quotedblright",
- "guillemotright",
- "ellipsis",
- "perthousand",
- "questiondown",
- "grave",
- "acute",
- "circumflex",
- "tilde",
- "macron",
- "breve",
- "dotaccent",
- "dieresis",
- "ring",
- "cedilla",
- "hungarumlaut",
- "ogonek",
- "caron",
- "emdash",
- "AE",
- "ordfeminine",
- "Lslash",
- "Oslash",
- "OE",
- "ordmasculine",
- "ae",
- "dotlessi",
- "lslash",
- "oslash",
- "oe",
- "germandbls",
- "onesuperior",
- "logicalnot",
- "mu",
- "trademark",
- "Eth",
- "onehalf",
- "plusminus",
- "Thorn",
- "onequarter",
- "divide",
- "brokenbar",
- "degree",
- "thorn",
- "threequarters",
- "twosuperior",
- "registered",
- "minus",
- "eth",
- "multiply",
- "threesuperior",
- "copyright",
- "Aacute",
- "Acircumflex",
- "Adieresis",
- "Agrave",
- "Aring",
- "Atilde",
- "Ccedilla",
- "Eacute",
- "Ecircumflex",
- "Edieresis",
- "Egrave",
- "Iacute",
- "Icircumflex",
- "Idieresis",
- "Igrave",
- "Ntilde",
- "Oacute",
- "Ocircumflex",
- "Odieresis",
- "Ograve",
- "Otilde",
- "Scaron",
- "Uacute",
- "Ucircumflex",
- "Udieresis",
- "Ugrave",
- "Yacute",
- "Ydieresis",
- "Zcaron",
- "aacute",
- "acircumflex",
- "adieresis",
- "agrave",
- "aring",
- "atilde",
- "ccedilla",
- "eacute",
- "ecircumflex",
- "edieresis",
- "egrave",
- "iacute",
- "icircumflex",
- "idieresis",
- "igrave",
- "ntilde",
- "oacute",
- "ocircumflex",
- "odieresis",
- "ograve",
- "otilde",
- "scaron",
- "uacute",
- "ucircumflex",
- "udieresis",
- "ugrave",
- "yacute",
- "ydieresis",
- "zcaron",
- "exclamsmall",
- "Hungarumlautsmall",
- "dollaroldstyle",
- "dollarsuperior",
- "ampersandsmall",
- "Acutesmall",
- "parenleftsuperior",
- "parenrightsuperior",
- "twodotenleader",
- "onedotenleader",
- "zerooldstyle",
- "oneoldstyle",
- "twooldstyle",
- "threeoldstyle",
- "fouroldstyle",
- "fiveoldstyle",
- "sixoldstyle",
- "sevenoldstyle",
- "eightoldstyle",
- "nineoldstyle",
- "commasuperior",
- "threequartersemdash",
- "periodsuperior",
- "questionsmall",
- "asuperior",
- "bsuperior",
- "centsuperior",
- "dsuperior",
- "esuperior",
- "isuperior",
- "lsuperior",
- "msuperior",
- "nsuperior",
- "osuperior",
- "rsuperior",
- "ssuperior",
- "tsuperior",
- "ff",
- "ffi",
- "ffl",
- "parenleftinferior",
- "parenrightinferior",
- "Circumflexsmall",
- "hyphensuperior",
- "Gravesmall",
- "Asmall",
- "Bsmall",
- "Csmall",
- "Dsmall",
- "Esmall",
- "Fsmall",
- "Gsmall",
- "Hsmall",
- "Ismall",
- "Jsmall",
- "Ksmall",
- "Lsmall",
- "Msmall",
- "Nsmall",
- "Osmall",
- "Psmall",
- "Qsmall",
- "Rsmall",
- "Ssmall",
- "Tsmall",
- "Usmall",
- "Vsmall",
- "Wsmall",
- "Xsmall",
- "Ysmall",
- "Zsmall",
- "colonmonetary",
- "onefitted",
- "rupiah",
- "Tildesmall",
- "exclamdownsmall",
- "centoldstyle",
- "Lslashsmall",
- "Scaronsmall",
- "Zcaronsmall",
- "Dieresissmall",
- "Brevesmall",
- "Caronsmall",
- "Dotaccentsmall",
- "Macronsmall",
- "figuredash",
- "hypheninferior",
- "Ogoneksmall",
- "Ringsmall",
- "Cedillasmall",
- "questiondownsmall",
- "oneeighth",
- "threeeighths",
- "fiveeighths",
- "seveneighths",
- "onethird",
- "twothirds",
- "zerosuperior",
- "foursuperior",
- "fivesuperior",
- "sixsuperior",
- "sevensuperior",
- "eightsuperior",
- "ninesuperior",
- "zeroinferior",
- "oneinferior",
- "twoinferior",
- "threeinferior",
- "fourinferior",
- "fiveinferior",
- "sixinferior",
- "seveninferior",
- "eightinferior",
- "nineinferior",
- "centinferior",
- "dollarinferior",
- "periodinferior",
- "commainferior",
- "Agravesmall",
- "Aacutesmall",
- "Acircumflexsmall",
- "Atildesmall",
- "Adieresissmall",
- "Aringsmall",
- "AEsmall",
- "Ccedillasmall",
- "Egravesmall",
- "Eacutesmall",
- "Ecircumflexsmall",
- "Edieresissmall",
- "Igravesmall",
- "Iacutesmall",
- "Icircumflexsmall",
- "Idieresissmall",
- "Ethsmall",
- "Ntildesmall",
- "Ogravesmall",
- "Oacutesmall",
- "Ocircumflexsmall",
- "Otildesmall",
- "Odieresissmall",
- "OEsmall",
- "Oslashsmall",
- "Ugravesmall",
- "Uacutesmall",
- "Ucircumflexsmall",
- "Udieresissmall",
- "Yacutesmall",
- "Thornsmall",
- "Ydieresissmall",
- "001.000",
- "001.001",
- "001.002",
- "001.003",
- "Black",
- "Bold",
- "Book",
- "Light",
- "Medium",
- "Regular",
- "Roman",
- "Semibold",
- NULL
-};
-const int nStdStrings = sizeof(cffnames)/sizeof(cffnames[0])-1;
-
-static char **readcfffontnames(FILE *ttf,int *cnt,struct ttfinfo *info) {
- uint16 count = getushort(ttf);
- int offsize;
- uint32 *offsets;
- char **names;
- int i,j;
-
- if ( cnt!=NULL ) *cnt = count;
-
- if ( count==0 )
-return( NULL );
- offsets = galloc((count+1)*sizeof(uint32));
- offsize = getc(ttf);
- for ( i=0; i<=count; ++i )
- offsets[i] = getoffset(ttf,offsize);
- names = galloc((count+1)*sizeof(char *));
- for ( i=0; i<count; ++i ) {
- if ( offsets[i+1]<offsets[i] ) {
-/* GT: The CFF font type contains a thing called a name INDEX, and that INDEX */
-/* GT: is bad. It is an index of many of the names used in the CFF font. */
-/* GT: We hope the user will never see this. */
- LogError( _("Bad CFF name INDEX\n") );
- if ( info!=NULL ) info->bad_cff = true;
- while ( i<count ) {
- names[i] = copy("");
- ++i;
- }
- --i;
- } else {
- names[i] = galloc(offsets[i+1]-offsets[i]+1);
- for ( j=0; j<(int)(offsets[i+1]-offsets[i]); ++j )
- names[i][j] = getc(ttf);
- names[i][j] = '\0';
- }
- }
- names[i] = NULL;
- free(offsets);
-return( names );
-}
-
-static char *addnibble(char *pt, int nib) {
- if ( nib<=9 )
- *pt++ = nib+'0';
- else if ( nib==10 )
- *pt++ = '.';
- else if ( nib==11 )
- *pt++ = 'E';
- else if ( nib==12 ) {
- *pt++ = 'E';
- *pt++ = '-';
- } else if ( nib==14 )
- *pt++ = '-';
- else if ( nib==15 )
- *pt++ = '\0';
-return( pt );
-}
-
-static int readcffthing(FILE *ttf,int *_ival,real *dval,int *operand,struct ttfinfo *info) {
- char buffer[50], *pt;
- int ch, ival;
-
- ch = getc(ttf);
- if ( ch==12 ) {
- *operand = (12<<8) | getc(ttf);
-return( 3 );
- } else if ( ch<=21 ) {
- *operand = ch;
-return( 3 );
- } else if ( ch==30 ) {
- /* fixed format doesn't exist in dict data but does in type2 strings */
- pt = buffer;
- do {
- ch = getc(ttf);
- if ( pt<buffer+44 || (ch&0xf)==0xf || (ch&0xf0)==0xf0 ) {
- pt = addnibble(pt,ch>>4);
- pt = addnibble(pt,ch&0xf);
- }
- } while ( pt[-1]!='\0' );
- *dval = strtod(buffer,NULL);
-return( 2 );
- } else if ( ch>=32 && ch<=246 ) {
- *_ival = ch-139;
-return( 1 );
- } else if ( ch>=247 && ch<=250 ) {
- *_ival = ((ch-247)<<8) + getc(ttf)+108;
-return( 1 );
- } else if ( ch>=251 && ch<=254 ) {
- *_ival = -((ch-251)<<8) - getc(ttf)-108;
-return( 1 );
- } else if ( ch==28 ) {
- ival = getc(ttf)<<8;
- *_ival = (short) (ival | getc(ttf));
-return( 1 );
- } else if ( ch==29 ) {
- /* 4 byte integers exist in dict data but not in type2 strings */
- ival = getc(ttf)<<24;
- ival = ival | getc(ttf)<<16;
- ival = ival | getc(ttf)<<8;
- *_ival = (int) (ival | getc(ttf));
-return( 1 );
- }
- LogError(_("Unexpected value in dictionary %d\n"), ch );
- info->bad_cff = true;
- *_ival = 0;
-return( 0 );
-}
-
-static void skipcfft2thing(FILE *ttf) {
- /* The old CFF spec allows little type2 programs to live in the CFF dict */
- /* indices. These are designed to allow interpolation of values for mm */
- /* fonts. */
- /* The Type2 program is terminated by an "endchar" operator */
- /* I don't support this, but I shall try to skip over them properly */
- /* There's no discussion about how values move from the t2 stack to the */
- /* cff stack, as there are no examples of this, it's hard to guess */
- int ch;
-
-/* GT: DICT is a magic term inside CFF fonts, as is INDEX, and I guess CFF and type2 */
- LogError( _("FontForge does not support type2 programs embedded in CFF DICT INDICES.\n") );
- forever {
- ch = getc(ttf);
- if ( ch>=247 && ch<=254 )
- getc(ttf); /* Two byte number */
- else if ( ch==255 ) {
- getc(ttf); getc(ttf); getc(ttf); getc(ttf);
- /* 16.16 number */
- } else if ( ch==28 ) {
- getc(ttf);
- getc(ttf);
- } else if ( ch==12 ) {
- getc(ttf); /* Two byte operator */
- } else if ( ch==14 ) {
-return;
- }
- }
-}
-
-struct topdicts {
- int32 cff_start;
-
- char *fontname; /* From Name Index */
-
- int version; /* SID */
- int notice; /* SID */
- int copyright; /* SID */
- int fullname; /* SID */
- int familyname; /* SID */
- int weight; /* SID */
- int isfixedpitch;
- real italicangle;
- real underlinepos;
- real underlinewidth;
- int painttype;
- int charstringtype;
- real fontmatrix[6];
- int fontmatrix_set;
- int uniqueid;
- real fontbb[4];
- real strokewidth;
- int xuid[20];
- int charsetoff; /* from start of file */
- int encodingoff; /* from start of file */
- int charstringsoff; /* from start of file */
- int private_size;
- int private_offset; /* from start of file */
- int synthetic_base; /* font index */
- int postscript_code; /* SID */
- /* synthetic fonts only (whatever they are) */
- int basefontname; /* SID */
- /* Multiple master/synthetic fonts */
- real basefontblend[16]; /* delta */ /* No description of why this is relevant for mm fonts */
- /* Multiple master fonts only */
- int blendaxistypes[17]; /* SID */
- int nMasters;
- int nAxes;
- real weightvector[17];
- int lenBuildCharArray; /* No description of what this means */
- int NormalizeDesignVector; /* SID */ /* No description of what this does */
- int ConvertDesignVector; /* SID */ /* No description of what this does */
- /* CID fonts only */
- int ros_registry; /* SID */
- int ros_ordering; /* SID */
- int ros_supplement;
- real cidfontversion;
- int cidfontrevision;
- int cidfonttype;
- int cidcount;
- int uidbase;
- int fdarrayoff; /* from start of file */
- int fdselectoff; /* from start of file */
- int sid_fontname; /* SID */
-/* Private stuff */
- real bluevalues[14];
- real otherblues[10];
- real familyblues[14];
- real familyotherblues[10];
- real bluescale;
- real blueshift;
- real bluefuzz;
- int stdhw;
- int stdvw;
- real stemsnaph[10];
- real stemsnapv[10];
- int forcebold;
- real forceboldthreshold;
- int languagegroup;
- real expansionfactor;
- int initialRandomSeed;
- int subrsoff; /* from start of this private table */
- int defaultwidthx;
- int nominalwidthx;
-
- struct pschars glyphs;
- struct pschars local_subrs;
- uint16 *charset;
-};
-
-static void TopDictFree(struct topdicts *dict) {
- int i;
-
- free(dict->charset);
- for ( i=0; i<dict->glyphs.cnt; ++i )
- free(dict->glyphs.values[i]);
- free(dict->glyphs.values);
- free(dict->glyphs.lens);
- for ( i=0; i<dict->local_subrs.cnt; ++i )
- free(dict->local_subrs.values[i]);
- free(dict->local_subrs.values);
- free(dict->local_subrs.lens);
- free(dict);
-}
-
-static void readcffsubrs(FILE *ttf, struct pschars *subs, struct ttfinfo *info) {
- uint16 count = getushort(ttf);
- int offsize;
- uint32 *offsets;
- int i,j, base;
- int err = false;
-
- memset(subs,'\0',sizeof(struct pschars));
- if ( count==0 )
-return;
- subs->cnt = count;
- subs->lens = galloc(count*sizeof(int));
- subs->values = galloc(count*sizeof(uint8 *));
- offsets = galloc((count+1)*sizeof(uint32));
- offsize = getc(ttf);
- for ( i=0; i<=count; ++i )
- offsets[i] = getoffset(ttf,offsize);
- base = ftell(ttf)-1;
- for ( i=0; i<count; ++i ) {
- if ( offsets[i+1]>offsets[i] && offsets[i+1]-offsets[i]<0x10000 ) {
- subs->lens[i] = offsets[i+1]-offsets[i];
- subs->values[i] = galloc(offsets[i+1]-offsets[i]+1);
- for ( j=0; j<(int)(offsets[i+1]-offsets[i]); ++j )
- subs->values[i][j] = getc(ttf);
- subs->values[i][j] = '\0';
- } else {
- if ( !err )
- LogError( _("Bad subroutine INDEX in cff font.\n" ));
- info->bad_cff = true;
- err = true;
- subs->lens[i] = 1;
- subs->values[i] = galloc(2);
- subs->values[i][0] = 11; /* return */
- subs->values[i][1] = '\0';
- fseek(ttf,base+offsets[i+1],SEEK_SET);
- }
- }
- free(offsets);
-}
-
-static struct topdicts *readcfftopdict(FILE *ttf, char *fontname, int len,
- struct ttfinfo *info) {
- struct topdicts *td = gcalloc(1,sizeof(struct topdicts));
- long base = ftell(ttf);
- int ival, oval, sp, ret, i;
- real stack[50];
-
- if ( fontname!=NULL )
- ValidatePostScriptFontName(info,fontname);
-
- td->fontname = fontname;
- td->underlinepos = -100;
- td->underlinewidth = 50;
- td->charstringtype = 2;
- td->fontmatrix[0] = td->fontmatrix[3] = .001;
-
- td->notice = td->copyright = td->fullname = td->familyname = td->weight = td->version = -1;
- td->postscript_code = td->basefontname = -1;
- td->synthetic_base = td->ros_registry = -1;
- td->fdarrayoff = td->fdselectoff = td->sid_fontname = -1;
- td->blendaxistypes[0] = -1;
-
- /* Multiple master fonts can have Type2 operators here, particularly */
- /* blend operators. We're ignoring that */
- while ( ftell(ttf)<base+len ) {
- sp = 0;
- while ( (ret=readcffthing(ttf,&ival,&stack[sp],&oval,info))!=3 && ftell(ttf)<base+len ) {
- if ( ret==1 )
- stack[sp]=ival;
- if ( ret!=0 && sp<45 )
- ++sp;
- }
- if ( ret==3 && oval==31 /* "T2" operator, can have 0 arguments */ ) {
- skipcfft2thing(ttf);
- } else if ( sp==0 ) {
- LogError( _("No argument to operator\n") );
- info->bad_cff = true;
- } else if ( ret==3 ) switch( oval ) {
- case 0:
- td->version = stack[sp-1];
- break;
- case 1:
- td->notice = stack[sp-1];
- break;
- case (12<<8)+0:
- td->copyright = stack[sp-1];
- break;
- case 2:
- td->fullname = stack[sp-1];
- break;
- case 3:
- td->familyname = stack[sp-1];
- break;
- case 4:
- td->weight = stack[sp-1];
- break;
- case (12<<8)+1:
- td->isfixedpitch = stack[sp-1];
- break;
- case (12<<8)+2:
- td->italicangle = stack[sp-1];
- break;
- case (12<<8)+3:
- td->underlinepos = stack[sp-1];
- break;
- case (12<<8)+4:
- td->underlinewidth = stack[sp-1];
- break;
- case (12<<8)+5:
- td->painttype = stack[sp-1];
- break;
- case (12<<8)+6:
- td->charstringtype = stack[sp-1];
- break;
- case (12<<8)+7:
- memcpy(td->fontmatrix,stack,(sp>=6?6:sp)*sizeof(real));
- td->fontmatrix_set = 1;
- break;
- case 13:
- td->uniqueid = stack[sp-1];
- break;
- case 5:
- memcpy(td->fontbb,stack,(sp>=4?4:sp)*sizeof(real));
- break;
- case (12<<8)+8:
- td->strokewidth = stack[sp-1];
- break;
- case 14:
- for ( i=0; i<sp && i<20; ++i )
- td->xuid[i] = stack[i];
- break;
- case 15:
- td->charsetoff = stack[sp-1];
- break;
- case 16:
- td->encodingoff = stack[sp-1];
- break;
- case 17:
- td->charstringsoff = stack[sp-1];
- break;
- case 18:
- td->private_size = stack[0];
- td->private_offset = stack[1];
- break;
- case (12<<8)+20:
- LogError( _("FontForge does not support synthetic fonts\n") );
- td->synthetic_base = stack[sp-1];
- break;
- case (12<<8)+21:
- td->postscript_code = stack[sp-1];
- break;
- case (12<<8)+22:
- td->basefontname = stack[sp-1];
- break;
- case (12<<8)+23:
- for ( i=0; i<sp && i<16; ++i )
- td->basefontblend[i] = stack[i];
- break;
- case (12<<8)+24:
- LogError( _("FontForge does not support type2 multiple master fonts\n") );
- info->bad_cff = true;
- td->nMasters = stack[0];
- td->nAxes = sp-4;
- memcpy(td->weightvector,stack+1,(sp-4)*sizeof(real));
- td->lenBuildCharArray = stack[sp-3];
- td->NormalizeDesignVector = stack[sp-2]; /* These are type2 charstrings, even in type1 fonts */
- td->ConvertDesignVector = stack[sp-1];
- break;
- case (12<<8)+26:
- for ( i=0; i<sp && i<16; ++i )
- td->blendaxistypes[i] = stack[i];
- td->blendaxistypes[i] = -1;
- break;
- case (12<<8)+30:
- td->ros_registry = stack[0];
- td->ros_ordering = stack[1];
- td->ros_supplement = stack[2];
- break;
- case (12<<8)+31:
- td->cidfontversion = stack[sp-1];
- break;
- case (12<<8)+32:
- td->cidfontrevision = stack[sp-1];
- break;
- case (12<<8)+33:
- td->cidfonttype = stack[sp-1];
- break;
- case (12<<8)+34:
- td->cidcount = stack[sp-1];
- break;
- case (12<<8)+35:
- td->uidbase = stack[sp-1];
- break;
- case (12<<8)+36:
- td->fdarrayoff = stack[sp-1];
- break;
- case (12<<8)+37:
- td->fdselectoff = stack[sp-1];
- break;
- case (12<<8)+38:
- td->sid_fontname = stack[sp-1];
- break;
- case (12<<8)+39:
- LogError(_("FontForge does not support Chameleon fonts\n"));;
- break;
- default:
- LogError(_("Unknown operator in %s: %x\n"), fontname, oval );
- info->bad_cff = true;
- break;
- }
- }
-return( td );
-}
-
-static void readcffprivate(FILE *ttf, struct topdicts *td, struct ttfinfo *info) {
- int ival, oval, sp, ret, i;
- real stack[50];
- int32 end = td->cff_start+td->private_offset+td->private_size;
-
- fseek(ttf,td->cff_start+td->private_offset,SEEK_SET);
-
- td->subrsoff = -1;
- td->expansionfactor = .06;
- td->bluefuzz = 1;
- td->blueshift = 7;
- td->bluescale = .039625;
-
- while ( ftell(ttf)<end ) {
- if ( feof(ttf) ) {
- LogError("End of file found when reading private dictionary.\n" );
- break;
- }
- sp = 0;
- while ( (ret=readcffthing(ttf,&ival,&stack[sp],&oval,info))!=3 && ftell(ttf)<end ) {
- if ( ret==1 )
- stack[sp]=ival;
- if ( ret!=0 && sp<45 )
- ++sp;
- }
- if ( ret==3 && oval==31 /* "T2" operator, can have 0 arguments */ ) {
- skipcfft2thing(ttf);
- } else if ( sp==0 && oval!=6 && oval!=7 && oval!=8 && oval!=9 && oval !=(12<<8)+12 && oval !=(12<<8)+13) {
- LogError( _("No argument to operator %d in private dict\n"), oval );
- info->bad_cff = true;
- } else if ( ret==3 ) switch( oval ) {
- case 6:
- for ( i=0; i<sp && i<14; ++i ) {
- td->bluevalues[i] = stack[i];
- if ( i!=0 )
- td->bluevalues[i] += td->bluevalues[i-1];
- }
- break;
- case 7:
- for ( i=0; i<sp && i<10; ++i ) {
- td->otherblues[i] = stack[i];
- if ( i!=0 )
- td->otherblues[i] += td->otherblues[i-1];
- }
- break;
- case 8:
- for ( i=0; i<sp && i<14; ++i ) {
- td->familyblues[i] = stack[i];
- if ( i!=0 )
- td->familyblues[i] += td->familyblues[i-1];
- }
- break;
- case 9:
- for ( i=0; i<sp && i<10; ++i ) {
- td->familyotherblues[i] = stack[i];
- if ( i!=0 )
- td->familyotherblues[i] += td->familyotherblues[i-1];
- }
- break;
- case (12<<8)+9:
- td->bluescale = stack[sp-1];
- break;
- case (12<<8)+10:
- td->blueshift = stack[sp-1];
- break;
- case (12<<8)+11:
- td->bluefuzz = stack[sp-1];
- break;
- case 10:
- td->stdhw = stack[sp-1];
- break;
- case 11:
- td->stdvw = stack[sp-1];
- break;
- case (12<<8)+12:
- for ( i=0; i<sp && i<10; ++i ) {
- td->stemsnaph[i] = stack[i];
- if ( i!=0 )
- td->stemsnaph[i] += td->stemsnaph[i-1];
- }
- break;
- case (12<<8)+13:
- for ( i=0; i<sp && i<10; ++i ) {
- td->stemsnapv[i] = stack[i];
- if ( i!=0 )
- td->stemsnapv[i] += td->stemsnapv[i-1];
- }
- break;
- case (12<<8)+14:
- td->forcebold = stack[sp-1];
- break;
- case (12<<8)+15: /* obsolete */
- td->forceboldthreshold = stack[sp-1];
- break;
- case (12<<8)+16:
- /* lenIV. -1 => unencrypted charstrings */
- /* obsolete */
- break;
- case (12<<8)+17:
- td->languagegroup = stack[sp-1];
- break;
- case (12<<8)+18:
- td->expansionfactor = stack[sp-1];
- break;
- case (12<<8)+19:
- td->initialRandomSeed = stack[sp-1];
- break;
- case 19:
- td->subrsoff = stack[sp-1];
- break;
- case 20:
- td->defaultwidthx = stack[sp-1];
- break;
- case 21:
- td->nominalwidthx = stack[sp-1];
- break;
- default:
- LogError(_("Unknown operator in %s: %x\n"), td->fontname, oval );
- info->bad_cff = true;
- break;
- }
- }
-
- if ( td->subrsoff!=-1 ) {
- fseek(ttf,td->cff_start+td->private_offset+td->subrsoff,SEEK_SET);
- readcffsubrs(ttf,&td->local_subrs,info);
- }
-}
-
-static struct topdicts **readcfftopdicts(FILE *ttf, char **fontnames, int32 cff_start,
- struct ttfinfo *info, struct topdicts *parent_dict) {
- uint16 count = getushort(ttf);
- int offsize;
- uint32 *offsets;
- struct topdicts **dicts;
- int i;
-
- if ( count==0 )
-return( NULL );
- offsets = galloc((count+1)*sizeof(uint32));
- offsize = getc(ttf);
- for ( i=0; i<=count; ++i )
- offsets[i] = getoffset(ttf,offsize);
- dicts = galloc((count+1)*sizeof(struct topdicts *));
- for ( i=0; i<count; ++i ) {
- dicts[i] = readcfftopdict(ttf,fontnames!=NULL?fontnames[i]:NULL,
- offsets[i+1]-offsets[i], info);
- if ( parent_dict!=NULL && parent_dict->fontmatrix_set ) {
- MatMultiply(parent_dict->fontmatrix,dicts[i]->fontmatrix,dicts[i]->fontmatrix);
- }
- dicts[i]->cff_start = cff_start;
- }
- dicts[i] = NULL;
- free(offsets);
-return( dicts );
-}
-
-static const char *FFgetsid(int sid,char **strings,int scnt,struct ttfinfo *info) {
- if ( sid==-1 )
-return( NULL );
- else if ( sid<nStdStrings )
-return( cffnames[sid] );
- else if ( sid-nStdStrings>scnt ) {
- LogError( _("Bad sid %d (must be less than %d)\n"), sid, scnt+nStdStrings );
- if ( info!=NULL ) info->bad_cff = true;
-return( NULL );
- } else
-return( strings[sid-nStdStrings]);
-}
-
-/* I really expect to deal with encodings in ttf cmap, but ocasionally we */
-/* get a bare cff */
-static void readcffenc(FILE *ttf,struct topdicts *dict,struct ttfinfo *info,
- char **strings, int scnt) {
- int format, cnt, i, j, pos, first, last, dupenc, sid;
- const char *name;
- EncMap *map;
-
- if ( info->encoding_start!=0 ) /* Use the cmap instead */
-return;
- if ( info->subfontcnt!=0 )
-return; /* Use cids instead */
-
- for ( i=0; i<info->glyph_cnt; ++i ) {
- if ( info->chars[i]->unicodeenc==-1 )
- info->chars[i]->unicodeenc = UniFromName(info->chars[i]->name,ui_none,&custom);
- }
-
- map = EncMapNew(256,256,&custom);
- if ( dict->encodingoff==0 || dict->encodingoff==1 ) {
- /* Standard Encodings */
- char **enc = dict->encodingoff==0 ? AdobeStandardEncoding : AdobeExpertEncoding;
- map->enc = FindOrMakeEncoding( dict->encodingoff==0 ?
- "AdobeStandard" : "Custom" );
- if ( map->enc==NULL )
- map->enc = &custom;
- for ( i=0; i<info->glyph_cnt; ++i ) {
- for ( pos=0; pos<256; ++pos )
- if ( strcmp(info->chars[i]->name,enc[pos])==0 )
- break;
- if ( pos<256 )
- map->map[pos] = i;
- }
- } else {
- fseek(ttf,dict->cff_start+dict->encodingoff,SEEK_SET);
- format = getc(ttf);
- if ( (format&0x7f)==0 ) {
- cnt = getc(ttf);
- for ( i=1; i<=cnt && i<info->glyph_cnt; ++i )
- map->map[getc(ttf)] = i;
- } else if ( (format&0x7f)==1 ) {
- cnt = getc(ttf);
- pos = 0;
- for ( i=0; i<cnt ; ++i ) {
- first = getc(ttf);
- last = first + getc(ttf)-1;
- while ( first<=last && first<256 ) {
- if ( pos<info->glyph_cnt )
- map->map[first] = pos;
- ++pos;
- ++first;
- }
- }
- } else {
- LogError( _("Unexpected encoding format in cff: %d\n"), format );
- if ( info!=NULL ) info->bad_cff = true;
- }
- if ( format&0x80 ) {
- cnt = getc(ttf);
- for ( i=0; i<cnt; ++i ) {
- dupenc = getc(ttf);
- sid = getushort(ttf);
- name = FFgetsid(sid,strings,scnt,info);
- if ( name==NULL ) /* Table is erroneous */
- break;
- for ( j=0; j<info->glyph_cnt; ++j )
- if ( strcmp(name,info->chars[j]->name)==0 )
- break;
- if ( j!=info->glyph_cnt )
- map->map[dupenc] = j;
- }
- }
- }
- info->map = map;
-}
-
-static void readcffset(FILE *ttf,struct topdicts *dict,struct ttfinfo *info) {
- int len = dict->glyphs.cnt;
- int i;
- int format, cnt, j, first;
-
- i = 0;
- if ( dict->charsetoff==0 ) {
- /* ISO Adobe charset */
- dict->charset = galloc(len*sizeof(uint16));
- for ( i=0; i<len && i<=228; ++i )
- dict->charset[i] = i;
- } else if ( dict->charsetoff==1 ) {
- /* Expert charset */
- dict->charset = galloc((len<162?162:len)*sizeof(uint16));
- dict->charset[0] = 0; /* .notdef */
- dict->charset[1] = 1;
- for ( i=2; i<len && i<=238-227; ++i )
- dict->charset[i] = i+227;
- dict->charset[12] = 13;
- dict->charset[13] = 14;
- dict->charset[14] = 15;
- dict->charset[15] = 99;
- for ( i=16; i<len && i<=248-223; ++i )
- dict->charset[i] = i+223;
- dict->charset[25] = 27;
- dict->charset[26] = 28;
- for ( i=27; i<len && i<=266-222; ++i )
- dict->charset[i] = i+222;
- dict->charset[44] = 109;
- dict->charset[45] = 110;
- for ( i=46; i<len && i<=318-221; ++i )
- dict->charset[i] = i+221;
- dict->charset[96] = 158;
- dict->charset[97] = 155;
- dict->charset[98] = 163;
- for ( i=99; i<len && i<=326-220; ++i )
- dict->charset[i] = i+220;
- dict->charset[107] = 150;
- dict->charset[108] = 164;
- dict->charset[109] = 169;
- for ( i=110; i<len && i<=378-217; ++i )
- dict->charset[i] = i+217;
- } else if ( dict->charsetoff==2 ) {
- /* Expert subset charset */
- dict->charset = galloc((len<130?130:len)*sizeof(uint16));
- dict->charset[0] = 0; /* .notdef */
- dict->charset[1] = 1;
- for ( i=2; i<len && i<=238-227; ++i )
- dict->charset[i] = i+227;
- dict->charset[12] = 13;
- dict->charset[13] = 14;
- dict->charset[14] = 15;
- dict->charset[15] = 99;
- for ( i=16; i<len && i<=248-223; ++i )
- dict->charset[i] = i+223;
- dict->charset[25] = 27;
- dict->charset[26] = 28;
- for ( i=27; i<len && i<=266-222; ++i )
- dict->charset[i] = i+222;
- dict->charset[44] = 109;
- dict->charset[45] = 110;
- for ( i=46; i<len && i<=272-221; ++i )
- dict->charset[i] = i+221;
- dict->charset[51] = 300;
- dict->charset[52] = 301;
- dict->charset[53] = 302;
- dict->charset[54] = 305;
- dict->charset[55] = 314;
- dict->charset[56] = 315;
- dict->charset[57] = 158;
- dict->charset[58] = 155;
- dict->charset[59] = 163;
- for ( i=60; i<len && i<=326-260; ++i )
- dict->charset[i] = i+260;
- dict->charset[67] = 150;
- dict->charset[68] = 164;
- dict->charset[69] = 169;
- for ( i=110; i<len && i<=346-217; ++i )
- dict->charset[i] = i+217;
- } else {
- dict->charset = galloc(len*sizeof(uint16));
- dict->charset[0] = 0; /* .notdef */
- fseek(ttf,dict->cff_start+dict->charsetoff,SEEK_SET);
- format = getc(ttf);
- if ( format==0 ) {
- for ( i=1; i<len; ++i )
- dict->charset[i] = getushort(ttf);
- } else if ( format==1 ) {
- for ( i = 1; i<len; ) {
- first = dict->charset[i++] = getushort(ttf);
- cnt = getc(ttf);
- for ( j=0; j<cnt; ++j )
- dict->charset[i++] = ++first;
- }
- } else if ( format==2 ) {
- for ( i = 1; i<len; ) {
- first = dict->charset[i++] = getushort(ttf);
- cnt = getushort(ttf);
- for ( j=0; j<cnt; ++j )
- dict->charset[i++] = ++first;
- }
- } else {
- LogError( _("Unexpected charset format in cff: %d\n"), format );
- if ( info!=NULL ) info->bad_cff = true;
- }
- }
- while ( i<len ) dict->charset[i++] = 0;
-}
-
-static uint8 *readfdselect(FILE *ttf,int numglyphs,struct ttfinfo *info) {
- uint8 *fdselect = gcalloc(numglyphs,sizeof(uint8));
- int i, j, format, nr, first, end, fd;
-
- format = getc(ttf);
- if ( format==0 ) {
- for ( i=0; i<numglyphs; ++i )
- fdselect[i] = getc(ttf);
- } else if ( format==3 ) {
- nr = getushort(ttf);
- first = getushort(ttf);
- for ( i=0; i<nr; ++i ) {
- fd = getc(ttf);
- end = getushort(ttf);
- for ( j=first; j<end; ++j ) {
- if ( j>=numglyphs ) {
- LogError( _("Bad fdselect\n") );
- if ( info!=NULL ) info->bad_cff = true;
- } else
- fdselect[j] = fd;
- }
- first = end;
- }
- } else {
- LogError( _("Didn't understand format for fdselect %d\n"), format );
- if ( info!=NULL ) info->bad_cff = true;
- }
-return( fdselect );
-}
-
-
-static char *intarray2str(int *array, int size) {
- int i,j;
- char *pt, *ret;
-
- for ( i=size-1; i>=0 && array[i]==0; --i );
- if ( i==-1 )
-return( NULL );
- ret = pt = galloc((i+1)*12+12);
- *pt++ = '[';
- for ( j=0; j<=i; ++j ) {
- sprintf( pt, "%d ", array[j]);
- pt += strlen(pt);
- }
- pt[-1]=']';
-return( ret );
-}
-
-static char *realarray2str(real *array, int size, int must_be_even) {
- int i,j;
- char *pt, *ret;
-
- for ( i=size-1; i>=0 && array[i]==0; --i );
- if ( i==-1 )
-return( NULL );
- if ( must_be_even && !(i&1) && array[i]<0 )
- ++i; /* Someone gave us a bluevalues of [-20 0] and we reported [-20] */
- ret = pt = galloc((i+1)*20+12);
- *pt++ = '[';
- for ( j=0; j<=i; ++j ) {
- sprintf( pt, "%g ", (double) array[j]);
- pt += strlen(pt);
- }
- pt[-1]=']';
-return( ret );
-}
-
-static void privateadd(struct psdict *private,char *key,char *value) {
- if ( value==NULL )
-return;
- private->keys[private->next] = copy(key);
- private->values[private->next++] = value;
-}
-
-static void privateaddint(struct psdict *private,char *key,int val) {
- char buf[20];
- if ( val==0 )
-return;
- sprintf( buf,"%d", val );
- privateadd(private,key,copy(buf));
-}
-
-static void privateaddintarray(struct psdict *private,char *key,int val) {
- char buf[20];
- if ( val==0 )
-return;
- sprintf( buf,"[%d]", val );
- privateadd(private,key,copy(buf));
-}
-
-static void privateaddreal(struct psdict *private,char *key,double val,double def) {
- char buf[20];
- if ( val==def )
-return;
- sprintf( buf,"%g", val );
- privateadd(private,key,copy(buf));
-}
-
-static void cffprivatefillup(struct psdict *private, struct topdicts *dict) {
- private->cnt = 14;
- private->keys = galloc(14*sizeof(char *));
- private->values = galloc(14*sizeof(char *));
- privateadd(private,"BlueValues",
- realarray2str(dict->bluevalues,sizeof(dict->bluevalues)/sizeof(dict->bluevalues[0]),true));
- privateadd(private,"OtherBlues",
- realarray2str(dict->otherblues,sizeof(dict->otherblues)/sizeof(dict->otherblues[0]),true));
- privateadd(private,"FamilyBlues",
- realarray2str(dict->familyblues,sizeof(dict->familyblues)/sizeof(dict->familyblues[0]),true));
- privateadd(private,"FamilyOtherBlues",
- realarray2str(dict->familyotherblues,sizeof(dict->familyotherblues)/sizeof(dict->familyotherblues[0]),true));
- privateaddreal(private,"BlueScale",dict->bluescale,0.039625);
- privateaddreal(private,"BlueShift",dict->blueshift,7);
- privateaddreal(private,"BlueFuzz",dict->bluefuzz,1);
- privateaddintarray(private,"StdHW",dict->stdhw);
- privateaddintarray(private,"StdVW",dict->stdvw);
- privateadd(private,"StemSnapH",
- realarray2str(dict->stemsnaph,sizeof(dict->stemsnaph)/sizeof(dict->stemsnaph[0]),false));
- privateadd(private,"StemSnapV",
- realarray2str(dict->stemsnapv,sizeof(dict->stemsnapv)/sizeof(dict->stemsnapv[0]),false));
- if ( dict->forcebold )
- privateadd(private,"ForceBold",copy("true"));
- if ( dict->forceboldthreshold!=0 )
- privateaddreal(private,"ForceBoldThreshold",dict->forceboldthreshold,0);
- privateaddint(private,"LanguageGroup",dict->languagegroup);
- privateaddreal(private,"ExpansionFactor",dict->expansionfactor,0.06);
-}
-
-static SplineFont *cffsffillup(struct topdicts *subdict, char **strings,
- int scnt, struct ttfinfo *info) {
- SplineFont *sf = SplineFontEmpty();
- int emsize;
- static int nameless;
-
- sf->fontname = utf8_verify_copy(FFgetsid(subdict->sid_fontname,strings,scnt,info));
- if ( sf->fontname==NULL ) {
- char buffer[40];
- sprintf(buffer,"UntitledSubFont_%d", ++nameless );
- sf->fontname = copy(buffer);
- }
-
- if ( subdict->fontmatrix[0]==0 )
- emsize = 1000;
- else
- emsize = rint( 1/subdict->fontmatrix[0] );
- sf->ascent = .8*emsize;
- sf->descent = emsize - sf->ascent;
- if ( subdict->copyright!=-1 )
- sf->copyright = utf8_verify_copy(FFgetsid(subdict->copyright,strings,scnt,info));
- else
- sf->copyright = utf8_verify_copy(FFgetsid(subdict->notice,strings,scnt,info));
- sf->familyname = utf8_verify_copy(FFgetsid(subdict->familyname,strings,scnt,info));
- sf->fullname = utf8_verify_copy(FFgetsid(subdict->fullname,strings,scnt,info));
- sf->weight = utf8_verify_copy(FFgetsid(subdict->weight,strings,scnt,info));
- sf->version = utf8_verify_copy(FFgetsid(subdict->version,strings,scnt,info));
- sf->italicangle = subdict->italicangle;
- sf->upos = subdict->underlinepos;
- sf->uwidth = subdict->underlinewidth;
- sf->xuid = intarray2str(subdict->xuid,sizeof(subdict->xuid)/sizeof(subdict->xuid[0]));
- sf->uniqueid = subdict->uniqueid;
- sf->strokewidth = subdict->strokewidth;
- sf->strokedfont = subdict->painttype==2;
-
- if ( subdict->private_size>0 ) {
- sf->private = gcalloc(1,sizeof(struct psdict));
- cffprivatefillup(sf->private,subdict);
- }
-return( sf );
-}
-
-static void cffinfofillup(struct ttfinfo *info, struct topdicts *dict,
- char **strings, int scnt ) {
-
- info->glyph_cnt = dict->glyphs.cnt;
- if ( info->glyph_cnt<0 ) info->glyph_cnt = 0;
-
- if ( dict->fontmatrix[0]==0 )
- info->emsize = 1000;
- else
- info->emsize = rint( 1/dict->fontmatrix[0] );
-#if 1
- info->ascent = .8*info->emsize;
-#else
- info->ascent = dict->fontbb[3]*info->emsize/(dict->fontbb[3]-dict->fontbb[1]);
-#endif
- info->descent = info->emsize - info->ascent;
- if ( dict->copyright!=-1 || dict->notice!=-1 )
- free( info->copyright );
- if ( dict->copyright!=-1 )
- info->copyright = utf8_verify_copy(FFgetsid(dict->copyright,strings,scnt,info));
- else if ( dict->notice!=-1 )
- info->copyright = utf8_verify_copy(FFgetsid(dict->notice,strings,scnt,info));
- if ( dict->familyname!=-1 ) {
- free(info->familyname);
- info->familyname = utf8_verify_copy(FFgetsid(dict->familyname,strings,scnt,info));
- }
- if ( dict->fullname!=-1 ) {
- free(info->fullname);
- info->fullname = utf8_verify_copy(FFgetsid(dict->fullname,strings,scnt,info));
- }
- if ( dict->weight!=-1 ) {
- free(info->weight);
- info->weight = utf8_verify_copy(FFgetsid(dict->weight,strings,scnt,info));
- }
- if ( dict->version!=-1 ) {
- free(info->version);
- info->version = utf8_verify_copy(FFgetsid(dict->version,strings,scnt,info));
- }
- if ( dict->fontname!=NULL ) {
- free(info->fontname);
- info->fontname = utf8_verify_copy(dict->fontname);
- }
- info->italicAngle = dict->italicangle;
- info->upos = dict->underlinepos;
- info->uwidth = dict->underlinewidth;
- info->xuid = intarray2str(dict->xuid,sizeof(dict->xuid)/sizeof(dict->xuid[0]));
- info->uniqueid = dict->uniqueid;
- info->strokewidth = dict->strokewidth;
- info->strokedfont = dict->painttype==2;
-
- if ( dict->private_size>0 ) {
- info->private = gcalloc(1,sizeof(struct psdict));
- cffprivatefillup(info->private,dict);
- }
- if ( dict->ros_registry!=-1 ) {
- info->cidregistry = copy(FFgetsid(dict->ros_registry,strings,scnt,info));
- info->ordering = copy(FFgetsid(dict->ros_ordering,strings,scnt,info));
- info->supplement = dict->ros_supplement;
- info->cidfontversion = dict->cidfontversion;
- }
-}
-
-static void cfffigure(struct ttfinfo *info, struct topdicts *dict,
- char **strings, int scnt, struct pschars *gsubrs) {
- int i, cstype;
- struct pschars *subrs;
- struct pscontext pscontext;
- memset(&pscontext,0,sizeof(pscontext));
-
- cffinfofillup(info, dict, strings, scnt );
-
-/* The format allows for some dicts that are type1 strings and others that */
-/* are type2s. Which means that the global subrs will have a different bias */
-/* as we flip from font to font. So we can't set the bias when we read in */
-/* the subrs but must wait until we know which font we're working on. */
- cstype = dict->charstringtype;
- pscontext.is_type2 = cstype-1;
- pscontext.painttype = dict->painttype;
- gsubrs->bias = cstype==1 ? 0 :
- gsubrs->cnt < 1240 ? 107 :
- gsubrs->cnt <33900 ? 1131 : 32768;
- subrs = &dict->local_subrs;
- subrs->bias = cstype==1 ? 0 :
- subrs->cnt < 1240 ? 107 :
- subrs->cnt <33900 ? 1131 : 32768;
-
- info->chars = gcalloc(info->glyph_cnt,sizeof(SplineChar *));
- for ( i=0; i<info->glyph_cnt; ++i ) {
- info->chars[i] = PSCharStringToBB(
- dict->glyphs.values[i], dict->glyphs.lens[i],&pscontext,
- subrs,gsubrs,FFgetsid(dict->charset[i],strings,scnt,info));
- info->chars[i]->vwidth = info->emsize;
- if ( cstype==2 ) {
- if ( info->chars[i]->width == (int16) 0x8000 )
- info->chars[i]->width = dict->defaultwidthx;
- else
- info->chars[i]->width += dict->nominalwidthx;
- }
- }
- /* Need to do a reference fixup here !!!!! just in case some idiot */
- /* used type1 char strings -- or used the depreciated meaning of */
- /* endchar (==seac) */
-}
-
-static void cidfigure(struct ttfinfo *info, struct topdicts *dict,
- char **strings, int scnt, struct pschars *gsubrs, struct topdicts **subdicts,
- uint8 *fdselect) {
- int i, j, cstype, uni, cid;
- struct pschars *subrs;
- SplineFont *sf;
- struct cidmap *map;
- char buffer[100];
- struct pscontext pscontext;
- EncMap *encmap = NULL;
-
- memset(&pscontext,0,sizeof(pscontext));
-
- cffinfofillup(info, dict, strings, scnt );
-
- /* We'll set the encmap later */
- /* info->map = encmap = EncMapNew(info->glyph_cnt,info->glyph_cnt,&custom);*/
-
- for ( j=0; subdicts[j]!=NULL; ++j );
- info->subfontcnt = j;
- info->subfonts = gcalloc(j+1,sizeof(SplineFont *));
- for ( j=0; subdicts[j]!=NULL; ++j ) {
- info->subfonts[j] = cffsffillup(subdicts[j],strings,scnt,info);
- info->subfonts[j]->map = encmap;
- info->subfonts[j]->glyphmin = -1;
- }
- /* here we also deal with glyphmin */
- for ( i=0; i<info->glyph_cnt; ++i ) {
- sf = info->subfonts[ fdselect[i] ];
- cid = dict->charset[i];
- if ( cid>=sf->glyphcnt ) {
- if (sf->glyphmin == -1) {
- /*
- sf->glyphmin = cid;
- */
- }
- sf->glyphcnt = sf->glyphmax = cid+1;
- }
- /* if ( cid>=encmap->enccount ) encmap->enccount = cid+1;*/
- }
- for ( j=0; subdicts[j]!=NULL; ++j ) {
- info->subfonts[j]->glyphs = gcalloc(info->subfonts[j]->glyphcnt,sizeof(SplineChar *));
- }
-
- /*encmap->encmax = encmap->enccount;*/
- /*encmap->map = galloc(encmap->enccount*sizeof(int));*/
- /*memset(encmap->map,-1,encmap->enccount*sizeof(int));*/
-
- info->chars = gcalloc(info->glyph_cnt,sizeof(SplineChar *));
-
- /* info->chars provides access to the chars ordered by glyph, which the */
- /* ttf routines care about */
- /* sf->glyphs provides access to the chars ordered by CID. Not sure what */
- /* would happen to a kern from one font to another... */
-
- map = FindCidMap(info->cidregistry,info->ordering,info->supplement,NULL);
-
- for ( i=0; i<info->glyph_cnt; ++i ) {
- j = fdselect[i];
- sf = info->subfonts[j];
- /* The format allows for some dicts that are type1 strings and others that */
- /* are type2s. Which means that the global subrs will have a different bias */
- /* as we flip from font to font. So we can't set the bias when we read in */
- /* the subrs but must wait until we know which font we're working on. */
- cstype = subdicts[j]->charstringtype;
- pscontext.is_type2 = cstype-1;
- pscontext.painttype = subdicts[j]->painttype;
- gsubrs->bias = cstype==1 ? 0 : gsubrs->cnt < 1240 ? 107 : gsubrs->cnt <33900 ? 1131 : 32768;
- subrs = &subdicts[j]->local_subrs;
- subrs->bias = cstype==1 ? 0 : subrs->cnt < 1240 ? 107 : subrs->cnt <33900 ? 1131 : 32768;
- /*
- cid = dict->charset[i];
- */
- cid = i ;
- /*encmap->map[cid] = cid;*/
- uni = CID2NameUni(map,cid,buffer,sizeof(buffer));
- info->chars[i] = PSCharStringToBB(dict->glyphs.values[i], dict->glyphs.lens[i],&pscontext,subrs,gsubrs,buffer);
- info->chars[i]->vwidth = sf->ascent+sf->descent;
- info->chars[i]->unicodeenc = uni;
- sf->glyphs[cid] = info->chars[i];
- sf->glyphs[cid]->parent = sf;
- sf->glyphs[cid]->orig_pos = i; /* fixed in 0.80.1 */
- if ( sf->glyphs[cid]->layers[ly_fore].refs!=NULL ) {
- IError( "Reference found in CID font. Can't fix it up");
- }
- THPatchSplineChar(sf->glyphs[cid]);
- if ( cstype==2 ) {
- if ( sf->glyphs[cid]->width == (int16) 0x8000 )
- sf->glyphs[cid]->width = subdicts[j]->defaultwidthx;
- else
- sf->glyphs[cid]->width += subdicts[j]->nominalwidthx;
- }
- /* moved here */
- if (sf->glyphmin == -1) {
- /* if (sf->glyphs[cid] != (struct splinechar *)-1) { */
- sf->glyphmin = cid ;
- /* } */
- }
- ff_progress_next();
- }
- /* bonus */
- if (sf->glyphmin == -1) {
- sf->glyphmin = 0 ;
- }
- /* No need to do a reference fixup here-- the chars aren't associated */
- /* with any encoding as is required for seac */
-}
-
-static int readcffglyphs(FILE *ttf,struct ttfinfo *info) {
- int offsize;
- int hdrsize;
- char **fontnames, **strings;
- struct topdicts **dicts, **subdicts;
- int i, j, which;
- struct pschars gsubs;
- uint8 *fdselect;
- int scnt;
-
- fseek(ttf,info->cff_start,SEEK_SET);
- if ( getc(ttf)!='\1' ) { /* Major version */
- LogError( _("CFF version mismatch\n" ));
- info->bad_cff = true;
- return 0;
- }
- getc(ttf); /* Minor version */
- hdrsize = getc(ttf);
- offsize = getc(ttf);
- if ( hdrsize!=4 )
- fseek(ttf,info->cff_start+hdrsize,SEEK_SET);
- fontnames = readcfffontnames(ttf,NULL,info);
- which = 0;
- if ( fontnames[1]!=NULL ) { /* More than one? Can that even happen in OpenType? */
- which = PickCFFFont(fontnames);
- if (which == -1) {
- for (i=0; fontnames[i]!=NULL; ++i) {
- free(fontnames[i]);
- }
- free(fontnames);
- return 0;
- }
- }
- dicts = readcfftopdicts(ttf,fontnames,info->cff_start,info, NULL);
- /* String index is just the same as fontname index */
- strings = readcfffontnames(ttf,&scnt,info);
- readcffsubrs(ttf,&gsubs,info );
- /* Can be many fonts here. Only decompose the one */
- if ( dicts[which]->charstringsoff!=-1 ) {
- fseek(ttf,info->cff_start+dicts[which]->charstringsoff,SEEK_SET);
- readcffsubrs(ttf,&dicts[which]->glyphs,info);
- }
- if ( dicts[which]->private_offset!=-1 )
- readcffprivate(ttf,dicts[which],info);
- if ( dicts[which]->charsetoff!=-1 )
- readcffset(ttf,dicts[which],info);
- if ( dicts[which]->fdarrayoff==-1 )
- cfffigure(info,dicts[which],strings,scnt,&gsubs);
- else {
- fseek(ttf,info->cff_start+dicts[which]->fdarrayoff,SEEK_SET);
- subdicts = readcfftopdicts(ttf,NULL,info->cff_start,info,dicts[which]);
- fseek(ttf,info->cff_start+dicts[which]->fdselectoff,SEEK_SET);
- fdselect = readfdselect(ttf,dicts[which]->glyphs.cnt,info);
- for ( j=0; subdicts[j]!=NULL; ++j ) {
- if ( subdicts[j]->private_offset!=-1 )
- readcffprivate(ttf,subdicts[j],info);
- if ( subdicts[j]->charsetoff!=-1 )
- readcffset(ttf,subdicts[j],info);
- }
- cidfigure(info,dicts[which],strings,scnt,&gsubs,subdicts,fdselect);
- for ( j=0; subdicts[j]!=NULL; ++j )
- TopDictFree(subdicts[j]);
- free(subdicts); free(fdselect);
- }
- if ( dicts[which]->encodingoff!=-1 )
- readcffenc(ttf,dicts[which],info,strings,scnt);
-
- if ( dicts[which]->fdarrayoff==-1 ) {
- for ( i=0; i<info->glyph_cnt ; ++i )
- if ( info->chars[i]!=NULL )
- info->chars[i]->orig_pos = i;
- }
-
- if ( info->to_order2 ) {
- for ( i=0; i<info->glyph_cnt; ++i )
- SCConvertToOrder2(info->chars[i]);
- }
-
- for ( i=0; fontnames[i]!=NULL && i<1; ++i ) {
- free(fontnames[i]);
- TopDictFree(dicts[i]);
- }
- free(fontnames); free(dicts);
- if ( strings!=NULL ) {
- for ( i=0; strings[i]!=NULL; ++i )
- free(strings[i]);
- free(strings);
- }
- for ( i=0; i<gsubs.cnt; ++i )
- free(gsubs.values[i]);
- free(gsubs.values); free(gsubs.lens);
-
- return 1 ;
-}
-
-static int readtyp1glyphs(FILE *ttf,struct ttfinfo *info) {
- FontDict *fd;
- FILE *tmp;
- int i;
- SplineChar *sc;
-
- fseek(ttf,info->typ1_start,SEEK_SET);
-
- /* There appear to be about 20 bytes of garbage (well, I don't know what they */
- /* mean, so they are garbage to me) before the start of the PostScript. But */
- /* it's not exactly 20. I've seen 22 and 24. So see if we can find "%!PS-Adobe" */
- /* in the first few bytes of the file, and skip to there if found */
-
- {
- char buffer[41];
- if(fread(buffer,1,sizeof(buffer),ttf) != sizeof(buffer))
- return( false );
- buffer[40] = '\0';
- for ( i=39; i>=0; --i )
- if ( buffer[i]=='%' && buffer[i+1]=='!' )
- break;
- if ( i<0 )
- i = 0;
- fseek(ttf,info->typ1_start+i,SEEK_SET);
- }
-
- tmp = tmpfile();
- for ( i=0; i<(int)info->typ1_length; ++i )
- putc(getc(ttf),tmp);
- rewind(tmp);
- fd = _ReadPSFont(tmp);
- fclose(tmp);
- if ( fd!=NULL ) {
- SplineFont *sf = SplineFontFromPSFont(fd);
- PSFontFree(fd);
- info->emsize = (sf->ascent+sf->descent);
- info->ascent = sf->ascent;
- info->descent = sf->descent;
- if ( sf->subfontcnt!=0 ) {
- info->subfontcnt = sf->subfontcnt;
- info->subfonts = sf->subfonts;
- info->cidregistry = copy(sf->cidregistry);
- info->ordering = copy(sf->ordering);
- info->supplement = sf->supplement;
- info->cidfontversion = sf->cidversion;
- sf->subfonts = NULL;
- sf->subfontcnt = 0;
- } else {
- info->chars = sf->glyphs;
- info->glyph_cnt = sf->glyphcnt;
- for ( i=sf->glyphcnt-1; i>=0; --i ) if ( (sc=sf->glyphs[i])!=NULL )
- sc->parent = NULL;
- sf->glyphs = NULL;
- sf->glyphcnt = 0;
- }
- SplineFontFree(sf);
- return( true );
- }
- return( false );
-}
-
-static void readttfwidths(FILE *ttf,struct ttfinfo *info) {
- int i,j;
- int lastwidth = info->emsize, lsb;
- /* I'm not interested in the lsb, I'm not sure what it means if it differs*/
- /* from that is specified in the outline. Do we move the outline? */
- /* Ah... I am interested in it if bit 1 of 'head'.flags is set, then we */
- /* do move the outline */
- int check_width_consistency = info->cff_start!=0 && info->glyph_start==0;
- SplineChar *sc;
- real trans[6];
-
- memset(trans,0,sizeof(trans));
- trans[0] = trans[3] = 1;
-
- fseek(ttf,info->hmetrics_start,SEEK_SET);
- for ( i=0; i<info->width_cnt && i<info->glyph_cnt; ++i ) {
- lastwidth = getushort(ttf);
- lsb = (short) getushort(ttf);
- if ( (sc = info->chars[i])!=NULL ) { /* can happen in ttc files */
- if ( check_width_consistency && sc->width!=lastwidth ) {
- if ( info->fontname!=NULL && sc->name!=NULL )
- LogError("In %s, in glyph %s, 'CFF ' advance width (%d) and\n 'hmtx' width (%d) do not match. (Subsequent mismatches will not be reported)\n",
- info->fontname, sc->name, sc->width, lastwidth );
- else
- LogError("In GID %d, 'CFF ' advance width (%d) and 'hmtx' width (%d) do not match.\n (Subsequent mismatches will not be reported)\n",
- i, sc->width, lastwidth );
- info->bad_metrics = true;
- check_width_consistency = false;
- }
- sc->width = lastwidth;
- sc->widthset = true;
- if ( info->apply_lsb ) {
- if ( sc->lsidebearing!=lsb ) {
- trans[4] = lsb-sc->lsidebearing;
- SplinePointListTransform(sc->layers[ly_fore].splines,trans,true);
- }
- }
- }
- }
- if ( i==0 ) {
- LogError( _("Invalid ttf hmtx table (or hhea), numOfLongMetrics is 0\n") );
- info->bad_metrics = true;
- }
-
- for ( j=i; j<info->glyph_cnt; ++j ) {
- if ( (sc = info->chars[j])!=NULL ) { /* In a ttc file we may skip some */
- sc->width = lastwidth;
- sc->widthset = true;
- if ( info->apply_lsb ) {
- lsb = (short) getushort(ttf);
- if ( sc->lsidebearing!=lsb ) {
- trans[4] = lsb-sc->lsidebearing;
- SplinePointListTransform(sc->layers[ly_fore].splines,trans,true);
- }
- }
- }
- }
-}
-
-static void dummywidthsfromstrike(FILE *ttf,struct ttfinfo *info) {
- BDFFont *bdf;
- int i, cnt;
- double scaled_sum;
- (void)ttf; /* -Wall */
- if ( info->bitmaps==NULL )
-return;
-#if 0
- for ( bdf=info->bitmaps; bdf->next!=NULL; bdf=bdf->next );
- for ( i=0; i<bdf->glyphcnt; ++i ) if ( bdf->glyphs[i]!=NULL ) {
- bdf->glyphs[i]->sc->width = info->emsize*bdf->glyphs[i]->width/bdf->pixelsize;
- bdf->glyphs[i]->sc->widthset = true;
- }
-#else
- for ( i=0; i<info->glyph_cnt; ++i ) if ( info->chars[i]!=NULL ) {
- cnt = 0; scaled_sum = 0;
- for ( bdf=info->bitmaps; bdf->next!=NULL; bdf=bdf->next ) {
- if ( i<bdf->glyphcnt && bdf->glyphs[i]!=NULL ) {
- scaled_sum += ((double) (info->emsize*bdf->glyphs[i]->width))/bdf->pixelsize;
- ++cnt;
- }
- }
- if ( cnt!=0 ) {
- info->chars[i]->width = scaled_sum/cnt;
- info->chars[i]->widthset = true;
- }
- }
-#endif
-}
-
-static void readttfvwidths(FILE *ttf,struct ttfinfo *info) {
- int i,j;
- int lastvwidth = info->emsize, vwidth_cnt, tsb/*, cnt=0*/;
- /* int32 voff=0; */
-
- fseek(ttf,info->vhea_start+4+4,SEEK_SET); /* skip over the version number & typo right/left */
- info->pfminfo.vlinegap = getushort(ttf);
- info->pfminfo.vheadset = true;
-
- for ( i=0; i<12; ++i )
- getushort(ttf);
- vwidth_cnt = getushort(ttf);
-
- fseek(ttf,info->vmetrics_start,SEEK_SET);
- for ( i=0; i<vwidth_cnt && i<info->glyph_cnt; ++i ) {
- lastvwidth = getushort(ttf);
- tsb = getushort(ttf);
- if ( info->chars[i]!=NULL ) { /* can happen in ttc files */
- info->chars[i]->vwidth = lastvwidth;
- info->chars[i]->tsb = tsb;
- }
- }
- if ( i==0 ) {
- LogError( _("Invalid ttf vmtx table (or vhea), numOfLongVerMetrics is 0\n") );
- info->bad_metrics = true;
- }
-
- for ( j=i; j<info->glyph_cnt; ++j ) {
- if ( info->chars[j]!=NULL ) /* In a ttc file we may skip some */
- info->chars[j]->vwidth = lastvwidth;
- }
-
-}
-
-static int modenc(int enc,int modtype) {
- (void)modtype; /* for -Wall */
-return( enc );
-}
-
-static int badencoding(struct ttfinfo *info) {
- if ( !info->bad_cmap ) {
- LogError("Bad encoding information in 'cmap' table.");
- info->bad_cmap = true;
- }
-return( -1 );
-}
-
-static int umodenc(int enc,int modtype, struct ttfinfo *info) {
- if ( modtype==-1 )
-return( -1 );
- if ( modtype<=1 /* Unicode */ ) {
- /* No conversion needed, already unicode */;
-#ifdef FROM_CJK_ICONV
- } else if ( modtype==2 /* SJIS */ ) {
- if ( enc<=127 ) {
- /* Latin */
- if ( enc=='\\' ) enc = 0xa5; /* Yen */
- } else if ( enc>=161 && enc<=223 ) {
- /* Katakana */
- enc = unicode_from_jis201[enc];
- } else if ( enc<255 ) {
- /* This is erroneous as I understand SJIS */
- enc = badencoding(info);
- } else {
- int ch1 = enc>>8, ch2 = enc&0xff;
- if ( ch1 >= 129 && ch1<= 159 )
- ch1 -= 112;
- else
- ch1 -= 176;
- ch1 <<= 1;
- if ( ch2>=159 )
- ch2-= 126;
- else if ( ch2>127 ) {
- --ch1;
- ch2 -= 32;
- } else {
- --ch1;
- ch2 -= 31;
- }
- if ( ch1<0x21 || ch2<0x21 || ch1>0x7f || ch2>0x7f )
- enc = badencoding(info);
- else
- enc = unicode_from_jis208[(ch1-0x21)*94+(ch2-0x21)];
- }
- } else if ( modtype==3 /* GB2312 offset by 0x8080, parse just like wansung */ ) {
- if ( enc>0xa1a1 ) {
- enc -= 0xa1a1;
- enc = (enc>>8)*94 + (enc&0xff);
- enc = unicode_from_gb2312[enc];
- if ( enc==0 ) enc = -1;
- } else if ( enc>0x100 )
- enc = badencoding(info);
- } else if ( modtype==4 /* BIG5 */ ) { /* old ms docs say big5 is modtype==3, but new ones say 4 */
- if ( enc>0x8100 )
- enc = unicode_from_big5hkscs[enc-0x8100];
- else if ( enc>0x100 )
- enc = badencoding(info);
- } else if ( modtype==5 /* Wansung == KSC 5601-1987, I hope */ ) {
- if ( enc>0xa1a1 ) {
- enc -= 0xa1a1;
- enc = (enc>>8)*94 + (enc&0xff);
- enc = unicode_from_ksc5601[enc];
- if ( enc==0 ) enc = -1;
- } else if ( enc>0x100 )
- enc = badencoding(info);
- } else if ( modtype==6 /* Johab */ ) {
- if ( enc>0x8400 )
- enc = unicode_from_johab[enc-0x8400];
- else if ( enc>0x100 )
- enc = badencoding(info);
-#else
- } else {
- enc = badencoding(info);
-#endif
- }
- if ( enc==0 )
- enc = -1;
-return( enc );
-}
-
-struct cmap_encs {
- int platform;
- int specific;
- int offset;
- int lang;
- int format;
- Encoding *enc;
-};
-
-static int SubtableIsntSupported(FILE *ttf,uint32 offset,struct cmap_encs *cmap_enc, struct ttfinfo *info) {
- uint32 here = ftell(ttf);
- int format, len, ret=false;
-
- fseek(ttf,offset,SEEK_SET);
-
- cmap_enc->format = format = getushort(ttf);
- if ( format<0 || (format&1) || format>12 ) {
- LogError( _("Encoding subtable for platform=%d, specific=%d has an unsupported format %d.\n"),
- cmap_enc->platform, cmap_enc->specific, format );
- info->bad_cmap = true;
- ret = true;
- }
-
- if ( format!=12 && format!=10 && format!=8 ) {
- len = getushort(ttf);
- cmap_enc->lang = getushort(ttf);
- } else {
- /* padding */ getushort(ttf);
- len = getlong(ttf);
- cmap_enc->lang = getlong(ttf);
- }
- if ( len==0 ) {
- LogError( _("Encoding subtable for platform=%d, specific=%d has a 0 length subtable.\n"),
- cmap_enc->platform, cmap_enc->specific );
- info->bad_cmap = true;
- ret = true;
- }
- fseek(ttf,here,SEEK_SET);
-return( ret );
-}
-
-static int SubtableMustBe14(FILE *ttf,uint32 offset,struct ttfinfo *info) {
- uint32 here = ftell(ttf);
- int format, ret=true;
-
- fseek(ttf,offset,SEEK_SET);
-
- format = getushort(ttf);
- if ( format!=14 ) {
- LogError( _("Encoding subtable for platform=%d, specific=%d (which must be 14)\nhas an unsupported format %d.\n"),
- 0, 5, format );
- info->bad_cmap = true;
- ret = false;
- }
- fseek(ttf,here,SEEK_SET);
-return( ret );
-}
-
-static void ApplyVariationSequenceSubtable(FILE *ttf,uint32 vs_map,
- struct ttfinfo *info,int justinuse) {
- int sub_table_len, vs_cnt, i, j, rcnt, gid;
- struct vs_data { int vs; uint32 def, non_def; } *vs_data;
- SplineChar *sc;
-
- fseek(ttf,vs_map,SEEK_SET);
- /* We/ve already checked the format is 14 */ getushort(ttf);
- sub_table_len = getlong(ttf);
- vs_cnt = getlong(ttf);
- vs_data = galloc(vs_cnt*sizeof(struct vs_data));
- for ( i=0; i<vs_cnt; ++i ) {
- vs_data[i].vs = get3byte(ttf);
- vs_data[i].def = getlong(ttf);
- vs_data[i].non_def = getlong(ttf);
- }
-
- for ( i=0; i<vs_cnt; ++i ) {
- if ( vs_data[i].def!=0 && justinuse==git_normal ) {
- fseek(ttf,vs_map+vs_data[i].def,SEEK_SET);
- rcnt = getlong(ttf);
- for ( j=0; j<rcnt; ++j ) {
- int start_uni = get3byte(ttf);
- int cnt = getc(ttf);
- int uni;
- for ( uni=start_uni; uni<=start_uni+cnt; ++uni ) {
- SplineChar *sc=NULL;
- struct altuni *altuni;
- for ( gid = 0; gid<info->glyph_cnt; ++gid ) {
- if ( (sc = info->chars[gid])!=NULL ) {
- if ( sc->unicodeenc==uni )
- break;
- for ( altuni = sc->altuni; altuni!=NULL; altuni=altuni->next )
- if ( altuni->unienc==uni && altuni->vs == -1 && altuni->fid==0 )
- break;
- if ( altuni!=NULL )
- break;
- }
- }
- if ( gid==info->glyph_cnt ) {
- LogError( _("No glyph with unicode U+%05x in font\n"),
- uni );
- info->bad_cmap = true;
- } else {
- altuni = chunkalloc(sizeof(struct altuni));
- altuni->unienc = uni;
- altuni->vs = vs_data[i].vs;
- altuni->fid = 0;
- altuni->next = sc->altuni;
- sc->altuni = altuni;
- }
- }
- }
- }
- if ( vs_data[i].non_def!=0 ) {
- fseek(ttf,vs_map+vs_data[i].non_def,SEEK_SET);
- rcnt = getlong(ttf);
- for ( j=0; j<rcnt; ++j ) {
- int uni = get3byte(ttf);
- int curgid = getushort(ttf);
- if ( justinuse==git_justinuse ) {
- if ( curgid<info->glyph_cnt && curgid>=0)
- info->inuse[curgid] = 1;
- } else if ( justinuse==git_justinuse ) {
- if ( curgid<info->glyph_cnt && curgid>=0 &&
- (sc=info->chars[curgid])!=NULL && sc->name==NULL ) {
- char buffer[32];
- sprintf(buffer, "u%04X.vs%04X", uni, vs_data[i].vs );
- sc->name = copy(buffer);
- }
- } else {
- if ( curgid>=info->glyph_cnt || curgid<0 ||
- info->chars[curgid]==NULL ) {
- LogError( _("GID out of range (%d) in format 14 'cmap' subtable\n"),
- curgid );
- info->bad_cmap = true;
- } else {
- SplineChar *sc = info->chars[curgid];
- struct altuni *altuni = chunkalloc(sizeof(struct altuni));
- altuni->unienc = uni;
- altuni->vs = vs_data[i].vs;
- altuni->fid = 0;
- altuni->next = sc->altuni;
- sc->altuni = altuni;
- }
- }
- }
- }
- }
- free(vs_data);
-}
-
-static enum uni_interp amscheck(struct ttfinfo *info, EncMap *map) {
- int cnt = 0;
- /* Try to guess if the font uses the AMS math PUA assignments */
-
- if ( map==NULL )
-return( ui_none );
-
- if ( 0xe668<map->enccount && map->map[0xe668]!=-1 &&
- info->chars[map->map[0xe668]]->unicodeenc=='b' )
- ++cnt;
- if ( 0xe3c8<map->enccount && map->map[0xe626]!=-1 &&
- info->chars[map->map[0xe626]]->unicodeenc==0xe626 )
- ++cnt;
- if ( 0xe3c8<map->enccount && map->map[0xe3c8]!=-1 &&
- info->chars[map->map[0xe3c8]]->unicodeenc==0x29e1 )
- ++cnt;
- if ( 0x2A7C<map->enccount && map->map[0x2A7C]!=-1 &&
- info->chars[map->map[0x2A7C]]->unicodeenc==0xE32A )
- ++cnt;
- if ( 0x2920<map->enccount && map->map[0x2920]!=-1 &&
- info->chars[map->map[0x2920]]->unicodeenc==0xE221 )
- ++cnt;
-return( cnt>=2 ? ui_ams : ui_none );
-}
-
-static int PickCMap(struct cmap_encs *cmap_encs,int enccnt,int def) {
- char buffer[500];
- char **choices, *encname;
- int i, ret;
- static char *macscripts[]= { N_("Roman"), N_("Japanese"), N_("Traditional Chinese"), N_("Korean"),
- N_("Arabic"), N_("Hebrew"), N_("Greek"),
-/* GT: Don't ask me what RSymbol means, I don't know either. It's in apple's */
-/* GT: docs though */
- N_("Cyrillic"), N_("RSymbol"), N_("Devanagari"),
-/* 10*/ N_("Gurmukhi"), N_("Gujarati"), NULL, NULL, NULL,
- NULL, NULL, NULL, NULL, NULL,
-/* 20*/ NULL, N_("Thai"), NULL, NULL, NULL, N_("Simplified Chinese"),
- NULL, NULL, NULL, N_("Central European"),
-/* 30*/ NULL, NULL, NULL };
-
- choices = galloc(enccnt*sizeof(char *));
- for ( i=0; i<enccnt; ++i ) {
- encname = NULL;
- if ( cmap_encs[i].platform==1 && cmap_encs[i].specific<32 ) {
- encname = macscripts[cmap_encs[i].specific];
- if ( encname!=NULL )
- encname = _(encname);
- } else if ( cmap_encs[i].platform==0 ) {
- switch ( cmap_encs[i].specific ) {
- case 0:
- encname = N_("Unicode 1.0");
- break;
- case 1:
- encname = N_("Unicode 1.1");
- break;
- case 2:
- encname = N_("ISO 10646:1993");
- break;
- case 3:
- encname = N_("Unicode 2.0+, BMP only");
- break;
- case 4:
- encname = N_("Unicode 2.0+, all planes");
- break;
- }
- } else if ( cmap_encs[i].platform==3 && cmap_encs[i].specific==0 )
- encname = N_("\"Symbol\"");
- if ( encname==NULL )
- encname = cmap_encs[i].enc->enc_name;
-
- sprintf(buffer,"%d (%s) %d %s %s %s",
- cmap_encs[i].platform,
- cmap_encs[i].platform==0 ? _("Unicode") :
- cmap_encs[i].platform==1 ? _("Apple") :
- cmap_encs[i].platform==2 ? _("ISO (Deprecated)") :
- cmap_encs[i].platform==3 ? _("MicroSoft") :
- cmap_encs[i].platform==4 ? _("Custom") :
- cmap_encs[i].platform==7 ? _("FreeType internals") :
- _("Unknown"),
- cmap_encs[i].specific,
- encname,
- cmap_encs[i].platform==1 && cmap_encs[i].lang!=0? MacLanguageFromCode(cmap_encs[i].lang-1) : "",
- cmap_encs[i].format == 0 ? "Byte encoding table" :
- cmap_encs[i].format == 2 ? "High-byte mapping through table" :
- cmap_encs[i].format == 4 ? "Segment mapping to delta values" :
- cmap_encs[i].format == 6 ? "Trimmed table mapping" :
- cmap_encs[i].format == 8 ? "mixed 16-bit and 32-bit coverage" :
- cmap_encs[i].format == 10 ? "Trimmed array" :
- cmap_encs[i].format == 12 ? "Segmented coverage" :
- "Unknown format" );
- choices[i] = copy(buffer);
- }
- ret = ff_choose(_("Pick a CMap subtable"),(const char **) choices,enccnt,def,
- _("Pick a CMap subtable"));
- for ( i=0; i<enccnt; ++i )
- free(choices[i]);
- free(choices);
-return( ret );
-}
-
-/* 'cmap' table: readttfcmap */
-static void readttfencodings(FILE *ttf,struct ttfinfo *info, int justinuse) {
- int i,j, def, unicode_cmap, unicode4_cmap, dcnt, dcmap_cnt, dc;
- int nencs, version, usable_encs;
- Encoding *enc = &custom;
- const int32 *trans=NULL;
- enum uni_interp interp = ui_none;
- int platform, specific;
- int offset, encoff=0;
- int format, len;
- uint32 vs_map=0;
- uint16 table[256];
- int segCount;
- uint16 *endchars, *startchars, *delta, *rangeOffset, *glyphs;
- int index, last;
- int mod = 0;
- SplineChar *sc;
- uint8 *used;
- int badencwarned=false;
- int glyph_tot;
- Encoding *temp;
- EncMap *map;
- struct cmap_encs *cmap_encs, desired_cmaps[2], *dcmap;
-
- fseek(ttf,info->encoding_start,SEEK_SET);
- version = getushort(ttf);
- nencs = getushort(ttf);
- if ( version!=0 && nencs==0 )
- nencs = version; /* Sometimes they are backwards */ /* Or was I just confused early on? */
- cmap_encs = galloc(nencs*sizeof(struct cmap_encs));
- for ( i=usable_encs=0; i<nencs; ++i ) {
- cmap_encs[usable_encs].platform = getushort(ttf);
- cmap_encs[usable_encs].specific = getushort(ttf);
- cmap_encs[usable_encs].offset = getlong(ttf);
- if ( cmap_encs[usable_encs].platform == 0 && cmap_encs[usable_encs].specific == 5 ) {
- /* This isn't a true encoding. */
- /* It's an optional set of encoding modifications (sort of) */
- /* applied to a format 4/10 encoding (unicode BMP/Full) */
- if ( SubtableMustBe14(ttf,info->encoding_start+cmap_encs[usable_encs].offset,info) )
- vs_map = info->encoding_start+cmap_encs[usable_encs].offset;
- continue;
- }
- temp = enc_from_platspec(cmap_encs[usable_encs].platform,cmap_encs[usable_encs].specific);
- if ( temp==NULL ) /* iconv doesn't support this. Some sun iconvs seem limited */
- temp = FindOrMakeEncoding("Custom");
- cmap_encs[usable_encs].enc = temp;
- if ( SubtableIsntSupported(ttf,info->encoding_start+cmap_encs[usable_encs].offset,
- &cmap_encs[usable_encs],info))
- continue;
- ++usable_encs;
- }
- if ( usable_encs==0 ) {
- LogError( _("Could not find any valid encoding tables" ));
- free(cmap_encs);
-return;
- }
- def = -1;
- enc = &custom;
- unicode_cmap = unicode4_cmap = -1;
- for ( i=0; i<usable_encs; ++i ) {
- temp = cmap_encs[i].enc;
- platform = cmap_encs[i].platform;
- specific = cmap_encs[i].specific;
- offset = cmap_encs[i].offset;
-
- if ( (platform==3 && specific==10) || (platform==0 && specific==4) ) { /* MS Unicode 4 byte */
- enc = temp;
- def = i;
- unicode4_cmap = i;
- } else if ( !enc->is_unicodefull && (!prefer_cjk_encodings ||
- (!enc->is_japanese && !enc->is_korean && !enc->is_tradchinese &&
- !enc->is_simplechinese)) &&
- (( platform==3 && specific==1 ) || /* MS Unicode */
-/* Well I should only deal with apple unicode specific==0 (default) and 3 (U2.0 semantics) */
-/* but apple ships dfonts with specific==1 (Unicode 1.1 semantics) */
-/* which is stupid of them */
- ( platform==0 /*&& (specific==0 || specific==3)*/ ))) { /* Apple Unicode */
- enc = temp;
- def = i;
- } else if ( platform==3 && specific==0 && enc->is_custom ) {
- /* Only select symbol if we don't have something better */
- enc = temp;
- def = i;
- /* Now I had assumed this would be a 1 byte encoding, but it turns*/
- /* out to map into the unicode private use area at U+f000-U+F0FF */
- /* so it's a 2 byte enc */
-/* Mac platform specific encodings are script numbers. 0=>roman, 1=>jap, 2=>big5, 3=>korean, 4=>arab, 5=>hebrew, 6=>greek, 7=>cyrillic, ... 25=>simplified chinese */
- } else if ( platform==1 && specific==0 && enc->is_custom ) {
- enc = temp;
- def = i;
- } else if ( platform==1 && (specific==2 ||specific==1||specific==3||specific==25) &&
- !enc->is_unicodefull &&
- (prefer_cjk_encodings || !enc->is_unicodebmp) ) {
- enc = temp;
- def = i;
- } else if ( platform==3 && (specific>=2 && specific<=6 ) &&
- !enc->is_unicodefull &&
- (prefer_cjk_encodings || !enc->is_unicodebmp) ) {
- /* Old ms docs say that specific==3 => big 5, new docs say specific==4 => big5 */
- /* Ain't that jus' great? */
- enc = temp;
- def = i;
- }
- if ( (platform==3 && specific==1) ||
- (platform==0 && specific==3))
- unicode_cmap = i;
- }
-
- if ( justinuse==git_justinuse || !ask_user_for_cmap || (i = PickCMap(cmap_encs,usable_encs,def))==-1 )
- i = def;
-
- if ( i==-1 ) {
- LogError( _("Could not find a usable encoding table" ));
- free(cmap_encs);
-return;
- }
-
- info->platform = cmap_encs[i].platform;
- info->specific = cmap_encs[i].specific;
-
- desired_cmaps[0] = cmap_encs[i]; dcnt = 1;
- if ( unicode4_cmap!=-1 ) {
- if ( i!=unicode4_cmap ) {
- desired_cmaps[1] = cmap_encs[unicode4_cmap];
- ++dcnt;
- }
- } else if ( unicode_cmap!=-1 ) {
- if ( i!=unicode_cmap ) {
- desired_cmaps[1] = cmap_encs[unicode_cmap];
- ++dcnt;
- }
- } else {
- if ( i!=def && def!=-1 ) {
- desired_cmaps[1] = cmap_encs[def];
- ++dcnt;
- }
- }
-
- map = NULL;
- if ( justinuse==git_justinuse ) {
- dcmap_cnt = usable_encs;
- dcmap = cmap_encs;
- } else {
- dcmap_cnt = dcnt;
- dcmap = desired_cmaps;
- }
- for ( dc=dcmap_cnt-1; dc>=0; --dc ) {
- /* if justinuse then look at all cmaps and tick the glyphs they use */
- /* otherwise dcmap_cnt will be either 1 or 2. If 1 then this subtable */
- /* contains both the encoding and the source for unicode encodings */
- /* if dcmap_cnt==2 then when dc==0 we are setting up the encoding */
- /* and when dc==1 we are setting up the unicode code points */
- int dounicode = (dc==dcmap_cnt-1);
- enc = dcmap[dc].enc;
- encoff = dcmap[dc].offset;
-
- if ( dc==0 && justinuse==git_normal ) {
- interp = interp_from_encoding(enc,ui_none);
- mod = 0;
- if ( dcmap[dc].platform==3 && (dcmap[dc].specific>=2 && dcmap[dc].specific<=6 ))
- mod = dcmap[dc].specific;
- else if ( dcmap[dc].platform==1 && (dcmap[dc].specific==2 ||dcmap[dc].specific==1||dcmap[dc].specific==3||dcmap[dc].specific==25))
- mod = dcmap[dc].specific==1?2:dcmap[dc].specific==2?4:dcmap[dc].specific==3?5:3; /* convert to ms specific */
- info->map = map = EncMapNew(enc->char_cnt,info->glyph_cnt,enc);
- info->uni_interp = interp;
- }
-
- fseek(ttf,info->encoding_start+encoff,SEEK_SET);
- format = getushort(ttf);
- if ( format!=12 && format!=10 && format!=8 ) {
- len = getushort(ttf);
- /* version/language = */ getushort(ttf);
- } else {
- /* padding */ getushort(ttf);
- len = getlong(ttf);
- /* language = */ getlong(ttf);
- }
- if ( enc->is_unicodebmp && (format==8 || format==10 || format==12))
- enc = FindOrMakeEncoding("UnicodeFull");
-
- if ( format==0 ) {
- if ( justinuse==git_normal && map!=NULL && map->enccount<256 ) {
- map->map = grealloc(map->map,256*sizeof(int));
- memset(map->map,-1,(256-map->enccount)*sizeof(int));
- map->enccount = map->encmax = 256;
- }
- for ( i=0; i<len-6; ++i )
- table[i] = getc(ttf);
- trans = enc->unicode;
- if ( trans==NULL && dcmap[dc].platform==1 )
- trans = MacEncToUnicode(dcmap[dc].specific,dcmap[dc].lang-1);
- for ( i=0; i<256 && i<len-6; ++i )
- if ( justinuse==git_normal ) {
- if ( table[i]<info->glyph_cnt && info->chars[table[i]]!=NULL ) {
- if ( map!=NULL )
- map->map[i] = table[i];
- if ( dounicode && trans!=NULL )
- info->chars[table[i]]->unicodeenc = trans[i];
- }
- } else if ( table[i]<info->glyph_cnt && info->chars[table[i]]!=NULL )
- info->inuse[table[i]] = 1;
- } else if ( format==4 ) {
- segCount = getushort(ttf)/2;
- /* searchRange = */ getushort(ttf);
- /* entrySelector = */ getushort(ttf);
- /* rangeShift = */ getushort(ttf);
- endchars = galloc(segCount*sizeof(uint16));
- used = gcalloc(65536,sizeof(uint8));
- for ( i=0; i<segCount; ++i )
- endchars[i] = getushort(ttf);
- if ( getushort(ttf)!=0 )
- IError("Expected 0 in 'cmap' format 4 subtable");
- startchars = galloc(segCount*sizeof(uint16));
- for ( i=0; i<segCount; ++i )
- startchars[i] = getushort(ttf);
- delta = galloc(segCount*sizeof(uint16));
- for ( i=0; i<segCount; ++i )
- delta[i] = getushort(ttf);
- rangeOffset = galloc(segCount*sizeof(uint16));
- for ( i=0; i<segCount; ++i )
- rangeOffset[i] = getushort(ttf);
- len -= 8*sizeof(uint16) +
- 4*segCount*sizeof(uint16);
- /* that's the amount of space left in the subtable and it must */
- /* be filled with glyphIDs */
- if ( len<0 ) {
- IError("This font has an illegal format 4 subtable with too little space for all the segments.\nThis error is not recoverable.\nBye" );
- exit(1);
- }
- glyphs = galloc(len);
- glyph_tot = len/2;
- for ( i=0; i<glyph_tot; ++i )
- glyphs[i] = getushort(ttf);
- for ( i=0; i<segCount; ++i ) {
- if ( rangeOffset[i]==0 && startchars[i]==0xffff )
- /* Done */;
- else if ( rangeOffset[i]==0 ) {
- for ( j=startchars[i]; j<=endchars[i]; ++j ) {
- if ( justinuse==git_justinuse && (uint16) (j+delta[i])<info->glyph_cnt )
- info->inuse[(uint16) (j+delta[i])] = true;
- else if ( (uint16) (j+delta[i])>=info->glyph_cnt || info->chars[(uint16) (j+delta[i])]==NULL ) {
- LogError( _("Attempt to encode missing glyph %d to %d (0x%x)\n"),
- (uint16) (j+delta[i]), modenc(j,mod), modenc(j,mod));
- info->bad_cmap = true;
- } else {
- int uenc = umodenc(j,mod,info);
- int lenc = modenc(j,mod);
- if ( uenc!=-1 && used[uenc] ) {
- if ( !badencwarned ) {
- LogError( _("Multiple glyphs map to the same unicode encoding U+%04X, only one will be used\n"), uenc );
- info->bad_cmap = true;
- badencwarned = true;
- }
- } else {
- if ( uenc!=-1 && dounicode ) used[uenc] = true;
- if ( dounicode && info->chars[(uint16) (j+delta[i])]->unicodeenc==-1 )
- info->chars[(uint16) (j+delta[i])]->unicodeenc = uenc;
- if ( map!=NULL && lenc<map->enccount )
- map->map[lenc] = (uint16) (j+delta[i]);
- }
- }
- }
- } else if ( rangeOffset[i]!=0xffff ) {
- /* Apple says a rangeOffset of 0xffff means no glyph */
- /* OpenType doesn't mention this */
- for ( j=startchars[i]; j<=endchars[i]; ++j ) {
- int temp = (i-segCount+rangeOffset[i]/2) + j-startchars[i];
- if ( temp<glyph_tot )
- index = glyphs[ temp ];
- else {
- /* This happened in mingliu.ttc(PMingLiU) */
- if ( justinuse==git_normal ) {
- LogError( _("Glyph index out of bounds. Was %d, must be less than %d.\n In attempt to associate a glyph with encoding %x in segment %d\n with platform=%d, specific=%d (in 'cmap')\n"),
- temp, glyph_tot, j, i, dcmap[dc].platform, dcmap[dc].specific );
- info->bad_cmap = true;
- }
- index = 0;
- }
- if ( index!=0 ) {
- index = (unsigned short) (index+delta[i]);
- if ( index>=info->glyph_cnt ) {
- /* This isn't mentioned either, but in some */
- /* MS Chinese fonts (kaiu.ttf) the index */
- /* goes out of bounds. and MS's ttf dump */
- /* program says it is treated as 0 */
- LogError( _("Attempt to encode missing glyph %d to %d (0x%x)\n"),
- index, modenc(j,mod), modenc(j,mod));
- info->bad_cmap = true;
- } else if ( justinuse==git_justinuse )
- info->inuse[index] = 1;
- else if ( info->chars[index]==NULL ) {
- LogError( _("Attempt to encode missing glyph %d to %d (0x%x)\n"),
- index, modenc(j,mod), modenc(j,mod));
- info->bad_cmap = true;
- } else {
- int uenc = umodenc(j,mod,info);
- int lenc = modenc(j,mod);
- if ( uenc!=-1 && used[uenc] ) {
- if ( !badencwarned ) {
- LogError( _("Multiple glyphs map to the same unicode encoding U+%04X, only one will be used\n"), uenc );
- info->bad_cmap = true;
- badencwarned = true;
- }
- } else {
- if ( uenc!=-1 && dounicode ) used[uenc] = true;
- if ( dounicode && info->chars[index]->unicodeenc==-1 )
- info->chars[index]->unicodeenc = uenc;
- if ( map!=NULL && lenc<map->enccount )
- map->map[lenc] = index;
- }
- }
- }
- }
- } else {
- LogError( _("Use of a range offset of 0xffff to mean a missing glyph in cmap table\n") );
- info->bad_cmap = true;
- }
- }
- free(glyphs);
- free(rangeOffset);
- free(delta);
- free(startchars);
- free(endchars);
- free(used);
- } else if ( format==6 ) {
- /* trimmed array format */
- /* Well, the docs say it's for 2byte encodings, but Apple actually*/
- /* uses it for 1 byte encodings which don't fit into the require-*/
- /* ments for a format 0 sub-table. See Zapfino.dfont */
- int first, count;
- first = getushort(ttf);
- count = getushort(ttf);
- trans = enc->unicode;
- if ( trans==NULL && dcmap[dc].platform==1 && first+count<=256 )
- trans = MacEncToUnicode(dcmap[dc].specific,dcmap[dc].lang-1);
- if ( justinuse==git_justinuse )
- for ( i=0; i<count; ++i )
- info->inuse[getushort(ttf)]= 1;
- else {
- for ( i=0; i<count; ++i ) {
- int gid = getushort(ttf);
- if ( dounicode )
- info->chars[gid]->unicodeenc = trans!=NULL ? trans[first+1] : first+i;
- if ( map!=NULL && first+i < map->enccount )
- map->map[first+i] = gid;
- }
- }
- } else if ( format==2 ) {
- int max_sub_head_key = 0, cnt, max_pos= -1;
- struct subhead *subheads;
-
- for ( i=0; i<256; ++i ) {
- table[i] = getushort(ttf)/8; /* Sub-header keys */
- if ( table[i]>max_sub_head_key ) {
- max_sub_head_key = table[i]; /* The entry is a byte pointer, I want a pointer in units of struct subheader */
- max_pos = i;
- }
- }
- subheads = galloc((max_sub_head_key+1)*sizeof(struct subhead));
- for ( i=0; i<=max_sub_head_key; ++i ) {
- subheads[i].first = getushort(ttf);
- subheads[i].cnt = getushort(ttf);
- subheads[i].delta = getushort(ttf);
- subheads[i].rangeoff = (getushort(ttf)-
- (max_sub_head_key-i)*sizeof(struct subhead)-
- sizeof(short))/sizeof(short);
- }
- cnt = (len-(ftell(ttf)-(info->encoding_start+encoff)))/sizeof(short);
- /* The count is the number of glyph indexes to read. it is the */
- /* length of the entire subtable minus that bit we've read so far */
- glyphs = galloc(cnt*sizeof(short));
- for ( i=0; i<cnt; ++i )
- glyphs[i] = getushort(ttf);
- last = -1;
- for ( i=0; i<256; ++i ) {
- if ( table[i]==0 ) {
- /* Special case, single byte encoding entry, look it up in */
- /* subhead */
- /* In the one example I've got of this encoding (wcl-02.ttf) the chars */
- /* 0xfd, 0xfe, 0xff are said to exist but there is no mapping */
- /* for them. */
- if ( i>=max_pos )
- index = 0; /* the subhead says there are 256 entries, but in fact there are only 193, so attempting to find these guys should give an error */
- else if ( i<subheads[0].first || i>=subheads[0].first+subheads[0].cnt ||
- subheads[0].rangeoff+(i-subheads[0].first)>=cnt )
- index = 0;
- else if ( (index = glyphs[subheads[0].rangeoff+(i-subheads[0].first)])!= 0 )
- index = (uint32) (index+subheads[0].delta);
- /* I assume the single byte codes are just ascii or latin1*/
- if ( index!=0 && index<info->glyph_cnt ) {
- if ( justinuse==git_justinuse )
- info->inuse[index] = 1;
- else if ( info->chars[index]==NULL )
- /* Do Nothing */;
- else {
- int lenc = modenc(i,mod);
- if ( dounicode && info->chars[index]->unicodeenc==-1 )
- info->chars[index]->unicodeenc = i;
- if ( map!=NULL && lenc<map->enccount )
- map->map[lenc] = index;
- }
- }
- } else {
- int k = table[i];
- for ( j=0; j<subheads[k].cnt; ++j ) {
- int enc, lenc;
- if ( subheads[k].rangeoff+j>=cnt )
- index = 0;
- else if ( (index = glyphs[subheads[k].rangeoff+j])!= 0 )
- index = (uint16) (index+subheads[k].delta);
- if ( index!=0 && index<info->glyph_cnt ) {
- enc = (i<<8)|(j+subheads[k].first);
- lenc = modenc(enc,mod);
- if ( justinuse==git_justinuse )
- info->inuse[index] = 1;
- else if ( info->chars[index]==NULL )
- /* Do Nothing */;
- else {
- if ( dounicode && info->chars[index]->unicodeenc==-1 )
- info->chars[index]->unicodeenc = umodenc(enc,mod,info);
- if ( map!=NULL && lenc<map->enccount )
- map->map[lenc] = index;
- }
- }
- }
- /*if ( last==-1 ) last = i;*/
- }
- }
- free(subheads);
- free(glyphs);
- } else if ( format==8 ) {
- uint32 ngroups, start, end, startglyph;
- if ( !enc->is_unicodefull ) {
- IError("I don't support 32 bit characters except for the UCS-4 (MS platform, specific=10)" );
- enc = FindOrMakeEncoding("UnicodeFull");
- }
- /* I'm now assuming unicode surrogate encoding, so I just ignore */
- /* the is32 table (it will be set for the surrogates and not for */
- /* anything else */
- fseek(ttf,8192,SEEK_CUR);
- ngroups = getlong(ttf);
- for ( j=0; j<(int)ngroups; ++j ) {
- start = getlong(ttf);
- end = getlong(ttf);
- startglyph = getlong(ttf);
- if ( justinuse==git_justinuse )
- for ( i=start; i<=(int)end; ++i )
- info->inuse[startglyph+i-start]= 1;
- else
- for ( i=start; i<=(int)end; ++i ) {
- int uenc = ((i>>16)-0xd800)*0x400 + (i&0xffff)-0xdc00 + 0x10000;
- sc = info->chars[startglyph+i-start];
- if ( dounicode && sc->unicodeenc==-1 )
- sc->unicodeenc = uenc;
- if ( map!=NULL && sc->unicodeenc < map->enccount )
- map->map[uenc] = startglyph+i-start;
- }
- }
- } else if ( format==10 ) {
- /* same as format 6, except for 4byte chars */
- int first, count;
- if ( !enc->is_unicodefull ) {
- IError("I don't support 32 bit characters except for the UCS-4 (MS platform, specific=10)" );
- enc = FindOrMakeEncoding("UnicodeFull");
- }
- first = getlong(ttf);
- count = getlong(ttf);
- if ( justinuse==git_justinuse )
- for ( i=0; i<count; ++i )
- info->inuse[getushort(ttf)]= 1;
- else
- for ( i=0; i<count; ++i ) {
- int gid = getushort(ttf);
- if ( dounicode )
- info->chars[gid]->unicodeenc = first+i;
- if ( map!=NULL && first+i < map->enccount )
- map->map[first+i] = gid;
- }
- } else if ( format==12 ) {
- uint32 ngroups, start, end, startglyph;
- if ( !enc->is_unicodefull ) {
- IError("I don't support 32 bit characters except for the UCS-4 (MS platform, specific=10)" );
- enc = FindOrMakeEncoding("UnicodeFull");
- }
- ngroups = getlong(ttf);
- for ( j=0; j<(int)ngroups; ++j ) {
- start = getlong(ttf);
- end = getlong(ttf);
- startglyph = getlong(ttf);
- if ( justinuse==git_justinuse ) {
- for ( i=start; i<=(int)end; ++i )
- if ( startglyph+i-start < (unsigned)info->glyph_cnt )
- info->inuse[startglyph+i-start]= 1;
- else
- break;
- } else {
- for ( i=start; i<=(int)end; ++i ) {
- if ( startglyph+i-start >= (unsigned)info->glyph_cnt || info->chars[startglyph+i-start]==NULL ) {
- LogError( _("Bad font: Encoding data out of range.\n") );
- info->bad_cmap = true;
- break;
- } else {
- if ( dounicode )
- info->chars[startglyph+i-start]->unicodeenc = i;
- if ( map!=NULL && i < map->enccount && i>=0)
- map->map[i] = startglyph+i-start;
- }
- }
- }
- }
- }
- }
- free(cmap_encs);
- if ( info->chars!=NULL )
- for ( i=0; i<info->glyph_cnt; ++i )
- if ( info->chars[i]!=NULL && info->chars[i]->unicodeenc==0xffff )
- info->chars[i]->unicodeenc = -1;
- info->vs_start = vs_map;
- if ( vs_map!=0 )
- ApplyVariationSequenceSubtable(ttf,vs_map,info,justinuse);
- if ( justinuse==git_normal ) {
- if ( interp==ui_none )
- info->uni_interp = amscheck(info,map);
- map->enc = enc; /* This can be changed from the initial value */
- }
- info->map = map;
-}
-
-static void readttfos2metrics(FILE *ttf,struct ttfinfo *info) {
- int i, sel;
-
- fseek(ttf,info->os2_start,SEEK_SET);
- info->os2_version = getushort(ttf);
-#ifdef LUA_FF_LIB
- info->pfminfo.avgwidth = getushort(ttf);
-#else
- /* avgwidth */ getushort(ttf);
-#endif
- info->pfminfo.weight = getushort(ttf);
- info->pfminfo.width = getushort(ttf);
- info->pfminfo.fstype = getushort(ttf);
- info->pfminfo.os2_subxsize = getushort(ttf);
- info->pfminfo.os2_subysize = getushort(ttf);
- info->pfminfo.os2_subxoff = getushort(ttf);
- info->pfminfo.os2_subyoff = getushort(ttf);
- info->pfminfo.os2_supxsize = getushort(ttf);
- info->pfminfo.os2_supysize = getushort(ttf);
- info->pfminfo.os2_supxoff = getushort(ttf);
- info->pfminfo.os2_supyoff = getushort(ttf);
- info->pfminfo.os2_strikeysize = getushort(ttf);
- info->pfminfo.os2_strikeypos = getushort(ttf);
- info->pfminfo.os2_family_class = getushort(ttf);
- for ( i=0; i<10; ++i )
- info->pfminfo.panose[i] = getc(ttf);
- info->pfminfo.pfmfamily = info->pfminfo.panose[0]==2 ? 0x11 : /* might be 0x21 */ /* Text & Display maps to either serif 0x11 or sans 0x21 or monospace 0x31 */
- info->pfminfo.panose[0]==3 ? 0x41 : /* Script */
- info->pfminfo.panose[0]==4 ? 0x51 : /* Decorative */
- 0x51; /* And pictorial doesn't fit into pfm */
- info->pfminfo.unicoderanges[0] = getlong(ttf);
- info->pfminfo.unicoderanges[1] = getlong(ttf);
- info->pfminfo.unicoderanges[2] = getlong(ttf);
- info->pfminfo.unicoderanges[3] = getlong(ttf);
- info->pfminfo.hasunicoderanges = true;
- info->pfminfo.os2_vendor[0] = getc(ttf);
- info->pfminfo.os2_vendor[1] = getc(ttf);
- info->pfminfo.os2_vendor[2] = getc(ttf);
- info->pfminfo.os2_vendor[3] = getc(ttf);
- sel = getushort(ttf);
- if ( info->os2_version>=4 ) {
- info->use_typo_metrics = (sel&128)?1:0;
- info->weight_width_slope_only = (sel&256)?1:0;
- }
-#ifdef LUA_FF_LIB
- info->pfminfo.firstchar = getushort(ttf);
- info->pfminfo.lastchar = getushort(ttf);
-#else
- /* firstchar */ getushort(ttf);
- /* lastchar */ getushort(ttf);
-#endif
- info->pfminfo.os2_typoascent = getushort(ttf);
- info->pfminfo.os2_typodescent = (short) getushort(ttf);
- if ( info->pfminfo.os2_typoascent-info->pfminfo.os2_typodescent == info->emsize ) {
- info->ascent = info->pfminfo.os2_typoascent;
- info->descent = -info->pfminfo.os2_typodescent;
- }
- info->pfminfo.os2_typolinegap = getushort(ttf);
- info->pfminfo.os2_winascent = getushort(ttf);
- info->pfminfo.os2_windescent = getushort(ttf);
- info->pfminfo.winascent_add = info->pfminfo.windescent_add = false;
- info->pfminfo.typoascent_add = info->pfminfo.typodescent_add = false;
- info->pfminfo.pfmset = true;
- info->pfminfo.panose_set = true;
- info->pfminfo.subsuper_set = true;
- if ( info->os2_version>=1 ) {
- info->pfminfo.codepages[0] = getlong(ttf);
- info->pfminfo.codepages[1] = getlong(ttf);
- info->pfminfo.hascodepages = true;
- }
-#ifdef LUA_FF_LIB
- if ( info->os2_version>=3 ) { /* TH just in case */
- info->pfminfo.os2_xheight = getushort(ttf); /* four new fields */
- info->pfminfo.os2_capheight = getushort(ttf);
- info->pfminfo.os2_defaultchar = getushort(ttf);
- info->pfminfo.os2_breakchar = getushort(ttf);
- }
-#endif
- if ( info->os2_version==0 ) {
- LogError("Windows will reject fonts with an OS/2 version number of 0\n");
- info->bad_os2_version = true;
- } else if ( info->os2_version==1 && info->cff_start!=0 ) {
- LogError("Windows will reject otf (cff) fonts with an OS/2 version number of 1\n");
- info->bad_os2_version = true;
- }
-}
-
-#if 0
-static int cmapEncFromName(struct ttfinfo *info,const char *nm, int glyphid) {
- int uni;
- int i;
-
- if ( info->map!=NULL )
- uni = EncFromName(nm,info->uni_interp,info->map->enc);
- else
- uni = EncFromName(nm,ui_none,&custom);
- if ( uni==-1 )
-return( -1 );
-
- for ( i=0; i<info->glyph_cnt; ++i ) if ( info->chars[i]!=NULL ) {
- if ( info->chars[i]->unicodeenc==uni ) {
- if ( info->complainedmultname )
- /* Don't do it again */;
- else if ( info->chars[i]->name!=NULL && strcmp(info->chars[i]->name,nm)==0 )
- LogError( _("Warning: Glyph %d has the same name (%s) as Glyph %d\n"),
- i, nm, glyphid );
- else
- LogError( _("Warning: Glyph %d is named %s which should mean it is mapped to\n Unicode U+%04X, but Glyph %d already has that encoding.\n"),
- glyphid, nm, uni, i);
- info->complainedmultname = true;
-return( -1 );
- }
- }
-return( uni );
-}
-#endif
-
-static void readttfpostnames(FILE *ttf,struct ttfinfo *info) {
- int i,j;
- int format, len, gc, gcbig, val;
- const char *name;
- char buffer[30];
- uint16 *indexes;
- int notdefwarned = false;
- int anynames = false;
-
- ff_progress_change_line2(_("Reading Names"));
-
- /* Give ourselves an xuid, just in case they want to convert to PostScript*/
- /* (even type42) */
- if ( xuid!=NULL && info->fd==NULL && info->xuid==NULL ) {
- info->xuid = galloc(strlen(xuid)+20);
- sprintf(info->xuid,"[%s %d]", xuid, (rand()&0xffffff));
- }
-
- if ( info->postscript_start!=0 ) {
- fseek(ttf,info->postscript_start,SEEK_SET);
- format = getlong(ttf);
- info->italicAngle = getfixed(ttf);
- info->upos = (short) getushort(ttf);
- info->uwidth = (short) getushort(ttf);
- info->upos += info->uwidth/2; /* 'post' defn of this field is different from FontInfo defn and I didn't notice */
- /* fixedpitch = */ getlong(ttf);
- /* mem1 = */ getlong(ttf);
- /* mem2 = */ getlong(ttf);
- /* mem3 = */ getlong(ttf);
- /* mem4 = */ getlong(ttf);
- if ( format==0x00020000 ) {
- gc = getushort(ttf);
- indexes = gcalloc(65536,sizeof(uint16));
- /* the index table is backwards from the way I want to use it */
- gcbig = 0;
- for ( i=0; i<gc; ++i ) {
- indexes[val = getushort(ttf)] = i;
- if ( val>=258 ) ++gcbig;
- }
-
- /* if we are only loading bitmaps, we can get holes in our data */
- for ( i=0; i<258; ++i ) if ( indexes[i]!=0 || i==0 ) if ( indexes[i]<info->glyph_cnt && info->chars[indexes[i]]!=NULL ) {
- info->chars[indexes[i]]->name = copy(ttfstandardnames[i]);
-#if 0 /* Too many fonts have badly named glyphs */
- if ( info->chars[indexes[i]]->unicodeenc==-1 )
- info->chars[indexes[i]]->unicodeenc = cmapEncFromName(info,ttfstandardnames[i],indexes[i]);
-#endif
- }
- gcbig += 258;
- for ( i=258; i<gcbig; ++i ) {
- char *nm;
- len = getc(ttf);
- if ( len<0 ) /* Don't crash on EOF */
- break;
- nm = galloc(len+1);
- for ( j=0; j<len; ++j )
- nm[j] = getc(ttf);
- nm[j] = '\0';
- if ( indexes[i]<info->glyph_cnt && info->chars[indexes[i]]!=NULL ) {
- if (info->chars[indexes[i]]->name)
- free( info->chars[indexes[i]]->name );
- info->chars[indexes[i]]->name = nm;
-#if 0 /* Too many fonts have badly named glyphs */
- if ( info->chars[indexes[i]]->unicodeenc==-1 )
- info->chars[indexes[i]]->unicodeenc = cmapEncFromName(info,nm,indexes[i]);
-#endif
- }
- }
- free(indexes);
- anynames = true;
- }
- }
-
- if ( info->fd!=NULL && info->fd->chars!=NULL) {
- EncMap *map = NULL;
- struct pschars *chars = info->fd->chars;
- if ( info->map==NULL )
- info->map = map = EncMapNew(65536,65536,FindOrMakeEncoding("UnicodeBmp"));
- /* In type42 fonts the names are stored in a postscript /CharStrings dictionary */
- for ( i=0; i<chars->next; ++i ) {
- int gid = (intpt) (chars->values[i]);
- if ( gid>=0 && gid<info->glyph_cnt && chars->keys[i]!=NULL ) {
- free(info->chars[gid]->name);
- info->chars[gid]->name = chars->keys[i];
- info->chars[gid]->unicodeenc = UniFromName(chars->keys[i],info->uni_interp,info->map->enc);
- if ( map!=NULL && info->chars[gid]->unicodeenc!=-1 &&
- info->chars[gid]->unicodeenc<map->enccount)
- map->map[ info->chars[gid]->unicodeenc ] = gid;
- chars->keys[i] = NULL;
- chars->values[i] = NULL;
- } else
- chars->values[i] = NULL;
- }
- }
-
- for ( i=0; i<info->glyph_cnt; ++i ) if ( info->chars[i]!=NULL ) {
- /* info->chars[i] can be null in some TTC files */
- if ( i!=0 && info->chars[i]->name!=NULL &&
- strcmp(info->chars[i]->name,".notdef")==0 ) {
- /* for some reason MS puts out fonts where several characters */
- /* are called .notdef (and only one is a real notdef). So if we */
- /* find a glyph other than 0 called ".notdef" then pretend it had */
- /* no name */
- if ( !notdefwarned ) {
- notdefwarned = true;
- LogError( _("Glyph %d is called \".notdef\", a singularly inept choice of name (only glyph 0\n may be called .notdef)\nFontForge will rename it.\n"), i );
- }
- free(info->chars[i]->name);
- info->chars[i]->name = NULL;
- /* I used to check for glyphs with bad names (ie. names indicative of */
- /* another unicode code point than the one applied to the glyph) but */
- /* this proves too early for that check, as we don't have the altunis*/
- /* figured out yet. So I've moved that into its own routine later */
- }
- /* And some volt files actually assign nul strings to the name */
- if ( (info->chars[i]->name!=NULL && *info->chars[i]->name!='\0' ))
- continue;
- free(info->chars[i]->name); /* If it's a null string get rid of it */
- if ( i==0 )
- name = ".notdef";
- else if ( info->chars[i]->unicodeenc<0 ) {
- /* Do this later */;
- name = NULL;
- } else {
- name = StdGlyphName(buffer,info->chars[i]->unicodeenc,info->uni_interp,NULL);
- if (THtest_duplicate_glyph_names && anynames ) {
- for ( j=0; j<info->glyph_cnt; ++j ) {
- if ( info->chars[j]!=NULL && j!=i && info->chars[j]->name!=NULL ) {
- if ( strcmp(info->chars[j]->name,name)==0 ) {
- name = NULL;
- break;
- }
- }
- }
- }
- }
- ff_progress_next();
- info->chars[i]->name = copy(name);
- }
-
- /* If we have a GSUB table we can give some unencoded glyphs names */
- /* for example if we have a vrt2 substitution of A to <unencoded> */
- /* we could name the unencoded "A.vrt2" (though in this case we might */
- /* try A.vert instead */ /* Werner suggested this */
- for ( i=info->glyph_cnt-1; i>=0 ; --i )
- if ( info->chars[i]!=NULL && info->chars[i]->name==NULL )
- break;
- if ( i>=0 && info->vs_start!=0 )
- ApplyVariationSequenceSubtable(ttf,info->vs_start,info,git_findnames);
- if ( i>=0 && info->gsub_start!=0 )
- GuessNamesFromGSUB(ttf,info);
- if ( i>=0 && info->math_start!=0 )
- GuessNamesFromMATH(ttf,info);
-
- for ( i=0; i<info->glyph_cnt; ++i ) {
- /* info->chars[i] can be null in some TTC files */
- if ( info->chars[i]==NULL )
- continue;
- if ( info->chars[i]->name!=NULL )
- continue;
- if ( info->ordering!=NULL )
- sprintf(buffer, "%.20s-%d", info->ordering, i );
- else if ( info->map!=NULL && info->map->backmap[i]!=-1 )
- sprintf(buffer, "nounicode.%d.%d.%x", info->platform, info->specific,
- (int) info->map->backmap[i] );
- else
- sprintf( buffer, "glyph%d", i );
- info->chars[i]->name = copy(buffer);
- ff_progress_next();
- }
- ff_progress_next_stage();
-}
-
-static void readttfgasp(FILE *ttf,struct ttfinfo *info) {
- int i, cnt;
-
- if ( info->gasp_start==0 )
-return;
-
- fseek(ttf,info->gasp_start,SEEK_SET);
- info->gasp_version = getushort(ttf);
- if ( info->gasp_version!=0 && info->gasp_version!=1 )
-return; /* We only support 'gasp' versions 0&1 (no other versions currently) */
- info->gasp_cnt = cnt = getushort(ttf);
- if ( cnt==0 )
-return;
- info->gasp = galloc(cnt*sizeof(struct gasp));
- for ( i=0; i<cnt; ++i ) {
- info->gasp[i].ppem = getushort(ttf);
- info->gasp[i].flags = getushort(ttf);
- }
-}
-
-static void UnfigureControls(Spline *spline,BasePoint *pos) {
- pos->x = rint( (spline->splines[0].c+2*spline->splines[0].d)/2 );
- pos->y = rint( (spline->splines[1].c+2*spline->splines[1].d)/2 );
-}
-
-int ttfFindPointInSC(SplineChar *sc,int layer,int pnum,BasePoint *pos,
- RefChar *bound) {
- SplineSet *ss;
- SplinePoint *sp;
- int last=0, ret;
- RefChar *refs;
-
- for ( ss = sc->layers[layer].splines; ss!=NULL; ss=ss->next ) {
- for ( sp=ss->first; ; ) {
- if ( sp->ttfindex==pnum ) {
- *pos = sp->me;
-return(-1);
- } else if ( sp->nextcpindex==pnum ) {
- if ( sp->next!=NULL && sp->next->order2 )
- *pos = sp->nextcp;
- else {
- /* fix this up to be 2 degree bezier control point */
- UnfigureControls(sp->next,pos);
- }
-return( -1 );
- }
- if ( !sp->nonextcp && last<=sp->nextcpindex )
- last = sp->nextcpindex+1;
- else if ( sp->ttfindex!=0xffff )
- last = sp->ttfindex+1;
- if ( sp->next==NULL )
- break;
- sp = sp->next->to;
- if ( sp==ss->first )
- break;
- }
- }
- for ( refs=sc->layers[layer].refs; refs!=NULL; refs=refs->next ) {
- if ( refs==bound ) {
- LogError( _("Invalid point match. Point would be after this reference.\n") );
-return( 0x800000 );
- }
- ret = ttfFindPointInSC(refs->sc,ly_fore,pnum-last,pos,NULL);
- if ( ret==-1 ) {
- BasePoint p;
- p.x = refs->transform[0]*pos->x + refs->transform[2]*pos->y + refs->transform[4];
- p.y = refs->transform[1]*pos->x + refs->transform[3]*pos->y + refs->transform[5];
- *pos = p;
-return( -1 );
- }
- last += ret;
- if ( last>pnum ) {
- IError("Point match failure last=%d, pnum=%d", last, pnum );
-return( 0x800000 );
- }
- }
-return( last ); /* Count of number of points in the character */
-}
-
-static void ttfPointMatch(SplineChar *sc,RefChar *rf) {
- BasePoint sofar, inref;
-
- if ( ttfFindPointInSC(sc,ly_fore,rf->match_pt_base,&sofar,rf)!=-1 ||
- ttfFindPointInSC(rf->sc,ly_fore,rf->match_pt_ref,&inref,NULL)!=-1 ) {
- LogError( _("Could not match points in composite glyph (%d to %d) when adding %s to %s\n"),
- rf->match_pt_base, rf->match_pt_ref, rf->sc->name, sc->name);
-return;
- }
- rf->transform[4] = sofar.x-inref.x;
- rf->transform[5] = sofar.y-inref.y;
-}
-
-int ttfFixupRef(SplineChar **chars,int i) {
- RefChar *ref, *prev, *next;
-
- if ( chars[i]==NULL ) /* Can happen in ttc files */
-return( false );
- if ( chars[i]->ticked )
-return( false );
- chars[i]->ticked = true;
- prev = NULL;
- for ( ref=chars[i]->layers[ly_fore].refs; ref!=NULL; ref=next ) {
- if ( ref->sc!=NULL )
- break; /* Already done */
- next = ref->next;
- if ( !ttfFixupRef(chars,ref->orig_pos)) {
- if ( prev==NULL )
- chars[i]->layers[ly_fore].refs = next;
- else
- prev->next = next;
- chunkfree(ref,sizeof(RefChar));
- } else {
- ref->sc = chars[ref->orig_pos];
- ref->adobe_enc = getAdobeEnc(ref->sc->name);
- if ( ref->point_match )
- ttfPointMatch(chars[i],ref);
- SCReinstanciateRefChar(chars[i],ref,ly_fore);
- SCMakeDependent(chars[i],ref->sc);
- prev = ref;
- }
- }
- chars[i]->ticked = false;
-return( true );
-}
-
-static void ttfFixupReferences(struct ttfinfo *info) {
- int i;
-
- ff_progress_change_line2(_("Fixing up References"));
- for ( i=0; i<info->glyph_cnt; ++i ) if ( info->chars[i]!=NULL )
- info->chars[i]->ticked = false;
- for ( i=0; i<info->glyph_cnt; ++i ) {
- ttfFixupRef(info->chars,i);
- ff_progress_next();
- }
- ff_progress_next_stage();
-}
-
-static void TtfCopyTableBlindly(struct ttfinfo *info,FILE *ttf,
- uint32 start,uint32 len,uint32 tag) {
- struct ttf_table *tab;
-
- if ( start==0 || len==0 )
-return;
- if ( len>0x1000000 ) {
- LogError( _("Unlikely length for table, so I'm ignoring it. %u\n"), len );
-return;
- }
-
- tab = chunkalloc(sizeof(struct ttf_table));
- tab->tag = tag;
- tab->len = len;
- tab->data = galloc(len);
- fseek(ttf,start,SEEK_SET);
- if (fread(tab->data,1,len,ttf) != (size_t)len) {
- LogError( _("Unable to read %u bytes for data, so I'm ignoring it.\n"), len );
- if (tab->data !=NULL) free(tab->data);
- if (tab !=NULL) free(tab);
-return;
- }
- tab->next = info->tabs;
- info->tabs = tab;
-}
-
-static int LookupListHasFeature(OTLookup *otl,uint32 tag) {
- FeatureScriptLangList *feat;
-
- while ( otl!=NULL ) {
- for ( feat = otl->features; feat!=NULL; feat=feat->next )
- if ( feat->featuretag == tag )
-return( true );
- otl = otl->next;
- }
-return( false );
-}
-
-static int readttf(FILE *ttf, struct ttfinfo *info, char *filename) {
- char *oldloc;
- int i;
-
- ff_progress_change_stages(3);
- if ( !readttfheader(ttf,info,filename,&info->chosenname)) {
-return( 0 );
- }
- oldloc = setlocale(LC_NUMERIC,"C"); /* TrueType doesn't need this but opentype dictionaries do */
- readttfpreglyph(ttf,info);
- ff_progress_change_total(info->glyph_cnt);
-
- /* If font only contains bitmaps, then only read bitmaps */
- if ( (info->glyphlocations_start==0 || info->glyph_length==0) &&
- info->cff_start==0 && info->typ1_start==0 &&
- info->bitmapdata_start!=0 && info->bitmaploc_start!=0 )
- info->onlystrikes = true;
-
- if ( !info->onlystrikes &&
- info->glyphlocations_start!=0 && info->glyph_start!=0 &&
- info->cff_start!=0 ) {
- char *buts[4];
- int choice;
- buts[0] = _("TTF 'glyf'");
- buts[1] = _("OTF 'CFF '");
- buts[2] = _("_Cancel");
- buts[3] = NULL;
- choice = ff_ask(_("Pick a font, any font..."),(const char **) buts,0,2,_("This font contains both a TrueType 'glyf' table and an OpenType 'CFF ' table. FontForge can only deal with one at a time, please pick which one you want to use"));
- if ( choice==2 ) {
- setlocale(LC_NUMERIC,oldloc);
-return( 0 );
- } else if ( choice==0 )
- info->cff_start=0;
- else
- info->glyph_start = info->glyphlocations_start = 0;
- }
-
- if ( info->onlystrikes ) {
- info->chars = gcalloc(info->glyph_cnt+1,sizeof(SplineChar *));
- info->to_order2 = new_fonts_are_order2;
- } else if ( info->glyphlocations_start!=0 && info->glyph_start!=0 ) {
- info->to_order2 = (!loaded_fonts_same_as_new ||
- (loaded_fonts_same_as_new && new_fonts_are_order2));
- readttfglyphs(ttf,info);
- } else if ( info->cff_start!=0 ) {
- info->to_order2 = (loaded_fonts_same_as_new && new_fonts_are_order2);
- if ( !readcffglyphs(ttf,info) ) {
- setlocale(LC_NUMERIC,oldloc);
-return( 0 );
- }
- } else if ( info->typ1_start!=0 ) {
- if ( !readtyp1glyphs(ttf,info) ) {
- setlocale(LC_NUMERIC,oldloc);
-return( 0 );
- }
- } else {
- setlocale(LC_NUMERIC,oldloc);
-return( 0 );
- }
- if ( info->bitmapdata_start!=0 && info->bitmaploc_start!=0 )
- ; /*TTFLoadBitmaps(ttf,info,info->onlyonestrike);*/
- else if ( info->onlystrikes )
- ff_post_error( _("No Bitmap Strikes"), _("No (useable) bitmap strikes in this TTF font: %s"), filename==NULL ? "<unknown>" : filename );
- if ( info->onlystrikes && info->bitmaps==NULL ) {
- free(info->chars);
- setlocale(LC_NUMERIC,oldloc);
-return( 0 );
- }
- if ( info->hmetrics_start!=0 )
- readttfwidths(ttf,info);
- else if ( info->bitmapdata_start!=0 && info->bitmaploc_start!=0 )
- dummywidthsfromstrike(ttf,info);
- if ( info->vmetrics_start!=0 && info->vhea_start!=0 )
- readttfvwidths(ttf,info);
- /* 'cmap' is not meaningful for cid keyed fonts, and not supplied for */
- /* type42 fonts */
- /* Oops. It is meaningful for cid fonts. It just seemed redundant to me */
- /* but that was my ignorance. Adobe complains that FF doesn't read it */
- /* (We've already (probably) set the unicodeencs of the glyphs according */
- /* to the cidmap files, but we can override that here. Mmm. what about a*/
- /* glyph in cidmap but not in cmap???? */
- if ( /* info->cidregistry==NULL && */ info->encoding_start!=0 )
- readttfencodings(ttf,info,git_normal);
- if ( info->os2_start!=0 )
- readttfos2metrics(ttf,info);
- readttfpostnames(ttf,info); /* If no postscript table we'll guess at names */
- if ( info->gdef_start!=0 ) /* ligature caret positioning info */
- readttfgdef(ttf,info);
- if ( info->base_start!=0 )
- readttfbase(ttf,info);
- if ( info->gasp_start!=0 )
- readttfgasp(ttf,info);
- /* read the cvt table before reading variation data */
- if ( info->to_order2 ) {
- /* Yes, even though we've looked at maxp already, let's make a blind */
- /* copy too for those fields we can't compute on our own */
- /* Like size of twilight zone, etc. */
- TtfCopyTableBlindly(info,ttf,info->maxp_start,info->maxp_len,CHR('m','a','x','p'));
- TtfCopyTableBlindly(info,ttf,info->cvt_start,info->cvt_len,CHR('c','v','t',' '));
- TtfCopyTableBlindly(info,ttf,info->fpgm_start,info->fpgm_len,CHR('f','p','g','m'));
- TtfCopyTableBlindly(info,ttf,info->prep_start,info->prep_len,CHR('p','r','e','p'));
- }
- for ( i=0; i<info->savecnt; ++i ) if ( info->savetab[i].offset!=0 )
- TtfCopyTableBlindly(info,ttf,info->savetab[i].offset,info->savetab[i].len,info->savetab[i].tag);
- if ( info->gpos_start!=0 ) /* kerning info may live in the gpos table too */
- readttfgpossub(ttf,info,true);
- /* Load the 'kern' table if the GPOS table either didn't exist or didn't */
- /* contain any kerning info */
- if ( info->kern_start!=0 && !LookupListHasFeature(info->gpos_lookups,CHR('k','e','r','n')))
- readttfkerns(ttf,info);
- if ( info->gsub_start!=0 )
- readttfgpossub(ttf,info,false);
-
- if ( info->pfed_start!=0 )
- pfed_read(ttf,info);
- if ( info->tex_start!=0 )
- tex_read(ttf,info);
- if ( info->math_start!=0 )
- otf_read_math(ttf,info);
- setlocale(LC_NUMERIC,oldloc);
- if ( !info->onlystrikes && info->glyphlocations_start!=0 && info->glyph_start!=0 )
- ttfFixupReferences(info);
- /* Can't fix up any postscript references until we create a SplineFont */
- /* so the check for cff is delayed. Generally there aren't any cff refs */
- /* anyway */
-return( true );
-}
-
-static void SymbolFixup(struct ttfinfo *info) {
- /* convert a two-byte symbol encoding (one using PUA) into expected */
- /* one-byte encoding. */
- int i, max;
- EncMap *map = info->map;
-
- max = -1;
- for ( i=map->enccount-1; i>=0; --i ) {
- if ( map->map[i]==-1 )
- continue;
- if ( i>=0xf000 && i<=0xf0ff ) {
- map->map[i-0xf000] = map->map[i];
- map->map[i] = -1;
- continue;
- }
- if ( i>max ) max = i;
- }
- map->enccount = max;
-}
-
-static void NameConsistancyCheck(SplineFont *sf,EncMap *map) {
- /* Many fonts seem to have glyph names which mean something other than */
- /* what the encoding says of the glyph */
- /* I used to ask about fixing the names up, but people didn't like that */
- /* so now I just produce warnings */
- int gid, uni;
- SplineChar *sc;
-#if 0
- char buffer[100];
- int response, asked=-1;
- char *buts[5];
-#endif
-
-#if 0
- buts[0] = _("Yes"); buts[1] = _("Yes to _All");
- buts[2] = _("No _to All"); buts[3] = _("No");
- buts[4] = NULL;
-#endif
-
- for ( gid = 0 ; gid<sf->glyphcnt; ++gid ) if ( (sc=sf->glyphs[gid])!=NULL ) {
- if ( sc->name!=NULL &&
- strcmp(sc->name,".null")!=0 &&
- strcmp(sc->name,"nonmarkingreturn")!=0 &&
- (uni = UniFromName(sc->name,sf->uni_interp,map==NULL ? &custom : map->enc))!= -1 &&
- sc->unicodeenc != uni ) {
-#if 1
- if ( uni>=0xe000 && uni<=0xf8ff )
- /* Don't complain about adobe's old PUA assignments for things like "eight.oldstyle" */;
- else if ( uni<0x20 )
- /* Nor about control characters */;
- else if ( sc->unicodeenc==-1 ) {
-#if 0
- LogError(_("The glyph named %.30s is not mapped to any unicode code point.\nBut its name indicates it should be mapped to U+%04X.\n"),
- sc->name,uni);
-#endif
- } else {
- /* Ah, but suppose there's an altuni? */
- struct altuni *alt;
- for ( alt = sc->altuni; alt!=NULL && alt->unienc!=uni; alt=alt->next );
- if ( alt==NULL )
- LogError( _("The glyph named %.30s is mapped to U+%04X.\nBut its name indicates it should be mapped to U+%04X.\n"),
- sc->name,sc->unicodeenc, uni);
- else if ( alt->vs==0 ) {
- alt->unienc = sc->unicodeenc;
- sc->unicodeenc = uni;
- }
- }
-#else
- if ( asked!=-1 )
- response = asked;
- else if ( sc->unicodeenc==-1 )
- response = ff_ask(_("Bad glyph name"),(const char **) buts,1,1,_("The glyph named %.30s is not mapped to any unicode code point. But its name indicates it should be mapped to U+%04X.\nWould you like to retain the name in spite of this?"),
- sc->name,uni);
- else
- response = ff_ask(_("Bad glyph name"),(const char **) buts,1,1,_("The glyph named %.30s is mapped to U+%04X.\nBut its name indicates it should be mapped to U+%04X.\nWould you like to retain the name in spite of this?"),
- sc->name,sc->unicodeenc, uni);
- if ( response==1 )
- asked = response = 0;
- else if ( response==2 )
- asked = response = 3;
- if ( response==3 ) {
- free(sc->name);
- if ( sc->unicodeenc==-1 )
- sc->name = StdGlyphName(buffer,sc->unicodeenc,sf->uni_interp,NULL);
- else {
- sprintf( buffer, "glyph%d", gid );
- sc->name = copy( buffer );
- }
- }
-#endif
- }
- }
-}
-
-static void UseGivenEncoding(SplineFont *sf,struct ttfinfo *info) {
- int i;
- RefChar *rf, *prev, *next;
- SplineChar *sc;
-
- sf->glyphs = info->chars;
- sf->glyphcnt = sf->glyphmax = info->glyph_cnt;
- for ( i=0; i<sf->glyphcnt; ++i )
- if ( (sc = sf->glyphs[i])!=NULL ) {
- sc->layers[ly_fore].order2 = sc->layers[ly_back].order2 = info->to_order2;
- sc->parent = sf;
- }
-
- /* A CFF font could contain type1 charstrings, or a type2 font could use */
- /* the depreciated convention that endchar =~ seac */
- if ( info->cff_length!=0 )
- SFInstanciateRefs(sf);
-
- for ( i=0; i<sf->glyphcnt; ++i ) if ( sf->glyphs[i]!=NULL ) {
- for ( rf = sf->glyphs[i]->layers[ly_fore].refs, prev=NULL; rf!=NULL; rf = next ) {
- next = rf->next;
- if ( rf->sc==NULL ) {
- if ( prev==NULL ) sf->glyphs[i]->layers[ly_fore].refs = next;
- else prev->next = next;
- RefCharFree(rf);
- } else {
- rf->orig_pos = rf->sc->orig_pos;
- rf->unicode_enc = rf->sc->unicodeenc;
- prev = rf;
- }
- }
- }
- sf->map = info->map;
- sf->uni_interp = info->uni_interp;
- NameConsistancyCheck(sf, sf->map);
-}
-
-static void SFRelativeWinAsDs(SplineFont *sf) {
- if ( !sf->pfminfo.winascent_add || !sf->pfminfo.windescent_add ||
- !sf->pfminfo.hheadascent_add || !sf->pfminfo.hheaddescent_add ) {
- DBounds b;
- CIDLayerFindBounds(sf,ly_fore,&b);
- if ( !sf->pfminfo.winascent_add ) {
- sf->pfminfo.winascent_add = true;
- if ( sf->pfminfo.os2_winascent < sf->ascent/8 ) {
- /* There was a bug for a while which gave us really bad values */
- sf->pfminfo.os2_winascent = 0;
- sf->pfminfo.windescent_add = true;
- sf->pfminfo.os2_windescent = 0;
- } else
- sf->pfminfo.os2_winascent -= b.maxy;
- }
- if ( !sf->pfminfo.windescent_add ) {
- sf->pfminfo.windescent_add = true;
- sf->pfminfo.os2_windescent += b.miny;
- }
- if ( !sf->pfminfo.hheadascent_add ) {
- sf->pfminfo.hheadascent_add = true;
- sf->pfminfo.hhead_ascent -= b.maxy;
- }
- if ( !sf->pfminfo.hheaddescent_add ) {
- sf->pfminfo.hheaddescent_add = true;
- sf->pfminfo.hhead_descent -= b.miny;
- }
- }
- if ( !sf->pfminfo.typoascent_add ) {
- sf->pfminfo.typoascent_add = true;
- sf->pfminfo.os2_typoascent -= sf->ascent;
- }
- if ( !sf->pfminfo.typodescent_add ) {
- sf->pfminfo.typodescent_add = true;
- sf->pfminfo.os2_typodescent -= -sf->descent;
- }
-}
-
-static void PsuedoEncodeUnencoded(EncMap *map,struct ttfinfo *info) {
- int extras, base;
- int i;
-
- for ( i=0; i<info->glyph_cnt; ++i )
- if ( info->chars[i]!=NULL )
- info->chars[i]->ticked = false;
- for ( i=0; i<map->enccount; ++i )
- if ( map->map[i]!=-1 )
- info->chars[map->map[i]]->ticked = true;
- extras = 0;
- for ( i=0; i<info->glyph_cnt; ++i )
- if ( info->chars[i]!=NULL && !info->chars[i]->ticked )
- ++extras;
- if ( extras!=0 ) {
- /* UnicodeBmp has its own Private Use Areas */
- /* if (strcmp(map->enc_name","UnicodeBmp")==0) { */
- /* if ( (info->glyph_cnt < 0x18FF) && (map->enccount<0xE000)) */
- /* base = 0xE000 */
- /* else if ( map->enccount<0xF0000 ) */
- /* base = 0xF0000; */
- /* else if ( map->enccount<0x100000 ) */
- /* base = 0x100000; */
- /* else */
- /* base = map->enccount; */
- /* } else { */
- if ( map->enccount<=256 )
- base = 256;
- else if ( map->enccount<=65536 )
- base = 65536;
- else if ( map->enccount<=17*65536 )
- base = 17*65536;
- else
- base = map->enccount;
- if ( base+extras>map->encmax ) {
- map->map = grealloc(map->map,(base+extras)*sizeof(int));
- memset(map->map+map->enccount,-1,(base+extras-map->enccount)*sizeof(int));
- map->encmax = base+extras;
- }
- map->enccount = base+extras;
- extras = 0;
- for ( i=0; i<info->glyph_cnt; ++i )
- if ( info->chars[i]!=NULL && !info->chars[i]->ticked )
- map->map[base+extras++] = i;
- }
-}
-
-static void MapDoBack(EncMap *map,struct ttfinfo *info) {
- int i;
-
- if ( map==NULL ) /* CID fonts */
-return;
- free(map->backmap); /* CFF files have this */
- map->backmax = info->glyph_cnt;
- map->backmap = galloc(info->glyph_cnt*sizeof(int));
- memset(map->backmap,-1,info->glyph_cnt*sizeof(int));
- for ( i = map->enccount-1; i>=0; --i )
- if ( map->map[i]>=0 && map->map[i]<info->glyph_cnt )
- if ( map->backmap[map->map[i]]==-1 )
- map->backmap[map->map[i]] = i;
-}
-
-static SplineFont *SFFillFromTTF(struct ttfinfo *info) {
- SplineFont *sf, *_sf;
- int i,k;
- SplineChar *sc;
- struct ttf_table *last[2], *tab, *next;
-
-
- sf = SplineFontEmpty();
- sf->display_size = -default_fv_font_size;
-#ifdef LUA_FF_LIB
- sf->units_per_em = info->emsize;
-#endif
- sf->display_antialias = default_fv_antialias;
- sf->fontname = info->fontname;
- sf->fullname = info->fullname;
- sf->familyname = info->familyname;
- sf->chosenname = info->chosenname;
- sf->onlybitmaps = info->onlystrikes;
- sf->layers[ly_fore].order2 = info->to_order2;
- sf->layers[ly_back].order2 = info->to_order2;
- sf->comments = info->fontcomments;
- sf->fontlog = info->fontlog;
- sf->cvt_names = info->cvt_names;
-
- sf->creationtime = info->creationtime;
- sf->modificationtime = info->modificationtime;
-
- sf->design_size = info->design_size;
- sf->design_range_bottom = info->design_range_bottom;
- sf->design_range_top = info->design_range_top;
- sf->fontstyle_id = info->fontstyle_id;
- sf->fontstyle_name = info->fontstyle_name;
-
- sf->gasp_cnt = info->gasp_cnt;
- sf->gasp = info->gasp;
- sf->MATH = info->math;
-
- sf->texdata = info->texdata;
-
- sf->mark_class_cnt = info->mark_class_cnt;
- sf->mark_classes = info->mark_classes;
- sf->mark_class_names = info->mark_class_names;
-
- if ( info->fd!=NULL ) { /* Special hack for type42 fonts */
- sf->fontname = copy(info->fd->fontname);
- sf->uniqueid = info->fd->uniqueid;
- sf->xuid = XUIDFromFD(info->fd->xuid);
- if ( info->fd->fontinfo!=NULL ) {
- sf->familyname = utf8_verify_copy(info->fd->fontinfo->familyname);
- sf->fullname = utf8_verify_copy(info->fd->fontinfo->fullname);
- sf->copyright = utf8_verify_copy(info->fd->fontinfo->notice);
- sf->weight = utf8_verify_copy(info->fd->fontinfo->weight);
- sf->version = utf8_verify_copy(info->fd->fontinfo->version);
- sf->italicangle = info->fd->fontinfo->italicangle;
- sf->upos = info->fd->fontinfo->underlineposition*(sf->ascent+sf->descent);
- sf->uwidth = info->fd->fontinfo->underlinethickness*(sf->ascent+sf->descent);
- }
- }
-
- if ( sf->fontname==NULL ) {
- sf->fontname = EnforcePostScriptName(sf->fullname);
- if ( sf->fontname==NULL )
- sf->fontname = EnforcePostScriptName(sf->familyname);
- if ( sf->fontname==NULL ) sf->fontname = EnforcePostScriptName("UntitledTTF");
- }
- if ( sf->fullname==NULL ) sf->fullname = copy( sf->fontname );
- if ( sf->familyname==NULL ) sf->familyname = copy( sf->fontname );
- if ( sf->weight==NULL ) {
- if ( info->weight != NULL )
- sf->weight = info->weight;
- else if ( info->pfminfo.pfmset )
- sf->weight = copy( info->pfminfo.weight <= 100 ? "Thin" :
- info->pfminfo.weight <= 200 ? "Extra-Light" :
- info->pfminfo.weight <= 300 ? "Light" :
- info->pfminfo.weight <= 400 ? "Book" :
- info->pfminfo.weight <= 500 ? "Medium" :
- info->pfminfo.weight <= 600 ? "Demi" :
- info->pfminfo.weight <= 700 ? "Bold" :
- info->pfminfo.weight <= 800 ? "Heavy" :
- "Black" );
- else
- sf->weight = copy("");
- } else
- free( info->weight );
- if ( sf->copyright==NULL )
- sf->copyright = info->copyright;
- else
- free( info->copyright );
- sf->version = info->version;
- sf->italicangle = info->italicAngle;
- sf->strokewidth = info->strokewidth;
- sf->strokedfont = info->strokedfont;
- sf->upos = info->upos;
- sf->uwidth = info->uwidth;
- sf->ascent = info->ascent;
- if ( info->vhea_start!=0 && info->vmetrics_start!=0 )
- sf->hasvmetrics = true;
- sf->descent = info->descent;
- sf->private = info->private;
- sf->xuid = info->xuid;
- sf->uniqueid = info->uniqueid;
- sf->pfminfo = info->pfminfo;
- sf->os2_version = info->os2_version;
- sf->use_typo_metrics = info->use_typo_metrics;
- sf->weight_width_slope_only = info->weight_width_slope_only;
- sf->head_optimized_for_cleartype = info->optimized_for_cleartype;
- sf->gasp_version = info->gasp_version;
- sf->names = info->names;
- sf->anchor = info->ahead;
- sf->kerns = info->khead;
- sf->vkerns = info->vkhead;
- sf->possub = info->possub;
- sf->gpos_lookups = info->gpos_lookups;
- sf->gsub_lookups = info->gsub_lookups;
-
- last[0] = sf->ttf_tables;
- last[1] = NULL;
- for ( tab=info->tabs; tab!=NULL; tab = next ) {
- next = tab->next;
- if ( tab->tag==CHR('f','p','g','m') || tab->tag==CHR('p','r','e','p') ||
- tab->tag==CHR('c','v','t',' ') || tab->tag==CHR('m','a','x','p')) {
- if ( last[0]==NULL )
- sf->ttf_tables = tab;
- else
- last[0]->next = tab;
- last[0] = tab;
- } else {
- if ( last[1]==NULL )
- sf->ttf_tab_saved = tab;
- else
- last[1]->next = tab;
- last[1] = tab;
- }
- tab->next = NULL;
- }
-
- if ( info->twobytesymbol )
- /* rework ms symbol encodings */
- SymbolFixup(info);
- if ( info->map==NULL && info->subfonts==NULL ) /* Can happen when reading a ttf from a pdf */
- info->map = EncMapFromEncoding(sf,FindOrMakeEncoding("original"));
- if (info->map==NULL) {
- LogError("Dummy map vector added");
- info->map = EncMapNew(info->glyph_cnt,info->glyph_cnt,&custom);
- }
- if ( info->subfontcnt==0 )
- PsuedoEncodeUnencoded(info->map,info);
- MapDoBack(info->map,info);
- sf->map = info->map;
- sf->cidregistry = info->cidregistry;
- sf->ordering = info->ordering;
- sf->supplement = info->supplement;
- sf->cidversion = info->cidfontversion;
- sf->bitmaps = info->bitmaps;
- sf->grid = info->guidelines;
- sf->horiz_base = info->horiz_base;
- sf->vert_base = info->vert_base;
- if ( info->layers!=NULL ) {
- info->layers[ly_fore] = sf->layers[ly_fore];
- sf->layers[ly_fore].name = NULL;
- if ( info->layers[ly_back].name==NULL )
- info->layers[ly_back].name = sf->layers[ly_back].name;
- else
- free( sf->layers[ly_back].name );
- free( sf->layers );
- sf->layers = info->layers;
- sf->layer_cnt = info->layer_cnt;
- }
-
-
- for ( i=0; i<info->glyph_cnt; ++i ) if ( info->chars[i]!=NULL ) {
- SCOrderAP(info->chars[i]);
- }
-
- if ( info->subfontcnt == 0 ) {
- UseGivenEncoding(sf,info);
- } else {
- sf->subfontcnt = info->subfontcnt;
- sf->subfonts = info->subfonts;
- free(info->chars); /* This is the GID->char index, don't need it now */
- for ( i=0; i<sf->subfontcnt; ++i ) {
- sf->subfonts[i]->cidmaster = sf;
- sf->subfonts[i]->hasvmetrics = sf->hasvmetrics;
- }
- }
-
- /* I thought the languages were supposed to be ordered, but it seems */
- /* that is not always the case. Order everything, just in case */
- { int isgpos; OTLookup *otl;
- for ( isgpos=0; isgpos<2; ++isgpos )
- for ( otl= isgpos? sf->gpos_lookups:sf->gsub_lookups; otl!=NULL; otl=otl->next )
- otl->features = FLOrder(otl->features);
- }
-
- if ( info->cff_length!=0 && !sf->layers[ly_fore].order2 ) {
- /* Clean up the hint masks, We create an initial hintmask whether we */
- /* need it or not */
- k=0;
- do {
- _sf = k<sf->subfontcnt?sf->subfonts[k]:sf;
- for ( i=0; i<sf->glyphcnt; ++i ) {
- if ( (sc = _sf->glyphs[i])!=NULL && !sc->hconflicts && !sc->vconflicts &&
- sc->layers[ly_fore].splines!=NULL ) {
- chunkfree( sc->layers[ly_fore].splines->first->hintmask,sizeof(HintMask) );
- sc->layers[ly_fore].splines->first->hintmask = NULL;
- }
- }
- ++k;
- } while ( k<sf->subfontcnt );
- }
- /* more info */
- sf->units_per_em = info->emsize ;
- sf->pfminfo = info->pfminfo ;
- sf->names = info->names ;
-
- SFRelativeWinAsDs(sf);
- free(info->savetab);
- /*if (info->chars) {
- int i;
- for(i=0; info->chars[i]; i++)
- if (info->chars[i]->name)
- free(info->chars[i]->name);
- }*/
- sf->loadvalidation_state =
- (info->bad_ps_fontname ?lvs_bad_ps_fontname:0) |
- (info->bad_glyph_data ?lvs_bad_glyph_table:0) |
- (info->bad_cff ?lvs_bad_cff_table:0) |
- (info->bad_metrics ?lvs_bad_metrics_table:0) |
- (info->bad_cmap ?lvs_bad_cmap_table:0) |
- (info->bad_embedded_bitmap ?lvs_bad_bitmaps_table:0) |
- (info->bad_gx ?lvs_bad_gx_table:0) |
- (info->bad_ot ?lvs_bad_ot_table:0) |
- (info->bad_os2_version ?lvs_bad_os2_version:0)|
- (info->bad_sfnt_header ?lvs_bad_sfnt_header:0);
-return( sf );
-}
-
-SplineFont *_SFReadTTF(FILE *ttf, int flags,enum openflags openflags, char *filename,struct fontdict *fd) {
- struct ttfinfo info;
- int ret;
-
- memset(&info,'\0',sizeof(struct ttfinfo));
- info.onlystrikes = (flags&ttf_onlystrikes)?1:0;
- info.onlyonestrike = (flags&ttf_onlyonestrike)?1:0;
- info.use_typo_metrics = true;
- info.openflags = openflags;
- info.fd = fd;
- ret = readttf(ttf,&info,filename);
- if ( !ret )
-return( NULL );
-return( SFFillFromTTF(&info));
-}
-
-SplineFont *SFReadTTF(char *filename, int flags, enum openflags openflags) {
- FILE *ttf;
- SplineFont *sf;
- char *temp=filename, *pt, *lparen, *rparen;
-
- pt = strrchr(filename,'/');
- if ( pt==NULL ) pt = filename;
- if ( (lparen = strrchr(pt,'('))!=NULL &&
- (rparen = strrchr(lparen,')'))!=NULL &&
- rparen[1]=='\0' ) {
- temp = copy(filename);
- pt = temp + (lparen-filename);
- *pt = '\0';
- }
- ttf = fopen(temp,"rb");
- if ( temp!=filename ) free(temp);
- if ( ttf==NULL )
-return( NULL );
-
- sf = _SFReadTTF(ttf,flags,openflags,filename,NULL);
- fclose(ttf);
-return( sf );
-}
-
-#ifdef LUA_FF_LIB
-
-static int readttfinfo(FILE *ttf, struct ttfinfo *info, char *filename) {
-
- if ( !readttfheader(ttf,info,filename,&info->chosenname)) {
-return( 0 );
- }
- readttfpreglyph(ttf,info);
- if ( info->os2_start!=0 )
- readttfos2metrics(ttf,info);
- if ( info->postscript_start!=0 ) {
- fseek(ttf,info->postscript_start,SEEK_SET);
- (void)getlong(ttf);
- info->italicAngle = getfixed(ttf);
- }
-return( true );
-}
-
-/* I am not sure what happens to the ttinfo struct's members.
- perhaps some need free()-ing
-*/
-
-void THPatchSplineChar (SplineChar *sc)
-{
- DBounds bb;
- if (sc->layers!=NULL && sc->layers[ly_fore].splines != NULL) {
- if (sc->xmax==0 && sc->ymax==0 && sc->xmin==0 && sc->ymin==0) {
- SplineCharFindBounds(sc,&bb);
- sc->xmin = bb.minx;
- sc->ymin = bb.miny;
- sc->xmax = bb.maxx;
- sc->ymax = bb.maxy;
- }
- /* free the curves */
- SplinePointListsFree(sc->layers[ly_fore].splines);
- sc->layers[ly_fore].splines=NULL;
- }
- if (sc->layers[ly_fore].refs!=NULL) {
- RefCharsFree(sc->layers[ly_fore].refs);
- sc->layers[ly_fore].refs = NULL;
- }
-}
-
-
-static SplineFont *SFFillFromTTFInfo(struct ttfinfo *info) {
- SplineFont *sf ;
-
- sf = SplineFontEmpty();
-
- sf->fontname = info->fontname;
- sf->fullname = info->fullname;
- sf->familyname = info->familyname;
-
- if ( info->fd!=NULL ) { /* Special hack for type42 fonts */
- sf->fontname = copy(info->fd->fontname);
- if ( info->fd->fontinfo!=NULL ) {
- sf->familyname = utf8_verify_copy(info->fd->fontinfo->familyname);
- sf->fullname = utf8_verify_copy(info->fd->fontinfo->fullname);
- sf->weight = utf8_verify_copy(info->fd->fontinfo->weight);
- }
- }
- if ( sf->fontname==NULL ) sf->fontname = EnforcePostScriptName(sf->fullname);
- if ( sf->fontname==NULL ) sf->fontname = EnforcePostScriptName(sf->familyname);
- if ( sf->fontname==NULL ) sf->fontname = EnforcePostScriptName("UntitledTTF");
-
- if ( sf->fullname==NULL ) sf->fullname = copy( sf->fontname );
- if ( sf->familyname==NULL ) sf->familyname = copy( sf->fontname );
- if ( sf->weight==NULL ) {
- if ( info->weight != NULL )
- sf->weight = info->weight;
- else if ( info->pfminfo.pfmset )
- sf->weight = copy( info->pfminfo.weight <= 100 ? "Thin" :
- info->pfminfo.weight <= 200 ? "Extra-Light" :
- info->pfminfo.weight <= 300 ? "Light" :
- info->pfminfo.weight <= 400 ? "Book" :
- info->pfminfo.weight <= 500 ? "Medium" :
- info->pfminfo.weight <= 600 ? "Demi" :
- info->pfminfo.weight <= 700 ? "Bold" :
- info->pfminfo.weight <= 800 ? "Heavy" :
- "Black" );
- else
- sf->weight = copy("");
- } else
- free( info->weight );
- sf->version = info->version;
- sf->italicangle = info->italicAngle;
- sf->names = info->names;
- sf->units_per_em = info->emsize ;
- sf->pfminfo = info->pfminfo ;
-
- free(info->savetab);
- if (info->chosenname)
- free(info->chosenname);
- if ( sf->copyright==NULL )
- sf->copyright = info->copyright;
- else
- free( info->copyright );
-return( sf );
-}
-
-SplineFont *_SFReadTTFInfo(FILE *ttf, int flags,enum openflags openflags, char *filename,struct fontdict *fd) {
- struct ttfinfo info;
- int ret;
- (void)openflags; /* for -Wall */
- memset(&info,'\0',sizeof(struct ttfinfo));
- info.onlystrikes = (flags&ttf_onlystrikes)?1:0;
- info.onlyonestrike = (flags&ttf_onlyonestrike)?1:0;
- info.use_typo_metrics = true;
- info.fd = fd;
- ret = readttfinfo(ttf,&info,filename);
- if ( !ret )
-return( NULL );
-return( SFFillFromTTFInfo(&info));
-}
-
-SplineFont *SFReadTTFInfo(char *filename, int flags, enum openflags openflags) {
- FILE *ttf;
- SplineFont *sf;
- char *temp=filename, *pt, *lparen, *rparen;
-
- pt = strrchr(filename,'/');
- if ( pt==NULL ) pt = filename;
- if ( (lparen = strrchr(pt,'('))!=NULL &&
- (rparen = strrchr(lparen,')'))!=NULL &&
- rparen[1]=='\0' ) {
- temp = copy(filename);
- pt = temp + (lparen-filename);
- *pt = '\0';
- }
- ttf = fopen(temp,"rb");
- if ( temp!=filename ) free(temp);
- if ( ttf==NULL )
-return( NULL );
-
- sf = _SFReadTTFInfo(ttf,flags,openflags,filename,NULL);
- fclose(ttf);
-return( sf );
-}
-#endif
-
-SplineFont *_CFFParse(FILE *temp,int len, char *fontsetname) {
- struct ttfinfo info;
- (void)fontsetname; /* for -Wall */
-
- memset(&info,'\0',sizeof(info));
- info.cff_start = 0;
- info.cff_length = len;
- info.barecff = true;
- if ( !readcffglyphs(temp,&info) )
-return( NULL );
-return( SFFillFromTTF(&info));
-}
-
-SplineFont *CFFParse(char *filename) {
- FILE *cff = fopen(filename,"r");
- SplineFont *sf;
- long len;
-
- if ( cff == NULL )
-return( NULL );
- fseek(cff,0,SEEK_END);
- len = ftell(cff);
- fseek(cff,0,SEEK_SET);
- sf = _CFFParse(cff,len,NULL);
- fclose(cff);
-return( sf );
-}
-
-char **NamesReadCFF(char *filename) {
- FILE *cff = fopen(filename,"rb");
- int32 hdrsize, offsize;
- char **fontnames;
-
- if ( cff==NULL )
-return( NULL );
- if ( getc(cff)!='\1' ) { /* Major version */
- LogError( _("CFF version mismatch\n") );
- fclose(cff);
-return( NULL );
- }
- getc(cff); /* Minor version */
- hdrsize = getc(cff);
- offsize = getc(cff);
- if ( hdrsize!=4 )
- fseek(cff,hdrsize,SEEK_SET);
- fontnames = readcfffontnames(cff,NULL,NULL);
- fclose(cff);
-return( fontnames );
-}
-
-char **NamesReadTTF(char *filename) {
- FILE *ttf = fopen(filename,"rb");
- int32 version, cnt, *offsets;
- int i,j;
- char **ret = NULL;
- char *temp;
-
- if ( ttf==NULL )
-return( NULL );
- version=getlong(ttf);
- if ( version==CHR('t','t','c','f')) {
- /* TTCF version = */ getlong(ttf);
- cnt = getlong(ttf);
- offsets = galloc(cnt*sizeof(int32));
- for ( i=0; i<cnt; ++i )
- offsets[i] = getlong(ttf);
- ret = galloc((cnt+1)*sizeof(char *));
- for ( i=j=0; i<cnt; ++i ) {
- temp = TTFGetFontName(ttf,offsets[i],0);
- if ( temp!=NULL )
- ret[j++] = temp;
- }
- ret[j] = NULL;
- free(offsets);
- } else {
- temp = TTFGetFontName(ttf,0,0);
- if ( temp!=NULL ) {
- ret = galloc(2*sizeof(char *));
- ret[0] = temp;
- ret[1] = NULL;
- }
- }
- fclose(ttf);
-return(ret);
-}
diff --git a/Build/source/texk/web2c/luatexdir/luafontloader/fontforge/fontforge/parsettfatt.c b/Build/source/texk/web2c/luatexdir/luafontloader/fontforge/fontforge/parsettfatt.c
deleted file mode 100644
index 85114e1213d..00000000000
--- a/Build/source/texk/web2c/luatexdir/luafontloader/fontforge/fontforge/parsettfatt.c
+++ /dev/null
@@ -1,3737 +0,0 @@
-/* Copyright (C) 2000-2008 by George Williams */
-/*
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are met:
-
- * Redistributions of source code must retain the above copyright notice, this
- * list of conditions and the following disclaimer.
-
- * Redistributions in binary form must reproduce the above copyright notice,
- * this list of conditions and the following disclaimer in the documentation
- * and/or other materials provided with the distribution.
-
- * The name of the author may not be used to endorse or promote products
- * derived from this software without specific prior written permission.
-
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
- * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
- * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
- * EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
- * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
- * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
- * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
- * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-#include "pfaedit.h"
-#include <chardata.h>
-#include <utype.h>
-#include <ustring.h>
-#include <math.h>
-#include <locale.h>
-#include <stdlib.h>
-#include "ttf.h"
-
-static uint16 *getAppleClassTable(FILE *ttf, int classdef_offset, int cnt, int sub, int div, struct ttfinfo *info) {
- uint16 *class = gcalloc(cnt,sizeof(uint16));
- int first, i, n;
- /* Apple stores its class tables as containing offsets. I find it hard to */
- /* think that way and convert them to indeces (by subtracting off a base */
- /* offset and dividing by the item's size) before doing anything else */
-
- fseek(ttf,classdef_offset,SEEK_SET);
- first = getushort(ttf);
- n = getushort(ttf);
- if ( first+n-1>=cnt ) {
- LogError( _("Bad Apple Kern Class\n") );
- info->bad_gx = true;
- }
- for ( i=0; i<n && i+first<cnt; ++i )
- class[first+i] = (getushort(ttf)-sub)/div;
-return( class );
-}
-
-static char **ClassToNames(struct ttfinfo *info,int class_cnt,uint16 *class,int glyph_cnt) {
- char **ret = galloc(class_cnt*sizeof(char *));
- int *lens = gcalloc(class_cnt,sizeof(int));
- int i;
-
- ret[0] = NULL;
- for ( i=0 ; i<glyph_cnt; ++i ) if ( class[i]!=0 && info->chars[i]!=NULL && class[i]<class_cnt )
- lens[class[i]] += strlen(info->chars[i]->name)+1;
- for ( i=1; i<class_cnt ; ++i )
- ret[i] = galloc(lens[i]+1);
- memset(lens,0,class_cnt*sizeof(int));
- for ( i=0 ; i<glyph_cnt; ++i ) if ( class[i]!=0 && info->chars[i]!=NULL ) {
- if ( class[i]<class_cnt ) {
- strcpy(ret[class[i]]+lens[class[i]], info->chars[i]->name );
- lens[class[i]] += strlen(info->chars[i]->name)+1;
- ret[class[i]][lens[class[i]]-1] = ' ';
- } else {
- LogError( _("Class index out of range %d (must be <%d)\n"),class[i], class_cnt );
- info->bad_ot = true;
- }
- }
- for ( i=1; i<class_cnt ; ++i )
- if ( lens[i]==0 )
- ret[i][0] = '\0';
- else
- ret[i][lens[i]-1] = '\0';
- free(lens);
-return( ret );
-}
-
-static char *CoverageMinusClasses(uint16 *coverageglyphs,uint16 *classed,
- struct ttfinfo *info ) {
- int i, j, len;
- uint8 *glyphs = gcalloc(info->glyph_cnt,1);
- char *ret;
-
- for ( i=0; coverageglyphs[i]!=0xffff; ++i )
- glyphs[coverageglyphs[i]] = 1;
- for ( i=0; i<info->glyph_cnt; ++i )
- if ( classed[i]!=0 )
- glyphs[i] = 0;
- for ( i=0; i<info->glyph_cnt; ++i )
- if ( glyphs[i]!=0 )
- break;
- /* coverage table matches glyphs in classes. No need for special treatment*/
- if ( i==info->glyph_cnt ) {
- free(glyphs);
-return( NULL );
- }
- /* Otherwise we need to generate a class string of glyph names in the coverage */
- /* table but not in any class. These become the glyphs in class 0 */
- ret = NULL;
- for ( j=0; j<2; ++j ) {
- len = 0;
- for ( i=0; i<info->glyph_cnt; ++i ) {
- if ( glyphs[i]!=0 ) {
- if ( j ) {
- strcpy( ret+len, info->chars[i]->name );
- strcat( ret+len, " ");
- }
- len += strlen(info->chars[i]->name)+1;
- }
- }
- if ( j==0 )
- ret = galloc(len+1);
- else
- ret[len-1] = '\0';
- }
- free(glyphs);
-return( ret );
-}
-
-static int ClassFindCnt(uint16 *class,int tot) {
- int i, max=0;
-
- for ( i=0; i<tot; ++i )
- if ( class[i]>max ) max = class[i];
-return( max+1 );
-}
-
-static int cmpuint16(const void *u1, const void *u2) {
-return( ((int) *((const uint16 *) u1)) - ((int) *((const uint16 *) u2)) );
-}
-
-static char *GlyphsToNames(struct ttfinfo *info,uint16 *glyphs,int make_uniq) {
- int i, j, len, off;
- char *ret, *pt;
-
- if ( glyphs==NULL )
-return( copy(""));
-
- /* Adobe produces coverage tables containing duplicate glyphs in */
- /* GaramondPremrPro.otf. We want unique glyphs, so enforce that */
- if ( make_uniq ) {
- for ( i=0 ; glyphs[i]!=0xffff; ++i );
- qsort(glyphs,i,sizeof(uint16),cmpuint16);
- for ( i=0; glyphs[i]!=0xffff; ++i ) {
- if ( glyphs[i+1]==glyphs[i] ) {
- for ( j=i+1; glyphs[j]==glyphs[i]; ++j );
- off = j-i -1;
- for ( j=i+1; ; ++j ) {
- glyphs[j] = glyphs[j+off];
- if ( glyphs[j]==0xffff )
- break;
- }
- }
- }
- }
-
- for ( i=len=0 ; glyphs[i]!=0xffff; ++i )
- if ( info->chars[glyphs[i]]!=NULL )
- len += strlen(info->chars[glyphs[i]]->name)+1;
- ret = pt = galloc(len+1); *pt = '\0';
- for ( i=0 ; glyphs[i]!=0xffff; ++i ) if ( info->chars[glyphs[i]]!=NULL ) {
- strcpy(pt,info->chars[glyphs[i]]->name);
- pt += strlen(pt);
- *pt++ = ' ';
- }
- if ( pt>ret ) pt[-1] = '\0';
-return( ret );
-}
-
-struct scripts {
- uint32 offset;
- uint32 tag;
- int langcnt; /* the default language is included as a */
- struct language { /* normal entry with lang tag 'dflt' */
- uint32 tag;
- uint32 offset;
- uint16 req; /* required feature index. 0xffff for null */
- int fcnt;
- uint16 *features;
- } *languages;
-};
-
-struct feature {
- uint32 offset;
- uint32 tag;
- int lcnt;
- uint16 *lookups;
-};
-
-struct lookup {
- uint16 type;
- uint16 flags;
- /* uint16 lookup; */ /* ???? can't imagine what this is*/
- uint32 offset;
- int subtabcnt;
- int32 *subtab_offsets;
- OTLookup *otlookup;
-};
-
-static uint16 *getCoverageTable(FILE *ttf, int coverage_offset, struct ttfinfo *info) {
- int format, cnt, i,j, rcnt;
- uint16 *glyphs=NULL;
- int start, end, ind, max;
-
- fseek(ttf,coverage_offset,SEEK_SET);
- format = getushort(ttf);
- if ( format==1 ) {
- cnt = getushort(ttf);
- glyphs = galloc((cnt+1)*sizeof(uint16));
- if ( ftell(ttf)+2*cnt > info->g_bounds ) {
- LogError( _("coverage table extends beyond end of table\n") );
- info->bad_ot = true;
- if ( ftell(ttf)>info->g_bounds )
-return( NULL );
- cnt = (info->g_bounds-ftell(ttf))/2;
- }
- for ( i=0; i<cnt; ++i ) {
- if ( cnt&0xffff0000 ) {
- LogError( _("Bad count.\n"));
- info->bad_ot = true;
- }
- glyphs[i] = getushort(ttf);
- if ( feof(ttf) ) {
- LogError( _("End of file found in coverage table.\n") );
- info->bad_ot = true;
- free(glyphs);
-return( NULL );
- }
- if ( glyphs[i]>=info->glyph_cnt ) {
- LogError( _("Bad coverage table. Glyph %d out of range [0,%d)\n"), glyphs[i], info->glyph_cnt );
- info->bad_ot = true;
- glyphs[i] = 0;
- }
- }
- } else if ( format==2 ) {
- glyphs = gcalloc((max=256),sizeof(uint16));
- rcnt = getushort(ttf); cnt = 0;
- if ( ftell(ttf)+6*rcnt > info->g_bounds ) {
- LogError( _("coverage table extends beyond end of table\n") );
- info->bad_ot = true;
- rcnt = (info->g_bounds-ftell(ttf))/6;
- }
-
- for ( i=0; i<rcnt; ++i ) {
- start = getushort(ttf);
- end = getushort(ttf);
- ind = getushort(ttf);
- if ( feof(ttf) ) {
- LogError( _("End of file found in coverage table.\n") );
- info->bad_ot = true;
- free(glyphs);
-return( NULL );
- }
- if ( start>end || end>=info->glyph_cnt ) {
- LogError( _("Bad coverage table. Glyph range %d-%d out of range [0,%d)\n"), start, end, info->glyph_cnt );
- info->bad_ot = true;
- start = end = 0;
- }
- if ( ind+end-start+2 >= max ) {
- int oldmax = max;
- max = ind+end-start+2;
- glyphs = grealloc(glyphs,max*sizeof(uint16));
- memset(glyphs+oldmax,0,(max-oldmax)*sizeof(uint16));
- }
- for ( j=start; j<=end; ++j ) {
- glyphs[j-start+ind] = j;
- if ( j>=info->glyph_cnt )
- glyphs[j-start+ind] = 0;
- }
- if ( ind+end-start+1>cnt )
- cnt = ind+end-start+1;
- }
- } else {
- LogError( _("Bad format for coverage table %d\n"), format );
- info->bad_ot = true;
-return( NULL );
- }
- glyphs[cnt] = 0xffff;
-
-return( glyphs );
-}
-
-struct valuerecord {
- int16 xplacement, yplacement;
- int16 xadvance, yadvance;
- uint16 offXplaceDev, offYplaceDev;
- uint16 offXadvanceDev, offYadvanceDev;
-};
-
-static uint16 *getClassDefTable(FILE *ttf, int classdef_offset, struct ttfinfo *info) {
- int format, i, j;
- uint16 start, glyphcnt, rangecnt, end, class;
- uint16 *glist=NULL;
- int warned = false;
- int cnt = info->glyph_cnt;
- uint32 g_bounds = info->g_bounds;
-
- fseek(ttf, classdef_offset, SEEK_SET);
- glist = gcalloc(cnt,sizeof(uint16)); /* Class 0 is default */
- format = getushort(ttf);
- if ( format==1 ) {
- start = getushort(ttf);
- glyphcnt = getushort(ttf);
- if ( start+(int) glyphcnt>cnt ) {
- LogError( _("Bad class def table. start=%d cnt=%d, max glyph=%d\n"), start, glyphcnt, cnt );
- info->bad_ot = true;
- glyphcnt = cnt-start;
- } else if ( ftell(ttf)+2*glyphcnt > g_bounds ) {
- LogError( _("Class definition sub-table extends beyond end of table\n") );
- info->bad_ot = true;
- if (g_bounds<ftell(ttf))
- glyphcnt = 0;
- else
- glyphcnt = (g_bounds-ftell(ttf))/2;
- }
- for ( i=0; i<glyphcnt; ++i )
- glist[start+i] = getushort(ttf);
- } else if ( format==2 ) {
- rangecnt = getushort(ttf);
- if ( ftell(ttf)+6*rangecnt > g_bounds ) {
- LogError( _("Class definition sub-table extends beyond end of table\n") );
- info->bad_ot = true;
- rangecnt = (g_bounds-ftell(ttf))/6;
- }
- for ( i=0; i<rangecnt; ++i ) {
- start = getushort(ttf);
- end = getushort(ttf);
- if ( start>end || end>=cnt ) {
- LogError( _("Bad class def table. Glyph range %d-%d out of range [0,%d)\n"), start, end, cnt );
- info->bad_ot = true;
- }
- class = getushort(ttf);
- for ( j=start; j<=end; ++j ) if ( j<cnt )
- glist[j] = class;
- }
- } else {
- LogError( _("Unknown class table format: %d\n"), format );
- info->bad_ot = true;
- }
-
- /* Do another validity test */
- for ( i=0; i<cnt; ++i ) {
- if ( glist[i]>=cnt+1 ) {
- if ( !warned ) {
- LogError( _("Nonsensical class assigned to a glyph-- class=%d is too big. Glyph=%d\n"),
- glist[i], i );
- info->bad_ot = true;
- warned = true;
- }
- glist[i] = 0;
- }
- }
-
-return glist;
-}
-
-static void readvaluerecord(struct valuerecord *vr,int vf,FILE *ttf) {
- memset(vr,'\0',sizeof(struct valuerecord));
- if ( vf&1 )
- vr->xplacement = getushort(ttf);
- if ( vf&2 )
- vr->yplacement = getushort(ttf);
- if ( vf&4 )
- vr->xadvance = getushort(ttf);
- if ( vf&8 )
- vr->yadvance = getushort(ttf);
- if ( vf&0x10 )
- vr->offXplaceDev = getushort(ttf);
- if ( vf&0x20 )
- vr->offYplaceDev = getushort(ttf);
- if ( vf&0x40 )
- vr->offXadvanceDev = getushort(ttf);
- if ( vf&0x80 )
- vr->offYadvanceDev = getushort(ttf);
-}
-
-#ifdef FONTFORGE_CONFIG_DEVICETABLES
-static void ReadDeviceTable(FILE *ttf,DeviceTable *adjust,uint32 devtab,
- struct ttfinfo *info) {
- long here;
- int pack;
- int w,b,i,c;
-
- if ( devtab==0 )
-return;
- here = ftell(ttf);
- fseek(ttf,devtab,SEEK_SET);
- adjust->first_pixel_size = getushort(ttf);
- adjust->last_pixel_size = getushort(ttf);
- pack = getushort(ttf);
- if ( adjust->first_pixel_size>adjust->last_pixel_size || pack==0 || pack>3 ) {
- LogError(_("Bad device table\n" ));
- info->bad_ot = true;
- adjust->first_pixel_size = adjust->last_pixel_size = 0;
- } else {
- c = adjust->last_pixel_size-adjust->first_pixel_size+1;
- adjust->corrections = galloc(c);
- if ( pack==1 ) {
- for ( i=0; i<c; i+=8 ) {
- w = getushort(ttf);
- for ( b=0; b<8 && i+b<c; ++b )
- adjust->corrections[i+b] = ((int16) ((w<<(b*2))&0xc000))>>14;
- }
- } else if ( pack==2 ) {
- for ( i=0; i<c; i+=4 ) {
- w = getushort(ttf);
- for ( b=0; b<4 && i+b<c; ++b )
- adjust->corrections[i+b] = ((int16) ((w<<(b*4))&0xf000))>>12;
- }
- } else {
- for ( i=0; i<c; ++i )
- adjust->corrections[i] = (int8) getc(ttf);
- }
- }
- fseek(ttf,here,SEEK_SET);
-}
-
-static ValDevTab *readValDevTab(FILE *ttf,struct valuerecord *vr,uint32 base,
- struct ttfinfo *info) {
- ValDevTab *ret;
-
- if ( vr->offXplaceDev==0 && vr->offYplaceDev==0 &&
- vr->offXadvanceDev==0 && vr->offYadvanceDev==0 )
-return( NULL );
- ret = chunkalloc(sizeof(ValDevTab));
- if ( vr->offXplaceDev!=0 )
- ReadDeviceTable(ttf,&ret->xadjust,base + vr->offXplaceDev,info);
- if ( vr->offYplaceDev!=0 )
- ReadDeviceTable(ttf,&ret->yadjust,base + vr->offYplaceDev,info);
- if ( vr->offXadvanceDev!=0 )
- ReadDeviceTable(ttf,&ret->xadv,base + vr->offXadvanceDev,info);
- if ( vr->offYadvanceDev!=0 )
- ReadDeviceTable(ttf,&ret->yadv,base + vr->offYadvanceDev,info);
-return( ret );
-}
-#endif
-
-static void addPairPos(struct ttfinfo *info, int glyph1, int glyph2,
- struct lookup *l, struct lookup_subtable *subtable, struct valuerecord *vr1,struct valuerecord *vr2,
- uint32 base,FILE *ttf) {
- (void)ttf; /* for -Wall */
- (void)l; /* for -Wall */
- (void)base; /* for -Wall */
- if ( glyph1<info->glyph_cnt && glyph2<info->glyph_cnt ) {
- PST *pos = chunkalloc(sizeof(PST));
- pos->type = pst_pair;
- pos->subtable = subtable;
- pos->next = info->chars[glyph1]->possub;
- info->chars[glyph1]->possub = pos;
- pos->u.pair.vr = chunkalloc(sizeof(struct vr [2]));
- pos->u.pair.paired = copy(info->chars[glyph2]->name);
- pos->u.pair.vr[0].xoff = vr1->xplacement;
- pos->u.pair.vr[0].yoff = vr1->yplacement;
- pos->u.pair.vr[0].h_adv_off = vr1->xadvance;
- pos->u.pair.vr[0].v_adv_off = vr1->yadvance;
- pos->u.pair.vr[1].xoff = vr2->xplacement;
- pos->u.pair.vr[1].yoff = vr2->yplacement;
- pos->u.pair.vr[1].h_adv_off = vr2->xadvance;
- pos->u.pair.vr[1].v_adv_off = vr2->yadvance;
-#ifdef FONTFORGE_CONFIG_DEVICETABLES
- pos->u.pair.vr[0].adjust = readValDevTab(ttf,vr1,base,info);
- pos->u.pair.vr[1].adjust = readValDevTab(ttf,vr2,base,info);
-#endif
- } else {
- LogError( _("Bad pair position: glyphs %d & %d should have been < %d\n"),
- glyph1, glyph2, info->glyph_cnt );
- info->bad_ot = true;
- }
-}
-
-static int addKernPair(struct ttfinfo *info, int glyph1, int glyph2,
- int16 offset, uint32 devtab, struct lookup *l, struct lookup_subtable *subtable,int isv,
- FILE *ttf) {
- KernPair *kp;
- (void)ttf; /* for -Wall */
- (void)l; /* for -Wall */
- (void)devtab; /* for -Wall */
- if ( glyph1<info->glyph_cnt && glyph2<info->glyph_cnt &&
- info->chars[glyph1]!=NULL && info->chars[glyph2]!=NULL ) {
- for ( kp=isv ? info->chars[glyph1]->vkerns : info->chars[glyph1]->kerns;
- kp!=NULL; kp=kp->next ) {
- if ( kp->sc == info->chars[glyph2] )
- break;
- }
- if ( kp==NULL ) {
- kp = chunkalloc(sizeof(KernPair));
- kp->sc = info->chars[glyph2];
- kp->off = offset;
- kp->subtable = subtable;
-#ifdef FONTFORGE_CONFIG_DEVICETABLES
- if ( devtab!=0 ) {
- kp->adjust = chunkalloc(sizeof(DeviceTable));
- ReadDeviceTable(ttf,kp->adjust,devtab,info);
- }
-#endif
- if ( isv ) {
- kp->next = info->chars[glyph1]->vkerns;
- info->chars[glyph1]->vkerns = kp;
- } else {
- kp->next = info->chars[glyph1]->kerns;
- info->chars[glyph1]->kerns = kp;
- }
- } else if ( kp->subtable!=subtable )
-return( true );
- } else if ( glyph1>=info->glyph_cnt || glyph2>=info->glyph_cnt ) {
- /* Might be NULL in a ttc file where we omit glyphs */
- LogError( _("Bad kern pair: glyphs %d & %d should have been < %d\n"),
- glyph1, glyph2, info->glyph_cnt );
- info->bad_ot = true;
- }
-return( false );
-}
-
-static void gposKernSubTable(FILE *ttf, int stoffset, struct ttfinfo *info, struct lookup *l, struct lookup_subtable *subtable) {
- int coverage, cnt, i, j, pair_cnt, vf1, vf2, glyph2;
- int cd1, cd2, c1_cnt, c2_cnt;
- uint16 format;
- uint16 *ps_offsets;
- uint16 *glyphs, *class1, *class2;
- struct valuerecord vr1, vr2;
- long foffset;
- KernClass *kc;
- int isv, r2l;
-
- format=getushort(ttf);
- if ( format!=1 && format!=2 ) /* Unknown subtable format */
-return;
- coverage = getushort(ttf);
- vf1 = getushort(ttf);
- vf2 = getushort(ttf);
- r2l = 0;
-
- /* Accept forms both with and without device tables */
- if ( (vf1==0x0008 || vf1==0x0088) && vf2==0x0000 )
- isv = 1; /* Top to bottom */
- else if ( vf1==0x0000 && (vf2==0x0004 || vf2==0x0044) && (l->flags&pst_r2l)) {
- isv = 0; /* Right to left */
- r2l = 1;
- } else if ( (vf1==0x0004 || vf1==0x0044) && vf2==0x0000 && !(l->flags&pst_r2l) )
- isv = 0; /* Left to right */
- else
- isv = 2; /* Can't optimize, store all 8 settings */
- if ( format==1 ) {
- subtable->per_glyph_pst_or_kern = true;
- cnt = getushort(ttf);
- ps_offsets = galloc(cnt*sizeof(uint16));
- for ( i=0; i<cnt; ++i )
- ps_offsets[i]=getushort(ttf);
- glyphs = getCoverageTable(ttf,stoffset+coverage,info);
- if ( glyphs==NULL )
-return;
- for ( i=0; i<cnt; ++i ) if ( glyphs[i]<info->glyph_cnt ) {
- fseek(ttf,stoffset+ps_offsets[i],SEEK_SET);
- pair_cnt = getushort(ttf);
- for ( j=0; j<pair_cnt; ++j ) {
- glyph2 = getushort(ttf);
- readvaluerecord(&vr1,vf1,ttf);
- readvaluerecord(&vr2,vf2,ttf);
- if ( isv==2 )
- addPairPos(info, glyphs[i], glyph2,l,subtable,&vr1,&vr2, stoffset,ttf);
- else if ( isv ) {
- if ( addKernPair(info, glyphs[i], glyph2, vr1.yadvance,
- vr1.offYadvanceDev==0?0:stoffset+vr1.offYadvanceDev,
- l,subtable,isv,ttf))
- addPairPos(info, glyphs[i], glyph2,l,subtable,&vr1,&vr2, stoffset,ttf);
- /* If we've already got kern data for this pair of */
- /* glyphs, then we can't make it be a true KernPair */
- /* but we can save the info as a pst_pair */
- } else if ( r2l ) { /* R2L */
- if ( addKernPair(info, glyphs[i], glyph2, vr2.xadvance,
- vr2.offXadvanceDev==0?0:stoffset+vr2.offXadvanceDev,
- l,subtable,isv,ttf))
- addPairPos(info, glyphs[i], glyph2,l,subtable,&vr1,&vr2,stoffset,ttf);
- } else {
- if ( addKernPair(info, glyphs[i], glyph2, vr1.xadvance,
- vr1.offXadvanceDev==0?0:stoffset+vr1.offXadvanceDev,
- l,subtable,isv,ttf))
- addPairPos(info, glyphs[i], glyph2,l,subtable,&vr1,&vr2,stoffset,ttf);
- }
- }
- }
- free(ps_offsets); free(glyphs);
- } else if ( format==2 ) { /* Class-based kerning */
- cd1 = getushort(ttf);
- cd2 = getushort(ttf);
- foffset = ftell(ttf);
- class1 = getClassDefTable(ttf, stoffset+cd1, info);
- class2 = getClassDefTable(ttf, stoffset+cd2, info);
- glyphs = getCoverageTable(ttf,stoffset+coverage,info);
- fseek(ttf, foffset, SEEK_SET); /* come back */
- c1_cnt = getushort(ttf);
- c2_cnt = getushort(ttf);
- if ( isv!=2 ) {
- if ( isv ) {
- if ( info->vkhead==NULL )
- info->vkhead = kc = chunkalloc(sizeof(KernClass));
- else
- kc = info->vklast->next = chunkalloc(sizeof(KernClass));
- info->vklast = kc;
- } else {
- if ( info->khead==NULL )
- info->khead = kc = chunkalloc(sizeof(KernClass));
- else
- kc = info->klast->next = chunkalloc(sizeof(KernClass));
- info->klast = kc;
- }
- subtable->vertical_kerning = isv;
- subtable->kc = kc;
- kc->first_cnt = c1_cnt; kc->second_cnt = c2_cnt;
- kc->subtable = subtable;
- kc->offsets = galloc(c1_cnt*c2_cnt*sizeof(int16));
-#ifdef FONTFORGE_CONFIG_DEVICETABLES
- kc->adjusts = gcalloc(c1_cnt*c2_cnt,sizeof(DeviceTable));
-#endif
- kc->firsts = ClassToNames(info,c1_cnt,class1,info->glyph_cnt);
- kc->seconds = ClassToNames(info,c2_cnt,class2,info->glyph_cnt);
- /* Now if the coverage table contains entries which are not in */
- /* the list of first classes, then those glyphs are the real */
- /* values for kc->firsts[0] */
- kc->firsts[0] = CoverageMinusClasses(glyphs,class1,info);
- for ( i=0; i<c1_cnt; ++i) {
- for ( j=0; j<c2_cnt; ++j) {
- readvaluerecord(&vr1,vf1,ttf);
- readvaluerecord(&vr2,vf2,ttf);
- if ( isv )
- kc->offsets[i*c2_cnt+j] = vr1.yadvance;
- else if ( r2l )
- kc->offsets[i*c2_cnt+j] = vr2.xadvance;
- else
- kc->offsets[i*c2_cnt+j] = vr1.xadvance;
-#ifdef FONTFORGE_CONFIG_DEVICETABLES
- if ( isv ) {
- if ( vr1.offYadvanceDev!=0 )
- ReadDeviceTable(ttf,&kc->adjusts[i*c2_cnt+j],stoffset+vr1.offYadvanceDev,info);
- } else if ( r2l ) {
- if ( vr2.offXadvanceDev!=0 )
- ReadDeviceTable(ttf,&kc->adjusts[i*c2_cnt+j],stoffset+vr2.offXadvanceDev,info);
- } else {
- if ( vr1.offXadvanceDev!=0 )
- ReadDeviceTable(ttf,&kc->adjusts[i*c2_cnt+j],stoffset+vr1.offXadvanceDev,info);
- }
-#endif
- }
- }
- } else { /* This happens when we have a feature which is neither 'kern' nor 'vkrn' we don't know what to do with it so we make it into kern pairs */
- int k,m;
- subtable->per_glyph_pst_or_kern = true;
- for ( i=0; i<c1_cnt; ++i) {
- for ( j=0; j<c2_cnt; ++j) {
- readvaluerecord(&vr1,vf1,ttf);
- readvaluerecord(&vr2,vf2,ttf);
- if ( vr1.xadvance!=0 || vr1.xplacement!=0 || vr1.yadvance!=0 || vr1.yplacement!=0 ||
- vr2.xadvance!=0 || vr2.xplacement!=0 || vr2.yadvance!=0 || vr2.yplacement!=0 )
- for ( k=0; k<info->glyph_cnt; ++k )
- if ( class1[k]==i )
- for ( m=0; m<info->glyph_cnt; ++m )
- if ( class2[m]==j )
- addPairPos(info, k,m,l,subtable,&vr1,&vr2,stoffset,ttf);
- }
- }
- }
- free(class1); free(class2);
- free(glyphs);
- }
-}
-
-static AnchorPoint *readAnchorPoint(FILE *ttf,uint32 base,AnchorClass *class,
- enum anchor_type type,AnchorPoint *last, struct ttfinfo *info) {
- AnchorPoint *ap;
- int format;
- (void)info; /* for -Wall */
- fseek(ttf,base,SEEK_SET);
-
- ap = chunkalloc(sizeof(AnchorPoint));
- ap->anchor = class;
- /* All anchor types have the same initial 3 entries, format */
- /* x,y pos. format 2 contains a truetype positioning point, and */
- /* format==3 may also have device tables */
- format = getushort(ttf);
- ap->me.x = (int16) getushort(ttf);
- ap->me.y = (int16) getushort(ttf);
- ap->type = type;
- if ( format==2 ) {
- ap->ttf_pt_index = getushort(ttf);
- ap->has_ttf_pt = true;
- }
-#ifdef FONTFORGE_CONFIG_DEVICETABLES
- else if ( format==3 ) {
- int devoff;
- devoff = getushort(ttf);
- if ( devoff!=0 )
- ReadDeviceTable(ttf,&ap->xadjust,base+devoff,info);
- devoff = getushort(ttf);
- if ( devoff!=0 )
- ReadDeviceTable(ttf,&ap->yadjust,base+devoff,info);
- }
-#endif
- ap->next = last;
-return( ap );
-}
-
-static void gposCursiveSubTable(FILE *ttf, int stoffset, struct ttfinfo *info,struct lookup *l, struct lookup_subtable *subtable) {
- int coverage, cnt, format, i;
- struct ee_offsets { int entry, exit; } *offsets;
- uint16 *glyphs;
- AnchorClass *class;
- SplineChar *sc;
- char buf[50];
- (void)l; /* for -Wall */
- format=getushort(ttf);
- if ( format!=1 ) /* Unknown subtable format */
-return;
- coverage = getushort(ttf);
- cnt = getushort(ttf);
- if ( cnt==0 )
-return;
- offsets = galloc(cnt*sizeof(struct ee_offsets));
- for ( i=0; i<cnt; ++i ) {
- offsets[i].entry = getushort(ttf);
- offsets[i].exit = getushort(ttf);
- }
- glyphs = getCoverageTable(ttf,stoffset+coverage,info);
-
- class = chunkalloc(sizeof(AnchorClass));
- snprintf(buf,sizeof(buf),_("Cursive-%d"),
- info->anchor_class_cnt++ );
- class->name = copy(buf);
- subtable->anchor_classes = true;
- class->subtable = subtable;
- class->type = act_curs;
- if ( info->ahead==NULL )
- info->ahead = class;
- else
- info->alast->next = class;
- info->alast = class;
-
- for ( i=0; i<cnt; ++i ) {
- sc = info->chars[glyphs[i]];
- if ( offsets[i].entry!=0 ) {
- sc->anchor = readAnchorPoint(ttf,stoffset+offsets[i].entry,class,
- at_centry,sc->anchor,info);
- }
- if ( offsets[i].exit!=0 ) {
- sc->anchor = readAnchorPoint(ttf,stoffset+offsets[i].exit,class,
- at_cexit,sc->anchor,info);
- }
- }
- free(offsets);
- free(glyphs);
-}
-
-static AnchorClass **MarkGlyphsProcessMarks(FILE *ttf,int markoffset,
- struct ttfinfo *info,struct lookup *l, struct lookup_subtable *subtable,uint16 *markglyphs,
- int classcnt) {
- AnchorClass **classes = gcalloc(classcnt,sizeof(AnchorClass *)), *ac;
- char buf[50];
- int i, cnt;
- struct mr { uint16 class, offset; } *at_offsets;
- SplineChar *sc;
-
- for ( i=0; i<classcnt; ++i ) {
- snprintf(buf,sizeof(buf),_("Anchor-%d"),
- info->anchor_class_cnt+i );
- classes[i] = ac = chunkalloc(sizeof(AnchorClass));
- ac->name = copy(buf);
- subtable->anchor_classes = true;
- ac->subtable = subtable;
- /*ac->merge_with = info->anchor_merge_cnt+1;*/
- ac->type = l->otlookup->lookup_type==gpos_mark2mark ? act_mkmk : act_mark;
- /* I don't distinguish between mark to base and mark to lig */
- if ( info->ahead==NULL )
- info->ahead = ac;
- else
- info->alast->next = ac;
- info->alast = ac;
- }
-
- fseek(ttf,markoffset,SEEK_SET);
- cnt = getushort(ttf);
- if ( feof(ttf) ) {
- LogError( _("Bad mark table.\n") );
- info->bad_ot = true;
-return( NULL );
- }
- at_offsets = galloc(cnt*sizeof(struct mr));
- for ( i=0; i<cnt; ++i ) {
- at_offsets[i].class = getushort(ttf);
- at_offsets[i].offset = getushort(ttf);
- if ( at_offsets[i].class>=classcnt ) {
- at_offsets[i].class = 0;
- if ( markglyphs[i]>=info->glyph_cnt )
- LogError( _("Class out of bounds in GPOS mark sub-table\n") );
- else
- LogError( _("Class out of bounds in GPOS mark sub-table for mark %.30s\n"), info->chars[markglyphs[i]]->name);
- info->bad_ot = true;
- }
- }
- for ( i=0; i<cnt; ++i ) {
- if ( markglyphs[i]>=info->glyph_cnt )
- continue;
- sc = info->chars[markglyphs[i]];
- if ( sc==NULL || at_offsets[i].offset==0 )
- continue;
- sc->anchor = readAnchorPoint(ttf,markoffset+at_offsets[i].offset,
- classes[at_offsets[i].class],at_mark,sc->anchor,info);
- }
- free(at_offsets);
-return( classes );
-}
-
-static void MarkGlyphsProcessBases(FILE *ttf,int baseoffset,
- struct ttfinfo *info,struct lookup *l, struct lookup_subtable *subtable,uint16 *baseglyphs,int classcnt,
- AnchorClass **classes,enum anchor_type at) {
- int basecnt,i, j, ibase;
- uint16 *offsets;
- SplineChar *sc;
- (void)subtable; /* for -Wall */
- (void)l; /* for -Wall */
- fseek(ttf,baseoffset,SEEK_SET);
- basecnt = getushort(ttf);
- if ( feof(ttf) ) {
- LogError( _("Bad base table.\n") );
- info->bad_ot = true;
-return;
- }
- offsets = galloc(basecnt*classcnt*sizeof(uint16));
- for ( i=0; i<basecnt*classcnt; ++i )
- offsets[i] = getushort(ttf);
- for ( i=ibase=0; i<basecnt; ++i, ibase+= classcnt ) {
- if ( baseglyphs[i]>=info->glyph_cnt )
- continue;
- sc = info->chars[baseglyphs[i]];
- if ( sc==NULL )
- continue;
- for ( j=0; j<classcnt; ++j ) if ( offsets[ibase+j]!=0 ) {
- sc->anchor = readAnchorPoint(ttf,baseoffset+offsets[ibase+j],
- classes[j], at,sc->anchor,info);
- }
- }
- free(offsets);
-}
-
-static void MarkGlyphsProcessLigs(FILE *ttf,int baseoffset,
- struct ttfinfo *info,struct lookup *l, struct lookup_subtable *subtable,uint16 *baseglyphs,int classcnt,
- AnchorClass **classes) {
- int basecnt,compcnt, i, j, k, kbase;
- uint16 *loffsets, *aoffsets;
- SplineChar *sc;
- (void)subtable; /* for -Wall */
- (void)l; /* for -Wall */
- fseek(ttf,baseoffset,SEEK_SET);
- basecnt = getushort(ttf);
- if ( feof(ttf) ) {
- LogError( _("Bad ligature base table.\n") );
- info->bad_ot = true;
-return;
- }
- loffsets = galloc(basecnt*sizeof(uint16));
- for ( i=0; i<basecnt; ++i )
- loffsets[i] = getushort(ttf);
- for ( i=0; i<basecnt; ++i ) {
- sc = info->chars[baseglyphs[i]];
- if ( baseglyphs[i]>=info->glyph_cnt || sc==NULL )
- continue;
- fseek(ttf,baseoffset+loffsets[i],SEEK_SET);
- compcnt = getushort(ttf);
- if ( feof(ttf)) {
- LogError(_("Bad ligature anchor count.\n"));
- info->bad_ot = true;
- continue;
- }
- aoffsets = galloc(compcnt*classcnt*sizeof(uint16));
- for ( k=0; k<compcnt*classcnt; ++k )
- aoffsets[k] = getushort(ttf);
- for ( k=kbase=0; k<compcnt; ++k, kbase+=classcnt ) {
- for ( j=0; j<classcnt; ++j ) if ( aoffsets[kbase+j]!=0 ) {
- sc->anchor = readAnchorPoint(ttf,baseoffset+loffsets[i]+aoffsets[kbase+j],
- classes[j], at_baselig,sc->anchor,info);
- sc->anchor->lig_index = k;
- }
- }
- free(aoffsets);
- }
- free(loffsets);
-}
-
-static void gposMarkSubTable(FILE *ttf, uint32 stoffset,
- struct ttfinfo *info, struct lookup *l, struct lookup_subtable *subtable) {
- int markcoverage, basecoverage, classcnt, markoffset, baseoffset;
- uint16 *markglyphs, *baseglyphs;
- AnchorClass **classes;
-
- /* The header for the three different mark tables is the same */
- /* Type = */ getushort(ttf);
- markcoverage = getushort(ttf);
- basecoverage = getushort(ttf);
- classcnt = getushort(ttf);
- markoffset = getushort(ttf);
- baseoffset = getushort(ttf);
- markglyphs = getCoverageTable(ttf,stoffset+markcoverage,info);
- baseglyphs = getCoverageTable(ttf,stoffset+basecoverage,info);
- if ( baseglyphs==NULL || markglyphs==NULL ) {
- free(baseglyphs); free(markglyphs);
-return;
- }
- /* as is the (first) mark table */
- classes = MarkGlyphsProcessMarks(ttf,stoffset+markoffset,
- info,l,subtable,markglyphs,classcnt);
- if ( classes==NULL )
-return;
- switch ( l->otlookup->lookup_type ) {
- case gpos_mark2base:
- case gpos_mark2mark:
- MarkGlyphsProcessBases(ttf,stoffset+baseoffset,
- info,l,subtable,baseglyphs,classcnt,classes,
- l->otlookup->lookup_type==gpos_mark2base?at_basechar:at_basemark);
- break;
- case gpos_mark2ligature:
- MarkGlyphsProcessLigs(ttf,stoffset+baseoffset,
- info,l,subtable,baseglyphs,classcnt,classes);
- break;
- default:
- break;
- }
- info->anchor_class_cnt += classcnt;
- ++ info->anchor_merge_cnt;
- free(markglyphs); free(baseglyphs);
- free(classes);
-}
-
-static void gposSimplePos(FILE *ttf, int stoffset, struct ttfinfo *info,
- struct lookup *l, struct lookup_subtable *subtable) {
- int coverage, cnt, i, vf;
- uint16 format;
- uint16 *glyphs;
- struct valuerecord *vr=NULL, _vr, *which;
- (void)l; /* for -Wall */
- format=getushort(ttf);
- if ( format!=1 && format!=2 ) /* Unknown subtable format */
-return;
- coverage = getushort(ttf);
- vf = getushort(ttf);
-#ifdef FONTFORGE_CONFIG_DEVICETABLES
- if ( vf==0 )
-return;
-#else
- if ( (vf&0xf)==0 ) /* Not interested in things whose data just live in device tables */
-return;
-#endif
- if ( format==1 ) {
- memset(&_vr,0,sizeof(_vr));
- readvaluerecord(&_vr,vf,ttf);
- } else {
- cnt = getushort(ttf);
- vr = gcalloc(cnt,sizeof(struct valuerecord));
- for ( i=0; i<cnt; ++i )
- readvaluerecord(&vr[i],vf,ttf);
- }
- glyphs = getCoverageTable(ttf,stoffset+coverage,info);
- if ( glyphs==NULL ) {
- free(vr);
-return;
- }
- for ( i=0; glyphs[i]!=0xffff; ++i ) if ( glyphs[i]<info->glyph_cnt ) {
- PST *pos = chunkalloc(sizeof(PST));
- pos->type = pst_position;
- pos->subtable = subtable;
- pos->next = info->chars[glyphs[i]]->possub;
- info->chars[glyphs[i]]->possub = pos;
- which = format==1 ? &_vr : &vr[i];
- pos->u.pos.xoff = which->xplacement;
- pos->u.pos.yoff = which->yplacement;
- pos->u.pos.h_adv_off = which->xadvance;
- pos->u.pos.v_adv_off = which->yadvance;
-#ifdef FONTFORGE_CONFIG_DEVICETABLES
- pos->u.pos.adjust = readValDevTab(ttf,which,stoffset,info);
-#endif
- }
- subtable->per_glyph_pst_or_kern = true;
- free(vr);
- free(glyphs);
-}
-
-static void ProcessSubLookups(FILE *ttf,struct ttfinfo *info,int gpos,
- struct lookup *alllooks,struct seqlookup *sl) {
- int i;
- (void)ttf; /* for -Wall */
- i = (intpt) sl->lookup;
- if ( i<0 || i>=info->lookup_cnt ) {
- LogError( _("Attempt to reference lookup %d (within a contextual lookup), but there are\n only %d lookups in %s\n"),
- i, info->lookup_cnt, gpos ? "'GPOS'" : "'GSUB'" );
- info->bad_ot = true;
- sl->lookup = NULL;
-return;
- }
- sl->lookup = alllooks[i].otlookup;
-}
-
-static void g___ContextSubTable1(FILE *ttf, int stoffset,
- struct ttfinfo *info, struct lookup *l, struct lookup_subtable *subtable, int justinuse,
- struct lookup *alllooks, int gpos) {
- int i, j, k, rcnt, cnt;
- uint16 coverage;
- uint16 *glyphs;
- struct subrule {
- uint32 offset;
- int gcnt;
- int scnt;
- uint16 *glyphs;
- struct seqlookup *sl;
- };
- struct rule {
- uint32 offsets;
- int scnt;
- struct subrule *subrules;
- } *rules;
- FPST *fpst;
- struct fpst_rule *rule;
- int warned = false, warned2 = false;
- (void)l; /* for -Wall */
- coverage = getushort(ttf);
- rcnt = getushort(ttf); /* glyph count in coverage table */
- rules = galloc(rcnt*sizeof(struct rule));
- for ( i=0; i<rcnt; ++i )
- rules[i].offsets = getushort(ttf)+stoffset;
- glyphs = getCoverageTable(ttf,stoffset+coverage,info);
- cnt = 0;
- for ( i=0; i<rcnt; ++i ) {
- fseek(ttf,rules[i].offsets,SEEK_SET);
- rules[i].scnt = getushort(ttf);
- cnt += rules[i].scnt;
- rules[i].subrules = galloc(rules[i].scnt*sizeof(struct subrule));
- for ( j=0; j<rules[i].scnt; ++j )
- rules[i].subrules[j].offset = getushort(ttf)+rules[i].offsets;
- for ( j=0; j<rules[i].scnt; ++j ) {
- fseek(ttf,rules[i].subrules[j].offset,SEEK_SET);
- rules[i].subrules[j].gcnt = getushort(ttf);
- rules[i].subrules[j].scnt = getushort(ttf);
- rules[i].subrules[j].glyphs = galloc((rules[i].subrules[j].gcnt+1)*sizeof(uint16));
- rules[i].subrules[j].glyphs[0] = glyphs[i];
- for ( k=1; k<rules[i].subrules[j].gcnt; ++k ) {
- rules[i].subrules[j].glyphs[k] = getushort(ttf);
- if ( rules[i].subrules[j].glyphs[k]>=info->glyph_cnt ) {
- if ( !warned )
- LogError( _("Bad contextual or chaining sub table. Glyph %d out of range [0,%d)\n"),
- rules[i].subrules[j].glyphs[k], info->glyph_cnt );
- info->bad_ot = true;
- warned = true;
- rules[i].subrules[j].glyphs[k] = 0;
- }
- }
- rules[i].subrules[j].glyphs[k] = 0xffff;
- rules[i].subrules[j].sl = galloc(rules[i].subrules[j].scnt*sizeof(struct seqlookup));
- for ( k=0; k<rules[i].subrules[j].scnt; ++k ) {
- rules[i].subrules[j].sl[k].seq = getushort(ttf);
- if ( rules[i].subrules[j].sl[k].seq >= rules[i].subrules[j].gcnt+1 )
- if ( !warned2 ) {
- LogError( _("Attempt to apply a lookup to a location out of the range of this contextual\n lookup seq=%d max=%d\n"),
- rules[i].subrules[j].sl[k].seq, rules[i].subrules[j].gcnt );
- info->bad_ot = true;
- warned2 = true;
- }
- rules[i].subrules[j].sl[k].lookup = (void *) (intpt) getushort(ttf);
- }
- }
- }
-
- if ( justinuse==git_justinuse ) {
- /* Nothing to do. This lookup doesn't really reference any glyphs */
- /* any lookups it invokes will be processed on their own */
- } else {
- fpst = chunkalloc(sizeof(FPST));
- fpst->type = gpos ? pst_contextpos : pst_contextsub;
- fpst->format = pst_glyphs;
- fpst->subtable = subtable;
- fpst->next = info->possub;
- info->possub = fpst;
- subtable->fpst = fpst;
-
- fpst->rules = rule = gcalloc(cnt,sizeof(struct fpst_rule));
- fpst->rule_cnt = cnt;
-
- cnt = 0;
- for ( i=0; i<rcnt; ++i ) for ( j=0; j<rules[i].scnt; ++j ) {
- rule[cnt].u.glyph.names = GlyphsToNames(info,rules[i].subrules[j].glyphs,false);
- rule[cnt].lookup_cnt = rules[i].subrules[j].scnt;
- rule[cnt].lookups = rules[i].subrules[j].sl;
- rules[i].subrules[j].sl = NULL;
- for ( k=0; k<rule[cnt].lookup_cnt; ++k )
- ProcessSubLookups(ttf,info,gpos,alllooks,&rule[cnt].lookups[k]);
- ++cnt;
- }
- }
-
- for ( i=0; i<rcnt; ++i ) {
- for ( j=0; j<rules[i].scnt; ++j ) {
- free(rules[i].subrules[j].glyphs);
- free(rules[i].subrules[j].sl);
- }
- free(rules[i].subrules);
- }
- free(rules);
- free(glyphs);
-}
-
-static void g___ChainingSubTable1(FILE *ttf, int stoffset,
- struct ttfinfo *info, struct lookup *l, struct lookup_subtable *subtable, int justinuse,
- struct lookup *alllooks, int gpos) {
- int i, j, k, rcnt, cnt, which;
- uint16 coverage;
- uint16 *glyphs;
- struct subrule {
- uint32 offset;
- int gcnt, bcnt, fcnt;
- int scnt;
- uint16 *glyphs, *bglyphs, *fglyphs;
- struct seqlookup *sl;
- };
- struct rule {
- uint32 offsets;
- int scnt;
- struct subrule *subrules;
- } *rules;
- FPST *fpst;
- struct fpst_rule *rule;
- int warned = false, warned2 = false;
- (void)l; /* for -Wall */
- coverage = getushort(ttf);
- rcnt = getushort(ttf); /* glyph count in coverage table */
- rules = galloc(rcnt*sizeof(struct rule));
- for ( i=0; i<rcnt; ++i )
- rules[i].offsets = getushort(ttf)+stoffset;
- glyphs = getCoverageTable(ttf,stoffset+coverage,info);
- if ( glyphs==NULL ) {
- free(rules);
-return;
- }
- cnt = 0;
- for ( i=0; i<rcnt; ++i ) {
- fseek(ttf,rules[i].offsets,SEEK_SET);
- rules[i].scnt = getushort(ttf);
- cnt += rules[i].scnt;
- rules[i].subrules = galloc(rules[i].scnt*sizeof(struct subrule));
- for ( j=0; j<rules[i].scnt; ++j )
- rules[i].subrules[j].offset = getushort(ttf)+rules[i].offsets;
- for ( j=0; j<rules[i].scnt; ++j ) {
- fseek(ttf,rules[i].subrules[j].offset,SEEK_SET);
- rules[i].subrules[j].bcnt = getushort(ttf);
- if ( feof(ttf)) {
- LogError( _("Unexpected end of file in contextual chaining subtable.\n") );
- info->bad_ot = true;
-return;
- }
- rules[i].subrules[j].bglyphs = galloc((rules[i].subrules[j].bcnt+1)*sizeof(uint16));
- for ( k=0; k<rules[i].subrules[j].bcnt; ++k )
- rules[i].subrules[j].bglyphs[k] = getushort(ttf);
- rules[i].subrules[j].bglyphs[k] = 0xffff;
-
- rules[i].subrules[j].gcnt = getushort(ttf);
- if ( feof(ttf)) {
- LogError( _("Unexpected end of file in contextual chaining subtable.\n") );
- info->bad_ot = true;
-return;
- }
- rules[i].subrules[j].glyphs = galloc((rules[i].subrules[j].gcnt+1)*sizeof(uint16));
- rules[i].subrules[j].glyphs[0] = glyphs[i];
- for ( k=1; k<rules[i].subrules[j].gcnt; ++k )
- rules[i].subrules[j].glyphs[k] = getushort(ttf);
- rules[i].subrules[j].glyphs[k] = 0xffff;
-
- rules[i].subrules[j].fcnt = getushort(ttf);
- if ( feof(ttf)) {
- LogError( _("Unexpected end of file in contextual chaining subtable.\n") );
- info->bad_ot = true;
-return;
- }
- rules[i].subrules[j].fglyphs = galloc((rules[i].subrules[j].fcnt+1)*sizeof(uint16));
- for ( k=0; k<rules[i].subrules[j].fcnt; ++k )
- rules[i].subrules[j].fglyphs[k] = getushort(ttf);
- rules[i].subrules[j].fglyphs[k] = 0xffff;
-
- for ( which = 0; which<3; ++which ) {
- for ( k=0; k<(&rules[i].subrules[j].gcnt)[which]; ++k ) {
- if ( (&rules[i].subrules[j].glyphs)[which][k]>=info->glyph_cnt ) {
- if ( !warned )
- LogError( _("Bad contextual or chaining sub table. Glyph %d out of range [0,%d)\n"),
- (&rules[i].subrules[j].glyphs)[which][k], info->glyph_cnt );
- info->bad_ot = true;
- warned = true;
- (&rules[i].subrules[j].glyphs)[which][k] = 0;
- }
- }
- }
-
- rules[i].subrules[j].scnt = getushort(ttf);
- if ( feof(ttf)) {
- LogError( _("Unexpected end of file in contextual chaining subtable.\n") );
- info->bad_ot = true;
-return;
- }
- rules[i].subrules[j].sl = galloc(rules[i].subrules[j].scnt*sizeof(struct seqlookup));
- for ( k=0; k<rules[i].subrules[j].scnt; ++k ) {
- rules[i].subrules[j].sl[k].seq = getushort(ttf);
- if ( rules[i].subrules[j].sl[k].seq >= rules[i].subrules[j].gcnt+1 )
- if ( !warned2 ) {
- LogError( _("Attempt to apply a lookup to a location out of the range of this contextual\n lookup seq=%d max=%d\n"),
- rules[i].subrules[j].sl[k].seq, rules[i].subrules[j].gcnt );
- info->bad_ot = true;
- warned2 = true;
- }
- rules[i].subrules[j].sl[k].lookup = (void *) (intpt) getushort(ttf);
- }
- }
- }
-
- if ( justinuse==git_justinuse ) {
- /* Nothing to do. This lookup doesn't really reference any glyphs */
- /* any lookups it invokes will be processed on their own */
- } else {
- fpst = chunkalloc(sizeof(FPST));
- fpst->type = gpos ? pst_chainpos : pst_chainsub;
- fpst->format = pst_glyphs;
- fpst->subtable = subtable;
- fpst->next = info->possub;
- info->possub = fpst;
- subtable->fpst = fpst;
-
- fpst->rules = rule = gcalloc(cnt,sizeof(struct fpst_rule));
- fpst->rule_cnt = cnt;
-
- cnt = 0;
- for ( i=0; i<rcnt; ++i ) for ( j=0; j<rules[i].scnt; ++j ) {
- rule[cnt].u.glyph.back = GlyphsToNames(info,rules[i].subrules[j].bglyphs,false);
- rule[cnt].u.glyph.names = GlyphsToNames(info,rules[i].subrules[j].glyphs,false);
- rule[cnt].u.glyph.fore = GlyphsToNames(info,rules[i].subrules[j].fglyphs,false);
- rule[cnt].lookup_cnt = rules[i].subrules[j].scnt;
- rule[cnt].lookups = rules[i].subrules[j].sl;
- rules[i].subrules[j].sl = NULL;
- for ( k=0; k<rule[cnt].lookup_cnt; ++k )
- ProcessSubLookups(ttf,info,gpos,alllooks,&rule[cnt].lookups[k]);
- ++cnt;
- }
- }
-
- for ( i=0; i<rcnt; ++i ) {
- for ( j=0; j<rules[i].scnt; ++j ) {
- free(rules[i].subrules[j].bglyphs);
- free(rules[i].subrules[j].glyphs);
- free(rules[i].subrules[j].fglyphs);
- free(rules[i].subrules[j].sl);
- }
- free(rules[i].subrules);
- }
- free(rules);
- free(glyphs);
-}
-
-static void g___ContextSubTable2(FILE *ttf, int stoffset,
- struct ttfinfo *info, struct lookup *l, struct lookup_subtable *subtable, int justinuse,
- struct lookup *alllooks, int gpos) {
- int i, j, k, rcnt, cnt;
- uint16 coverage;
- uint16 classoff;
- struct subrule {
- uint32 offset;
- int ccnt;
- int scnt;
- uint16 *classindeces;
- struct seqlookup *sl;
- };
- struct rule {
- uint32 offsets;
- int scnt;
- struct subrule *subrules;
- } *rules;
- FPST *fpst;
- struct fpst_rule *rule;
- uint16 *glyphs, *class;
- int warned2 = false;
- (void)l; /* for -Wall */
- coverage = getushort(ttf);
- classoff = getushort(ttf);
- rcnt = getushort(ttf); /* class count in coverage table *//* == number of top level rules */
- rules = gcalloc(rcnt,sizeof(struct rule));
- for ( i=0; i<rcnt; ++i )
- rules[i].offsets = getushort(ttf)+stoffset;
- cnt = 0;
- for ( i=0; i<rcnt; ++i ) if ( rules[i].offsets!=(unsigned)stoffset ) { /* some classes might be unused */
- fseek(ttf,rules[i].offsets,SEEK_SET);
- rules[i].scnt = getushort(ttf);
- if ( rules[i].scnt<0 ) {
- LogError( _("Bad count in context chaining sub-table.\n") );
- info->bad_ot = true;
-return;
- }
- cnt += rules[i].scnt;
- rules[i].subrules = galloc(rules[i].scnt*sizeof(struct subrule));
- for ( j=0; j<rules[i].scnt; ++j )
- rules[i].subrules[j].offset = getushort(ttf)+rules[i].offsets;
- for ( j=0; j<rules[i].scnt; ++j ) {
- fseek(ttf,rules[i].subrules[j].offset,SEEK_SET);
- rules[i].subrules[j].ccnt = getushort(ttf);
- rules[i].subrules[j].scnt = getushort(ttf);
- if ( rules[i].subrules[j].ccnt<0 ) {
- LogError( _("Bad class count in contextual chaining sub-table.\n") );
- info->bad_ot = true;
- free(rules);
-return;
- }
- rules[i].subrules[j].classindeces = galloc(rules[i].subrules[j].ccnt*sizeof(uint16));
- rules[i].subrules[j].classindeces[0] = i;
- for ( k=1; k<rules[i].subrules[j].ccnt; ++k )
- rules[i].subrules[j].classindeces[k] = getushort(ttf);
- if ( rules[i].subrules[j].scnt<0 ) {
- LogError( _("Bad count in contextual chaining sub-table.\n") );
- info->bad_ot = true;
- free(rules);
-return;
- }
- rules[i].subrules[j].sl = galloc(rules[i].subrules[j].scnt*sizeof(struct seqlookup));
- for ( k=0; k<rules[i].subrules[j].scnt; ++k ) {
- rules[i].subrules[j].sl[k].seq = getushort(ttf);
- if ( rules[i].subrules[j].sl[k].seq >= rules[i].subrules[j].ccnt )
- if ( !warned2 ) {
- LogError( _("Attempt to apply a lookup to a location out of the range of this contextual\n lookup seq=%d max=%d\n"),
- rules[i].subrules[j].sl[k].seq, rules[i].subrules[j].ccnt-1);
- info->bad_ot = true;
- warned2 = true;
- }
- rules[i].subrules[j].sl[k].lookup = (void *) (intpt) getushort(ttf);
- }
- }
- }
-
- if ( justinuse==git_justinuse ) {
- /* Nothing to do. This lookup doesn't really reference any glyphs */
- /* any lookups it invokes will be processed on their own */
- } else {
- fpst = chunkalloc(sizeof(FPST));
- fpst->type = gpos ? pst_contextpos : pst_contextsub;
- fpst->format = pst_class;
- fpst->subtable = subtable;
- subtable->fpst = fpst;
- fpst->next = info->possub;
- info->possub = fpst;
-
- fpst->rules = rule = gcalloc(cnt,sizeof(struct fpst_rule));
- fpst->rule_cnt = cnt;
- class = getClassDefTable(ttf, stoffset+classoff, info);
- fpst->nccnt = ClassFindCnt(class,info->glyph_cnt);
- fpst->nclass = ClassToNames(info,fpst->nccnt,class,info->glyph_cnt);
-
- /* Just in case they used the coverage table to redefine class 0 */
- glyphs = getCoverageTable(ttf,stoffset+coverage,info);
- fpst->nclass[0] = CoverageMinusClasses(glyphs,class,info);
- free(glyphs); free(class); class = NULL;
-
- cnt = 0;
- for ( i=0; i<rcnt; ++i ) for ( j=0; j<rules[i].scnt; ++j ) {
- rule[cnt].u.class.nclasses = rules[i].subrules[j].classindeces;
- rule[cnt].u.class.ncnt = rules[i].subrules[j].ccnt;
- rules[i].subrules[j].classindeces = NULL;
- rule[cnt].lookup_cnt = rules[i].subrules[j].scnt;
- rule[cnt].lookups = rules[i].subrules[j].sl;
- rules[i].subrules[j].sl = NULL;
- for ( k=0; k<rule[cnt].lookup_cnt; ++k )
- ProcessSubLookups(ttf,info,gpos,alllooks,&rule[cnt].lookups[k]);
- ++cnt;
- }
- }
-
- for ( i=0; i<rcnt; ++i ) {
- for ( j=0; j<rules[i].scnt; ++j ) {
- free(rules[i].subrules[j].classindeces);
- free(rules[i].subrules[j].sl);
- }
- free(rules[i].subrules);
- }
- free(rules);
-}
-
-static void g___ChainingSubTable2(FILE *ttf, int stoffset,
- struct ttfinfo *info, struct lookup *l, struct lookup_subtable *subtable, int justinuse,
- struct lookup *alllooks, int gpos) {
- int i, j, k, rcnt, cnt;
- uint16 coverage, offset;
- uint16 bclassoff, classoff, fclassoff;
- struct subrule {
- uint32 offset;
- int ccnt, bccnt, fccnt;
- int scnt;
- uint16 *classindeces, *bci, *fci;
- struct seqlookup *sl;
- };
- struct rule {
- uint32 offsets;
- int scnt;
- struct subrule *subrules;
- } *rules;
- FPST *fpst;
- struct fpst_rule *rule;
- uint16 *glyphs, *class;
- int warned2 = false;
- (void)l; /* for -Wall */
- coverage = getushort(ttf);
- bclassoff = getushort(ttf);
- classoff = getushort(ttf);
- fclassoff = getushort(ttf);
- rcnt = getushort(ttf); /* class count *//* == max number of top level rules */
- rules = gcalloc(rcnt,sizeof(struct rule));
- for ( i=0; i<rcnt; ++i ) {
- offset = getushort(ttf);
- rules[i].offsets = offset==0 ? 0 : offset+stoffset;
- }
- cnt = 0;
- for ( i=0; i<rcnt; ++i ) if ( rules[i].offsets!=0 ) { /* some classes might be unused */
- fseek(ttf,rules[i].offsets,SEEK_SET);
- rules[i].scnt = getushort(ttf);
- if ( rules[i].scnt<0 ) {
- LogError( _("Bad count in context chaining sub-table.\n") );
- info->bad_ot = true;
-return;
- }
- cnt += rules[i].scnt;
- rules[i].subrules = galloc(rules[i].scnt*sizeof(struct subrule));
- for ( j=0; j<rules[i].scnt; ++j )
- rules[i].subrules[j].offset = getushort(ttf)+rules[i].offsets;
- for ( j=0; j<rules[i].scnt; ++j ) {
- fseek(ttf,rules[i].subrules[j].offset,SEEK_SET);
- rules[i].subrules[j].bccnt = getushort(ttf);
- if ( rules[i].subrules[j].bccnt<0 ) {
- LogError( _("Bad class count in contextual chaining sub-table.\n") );
- info->bad_ot = true;
- free(rules);
-return;
- }
- rules[i].subrules[j].bci = galloc(rules[i].subrules[j].bccnt*sizeof(uint16));
- for ( k=0; k<rules[i].subrules[j].bccnt; ++k )
- rules[i].subrules[j].bci[k] = getushort(ttf);
- rules[i].subrules[j].ccnt = getushort(ttf);
- if ( rules[i].subrules[j].ccnt<0 ) {
- LogError( _("Bad class count in contextual chaining sub-table.\n") );
- info->bad_ot = true;
- free(rules);
-return;
- }
- rules[i].subrules[j].classindeces = galloc(rules[i].subrules[j].ccnt*sizeof(uint16));
- rules[i].subrules[j].classindeces[0] = i;
- for ( k=1; k<rules[i].subrules[j].ccnt; ++k )
- rules[i].subrules[j].classindeces[k] = getushort(ttf);
- rules[i].subrules[j].fccnt = getushort(ttf);
- if ( rules[i].subrules[j].fccnt<0 ) {
- LogError( _("Bad class count in contextual chaining sub-table.\n") );
- info->bad_ot = true;
- free(rules);
-return;
- }
- rules[i].subrules[j].fci = galloc(rules[i].subrules[j].fccnt*sizeof(uint16));
- for ( k=0; k<rules[i].subrules[j].fccnt; ++k )
- rules[i].subrules[j].fci[k] = getushort(ttf);
- rules[i].subrules[j].scnt = getushort(ttf);
- if ( rules[i].subrules[j].scnt<0 ) {
- LogError( _("Bad count in contextual chaining sub-table.\n") );
- info->bad_ot = true;
- free(rules);
-return;
- }
- rules[i].subrules[j].sl = galloc(rules[i].subrules[j].scnt*sizeof(struct seqlookup));
- for ( k=0; k<rules[i].subrules[j].scnt; ++k ) {
- rules[i].subrules[j].sl[k].seq = getushort(ttf);
- if ( rules[i].subrules[j].sl[k].seq >= rules[i].subrules[j].ccnt )
- if ( !warned2 ) {
- LogError( _("Attempt to apply a lookup to a location out of the range of this contextual\n lookup seq=%d max=%d\n"),
- rules[i].subrules[j].sl[k].seq, rules[i].subrules[j].ccnt-1);
- info->bad_ot = true;
- warned2 = true;
- }
- rules[i].subrules[j].sl[k].lookup = (void *) (intpt) getushort(ttf);
- }
- }
- }
-
- if ( justinuse==git_justinuse ) {
- /* Nothing to do. This lookup doesn't really reference any glyphs */
- /* any lookups it invokes will be processed on their own */
- } else {
- fpst = chunkalloc(sizeof(FPST));
- fpst->type = gpos ? pst_chainpos : pst_chainsub;
- fpst->format = pst_class;
- fpst->subtable = subtable;
- subtable->fpst = fpst;
- fpst->next = info->possub;
- info->possub = fpst;
-
- fpst->rules = rule = gcalloc(cnt,sizeof(struct fpst_rule));
- fpst->rule_cnt = cnt;
-
- class = getClassDefTable(ttf, stoffset+classoff, info);
- fpst->nccnt = ClassFindCnt(class,info->glyph_cnt);
- fpst->nclass = ClassToNames(info,fpst->nccnt,class,info->glyph_cnt);
-
- /* Just in case they used the coverage table to redefine class 0 */
- glyphs = getCoverageTable(ttf,stoffset+coverage,info);
- fpst->nclass[0] = CoverageMinusClasses(glyphs,class,info);
- free(glyphs); free(class); class = NULL;
-
- /* The docs don't mention this, but in mangal.ttf fclassoff==0 NULL */
- if ( bclassoff!=0 )
- class = getClassDefTable(ttf, stoffset+bclassoff, info);
- else
- class = gcalloc(info->glyph_cnt,sizeof(uint16));
- fpst->bccnt = ClassFindCnt(class,info->glyph_cnt);
- fpst->bclass = ClassToNames(info,fpst->bccnt,class,info->glyph_cnt);
- free(class);
- if ( fclassoff!=0 )
- class = getClassDefTable(ttf, stoffset+fclassoff, info);
- else
- class = gcalloc(info->glyph_cnt,sizeof(uint16));
- fpst->fccnt = ClassFindCnt(class,info->glyph_cnt);
- fpst->fclass = ClassToNames(info,fpst->fccnt,class,info->glyph_cnt);
- free(class);
-
- cnt = 0;
- for ( i=0; i<rcnt; ++i ) for ( j=0; j<rules[i].scnt; ++j ) {
- rule[cnt].u.class.nclasses = rules[i].subrules[j].classindeces;
- rule[cnt].u.class.ncnt = rules[i].subrules[j].ccnt;
- rules[i].subrules[j].classindeces = NULL;
- rule[cnt].u.class.bclasses = rules[i].subrules[j].bci;
- rule[cnt].u.class.bcnt = rules[i].subrules[j].bccnt;
- rules[i].subrules[j].bci = NULL;
- rule[cnt].u.class.fclasses = rules[i].subrules[j].fci;
- rule[cnt].u.class.fcnt = rules[i].subrules[j].fccnt;
- rules[i].subrules[j].fci = NULL;
- rule[cnt].lookup_cnt = rules[i].subrules[j].scnt;
- rule[cnt].lookups = rules[i].subrules[j].sl;
- rules[i].subrules[j].sl = NULL;
- for ( k=0; k<rule[cnt].lookup_cnt; ++k )
- ProcessSubLookups(ttf,info,gpos,alllooks,&rule[cnt].lookups[k]);
- ++cnt;
- }
- }
-
- for ( i=0; i<rcnt; ++i ) {
- for ( j=0; j<rules[i].scnt; ++j ) {
- free(rules[i].subrules[j].classindeces);
- free(rules[i].subrules[j].sl);
- }
- free(rules[i].subrules);
- }
- free(rules);
-}
-
-static void g___ContextSubTable3(FILE *ttf, int stoffset,
- struct ttfinfo *info, struct lookup *l, struct lookup_subtable *subtable, int justinuse,
- struct lookup *alllooks, int gpos) {
- int i, k, scnt, gcnt;
- uint16 *coverage;
- struct seqlookup *sl;
- uint16 *glyphs;
- FPST *fpst;
- struct fpst_rule *rule;
- int warned2 = false;
- (void)l; /* for -Wall */
- gcnt = getushort(ttf);
- scnt = getushort(ttf);
- if ( feof(ttf) ) {
- LogError( _("End of file in context chaining sub-table.\n") );
- info->bad_ot = true;
-return;
- }
- coverage = galloc(gcnt*sizeof(uint16));
- for ( i=0; i<gcnt; ++i )
- coverage[i] = getushort(ttf);
- sl = galloc(scnt*sizeof(struct seqlookup));
- for ( k=0; k<scnt; ++k ) {
- sl[k].seq = getushort(ttf);
- if ( sl[k].seq >= gcnt && !warned2 ) {
- LogError( _("Attempt to apply a lookup to a location out of the range of this contextual\n lookup seq=%d, max=%d\n"),
- sl[k].seq, gcnt-1 );
- info->bad_ot = true;
- warned2 = true;
- }
- sl[k].lookup = (void *) (intpt) getushort(ttf);
- }
-
- if ( justinuse==git_justinuse ) {
- /* Nothing to do. This lookup doesn't really reference any glyphs */
- /* any lookups it invokes will be processed on their own */
- } else {
- fpst = chunkalloc(sizeof(FPST));
- fpst->type = gpos ? pst_contextpos : pst_contextsub;
- fpst->format = pst_coverage;
- fpst->subtable = subtable;
- subtable->fpst = fpst;
- fpst->next = info->possub;
- info->possub = fpst;
-
- fpst->rules = rule = gcalloc(1,sizeof(struct fpst_rule));
- fpst->rule_cnt = 1;
- rule->u.coverage.ncnt = gcnt;
- rule->u.coverage.ncovers = galloc(gcnt*sizeof(char **));
- for ( i=0; i<gcnt; ++i ) {
- glyphs = getCoverageTable(ttf,stoffset+coverage[i],info);
- rule->u.coverage.ncovers[i] = GlyphsToNames(info,glyphs,true);
- free(glyphs);
- }
- rule->lookup_cnt = scnt;
- rule->lookups = sl;
- for ( k=0; k<scnt; ++k )
- ProcessSubLookups(ttf,info,gpos,alllooks,&sl[k]);
- }
-
- free(coverage);
-}
-
-static void g___ChainingSubTable3(FILE *ttf, int stoffset,
- struct ttfinfo *info, struct lookup *l, struct lookup_subtable *subtable, int justinuse,
- struct lookup *alllooks, int gpos) {
- int i, k, scnt, gcnt, bcnt, fcnt;
- uint16 *coverage, *bcoverage, *fcoverage;
- struct seqlookup *sl;
- uint16 *glyphs;
- FPST *fpst;
- struct fpst_rule *rule;
- int warned2 = false;
- (void)l; /* for -Wall */
- bcnt = getushort(ttf);
- if ( feof(ttf)) {
- LogError( _("End of file in context chaining subtable.\n") );
- info->bad_ot = true;
-return;
- }
- bcoverage = galloc(bcnt*sizeof(uint16));
- for ( i=0; i<bcnt; ++i )
- bcoverage[i] = getushort(ttf);
- gcnt = getushort(ttf);
- if ( feof(ttf)) {
- LogError( _("End of file in context chaining subtable.\n") );
- info->bad_ot = true;
-return;
- }
- coverage = galloc(gcnt*sizeof(uint16));
- for ( i=0; i<gcnt; ++i )
- coverage[i] = getushort(ttf);
- fcnt = getushort(ttf);
- if ( feof(ttf)) {
- LogError( _("End of file in context chaining subtable.\n") );
- info->bad_ot = true;
-return;
- }
- fcoverage = galloc(fcnt*sizeof(uint16));
- for ( i=0; i<fcnt; ++i )
- fcoverage[i] = getushort(ttf);
- scnt = getushort(ttf);
- if ( feof(ttf)) {
- LogError( _("End of file in context chaining subtable.\n") );
- info->bad_ot = true;
-return;
- }
- sl = galloc(scnt*sizeof(struct seqlookup));
- for ( k=0; k<scnt; ++k ) {
- sl[k].seq = getushort(ttf);
- if ( sl[k].seq >= gcnt && !warned2 ) {
- LogError( _("Attempt to apply a lookup to a location out of the range of this contextual\n lookup seq=%d, max=%d\n"),
- sl[k].seq, gcnt-1 );
- info->bad_ot = true;
- warned2 = true;
- }
- sl[k].lookup = (void *) (intpt) getushort(ttf);
- }
-
- if ( justinuse==git_justinuse ) {
- /* Nothing to do. This lookup doesn't really reference any glyphs */
- /* any lookups it invokes will be processed on their own */
- } else {
- fpst = chunkalloc(sizeof(FPST));
- fpst->type = gpos ? pst_chainpos : pst_chainsub;
- fpst->format = pst_coverage;
- fpst->subtable = subtable;
- subtable->fpst = fpst;
- fpst->next = info->possub;
- info->possub = fpst;
-
- fpst->rules = rule = gcalloc(1,sizeof(struct fpst_rule));
- fpst->rule_cnt = 1;
-
- rule->u.coverage.bcnt = bcnt;
- rule->u.coverage.bcovers = galloc(bcnt*sizeof(char **));
- for ( i=0; i<bcnt; ++i ) {
- glyphs = getCoverageTable(ttf,stoffset+bcoverage[i],info);
- rule->u.coverage.bcovers[i] = GlyphsToNames(info,glyphs,true);
- free(glyphs);
- }
-
- rule->u.coverage.ncnt = gcnt;
- rule->u.coverage.ncovers = galloc(gcnt*sizeof(char **));
- for ( i=0; i<gcnt; ++i ) {
- glyphs = getCoverageTable(ttf,stoffset+coverage[i],info);
- rule->u.coverage.ncovers[i] = GlyphsToNames(info,glyphs,true);
- free(glyphs);
- }
-
- rule->u.coverage.fcnt = fcnt;
- rule->u.coverage.fcovers = galloc(fcnt*sizeof(char **));
- for ( i=0; i<fcnt; ++i ) {
- glyphs = getCoverageTable(ttf,stoffset+fcoverage[i],info);
- rule->u.coverage.fcovers[i] = GlyphsToNames(info,glyphs,true);
- free(glyphs);
- }
-
- rule->lookup_cnt = scnt;
- rule->lookups = sl;
- for ( k=0; k<scnt; ++k )
- ProcessSubLookups(ttf,info,gpos,alllooks,&sl[k]);
- }
-
- free(bcoverage);
- free(coverage);
- free(fcoverage);
-}
-
-static void gposContextSubTable(FILE *ttf, int stoffset,
- struct ttfinfo *info, struct lookup *l, struct lookup_subtable *subtable,
- struct lookup *alllooks) {
- switch( getushort(ttf)) {
- case 1:
- g___ContextSubTable1(ttf,stoffset,info,l,subtable,git_normal,alllooks,true);
- break;
- case 2:
- g___ContextSubTable2(ttf,stoffset,info,l,subtable,git_normal,alllooks,true);
- break;
- case 3:
- g___ContextSubTable3(ttf,stoffset,info,l,subtable,git_normal,alllooks,true);
- break;
- }
-}
-
-static void gposChainingSubTable(FILE *ttf, int stoffset,
- struct ttfinfo *info, struct lookup *l, struct lookup_subtable *subtable,
- struct lookup *alllooks) {
- switch( getushort(ttf)) {
- case 1:
- g___ChainingSubTable1(ttf,stoffset,info,l,subtable,git_normal,alllooks,true);
- break;
- case 2:
- g___ChainingSubTable2(ttf,stoffset,info,l,subtable,git_normal,alllooks,true);
- break;
- case 3:
- g___ChainingSubTable3(ttf,stoffset,info,l,subtable,git_normal,alllooks,true);
- break;
- }
-}
-
-static struct { uint32 tag; char *str; } tagstr[] = {
- { CHR('v','r','t','2'), "vert" },
- { CHR('s','m','c','p'), "sc" },
- { CHR('s','m','c','p'), "small" },
- { CHR('o','n','u','m'), "oldstyle" },
- { CHR('s','u','p','s'), "superior" },
- { CHR('s','u','b','s'), "inferior" },
- { CHR('s','w','s','h'), "swash" },
- { 0, NULL }
-};
-
-
-static void gsubSimpleSubTable(FILE *ttf, int stoffset, struct ttfinfo *info,
- struct lookup *l, struct lookup_subtable *subtable, int justinuse) {
- int coverage, cnt, i, j, which;
- uint16 format;
- uint16 *glyphs, *glyph2s=NULL;
- int delta=0;
-
- format=getushort(ttf);
- if ( format!=1 && format!=2 ) /* Unknown subtable format */
-return;
- coverage = getushort(ttf);
- if ( format==1 ) {
- delta = getushort(ttf);
- } else {
- cnt = getushort(ttf);
- glyph2s = galloc(cnt*sizeof(uint16));
- for ( i=0; i<cnt; ++i )
- glyph2s[i] = getushort(ttf);
- /* in range check comes later */
- }
- glyphs = getCoverageTable(ttf,stoffset+coverage,info);
- if ( glyphs==NULL ) {
- free(glyph2s);
-return;
- }
- if ( justinuse==git_findnames ) {
- FeatureScriptLangList *fl;
- fl = l->otlookup->features;
- /* Unnamed glyphs get a name built of the base name and the feature tag */
- /* assuming this lookup is tagged with a feature... */
- if ( fl!=NULL )
- for ( i=0; glyphs[i]!=0xffff; ++i ) if ( glyphs[i]<info->glyph_cnt ) {
- if ( info->chars[glyphs[i]]->name!=NULL ) {
- which = format==1 ? (uint16) (glyphs[i]+delta) : glyph2s[i];
- if ( which<info->glyph_cnt && which>=0 && info->chars[which]!=NULL &&
- info->chars[which]->name==NULL ) {
- char *basename = info->chars[glyphs[i]]->name;
- char *str;
- char tag[5], *pt=tag;
- for ( j=0; tagstr[j].tag!=0 && tagstr[j].tag!=fl->featuretag; ++j );
- if ( tagstr[j].tag!=0 )
- pt = tagstr[j].str;
- else {
- tag[0] = fl->featuretag>>24;
- if ( (tag[1] = (fl->featuretag>>16)&0xff)==' ' ) tag[1] = '\0';
- if ( (tag[2] = (fl->featuretag>>8)&0xff)==' ' ) tag[2] = '\0';
- if ( (tag[3] = (fl->featuretag)&0xff)==' ' ) tag[3] = '\0';
- tag[4] = '\0';
- pt = tag;
- }
- str = galloc(strlen(basename)+strlen(pt)+2);
- sprintf(str,"%s.%s", basename, pt );
- info->chars[which]->name = str;
- }
- }
- }
- } else if ( justinuse==git_justinuse ) {
- for ( i=0; glyphs[i]!=0xffff; ++i ) if ( glyphs[i]<info->glyph_cnt ) {
- info->inuse[glyphs[i]]= true;
- which = format==1 ? (uint16) (glyphs[i]+delta) : glyph2s[i];
- info->inuse[which]= true;
- }
- } else if ( justinuse==git_normal ) {
- for ( i=0; glyphs[i]!=0xffff; ++i ) if ( glyphs[i]<info->glyph_cnt && info->chars[glyphs[i]]!=NULL ) {
- which = format==1 ? (uint16) (glyphs[i]+delta) : glyph2s[i];
- if ( which>=info->glyph_cnt ) {
- LogError( _("Bad substitution glyph: GID %d not less than %d\n"),
- which, info->glyph_cnt);
- info->bad_ot = true;
- which = 0;
- }
- if ( info->chars[which]!=NULL ) { /* Might be in a ttc file */
- PST *pos = chunkalloc(sizeof(PST));
- pos->type = pst_substitution;
- pos->subtable = subtable;
- pos->next = info->chars[glyphs[i]]->possub;
- info->chars[glyphs[i]]->possub = pos;
- pos->u.subs.variant = copy(info->chars[which]->name);
- }
- }
- }
- subtable->per_glyph_pst_or_kern = true;
- free(glyph2s);
- free(glyphs);
-}
-
-/* Multiple and alternate substitution lookups have the same format */
-static void gsubMultipleSubTable(FILE *ttf, int stoffset, struct ttfinfo *info,
- struct lookup *l, struct lookup_subtable *subtable, int justinuse) {
- int coverage, cnt, i, j, len, max;
- uint16 format;
- uint16 *offsets;
- uint16 *glyphs, *glyph2s;
- char *pt;
- int bad;
- int badcnt = 0;
-
- if ( justinuse==git_findnames )
-return;
-
- format=getushort(ttf);
- if ( format!=1 ) /* Unknown subtable format */
-return;
- coverage = getushort(ttf);
- cnt = getushort(ttf);
- if ( feof(ttf)) {
- LogError( _("Unexpected end of file in GSUB sub-table.\n"));
- info->bad_ot = true;
-return;
- }
- offsets = galloc(cnt*sizeof(uint16));
- for ( i=0; i<cnt; ++i )
- offsets[i] = getushort(ttf);
- glyphs = getCoverageTable(ttf,stoffset+coverage,info);
- if ( glyphs==NULL ) {
- free(offsets);
-return;
- }
- for ( i=0; glyphs[i]!=0xffff; ++i );
- if ( i!=cnt ) {
- LogError( _("Coverage table specifies a different number of glyphs than the sub-table expects.\n" ));
- info->bad_ot = true;
- if ( cnt<i )
- glyphs[cnt] = 0xffff;
- else
- cnt = i;
- }
- max = 20;
- glyph2s = galloc(max*sizeof(uint16));
- for ( i=0; glyphs[i]!=0xffff; ++i ) {
- PST *alt;
- fseek(ttf,stoffset+offsets[i],SEEK_SET);
- cnt = getushort(ttf);
- if ( feof(ttf)) {
- LogError( _("Unexpected end of file in GSUB sub-table.\n"));
- info->bad_ot = true;
-return;
- }
- if ( cnt>max ) {
- max = cnt+30;
- glyph2s = grealloc(glyph2s,max*sizeof(uint16));
- }
- len = 0; bad = false;
- for ( j=0; j<cnt; ++j ) {
- glyph2s[j] = getushort(ttf);
- if ( feof(ttf)) {
- LogError( _("Unexpected end of file in GSUB sub-table.\n" ));
- info->bad_ot = true;
-return;
- }
- if ( glyph2s[j]>=info->glyph_cnt ) {
- if ( !justinuse )
- LogError( _("Bad Multiple/Alternate substitution glyph. GID %d not less than %d\n"),
- glyph2s[j], info->glyph_cnt );
- info->bad_ot = true;
- if ( ++badcnt>20 )
-return;
- glyph2s[j] = 0;
- }
- if ( justinuse==git_justinuse )
- /* Do Nothing */;
- else if ( info->chars[glyph2s[j]]==NULL )
- bad = true;
- else
- len += strlen( info->chars[glyph2s[j]]->name) +1;
- }
- if ( justinuse==git_justinuse ) {
- info->inuse[glyphs[i]] = 1;
- for ( j=0; j<cnt; ++j )
- info->inuse[glyph2s[j]] = 1;
- } else if ( info->chars[glyphs[i]]!=NULL && !bad ) {
- alt = chunkalloc(sizeof(PST));
- alt->type = l->otlookup->lookup_type==gsub_multiple?pst_multiple:pst_alternate;
- alt->subtable = subtable;
- alt->next = info->chars[glyphs[i]]->possub;
- info->chars[glyphs[i]]->possub = alt;
- pt = alt->u.subs.variant = galloc(len+1);
- *pt = '\0';
- for ( j=0; j<cnt; ++j ) {
- strcat(pt,info->chars[glyph2s[j]]->name);
- strcat(pt," ");
- }
- if ( *pt!='\0' && pt[strlen(pt)-1]==' ' )
- pt[strlen(pt)-1] = '\0';
- }
- }
- subtable->per_glyph_pst_or_kern = true;
- free(glyphs);
- free(glyph2s);
- free(offsets);
-}
-
-static void gsubLigatureSubTable(FILE *ttf, int stoffset,
- struct ttfinfo *info, struct lookup *l, struct lookup_subtable *subtable, int justinuse) {
- int coverage, cnt, i, j, k, lig_cnt, cc, len;
- uint16 *ls_offsets, *lig_offsets;
- uint16 *glyphs, *lig_glyphs, lig;
- char *pt;
- PST *liga;
-
- /* Format = */ getushort(ttf);
- coverage = getushort(ttf);
- cnt = getushort(ttf);
- if ( feof(ttf)) {
- LogError( _("Unexpected end of file in GSUB ligature sub-table.\n" ));
- info->bad_ot = true;
-return;
- }
- ls_offsets = galloc(cnt*sizeof(uint16));
- for ( i=0; i<cnt; ++i )
- ls_offsets[i]=getushort(ttf);
- glyphs = getCoverageTable(ttf,stoffset+coverage,info);
- if ( glyphs==NULL )
-return;
- for ( i=0; i<cnt; ++i ) {
- fseek(ttf,stoffset+ls_offsets[i],SEEK_SET);
- lig_cnt = getushort(ttf);
- if ( feof(ttf)) {
- LogError( _("Unexpected end of file in GSUB ligature sub-table.\n" ));
- info->bad_ot = true;
-return;
- }
- lig_offsets = galloc(lig_cnt*sizeof(uint16));
- for ( j=0; j<lig_cnt; ++j )
- lig_offsets[j] = getushort(ttf);
- if ( feof(ttf)) {
- LogError( _("Unexpected end of file in GSUB ligature sub-table.\n" ));
- info->bad_ot = true;
-return;
- }
- for ( j=0; j<lig_cnt; ++j ) {
- fseek(ttf,stoffset+ls_offsets[i]+lig_offsets[j],SEEK_SET);
- lig = getushort(ttf);
- if ( lig>=info->glyph_cnt ) {
- LogError( _("Bad ligature glyph. GID %d not less than %d\n"),
- lig, info->glyph_cnt );
- info->bad_ot = true;
- lig = 0;
- }
- cc = getushort(ttf);
- if ( cc<0 || cc>100 ) {
- LogError( _("Unlikely count of ligature components (%d), I suspect this ligature sub-\n table is garbage, I'm giving up on it.\n"), cc );
- info->bad_ot = true;
- free(glyphs); free(lig_offsets);
-return;
- }
- lig_glyphs = galloc(cc*sizeof(uint16));
- lig_glyphs[0] = glyphs[i];
- for ( k=1; k<cc; ++k ) {
- lig_glyphs[k] = getushort(ttf);
- if ( lig_glyphs[k]>=info->glyph_cnt ) {
- if ( justinuse==git_normal )
- LogError( _("Bad ligature component glyph. GID %d not less than %d (in ligature %d)\n"),
- lig_glyphs[k], info->glyph_cnt, lig );
- info->bad_ot = true;
- lig_glyphs[k] = 0;
- }
- }
- if ( justinuse==git_justinuse ) {
- info->inuse[lig] = 1;
- for ( k=0; k<cc; ++k )
- info->inuse[lig_glyphs[k]] = 1;
- } else if ( justinuse==git_findnames ) {
- FeatureScriptLangList *fl = l->otlookup->features;
- /* If our ligature glyph has no name (and its components do) */
- /* give it a name by concatenating components with underscores */
- /* between them, and appending the tag */
- if ( fl!=NULL && info->chars[lig]!=NULL && info->chars[lig]->name==NULL ) {
- int len=0;
- for ( k=0; k<cc; ++k ) {
- if ( info->chars[lig_glyphs[k]]==NULL || info->chars[lig_glyphs[k]]->name==NULL )
- break;
- len += strlen(info->chars[lig_glyphs[k]]->name)+1;
- }
- if ( k==cc ) {
- char *str = galloc(len+6), *pt;
- char tag[5];
- tag[0] = fl->featuretag>>24;
- if ( (tag[1] = (fl->featuretag>>16)&0xff)==' ' ) tag[1] = '\0';
- if ( (tag[2] = (fl->featuretag>>8)&0xff)==' ' ) tag[2] = '\0';
- if ( (tag[3] = (fl->featuretag)&0xff)==' ' ) tag[3] = '\0';
- tag[4] = '\0';
- *str='\0';
- for ( k=0; k<cc; ++k ) {
- strcat(str,info->chars[lig_glyphs[k]]->name);
- strcat(str,"_");
- }
- pt = str+strlen(str);
- pt[-1] = '.';
- strcpy(pt,tag);
- info->chars[lig]->name = str;
- }
- }
- } else if ( info->chars[lig]!=NULL ) {
- for ( k=len=0; k<cc; ++k )
- if ( lig_glyphs[k]<info->glyph_cnt &&
- info->chars[lig_glyphs[k]]!=NULL )
- len += strlen(info->chars[lig_glyphs[k]]->name)+1;
- liga = chunkalloc(sizeof(PST));
- liga->type = pst_ligature;
- liga->subtable = subtable;
- liga->next = info->chars[lig]->possub;
- info->chars[lig]->possub = liga;
- liga->u.lig.lig = info->chars[lig];
- liga->u.lig.components = pt = galloc(len);
- for ( k=0; k<cc; ++k ) {
- if ( lig_glyphs[k]<info->glyph_cnt &&
- info->chars[lig_glyphs[k]]!=NULL ) {
- strcpy(pt,info->chars[lig_glyphs[k]]->name);
- pt += strlen(pt);
- *pt++ = ' ';
- }
- }
- pt[-1] = '\0';
- }
- free(lig_glyphs);
- }
- free(lig_offsets);
- }
- subtable->per_glyph_pst_or_kern = true;
- free(ls_offsets); free(glyphs);
-}
-
-static void gsubContextSubTable(FILE *ttf, int stoffset,
- struct ttfinfo *info, struct lookup *l, struct lookup_subtable *subtable, int justinuse,
- struct lookup *alllooks) {
- if ( justinuse==git_findnames )
-return; /* Don't give names to these guys, they might not be unique */
- /* ie. because these are context based there is not a one to one */
- /* mapping between input glyphs and output glyphs. One input glyph */
- /* may go to several output glyphs (depending on context) and so */
- /* <input-glyph-name>"."<tag-name> would be used for several glyphs */
- switch( getushort(ttf)) {
- case 1:
- g___ContextSubTable1(ttf,stoffset,info,l,subtable,justinuse,alllooks,false);
- break;
- case 2:
- g___ContextSubTable2(ttf,stoffset,info,l,subtable,justinuse,alllooks,false);
- break;
- case 3:
- g___ContextSubTable3(ttf,stoffset,info,l,subtable,justinuse,alllooks,false);
- break;
- }
-}
-
-static void gsubChainingSubTable(FILE *ttf, int stoffset,
- struct ttfinfo *info, struct lookup *l, struct lookup_subtable *subtable, int justinuse,
- struct lookup *alllooks) {
- if ( justinuse==git_findnames )
-return; /* Don't give names to these guys, the names might not be unique */
- switch( getushort(ttf)) {
- case 1:
- g___ChainingSubTable1(ttf,stoffset,info,l,subtable,justinuse,alllooks,false);
- break;
- case 2:
- g___ChainingSubTable2(ttf,stoffset,info,l,subtable,justinuse,alllooks,false);
- break;
- case 3:
- g___ChainingSubTable3(ttf,stoffset,info,l,subtable,justinuse,alllooks,false);
- break;
- }
-}
-
-static void gsubReverseChainSubTable(FILE *ttf, int stoffset,
- struct ttfinfo *info, struct lookup *l, struct lookup_subtable *subtable, int justinuse) {
- int scnt, bcnt, fcnt, i;
- uint16 coverage, *bcoverage, *fcoverage, *sglyphs, *glyphs;
- FPST *fpst;
- struct fpst_rule *rule;
- (void)l; /* for -Wall */
- if ( justinuse==git_findnames )
-return; /* Don't give names to these guys, they might not be unique */
- if ( getushort(ttf)!=1 )
-return; /* Don't understand this format type */
-
- coverage = getushort(ttf);
- bcnt = getushort(ttf);
- bcoverage = galloc(bcnt*sizeof(uint16));
- for ( i = 0 ; i<bcnt; ++i )
- bcoverage[i] = getushort(ttf);
- fcnt = getushort(ttf);
- fcoverage = galloc(fcnt*sizeof(uint16));
- for ( i = 0 ; i<fcnt; ++i )
- fcoverage[i] = getushort(ttf);
- scnt = getushort(ttf);
- sglyphs = galloc((scnt+1)*sizeof(uint16));
- for ( i = 0 ; i<scnt; ++i )
- if (( sglyphs[i] = getushort(ttf))>=info->glyph_cnt ) {
- LogError( _("Bad reverse contextual chaining substitution glyph: %d is not less than %d\n"),
- sglyphs[i], info->glyph_cnt );
- info->bad_ot = true;
- sglyphs[i] = 0;
- }
- sglyphs[i] = 0xffff;
-
- if ( justinuse==git_justinuse ) {
- for ( i = 0 ; i<scnt; ++i )
- info->inuse[sglyphs[i]] = 1;
- } else {
- fpst = chunkalloc(sizeof(FPST));
- fpst->type = pst_reversesub;
- fpst->format = pst_reversecoverage;
- fpst->subtable = subtable;
- fpst->next = info->possub;
- info->possub = fpst;
- subtable->fpst = fpst;
-
- fpst->rules = rule = gcalloc(1,sizeof(struct fpst_rule));
- fpst->rule_cnt = 1;
-
- rule->u.rcoverage.always1 = 1;
- rule->u.rcoverage.bcnt = bcnt;
- rule->u.rcoverage.fcnt = fcnt;
- rule->u.rcoverage.ncovers = galloc(sizeof(char *));
- rule->u.rcoverage.bcovers = galloc(bcnt*sizeof(char *));
- rule->u.rcoverage.fcovers = galloc(fcnt*sizeof(char *));
- rule->u.rcoverage.replacements = GlyphsToNames(info,sglyphs,false);
- glyphs = getCoverageTable(ttf,stoffset+coverage,info);
- rule->u.rcoverage.ncovers[0] = GlyphsToNames(info,glyphs,false);
- free(glyphs);
- for ( i=0; i<bcnt; ++i ) {
- glyphs = getCoverageTable(ttf,stoffset+bcoverage[i],info);
- rule->u.rcoverage.bcovers[i] = GlyphsToNames(info,glyphs,true);
- free(glyphs);
- }
- for ( i=0; i<fcnt; ++i ) {
- glyphs = getCoverageTable(ttf,stoffset+fcoverage[i],info);
- rule->u.rcoverage.fcovers[i] = GlyphsToNames(info,glyphs,true);
- free(glyphs);
- }
- rule->lookup_cnt = 0; /* substitution lookups needed for reverse chaining */
- }
- free(sglyphs);
- free(fcoverage);
- free(bcoverage);
-}
-
-static void readttfsizeparameters(FILE *ttf,int32 broken_pos,int32 correct_pos,
- struct ttfinfo *info) {
- int32 here;
- /* Both of the two fonts I've seen that contain a 'size' feature */
- /* have multiple features all of which point to the same parameter */
- /* area. Odd. */
- /* When Adobe first released fonts containing the 'size' feature */
- /* they did not follow the spec, and the offset to the size parameters */
- /* was relative to the wrong location. They claim (Aug 2006) that */
- /* this has been fixed. Be prepared to read either style of 'size' */
- /* following the heuristics Adobe provides */
- int32 test[2];
- int i, nid;
-
- if ( info->last_size_pos==broken_pos || info->last_size_pos==correct_pos )
-return;
-
- if ( info->last_size_pos!=0 ) {
- LogError( _("This font, %s, has multiple GPOS 'size' features. I'm not sure how to interpret that. I shall pick one arbitrarily.\n"),
- info->fontname==NULL? _("<Untitled>") : info->fontname );
- info->bad_ot = true;
-return;
- }
-
- test[0] = correct_pos; test[1] = broken_pos;
- here = ftell(ttf);
- for ( i=0; i<2; ++i ) {
- fseek(ttf,test[i],SEEK_SET);
- info->last_size_pos = test[i];
- info->design_size = getushort(ttf);
- if ( info->design_size==0 )
- continue;
- info->fontstyle_id = getushort(ttf);
- nid = getushort(ttf);
- info->design_range_bottom = getushort(ttf);
- info->design_range_top = getushort(ttf);
- if ( info->fontstyle_id == 0 && nid==0 &&
- info->design_range_bottom==0 && info->design_range_top==0 ) {
- /* Reasonable spec, only design size provided */
- info->fontstyle_name = NULL;
- break;
- }
- if ( info->design_size < info->design_range_bottom ||
- info->design_size > info->design_range_top ||
- info->design_range_bottom > info->design_range_top ||
- nid<256 || nid>32767 )
- continue;
- info->fontstyle_name = FindAllLangEntries(ttf,info,nid);
- if ( info->fontstyle_name==NULL )
- continue;
- else
- break;
- }
- if ( i==2 ) {
- LogError(_("The 'size' feature does not seem to follow the standard,\nnor does it conform to Adobe's early misinterpretation of\nthe standard. I cannot parse it.\n") );
- info->bad_ot = true;
- info->design_size = info->design_range_bottom = info->design_range_top = info->fontstyle_id = 0;
- info->fontstyle_name = NULL;
- } else if ( i==1 ) {
- LogError(_("The 'size' feature of this font conforms to Adobe's early misinterpretation of the otf standard.\n") );
- }
- fseek(ttf,here,SEEK_SET);
-
-#if 0
- printf( "pos=%d size=%g, range=(%g,%g] id=%d name=%d\n", pos,
- info->design_size/10.0, info->design_range_bottom/10.0, info->design_range_top/10.0,
- info->fontstyle_id, info->fontstyle_name );
-#endif
-}
-
-static struct scripts *readttfscripts(FILE *ttf,int32 pos, struct ttfinfo *info, int isgpos) {
- int i,j,k,cnt;
- int deflang, lcnt;
- struct scripts *scripts;
-
- if ( pos>=(int32)info->g_bounds ) {
- LogError(_("Attempt to read script data beyond end of %s table"), isgpos ? "GPOS" : "GSUB" );
- info->bad_ot = true;
-return( NULL );
- }
- fseek(ttf,pos,SEEK_SET);
- cnt = getushort(ttf);
- if ( cnt<=0 )
-return( NULL );
- else if ( cnt>1000 ) {
- LogError( _("Too many scripts %d\n"), cnt );
- info->bad_ot = true;
-return( NULL );
- }
-
- scripts = gcalloc(cnt+1,sizeof(struct scripts));
- for ( i=0; i<cnt; ++i ) {
- scripts[i].tag = getlong(ttf);
- scripts[i].offset = getushort(ttf);
- }
- for ( i=0; i<cnt; ++i ) {
- fseek(ttf,pos+scripts[i].offset,SEEK_SET);
- deflang = getushort(ttf);
- lcnt = getushort(ttf);
- lcnt += (deflang!=0);
- scripts[i].langcnt = lcnt;
- scripts[i].languages = gcalloc(lcnt+1,sizeof(struct language));
- j = 0;
- if ( deflang!=0 ) {
- scripts[i].languages[0].tag = CHR('d','f','l','t');
- scripts[i].languages[0].offset = deflang+scripts[i].offset;
- ++j;
- }
- for ( ; j<lcnt; ++j ) {
- scripts[i].languages[j].tag = getlong(ttf);
- scripts[i].languages[j].offset = scripts[i].offset+getushort(ttf);
- }
- for ( j=0; j<lcnt; ++j ) {
- if ( pos+scripts[i].languages[j].offset>=info->g_bounds ) {
- LogError(_("Attempt to read script data beyond end of %s table"), isgpos ? "GPOS" : "GSUB" );
- info->bad_ot = true;
-return( NULL );
- }
- fseek(ttf,pos+scripts[i].languages[j].offset,SEEK_SET);
- (void) getushort(ttf); /* lookup ordering table undefined */
- scripts[i].languages[j].req = getushort(ttf);
- scripts[i].languages[j].fcnt = getushort(ttf);
- if ( feof(ttf)) {
- LogError(_("End of file when reading scripts in %s table"), isgpos ? "GPOS" : "GSUB" );
- info->bad_ot = true;
-return( NULL );
- }
- scripts[i].languages[j].features = galloc(scripts[i].languages[j].fcnt*sizeof(uint16));
- for ( k=0; k<scripts[i].languages[j].fcnt; ++k )
- scripts[i].languages[j].features[k] = getushort(ttf);
- }
- }
-
- if ( feof(ttf)) {
- LogError(_("End of file in %s table"), isgpos ? "GPOS" : "GSUB" );
- info->bad_ot = true;
-return( NULL );
- }
-
-return( scripts );
-}
-
-static struct feature *readttffeatures(FILE *ttf,int32 pos,int isgpos, struct ttfinfo *info) {
- /* read the features table returning an array containing all interesting */
- /* features */
- int cnt;
- int i,j;
- struct feature *features;
- int parameters;
-
- if ( pos>=(int32)info->g_bounds ) {
- LogError(_("Attempt to read feature data beyond end of %s table"), isgpos ? "GPOS" : "GSUB" );
- info->bad_ot = true;
-return( NULL );
- }
- fseek(ttf,pos,SEEK_SET);
- info->feature_cnt = cnt = getushort(ttf);
- if ( cnt<=0 )
-return( NULL );
- else if ( cnt>1000 ) {
- LogError( _("Too many features %d\n"), cnt );
- info->bad_ot = true;
-return( NULL );
- }
-
- features = gcalloc(cnt+1,sizeof(struct feature));
- for ( i=0; i<cnt; ++i ) {
- features[i].tag = getlong(ttf);
- features[i].offset = getushort(ttf);
- }
-
- for ( i=0; i<cnt; ++i ) {
- if ( pos+features[i].offset>=info->g_bounds ) {
- LogError(_("Attempt to read feature data beyond end of %s table"), isgpos ? "GPOS" : "GSUB" );
- info->bad_ot = true;
-return( NULL );
- }
- fseek(ttf,pos+features[i].offset,SEEK_SET);
- parameters = getushort(ttf);
- if ( features[i].tag==CHR('s','i','z','e') && parameters!=0 && !feof(ttf))
- readttfsizeparameters(ttf,pos+parameters,
- pos+parameters+features[i].offset,info);
- features[i].lcnt = getushort(ttf);
- if ( feof(ttf) ) {
- LogError(_("End of file when reading features in %s table"), isgpos ? "GPOS" : "GSUB" );
- info->bad_ot = true;
-return( NULL );
- }
- features[i].lookups = galloc(features[i].lcnt*sizeof(uint16));
- for ( j=0; j<features[i].lcnt; ++j )
- features[i].lookups[j] = getushort(ttf);
- }
-
-return( features );
-}
-
-static struct lookup *readttflookups(FILE *ttf,int32 pos, struct ttfinfo *info, int isgpos) {
- int cnt,i,j;
- struct lookup *lookups;
- OTLookup *otlookup, *last=NULL;
- struct lookup_subtable *st;
-
- if ( pos>=(int32)info->g_bounds ) {
- LogError(_("Attempt to read lookup data beyond end of %s table"), isgpos ? "GPOS" : "GSUB" );
- info->bad_ot = true;
-return( NULL );
- }
-
- fseek(ttf,pos,SEEK_SET);
- info->lookup_cnt = cnt = getushort(ttf);
- info->cur_lookups = NULL;
- if ( cnt<=0 )
-return( NULL );
- else if ( cnt>1000 ) {
- LogError( _("Too many lookups %d\n"), cnt );
- info->bad_ot = true;
-return( NULL );
- }
-
- lookups = gcalloc(cnt+1,sizeof(struct lookup));
- for ( i=0; i<cnt; ++i )
- lookups[i].offset = getushort(ttf);
- for ( i=0; i<cnt; ++i ) {
- if ( pos+lookups[i].offset>=info->g_bounds ) {
- LogError(_("Attempt to read lookup data beyond end of %s table"), isgpos ? "GPOS" : "GSUB" );
- info->bad_ot = true;
-return( NULL );
- }
- fseek(ttf,pos+lookups[i].offset,SEEK_SET);
- lookups[i].type = getushort(ttf);
- lookups[i].flags = getushort(ttf);
- lookups[i].subtabcnt = getushort(ttf);
- lookups[i].subtab_offsets = galloc(lookups[i].subtabcnt*sizeof(int32));
- for ( j=0; j<lookups[i].subtabcnt; ++j )
- lookups[i].subtab_offsets[j] = pos+lookups[i].offset+getushort(ttf);
-
- lookups[i].otlookup = otlookup = chunkalloc(sizeof(OTLookup));
- otlookup->lookup_index = i;
- if ( last==NULL )
- info->cur_lookups = otlookup;
- else
- last->next = otlookup;
- last = otlookup;
- otlookup->lookup_type = (isgpos<<8) | lookups[i].type;
- otlookup->lookup_flags = lookups[i].flags;
- otlookup->lookup_index = i;
- if ( feof(ttf) ) {
- LogError(_("End of file when reading lookups in %s table"), isgpos ? "GPOS" : "GSUB" );
- info->bad_ot = true;
-return( NULL );
- }
- for ( j=0; j<lookups[i].subtabcnt; ++j ) {
- st = chunkalloc(sizeof(struct lookup_subtable));
- st->next = otlookup->subtables;
- st->lookup = otlookup;
- otlookup->subtables = st;
- }
- }
- if ( isgpos )
- info->gpos_lookups = info->cur_lookups;
- else
- info->gsub_lookups = info->cur_lookups;
-return( lookups );
-}
-
-static void tagLookupsWithFeature(uint32 script_tag,uint32 lang_tag,
- int required_feature, struct feature *feature, struct lookup *lookups,
- struct ttfinfo *info) {
- uint32 feature_tag = required_feature ? REQUIRED_FEATURE : feature->tag;
- int i;
- OTLookup *otlookup;
- FeatureScriptLangList *fl;
-
- /* The otf docs are ambiguous as to the capitalization of the default */
- /* script. The capitalized version is correct (uncapitalized is used for languages) */
- if ( script_tag == DEFAULT_LANG )
- script_tag = DEFAULT_SCRIPT;
-
- for ( i=0; i < feature->lcnt; ++i ) {
- if ( feature->lookups[i]>=info->lookup_cnt ) {
- LogError( _("Lookup out of bounds in feature table.\n") );
- info->bad_ot = true;
- } else {
- otlookup = lookups[feature->lookups[i]].otlookup;
- for ( fl = otlookup->features; fl!=NULL && fl->featuretag!=feature_tag; fl=fl->next );
- if ( fl==NULL ) {
- fl = chunkalloc(sizeof(FeatureScriptLangList));
- fl->featuretag = feature_tag;
- fl->next = otlookup->features;
- otlookup->features = fl;
- }
- FListAppendScriptLang(fl,script_tag,lang_tag);
- }
- }
-}
-
-static void tagLookupsWithScript(struct scripts *scripts,
- struct feature *features, struct lookup *lookups,struct ttfinfo *info ) {
- int i,j;
- struct scripts *s;
- struct language *lang;
- struct lookup *l;
-
- if ( scripts==NULL || features==NULL )
-return; /* Legal, I'd guess, but not very interesting. Perhaps all lookups are controlled by the JSTF table or something */
-
- /* First tag every lookup with all script, lang, feature combinations that*/
- /* invoke it */
- for ( s=scripts; s->tag!=0; ++s ) {
- for ( lang=s->languages, i=0; i<s->langcnt; ++i, ++lang ) {
- if ( lang->req==0xffff )
- /* Do Nothing */;
- else if ( lang->req>= info->feature_cnt ) {
- LogError( _("Required feature out of bounds in script table.\n") );
- info->bad_ot = true;
- } else
- tagLookupsWithFeature(s->tag,lang->tag,true,&features[lang->req],
- lookups,info);
- for ( j=0; j<lang->fcnt; ++j ) {
- if ( lang->features[j]>=info->feature_cnt ) {
- LogError( _("Feature out of bounds in script table.\n") );
- info->bad_ot = true;
- } else
- tagLookupsWithFeature(s->tag,lang->tag,false,&features[lang->features[j]],
- lookups,info);
- }
- }
- }
-
- /* The scripts got added backwards so reverse to put them in */
- /* alphabetic order again */
- for ( l=lookups, i=0; l->offset!=0; ++l, ++i ) {
- OTLookup *otl = l->otlookup;
- FeatureScriptLangList *fl;
- struct scriptlanglist *sl, *next, *prev;
- for ( fl=otl->features; fl!=NULL; fl=fl->next ) {
- prev = NULL;
- for ( sl=fl->scripts; sl!=NULL; sl = next ) {
- next = sl->next;
- sl->next = prev;
- prev = sl;
- }
- fl->scripts = prev;
- }
- }
-}
-
-static void gposExtensionSubTable(FILE *ttf, int stoffset,
- struct ttfinfo *info, struct lookup *l, struct lookup_subtable *subtable,
- struct lookup *alllooks) {
- uint32 base = ftell(ttf), st, offset;
- int lu_type;
- (void)stoffset; /* for -Wall */
- /* Format = */ getushort(ttf);
- lu_type = getushort(ttf);
- offset = getlong(ttf);
-
- l->otlookup->lookup_type = 0x100|lu_type;
-
- fseek(ttf,st = base+offset,SEEK_SET);
- switch ( lu_type ) {
- case 1:
- gposSimplePos(ttf,st,info,l,subtable);
- break;
- case 2:
- gposKernSubTable(ttf,st,info,l,subtable);
- break;
- case 3:
- gposCursiveSubTable(ttf,st,info,l,subtable);
- break;
- case 4: case 5: case 6:
- gposMarkSubTable(ttf,st,info,l,subtable);
- break;
- case 7:
- gposContextSubTable(ttf,st,info,l,subtable,alllooks);
- break;
- case 8:
- gposChainingSubTable(ttf,st,info,l,subtable,alllooks);
- break;
- case 9:
- LogError( _("This font is erroneous: it has a GPOS extension subtable that points to\nanother extension sub-table.\n") );
- info->bad_ot = true;
- break;
-/* Any cases added here also need to go in the gposLookupSwitch */
- default:
- LogError( _("Unknown GPOS sub-table type: %d\n"), lu_type );
- info->bad_ot = true;
- break;
- }
- if ( ftell(ttf)>info->gpos_start+info->gpos_length ) {
- LogError( _("Subtable extends beyond end of GPOS table\n") );
- info->bad_ot = true;
- }
-}
-
-static void gsubExtensionSubTable(FILE *ttf, int stoffset,
- struct ttfinfo *info, struct lookup *l, struct lookup_subtable *subtable, int justinuse,
- struct lookup *alllooks) {
- uint32 base = ftell(ttf), st, offset;
- int lu_type;
- (void)stoffset; /* for -Wall */
- /* Format = */ getushort(ttf);
- lu_type = getushort(ttf);
- offset = getlong(ttf);
-
- l->otlookup->lookup_type = lu_type;
-
- fseek(ttf,st = base+offset,SEEK_SET);
- switch ( lu_type ) {
- case 1:
- gsubSimpleSubTable(ttf,st,info,l,subtable,justinuse);
- break;
- case 2: case 3: /* Multiple and alternate have same format, different semantics */
- gsubMultipleSubTable(ttf,st,info,l,subtable,justinuse);
- break;
- case 4:
- gsubLigatureSubTable(ttf,st,info,l,subtable,justinuse);
- break;
- case 5:
- gsubContextSubTable(ttf,st,info,l,subtable,justinuse,alllooks);
- break;
- case 6:
- gsubChainingSubTable(ttf,st,info,l,subtable,justinuse,alllooks);
- break;
- case 7:
- LogError( _("This font is erroneous: it has a GSUB extension subtable that points to\nanother extension sub-table.\n") );
- info->bad_ot = true;
- break;
- case 8:
- gsubReverseChainSubTable(ttf,st,info,l,subtable,justinuse);
- break;
-/* Any cases added here also need to go in the gsubLookupSwitch */
- default:
- LogError( _("Unknown GSUB sub-table type: %d\n"), lu_type );
- info->bad_ot = true;
- break;
- }
- if ( ftell(ttf)>info->gsub_start+info->gsub_length ) {
- LogError( _("Subtable extends beyond end of GSUB table\n") );
- info->bad_ot = true;
- }
-}
-
-static void gposLookupSwitch(FILE *ttf, int st,
- struct ttfinfo *info, struct lookup *l, struct lookup_subtable *subtable,
- struct lookup *alllooks) {
-
- switch ( l->type | 0x100 ) {
- case gpos_single:
- gposSimplePos(ttf,st,info,l,subtable);
- break;
- case gpos_pair:
- gposKernSubTable(ttf,st,info,l,subtable);
- break;
- case gpos_cursive:
- gposCursiveSubTable(ttf,st,info,l,subtable);
- break;
- case gpos_mark2base: case gpos_mark2ligature: case gpos_mark2mark:
- gposMarkSubTable(ttf,st,info,l,subtable);
- break;
- case gpos_context:
- gposContextSubTable(ttf,st,info,l,subtable,alllooks);
- break;
- case gpos_contextchain:
- gposChainingSubTable(ttf,st,info,l,subtable,alllooks);
- break;
- case 0x109:
- gposExtensionSubTable(ttf,st,info,l,subtable,alllooks);
- break;
-/* Any cases added here also need to go in the gposExtensionSubTable */
- default:
- LogError( _("Unknown GPOS sub-table type: %d\n"), l->otlookup->lookup_type );
- info->bad_ot = true;
- break;
- }
- if ( ftell(ttf)>info->gpos_start+info->gpos_length ) {
- LogError( _("Subtable extends beyond end of GPOS table\n") );
- info->bad_ot = true;
- }
-}
-
-static void gsubLookupSwitch(FILE *ttf, int st,
- struct ttfinfo *info, struct lookup *l, struct lookup_subtable *subtable, int justinuse,
- struct lookup *alllooks) {
-
- switch ( l->type ) {
- case gsub_single:
- gsubSimpleSubTable(ttf,st,info,l,subtable,justinuse);
- break;
- case gsub_multiple: case gsub_alternate: /* Multiple and alternate have same format, different semantics */
- gsubMultipleSubTable(ttf,st,info,l,subtable,justinuse);
- break;
- case gsub_ligature:
- gsubLigatureSubTable(ttf,st,info,l,subtable,justinuse);
- break;
- case gsub_context:
- gsubContextSubTable(ttf,st,info,l,subtable,justinuse,alllooks);
- break;
- case gsub_contextchain:
- gsubChainingSubTable(ttf,st,info,l,subtable,justinuse,alllooks);
- break;
- case 7:
- gsubExtensionSubTable(ttf,st,info,l,subtable,justinuse,alllooks);
- break;
- case gsub_reversecchain:
- gsubReverseChainSubTable(ttf,st,info,l,subtable,justinuse);
- break;
-/* Any cases added here also need to go in the gsubExtensionSubTable */
- default:
- LogError( _("Unknown GSUB sub-table type: %d\n"), l->otlookup->lookup_type );
- info->bad_ot = true;
- break;
- }
- if ( ftell(ttf)>info->g_bounds ) {
- LogError( _("Subtable extends beyond end of GSUB table\n" ));
- info->bad_ot = true;
- }
-}
-
-static void ScriptsFree(struct scripts *scripts) {
- int i,j;
-
- if ( scripts==NULL )
-return;
- for ( i=0; scripts[i].offset!=0 ; ++i ) {
- for ( j=0; j<scripts[i].langcnt; ++j )
- free( scripts[i].languages[j].features);
- free(scripts[i].languages);
- }
- free(scripts);
-}
-
-static void FeaturesFree(struct feature *features) {
- int i;
-
- if ( features==NULL )
-return;
- for ( i=0; features[i].offset!=0 ; ++i )
- free(features[i].lookups);
- free(features);
-}
-
-static void LookupsFree(struct lookup *lookups) {
- int i;
-
- for ( i=0; lookups[i].offset!=0 ; ++i ) {
- free( lookups[i].subtab_offsets );
- }
- free(lookups);
-}
-
-static void ProcessGPOSGSUB(FILE *ttf,struct ttfinfo *info,int gpos,int inusetype) {
- int k;
- int32 base, lookup_start, st;
- int32 script_off, feature_off;
- struct scripts *scripts;
- struct feature *features;
- struct lookup *lookups, *l;
- struct lookup_subtable *subtable;
-
- if ( gpos ) {
- base = info->gpos_start;
- info->g_bounds = base + info->gpos_length;
- } else {
- base = info->gsub_start;
- info->g_bounds = base + info->gsub_length;
- }
- fseek(ttf,base,SEEK_SET);
- /* version = */ getlong(ttf);
- script_off = getushort(ttf);
- feature_off = getushort(ttf);
- lookup_start = base+getushort(ttf);
-
- scripts = readttfscripts(ttf,base+script_off,info,gpos);
- features = readttffeatures(ttf,base+feature_off,gpos,info);
- /* It is legal to have lookups with no features or scripts */
- /* For example if all the lookups were controlled by the JSTF table */
- lookups = readttflookups(ttf,lookup_start,info,gpos);
- if ( lookups==NULL ) {
- ScriptsFree(scripts);
- FeaturesFree(features);
-return;
- }
- tagLookupsWithScript(scripts,features,lookups,info);
- ScriptsFree(scripts); scripts = NULL;
- FeaturesFree(features); features = NULL;
-
- for ( l = lookups; l->offset!=0; ++l ) {
- for ( k=0, subtable=l->otlookup->subtables; k<l->subtabcnt; ++k, subtable=subtable->next ) {
- st = l->subtab_offsets[k];
- fseek(ttf,st,SEEK_SET);
- if ( gpos ) {
- gposLookupSwitch(ttf,st,info,l,subtable,lookups);
- } else {
- gsubLookupSwitch(ttf,st,info,l,subtable,inusetype,lookups);
- }
- }
- }
-
- /* Then generate some user-friendly names for the all the lookups */
- if ( inusetype==git_normal )
- for ( l=lookups; l->offset!=0; ++l )
- NameOTLookup(l->otlookup,NULL);
-
- LookupsFree(lookups);
- if ( inusetype!=git_normal && !gpos ) {
- OTLookupListFree(info->gsub_lookups);
- info->gsub_lookups = info->cur_lookups = NULL;
- }
-}
-
-void readttfgsubUsed(FILE *ttf,struct ttfinfo *info) {
- ProcessGPOSGSUB(ttf,info,false,git_justinuse);
- info->g_bounds = 0;
-}
-
-void GuessNamesFromGSUB(FILE *ttf,struct ttfinfo *info) {
- ProcessGPOSGSUB(ttf,info,false,git_findnames);
- info->g_bounds = 0;
-}
-
-void readttfgpossub(FILE *ttf,struct ttfinfo *info,int gpos) {
- ProcessGPOSGSUB(ttf,info,gpos,git_normal);
- info->g_bounds = 0;
-}
-
-void readttfgdef(FILE *ttf,struct ttfinfo *info) {
- int lclo, gclass, mac;
- int coverage, cnt, i,j, format;
- uint16 *glyphs, *lc_offsets, *offsets;
- uint32 caret_base;
- uint32 version;
- PST *pst;
- SplineChar *sc;
-
- fseek(ttf,info->gdef_start,SEEK_SET);
-
- version = getlong(ttf) ;
- if (version != 0x00010000 && version != 0x00010002)
- return;
-
- info->g_bounds = info->gdef_start + info->gdef_length;
- gclass = getushort(ttf);
- /* attach list = */ getushort(ttf);
- lclo = getushort(ttf); /* ligature caret list */
- mac = getushort(ttf); /* mark attach class */
-
- if (version == 0x00010002)
- getushort(ttf); /* class defs */
-
- if ( gclass!=0 ) {
- uint16 *gclasses = getClassDefTable(ttf,info->gdef_start+gclass, info);
- for ( i=0; i<info->glyph_cnt; ++i )
- if ( info->chars[i]!=NULL && gclasses[i]!=0 )
- info->chars[i]->glyph_class = gclasses[i]+1;
- free(gclasses);
- }
-
- if ( mac!=0 ) {
- uint16 *mclasses = getClassDefTable(ttf,info->gdef_start+mac, info);
- const char *format_spec = _("MarkClass-%d");
- info->mark_class_cnt = ClassFindCnt(mclasses,info->glyph_cnt);
- info->mark_classes = ClassToNames(info,info->mark_class_cnt,mclasses,info->glyph_cnt);
- info->mark_class_names = galloc(info->mark_class_cnt*sizeof(char *));
- info->mark_class_names[0] = NULL;
- for ( i=1; i<info->mark_class_cnt; ++i ) {
- info->mark_class_names[i] = galloc((strlen(format_spec)+10));
- sprintf( info->mark_class_names[i], format_spec, i );
- }
- free(mclasses);
- }
-
- if ( lclo!=0 ) {
- lclo += info->gdef_start;
- fseek(ttf,lclo,SEEK_SET);
- coverage = getushort(ttf);
- cnt = getushort(ttf);
- if ( cnt==0 )
-return;
- lc_offsets = galloc(cnt*sizeof(uint16));
- for ( i=0; i<cnt; ++i )
- lc_offsets[i]=getushort(ttf);
- glyphs = getCoverageTable(ttf,lclo+coverage,info);
- if ( glyphs==NULL )
-return;
- for ( i=0; i<cnt; ++i ) if ( glyphs[i]<info->glyph_cnt ) {
- fseek(ttf,lclo+lc_offsets[i],SEEK_SET);
- sc = info->chars[glyphs[i]];
- for ( pst=sc->possub; pst!=NULL && pst->type!=pst_lcaret; pst=pst->next );
- if ( pst==NULL ) {
- pst = chunkalloc(sizeof(PST));
- pst->next = sc->possub;
- sc->possub = pst;
- pst->type = pst_lcaret;
- pst->subtable = NULL;
- sc->lig_caret_cnt_fixed = true;
- }
- caret_base = ftell(ttf);
- pst->u.lcaret.cnt = getushort(ttf);
- if ( pst->u.lcaret.carets!=NULL ) free(pst->u.lcaret.carets);
- offsets = galloc(pst->u.lcaret.cnt*sizeof(uint16));
- for ( j=0; j<pst->u.lcaret.cnt; ++j )
- offsets[j] = getushort(ttf);
- pst->u.lcaret.carets = galloc(pst->u.lcaret.cnt*sizeof(int16));
- for ( j=0; j<pst->u.lcaret.cnt; ++j ) {
- fseek(ttf,caret_base+offsets[j],SEEK_SET);
- format=getushort(ttf);
- if ( format==1 ) {
- pst->u.lcaret.carets[j] = getushort(ttf);
- } else if ( format==2 ) {
- pst->u.lcaret.carets[j] = 0;
- /* point = */ getushort(ttf);
- } else if ( format==3 ) {
- pst->u.lcaret.carets[j] = getushort(ttf);
- /* in device table = */ getushort(ttf);
- } else {
- LogError( _("!!!! Unknown caret format %d !!!!\n"), format );
- info->bad_ot = true;
- }
- }
- free(offsets);
- }
- free(lc_offsets);
- free(glyphs);
- }
- info->g_bounds = 0;
-}
-
-static void OTLAppend(struct ttfinfo *info,OTLookup *otl,int gpos) {
- OTLookup *prev;
- int pos=0;
-
- if ( gpos && info->gpos_lookups == NULL )
- info->gpos_lookups = otl;
- else if ( !gpos && info->gsub_lookups == NULL )
- info->gsub_lookups = otl;
- else {
- prev = gpos ? info->gpos_lookups : info->gsub_lookups;
- pos = 1;
- while ( prev->next!=NULL ) {
- prev = prev->next;
- ++pos;
- }
- prev->next = otl;
- }
- otl->lookup_index = pos;
-}
-
-static void OTLRemove(struct ttfinfo *info,OTLookup *otl,int gpos) {
- /* Remove the most recent lookup. We got bad data and can't use it */
- OTLookup *prev, **base;
-
- base = gpos ? &info->gpos_lookups : &info->gsub_lookups;
- if ( *base==otl )
- *base = NULL;
- else if ( *base!=NULL ) {
- for ( prev = *base; prev->next!=NULL && prev->next!=otl; prev = prev->next );
- prev->next = NULL;
- }
- OTLookupFree(otl);
-}
-
-static void InfoNameOTLookup(OTLookup *otl,struct ttfinfo *info) {
- SplineFont sf;
-
- memset(&sf,0,sizeof(sf));
- NameOTLookup(otl,&sf);
-}
-
-/* Apple's docs imply that kerning info is always provided left to right, even*/
-/* for right to left scripts. My guess is that their docs are wrong, as they */
-/* often are, but if that be so then we need code in here to reverse */
-/* the order of the characters for right to left since pfaedit's convention */
-/* is to follow writing order rather than to go left to right */
-void readttfkerns(FILE *ttf,struct ttfinfo *info) {
- int tabcnt, len, coverage,i,j, npairs, version, format, flags_good, tab;
- int left, right, offset, array, rowWidth;
- int header_size;
- KernPair *kp;
- KernClass *kc;
- uint32 begin_table;
- uint16 *class1, *class2;
- int isv;
- OTLookup *otl;
-
- fseek(ttf,info->kern_start,SEEK_SET);
- version = getushort(ttf);
- tabcnt = getushort(ttf);
- if ( version!=0 ) {
- LogError(_("Invalid or unsupported version (0x%x) for 'kern' table"), version );
- info->bad_gx = true;
-return;
- }
- for ( tab=0; tab<tabcnt; ++tab ) {
- begin_table = ftell(ttf);
- /* version = */ getushort(ttf);
- len = getushort(ttf);
- coverage = getushort(ttf);
- format = coverage>>8;
- flags_good = ((coverage&7)<=1);
- isv = !(coverage&1);
- header_size = 6;
- otl = NULL;
- if ( flags_good ) {
- otl = chunkalloc(sizeof(OTLookup));
- otl->lookup_type = gpos_pair;
- otl->subtables = chunkalloc(sizeof(struct lookup_subtable));
- otl->subtables->lookup = otl;
- otl->subtables->per_glyph_pst_or_kern = true;
- otl->subtables->vertical_kerning = isv;
- otl->features = chunkalloc(sizeof(FeatureScriptLangList));
- if (isv)
- otl->features->featuretag = CHR('v','k','r','n');
- else
- otl->features->featuretag = CHR('k','e','r','n');
- OTLAppend(info,otl,true);
- }
- if ( flags_good && format==0 ) {
- /* format 0, horizontal kerning data (as pairs) not perpendicular */
- SplineChar **chars = info->chars;
- npairs = getushort(ttf);
- if ( len-14 != 6*npairs || npairs>10920 ) {
- LogError( _("In the 'kern' table, a subtable's length does not match the number of kerning pairs.") );
- info->bad_gx = true;
- }
- /* searchRange = */ getushort(ttf);
- /* entrySelector = */ getushort(ttf);
- /* rangeShift = */ getushort(ttf);
- otl->subtables[0].per_glyph_pst_or_kern = true;
- for ( j=0; j<npairs; ++j ) {
- left = getushort(ttf);
- right = getushort(ttf);
- offset = (short) getushort(ttf);
- if ( left<0 || right<0 ) {
- /* We've seen such buggy fonts... */
- LogError( _("Bad kern pair: glyphs %d & %d mustn't be negative\n"),
- left, right );
- info->bad_gx = true;
- } else if ( left>=info->glyph_cnt || right>=info->glyph_cnt ) {
- /* Holes happen when reading ttc files. They are probably ok */
- LogError( _("Bad kern pair: glyphs %d & %d must be less than %d\n"),
- left, right, info->glyph_cnt );
- info->bad_gx = true;
- } else if (chars[left]==NULL || chars[right]==NULL ) {
- /* Shouldn't happen. */
- LogError( _("Bad kern pair: glyphs at %d & %d are null\n"),
- left, right);
- info->bad_gx = true;
- } else {
- kp = chunkalloc(sizeof(KernPair));
- kp->sc = chars[right];
- kp->off = offset;
- kp->subtable = otl->subtables;
- FListsAppendScriptLang(otl->features,SCScriptFromUnicode(chars[left]),
- DEFAULT_LANG);
- if ( isv ) {
- kp->next = chars[left]->vkerns;
- chars[left]->vkerns = kp;
- } else {
- kp->next = chars[left]->kerns;
- chars[left]->kerns = kp;
- }
- }
- }
- InfoNameOTLookup(otl,info);
- } else if ( flags_good && (format==2 || format==3 )) {
- /* two class based formats */
- KernClass **khead, **klast;
- if ( isv ) {
- khead = &info->vkhead;
- klast = &info->vklast;
- } else {
- khead = &info->khead;
- klast = &info->klast;
- }
- if ( *khead==NULL )
- *khead = kc = chunkalloc(sizeof(KernClass));
- else
- kc = (*klast)->next = chunkalloc(sizeof(KernClass));
- *klast = kc;
- if ( format==2 ) {
- rowWidth = getushort(ttf);
- left = getushort(ttf);
- right = getushort(ttf);
- array = getushort(ttf);
- kc->second_cnt = rowWidth/sizeof(uint16);
- class1 = getAppleClassTable(ttf, begin_table+left, info->glyph_cnt, array, rowWidth, info );
- class2 = getAppleClassTable(ttf, begin_table+right, info->glyph_cnt, 0, sizeof(uint16), info );
- for ( i=0; i<info->glyph_cnt; ++i )
- if ( class1[i]>kc->first_cnt )
- kc->first_cnt = class1[i];
- ++ kc->first_cnt;
- kc->offsets = galloc(kc->first_cnt*kc->second_cnt*sizeof(int16));
-#ifdef FONTFORGE_CONFIG_DEVICETABLES
- kc->adjusts = gcalloc(kc->first_cnt*kc->second_cnt,sizeof(DeviceTable));
-#endif
- fseek(ttf,begin_table+array,SEEK_SET);
- for ( i=0; i<kc->first_cnt*kc->second_cnt; ++i )
- kc->offsets[i] = getushort(ttf);
- } else {
- /* format 3, horizontal kerning data (as classes limited to 256 entries) */
- /* OpenType's spec doesn't document this */
- int gc, kv, flags;
- int16 *kvs;
- gc = getushort(ttf);
- kv = getc(ttf);
- kc->first_cnt = getc(ttf);
- kc->second_cnt = getc(ttf);
- flags = getc(ttf);
- if ( gc>info->glyph_cnt ) {
- LogError( _("Kerning subtable 3 says the glyph count is %d, but maxp says %d\n"),
- gc, info->glyph_cnt );
- info->bad_gx = true;
- }
- class1 = gcalloc(gc>info->glyph_cnt?gc:info->glyph_cnt,sizeof(uint16));
- class2 = gcalloc(gc>info->glyph_cnt?gc:info->glyph_cnt,sizeof(uint16));
- kvs = galloc(kv*sizeof(int16));
- kc->offsets = galloc(kc->first_cnt*kc->second_cnt*sizeof(int16));
-#ifdef FONTFORGE_CONFIG_DEVICETABLES
- kc->adjusts = gcalloc(kc->first_cnt*kc->second_cnt,sizeof(DeviceTable));
-#endif
- for ( i=0; i<kv; ++i )
- kvs[i] = (int16) getushort(ttf);
- for ( i=0; i<gc; ++i )
- class1[i] = getc(ttf);
- for ( i=0; i<gc; ++i )
- class2[i] = getc(ttf);
- for ( i=0; i<kc->first_cnt*kc->second_cnt; ++i )
- kc->offsets[i] = kvs[getc(ttf)];
- free(kvs);
- }
- kc->firsts = ClassToNames(info,kc->first_cnt,class1,info->glyph_cnt);
- kc->seconds = ClassToNames(info,kc->second_cnt,class2,info->glyph_cnt);
- for ( i=0; i<info->glyph_cnt; ++i ) {
- if ( class1[i]>=4 && info->chars[i]!=NULL )
- FListsAppendScriptLang(otl->features,
- SCScriptFromUnicode(info->chars[i]),
- DEFAULT_LANG);
- }
- free(class1); free(class2);
- fseek(ttf,begin_table+len,SEEK_SET);
- otl->subtables[0].kc = kc;
- kc->subtable = otl->subtables;
- InfoNameOTLookup(otl,info);
- } else {
- LogError(_("Invalid or unsupported format (%d) for subtable of 'kern' table"), format );
- info->bad_gx = true;
- fseek(ttf,len-header_size,SEEK_CUR);
- if ( otl!=NULL )
- OTLRemove(info,otl,true);
- }
- }
-}
-
-/******************************************************************************/
-/* ******************************* MATH Table ******************************* */
-/* ********************** (Not strictly OpenType yet) *********************** */
-/******************************************************************************/
-
-/* ******************************** Read MATH ******************************* */
-
-static void ttf_math_read_constants(FILE *ttf,struct ttfinfo *info, uint32 start) {
- struct MATH *math;
- int i;
-#ifdef FONTFORGE_CONFIG_DEVICETABLES
- uint16 off;
-#endif
-
- fseek(ttf,start,SEEK_SET);
- info->math = math = gcalloc(1,sizeof(struct MATH));
-
- for ( i=0; math_constants_descriptor[i].script_name!=NULL; ++i ) {
- int16 *pos = (int16 *) (((char *) (math)) + math_constants_descriptor[i].offset );
- if ( pos == (int16 *) &math->MinConnectorOverlap )
- continue; /* Actually lives in the Variant table, not here */
- *pos = getushort(ttf);
-#ifdef FONTFORGE_CONFIG_DEVICETABLES
- if ( math_constants_descriptor[i].devtab_offset >= 0 ) {
- DeviceTable **devtab = (DeviceTable **) (((char *) (math)) + math_constants_descriptor[i].devtab_offset );
- off = getushort(ttf);
- if ( off!=0 ) {
- *devtab = chunkalloc(sizeof(DeviceTable));
- ReadDeviceTable(ttf,*devtab,start+off,info);
- }
- }
-#else
- /* No support for device tables, skip it */
- if ( math_constants_descriptor[i].devtab_offset != -1 )
- (void) getushort(ttf);
-#endif
- }
-}
-
-static void ttf_math_read_icta(FILE *ttf,struct ttfinfo *info, uint32 start, int is_ic) {
- /* The italic correction and top accent sub-tables have the same format */
- int coverage, cnt, i, val, offset;
- uint16 *glyphs;
-
- fseek(ttf,start,SEEK_SET);
- coverage = getushort(ttf);
- cnt = getushort(ttf);
- glyphs = getCoverageTable(ttf,start+coverage,info);
- if ( glyphs==NULL )
-return;
- fseek(ttf,start+4,SEEK_SET);
- for ( i=0; i<cnt; ++i ) {
- val = (int16) getushort(ttf);
- offset = getushort(ttf);
- if ( glyphs[i]<info->glyph_cnt && info->chars[ glyphs[i]]!=NULL ) {
- if ( is_ic )
- info->chars[ glyphs[i] ]->italic_correction = val;
- else
- info->chars[ glyphs[i] ]->top_accent_horiz = val;
-#ifdef FONTFORGE_CONFIG_DEVICETABLES
- if ( offset!=0 ) {
- DeviceTable *dv = chunkalloc(sizeof(DeviceTable));
- ReadDeviceTable(ttf,dv,start+offset,info);
- if ( is_ic )
- info->chars[ glyphs[i] ]->italic_adjusts = dv;
- else
- info->chars[ glyphs[i] ]->top_accent_adjusts = dv;
- }
-#endif
- }
- }
- free(glyphs);
-}
-
-static void ttf_math_read_extended(FILE *ttf,struct ttfinfo *info, uint32 start) {
- int i;
- uint16 *glyphs;
-
- glyphs = getCoverageTable(ttf,start,info);
- if ( glyphs==NULL )
-return;
- for ( i=0; glyphs[i]!=0xffff; ++i ) if ( glyphs[i]<info->glyph_cnt && info->chars[ glyphs[i]]!=NULL )
- info->chars[ glyphs[i] ]->is_extended_shape = true;
- free(glyphs);
-}
-
-static void ttf_math_read_mathkernv(FILE *ttf, uint32 start,struct mathkernvertex *mkv,
- SplineChar *sc, int istop, struct ttfinfo *info) {
- int cnt, i;
- (void)info; /* for -Wall */
- fseek(ttf,start,SEEK_SET);
- /* There is one more width than height. I store the width count */
- /* and guess a dummy height later */
- mkv->cnt = cnt = getushort(ttf)+1;
- mkv->mkd = gcalloc(cnt,sizeof(struct mathkerndata));
-
- for ( i=0; i<cnt-1; ++i ) {
- mkv->mkd[i].height = getushort(ttf);
-#ifdef FONTFORGE_CONFIG_DEVICETABLES
- mkv->mkd[i].height_adjusts = (void *) (intpt) getushort(ttf);
-#else
- (void) getushort(ttf);
-#endif
- }
-
- for ( i=0; i<cnt; ++i ) {
- mkv->mkd[i].kern = getushort(ttf);
-#ifdef FONTFORGE_CONFIG_DEVICETABLES
- mkv->mkd[i].kern_adjusts = (void *) (intpt) getushort(ttf);
-#else
- (void) getushort(ttf);
-#endif
- }
-
-#ifdef FONTFORGE_CONFIG_DEVICETABLES
- for ( i=0; i<cnt; ++i ) {
- DeviceTable *dv;
- uint32 offset;
- if ( mkv->mkd[i].height_adjusts!=NULL ) {
- offset = start + (intpt) mkv->mkd[i].height_adjusts;
- mkv->mkd[i].height_adjusts = dv = chunkalloc(sizeof(DeviceTable));
- ReadDeviceTable(ttf,dv,offset,info);
- }
- if ( mkv->mkd[i].kern_adjusts!=NULL ) {
- offset = start + (intpt) mkv->mkd[i].kern_adjusts;
- mkv->mkd[i].kern_adjusts = dv = chunkalloc(sizeof(DeviceTable));
- ReadDeviceTable(ttf,dv,offset,info);
- }
- }
-#endif
-
- if ( cnt>=3 )
- mkv->mkd[cnt-1].height = 2*mkv->mkd[cnt-2].height - mkv->mkd[cnt-3].height;
- else if ( cnt>=2 )
- mkv->mkd[cnt-1].height = mkv->mkd[cnt-2].height + 100;
- else if ( cnt==1 ) {
- if ( istop ) {
- DBounds b;
- SplineCharQuickBounds(sc,&b);
- mkv->mkd[cnt-1].height = b.maxy;
- } else
- mkv->mkd[cnt-1].height = 0;
- }
-}
-
-static void ttf_math_read_mathkern(FILE *ttf,struct ttfinfo *info, uint32 start) {
- int coverage, cnt, i;
- uint16 *glyphs;
- struct koff { uint16 tr, tl, br, bl; } *koff;
-
- fseek(ttf,start,SEEK_SET);
- coverage = getushort(ttf);
- cnt = getushort(ttf);
- koff = galloc(cnt*sizeof(struct koff));
- for ( i=0; i<cnt; ++i ) {
- koff[i].tr = getushort(ttf);
- koff[i].tl = getushort(ttf);
- koff[i].br = getushort(ttf);
- koff[i].bl = getushort(ttf);
- }
- glyphs = getCoverageTable(ttf,start+coverage,info);
- if ( glyphs==NULL ) {
- free(koff);
-return;
- }
- for ( i=0; i<cnt; ++i ) if ( glyphs[i]<info->glyph_cnt && info->chars[ glyphs[i]]!=NULL ) {
- SplineChar *sc = info->chars[ glyphs[i]];
- sc->mathkern = chunkalloc(sizeof(struct mathkern));
- if ( koff[i].tr!=0 )
- ttf_math_read_mathkernv(ttf,start+koff[i].tr,&sc->mathkern->top_right,sc,true,info);
- if ( koff[i].tl!=0 )
- ttf_math_read_mathkernv(ttf,start+koff[i].tl,&sc->mathkern->top_left,sc,true,info);
- if ( koff[i].br!=0 )
- ttf_math_read_mathkernv(ttf,start+koff[i].br,&sc->mathkern->bottom_right,sc,false,info);
- if ( koff[i].bl!=0 )
- ttf_math_read_mathkernv(ttf,start+koff[i].bl,&sc->mathkern->bottom_left,sc,false,info);
- }
- free(koff);
- free(glyphs);
-}
-
-static void ttf_math_read_glyphinfo(FILE *ttf,struct ttfinfo *info, uint32 start) {
- int icoff,taoff,esoff,kioff;
-
- fseek(ttf,start,SEEK_SET);
- icoff = getushort(ttf);
- taoff = getushort(ttf);
- esoff = getushort(ttf);
- kioff = getushort(ttf);
-
- if ( icoff!=0 )
- ttf_math_read_icta(ttf,info,start+icoff,true);
- if ( taoff!=0 )
- ttf_math_read_icta(ttf,info,start+taoff,false);
- if ( esoff!=0 )
- ttf_math_read_extended(ttf,info,start+esoff);
- if ( kioff!=0 )
- ttf_math_read_mathkern(ttf,info,start+kioff);
-}
-
-static struct glyphvariants *ttf_math_read_gvtable(FILE *ttf,struct ttfinfo *info, uint32 start,
- enum gsub_inusetype justinuse, SplineChar *basesc, int isv ) {
- struct glyphvariants *gv = chunkalloc(sizeof(struct glyphvariants));
- int ga_offset;
- int vcnt;
- uint16 *glyphs;
- int i, j, len;
- char *pt;
- int ic_offset, pcnt;
- SplineChar *sc;
- char ebuf[20], buffer[50], *ext;
-
- fseek(ttf,start,SEEK_SET);
- ga_offset = getushort(ttf);
- vcnt = getushort(ttf);
- if ( vcnt!=0 ) {
- if ( justinuse==git_justinuse ) {
- for ( i=0; i<vcnt; ++i ) {
- int gid = getushort(ttf);
- /* sizes[i] = */ getushort(ttf);
- if ( gid>=0 && gid<info->glyph_cnt )
- info->inuse[gid] = true;
- }
- } else if ( justinuse==git_findnames ) {
- for ( i=0; i<vcnt; ++i ) {
- int gid = getushort(ttf);
- /* sizes[i] = */ getushort(ttf);
- if ( basesc!=NULL && basesc->name!=NULL &&
- gid>=0 && gid<info->glyph_cnt &&
- (sc = info->chars[gid])!=NULL && sc->name==NULL ) {
- snprintf(buffer,sizeof(buffer),"%.30s.%csize%d",
- basesc->name, isv?'v':'h', i);
- sc->name = copy(buffer);
- }
- }
- } else {
- glyphs = galloc(vcnt*sizeof(uint16));
- len = 0;
- for ( i=0; i<vcnt; ++i ) {
- glyphs[i] = getushort(ttf);
- /* sizes[i] = */ getushort(ttf);
- if ( glyphs[i]<info->glyph_cnt && (sc = info->chars[ glyphs[i]])!=NULL )
- len += strlen(sc->name)+1;
- }
- if ( len!=0 ) {
- gv->variants = pt = galloc(len);
- for ( i=len=0; i<vcnt; ++i ) {
- if ( glyphs[i]<info->glyph_cnt && (sc = info->chars[ glyphs[i]])!=NULL ) {
- strcpy(pt+len,sc->name);
- len += strlen(sc->name);
- pt[len++] = ' ';
- }
- }
- pt[len-1] = '\0';
- }
- free(glyphs);
- }
- }
- if ( ga_offset!=0 ) {
- start += ga_offset;
- fseek(ttf,start,SEEK_SET);
- gv->italic_correction = getushort(ttf);
- ic_offset = getushort(ttf);
- gv->part_cnt = pcnt = getushort(ttf);
- if ( justinuse==git_normal )
- gv->parts = gcalloc(pcnt,sizeof(struct gv_part));
- for ( i=j=0; i<pcnt; ++i ) {
- int gid, start, end, full, flags;
- gid = getushort(ttf);
- start = getushort(ttf);
- end = getushort(ttf);
- full = getushort(ttf);
- flags = getushort(ttf);
- if ( feof(ttf)) {
- LogError( _("Bad glyph variant subtable of MATH table.\n") );
- info->bad_ot = true;
- chunkfree(gv,sizeof(*gv));
-return( NULL );
- }
- if ( justinuse==git_justinuse ) {
- if ( gid<info->glyph_cnt )
- info->inuse[gid] = true;
- } else if ( justinuse==git_findnames ) {
- if ( basesc!=NULL && basesc->name!=NULL &&
- gid>=0 && gid<info->glyph_cnt &&
- (sc = info->chars[gid])!=NULL && sc->name==NULL ) {
- if ( pcnt==1 )
- ext = "repeat";
- if ( i==0 )
- ext = isv ? "bot" : "left";
- else if ( i==pcnt-1 )
- ext = isv ? "top" : "right";
- else if ( i==1 && pcnt==3 )
- ext = "mid";
- else {
- sprintf( ebuf, "%cpart%d", isv?'v':'h', i );
- ext = ebuf;
- }
- snprintf(buffer,sizeof(buffer),"%.30s.%s",
- basesc->name, ext );
- sc->name = copy(buffer);
- }
- } else {
- if ( gid<info->glyph_cnt && (sc = info->chars[gid])!=NULL ) {
- gv->parts[j].component = copy( sc->name );
- gv->parts[j].startConnectorLength = start;
- gv->parts[j].endConnectorLength = end;
- gv->parts[j].fullAdvance = full;
- gv->parts[j++].is_extender = flags&1;
- }
- }
- }
- gv->part_cnt = j;
-#ifdef FONTFORGE_CONFIG_DEVICETABLES
- if ( ic_offset!=0 && justinuse==git_normal ) {
- gv->italic_adjusts = chunkalloc(sizeof(DeviceTable));
- ReadDeviceTable(ttf,gv->italic_adjusts,start+ic_offset,info);
- }
-#endif
- }
- if ( justinuse==git_justinuse ) {
- chunkfree(gv,sizeof(*gv));
-return( NULL );
- }
-return( gv );
-}
-
-static void ttf_math_read_variants(FILE *ttf,struct ttfinfo *info, uint32 start,
- enum gsub_inusetype justinuse) {
- int vcoverage, hcoverage, vcnt, hcnt;
- int *hoffs, *voffs;
- uint16 *hglyphs, *vglyphs;
- int i;
-
- fseek(ttf,start,SEEK_SET);
- if ( info->math==NULL )
- info->math = gcalloc(1,sizeof(struct MATH));
- info->math->MinConnectorOverlap = getushort(ttf);
- vcoverage = getushort(ttf);
- hcoverage = getushort(ttf);
- vcnt = getushort(ttf);
- hcnt = getushort(ttf);
- hoffs = galloc(hcnt*sizeof(int));
- voffs = galloc(vcnt*sizeof(int));
-
- for ( i=0; i<vcnt; ++i )
- voffs[i] = getushort(ttf);
- for ( i=0; i<hcnt; ++i )
- hoffs[i] = getushort(ttf);
- vglyphs = hglyphs = NULL;
- if ( vcoverage!=0 )
- vglyphs = getCoverageTable(ttf,start+vcoverage,info);
- if ( hcoverage!=0 )
- hglyphs = getCoverageTable(ttf,start+hcoverage,info);
-
- if ( vglyphs!=NULL ) {
- for ( i=0; i<vcnt; ++i ) if ( vglyphs[i]<info->glyph_cnt && voffs[i]!=0) {
- if ( justinuse == git_normal || justinuse == git_findnames ) {
- SplineChar *sc = info->chars[ vglyphs[i]];
- if ( sc!=NULL )
- sc->vert_variants = ttf_math_read_gvtable(ttf,info,start+voffs[i],justinuse,sc,true);
- } else if ( info->inuse[ vglyphs[i]])
- ttf_math_read_gvtable(ttf,info,start+voffs[i],justinuse,NULL,true);
- }
- }
- if ( hglyphs!=NULL ) {
- for ( i=0; i<hcnt; ++i ) if ( hglyphs[i]<info->glyph_cnt && hoffs[i]!=0) {
- if ( justinuse == git_normal || justinuse == git_findnames ) {
- SplineChar *sc = info->chars[ hglyphs[i]];
- if ( sc!=NULL )
- sc->horiz_variants = ttf_math_read_gvtable(ttf,info,start+hoffs[i],justinuse,sc,false);
- } else if ( info->inuse[ hglyphs[i]])
- ttf_math_read_gvtable(ttf,info,start+hoffs[i],justinuse,NULL,false);
- }
- }
-
- free(vglyphs); free(voffs);
- free(hglyphs); free(hoffs);
-}
-
-static void _otf_read_math(FILE *ttf,struct ttfinfo *info,
- enum gsub_inusetype justinuse) {
- int constants, glyphinfo, variants;
- if ( info->math_start==0 )
-return;
- fseek(ttf,info->math_start,SEEK_SET);
-
- info->g_bounds = info->math_start+info->math_length;
-
- if ( getlong(ttf)!=0x00010000 )
-return;
- constants = getushort(ttf);
- glyphinfo = getushort(ttf);
- variants = getushort(ttf);
-
- if ( justinuse == git_normal ) {
- if ( constants!=0 )
- ttf_math_read_constants(ttf,info,info->math_start+constants);
- if ( glyphinfo!=0 )
- ttf_math_read_glyphinfo(ttf,info,info->math_start+glyphinfo);
- }
- if ( variants!=0 )
- ttf_math_read_variants(ttf,info,info->math_start+variants,justinuse);
- if ( ftell(ttf)>info->g_bounds ) {
- LogError("MATH table extends beyond table bounds");
- info->bad_ot = true;
- }
- info->g_bounds = 0;
-}
-
-void otf_read_math(FILE *ttf,struct ttfinfo *info) {
- _otf_read_math(ttf,info,git_normal);
-}
-
-void otf_read_math_used(FILE *ttf,struct ttfinfo *info) {
- _otf_read_math(ttf,info,git_justinuse);
-}
-
-void GuessNamesFromMATH(FILE *ttf,struct ttfinfo *info) {
- _otf_read_math(ttf,info,git_findnames);
-}
-
-static struct baselangextent *readttfbaseminmax(FILE *ttf,uint32 offset,struct ttfinfo *info,
- uint32 script_tag,uint32 lang_tag) {
- int j,feat_cnt;
- struct baselangextent *lang, *cur, *last;
- (void)info; /* for -Wall */
- (void)script_tag; /* for -Wall */
- fseek(ttf,offset,SEEK_SET);
- lang = chunkalloc(sizeof(struct baselangextent));
- lang->lang = lang_tag;
- lang->descent = (short) getushort(ttf);
- lang->ascent = (short) getushort(ttf);
-
- feat_cnt = getushort(ttf);
- last = NULL;
- for ( j=0; j<feat_cnt; ++j ) {
- cur = chunkalloc(sizeof(struct baselangextent));
- if ( last==NULL )
- lang->features = cur;
- else
- last->next = cur;
- last = cur;
- cur->lang = getlong(ttf); /* Actually feature tag here */
- cur->descent = (short) getushort(ttf);
- cur->ascent = (short) getushort(ttf);
- }
-return( lang );
-}
-
-void readttfbase(FILE *ttf,struct ttfinfo *info) {
- int version;
- uint32 axes[2];
- uint32 basetags, basescripts;
- int basescriptcnt;
- struct tagoff { uint32 tag; uint32 offset; } *bs;
- int axis,i,j, tot;
- struct Base *curBase;
- struct basescript *curScript, *last;
- struct baselangextent *cur, *lastLang;
-
- if ( info->base_start==0 )
-return;
- fseek(ttf,info->base_start,SEEK_SET);
-
- version = getlong(ttf);
- if ( version!=0x00010000 )
-return;
- axes[0] = getushort(ttf); /* Horizontal */
- axes[1] = getushort(ttf); /* Vertical */
-
- for ( axis=0; axis<2; ++axis ) {
- if ( axes[axis]==0 )
- continue;
- fseek(ttf,info->base_start+axes[axis],SEEK_SET);
- curBase = chunkalloc(sizeof(struct Base));
- if ( axis==0 ) info->horiz_base = curBase; else info->vert_base = curBase;
- basetags = getushort(ttf);
- basescripts = getushort(ttf);
- if ( basetags==0 ) {
- curBase->baseline_cnt = 0;
- curBase->baseline_tags = NULL;
- } else {
- fseek(ttf,info->base_start+axes[axis]+basetags,SEEK_SET);
- curBase->baseline_cnt = getushort(ttf);
- curBase->baseline_tags = gcalloc(curBase->baseline_cnt,sizeof(uint32));
- for ( i=0; i<curBase->baseline_cnt; ++i )
- curBase->baseline_tags[i] = getlong(ttf);
- }
- if ( basescripts!=0 ) {
- fseek(ttf,info->base_start+axes[axis]+basescripts,SEEK_SET);
- basescriptcnt = getushort(ttf);
- bs = gcalloc(basescriptcnt,sizeof(struct tagoff));
- for ( i=0; i<basescriptcnt; ++i ) {
- bs[i].tag = getlong(ttf);
- bs[i].offset = getushort(ttf);
- if ( bs[i].offset != 0 )
- bs[i].offset += info->base_start+axes[axis]+basescripts;
- }
- last = NULL;
- for ( i=0; i<basescriptcnt; ++i ) if ( bs[i].offset!=0 ) {
- int basevalues, defminmax;
- int langsyscnt;
- struct tagoff *ls;
- fseek(ttf,bs[i].offset,SEEK_SET);
- basevalues = getushort(ttf);
- defminmax = getushort(ttf);
- langsyscnt = getushort(ttf);
- ls = gcalloc(langsyscnt,sizeof(struct tagoff));
- for ( j=0; j<langsyscnt; ++j ) {
- ls[j].tag = getlong(ttf);
- ls[j].offset = getushort(ttf);
- }
- curScript = chunkalloc(sizeof(struct basescript));
- if ( last==NULL )
- curBase->scripts = curScript;
- else
- last->next = curScript;
- last = curScript;
- curScript->script = bs[i].tag;
- if ( basevalues!=0 ) {
- int coordcnt;
- int *coords;
-
- fseek( ttf,bs[i].offset+basevalues,SEEK_SET);
- curScript->def_baseline = getushort(ttf);
- tot = coordcnt = getushort(ttf);
- if ( coordcnt!=curBase->baseline_cnt ) {
- info->bad_ot = true;
- LogError( "!!!!! Coord count (%d) for '%c%c%c%c' script does not match base tag count (%d) in 'BASE' table\n",
- coordcnt,
- bs[i].tag>>24, bs[i].tag>>16, bs[i].tag>>8, bs[i].tag,
- curBase->baseline_cnt );
- if ( tot<curBase->baseline_cnt )
- tot = curBase->baseline_cnt;
- }
- coords = gcalloc(coordcnt,sizeof(int));
- curScript->baseline_pos = gcalloc(tot,sizeof(int16));
- for ( j=0; j<coordcnt; ++j )
- coords[j] = getushort(ttf);
- for ( j=0; j<coordcnt; ++j ) if ( coords[j]!=0 ) {
- int format;
- fseek( ttf,bs[i].offset+basevalues+coords[j],SEEK_SET);
- format = getushort(ttf);
- curScript->baseline_pos[j] = (short) getushort(ttf);
- if ( format!=1 && format!=2 && format!=3 ) {
- info->bad_ot = true;
- LogError("!!!!! Bad Base Coord format (%d) for '%c%c%c%c' in '%c%c%c%c' script in 'BASE' table\n",
- format,
- curBase->baseline_tags[j]>>24, curBase->baseline_tags[j]>>16, curBase->baseline_tags[j]>>8, curBase->baseline_tags[j],
- bs[i].tag>>24, bs[i].tag>>16, bs[i].tag>>8, bs[i].tag );
- }
- }
- free(coords);
- }
- lastLang = NULL;
- if ( defminmax!=0 )
- curScript->langs = lastLang = readttfbaseminmax(ttf,bs[i].offset+defminmax,info,bs[i].tag,DEFAULT_LANG);
- if ( langsyscnt!=0 ) {
- for ( j=0; j<langsyscnt; ++j ) if ( ls[j].offset!=0 ) {
- cur = readttfbaseminmax(ttf,bs[i].offset+ls[j].offset,info,bs[i].tag,ls[j].tag);
- if ( last==NULL )
- curScript->langs = cur;
- else
- lastLang->next = cur;
- lastLang = cur;
- }
- }
- free(ls);
- }
- free(bs);
- }
- }
-}
diff --git a/Build/source/texk/web2c/luatexdir/luafontloader/fontforge/fontforge/pfaedit.h b/Build/source/texk/web2c/luatexdir/luafontloader/fontforge/fontforge/pfaedit.h
deleted file mode 100644
index 73d0928a5e2..00000000000
--- a/Build/source/texk/web2c/luatexdir/luafontloader/fontforge/fontforge/pfaedit.h
+++ /dev/null
@@ -1,80 +0,0 @@
-/* Copyright (C) 2000-2008 by George Williams */
-/*
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are met:
-
- * Redistributions of source code must retain the above copyright notice, this
- * list of conditions and the following disclaimer.
-
- * Redistributions in binary form must reproduce the above copyright notice,
- * this list of conditions and the following disclaimer in the documentation
- * and/or other materials provided with the distribution.
-
- * The name of the author may not be used to endorse or promote products
- * derived from this software without specific prior written permission.
-
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
- * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
- * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
- * EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
- * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
- * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
- * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
- * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-#ifndef _PFAEDIT_H_
-#define _PFAEDIT_H_
-
-#include "configure-pfaedit.h"
-#include <basics.h>
-#include <stdio.h>
-#include <string.h>
-#include <intl.h>
-#include "splinefont.h"
-#include "uiinterface.h"
-
-static const int unicode4_size = 17*65536;
- /* Unicode goes up to 0x10ffff */
-
-
-extern void ProcessNativeScript(int argc, char *argv[], FILE *script);
-extern void CheckIsScript(int argc, char *argv[]);
-
-extern char *AdobeStandardEncoding[256];
-extern int32 unicode_from_adobestd[256];
-
-struct unicode_nameannot {
- const char *name, *annot;
-};
-extern const struct unicode_nameannot * const *const *_UnicodeNameAnnot;
-
-extern int default_fv_font_size;
-extern int default_fv_antialias;
-extern int default_fv_bbsized;
-extern Encoding *default_encoding, custom;
-extern int adjustwidth;
-extern int adjustlbearing;
-extern int autohint_before_rasterize;
-extern int autohint_before_generate;
-extern int seperate_hint_controls;
-extern int no_windowing_ui;
-extern int use_utf8_in_script;
-
-extern int new_em_size;
-extern int new_fonts_are_order2;
-extern int loaded_fonts_same_as_new;
-
-extern char *BDFFoundry, *TTFFoundry;
-extern char *xuid;
-
-extern int pagewidth, pageheight, printtype; /* Printer defaults */
-extern char *printcommand, *printlazyprinter;
-
-extern Encoding *enclist;
-
-
-#define SCRIPT_MENU_MAX 10
-
-#endif
diff --git a/Build/source/texk/web2c/luatexdir/luafontloader/fontforge/fontforge/plugins.h b/Build/source/texk/web2c/luatexdir/luafontloader/fontforge/fontforge/plugins.h
deleted file mode 100644
index 58ae2448484..00000000000
--- a/Build/source/texk/web2c/luatexdir/luafontloader/fontforge/fontforge/plugins.h
+++ /dev/null
@@ -1,99 +0,0 @@
-/* Copyright (C) 2005-2008 by George Williams */
-/*
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are met:
-
- * Redistributions of source code must retain the above copyright notice, this
- * list of conditions and the following disclaimer.
-
- * Redistributions in binary form must reproduce the above copyright notice,
- * this list of conditions and the following disclaimer in the documentation
- * and/or other materials provided with the distribution.
-
- * The name of the author may not be used to endorse or promote products
- * derived from this software without specific prior written permission.
-
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
- * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
- * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
- * EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
- * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
- * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
- * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
- * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/* If a user wants to write a fontforge plugin s/he should include this file */
-
-/*
- I envision that there will eventually be three types of plug-ins. At the
- moment I am only supporing two of them.
-
- * A plug in which adds a new encoding to the encoding/force encoding
- menus.
- * A plug in which adds a new scripting command
- * A plug in which adds a new menu item.
- (I haven't figure out how I want to do this last. So I'm not currently
- supporting it.)
-
- A plug-in should be a dynamic library.
- Plug-ins will be loaded at start up if they are in the default plugin
- directory, or a script may explicitly invoke a LoadPlugin() call
- and pass a filename.
- Each plug-in should contain an entry-point:
- void FontForgeInit(void);
- When FF loads a plug-in it will call this entry point.
- I expect that this routine in term will call one (or more) of the install
- routines (though it can do whatever it likes):
- * AddEncoding(name,enc-to-unicode-func,unicode-to-enc-func)
- * AddScriptingCommand(name,func,needs-font)
-
- Once loaded, there is no way to remove a plug in -- but you can map a
- plug in's name to do something else.
-
- I am presuming that plugins will be linked against libfontforge and
- that it will have access to all routines declared in fontforge's
- header files. I do not expect to turn this into a real library with
- a true API. It's just a catch all bag of routines I have needed.
- It's not documented either.
-*/
-
- /* Entry point all plugins must contain */
-extern int FontForgeInit(void);
- /* If the load fails, then this routine should return 0, else 1 */
- /* if it returns 0, fontforge will dlclose the shared lib */
- /* FontForge will not complain itself. FontForgeInit should */
- /* call LogError (or gwwv_post_error or whatever) if it wants */
- /* to report failure */
-
- /* AddScriptingCommand is documented within */
-#include "scripting.h"
-
- /* AddEncoding is documented here */
-typedef int (*EncFunc)(int);
-extern int AddEncoding(char *name,EncFunc enc_to_uni,EncFunc uni_to_enc,int max);
- /* The "Encoding" here is a little different from what you normally see*/
- /* It isn't a mapping from a byte stream to unicode, but from an int */
- /* to unicode. If we have an 8/16 encoding (EUC or SJIS) then the */
- /* single byte entries will be numbers less than <256 and the */
- /* multibyte entries will be numbers >=256. So an encoding might be */
- /* valid for the domain [0x20..0x7f] [0xa1a1..0xfefe] */
- /* In other words, we're interested in the ordering displayed in the */
- /* fontview. Nothing else */
- /* The max value need not be exact (though it should be at least as big)*/
- /* if you create a new font with the given encoding, then the font will */
- /* have max slots in it by default */
- /* A return value of -1 (from an EncFunc) indicates no mapping */
- /* AddEncoding returns 1 if the encoding was added, 2 if it replaced */
- /* an existing encoding, 0 if you attempt to replace a builtin */
- /* encoding */
-
-
- /* Internal routines. Plugins shouldn't need these */
-extern void LoadPlugin(char *dynamic_lib_name);
- /* Loads a single plugin file */
-extern void LoadPluginDir(char *dir);
- /* Loads any dynamic libs from this directory. if dir is NULL loads from */
- /* default directory */
diff --git a/Build/source/texk/web2c/luatexdir/luafontloader/fontforge/fontforge/psfont.h b/Build/source/texk/web2c/luatexdir/luafontloader/fontforge/fontforge/psfont.h
deleted file mode 100644
index 5362ccd3cf1..00000000000
--- a/Build/source/texk/web2c/luatexdir/luafontloader/fontforge/fontforge/psfont.h
+++ /dev/null
@@ -1,191 +0,0 @@
-/* Copyright (C) 2000-2008 by George Williams */
-/*
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are met:
-
- * Redistributions of source code must retain the above copyright notice, this
- * list of conditions and the following disclaimer.
-
- * Redistributions in binary form must reproduce the above copyright notice,
- * this list of conditions and the following disclaimer in the documentation
- * and/or other materials provided with the distribution.
-
- * The name of the author may not be used to endorse or promote products
- * derived from this software without specific prior written permission.
-
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
- * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
- * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
- * EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
- * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
- * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
- * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
- * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-#ifndef _PSFONT_H_
-#define _PSFONT_H_
-
-#include "splinefont.h"
-
-/* pfb section headers.
- There seem to be three and a half of them. the first is a the start of the
- file and is 6 bytes long "\200\001x\005\000\000", the second is right after
- the newline after eexec and is 6 bytes "\200\002I\224\000\000", the third
- is right before the zeros (after the encoded data) and is "\200\001\024\002\000\000"
- the last is at the end of file and is only two bytes "\200\003"
- I think that the \200 byte indicates a header, the next byte is 1 for ascii,
- 2 for binary and 3 for eof, then next 4 bytes are the length (not present
- for eof headers) with the first byte the least significant.
-*/
-
-struct charprocs {
- int cnt, next;
- char **keys;
- SplineChar **values;
-};
-
-struct fontinfo {
- char *familyname;
- char *fullname;
- char *notice;
- char *weight;
- char *version;
- real italicangle;
- unsigned int isfixedpitch:1;
- real underlineposition;
- real underlinethickness;
- int em, ascent, descent; /* Generated by Fontographer (and us) */
- int fstype; /* 2=>no embedding, 4=>print, 8=>edit */
- /* Multiple master */
- char *blenddesignpositions;
- char *blenddesignmap;
- char *blendaxistypes;
-};
-
-struct private {
- struct psdict *private;
- struct pschars *subrs; /* (optional, required if othersubrs is present) */
- /* 0-2 part of Flex, 3 hint replacement, 4 and up for charstrings */
- int leniv; /* (optional) must be 4 for old interpreters (number of rand chars at start of charstrings entries) */
-#if 0
- int bluefuzz; /* (optional) (expand bluezones by this much, def=1) */
- real bluescale; /* (optional) if the current pointsize in pixels is less than this value then do overshoot hinting */
- int blueshift; /* (optional) */
- real bluevalues[14]; /* <=7 pairs of integers, first less than second, (may be empty) */
- /* first pair is baseline overshoots, other pairs above baseline */
- real expansionfactor; /* (optional) only for languagegroup==1 (CJK) */
- real familyblues[14]; /* (optional) bluevalues for family, can override local entry at small pointsizes */
- real familyotherblues[10];/* (optional) otherblues for family */
- unsigned int forcebold:1; /* (optional) */
- int languagegroup; /* (optional) (0=>latin, greek, cyril, etc.), (1=>CJK)*/
- int leniv; /* (optional) must be 4 for old interpreters (number of rand chars at start of charstrings entries) */
- char *minfeature; /* obsolete, required must be {16 16} */
- char *nd; /* "noaccess def" (may also be named "|-") */
- char *np; /* "noaccess put" (may also be named "|") */
- real otherblues[10]; /* (optional) descender blue zones */
- struct pschars *othersubrs; /* (optional) shouldn't contain user defined subs */
- int password; /* obsolete, required must be 5839 */
- char *rd; /* "{string currentfile exch readstring pop}" (may also be named "-|") */
- unsigned int rndstemup:1; /* (optional) obsolete, false if languagegroud==1 */
- real stdhw[1]; /* (optional) dominant horizontal stem width */
- real stdvw[1]; /* (optional) dominant vert */
- real stemsnaph[12]; /* (optional) common h stem widths (at most 12, includes stdhw, sorted by increasing size) */
- real stemsnapv[12]; /* (optional) common v stem widths*/
- struct pschars *subrs; /* (optional, required if othersubrs is present) */
- /* 0-2 part of Flex, 3 hint replacement, 4 and up for charstrings */
- int uniqueid; /* (optional) seems same as fontdict entry. why's it here too? what of XUID? */
-/* CID entries */
- int subrmapoffset; /* Offset to the start of this font's subr strings map */
- int sdbytes; /* bytes in each pointer in the map */
- int subrcnt; /* number of subroutines, number of pointers-1 in the map */
-#endif
-};
-
-typedef struct fontdict {
- int fonttype;
- real fontmatrix[6];
- char *fontname; /* (optional) */
- struct fontinfo *fontinfo;
- int languagelevel; /* (optional) */
- int wmode; /* (optional) chooses between alternate metric sets */
-/* non-type0 entries */
- char *encoding[256];
- real fontbb[4];
- int uniqueid; /* (optional) open range between 4,000,000 and 4,999,999 */
- int xuid[20]; /* (optional) */
-/* Type1 specific values */
- int painttype; /* 0 (filled) 2 (stroked) */
- real strokewidth; /* (optional) only if painttype==2 */
- struct psdict *metrics; /* (optional) */
- struct psdict *metrics2; /* (optional) */
- struct pschars *chars;
- struct charprocs *charprocs;
- struct private *private;
- unsigned int wasbinary: 1;
- unsigned int wascff: 1;
- Encoding *encoding_name;
-/* CID stuff */
- int fdcnt; /* For the underlying dictionaries */
- struct fontdict **fds;
- char *cidfontname;
- int cidfonttype;
- real cidversion;
- char *registry;
- char *ordering;
- int supplement;
- int mapoffset;
- int fdbytes;
- int gdbytes;
- int cidcnt;
- uint8 **cidstrs;
- int16 *cidlens;
- int16 *cidfds;
-/* CFF stuff */
- struct splinefont *sf;
-/* MM stuff */
- char *blendfunc;
- char *weightvector;
- char *cdv;
- char *ndv;
- struct psdict *blendprivate;
- struct psdict *blendfontinfo;
-#ifdef _HAS_LONGLONG
- long long creationtime; /* seconds since 1970 */
- long long modificationtime;
-#else
- long creationtime;
- long modificationtime;
-#endif
-} FontDict;
-
-struct cidbytes {
- int fdbytes, gdbytes, cidcnt;
- int cidmapoffset;
- int fdcnt;
- struct fddata {
- int leniv;
- int subrmapoff, sdbytes, subrcnt;
- int flexmax;
- unsigned int iscjk:1;
- struct pschars *subrs;
- } *fds;
- int *fdind;
- int errors;
-};
-
-struct fd2data {
- int defwid, nomwid; /* For Type2 charstrings */
- struct pschars *subrs;
- FILE *private; /* Subroutines get stored in the private file immediately after the private dict */
- int eodictmark, fillindictmark;
- int privatelen;
-};
-
-extern char *AdobeStandardEncoding[256];
-
-extern FontDict *_ReadPSFont(FILE *ps);
-extern FontDict *ReadPSFont(char *fontname);
-extern void PSFontFree(FontDict *fd);
-#endif
diff --git a/Build/source/texk/web2c/luatexdir/luafontloader/fontforge/fontforge/psread.c b/Build/source/texk/web2c/luatexdir/luafontloader/fontforge/fontforge/psread.c
deleted file mode 100644
index 96cf5c30d4c..00000000000
--- a/Build/source/texk/web2c/luatexdir/luafontloader/fontforge/fontforge/psread.c
+++ /dev/null
@@ -1,4799 +0,0 @@
-/* Copyright (C) 2000-2008 by George Williams */
-/*
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are met:
-
- * Redistributions of source code must retain the above copyright notice, this
- * list of conditions and the following disclaimer.
-
- * Redistributions in binary form must reproduce the above copyright notice,
- * this list of conditions and the following disclaimer in the documentation
- * and/or other materials provided with the distribution.
-
- * The name of the author may not be used to endorse or promote products
- * derived from this software without specific prior written permission.
-
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
- * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
- * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
- * EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
- * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
- * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
- * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
- * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-#include "pfaedit.h"
-#include <math.h>
-#include <locale.h>
-#include <ustring.h>
-#include <utype.h>
-#include "psfont.h"
-#include "sd.h"
-#ifdef HAVE_IEEEFP_H
-# include <ieeefp.h> /* Solaris defines isnan in ieeefp rather than math.h */
-#endif
-
-int THdo_hint_guessing = 0;
-int THdo_set_reversing = 0;
-int THdo_catagorize = 0;
-
-typedef struct _io {
- char *macro, *start;
- FILE *ps, *fog;
- char fogbuf[60];
- int backedup, cnt, isloop, isstopped, fogns;
- struct _io *prev;
-} _IO;
-
-typedef struct io {
- struct _io *top;
- int endedstopped;
- int advance_width; /* Can be set from a PS comment by MF2PT1 */
-} IO;
-
-typedef struct growbuf {
- char *pt;
- char *base;
- char *end;
-} GrowBuf;
-
-#define GARBAGE_MAX 64
-struct garbage {
- int cnt;
- struct garbage *next;
- struct pskeyval *entries[GARBAGE_MAX];
- int16 cnts[GARBAGE_MAX];
-};
-
-static void GrowBuffer(GrowBuf *gb,int len) {
- if ( len<400 ) len = 400;
- if ( gb->base==NULL ) {
- gb->base = gb->pt = galloc(len);
- gb->end = gb->base + len;
- } else {
- int off = gb->pt-gb->base;
- len += (gb->end-gb->base);
- gb->base = grealloc(gb->base,len);
- gb->end = gb->base + len;
- gb->pt = gb->base+off;
- }
-}
-
-static void AddTok(GrowBuf *gb,char *buf,int islit) {
- int len = islit + strlen(buf) + 1;
-
- if ( gb->pt+len+1 >= gb->end )
- GrowBuffer(gb,len+1);
- if ( islit )
- *(gb->pt++) = '/';
- strcpy(gb->pt,buf);
- gb->pt += strlen(buf);
- *gb->pt++ = ' ';
-}
-
-static struct pskeyval *lookup(struct pskeydict *dict,char *tokbuf) {
- int i;
-
- for ( i=0; i<dict->cnt; ++i )
- if ( strcmp(dict->entries[i].key,tokbuf)==0 )
-return( &dict->entries[i] );
-
-return( NULL );
-}
-
-static void dictfree(struct pskeydict *dict) {
- int i;
-
- for ( i=0; i<dict->cnt; ++i ) {
- if ( dict->entries[i].type==ps_string || dict->entries[i].type==ps_instr ||
- dict->entries[i].type==ps_lit )
- free(dict->entries[i].u.str);
- else if ( dict->entries[i].type==ps_array || dict->entries[i].type==ps_dict )
- dictfree(&dict->entries[i].u.dict);
- }
-}
-
-static void garbagefree(struct garbage *all) {
- struct garbage *junk, *next;
- int i,j;
-
- for ( junk = all; junk!=NULL; junk = next ) {
- next = junk->next;
- for ( j=0; j<junk->cnt; ++j ) {
- for ( i=0; i<junk->cnts[j]; ++i ) {
- if ( junk->entries[j][i].type==ps_string || junk->entries[j][i].type==ps_instr ||
- junk->entries[j][i].type==ps_lit )
- free(junk->entries[j][i].u.str);
- }
- free(junk->entries[j]);
- }
- if ( junk!=all )
- chunkfree(junk,sizeof(struct garbage));
- }
-}
-/**************************** Postscript Importer *****************************/
-/* It's really dumb. It ignores almost everything except linetos and curvetos */
-/* anything else, function calls, ... is thrown out, if this breaks a lineto */
-/* or curveto or moveto (if there aren't enough things on the stack) then we */
-/* ignore that too */
-
-enum pstoks { pt_eof=-1, pt_moveto, pt_rmoveto, pt_curveto, pt_rcurveto,
- pt_lineto, pt_rlineto, pt_arc, pt_arcn, pt_arct, pt_arcto,
- pt_newpath, pt_closepath, pt_dup, pt_pop, pt_index,
- pt_exch, pt_roll, pt_clear, pt_copy, pt_count,
- pt_setcachedevice, pt_setcharwidth,
- pt_translate, pt_scale, pt_rotate, pt_concat, pt_end, pt_exec,
- pt_add, pt_sub, pt_mul, pt_div, pt_idiv, pt_mod, pt_neg,
- pt_abs, pt_round, pt_ceiling, pt_floor, pt_truncate, pt_max, pt_min,
- pt_ne, pt_eq, pt_gt, pt_ge, pt_lt, pt_le, pt_and, pt_or, pt_xor, pt_not,
- pt_exp, pt_sqrt, pt_ln, pt_log, pt_atan, pt_sin, pt_cos,
- pt_true, pt_false,
- pt_if, pt_ifelse, pt_for, pt_loop, pt_repeat, pt_exit,
- pt_stopped, pt_stop,
- pt_def, pt_bind, pt_load,
- pt_setlinecap, pt_setlinejoin, pt_setlinewidth, pt_setdash,
- pt_currentlinecap, pt_currentlinejoin, pt_currentlinewidth, pt_currentdash,
- pt_setgray, pt_currentgray, pt_sethsbcolor, pt_currenthsbcolor,
- pt_setrgbcolor, pt_currentrgbcolor, pt_setcmykcolor, pt_currentcmykcolor,
- pt_currentpoint,
- pt_fill, pt_stroke, pt_clip,
-
- pt_imagemask,
-
- pt_transform, pt_itransform, pt_dtransform, pt_idtransform,
-
- /* things we sort of pretend to do, but actually do something wrong */
- pt_gsave, pt_grestore, pt_save, pt_restore, pt_currentmatrix, pt_setmatrix,
- pt_null,
-
- pt_currentflat, pt_setflat,
- pt_currentglobal, pt_setglobal,
- pt_currentmiterlimit, pt_setmiterlimit,
- pt_currentobjectformat, pt_setobjectformat,
- pt_currentoverprint, pt_setoverprint,
- pt_currentpacking, pt_setpacking,
- pt_currentshared,
- pt_currentsmoothness, pt_setsmoothness,
- pt_currentstrokeadjust, pt_setstrokeadjust,
-
- pt_mark, pt_counttomark, pt_cleartomark, pt_array, pt_aload, pt_astore,
- pt_print, pt_cvi, pt_cvlit, pt_cvn, pt_cvr, pt_cvrs, pt_cvs, pt_cvx, pt_stringop,
-
- pt_opencurly, pt_closecurly, pt_openarray, pt_closearray, pt_string,
- pt_number, pt_unknown, pt_namelit, pt_output, pt_outputd };
-
-static char *toknames[] = { "moveto", "rmoveto", "curveto", "rcurveto",
- "lineto", "rlineto", "arc", "arcn", "arct", "arcto",
- "newpath", "closepath", "dup", "pop", "index",
- "exch", "roll", "clear", "copy", "count",
- "setcachedevice", "setcharwidth",
- "translate", "scale", "rotate", "concat", "end", "exec",
- "add", "sub", "mul", "div", "idiv", "mod", "neg",
- "abs", "round", "ceiling", "floor", "truncate", "max", "min",
- "ne", "eq", "gt", "ge", "lt", "le", "and", "or", "xor", "not",
- "exp", "sqrt", "ln", "log", "atan", "sin", "cos",
- "true", "false",
- "if", "ifelse", "for", "loop", "repeat", "exit",
- "stopped", "stop",
- "def", "bind", "load",
- "setlinecap", "setlinejoin", "setlinewidth", "setdash",
- "currentlinecap", "currentlinejoin", "currentlinewidth", "currentdash",
- "setgray", "currentgray", "sethsbcolor", "currenthsbcolor",
- "setrgbcolor", "currentrgbcolor", "setcmykcolor", "currentcmykcolor",
- "currentpoint",
- "fill", "stroke", "clip",
-
- "imagemask",
-
- "transform", "itransform", "dtransform", "idtransform",
-
- "gsave", "grestore", "save", "restore", "currentmatrix", "setmatrix",
- "null",
-
- "currentflat", "setflat",
- "currentglobal", "setglobal",
- "currentmiterlimit", "setmiterlimit",
- "currentobjectformat", "setobjectformat",
- "currentoverprint", "setoverprint",
- "currentpacking", "setpacking",
- "currentshared",
- "currentsmoothness", "setsmoothness",
- "currentstrokeadjust", "setstrokeadjust",
-
- "mark", "counttomark", "cleartomark", "array", "aload", "astore",
- "print", "cvi", "cvlit", "cvn", "cvr", "cvrs", "cvs", "cvx", "string",
-
- "opencurly", "closecurly", "openarray", "closearray", "string",
- "number", "unknown", "namelit", "=", "==",
-
- NULL };
-
-/* length (of string)
- fill eofill stroke
- gsave grestore
-*/
-
-static int getfoghex(_IO *io) {
- int ch,val;
-
- while ( isspace( ch = getc(io->fog)));
- if ( isdigit(ch))
- val = ch-'0';
- else if ( ch >= 'A' && ch <= 'F' )
- val = ch-'A'+10;
- else if ( ch >= 'a' && ch <= 'f' )
- val = ch-'a'+10;
- else
-return(EOF);
-
- val <<= 4;
- while ( isspace( ch = getc(io->fog)));
- if ( isdigit(ch))
- val |= ch-'0';
- else if ( ch >= 'A' && ch <= 'F' )
- val |= ch-'A'+10;
- else if ( ch >= 'a' && ch <= 'f' )
- val |= ch-'a'+10;
- else
-return(EOF);
-
-return( val );
-}
-
-static int nextch(IO *wrapper) {
- int ch;
- _IO *io = wrapper->top;
-/* This works for fog 4.1. Fonts generated by 2.4 seem to use a different */
-/* vector, and a different number parsing scheme */
- static char *foguvec[]= { "moveto ", "rlineto ", "rrcurveto ", " ", " ",
- "Cache ", "10 div setlinewidth ", "ShowInt ", " ", " ", " ", " ",
- "FillStroke ", " ", " ", "SetWid ", "100 mul add ", "togNS_ ",
- " ", "closepath ", " ", "SG " };
-
- while ( io!=NULL ) {
- if ( io->backedup!=EOF ) {
- ch = io->backedup;
- io->backedup = EOF;
-return( ch );
- } else if ( io->ps!=NULL ) {
- if ( (ch = getc(io->ps))!=EOF )
-return( ch );
- } else if ( io->fog!=NULL ) {
- if ( io->macro!=NULL && *io->macro!='\0' )
-return( *(io->macro++) );
- ch = getfoghex(io);
- if ( ch>=233 ) {
- io->macro = foguvec[ch-233];
-return( *(io->macro++) );
- } else if ( ch!=EOF && ch<200 ) {
- sprintf( io->fogbuf, "%d ", ch-100);
- io->macro=io->fogbuf;
-return( *(io->macro++) );
- } else if (ch!=EOF) {
- sprintf( io->fogbuf, "%d %s ", ch-233+17, io->fogns
- ? "2 exch exp 3 1 roll 100 mul add mul"
- : "100 mul add" );
- io->macro=io->fogbuf;
-return( *(io->macro++) );
- }
- } else {
- if ( (ch = *(io->macro++))!='\0' )
-return( ch );
- if ( --io->cnt>0 ) {
- io->macro = io->start;
-return( nextch(wrapper));
- }
- }
- wrapper->top = io->prev;
- if ( io->isstopped )
- wrapper->endedstopped = true;
- free(io->start);
- free(io);
- io = wrapper->top;
- }
-return( EOF );
-}
-
-static void unnextch(int ch,IO *wrapper) {
- if ( ch==EOF )
-return;
- if ( wrapper->top==NULL )
- LogError( _("Can't back up with nothing on stack\n") );
- else if ( wrapper->top->backedup!=EOF )
- LogError( _("Attempt to back up twice\n") );
- else if ( wrapper->top->ps!=NULL )
- ungetc(ch,wrapper->top->ps);
- else
- wrapper->top->backedup = ch;
-}
-
-static void pushio(IO *wrapper, FILE *ps, char *macro, int cnt) {
- _IO *io = gcalloc(1,sizeof(_IO));
-
- io->prev = wrapper->top;
- io->ps = ps;
- io->macro = io->start = copy(macro);
- io->backedup = EOF;
- if ( cnt==-1 ) {
- io->cnt = 1;
- io->isstopped = true;
- } else if ( cnt==0 ) {
- io->cnt = 1;
- io->isloop = false;
- } else {
- io->cnt = cnt;
- io->isloop = true;
- }
- wrapper->top = io;
-}
-
-static void pushfogio(IO *wrapper, FILE *fog) {
- _IO *io = gcalloc(1,sizeof(_IO));
-
- io->prev = wrapper->top;
- io->fog = fog;
- io->backedup = EOF;
- io->cnt = 1;
- io->isloop = false;
- wrapper->top = io;
-}
-
-static void ioescapeloop(IO *wrapper) {
- _IO *io = wrapper->top, *iop;
- int wasloop;
-
- while ( io->prev!=NULL && !io->isstopped ) {
- iop = io->prev;
- wasloop = io->isloop;
- free(io->start);
- free(io);
- if ( wasloop ) {
- wrapper->top = iop;
-return;
- }
- io = iop;
- }
-
-/* GT: This is part of the PostScript language. "exit" should not be translated */
-/* GT: as it is a PostScript keyword. (FF contains a small PostScript interpreter */
-/* GT: so it can understand some PostScript fonts, and can generate errors when */
-/* GT: handed bad PostScript). */
- LogError( _("Use of \"exit\" when not in a loop\n") );
- wrapper->top = io;
-}
-
-static int ioescapestopped(IO *wrapper, struct psstack *stack, int sp, const size_t bsize) {
- _IO *io = wrapper->top, *iop;
- int wasstopped;
-
- while ( io->prev!=NULL ) {
- iop = io->prev;
- wasstopped = io->isstopped;
- free(io->start);
- free(io);
- if ( wasstopped ) {
- wrapper->top = iop;
- if ( sp<(int)bsize ) {
- stack[sp].type = ps_bool;
- stack[sp++].u.tf = true;
- }
-return(sp);
- }
- io = iop;
- }
-
-/* GT: This is part of the PostScript language. Neither "stop" nor "stopped" */
-/* GT: should be translated as both are PostScript keywords. */
- LogError( _("Use of \"stop\" when not in a stopped\n") );
- wrapper->top = io;
-return( sp );
-}
-
-static int endedstopped(IO *wrapper) {
- if ( wrapper->endedstopped ) {
- wrapper->endedstopped = false;
-return( true );
- }
-return( false );
-}
-
-
-static int nextpstoken(IO *wrapper, real *val, char *tokbuf, int tbsize) {
- int ch, r, i;
- char *pt, *end;
- float mf2pt_advance_width;
-
- pt = tokbuf;
- end = pt+tbsize-1;
-
- /* Eat whitespace and comments. Comments last to eol (or formfeed) */
- while ( 1 ) {
- while ( isspace(ch = nextch(wrapper)) );
- if ( ch!='%' )
- break;
- while ( (ch=nextch(wrapper))!=EOF && ch!='\r' && ch!='\n' && ch!='\f' )
- if ( pt<end )
- *pt++ = ch;
- *pt='\0';
- /* Some comments have meanings (that we care about) */
- if ( sscanf( tokbuf, " MF2PT1: bbox %*g %*g %g %*g", &mf2pt_advance_width )==1 )
- wrapper->advance_width = mf2pt_advance_width;
- else if ( sscanf( tokbuf, " MF2PT1: glyph_dimensions %*g %*g %g %*g", &mf2pt_advance_width )==1 )
- wrapper->advance_width = mf2pt_advance_width;
- pt = tokbuf;
- }
-
- if ( ch==EOF )
-return( pt_eof );
-
- pt = tokbuf;
- end = pt+tbsize-1;
- *pt++ = ch; *pt='\0';
-
- if ( ch=='(' ) {
- int nest=1, quote=0;
- while ( (ch=nextch(wrapper))!=EOF ) {
- if ( pt<end ) *pt++ = ch;
- if ( quote )
- quote=0;
- else if ( ch=='(' )
- ++nest;
- else if ( ch==')' ) {
- if ( --nest==0 )
- break;
- } else if ( ch=='\\' )
- quote = 1;
- }
- *pt='\0';
-return( pt_string );
- } else if ( ch=='<' ) {
- ch = nextch(wrapper);
- if ( pt<end ) *pt++ = ch;
- if ( ch=='>' )
- /* Done */;
- else if ( ch!='~' ) {
- while ( (ch=nextch(wrapper))!=EOF && ch!='>' )
- if ( pt<end ) *pt++ = ch;
- } else {
- int twiddle=0;
- while ( (ch=nextch(wrapper))!=EOF ) {
- if ( pt<end ) *pt++ = ch;
- if ( ch=='~' ) twiddle = 1;
- else if ( twiddle && ch=='>' )
- break;
- else twiddle = 0;
- }
- }
- *pt='\0';
-return( pt_string );
- } else if ( ch==')' || ch=='>' || ch=='[' || ch==']' || ch=='{' || ch=='}' ) {
- if ( ch=='{' )
-return( pt_opencurly );
- else if ( ch=='}' )
-return( pt_closecurly );
- if ( ch=='[' )
-return( pt_openarray );
- else if ( ch==']' )
-return( pt_closearray );
-
-return( pt_unknown ); /* single character token */
- } else if ( ch=='/' ) {
- pt = tokbuf;
- while ( (ch=nextch(wrapper))!=EOF && !isspace(ch) && ch!='%' &&
- ch!='(' && ch!=')' && ch!='<' && ch!='>' && ch!='[' && ch!=']' &&
- ch!='{' && ch!='}' && ch!='/' )
- if ( pt<tokbuf+tbsize-2 )
- *pt++ = ch;
- *pt = '\0';
- unnextch(ch,wrapper);
-return( pt_namelit ); /* name literal */
- } else {
- while ( (ch=nextch(wrapper))!=EOF && !isspace(ch) && ch!='%' &&
- ch!='(' && ch!=')' && ch!='<' && ch!='>' && ch!='[' && ch!=']' &&
- ch!='{' && ch!='}' && ch!='/' ) {
- if ( pt<tokbuf+tbsize-2 )
- *pt++ = ch;
- }
- *pt = '\0';
- unnextch(ch,wrapper);
- r = strtol(tokbuf,&end,10);
- pt = end;
- if ( *pt=='\0' ) { /* It's a normal integer */
- *val = r;
-return( pt_number );
- } else if ( *pt=='#' ) {
- r = strtol(pt+1,&end,r);
- if ( *end=='\0' ) { /* It's a radix integer */
- *val = r;
-return( pt_number );
- }
- } else {
- *val = strtod(tokbuf,&end);
- if ( !isfinite(*val) ) {
-/* GT: NaN is a concept in IEEE floating point which means "Not a Number" */
-/* GT: it is used to represent errors like 0/0 or sqrt(-1). */
- LogError( _("Bad number, infinity or nan: %s\n"), tokbuf );
- *val = 0;
- }
- if ( *end=='\0' ) /* It's a real */
-return( pt_number );
- }
- /* It's not a number */
- for ( i=0; toknames[i]!=NULL; ++i )
- if ( strcmp(tokbuf,toknames[i])==0 )
-return( i );
-
-return( pt_unknown );
- }
-}
-
-static void Transform(BasePoint *to, DBasePoint *from, real trans[6]) {
- to->x = trans[0]*from->x+trans[2]*from->y+trans[4];
- to->y = trans[1]*from->x+trans[3]*from->y+trans[5];
-}
-
-void MatMultiply(real m1[6], real m2[6], real to[6]) {
- real trans[6];
-
- trans[0] = m1[0]*m2[0] +
- m1[1]*m2[2];
- trans[1] = m1[0]*m2[1] +
- m1[1]*m2[3];
- trans[2] = m1[2]*m2[0] +
- m1[3]*m2[2];
- trans[3] = m1[2]*m2[1] +
- m1[3]*m2[3];
- trans[4] = m1[4]*m2[0] +
- m1[5]*m2[2] +
- m2[4];
- trans[5] = m1[4]*m2[1] +
- m1[5]*m2[3] +
- m2[5];
- memcpy(to,trans,sizeof(trans));
-}
-
-void MatInverse(real into[6], real orig[6]) {
- real det = orig[0]*orig[3] - orig[1]*orig[2];
-
- if ( det==0 ) {
- LogError( _("Attempt to invert a singular matrix\n") );
- memset(into,0,sizeof(*into));
- } else {
- into[0] = orig[3]/det;
- into[1] = -orig[1]/det;
- into[2] = -orig[2]/det;
- into[3] = orig[0]/det;
- into[4] = -orig[4]*into[0] - orig[5]*into[2];
- into[5] = -orig[4]*into[1] - orig[5]*into[3];
- }
-}
-
-static void ECCatagorizePoints( EntityChar *ec ) {
- Entity *ent;
-
- for ( ent=ec->splines; ent!=NULL; ent=ent->next ) if ( ent->type == et_splines ) {
- SPLCatagorizePoints( ent->u.splines.splines );
- SPLCatagorizePoints( ent->clippath );
- }
-}
-
-static int AddEntry(struct pskeydict *dict,struct psstack *stack, int sp) {
- int i;
-
- if ( dict->cnt>=dict->max ) {
- if ( dict->cnt==0 ) {
- dict->max = 30;
- dict->entries = galloc(dict->max*sizeof(struct pskeyval));
- } else {
- dict->max += 30;
- dict->entries = grealloc(dict->entries,dict->max*sizeof(struct pskeyval));
- }
- }
- if ( sp<2 )
-return(sp);
- if ( stack[sp-2].type!=ps_string && stack[sp-2].type!=ps_lit ) {
-/* GT: Here "def" is a PostScript keyword, (meaning define). */
-/* GT: This "def" should not be translated as it is part of the PostScript language. */
- LogError( _("Key for a def must be a string or name literal\n") );
-return(sp-2);
- }
- for ( i=0; i<dict->cnt; ++i )
- if ( strcmp(dict->entries[i].key,stack[sp-2].u.str)==0 )
- break;
- if ( i!=dict->cnt ) {
- free(stack[sp-2].u.str);
- if ( dict->entries[i].type==ps_string || dict->entries[i].type==ps_instr ||
- dict->entries[i].type==ps_lit )
- free(dict->entries[i].u.str);
- } else {
- memset(&dict->entries[i],'\0',sizeof(struct pskeyval));
- dict->entries[i].key = stack[sp-2].u.str;
- ++dict->cnt;
- }
- dict->entries[i].type = stack[sp-1].type;
- dict->entries[i].u = stack[sp-1].u;
-return(sp-2);
-}
-
-static int forgetstack(struct psstack *stack, int forgets, int sp) {
- /* forget the bottom most "forgets" entries on the stack */
- /* we presume they are garbage that has accumulated because we */
- /* don't understand all of PS */
- int i;
- for ( i=0; i<forgets; ++i ) {
- if ( stack[i].type==ps_string || stack[i].type==ps_instr ||
- stack[i].type==ps_lit )
- free(stack[i].u.str);
- else if ( stack[i].type==ps_array || stack[i].type==ps_dict )
- dictfree(&stack[i].u.dict);
- }
- for ( i=forgets; i<sp; ++i )
- stack[i-forgets] = stack[i];
-return( sp-forgets );
-}
-
-static int rollstack(struct psstack *stack, int sp) {
- int n,j,i;
- struct psstack *temp;
-
- if ( sp>1 ) {
- n = stack[sp-2].u.val;
- j = stack[sp-1].u.val;
- sp-=2;
- if ( sp>=n && n>0 ) {
- j %= n;
- if ( j<0 ) j += n;
- temp = galloc(n*sizeof(struct psstack));
- for ( i=0; i<n; ++i )
- temp[i] = stack[sp-n+i];
- for ( i=0; i<n; ++i )
- stack[sp-n+(i+j)%n] = temp[i];
- free(temp);
- }
- }
-return( sp );
-}
-
-static void CheckMakeB(BasePoint *test, BasePoint *good) {
- if ( !isfinite(test->x) || test->x>100000 || test->x<-100000 ) {
- LogError( _("Value out of bounds in spline.\n") );
- if ( good!=NULL )
- test->x = good->x;
- else
- test->x = 0;
- }
- if ( !isfinite(test->y) || test->y>100000 || test->y<-100000 ) {
- LogError( _("Value out of bounds in spline.\n") );
- if ( good!=NULL )
- test->y = good->y;
- else
- test->y = 0;
- }
-}
-
-static void CheckMake(SplinePoint *from, SplinePoint *to) {
- CheckMakeB(&from->me,NULL);
- CheckMakeB(&from->nextcp,&from->me);
- CheckMakeB(&to->prevcp,&from->nextcp);
- CheckMakeB(&to->me,&to->prevcp);
-}
-
-static void circlearcto(real a1, real a2, real cx, real cy, real r,
- SplineSet *cur, real *transform ) {
- SplinePoint *pt;
- DBasePoint temp, base, cp;
- real cplen;
- int sign=1;
- real s1, s2, c1, c2;
-
- if ( a1==a2 )
-return;
-
- cplen = (a2-a1)/90 * r * .552;
- a1 *= 3.1415926535897932/180; a2 *= 3.1415926535897932/180;
- s1 = sin(a1); s2 = sin(a2); c1 = cos(a1); c2 = cos(a2);
- temp.x = cx+r*c2; temp.y = cy+r*s2;
- base.x = cx+r*c1; base.y = cy+r*s1;
- pt = chunkalloc(sizeof(SplinePoint));
- Transform(&pt->me,&temp,transform);
- cp.x = temp.x-cplen*s2; cp.y = temp.y + cplen*c2;
- if ( (cp.x-base.x)*(cp.x-base.x)+(cp.y-base.y)*(cp.y-base.y) >
- (temp.x-base.x)*(temp.x-base.x)+(temp.y-base.y)*(temp.y-base.y) ) {
- sign = -1;
- cp.x = temp.x+cplen*s2; cp.y = temp.y - cplen*c2;
- }
- Transform(&pt->prevcp,&cp,transform);
- pt->nonextcp = true;
- cp.x = base.x + sign*cplen*s1; cp.y = base.y - sign*cplen*c1;
- Transform(&cur->last->nextcp,&cp,transform);
- cur->last->nonextcp = false;
- CheckMake(cur->last,pt);
- SplineMake3(cur->last,pt);
- cur->last = pt;
-}
-
-static void circlearcsto(real a1, real a2, real cx, real cy, real r,
- SplineSet *cur, real *transform, int clockwise ) {
- int a;
- real last;
-
- while ( a1<0 ) { a1 += 360; a2 +=360;} while ( a2-a1<=-360 ) a2 += 360;
- while ( a1>360 ) { a1 -= 360; a2 -= 360; } while ( a2-a1>360 ) a2 -= 360;
- if ( !clockwise ) {
- if ( a1>a2 )
- a2 += 360;
- last = a1;
- for ( a=((int) (a1+90)/90)*90; a<a2; a += 90 ) {
- circlearcto(last,a,cx,cy,r,cur,transform);
- last = a;
- }
- circlearcto(last,a2,cx,cy,r,cur,transform);
- } else {
- if ( a2>a1 )
- a1 += 360;
- last = a1;
- for ( a=((int) (a1-90)/90)*90+90; a>a2; a -= 90 ) {
- circlearcto(last,a,cx,cy,r,cur,transform);
- last = a;
- }
- circlearcto(last,a2,cx,cy,r,cur,transform);
- }
-}
-
-static void collectgarbage(struct garbage *tofrees,struct pskeydict *to) {
- struct garbage *into;
-
- /* Garbage collection pointers */
- into = tofrees;
- if ( tofrees->cnt>=GARBAGE_MAX && tofrees->next!=NULL )
- into = tofrees->next;
- if ( into->cnt>=GARBAGE_MAX ) {
- into = chunkalloc(sizeof(struct garbage));
- into->next = tofrees->next;
- tofrees->next = into;
- }
- into->cnts[ into->cnt ] = to->cnt;
- into->entries[ into->cnt++ ] = to->entries;
-}
-
-static void copyarray(struct pskeydict *to,struct pskeydict *from, struct garbage *tofrees) {
- int i;
- struct pskeyval *oldent = from->entries;
-
- *to = *from;
- to->entries = gcalloc(to->cnt,sizeof(struct pskeyval));
- for ( i=0; i<to->cnt; ++i ) {
- to->entries[i] = oldent[i];
- if ( to->entries[i].type==ps_string || to->entries[i].type==ps_instr ||
- to->entries[i].type==ps_lit )
- to->entries[i].u.str = copy(to->entries[i].u.str);
- else if ( to->entries[i].type==ps_array || to->entries[i].type==ps_dict )
- copyarray(&to->entries[i].u.dict,&oldent[i].u.dict,tofrees);
- }
- collectgarbage(tofrees,to);
-}
-
-static int aload(int sp, struct psstack *stack,int stacktop, struct garbage *tofrees) {
- int i;
-
- if ( sp>=1 && stack[sp-1].type==ps_array ) {
- struct pskeydict dict;
- --sp;
- dict = stack[sp].u.dict;
- for ( i=0; i<dict.cnt; ++i ) {
- if ( sp<stacktop ) {
- stack[sp].type = dict.entries[i].type;
- stack[sp].u = dict.entries[i].u;
- if ( stack[sp].type==ps_string || stack[sp].type==ps_instr ||
- stack[sp].type==ps_lit )
- stack[sp].u.str = copy(stack[sp].u.str);
-/* The following is incorrect behavior, but as I don't do garbage collection */
-/* and I'm not going to implement reference counts, this will work in most cases */
- else if ( stack[sp].type==ps_array )
- copyarray(&stack[sp].u.dict,&stack[sp].u.dict,tofrees);
- ++sp;
- }
- }
- if ( sp<(int)(sizeof(stack)/sizeof(stack[0])) ) {
- stack[sp].type = ps_array;
- stack[sp].u.dict = dict;
- ++sp;
- }
- }
-return( sp );
-}
-
-static void printarray(struct pskeydict *dict) {
- int i;
-
- printf("[" );
- for ( i=0; i<dict->cnt; ++i ) {
- switch ( dict->entries[i].type ) {
- case ps_num:
- printf( "%g", (double) dict->entries[i].u.val );
- break;
- case ps_bool:
- printf( "%s", dict->entries[i].u.tf ? "true" : "false" );
- break;
- case ps_string: case ps_instr: case ps_lit:
- printf( dict->entries[i].type==ps_lit ? "/" :
- dict->entries[i].type==ps_string ? "(" : "{" );
- printf( "%s", dict->entries[i].u.str );
- printf( dict->entries[i].type==ps_lit ? "" :
- dict->entries[i].type==ps_string ? ")" : "}" );
- break;
- case ps_array:
- printarray(&dict->entries[i].u.dict);
- break;
- case ps_void:
- printf( "-- void --" );
- break;
- default:
- printf( "-- nostringval --" );
- break;
- }
- printf(" ");
- }
- printf( "]" );
-}
-
-static void freestuff(struct psstack *stack, int sp, struct pskeydict *dict,
- GrowBuf *gb, struct garbage *tofrees) {
- int i;
-
- free(gb->base);
- for ( i=0; i<dict->cnt; ++i ) {
- if ( dict->entries[i].type==ps_string || dict->entries[i].type==ps_instr ||
- dict->entries[i].type==ps_lit )
- free(dict->entries[i].u.str);
- free(dict->entries[i].key);
- }
- free( dict->entries );
- for ( i=0; i<sp; ++i ) {
- if ( stack[i].type==ps_string || stack[i].type==ps_instr ||
- stack[i].type==ps_lit )
- free(stack[i].u.str);
-#if 0 /* Garbage collection should get these */
- else if ( stack[i].type==ps_array || stack[i].type==ps_dict )
- dictfree(&stack[i].u.dict);
-#endif
- }
- garbagefree(tofrees);
-}
-
-static void DoMatTransform(int tok,int sp,struct psstack *stack) {
- real invt[6], t[6];
-
- if ( stack[sp-1].u.dict.cnt==6 && stack[sp-1].u.dict.entries[0].type==ps_num ) {
- double x = stack[sp-3].u.val, y = stack[sp-2].u.val;
- --sp;
- t[5] = stack[sp].u.dict.entries[5].u.val;
- t[4] = stack[sp].u.dict.entries[4].u.val;
- t[3] = stack[sp].u.dict.entries[3].u.val;
- t[2] = stack[sp].u.dict.entries[2].u.val;
- t[1] = stack[sp].u.dict.entries[1].u.val;
- t[0] = stack[sp].u.dict.entries[0].u.val;
- dictfree(&stack[sp].u.dict);
- if ( tok==pt_itransform || tok==pt_idtransform ) {
- MatInverse(invt,t);
- memcpy(t,invt,sizeof(t));
- }
- stack[sp-2].u.val = t[0]*x + t[1]*y;
- stack[sp-1].u.val = t[2]*x + t[3]*y;
- if ( tok==pt_transform || tok==pt_itransform ) {
- stack[sp-2].u.val += t[4];
- stack[sp-1].u.val += t[5];
- }
- }
-}
-
-static int DoMatOp(int tok,int sp,struct psstack *stack) {
- real temp[6], t[6];
- int nsp=sp;
-
- if ( stack[sp-1].u.dict.cnt==6 && stack[sp-1].u.dict.entries[0].type==ps_num ) {
- t[5] = stack[sp-1].u.dict.entries[5].u.val;
- t[4] = stack[sp-1].u.dict.entries[4].u.val;
- t[3] = stack[sp-1].u.dict.entries[3].u.val;
- t[2] = stack[sp-1].u.dict.entries[2].u.val;
- t[1] = stack[sp-1].u.dict.entries[1].u.val;
- t[0] = stack[sp-1].u.dict.entries[0].u.val;
- switch ( tok ) {
- case pt_translate:
- if ( sp>=3 ) {
- stack[sp-1].u.dict.entries[5].u.val += stack[sp-3].u.val*t[0]+stack[sp-2].u.val*t[2];
- stack[sp-1].u.dict.entries[4].u.val += stack[sp-3].u.val*t[1]+stack[sp-2].u.val*t[3];
- nsp = sp-2;
- }
- break;
- case pt_scale:
- if ( sp>=2 ) {
- stack[sp-1].u.dict.entries[0].u.val *= stack[sp-3].u.val;
- stack[sp-1].u.dict.entries[1].u.val *= stack[sp-3].u.val;
- stack[sp-1].u.dict.entries[2].u.val *= stack[sp-2].u.val;
- stack[sp-1].u.dict.entries[3].u.val *= stack[sp-2].u.val;
- /* transform[4,5] are unchanged */
- nsp = sp-2;
- }
- break;
- case pt_rotate:
- if ( sp>=1 ) {
- --sp;
- temp[0] = temp[3] = cos(stack[sp].u.val);
- temp[1] = sin(stack[sp].u.val);
- temp[2] = -temp[1];
- temp[4] = temp[5] = 0;
- MatMultiply(temp,t,t);
- stack[sp-1].u.dict.entries[5].u.val = t[5];
- stack[sp-1].u.dict.entries[4].u.val = t[4];
- stack[sp-1].u.dict.entries[3].u.val = t[3];
- stack[sp-1].u.dict.entries[2].u.val = t[2];
- stack[sp-1].u.dict.entries[1].u.val = t[1];
- stack[sp-1].u.dict.entries[0].u.val = t[0];
- nsp = sp-1;
- }
- break;
- }
- stack[nsp-1] = stack[sp-1];
- }
-return(nsp);
-}
-
-static Entity *EntityCreate(SplinePointList *head,int linecap,int linejoin,
- real linewidth, real *transform, SplineSet *clippath) {
- Entity *ent = gcalloc(1,sizeof(Entity));
- ent->type = et_splines;
- ent->u.splines.splines = head;
- ent->u.splines.cap = linecap;
- ent->u.splines.join = linejoin;
- ent->u.splines.stroke_width = linewidth;
- ent->u.splines.fill.col = 0xffffffff;
- ent->u.splines.stroke.col = 0xffffffff;
- ent->u.splines.fill.opacity = 1.0;
- ent->u.splines.stroke.opacity = 1.0;
- ent->clippath = SplinePointListCopy(clippath);
- memcpy(ent->u.splines.transform,transform,6*sizeof(real));
-return( ent );
-}
-
-
-static void HandleType3Reference(IO *wrapper,EntityChar *ec,real transform[6],
- char *tokbuf, int toksize) {
- int tok;
- real dval;
- char *glyphname;
- RefChar *ref;
-
- tok = nextpstoken(wrapper,&dval,tokbuf,toksize);
- if ( strcmp(tokbuf,"get")!=0 )
-return; /* Hunh. I don't understand it. I give up */
- tok = nextpstoken(wrapper,&dval,tokbuf,toksize);
- if ( tok!=pt_namelit )
-return; /* Hunh. I don't understand it. I give up */
- glyphname = copy(tokbuf);
- tok = nextpstoken(wrapper,&dval,tokbuf,toksize);
- if ( strcmp(tokbuf,"get")!=0 )
-return; /* Hunh. I don't understand it. I give up */
- tok = nextpstoken(wrapper,&dval,tokbuf,toksize);
- if ( strcmp(tokbuf,"exec")!=0 )
-return; /* Hunh. I don't understand it. I give up */
-
- /* Ok, it looks very much like a reference to glyphname */
- ref = RefCharCreate();
- memcpy(ref->transform,transform,sizeof(ref->transform));
- ref->sc = (SplineChar *) glyphname;
- ref->next = ec->refs;
- ec->refs = ref;
-}
-
-static void _InterpretPS(IO *wrapper, EntityChar *ec, RetStack *rs) {
- SplinePointList *cur=NULL, *head=NULL;
- DBasePoint current, temp;
- int tok, i, j;
- struct psstack stack[100];
- real dval;
- int sp=0;
- SplinePoint *pt;
- RefChar *ref, *lastref=NULL;
- real transform[6], t[6];
- struct graphicsstate {
- real transform[6];
- DBasePoint current;
- real linewidth;
- int linecap, linejoin;
- Color fore;
- DashType dashes[DASH_MAX];
- SplineSet *clippath;
- } gsaves[30];
- int gsp = 0;
- int ccnt=0;
- GrowBuf gb;
- struct pskeydict dict;
- struct pskeyval *kv;
- Color fore=COLOR_INHERITED;
- int linecap=lc_inherited, linejoin=lj_inherited; real linewidth=WIDTH_INHERITED;
- DashType dashes[DASH_MAX];
- int dash_offset = 0;
- Entity *ent;
- char *oldloc;
- int warned = 0;
- struct garbage tofrees;
- SplineSet *clippath = NULL;
- char tokbuf[100];
- const int tokbufsize = 100;
-
- oldloc = setlocale(LC_NUMERIC,"C");
-
- memset(&gb,'\0',sizeof(GrowBuf));
- memset(&dict,'\0',sizeof(dict));
- tofrees.cnt = 0; tofrees.next = NULL;
-
- transform[0] = transform[3] = 1.0;
- transform[1] = transform[2] = transform[4] = transform[5] = 0;
- current.x = current.y = 0;
- dashes[0] = 0; dashes[1] = DASH_INHERITED;
-
- if ( ec->fromtype3 ) {
- /* My type3 fonts have two things pushed on the stack when they */
- /* start. One is a dictionary, the other a flag (number). If the */
- /* flag is non-zero then we are a nested call (a reference char) */
- /* if 0, we're normal. We don't want to do setcachedevice for */
- /* reference chars. We can't represent a dictionary on the stack */
- /* so just push two 0s */
- stack[0].type = stack[1].type = ps_num;
- stack[0].u.val = stack[1].u.val = 0;
- sp = 2;
- }
-
- while ( (tok = nextpstoken(wrapper,&dval,tokbuf,tokbufsize))!=pt_eof ) {
- if ( endedstopped(wrapper)) {
- if ( sp<(int)(sizeof(stack)/sizeof(stack[0])) ) {
- stack[sp].type = ps_bool;
- stack[sp++].u.tf = false;
- }
- }
- if ( sp>(int)(sizeof(stack)/sizeof(stack[0])*4/5) ) {
- /* We don't interpret all of postscript */
- /* Sometimes we leave garbage on the stack that a real PS interp */
- /* would have handled. If the stack gets too deep, clean out the */
- /* oldest entries */
- sp = forgetstack(stack,sizeof(stack)/sizeof(stack[0])/3,sp );
- }
- if ( ccnt>0 ) {
- if ( tok==pt_closecurly )
- --ccnt;
- else if ( tok==pt_opencurly )
- ++ccnt;
- if ( ccnt>0 )
- AddTok(&gb,tokbuf,tok==pt_namelit);
- else {
- if ( sp<(int)(sizeof(stack)/sizeof(stack[0])) ) {
- stack[sp].type = ps_instr;
- if ( gb.pt==NULL )
- stack[sp++].u.str = copy("");
- else {
- *gb.pt = '\0'; gb.pt = gb.base;
- stack[sp++].u.str = copy(gb.base);
- }
- }
- }
- } else if ( tok==pt_unknown && (kv=lookup(&dict,tokbuf))!=NULL ) {
- if ( kv->type == ps_instr )
- pushio(wrapper,NULL,copy(kv->u.str),0);
- else if ( sp<(int)(sizeof(stack)/sizeof(stack[0])) ) {
- stack[sp].type = kv->type;
- stack[sp++].u = kv->u;
- if ( kv->type==ps_instr || kv->type==ps_lit || kv->type==ps_string )
- stack[sp-1].u.str = copy(stack[sp-1].u.str);
- else if ( kv->type==ps_array || kv->type==ps_dict ) {
- copyarray(&stack[sp-1].u.dict,&stack[sp-1].u.dict,&tofrees);
- if ( stack[sp-1].u.dict.is_executable )
- sp = aload(sp,stack,sizeof(stack)/sizeof(stack[0]),&tofrees);
- }
- }
- } else {
- if ( tok==pt_unknown ) {
- if ( strcmp(tokbuf,"Cache")==0 ) /* Fontographer type3s */
- tok = pt_setcachedevice;
- else if ( strcmp(tokbuf,"SetWid")==0 ) {
- tok = pt_setcharwidth;
- if ( sp<(int)(sizeof(stack)/sizeof(stack[0])) ) {
- stack[sp].type = ps_num;
- stack[sp++].u.val = 0;
- }
- } else if ( strcmp(tokbuf,"rrcurveto")==0 ) {
- if ( sp>=6 ) {
- stack[sp-4].u.val += stack[sp-6].u.val;
- stack[sp-3].u.val += stack[sp-5].u.val;
- stack[sp-2].u.val += stack[sp-4].u.val;
- stack[sp-1].u.val += stack[sp-3].u.val;
- tok = pt_rcurveto;
- }
- } else if ( strcmp(tokbuf,"FillStroke")==0 ) {
- if ( sp>0 )
- --sp;
- tok = linewidth!=WIDTH_INHERITED ? pt_stroke : pt_fill;
- if ( wrapper->top!=NULL && wrapper->top->ps!=NULL &&
- linewidth!=WIDTH_INHERITED )
- linewidth /= 10.0; /* bug in Fontographer's unencrypted type3 fonts */
- } else if ( strcmp(tokbuf,"SG")==0 ) {
- if ( linewidth!=WIDTH_INHERITED && sp>1 )
- stack[sp-2].u.val = stack[sp-1].u.val;
- if ( sp>0 )
- --sp;
- if ( sp>0 )
- stack[sp-1].u.val = (stack[sp-1].u.val+99)/198.0;
- tok = pt_setgray;
- } else if ( strcmp(tokbuf,"ShowInt")==0 ) {
- /* Fontographer reference */
- if ( (!wrapper->top->fogns && sp>0 && stack[sp-1].type == ps_num &&
- stack[sp-1].u.val>=0 && stack[sp-1].u.val<=255 ) ||
- (wrapper->top->fogns && sp>6 && stack[sp-7].type == ps_num &&
- stack[sp-7].u.val>=0 && stack[sp-7].u.val<=255 )) {
- ref = RefCharCreate();
- memcpy(ref->transform,transform,sizeof(ref->transform));
- if ( wrapper->top->fogns ) {
- sp -= 6;
- t[0] = stack[sp+0].u.val;
- t[1] = stack[sp+1].u.val;
- t[2] = stack[sp+2].u.val;
- t[3] = stack[sp+3].u.val;
- t[4] = stack[sp+4].u.val;
- t[5] = stack[sp+5].u.val;
- MatMultiply(t,ref->transform,ref->transform);
- wrapper->top->fogns = false;
- }
- ref->orig_pos = stack[--sp].u.val;
- ref->next = ec->refs;
- ec->refs = ref;
- continue;
- }
- } else if ( strcmp(tokbuf,"togNS_")==0 ) {
- wrapper->top->fogns = !wrapper->top->fogns;
- continue;
- }
- }
- switch ( tok ) {
- case pt_number:
- if ( sp<(int)(sizeof(stack)/sizeof(stack[0])) ) {
- stack[sp].type = ps_num;
- stack[sp++].u.val = dval;
- }
- break;
- case pt_string:
- if ( sp<(int)(sizeof(stack)/sizeof(stack[0])) ) {
- stack[sp].type = ps_string;
- stack[sp++].u.str = copyn(tokbuf+1,strlen(tokbuf)-2);
- }
- break;
- case pt_true: case pt_false:
- if ( sp<(int)(sizeof(stack)/sizeof(stack[0])) ) {
- stack[sp].type = ps_bool;
- stack[sp++].u.tf = tok==pt_true;
- }
- break;
- case pt_opencurly:
- ++ccnt;
- break;
- case pt_closecurly:
- --ccnt;
- if ( ccnt<0 ) {
- goto done;
- }
- break;
- case pt_count:
- if ( sp<(int)(sizeof(stack)/sizeof(stack[0])) ) {
- stack[sp].type = ps_num;
- stack[sp].u.val = sp;
- ++sp;
- }
- break;
- case pt_pop:
- if ( sp>0 ) {
- --sp;
- if ( stack[sp].type==ps_string || stack[sp].type==ps_instr ||
- stack[sp].type==ps_lit )
- free(stack[sp].u.str);
- else if ( stack[sp].type==ps_array || stack[sp].type==ps_dict )
- dictfree(&stack[sp].u.dict);
- }
- break;
- case pt_clear:
- while ( sp>0 ) {
- --sp;
- if ( stack[sp].type==ps_string || stack[sp].type==ps_instr ||
- stack[sp].type==ps_lit )
- free(stack[sp].u.str);
- else if ( stack[sp].type==ps_array || stack[sp].type==ps_dict )
- dictfree(&stack[sp].u.dict);
- }
- break;
- case pt_dup:
- if ( sp>0 && sp<(int)(sizeof(stack)/sizeof(stack[0])) ) {
- stack[sp] = stack[sp-1];
- if ( stack[sp].type==ps_string || stack[sp].type==ps_instr ||
- stack[sp].type==ps_lit )
- stack[sp].u.str = copy(stack[sp].u.str);
- /* The following is incorrect behavior, but as I don't do garbage collection */
- /* and I'm not going to implement reference counts, this will work in most cases */
- else if ( stack[sp].type==ps_array )
- copyarray(&stack[sp].u.dict,&stack[sp].u.dict,&tofrees);
- ++sp;
- }
- break;
- case pt_copy:
- if ( sp>0 ) {
- int n = stack[--sp].u.val;
- if ( n+sp<(int)(sizeof(stack)/sizeof(stack[0])) ) {
- int i;
- for ( i=0; i<n; ++i ) {
- stack[sp] = stack[sp-n];
- if ( stack[sp].type==ps_string || stack[sp].type==ps_instr ||
- stack[sp].type==ps_lit )
- stack[sp].u.str = copy(stack[sp].u.str);
- /* The following is incorrect behavior, but as I don't do garbage collection */
- /* and I'm not going to implement reference counts, this will work in most cases */
- else if ( stack[sp].type==ps_array )
- copyarray(&stack[sp].u.dict,&stack[sp].u.dict,&tofrees);
- ++sp;
- }
- }
- }
- break;
- case pt_exch:
- if ( sp>1 ) {
- struct psstack temp;
- temp = stack[sp-1];
- stack[sp-1] = stack[sp-2];
- stack[sp-2] = temp;
- }
- break;
- case pt_roll:
- sp = rollstack(stack,sp);
- break;
- case pt_index:
- if ( sp>0 ) {
- i = stack[--sp].u.val;
- if ( sp>i && i>=0 ) {
- stack[sp] = stack[sp-i-1];
- if ( stack[sp].type==ps_string || stack[sp].type==ps_instr ||
- stack[sp].type==ps_lit )
- stack[sp].u.str = copy(stack[sp].u.str);
- /* The following is incorrect behavior, but as I don't do garbage collection */
- /* and I'm not going to implement reference counts, this will work in most cases */
- else if ( stack[sp].type==ps_array )
- copyarray(&stack[sp].u.dict,&stack[sp].u.dict,&tofrees);
- ++sp;
- }
- }
- break;
- case pt_add:
- if ( sp>=2 && stack[sp-1].type==ps_num && stack[sp-2].type==ps_num ) {
- stack[sp-2].u.val += stack[sp-1].u.val;
- --sp;
- }
- break;
- case pt_sub:
- if ( sp>=2 && stack[sp-1].type==ps_num && stack[sp-2].type==ps_num ) {
- stack[sp-2].u.val -= stack[sp-1].u.val;
- --sp;
- }
- break;
- case pt_mul:
- if ( sp>=2 && stack[sp-1].type==ps_num && stack[sp-2].type==ps_num ) {
- stack[sp-2].u.val *= stack[sp-1].u.val;
- --sp;
- }
- break;
- case pt_div:
- if ( sp>=2 && stack[sp-1].type==ps_num && stack[sp-2].type==ps_num ) {
- if ( stack[sp-1].u.val == 0 )
- LogError( _("Divide by zero in postscript code.\n" ));
- else
- stack[sp-2].u.val /= stack[sp-1].u.val;
- --sp;
- }
- break;
- case pt_idiv:
- if ( sp>=2 && stack[sp-1].type==ps_num && stack[sp-2].type==ps_num ) {
- if ( stack[sp-1].u.val == 0 )
- LogError( _("Divide by zero in postscript code.\n" ));
- else
- stack[sp-2].u.val = ((int) stack[sp-2].u.val) / ((int) stack[sp-1].u.val);
- --sp;
- }
- break;
- case pt_mod:
- if ( sp>=2 && stack[sp-1].type==ps_num && stack[sp-2].type==ps_num ) {
- if ( stack[sp-1].u.val == 0 )
- LogError( _("Divide by zero in postscript code.\n" ));
- else
- stack[sp-2].u.val = ((int) stack[sp-2].u.val) % ((int) stack[sp-1].u.val);
- --sp;
- }
- break;
- case pt_max:
- if ( sp>=2 && stack[sp-1].type==ps_num && stack[sp-2].type==ps_num ) {
- if ( stack[sp-2].u.val < stack[sp-1].u.val )
- stack[sp-2].u.val = stack[sp-1].u.val;
- --sp;
- }
- break;
- case pt_min:
- if ( sp>=2 && stack[sp-1].type==ps_num && stack[sp-2].type==ps_num ) {
- if ( stack[sp-2].u.val > stack[sp-1].u.val )
- stack[sp-2].u.val = stack[sp-1].u.val;
- --sp;
- }
- break;
- case pt_neg:
- if ( sp>=1 ) {
- if ( stack[sp-1].type == ps_num )
- stack[sp-1].u.val = -stack[sp-1].u.val;
- }
- break;
- case pt_abs:
- if ( sp>=1 ) {
- if ( stack[sp-1].type == ps_num )
- if ( stack[sp-1].u.val < 0 )
- stack[sp-1].u.val = -stack[sp-1].u.val;
- }
- break;
- case pt_round:
- if ( sp>=1 ) {
- if ( stack[sp-1].type == ps_num )
- stack[sp-1].u.val = rint(stack[sp-1].u.val);
- /* rint isn't quite right, round will take 6.5 to 7, 5.5 to 6, etc. while rint() will take both to 6 */
- }
- break;
- case pt_floor:
- if ( sp>=1 ) {
- if ( stack[sp-1].type == ps_num )
- stack[sp-1].u.val = floor(stack[sp-1].u.val);
- }
- break;
- case pt_ceiling:
- if ( sp>=1 ) {
- if ( stack[sp-1].type == ps_num )
- stack[sp-1].u.val = ceil(stack[sp-1].u.val);
- }
- break;
- case pt_truncate:
- if ( sp>=1 ) {
- if ( stack[sp-1].type == ps_num ) {
- if ( stack[sp-1].u.val<0 )
- stack[sp-1].u.val = ceil(stack[sp-1].u.val);
- else
- stack[sp-1].u.val = floor(stack[sp-1].u.val);
- }
- }
- break;
- case pt_ne: case pt_eq:
- if ( sp>=2 ) {
- if ( stack[sp-2].type!=stack[sp-1].type )
- stack[sp-2].u.tf = false;
- else if ( stack[sp-2].type==ps_num )
- stack[sp-2].u.tf = (stack[sp-2].u.val == stack[sp-1].u.val);
- else if ( stack[sp-2].type==ps_bool )
- stack[sp-2].u.tf = (stack[sp-2].u.tf == stack[sp-1].u.tf);
- else
- stack[sp-2].u.tf = strcmp(stack[sp-2].u.str,stack[sp-1].u.str)==0 ;
- stack[sp-2].type = ps_bool;
- if ( tok==pt_ne ) stack[sp-2].u.tf = !stack[sp-2].u.tf;
- --sp;
- }
- break;
- case pt_gt: case pt_le: case pt_lt: case pt_ge:
- if ( sp>=2 ) {
- if ( stack[sp-2].type!=stack[sp-1].type )
- stack[sp-2].u.tf = false;
- else if ( stack[sp-2].type==ps_array )
- LogError( _("Can't compare arrays\n" ));
- else {
- int cmp;
- if ( stack[sp-2].type==ps_num )
- cmp = (stack[sp-2].u.val > stack[sp-1].u.val)?1:
- (stack[sp-2].u.val == stack[sp-1].u.val)?0:-1;
- else if ( stack[sp-2].type==ps_bool )
- cmp = (stack[sp-2].u.tf - stack[sp-1].u.tf);
- else
- cmp = strcmp(stack[sp-2].u.str,stack[sp-1].u.str);
- if ( tok==pt_gt )
- stack[sp-2].u.tf = cmp>0;
- else if ( tok==pt_lt )
- stack[sp-2].u.tf = cmp<0;
- else if ( tok==pt_le )
- stack[sp-2].u.tf = cmp<=0;
- else
- stack[sp-2].u.tf = cmp>=0;
- }
- stack[sp-2].type = ps_bool;
- --sp;
- }
- break;
- case pt_not:
- if ( sp>=1 ) {
- if ( stack[sp-1].type == ps_bool )
- stack[sp-1].u.tf = !stack[sp-1].u.tf;
- }
- break;
- case pt_and:
- if ( sp>=2 ) {
- if ( stack[sp-2].type == ps_num )
- stack[sp-2].u.val = ((int) stack[sp-1].u.val) & (int) stack[sp-1].u.val;
- else if ( stack[sp-2].type == ps_bool )
- stack[sp-2].u.tf &= stack[sp-1].u.tf;
- --sp;
- }
- break;
- case pt_or:
- if ( sp>=2 ) {
- if ( stack[sp-2].type == ps_num )
- stack[sp-2].u.val = ((int) stack[sp-1].u.val) | (int) stack[sp-1].u.val;
- else if ( stack[sp-2].type == ps_bool )
- stack[sp-2].u.tf |= stack[sp-1].u.tf;
- --sp;
- }
- break;
- case pt_xor:
- if ( sp>=2 ) {
- if ( stack[sp-2].type == ps_num )
- stack[sp-2].u.val = ((int) stack[sp-1].u.val) ^ (int) stack[sp-1].u.val;
- else if ( stack[sp-2].type == ps_bool )
- stack[sp-2].u.tf ^= stack[sp-1].u.tf;
- --sp;
- }
- break;
- case pt_exp:
- if ( sp>=2 && stack[sp-1].type==ps_num && stack[sp-2].type==ps_num ) {
- stack[sp-2].u.val = pow(stack[sp-2].u.val,stack[sp-1].u.val);
- --sp;
- }
- break;
- case pt_sqrt:
- if ( sp>=1 && stack[sp-1].type==ps_num ) {
- stack[sp-1].u.val = sqrt(stack[sp-1].u.val);
- }
- break;
- case pt_ln:
- if ( sp>=1 && stack[sp-1].type==ps_num ) {
- stack[sp-1].u.val = log(stack[sp-1].u.val);
- }
- break;
- case pt_log:
- if ( sp>=1 && stack[sp-1].type==ps_num ) {
- stack[sp-1].u.val = log10(stack[sp-1].u.val);
- }
- break;
- case pt_atan:
- if ( sp>=2 && stack[sp-1].type==ps_num && stack[sp-2].type==ps_num ) {
- stack[sp-2].u.val = atan2(stack[sp-2].u.val,stack[sp-1].u.val)*
- 180/3.1415926535897932;
- --sp;
- }
- break;
- case pt_sin:
- if ( sp>=1 && stack[sp-1].type==ps_num ) {
- stack[sp-1].u.val = sin(stack[sp-1].u.val*3.1415926535897932/180);
- }
- break;
- case pt_cos:
- if ( sp>=1 && stack[sp-1].type==ps_num ) {
- stack[sp-1].u.val = cos(stack[sp-1].u.val*3.1415926535897932/180);
- }
- break;
- case pt_if:
- if ( sp>=2 ) {
- if ( ((stack[sp-2].type == ps_bool && stack[sp-2].u.tf) ||
- (stack[sp-2].type == ps_num && strstr(stack[sp-1].u.str,"setcachedevice")!=NULL)) &&
- stack[sp-1].type==ps_instr )
- pushio(wrapper,NULL,stack[sp-1].u.str,0);
- if ( stack[sp-1].type==ps_string || stack[sp-1].type==ps_instr || stack[sp-1].type==ps_lit )
- free(stack[sp-1].u.str);
- sp -= 2;
- } else if ( sp==1 && stack[sp-1].type==ps_instr ) {
- /*This can happen when reading our type3 fonts, we get passed */
- /* values on the stack which the interpreter knows nothing */
- /* about, but the interp needs to learn the width of the char */
- if ( strstr(stack[sp-1].u.str,"setcachedevice")!=NULL ||
- strstr(stack[sp-1].u.str,"setcharwidth")!=NULL )
- pushio(wrapper,NULL,stack[sp-1].u.str,0);
- free(stack[sp-1].u.str);
- sp = 0;
- }
- break;
- case pt_ifelse:
- if ( sp>=3 ) {
- if ( stack[sp-3].type == ps_bool && stack[sp-3].u.tf ) {
- if ( stack[sp-2].type==ps_instr )
- pushio(wrapper,NULL,stack[sp-2].u.str,0);
- } else {
- if ( stack[sp-1].type==ps_instr )
- pushio(wrapper,NULL,stack[sp-1].u.str,0);
- }
- if ( stack[sp-1].type==ps_string || stack[sp-1].type==ps_instr || stack[sp-1].type==ps_lit )
- free(stack[sp-1].u.str);
- if ( stack[sp-2].type==ps_string || stack[sp-2].type==ps_instr || stack[sp-2].type==ps_lit )
- free(stack[sp-2].u.str);
- sp -= 3;
- }
- break;
- case pt_for:
- if ( sp>=4 ) {
- real init, incr, limit;
- char *func;
- int cnt;
-
- if ( stack[sp-4].type == ps_num && stack[sp-3].type==ps_num &&
- stack[sp-2].type==ps_num && stack[sp-1].type==ps_instr ) {
- init = stack[sp-4].u.val;
- incr = stack[sp-3].u.val;
- limit = stack[sp-2].u.val;
- func = stack[sp-1].u.str;
- sp -= 4;
- cnt = 0;
- if ( incr>0 ) {
- while ( init<=limit ) { ++cnt; init += incr; }
- } else if ( incr<0 ) {
- while ( init>=limit ) { ++cnt; init += incr; }
- }
- pushio(wrapper,NULL,func,cnt);
- free(func);
- }
- }
- break;
- case pt_loop:
- if ( sp>=1 ) {
- char *func;
- int cnt;
-
- if ( stack[sp-1].type==ps_instr ) {
- cnt = 0x7fffffff; /* Loop for ever */
- func = stack[sp-1].u.str;
- --sp;
- pushio(wrapper,NULL,func,cnt);
- free(func);
- }
- }
- break;
- case pt_repeat:
- if ( sp>=2 ) {
- char *func;
- int cnt;
-
- if ( stack[sp-2].type==ps_num && stack[sp-1].type==ps_instr ) {
- cnt = stack[sp-2].u.val;
- func = stack[sp-1].u.str;
- sp -= 2;
- pushio(wrapper,NULL,func,cnt);
- free(func);
- }
- }
- break;
- case pt_exit:
- ioescapeloop(wrapper);
- break;
- case pt_stopped:
- if ( sp>=1 ) {
- char *func;
-
- if ( stack[sp-1].type==ps_instr ) {
- func = stack[sp-1].u.str;
- --sp;
- pushio(wrapper,NULL,func,-1);
- free(func);
- }
- }
- break;
- case pt_stop:
- sp = ioescapestopped(wrapper,stack,sp,sizeof(stack)/sizeof(stack[0]));
- break;
- case pt_load:
- if ( sp>=1 && stack[sp-1].type==ps_lit ) {
- kv = lookup(&dict,stack[sp-1].u.str);
- if ( kv!=NULL ) {
- free( stack[sp-1].u.str );
- stack[sp-1].type = kv->type;
- stack[sp-1].u = kv->u;
- if ( kv->type==ps_instr || kv->type==ps_lit )
- stack[sp-1].u.str = copy(stack[sp-1].u.str);
- } else
- stack[sp-1].type = ps_instr;
- }
- break;
- case pt_def:
- sp = AddEntry(&dict,stack,sp);
- break;
- case pt_bind:
- /* a noop in this context */
- break;
- case pt_setcachedevice:
- if ( sp>=6 ) {
- ec->width = stack[sp-6].u.val;
- ec->vwidth = stack[sp-5].u.val;
- /* I don't care about the bounding box */
- sp-=6;
- }
- break;
- case pt_setcharwidth:
- if ( sp>=2 )
- ec->width = stack[sp-=2].u.val;
- break;
- case pt_translate:
- if ( sp>=1 && stack[sp-1].type==ps_array )
- sp = DoMatOp(tok,sp,stack);
- else if ( sp>=2 ) {
- transform[4] += stack[sp-2].u.val*transform[0]+stack[sp-1].u.val*transform[2];
- transform[5] += stack[sp-2].u.val*transform[1]+stack[sp-1].u.val*transform[3];
- sp -= 2;
- }
- break;
- case pt_scale:
- if ( sp>=1 && stack[sp-1].type==ps_array )
- sp = DoMatOp(tok,sp,stack);
- else if ( sp>=2 ) {
- transform[0] *= stack[sp-2].u.val;
- transform[1] *= stack[sp-2].u.val;
- transform[2] *= stack[sp-1].u.val;
- transform[3] *= stack[sp-1].u.val;
- /* transform[4,5] are unchanged */
- sp -= 2;
- }
- break;
- case pt_rotate:
- if ( sp>=1 && stack[sp-1].type==ps_array )
- sp = DoMatOp(tok,sp,stack);
- else if ( sp>=1 ) {
- --sp;
- t[0] = t[3] = cos(stack[sp].u.val);
- t[1] = sin(stack[sp].u.val);
- t[2] = -t[1];
- t[4] = t[5] = 0;
- MatMultiply(t,transform,transform);
- }
- break;
- case pt_concat:
- if ( sp>=1 ) {
- if ( stack[sp-1].type==ps_array ) {
- if ( stack[sp-1].u.dict.cnt==6 && stack[sp-1].u.dict.entries[0].type==ps_num ) {
- --sp;
- t[5] = stack[sp].u.dict.entries[5].u.val;
- t[4] = stack[sp].u.dict.entries[4].u.val;
- t[3] = stack[sp].u.dict.entries[3].u.val;
- t[2] = stack[sp].u.dict.entries[2].u.val;
- t[1] = stack[sp].u.dict.entries[1].u.val;
- t[0] = stack[sp].u.dict.entries[0].u.val;
- dictfree(&stack[sp].u.dict);
- MatMultiply(t,transform,transform);
- }
- }
- }
- break;
- case pt_transform:
- if ( sp>=1 && stack[sp-1].type==ps_array ) {
- if ( sp>=3 ) {
- DoMatTransform(tok,sp,stack);
- --sp;
- }
- } else if ( sp>=2 ) {
- double x = stack[sp-2].u.val, y = stack[sp-1].u.val;
- stack[sp-2].u.val = transform[0]*x + transform[1]*y + transform[4];
- stack[sp-1].u.val = transform[2]*x + transform[3]*y + transform[5];
- }
- break;
- case pt_itransform:
- if ( sp>=1 && stack[sp-1].type==ps_array ) {
- if ( sp>=3 ) {
- DoMatTransform(tok,sp,stack);
- --sp;
- }
- } else if ( sp>=2 ) {
- double x = stack[sp-2].u.val, y = stack[sp-1].u.val;
- MatInverse(t,transform);
- stack[sp-2].u.val = t[0]*x + t[1]*y + t[4];
- stack[sp-1].u.val = t[2]*x + t[3]*y + t[5];
- }
- break;
- case pt_dtransform:
- if ( sp>=1 && stack[sp-1].type==ps_array ) {
- if ( sp>=3 ) {
- DoMatTransform(tok,sp,stack);
- --sp;
- }
- } else if ( sp>=2 ) {
- double x = stack[sp-2].u.val, y = stack[sp-1].u.val;
- stack[sp-2].u.val = transform[0]*x + transform[1]*y;
- stack[sp-1].u.val = transform[2]*x + transform[3]*y;
- }
- break;
- case pt_idtransform:
- if ( sp>=1 && stack[sp-1].type==ps_array ) {
- if ( sp>=3 ) {
- DoMatTransform(tok,sp,stack);
- --sp;
- }
- } else if ( sp>=2 ) {
- double x = stack[sp-2].u.val, y = stack[sp-1].u.val;
- MatInverse(t,transform);
- stack[sp-2].u.val = t[0]*x + t[1]*y;
- stack[sp-1].u.val = t[2]*x + t[3]*y;
- }
- break;
- case pt_namelit:
- if ( strcmp(tokbuf,"CharProcs")==0 && ec!=NULL ) {
- HandleType3Reference(wrapper,ec,transform,tokbuf,tokbufsize);
- } else if ( sp<(int)(sizeof(stack)/sizeof(stack[0])) ) {
- stack[sp].type = ps_lit;
- stack[sp++].u.str = copy(tokbuf);
- }
- break;
- case pt_exec:
- if ( sp>0 && stack[sp-1].type == ps_lit ) {
- ref = RefCharCreate();
- ref->sc = (SplineChar *) stack[--sp].u.str;
- memcpy(ref->transform,transform,sizeof(transform));
- if ( ec->refs==NULL )
- ec->refs = ref;
- else
- lastref->next = ref;
- lastref = ref;
- }
- break;
- case pt_newpath:
- SplinePointListsFree(head);
- head = NULL;
- cur = NULL;
- break;
- case pt_lineto: case pt_rlineto:
- case pt_moveto: case pt_rmoveto:
- if ( sp>=2 || tok==pt_newpath ) {
- if ( tok==pt_rlineto || tok==pt_rmoveto ) {
- current.x += stack[sp-2].u.val;
- current.y += stack[sp-1].u.val;
- sp -= 2;
- } else if ( tok==pt_lineto || tok == pt_moveto ) {
- current.x = stack[sp-2].u.val;
- current.y = stack[sp-1].u.val;
- sp -= 2;
- }
- pt = chunkalloc(sizeof(SplinePoint));
- Transform(&pt->me,&current,transform);
- pt->noprevcp = true; pt->nonextcp = true;
- if ( tok==pt_moveto || tok==pt_rmoveto ) {
- SplinePointList *spl = chunkalloc(sizeof(SplinePointList));
- spl->first = spl->last = pt;
- if ( cur!=NULL )
- cur->next = spl;
- else
- head = spl;
- cur = spl;
- } else {
- if ( cur!=NULL && cur->first!=NULL && (cur->first!=cur->last || cur->first->next==NULL) ) {
- CheckMake(cur->last,pt);
- SplineMake3(cur->last,pt);
- cur->last = pt;
- }
- }
- } else
- sp = 0;
- break;
- case pt_curveto: case pt_rcurveto:
- if ( sp>=6 ) {
- if ( tok==pt_rcurveto ) {
- stack[sp-1].u.val += current.y;
- stack[sp-3].u.val += current.y;
- stack[sp-5].u.val += current.y;
- stack[sp-2].u.val += current.x;
- stack[sp-4].u.val += current.x;
- stack[sp-6].u.val += current.x;
- }
- current.x = stack[sp-2].u.val;
- current.y = stack[sp-1].u.val;
- if ( cur!=NULL && cur->first!=NULL && (cur->first!=cur->last || cur->first->next==NULL) ) {
- temp.x = stack[sp-6].u.val; temp.y = stack[sp-5].u.val;
- Transform(&cur->last->nextcp,&temp,transform);
- cur->last->nonextcp = false;
- pt = chunkalloc(sizeof(SplinePoint));
- temp.x = stack[sp-4].u.val; temp.y = stack[sp-3].u.val;
- Transform(&pt->prevcp,&temp,transform);
- Transform(&pt->me,&current,transform);
- pt->nonextcp = true;
- CheckMake(cur->last,pt);
- SplineMake3(cur->last,pt);
- cur->last = pt;
- }
- sp -= 6;
- } else
- sp = 0;
- break;
- case pt_arc: case pt_arcn:
- if ( sp>=5 ) {
- real cx, cy, r, a1, a2;
- cx = stack[sp-5].u.val;
- cy = stack[sp-4].u.val;
- r = stack[sp-3].u.val;
- a1 = stack[sp-2].u.val;
- a2 = stack[sp-1].u.val;
- sp -= 5;
- temp.x = cx+r*cos(a1/180 * 3.1415926535897932);
- temp.y = cy+r*sin(a1/180 * 3.1415926535897932);
- if ( temp.x!=current.x || temp.y!=current.y ||
- !( cur!=NULL && cur->first!=NULL && (cur->first!=cur->last || cur->first->next==NULL) )) {
- pt = chunkalloc(sizeof(SplinePoint));
- Transform(&pt->me,&temp,transform);
- pt->noprevcp = true; pt->nonextcp = true;
- if ( cur!=NULL && cur->first!=NULL && (cur->first!=cur->last || cur->first->next==NULL) ) {
- CheckMake(cur->last,pt);
- SplineMake3(cur->last,pt);
- cur->last = pt;
- } else { /* if no current point, then start here */
- SplinePointList *spl = chunkalloc(sizeof(SplinePointList));
- spl->first = spl->last = pt;
- if ( cur!=NULL )
- cur->next = spl;
- else
- head = spl;
- cur = spl;
- }
- }
- circlearcsto(a1,a2,cx,cy,r,cur,transform,tok==pt_arcn);
- current.x = cx+r*cos(a2/180 * 3.1415926535897932);
- current.y = cy+r*sin(a2/180 * 3.1415926535897932);
- } else
- sp = 0;
- break;
- case pt_arct: case pt_arcto:
- if ( sp>=5 ) {
- real x1, y1, x2, y2, r;
- real xt1, xt2, yt1, yt2;
- x1 = stack[sp-5].u.val;
- y1 = stack[sp-4].u.val;
- x2 = stack[sp-3].u.val;
- y2 = stack[sp-2].u.val;
- r = stack[sp-1].u.val;
- sp -= 5;
-
- xt1 = xt2 = x1; yt1 = yt2 = y1;
- if ( cur==NULL || cur->first==NULL || (cur->first==cur->last && cur->first->next!=NULL) )
- /* Error */;
- else if ( current.x==x1 && current.y==y1 )
- /* Error */;
- else if (( x1==x2 && y1==y2 ) ||
- (current.x-x1)*(y2-y1) == (x2-x1)*(current.y-y1) ) {
- /* Degenerate case */
- current.x = x1; current.y = y1;
- pt = chunkalloc(sizeof(SplinePoint));
- Transform(&pt->me,&current,transform);
- pt->noprevcp = true; pt->nonextcp = true;
- CheckMake(cur->last,pt);
- SplineMake3(cur->last,pt);
- cur->last = pt;
- } else {
- real l1 = sqrt((current.x-x1)*(current.x-x1)+(current.y-y1)*(current.y-y1));
- real l2 = sqrt((x2-x1)*(x2-x1)+(y2-y1)*(y2-y1));
- real dx = ((current.x-x1)/l1 + (x2-x1)/l2);
- real dy = ((current.y-y1)/l1 + (y2-y1)/l2);
- /* the line from (x1,y1) to (x1+dx,y1+dy) contains the center*/
- real l3 = sqrt(dx*dx+dy*dy);
- real cx, cy, t, tmid;
- real a1, amid, a2;
- int clockwise = true;
- dx /= l3; dy /= l3;
- a1 = atan2(current.y-y1,current.x-x1);
- a2 = atan2(y2-y1,x2-x1);
- amid = atan2(dy,dx) - a1;
- tmid = r/sin(amid);
- t = r/tan(amid);
- if ( t<0 ) {
- clockwise = false;
- t = -t;
- tmid = -tmid;
- }
- cx = x1+ tmid*dx; cy = y1 + tmid*dy;
- xt1 = x1 + t*(current.x-x1)/l1; yt1 = y1 + t*(current.y-y1)/l1;
- xt2 = x1 + t*(x2-x1)/l2; yt2 = y1 + t*(y2-y1)/l2;
- if ( xt1!=current.x || yt1!=current.y ) {
- DBasePoint temp;
- temp.x = xt1; temp.y = yt1;
- pt = chunkalloc(sizeof(SplinePoint));
- Transform(&pt->me,&temp,transform);
- pt->noprevcp = true; pt->nonextcp = true;
- CheckMake(cur->last,pt);
- SplineMake3(cur->last,pt);
- cur->last = pt;
- }
- a1 = 3*3.1415926535897932/2+a1;
- a2 = 3.1415926535897932/2+a2;
- if ( !clockwise ) {
- a1 += 3.1415926535897932;
- a2 += 3.1415926535897932;
- }
- circlearcsto(a1*180/3.1415926535897932,a2*180/3.1415926535897932,
- cx,cy,r,cur,transform,clockwise);
- }
- if ( tok==pt_arcto ) {
- stack[sp].type = stack[sp+1].type = stack[sp+2].type = stack[sp+3].type = ps_num;
- stack[sp++].u.val = xt1;
- stack[sp++].u.val = yt1;
- stack[sp++].u.val = xt2;
- stack[sp++].u.val = yt2;
- }
- current.x = xt2; current.y = yt2;
- }
- break;
- case pt_closepath:
- if ( cur!=NULL && cur->first!=NULL && cur->first!=cur->last ) {
- if ( RealNear(cur->first->me.x,cur->last->me.x) && RealNear(cur->first->me.y,cur->last->me.y) ) {
- SplinePoint *oldlast = cur->last;
- cur->first->prevcp = oldlast->prevcp;
- cur->first->prevcp.x += (cur->first->me.x-oldlast->me.x);
- cur->first->prevcp.y += (cur->first->me.y-oldlast->me.y);
- cur->first->noprevcp = oldlast->noprevcp;
- oldlast->prev->from->next = NULL;
- cur->last = oldlast->prev->from;
- SplineFree(oldlast->prev);
- SplinePointFree(oldlast);
- }
- CheckMake(cur->last,cur->first);
- SplineMake3(cur->last,cur->first);
- cur->last = cur->first;
- }
- break;
- case pt_setlinecap:
- if ( sp>=1 )
- linecap = stack[--sp].u.val;
- break;
- case pt_setlinejoin:
- if ( sp>=1 )
- linejoin = stack[--sp].u.val;
- break;
- case pt_setlinewidth:
- if ( sp>=1 )
- linewidth = stack[--sp].u.val;
- break;
- case pt_setdash:
- if ( sp>=2 && stack[sp-1].type==ps_num && stack[sp-2].type==ps_array ) {
- sp -= 2;
- dash_offset = stack[sp+1].u.val;
- for ( i=0; i<DASH_MAX && i<stack[sp].u.dict.cnt; ++i )
- dashes[i] = stack[sp].u.dict.entries[i].u.val;
- dictfree(&stack[sp].u.dict);
- }
- break;
- case pt_currentlinecap: case pt_currentlinejoin:
- if ( sp<(int)(sizeof(stack)/sizeof(stack[0])) ) {
- stack[sp].type = ps_num;
- stack[sp++].u.val = tok==pt_currentlinecap?linecap:linejoin;
- }
- break;
- case pt_currentlinewidth:
- if ( sp<(int)(sizeof(stack)/sizeof(stack[0])) ) {
- stack[sp].type = ps_num;
- stack[sp++].u.val = linewidth;
- }
- break;
- case pt_currentdash:
- if ( sp+1<(int)(sizeof(stack)/sizeof(stack[0])) ) {
- struct pskeydict dict;
- dict.is_executable = 0;
- for ( i=0; i<DASH_MAX && dashes[i]!=0; ++i );
- dict.cnt = dict.max = i;
- dict.entries = gcalloc(i,sizeof(struct pskeyval));
- for ( j=0; j<i; ++j ) {
- dict.entries[j].type = ps_num;
- dict.entries[j].u.val = dashes[j];
- }
- stack[sp].type = ps_array;
- stack[sp++].u.dict = dict;
- stack[sp].type = ps_num;
- stack[sp++].u.val = dash_offset;
- }
- break;
- case pt_currentgray:
- if ( sp<(int)(sizeof(stack)/sizeof(stack[0])) ) {
- stack[sp].type = ps_num;
- stack[sp++].u.val = (3*((fore>>16)&0xff) + 6*((fore>>8)&0xff) + (fore&0xff))/2550.;
- }
- break;
- case pt_setgray:
- if ( sp>=1 ) {
- fore = stack[--sp].u.val*255;
- fore *= 0x010101;
- }
- break;
- case pt_setrgbcolor:
- if ( sp>=3 ) {
- fore = (((int) (stack[sp-3].u.val*255))<<16) +
- (((int) (stack[sp-2].u.val*255))<<8) +
- (int) (stack[sp-1].u.val*255);
- sp -= 3;
- }
- break;
- case pt_currenthsbcolor: case pt_currentrgbcolor:
- if ( sp+2<(int)(sizeof(stack)/sizeof(stack[0])) ) {
- stack[sp].type = stack[sp+1].type = stack[sp+2].type = ps_num;
- if ( tok==pt_currentrgbcolor ) {
- stack[sp++].u.val = ((fore>>16)&0xff)/255.;
- stack[sp++].u.val = ((fore>>8)&0xff)/255.;
- stack[sp++].u.val = (fore&0xff)/255.;
- } else {
- int r=fore>>16, g=(fore>>8)&0xff, bl=fore&0xff;
- int mx, mn;
- real h, s, b;
- mx = mn = r;
- if ( mx>g ) mn=g; else mx=g;
- if ( mx<bl ) mx = bl; if ( mn>bl ) mn = bl;
- b = mx/255.;
- s = h = 0;
- if ( mx>0 )
- s = ((real) (mx-mn))/mx;
- if ( s!=0 ) {
- real rdiff = ((real) (mx-r))/(mx-mn);
- real gdiff = ((real) (mx-g))/(mx-mn);
- real bdiff = ((real) (mx-bl))/(mx-mn);
- if ( rdiff==0 )
- h = bdiff-gdiff;
- else if ( gdiff==0 )
- h = 2 + rdiff-bdiff;
- else
- h = 4 + gdiff-rdiff;
- h /= 6;
- if ( h<0 ) h += 1;
- }
- stack[sp++].u.val = h;
- stack[sp++].u.val = s;
- stack[sp++].u.val = b;
- }
- }
- break;
- case pt_sethsbcolor:
- if ( sp>=3 ) {
- real h = stack[sp-3].u.val, s = stack[sp-2].u.val, b = stack[sp-1].u.val;
- int r=0,g=0,bl=0;
- if ( s==0 ) /* it's grey */
- fore = ((int) (b*255)) * 0x010101;
- else {
- real sextant = (h-floor(h))*6;
- real mod = sextant-floor(sextant);
- real p = b*(1-s), q = b*(1-s*mod), t = b*(1-s*(1-mod));
- switch( (int) sextant) {
- case 0:
- r = b*255.; g = t*255.; bl = p*255.;
- break;
- case 1:
- r = q*255.; g = b*255.; bl = p*255.;
- break;
- case 2:
- r = p*255.; g = b*255.; bl = t*255.;
- break;
- case 3:
- r = p*255.; g = q*255.; bl = b*255.;
- break;
- case 4:
- r = t*255.; g = p*255.; bl = b*255.;
- break;
- case 5:
- r = b*255.; g = p*255.; bl = q*255.;
- break;
- }
- fore = COLOR_CREATE(r,g,bl);
- }
- sp -= 3;
- }
- break;
- case pt_currentcmykcolor:
- if ( sp+3<(int)(sizeof(stack)/sizeof(stack[0])) ) {
- real c,m,y,k;
- stack[sp].type = stack[sp+1].type = stack[sp+2].type = stack[sp+3].type = ps_num;
- y = 1.-(fore&0xff)/255.;
- m = 1.-((fore>>8)&0xff)/255.;
- c = 1.-((fore>>16)&0xff)/255.;
- k = y; if ( k>m ) k=m; if ( k>c ) k=c;
- if ( k!=1 ) {
- y = (y-k)/(1-k);
- m = (m-k)/(1-k);
- c = (c-k)/(1-k);
- } else
- y = m = c = 0;
- stack[sp++].u.val = c;
- stack[sp++].u.val = m;
- stack[sp++].u.val = y;
- stack[sp++].u.val = k;
- }
- break;
- case pt_setcmykcolor:
- if ( sp>=4 ) {
- real c=stack[sp-4].u.val,m=stack[sp-3].u.val,y=stack[sp-2].u.val,k=stack[sp-1].u.val;
- sp -= 4;
- if ( k==1 )
- fore = 0x000000;
- else {
- if (( y = (1-k)*y+k )<0 ) y=0; else if ( y>1 ) y=1;
- if (( m = (1-k)*m+k )<0 ) m=0; else if ( m>1 ) m=1;
- if (( c = (1-k)*c+k )<0 ) c=0; else if ( c>1 ) c=1;
- fore = ((int) ((1-c)*255.)<<16) |
- ((int) ((1-m)*255.)<<8) |
- ((int) ((1-y)*255.));
- }
- }
- break;
- case pt_currentpoint:
- if ( sp+1<(int)(sizeof(stack)/sizeof(stack[0])) ) {
- stack[sp].type = ps_num;
- stack[sp++].u.val = current.x;
- stack[sp].type = ps_num;
- stack[sp++].u.val = current.y;
- }
- break;
- case pt_fill: case pt_stroke:
- if ( head==NULL && ec->splines!=NULL ) {
- /* assume they did a "gsave fill grestore stroke" (or reverse)*/
- ent = ec->splines;
- if ( tok==pt_stroke ) {
- ent->u.splines.cap = linecap; ent->u.splines.join = linejoin;
- ent->u.splines.stroke_width = linewidth;
- memcpy(ent->u.splines.transform,transform,sizeof(transform));
- }
- } else {
- ent = EntityCreate(head,linecap,linejoin,linewidth,transform,clippath);
- ent->next = ec->splines;
- ec->splines = ent;
- }
- if ( tok==pt_fill )
- ent->u.splines.fill.col = fore;
- else
- ent->u.splines.stroke.col = fore;
- head = NULL; cur = NULL;
- break;
- case pt_clip:
- /* I really should intersect the old clip path with the new, but */
- /* I don't trust my intersect routine, crashes too often */
- SplinePointListsFree(clippath);
- clippath = SplinePointListCopy(head);
- if ( clippath!=NULL && clippath->first!=clippath->last ) {
- SplineMake3(clippath->last,clippath->first);
- clippath->last = clippath->first;
- }
- break;
- case pt_imagemask:
- LogError( _("This version of FontForge does not support the imagemask operator.\nFor support configure --with-multilayer.\n") );
- if ( sp>=5 && (stack[sp-1].type==ps_instr || stack[sp-1].type==ps_string))
- sp -= 5;
- break;
-
- /* We don't do these right, but at least we'll avoid some errors with this hack */
- case pt_save: case pt_currentmatrix:
- /* push some junk on the stack */
- if ( sp<(int)(sizeof(stack)/sizeof(stack[0])) ) {
- stack[sp].type = ps_num;
- stack[sp++].u.val = 0;
- }
- /* Fall through into gsave */;
- case pt_gsave:
- if ( gsp<30 ) {
- memcpy(gsaves[gsp].transform,transform,sizeof(transform));
- gsaves[gsp].current = current;
- gsaves[gsp].linewidth = linewidth;
- gsaves[gsp].linecap = linecap;
- gsaves[gsp].linejoin = linejoin;
- gsaves[gsp].fore = fore;
- gsaves[gsp].clippath = SplinePointListCopy(clippath);
- ++gsp;
- /* I should be saving the "current path" too, but that's too hard */
- }
- break;
- case pt_restore: case pt_setmatrix:
- /* pop some junk off the stack */
- if ( sp>=1 )
- --sp;
- /* Fall through into grestore */;
- case pt_grestore:
- if ( gsp>0 ) {
- --gsp;
- memcpy(transform,gsaves[gsp].transform,sizeof(transform));
- current = gsaves[gsp].current;
- linewidth = gsaves[gsp].linewidth;
- linecap = gsaves[gsp].linecap;
- linejoin = gsaves[gsp].linejoin;
- fore = gsaves[gsp].fore;
- SplinePointListsFree(clippath);
- clippath = gsaves[gsp].clippath;
- }
- break;
- case pt_null:
- /* push a 0. I don't handle pointers properly */
- if ( sp<(int)(sizeof(stack)/sizeof(stack[0])) ) {
- stack[sp].u.val = 0;
- stack[sp++].type = ps_num;
- }
- break;
- case pt_currentoverprint:
- /* push false. I don't handle this properly */
- if ( sp<(int)(sizeof(stack)/sizeof(stack[0])) ) {
- stack[sp].u.val = 0;
- stack[sp++].type = ps_bool;
- }
- break;
- case pt_setoverprint:
- /* pop one item on stack */
- if ( sp>=1 )
- --sp;
- break;
- case pt_currentflat:
- /* push 1.0 (default value). I don't handle this properly */
- if ( sp<(int)(sizeof(stack)/sizeof(stack[0]) )) {
- stack[sp].u.val = 1.0;
- stack[sp++].type = ps_num;
- }
- break;
- case pt_setflat:
- /* pop one item on stack */
- if ( sp>=1 )
- --sp;
- break;
- case pt_currentmiterlimit:
- /* push 10.0 (default value). I don't handle this properly */
- if ( sp<(int)(sizeof(stack)/sizeof(stack[0])) ) {
- stack[sp].u.val = 10.0;
- stack[sp++].type = ps_num;
- }
- break;
- case pt_setmiterlimit:
- /* pop one item off stack */
- if ( sp>=1 )
- --sp;
- break;
- case pt_currentpacking:
- /* push false (default value). I don't handle this properly */
- if ( sp<(int)(sizeof(stack)/sizeof(stack[0])) ) {
- stack[sp].u.val = 0;
- stack[sp++].type = ps_bool;
- }
- break;
- case pt_setpacking:
- /* pop one item on stack */
- if ( sp>=1 )
- --sp;
- break;
- case pt_currentstrokeadjust:
- /* push false (default value). I don't handle this properly */
- if ( sp<(int)(sizeof(stack)/sizeof(stack[0])) ) {
- stack[sp].u.val = 0;
- stack[sp++].type = ps_bool;
- }
- break;
- case pt_setstrokeadjust:
- /* pop one item on stack */
- if ( sp>=1 )
- --sp;
- break;
- case pt_currentsmoothness:
- /* default value is installation dependant. I don't handle this properly */
- if ( sp<(int)(sizeof(stack)/sizeof(stack[0])) ) {
- stack[sp].u.val = 1.0;
- stack[sp++].type = ps_num;
- }
- break;
- case pt_setsmoothness:
- /* pop one item on stack */
- if ( sp>=1 )
- --sp;
- break;
- case pt_currentobjectformat:
- /* default value is installation dependant. I don't handle this properly */
- if ( sp<(int)(sizeof(stack)/sizeof(stack[0])) ) {
- stack[sp].u.val = 0.0;
- stack[sp++].type = ps_num;
- }
- break;
- case pt_setobjectformat:
- /* pop one item on stack */
- if ( sp>=1 )
- --sp;
- break;
- case pt_currentglobal: case pt_currentshared:
- /* push false (default value). I don't handle this properly */
- if ( sp<(int)(sizeof(stack)/sizeof(stack[0])) ) {
- stack[sp].u.val = 0;
- stack[sp++].type = ps_bool;
- }
- break;
- case pt_setglobal:
- /* pop one item on stack */
- if ( sp>=1 )
- --sp;
- break;
-
- case pt_openarray: case pt_mark:
- if ( sp<(int)(sizeof(stack)/sizeof(stack[0])) ) {
- stack[sp++].type = ps_mark;
- }
- break;
- case pt_counttomark:
- for ( i=0; i<sp; ++i )
- if ( stack[sp-1-i].type==ps_mark )
- break;
- if ( i==sp )
- LogError( _("No mark in counttomark\n") );
- else if ( sp<(int)(sizeof(stack)/sizeof(stack[0])) ) {
- stack[sp].type = ps_num;
- stack[sp++].u.val = i;
- }
- break;
- case pt_cleartomark:
- for ( i=0; i<sp; ++i )
- if ( stack[sp-1-i].type==ps_mark )
- break;
- if ( i==sp )
- LogError( _("No mark in cleartomark\n") );
- else {
- while ( sp>=i ) {
- --sp;
- if ( stack[sp].type==ps_string || stack[sp].type==ps_instr ||
- stack[sp].type==ps_lit )
- free(stack[sp].u.str);
- else if ( stack[sp].type==ps_array || stack[sp].type==ps_dict )
- dictfree(&stack[sp].u.dict);
- }
- }
- break;
- case pt_closearray:
- for ( i=0; i<sp; ++i )
- if ( stack[sp-1-i].type==ps_mark )
- break;
- if ( i==sp )
- LogError( _("No mark in ] (close array)\n") );
- else {
- struct pskeydict dict;
- dict.is_executable = 0;
- dict.cnt = dict.max = i;
- dict.entries = gcalloc(i,sizeof(struct pskeyval));
- for ( j=0; j<i; ++j ) {
- dict.entries[j].type = stack[sp-i+j].type;
- dict.entries[j].u = stack[sp-i+j].u;
- /* don't need to copy because the things on the stack */
- /* are being popped (don't need to free either) */
- }
- collectgarbage(&tofrees,&dict);
- sp = sp-i;
- stack[sp-1].type = ps_array;
- stack[sp-1].u.dict = dict;
- }
- break;
- case pt_array:
- if ( sp>=1 && stack[sp-1].type==ps_num ) {
- struct pskeydict dict;
- dict.is_executable = 0;
- dict.cnt = dict.max = stack[sp-1].u.val;
- dict.entries = gcalloc(dict.cnt,sizeof(struct pskeyval));
- /* all entries are inited to void */
- stack[sp-1].type = ps_array;
- stack[sp-1].u.dict = dict;
- }
- break;
- case pt_aload:
- sp = aload(sp,stack,sizeof(stack)/sizeof(stack[0]),&tofrees);
- break;
- case pt_astore:
- if ( sp>=1 && stack[sp-1].type==ps_array ) {
- struct pskeydict dict;
- --sp;
- dict = stack[sp].u.dict;
- if ( sp>=dict.cnt ) {
- for ( i=dict.cnt-1; i>=0 ; --i ) {
- --sp;
- dict.entries[i].type = stack[sp].type;
- dict.entries[i].u = stack[sp].u;
- }
- }
- stack[sp].type = ps_array;
- stack[sp].u.dict = dict;
- ++sp;
- }
- break;
-
- case pt_output: case pt_outputd: case pt_print:
- if ( sp>=1 ) {
- --sp;
- switch ( stack[sp].type ) {
- case ps_num:
- printf( "%g", (double) stack[sp].u.val );
- break;
- case ps_bool:
- printf( "%s", stack[sp].u.tf ? "true" : "false" );
- break;
- case ps_string: case ps_instr: case ps_lit:
- if ( tok==pt_outputd )
- printf( stack[sp].type==ps_lit ? "/" :
- stack[sp].type==ps_string ? "(" : "{" );
- printf( "%s", stack[sp].u.str );
- if ( tok==pt_outputd )
- printf( stack[sp].type==ps_lit ? "" :
- stack[sp].type==ps_string ? ")" : "}" );
- free(stack[sp].u.str);
- break;
- case ps_void:
- printf( "-- void --" );
- break;
- case ps_array:
- if ( tok==pt_outputd ) {
- printarray(&stack[sp].u.dict);
- dictfree(&stack[sp].u.dict);
- break;
- } /* else fall through */
- dictfree(&stack[sp].u.dict);
- default:
- printf( "-- nostringval --" );
- break;
- }
- if ( tok==pt_output || tok==pt_outputd )
- printf( "\n" );
- } else
- LogError( _("Nothing on stack to print\n") );
- break;
-
- case pt_cvi: case pt_cvr:
- /* I shan't distinguish between integers and reals */
- if ( sp>=1 && stack[sp-1].type==ps_string ) {
- double val = strtod(stack[sp-1].u.str,NULL);
- free(stack[sp-1].u.str);
- stack[sp-1].u.val = val;
- stack[sp-1].type = ps_num;
- }
- break;
- case pt_cvlit:
- if ( sp>=1 ) {
- if ( stack[sp-1].type==ps_array )
- stack[sp-1].u.dict.is_executable = false;
- }
- case pt_cvn:
- if ( sp>=1 ) {
- if ( stack[sp-1].type==ps_string )
- stack[sp-1].type = ps_lit;
- }
- case pt_cvx:
- if ( sp>=1 ) {
- if ( stack[sp-1].type==ps_array )
- stack[sp-1].u.dict.is_executable = true;
- }
- break;
- case pt_cvrs:
- if ( sp>=3 && stack[sp-1].type==ps_string &&
- stack[sp-2].type==ps_num &&
- stack[sp-3].type==ps_num ) {
- if ( stack[sp-2].u.val==8 )
- sprintf( stack[sp-1].u.str, "%o", (int) stack[sp-3].u.val );
- else if ( stack[sp-2].u.val==16 )
- sprintf( stack[sp-1].u.str, "%X", (int) stack[sp-3].u.val );
- else /* default to radix 10 no matter what they asked for */
- sprintf( stack[sp-1].u.str, "%g", (double) stack[sp-3].u.val );
- stack[sp-3] = stack[sp-1];
- sp-=2;
- }
- break;
- case pt_cvs:
- if ( sp>=2 && stack[sp-1].type==ps_string ) {
- switch ( stack[sp].type ) {
- case ps_num:
- sprintf( stack[sp-1].u.str, "%g", (double) stack[sp-2].u.val );
- break;
- case ps_bool:
- sprintf( stack[sp-1].u.str, "%s", stack[sp-2].u.tf ? "true" : "false" );
- break;
- case ps_string: case ps_instr: case ps_lit:
- sprintf( stack[sp-1].u.str, "%s", stack[sp-2].u.str );
- free(stack[sp].u.str);
- break;
- case ps_void:
- printf( "-- void --" );
- break;
- case ps_array:
- dictfree(&stack[sp].u.dict);
- default:
- sprintf( stack[sp-1].u.str, "-- nostringval --" );
- break;
- }
- stack[sp-2] = stack[sp-1];
- --sp;
- }
- break;
- case pt_stringop: /* the string keyword, not the () thingy */
- if ( sp>=1 && stack[sp-1].type==ps_num ) {
- stack[sp-1].type = ps_string;
- stack[sp-1].u.str = gcalloc(stack[sp-1].u.val+1,1);
- }
- break;
-
- case pt_unknown:
- if ( !warned ) {
- LogError( _("Warning: Unable to parse token %s, some features may be lost\n"), tokbuf );
- warned = true;
- }
- break;
-
- default:
- break;
- }}
- }
- done:
- if ( rs!=NULL ) {
- int i, cnt, j;
- for ( i=sp-1; i>=0; --i )
- if ( stack[i].type!=ps_num )
- break;
- cnt = sp-1-i;
- if ( cnt>rs->max ) cnt = rs->max;
- rs->cnt = cnt;
- for ( j=i+1; j<sp; ++j )
- rs->stack[j-i-1] = stack[j].u.val;
- }
- freestuff(stack,sp,&dict,&gb,&tofrees);
- if ( head!=NULL ) {
- ent = EntityCreate(head,linecap,linejoin,linewidth,transform,clippath);
- ent->next = ec->splines;
- ec->splines = ent;
- }
- while ( gsp>0 ) {
- --gsp;
- SplinePointListsFree(gsaves[gsp].clippath);
- }
- SplinePointListsFree(clippath);
- ECCatagorizePoints(ec);
- if ( ec->width == UNDEFINED_WIDTH )
- ec->width = wrapper->advance_width;
- setlocale(LC_NUMERIC,oldloc);
-}
-
-static void InterpretPS(FILE *ps, char *psstr, EntityChar *ec, RetStack *rs) {
- IO wrapper;
-
- memset(&wrapper,0,sizeof(wrapper));
- wrapper.advance_width = UNDEFINED_WIDTH;
- pushio(&wrapper,ps,psstr,0);
- _InterpretPS(&wrapper,ec,rs);
-}
-
-static SplinePointList *EraseStroke(SplineChar *sc,SplinePointList *head,SplinePointList *erase) {
- SplineSet *spl, *last;
- SplinePoint *sp;
-
- if ( head==NULL ) {
- /* Pointless, but legal */
- SplinePointListsFree(erase);
-return( NULL );
- }
-
- last = NULL;
- for ( spl=head; spl!=NULL; spl=spl->next ) {
- for ( sp=spl->first; sp!=NULL; ) {
- sp->selected = false;
- if ( sp->next==NULL )
- break;
- sp = sp->next->to;
- if ( sp==spl->first )
- break;
- }
- last = spl;
- }
- for ( spl=erase; spl!=NULL; spl=spl->next ) {
- for ( sp=spl->first; sp!=NULL; ) {
- sp->selected = true;
- if ( sp->next==NULL )
- break;
- sp = sp->next->to;
- if ( sp==spl->first )
- break;
- }
- }
- last->next = erase;
-return( SplineSetRemoveOverlap(sc,head,over_exclude) );
-}
-
-static Entity *EntityReverse(Entity *ent) {
- Entity *next, *last = NULL;
-
- while ( ent!=NULL ) {
- next = ent->next;
- ent->next = last;
- last = ent;
- ent = next;
- }
-return( last );
-}
-
-void SFSplinesFromLayers(SplineFont *sf, int tostroke) {
- (void)sf;
- (void)tostroke;
-}
-
-static void EntityCharCorrectDir(EntityChar *ec) {
- SplineSet *ss;
- Entity *ent;
- int changed;
-
- for ( ent=ec->splines; ent!=NULL; ent = ent->next ) {
- /* ignore splines which are only stoked, but not filled */
- if ( ent->type == et_splines && ent->u.splines.fill.col!=0xffffffff ) {
- /* Correct the direction of each stroke or fill with respect to */
- /* the splines in it */
- SplineSetsCorrect(ent->u.splines.splines,&changed);
- if ( ent->u.splines.fill.col==0xffffff ) {
- /* If they are filling with white, then assume they mean */
- /* an internal area that should be drawn backwards */
- for ( ss=ent->u.splines.splines; ss!=NULL; ss=ss->next )
- SplineSetReverse(ss);
- }
- SplineSetsCorrect(ent->clippath,&changed);
- }
- }
-}
-
-static void EntityDefaultStrokeFill(Entity *ent) {
- while ( ent!=NULL ) {
- if ( ent->type == et_splines &&
- ent->u.splines.stroke.col==0xffffffff &&
- ent->u.splines.fill.col==0xffffffff ) {
- SplineSet *spl;
- int all=1;
- for ( spl=ent->u.splines.splines; spl!=NULL; spl=spl->next )
- if ( spl->first->prev!=NULL ) {
- all = false;
- break;
- }
- if ( all && ent->u.splines.splines!=NULL &&
- (ent->u.splines.stroke_width==0 || ent->u.splines.stroke_width==WIDTH_INHERITED))
- ent->u.splines.stroke_width=40; /* random guess */
- if (ent->u.splines.stroke_width==0 || ent->u.splines.stroke_width==WIDTH_INHERITED)
- ent->u.splines.fill.col = COLOR_INHERITED;
- else
- ent->u.splines.stroke.col = COLOR_INHERITED;
- }
- ent = ent->next;
- }
-}
-
-static SplinePointList *SplinesFromEntityChar(EntityChar *ec,int *flags,int is_stroked) {
- Entity *ent, *next;
- SplinePointList *head=NULL, *last=NULL, *new, *nlast=NULL, *temp, *each, *transed;
- StrokeInfo si;
- real inversetrans[6];
- /*SplineSet *spl;*/
- int handle_eraser = false;
- int ask = false;
-
- EntityDefaultStrokeFill(ec->splines);
-
- if ( !is_stroked ) {
-
- if ( *flags==-1 ) {
- for ( ent=ec->splines; ent!=NULL; ent = ent->next ) {
- if ( ent->type == et_splines &&
- (ent->u.splines.fill.col==0xffffff ||
- /*ent->u.splines.clippath!=NULL ||*/
- (ent->u.splines.stroke_width!=0 && ent->u.splines.stroke.col!=0xffffffff))) {
- ask = true;
- break;
- }
- }
- if ( ask )
- *flags = PsStrokeFlagsDlg();
- }
-
- if ( *flags & sf_correctdir ) /* Will happen if flags still unset (-1) */
- EntityCharCorrectDir(ec);
-
- handle_eraser = *flags!=-1 && (*flags & sf_handle_eraser);
- if ( handle_eraser )
- ec->splines = EntityReverse(ec->splines);
- }
-
- for ( ent=ec->splines; ent!=NULL; ent = next ) {
- next = ent->next;
- if ( ent->type == et_splines && is_stroked ) {
- if ( head==NULL )
- head = ent->u.splines.splines;
- else
- last->next = ent->u.splines.splines;
- if ( ent->u.splines.splines!=NULL )
- for ( last = ent->u.splines.splines; last->next!=NULL; last=last->next );
- ent->u.splines.splines = NULL;
- } else if ( ent->type == et_splines ) {
- if ( ent->u.splines.stroke.col!=0xffffffff &&
- (ent->u.splines.fill.col==0xffffffff || ent->u.splines.stroke_width!=0)) {
- /* What does a stroke width of 0 mean? PS Says minimal width line */
- /* How do we implement that? Special case: If filled and stroked 0, then */
- /* ignore the stroke. This idiom is used by MetaPost sometimes and means */
- /* no stroke */
- memset(&si,'\0',sizeof(si));
- si.toobigwarn = *flags & sf_toobigwarn ? 1 : 0;
- si.join = ent->u.splines.join;
- si.cap = ent->u.splines.cap;
- si.removeoverlapifneeded = *flags & sf_removeoverlap ? 1 : 0;
- si.radius = ent->u.splines.stroke_width/2;
- if ( ent->u.splines.stroke_width==WIDTH_INHERITED )
- si.radius = .5;
- if ( si.cap == lc_inherited ) si.cap = lc_butt;
- if ( si.join == lc_inherited ) si.join = lj_miter;
- new = NULL;
-#if 0
- SSBisectTurners(ent->u.splines.splines);
-#endif
- MatInverse(inversetrans,ent->u.splines.transform);
- transed = SplinePointListTransform(SplinePointListCopy(
- ent->u.splines.splines),inversetrans,true);
- for ( each = transed; each!=NULL; each=each->next ) {
- temp = SplineSetStroke(each,&si,ec->sc);
- if ( new==NULL )
- new=temp;
- else
- nlast->next = temp;
- if ( temp!=NULL )
- for ( nlast=temp; nlast->next!=NULL; nlast=nlast->next );
- }
- new = SplinePointListTransform(new,ent->u.splines.transform,true);
- SplinePointListsFree(transed);
- if ( handle_eraser && ent->u.splines.stroke.col==0xffffff ) {
- head = EraseStroke(ec->sc,head,new);
- last = head;
- if ( last!=NULL )
- for ( ; last->next!=NULL; last=last->next );
- } else {
- if ( head==NULL )
- head = new;
- else
- last->next = new;
- if ( new!=NULL )
- for ( last = new; last->next!=NULL; last=last->next );
- }
- if ( si.toobigwarn )
- *flags |= sf_toobigwarn;
- }
- /* If they have neither a stroke nor a fill, pretend they said fill */
- if ( ent->u.splines.fill.col==0xffffffff && ent->u.splines.stroke.col!=0xffffffff )
- SplinePointListsFree(ent->u.splines.splines);
- else if ( handle_eraser && ent->u.splines.fill.col==0xffffff ) {
- head = EraseStroke(ec->sc,head,ent->u.splines.splines);
- last = head;
- if ( last!=NULL )
- for ( ; last->next!=NULL; last=last->next );
- } else {
- new = ent->u.splines.splines;
- if ( head==NULL )
- head = new;
- else
- last->next = new;
- if ( new!=NULL )
- for ( last = new; last->next!=NULL; last=last->next );
- }
- }
- SplinePointListsFree(ent->clippath);
- free(ent);
- }
-return( head );
-}
-
-
-static RefChar *revrefs(RefChar *cur) {
- RefChar *p, *n;
-
- if ( cur==NULL )
-return( NULL );
-
- p = NULL;
- for ( ; (n=cur->next)!=NULL; cur = n ) {
- cur->next = p;
- p = cur;
- }
- cur->next = p;
-return( cur );
-}
-
-static void SCInterpretPS(FILE *ps,SplineChar *sc, int *flags) {
- EntityChar ec;
- real dval;
- char tokbuf[10];
- IO wrapper;
- int ch;
-
- while ( isspace(ch = getc(ps)) );
- ungetc(ch,ps);
-
- memset(&wrapper,0,sizeof(wrapper));
- wrapper.advance_width = UNDEFINED_WIDTH;
- if ( ch!='<' ) {
- pushio(&wrapper,ps,NULL,0);
-
- if ( nextpstoken(&wrapper,&dval,tokbuf,sizeof(tokbuf))!=pt_opencurly )
- LogError( _("We don't understand this font\n") );
- } else {
- (void) getc(ps);
- pushfogio(&wrapper,ps);
- }
- memset(&ec,'\0',sizeof(ec));
- ec.fromtype3 = true;
- ec.sc = sc;
- _InterpretPS(&wrapper,&ec,NULL);
- sc->width = ec.width;
- sc->layers[ly_fore].splines = SplinesFromEntityChar(&ec,flags,false);
- sc->layers[ly_fore].refs = revrefs(ec.refs);
- free(wrapper.top);
-}
-
-void PSFontInterpretPS(FILE *ps,struct charprocs *cp,char **encoding) {
- char tokbuf[100];
- int tok,i, j;
- real dval;
- SplineChar *sc; EntityChar dummy;
- RefChar *p, *ref, *next;
- IO wrapper;
- int flags = -1;
-
- wrapper.top = NULL;
- wrapper.advance_width = UNDEFINED_WIDTH;
- pushio(&wrapper,ps,NULL,0);
-
- while ( (tok = nextpstoken(&wrapper,&dval,tokbuf,sizeof(tokbuf)))!=pt_eof && tok!=pt_end ) {
- if ( tok==pt_namelit ) {
- if ( cp->next>=cp->cnt ) {
- ++cp->cnt;
- cp->keys = grealloc(cp->keys,cp->cnt*sizeof(char *));
- cp->values = grealloc(cp->values,cp->cnt*sizeof(char *));
- }
- if ( cp->next<cp->cnt ) {
- sc = SplineCharCreate(2);
- cp->keys[cp->next] = copy(tokbuf);
- cp->values[cp->next++] = sc;
- sc->name = copy(tokbuf);
- SCInterpretPS(ps,sc,&flags);
- ff_progress_next();
- } else {
- memset(&dummy,0,sizeof(dummy));
- dummy.fromtype3 = true;
- InterpretPS(ps,NULL,&dummy,NULL);
- }
- }
- }
- free(wrapper.top);
-
- /* References were done by name in the postscript. we stored the names in */
- /* ref->sc (which is a hack). Now look up all those names and replace */
- /* with the appropriate splinechar. If we can't find anything then throw */
- /* out the reference */
- /* Further fixups come later, where all ps refs are fixedup */
- for ( i=0; i<cp->next; ++i ) {
- for ( p=NULL, ref=cp->values[i]->layers[ly_fore].refs; ref!=NULL; ref=next ) {
- char *refname = (char *) (ref->sc);
- next = ref->next;
- if ( ref->sc==NULL )
- refname=encoding[ref->orig_pos];
- for ( j=0; j<cp->next; ++j )
- if ( strcmp(cp->keys[j],refname)==0 )
- break;
- free(ref->sc); /* a string, not a splinechar */
- if ( j!=cp->next ) {
- ref->sc = cp->values[j];
- SCMakeDependent(cp->values[i],ref->sc);
- ref->adobe_enc = getAdobeEnc(ref->sc->name);
- ref->checked = true;
- p = ref;
- } else {
- if ( p==NULL )
- cp->values[i]->layers[ly_fore].refs = next;
- else
- p->next = next;
- ref->next = NULL;
- RefCharFree(ref);
- }
- }
- }
-}
-
-static void closepath(SplinePointList *cur, int is_type2) {
- if ( cur!=NULL && cur->first==cur->last && cur->first->prev==NULL && is_type2 )
-return; /* The "path" is just a single point created by a moveto */
- /* Probably we're just doing another moveto */
- if ( cur!=NULL && cur->first!=NULL && cur->first!=cur->last ) {
-/* I allow for greater errors here than I do in the straight postscript code */
-/* because: 1) the rel-rel operators will accumulate more rounding errors */
-/* 2) I only output 2 decimal digits after the decimal in type1 output */
- if ( RealWithin(cur->first->me.x,cur->last->me.x,.05) && RealWithin(cur->first->me.y,cur->last->me.y,.05) ) {
- SplinePoint *oldlast = cur->last;
- cur->first->prevcp = oldlast->prevcp;
- cur->first->prevcp.x += (cur->first->me.x-oldlast->me.x);
- cur->first->prevcp.y += (cur->first->me.y-oldlast->me.y);
- cur->first->noprevcp = oldlast->noprevcp;
- oldlast->prev->from->next = NULL;
- cur->last = oldlast->prev->from;
- chunkfree(oldlast->prev,sizeof(*oldlast));
- chunkfree(oldlast->hintmask,sizeof(HintMask));
- chunkfree(oldlast,sizeof(*oldlast));
- }
- CheckMake(cur->last,cur->first);
- SplineMake3(cur->last,cur->first);
- cur->last = cur->first;
- }
-}
-
-static void UnblendFree(StemInfo *h ) {
- while ( h!=NULL ) {
- chunkfree(h->u.unblended,sizeof(real [2][MmMax]));
- h->u.unblended = NULL;
- h = h->next;
- }
-}
-
-static StemInfo *HintsAppend(StemInfo *to,StemInfo *extra) {
- StemInfo *h;
-
- if ( to==NULL )
-return( extra );
- if ( extra==NULL )
-return( to );
- for ( h=to; h->next!=NULL; h=h->next );
- h->next = extra;
-return( to );
-}
-
-static StemInfo *HintNew(double start,double width) {
- StemInfo *h;
-
- h = chunkalloc(sizeof(StemInfo));
- h->start = start;
- h->width = width;
-return( h );
-}
-
-static void RemapHintMask(HintMask *hm,int mapping[96],int max) {
- HintMask rpl;
- int i, mb;
-
- if ( hm==NULL )
-return;
-
- if ( max>96 ) max = 96;
- mb = (max+7)>>3;
-
- memset(&rpl,0,mb);
- for ( i=0; i<max; ++i ) if ( (*hm)[i>>3]&(0x80>>(i&0x7)) )
- rpl[mapping[i]>>3] |= (0x80>>(mapping[i]&0x7));
- memcpy(hm,&rpl,mb);
-}
-
-static void HintsRenumber(SplineChar *sc) {
- /* In a type1 font the hints may get added to our hint list in a semi- */
- /* random order. In an incorrect type2 font the same thing could happen. */
- /* Force the order to be correct, and then update all masks */
- int mapping[96];
- int i, max;
- StemInfo *h;
- SplineSet *spl;
- SplinePoint *sp;
-
- for ( i=0; i<96; ++i ) mapping[i] = i;
-
- i = 0;
- for ( h=sc->hstem; h!=NULL; h=h->next ) {
- if ( h->hintnumber<96 && i<96 ) {
- mapping[h->hintnumber] = i;
- h->hintnumber = i++;
- }
- chunkfree(h->u.unblended,sizeof(real [2][MmMax]));
- h->u.unblended = NULL;
- }
- for ( h=sc->vstem; h!=NULL; h=h->next ) {
- if ( h->hintnumber<96 && i<96 ) {
- mapping[h->hintnumber] = i;
- h->hintnumber = i++;
- }
- chunkfree(h->u.unblended,sizeof(real [2][MmMax]));
- h->u.unblended = NULL;
- }
- max = i;
- for ( i=0; i<max; ++i )
- if ( mapping[i]!=i )
- break;
- if ( i==max )
-return; /* Didn't change the order */
-
- for ( i=0; i<sc->countermask_cnt; ++i )
- RemapHintMask(&sc->countermasks[i],mapping,max);
- for ( spl = sc->layers[ly_fore].splines; spl!=NULL; spl=spl->next ) {
- for ( sp = spl->first; ; ) {
- RemapHintMask(sp->hintmask,mapping,max);
- if ( sp->next==NULL )
- break;
- sp = sp->next->to;
- if ( sp==spl->first )
- break;
- }
- }
-}
-
-int UnblendedCompare(real u1[MmMax], real u2[MmMax], int cnt) {
- int i;
-
- for ( i=0; i<cnt; ++i ) {
- if ( u1[i]!=u2[i] )
-return( u1[i]>u2[i]?1:-1 );
- }
-return( 0 );
-}
-
-static StemInfo *SameH(StemInfo *old,real start, real width,
- real unblended[2][MmMax], int instance_count) {
- StemInfo *sameh;
-
- if ( instance_count==0 ) {
- for ( sameh=old; sameh!=NULL; sameh=sameh->next )
- if ( sameh->start==start && sameh->width==width)
- break;
- } else { int j;
- for ( j=1; j<instance_count; ++j ) {
- unblended[0][j] += unblended[0][j-1];
- unblended[1][j] += unblended[1][j-1];
- }
- for ( sameh=old; sameh!=NULL; sameh=sameh->next ) {
- if ( (*sameh->u.unblended)[0] == NULL || (*sameh->u.unblended)[1]==NULL )
- continue;
- if ( UnblendedCompare((*sameh->u.unblended)[0],unblended[0],instance_count)==0 &&
- UnblendedCompare((*sameh->u.unblended)[1],unblended[1],instance_count)==0)
- break;
- }
- }
-return( sameh );
-}
-
-static real Blend(real u[MmMax],struct pscontext *context) {
- real sum = u[0];
- int i;
-
- for ( i=1; i<context->instance_count; ++i )
- sum += context->blend_values[i]*u[i];
-return( sum );
-}
-
-/* this handles either Type1 or Type2 charstrings. Type2 charstrings have */
-/* more operators than Type1s and the old operators have extended meanings */
-/* (ie. the rlineto operator can produce more than one line). But pretty */
-/* much it's a superset and if we parse for type2 (with a few additions) */
-/* we'll get it right */
-/* Char width is done differently. Moveto starts a newpath. 0xff starts a 16.16*/
-/* number rather than a 32 bit number */
-SplineChar *PSCharStringToSplines(uint8 *type1, int len, struct pscontext *context,
- struct pschars *subrs, struct pschars *gsubrs, const char *name) {
- int is_type2 = context->is_type2;
- real stack[50]; int sp=0, v; /* Type1 stack is about 25 long, Type2 stack is 48 */
- real transient[32];
- SplineChar *ret = SplineCharCreate(2);
- SplinePointList *cur=NULL, *oldcur=NULL;
- RefChar *r1, *r2, *rlast=NULL;
- DBasePoint current;
- real dx, dy, dx2, dy2, dx3, dy3, dx4, dy4, dx5, dy5, dx6=0, dy6;
- SplinePoint *pt;
- /* subroutines may be nested to a depth of 10 */
- struct substate { unsigned char *type1; int len; int subnum; } pcstack[11];
- int pcsp=0;
- StemInfo *hint, *hp;
- real pops[30];
- int popsp=0;
- int base, polarity;
- real coord;
- struct pschars *s;
- int hint_cnt = 0;
- StemInfo *activeh=NULL, *activev=NULL, *sameh;
- HintMask *pending_hm = NULL;
- HintMask *counters[96];
- int cp=0;
- real unblended[2][MmMax];
- int last_was_b1=false, old_last_was_b1;
-
- if ( !is_type2 && context->instance_count>1 )
- memset(unblended,0,sizeof(unblended));
-
- ret->name = copy( name );
- ret->unicodeenc = -1;
- ret->width = (int16) 0x8000;
- if ( name==NULL ) name = "unnamed";
- ret->manualhints = true;
-
- current.x = current.y = 0;
- while ( len>0 ) {
- if ( sp>48 ) {
- LogError( _("Stack got too big in %s\n"), name );
- sp = 48;
- }
- base = 0;
- --len;
- if ( (v = *type1++)>=32 ) {
- if ( v<=246) {
- stack[sp++] = v - 139;
- } else if ( v<=250 ) {
- stack[sp++] = (v-247)*256 + *type1++ + 108;
- --len;
- } else if ( v<=254 ) {
- stack[sp++] = -(v-251)*256 - *type1++ - 108;
- --len;
- } else {
- int val = (*type1<<24) | (type1[1]<<16) | (type1[2]<<8) | type1[3];
- stack[sp++] = val;
- type1 += 4;
- len -= 4;
- if ( is_type2 ) {
-#ifndef PSFixed_Is_TTF /* The type2 spec is contradictory. It says this is a */
- /* two's complement number, but it also says it is a */
- /* Fixed, which in truetype is not two's complement */
- /* (mantisa is always unsigned) */
- stack[sp-1] /= 65536.;
-#else
- int mant = val&0xffff;
- stack[sp-1] = (val>>16) + mant/65536.;
-#endif
- }
- }
- } else if ( v==28 ) {
- stack[sp++] = (short) ((type1[0]<<8) | type1[1]);
- type1 += 2;
- len -= 2;
- /* In the Dict tables of CFF, a 5byte fixed value is prefixed by a */
- /* 29 code. In Type2 strings the prefix is 255. */
- } else if ( v==12 ) {
- old_last_was_b1 = last_was_b1; last_was_b1 = false;
- v = *type1++;
- --len;
- switch ( v ) {
- case 0: /* dotsection */
- sp = 0;
- break;
- case 1: /* vstem3 */ /* specifies three v hints zones at once */
- if ( sp<6 ) LogError( _("Stack underflow on vstem3 in %s\n"), name );
- /* according to the standard, if there is a vstem3 there can't */
- /* be any vstems, so there can't be any confusion about hint order */
- /* so we don't need to worry about unblended stuff */
- sameh = NULL;
- if ( !is_type2 )
- sameh = SameH(ret->vstem,stack[0] + ret->lsidebearing,stack[1],
- unblended,0);
- hint = HintNew(stack[0] + ret->lsidebearing,stack[1]);
- hint->hintnumber = sameh!=NULL ? sameh->hintnumber : hint_cnt++;
- if ( activev==NULL )
- activev = hp = hint;
- else {
- for ( hp=activev; hp->next!=NULL; hp = hp->next );
- hp->next = hint;
- hp = hint;
- }
- sameh = NULL;
- if ( !is_type2 )
- sameh = SameH(ret->vstem,stack[2] + ret->lsidebearing,stack[3],
- unblended,0);
- hp->next = HintNew(stack[2] + ret->lsidebearing,stack[3]);
- hp->next->hintnumber = sameh!=NULL ? sameh->hintnumber : hint_cnt++;
- if ( !is_type2 )
- sameh = SameH(ret->vstem,stack[4] + ret->lsidebearing,stack[5],
- unblended,0);
- hp->next->next = HintNew(stack[4] + ret->lsidebearing,stack[5]);
- hp->next->next->hintnumber = sameh!=NULL ? sameh->hintnumber : hint_cnt++;
- if ( !is_type2 && hp->next->next->hintnumber<96 ) {
- if ( pending_hm==NULL )
- pending_hm = chunkalloc(sizeof(HintMask));
- (*pending_hm)[hint->hintnumber>>3] |= 0x80>>(hint->hintnumber&0x7);
- (*pending_hm)[hint->next->hintnumber>>3] |= 0x80>>(hint->next->hintnumber&0x7);
- (*pending_hm)[hint->next->next->hintnumber>>3] |= 0x80>>(hint->next->next->hintnumber&0x7);
- }
- hp = hp->next->next;
- sp = 0;
- break;
- case 2: /* hstem3 */ /* specifies three h hints zones at once */
- if ( sp<6 ) LogError( _("Stack underflow on hstem3 in %s\n"), name );
- sameh = NULL;
- if ( !is_type2 )
- sameh = SameH(ret->hstem,stack[0],stack[1], unblended,0);
- hint = HintNew(stack[0],stack[1]);
- hint->hintnumber = sameh!=NULL ? sameh->hintnumber : hint_cnt++;
- if ( activeh==NULL )
- activeh = hp = hint;
- else {
- for ( hp=activeh; hp->next!=NULL; hp = hp->next );
- hp->next = hint;
- hp = hint;
- }
- sameh = NULL;
- if ( !is_type2 )
- sameh = SameH(ret->hstem,stack[2],stack[3], unblended,0);
- hp->next = HintNew(stack[2],stack[3]);
- hp->next->hintnumber = sameh!=NULL ? sameh->hintnumber : hint_cnt++;
- sameh = NULL;
- if ( !is_type2 )
- sameh = SameH(ret->hstem,stack[4],stack[5], unblended,0);
- hp->next->next = HintNew(stack[4],stack[5]);
- hp->next->next->hintnumber = sameh!=NULL ? sameh->hintnumber : hint_cnt++;
- if ( !is_type2 && hp->next->next->hintnumber<96 ) {
- if ( pending_hm==NULL )
- pending_hm = chunkalloc(sizeof(HintMask));
- (*pending_hm)[hint->hintnumber>>3] |= 0x80>>(hint->hintnumber&0x7);
- (*pending_hm)[hint->next->hintnumber>>3] |= 0x80>>(hint->next->hintnumber&0x7);
- (*pending_hm)[hint->next->next->hintnumber>>3] |= 0x80>>(hint->next->next->hintnumber&0x7);
- }
- hp = hp->next->next;
- sp = 0;
- break;
- case 6: /* seac */ /* build accented characters */
- seac:
- if ( sp<5 ) LogError( _("Stack underflow on seac in %s\n"), name );
- /* stack[0] must be the lsidebearing of the accent. I'm not sure why */
- r1 = RefCharCreate();
- r2 = RefCharCreate();
- r2->transform[0] = 1; r2->transform[3]=1;
- r2->transform[4] = stack[1] - (stack[0]-ret->lsidebearing);
- r2->transform[5] = stack[2];
- /* the translation of the accent here is said to be relative */
- /* to the origins of the base character. I think they place */
- /* the origin at the left bearing. And they don't mean the */
- /* base char at all, they mean the current char's lbearing */
- /* (which is normally the same as the base char's, except */
- /* when I has a big accent (like diaerisis) */
- r1->transform[0] = 1; r1->transform[3]=1;
- r1->adobe_enc = stack[3];
- r2->adobe_enc = stack[4];
- if ( stack[3]<0 || stack[3]>=256 || stack[4]<0 || stack[4]>=256 ) {
- LogError( _("Reference encoding out of bounds in %s\n"), name );
- r1->adobe_enc = 0;
- r2->adobe_enc = 0;
- }
- r1->next = r2;
- if ( rlast!=NULL ) rlast->next = r1;
- else ret->layers[ly_fore].refs = r1;
- ret->changedsincelasthinted = true; /* seac glyphs contain no hints */
- rlast = r2;
- sp = 0;
- break;
- case 7: /* sbw */ /* generalized width/sidebearing command */
- if ( sp<4 ) LogError( _("Stack underflow on sbw in %s\n"), name );
- ret->lsidebearing = stack[0];
- /* stack[1] is lsidebearing y (only for vertical writing styles, CJK) */
- ret->width = stack[2];
- /* stack[3] is height (for vertical writing styles, CJK) */
- sp = 0;
- break;
- case 5: case 9: case 14: case 26:
- if ( sp<1 ) LogError( _("Stack underflow on unary operator in %s\n"), name );
- switch ( v ) {
- case 5: stack[sp-1] = (stack[sp-1]==0); break; /* not */
- case 9: if ( stack[sp-1]<0 ) stack[sp-1]= -stack[sp-1]; break; /* abs */
- case 14: stack[sp-1] = -stack[sp-1]; break; /* neg */
- case 26: stack[sp-1] = sqrt(stack[sp-1]); break; /* sqrt */
- }
- break;
- case 3: case 4: case 10: case 11: case 12: case 15: case 24:
- if ( sp<2 ) LogError( _("Stack underflow on binary operator in %s\n"), name );
- else switch ( v ) {
- case 3: /* and */
- stack[sp-2] = (stack[sp-1]!=0 && stack[sp-2]!=0);
- break;
- case 4: /* and */
- stack[sp-2] = (stack[sp-1]!=0 || stack[sp-2]!=0);
- break;
- case 10: /* add */
- stack[sp-2] += stack[sp-1];
- break;
- case 11: /* sub */
- stack[sp-2] -= stack[sp-1];
- break;
- case 12: /* div */
- stack[sp-2] /= stack[sp-1];
- break;
- case 24: /* mul */
- stack[sp-2] *= stack[sp-1];
- break;
- case 15: /* eq */
- stack[sp-2] = (stack[sp-1]==stack[sp-2]);
- break;
- }
- --sp;
- break;
- case 22: /* ifelse */
- if ( sp<4 ) LogError( _("Stack underflow on ifelse in %s\n"), name );
- else {
- if ( stack[sp-2]>stack[sp-1] )
- stack[sp-4] = stack[sp-3];
- sp -= 3;
- }
- break;
- case 23: /* random */
- /* This function returns something (0,1]. It's not clear to me*/
- /* if rand includes 0 and RAND_MAX or not, but this approach */
- /* should work no matter what */
- do {
- stack[sp] = (rand()/(RAND_MAX-1));
- } while ( stack[sp]==0 || stack[sp]>1 );
- ++sp;
- break;
- case 16: /* callothersubr */
- /* stack[sp-1] is the number of the thing to call in the othersubr array */
- /* stack[sp-2] is the number of args to grab off our stack and put on the */
- /* real postscript stack */
- if ( is_type2 )
- LogError( _("Type2 fonts do not support the Type1 callothersubrs operator") );
- if ( sp<2 || sp < 2+stack[sp-2] ) {
- LogError( _("Stack underflow on callothersubr in %s\n"), name );
- sp = 0;
- } else {
- int tot = stack[sp-2], i, k, j;
- popsp = 0;
- for ( k=sp-3; k>=sp-2-tot; --k )
- pops[popsp++] = stack[k];
- /* othersubrs 0-3 must be interpretted. 0-2 are Flex, 3 is Hint Replacement */
- /* othersubrs 12,13 are for counter hints. We don't need to */
- /* do anything to ignore them */
- /* Subroutines 14-18 are multiple master blenders. We need */
- /* to pay attention to them too */
- switch ( (int) stack[sp-1] ) {
- case 3: {
- /* when we weren't capabable of hint replacement we */
- /* punted by putting 3 on the stack (T1 spec page 70) */
- /* subroutine 3 is a noop */
- /*pops[popsp-1] = 3;*/
- ret->manualhints = false;
- /* We can manage hint substitution from hintmask though*/
- /* well enough that we needn't clear the manualhints bit */
- ret->hstem = HintsAppend(ret->hstem,activeh); activeh=NULL;
- ret->vstem = HintsAppend(ret->vstem,activev); activev=NULL;
- } break;
- case 1: {
- /* Essentially what we want to do is draw a line from */
- /* where we are at the beginning to where we are at */
- /* the end. So we save the beginning here (this starts*/
- /* the flex sequence), we ignore all calls to othersub*/
- /* 2, and when we get to othersub 0 we put everything*/
- /* back to where it should be and free up whatever */
- /* extranious junk we created along the way and draw */
- /* our line. */
- /* Let's punt a little less, and actually figure out */
- /* the appropriate rrcurveto commands and put in a */
- /* dished serif */
- /* We should never get here in a type2 font. But we did*/
- /* this code won't work if we follow type2 conventions*/
- /* so turn off type2 until we get 0 callothersubrs */
- /* which marks the end of the flex sequence */
- is_type2 = false;
- if ( cur!=NULL ) {
- oldcur = cur;
- cur->next = NULL;
- } else
- LogError( _("Bad flex subroutine in %s\n"), name );
- } break;
- case 2: {
- /* No op */;
- } break;
- case 0: if ( oldcur!=NULL ) {
- SplinePointList *spl = oldcur->next;
- if ( spl!=NULL && spl->next!=NULL &&
- spl->next->next!=NULL &&
- spl->next->next->next!=NULL &&
- spl->next->next->next->next!=NULL &&
- spl->next->next->next->next->next!=NULL &&
- spl->next->next->next->next->next->next!=NULL ) {
- BasePoint old_nextcp, mid_prevcp, mid, mid_nextcp,
- end_prevcp, end;
- old_nextcp = spl->next->first->me;
- mid_prevcp = spl->next->next->first->me;
- mid = spl->next->next->next->first->me;
- mid_nextcp = spl->next->next->next->next->first->me;
- end_prevcp = spl->next->next->next->next->next->first->me;
- end = spl->next->next->next->next->next->next->first->me;
- cur = oldcur;
- if ( cur!=NULL && cur->first!=NULL && (cur->first!=cur->last || cur->first->next==NULL) ) {
- cur->last->nextcp = old_nextcp;
- cur->last->nonextcp = false;
- pt = chunkalloc(sizeof(SplinePoint));
- pt->hintmask = pending_hm; pending_hm = NULL;
- pt->prevcp = mid_prevcp;
- pt->me = mid;
- pt->nextcp = mid_nextcp;
- /*pt->flex = pops[2];*/
- CheckMake(cur->last,pt);
- SplineMake3(cur->last,pt);
- cur->last = pt;
- pt = chunkalloc(sizeof(SplinePoint));
- pt->prevcp = end_prevcp;
- pt->me = end;
- pt->nonextcp = true;
- CheckMake(cur->last,pt);
- SplineMake3(cur->last,pt);
- cur->last = pt;
- } else
- LogError( _("No previous point on path in curveto from flex 0 in %s\n"), name );
- } else {
- /* Um, something's wrong. Let's just draw a line */
- /* do the simple method, which consists of creating */
- /* the appropriate line */
- pt = chunkalloc(sizeof(SplinePoint));
- pt->me.x = pops[1]; pt->me.y = pops[0];
- pt->noprevcp = true; pt->nonextcp = true;
- SplinePointListFree(oldcur->next); oldcur->next = NULL; spl = NULL;
- cur = oldcur;
- if ( cur!=NULL && cur->first!=NULL && (cur->first!=cur->last || cur->first->next==NULL) ) {
- CheckMake(cur->last,pt);
- SplineMake3(cur->last,pt);
- cur->last = pt;
- } else
- LogError( _("No previous point on path in lineto from flex 0 in %s\n"), name );
- }
- --popsp;
- cur->next = NULL;
- SplinePointListsFree(spl);
- oldcur = NULL;
- } else
- LogError( _("Bad flex subroutine in %s\n"), name );
-
- is_type2 = context->is_type2;
- /* If we found a type2 font with a type1 flex sequence */
- /* (an illegal idea, but never mind, someone gave us one)*/
- /* then we had to turn off type2 untill the end of the */
- /* flex sequence. Which is here */
- break;
- case 14: /* results in 1 blended value */
- case 15: /* results in 2 blended values */
- case 16: /* results in 3 blended values */
- case 17: /* results in 4 blended values */
- case 18: { /* results in 6 blended values */
- int cnt = stack[sp-1]-13;
- if ( cnt==5 ) cnt=6;
- if ( context->instance_count==0 )
- LogError( _("Attempt to use a multiple master subroutine in a non-mm font in %s.\n"), name );
- else if ( tot!=cnt*context->instance_count )
- LogError( _("Multiple master subroutine called with the wrong number of arguments in %s.\n"), name );
- else {
- /* Hints need to keep track of the original blends */
- if ( cnt==1 && !is_type2 ) {
- if ( sp-2-tot>=1 && (!old_last_was_b1 || stack[0]!=Blend(unblended[1],context))) {
- unblended[0][0] = stack[0];
- for ( i=1; i<context->instance_count; ++i )
- unblended[0][i] = 0;
- } else
- memcpy(unblended,unblended+1,context->instance_count*sizeof(real));
- for ( j=0; j<context->instance_count; ++j )
- unblended[1][j] = stack[sp-2-tot+j];
- } else if ( cnt==2 && !is_type2 ) {
- unblended[0][0] = stack[sp-2-tot];
- unblended[1][0] = stack[sp-2-tot+1];
- for ( i=0; i<2; ++i )
- for ( j=1; j<context->instance_count; ++j )
- unblended[i][j] = stack[sp-2-tot+2+i*(context->instance_count-1)+(j-1)];
- }
- popsp = 0;
- for ( i=0; i<cnt; ++i ) {
- double sum = stack[sp-2-tot+ i];
- for ( j=1; j<context->instance_count; ++j )
- sum += context->blend_values[j]*
- stack[sp-2-tot+ cnt +i*(context->instance_count-1)+ j-1];
- pops[cnt-1-popsp++] = sum;
- }
- }
- } break;
- }
- sp = k+1;
- }
- break;
- case 20: /* put */
- if ( sp<2 ) LogError( _("Too few items on stack for put in %s\n"), name );
- else if ( stack[sp-1]<0 || stack[sp-1]>=32 ) LogError( _("Reference to transient memory out of bounds in put in %s\n"), name );
- else {
- transient[(int)stack[sp-1]] = stack[sp-2];
- sp -= 2;
- }
- break;
- case 21: /* get */
- if ( sp<1 ) LogError( _("Too few items on stack for get in %s\n"), name );
- else if ( stack[sp-1]<0 || stack[sp-1]>=32 ) LogError( _("Reference to transient memory out of bounds in put in %s\n"), name );
- else
- stack[sp-1] = transient[(int)stack[sp-1]];
- break;
- case 17: /* pop */
- /* pops something from the postscript stack and pushes it on ours */
- /* used to get a return value from an othersubr call */
- /* Bleah. Adobe wants the pops to return the arguments if we */
- /* don't understand the call. What use is the subroutine then?*/
- if ( popsp<=0 )
- LogError( _("Pop stack underflow on pop in %s\n"), name );
- else
- stack[sp++] = pops[--popsp];
- break;
- case 18: /* drop */
- if ( sp>0 ) --sp;
- break;
- case 27: /* dup */
- if ( sp>=1 ) {
- stack[sp] = stack[sp-1];
- ++sp;
- }
- break;
- case 28: /* exch */
- if ( sp>=2 ) {
- real temp = stack[sp-1];
- stack[sp-1] = stack[sp-2]; stack[sp-2] = temp;
- }
- break;
- case 29: /* index */
- if ( sp>=1 ) {
- int index = stack[--sp];
- if ( index<0 || sp<index+1 )
- LogError( _("Index out of range in %s\n"), name );
- else {
- stack[sp] = stack[sp-index-1];
- ++sp;
- }
- }
- break;
- case 30: /* roll */
- if ( sp>=2 ) {
- int j = stack[sp-1], N=stack[sp-2];
- if ( N>sp || j>=N || j<0 || N<0 )
- LogError( _("roll out of range in %s\n"), name );
- else if ( j==0 || N==0 )
- /* No op */;
- else {
- real *temp = galloc(N*sizeof(real));
- int i;
- for ( i=0; i<N; ++i )
- temp[i] = stack[sp-N+i];
- for ( i=0; i<N; ++i )
- stack[sp-N+i] = temp[(i+j)%N];
- free(temp);
- }
- }
- break;
- case 33: /* setcurrentpoint */
- if ( sp<2 ) LogError( _("Stack underflow on setcurrentpoint in %s\n"), name );
- else {
- current.x = stack[0];
- current.y = stack[1];
- }
- sp = 0;
- break;
- case 34: /* hflex */
- case 35: /* flex */
- case 36: /* hflex1 */
- case 37: /* flex1 */
- dy = dy3 = dy4 = dy5 = dy6 = 0;
- dx = stack[base++];
- if ( v!=34 )
- dy = stack[base++];
- dx2 = stack[base++];
- dy2 = stack[base++];
- dx3 = stack[base++];
- if ( v!=34 && v!=36 )
- dy3 = stack[base++];
- dx4 = stack[base++];
- if ( v!=34 && v!=36 )
- dy4 = stack[base++];
- dx5 = stack[base++];
- if ( v==34 )
- dy5 = -dy2;
- else
- dy5 = stack[base++];
- switch ( v ) {
- real xt, yt;
- case 35: /* flex */
- dx6 = stack[base++];
- dy6 = stack[base++];
- break;
- case 34: /* hflex */
- dx6 = stack[base++];
- break;
- case 36: /* hflex1 */
- dx6 = stack[base++];
- dy6 = -dy-dy2-dy5;
- break;
- case 37: /* flex1 */
- xt = dx+dx2+dx3+dx4+dx5;
- yt = dy+dy2+dy3+dy4+dy5;
- if ( xt<0 ) xt= -xt;
- if ( yt<0 ) yt= -yt;
- if ( xt>yt ) {
- dx6 = stack[base++];
- dy6 = -dy-dy2-dy3-dy4-dy5;
- } else {
- dy6 = stack[base++];
- dx6 = -dx-dx2-dx3-dx4-dx5;
- }
- break;
- }
- if ( cur!=NULL && cur->first!=NULL && (cur->first!=cur->last || cur->first->next==NULL) ) {
- current.x = rint((current.x+dx)*1024)/1024; current.y = rint((current.y+dy)*1024)/1024;
- cur->last->nextcp.x = current.x; cur->last->nextcp.y = current.y;
- cur->last->nonextcp = false;
- current.x = rint((current.x+dx2)*1024)/1024; current.y = rint((current.y+dy2)*1024)/1024;
- pt = chunkalloc(sizeof(SplinePoint));
- pt->hintmask = pending_hm; pending_hm = NULL;
- pt->prevcp.x = current.x; pt->prevcp.y = current.y;
- current.x = rint((current.x+dx3)*1024)/1024; current.y = rint((current.y+dy3)*1024)/1024;
- pt->me.x = current.x; pt->me.y = current.y;
- pt->nonextcp = true;
- CheckMake(cur->last,pt);
- SplineMake3(cur->last,pt);
- cur->last = pt;
-
- current.x = rint((current.x+dx4)*1024)/1024; current.y = rint((current.y+dy4)*1024)/1024;
- cur->last->nextcp.x = current.x; cur->last->nextcp.y = current.y;
- cur->last->nonextcp = false;
- current.x = rint((current.x+dx5)*1024)/1024; current.y = rint((current.y+dy5)*1024)/1024;
- pt = chunkalloc(sizeof(SplinePoint));
- pt->prevcp.x = current.x; pt->prevcp.y = current.y;
- current.x = rint((current.x+dx6)*1024)/1024; current.y = rint((current.y+dy6)*1024)/1024;
- pt->me.x = current.x; pt->me.y = current.y;
- pt->nonextcp = true;
- CheckMake(cur->last,pt);
- SplineMake3(cur->last,pt);
- cur->last = pt;
- } else
- LogError( _("No previous point on path in flex operator in %s\n"), name );
- sp = 0;
- break;
- default:
- LogError( _("Uninterpreted opcode 12,%d in %s\n"), v, name );
- break;
- }
- } else { last_was_b1 = false; switch ( v ) {
- case 1: /* hstem */
- case 18: /* hstemhm */
- base = 0;
- if ( (sp&1) && ret->width == (int16) 0x8000 )
- ret->width = stack[0];
- if ( sp&1 )
- base=1;
- if ( sp-base<2 )
- LogError( _("Stack underflow on hstem in %s\n"), name );
- /* stack[0] is absolute y for start of horizontal hint */
- /* (actually relative to the y specified as lsidebearing y in sbw*/
- /* stack[1] is relative y for height of hint zone */
- coord = 0;
- hp = NULL;
- if ( activeh!=NULL )
- for ( hp=activeh; hp->next!=NULL; hp = hp->next );
- while ( sp-base>=2 ) {
- sameh = NULL;
- if ( !is_type2 )
- sameh = SameH(ret->hstem,stack[base]+coord,stack[base+1],
- unblended,context->instance_count);
- hint = HintNew(stack[base]+coord,stack[base+1]);
- hint->hintnumber = sameh!=NULL ? sameh->hintnumber : hint_cnt++;
- if ( !is_type2 && context->instance_count!=0 ) {
- hint->u.unblended = chunkalloc(sizeof(real [2][MmMax]));
- memcpy(hint->u.unblended,unblended,sizeof(real [2][MmMax]));
- }
- if ( activeh==NULL )
- activeh = hint;
- else
- hp->next = hint;
- hp = hint;
- if ( !is_type2 && hint->hintnumber<96 ) {
- if ( pending_hm==NULL )
- pending_hm = chunkalloc(sizeof(HintMask));
- (*pending_hm)[hint->hintnumber>>3] |= 0x80>>(hint->hintnumber&0x7);
- }
- base+=2;
- coord = hint->start+hint->width;
- }
- sp = 0;
- break;
- case 19: /* hintmask */
- case 20: /* cntrmask */
- /* If there's anything on the stack treat it as a vstem hint */
- case 3: /* vstem */
- case 23: /* vstemhm */
- base = 0;
- if ( cur==NULL || v==3 || v==23 ) {
- if ( (sp&1) && is_type2 && ret->width == (int16) 0x8000 ) {
- ret->width = stack[0];
- }
- if ( sp&1 )
- base=1;
- /* I've seen a vstemhm with no arguments. I've no idea what that */
- /* means. It came right after a hintmask */
- /* I'm confused about v/hstemhm because the manual says it needs */
- /* to be used if one uses a hintmask, but that's not what the */
- /* examples show. Or I'm not understanding. */
- if ( sp-base<2 && v!=19 && v!=20 )
- LogError( _("Stack underflow on vstem in %s\n"), name );
- /* stack[0] is absolute x for start of vertical hint */
- /* (actually relative to the x specified as lsidebearing in h/sbw*/
- /* stack[1] is relative x for height of hint zone */
- coord = ret->lsidebearing;
- hp = NULL;
- if ( activev!=NULL )
- for ( hp=activev; hp->next!=NULL; hp = hp->next );
- while ( sp-base>=2 ) {
- sameh = NULL;
- if ( !is_type2 )
- sameh = SameH(ret->vstem,stack[base]+coord,stack[base+1],
- unblended,context->instance_count);
- hint = HintNew(stack[base]+coord,stack[base+1]);
- hint->hintnumber = sameh!=NULL ? sameh->hintnumber : hint_cnt++;
- if ( !is_type2 && context->instance_count!=0 ) {
- hint->u.unblended = chunkalloc(sizeof(real [2][MmMax]));
- memcpy(hint->u.unblended,unblended,sizeof(real [2][MmMax]));
- }
- if ( !is_type2 && hint->hintnumber<96 ) {
- if ( pending_hm==NULL )
- pending_hm = chunkalloc(sizeof(HintMask));
- (*pending_hm)[hint->hintnumber>>3] |= 0x80>>(hint->hintnumber&0x7);
- }
- if ( activev==NULL )
- activev = hint;
- else
- hp->next = hint;
- hp = hint;
- base+=2;
- coord = hint->start+hint->width;
- }
- sp = 0;
- }
- if ( v==19 || v==20 ) { /* hintmask, cntrmask */
- unsigned bytes = (hint_cnt+7)/8;
- if ( bytes>sizeof(HintMask) ) bytes = sizeof(HintMask);
- if ( v==19 ) {
- ret->hstem = HintsAppend(ret->hstem,activeh); activeh=NULL;
- ret->vstem = HintsAppend(ret->vstem,activev); activev=NULL;
- if ( pending_hm==NULL )
- pending_hm = chunkalloc(sizeof(HintMask));
- memcpy(pending_hm,type1,bytes);
- } else if ( cp<(int)(sizeof(counters)/sizeof(counters[0])) ) {
- counters[cp] = chunkalloc(sizeof(HintMask));
- memcpy(counters[cp],type1,bytes);
- ++cp;
- }
- if ( bytes!=(unsigned)hint_cnt/8 ) {
- int mask = 0xff>>(hint_cnt&7);
- if ( type1[bytes-1]&mask )
- LogError( _("Hint mask (or counter mask) with too many hints in %s\n"), name );
- }
- type1 += bytes;
- len -= bytes;
- }
- break;
- case 14: /* endchar */
- /* endchar is allowed to terminate processing even within a subroutine */
- if ( (sp&1) && is_type2 && ret->width == (int16) 0x8000 )
- ret->width = stack[0];
- if ( context->painttype!=2 )
- closepath(cur,is_type2);
- pcsp = 0;
- if ( sp==4 ) {
- /* In Type2 strings endchar has a depreciated function of doing */
- /* a seac (which doesn't exist at all). Except enchar takes */
- /* 4 args and seac takes 5. Bleah */
- stack[4] = stack[3]; stack[3] = stack[2]; stack[2] = stack[1]; stack[1] = stack[0];
- stack[0] = 0;
- sp = 5;
- goto seac;
- } else if ( sp==5 ) {
- /* same as above except also specified a width */
- stack[0] = 0;
- goto seac;
- }
- /* the docs say that endchar must be the last command in a char */
- /* (or the last command in a subroutine which is the last in the */
- /* char) So in theory if there's anything left we should complain*/
- /* In practice though, the EuroFont has a return statement after */
- /* the endchar in a subroutine. So we won't try to catch that err*/
- /* and just stop. */
- /* Adobe says it's not an error, but I can't understand their */
- /* logic */
- goto done;
- break;
- case 13: /* hsbw (set left sidebearing and width) */
- if ( sp<2 ) LogError( _("Stack underflow on hsbw in %s\n"), name );
- ret->lsidebearing = stack[0];
- current.x = stack[0]; /* sets the current point too */
- ret->width = stack[1];
- sp = 0;
- break;
- case 9: /* closepath */
- sp = 0;
- closepath(cur,is_type2);
- break;
- case 21: /* rmoveto */
- case 22: /* hmoveto */
- case 4: /* vmoveto */
- if ( is_type2 ) {
- if (( (v==21 && sp==3) || (v!=21 && sp==2)) && ret->width == (int16) 0x8000 )
- /* Character's width may be specified on the first moveto */
- ret->width = stack[0];
- if ( v==21 && sp>2 ) {
- stack[0] = stack[sp-2]; stack[1] = stack[sp-1];
- sp = 2;
- } else if ( v!=21 && sp>1 ) {
- stack[0] = stack[sp-1];
- sp = 1;
- }
- if ( context->painttype!=2 )
- closepath(cur,true);
- }
- case 5: /* rlineto */
- case 6: /* hlineto */
- case 7: /* vlineto */
- polarity = 0;
- base = 0;
- while ( base<sp ) {
- dx = dy = 0;
- if ( v==5 || v==21 ) {
- if ( sp<base+2 ) {
- LogError( _("Stack underflow on rlineto/rmoveto in %s\n"), name );
- break;
- }
- dx = stack[base++];
- dy = stack[base++];
- } else if ( (v==6 && !(polarity&1)) || (v==7 && (polarity&1)) || v==22 ) {
- if ( sp<=base ) {
- LogError( _("Stack underflow on hlineto/hmoveto in %s\n"), name );
- break;
- }
- dx = stack[base++];
- } else /*if ( (v==7 && !(parity&1)) || (v==6 && (parity&1) || v==4 )*/ {
- if ( sp<=base ) {
- LogError( _("Stack underflow on vlineto/vmoveto in %s\n"), name );
- break;
- }
- dy = stack[base++];
- }
- ++polarity;
- current.x = rint((current.x+dx)*1024)/1024; current.y = rint((current.y+dy)*1024)/1024;
- pt = chunkalloc(sizeof(SplinePoint));
- pt->hintmask = pending_hm; pending_hm = NULL;
- pt->me.x = current.x; pt->me.y = current.y;
- pt->noprevcp = true; pt->nonextcp = true;
- if ( v==4 || v==21 || v==22 ) {
- if ( cur!=NULL && cur->first==cur->last && cur->first->prev==NULL && is_type2 ) {
- /* Two adjacent movetos should not create single point paths */
- cur->first->me.x = current.x; cur->first->me.y = current.y;
- SplinePointFree(pt);
- } else {
- SplinePointList *spl = chunkalloc(sizeof(SplinePointList));
- spl->first = spl->last = pt;
- if ( cur!=NULL )
- cur->next = spl;
- else
- ret->layers[ly_fore].splines = spl;
- cur = spl;
- }
- break;
- } else {
- if ( cur!=NULL && cur->first!=NULL && (cur->first!=cur->last || cur->first->next==NULL) ) {
- CheckMake(cur->last,pt);
- SplineMake3(cur->last,pt);
- cur->last = pt;
- } else
- LogError( _("No previous point on path in lineto in %s\n"), name );
- if ( !is_type2 )
- break;
- }
- }
- sp = 0;
- break;
- case 25: /* rlinecurve */
- base = 0;
- while ( sp>base+6 ) {
- current.x = rint((current.x+stack[base++])*1024)/1024; current.y = rint((current.y+stack[base++])*1024)/1024;
- if ( cur!=NULL ) {
- pt = chunkalloc(sizeof(SplinePoint));
- pt->hintmask = pending_hm; pending_hm = NULL;
- pt->me.x = current.x; pt->me.y = current.y;
- pt->noprevcp = true; pt->nonextcp = true;
- CheckMake(cur->last,pt);
- SplineMake3(cur->last,pt);
- cur->last = pt;
- }
- }
- case 24: /* rcurveline */
- case 8: /* rrcurveto */
- case 31: /* hvcurveto */
- case 30: /* vhcurveto */
- case 27: /* hhcurveto */
- case 26: /* vvcurveto */
- polarity = 0;
- while ( sp>base+2 ) {
- dx = dy = dx2 = dy2 = dx3 = dy3 = 0;
- if ( v==8 || v==25 || v==24 ) {
- if ( sp<6+base ) {
- LogError( _("Stack underflow on rrcurveto in %s\n"), name );
- base = sp;
- } else {
- dx = stack[base++];
- dy = stack[base++];
- dx2 = stack[base++];
- dy2 = stack[base++];
- dx3 = stack[base++];
- dy3 = stack[base++];
- }
- } else if ( v==27 ) { /* hhcurveto */
- if ( sp<4+base ) {
- LogError( _("Stack underflow on hhcurveto in %s\n"), name );
- base = sp;
- } else {
- if ( (sp-base)&1 ) dy = stack[base++];
- dx = stack[base++];
- dx2 = stack[base++];
- dy2 = stack[base++];
- dx3 = stack[base++];
- }
- } else if ( v==26 ) { /* vvcurveto */
- if ( sp<4+base ) {
- LogError( _("Stack underflow on hhcurveto in %s\n"), name );
- base = sp;
- } else {
- if ( (sp-base)&1 ) dx = stack[base++];
- dy = stack[base++];
- dx2 = stack[base++];
- dy2 = stack[base++];
- dy3 = stack[base++];
- }
- } else if ( (v==31 && !(polarity&1)) || (v==30 && (polarity&1)) ) {
- if ( sp<4+base ) {
- LogError( _("Stack underflow on hvcurveto in %s\n"), name );
- base = sp;
- } else {
- dx = stack[base++];
- dx2 = stack[base++];
- dy2 = stack[base++];
- dy3 = stack[base++];
- if ( sp==base+1 )
- dx3 = stack[base++];
- }
- } else /*if ( (v==30 && !(polarity&1)) || (v==31 && (polarity&1)) )*/ {
- if ( sp<4+base ) {
- LogError( _("Stack underflow on vhcurveto in %s\n"), name );
- base = sp;
- } else {
- dy = stack[base++];
- dx2 = stack[base++];
- dy2 = stack[base++];
- dx3 = stack[base++];
- if ( sp==base+1 )
- dy3 = stack[base++];
- }
- }
- ++polarity;
- if ( cur!=NULL && cur->first!=NULL && (cur->first!=cur->last || cur->first->next==NULL) ) {
- current.x = rint((current.x+dx)*1024)/1024; current.y = rint((current.y+dy)*1024)/1024;
- cur->last->nextcp.x = current.x; cur->last->nextcp.y = current.y;
- cur->last->nonextcp = false;
- current.x = rint((current.x+dx2)*1024)/1024; current.y = rint((current.y+dy2)*1024)/1024;
- pt = chunkalloc(sizeof(SplinePoint));
- pt->hintmask = pending_hm; pending_hm = NULL;
- pt->prevcp.x = current.x; pt->prevcp.y = current.y;
- current.x = rint((current.x+dx3)*1024)/1024; current.y = rint((current.y+dy3)*1024)/1024;
- pt->me.x = current.x; pt->me.y = current.y;
- pt->nonextcp = true;
- CheckMake(cur->last,pt);
- SplineMake3(cur->last,pt);
- cur->last = pt;
- } else
- LogError( _("No previous point on path in curveto in %s\n"), name );
- }
- if ( v==24 ) {
- current.x = rint((current.x+stack[base++])*1024)/1024; current.y = rint((current.y+stack[base++])*1024)/1024;
- if ( cur!=NULL ) { /* In legal code, cur can't be null here, but I got something illegal... */
- pt = chunkalloc(sizeof(SplinePoint));
- pt->hintmask = pending_hm; pending_hm = NULL;
- pt->me.x = current.x; pt->me.y = current.y;
- pt->noprevcp = true; pt->nonextcp = true;
- CheckMake(cur->last,pt);
- SplineMake3(cur->last,pt);
- cur->last = pt;
- }
- }
- sp = 0;
- break;
- case 29: /* callgsubr */
- case 10: /* callsubr */
- /* stack[sp-1] contains the number of the subroutine to call */
- if ( sp<1 ) {
- LogError( _("Stack underflow on callsubr in %s\n"), name );
- break;
- } else if ( pcsp>10 ) {
- LogError( _("Too many subroutine calls in %s\n"), name );
- break;
- }
- s=subrs; if ( v==29 ) s = gsubrs;
- if ( s!=NULL ) stack[sp-1] += s->bias;
- /* Type2 subrs have a bias that must be added to the subr-number */
- /* Type1 subrs do not. We set the bias on them to 0 */
- if ( s==NULL || stack[sp-1]>=s->cnt || stack[sp-1]<0 ||
- s->values[(int) stack[sp-1]]==NULL )
- LogError( _("Subroutine number out of bounds in %s\n"), name );
- else {
- pcstack[pcsp].type1 = type1;
- pcstack[pcsp].len = len;
- pcstack[pcsp].subnum = stack[sp-1];
- ++pcsp;
- type1 = s->values[(int) stack[sp-1]];
- len = s->lens[(int) stack[sp-1]];
- }
- if ( --sp<0 ) sp = 0;
- break;
- case 11: /* return */
- /* return from a subr outine */
- if ( pcsp<1 ) LogError( _("return when not in subroutine in %s\n"), name );
- else {
- --pcsp;
- type1 = pcstack[pcsp].type1;
- len = pcstack[pcsp].len;
- }
- break;
- case 16: { /* blend -- obsolete type 2 multiple master operator */
- int cnt,i,j;
- if ( context->instance_count==0 )
- LogError( _("Attempt to use a multiple master subroutine in a non-mm font.\n") );
- else if ( sp<1 || sp<context->instance_count*stack[sp-1]+1 )
- LogError( _("Too few items on stack for blend in %s\n"), name );
- else {
- if ( !context->blend_warn ) {
- LogError( _("Use of obsolete blend operator.\n") );
- context->blend_warn = true;
- }
- cnt = stack[sp-1];
- sp -= context->instance_count*stack[sp-1]+1;
- for ( i=0; i<cnt; ++i ) {
- for ( j=1; j<context->instance_count; ++j )
- stack[sp+i] += context->blend_values[j]*stack[sp+
- cnt+ i*(context->instance_count-1)+ j-1];
- }
- /* there will always be fewer pushes than there were pops */
- /* so I don't bother to check the stack */
- sp += cnt;
- }
- }
- break;
- default:
- LogError( _("Uninterpreted opcode %d in %s\n"), v, name );
- break;
- }}
- }
- done:
- if ( pcsp!=0 )
- LogError( _("end of subroutine reached with no return in %s\n"), name );
- if (THdo_catagorize)
- SCCatagorizePoints(ret);
-
- ret->hstem = HintsAppend(ret->hstem,activeh); activeh=NULL;
- ret->vstem = HintsAppend(ret->vstem,activev); activev=NULL;
-
- if ( cp!=0 ) { int i;
- ret->countermasks = galloc(cp*sizeof(HintMask));
- ret->countermask_cnt = cp;
- for ( i=0; i<cp; ++i ) {
- memcpy(&ret->countermasks[i],counters[i],sizeof(HintMask));
- chunkfree(counters[i],sizeof(HintMask));
- }
- }
-
- /* Even in type1 fonts all paths should be closed. But if we close them at*/
- /* the obvious moveto, that breaks flex hints. So we have a hack here at */
- /* the end which closes any open paths. */
- /* If we do have a PaintType 2 font, then presumably the difference between*/
- /* open and closed paths matters */
- if ( !is_type2 && !context->painttype )
- for ( cur = ret->layers[ly_fore].splines; cur!=NULL; cur = cur->next ) if ( cur->first->prev==NULL ) {
- CheckMake(cur->last,cur->first);
- SplineMake3(cur->last,cur->first);
- cur->last = cur->first;
- }
- /* Oh, I see. PS and TT disagree on which direction to use, so Fontographer*/
- /* chose the TT direction and we must reverse postscript */
- if (THdo_set_reversing) {
- for ( cur = ret->layers[ly_fore].splines; cur!=NULL; cur = cur->next )
- SplineSetReverse(cur);
- }
- if ( ret->hstem==NULL && ret->vstem==NULL )
- ret->manualhints = false;
- if ( !is_type2 && context->instance_count!=0 ) {
- UnblendFree(ret->hstem);
- UnblendFree(ret->vstem);
- }
- if (THdo_hint_guessing) {
- ret->hstem = HintCleanup(ret->hstem,true,context->instance_count);
- ret->vstem = HintCleanup(ret->vstem,true,context->instance_count);
- SCGuessHHintInstancesList(ret,ly_fore);
- SCGuessVHintInstancesList(ret,ly_fore);
- ret->hconflicts = StemListAnyConflicts(ret->hstem);
- ret->vconflicts = StemListAnyConflicts(ret->vstem);
- if ( context->instance_count==1 && !ret->hconflicts && !ret->vconflicts )
- SCClearHintMasks(ret,ly_fore,false);
- HintsRenumber(ret);
- }
- if ( name!=NULL && strcmp(name,".notdef")!=0 )
- ret->widthset = true;
-return( ret );
-}
-
-
-/* This finds the 'connect-the-dots' boundingbox of a Type2 charstring */
-/* It is a simplified version of PSCharStringToSplines, above */
-
-SplineChar *PSCharStringToBB(uint8 *type1, int len, struct pscontext *context,
- struct pschars *subrs, struct pschars *gsubrs, const char *name) {
- real stack[50]; int sp=0, v; /* Type1 stack is about 25 long, Type2 stack is 48 */
- real transient[32];
- SplineChar *ret = SplineCharCreate(2);
-
- DBasePoint current, ll, ur;
- real dx, dy, dx2, dy2, dx3, dy3, dx4, dy4, dx5, dy5, dx6=0, dy6;
-
- int first = 1; /* to flag extra set width */
- /* subroutines may be nested to a depth of 10 */
- struct substate { unsigned char *type1; int len; int subnum; } pcstack[11];
- int pcsp=0;
-
- real pops[30];
- int popsp=0;
- int base, polarity;
-
- struct pschars *s;
- int hint_cnt = 0;
-
- int last_was_b1=false, old_last_was_b1;
-
- ret->name = copy( name );
- ret->unicodeenc = -1;
- ret->width = (int16) 0x8000;
- if ( name==NULL ) name = "unnamed";
- ret->manualhints = true;
- if ( !context->is_type2 ) {
- LogError( _("Quick boundingbox mode only does CFF charstrings, not Type1 (font %s)\n"), name );
- return (ret);
- }
-
- current.x = current.y = 0;
- ll.x = ll.y = (int16) 0x7FFF;
- ur.x = ur.y = (int16) -0x7FFF;
-
- while ( len>0 ) {
- if ( sp>48 ) {
- LogError( _("Stack got too big in %s\n"), name );
- sp = 48;
- }
- base = 0;
- --len;
- if ( (v = *type1++)>=32 ) {
- if ( v<=246) {
- stack[sp++] = v - 139;
- } else if ( v<=250 ) {
- stack[sp++] = (v-247)*256 + *type1++ + 108;
- --len;
- } else if ( v<=254 ) {
- stack[sp++] = -(v-251)*256 - *type1++ - 108;
- --len;
- } else {
- int val = (*type1<<24) | (type1[1]<<16) | (type1[2]<<8) | type1[3];
- stack[sp++] = val;
- type1 += 4;
- len -= 4;
- stack[sp-1] /= 65536.;
- }
- } else if ( v==28 ) {
- stack[sp++] = (short) ((type1[0]<<8) | type1[1]);
- type1 += 2;
- len -= 2;
- /* In the Dict tables of CFF, a 5byte fixed value is prefixed by a */
- /* 29 code. In Type2 strings the prefix is 255. */
- } else if ( v==12 ) {
- old_last_was_b1 = last_was_b1; last_was_b1 = false;
- v = *type1++;
- --len;
- switch ( v ) {
- case 0: /* dotsection */
- sp = 0;
- break;
- case 1: /* vstem3 */ /* specifies three v hints zones at once */
- if ( sp<6 ) LogError( _("Stack underflow on vstem3 in %s\n"), name );
- /* according to the standard, if there is a vstem3 there can't */
- /* be any vstems, so there can't be any confusion about hint order */
- /* so we don't need to worry about unblended stuff */
- hint_cnt+=3;
- sp = 0;
- break;
- case 2: /* hstem3 */ /* specifies three h hints zones at once */
- if ( sp<6 ) LogError( _("Stack underflow on hstem3 in %s\n"), name );
- hint_cnt+=3;
- sp = 0;
- break;
- case 6: /* seac */ /* build accented characters */
- seac:
- if ( sp<5 ) LogError( _("Stack underflow on seac in %s\n"), name );
- /* stack[0] must be the lsidebearing of the accent. I'm not sure why */
- sp = 0;
- break;
- case 7: /* sbw */ /* generalized width/sidebearing command */
- if ( sp<4 ) LogError( _("Stack underflow on sbw in %s\n"), name );
- ret->lsidebearing = stack[0];
- /* stack[1] is lsidebearing y (only for vertical writing styles, CJK) */
- ret->width = stack[2];
- /* stack[3] is height (for vertical writing styles, CJK) */
- sp = 0;
- break;
- case 5: case 9: case 14: case 26:
- if ( sp<1 ) LogError( _("Stack underflow on unary operator in %s\n"), name );
- switch ( v ) {
- case 5: stack[sp-1] = (stack[sp-1]==0); break; /* not */
- case 9: if ( stack[sp-1]<0 ) stack[sp-1]= -stack[sp-1]; break; /* abs */
- case 14: stack[sp-1] = -stack[sp-1]; break; /* neg */
- case 26: stack[sp-1] = sqrt(stack[sp-1]); break; /* sqrt */
- }
- break;
- case 3: case 4: case 10: case 11: case 12: case 15: case 24:
- if ( sp<2 ) LogError( _("Stack underflow on binary operator in %s\n"), name );
- else switch ( v ) {
- case 3: /* and */
- stack[sp-2] = (stack[sp-1]!=0 && stack[sp-2]!=0);
- break;
- case 4: /* and */
- stack[sp-2] = (stack[sp-1]!=0 || stack[sp-2]!=0);
- break;
- case 10: /* add */
- stack[sp-2] += stack[sp-1];
- break;
- case 11: /* sub */
- stack[sp-2] -= stack[sp-1];
- break;
- case 12: /* div */
- stack[sp-2] /= stack[sp-1];
- break;
- case 24: /* mul */
- stack[sp-2] *= stack[sp-1];
- break;
- case 15: /* eq */
- stack[sp-2] = (stack[sp-1]==stack[sp-2]);
- break;
- }
- --sp;
- break;
- case 22: /* ifelse */
- if ( sp<4 ) LogError( _("Stack underflow on ifelse in %s\n"), name );
- else {
- if ( stack[sp-2]>stack[sp-1] )
- stack[sp-4] = stack[sp-3];
- sp -= 3;
- }
- break;
- case 23: /* random */
- /* This function returns something (0,1]. It's not clear to me*/
- /* if rand includes 0 and RAND_MAX or not, but this approach */
- /* should work no matter what */
- do {
- stack[sp] = (rand()/(RAND_MAX-1));
- } while ( stack[sp]==0 || stack[sp]>1 );
- ++sp;
- break;
- case 20: /* put */
- if ( sp<2 ) LogError( _("Too few items on stack for put in %s\n"), name );
- else if ( stack[sp-1]<0 || stack[sp-1]>=32 ) LogError( _("Reference to transient memory out of bounds in put in %s\n"), name );
- else {
- transient[(int)stack[sp-1]] = stack[sp-2];
- sp -= 2;
- }
- break;
- case 21: /* get */
- if ( sp<1 ) LogError( _("Too few items on stack for get in %s\n"), name );
- else if ( stack[sp-1]<0 || stack[sp-1]>=32 ) LogError( _("Reference to transient memory out of bounds in put in %s\n"), name );
- else
- stack[sp-1] = transient[(int)stack[sp-1]];
- break;
- case 17: /* pop */
- /* pops something from the postscript stack and pushes it on ours */
- /* used to get a return value from an othersubr call */
- /* Bleah. Adobe wants the pops to return the arguments if we */
- /* don't understand the call. What use is the subroutine then?*/
- if ( popsp<=0 )
- LogError( _("Pop stack underflow on pop in %s\n"), name );
- else
- stack[sp++] = pops[--popsp];
- break;
- case 18: /* drop */
- if ( sp>0 ) --sp;
- break;
- case 27: /* dup */
- if ( sp>=1 ) {
- stack[sp] = stack[sp-1];
- ++sp;
- }
- break;
- case 28: /* exch */
- if ( sp>=2 ) {
- real temp = stack[sp-1];
- stack[sp-1] = stack[sp-2]; stack[sp-2] = temp;
- }
- break;
- case 29: /* index */
- if ( sp>=1 ) {
- int index = stack[--sp];
- if ( index<0 || sp<index+1 )
- LogError( _("Index out of range in %s\n"), name );
- else {
- stack[sp] = stack[sp-index-1];
- ++sp;
- }
- }
- break;
- case 30: /* roll */
- if ( sp>=2 ) {
- int j = stack[sp-1], N=stack[sp-2];
- if ( N>sp || j>=N || j<0 || N<0 )
- LogError( _("roll out of range in %s\n"), name );
- else if ( j==0 || N==0 )
- /* No op */;
- else {
- real *temp = galloc(N*sizeof(real));
- int i;
- for ( i=0; i<N; ++i )
- temp[i] = stack[sp-N+i];
- for ( i=0; i<N; ++i )
- stack[sp-N+i] = temp[(i+j)%N];
- free(temp);
- }
- }
- break;
- case 33: /* setcurrentpoint */
- if ( sp<2 ) LogError( _("Stack underflow on setcurrentpoint in %s\n"), name );
- else {
- current.x = stack[0];
- current.y = stack[1];
- if (ll.y>current.y) ll.y = current.y;
- if (ur.y<current.y) ur.y = current.y;
- if (ll.x>current.x) ll.x = current.x;
- if (ur.x<current.x) ur.x = current.x;
- }
- sp = 0;
- break;
- case 34: /* hflex */
- case 35: /* flex */
- case 36: /* hflex1 */
- case 37: /* flex1 */
- dy = dy3 = dy4 = dy5 = dy6 = 0;
- dx = stack[base++];
- if ( v!=34 )
- dy = stack[base++];
- dx2 = stack[base++];
- dy2 = stack[base++];
- dx3 = stack[base++];
- if ( v!=34 && v!=36 )
- dy3 = stack[base++];
- dx4 = stack[base++];
- if ( v!=34 && v!=36 )
- dy4 = stack[base++];
- dx5 = stack[base++];
- if ( v==34 )
- dy5 = -dy2;
- else
- dy5 = stack[base++];
- switch ( v ) {
- real xt, yt;
- case 35: /* flex */
- dx6 = stack[base++];
- dy6 = stack[base++];
- break;
- case 34: /* hflex */
- dx6 = stack[base++];
- break;
- case 36: /* hflex1 */
- dx6 = stack[base++];
- dy6 = -dy-dy2-dy5;
- break;
- case 37: /* flex1 */
- xt = dx+dx2+dx3+dx4+dx5;
- yt = dy+dy2+dy3+dy4+dy5;
- if ( xt<0 ) xt= -xt;
- if ( yt<0 ) yt= -yt;
- if ( xt>yt ) {
- dx6 = stack[base++];
- dy6 = -dy-dy2-dy3-dy4-dy5;
- } else {
- dy6 = stack[base++];
- dx6 = -dx-dx2-dx3-dx4-dx5;
- }
- break;
- }
- current.x = current.x+dx; current.y = current.y+dy;
- if (ll.y>current.y) ll.y = current.y;
- if (ur.y<current.y) ur.y = current.y;
- if (ll.x>current.x) ll.x = current.x;
- if (ur.x<current.x) ur.x = current.x;
- current.x = current.x+dx2; current.y = current.y+dy2;
- if (ll.y>current.y) ll.y = current.y;
- if (ur.y<current.y) ur.y = current.y;
- if (ll.x>current.x) ll.x = current.x;
- if (ur.x<current.x) ur.x = current.x;
- current.x = current.x+dx3; current.y = current.y+dy3;
- if (ll.y>current.y) ll.y = current.y;
- if (ur.y<current.y) ur.y = current.y;
- if (ll.x>current.x) ll.x = current.x;
- if (ur.x<current.x) ur.x = current.x;
-
- current.x = current.x+dx4; current.y = current.y+dy4;
- if (ll.y>current.y) ll.y = current.y;
- if (ur.y<current.y) ur.y = current.y;
- if (ll.x>current.x) ll.x = current.x;
- if (ur.x<current.x) ur.x = current.x;
- current.x = current.x+dx5; current.y = current.y+dy5;
- if (ll.y>current.y) ll.y = current.y;
- if (ur.y<current.y) ur.y = current.y;
- if (ll.x>current.x) ll.x = current.x;
- if (ur.x<current.x) ur.x = current.x;
- current.x = current.x+dx6; current.y = current.y+dy6;
- if (ll.y>current.y) ll.y = current.y;
- if (ur.y<current.y) ur.y = current.y;
- if (ll.x>current.x) ll.x = current.x;
- if (ur.x<current.x) ur.x = current.x;
- sp = 0;
- break;
- default:
- LogError( _("Uninterpreted opcode 12,%d in %s\n"), v, name );
- break;
- }
- } else { last_was_b1 = false; switch ( v ) {
- case 1: /* hstem */
- case 18: /* hstemhm */
- base = 0;
- if ( (sp&1) && ret->width == (int16) 0x8000 )
- ret->width = stack[0];
- if ( sp&1 )
- base=1;
- if ( sp-base<2 )
- LogError( _("Stack underflow on hstem in %s\n"), name );
- /* stack[0] is absolute y for start of horizontal hint */
- /* (actually relative to the y specified as lsidebearing y in sbw*/
- /* stack[1] is relative y for height of hint zone */
-
-
- while ( sp-base>=2 ) {
- hint_cnt++;
- base+=2;
- }
- sp = 0;
- break;
- case 19: /* hintmask */
- case 20: /* cntrmask */
- /* If there's anything on the stack treat it as a vstem hint */
- case 3: /* vstem */
- case 23: /* vstemhm */
- base = 0;
- if ( first || v==3 || v==23 ) {
- if ( (sp&1) && ret->width == (int16) 0x8000 ) {
- ret->width = stack[0];
- }
- if ( sp&1 )
- base=1;
- if ( sp-base<2 && v!=19 && v!=20 )
- LogError( _("Stack underflow on vstem in %s\n"), name );
- /* stack[0] is absolute x for start of vertical hint */
- /* (actually relative to the x specified as lsidebearing in h/sbw*/
- /* stack[1] is relative x for height of hint zone */
-
-
- while ( sp-base>=2 ) {
- hint_cnt++;
- base+=2;
- }
- sp = 0;
- }
- if ( v==19 || v==20 ) { /* hintmask, cntrmask */
- unsigned bytes = (hint_cnt+7)/8;
- if ( bytes>sizeof(HintMask) ) bytes = sizeof(HintMask);
- if ( bytes!=(unsigned)hint_cnt/8 ) {
- int mask = 0xff>>(hint_cnt&7);
- if ( type1[bytes-1]&mask )
- LogError( _("Hint mask (or counter mask) with too many hints in %s\n"), name );
- }
- type1 += bytes;
- len -= bytes;
- }
- break;
- case 14: /* endchar */
- /* endchar is allowed to terminate processing even within a subroutine */
- if ( (sp&1) && ret->width == (int16) 0x8000 )
- ret->width = stack[0];
- pcsp = 0;
- if ( sp==4 ) {
- /* In Type2 strings endchar has a depreciated function of doing */
- /* a seac (which doesn't exist at all). Except enchar takes */
- /* 4 args and seac takes 5. Bleah */
- stack[4] = stack[3]; stack[3] = stack[2]; stack[2] = stack[1]; stack[1] = stack[0];
- stack[0] = 0;
- sp = 5;
- goto seac;
- } else if ( sp==5 ) {
- /* same as above except also specified a width */
- stack[0] = 0;
- goto seac;
- }
- /* the docs say that endchar must be the last command in a char */
- goto done;
- break;
- case 13: /* hsbw (set left sidebearing and width) */
- if ( sp<2 ) LogError( _("Stack underflow on hsbw in %s\n"), name );
- ret->lsidebearing = stack[0];
- current.x = stack[0]; /* sets the current point too */
- if (ll.x>current.x) ll.x = current.x;
- if (ur.x<current.x) ur.x = current.x;
- ret->width = stack[1];
- sp = 0;
- break;
- case 9: /* closepath */
- sp = 0;
- break;
- case 21: /* rmoveto */
- case 22: /* hmoveto */
- case 4: /* vmoveto */
- if (( (v==21 && sp==3) || (v!=21 && sp==2)) && ret->width == (int16) 0x8000 )
- /* Character's width may be specified on the first moveto */
- ret->width = stack[0];
- if ( v==21 && sp>2 ) {
- stack[0] = stack[sp-2]; stack[1] = stack[sp-1];
- sp = 2;
- } else if ( v!=21 && sp>1 ) {
- stack[0] = stack[sp-1];
- sp = 1;
- }
- /* fall through */
- case 5: /* rlineto */
- case 6: /* hlineto */
- case 7: /* vlineto */
- polarity = 0;
- base = 0;
- while ( base<sp ) {
- dx = dy = 0;
- if ( v==5 || v==21 ) {
- if ( sp<base+2 ) {
- LogError( _("Stack underflow on rlineto/rmoveto in %s\n"), name );
- break;
- }
- dx = stack[base++];
- dy = stack[base++];
- } else if ( (v==6 && !(polarity&1)) || (v==7 && (polarity&1)) || v==22 ) {
- if ( sp<=base ) {
- LogError( _("Stack underflow on hlineto/hmoveto in %s\n"), name );
- break;
- }
- dx = stack[base++];
- } else /*if ( (v==7 && !(parity&1)) || (v==6 && (parity&1) || v==4 )*/ {
- if ( sp<=base ) {
- LogError( _("Stack underflow on vlineto/vmoveto in %s\n"), name );
- break;
- }
- dy = stack[base++];
- }
- ++polarity;
- current.x = current.x+dx; current.y = current.y+dy;
- if (ll.y>current.y) ll.y = current.y;
- if (ur.y<current.y) ur.y = current.y;
- if (ll.x>current.x) ll.x = current.x;
- if (ur.x<current.x) ur.x = current.x;
- if ( v==4 || v==21 || v==22 ) {
- first = 0;
- break;
- } else {
- first = 0;
- }
- }
- sp = 0;
- break;
- case 25: /* rlinecurve */
- base = 0;
- while ( sp>base+6 ) {
- current.x = current.x+stack[base++]; current.y = current.y+stack[base++];
- if (ll.y>current.y) ll.y = current.y;
- if (ur.y<current.y) ur.y = current.y;
- if (ll.x>current.x) ll.x = current.x;
- if (ur.x<current.x) ur.x = current.x;
- first = 0;
- }
- case 24: /* rcurveline */
- case 8: /* rrcurveto */
- case 31: /* hvcurveto */
- case 30: /* vhcurveto */
- case 27: /* hhcurveto */
- case 26: /* vvcurveto */
- polarity = 0;
- while ( sp>base+2 ) {
- dx = dy = dx2 = dy2 = dx3 = dy3 = 0;
- if ( v==8 || v==25 || v==24 ) {
- if ( sp<6+base ) {
- LogError( _("Stack underflow on rrcurveto in %s\n"), name );
- base = sp;
- } else {
- dx = stack[base++];
- dy = stack[base++];
- dx2 = stack[base++];
- dy2 = stack[base++];
- dx3 = stack[base++];
- dy3 = stack[base++];
- }
- } else if ( v==27 ) { /* hhcurveto */
- if ( sp<4+base ) {
- LogError( _("Stack underflow on hhcurveto in %s\n"), name );
- base = sp;
- } else {
- if ( (sp-base)&1 ) dy = stack[base++];
- dx = stack[base++];
- dx2 = stack[base++];
- dy2 = stack[base++];
- dx3 = stack[base++];
- }
- } else if ( v==26 ) { /* vvcurveto */
- if ( sp<4+base ) {
- LogError( _("Stack underflow on hhcurveto in %s\n"), name );
- base = sp;
- } else {
- if ( (sp-base)&1 ) dx = stack[base++];
- dy = stack[base++];
- dx2 = stack[base++];
- dy2 = stack[base++];
- dy3 = stack[base++];
- }
- } else if ( (v==31 && !(polarity&1)) || (v==30 && (polarity&1)) ) {
- if ( sp<4+base ) {
- LogError( _("Stack underflow on hvcurveto in %s\n"), name );
- base = sp;
- } else {
- dx = stack[base++];
- dx2 = stack[base++];
- dy2 = stack[base++];
- dy3 = stack[base++];
- if ( sp==base+1 )
- dx3 = stack[base++];
- }
- } else /*if ( (v==30 && !(polarity&1)) || (v==31 && (polarity&1)) )*/ {
- if ( sp<4+base ) {
- LogError( _("Stack underflow on vhcurveto in %s\n"), name );
- base = sp;
- } else {
- dy = stack[base++];
- dx2 = stack[base++];
- dy2 = stack[base++];
- dx3 = stack[base++];
- if ( sp==base+1 )
- dy3 = stack[base++];
- }
- }
- ++polarity;
- current.x = current.x+dx; current.y = current.y+dy;
- if (ll.y>current.y) ll.y = current.y;
- if (ur.y<current.y) ur.y = current.y;
- if (ll.x>current.x) ll.x = current.x;
- if (ur.x<current.x) ur.x = current.x;
- current.x = current.x+dx2; current.y = current.y+dy2;
- if (ll.y>current.y) ll.y = current.y;
- if (ur.y<current.y) ur.y = current.y;
- if (ll.x>current.x) ll.x = current.x;
- if (ur.x<current.x) ur.x = current.x;
- current.x = current.x+dx3; current.y = current.y+dy3;
- if (ll.y>current.y) ll.y = current.y;
- if (ur.y<current.y) ur.y = current.y;
- if (ll.x>current.x) ll.x = current.x;
- if (ur.x<current.x) ur.x = current.x;
- }
- if ( v==24 ) {
- current.x = current.x+stack[base++]; current.y = current.y+stack[base++];
- if (ll.y>current.y) ll.y = current.y;
- if (ur.y<current.y) ur.y = current.y;
- if (ll.x>current.x) ll.x = current.x;
- if (ur.x<current.x) ur.x = current.x;
- }
- sp = 0;
- break;
- case 29: /* callgsubr */
- case 10: /* callsubr */
- /* stack[sp-1] contains the number of the subroutine to call */
- if ( sp<1 ) {
- LogError( _("Stack underflow on callsubr in %s\n"), name );
- break;
- } else if ( pcsp>10 ) {
- LogError( _("Too many subroutine calls in %s\n"), name );
- break;
- }
- s=subrs; if ( v==29 ) s = gsubrs;
- if ( s!=NULL ) stack[sp-1] += s->bias;
- /* Type2 subrs have a bias that must be added to the subr-number */
- /* Type1 subrs do not. We set the bias on them to 0 */
- if ( s==NULL || stack[sp-1]>=s->cnt || stack[sp-1]<0 ||
- s->values[(int) stack[sp-1]]==NULL )
- LogError( _("Subroutine number out of bounds in %s\n"), name );
- else {
- pcstack[pcsp].type1 = type1;
- pcstack[pcsp].len = len;
- pcstack[pcsp].subnum = stack[sp-1];
- ++pcsp;
- type1 = s->values[(int) stack[sp-1]];
- len = s->lens[(int) stack[sp-1]];
- }
- if ( --sp<0 ) sp = 0;
- break;
- case 11: /* return */
- /* return from a subr outine */
- if ( pcsp<1 ) LogError( _("return when not in subroutine in %s\n"), name );
- else {
- --pcsp;
- type1 = pcstack[pcsp].type1;
- len = pcstack[pcsp].len;
- }
- break;
- case 16: { /* blend -- obsolete type 2 multiple master operator */
- int cnt,i,j;
- if ( context->instance_count==0 )
- LogError( _("Attempt to use a multiple master subroutine in a non-mm font.\n") );
- else if ( sp<1 || sp<context->instance_count*stack[sp-1]+1 )
- LogError( _("Too few items on stack for blend in %s\n"), name );
- else {
- if ( !context->blend_warn ) {
- LogError( _("Use of obsolete blend operator.\n") );
- context->blend_warn = true;
- }
- cnt = stack[sp-1];
- sp -= context->instance_count*stack[sp-1]+1;
- for ( i=0; i<cnt; ++i ) {
- for ( j=1; j<context->instance_count; ++j )
- stack[sp+i] += context->blend_values[j]*stack[sp+
- cnt+ i*(context->instance_count-1)+ j-1];
- }
- /* there will always be fewer pushes than there were pops */
- /* so I don't bother to check the stack */
- sp += cnt;
- }
- }
- break;
- default:
- LogError( _("Uninterpreted opcode %d in %s\n"), v, name );
- break;
- }}
- }
-done:
- if ( pcsp!=0 )
- LogError( _("end of subroutine reached with no return in %s\n"), name );
-
- if ( name!=NULL && strcmp(name,".notdef")!=0 )
- ret->widthset = true;
- if (ur.x == -0x7FFF) ur.x = 0;
- if (ur.y == -0x7FFF) ur.y = 0;
- if (ll.x == 0x7FFF) ll.x = 0;
- if (ll.y == 0x7FFF) ll.y = 0;
- if (ll.x>ur.x) ll.x = ur.x;
- if (ll.y>ur.y) ll.y = ur.y;
-
-
- ret->xmin = rint(ll.x);
- ret->ymin = rint(ll.y);
- ret->xmax = rint(ur.x);
- ret->ymax = rint(ur.y);
- /* free the curves */
- if (ret->layers!=NULL && ret->layers[ly_fore].splines != NULL) {
- SplinePointListsFree(ret->layers[ly_fore].splines);
- ret->layers[ly_fore].splines=NULL;
- }
- if (ret->layers[ly_fore].refs!=NULL) {
- RefCharsFree(ret->layers[ly_fore].refs);
- ret->layers[ly_fore].refs = NULL;
- }
- return( ret );
-}
diff --git a/Build/source/texk/web2c/luatexdir/luafontloader/fontforge/fontforge/pua.c b/Build/source/texk/web2c/luatexdir/luafontloader/fontforge/fontforge/pua.c
deleted file mode 100644
index 3e7582829bf..00000000000
--- a/Build/source/texk/web2c/luatexdir/luafontloader/fontforge/fontforge/pua.c
+++ /dev/null
@@ -1,1612 +0,0 @@
-/* A number of encodings use the public use area to map to glyphs that are */
-/* defined in planes other than the BMP (chinese), or just multiple encodings*/
-/* for the same glyph (ams) */
-
-/* These data are taken from http://www.ams.org/STIX/bnb/stix-tbl.asc-2003-10-10 */
-const int amspua[] = {
-/* E000 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* E008 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* E010 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* E018 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* E020 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* E028 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* E030 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* E038 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* E040 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* E048 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* E050 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* E058 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* E060 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* E068 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* E070 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* E078 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* E080 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* E088 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* E090 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* E098 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* E0A0 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* E0A8 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* E0B0 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* E0B8 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* E0C0 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* E0C8 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* E0D0 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* E0D8 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* E0E0 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* E0E8 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* E0F0 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* E0F8 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* E100 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* E108 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* E110 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* E118 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* E120 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* E128 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* E130 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* E138 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* E140 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* E148 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* E150 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* E158 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* E160 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* E168 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* E170 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* E178 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* E180 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* E188 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* E190 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* E198 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* E1A0 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* E1A8 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* E1B0 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* E1B8 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* E1C0 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* E1C8 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* E1D0 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* E1D8 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* E1E0 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* E1E8 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* E1F0 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* E1F8 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* E200 */ 0x027f8, 0x027f5, 0x027fa, 0x027f7, 0x027f9, 0x027f6, 0x0290e, 0x0290f,
-/* E208 */ 0x027fc, 0x02910, 0x02926, 0x02925, 0x02923, 0x02924, 0x02928, 0x02929,
-/* E210 */ 0x0292a, 0x02927, 0x02905, 0x0, 0x0297c, 0x0297d, 0x021f5, 0x0296f,
-/* E218 */ 0x0296e, 0x02937, 0x02936, 0x0, 0x02933, 0x0, 0x02945, 0x02946,
-/* E220 */ 0x0291f, 0x02920, 0x0291d, 0x0291e, 0x02964, 0x02962, 0x02963, 0x02965,
-/* E228 */ 0x0294b, 0x0294a, 0x02968, 0x02966, 0x02967, 0x02969, 0x0296a, 0x0296d,
-/* E230 */ 0x0296c, 0x0296b, 0x02192, 0x02190, 0x02972, 0x02975, 0x02971, 0x02949,
-/* E238 */ 0x02911, 0x02916, 0x0291a, 0x0291c, 0x02919, 0x0291b, 0x02938, 0x02939,
-/* E240 */ 0x02948, 0x021fe, 0x021fd, 0x021ff, 0x021dd, 0x02904, 0x02903, 0x02902,
-/* E248 */ 0x0237c, 0x0293c, 0x0293d, 0x0297e, 0x0297f, 0x02974, 0x02973, 0x02af0,
-/* E250 */ 0x02aef, 0x02a3f, 0x0, 0x0, 0x02a00, 0x02a01, 0x02a02, 0x02a06,
-/* E258 */ 0x02a04, 0x02a3c, 0x02a25, 0x02a2a, 0x02a2d, 0x02a2e, 0x02a34, 0x02a35,
-/* E260 */ 0x029b5, 0x02a40, 0x02abd, 0x02abe, 0x02a33, 0x02a5f, 0x02a22, 0x02a72,
-/* E268 */ 0x02a71, 0x02a27, 0x02a23, 0x02a24, 0x02a26, 0x02a30, 0x02a46, 0x02a47,
-/* E270 */ 0x02a48, 0x02a49, 0x02a4a, 0x02a4b, 0x0, 0x0, 0x0, 0x0,
-/* E278 */ 0x02a4c, 0x02a4d, 0x02a50, 0x02a39, 0x02a3a, 0x02a3b, 0x029cd, 0x029c4,
-/* E280 */ 0x029c5, 0x02a44, 0x02a45, 0x02a42, 0x02a43, 0x02a38, 0x029bc, 0x029bf,
-/* E288 */ 0x029c0, 0x029c1, 0x029b7, 0x029b9, 0x02a37, 0x02a36, 0x02a31, 0x0,
-/* E290 */ 0x0, 0x02994, 0x02993, 0x023b1, 0x023b0, 0x02996, 0x02995, 0x02991,
-/* E298 */ 0x02992, 0x0298b, 0x0298c, 0x0298d, 0x0298e, 0x0298f, 0x02990, 0x02a8a,
-/* E2A0 */ 0x02a88, 0x02269, 0x02a89, 0x02a87, 0x02268, 0x02271, 0x02271, 0x02270,
-/* E2A8 */ 0x02270, 0x0, 0x02224, 0x02226, 0x02284, 0x02288, 0x02288, 0x02285,
-/* E2B0 */ 0x02289, 0x02289, 0x02ab9, 0x02ab5, 0x02aba, 0x02ab6, 0x02acb, 0x02acc,
-/* E2B8 */ 0x02acb, 0x0228a, 0x0228b, 0x02acc, 0x0, 0x0, 0x0, 0x0,
-/* E2C0 */ 0x0, 0x02270, 0x02271, 0x0226e, 0x0226f, 0x0, 0x02249, 0x0,
-/* E2C8 */ 0x02af3, 0x0f423, 0x0f428, 0x0, 0x0, 0x0, 0x0, 0x022ed,
-/* E2D0 */ 0x022ec, 0x02aee, 0x0, 0x0, 0x0, 0x0210f, 0x029a4, 0x029a5,
-/* E2D8 */ 0x0, 0x029a8, 0x029a9, 0x029aa, 0x029ab, 0x029ac, 0x029ad, 0x029ae,
-/* E2E0 */ 0x029af, 0x0299d, 0x025f9, 0x0, 0x025f8, 0x025fa, 0x029c9, 0x029b1,
-/* E2E8 */ 0x029b2, 0x029b3, 0x029b4, 0x0299a, 0x0ee39, 0x0204f, 0x023b5, 0x023b4,
-/* E2F0 */ 0x023b6, 0x029c2, 0x029c3, 0x0, 0x02a86, 0x02a8c, 0x02a7e, 0x02aa2,
-/* E2F8 */ 0x02a85, 0x02a8b, 0x02a7d, 0x02aa1, 0x0, 0x02ab7, 0x02aaf, 0x02ab8,
-/* E300 */ 0x02ab0, 0x02223, 0x02225, 0x02323, 0x02ac5, 0x02ac6, 0x02248, 0x0,
-/* E308 */ 0x0, 0x02a77, 0x02adb, 0x02a9d, 0x02a9e, 0x02aeb, 0x02a74, 0x02ae4,
-/* E310 */ 0x02ae8, 0x02ae7, 0x02ae9, 0x02ae6, 0x02a6d, 0x02a70, 0x02aae, 0x02a73,
-/* E318 */ 0x02a78, 0x02a66, 0x02a29, 0x02ad9, 0x02ada, 0x02a7f, 0x02a80, 0x02a81,
-/* E320 */ 0x02a82, 0x02a83, 0x02a84, 0x02a97, 0x02a98, 0x02a79, 0x02a7a, 0x0,
-/* E328 */ 0x0, 0x02a7b, 0x02a7c, 0x022da, 0x022db, 0x02a91, 0x02a92, 0x02aa4,
-/* E330 */ 0x02aa5, 0x02a93, 0x02a94, 0x02a8d, 0x02a8e, 0x02a8f, 0x02a90, 0x02a9f,
-/* E338 */ 0x02aa0, 0x02aaa, 0x02aab, 0x02aac, 0x02aad, 0x0, 0x0, 0x02979,
-/* E340 */ 0x0297b, 0x02abf, 0x02ac0, 0x02ac1, 0x02ac2, 0x02ac7, 0x02ac8, 0x02ad3,
-/* E348 */ 0x02ad4, 0x02ad5, 0x02ad6, 0x02ad7, 0x02ad8, 0x0ee40, 0x0ee41, 0x02ac3,
-/* E350 */ 0x02ac4, 0x02acf, 0x02ad0, 0x02ad1, 0x02ad2, 0x02aa6, 0x02aa7, 0x02aa8,
-/* E358 */ 0x02aa9, 0x029ce, 0x02ab3, 0x02ab4, 0x02abb, 0x02abc, 0x02976, 0x02978,
-/* E360 */ 0x0, 0x02218, 0x0, 0x022a5, 0x1d453, 0x021d4, 0x0, 0x0,
-/* E368 */ 0x0, 0x0, 0x0204e, 0x0, 0x0220c, 0x0220c, 0x02a55, 0x02a56,
-/* E370 */ 0x02209, 0x02057, 0x029dc, 0x0299c, 0x02a53, 0x02a54, 0x02a15, 0x02a16,
-/* E378 */ 0x02a0c, 0x0, 0x0, 0x022f7, 0x022f6, 0x022fe, 0x022fd, 0x001b5,
-/* E380 */ 0x0ee44, 0x0ee45, 0x02afd, 0x02af1, 0x029e3, 0x029e4, 0x029e5, 0x0,
-/* E388 */ 0x0, 0x0, 0x0, 0x02a6a, 0x02a6f, 0x02af2, 0x029de, 0x029dd,
-/* E390 */ 0x0, 0x02a5a, 0x02a5b, 0x02a5d, 0x02a5c, 0x02a10, 0x02a0d, 0x02a12,
-/* E398 */ 0x02a13, 0x02a14, 0x02a17, 0x02a11, 0x022f5, 0x0, 0x022f9, 0x0,
-/* E3A0 */ 0x022f2, 0x022fa, 0x022f3, 0x022fb, 0x022f4, 0x022fc, 0x0ee46, 0x0ee47,
-/* E3A8 */ 0x029bb, 0x02052, 0x029a6, 0x029a7, 0x02aec, 0x02aed, 0x02a57, 0x02a58,
-/* E3B0 */ 0x02a61, 0x02218, 0x0ee24, 0x0, 0x02026, 0x0ee30, 0x00308, 0x02aea,
-/* E3B8 */ 0x022f8, 0x0, 0x0, 0x0, 0x02209, 0x02275, 0x02274, 0x0,
-/* E3C0 */ 0x02053, 0x0, 0x0, 0x0, 0x02ae2, 0x0, 0x0, 0x0299f,
-/* E3C8 */ 0x029e1, 0x0, 0x02a51, 0x02a52, 0x003b1, 0x0026b, 0x0, 0x0,
-/* E3D0 */ 0x003c3, 0x00067, 0x025aa, 0x02a0f, 0x022bd, 0x0007c, 0x02934, 0x02935,
-/* E3D8 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* E3E0 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* E3E8 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* E3F0 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* E3F8 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* E400 */ 0x0, 0x0, 0x0290c, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* E408 */ 0x0, 0x029be, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* E410 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x02241, 0x0, 0x0,
-/* E418 */ 0x0, 0x0, 0x029b0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* E420 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* E428 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* E430 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* E438 */ 0x0, 0x0, 0x0, 0x0ee3b, 0x0ee3c, 0x0, 0x0, 0x0,
-/* E440 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* E448 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* E450 */ 0x00308, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* E458 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* E460 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* E468 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* E470 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* E478 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* E480 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* E488 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* E490 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* E498 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* E4A0 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* E4A8 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* E4B0 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* E4B8 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* E4C0 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* E4C8 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* E4D0 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* E4D8 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* E4E0 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* E4E8 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* E4F0 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* E4F8 */ 0x0, 0x02423, 0x0, 0x0, 0x0ee31, 0x0, 0x0, 0x0ee32,
-/* E500 */ 0x1d538, 0x1d539, 0x02102, 0x1d53b, 0x1d53c, 0x1d53d, 0x1d53e, 0x0210d,
-/* E508 */ 0x1d540, 0x1d541, 0x1d542, 0x1d543, 0x1d544, 0x02115, 0x1d546, 0x02119,
-/* E510 */ 0x0211a, 0x0211d, 0x1d54a, 0x1d54b, 0x1d54c, 0x1d54d, 0x1d54e, 0x1d54f,
-/* E518 */ 0x1d550, 0x02124, 0x0213f, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* E520 */ 0x1d49c, 0x0212c, 0x1d49e, 0x1d49f, 0x02130, 0x02131, 0x1d4a2, 0x0210b,
-/* E528 */ 0x02110, 0x1d4a5, 0x1d4a6, 0x02112, 0x02133, 0x1d4a9, 0x1d4aa, 0x1d4ab,
-/* E530 */ 0x1d4ac, 0x0211b, 0x1d4ae, 0x1d4af, 0x1d4b0, 0x1d4b1, 0x1d4b2, 0x1d4b3,
-/* E538 */ 0x1d4b4, 0x1d4b5, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* E540 */ 0x1d4b6, 0x1d4b7, 0x1d4b8, 0x1d4b9, 0x0212f, 0x1d4bb, 0x0210a, 0x1d4bd,
-/* E548 */ 0x1d4be, 0x1d4bf, 0x1d4c0, 0x02113, 0x1d4c2, 0x1d4c3, 0x02134, 0x1d4c5,
-/* E550 */ 0x1d4c6, 0x1d4c7, 0x1d4c8, 0x1d4c9, 0x1d4ca, 0x1d4cb, 0x1d4cc, 0x1d4cd,
-/* E558 */ 0x1d4ce, 0x1d4cf, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* E560 */ 0x1d504, 0x1d505, 0x1d506, 0x1d507, 0x1d508, 0x1d509, 0x1d50a, 0x0210c,
-/* E568 */ 0x02111, 0x1d50d, 0x1d50e, 0x1d50f, 0x1d510, 0x1d511, 0x1d512, 0x1d513,
-/* E570 */ 0x1d514, 0x0211c, 0x1d516, 0x1d517, 0x1d518, 0x1d519, 0x1d51a, 0x1d51b,
-/* E578 */ 0x1d51c, 0x12128, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* E580 */ 0x1d51e, 0x1d51f, 0x1d520, 0x1d521, 0x1d522, 0x1d523, 0x1d524, 0x1d525,
-/* E588 */ 0x1d526, 0x1d527, 0x1d528, 0x1d529, 0x1d52a, 0x1d52b, 0x1d52c, 0x1d52d,
-/* E590 */ 0x1d52e, 0x1d52f, 0x1d530, 0x1d531, 0x1d532, 0x1d533, 0x1d534, 0x1d535,
-/* E598 */ 0x1d536, 0x1d537, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* E5A0 */ 0x02942, 0x02944, 0x02947, 0x02940, 0x02941, 0x0, 0x0, 0x0,
-/* E5A8 */ 0x02985, 0x0, 0x02980, 0x0, 0x0ec01, 0x0, 0x0, 0x02986,
-/* E5B0 */ 0x02af6, 0x0, 0x02999, 0x0, 0x0ee33, 0x0ee34, 0x0ee35, 0x0ee36,
-/* E5B8 */ 0x025a9, 0x0ee37, 0x0ee38, 0x0, 0x0ee80, 0x0, 0x0, 0x02222,
-/* E5C0 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x02a08, 0x02a07, 0x02a63,
-/* E5C8 */ 0x02a5e, 0x0, 0x029ca, 0x0, 0x0, 0x0, 0x0, 0x02a95,
-/* E5D0 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* E5D8 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x02a96,
-/* E5E0 */ 0x0, 0x0, 0x0, 0x0, 0x0e84e, 0x0, 0x0, 0x0ee50,
-/* E5E8 */ 0x0ee51, 0x0ee52, 0x0ee53, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* E5F0 */ 0x0, 0x0, 0x0ee3a, 0x0, 0x0ee54, 0x0, 0x0ee55, 0x0ee56,
-/* E5F8 */ 0x0ee57, 0x0ee58, 0x0, 0x0ee59, 0x0ee5a, 0x0ee5b, 0x029f8, 0x029f9,
-/* E600 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0ee5c, 0x0ee5d, 0x0ee5e,
-/* E608 */ 0x0ee5f, 0x0ee60, 0x0ee61, 0x0ee62, 0x0224c, 0x0224c, 0x0, 0x029cb,
-/* E610 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* E618 */ 0x0, 0x02a2f, 0x0, 0x029b6, 0x0, 0x0, 0x0, 0x0,
-/* E620 */ 0x0, 0x0, 0x0, 0x02205, 0x0ee10, 0x00326, 0x000b7, 0x0,
-/* E628 */ 0x0, 0x003f5, 0x0, 0x0, 0x0, 0x0ee14, 0x00061, 0x0,
-/* E630 */ 0x0ee15, 0x0, 0x0ee18, 0x0ee19, 0x0ee1a, 0x0ee1b, 0x0ee1c, 0x0,
-/* E638 */ 0x0ee1d, 0x0ee1e, 0x0026e, 0x0, 0x002af, 0x0, 0x00235, 0x00236,
-/* E640 */ 0x0ee1f, 0x00221, 0x0ee12, 0x02afd, 0x0ee20, 0x0, 0x0, 0x02afb,
-/* E648 */ 0x0, 0x0, 0x0005c, 0x0ee13, 0x0ee16, 0x0, 0x0, 0x0,
-/* E650 */ 0x021f9, 0x0, 0x0, 0x0, 0x0e215, 0x0, 0x0, 0x0,
-/* E658 */ 0x0, 0x1d5b2, 0x0, 0x02a05, 0x0, 0x0, 0x0, 0x0,
-/* E660 */ 0x003d8, 0x003d9, 0x0223c, 0x003d2, 0x003f4, 0x0, 0x0, 0x0,
-/* E668 */ 0x00062, 0x00063, 0x00064, 0x00065, 0x00066, 0x00068, 0x00069, 0x0006a,
-/* E670 */ 0x0006b, 0x0006c, 0x0006d, 0x0006e, 0x0006f, 0x00070, 0x00071, 0x00072,
-/* E678 */ 0x00073, 0x00074, 0x00075, 0x00076, 0x00077, 0x00078, 0x00079, 0x0007a,
-/* E680 */ 0x0030f, 0x003c7, 0x003b2, 0x001a5, 0x01d1c, 0x01d07, 0x0004d, 0x0002f,
-/* E688 */ 0x01d00, 0x0029c, 0x0e2d4, 0x003b8, 0x003bb, 0x02260, 0x00110, 0x003c9,
-/* E690 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* E698 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* E6A0 */ 0x0ee17, 0x0ee70, 0x0ee71, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* E6A8 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* E6B0 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* E6B8 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* E6C0 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* E6C8 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* E6D0 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* E6D8 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* E6E0 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* E6E8 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* E6F0 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* E6F8 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* E700 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* E708 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* E710 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* E718 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* E720 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* E728 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* E730 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* E738 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* E740 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* E748 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* E750 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* E758 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* E760 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* E768 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* E770 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* E778 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* E780 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* E788 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* E790 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* E798 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* E7A0 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* E7A8 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* E7B0 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* E7B8 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* E7C0 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* E7C8 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* E7D0 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* E7D8 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* E7E0 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* E7E8 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* E7F0 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* E7F8 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* E800 */ 0x003f6, 0x0213f, 0x0, 0x1d7d9, 0x1d7d8, 0x02a03, 0x0, 0x0,
-/* E808 */ 0x0, 0x02a09, 0x0290d, 0x029eb, 0x0, 0x029c6, 0x0, 0x0,
-/* E810 */ 0x029c7, 0x0, 0x02a32, 0x02ae3, 0x0, 0x0, 0x0, 0x0,
-/* E818 */ 0x0, 0x029df, 0x02adc, 0x02add, 0x02141, 0x0, 0x0, 0x0,
-/* E820 */ 0x0, 0x02a0e, 0x02a19, 0x02a1a, 0x02af4, 0x02a18, 0x0, 0x0,
-/* E828 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x027fb, 0x027fd, 0x0,
-/* E830 */ 0x027fe, 0x0, 0x0, 0x0, 0x02906, 0x02907, 0x0, 0x0,
-/* E838 */ 0x0, 0x029b8, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* E840 */ 0x02aa3, 0x0, 0x0, 0x02322, 0x02216, 0x0, 0x0214b, 0x0221d,
-/* E848 */ 0x0, 0x00303, 0x0, 0x0, 0x0, 0x0, 0x0e84e, 0x0,
-/* E850 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* E858 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* E860 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* E868 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* E870 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* E878 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* E880 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* E888 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* E890 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* E898 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* E8A0 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* E8A8 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* E8B0 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* E8B8 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* E8C0 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* E8C8 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* E8D0 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* E8D8 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* E8E0 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* E8E8 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* E8F0 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* E8F8 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* E900 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* E908 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* E910 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* E918 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* E920 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* E928 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* E930 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* E938 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* E940 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* E948 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* E950 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* E958 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* E960 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* E968 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* E970 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* E978 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* E980 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* E988 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* E990 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* E998 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* E9A0 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* E9A8 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* E9B0 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* E9B8 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* E9C0 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* E9C8 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* E9D0 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* E9D8 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* E9E0 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* E9E8 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* E9F0 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* E9F8 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* EA00 */ 0x029a2, 0x0299e, 0x029a3, 0x0ee73, 0x0ee74, 0x0, 0x0ee75, 0x02943,
-/* EA08 */ 0x02051, 0x00319, 0x0ee11, 0x0, 0x0ee76, 0x0, 0x0, 0x0,
-/* EA10 */ 0x0, 0x029f3, 0x029f1, 0x0, 0x0, 0x029bd, 0x029ec, 0x029ed,
-/* EA18 */ 0x0, 0x029ba, 0x02050, 0x0ee77, 0x029ef, 0x0, 0x0, 0x0,
-/* EA20 */ 0x0, 0x0, 0x025a0, 0x0, 0x0, 0x0223c, 0x0ee21, 0x0ee22,
-/* EA28 */ 0x029ea, 0x02908, 0x0ee72, 0x0, 0x0ee78, 0x0ee79, 0x0ee7a, 0x0ee7b,
-/* EA30 */ 0x0ee7c, 0x0ee7d, 0x0ee23, 0x0, 0x0, 0x0, 0x0, 0x0ee7e,
-/* EA38 */ 0x0, 0x0, 0x0, 0x0, 0x02142, 0x029e0, 0x0293e, 0x029d1,
-/* EA40 */ 0x029d4, 0x0, 0x0, 0x02983, 0x02922, 0x02921, 0x029f2, 0x029f0,
-/* EA48 */ 0x029ee, 0x0, 0x029d6, 0x02034, 0x021f6, 0x0293b, 0x029d2, 0x029d5,
-/* EA50 */ 0x02984, 0x02143, 0x1d5ab, 0x0ee42, 0x0ee43, 0x025fb, 0x025fc, 0x02a0b,
-/* EA58 */ 0x020e8, 0x0297a, 0x02a28, 0x029cc, 0x02909, 0x0ee7f, 0x02144, 0x029c8,
-/* EA60 */ 0x027d0, 0x029d3, 0x029d7, 0x00318, 0x02977, 0x02278, 0x02279, 0x0,
-/* EA68 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* EA70 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* EA78 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* EA80 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* EA88 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* EA90 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* EA98 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* EAA0 */ 0x02987, 0x02988, 0x02989, 0x0298a, 0x02982, 0x02a3e, 0x02a1f, 0x02a20,
-/* EAA8 */ 0x02040, 0x02a21, 0x02a64, 0x02a65, 0x022ff, 0x02a41, 0x020e6, 0x0,
-/* EAB0 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* EAB8 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* EAC0 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* EAC8 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* EAD0 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* EAD8 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* EAE0 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* EAE8 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* EAF0 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* EAF8 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* EB00 */ 0x0ee3d, 0x0, 0x0ee3e, 0x029e7, 0x0ee81, 0x029e8, 0x029e9, 0x0,
-/* EB08 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* EB10 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* EB18 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* EB20 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* EB28 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* EB30 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* EB38 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* EB40 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* EB48 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* EB50 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* EB58 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* EB60 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* EB68 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* EB70 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* EB78 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* EB80 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* EB88 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* EB90 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* EB98 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* EBA0 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* EBA8 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* EBB0 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* EBB8 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* EBC0 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* EBC8 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* EBD0 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* EBD8 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* EBE0 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* EBE8 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* EBF0 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* EBF8 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* EC00 */ 0x02a3d, 0x0e5ac, 0x0e5a5, 0x00302, 0x0030c, 0x00330, 0x020e7, 0x029e2,
-/* EC08 */ 0x0290a, 0x0290b, 0x02140, 0x02a1b, 0x02a1c, 0x02a1d, 0x02a1e, 0x0,
-/* EC10 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* EC18 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* EC20 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* EC28 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* EC30 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* EC38 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* EC40 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* EC48 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* EC50 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* EC58 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* EC60 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* EC68 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* EC70 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* EC78 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* EC80 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* EC88 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* EC90 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* EC98 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* ECA0 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* ECA8 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* ECB0 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* ECB8 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* ECC0 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* ECC8 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* ECD0 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* ECD8 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* ECE0 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* ECE8 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* ECF0 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* ECF8 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* ED00 */ 0x0292b, 0x0292c, 0x0292d, 0x0292e, 0x0292f, 0x02930, 0x02931, 0x02932,
-/* ED08 */ 0x0294c, 0x0294d, 0x021f7, 0x021f8, 0x021fa, 0x0, 0x021fb, 0x021fc,
-/* ED10 */ 0x02900, 0x02901, 0x02914, 0x02915, 0x02917, 0x02918, 0x0, 0x0,
-/* ED18 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* ED20 */ 0x0293f, 0x0293a, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* ED28 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* ED30 */ 0x0e370, 0x0e36c, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* ED38 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* ED40 */ 0x0, 0x0, 0x02a2c, 0x02a2b, 0x02a62, 0x02a60, 0x0, 0x0,
-/* ED48 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* ED50 */ 0x02a6b, 0x0, 0x0, 0x02a6c, 0x0, 0x0, 0x0, 0x0,
-/* ED58 */ 0x0, 0x0, 0x02a67, 0x0, 0x0, 0x0, 0x02a76, 0x0,
-/* ED60 */ 0x02270, 0x02271, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* ED68 */ 0x02a99, 0x02a9a, 0x02a9b, 0x02a9c, 0x0, 0x0, 0x0, 0x0,
-/* ED70 */ 0x02272, 0x02273, 0x02a9d, 0x02a9e, 0x02ab1, 0x02ab2, 0x0, 0x0,
-/* ED78 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* ED80 */ 0x02ac9, 0x02aca, 0x02288, 0x02289, 0x02a59, 0x02a4e, 0x02a4f, 0x02acd,
-/* ED88 */ 0x02ace, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* ED90 */ 0x02ae0, 0x02ade, 0x02adf, 0x02ae5, 0x02ae1, 0x0299b, 0x029a0, 0x029a1,
-/* ED98 */ 0x0, 0x02af5, 0x02a68, 0x02a69, 0x02af7, 0x02af8, 0x02a0a, 0x0213e,
-/* EDA0 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* EDA8 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* EDB0 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* EDB8 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* EDC0 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* EDC8 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* EDD0 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* EDD8 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* EDE0 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* EDE8 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* EDF0 */ 0x0ee82, 0x0ee83, 0x0ee84, 0x0220a, 0x0220d, 0x0ee85, 0x0, 0x0,
-/* EDF8 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* EE00 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* EE08 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* EE10 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* EE18 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* EE20 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* EE28 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* EE30 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* EE38 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* EE40 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* EE48 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* EE50 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* EE58 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* EE60 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* EE68 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* EE70 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* EE78 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* EE80 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* EE88 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* EE90 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* EE98 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* EEA0 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* EEA8 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* EEB0 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* EEB8 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* EEC0 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* EEC8 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* EED0 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* EED8 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* EEE0 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* EEE8 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* EEF0 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* EEF8 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* EF00 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* EF08 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* EF10 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* EF18 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* EF20 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* EF28 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* EF30 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* EF38 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* EF40 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* EF48 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* EF50 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* EF58 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* EF60 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* EF68 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* EF70 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* EF78 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* EF80 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* EF88 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* EF90 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* EF98 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* EFA0 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* EFA8 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* EFB0 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* EFB8 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* EFC0 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* EFC8 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* EFD0 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* EFD8 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* EFE0 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* EFE8 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* EFF0 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* EFF8 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* F000 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* F008 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* F010 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* F018 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* F020 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* F028 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* F030 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* F038 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* F040 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* F048 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* F050 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* F058 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* F060 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* F068 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* F070 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* F078 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* F080 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* F088 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* F090 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* F098 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* F0A0 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* F0A8 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* F0B0 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* F0B8 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* F0C0 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* F0C8 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* F0D0 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* F0D8 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* F0E0 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* F0E8 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* F0F0 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* F0F8 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* F100 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* F108 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* F110 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* F118 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* F120 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* F128 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* F130 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* F138 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* F140 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* F148 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* F150 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* F158 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* F160 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* F168 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* F170 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* F178 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* F180 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* F188 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* F190 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* F198 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* F1A0 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* F1A8 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* F1B0 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* F1B8 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* F1C0 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* F1C8 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* F1D0 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* F1D8 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* F1E0 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* F1E8 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* F1F0 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* F1F8 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* F200 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* F208 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* F210 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* F218 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* F220 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* F228 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* F230 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* F238 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* F240 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* F248 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* F250 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* F258 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* F260 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* F268 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* F270 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* F278 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* F280 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* F288 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* F290 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* F298 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* F2A0 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* F2A8 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* F2B0 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* F2B8 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* F2C0 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* F2C8 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* F2D0 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* F2D8 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* F2E0 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* F2E8 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* F2F0 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* F2F8 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* F300 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* F308 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* F310 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* F318 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* F320 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* F328 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* F330 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* F338 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* F340 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* F348 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* F350 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* F358 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* F360 */ 0x0, 0x0, 0x0, 0x0, 0x0205f, 0x0, 0x0, 0x0,
-/* F368 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* F370 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* F378 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* F380 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* F388 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* F390 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* F398 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* F3A0 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* F3A8 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* F3B0 */ 0x0, 0x0, 0x0ee90, 0x0, 0x0, 0x0, 0x02062, 0x02061,
-/* F3B8 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* F3C0 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* F3C8 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* F3D0 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* F3D8 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* F3E0 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* F3E8 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* F3F0 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* F3F8 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* F400 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* F408 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* F410 */ 0x029cf, 0x029d0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* F418 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* F420 */ 0x0, 0x0, 0x0, 0x0f423, 0x0, 0x0, 0x0, 0x0,
-/* F428 */ 0x0f428, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* F430 */ 0x0, 0x02a75, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* F438 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* F440 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* F448 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* F450 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* F458 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* F460 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* F468 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* F470 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* F478 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* F480 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* F488 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* F490 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* F498 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* F4A0 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* F4A8 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* F4B0 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* F4B8 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* F4C0 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* F4C8 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* F4D0 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* F4D8 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* F4E0 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* F4E8 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* F4F0 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* F4F8 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* F500 */ 0x0, 0x0, 0x0, 0x02912, 0x02913, 0x0294e, 0x0, 0x02952,
-/* F508 */ 0x02953, 0x0295a, 0x0295b, 0x02950, 0x02956, 0x02957, 0x0295e, 0x0295f,
-/* F510 */ 0x0294f, 0x02954, 0x02955, 0x0295c, 0x0295d, 0x02951, 0x02958, 0x02959,
-/* F518 */ 0x02960, 0x02961, 0x0, 0x0, 0x0, 0x0, 0x0, 0x029f4,
-/* F520 */ 0x0ee05, 0x0, 0x0, 0x0, 0x02970, 0x0, 0x0, 0x0ee06,
-/* F528 */ 0x0ee07, 0x025fe, 0x02191, 0x02193, 0x0, 0x0, 0x0, 0x0,
-/* F530 */ 0x025fd, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* F538 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* F540 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* F548 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* F550 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* F558 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* F560 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* F568 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* F570 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* F578 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* F580 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* F588 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* F590 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* F598 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* F5A0 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* F5A8 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* F5B0 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* F5B8 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* F5C0 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* F5C8 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* F5D0 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* F5D8 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* F5E0 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* F5E8 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* F5F0 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* F5F8 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* F600 */ 0x0, 0x0ee91, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* F608 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* F610 */ 0x0, 0x0, 0x0, 0x0, 0x00346, 0x0033a, 0x0, 0x0,
-/* F618 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* F620 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* F628 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* F630 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* F638 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* F640 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* F648 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* F650 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* F658 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* F660 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* F668 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* F670 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* F678 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* F680 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* F688 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* F690 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* F698 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* F6A0 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* F6A8 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* F6B0 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* F6B8 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* F6C0 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* F6C8 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* F6D0 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* F6D8 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* F6E0 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x1d552, 0x1d553,
-/* F6E8 */ 0x1d554, 0x1d555, 0x1d556, 0x1d557, 0x1d558, 0x1d559, 0x1d55a, 0x1d55b,
-/* F6F0 */ 0x1d55c, 0x1d55d, 0x1d55e, 0x1d55f, 0x1d560, 0x1d561, 0x1d562, 0x1d563,
-/* F6F8 */ 0x1d564, 0x1d565, 0x1d566, 0x1d567, 0x1d568, 0x1d569, 0x1d56a, 0x1d56b,
-/* F700 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* F708 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* F710 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* F718 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* F720 */ 0x0, 0x0ee92, 0x0ee93, 0x0ee94, 0x0, 0x026a0, 0x0, 0x0,
-/* F728 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* F730 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* F738 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* F740 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* F748 */ 0x0, 0x0ee00, 0x0213d, 0x02145, 0x02146, 0x02147, 0x02148, 0x02149,
-/* F750 */ 0x02981, 0x0ee95, 0x0ee96, 0x0ee97, 0x0, 0x0, 0x0ee98, 0x0ee99,
-/* F758 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* F760 */ 0x0, 0x0, 0x0, 0x0ee9d, 0x0ee9a, 0x0, 0x0ee9e, 0x0ee9b,
-/* F768 */ 0x0ee9c, 0x0ee9f, 0x0eea0, 0x0eeab, 0x0eeac, 0x0, 0x0, 0x0,
-/* F770 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* F778 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* F780 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* F788 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* F790 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* F798 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* F7A0 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* F7A8 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* F7B0 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* F7B8 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0eea1, 0x0eea2,
-/* F7C0 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* F7C8 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* F7D0 */ 0x0eea3, 0x0eea4, 0x0eea5, 0x0eea6, 0x0eea7, 0x0eea8, 0x0eea9, 0x0eeaa,
-/* F7D8 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* F7E0 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* F7E8 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* F7F0 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* F7F8 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* F800 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* F808 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* F810 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* F818 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* F820 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* F828 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* F830 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* F838 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* F840 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* F848 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* F850 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* F858 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* F860 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* F868 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* F870 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* F878 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* F880 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* F888 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* F890 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* F898 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* F8A0 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* F8A8 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* F8B0 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* F8B8 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* F8C0 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* F8C8 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* F8D0 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* F8D8 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* F8E0 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* F8E8 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* F8F0 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* F8F8 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0
-};
-
-/* These data are taken from adobe's cid2code.txt for ac14 */
-const int cns14pua[] = { /* Big5 and friends */
-/* E000 */ 0x20547, 0x0, 0x205df, 0x23fc5, 0x0, 0x0, 0x0, 0x0,
-/* E008 */ 0x0, 0x24942, 0x289e4, 0x0, 0x219db, 0x0, 0x23cc8, 0x0,
-/* E010 */ 0x0, 0x0, 0x24933, 0x289aa, 0x202a0, 0x26bb3, 0x21305, 0x0,
-/* E018 */ 0x224ed, 0x0, 0x26d29, 0x27a84, 0x23600, 0x24ab1, 0x22513, 0x0,
-/* E020 */ 0x2037e, 0x0, 0x20380, 0x20347, 0x0, 0x2041f, 0x0, 0x0,
-/* E028 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x249a4, 0x20487, 0x0,
-/* E030 */ 0x233b4, 0x0, 0x20bff, 0x220fc, 0x202e5, 0x22530, 0x2058e, 0x23233,
-/* E038 */ 0x21983, 0x0, 0x0, 0x205b3, 0x23c99, 0x0, 0x0, 0x0,
-/* E040 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x24aa6, 0x0, 0x0,
-/* E048 */ 0x0, 0x0, 0x0, 0x0, 0x2372d, 0x0, 0x0, 0x0,
-/* E050 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* E058 */ 0x0, 0x0, 0x26b13, 0x0, 0x28ade, 0x0, 0x0, 0x23f80,
-/* E060 */ 0x20954, 0x23fec, 0x0, 0x0, 0x20be2, 0x0, 0x21726, 0x0,
-/* E068 */ 0x0, 0x0, 0x0, 0x0, 0x216e8, 0x0, 0x0, 0x0,
-/* E070 */ 0x0, 0x286ab, 0x0, 0x0, 0x21596, 0x21613, 0x0, 0x0,
-/* E078 */ 0x28a9b, 0x0, 0x0, 0x0, 0x0, 0x25772, 0x0, 0x0,
-/* E080 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x20b8f,
-/* E088 */ 0x0, 0x23feb, 0x22da3, 0x0, 0x20c77, 0x0, 0x0, 0x0,
-/* E090 */ 0x0, 0x0, 0x0, 0x26b53, 0x20d74, 0x0, 0x0, 0x0,
-/* E098 */ 0x0, 0x2170d, 0x20edd, 0x0, 0x20d4d, 0x289bc, 0x22698, 0x0,
-/* E0A0 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x218d7, 0x2403a,
-/* E0A8 */ 0x0, 0x24435, 0x0, 0x210b4, 0x0, 0x0, 0x2328a, 0x0,
-/* E0B0 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* E0B8 */ 0x0, 0x0, 0x28b66, 0x0, 0x2124f, 0x0, 0x241a5, 0x0,
-/* E0C0 */ 0x0, 0x0, 0x0, 0x26c7e, 0x0, 0x21416, 0x0, 0x21454,
-/* E0C8 */ 0x24363, 0x0, 0x24bf5, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* E0D0 */ 0x2123c, 0x0, 0x0, 0x0, 0x2a150, 0x24278, 0x0, 0x0,
-/* E0D8 */ 0x0, 0x0, 0x0, 0x0, 0x2163e, 0x0, 0x0, 0x21692,
-/* E0E0 */ 0x0, 0x0, 0x20d4e, 0x26c81, 0x26d2a, 0x217dc, 0x0, 0x217fb,
-/* E0E8 */ 0x217b2, 0x26da6, 0x0, 0x21828, 0x216d5, 0x0, 0x26e45, 0x0,
-/* E0F0 */ 0x0, 0x0, 0x249a9, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* E0F8 */ 0x26fa1, 0x22554, 0x0, 0x21911, 0x0, 0x216b8, 0x0, 0x0,
-/* E100 */ 0x0, 0x0, 0x0, 0x27a0e, 0x0, 0x0, 0x20204, 0x0,
-/* E108 */ 0x0, 0x21a34, 0x259cc, 0x205a5, 0x0, 0x0, 0x0, 0x0,
-/* E110 */ 0x21b44, 0x0, 0x0, 0x0, 0x21ca5, 0x26b28, 0x0, 0x0,
-/* E118 */ 0x0, 0x0, 0x0, 0x0, 0x21df9, 0x21e37, 0x0, 0x0,
-/* E120 */ 0x0, 0x21ea4, 0x0, 0x0, 0x0, 0x0, 0x24901, 0x22049,
-/* E128 */ 0x22173, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* E130 */ 0x244bc, 0x20cd3, 0x0, 0x0, 0x0, 0x0, 0x21771, 0x0,
-/* E138 */ 0x0, 0x28482, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* E140 */ 0x0, 0x201c1, 0x2f894, 0x0, 0x0, 0x2133a, 0x0, 0x26888,
-/* E148 */ 0x223d0, 0x0, 0x22471, 0x0, 0x0, 0x26e6e, 0x0, 0x0,
-/* E150 */ 0x28a36, 0x0, 0x0, 0x0, 0x25250, 0x21f6a, 0x270f8, 0x22668,
-/* E158 */ 0x0, 0x2029e, 0x28a29, 0x0, 0x0, 0x21877, 0x0, 0x0,
-/* E160 */ 0x0, 0x0, 0x227b4, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* E168 */ 0x24982, 0x2498f, 0x27a53, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* E170 */ 0x0, 0x2f8a6, 0x26ed2, 0x0, 0x0, 0x20656, 0x0, 0x0,
-/* E178 */ 0x23fb7, 0x2285f, 0x0, 0x28b9d, 0x2995d, 0x0, 0x0, 0x22980,
-/* E180 */ 0x228c1, 0x0, 0x0, 0x0, 0x0, 0x20118, 0x0, 0x21770,
-/* E188 */ 0x0, 0x22e0d, 0x0, 0x249df, 0x0, 0x0, 0x0, 0x2138e,
-/* E190 */ 0x217fc, 0x0, 0x0, 0x22e36, 0x0, 0x2408c, 0x2571d, 0x0,
-/* E198 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x24a28,
-/* E1A0 */ 0x24a23, 0x0, 0x0, 0x0, 0x2307e, 0x0, 0x24940, 0x0,
-/* E1A8 */ 0x0, 0x0, 0x21829, 0x0, 0x0, 0x0, 0x23400, 0x0,
-/* E1B0 */ 0x231f7, 0x231f8, 0x0, 0x231a4, 0x231a5, 0x0, 0x20e75, 0x0,
-/* E1B8 */ 0x251e6, 0x0, 0x0, 0x21e3d, 0x23231, 0x285f4, 0x231c8, 0x25313,
-/* E1C0 */ 0x0, 0x228f7, 0x0, 0x0, 0x2439c, 0x24a21, 0x0, 0x0,
-/* E1C8 */ 0x237c2, 0x0, 0x0, 0x0, 0x241cd, 0x290ed, 0x0, 0x0,
-/* E1D0 */ 0x0, 0x0, 0x0, 0x0, 0x233e6, 0x26da0, 0x0, 0x2346f,
-/* E1D8 */ 0x0, 0x0, 0x28adf, 0x0, 0x0, 0x235cd, 0x0, 0x0,
-/* E1E0 */ 0x0, 0x0, 0x2363c, 0x0, 0x0, 0x0, 0x28a4a, 0x0,
-/* E1E8 */ 0x0, 0x0, 0x0, 0x203c9, 0x0, 0x0, 0x0, 0x23659,
-/* E1F0 */ 0x2212a, 0x0, 0x23703, 0x0, 0x0, 0x0, 0x0, 0x2919c,
-/* E1F8 */ 0x0, 0x0, 0x20923, 0x0, 0x0, 0x0, 0x227cd, 0x0,
-/* E200 */ 0x23adb, 0x203b5, 0x21958, 0x0, 0x0, 0x23b5a, 0x0, 0x23efc,
-/* E208 */ 0x0, 0x0, 0x2248b, 0x248f1, 0x26b51, 0x0, 0x0, 0x0,
-/* E210 */ 0x23dbc, 0x0, 0x23dbd, 0x241a4, 0x2490c, 0x24900, 0x23cc9, 0x0,
-/* E218 */ 0x0, 0x20d32, 0x0, 0x231f9, 0x22491, 0x0, 0x0, 0x26d25,
-/* E220 */ 0x26da1, 0x26deb, 0x0, 0x0, 0x0, 0x0, 0x2497f, 0x24085,
-/* E228 */ 0x26e72, 0x0, 0x26f74, 0x0, 0x0, 0x0, 0x0, 0x28b21,
-/* E230 */ 0x0, 0x23e2f, 0x0, 0x23f82, 0x0, 0x0, 0x0, 0x2304b,
-/* E238 */ 0x0, 0x0, 0x0, 0x23e30, 0x0, 0x21497, 0x2403d, 0x0,
-/* E240 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x29170, 0x0, 0x0,
-/* E248 */ 0x24144, 0x0, 0x24091, 0x24155, 0x24039, 0x23ff0, 0x23fb4, 0x2413f,
-/* E250 */ 0x0, 0x24156, 0x24157, 0x24140, 0x261dd, 0x0, 0x0, 0x0,
-/* E258 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* E260 */ 0x0, 0x24277, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* E268 */ 0x24365, 0x0, 0x0, 0x242c1, 0x0, 0x2445a, 0x24a27, 0x24a22,
-/* E270 */ 0x0, 0x28be8, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* E278 */ 0x0, 0x0, 0x25605, 0x0, 0x0, 0x24974, 0x0, 0x0,
-/* E280 */ 0x0, 0x0, 0x23044, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* E288 */ 0x24823, 0x2882b, 0x0, 0x28804, 0x0, 0x0, 0x0, 0x0,
-/* E290 */ 0x20c3a, 0x26a2e, 0x0, 0x0, 0x241e2, 0x216e7, 0x24a24, 0x0,
-/* E298 */ 0x0, 0x249b7, 0x2498d, 0x249fb, 0x0, 0x0, 0x0, 0x24a26,
-/* E2A0 */ 0x0, 0x205c3, 0x0, 0x0, 0x228ad, 0x0, 0x28eb2, 0x0,
-/* E2A8 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* E2B0 */ 0x0, 0x0, 0x24a8c, 0x2415f, 0x24a79, 0x28b8f, 0x0, 0x28c03,
-/* E2B8 */ 0x2189e, 0x0, 0x21988, 0x0, 0x0, 0x0, 0x28ed9, 0x21a4b,
-/* E2C0 */ 0x0, 0x28eac, 0x0, 0x0, 0x0, 0x0, 0x0, 0x24f82,
-/* E2C8 */ 0x0, 0x24d13, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* E2D0 */ 0x0, 0x0, 0x0, 0x0, 0x263f5, 0x0, 0x0, 0x0,
-/* E2D8 */ 0x26911, 0x2690e, 0x0, 0x0, 0x0, 0x0, 0x26f9f, 0x0,
-/* E2E0 */ 0x2509d, 0x2517d, 0x21e1c, 0x0, 0x0, 0x0, 0x0, 0x25220,
-/* E2E8 */ 0x0, 0x232ac, 0x0, 0x28964, 0x28968, 0x216c1, 0x0, 0x0,
-/* E2F0 */ 0x21376, 0x24a12, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* E2F8 */ 0x255e0, 0x0, 0x0, 0x0, 0x2760c, 0x0, 0x0, 0x28b2b,
-/* E300 */ 0x26083, 0x2261c, 0x0, 0x0, 0x0, 0x0, 0x25857, 0x0,
-/* E308 */ 0x27b39, 0x0, 0x0, 0x0, 0x27126, 0x0, 0x0, 0x2910d,
-/* E310 */ 0x0, 0x23ed7, 0x0, 0x26ed3, 0x0, 0x257e0, 0x0, 0x0,
-/* E318 */ 0x28be9, 0x0, 0x0, 0x258e1, 0x294d9, 0x0, 0x0, 0x259ac,
-/* E320 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x2648d, 0x0, 0x0,
-/* E328 */ 0x0, 0x0, 0x0, 0x0, 0x25c01, 0x0, 0x0, 0x0,
-/* E330 */ 0x2530e, 0x25cfe, 0x0, 0x0, 0x0, 0x25bb4, 0x26c7f, 0x0,
-/* E338 */ 0x0, 0x0, 0x0, 0x25d20, 0x0, 0x25c65, 0x0, 0x0,
-/* E340 */ 0x0, 0x0, 0x25cc1, 0x0, 0x0, 0x24882, 0x0, 0x0,
-/* E348 */ 0x24578, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* E350 */ 0x0, 0x0, 0x26e44, 0x0, 0x26ed6, 0x0, 0x0, 0x0,
-/* E358 */ 0x0, 0x0, 0x0, 0x24057, 0x26029, 0x0, 0x0, 0x0,
-/* E360 */ 0x217f9, 0x0, 0x2836d, 0x0, 0x26121, 0x2615a, 0x0, 0x0,
-/* E368 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x262d0,
-/* E370 */ 0x0, 0x0, 0x26351, 0x0, 0x21661, 0x20068, 0x0, 0x23766,
-/* E378 */ 0x0, 0x2833a, 0x0, 0x26489, 0x0, 0x0, 0x0, 0x0,
-/* E380 */ 0x0, 0x2a087, 0x26cc3, 0x0, 0x0, 0x0, 0x22714, 0x0,
-/* E388 */ 0x26626, 0x23de3, 0x266e8, 0x0, 0x0, 0x28a48, 0x0, 0x0,
-/* E390 */ 0x0, 0x226f6, 0x0, 0x26498, 0x24fb8, 0x0, 0x2148a, 0x0,
-/* E398 */ 0x2185e, 0x0, 0x24a65, 0x24a95, 0x0, 0x0, 0x20b0d, 0x26a52,
-/* E3A0 */ 0x23d7e, 0x0, 0x214fd, 0x0, 0x0, 0x26b0a, 0x249a7, 0x23530,
-/* E3A8 */ 0x21773, 0x23df8, 0x0, 0x0, 0x2f994, 0x0, 0x0, 0x0,
-/* E3B0 */ 0x0, 0x20e16, 0x217b4, 0x0, 0x2317d, 0x2355a, 0x0, 0x0,
-/* E3B8 */ 0x0, 0x23e8b, 0x26da3, 0x26b05, 0x26b97, 0x235ce, 0x0, 0x0,
-/* E3C0 */ 0x0, 0x0, 0x0, 0x26da5, 0x0, 0x0, 0x0, 0x0,
-/* E3C8 */ 0x26ed4, 0x0, 0x0, 0x0, 0x26e42, 0x22eef, 0x0, 0x25be4,
-/* E3D0 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x23cb5, 0x0, 0x0,
-/* E3D8 */ 0x26b96, 0x26e77, 0x26e43, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* E3E0 */ 0x0, 0x25c91, 0x0, 0x25cc0, 0x0, 0x0, 0x0, 0x26e99,
-/* E3E8 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x28625, 0x2863b, 0x0,
-/* E3F0 */ 0x27088, 0x0, 0x21582, 0x270cd, 0x2f9b2, 0x0, 0x0, 0x0,
-/* E3F8 */ 0x218a2, 0x0, 0x2739a, 0x0, 0x0, 0x2a0f8, 0x0, 0x22c27,
-/* E400 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* E408 */ 0x0, 0x275e0, 0x23db9, 0x275e4, 0x0, 0x0, 0x0, 0x0,
-/* E410 */ 0x0, 0x0, 0x0, 0x0, 0x2770f, 0x0, 0x0, 0x0,
-/* E418 */ 0x0, 0x0, 0x0, 0x28a25, 0x0, 0x27924, 0x27abd, 0x0,
-/* E420 */ 0x0, 0x0, 0x0, 0x27a59, 0x0, 0x27b3a, 0x23f8f, 0x0,
-/* E428 */ 0x27b38, 0x0, 0x0, 0x0, 0x25430, 0x25565, 0x0, 0x0,
-/* E430 */ 0x0, 0x0, 0x24a7a, 0x0, 0x0, 0x0, 0x216df, 0x0,
-/* E438 */ 0x0, 0x0, 0x27d54, 0x27d8f, 0x2f9d4, 0x0, 0x27d53, 0x0,
-/* E440 */ 0x27d98, 0x27dbd, 0x0, 0x0, 0x21910, 0x0, 0x0, 0x0,
-/* E448 */ 0x24cc9, 0x0, 0x0, 0x0, 0x28002, 0x21014, 0x2498a, 0x0,
-/* E450 */ 0x281bc, 0x2710c, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* E458 */ 0x0, 0x28365, 0x28412, 0x0, 0x0, 0x2a29f, 0x20a50, 0x0,
-/* E460 */ 0x0, 0x289de, 0x2853d, 0x23dbb, 0x0, 0x23262, 0x0, 0x2a014,
-/* E468 */ 0x286bc, 0x28501, 0x22325, 0x0, 0x26ed7, 0x0, 0x2853c, 0x27abe,
-/* E470 */ 0x0, 0x2856c, 0x2860b, 0x0, 0x28713, 0x0, 0x286e6, 0x0,
-/* E478 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x28933, 0x21e89,
-/* E480 */ 0x0, 0x0, 0x0, 0x0, 0x255b9, 0x0, 0x28ac6, 0x23c9b,
-/* E488 */ 0x28b0c, 0x255db, 0x20d31, 0x0, 0x0, 0x28ae1, 0x28beb, 0x0,
-/* E490 */ 0x0, 0x28ae2, 0x28ae5, 0x0, 0x0, 0x28bec, 0x28c39, 0x28bff,
-/* E498 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* E4A0 */ 0x0, 0x2267a, 0x286d8, 0x2127c, 0x23e2e, 0x0, 0x0, 0x0,
-/* E4A8 */ 0x0, 0x0, 0x0, 0x26ed5, 0x0, 0x0, 0x0, 0x28ae0,
-/* E4B0 */ 0x0, 0x0, 0x0, 0x26cb8, 0x20274, 0x26410, 0x290af, 0x290e5,
-/* E4B8 */ 0x24ad1, 0x21915, 0x2330a, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* E4C0 */ 0x0, 0x24ae9, 0x0, 0x0, 0x0, 0x0, 0x291d5, 0x0,
-/* E4C8 */ 0x0, 0x291eb, 0x0, 0x0, 0x0, 0x230b7, 0x230bc, 0x0,
-/* E4D0 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x2546c, 0x0,
-/* E4D8 */ 0x0, 0x29433, 0x0, 0x0, 0x2941d, 0x2797a, 0x0, 0x0,
-/* E4E0 */ 0x0, 0x0, 0x0, 0x0, 0x27175, 0x0, 0x20630, 0x2415c,
-/* E4E8 */ 0x25706, 0x0, 0x0, 0x0, 0x0, 0x0, 0x26d27, 0x216d3,
-/* E4F0 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x24a29, 0x0,
-/* E4F8 */ 0x29857, 0x29905, 0x0, 0x0, 0x0, 0x0, 0x0, 0x25725,
-/* E500 */ 0x0, 0x290b1, 0x29bd5, 0x0, 0x0, 0x29b05, 0x0, 0x0,
-/* E508 */ 0x0, 0x0, 0x28600, 0x0, 0x0, 0x269a8, 0x0, 0x2307d,
-/* E510 */ 0x0, 0x0, 0x29d3e, 0x0, 0x21863, 0x0, 0x2424b, 0x0,
-/* E518 */ 0x0, 0x0, 0x29e68, 0x0, 0x29fb7, 0x2a192, 0x2a1ab, 0x2a0e1,
-/* E520 */ 0x2a123, 0x2a1df, 0x0, 0x0, 0x2a134, 0x0, 0x0, 0x0,
-/* E528 */ 0x2215b, 0x2a193, 0x2a220, 0x2193b, 0x2a233, 0x0, 0x2a0b9, 0x2a2b4,
-/* E530 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x24364,
-/* E538 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x28c2b, 0x0,
-/* E540 */ 0x0, 0x0, 0x0, 0x26da2, 0x0, 0x0, 0x0, 0x0,
-/* E548 */ 0x0, 0x0, 0x0, 0x2908b, 0x0, 0x0, 0x0, 0x0,
-/* E550 */ 0x0, 0x0, 0x0, 0x0, 0x24975, 0x249bb, 0x0, 0x249f8,
-/* E558 */ 0x24348, 0x24a51, 0x0, 0x28bda, 0x218fa, 0x0, 0x2897e, 0x28e36,
-/* E560 */ 0x0, 0x0, 0x28a44, 0x0, 0x0, 0x0, 0x2896c, 0x244b9,
-/* E568 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x24473, 0x243f8, 0x0,
-/* E570 */ 0x217ef, 0x0, 0x218be, 0x23599, 0x0, 0x21885, 0x2542f, 0x217f8,
-/* E578 */ 0x0, 0x216fb, 0x21839, 0x0, 0x21774, 0x218d1, 0x25f4b, 0x0,
-/* E580 */ 0x216c0, 0x0, 0x24a25, 0x213fe, 0x212a8, 0x213c6, 0x214b6, 0x0,
-/* E588 */ 0x236a6, 0x0, 0x0, 0x24994, 0x27165, 0x23e31, 0x2555c, 0x23efb,
-/* E590 */ 0x27052, 0x0, 0x236ee, 0x2999d, 0x26f26, 0x0, 0x0, 0x0,
-/* E598 */ 0x0, 0x0, 0x21922, 0x0, 0x0, 0x2373f, 0x240e1, 0x2408b,
-/* E5A0 */ 0x2410f, 0x26c21, 0x0, 0x0, 0x266b1, 0x0, 0x20fdf, 0x20ba8,
-/* E5A8 */ 0x20e0d, 0x0, 0x28b13, 0x0, 0x0, 0x0, 0x0, 0x24436,
-/* E5B0 */ 0x0, 0x20465, 0x2037f, 0x0, 0x0, 0x25651, 0x0, 0x201ab,
-/* E5B8 */ 0x203cb, 0x0, 0x2030a, 0x20414, 0x0, 0x0, 0x202c0, 0x28eb3,
-/* E5C0 */ 0x20275, 0x0, 0x2020c, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* E5C8 */ 0x24a0e, 0x23e8a, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* E5D0 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x23595,
-/* E5D8 */ 0x23e39, 0x23ebf, 0x0, 0x21884, 0x23e89, 0x0, 0x0, 0x205e0,
-/* E5E0 */ 0x0, 0x204a3, 0x20492, 0x20491, 0x0, 0x28a9c, 0x2070e, 0x0,
-/* E5E8 */ 0x0, 0x20873, 0x0, 0x0, 0x0, 0x0, 0x2438c, 0x20c20,
-/* E5F0 */ 0x249ac, 0x210e4, 0x0, 0x20e1d, 0x0, 0x0, 0x0, 0x0,
-/* E5F8 */ 0x0, 0x0, 0x0, 0x24abc, 0x2408d, 0x0, 0x0, 0x0,
-/* E600 */ 0x240c9, 0x0, 0x20345, 0x0, 0x20bc6, 0x0, 0x0, 0x0,
-/* E608 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x28a46,
-/* E610 */ 0x216fa, 0x2176f, 0x21710, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* E618 */ 0x0, 0x25946, 0x219f3, 0x21861, 0x24295, 0x0, 0x0, 0x0,
-/* E620 */ 0x0, 0x25e83, 0x0, 0x28bd7, 0x20413, 0x0, 0x0, 0x21303,
-/* E628 */ 0x0, 0x0, 0x0, 0x289fb, 0x0, 0x0, 0x0, 0x0,
-/* E630 */ 0x0, 0x0, 0x21996, 0x2197c, 0x23aee, 0x0, 0x0, 0x21903,
-/* E638 */ 0x21904, 0x0, 0x218a0, 0x0, 0x216fe, 0x0, 0x0, 0x28a47,
-/* E640 */ 0x21dba, 0x23472, 0x289a8, 0x0, 0x0, 0x21927, 0x217ab, 0x0,
-/* E648 */ 0x2173b, 0x0, 0x0, 0x275fd, 0x0, 0x0, 0x22860, 0x2262b,
-/* E650 */ 0x0, 0x0, 0x225af, 0x225be, 0x29088, 0x26f73, 0x0, 0x2003e,
-/* E658 */ 0x20046, 0x2261b, 0x0, 0x0, 0x0, 0x22c9b, 0x22d07, 0x246d4,
-/* E660 */ 0x2914d, 0x0, 0x24665, 0x22b6a, 0x0, 0x22b22, 0x23450, 0x298ea,
-/* E668 */ 0x22e78, 0x0, 0x2a45b, 0x0, 0x0, 0x0, 0x249e3, 0x22d67,
-/* E670 */ 0x0, 0x22ca1, 0x0, 0x0, 0x0, 0x0, 0x2308e, 0x232ad,
-/* E678 */ 0x24989, 0x232ab, 0x0, 0x232e0, 0x218d9, 0x2943f, 0x0, 0x23289,
-/* E680 */ 0x231b3, 0x0, 0x0, 0x25584, 0x28b22, 0x2558f, 0x216fc, 0x2555b,
-/* E688 */ 0x25425, 0x0, 0x23103, 0x2182a, 0x23234, 0x0, 0x2320f, 0x23182,
-/* E690 */ 0x242c9, 0x0, 0x26d24, 0x0, 0x0, 0x0, 0x27870, 0x21deb,
-/* E698 */ 0x0, 0x232d2, 0x232e1, 0x0, 0x25872, 0x0, 0x2383a, 0x237bc,
-/* E6A0 */ 0x0, 0x237a2, 0x233fe, 0x0, 0x0, 0x0, 0x2462a, 0x0,
-/* E6A8 */ 0x0, 0x0, 0x0, 0x0, 0x237d5, 0x24487, 0x0, 0x0,
-/* E6B0 */ 0x0, 0x0, 0x21912, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* E6B8 */ 0x0, 0x23fc0, 0x23c9a, 0x0, 0x0, 0x28bea, 0x28acb, 0x0,
-/* E6C0 */ 0x2801e, 0x289dc, 0x0, 0x0, 0x0, 0x249ec, 0x0, 0x23f7f,
-/* E6C8 */ 0x0, 0x0, 0x2403c, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* E6D0 */ 0x0, 0x2431a, 0x24276, 0x0, 0x0, 0x0, 0x0, 0x2478f,
-/* E6D8 */ 0x24725, 0x0, 0x24aa4, 0x205eb, 0x0, 0x23ef8, 0x2365f, 0x24a4a,
-/* E6E0 */ 0x24917, 0x25fe1, 0x0, 0x0, 0x24adf, 0x28c23, 0x23f35, 0x0,
-/* E6E8 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x26dea, 0x0,
-/* E6F0 */ 0x0, 0x0, 0x24cd9, 0x24d06, 0x0, 0x0, 0x0, 0x2a5c6,
-/* E6F8 */ 0x0, 0x0, 0x28acc, 0x249ab, 0x2498e, 0x0, 0x0, 0x24a4e,
-/* E700 */ 0x0, 0x249c5, 0x248f3, 0x0, 0x0, 0x0, 0x28ae3, 0x21864,
-/* E708 */ 0x0, 0x25221, 0x251e7, 0x0, 0x23232, 0x0, 0x0, 0x0,
-/* E710 */ 0x24697, 0x23781, 0x0, 0x248f0, 0x0, 0x0, 0x0, 0x24aba,
-/* E718 */ 0x24ac7, 0x0, 0x24a96, 0x261ae, 0x0, 0x25581, 0x0, 0x0,
-/* E720 */ 0x0, 0x0, 0x0, 0x0, 0x27741, 0x256e3, 0x0, 0x0,
-/* E728 */ 0x0, 0x0, 0x0, 0x23efa, 0x0, 0x0, 0x0, 0x216e6,
-/* E730 */ 0x0, 0x0, 0x0, 0x20d4c, 0x2498c, 0x20299, 0x23dba, 0x2176e,
-/* E738 */ 0x0, 0x0, 0x0, 0x0, 0x201d4, 0x20c0d, 0x0, 0x0,
-/* E740 */ 0x226f5, 0x25aaf, 0x25a9c, 0x0, 0x2025b, 0x0, 0x0, 0x25bc6,
-/* E748 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x25bb3, 0x25ebc, 0x25ea6,
-/* E750 */ 0x0, 0x249f9, 0x217b0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* E758 */ 0x0, 0x0, 0x0, 0x26261, 0x2615c, 0x27b48, 0x0, 0x25e82,
-/* E760 */ 0x0, 0x26b75, 0x20916, 0x0, 0x2004e, 0x235cf, 0x0, 0x26412,
-/* E768 */ 0x263f8, 0x24962, 0x0, 0x0, 0x2082c, 0x25ae9, 0x25d43, 0x0,
-/* E770 */ 0x25e0e, 0x0, 0x0, 0x0, 0x0, 0x2343f, 0x0, 0x249f7,
-/* E778 */ 0x265ad, 0x0, 0x265a0, 0x0, 0x27127, 0x26cd1, 0x0, 0x0,
-/* E780 */ 0x0, 0x0, 0x0, 0x0, 0x267b4, 0x0, 0x26a42, 0x0,
-/* E788 */ 0x0, 0x26a51, 0x0, 0x26da7, 0x0, 0x2721b, 0x0, 0x0,
-/* E790 */ 0x21840, 0x0, 0x218a1, 0x0, 0x218d8, 0x0, 0x2f9bc, 0x23d8f,
-/* E798 */ 0x0, 0x27422, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* E7A0 */ 0x0, 0x0, 0x25683, 0x0, 0x27785, 0x27784, 0x28bf5, 0x28bd9,
-/* E7A8 */ 0x28b9c, 0x289f9, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* E7B0 */ 0x0, 0x29448, 0x0, 0x0, 0x24284, 0x0, 0x0, 0x0,
-/* E7B8 */ 0x21845, 0x0, 0x0, 0x0, 0x27ddc, 0x0, 0x0, 0x0,
-/* E7C0 */ 0x0, 0x0, 0x0, 0x0, 0x24c09, 0x0, 0x0, 0x0,
-/* E7C8 */ 0x0, 0x0, 0x22321, 0x0, 0x0, 0x0, 0x217da, 0x0,
-/* E7D0 */ 0x0, 0x2492f, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* E7D8 */ 0x28a4b, 0x0, 0x28afc, 0x0, 0x28c1d, 0x28c3b, 0x0, 0x0,
-/* E7E0 */ 0x0, 0x0, 0x0, 0x0, 0x28d34, 0x0, 0x0, 0x248ff,
-/* E7E8 */ 0x24a42, 0x243ea, 0x0, 0x23225, 0x0, 0x28ee7, 0x28e66, 0x28e65,
-/* E7F0 */ 0x0, 0x249ed, 0x24a78, 0x23fee, 0x0, 0x0, 0x0, 0x0,
-/* E7F8 */ 0x290b0, 0x0, 0x0, 0x29093, 0x257df, 0x0, 0x0, 0x28989,
-/* E800 */ 0x28c26, 0x28b2f, 0x263be, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* E808 */ 0x2421b, 0x0, 0x0, 0x0, 0x20f26, 0x0, 0x28bc5, 0x24ab2,
-/* E810 */ 0x0, 0x294da, 0x0, 0x295d7, 0x0, 0x0, 0x28b50, 0x24a67,
-/* E818 */ 0x28b64, 0x0, 0x28a45, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* E820 */ 0x0, 0x27b06, 0x0, 0x0, 0x0, 0x0, 0x0, 0x28b65,
-/* E828 */ 0x258c8, 0x0, 0x0, 0x0, 0x0, 0x298f1, 0x0, 0x29948,
-/* E830 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x21302, 0x0, 0x249b8,
-/* E838 */ 0x214e8, 0x0, 0x2271f, 0x23db8, 0x0, 0x0, 0x0, 0x0,
-/* E840 */ 0x0, 0x22781, 0x2296b, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* E848 */ 0x0, 0x0, 0x0, 0x29e2d, 0x0, 0x2a1f5, 0x2a0fe, 0x0,
-/* E850 */ 0x0, 0x24104, 0x0, 0x0, 0x0, 0x2a1b4, 0x2a0ed, 0x2a0f3,
-/* E858 */ 0x2992f, 0x0, 0x0, 0x26e12, 0x26fdf, 0x26b82, 0x0, 0x0,
-/* E860 */ 0x26da4, 0x26e84, 0x26df0, 0x0, 0x0, 0x26e00, 0x237d7, 0x26064,
-/* E868 */ 0x0, 0x2359c, 0x23640, 0x0, 0x249de, 0x0, 0x0, 0x0,
-/* E870 */ 0x0, 0x202bf, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* E878 */ 0x2555d, 0x0, 0x0, 0x0, 0x0, 0x21757, 0x231c9, 0x24941,
-/* E880 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x241b5,
-/* E888 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x241ac,
-/* E890 */ 0x0, 0x26c40, 0x24f97, 0x0, 0x217b5, 0x28a49, 0x0, 0x0,
-/* E898 */ 0x0, 0x0, 0x24488, 0x0, 0x0, 0x289fc, 0x0, 0x0,
-/* E8A0 */ 0x218d6, 0x20f1d, 0x0, 0x26cc0, 0x21413, 0x242fa, 0x22c26, 0x243c1,
-/* E8A8 */ 0x0, 0x23db7, 0x26741, 0x0, 0x2615b, 0x260a4, 0x249b9, 0x2498b,
-/* E8B0 */ 0x289fa, 0x0, 0x0, 0x0, 0x0, 0x28b63, 0x2189f, 0x0,
-/* E8B8 */ 0x24ab3, 0x0, 0x0, 0x0, 0x0, 0x24a3e, 0x24a94, 0x217d9,
-/* E8C0 */ 0x24a66, 0x203a7, 0x21424, 0x249e5, 0x0, 0x24916, 0x0, 0x24976,
-/* E8C8 */ 0x0, 0x0, 0x0, 0x204fe, 0x0, 0x28ace, 0x28a16, 0x0,
-/* E8D0 */ 0x28be7, 0x255d5, 0x0, 0x28a82, 0x0, 0x24943, 0x20cff, 0x0,
-/* E8D8 */ 0x2061a, 0x20beb, 0x20cb8, 0x0, 0x0, 0x217fa, 0x0, 0x216c2,
-/* E8E0 */ 0x24a50, 0x21852, 0x0, 0x0, 0x0, 0x28ac0, 0x249ad, 0x0,
-/* E8E8 */ 0x218bf, 0x21883, 0x27484, 0x0, 0x0, 0x23d5b, 0x0, 0x0,
-/* E8F0 */ 0x0, 0x28a81, 0x21862, 0x0, 0x0, 0x20ab4, 0x0, 0x0,
-/* E8F8 */ 0x0, 0x0, 0x0, 0x2139c, 0x0, 0x0, 0x28218, 0x0,
-/* E900 */ 0x290e4, 0x0, 0x0, 0x27e4f, 0x0, 0x0, 0x0, 0x23fed,
-/* E908 */ 0x23e2d, 0x0, 0x0, 0x0, 0x203f5, 0x0, 0x0, 0x0,
-/* E910 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x28c1c,
-/* E918 */ 0x26bc0, 0x0, 0x0, 0x0, 0x21452, 0x0, 0x24362, 0x24a71,
-/* E920 */ 0x22fe3, 0x212b0, 0x223bd, 0x0, 0x0, 0x21398, 0x234e5, 0x27bf4,
-/* E928 */ 0x236df, 0x28a83, 0x237d6, 0x233fa, 0x24c9f, 0x0, 0x236ad, 0x26cb7,
-/* E930 */ 0x0, 0x0, 0x0, 0x26d26, 0x26d51, 0x26c82, 0x26fde, 0x0,
-/* E938 */ 0x27109, 0x0, 0x2173a, 0x0, 0x26c80, 0x27053, 0x217db, 0x0,
-/* E940 */ 0x0, 0x217b3, 0x0, 0x0, 0x21905, 0x241fc, 0x0, 0x0,
-/* E948 */ 0x2173c, 0x0, 0x0, 0x0, 0x0, 0x242a5, 0x0, 0x0,
-/* E950 */ 0x24293, 0x0, 0x23ef9, 0x27736, 0x2445b, 0x242ca, 0x0, 0x24259,
-/* E958 */ 0x289e1, 0x0, 0x26d28, 0x0, 0x244ce, 0x27e4d, 0x243bd, 0x0,
-/* E960 */ 0x24256, 0x21304, 0x0, 0x0, 0x243e9, 0x0, 0x0, 0x2f825,
-/* E968 */ 0x24a4f, 0x0, 0x0, 0x0, 0x0, 0x0, 0x24a5d, 0x217df,
-/* E970 */ 0x0, 0x0, 0x0, 0x23afa, 0x23300, 0x20214, 0x0, 0x208d5,
-/* E978 */ 0x20619, 0x0, 0x21f9e, 0x2a2b6, 0x0, 0x2915b, 0x0, 0x0,
-/* E980 */ 0x0, 0x28a59, 0x29420, 0x0, 0x0, 0x0, 0x0, 0x27af4,
-/* E988 */ 0x0, 0x0, 0x256f6, 0x0, 0x0, 0x0, 0x27b18, 0x0,
-/* E990 */ 0x0, 0x248f2, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* E998 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* E9A0 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* E9A8 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* E9B0 */ 0x24f5c, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* E9B8 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* E9C0 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* E9C8 */ 0x0, 0x0, 0x0, 0x25535, 0x0, 0x0, 0x0, 0x0,
-/* E9D0 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* E9D8 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* E9E0 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* E9E8 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x20ccf,
-/* E9F0 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* E9F8 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* EA00 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* EA08 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* EA10 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* EA18 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* EA20 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* EA28 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* EA30 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* EA38 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* EA40 */ 0x0, 0x0, 0x0, 0x27967, 0x0, 0x0, 0x0, 0x0,
-/* EA48 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* EA50 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* EA58 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* EA60 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* EA68 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* EA70 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* EA78 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* EA80 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* EA88 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* EA90 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* EA98 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* EAA0 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* EAA8 */ 0x0, 0x21bc2, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* EAB0 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* EAB8 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x20094,
-/* EAC0 */ 0x202b7, 0x203a0, 0x0, 0x0, 0x0, 0x204d7, 0x0, 0x0,
-/* EAC8 */ 0x0, 0x205d5, 0x20615, 0x20676, 0x216ba, 0x0, 0x0, 0x20ac2,
-/* EAD0 */ 0x20acd, 0x20bbf, 0x0, 0x2f83b, 0x20bcb, 0x0, 0x20bfb, 0x20c3b,
-/* EAD8 */ 0x20c53, 0x20c65, 0x20c7c, 0x0, 0x20c8d, 0x0, 0x20cb5, 0x20cdd,
-/* EAE0 */ 0x20ced, 0x20d6f, 0x20db2, 0x20dc8, 0x0, 0x0, 0x0, 0x20e04,
-/* EAE8 */ 0x20e0e, 0x20ed7, 0x20f90, 0x20f2d, 0x20e73, 0x0, 0x20fbc, 0x0,
-/* EAF0 */ 0x2105c, 0x2104f, 0x21076, 0x0, 0x2107b, 0x21088, 0x21096, 0x0,
-/* EAF8 */ 0x210bf, 0x210d3, 0x2112f, 0x2113b, 0x0, 0x0, 0x212e3, 0x21375,
-/* EB00 */ 0x21336, 0x0, 0x21577, 0x21619, 0x217c3, 0x217c7, 0x0, 0x0,
-/* EB08 */ 0x2182d, 0x2196a, 0x21a2d, 0x21a45, 0x21c2a, 0x21c70, 0x21cac, 0x21ec8,
-/* EB10 */ 0x0, 0x21ed5, 0x21f15, 0x0, 0x0, 0x22045, 0x0, 0x0,
-/* EB18 */ 0x2227c, 0x223d7, 0x223fa, 0x2272a, 0x22871, 0x2294f, 0x0, 0x22967,
-/* EB20 */ 0x22993, 0x22ad5, 0x0, 0x22ae8, 0x0, 0x22b0e, 0x0, 0x22b3f,
-/* EB28 */ 0x0, 0x0, 0x22c4c, 0x0, 0x22c88, 0x22cb7, 0x25be8, 0x22d08,
-/* EB30 */ 0x22d12, 0x22db7, 0x22d95, 0x22e42, 0x22f74, 0x22fcc, 0x23033, 0x23066,
-/* EB38 */ 0x2331f, 0x233de, 0x0, 0x0, 0x0, 0x27a79, 0x23567, 0x235f3,
-/* EB40 */ 0x0, 0x249ba, 0x0, 0x2361a, 0x23716, 0x0, 0x20346, 0x0,
-/* EB48 */ 0x0, 0x0, 0x23aa7, 0x27657, 0x25fe2, 0x23e11, 0x23eb9, 0x275fe,
-/* EB50 */ 0x2209a, 0x0, 0x0, 0x24119, 0x28a9a, 0x242ee, 0x2430d, 0x2403b,
-/* EB58 */ 0x24334, 0x24396, 0x24a45, 0x205ca, 0x0, 0x20611, 0x0, 0x21ea8,
-/* EB60 */ 0x0, 0x23cff, 0x24404, 0x244d6, 0x0, 0x24674, 0x0, 0x2472f,
-/* EB68 */ 0x285e8, 0x299c9, 0x0, 0x221c3, 0x0, 0x28b4e, 0x0, 0x24812,
-/* EB70 */ 0x248fb, 0x24a15, 0x0, 0x24ac0, 0x20c78, 0x0, 0x24ea5, 0x24f86,
-/* EB78 */ 0x20779, 0x0, 0x2502c, 0x0, 0x0, 0x0, 0x25299, 0x25419,
-/* EB80 */ 0x23f4a, 0x24aa7, 0x0, 0x25446, 0x2546e, 0x26b52, 0x0, 0x0,
-/* EB88 */ 0x2553f, 0x27632, 0x2555e, 0x0, 0x25562, 0x25566, 0x257c7, 0x2493f,
-/* EB90 */ 0x2585d, 0x0, 0x0, 0x233cc, 0x0, 0x25903, 0x0, 0x28948,
-/* EB98 */ 0x25aae, 0x25b89, 0x25c06, 0x21d90, 0x0, 0x0, 0x0, 0x26102,
-/* EBA0 */ 0x27c12, 0x0, 0x261b2, 0x24f9a, 0x0, 0x26402, 0x2644a, 0x0,
-/* EBA8 */ 0x26bf7, 0x0, 0x26484, 0x2191c, 0x0, 0x249f6, 0x26488, 0x23fef,
-/* EBB0 */ 0x26512, 0x0, 0x265bf, 0x266b5, 0x2271b, 0x0, 0x257e1, 0x0,
-/* EBB8 */ 0x0, 0x2f8cd, 0x0, 0x0, 0x24521, 0x266fc, 0x0, 0x24934,
-/* EBC0 */ 0x0, 0x0, 0x26cbd, 0x0, 0x0, 0x26799, 0x2686e, 0x26411,
-/* EBC8 */ 0x2685e, 0x0, 0x268c7, 0x0, 0x290c0, 0x20a11, 0x26926, 0x0,
-/* EBD0 */ 0x26939, 0x0, 0x0, 0x269fa, 0x0, 0x26a2d, 0x0, 0x26469,
-/* EBD8 */ 0x20021, 0x0, 0x26a34, 0x26b5b, 0x0, 0x23519, 0x0, 0x26b9d,
-/* EBE0 */ 0x0, 0x26ca4, 0x0, 0x0, 0x26dae, 0x0, 0x0, 0x2258d,
-/* EBE8 */ 0x2704b, 0x271cd, 0x0, 0x27280, 0x27285, 0x0, 0x2217a, 0x2728b,
-/* EBF0 */ 0x0, 0x272e6, 0x249d0, 0x0, 0x0, 0x27450, 0x20ef8, 0x0,
-/* EBF8 */ 0x0, 0x22926, 0x28473, 0x217b1, 0x0, 0x24a2a, 0x21820, 0x0,
-/* EC00 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x29cad, 0x298a4, 0x0,
-/* EC08 */ 0x277cc, 0x27858, 0x0, 0x0, 0x2160a, 0x0, 0x2372f, 0x280e8,
-/* EC10 */ 0x213c5, 0x0, 0x0, 0x279dd, 0x291a8, 0x0, 0x0, 0x270af,
-/* EC18 */ 0x289ab, 0x279fd, 0x27a0a, 0x27b0b, 0x27d66, 0x2417a, 0x0, 0x0,
-/* EC20 */ 0x28009, 0x0, 0x2a2df, 0x0, 0x28318, 0x0, 0x26e07, 0x0,
-/* EC28 */ 0x0, 0x0, 0x2816f, 0x28023, 0x269b5, 0x213ed, 0x2322f, 0x28048,
-/* EC30 */ 0x0, 0x28c30, 0x28083, 0x0, 0x0, 0x28949, 0x0, 0x24988,
-/* EC38 */ 0x0, 0x0, 0x0, 0x24aa5, 0x23f81, 0x0, 0x0, 0x28090,
-/* EC40 */ 0x280f4, 0x2812e, 0x21fa1, 0x2814f, 0x28189, 0x281af, 0x2821a, 0x28306,
-/* EC48 */ 0x2832f, 0x2838a, 0x0, 0x28468, 0x286aa, 0x0, 0x0, 0x28956,
-/* EC50 */ 0x0, 0x0, 0x289b8, 0x0, 0x289e7, 0x0, 0x289e8, 0x28b46,
-/* EC58 */ 0x28bd4, 0x0, 0x28c09, 0x0, 0x28fc5, 0x290ec, 0x0, 0x29110,
-/* EC60 */ 0x2913c, 0x0, 0x2915e, 0x24aca, 0x0, 0x0, 0x0, 0x294e7,
-/* EC68 */ 0x295e9, 0x295b0, 0x295b8, 0x29732, 0x298d1, 0x29949, 0x2996a, 0x299c3,
-/* EC70 */ 0x29a28, 0x29b0e, 0x29d5a, 0x29d9b, 0x0, 0x29ef8, 0x29f23, 0x0,
-/* EC78 */ 0x0, 0x2a293, 0x0, 0x2a2ff, 0x0, 0x0, 0x2a5cb, 0x0,
-/* EC80 */ 0x20c9c, 0x0, 0x0, 0x0, 0x224b0, 0x0, 0x24a93, 0x0,
-/* EC88 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x28b2c, 0x2789d, 0x0,
-/* EC90 */ 0x0, 0x217f5, 0x28024, 0x28b6c, 0x28b99, 0x27a3e, 0x266af, 0x0,
-/* EC98 */ 0x27655, 0x23cb7, 0x25635, 0x25956, 0x0, 0x25e81, 0x26258, 0x0,
-/* ECA0 */ 0x20e6d, 0x0, 0x0, 0x23e88, 0x24c9e, 0x0, 0x0, 0x217f6,
-/* ECA8 */ 0x2187b, 0x0, 0x0, 0x25c4a, 0x0, 0x25311, 0x0, 0x29d98,
-/* ECB0 */ 0x0, 0x0, 0x0, 0x0, 0x25ed8, 0x0, 0x23d40, 0x0,
-/* ECB8 */ 0x0, 0x20fea, 0x20d49, 0x236ba, 0x0, 0x0, 0x0, 0x0,
-/* ECC0 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* ECC8 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x20e9d,
-/* ECD0 */ 0x0, 0x0, 0x0, 0x0, 0x282e2, 0x0, 0x0, 0x0,
-/* ECD8 */ 0x0, 0x0, 0x0, 0x20c41, 0x20c96, 0x0, 0x25148, 0x20e76,
-/* ECE0 */ 0x22c62, 0x20ea2, 0x0, 0x0, 0x0, 0x21075, 0x0, 0x0,
-/* ECE8 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* ECF0 */ 0x22b43, 0x0, 0x22eb3, 0x0, 0x0, 0x20da7, 0x0, 0x0,
-/* ECF8 */ 0x0, 0x0, 0x0, 0x0, 0x2688a, 0x0, 0x0, 0x0,
-/* ED00 */ 0x0, 0x0, 0x0, 0x0, 0x210c1, 0x0, 0x0, 0x24706,
-/* ED08 */ 0x0, 0x0, 0x26893, 0x0, 0x226f4, 0x27d2f, 0x241a3, 0x27d73,
-/* ED10 */ 0x26ed0, 0x272b6, 0x0, 0x211d9, 0x0, 0x23cfc, 0x2a6a9, 0x20eac,
-/* ED18 */ 0x20ef9, 0x0, 0x21ca2, 0x0, 0x24fc2, 0x27ff9, 0x20feb, 0x0,
-/* ED20 */ 0x0, 0x0, 0x22da0, 0x0, 0x247e0, 0x29d7c, 0x20fec, 0x20e0a,
-/* ED28 */ 0x0, 0x275a3, 0x20fed, 0x0, 0x26048, 0x21187, 0x0, 0x0,
-/* ED30 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* ED38 */ 0x0, 0x0, 0x0, 0x24618, 0x0, 0x24b6e, 0x0, 0x0,
-/* ED40 */ 0x0, 0x25a95, 0x20979, 0x0, 0x0, 0x22465, 0x0, 0x29eac,
-/* ED48 */ 0x0, 0x0, 0x23cfe, 0x29f30, 0x0, 0x24fa9, 0x2959e, 0x29fde,
-/* ED50 */ 0x0, 0x23db6, 0x272b2, 0x267b3, 0x23720, 0x0, 0x0, 0x23ef7,
-/* ED58 */ 0x23e2c, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x2048e,
-/* ED60 */ 0x0, 0x0, 0x20eb6, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* ED68 */ 0x0, 0x0, 0x0, 0x2a434, 0x0, 0x0, 0x0, 0x0,
-/* ED70 */ 0x0, 0x230da, 0x243f2, 0x0, 0x0, 0x212a9, 0x0, 0x24963,
-/* ED78 */ 0x29e06, 0x0, 0x270ae, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* ED80 */ 0x0, 0x2176c, 0x0, 0x0, 0x294d0, 0x26335, 0x27164, 0x0,
-/* ED88 */ 0x20d28, 0x26d22, 0x24ae2, 0x20d71, 0x0, 0x0, 0x21f0f, 0x0,
-/* ED90 */ 0x0, 0x21dd1, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* ED98 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* EDA0 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x2493e, 0x0,
-/* EDA8 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* EDB0 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* EDB8 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* EDC0 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x2176d, 0x0,
-/* EDC8 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x28e97,
-/* EDD0 */ 0x0, 0x26d23, 0x0, 0x0, 0x0, 0x0, 0x0, 0x203fc,
-/* EDD8 */ 0x0, 0x0, 0x25c21, 0x23cfd, 0x0, 0x24919, 0x0, 0x0,
-/* EDE0 */ 0x0, 0x20cd4, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* EDE8 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x201f2, 0x0, 0x0,
-/* EDF0 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* EDF8 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* EE00 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* EE08 */ 0x2a64a, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* EE10 */ 0x0, 0x2837d, 0x0, 0x0, 0x0, 0x24a77, 0x0, 0x0,
-/* EE18 */ 0x0, 0x0, 0x0, 0x28a5a, 0x0, 0x0, 0x0, 0x0,
-/* EE20 */ 0x2a2b2, 0x0, 0x2f840, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* EE28 */ 0x0, 0x0, 0x24abb, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* EE30 */ 0x2183b, 0x26e05, 0x0, 0x0, 0x2251b, 0x0, 0x0, 0x0,
-/* EE38 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* EE40 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* EE48 */ 0x26159, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* EE50 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x233f5, 0x0,
-/* EE58 */ 0x0, 0x0, 0x0, 0x28bc2, 0x0, 0x28e39, 0x0, 0x0,
-/* EE60 */ 0x21d46, 0x0, 0x0, 0x0, 0x20f3b, 0x0, 0x0, 0x0,
-/* EE68 */ 0x0, 0x0, 0x25f1a, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* EE70 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x27486, 0x0,
-/* EE78 */ 0x0, 0x0, 0x0, 0x0, 0x267cc, 0x0, 0x26ed1, 0x0,
-/* EE80 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* EE88 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* EE90 */ 0x0, 0x24011, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* EE98 */ 0x0, 0x0, 0x0, 0x0, 0x28b2d, 0x0, 0x0, 0x0,
-/* EEA0 */ 0x0, 0x0, 0x23cc7, 0x25ed7, 0x27656, 0x25531, 0x21944, 0x212fe,
-/* EEA8 */ 0x29903, 0x26ddc, 0x270ad, 0x0, 0x261ad, 0x28a0f, 0x23677, 0x200ee,
-/* EEB0 */ 0x26846, 0x24f0e, 0x0, 0x0, 0x2634c, 0x0, 0x0, 0x2626b,
-/* EEB8 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* EEC0 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* EEC8 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* EED0 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* EED8 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* EEE0 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* EEE8 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* EEF0 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* EEF8 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* EF00 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* EF08 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* EF10 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* EF18 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* EF20 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* EF28 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* EF30 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* EF38 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* EF40 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* EF48 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* EF50 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* EF58 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* EF60 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* EF68 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* EF70 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* EF78 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* EF80 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* EF88 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* EF90 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* EF98 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* EFA0 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* EFA8 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* EFB0 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* EFB8 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* EFC0 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* EFC8 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* EFD0 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* EFD8 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* EFE0 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* EFE8 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* EFF0 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* EFF8 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* F000 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* F008 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* F010 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* F018 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* F020 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* F028 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* F030 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* F038 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* F040 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* F048 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* F050 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* F058 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* F060 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* F068 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* F070 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* F078 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* F080 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* F088 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* F090 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* F098 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* F0A0 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* F0A8 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* F0B0 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* F0B8 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* F0C0 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* F0C8 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* F0D0 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* F0D8 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* F0E0 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* F0E8 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* F0F0 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* F0F8 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* F100 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* F108 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* F110 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* F118 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* F120 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* F128 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* F130 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* F138 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* F140 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* F148 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* F150 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* F158 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* F160 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* F168 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* F170 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* F178 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* F180 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* F188 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* F190 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* F198 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* F1A0 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* F1A8 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* F1B0 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* F1B8 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* F1C0 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* F1C8 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* F1D0 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* F1D8 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* F1E0 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* F1E8 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* F1F0 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* F1F8 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* F200 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* F208 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* F210 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* F218 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* F220 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* F228 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* F230 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* F238 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* F240 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* F248 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* F250 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* F258 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* F260 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* F268 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* F270 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* F278 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* F280 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* F288 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* F290 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* F298 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* F2A0 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* F2A8 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* F2B0 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* F2B8 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* F2C0 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* F2C8 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* F2D0 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* F2D8 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* F2E0 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* F2E8 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* F2F0 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* F2F8 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* F300 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* F308 */ 0x2010c, 0x0, 0x200d1, 0x200cd, 0x0, 0x0, 0x200cb, 0x21fe8,
-/* F310 */ 0x0, 0x200ca, 0x0, 0x0, 0x0, 0x0, 0x2010e, 0x0,
-/* F318 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* F320 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* F328 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* F330 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* F338 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* F340 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* F348 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* F350 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* F358 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* F360 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* F368 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* F370 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* F378 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* F380 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* F388 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* F390 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* F398 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* F3A0 */ 0x2a3a9, 0x21145, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* F3A8 */ 0x0, 0x0, 0x0, 0x0, 0x27735, 0x0, 0x0, 0x0,
-/* F3B0 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* F3B8 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* F3C0 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* F3C8 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* F3D0 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* F3D8 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* F3E0 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* F3E8 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* F3F0 */ 0x209e7, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* F3F8 */ 0x0, 0x29df6, 0x2700e, 0x0, 0x2a133, 0x0, 0x0, 0x0,
-/* F400 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* F408 */ 0x2846c, 0x21dca, 0x205d0, 0x22ae6, 0x0, 0x0, 0x0, 0x0,
-/* F410 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* F418 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* F420 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* F428 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* F430 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* F438 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x27d84, 0x0, 0x0,
-/* F440 */ 0x20c42, 0x20d15, 0x2512b, 0x0, 0x22cc6, 0x0, 0x20341, 0x0,
-/* F448 */ 0x24db8, 0x294e5, 0x0, 0x280be, 0x0, 0x22c38, 0x0, 0x0,
-/* F450 */ 0x2815d, 0x269f2, 0x24dea, 0x0, 0x20d7c, 0x20fb4, 0x20cd5, 0x210f4,
-/* F458 */ 0x0, 0x0, 0x20e96, 0x20c0b, 0x20f64, 0x22ca9, 0x28256, 0x244d3,
-/* F460 */ 0x0, 0x20d46, 0x29a4d, 0x280e9, 0x0, 0x24ea7, 0x22cc2, 0x0,
-/* F468 */ 0x0, 0x295f4, 0x0, 0x0, 0x252c7, 0x297d4, 0x278c8, 0x22d44,
-/* F470 */ 0x0, 0x0, 0x0, 0x0, 0x260a5, 0x0, 0x0, 0x22d4c,
-/* F478 */ 0x22bca, 0x21077, 0x0, 0x2106f, 0x266da, 0x26716, 0x279a0, 0x0,
-/* F480 */ 0x25052, 0x20c43, 0x0, 0x221a1, 0x28b4c, 0x20731, 0x0, 0x0,
-/* F488 */ 0x201a9, 0x0, 0x0, 0x22d8d, 0x0, 0x245c8, 0x204fc, 0x26097,
-/* F490 */ 0x20f4c, 0x20d96, 0x0, 0x0, 0x0, 0x0, 0x0, 0x22a66,
-/* F498 */ 0x2109d, 0x0, 0x0, 0x20d9c, 0x0, 0x0, 0x22775, 0x0,
-/* F4A0 */ 0x0, 0x0, 0x0, 0x0, 0x2a601, 0x20e09, 0x22acf, 0x22cc9,
-/* F4A8 */ 0x0, 0x210c8, 0x239c2, 0x0, 0x0, 0x2829b, 0x0, 0x25e49,
-/* F4B0 */ 0x220c7, 0x0, 0x20f31, 0x22cb2, 0x29720, 0x0, 0x0, 0x24e3b,
-/* F4B8 */ 0x0, 0x0, 0x27574, 0x22e8b, 0x22208, 0x2a65b, 0x28ccd, 0x20e7a,
-/* F4C0 */ 0x20c34, 0x2681c, 0x0, 0x210cf, 0x22803, 0x22939, 0x0, 0x251e3,
-/* F4C8 */ 0x20e8c, 0x20f8d, 0x20eaa, 0x0, 0x20f30, 0x20d47, 0x2114f, 0x20e4c,
-/* F4D0 */ 0x0, 0x20eab, 0x20ba9, 0x20d48, 0x210c0, 0x2113d, 0x0, 0x22696,
-/* F4D8 */ 0x0, 0x20fad, 0x233f4, 0x27639, 0x22bce, 0x20d7e, 0x20d7f, 0x22c51,
-/* F4E0 */ 0x22c55, 0x0, 0x20e98, 0x210c7, 0x20f2e, 0x2a632, 0x26b50, 0x28cd2,
-/* F4E8 */ 0x28d99, 0x28cca, 0x0, 0x0, 0x0, 0x0, 0x0, 0x29ec3,
-/* F4F0 */ 0x0, 0x0, 0x2775e, 0x22dee, 0x0, 0x0, 0x0, 0x0,
-/* F4F8 */ 0x26572, 0x0, 0x0, 0x0, 0x280bd, 0x0, 0x20efa, 0x20e0f,
-/* F500 */ 0x20e77, 0x20efb, 0x0, 0x24deb, 0x0, 0x20cd6, 0x0, 0x227b5,
-/* F508 */ 0x210c9, 0x20e10, 0x20e78, 0x21078, 0x21148, 0x28207, 0x21455, 0x20e79,
-/* F510 */ 0x24e50, 0x22da4, 0x0, 0x2101d, 0x2101e, 0x210f5, 0x210f6, 0x0,
-/* F518 */ 0x20e11, 0x27694, 0x282cd, 0x20fb5, 0x20e7b, 0x2517e, 0x0, 0x20fb6,
-/* F520 */ 0x21180, 0x252d8, 0x2a2bd, 0x249da, 0x2183a, 0x24177, 0x2827c, 0x0,
-/* F528 */ 0x0, 0x0, 0x2573d, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* F530 */ 0x0, 0x0, 0x0, 0x25b74, 0x2313d, 0x0, 0x0, 0x0,
-/* F538 */ 0x0, 0x0, 0x21bc1, 0x2f878, 0x0, 0x20086, 0x0, 0x0,
-/* F540 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* F548 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x248e9, 0x0,
-/* F550 */ 0x0, 0x0, 0x0, 0x2626a, 0x0, 0x0, 0x2634b, 0x0,
-/* F558 */ 0x0, 0x26612, 0x26951, 0x0, 0x0, 0x0, 0x278b2, 0x0,
-/* F560 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x28e0f, 0x0, 0x0,
-/* F568 */ 0x0, 0x0, 0x0, 0x29810, 0x0, 0x0, 0x0, 0x0,
-/* F570 */ 0x0, 0x0, 0x20087, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* F578 */ 0x0, 0x29c73, 0x0, 0x0, 0x0, 0x2414e, 0x0, 0x0,
-/* F580 */ 0x0, 0x251cd, 0x0, 0x25d30, 0x0, 0x28a32, 0x0, 0x0,
-/* F588 */ 0x0, 0x0, 0x0, 0x23281, 0x2a107, 0x0, 0x21980, 0x0,
-/* F590 */ 0x0, 0x0, 0x0, 0x2870f, 0x0, 0x0, 0x2a2ba, 0x0,
-/* F598 */ 0x0, 0x0, 0x0, 0x29947, 0x28aea, 0x0, 0x0, 0x0,
-/* F5A0 */ 0x2207e, 0x0, 0x0, 0x289e3, 0x0, 0x0, 0x0, 0x0,
-/* F5A8 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* F5B0 */ 0x21db6, 0x0, 0x0, 0x0, 0x22712, 0x0, 0x233f9, 0x0,
-/* F5B8 */ 0x0, 0x23c63, 0x0, 0x0, 0x0, 0x24505, 0x0, 0x0,
-/* F5C0 */ 0x24a13, 0x0, 0x0, 0x0, 0x25ca4, 0x25695, 0x0, 0x0,
-/* F5C8 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* F5D0 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x28db9, 0x2143f,
-/* F5D8 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* F5E0 */ 0x0, 0x0, 0x0, 0x0, 0x2497b, 0x0, 0x2710d, 0x0,
-/* F5E8 */ 0x26d74, 0x0, 0x26b15, 0x26fbe, 0x0, 0x0, 0x0, 0x0,
-/* F5F0 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* F5F8 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* F600 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* F608 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* F610 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* F618 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* F620 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* F628 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* F630 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* F638 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* F640 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* F648 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* F650 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* F658 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* F660 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* F668 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* F670 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* F678 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* F680 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* F688 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* F690 */ 0x0, 0x0, 0x0, 0x0, 0x289c0, 0x0, 0x0, 0x0,
-/* F698 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x23f41, 0x0,
-/* F6A0 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* F6A8 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x20325, 0x0, 0x0,
-/* F6B0 */ 0x20ed8, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* F6B8 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* F6C0 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* F6C8 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* F6D0 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* F6D8 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* F6E0 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* F6E8 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* F6F0 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* F6F8 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* F700 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* F708 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* F710 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* F718 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* F720 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* F728 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* F730 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* F738 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* F740 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* F748 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* F750 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* F758 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* F760 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* F768 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* F770 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* F778 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* F780 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* F788 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* F790 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* F798 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* F7A0 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* F7A8 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* F7B0 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* F7B8 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* F7C0 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* F7C8 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* F7D0 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* F7D8 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* F7E0 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x200cc, 0x0,
-/* F7E8 */ 0x2008a, 0x0, 0x0, 0x0, 0x0, 0x0, 0x27607, 0x0,
-/* F7F0 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* F7F8 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* F800 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* F808 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* F810 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* F818 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* F820 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* F828 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* F830 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* F838 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* F840 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* F848 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* F850 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* F858 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* F860 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* F868 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* F870 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* F878 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* F880 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* F888 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* F890 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* F898 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* F8A0 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* F8A8 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* F8B0 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* F8B8 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* F8C0 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* F8C8 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* F8D0 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* F8D8 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* F8E0 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* F8E8 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* F8F0 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-/* F8F8 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0
-};
-
diff --git a/Build/source/texk/web2c/luatexdir/luafontloader/fontforge/fontforge/python.c b/Build/source/texk/web2c/luatexdir/luafontloader/fontforge/fontforge/python.c
deleted file mode 100644
index 211ad7db6ee..00000000000
--- a/Build/source/texk/web2c/luatexdir/luafontloader/fontforge/fontforge/python.c
+++ /dev/null
@@ -1,320 +0,0 @@
-/* Copyright (C) 2007,2008 by George Williams */
-/*
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are met:
-
- * Redistributions of source code must retain the above copyright notice, this
- * list of conditions and the following disclaimer.
-
- * Redistributions in binary form must reproduce the above copyright notice,
- * this list of conditions and the following disclaimer in the documentation
- * and/or other materials provided with the distribution.
-
- * The name of the author may not be used to endorse or promote products
- * derived from this software without specific prior written permission.
-
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
- * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
- * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
- * EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
- * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
- * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
- * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
- * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-/* Python Interface to FontForge */
-
-
-#ifdef HAVE_CONFIG_H
-# include <w2c/config.h>
-#endif
-
-#include <stdio.h>
-
-#include "uiinterface.h"
-
-typedef struct flaglist {
- const char *name;
- int flag;
-} flaglist;
-
-/* These don't get translated. They are a copy of a similar list in fontinfo.c */
-static struct flaglist sfnt_name_str_ids[] = {
- { "SubFamily", 2},
- { "Copyright", 0},
- { "Family", 1},
- { "Fullname", 4},
- { "UniqueID", 3},
- { "Version", 5},
- { "PostscriptName", 6},
- { "Trademark", 7},
- { "Manufacturer", 8},
- { "Designer", 9},
- { "Descriptor", 10},
- { "Vendor URL", 11},
- { "Designer URL", 12},
- { "License", 13},
- { "License URL", 14},
-/* slot 15 is reserved */
- { "Preferred Family", 16},
- { "Preferred Styles", 17},
- { "Compatible Full", 18},
- { "Sample Text", 19},
- { "CID findfont Name", 20},
- { "WWS Family", 21},
- { "WWS Subfamily", 22},
- { NULL, 0 }
-};
-/* These don't get translated. They are a copy of a similar list in fontinfo.c */
-static struct flaglist sfnt_name_mslangs[] = {
- { "Afrikaans", 0x436},
- { "Albanian", 0x41c},
- { "Amharic", 0x45e},
- { "Arabic (Saudi Arabia)", 0x401},
- { "Arabic (Iraq)", 0x801},
- { "Arabic (Egypt)", 0xc01},
- { "Arabic (Libya)", 0x1001},
- { "Arabic (Algeria)", 0x1401},
- { "Arabic (Morocco)", 0x1801},
- { "Arabic (Tunisia)", 0x1C01},
- { "Arabic (Oman)", 0x2001},
- { "Arabic (Yemen)", 0x2401},
- { "Arabic (Syria)", 0x2801},
- { "Arabic (Jordan)", 0x2c01},
- { "Arabic (Lebanon)", 0x3001},
- { "Arabic (Kuwait)", 0x3401},
- { "Arabic (U.A.E.)", 0x3801},
- { "Arabic (Bahrain)", 0x3c01},
- { "Arabic (Qatar)", 0x4001},
- { "Armenian", 0x42b},
- { "Assamese", 0x44d},
- { "Azeri (Latin)", 0x42c},
- { "Azeri (Cyrillic)", 0x82c},
- { "Basque", 0x42d},
- { "Byelorussian", 0x423},
- { "Bengali", 0x445},
- { "Bengali Bangladesh", 0x845},
- { "Bulgarian", 0x402},
- { "Burmese", 0x455},
- { "Catalan", 0x403},
- { "Cambodian", 0x453},
- { "Cherokee", 0x45c},
- { "Chinese (Taiwan)", 0x404},
- { "Chinese (PRC)", 0x804},
- { "Chinese (Hong Kong)", 0xc04},
- { "Chinese (Singapore)", 0x1004},
- { "Chinese (Macau)", 0x1404},
- { "Croatian", 0x41a},
- { "Croatian Bosnia/Herzegovina", 0x101a},
- { "Czech", 0x405},
- { "Danish", 0x406},
- { "Divehi", 0x465},
- { "Dutch", 0x413},
- { "Flemish (Belgian Dutch)", 0x813},
- { "Edo", 0x466},
- { "English (British)", 0x809},
- { "English (US)", 0x409},
- { "English (Canada)", 0x1009},
- { "English (Australian)", 0xc09},
- { "English (New Zealand)", 0x1409},
- { "English (Irish)", 0x1809},
- { "English (South Africa)", 0x1c09},
- { "English (Jamaica)", 0x2009},
- { "English (Caribbean)", 0x2409},
- { "English (Belize)", 0x2809},
- { "English (Trinidad)", 0x2c09},
- { "English (Zimbabwe)", 0x3009},
- { "English (Philippines)", 0x3409},
- { "English (Indonesia)", 0x3809},
- { "English (Hong Kong)", 0x3c09},
- { "English (India)", 0x4009},
- { "English (Malaysia)", 0x4409},
- { "Estonian", 0x425},
- { "Faeroese", 0x438},
- { "Farsi", 0x429},
- { "Filipino", 0x464},
- { "Finnish", 0x40b},
- { "French French", 0x40c},
- { "French Belgium", 0x80c},
- { "French Canadian", 0xc0c},
- { "French Swiss", 0x100c},
- { "French Luxembourg", 0x140c},
- { "French Monaco", 0x180c},
- { "French West Indies", 0x1c0c},
- { "French Réunion", 0x200c},
- { "French D.R. Congo", 0x240c},
- { "French Senegal", 0x280c},
- { "French Camaroon", 0x2c0c},
- { "French Côte d'Ivoire", 0x300c},
- { "French Mali", 0x340c},
- { "French Morocco", 0x380c},
- { "French Haiti", 0x3c0c},
- { "French North Africa", 0xe40c},
- { "Frisian", 0x462},
- { "Fulfulde", 0x467},
- { "Gaelic (Scottish)", 0x43c},
- { "Gaelic (Irish)", 0x83c},
- { "Galician", 0x467},
- { "Georgian", 0x437},
- { "German German", 0x407},
- { "German Swiss", 0x807},
- { "German Austrian", 0xc07},
- { "German Luxembourg", 0x1007},
- { "German Liechtenstein", 0x1407},
- { "Greek", 0x408},
- { "Guarani", 0x474},
- { "Gujarati", 0x447},
- { "Hausa", 0x468},
- { "Hawaiian", 0x475},
- { "Hebrew", 0x40d},
- { "Hindi", 0x439},
- { "Hungarian", 0x40e},
- { "Ibibio", 0x469},
- { "Icelandic", 0x40f},
- { "Igbo", 0x470},
- { "Indonesian", 0x421},
- { "Inuktitut", 0x45d},
- { "Italian", 0x410},
- { "Italian Swiss", 0x810},
- { "Japanese", 0x411},
- { "Kannada", 0x44b},
- { "Kanuri", 0x471},
- { "Kashmiri (India)", 0x860},
- { "Kazakh", 0x43f},
- { "Khmer", 0x453},
- { "Kirghiz", 0x440},
- { "Konkani", 0x457},
- { "Korean", 0x412},
- { "Korean (Johab)", 0x812},
- { "Lao", 0x454},
- { "Latvian", 0x426},
- { "Latin", 0x476},
- { "Lithuanian", 0x427},
- { "Lithuanian (Classic)", 0x827},
- { "Macedonian", 0x42f},
- { "Malay", 0x43e},
- { "Malay (Brunei)", 0x83e},
- { "Malayalam", 0x44c},
- { "Maltese", 0x43a},
- { "Manipuri", 0x458},
- { "Maori", 0x481},
- { "Marathi", 0x44e},
- { "Mongolian (Cyrillic)", 0x450},
- { "Mongolian (Mongolian)", 0x850},
- { "Nepali", 0x461},
- { "Nepali (India)", 0x861},
- { "Norwegian (Bokmal)", 0x414},
- { "Norwegian (Nynorsk)", 0x814},
- { "Oriya", 0x448},
- { "Oromo", 0x472},
- { "Papiamentu", 0x479},
- { "Pashto", 0x463},
- { "Polish", 0x415},
- { "Portugese (Portugal)", 0x416},
- { "Portuguese (Brasil)", 0x816},
- { "Punjabi (India)", 0x446},
- { "Punjabi (Pakistan)", 0x846},
- { "Quecha (Bolivia)", 0x46b},
- { "Quecha (Ecuador)", 0x86b},
- { "Quecha (Peru)", 0xc6b},
- { "Rhaeto-Romanic", 0x417},
- { "Romanian", 0x418},
- { "Romanian (Moldova)", 0x818},
- { "Russian", 0x419},
- { "Russian (Moldova)", 0x819},
- { "Sami (Lappish)", 0x43b},
- { "Sanskrit", 0x43b},
- { "Sepedi", 0x46c},
- { "Serbian (Cyrillic)", 0xc1a},
- { "Serbian (Latin)", 0x81a},
- { "Sindhi India", 0x459},
- { "Sindhi Pakistan", 0x859},
- { "Sinhalese", 0x45b},
- { "Slovak", 0x41b},
- { "Slovenian", 0x424},
- { "Sorbian", 0x42e},
- { "Spanish (Traditional)", 0x40a},
- { "Spanish Mexico", 0x80a},
- { "Spanish (Modern)", 0xc0a},
- { "Spanish (Guatemala)", 0x100a},
- { "Spanish (Costa Rica)", 0x140a},
- { "Spanish (Panama)", 0x180a},
- { "Spanish (Dominican Republic)", 0x1c0a},
- { "Spanish (Venezuela)", 0x200a},
- { "Spanish (Colombia)", 0x240a},
- { "Spanish (Peru)", 0x280a},
- { "Spanish (Argentina)", 0x2c0a},
- { "Spanish (Ecuador)", 0x300a},
- { "Spanish (Chile)", 0x340a},
- { "Spanish (Uruguay)", 0x380a},
- { "Spanish (Paraguay)", 0x3c0a},
- { "Spanish (Bolivia)", 0x400a},
- { "Spanish (El Salvador)", 0x440a},
- { "Spanish (Honduras)", 0x480a},
- { "Spanish (Nicaragua)", 0x4c0a},
- { "Spanish (Puerto Rico)", 0x500a},
- { "Spanish (United States)", 0x540a},
- { "Spanish (Latin America)", 0xe40a},
- { "Sutu", 0x430},
- { "Swahili (Kenyan)", 0x441},
- { "Swedish (Sweden)", 0x41d},
- { "Swedish (Finland)", 0x81d},
- { "Syriac", 0x45a},
- { "Tagalog", 0x464},
- { "Tajik", 0x428},
- { "Tamazight (Arabic)", 0x45f},
- { "Tamazight (Latin)", 0x85f},
- { "Tamil", 0x449},
- { "Tatar (Tatarstan)", 0x444},
- { "Telugu", 0x44a},
- { "Thai", 0x41e},
- { "Tibetan (PRC)", 0x451},
- { "Tibetan Bhutan", 0x851},
- { "Tigrinya Ethiopia", 0x473},
- { "Tigrinyan Eritrea", 0x873},
- { "Tsonga", 0x431},
- { "Tswana", 0x432},
- { "Turkish", 0x41f},
- { "Turkmen", 0x442},
- { "Uighur", 0x480},
- { "Ukrainian", 0x422},
- { "Urdu (Pakistan)", 0x420},
- { "Urdu (India)", 0x820},
- { "Uzbek (Latin)", 0x443},
- { "Uzbek (Cyrillic)", 0x843},
- { "Venda", 0x433},
- { "Vietnamese", 0x42a},
- { "Welsh", 0x452},
- { "Xhosa", 0x434},
- { "Yi", 0x478},
- { "Yiddish", 0x43d},
- { "Yoruba", 0x46a},
- { "Zulu", 0x435},
- { NULL, 0 }};
-
-const char *NOUI_TTFNameIds(int id) {
- int i;
-
- for ( i=0; sfnt_name_str_ids[i].name!=NULL; ++i )
- if ( sfnt_name_str_ids[i].flag == id )
-return( (char *) sfnt_name_str_ids[i].name );
-
-return( "Unknown" );
-}
-
-const char *NOUI_MSLangString(int language) {
- int i;
-
- for ( i=0; sfnt_name_mslangs[i].name!=NULL; ++i )
- if ( sfnt_name_mslangs[i].flag == language )
-return( (char *) sfnt_name_mslangs[i].name );
-
- language &= 0xff;
- for ( i=0; sfnt_name_mslangs[i].name!=NULL; ++i )
- if ( sfnt_name_mslangs[i].flag == language )
-return( (char *) sfnt_name_mslangs[i].name );
-
-return( "Unknown" );
-}
diff --git a/Build/source/texk/web2c/luatexdir/luafontloader/fontforge/fontforge/scripting.h b/Build/source/texk/web2c/luatexdir/luafontloader/fontforge/fontforge/scripting.h
deleted file mode 100644
index f24eecca9be..00000000000
--- a/Build/source/texk/web2c/luatexdir/luafontloader/fontforge/fontforge/scripting.h
+++ /dev/null
@@ -1,140 +0,0 @@
-/* Copyright (C) 2005-2008 by George Williams */
-/*
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are met:
-
- * Redistributions of source code must retain the above copyright notice, this
- * list of conditions and the following disclaimer.
-
- * Redistributions in binary form must reproduce the above copyright notice,
- * this list of conditions and the following disclaimer in the documentation
- * and/or other materials provided with the distribution.
-
- * The name of the author may not be used to endorse or promote products
- * derived from this software without specific prior written permission.
-
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
- * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
- * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
- * EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
- * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
- * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
- * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
- * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#ifndef _SCRIPTING_H
-#define _SCRIPTING_H
-
-#include "fontforgevw.h"
-#include <setjmp.h>
-#include <stdarg.h>
-
-/* If users want to write user defined scripting built-in functions they will */
-/* need this file. The most relevant structure is the Context */
-
-struct dictentry {
- char *name;
- Val val;
-};
-
-struct dictionary {
- struct dictentry *entries;
- int cnt, max;
-};
-
-typedef struct array {
- int argc;
- Val *vals;
-} Array;
-
-#define TOK_MAX 256
-enum token_type { tt_name, tt_string, tt_number, tt_unicode, tt_real,
- tt_lparen, tt_rparen, tt_comma, tt_eos, /* eos is end of statement, semicolon, newline */
- tt_lbracket, tt_rbracket,
- tt_minus, tt_plus, tt_not, tt_bitnot, tt_colon,
- tt_mul, tt_div, tt_mod, tt_and, tt_or, tt_bitand, tt_bitor, tt_xor,
- tt_eq, tt_ne, tt_gt, tt_lt, tt_ge, tt_le,
- tt_assign, tt_pluseq, tt_minuseq, tt_muleq, tt_diveq, tt_modeq,
- tt_incr, tt_decr,
-
- tt_if, tt_else, tt_elseif, tt_endif, tt_while, tt_foreach, tt_endloop,
- tt_shift, tt_return, tt_break,
-
- tt_eof,
-
- tt_error = -1
-};
-
-typedef struct context {
- struct context *caller; /* The context of the script that called us */
- Array a; /* The argument array */
- Array **dontfree; /* Irrelevant for user defined funcs */
- struct dictionary locals; /* Irrelevant for user defined funcs */
- FILE *script; /* Irrelevant for user defined funcs */
- unsigned int backedup: 1; /* Irrelevant for user defined funcs */
- unsigned int donteval: 1; /* Irrelevant for user defined funcs */
- unsigned int returned: 1; /* Irrelevant for user defined funcs */
- unsigned int broken: 1; /* Irrelevant for user defined funcs */
- char tok_text[TOK_MAX+1]; /* Irrelevant for user defined funcs */
- enum token_type tok; /* Irrelevant for user defined funcs */
- Val tok_val; /* Irrelevant for user defined funcs */
- Val return_val; /* Initialized to void. If user wants */
- /* return something set the return */
- /* value here */
- Val trace; /* Irrelevant for user defined funcs */
- Val argsval; /* Irrelevant for user defined funcs */
- char *filename; /* Irrelevant for user defined funcs */
- int lineno; /* Irrelevant for user defined funcs */
- int ungotch; /* Irrelevant for user defined funcs */
- FontViewBase *curfv; /* Current fontview */
- jmp_buf *err_env; /* place to longjump to on an error */
-} Context;
-
-void arrayfree(Array *);
-
-void FontImage(SplineFont *sf,char *filename,Array *arr,int width,int height);
-
- /* Adds a user defined scripting function to the interpretter */
- /* (you can't override a built-in name) */
- /* (you can replace a previous user defined function */
- /* Most functions will require a font to be loaded, but a few do not */
- /* Open(), Exit(), Sin() don't. ff uses the needs_font flag to perform */
- /* this check for you */
- /* Returns 1 if the addition was successful, 2 if it replaced a previous func */
- /* Returns 0 on failure (ie. if it attempts to replace a builtin function) */
-typedef void (*UserDefScriptFunc)(Context *);
-extern int AddScriptingCommand(char *name,UserDefScriptFunc func,int needs_font);
-
- /* Returns whether a user defined scripting command already exists with the */
- /* given name */
-extern UserDefScriptFunc HasUserScriptingCommand(char *name);
-
- /* Scripts used to be in latin1, and we still support that if the user sets */
- /* an environment variable. Now scripts are by default utf8. These two funcs */
- /* will interconvert between latin1 & utf8 if appropriate, or just make a */
- /* utf8 copy if not. They always make a copy. */
-extern char *utf82script_copy(const char *ustr);
-extern char *script2utf8_copy(const char *str);
-
- /* Various error routines. */
-void ScriptError( Context *c, const char *msg );
- /* Prints an error message and exits. msg is in the script's encoding */
-void ScriptErrorString( Context *c, const char *msg, const char *name);
- /* Prints an error message followed by a string and exits. */
- /* both strings are in the script's encoding */
-void ScriptErrorF( Context *c, const char *fmt, ... );
- /* Standard printf-style spec. All string arguments assumed to be in */
- /* utf8 */
-
-extern int running_script;
-
-/* Hooks so a scripting dlg can execute fontforge's legacy scripting language */
-extern void ff_VerboseCheck(void);
-extern enum token_type ff_NextToken(Context *c);
-extern void ff_backuptok(Context *c);
-extern void ff_statement(Context*);
-
-#endif /* _SCRIPTING_H */
diff --git a/Build/source/texk/web2c/luatexdir/luafontloader/fontforge/fontforge/sd.h b/Build/source/texk/web2c/luatexdir/luafontloader/fontforge/fontforge/sd.h
deleted file mode 100644
index ab365789148..00000000000
--- a/Build/source/texk/web2c/luatexdir/luafontloader/fontforge/fontforge/sd.h
+++ /dev/null
@@ -1,163 +0,0 @@
-/* Copyright (C) 2000-2008 by George Williams */
-/*
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are met:
-
- * Redistributions of source code must retain the above copyright notice, this
- * list of conditions and the following disclaimer.
-
- * Redistributions in binary form must reproduce the above copyright notice,
- * this list of conditions and the following disclaimer in the documentation
- * and/or other materials provided with the distribution.
-
- * The name of the author may not be used to endorse or promote products
- * derived from this software without specific prior written permission.
-
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
- * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
- * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
- * EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
- * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
- * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
- * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
- * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-#ifndef _SD_H
-#define _SD_H
-# include <gimage.h>
-
-/* All coordinates are in millimeters */
-/* they will be displayed to the user scaled by the units field of the design */
-
-#include "splinefont.h"
-
-struct epattern {
- struct entity *tile;
- real width, height;
- DBounds bbox;
- real transform[6];
-};
-
-typedef struct entpen {
- Color col;
- struct gradient *grad;
- struct epattern *tile;
- float scale;
- float opacity;
-} Pen;
-
-typedef struct textunit {
- unichar_t *text;
- SplineFont *sf;
- float size; /* in points */
- float kernafter;
- Pen fill;
- struct textunit *next;
-} TextUnit;
-
-typedef struct entity {
- enum entity_type { et_splines, et_text, et_image, et_group } type;
- union {
- struct filledsplines {
- SplineSet *splines;
- unsigned int isfillable: 1; /* All splinesets are closed */
- Pen fill, stroke; /* A value of 0xffffffff means do not fill or stroke */
- float stroke_width;
- enum linejoin join;
- enum linecap cap;
- real transform[6]; /* The stroke may be quite different depending on the transformation (ie. ellipse not circle, rotated, etc) */
- } splines;
- struct text {
- TextUnit *text;
- real transform[6];
- struct entity *bound;
- } text;
- struct image {
- GImage *image;
- real transform[6];
- Color col; /* that gets poured into imagemasks */
- } image;
- struct group {
- struct entity *group;
- } group;
- } u;
- SplineSet *clippath;
- DBounds bb;
- struct entity *next;
-} Entity;
-
-typedef struct entlayer {
- Entity *entities;
- char *name;
- unsigned int isvisible: 1;
-} EntLayer;
-
-typedef struct tile {
- Entity *tile;
- struct tileinstance { real scale; struct gwindow *pixmap; struct tileinstance *next; }
- *instances;
- char *name;
-} Tile;
-
-typedef struct splinedesign {
- int lcnt, lmax, active;
- EntLayer *layers;
-
- real width, height; /* in millimeters */
- int16 hpages, vpages;
- real pwidth, pheight; /* in millimeters */
- real units; /* if user wants to see things in */
- /* centimeters then units will be 10, if inches then 25.4, if points */
- /* then 25.4/72, if 1/1200" then 25.4/1200, etc. */
- struct dview *dvs;
-} SplineDesign, Design;
-
-extern Entity *EntityInterpretPS(FILE *ps,int *width);
-extern Entity *EntityInterpretSVG(char *filename,char *memory, int memlen, int em_size,int ascent);
-extern Entity *EntityInterpretPDFPage(FILE *pdf,int select_page);
-extern SplinePointList *SplinesFromEntities(Entity *ent,int *flags,int is_stroked);
-extern void SCAppendEntityLayers(SplineChar *sc, Entity *ent);
-
- /* Used for type3 fonts briefly */
-/* This is not a "real" structure. It is a temporary hack that encompasses */
-/* various possibilities, the combination of which won't occur in reality */
-typedef struct entitychar {
- Entity *splines;
- RefChar *refs;
- int width, vwidth;
- SplineChar *sc;
- uint8 fromtype3;
-} EntityChar;
-
-struct pskeydict {
- int16 cnt, max;
- uint8 is_executable;
- struct pskeyval *entries;
-};
-
-struct psstack {
- enum pstype { ps_void, ps_num, ps_bool, ps_string, ps_instr, ps_lit,
- ps_mark, ps_array, ps_dict } type;
- union vals {
- real val;
- int tf;
- char *str;
- struct pskeydict dict; /* and for arrays too */
- } u;
-};
-
-struct pskeyval {
- enum pstype type;
- union vals u;
- char *key;
-};
-
-typedef struct retstack {
- int max;
- int cnt;
- real *stack;
-} RetStack;
-
-#endif
diff --git a/Build/source/texk/web2c/luatexdir/luafontloader/fontforge/fontforge/sfd1.c b/Build/source/texk/web2c/luatexdir/luafontloader/fontforge/fontforge/sfd1.c
deleted file mode 100644
index 0cbfbaf1d0a..00000000000
--- a/Build/source/texk/web2c/luatexdir/luafontloader/fontforge/fontforge/sfd1.c
+++ /dev/null
@@ -1,48 +0,0 @@
-/* Copyright (C) 2000-2008 by George Williams */
-/*
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are met:
-
- * Redistributions of source code must retain the above copyright notice, this
- * list of conditions and the following disclaimer.
-
- * Redistributions in binary form must reproduce the above copyright notice,
- * this list of conditions and the following disclaimer in the documentation
- * and/or other materials provided with the distribution.
-
- * The name of the author may not be used to endorse or promote products
- * derived from this software without specific prior written permission.
-
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
- * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
- * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
- * EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
- * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
- * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
- * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
- * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include "pfaedit.h"
-#include "sfd1.h"
-#include <string.h>
-
-
-enum uni_interp interp_from_encoding(Encoding *enc,enum uni_interp interp) {
-
- if ( enc==NULL )
-return( interp );
-
- if ( enc->is_japanese )
- interp = ui_japanese;
- else if ( enc->is_korean )
- interp = ui_korean;
- else if ( enc->is_tradchinese )
- interp = ui_trad_chinese;
- else if ( enc->is_simplechinese )
- interp = ui_simp_chinese;
-return( interp );
-}
-
diff --git a/Build/source/texk/web2c/luatexdir/luafontloader/fontforge/fontforge/sfd1.h b/Build/source/texk/web2c/luatexdir/luafontloader/fontforge/fontforge/sfd1.h
deleted file mode 100644
index ecb62e8b66a..00000000000
--- a/Build/source/texk/web2c/luatexdir/luafontloader/fontforge/fontforge/sfd1.h
+++ /dev/null
@@ -1,105 +0,0 @@
-/* Copyright (C) 2000-2008 by George Williams */
-/*
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are met:
-
- * Redistributions of source code must retain the above copyright notice, this
- * list of conditions and the following disclaimer.
-
- * Redistributions in binary form must reproduce the above copyright notice,
- * this list of conditions and the following disclaimer in the documentation
- * and/or other materials provided with the distribution.
-
- * The name of the author may not be used to endorse or promote products
- * derived from this software without specific prior written permission.
-
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
- * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
- * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
- * EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
- * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
- * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
- * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
- * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-#ifndef _SFD1_H
-#define _SFD1_H
-/* This file contains the data structures needed to read in an old sfd file */
-/* features and lookups and scripts are handled differently. That means that */
-/* the KernPair, KernClass, PST, FPST, AnchorClass, StateMachine data structures */
-/* are organized differently. Also we've got a script language list which */
-/* doesn't exist in the new format and we don't have OTLookup */
-
-#include "splinefont.h"
-
-#define SLI_UNKNOWN 0xffff
-#define SLI_NESTED 0xfffe
-
-typedef struct anchorclass1 {
- AnchorClass ac;
- uint32 feature_tag;
- uint16 script_lang_index;
- uint16 flags;
- uint16 merge_with;
- uint8 has_bases;
- uint8 has_ligatures;
-} AnchorClass1;
-
-typedef struct kernpair1 {
- KernPair kp;
- uint16 sli, flags;
-} KernPair1;
-
-typedef struct kernclass1 {
- KernClass kc;
- uint16 sli;
- uint16 flags;
-} KernClass1;
-
-typedef struct generic_pst1 {
- PST pst;
- uint16 flags;
- uint16 script_lang_index; /* 0xffff means none */
- uint32 tag;
-} PST1;
-
-typedef struct generic_fpst1 {
- FPST fpst;
- uint16 script_lang_index;
- uint16 flags;
- uint32 tag;
-} FPST1;
-
-typedef struct splinefont1 {
- SplineFont sf;
-
- struct table_ordering { uint32 table_tag; uint32 *ordered_features; struct table_ordering *next; } *orders;
-
- /* Any GPOS/GSUB entry (PST, AnchorClass, kerns, FPST */
- /* Has an entry saying what scripts/languages it should appear it */
- /* Things like fractions will appear in almost all possible script/lang */
- /* combinations, while alphabetic ligatures will only live in one script */
- /* Rather than store the complete list of possibilities in each PST we */
- /* store all choices used here, and just store an index into this list */
- /* in the PST. All lists are terminated by a 0 entry */
- struct script_record {
- uint32 script;
- uint32 *langs;
- } **script_lang;
- int16 sli_cnt;
-
- struct gentagtype {
- uint16 tt_cur, tt_max;
- struct tagtype {
- enum possub_type type;
- uint32 tag;
- } *tagtype;
- } gentags;
-} SplineFont1;
-
-extern int SFFindBiggestScriptLangIndex(SplineFont *_sf,uint32 script,uint32 lang);
-extern int SFAddScriptIndex(SplineFont1 *sf,uint32 *scripts,int scnt);
-extern void SFD_AssignLookups(SplineFont1 *sf);
-#endif /* _SFD1_H */
diff --git a/Build/source/texk/web2c/luatexdir/luafontloader/fontforge/fontforge/splinechar.c b/Build/source/texk/web2c/luatexdir/luafontloader/fontforge/fontforge/splinechar.c
deleted file mode 100644
index b123de4827d..00000000000
--- a/Build/source/texk/web2c/luatexdir/luafontloader/fontforge/fontforge/splinechar.c
+++ /dev/null
@@ -1,246 +0,0 @@
-/* Copyright (C) 2000-2008 by George Williams */
-/*
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are met:
-
- * Redistributions of source code must retain the above copyright notice, this
- * list of conditions and the following disclaimer.
-
- * Redistributions in binary form must reproduce the above copyright notice,
- * this list of conditions and the following disclaimer in the documentation
- * and/or other materials provided with the distribution.
-
- * The name of the author may not be used to endorse or promote products
- * derived from this software without specific prior written permission.
-
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
- * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
- * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
- * EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
- * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
- * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
- * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
- * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include "fontforgevw.h"
-#include <math.h>
-#include <locale.h>
-# include <ustring.h>
-# include <utype.h>
-#ifdef HAVE_IEEEFP_H
-# include <ieeefp.h> /* Solaris defines isnan in ieeefp rather than math.h */
-#endif
-#include "ttf.h"
-
-int adjustwidth = true;
-int adjustlbearing = true;
-int allow_utf8_glyphnames = false;
-int clear_tt_instructions_when_needed = true;
-
-void SCClearRounds(SplineChar *sc,int layer) {
- SplineSet *ss;
- SplinePoint *sp;
-
- for ( ss=sc->layers[layer].splines; ss!=NULL; ss=ss->next ) {
- for ( sp=ss->first; ; ) {
- sp->roundx = sp->roundy = false;
- if ( sp->next==NULL )
- break;
- sp = sp->next->to;
- if ( sp==ss->first )
- break;
- }
- }
-}
-
-
-void SCClearLayer(SplineChar *sc,int layer) {
- RefChar *refs, *next;
-
- SplinePointListsFree(sc->layers[layer].splines);
- sc->layers[layer].splines = NULL;
- for ( refs=sc->layers[layer].refs; refs!=NULL; refs = next ) {
- next = refs->next;
- SCRemoveDependent(sc,refs,layer);
- }
- sc->layers[layer].refs = NULL;
- ImageListsFree(sc->layers[layer].images);
- sc->layers[layer].images = NULL;
-}
-
-void SCClearContents(SplineChar *sc,int layer) {
- int ly_first, ly_last;
-
- if ( sc==NULL )
-return;
- if ( sc->parent!=NULL && sc->parent->multilayer ) {
- ly_first = ly_fore;
- ly_last = sc->layer_cnt-1;
- } else
- ly_first = ly_last = layer;
- for ( layer = ly_first; layer<=ly_last; ++layer )
- SCClearLayer(sc,layer);
- --layer;
-
- if ( sc->parent!=NULL &&
- (sc->parent->multilayer ||
- (!sc->parent->layers[layer].background && SCWasEmpty(sc,layer)))) {
- sc->widthset = false;
- if ( sc->parent!=NULL && sc->width!=0 )
- sc->width = sc->parent->ascent+sc->parent->descent;
- AnchorPointsFree(sc->anchor);
- sc->anchor = NULL;
- StemInfosFree(sc->hstem); sc->hstem = NULL;
- StemInfosFree(sc->vstem); sc->vstem = NULL;
- DStemInfosFree(sc->dstem); sc->dstem = NULL;
- MinimumDistancesFree(sc->md); sc->md = NULL;
- free(sc->ttf_instrs);
- sc->ttf_instrs = NULL;
- sc->ttf_instrs_len = 0;
- SCOutOfDateBackground(sc);
- }
-}
-
-
-void SplinePointRound(SplinePoint *sp,real factor) {
-
- sp->nextcp.x = rint(sp->nextcp.x*factor)/factor;
- sp->nextcp.y = rint(sp->nextcp.y*factor)/factor;
- if ( sp->next!=NULL && sp->next->order2 )
- sp->next->to->prevcp = sp->nextcp;
- sp->prevcp.x = rint(sp->prevcp.x*factor)/factor;
- sp->prevcp.y = rint(sp->prevcp.y*factor)/factor;
- if ( sp->prev!=NULL && sp->prev->order2 )
- sp->prev->from->nextcp = sp->prevcp;
- if ( sp->prev!=NULL && sp->next!=NULL && sp->next->order2 &&
- sp->ttfindex == 0xffff ) {
- sp->me.x = (sp->nextcp.x + sp->prevcp.x)/2;
- sp->me.y = (sp->nextcp.y + sp->prevcp.y)/2;
- } else {
- sp->me.x = rint(sp->me.x*factor)/factor;
- sp->me.y = rint(sp->me.y*factor)/factor;
- }
-}
-
-void SplineSetsRound2Int(SplineSet *spl,real factor, int inspiro, int onlysel) {
- SplinePoint *sp;
-
- for ( ; spl!=NULL; spl=spl->next ) {
- if ( inspiro ) {
- } else {
- for ( sp=spl->first; ; ) {
- if ( sp->selected || !onlysel )
- SplinePointRound(sp,factor);
- if ( sp->prev!=NULL )
- SplineRefigure(sp->prev);
- if ( sp->next==NULL )
- break;
- sp = sp->next->to;
- if ( sp==spl->first )
- break;
- }
- if ( spl->first->prev!=NULL )
- SplineRefigure(spl->first->prev);
- }
- }
-}
-
-void SCOrderAP(SplineChar *sc) {
- int lc=0, cnt=0, out=false, i,j;
- AnchorPoint *ap, **array;
- /* Order so that first ligature index comes first */
-
- for ( ap=sc->anchor; ap!=NULL; ap=ap->next ) {
- if ( ap->lig_index<lc ) out = true;
- if ( ap->lig_index>lc ) lc = ap->lig_index;
- ++cnt;
- }
- if ( !out )
-return;
-
- array = galloc(cnt*sizeof(AnchorPoint *));
- for ( i=0, ap=sc->anchor; ap!=NULL; ++i, ap=ap->next )
- array[i] = ap;
- for ( i=0; i<cnt-1; ++i ) {
- for ( j=i+1; j<cnt; ++j ) {
- if ( array[i]->lig_index>array[j]->lig_index ) {
- ap = array[i];
- array[i] = array[j];
- array[j] = ap;
- }
- }
- }
- sc->anchor = array[0];
- for ( i=0; i<cnt-1; ++i )
- array[i]->next = array[i+1];
- array[cnt-1]->next = NULL;
- free( array );
-}
-
-
-static void SCUpdateNothing(SplineChar *sc) {
-}
-
-static void SCHintsChng(SplineChar *sc) {
- sc->changedsincelasthinted = false;
- if ( !sc->changed ) {
- sc->changed = true;
- sc->parent->changed = true;
- }
-}
-
-static void _SCChngNoUpdate(SplineChar *sc,int layer,int changed) {
-}
-
-static void SCChngNoUpdate(SplineChar *sc,int layer) {
- _SCChngNoUpdate(sc,layer,true);
-}
-
-static void SCB_MoreLayers(SplineChar *sc,Layer *old) {
-}
-
-static struct sc_interface noui_sc = {
- SCUpdateNothing,
- SCUpdateNothing,
- SCUpdateNothing,
- SCHintsChng,
- SCChngNoUpdate,
- _SCChngNoUpdate,
- SCUpdateNothing,
- SCUpdateNothing,
- SCB_MoreLayers
-};
-
-struct sc_interface *sc_interface = &noui_sc;
-
-void FF_SetSCInterface(struct sc_interface *sci) {
- sc_interface = sci;
-}
-
-static void CVChngNoUpdate(CharViewBase *cv) {
-}
-
-static void _CVChngNoUpdate(CharViewBase *cv,int changed) {
-}
-
-static void CVGlphRenameFixup(SplineFont *sf,char *oldname, char *newname) {
-}
-
-static void CV__LayerPaletteCheck(SplineFont *sf) {
-}
-
-static struct cv_interface noui_cv = {
- CVChngNoUpdate,
- _CVChngNoUpdate,
- CVGlphRenameFixup,
- CV__LayerPaletteCheck
-};
-
-struct cv_interface *cv_interface = &noui_cv;
-
-void FF_SetCVInterface(struct cv_interface *cvi) {
- cv_interface = cvi;
-}
diff --git a/Build/source/texk/web2c/luatexdir/luafontloader/fontforge/fontforge/splinefill.c b/Build/source/texk/web2c/luatexdir/luafontloader/fontforge/fontforge/splinefill.c
deleted file mode 100644
index b9e52fb9fbd..00000000000
--- a/Build/source/texk/web2c/luatexdir/luafontloader/fontforge/fontforge/splinefill.c
+++ /dev/null
@@ -1,532 +0,0 @@
-/* Copyright (C) 2000-2008 by George Williams */
-/*
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are met:
-
- * Redistributions of source code must retain the above copyright notice, this
- * list of conditions and the following disclaimer.
-
- * Redistributions in binary form must reproduce the above copyright notice,
- * this list of conditions and the following disclaimer in the documentation
- * and/or other materials provided with the distribution.
-
- * The name of the author may not be used to endorse or promote products
- * derived from this software without specific prior written permission.
-
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
- * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
- * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
- * EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
- * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
- * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
- * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
- * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-#include "pfaedit.h"
-#include <stdio.h>
-#include <string.h>
-#include <ustring.h>
-#include <math.h>
-#include "splinefont.h"
-#include "edgelist.h"
-
-static void HintsFree(Hints *h) {
- Hints *hnext;
- for ( ; h!=NULL; h = hnext ) {
- hnext = h->next;
- free(h);
- }
-}
-
-static void _FreeEdgeList(EdgeList *es) {
- int i;
-
- /* edges will be NULL if the user tries to make an enormous bitmap */
- /* if the linear size is bigger than several thousand, we just */
- /* ignore the request */
- if ( es->edges!=NULL ) {
- for ( i=0; i<es->cnt; ++i ) {
- Edge *e, *next;
- for ( e = es->edges[i]; e!=NULL; e = next ) {
- next = e->esnext;
- free(e);
- }
- es->edges[i] = NULL;
- }
- }
-}
-
-void FreeEdges(EdgeList *es) {
- _FreeEdgeList(es);
- free(es->edges);
- free(es->interesting);
- HintsFree(es->hhints);
- HintsFree(es->vhints);
-}
-
-extended IterateSplineSolve(const Spline1D *sp, extended tmin, extended tmax,
- extended sought,double err) {
- extended t, low, high, test;
- Spline1D temp;
- int cnt;
-
- /* Now the closed form CubicSolver can have rounding errors so if we know */
- /* the spline to be monotonic, an iterative approach is more accurate */
-
- temp = *sp;
- temp.d -= sought;
-
- if ( temp.a==0 && temp.b==0 && temp.c!=0 ) {
- t = -temp.d/(extended) temp.c;
- if ( t<0 || t>1 )
-return( -1 );
-return( t );
- }
-
- low = ((temp.a*tmin+temp.b)*tmin+temp.c)*tmin+temp.d;
- high = ((temp.a*tmax+temp.b)*tmax+temp.c)*tmax+temp.d;
- if ( low<err && low>-err )
-return(tmin);
- if ( high<err && high>-err )
-return(tmax);
- if (( low<0 && high>0 ) ||
- ( low>0 && high<0 )) {
-
- for ( cnt=0; cnt<1000; ++cnt ) { /* Avoid impossible error limits */
- t = (tmax+tmin)/2;
- test = ((temp.a*t+temp.b)*t+temp.c)*t+temp.d;
- if ( test>-err && test<err )
-return( t );
- if ( (low<0 && test<0) || (low>0 && test>0) )
- tmin=t;
- else
- tmax = t;
- }
-return( (tmax+tmin)/2 );
- }
-return( -1 );
-}
-
-double TOfNextMajor(Edge *e, EdgeList *es, double sought_m ) {
- /* We want to find t so that Mspline(t) = sought_m */
- /* the curve is monotonic */
- Spline1D *msp = &e->spline->splines[es->major];
- double new_t;
-
- if ( es->is_overlap ) {
-
- /* if we've adjusted the height then we won't be able to find it restricting */
- /* t between [0,1] as we do. So it's a special case. (this is to handle */
- /* hstem hints) */
- if ( e->max_adjusted && sought_m==e->mmax ) {
- e->m_cur = sought_m;
-return( e->up?1.0:0.0 );
- }
-
- new_t = IterateSplineSolve(msp,e->t_mmin,e->t_mmax,(sought_m+es->mmin)/es->scale,.001);
- if ( new_t==-1 )
- IError( "No Solution");
- e->m_cur = (((msp->a*new_t + msp->b)*new_t+msp->c)*new_t + msp->d)*es->scale - es->mmin;
-return( new_t );
- } else {
- Spline *sp = e->spline;
-
- if ( sp->islinear ) {
- new_t = e->t_cur + (sought_m-e->m_cur)/(es->scale * msp->c);
- e->m_cur = (msp->c*new_t + msp->d)*es->scale - es->mmin;
-return( new_t );
- }
- /* if we have a spline that is nearly horizontal at its max. endpoint */
- /* then finding A value of t for which y has the right value isn't good */
- /* enough (at least not when finding intersections) */
- if ( sought_m+1>e->mmax ) {
- e->m_cur = e->mmax;
-return( e->t_mmax );
- }
-
- /* if we've adjusted the height then we won't be able to find it restricting */
- /* t between [0,1] as we do. So it's a special case. (this is to handle */
- /* hstem hints) */
- if ( e->max_adjusted && sought_m==e->mmax ) {
- e->m_cur = sought_m;
-return( e->up?1.0:0.0 );
- }
- new_t = IterateSplineSolve(msp,e->t_mmin,e->t_mmax,(sought_m+es->mmin)/es->scale,.001);
- if ( new_t==-1 )
- IError( "No Solution");
- e->m_cur = (((msp->a*new_t + msp->b)*new_t+msp->c)*new_t + msp->d)*es->scale - es->mmin;
-return( new_t );
- }
-}
-
-static int SlopeLess(Edge *e, Edge *p, int other) {
- Spline1D *osp = &e->spline->splines[other];
- Spline1D *psp = &p->spline->splines[other];
- Spline1D *msp = &e->spline->splines[!other];
- Spline1D *qsp = &p->spline->splines[!other];
- real os = (3*osp->a*e->t_cur+2*osp->b)*e->t_cur+osp->c,
- ps = (3*psp->a*p->t_cur+2*psp->b)*p->t_cur+psp->c;
- real ms = (3*msp->a*e->t_cur+2*msp->b)*e->t_cur+msp->c,
- qs = (3*qsp->a*p->t_cur+2*qsp->b)*p->t_cur+qsp->c;
- if ( ms<.0001 && ms>-.0001 ) ms = 0;
- if ( qs<.0001 && qs>-.0001 ) qs = 0;
- if ( qs==0 ) {
- if ( p->t_cur==1 ) {
- qs = (3*qsp->a*.9999+2*qsp->b)*.9999+qsp->c;
- ps = (3*psp->a*.9999+2*psp->b)*.9999+psp->c;
- } else {
- qs = (3*qsp->a*(p->t_cur+.0001)+2*qsp->b)*(p->t_cur+.0001)+qsp->c;
- ps = (3*psp->a*(p->t_cur+.0001)+2*psp->b)*(p->t_cur+.0001)+psp->c;
- }
- }
- if ( ms==0 ) {
- if ( e->t_cur==1 ) {
- ms = (3*msp->a*.9999+2*msp->b)*.9999+msp->c;
- os = (3*osp->a*.9999+2*osp->b)*.9999+osp->c;
- } else {
- ms = (3*msp->a*(e->t_cur+.0001)+2*msp->b)*(e->t_cur+.0001)+msp->c;
- os = (3*osp->a*(e->t_cur+.0001)+2*osp->b)*(e->t_cur+.0001)+osp->c;
- }
- }
- if ( e->t_cur-e->tmin > e->tmax-e->t_cur ) { os = -os; ms = -ms; }
- if ( p->t_cur-p->tmin > p->tmax-p->t_cur ) { ps = -ps; qs = -qs; }
- if ( ms!=0 && qs!=0 ) { os /= ms; ps /= qs; }
- else if ( ms==0 && qs==0 ) /* Do Nothing */;
- else if ( (ms==0 && os>0) || (qs==0 && ps<0) ) /* Does this make sense? */
-return( false );
- else if ( (ms==0 && os<0) || (qs==0 && ps>0) ) /* Does this make sense? */
-return( true );
-
- if ( os==ps || ms==0 || qs==0 )
-return( e->o_mmax<p->o_mmax );
-
-return( os<ps );
-}
-
-static void AddEdge(EdgeList *es, Spline *sp, real tmin, real tmax ) {
- Edge *e, *pr;
- real m1, m2;
- int mpos;
- Hints *hint;
- Spline1D *msp = &sp->splines[es->major], *osp = &sp->splines[es->other];
-
- e = gcalloc(1,sizeof(Edge));
- e->spline = sp;
-
- m1 = ( ((msp->a*tmin+msp->b)*tmin+msp->c)*tmin + msp->d ) * es->scale;
- m2 = ( ((msp->a*tmax+msp->b)*tmax+msp->c)*tmax + msp->d ) * es->scale;
- if ( m1>m2 ) {
- e->mmin = m2;
- e->t_mmin = tmax;
- e->mmax = m1;
- e->t_mmax = tmin;
- e->up = false;
- } else {
- e->mmax = m2;
- e->t_mmax = tmax;
- e->mmin = m1;
- e->t_mmin = tmin;
- e->up = true;
- }
- if ( RealNear(e->mmin,es->mmin)) e->mmin = es->mmin;
- e->o_mmin = ( ((osp->a*e->t_mmin+osp->b)*e->t_mmin+osp->c)*e->t_mmin + osp->d ) * es->scale;
- e->o_mmax = ( ((osp->a*e->t_mmax+osp->b)*e->t_mmax+osp->c)*e->t_mmax + osp->d ) * es->scale;
- e->mmin -= es->mmin; e->mmax -= es->mmin;
- e->t_cur = e->t_mmin;
- e->o_cur = e->o_mmin;
- e->m_cur = e->mmin;
- e->last_opos = e->last_mpos = -2;
- e->tmin = tmin; e->tmax = tmax;
-
- if ( e->mmin<0 || e->mmin>=e->mmax ) {
- /*IError("Probably not serious, but we've got a zero length spline in AddEdge in %s",es->sc==NULL?<nameless>:es->sc->name);*/
- free(e);
-return;
- }
-
- if ( es->sc!=NULL ) for ( hint=es->hhints; hint!=NULL; hint=hint->next ) {
- if ( hint->adjustb ) {
- if ( e->m_cur>hint->b1 && e->m_cur<hint->b2 ) {
- e->m_cur = e->mmin = hint->ab;
- e->min_adjusted = true;
- } else if ( e->mmax>hint->b1 && e->mmax<hint->b2 ) {
- e->mmax = hint->ab;
- e->max_adjusted = true;
- }
- } else if ( hint->adjuste ) {
- if ( e->m_cur>hint->e1 && e->m_cur<hint->e2 ) {
- e->m_cur = e->mmin = hint->ae;
- e->min_adjusted = true;
- } else if ( e->mmax>hint->e1 && e->mmax<hint->e2 ) {
- e->mmax = hint->ae;
- e->max_adjusted = true;
- }
- }
- }
-
- mpos = (int) ceil(e->m_cur);
- if ( mpos>e->mmax || mpos>=es->cnt ) {
- free(e);
-return;
- }
-
- if ( e->m_cur!=ceil(e->m_cur) ) {
- /* bring the new edge up to its first scan line */
- e->t_cur = TOfNextMajor(e,es,ceil(e->m_cur));
- e->o_cur = ( ((osp->a*e->t_cur+osp->b)*e->t_cur+osp->c)*e->t_cur + osp->d ) * es->scale;
- }
-
- e->before = es->last;
- if ( es->last!=NULL )
- es->last->after = e;
- if ( es->last==NULL )
- es->splinesetfirst = e;
- es->last = e;
-
- if ( es->edges[mpos]==NULL || e->o_cur<es->edges[mpos]->o_cur ||
- (e->o_cur==es->edges[mpos]->o_cur && SlopeLess(e,es->edges[mpos],es->other))) {
- e->esnext = es->edges[mpos];
- es->edges[mpos] = e;
- } else {
- for ( pr=es->edges[mpos]; pr->esnext!=NULL && pr->esnext->o_cur<e->o_cur ;
- pr = pr->esnext );
- /* When two splines share a vertex which is a local minimum, then */
- /* o_cur will be equal for both (to the vertex's o value) and so */
- /* the above code randomly picked one to go first. That screws up */
- /* the overlap code, which wants them properly ordered from the */
- /* start. so look at the end point, nope the end point isn't always */
- /* meaningful, look at the slope... */
- if ( pr->esnext!=NULL && pr->esnext->o_cur==e->o_cur &&
- SlopeLess(e,pr->esnext,es->other)) {
- pr = pr->esnext;
- }
- e->esnext = pr->esnext;
- pr->esnext = e;
- }
- if ( es->interesting ) {
- /* Mark the other end of the spline as interesting */
- es->interesting[(int) ceil(e->mmax)]=1;
- }
-}
-
-static void AddMajorEdge(EdgeList *es, Spline *sp) {
- Edge *e, *pr;
- real m1;
- Spline1D *msp = &sp->splines[es->major], *osp = &sp->splines[es->other];
-
- e = gcalloc(1,sizeof(Edge));
- e->spline = sp;
-
- e->mmin = e->mmax = m1 = msp->d * es->scale - es->mmin;
- e->t_mmin = 0;
- e->t_mmax = 1;
- e->up = false;
- e->o_mmin = osp->d * es->scale;
- e->o_mmax = ( osp->a + osp->b + osp->c + osp->d ) * es->scale;
- if ( e->o_mmin == e->o_mmax ) { /* Just a point? */
- free(e);
-return;
- }
- if ( e->mmin<0 )
- IError("Grg!");
-
- if ( ceil(e->m_cur)>e->mmax ) {
- free(e);
-return;
- }
-
- if ( es->majors==NULL || es->majors->mmin>=m1 ) {
- e->esnext = es->majors;
- es->majors = e;
- } else {
- for ( pr=es->majors; pr->esnext!=NULL && pr->esnext->mmin<m1; pr = pr->esnext );
- e->esnext = pr->esnext;
- pr->esnext = e;
- }
-}
-
-static void AddSpline(EdgeList *es, Spline *sp ) {
- real t1=2, t2=2, t;
- real b2_fourac;
- real fm, tm;
- Spline1D *msp = &sp->splines[es->major], *osp = &sp->splines[es->other];
-
- /* Find the points of extrema on the curve discribing y behavior */
- if ( !RealNear(msp->a,0) ) {
- /* cubic, possibly 2 extrema (possibly none) */
- b2_fourac = 4*msp->b*msp->b - 12*msp->a*msp->c;
- if ( b2_fourac>=0 ) {
- b2_fourac = sqrt(b2_fourac);
- t1 = CheckExtremaForSingleBitErrors(msp,(-2*msp->b - b2_fourac) / (6*msp->a));
- t2 = CheckExtremaForSingleBitErrors(msp,(-2*msp->b + b2_fourac) / (6*msp->a));
- if ( t1>t2 ) { real temp = t1; t1 = t2; t2 = temp; }
- else if ( t1==t2 ) t2 = 2.0;
-
- /* check for curves which have such a small slope they might */
- /* as well be horizontal */
- fm = es->major==1?sp->from->me.y:sp->from->me.x;
- tm = es->major==1?sp->to->me.y:sp->to->me.x;
- if ( fm==tm ) {
- real m1, m2, d1, d2;
- m1 = m2 = fm;
- if ( t1>0 && t1<1 )
- m1 = ((msp->a*t1+msp->b)*t1+msp->c)*t1 + msp->d;
- if ( t2>0 && t2<1 )
- m2 = ((msp->a*t2+msp->b)*t2+msp->c)*t2 + msp->d;
- d1 = (m1-fm)*es->scale;
- d2 = (m2-fm)*es->scale;
- if ( d1>-.5 && d1<.5 && d2>-.5 && d2<.5 ) {
- sp->ishorvert = true;
- if ( es->genmajoredges )
- AddMajorEdge(es,sp);
-return; /* Pretend it's horizontal, ignore it */
- }
- }
- }
- } else if ( !RealNear(msp->b,0) ) {
- /* Quadratic, at most one extremum */
- t1 = -msp->c/(2.0*msp->b);
- } else if ( !RealNear(msp->c,0) ) {
- /* linear, no points of extrema */
- } else {
- sp->ishorvert = true;
- if ( es->genmajoredges )
- AddMajorEdge(es,sp);
-return; /* Horizontal line, ignore it */
- }
-
- if ( RealNear(t1,0)) t1=0;
- if ( RealNear(t1,1)) t1=1;
- if ( RealNear(t2,0)) t2=0;
- if ( RealNear(t2,1)) t2=1;
- if ( RealNear(t1,t2)) t2=2;
- t=0;
- if ( t1>0 && t1<1 ) {
- AddEdge(es,sp,0,t1);
- t = t1;
- }
- if ( t2>0 && t2<1 ) {
- AddEdge(es,sp,t,t2);
- t = t2;
- }
- AddEdge(es,sp,t,1.0);
- if ( es->interesting ) {
- /* Also store up points of extrema in X as interesting (we got the endpoints, just internals now)*/
- extended ot1, ot2;
- int mpos;
- SplineFindExtrema(osp,&ot1,&ot2);
- if ( ot1>0 && ot1<1 ) {
- mpos = (int) ceil( ( ((msp->a*ot1+msp->b)*ot1+msp->c)*ot1+msp->d )*es->scale-es->mmin );
- es->interesting[mpos] = 1;
- }
- if ( ot2>0 && ot2<1 ) {
- mpos = (int) ceil( ( ((msp->a*ot2+msp->b)*ot2+msp->c)*ot2+msp->d )*es->scale-es->mmin );
- es->interesting[mpos] = 1;
- }
- }
-}
-
-void FindEdgesSplineSet(SplinePointList *spl, EdgeList *es, int ignore_clip) {
- Spline *spline, *first;
-
- for ( ; spl!=NULL; spl = spl->next ) {
- if ( spl->first->prev!=NULL && spl->first->prev->from!=spl->first &&
- (!ignore_clip || (ignore_clip==1 && !spl->is_clip_path) || (ignore_clip==2 && spl->is_clip_path))) {
- first = NULL;
- es->last = es->splinesetfirst = NULL;
- /* Set so there is no previous point!!! */
- for ( spline = spl->first->next; spline!=NULL && spline!=first; spline=spline->to->next ) {
- AddSpline(es,spline);
- if ( first==NULL ) first = spline;
- }
- if ( es->last!=NULL ) {
- es->splinesetfirst->before = es->last;
- es->last->after = es->splinesetfirst;
- }
- }
- }
-}
-
-Edge *ActiveEdgesInsertNew(EdgeList *es, Edge *active,int i) {
- Edge *apt, *pr, *npt;
-
- for ( pr=NULL, apt=active, npt=es->edges[(int) i]; apt!=NULL && npt!=NULL; ) {
- if ( npt->o_cur<apt->o_cur ) {
- npt->aenext = apt;
- if ( pr==NULL )
- active = npt;
- else
- pr->aenext = npt;
- pr = npt;
- npt = npt->esnext;
- } else {
- pr = apt;
- apt = apt->aenext;
- }
- }
- while ( npt!=NULL ) {
- npt->aenext = NULL;
- if ( pr==NULL )
- active = npt;
- else
- pr->aenext = npt;
- pr = npt;
- npt = npt->esnext;
- }
-return( active );
-}
-
-Edge *ActiveEdgesRefigure(EdgeList *es, Edge *active,real i) {
- Edge *apt, *pr;
- int any;
-
- /* first remove any entry which doesn't intersect the new scan line */
- /* (ie. stopped on last line) */
- for ( pr=NULL, apt=active; apt!=NULL; apt = apt->aenext ) {
- if ( apt->mmax<i ) {
- if ( pr==NULL )
- active = apt->aenext;
- else
- pr->aenext = apt->aenext;
- } else
- pr = apt;
- }
- /* then move the active list to the next line */
- for ( apt=active; apt!=NULL; apt = apt->aenext ) {
- Spline1D *osp = &apt->spline->splines[es->other];
- apt->t_cur = TOfNextMajor(apt,es,i);
- apt->o_cur = ( ((osp->a*apt->t_cur+osp->b)*apt->t_cur+osp->c)*apt->t_cur + osp->d ) * es->scale;
- }
- /* reorder list */
- if ( active!=NULL ) {
- any = true;
- while ( any ) {
- any = false;
- for ( pr=NULL, apt=active; apt->aenext!=NULL; ) {
- if ( apt->o_cur <= apt->aenext->o_cur ) {
- /* still ordered */;
- pr = apt;
- apt = apt->aenext;
- } else if ( pr==NULL ) {
- active = apt->aenext;
- apt->aenext = apt->aenext->aenext;
- active->aenext = apt;
- /* don't need to set any, since this reorder can't disorder the list */
- pr = active;
- } else {
- pr->aenext = apt->aenext;
- apt->aenext = apt->aenext->aenext;
- pr->aenext->aenext = apt;
- any = true;
- pr = pr->aenext;
- }
- }
- }
- }
- /* Insert new nodes */
- active = ActiveEdgesInsertNew(es,active,i);
-return( active );
-}
-
diff --git a/Build/source/texk/web2c/luatexdir/luafontloader/fontforge/fontforge/splinefont.c b/Build/source/texk/web2c/luatexdir/luafontloader/fontforge/fontforge/splinefont.c
deleted file mode 100644
index 84e062c013e..00000000000
--- a/Build/source/texk/web2c/luatexdir/luafontloader/fontforge/fontforge/splinefont.c
+++ /dev/null
@@ -1,655 +0,0 @@
-/* Copyright (C) 2000-2008 by George Williams */
-/*
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are met:
-
- * Redistributions of source code must retain the above copyright notice, this
- * list of conditions and the following disclaimer.
-
- * Redistributions in binary form must reproduce the above copyright notice,
- * this list of conditions and the following disclaimer in the documentation
- * and/or other materials provided with the distribution.
-
- * The name of the author may not be used to endorse or promote products
- * derived from this software without specific prior written permission.
-
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
- * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
- * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
- * EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
- * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
- * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
- * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
- * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include "fontforgevw.h"
-#include <utype.h>
-#include <ustring.h>
-#include <math.h>
-#include <unistd.h>
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <gfile.h>
-#include <time.h>
-#include "unicoderange.h"
-#include "psfont.h"
-
-#ifdef _WIN32
-#define MKDIR(A,B) mkdir(A)
-#else
-#define MKDIR(A,B) mkdir(A,B)
-#endif
-
-
-void SFUntickAll(SplineFont *sf) {
- int i;
-
- for ( i=0; i<sf->glyphcnt; ++i ) if ( sf->glyphs[i]!=NULL )
- sf->glyphs[i]->ticked = false;
-}
-
-SplineChar *SCBuildDummy(SplineChar *dummy,SplineFont *sf,EncMap *map,int i) {
- static char namebuf[100];
- static Layer layers[2];
-
- memset(dummy,'\0',sizeof(*dummy));
- dummy->color = COLOR_DEFAULT;
- dummy->layer_cnt = 2;
- dummy->layers = layers;
- if ( sf->cidmaster!=NULL ) {
- /* CID fonts don't have encodings, instead we must look up the cid */
- if ( sf->cidmaster->loading_cid_map )
- dummy->unicodeenc = -1;
- else
- dummy->unicodeenc = CID2NameUni(FindCidMap(sf->cidmaster->cidregistry,sf->cidmaster->ordering,sf->cidmaster->supplement,sf->cidmaster),
- i,namebuf,sizeof(namebuf));
- } else
- dummy->unicodeenc = UniFromEnc(i,map->enc);
-
- if ( sf->cidmaster!=NULL )
- dummy->name = namebuf;
- else if ( map->enc->psnames!=NULL && i<map->enc->char_cnt &&
- map->enc->psnames[i]!=NULL )
- dummy->name = map->enc->psnames[i];
- else if ( dummy->unicodeenc==-1 )
- dummy->name = NULL;
- else
- dummy->name = (char *) StdGlyphName(namebuf,dummy->unicodeenc,sf->uni_interp,sf->for_new_glyphs);
- if ( dummy->name==NULL ) {
- /*if ( dummy->unicodeenc!=-1 || i<256 )
- dummy->name = ".notdef";
- else*/ {
- int j;
- sprintf( namebuf, "NameMe.%d", i);
- j=0;
- while ( SFFindExistingSlot(sf,-1,namebuf)!=-1 )
- sprintf( namebuf, "NameMe.%d.%d", i, ++j);
- dummy->name = namebuf;
- }
- }
- dummy->width = dummy->vwidth = sf->ascent+sf->descent;
- if ( dummy->unicodeenc>0 && dummy->unicodeenc<0x10000 &&
- iscombining(dummy->unicodeenc)) {
- /* Mark characters should be 0 width */
- dummy->width = 0;
- /* Except in monospaced fonts on windows, where they should be the */
- /* same width as everything else */
- }
- /* Actually, in a monospace font, all glyphs should be the same width */
- /* whether mark or not */
- if ( sf->pfminfo.panose_set && sf->pfminfo.panose[3]==9 &&
- sf->glyphcnt>0 ) {
- for ( i=sf->glyphcnt-1; i>=0; --i )
- if ( SCWorthOutputting(sf->glyphs[i])) {
- dummy->width = sf->glyphs[i]->width;
- break;
- }
- }
- dummy->parent = sf;
- dummy->orig_pos = 0xffff;
-return( dummy );
-}
-
-static SplineChar *_SFMakeChar(SplineFont *sf,EncMap *map,int enc) {
- SplineChar dummy, *sc;
- SplineFont *ssf;
- int j, real_uni, gid;
- extern const int cns14pua[], amspua[];
-
- if ( enc>=map->enccount )
- gid = -1;
- else
- gid = map->map[enc];
- if ( sf->subfontcnt!=0 && gid!=-1 ) {
- ssf = NULL;
- for ( j=0; j<sf->subfontcnt; ++j )
- if ( gid<sf->subfonts[j]->glyphcnt ) {
- ssf = sf->subfonts[j];
- if ( ssf->glyphs[gid]!=NULL ) {
-return( ssf->glyphs[gid] );
- }
- }
- sf = ssf;
- }
-
- if ( gid==-1 || (sc = sf->glyphs[gid])==NULL ) {
- if (( map->enc->is_unicodebmp || map->enc->is_unicodefull ) &&
- ( enc>=0xe000 && enc<=0xf8ff ) &&
- ( sf->uni_interp==ui_ams || sf->uni_interp==ui_trad_chinese ) &&
- ( real_uni = (sf->uni_interp==ui_ams ? amspua : cns14pua)[enc-0xe000])!=0 ) {
- if ( real_uni<map->enccount ) {
- SplineChar *sc;
- /* if necessary, create the real unicode code point */
- /* and then make us be a duplicate of it */
- sc = _SFMakeChar(sf,map,real_uni);
- map->map[enc] = gid = sc->orig_pos;
- SCCharChangedUpdate(sc,ly_all);
-return( sc );
- }
- }
-
- SCBuildDummy(&dummy,sf,map,enc);
- /* Let's say a user has a postscript encoding where the glyph ".notdef" */
- /* is assigned to many slots. Once the user creates a .notdef glyph */
- /* all those slots should fill in. If they don't they damn well better*/
- /* when the user clicks on one to edit it */
- /* Used to do that with all encodings. It just confused people */
- if ( map->enc->psnames!=NULL &&
- (sc = SFGetChar(sf,dummy.unicodeenc,dummy.name))!=NULL ) {
- map->map[enc] = sc->orig_pos;
-return( sc );
- }
- sc = SFSplineCharCreate(sf);
- sc->unicodeenc = dummy.unicodeenc;
- sc->name = copy(dummy.name);
- sc->width = dummy.width;
- sc->orig_pos = 0xffff;
- /*SCLigDefault(sc);*/
- SFAddGlyphAndEncode(sf,sc,map,enc);
- }
-return( sc );
-}
-
-SplineChar *SFMakeChar(SplineFont *sf,EncMap *map, int enc) {
- int gid;
-
- if ( enc==-1 )
-return( NULL );
- if ( enc>=map->enccount )
- gid = -1;
- else
- gid = map->map[enc];
- if ( sf->mm!=NULL && (gid==-1 || sf->glyphs[gid]==NULL) ) {
- int j;
- _SFMakeChar(sf->mm->normal,map,enc);
- for ( j=0; j<sf->mm->instance_count; ++j )
- _SFMakeChar(sf->mm->instances[j],map,enc);
- }
-return( _SFMakeChar(sf,map,enc));
-}
-
-struct unicoderange specialnames[] = {
- { NULL, 0, 0, 0, 0, 0, 0 }
-};
-
-
-static SplineFont *_SFReadPostscript(FILE *file,char *filename) {
- FontDict *fd=NULL;
- SplineFont *sf=NULL;
-
- ff_progress_change_stages(2);
- fd = _ReadPSFont(file);
- ff_progress_next_stage();
- ff_progress_change_line2(_("Interpreting Glyphs"));
- if ( fd!=NULL ) {
- sf = SplineFontFromPSFont(fd);
- PSFontFree(fd);
- if ( sf!=NULL )
- CheckAfmOfPostscript(sf,filename,sf->map);
- }
-return( sf );
-}
-
-static SplineFont *SFReadPostscript(char *filename) {
- FontDict *fd=NULL;
- SplineFont *sf=NULL;
-
- ff_progress_change_stages(2);
- fd = ReadPSFont(filename);
- ff_progress_next_stage();
- ff_progress_change_line2(_("Interpreting Glyphs"));
- if ( fd!=NULL ) {
- sf = SplineFontFromPSFont(fd);
- PSFontFree(fd);
- if ( sf!=NULL )
- CheckAfmOfPostscript(sf,filename,sf->map);
- }
-return( sf );
-}
-
-
-struct compressors compressors[] = {
- { ".gz", "gunzip", "gzip" },
- { ".bz2", "bunzip2", "bzip2" },
- { ".bz", "bunzip2", "bzip2" },
- { ".Z", "gunzip", "compress" },
-/* file types which are both archived and compressed (.tgz, .zip) are handled */
-/* by the archiver above */
- { NULL, NULL, NULL }
-};
-
-char *Decompress(char *name, int compression) {
- char *dir = getenv("TMPDIR");
- char buf[1500];
- char *tmpfile;
-
- if ( dir==NULL ) dir = P_tmpdir;
- tmpfile = galloc(strlen(dir)+strlen(GFileNameTail(name))+2);
- strcpy(tmpfile,dir);
- strcat(tmpfile,"/");
- strcat(tmpfile,GFileNameTail(name));
- *strrchr(tmpfile,'.') = '\0';
-#if defined( _NO_SNPRINTF ) || defined( __VMS )
- sprintf( buf, "%s < %s > %s", compressors[compression].decomp, name, tmpfile );
-#else
- snprintf( buf, sizeof(buf), "%s < %s > %s", compressors[compression].decomp, name, tmpfile );
-#endif
- if ( system(buf)==0 )
-return( tmpfile );
- free(tmpfile);
-return( NULL );
-}
-
-static char *ForceFileToHaveName(FILE *file, char *exten) {
- char tmpfilename[L_tmpnam+100];
- static int try=0;
- FILE *newfile;
-
- forever {
- sprintf( tmpfilename, P_tmpdir "/fontforge%d-%d", getpid(), try++ );
- if ( exten!=NULL )
- strcat(tmpfilename,exten);
- if ( access( tmpfilename, F_OK )==-1 &&
- (newfile = fopen(tmpfilename,"w"))!=NULL ) {
- char buffer[1024];
- int len;
- while ( (len = fread(buffer,1,sizeof(buffer),file))>0 )
- fwrite(buffer,1,len,newfile);
- fclose(newfile);
- }
-return(copy(tmpfilename)); /* The filename does not exist */
- }
-}
-
-/* This does not check currently existing fontviews, and should only be used */
-/* by LoadSplineFont (which does) and by RevertFile (which knows what it's doing) */
-SplineFont *_ReadSplineFont(FILE *file,char *filename,enum openflags openflags) {
- SplineFont *sf;
- char ubuf[250], *temp;
- int fromsfd = false;
- int i;
- char *pt, *strippedname, *oldstrippedname, *tmpfile=NULL, *paren=NULL, *fullname=filename, *rparen;
- int len;
- int checked;
- int compression=0;
- int wasurl = false, nowlocal = true;
-
- if ( filename==NULL )
-return( NULL );
-
- strippedname = filename;
- pt = strrchr(filename,'/');
- if ( pt==NULL ) pt = filename;
- /* Someone gave me a font "Nafees Nastaleeq(Updated).ttf" and complained */
- /* that ff wouldn't open it */
- /* Now someone will complain about "Nafees(Updated).ttc(fo(ob)ar)" */
- if ( (paren = strrchr(pt,'('))!=NULL &&
- (rparen = strrchr(paren,')'))!=NULL &&
- rparen[1]=='\0' ) {
- strippedname = copy(filename);
- strippedname[paren-filename] = '\0';
- }
-
- pt = strrchr(strippedname,'.');
-
- i = -1;
- if ( pt!=NULL ) for ( i=0; compressors[i].ext!=NULL; ++i )
- if ( strcmp(compressors[i].ext,pt)==0 )
- break;
- oldstrippedname = strippedname;
- if ( i==-1 || compressors[i].ext==NULL )
- i=-1;
- else {
- if ( file!=NULL ) {
- char *spuriousname = ForceFileToHaveName(file,compressors[i].ext);
- tmpfile = Decompress(spuriousname,i);
- fclose(file); file = NULL;
- unlink(spuriousname); free(spuriousname);
- } else
- tmpfile = Decompress(strippedname,i);
- if ( tmpfile!=NULL ) {
- strippedname = tmpfile;
- } else {
- ff_post_error(_("Decompress Failed!"),_("Decompress Failed!"));
-return( NULL );
- }
- compression = i+1;
- if ( strippedname!=filename && paren!=NULL ) {
- fullname = galloc(strlen(strippedname)+strlen(paren)+1);
- strcpy(fullname,strippedname);
- strcat(fullname,paren);
- } else
- fullname = strippedname;
- }
-
- /* If there are no pfaedit windows, give them something to look at */
- /* immediately. Otherwise delay a bit */
- strcpy(ubuf,_("Loading font from "));
- len = strlen(ubuf);
- if ( !wasurl || i==-1 ) /* If it wasn't compressed, or it wasn't an url, then the fullname is reasonable, else use the original name */
- strncat(ubuf,temp = copy(GFileNameTail(fullname)),100);
- else
- strncat(ubuf,temp = copy(GFileNameTail(filename)),100);
- free(temp);
- ubuf[100+len] = '\0';
- ff_progress_start_indicator(FontViewFirst()==NULL?0:10,_("Loading..."),ubuf,_("Reading Glyphs"),0,1);
- ff_progress_enable_stop(0);
-
- if ( file==NULL ) {
- file = fopen(strippedname,"rb");
- nowlocal = true;
- }
-
- sf = NULL;
- checked = false;
-/* checked == false => not checked */
-/* checked == 'u' => UFO */
-/* checked == 't' => TTF/OTF */
-/* checked == 'p' => pfb/general postscript */
-/* checked == 'P' => pdf */
-/* checked == 'c' => cff */
-/* checked == 'S' => svg */
-/* checked == 'f' => sfd */
-/* checked == 'F' => sfdir */
-/* checked == 'b' => bdf */
-/* checked == 'i' => ikarus */
- if ( file!=NULL ) {
- /* Try to guess the file type from the first few characters... */
- int ch1 = getc(file);
- int ch2 = getc(file);
- int ch3 = getc(file);
- int ch4 = getc(file);
- int ch9, ch10;
- fseek(file, 98, SEEK_SET);
- ch9 = getc(file);
- ch10 = getc(file);
- rewind(file);
- if (( ch1==0 && ch2==1 && ch3==0 && ch4==0 ) ||
- (ch1=='O' && ch2=='T' && ch3=='T' && ch4=='O') ||
- (ch1=='t' && ch2=='r' && ch3=='u' && ch4=='e') ||
- (ch1=='t' && ch2=='t' && ch3=='c' && ch4=='f') ) {
- sf = _SFReadTTF(file,0,openflags,fullname,NULL);
- checked = 't';
- } else if (( ch1=='%' && ch2=='!' ) ||
- ( ch1==0x80 && ch2=='\01' ) ) { /* PFB header */
- sf = _SFReadPostscript(file,fullname);
- checked = 'p';
- } else if ( ch1==1 && ch2==0 && ch3==4 ) {
- int len;
- fseek(file,0,SEEK_END);
- len = ftell(file);
- fseek(file,0,SEEK_SET);
- sf = _CFFParse(file,len,NULL);
- checked = 'c';
- } /* Too hard to figure out a valid mark for a mac resource file */
- if ( file!=NULL ) fclose(file);
- }
-
- if ( sf!=NULL )
- /* good */;
- else if (( strmatch(fullname+strlen(fullname)-4, ".ttf")==0 ||
- strmatch(fullname+strlen(strippedname)-4, ".ttc")==0 ||
- strmatch(fullname+strlen(fullname)-4, ".gai")==0 ||
- strmatch(fullname+strlen(fullname)-4, ".otf")==0 ||
- strmatch(fullname+strlen(fullname)-4, ".otb")==0 ) && checked!='t') {
- sf = SFReadTTF(fullname,0,openflags);
- } else if ( strmatch(fullname+strlen(strippedname)-4, ".bin")==0 ||
- strmatch(fullname+strlen(strippedname)-4, ".hqx")==0 ||
- strmatch(fullname+strlen(strippedname)-6, ".dfont")==0 ) {
- sf = SFReadMacBinary(fullname,0,openflags);
- } else if ( (strmatch(fullname+strlen(fullname)-4, ".pfa")==0 ||
- strmatch(fullname+strlen(fullname)-4, ".pfb")==0 ||
- strmatch(fullname+strlen(fullname)-4, ".pf3")==0 ||
- strmatch(fullname+strlen(fullname)-4, ".cid")==0 ||
- strmatch(fullname+strlen(fullname)-4, ".gsf")==0 ||
- strmatch(fullname+strlen(fullname)-4, ".pt3")==0 ||
- strmatch(fullname+strlen(fullname)-3, ".ps")==0 ) && checked!='p' ) {
- sf = SFReadPostscript(fullname);
- } else if ( strmatch(fullname+strlen(fullname)-4, ".cff")==0 && checked!='c' ) {
- sf = CFFParse(fullname);
- } else {
- sf = SFReadMacBinary(fullname,0,openflags);
- }
- ff_progress_end_indicator();
-
- if ( sf!=NULL ) {
- SplineFont *norm = sf->mm!=NULL ? sf->mm->normal : sf;
- if ( compression!=0 ) {
- free(sf->filename);
- *strrchr(oldstrippedname,'.') = '\0';
- sf->filename = copy( oldstrippedname );
- }
- if ( fromsfd )
- sf->compression = compression;
- free( norm->origname );
- if ( sf->chosenname!=NULL && strippedname==filename ) {
- norm->origname = galloc(strlen(filename)+strlen(sf->chosenname)+8);
- strcpy(norm->origname,filename);
- strcat(norm->origname,"(");
- strcat(norm->origname,sf->chosenname);
- strcat(norm->origname,")");
- } else
- norm->origname = copy(filename);
- free( norm->chosenname ); norm->chosenname = NULL;
- if ( sf->mm!=NULL ) {
- int j;
- for ( j=0; j<sf->mm->instance_count; ++j ) {
- free(sf->mm->instances[j]->origname);
- sf->mm->instances[j]->origname = copy(norm->origname);
- }
- }
- } else if ( !GFileExists(filename) )
- ff_post_error(_("Couldn't open font"),_("The requested file, %.100s, does not exist"),GFileNameTail(filename));
- else if ( !GFileReadable(filename) )
- ff_post_error(_("Couldn't open font"),_("You do not have permission to read %.100s"),GFileNameTail(filename));
- else
- ff_post_error(_("Couldn't open font"),_("%.100s is not in a known format (or is so badly corrupted as to be unreadable)"),GFileNameTail(filename));
-
- if ( oldstrippedname!=filename )
- free(oldstrippedname);
- if ( fullname!=filename && fullname!=strippedname )
- free(fullname);
- if ( tmpfile!=NULL ) {
- unlink(tmpfile);
- free(tmpfile);
- }
- if ( (openflags&of_fstypepermitted) && sf!=NULL && (sf->pfminfo.fstype&0xff)==0x0002 ) {
- /* Ok, they have told us from a script they have access to the font */
- } else if ( !fromsfd && sf!=NULL && (sf->pfminfo.fstype&0xff)==0x0002 ) {
- char *buts[3];
- buts[0] = _("_Yes"); buts[1] = _("_No"); buts[2] = NULL;
- if ( ff_ask(_("Restricted Font"),(const char **) buts,1,1,_("This font is marked with an FSType of 2 (Restricted\nLicense). That means it is not editable without the\npermission of the legal owner.\n\nDo you have such permission?"))==1 ) {
- SplineFontFree(sf);
-return( NULL );
- }
- }
-return( sf );
-}
-
-SplineFont *ReadSplineFont(char *filename,enum openflags openflags) {
-return( _ReadSplineFont(NULL,filename,openflags));
-}
-
-
-SplineFont *ReadSplineFontInfo(char *filename,enum openflags openflags) {
- SplineFont *sf, *sf_ptr;
- char **fontlist;
- char *pt =NULL, *strippedname=filename, *paren=NULL, *rparen=NULL, *fullname=filename;
- FILE *foo = NULL;
- int checked = 0;
- char s[512] = {0};
-
- if ( filename==NULL )
-return( NULL );
-
- pt = strrchr(filename,'/');
- if ( pt==NULL ) pt = filename;
- /* Someone gave me a font "Nafees Nastaleeq(Updated).ttf" and complained */
- /* that ff wouldn't open it */
- /* Now someone will complain about "Nafees(Updated).ttc(fo(ob)ar)" */
- if ( (paren = strrchr(pt,'('))!=NULL &&
- (rparen = strrchr(paren,')'))!=NULL &&
- rparen[1]=='\0' ) {
- strippedname = copy(filename);
- strippedname[paren-filename] = '\0';
- }
-
- sf = NULL;
- foo = fopen(strippedname,"rb");
- checked = false;
- if ( foo!=NULL ) {
- /* Try to guess the file type from the first few characters... */
- int ch1 = getc(foo);
- int ch2 = getc(foo);
- int ch3 = getc(foo);
- int ch4 = getc(foo);
- fclose(foo);
- if (( ch1==0 && ch2==1 && ch3==0 && ch4==0 ) ||
- (ch1=='O' && ch2=='T' && ch3=='T' && ch4=='O') ||
- (ch1=='t' && ch2=='r' && ch3=='u' && ch4=='e') ) {
- sf = SFReadTTFInfo(fullname,0,openflags);
- checked = 't';
- } else if ((ch1=='t' && ch2=='t' && ch3=='c' && ch4=='f')) {
- char **old_fontlist;
- int i;
- /* read all fonts in a collection */
- fontlist = NamesReadTTF(fullname);
- old_fontlist = fontlist;
- if (fontlist) {
- while (*fontlist != NULL) {
- snprintf(s,511, "%s(%s)", fullname,*fontlist);
- sf_ptr = SFReadTTFInfo(s,0,openflags);
- if (sf != NULL)
- sf_ptr->next = sf;
- sf = sf_ptr;
- fontlist++;
- }
- /* fontlist is (g)allocated */
- fontlist = old_fontlist;
- for(i=0; fontlist[i]; i++)
- free(fontlist[i]);
- free(fontlist);
- old_fontlist = NULL;
- }
- } else if ( strmatch(fullname+strlen(strippedname)-4, ".bin")==0 ||
- strmatch(fullname+strlen(strippedname)-4, ".hqx")==0 ||
- strmatch(fullname+strlen(strippedname)-6, ".dfont")==0 ) {
- fontlist = NamesReadMacBinary(fullname);
- if (fontlist) {
- while (*fontlist != NULL) {
- snprintf(s,511, "%s(%s)", fullname,*fontlist);
- sf_ptr = SFReadMacBinaryInfo(s,0,openflags);
- if (sf != NULL)
- sf_ptr->next = sf;
- sf = sf_ptr;
- fontlist++;
- }
- }
- } else {
- sf = ReadSplineFont (fullname, openflags);
- }
- }
- if ( strippedname!=filename )
- free(strippedname);
-return( sf );
-}
-
-
-/* Use URW 4 letter abbreviations */
-char *knownweights[] = { "Demi", "Bold", "Regu", "Medi", "Book", "Thin",
- "Ligh", "Heav", "Blac", "Ultr", "Nord", "Norm", "Gras", "Stan", "Halb",
- "Fett", "Mage", "Mitt", "Buch", NULL };
-char *realweights[] = { "Demi", "Bold", "Regular", "Medium", "Book", "Thin",
- "Light", "Heavy", "Black", "Ultra", "Nord", "Normal", "Gras", "Standard", "Halbfett",
- "Fett", "Mager", "Mittel", "Buchschrift", NULL};
-static char *moreweights[] = { "ExtraLight", "VeryLight", NULL };
-char **noticeweights[] = { moreweights, realweights, knownweights, NULL };
-
-static char *modifierlist[] = { "Ital", "Obli", "Kursive", "Cursive", "Slanted",
- "Expa", "Cond", NULL };
-static char *modifierlistfull[] = { "Italic", "Oblique", "Kursive", "Cursive", "Slanted",
- "Expanded", "Condensed", NULL };
-static char **mods[] = { knownweights, modifierlist, NULL };
-static char **fullmods[] = { realweights, modifierlistfull, NULL };
-
-char *_GetModifiers(char *fontname, char *familyname,char *weight) {
- char *pt, *fpt;
- int i, j;
-
- /* URW fontnames don't match the familyname */
- /* "NimbusSanL-Regu" vs "Nimbus Sans L" (note "San" vs "Sans") */
- /* so look for a '-' if there is one and use that as the break point... */
-
- if ( (fpt=strchr(fontname,'-'))!=NULL ) {
- ++fpt;
- if ( *fpt=='\0' )
- fpt = NULL;
- } else if ( familyname!=NULL ) {
- for ( pt = fontname, fpt=familyname; *fpt!='\0' && *pt!='\0'; ) {
- if ( *fpt == *pt ) {
- ++fpt; ++pt;
- } else if ( *fpt==' ' )
- ++fpt;
- else if ( *pt==' ' )
- ++pt;
- else if ( *fpt=='a' || *fpt=='e' || *fpt=='i' || *fpt=='o' || *fpt=='u' )
- ++fpt; /* allow vowels to be omitted from family when in fontname */
- else
- break;
- }
- if ( *fpt=='\0' && *pt!='\0' )
- fpt = pt;
- else
- fpt = NULL;
- }
-
- if ( fpt == NULL ) {
- for ( i=0; mods[i]!=NULL; ++i ) for ( j=0; mods[i][j]!=NULL; ++j ) {
- pt = strstr(fontname,mods[i][j]);
- if ( pt!=NULL && (fpt==NULL || pt<fpt))
- fpt = pt;
- }
- }
- if ( fpt!=NULL ) {
- for ( i=0; mods[i]!=NULL; ++i ) for ( j=0; mods[i][j]!=NULL; ++j ) {
- if ( strcmp(fpt,mods[i][j])==0 )
-return( fullmods[i][j]);
- }
- if ( strcmp(fpt,"BoldItal")==0 )
-return( "BoldItalic" );
- else if ( strcmp(fpt,"BoldObli")==0 )
-return( "BoldOblique" );
-
-return( fpt );
- }
-
-return( weight==NULL || *weight=='\0' ? "Regular": weight );
-}
-
-char *SFGetModifiers(SplineFont *sf) {
-return( _GetModifiers(sf->fontname,sf->familyname,sf->weight));
-}
-
diff --git a/Build/source/texk/web2c/luatexdir/luafontloader/fontforge/fontforge/splinefont.h b/Build/source/texk/web2c/luatexdir/luafontloader/fontforge/fontforge/splinefont.h
deleted file mode 100644
index 5c432cb7db8..00000000000
--- a/Build/source/texk/web2c/luatexdir/luafontloader/fontforge/fontforge/splinefont.h
+++ /dev/null
@@ -1,2913 +0,0 @@
-/* Copyright (C) 2000-2008 by George Williams */
-/*
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are met:
-
- * Redistributions of source code must retain the above copyright notice, this
- * list of conditions and the following disclaimer.
-
- * Redistributions in binary form must reproduce the above copyright notice,
- * this list of conditions and the following disclaimer in the documentation
- * and/or other materials provided with the distribution.
-
- * The name of the author may not be used to endorse or promote products
- * derived from this software without specific prior written permission.
-
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
- * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
- * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
- * EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
- * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
- * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
- * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
- * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-#ifndef _SPLINEFONT_H
-#define _SPLINEFONT_H
-
-#include "basics.h"
-#include "configure-pfaedit.h"
-#ifdef HAVE_ICONV_H
-# include <iconv.h>
-/* libiconv.h defines iconv as taking a const pointer for inbuf. iconv doesn't*/
-# ifdef _LIBICONV_VERSION
-# define ICONV_CONST const
-# else
-# define ICONV_CONST
-# endif
-#else
-# include <gwwiconv.h>
-# define ICONV_CONST
-#endif
-
-#if defined( FONTFORGE_CONFIG_USE_LONGDOUBLE )
-# define real long double
-# define bigreal long double
-#elif defined( FONTFORGE_CONFIG_USE_DOUBLE )
-# define real double
-# define bigreal double
-#else
-# define real float
-# define bigreal double
-#endif
-
-#if defined( HAVE_LONG_DOUBLE ) && defined( This_does_not_seem_to_make_a_difference )
-# define extended long double
-# define CheckExtremaForSingleBitErrors(sp,t) (t)
-# define EXTENDED_IS_LONG_DOUBLE 1
-#else
-# define extended double
-#endif
- /* Solaris wants to define extended to be unsigned [3] unless we do this*/
-#define _EXTENDED
-
-#define CHR(ch1,ch2,ch3,ch4) (((ch1)<<24)|((ch2)<<16)|((ch3)<<8)|(ch4))
-
-#define MmMax 16 /* PS says at most this many instances for type1/2 mm fonts */
-
-typedef struct ipoint {
- int x;
- int y;
-} IPoint;
-
-typedef struct basepoint {
- real x;
- real y;
-} BasePoint;
-
-typedef struct dbasepoint {
- bigreal x;
- bigreal y;
-} DBasePoint;
-
-typedef struct tpoint {
- real x;
- real y;
- real t;
-} TPoint;
-
-typedef struct dbounds {
- real minx, maxx;
- real miny, maxy;
-} DBounds;
-
-typedef struct ibounds {
- int minx, maxx;
- int miny, maxy;
-} IBounds;
-
-typedef struct val {
- enum val_type { v_int, v_real, v_str, v_unicode, v_lval, v_arr, v_arrfree,
- v_int32pt, v_int16pt, v_int8pt, v_void } type;
- union {
- int ival;
- real fval;
- char *sval;
- struct val *lval;
- struct array *aval;
- uint32 *u32ptval;
- uint16 *u16ptval;
- uint8 *u8ptval;
- } u;
-} Val; /* Used by scripting */
-
-struct psdict {
- int cnt, next;
- char **keys;
- char **values;
-};
-
-struct pschars {
- int cnt, next;
- char **keys;
- uint8 **values;
- int *lens;
- int bias; /* for type2 strings */
-};
-
-enum linejoin {
- lj_miter, /* Extend lines until they meet */
- lj_round, /* circle centered at the join of expand radius */
- lj_bevel, /* Straight line between the ends of next and prev */
- lj_inherited
-};
-enum linecap {
- lc_butt, /* equiv to lj_bevel, straight line extends from one side to other */
- lc_round, /* semi-circle */
- lc_square, /* Extend lines by radius, then join them */
- lc_inherited
-};
-enum spreadMethod {
- sm_pad, sm_reflect, sm_repeat
-};
-#define COLOR_INHERITED 0xfffffffe
-struct gradient {
- BasePoint start; /* focal of a radial gradient, start of a linear */
- BasePoint stop; /* center of a radial gradient, end of a linear */
- real radius; /* 0=>linear gradient, else radius of a radial gradient */
- enum spreadMethod sm;
- int stop_cnt;
- struct grad_stops {
- real offset;
- uint32 col;
- real opacity;
- } *grad_stops;
-};
-
-struct pattern {
- char *pattern;
- real width, height; /* Pattern is scaled to be repeated every width/height (in user coordinates) */
- real transform[6];
- /* Used during rasterization process */
- struct bdfchar *pat;
- real invtrans[6];
- int bminx, bminy, bwidth, bheight; /* of the pattern at bdfchar scale */
-};
-
-struct brush {
- uint32 col;
- float opacity; /* number between [0,1], only for svg/pdf */
- struct pattern *pattern; /* A pattern to be tiled */
- struct gradient *gradient; /* A gradient fill */
-};
-#define WIDTH_INHERITED (-1)
-#define DASH_INHERITED 255 /* if the dashes[0]==0 && dashes[1]==DASH_INHERITED */
-#define DASH_MAX 8
-typedef unsigned char DashType;
-struct pen {
- struct brush brush;
- uint8 linejoin;
- uint8 linecap;
- float width;
- real trans[4];
- DashType dashes[DASH_MAX];
-};
-
-struct spline;
-enum si_type { si_std, si_caligraphic, si_elipse, si_centerline };
-/* If you change this structure you may need to update MakeStrokeDlg */
-/* and cvpalettes.c both contain statically initialized StrokeInfos */
-typedef struct strokeinfo {
- real radius; /* or major axis of pen */
- enum linejoin join;
- enum linecap cap;
- enum si_type stroke_type;
- unsigned int toobigwarn: 1;
- unsigned int removeinternal: 1;
- unsigned int removeexternal: 1;
- unsigned int removeoverlapifneeded: 1;
- unsigned int gottoobig: 1;
- unsigned int gottoobiglocal: 1;
- real penangle;
- real ratio; /* ratio of minor pen axis to major */
-/* For eplipse */
- real minorradius;
-/* For freehand tool */
- real radius2;
- int pressure1, pressure2;
-/* End freehand tool */
- bigreal c,s;
- real xoff[8], yoff[8];
- void *data;
- bigreal (*factor)(void *data,struct spline *spline,real t);
-} StrokeInfo;
-
-enum overlap_type { over_remove, over_rmselected, over_intersect, over_intersel,
- over_exclude, over_findinter, over_fisel };
-
-enum simpify_flags { sf_cleanup=-1, sf_normal=0, sf_ignoreslopes=1,
- sf_ignoreextremum=2, sf_smoothcurves=4, sf_choosehv=8,
- sf_forcelines=0x10, sf_nearlyhvlines=0x20,
- sf_mergelines=0x40, sf_setstart2extremum=0x80,
- sf_rmsingletonpoints=0x100 };
-struct simplifyinfo {
- int flags;
- bigreal err;
- bigreal tan_bounds;
- bigreal linefixup;
- bigreal linelenmax; /* Don't simplify any straight lines longer than this */
- int set_as_default;
- int check_selected_contours;
-};
-
-typedef struct italicinfo {
- double italic_angle;
- double xheight_percent;
- struct hsquash { double lsb_percent, stem_percent, counter_percent, rsb_percent; }
- lc, uc, neither;
- enum { srf_flat, srf_simpleslant, srf_complexslant } secondary_serif;
- /* | | (flat) | | (simple) | | (complex) */
- /* | | | / | / */
- /* | | | / | / */
- /* +----+ |/ \ / */
-
- unsigned int transform_bottom_serifs: 1;
- unsigned int transform_top_xh_serifs: 1; /* Those at x-height */
- unsigned int transform_top_as_serifs: 1; /* Those at ascender-height */
- unsigned int transform_diagon_serifs: 1; /* Those at baseline/xheight */
-
- unsigned int a_from_d: 1; /* replace the "a" glyph with the variant which looks like a "d" without an ascender */
- /* When I say "f" I also mean "f_f" ligature, "longs", cyrillic phi and other things shaped like "f" */
- unsigned int f_long_tail: 1; /* Some Italic fonts have the "f" grow an extension of the main stem below the baseline */
- unsigned int f_rotate_top: 1; /* Most Italic fonts take the top curve of the "f", rotate it 180 and attach to the bottom */
- unsigned int pq_deserif: 1; /* Remove a serif from the descender of p or q and replace with a secondary serif as above */
-
- /* Unsupported */
- /* e becomes rounder, cross bar slightly slanted */
- /* g closed counter at bottom */
- /* k closed counter at top */
- /* v-z diagonal stems become more curvatious */
-
- unsigned int cyrl_phi: 1; /* Gains an "f" like top, bottom treated like "f" */
- unsigned int cyrl_i: 1; /* Turns into a latin u */
- unsigned int cyrl_pi: 1; /* Turns into a latin n */
- unsigned int cyrl_te: 1; /* Turns into a latin m */
- unsigned int cyrl_sha: 1; /* Turns into a latin m rotated 180 */
- unsigned int cyrl_dje: 1; /* Turns into a latin smallcaps T */
- unsigned int cyrl_dzhe: 1; /* Turns into a latin u */
- /* Is there a difference between dzhe and i? both look like u to me */
-
- /* Unsupported */
- /* u432 curved B */
- /* u433 strange gamma */
- /* u434 normal delta */
- /* u436 */
- /* u43b lambda ? */
- /* u43c */
- /* u446 */
- /* u449 */
- /* u449 */
- /* u44a */
-
-/* This half of the structure gets filled in later */
- double tan_ia;
- double x_height;
- double pq_depth;
- double ascender_height;
- double emsize;
- int order2;
- struct splinefont *sf;
- int layer;
- double serif_extent, serif_height;
- struct splinepoint *f_start, *f_end; /* start has next pointing into the f head and up */
- struct splinepoint *ff_start1, *ff_end1, *ff_start2, *ff_end2;
- double f_height, ff_height;
-} ItalicInfo;
-
-typedef struct bluedata {
- real xheight, xheighttop; /* height of "x" and "o" (u,v,w,x,y,z) */
- real caph, caphtop; /* height of "I" and "O" */
- real base, basebelow; /* bottom of "I" and "O" */
- real ascent; /* height of "l" */
- real descent; /* depth of "p" */
- real numh, numhtop; /* height of "7" and "8" */ /* numbers with ascenders */
- int bluecnt; /* If the private dica contains bluevalues... */
- real blues[12][2]; /* 7 pairs from bluevalues, 5 from otherblues */
-} BlueData;
-
-typedef struct bdffloat {
- int16 xmin,xmax,ymin,ymax;
- int16 bytes_per_line;
- unsigned int byte_data:1;
- uint8 depth;
- uint8 *bitmap;
-} BDFFloat;
-
-/* OpenType does not document 'dflt' as a language, but we'll use it anyway. */
-/* (Adobe uses it too) we'll turn it into a default entry when we output it. */
-#define DEFAULT_LANG CHR('d','f','l','t')
-/* The OpenType spec says in one place that the default script is 'dflt' and */
-/* in another that it is 'DFLT'. 'DFLT' is correct */
-#define DEFAULT_SCRIPT CHR('D','F','L','T')
-#define REQUIRED_FEATURE CHR(' ','R','Q','D')
-
-enum otlookup_type {
- ot_undef = 0, /* Not a lookup type */
- gsub_start = 0x000, /* Not a lookup type */
- gsub_single = 0x001,
- gsub_multiple = 0x002,
- gsub_alternate = 0x003,
- gsub_ligature = 0x004,
- gsub_context = 0x005,
- gsub_contextchain = 0x006,
- /* GSUB extension 7 */
- gsub_reversecchain = 0x008,
- /* ********************* */
- gpos_start = 0x100, /* Not a lookup type */
-
- gpos_single = 0x101,
- gpos_pair = 0x102,
- gpos_cursive = 0x103,
- gpos_mark2base = 0x104,
- gpos_mark2ligature = 0x105,
- gpos_mark2mark = 0x106,
- gpos_context = 0x107,
- gpos_contextchain = 0x108,
- /* GPOS extension 9 */
-
- /* otlookup&0xff == lookup type for the appropriate table */
- /* otlookup>>8: 0=>GSUB, 1=>GPOS */
-};
-
-enum otlookup_typemasks {
- gsub_single_mask = 0x00001,
- gsub_multiple_mask = 0x00002,
- gsub_alternate_mask = 0x00004,
- gsub_ligature_mask = 0x00008,
- gsub_context_mask = 0x00010,
- gsub_contextchain_mask = 0x00020,
- gsub_reversecchain_mask = 0x00040,
- /* ********************* */
- gpos_single_mask = 0x00400,
- gpos_pair_mask = 0x00800,
- gpos_cursive_mask = 0x01000,
- gpos_mark2base_mask = 0x02000,
- gpos_mark2ligature_mask = 0x04000,
- gpos_mark2mark_mask = 0x08000,
- gpos_context_mask = 0x10000,
- gpos_contextchain_mask = 0x20000,
-};
-
-#define MAX_LANG 4 /* If more than this we allocate more_langs in chunks of MAX_LANG */
-struct scriptlanglist {
- uint32 script;
- uint32 langs[MAX_LANG];
- uint32 *morelangs;
- int lang_cnt;
- struct scriptlanglist *next;
-};
-
-extern struct opentype_feature_friendlynames {
- uint32 tag;
- char *tagstr;
- char *friendlyname;
- int masks;
-} friendlies[];
-
-typedef struct featurescriptlanglist {
- uint32 featuretag;
- struct scriptlanglist *scripts;
- struct featurescriptlanglist *next;
-} FeatureScriptLangList;
-
-enum pst_flags { pst_r2l=1, pst_ignorebaseglyphs=2, pst_ignoreligatures=4,
- pst_ignorecombiningmarks=8 };
-
-typedef struct otlookup {
- struct otlookup *next;
- enum otlookup_type lookup_type;
- uint16 lookup_flags;
- char *lookup_name;
- FeatureScriptLangList *features;
- struct lookup_subtable {
- char *subtable_name;
- char *suffix; /* for gsub_single, used to find a default replacement */
- struct otlookup *lookup;
- unsigned int unused: 1;
- unsigned int per_glyph_pst_or_kern: 1;
- unsigned int anchor_classes: 1;
- unsigned int vertical_kerning: 1;
- unsigned int ticked: 1;
- struct kernclass *kc;
- struct generic_fpst *fpst;
- /* Each time an item is added to a lookup we must place it into a */
- /* subtable. If it's a kerning class, fpst or state machine it has */
- /* a subtable all to itself. If it's an anchor class it can share */
- /* a subtable with other anchor classes (merge with). If it's a glyph */
- /* PST it may share a subtable with other PSTs */
- /* Note items may only be placed in lookups in which they fit. Can't */
- /* put kerning data in a gpos_single lookup, etc. */
- struct lookup_subtable *next;
- int32 subtable_offset;
- int32 *extra_subtables;
- /* If a kerning subtable has too much stuff in it, we are prepared to */
- /* break it up into several smaller subtables, each of which has */
- /* an offset in this list (extra-subtables[0]==subtable_offset) */
- /* the list is terminated by an entry of -1 */
- } *subtables;
- unsigned int unused: 1; /* No subtable is used (call SFFindUnusedLookups before examining) */
- unsigned int empty: 1; /* No subtable is used, and no anchor classes are used */
- unsigned int store_in_afm: 1; /* Used for ligatures, some get stored */
- /* 'liga' generally does, but 'frac' doesn't */
- unsigned int needs_extension: 1; /* Used during opentype generation */
- unsigned int temporary_kern: 1; /* Used when decomposing kerning classes into kern pairs for older formats */
- unsigned int def_lang_checked: 1;
- unsigned int def_lang_found: 1;
- unsigned int ticked: 1;
- int16 subcnt; /* Actual number of subtables we will output */
- /* Some of our subtables may contain no data */
- /* Some may be too big and need to be broken up.*/
- /* So this field may be different than just counting the subtables */
- int lookup_index; /* used during opentype generation */
- uint32 lookup_offset;
- uint32 lookup_length;
- char *tempname;
-} OTLookup;
-
-#ifdef FONTFORGE_CONFIG_DEVICETABLES
-typedef struct devicetab {
- uint16 first_pixel_size, last_pixel_size; /* A range of point sizes to which this table applies */
- int8 *corrections; /* a set of pixel corrections, one for each point size */
-} DeviceTable;
-
-typedef struct valdev { /* Value records can have four associated device tables */
- DeviceTable xadjust;
- DeviceTable yadjust;
- DeviceTable xadv;
- DeviceTable yadv;
-} ValDevTab;
-#endif
-
-enum anchorclass_type { act_mark, act_mkmk, act_curs, act_mklg };
-typedef struct anchorclass {
- char *name; /* in utf8 */
- struct lookup_subtable *subtable;
- uint8 type; /* anchorclass_type */
- uint8 has_base;
- uint8 processed, has_mark, matches, ac_num;
- uint8 ticked;
- struct anchorclass *next;
-} AnchorClass;
-
-enum anchor_type { at_mark, at_basechar, at_baselig, at_basemark, at_centry, at_cexit, at_max };
-typedef struct anchorpoint {
- AnchorClass *anchor;
- BasePoint me;
-#ifdef FONTFORGE_CONFIG_DEVICETABLES
- DeviceTable xadjust, yadjust;
-#endif
- unsigned int type: 4;
- unsigned int selected: 1;
- unsigned int ticked: 1;
- unsigned int has_ttf_pt: 1;
- uint16 ttf_pt_index;
- int16 lig_index;
- struct anchorpoint *next;
-} AnchorPoint;
-
-typedef struct kernpair {
- struct lookup_subtable *subtable;
- struct splinechar *sc;
- int16 off;
- uint16 kcid; /* temporary value */
-#ifdef FONTFORGE_CONFIG_DEVICETABLES
- DeviceTable *adjust; /* Only adjustment in one dimen, if more needed use pst */
-#endif
- struct kernpair *next;
-} KernPair;
-
-typedef struct kernclass {
- int first_cnt, second_cnt; /* Count of classes for first and second chars */
- char **firsts; /* list of a space seperated list of char names */
- char **seconds; /* one entry for each class. Entry 0 is null */
- /* and means everything not specified elsewhere */
- struct lookup_subtable *subtable;
- uint16 kcid; /* Temporary value, used for many things briefly */
- int16 *offsets; /* array of first_cnt*second_cnt entries */
-#ifdef FONTFORGE_CONFIG_DEVICETABLES
- DeviceTable *adjusts; /* array of first_cnt*second_cnt entries */
-#endif
- struct kernclass *next;
-} KernClass;
-
-enum possub_type { pst_null, pst_position, pst_pair,
- pst_substitution, pst_alternate,
- pst_multiple, pst_ligature,
- pst_lcaret /* must be pst_max-1, see charinfo.c*/,
- pst_max,
- /* These are not psts but are related so it's handly to have values for them */
- pst_kerning = pst_max, pst_vkerning, pst_anchors,
- /* And these are fpsts */
- pst_contextpos, pst_contextsub, pst_chainpos, pst_chainsub,
- pst_reversesub, fpst_max,
- /* And these are used to specify a kerning pair where the current */
- /* char is the final glyph rather than the initial one */
- /* A kludge used when cutting and pasting features */
- pst_kernback, pst_vkernback
- };
-
-struct vr {
- int16 xoff, yoff, h_adv_off, v_adv_off;
-#ifdef FONTFORGE_CONFIG_DEVICETABLES
- ValDevTab *adjust;
-#endif
-};
-
-typedef struct generic_pst {
- unsigned int ticked: 1;
- unsigned int temporary: 1; /* Used in afm ligature closure */
- /* enum possub_type*/ uint8 type;
- struct lookup_subtable *subtable;
- struct generic_pst *next;
- union {
- struct vr pos;
- struct { char *paired; struct vr *vr; } pair;
- struct { char *variant; } subs;
- struct { char *components; } mult, alt;
- struct { char *components; struct splinechar *lig; } lig;
- struct { int16 *carets; int cnt; } lcaret; /* Ligature caret positions */
- } u;
-} PST;
-
-typedef struct liglist {
- PST *lig;
- struct splinechar *first; /* First component */
- struct splinecharlist *components; /* Other than the first */
- struct liglist *next;
- int ccnt; /* Component count. (includes first component) */
-} LigList;
-
-enum fpossub_format { pst_glyphs, pst_class, pst_coverage,
- pst_reversecoverage, pst_formatmax };
-
-typedef struct generic_fpst {
- uint16 /*enum sfpossub_type*/ type;
- uint16 /*enum fpossub_format*/ format;
- struct lookup_subtable *subtable;
- struct generic_fpst *next;
- uint16 nccnt, bccnt, fccnt;
- uint16 rule_cnt;
- char **nclass, **bclass, **fclass;
- struct fpst_rule {
- union {
- struct fpg { char *names, *back, *fore; } glyph;
- struct fpc { int ncnt, bcnt, fcnt; uint16 *nclasses, *bclasses, *fclasses, *allclasses; } class;
- struct fpv { int ncnt, bcnt, fcnt; char **ncovers, **bcovers, **fcovers; } coverage;
- struct fpr { int always1, bcnt, fcnt; char **ncovers, **bcovers, **fcovers; char *replacements; } rcoverage;
- } u;
- int lookup_cnt;
- struct seqlookup {
- int seq;
- struct otlookup *lookup;
- } *lookups;
- } *rules;
- uint8 ticked;
- uint8 effectively_by_glyphs;
-} FPST;
-
-struct opentype_str {
- struct splinechar *sc;
- struct vr vr; /* Scaled and rounded gpos modifications (device table info included in xoff, etc. not in adjusts) */
- struct kernpair *kp;
- struct kernclass *kc;
- int16 advance_width; /* Basic advance, modifications in vr, scaled and rounded */
- int16 kc_index;
- int16 lig_pos; /* when skipping marks to form a ligature keep track of what ligature element a mark was attached to */
- int16 context_pos; /* When doing a contextual match remember which glyphs are used, and where in the match they occur. Skipped glyphs have -1 */
- int32 orig_index;
- void *fl;
- unsigned int line_break_after: 1;
- unsigned int r2l: 1;
- int16 bsln_off;
-};
-
-/* Wow, the GPOS 'size' feature stores a string in the name table just as mac */
-/* features do */
-struct otfname {
- struct otfname *next;
- uint16 lang; /* windows language code */
- char *name; /* utf8 */
-};
-
-typedef struct undoes {
- struct undoes *next;
- enum undotype { ut_none=0, ut_state, ut_tstate, ut_statehint, ut_statename,
- ut_statelookup,
- ut_anchors,
- ut_width, ut_vwidth, ut_lbearing, ut_rbearing, ut_possub,
- ut_hints, ut_bitmap, ut_bitmapsel, ut_composit, ut_multiple, ut_layers,
- ut_noop } undotype;
- unsigned int was_modified: 1;
- unsigned int was_order2: 1;
- union {
- struct {
- int16 width, vwidth;
- int16 lbearingchange;
- int unicodeenc; /* only for ut_statename */
- char *charname; /* only for ut_statename */
- char *comment; /* in utf8 */
- PST *possub; /* only for ut_statename */
- struct splinepointlist *splines;
- struct refchar *refs;
-
- struct imagelist *images;
- void *hints; /* ut_statehint, ut_statename */
- uint8 *instrs;
- int instrs_len;
- AnchorPoint *anchor;
-#ifdef FONTFORGE_CONFIG_TYPE3
- struct brush fill_brush;
- struct pen stroke_pen;
- unsigned int dofill: 1;
- unsigned int dostroke: 1;
- unsigned int fillfirst: 1;
-#endif
- } state;
- int width; /* used by both ut_width and ut_vwidth */
- int lbearing; /* used by ut_lbearing */
- int rbearing; /* used by ut_rbearing */
- struct {
- int16 width; /* width should be controled by postscript, but people don't like that */
- int16 xmin,xmax,ymin,ymax;
- int16 bytes_per_line;
- int16 pixelsize;
- int16 depth;
- uint8 *bitmap;
- BDFFloat *selection;
- } bmpstate;
- struct { /* copy contains an outline state and a set of bitmap states */
- struct undoes *state;
- struct undoes *bitmaps;
- } composit;
- struct {
- struct undoes *mult; /* copy contains several sub copies (composits, or states or widths or...) */
- /* Also used for ut_layers, each sub copy is a state (first is ly_fore, next ly_fore+1...) */
- } multiple;
- struct {
- enum possub_type pst;
- char **data; /* First 4 bytes is tag, then space then data */
- struct undoes *more_pst;
- short cnt,max; /* Not always set */
- } possub;
- uint8 *bitmap;
- } u;
- struct splinefont *copied_from;
-} Undoes;
-
-typedef struct bdfchar {
- struct splinechar *sc;
- int16 xmin,xmax,ymin,ymax;
- int16 width;
- int16 bytes_per_line;
- uint8 *bitmap;
- int orig_pos;
- struct bitmapview *views;
- Undoes *undoes;
- Undoes *redoes;
- unsigned int changed: 1;
- unsigned int byte_data: 1; /* for anti-aliased chars entries are grey-scale bytes not bw bits */
- unsigned int widthgroup: 1; /* for ttf bitmap output */
- unsigned int isreference: 1; /* for ttf bitmap input, */
- unsigned int ticked: 1;
- uint8 depth; /* for ttf bitmap output */
- uint16 vwidth;
- BDFFloat *selection;
-} BDFChar;
-
-typedef struct enc {
- char *enc_name;
- int char_cnt; /* Size of the next two arrays */
- int32 *unicode; /* unicode value for each encoding point */
- char **psnames; /* optional postscript name for each encoding point */
- struct enc *next;
- unsigned int builtin: 1;
- unsigned int hidden: 1;
- unsigned int only_1byte: 1;
- unsigned int has_1byte: 1;
- unsigned int has_2byte: 1;
- unsigned int is_unicodebmp: 1;
- unsigned int is_unicodefull: 1;
- unsigned int is_custom: 1;
- unsigned int is_original: 1;
- unsigned int is_compact: 1;
- unsigned int is_japanese: 1;
- unsigned int is_korean: 1;
- unsigned int is_tradchinese: 1;
- unsigned int is_simplechinese: 1;
- char iso_2022_escape[8];
- int iso_2022_escape_len;
- int low_page, high_page;
- char *iconv_name; /* For compatibility to old versions we might use a different name from that used by iconv. */
- iconv_t *tounicode;
- iconv_t *fromunicode;
- int (*tounicode_func)(int);
- int (*fromunicode_func)(int);
- unsigned int is_temporary: 1; /* freed when the map gets freed */
- int char_max; /* Used by temporary encodings */
-} Encoding;
-
-typedef struct namelist {
- struct namelist *basedon;
- char *title;
- const char ***unicode[17];
- struct namelist *next;
- struct renames { char *from; char *to; } *renames;
- int uses_unicode;
- char *a_utf8_name;
-} NameList;
-
-enum uni_interp { ui_unset= -1, ui_none, ui_adobe, ui_greek, ui_japanese,
- ui_trad_chinese, ui_simp_chinese, ui_korean, ui_ams };
-
-struct remap { uint32 firstenc, lastenc; int32 infont; };
-
-typedef struct encmap { /* A per-font map of encoding to glyph id */
- int32 *map; /* Map from encoding to glyphid */
- int32 *backmap; /* Map from glyphid to encoding */
- int enccount; /* used size of the map array */
- /* strictly speaking this might include */
- /* glyphs that are not encoded, but which */
- /* are displayed after the proper encoding */
- int encmax; /* allocated size of the map array */
- int backmax; /* allocated size of the backmap array */
- struct remap *remap;
- Encoding *enc;
- unsigned int ticked: 1;
-} EncMap;
-
-enum property_type { prt_string, prt_atom, prt_int, prt_uint, prt_property=0x10 };
-
-typedef struct bdfprops {
- char *name; /* These include both properties (like SLANT) and non-properties (like FONT) */
- int type;
- union {
- char *str;
- char *atom;
- int val;
- } u;
-} BDFProperties;
-
-typedef struct bdffont {
- struct splinefont *sf;
- int glyphcnt, glyphmax,glyphmin; /* used & allocated sizes of glyphs array */
- BDFChar **glyphs; /* an array of charcnt entries */
- int16 pixelsize;
- int16 ascent, descent;
- int16 layer; /* for piecemeal fonts */
- unsigned int piecemeal: 1;
- unsigned int bbsized: 1;
- unsigned int ticked: 1;
- unsigned int unhinted_freetype: 1;
- struct bdffont *next;
- struct clut *clut;
- char *foundry;
- int res;
- void *freetype_context;
- uint16 truesize; /* for bbsized fonts */
- int16 prop_cnt;
- int16 prop_max; /* only used within bdfinfo dlg */
- BDFProperties *props;
-} BDFFont;
-
-#define HntMax 96 /* PS says at most 96 hints */
-typedef uint8 HintMask[HntMax/8];
-
-enum pointtype { pt_curve, pt_corner, pt_tangent, pt_hvcurve };
-typedef struct splinepoint {
- BasePoint me;
- BasePoint nextcp; /* control point */
- BasePoint prevcp; /* control point */
- unsigned int nonextcp:1;
- unsigned int noprevcp:1;
- unsigned int nextcpdef:1;
- unsigned int prevcpdef:1;
- unsigned int selected:1; /* for UI */
- unsigned int pointtype:2;
- unsigned int isintersection: 1;
- unsigned int flexy: 1;
- unsigned int flexx: 1;
- unsigned int roundx: 1; /* For true type hinting */
- unsigned int roundy: 1; /* For true type hinting */
- unsigned int dontinterpolate: 1; /* in ttf, don't imply point by interpolating between cps */
- unsigned int ticked: 1;
- unsigned int watched: 1;
- /* 1 bits left... */
- uint16 ptindex; /* Temporary value used by metafont routine */
- uint16 ttfindex; /* Truetype point index */
- /* Special values 0xffff => point implied by averaging control points */
- /* 0xfffe => point created with no real number yet */
- /* (or perhaps point in context where no number is possible as in a glyph with points & refs) */
- uint16 nextcpindex; /* Truetype point index */
- struct spline *next;
- struct spline *prev;
- HintMask *hintmask;
-} SplinePoint;
-
-typedef struct linelist {
- IPoint here;
- struct linelist *next;
- /* The first two fields are constant for the linelist, the next ones */
- /* refer to a particular screen. If some portion of the line from */
- /* this point to the next one is on the screen then set cvli_onscreen */
- /* if this point needs to be clipped then set cvli_clipped */
- /* asend and asstart are the actual screen locations where this point */
- /* intersects the clip edge. */
- enum { cvli_onscreen=0x1, cvli_clipped=0x2 } flags;
- IPoint asend, asstart;
-} LineList;
-
-typedef struct linearapprox {
- real scale;
- unsigned int oneline: 1;
- unsigned int onepoint: 1;
- unsigned int any: 1; /* refers to a particular screen */
- struct linelist *lines;
- struct linearapprox *next;
-} LinearApprox;
-
-typedef struct spline1d {
- real a, b, c, d;
-} Spline1D;
-
-typedef struct spline {
- unsigned int islinear: 1; /* No control points */
- unsigned int isquadratic: 1; /* probably read in from ttf */
- unsigned int isticked: 1;
- unsigned int isneeded: 1; /* Used in remove overlap */
- unsigned int isunneeded: 1; /* Used in remove overlap */
- unsigned int exclude: 1; /* Used in remove overlap varient: exclude */
- unsigned int ishorvert: 1;
- unsigned int knowncurved: 1; /* We know that it curves */
- unsigned int knownlinear: 1; /* it might have control points, but still traces out a line */
- /* If neither knownlinear nor curved then we haven't checked */
- unsigned int order2: 1; /* It's a bezier curve with only one cp */
- unsigned int touched: 1;
- unsigned int leftedge: 1;
- unsigned int rightedge: 1;
- unsigned int acceptableextrema: 1; /* This spline has extrema, but we don't care */
- SplinePoint *from, *to;
- Spline1D splines[2]; /* splines[0] is the x spline, splines[1] is y */
- struct linearapprox *approx;
- /* Posible optimizations:
- Precalculate bounding box
- Precalculate min/max/ points of inflection
- */
-} Spline;
-
-
-typedef struct splinepointlist {
- SplinePoint *first, *last;
- struct splinepointlist *next;
- uint8 ticked;
- uint8 beziers_need_optimizer; /* If the spiros have changed in spiro mode, then reverting to bezier mode might, someday, run a simplifier */
- uint8 is_clip_path; /* In type3/svg fonts */
- char *contour_name;
-} SplinePointList, SplineSet;
-
-typedef struct imagelist {
- struct gimage *image;
- real xoff, yoff; /* position in character space of upper left corner of image */
- real xscale, yscale; /* scale to convert one pixel of image to one unit of character space */
- DBounds bb;
- struct imagelist *next;
- unsigned int selected: 1;
-} ImageList;
-
-typedef struct refchar {
- unsigned int checked: 1;
- unsigned int selected: 1;
- unsigned int point_match: 1; /* match_pt* are point indexes */
- /* and need to be converted to a */
- /* translation after truetype readin */
- unsigned int encoded: 1; /* orig_pos is actually an encoded value, used for old sfd files */
- unsigned int justtranslated: 1; /* The transformation matrix specifies a translation (or is identity) */
- unsigned int use_my_metrics: 1; /* Retain the ttf "use_my_metrics" info. */
- /* important for glyphs with instructions which change the width used */
- /* inside composites */
- unsigned int round_translation_to_grid: 1; /* Retain the ttf "round_to_grid" info. */
- unsigned int point_match_out_of_date: 1; /* Someone has edited a base glyph */
- int16 adobe_enc;
- int orig_pos;
- int unicode_enc; /* used by paste */
- real transform[6]; /* transformation matrix (first 2 rows of a 3x3 matrix, missing row is 0,0,1) */
- struct reflayer {
- unsigned int background: 1;
- unsigned int order2: 1;
- unsigned int anyflexes: 1;
-#ifdef FONTFORGE_CONFIG_TYPE3
- unsigned int dofill: 1;
- unsigned int dostroke: 1;
- unsigned int fillfirst: 1;
- struct brush fill_brush;
- struct pen stroke_pen;
-#endif
- SplinePointList *splines;
- ImageList *images; /* Only in background or type3 layer(s) */
- } *layers;
- int layer_cnt;
- struct refchar *next;
- DBounds bb;
- struct splinechar *sc;
- BasePoint top;
- uint16 match_pt_base, match_pt_ref;
-} RefChar;
-
-/* Some stems may appear, disappear, reapear several times */
-/* Serif stems on I which appear at 0, disappear, reappear at top */
-/* Or the major vertical stems on H which disappear at the cross bar */
-typedef struct hintinstance {
- real begin; /* location in the non-major direction*/
- real end; /* width/height in non-major direction*/
- unsigned int closed: 1;
- short int counternumber;
- struct hintinstance *next;
-} HintInstance;
-
-enum hinttypes { ht_unspecified=0, ht_h, ht_v, ht_d };
-typedef real _MMArray[2][MmMax];
-
-typedef struct steminfo {
- struct steminfo *next;
- unsigned int hinttype: 2; /* Only used by undoes */
- unsigned int ghost: 1; /* this is a ghost stem hint. As such truetype should ignore it, type2 output should negate it, and type1 should use as is */
- /* stored width will be either 20 or 21 */
- /* Type2 says: -20 is "width" of top edge, -21 is "width" of bottom edge, type1 accepts either */
- unsigned int haspointleft:1;
- unsigned int haspointright:1;
- unsigned int hasconflicts:1;/* Does this stem have conflicts within its cluster? */
- unsigned int used: 1; /* Temporary for counter hints or hint substitution */
- unsigned int tobeused: 1; /* Temporary for counter hints or hint substitution */
- unsigned int active: 1; /* Currently active hint in Review Hints dlg */
- /* displayed differently in char display */
- unsigned int enddone: 1; /* Used by ttf instructing, indicates a prev */
- /* hint had the same end as this one (so */
- /* the points on the end line have been */
- /* instructed already */
- unsigned int startdone: 1; /* Used by ttf instructing */
- /*unsigned int backwards: 1;*/ /* If we think this hint is better done with a negative width */
- unsigned int reordered: 1; /* In AutoHinting. Means we changed the start of the hint, need to test for out of order */
- unsigned int pendingpt: 1; /* A pending stem creation, not a true stem */
- unsigned int linearedges: 1;/* If we have a nice rectangle then we aren't */
- /* interested in the orientation which is */
- /* wider than long */
- int16 hintnumber; /* when dumping out hintmasks we need to know */
- /* what bit to set for this hint */
- union {
- int mask; /* Mask of all references that use this hint */
- /* in type2 output */
- _MMArray *unblended /*[2][MmMax]*/; /* Used when reading in type1 mm hints */
- } u;
- real start; /* location at which the stem starts */
- real width; /* or height */
- HintInstance *where; /* location(s) in the other coord */
-} StemInfo;
-
-typedef struct dsteminfo {
- struct dsteminfo *next; /* First two fields match those in steminfo */
- unsigned int hinttype: 2; /* Only used by undoes */
- unsigned int used: 1; /* used only by tottf.c:gendinstrs, metafont.c to mark a hint that has been dealt with */
- BasePoint left, right, unit;
- HintInstance *where; /* location(s) along the unit vector */
-} DStemInfo;
-
-typedef struct minimumdistance {
- /* If either point is NULL it will be assumed to mean either the origin */
- /* or the width point (depending on which is closer). This allows user */
- /* to control metrics... */
- SplinePoint *sp1, *sp2;
- unsigned int x: 1;
- unsigned int done: 1;
- struct minimumdistance *next;
-} MinimumDistance;
-
-typedef struct layer /* : reflayer */{
- unsigned int background: 1;
- unsigned int order2: 1;
- unsigned int anyflexes: 1;
-#ifdef FONTFORGE_CONFIG_TYPE3
- unsigned int dofill: 1;
- unsigned int dostroke: 1;
- unsigned int fillfirst: 1;
- struct brush fill_brush;
- struct pen stroke_pen;
-#endif
- SplinePointList *splines;
- ImageList *images; /* Only in background or type3 layer(s) */
- RefChar *refs; /* Only in foreground layer(s) */
- Undoes *undoes;
- Undoes *redoes;
- uint32 validation_state;
- uint32 old_vs;
-} Layer;
-
-enum layer_type { ly_all=-2, ly_grid= -1, ly_back=0, ly_fore=1,
- /* Possibly other foreground layers for type3 things */
- /* Possibly other background layers for normal fonts */
- ly_none = -3
- };
-
-/* For the 'MATH' table (and for TeX) */
-struct glyphvariants {
- char *variants; /* Space separated list of glyph names */
-/* Glyph assembly */
- int16 italic_correction; /* Of the composed glyph */
-#ifdef FONTFORGE_CONFIG_DEVICETABLES
- DeviceTable *italic_adjusts;
-#endif
- int part_cnt;
- struct gv_part {
- char *component;
- unsigned int is_extender: 1; /* This component may be skipped or repeated */
- uint16 startConnectorLength;
- uint16 endConnectorLength;
- uint16 fullAdvance;
- } *parts;
-};
-
-/* For the 'MATH' table */
-struct mathkernvertex {
- int cnt; /* There is one more kern entry than height entry */
- /* So the last mkd should have its height ignored */
- /* The MATH table stores the height count, I think the kern count */
- /* is more useful. They differ by 1 */
- struct mathkerndata {
- int16 height,kern;
-#ifdef FONTFORGE_CONFIG_DEVICETABLES
- DeviceTable *height_adjusts;
- DeviceTable *kern_adjusts;
-#endif
- } *mkd;
-};
-
-struct mathkern {
- struct mathkernvertex top_right;
- struct mathkernvertex top_left;
- struct mathkernvertex bottom_right;
- struct mathkernvertex bottom_left;
-};
-
-enum privatedict_state {
- pds_odd = 0x1, /* Odd number of entries */
- pds_outoforder = 0x2, /* Bluevalues should be listed in order */
- pds_toomany = 0x4, /* arrays are of limited sizes */
- pds_tooclose = 0x8, /* adjacent zones must not be within 2*bluefuzz+1 (or 3, if bluefuzz omitted) */
- pds_notintegral= 0x10, /* Must be integers */
- pds_toobig = 0x20, /* within pair difference have some relation to BlueScale but the docs make no sense to me */
- pds_shift = 8, /* BlueValues/OtherBlues, unshifted, FamilyBlues/FamilyOtherBlues shifted once */
-
- pds_missingblue = 0x010000,
- pds_badbluefuzz = 0x020000,
- pds_badbluescale = 0x040000,
- pds_badstdhw = 0x080000,
- pds_badstdvw = 0x100000,
- pds_badstemsnaph = 0x200000,
- pds_badstemsnapv = 0x400000,
- pds_stemsnapnostdh = 0x0800000,
- pds_stemsnapnostdv = 0x1000000,
- pds_badblueshift = 0x2000000
-
-};
-
-enum validation_state { vs_unknown = 0,
- vs_known=0x01, /* It has been validated */
- vs_opencontour=0x02,
- vs_selfintersects=0x04,
- vs_wrongdirection=0x08,
- vs_flippedreferences=0x10, /* special case of wrong direction */
- vs_missingextrema=0x20,
- vs_missingglyphnameingsub=0x40,
- /* Next few are postscript only */
- vs_toomanypoints=0x80,
- vs_toomanyhints=0x100,
- vs_badglyphname=0x200,
- /* Next few are only for fontlint */
- /* These are relative to maxp values which ff would fix on generating a font */
- vs_maxp_toomanypoints =0x400,
- vs_maxp_toomanypaths =0x800,
- vs_maxp_toomanycomppoints=0x1000,
- vs_maxp_toomanycomppaths =0x2000,
- vs_maxp_instrtoolong =0x4000,
- vs_maxp_toomanyrefs =0x8000,
- vs_maxp_refstoodeep =0x10000,
- /* vs_maxp_prepfpgmtoolong=0x20000, */ /* I think I was wrong about this "error" */
- /* Oops, we need another one, two, for the glyphs */
- vs_pointstoofarapart = 0x40000,
- vs_nonintegral = 0x80000, /* This will never be interesting in a real font, but might be in an sfd file */
- vs_missinganchor = 0x100000,
- vs_dupname = 0x200000,
- vs_dupunicode = 0x400000,
-
- vs_last = vs_dupunicode,
- vs_maskps = 0x3fe | vs_pointstoofarapart | vs_missinganchor | vs_dupname | vs_dupunicode,
- vs_maskcid = 0x1fe | vs_pointstoofarapart | vs_missinganchor | vs_dupname,
- vs_maskttf = 0x7e | vs_pointstoofarapart | vs_nonintegral | vs_missinganchor | vs_dupunicode,
- vs_maskfindproblems = 0x1be | vs_pointstoofarapart | vs_nonintegral | vs_missinganchor
- };
-
-typedef struct splinechar {
- char *name;
- int unicodeenc;
- int orig_pos; /* Original position in the glyph list */
- int16 width, vwidth, tsb;
- int16 xmin, ymin, xmax, ymax;
- int16 lsidebearing; /* only used when reading in a type1 font */
- /* Or an otf font where it is the subr number of a refered character */
- /* or a ttf font without bit 1 of head.flags set */
- /* or (once upon a time, but no longer) a ttf font with vert metrics where it is the ymax value when we had a font-wide vertical offset */
- /* Always a temporary value */
- int ttf_glyph; /* only used when writing out a ttf or otf font */
- Layer *layers; /* layer[0] is background, layer[1] foreground */
- /* In type3 fonts 2-n are also foreground, otherwise also background */
- int layer_cnt;
- StemInfo *hstem; /* hstem hints have a vertical offset but run horizontally */
- StemInfo *vstem; /* vstem hints have a horizontal offset but run vertically */
- DStemInfo *dstem; /* diagonal hints for ttf */
- MinimumDistance *md;
- struct charviewbase *views;
- struct charinfo *charinfo;
- struct splinefont *parent;
- unsigned int changed: 1;
- unsigned int changedsincelasthinted: 1;
- unsigned int manualhints: 1;
- unsigned int ticked: 1; /* For reference character processing */
- /* And fontview processing */
- unsigned int changed_since_autosave: 1;
- unsigned int widthset: 1; /* needed so an emspace char doesn't disappear */
- unsigned int vconflicts: 1; /* Any hint overlaps in the vstem list? */
- unsigned int hconflicts: 1; /* Any hint overlaps in the hstem list? */
- unsigned int searcherdummy: 1;
- unsigned int changed_since_search: 1;
- unsigned int wasopen: 1;
- unsigned int namechanged: 1;
- unsigned int blended: 1; /* An MM blended character */
- unsigned int ticked2: 1;
- unsigned int glyph_class: 3; /* 0=> fontforge determines class automagically, else one more than the class value in gdef so 2+1=>lig, 3+1=>mark */
- unsigned int numberpointsbackards: 1;
- unsigned int instructions_out_of_date: 1;
- unsigned int complained_about_ptnums: 1;
- unsigned int vs_open: 1;
- unsigned int unlink_rm_ovrlp_save_undo: 1;
- unsigned int inspiro: 1;
- unsigned int lig_caret_cnt_fixed: 1;
- /* 6 bits left (one more if we ignore compositionunit below) */
-#if HANYANG
- unsigned int compositionunit: 1;
- int16 jamo, varient;
-#endif
- struct splinecharlist { struct splinechar *sc; struct splinecharlist *next;} *dependents;
- /* The dependents list is a list of all characters which refenence*/
- /* the current character directly */
- KernPair *kerns;
- KernPair *vkerns;
- PST *possub; /* If we are a ligature then this tells us what */
- /* It may also contain a bunch of other stuff now */
- LigList *ligofme; /* If this is the first character of a ligature then this gives us the list of possible ones */
- /* this field must be regenerated before the font is saved */
- char *comment; /* in utf8 */
- uint32 /*Color*/ color;
- AnchorPoint *anchor;
- uint8 *ttf_instrs;
- int16 ttf_instrs_len;
- int16 countermask_cnt;
- HintMask *countermasks;
- struct altuni { struct altuni *next; int unienc, vs, fid; } *altuni;
- /* vs is the "variation selector" a unicode codepoint which modifieds */
- /* the code point before it. If vs is -1 then unienc is just an */
- /* alternate encoding (greek Alpha and latin A), but if vs is one */
- /* of unicode's variation selectors then this glyph is somehow a */
- /* variant shape. The specifics depend on the selector and script */
- /* fid is currently unused, but may, someday, be used to do ttcs */
- /* NOTE: GlyphInfo displays vs==-1 as vs==0, and fixes things up */
-/* for TeX */
- int16 tex_height, tex_depth;
-/* TeX also uses italic_correction and glyph variants below */
-/* For the 'MATH' table (and for TeX) */
- unsigned int is_extended_shape: 1;
- int16 italic_correction;
- int16 top_accent_horiz; /* MATH table allows you to specific a*/
- /* horizontal anchor for accent attachments, vertical */
- /* positioning is done elsewhere */
-#ifdef FONTFORGE_CONFIG_DEVICETABLES
- DeviceTable *italic_adjusts;
- DeviceTable *top_accent_adjusts;
-#endif
- struct glyphvariants *vert_variants;
- struct glyphvariants *horiz_variants;
- struct mathkern *mathkern;
-/* End of MATH/TeX fields */
-#ifndef _NO_PYTHON
- void *python_sc_object;
- void *python_temporary;
-#endif
- void *python_persistent; /* If python this will hold a python object, if not python this will hold a string containing a pickled object. We do nothing with it (if not python) except save it back out unchanged */
-#ifdef FONTFORGE_CONFIG_TYPE3
- /* If the glyph is used as a tile pattern, then the next two values */
- /* determine the amount of white space around the tile. If extra is*/
- /* non-zero then we add it to the max components of the bbox and */
- /* subtract it from the min components. If extra is 0 then tile_bounds*/
- /* will be used. If tile_bounds is all zeros then the glyph's bbox */
- /* will be used. */
- real tile_margin; /* If the glyph is used as a tile */
- DBounds tile_bounds;
-#endif
-} SplineChar;
-
-#define TEX_UNDEF 0x7fff
-
-enum ttfnames { ttf_copyright=0, ttf_family, ttf_subfamily, ttf_uniqueid,
- ttf_fullname, ttf_version, ttf_postscriptname, ttf_trademark,
- ttf_manufacturer, ttf_designer, ttf_descriptor, ttf_venderurl,
- ttf_designerurl, ttf_license, ttf_licenseurl, ttf_idontknow/*reserved*/,
- ttf_preffamilyname, ttf_prefmodifiers, ttf_compatfull, ttf_sampletext,
- ttf_cidfindfontname, ttf_wwsfamily, ttf_wwssubfamily, ttf_namemax };
-struct ttflangname {
- int lang;
- char *names[ttf_namemax]; /* in utf8 */
- int frommac[(ttf_namemax+31)/32]; /* Used when parsing the 'name' table */
- struct ttflangname *next;
-};
-
-#ifdef FONTFORGE_CONFIG_DEVICETABLES
-struct MATH {
-/* From the MATH Constants subtable (constants for positioning glyphs. Not PI)*/
- int16 ScriptPercentScaleDown;
- int16 ScriptScriptPercentScaleDown;
- uint16 DelimitedSubFormulaMinHeight;
- uint16 DisplayOperatorMinHeight;
- int16 MathLeading;
- DeviceTable *MathLeading_adjust;
- int16 AxisHeight;
- DeviceTable *AxisHeight_adjust;
- int16 AccentBaseHeight;
- DeviceTable *AccentBaseHeight_adjust;
- int16 FlattenedAccentBaseHeight;
- DeviceTable *FlattenedAccentBaseHeight_adjust;
- int16 SubscriptShiftDown;
- DeviceTable *SubscriptShiftDown_adjust;
- int16 SubscriptTopMax;
- DeviceTable *SubscriptTopMax_adjust;
- int16 SubscriptBaselineDropMin;
- DeviceTable *SubscriptBaselineDropMin_adjust;
- int16 SuperscriptShiftUp;
- DeviceTable *SuperscriptShiftUp_adjust;
- int16 SuperscriptShiftUpCramped;
- DeviceTable *SuperscriptShiftUpCramped_adjust;
- int16 SuperscriptBottomMin;
- DeviceTable *SuperscriptBottomMin_adjust;
- int16 SuperscriptBaselineDropMax;
- DeviceTable *SuperscriptBaselineDropMax_adjust;
- int16 SubSuperscriptGapMin;
- DeviceTable *SubSuperscriptGapMin_adjust;
- int16 SuperscriptBottomMaxWithSubscript;
- DeviceTable *SuperscriptBottomMaxWithSubscript_adjust;
- int16 SpaceAfterScript;
- DeviceTable *SpaceAfterScript_adjust;
- int16 UpperLimitGapMin;
- DeviceTable *UpperLimitGapMin_adjust;
- int16 UpperLimitBaselineRiseMin;
- DeviceTable *UpperLimitBaselineRiseMin_adjust;
- int16 LowerLimitGapMin;
- DeviceTable *LowerLimitGapMin_adjust;
- int16 LowerLimitBaselineDropMin;
- DeviceTable *LowerLimitBaselineDropMin_adjust;
- int16 StackTopShiftUp;
- DeviceTable *StackTopShiftUp_adjust;
- int16 StackTopDisplayStyleShiftUp;
- DeviceTable *StackTopDisplayStyleShiftUp_adjust;
- int16 StackBottomShiftDown;
- DeviceTable *StackBottomShiftDown_adjust;
- int16 StackBottomDisplayStyleShiftDown;
- DeviceTable *StackBottomDisplayStyleShiftDown_adjust;
- int16 StackGapMin;
- DeviceTable *StackGapMin_adjust;
- int16 StackDisplayStyleGapMin;
- DeviceTable *StackDisplayStyleGapMin_adjust;
- int16 StretchStackTopShiftUp;
- DeviceTable *StretchStackTopShiftUp_adjust;
- int16 StretchStackBottomShiftDown;
- DeviceTable *StretchStackBottomShiftDown_adjust;
- int16 StretchStackGapAboveMin;
- DeviceTable *StretchStackGapAboveMin_adjust;
- int16 StretchStackGapBelowMin;
- DeviceTable *StretchStackGapBelowMin_adjust;
- int16 FractionNumeratorShiftUp;
- DeviceTable *FractionNumeratorShiftUp_adjust;
- int16 FractionNumeratorDisplayStyleShiftUp;
- DeviceTable *FractionNumeratorDisplayStyleShiftUp_adjust;
- int16 FractionDenominatorShiftDown;
- DeviceTable *FractionDenominatorShiftDown_adjust;
- int16 FractionDenominatorDisplayStyleShiftDown;
- DeviceTable *FractionDenominatorDisplayStyleShiftDown_adjust;
- int16 FractionNumeratorGapMin;
- DeviceTable *FractionNumeratorGapMin_adjust;
- int16 FractionNumeratorDisplayStyleGapMin;
- DeviceTable *FractionNumeratorDisplayStyleGapMin_adjust;
- int16 FractionRuleThickness;
- DeviceTable *FractionRuleThickness_adjust;
- int16 FractionDenominatorGapMin;
- DeviceTable *FractionDenominatorGapMin_adjust;
- int16 FractionDenominatorDisplayStyleGapMin;
- DeviceTable *FractionDenominatorDisplayStyleGapMin_adjust;
- int16 SkewedFractionHorizontalGap;
- DeviceTable *SkewedFractionHorizontalGap_adjust;
- int16 SkewedFractionVerticalGap;
- DeviceTable *SkewedFractionVerticalGap_adjust;
- int16 OverbarVerticalGap;
- DeviceTable *OverbarVerticalGap_adjust;
- int16 OverbarRuleThickness;
- DeviceTable *OverbarRuleThickness_adjust;
- int16 OverbarExtraAscender;
- DeviceTable *OverbarExtraAscender_adjust;
- int16 UnderbarVerticalGap;
- DeviceTable *UnderbarVerticalGap_adjust;
- int16 UnderbarRuleThickness;
- DeviceTable *UnderbarRuleThickness_adjust;
- int16 UnderbarExtraDescender;
- DeviceTable *UnderbarExtraDescender_adjust;
- int16 RadicalVerticalGap;
- DeviceTable *RadicalVerticalGap_adjust;
- int16 RadicalDisplayStyleVerticalGap;
- DeviceTable *RadicalDisplayStyleVerticalGap_adjust;
- int16 RadicalRuleThickness;
- DeviceTable *RadicalRuleThickness_adjust;
- int16 RadicalExtraAscender;
- DeviceTable *RadicalExtraAscender_adjust;
- int16 RadicalKernBeforeDegree;
- DeviceTable *RadicalKernBeforeDegree_adjust;
- int16 RadicalKernAfterDegree;
- DeviceTable *RadicalKernAfterDegree_adjust;
- uint16 RadicalDegreeBottomRaisePercent;
-/* Global constants from other subtables */
- uint16 MinConnectorOverlap; /* in the math variants sub-table */
-};
-#else
-struct MATH {
-/* From the MATH Constants subtable (constants for positioning glyphs. Not PI)*/
- int16 ScriptPercentScaleDown;
- int16 ScriptScriptPercentScaleDown;
- uint16 DelimitedSubFormulaMinHeight;
- uint16 DisplayOperatorMinHeight;
- int16 MathLeading;
- int16 AxisHeight;
- int16 AccentBaseHeight;
- int16 FlattenedAccentBaseHeight;
- int16 SubscriptShiftDown;
- int16 SubscriptTopMax;
- int16 SubscriptBaselineDropMin;
- int16 SuperscriptShiftUp;
- int16 SuperscriptShiftUpCramped;
- int16 SuperscriptBottomMin;
- int16 SuperscriptBaselineDropMax;
- int16 SubSuperscriptGapMin;
- int16 SuperscriptBottomMaxWithSubscript;
- int16 SpaceAfterScript;
- int16 UpperLimitGapMin;
- int16 UpperLimitBaselineRiseMin;
- int16 LowerLimitGapMin;
- int16 LowerLimitBaselineDropMin;
- int16 StackTopShiftUp;
- int16 StackTopDisplayStyleShiftUp;
- int16 StackBottomShiftDown;
- int16 StackBottomDisplayStyleShiftDown;
- int16 StackGapMin;
- int16 StackDisplayStyleGapMin;
- int16 StretchStackTopShiftUp;
- int16 StretchStackBottomShiftDown;
- int16 StretchStackGapAboveMin;
- int16 StretchStackGapBelowMin;
- int16 FractionNumeratorShiftUp;
- int16 FractionNumeratorDisplayStyleShiftUp;
- int16 FractionDenominatorShiftDown;
- int16 FractionDenominatorDisplayStyleShiftDown;
- int16 FractionNumeratorGapMin;
- int16 FractionNumeratorDisplayStyleGapMin;
- int16 FractionRuleThickness;
- int16 FractionDenominatorGapMin;
- int16 FractionDenominatorDisplayStyleGapMin;
- int16 SkewedFractionHorizontalGap;
- int16 SkewedFractionVerticalGap;
- int16 OverbarVerticalGap;
- int16 OverbarRuleThickness;
- int16 OverbarExtraAscender;
- int16 UnderbarVerticalGap;
- int16 UnderbarRuleThickness;
- int16 UnderbarExtraDescender;
- int16 RadicalVerticalGap;
- int16 RadicalDisplayStyleVerticalGap;
- int16 RadicalRuleThickness;
- int16 RadicalExtraAscender;
- int16 RadicalKernBeforeDegree;
- int16 RadicalKernAfterDegree;
- uint16 RadicalDegreeBottomRaisePercent;
-/* Global constants from other subtables */
- uint16 MinConnectorOverlap; /* in the math variants sub-table */
-};
-#endif
-
-enum backedup_state { bs_dontknow=0, bs_not=1, bs_backedup=2 };
-enum loadvalidation_state {
- lvs_bad_ps_fontname = 0x001,
- lvs_bad_glyph_table = 0x002,
- lvs_bad_cff_table = 0x004,
- lvs_bad_metrics_table = 0x008,
- lvs_bad_cmap_table = 0x010,
- lvs_bad_bitmaps_table = 0x020,
- lvs_bad_gx_table = 0x040,
- lvs_bad_ot_table = 0x080,
- lvs_bad_os2_version = 0x100,
- lvs_bad_sfnt_header = 0x200
- };
-
-typedef struct layerinfo {
- char *name;
- unsigned int background: 1; /* Layer is to be treated as background: No width, images, not worth outputting */
- unsigned int order2: 1; /* Layer's data are order 2 bezier splines (truetype) rather than order 3 (postscript) */
- /* In all glyphs in the font */
- unsigned int ticked: 1;
-} LayerInfo;
-
-/* Baseline data from the 'BASE' table */
-struct baselangextent {
- uint32 lang; /* also used for feature tag */
- struct baselangextent *next;
- int16 ascent, descent;
- struct baselangextent *features;
-};
-
-struct basescript {
- uint32 script;
- struct basescript *next;
- int def_baseline; /* index [0-baseline_cnt) */
- int16 *baseline_pos; /* baseline_cnt of these */
- struct baselangextent *langs; /* Language specific extents (may be NULL) */
- /* The default one has the tag DEFAULT_LANG */
-};
-
-struct Base {
- int baseline_cnt;
- uint32 *baseline_tags;
- /* A font does not need to provide info on all baselines, but if one script */
- /* talks about a baseline, then all must. So the set of baselines is global*/
- struct basescript *scripts;
-};
-
-typedef struct splinefont {
- char *fontname, *fullname, *familyname, *weight;
- char *copyright;
- char *filename; /* sfd name. NULL if we open a font, that's origname */
- char *defbasefilename;
- char *version;
- real italicangle, upos, uwidth; /* In font info */
- int units_per_em;
- struct splinefont *next;
- int ascent, descent;
- int uniqueid; /* Not copied when reading in!!!! */
- int glyphcnt, glyphmax,glyphmin; /* allocated size of glyphs array */
- SplineChar **glyphs;
- unsigned int changed: 1;
- unsigned int changed_since_autosave: 1;
- unsigned int changed_since_xuidchanged: 1;
- unsigned int display_antialias: 1;
- unsigned int display_bbsized: 1;
- unsigned int dotlesswarn: 1; /* User warned that font doesn't have a dotless i character */
- unsigned int onlybitmaps: 1; /* it's a bdf editor, not a postscript editor */
- unsigned int serifcheck: 1; /* Have we checked to see if we have serifs? */
- unsigned int issans: 1; /* We have no serifs */
- unsigned int isserif: 1; /* We have serifs. If neither set then we don't know. */
- unsigned int hasvmetrics: 1; /* We've got vertical metric data and should output vhea/vmtx/VORG tables */
- unsigned int loading_cid_map: 1;
- unsigned int dupnamewarn: 1; /* Warn about duplicate names when loading bdf font */
- unsigned int encodingchanged: 1; /* Font's encoding has changed since it was loaded */
- unsigned int multilayer: 1; /* only applies if TYPE3 is set, means this font can contain strokes & fills */
- /* I leave it in so as to avoid cluttering up code with #ifdefs */
- unsigned int strokedfont: 1;
- unsigned int new: 1; /* A new and unsaved font */
- unsigned int compacted: 1; /* only used when opening a font */
- unsigned int backedup: 2; /* 0=>don't know, 1=>no, 2=>yes */
- unsigned int use_typo_metrics: 1; /* The standard says to. But MS */
- /* seems to feel that isn't good */
- /* enough and has created a bit */
- /* to mean "really use them" */
- unsigned int weight_width_slope_only: 1; /* This bit seems stupid to me */
- unsigned int save_to_dir: 1; /* Loaded from an sfdir collection rather than a simple sfd file */
- unsigned int head_optimized_for_cleartype: 1;/* Bit in the 'head' flags field, if unset "East Asian fonts in the Windows Presentation Framework (Avalon) will not be hinted" */
- unsigned int ticked: 1;
- unsigned int internal_temp: 1; /* Internal temporary font to be passed to freetype for rasterizing. Don't complain about oddities */
- unsigned int complained_about_spiros: 1;
- unsigned int use_xuid: 1; /* Adobe has deprecated these two */
- unsigned int use_uniqueid: 1; /* fields. Mostly we don't want to use them */
- /* 2 bits left */
- struct fontviewbase *fv;
- struct metricsview *metrics;
- enum uni_interp uni_interp;
- NameList *for_new_glyphs;
- EncMap *map; /* only used when opening a font to provide original default encoding */
- Layer grid;
- BDFFont *bitmaps;
- char *origname; /* filename of font file (ie. if not an sfd) */
- char *autosavename;
- int display_size; /* a val <0 => Generate our own images from splines, a value >0 => find a bdf font of that size */
- struct psdict *private; /* read in from type1 file or provided by user */
- char *xuid;
- struct pfminfo { /* A misnomer now. OS/2 info would be more accurate, but that's stuff in here from all over ttf files */
- unsigned int pfmset: 1;
- unsigned int winascent_add: 1;
- unsigned int windescent_add: 1;
- unsigned int hheadascent_add: 1;
- unsigned int hheaddescent_add: 1;
- unsigned int typoascent_add: 1;
- unsigned int typodescent_add: 1;
- unsigned int subsuper_set: 1;
- unsigned int panose_set: 1;
- unsigned int hheadset: 1;
- unsigned int vheadset: 1;
- unsigned int hascodepages: 1;
- unsigned int hasunicoderanges: 1;
- unsigned char pfmfamily;
- int16 weight;
- int16 width;
- char panose[10];
- int16 fstype;
- int16 linegap; /* from hhea */
- int16 vlinegap; /* from vhea */
- int16 hhead_ascent, hhead_descent;
- int16 os2_typoascent, os2_typodescent, os2_typolinegap;
- int16 os2_winascent, os2_windescent;
- int16 os2_subxsize, os2_subysize, os2_subxoff, os2_subyoff;
- int16 os2_supxsize, os2_supysize, os2_supxoff, os2_supyoff;
- int16 os2_strikeysize, os2_strikeypos;
- char os2_vendor[4];
- int16 os2_family_class;
- uint32 codepages[2];
- uint32 unicoderanges[4];
- uint16 avgwidth;
- uint16 firstchar;
- uint16 lastchar;
- int16 os2_xheight;
- int16 os2_capheight;
- uint16 os2_defaultchar;
- uint16 os2_breakchar;
- } pfminfo;
- struct ttflangname *names;
- char *cidregistry, *ordering;
- int supplement;
- int subfontcnt;
- struct splinefont **subfonts;
- struct splinefont *cidmaster; /* Top level cid font */
- float cidversion;
-#if HANYANG
- struct compositionrules *rules;
-#endif
- char *comments; /* Used to be restricted to ASCII, now utf8 */
- char *fontlog;
- int tempuniqueid;
- int top_enc;
- uint16 desired_row_cnt, desired_col_cnt;
- struct glyphnamehash *glyphnames;
- struct ttf_table {
- uint32 tag;
- int32 len, maxlen;
- uint8 *data;
- struct ttf_table *next;
- FILE *temp; /* Temporary storage used during generation */
- } *ttf_tables, *ttf_tab_saved;
- /* We copy: fpgm, prep, cvt, maxp (into ttf_tables) user can ask for others, into saved*/
- char **cvt_names;
- /* The end of this array is marked by a special entry: */
-#define END_CVT_NAMES ((char *) (~(intpt) 0))
- struct instrdata *instr_dlgs; /* Pointer to all table and character instruction dlgs in this font */
- struct shortview *cvt_dlg;
- struct kernclasslistdlg *kcld, *vkcld;
- struct kernclassdlg *kcd;
- struct texdata {
- enum { tex_unset, tex_text, tex_math, tex_mathext } type;
- int32 params[22]; /* param[6] has different meanings in normal and math fonts */
- } texdata;
- OTLookup *gsub_lookups, *gpos_lookups;
- AnchorClass *anchor;
- KernClass *kerns, *vkerns;
- FPST *possub;
- char *chosenname; /* Set for files with multiple fonts in them */
- struct mmset *mm; /* If part of a multiple master set */
- int16 macstyle;
- char *fondname; /* For use in generating mac families */
- /* from the GPOS 'size' feature. design_size, etc. are measured in tenths of a point */
- /* bottom is exclusive, top is inclusive */
- /* if any field is 0, it is undefined. All may be undefined, All may be */
- /* defined, or design_size may be defined without any of the others */
- /* but we can't define the range without defining the other junk */
- /* Name must contain an English language name, may contain others */
- uint16 design_size;
- uint16 fontstyle_id;
- struct otfname *fontstyle_name;
- uint16 design_range_bottom, design_range_top;
- real strokewidth;
-/* For GDEF Mark Attachment Class -- used in lookup flags */
-/* As usual, class 0 is unused */
- int mark_class_cnt;
- char **mark_classes; /* glyph name list */
- char **mark_class_names; /* used within ff, utf8 (the name we've given to this class of marks) */
-#ifdef _HAS_LONGLONG
- long long creationtime; /* seconds since 1970 */
- long long modificationtime;
-#else
- long creationtime;
- long modificationtime;
-#endif
- short os2_version; /* 0 means default rather than the real version 0 */
- short compression; /* If we opened a compressed sfd file, then save it out compressed too */
- short gasp_version; /* 0/1 currently */
- short gasp_cnt;
- struct gasp {
- uint16 ppem;
- uint16 flags;
- } *gasp;
- struct MATH *MATH;
- float sfd_version; /* Used only when reading in an sfd file */
- struct gfi_data *fontinfo;
- struct val_data *valwin;
- void *python_temporary;
- void *python_persistent; /* If python this will hold a python object, if not python this will hold a string containing a pickled object. We do nothing with it (if not python) except save it back out unchanged */
- enum loadvalidation_state loadvalidation_state;
- LayerInfo *layers;
- int layer_cnt;
- int display_layer;
- struct Base *horiz_base, *vert_base;
- int extrema_bound; /* Splines do not count for extrema complaints when the distance between the endpoints is less than or equal to this */
-} SplineFont;
-
-/* I am going to simplify my life and not encourage intermediate designs */
-/* this means I can easily calculate ConvertDesignVector, and don't have */
-/* to bother the user with specifying it. */
-/* (NormalizeDesignVector is fairly basic and shouldn't need user help ever) */
-/* (As long as they want piecewise linear) */
-typedef struct mmset {
- int axis_count;
- char *axes[4];
- int instance_count;
- SplineFont **instances;
- SplineFont *normal;
- real *positions; /* array[instance][axis] saying where each instance lies on each axis */
- real *defweights; /* array[instance] saying how much of each instance makes the normal font */
- struct axismap {
- int points; /* size of the next two arrays */
- real *blends; /* between [0,1] ordered so that blend[0]<blend[1]<... */
- real *designs; /* between the design ranges for this axis, typically [1,999] or [6,72] */
- real min, def, max; /* For mac */
- } *axismaps; /* array[axis] */
- char *cdv, *ndv; /* for adobe */
- unsigned int changed: 1;
-} MMSet;
-
-/* mac styles. Useful idea we'll just steal it */
-enum style_flags { sf_bold = 1, sf_italic = 2, sf_underline = 4, sf_outline = 8,
- sf_shadow = 0x10, sf_condense = 0x20, sf_extend = 0x40 };
-
-struct sflist {
- SplineFont *sf;
- int32 *sizes;
- FILE *tempttf; /* For ttf */
- int id; /* For ttf */
- int* ids; /* One for each size */
- BDFFont **bdfs; /* Ditto */
- EncMap *map;
- struct sflist *next;
- char **former_names;
-};
-
- /* Used for drawing text with mark to base anchors */
-typedef struct anchorpos {
- SplineChar *sc; /* This is the mark being positioned */
- int x,y; /* Its origin should be shifted this much relative to that of the original base char */
- AnchorPoint *apm; /* The anchor point in sc used to position it */
- AnchorPoint *apb; /* The anchor point in the base character against which we are positioned */
- int base_index; /* Index in this array to the base character (-1=> original base char) */
- unsigned int ticked: 1; /* Used as a mark to mark */
-} AnchorPos;
-
-enum ttf_flags { ttf_flag_shortps = 1, ttf_flag_nohints = 2,
- ttf_flag_applemode=4,
- ttf_flag_pfed_comments=8, ttf_flag_pfed_colors=0x10,
- ttf_flag_otmode=0x20,
- ttf_flag_glyphmap=0x40,
- ttf_flag_TeXtable=0x80,
- ttf_flag_ofm=0x100,
- ttf_flag_oldkern=0x200, /* never set in conjunction with applemode */
- ttf_flag_brokensize=0x400, /* Adobe originally issued fonts with a bug in the size feature. They now claim (Aug 2006) that this has been fixed. Legacy programs will do the wrong thing with the fixed feature though */
- ttf_flag_pfed_lookupnames=0x800,
- ttf_flag_pfed_guides=0x1000,
- ttf_flag_pfed_layers=0x2000,
- ttf_flag_symbol=0x4000,
- ttf_flag_dummyDSIG=0x8000
- };
-enum openflags { of_fstypepermitted=1, of_askcmap=2, of_all_glyphs_in_ttc=4,
- of_fontlint=8, of_hidewindow=0x10 };
-enum ps_flags { ps_flag_nohintsubs = 0x10000, ps_flag_noflex=0x20000,
- ps_flag_nohints = 0x40000, ps_flag_restrict256=0x80000,
- ps_flag_afm = 0x100000, ps_flag_pfm = 0x200000,
- ps_flag_tfm = 0x400000,
- ps_flag_round = 0x800000,
-/* CFF fonts are wrapped up in some postscript sugar -- unless they are to */
-/* go into a pdf file or an otf font */
- ps_flag_nocffsugar = 0x1000000,
-/* in type42 cid fonts we sometimes want an identity map from gid to cid */
- ps_flag_identitycidmap = 0x2000000,
- ps_flag_afmwithmarks = 0x4000000,
- ps_flag_noseac = 0x8000000,
- ps_flag_outputfontlog = 0x10000000,
- ps_flag_mask = (ps_flag_nohintsubs|ps_flag_noflex|
- ps_flag_afm|ps_flag_pfm|ps_flag_tfm|ps_flag_round)
- };
-
-struct compressors { char *ext, *decomp, *recomp; };
-struct archivers {
- char *ext, *unarchive, *archive, *listargs, *extractargs, *appendargs;
- enum archive_list_style { ars_tar, ars_zip } ars;
-};
-
-struct fontdict;
-struct pschars;
-struct findsel;
-struct charprocs;
-struct enc;
-
-/* extern void *chunkalloc(int size); */
-/* extern void chunkfree(void *, int size); */
-
-#define chunkalloc(size) gcalloc(1,size)
-#define chunkfree(item,size) free(item)
-
-extern char *strconcat(const char *str, const char *str2);
-extern char *strconcat3(const char *str, const char *str2, const char *str3);
-
-extern char *XUIDFromFD(int xuid[20]);
-extern SplineFont *SplineFontFromPSFont(struct fontdict *fd);
-extern int CheckAfmOfPostscript(SplineFont *sf, const char *psname,EncMap *map);
-extern int LoadKerningDataFromAmfm(SplineFont *sf, char *filename, EncMap *map);
-extern int LoadKerningDataFromAfm(SplineFont *sf, char *filename, EncMap *map);
-extern int LoadKerningDataFromTfm(SplineFont *sf, char *filename, EncMap *map);
-extern int LoadKerningDataFromOfm(SplineFont *sf, char *filename, EncMap *map);
-extern int LoadKerningDataFromPfm(SplineFont *sf, char *filename, EncMap *map);
-extern int LoadKerningDataFromMacFOND(SplineFont *sf, char *filename, EncMap *map);
-extern int LoadKerningDataFromMetricsFile(SplineFont *sf, char *filename, EncMap *map);
-extern void FeatDumpFontLookups(FILE *out,SplineFont *sf);
-extern void FeatDumpOneLookup(FILE *out,SplineFont *sf, OTLookup *otl);
-extern void SFApplyFeatureFile(SplineFont *sf,FILE *file,char *filename);
-extern void SFApplyFeatureFilename(SplineFont *sf,char *filename);
-extern void SubsNew(SplineChar *to,enum possub_type type,int tag,char *components,
- SplineChar *default_script);
-extern void PosNew(SplineChar *to,int tag,int dx, int dy, int dh, int dv);
-extern int SFOneWidth(SplineFont *sf);
-extern int CIDOneWidth(SplineFont *sf);
-extern int SFOneHeight(SplineFont *sf);
-extern int SFIsCJK(SplineFont *sf,EncMap *map);
-extern void CIDMasterAsDes(SplineFont *sf);
-enum fontformat { ff_pfa, ff_pfb, ff_pfbmacbin, ff_multiple, ff_mma, ff_mmb,
- ff_ptype3, ff_ptype0, ff_cid, ff_cff, ff_cffcid,
- ff_type42, ff_type42cid,
- ff_ttf, ff_ttfsym, ff_ttfmacbin, ff_ttfdfont, ff_otf, ff_otfdfont,
- ff_otfcid, ff_otfciddfont, ff_svg, ff_ufo, ff_none };
-extern struct pschars *SplineFont2ChrsSubrs(SplineFont *sf, int iscjk,
- struct pschars *subrs,int flags,enum fontformat format,int layer);
-extern int CanonicalCombiner(int uni);
-struct cidbytes;
-struct fd2data;
-struct ttfinfo;
-struct alltabs;
-struct growbuf;
-struct glyphdata;
-extern int UnitsParallel(BasePoint *u1,BasePoint *u2,int strict);
-extern int CvtPsStem3(struct growbuf *gb, SplineChar *scs[MmMax], int instance_count,
- int ishstem, int round);
-extern struct pschars *SplineFont2ChrsSubrs2(SplineFont *sf, int nomwid,
- int defwid, const int *bygid, int cnt, int flags,
- struct pschars **_subrs,int layer);
-extern struct pschars *CID2ChrsSubrs2(SplineFont *cidmaster,struct fd2data *fds,
- int flags, struct pschars **_glbls,int layer);
-enum bitmapformat { bf_bdf, bf_ttf, bf_sfnt_dfont, bf_sfnt_ms, bf_otb,
- bf_nfntmacbin, /*bf_nfntdfont, */bf_fon, bf_fnt, bf_palm,
- bf_ptype3,
- bf_none };
-extern const char *GetAuthor(void);
-extern SplineChar *SFFindExistingCharMac(SplineFont *,EncMap *map, int unienc);
-extern void SC_PSDump(void (*dumpchar)(int ch,void *data), void *data,
- SplineChar *sc, int refs_to_splines, int pdfopers,int layer );
-extern int _WritePSFont(FILE *out,SplineFont *sf,enum fontformat format,int flags,EncMap *enc,SplineFont *fullsf,int layer);
-extern int WritePSFont(char *fontname,SplineFont *sf,enum fontformat format,int flags,EncMap *enc,SplineFont *fullsf,int layer);
-extern int WriteMacPSFont(char *fontname,SplineFont *sf,enum fontformat format,
- int flags,EncMap *enc,int layer);
-extern int _WriteTTFFont(FILE *ttf,SplineFont *sf, enum fontformat format,
- int32 *bsizes, enum bitmapformat bf,int flags,EncMap *enc,int layer);
-extern int WriteTTFFont(char *fontname,SplineFont *sf, enum fontformat format,
- int32 *bsizes, enum bitmapformat bf,int flags,EncMap *enc,int layer);
-extern int _WriteType42SFNTS(FILE *type42,SplineFont *sf,enum fontformat format,
- int flags,EncMap *enc,int layer);
-extern int WriteMacTTFFont(char *fontname,SplineFont *sf, enum fontformat format,
- int32 *bsizes, enum bitmapformat bf,int flags,EncMap *enc,int layer);
-extern int WriteMacBitmaps(char *filename,SplineFont *sf, int32 *sizes,
- int is_dfont,EncMap *enc);
-extern int WritePalmBitmaps(char *filename,SplineFont *sf, int32 *sizes,EncMap *enc);
-extern int WriteMacFamily(char *filename,struct sflist *sfs,enum fontformat format,
- enum bitmapformat bf,int flags,EncMap *enc,int layer);
-extern long mactime(void);
-extern int WriteSVGFont(char *fontname,SplineFont *sf,enum fontformat format,int flags,EncMap *enc,int layer);
-extern int WriteUFOFont(char *fontname,SplineFont *sf,enum fontformat format,int flags,EncMap *enc,int layer);
-extern void SfListFree(struct sflist *sfs);
-extern void DefaultTTFEnglishNames(struct ttflangname *dummy, SplineFont *sf);
-extern void TeXDefaultParams(SplineFont *sf);
-extern int AlreadyMSSymbolArea(SplineFont *sf,EncMap *map);
-extern void OS2FigureCodePages(SplineFont *sf, uint32 CodePage[2]);
-extern void OS2FigureUnicodeRanges(SplineFont *sf, uint32 Ranges[4]);
-extern void SFDefaultOS2Info(struct pfminfo *pfminfo,SplineFont *sf,char *fontname);
-extern void SFDefaultOS2Simple(struct pfminfo *pfminfo,SplineFont *sf);
-extern void SFDefaultOS2SubSuper(struct pfminfo *pfminfo,int emsize,double italicangle);
-extern void VerifyLanguages(SplineFont *sf);
-extern int ScriptIsRightToLeft(uint32 script);
-extern void ScriptMainRange(uint32 script, int *start, int *end);
-extern uint32 ScriptFromUnicode(int u,SplineFont *sf);
-extern uint32 SCScriptFromUnicode(SplineChar *sc);
-extern int SCRightToLeft(SplineChar *sc);
-extern int SLIContainsR2L(SplineFont *sf,int sli);
-extern void SFFindNearTop(SplineFont *);
-extern void SFRestoreNearTop(SplineFont *);
-extern int SFForceEncoding(SplineFont *sf,EncMap *old,Encoding *new_map);
-extern int CountOfEncoding(Encoding *encoding_name);
-extern void SFMatchGlyphs(SplineFont *sf,SplineFont *target,int addempties);
-extern void MMMatchGlyphs(MMSet *mm);
-extern char *_GetModifiers(char *fontname, char *familyname,char *weight);
-extern char *SFGetModifiers(SplineFont *sf);
-extern const unichar_t *_uGetModifiers(const unichar_t *fontname, const unichar_t *familyname,
- const unichar_t *weight);
-extern void SFSetFontName(SplineFont *sf, char *family, char *mods, char *full);
-extern void ttfdumpbitmap(SplineFont *sf,struct alltabs *at,int32 *sizes);
-extern void ttfdumpbitmapscaling(SplineFont *sf,struct alltabs *at,int32 *sizes);
-extern void SplineFontSetUnChanged(SplineFont *sf);
-
-extern int RealNear(real a,real b);
-extern int RealNearish(real a,real b);
-extern int RealApprox(real a,real b);
-extern int RealWithin(real a,real b,real fudge);
-extern int RealRatio(real a,real b,real fudge);
-
-extern int PointsDiagonalable(SplineFont *sf,BasePoint **bp,BasePoint *unit);
-extern int MergeDStemInfo(SplineFont *sf,DStemInfo **ds, DStemInfo *test);
-
-extern void LineListFree(LineList *ll);
-extern void LinearApproxFree(LinearApprox *la);
-extern void SplineFree(Spline *spline);
-extern SplinePoint *SplinePointCreate(real x, real y);
-extern void SplinePointFree(SplinePoint *sp);
-extern void SplinePointMDFree(SplineChar *sc,SplinePoint *sp);
-extern void SplinePointsFree(SplinePointList *spl);
-extern void SplinePointListFree(SplinePointList *spl);
-extern void SplinePointListMDFree(SplineChar *sc,SplinePointList *spl);
-extern void SplinePointListsMDFree(SplineChar *sc,SplinePointList *spl);
-extern void SplinePointListsFree(SplinePointList *head);
-extern void SplineSetBeziersClear(SplineSet *spl);
-extern void RefCharFree(RefChar *ref);
-extern void RefCharsFree(RefChar *ref);
-extern void RefCharsFreeRef(RefChar *ref);
-extern void CopyBufferFree(void);
-extern void CopyBufferClearCopiedFrom(SplineFont *dying);
-extern void UndoesFree(Undoes *undo);
-extern void StemInfosFree(StemInfo *h);
-extern void StemInfoFree(StemInfo *h);
-extern void DStemInfosFree(DStemInfo *h);
-extern void DStemInfoFree(DStemInfo *h);
-extern void KernPairsFree(KernPair *kp);
-extern void SCOrderAP(SplineChar *sc);
-extern void AnchorPointsFree(AnchorPoint *ap);
-extern AnchorPoint *AnchorPointsCopy(AnchorPoint *alist);
-extern void SFRemoveAnchorClass(SplineFont *sf,AnchorClass *an);
-extern int AnchorClassesNextMerge(AnchorClass *ac);
-extern int IsAnchorClassUsed(SplineChar *sc,AnchorClass *an);
-extern AnchorPoint *APAnchorClassMerge(AnchorPoint *anchors,AnchorClass *into,AnchorClass *from);
-extern void AnchorClassMerge(SplineFont *sf,AnchorClass *into,AnchorClass *from);
-extern void AnchorClassesFree(AnchorClass *kp);
-extern void TtfTablesFree(struct ttf_table *tab);
-extern void SFRemoveSavedTable(SplineFont *sf, uint32 tag);
-extern AnchorClass *AnchorClassMatch(SplineChar *sc1,SplineChar *sc2,
- AnchorClass *restrict_, AnchorPoint **_ap1,AnchorPoint **_ap2 );
-extern AnchorClass *AnchorClassMkMkMatch(SplineChar *sc1,SplineChar *sc2,
- AnchorPoint **_ap1,AnchorPoint **_ap2 );
-extern AnchorClass *AnchorClassCursMatch(SplineChar *sc1,SplineChar *sc2,
- AnchorPoint **_ap1,AnchorPoint **_ap2 );
-extern void SCInsertPST(SplineChar *sc,PST *new);
-#ifdef FONTFORGE_CONFIG_DEVICETABLES
-extern void ValDevFree(ValDevTab *adjust);
-extern ValDevTab *ValDevTabCopy(ValDevTab *orig);
-extern void DeviceTableFree(DeviceTable *adjust);
-extern DeviceTable *DeviceTableCopy(DeviceTable *orig);
-extern void DeviceTableSet(DeviceTable *adjust, int size, int correction);
-#endif
-extern void PSTFree(PST *lig);
-extern uint16 PSTDefaultFlags(enum possub_type type,SplineChar *sc );
-extern int PSTContains(const char *components,const char *name);
-extern StemInfo *StemInfoCopy(StemInfo *h);
-extern DStemInfo *DStemInfoCopy(DStemInfo *h);
-extern MinimumDistance *MinimumDistanceCopy(MinimumDistance *h);
-extern void SPChangePointType(SplinePoint *sp, int pointtype);
-struct sfmergecontext {
- SplineFont *sf_from, *sf_to;
- int lcnt;
- struct lookup_cvt { OTLookup *from, *to; int old;} *lks;
- int scnt;
- struct sub_cvt { struct lookup_subtable *from, *to; int old;} *subs;
- int acnt;
- struct ac_cvt { AnchorClass *from, *to; int old;} *acs;
- char *prefix;
- int preserveCrossFontKerning;
- int lmax;
-};
-extern PST *PSTCopy(PST *base,SplineChar *sc,struct sfmergecontext *mc);
-extern struct lookup_subtable *MCConvertSubtable(struct sfmergecontext *mc,struct lookup_subtable *sub);
-extern AnchorClass *MCConvertAnchorClass(struct sfmergecontext *mc,AnchorClass *ac);
-extern void SFFinishMergeContext(struct sfmergecontext *mc);
-extern SplineChar *SplineCharCopy(SplineChar *sc,SplineFont *into,struct sfmergecontext *);
-extern BDFChar *BDFCharCopy(BDFChar *bc);
-extern void BCFlattenFloat(BDFChar *bc);
-extern void BitmapsCopy(SplineFont *to, SplineFont *from, int to_index, int from_index );
-extern struct gimage *ImageAlterClut(struct gimage *image);
-extern void ImageListsFree(ImageList *imgs);
-extern void TTFLangNamesFree(struct ttflangname *l);
-extern void AltUniFree(struct altuni *altuni);
-extern void AltUniRemove(SplineChar *sc,int uni);
-extern void MinimumDistancesFree(MinimumDistance *md);
-extern void LayerDefault(Layer *);
-extern SplineChar *SplineCharCreate(int layer_cnt);
-extern SplineChar *SFSplineCharCreate(SplineFont *sf);
-extern RefChar *RefCharCreate(void);
-extern RefChar *RefCharsCopy(RefChar *ref); /* Still needs to be instanciated and have the dependency list adjusted */
-extern void SCAddRef(SplineChar *sc,SplineChar *rsc,int layer, real xoff, real yoff);
-extern void _SCAddRef(SplineChar *sc,SplineChar *rsc,int layer, real transform[6]);
-extern KernClass *KernClassCopy(KernClass *kc);
-extern void KernClassFreeContents(KernClass *kc);
-extern void KernClassListFree(KernClass *kc);
-extern int KernClassContains(KernClass *kc, char *name1, char *name2, int ordered );
-extern void OTLookupFree(OTLookup *lookup);
-extern void OTLookupListFree(OTLookup *lookup );
-extern FPST *FPSTCopy(FPST *fpst);
-extern void FPSTRuleContentsFree(struct fpst_rule *r, enum fpossub_format format);
-extern void FPSTRulesFree(struct fpst_rule *r, enum fpossub_format format, int rcnt);
-extern void FPSTFree(FPST *fpst);
-extern void GlyphVariantsFree(struct glyphvariants *gv);
-extern void MathKernVContentsFree(struct mathkernvertex *mk);
-extern void MathKernFree(struct mathkern *mk);
-extern struct mathkern *MathKernCopy(struct mathkern *mk);
-extern void SplineCharListsFree(struct splinecharlist *dlist);
-extern void LayerFreeContents(SplineChar *sc, int layer);
-extern void SplineCharFreeContents(SplineChar *sc);
-extern void SplineCharFree(SplineChar *sc);
-extern void EncMapFree(EncMap *map);
-extern EncMap *EncMapFromEncoding(SplineFont *sf,Encoding *enc);
-extern EncMap *CompactEncMap(EncMap *map, SplineFont *sf);
-extern EncMap *EncMapNew(int encmax, int backmax, Encoding *enc);
-extern EncMap *EncMap1to1(int enccount);
-extern EncMap *EncMapCopy(EncMap *map);
-extern void SFExpandGlyphCount(SplineFont *sf, int newcnt);
-extern void ScriptLangListFree(struct scriptlanglist *sl);
-extern void FeatureScriptLangListFree(FeatureScriptLangList *fl);
-extern void SFBaseSort(SplineFont *sf);
-extern struct baselangextent *BaseLangCopy(struct baselangextent *extent);
-extern void BaseLangFree(struct baselangextent *extent);
-extern void BaseScriptFree(struct basescript *bs);
-extern void BaseFree(struct Base *base);
-extern void SplineFontFree(SplineFont *sf);
-extern void MATHFree(struct MATH *math);
-extern struct MATH *MathTableNew(SplineFont *sf);
-extern void OtfNameListFree(struct otfname *on);
-extern void MarkClassFree(int cnt,char **classes,char **names);
-extern void MMSetFreeContents(MMSet *mm);
-extern void MMSetFree(MMSet *mm);
-extern void SFRemoveUndoes(SplineFont *sf,uint8 *selected,EncMap *map);
-extern void SplineRefigure3(Spline *spline);
-extern void SplineRefigure(Spline *spline);
-extern Spline *SplineMake3(SplinePoint *from, SplinePoint *to);
-extern LinearApprox *SplineApproximate(Spline *spline, real scale);
-extern int SplinePointListIsClockwise(const SplineSet *spl);
-extern void SplineSetFindBounds(const SplinePointList *spl, DBounds *bounds);
-extern void SplineCharLayerFindBounds(SplineChar *sc,int layer,DBounds *bounds);
-extern void SplineCharFindBounds(SplineChar *sc,DBounds *bounds);
-extern void SplineFontLayerFindBounds(SplineFont *sf,int layer,DBounds *bounds);
-extern void SplineFontFindBounds(SplineFont *sf,DBounds *bounds);
-extern void CIDLayerFindBounds(SplineFont *sf,int layer,DBounds *bounds);
-extern void SplineSetQuickBounds(SplineSet *ss,DBounds *b);
-extern void SplineCharQuickBounds(SplineChar *sc, DBounds *b);
-extern void SplineSetQuickConservativeBounds(SplineSet *ss,DBounds *b);
-extern void SplineCharQuickConservativeBounds(SplineChar *sc, DBounds *b);
-extern void SplineFontQuickConservativeBounds(SplineFont *sf,DBounds *b);
-extern void SplinePointCatagorize(SplinePoint *sp);
-extern int SplinePointIsACorner(SplinePoint *sp);
-extern void SPLCatagorizePoints(SplinePointList *spl);
-extern void SCCatagorizePoints(SplineChar *sc);
-extern SplinePointList *SplinePointListCopy1(const SplinePointList *spl);
-extern SplinePointList *SplinePointListCopy(const SplinePointList *base);
-extern SplinePointList *SplinePointListCopySelected(SplinePointList *base);
-extern ImageList *ImageListCopy(ImageList *cimg);
-extern ImageList *ImageListTransform(ImageList *cimg,real transform[6]);
-extern void ApTransform(AnchorPoint *ap, real transform[6]);
-extern SplinePointList *SplinePointListTransform(SplinePointList *base, real transform[6], int allpoints );
-extern SplinePointList *SplinePointListShift(SplinePointList *base, real xoff, int allpoints );
-extern HintMask *HintMaskFromTransformedRef(RefChar *ref,BasePoint *trans,
- SplineChar *basesc,HintMask *hm);
-extern SplinePointList *SPLCopyTranslatedHintMasks(SplinePointList *base,
- SplineChar *basesc, SplineChar *subsc, BasePoint *trans);
-extern SplinePointList *SPLCopyTransformedHintMasks(RefChar *r,
- SplineChar *basesc, BasePoint *trans,int layer);
-extern SplinePointList *SplinePointListRemoveSelected(SplineChar *sc,SplinePointList *base);
-extern void SplinePointListSet(SplinePointList *tobase, SplinePointList *frombase);
-extern void SplinePointListSelect(SplinePointList *spl,int sel);
-extern void SCRefToSplines(SplineChar *sc,RefChar *rf,int layer);
-extern void RefCharFindBounds(RefChar *rf);
-extern void SCReinstanciateRefChar(SplineChar *sc,RefChar *rf,int layer);
-extern void SCReinstanciateRef(SplineChar *sc,SplineChar *rsc,int layer);
-extern void SFReinstanciateRefs(SplineFont *sf);
-extern void SFInstanciateRefs(SplineFont *sf);
-extern SplineChar *MakeDupRef(SplineChar *base, int local_enc, int uni_enc);
-extern void SCRemoveDependent(SplineChar *dependent,RefChar *rf,int layer);
-extern void SCRemoveLayerDependents(SplineChar *dependent,int layer);
-extern void SCRemoveDependents(SplineChar *dependent);
-extern int SCDependsOnSC(SplineChar *parent, SplineChar *child);
-extern void BCCompressBitmap(BDFChar *bdfc);
-extern void BCRegularizeBitmap(BDFChar *bdfc);
-extern void BCRegularizeGreymap(BDFChar *bdfc);
-extern void BCPasteInto(BDFChar *bc,BDFChar *rbc,int ixoff,int iyoff, int invert, int cleartoo);
-extern void BCRotateCharForVert(BDFChar *bc,BDFChar *from, BDFFont *frombdf);
-extern int GradientHere(double scale,DBounds *bbox,int iy,int ix,
- struct gradient *grad,struct pattern *pat, int defgrey);
-extern void PatternPrep(SplineChar *sc,struct brush *brush,double scale);
-extern BDFChar *SplineCharRasterize(SplineChar *sc, int layer, double pixelsize);
-extern BDFFont *SplineFontToBDFHeader(SplineFont *_sf, int pixelsize, int indicate);
-extern BDFFont *SplineFontRasterize(SplineFont *sf, int layer, int pixelsize, int indicate);
-extern void BDFCAntiAlias(BDFChar *bc, int linear_scale);
-extern BDFChar *SplineCharAntiAlias(SplineChar *sc, int layer, int pixelsize,int linear_scale);
-extern BDFFont *SplineFontAntiAlias(SplineFont *sf, int layer, int pixelsize,int linear_scale);
-extern struct clut *_BDFClut(int linear_scale);
-extern void BDFClut(BDFFont *bdf, int linear_scale);
-extern int BDFDepth(BDFFont *bdf);
-extern BDFChar *BDFPieceMeal(BDFFont *bdf, int index);
-extern BDFChar *BDFPieceMealCheck(BDFFont *bdf, int index);
-enum piecemeal_flags { pf_antialias=1, pf_bbsized=2, pf_ft_nohints=4 };
-extern BDFFont *SplineFontPieceMeal(SplineFont *sf,int layer,int pixelsize,int flags,void *freetype_context);
-extern void BDFCharFindBounds(BDFChar *bc,IBounds *bb);
-extern BDFFont *BitmapFontScaleTo(BDFFont *old, int to);
-extern void BDFCharFree(BDFChar *bdfc);
-extern void BDFPropsFree(BDFFont *bdf);
-extern void BDFFontFree(BDFFont *bdf);
-extern void SFDefaultAscent(SplineFont *sf);
-extern int PSBitmapDump(char *filename,BDFFont *font, EncMap *map);
-extern int BDFFontDump(char *filename,BDFFont *font, EncMap *map, int res);
-extern int FNTFontDump(char *filename,BDFFont *font, EncMap *map, int res);
-extern int FONFontDump(char *filename,SplineFont *sf, int32 *sizes,int res,
- EncMap *map);
-extern void SFReplaceEncodingBDFProps(SplineFont *sf,EncMap *map);
-extern void SFReplaceFontnameBDFProps(SplineFont *sf);
-extern int IsUnsignedBDFKey(char *key);
-extern int BdfPropHasInt(BDFFont *font,const char *key, int def );
-extern char *BdfPropHasString(BDFFont *font,const char *key, char *def );
-extern void def_Charset_Enc(EncMap *map,char *reg,char *enc);
-extern void Default_XLFD(BDFFont *bdf,EncMap *map, int res);
-extern void Default_Properties(BDFFont *bdf,EncMap *map,char *onlyme);
-extern void BDFDefaultProps(BDFFont *bdf, EncMap *map, int res);
-extern BDFProperties *BdfPropsCopy(BDFProperties *props, int cnt );
-struct xlfd_components {
- char foundry[80];
- char family[100];
- char weight[80];
- char slant[40];
- char setwidth[50];
- char add_style[50];
- int pixel_size;
- int point_size;
- int res_x;
- int res_y;
- char spacing[40];
- int avg_width;
- char cs_reg[80]; /* encoding */
- char cs_enc[80]; /* encoding version? */
- int char_cnt;
-};
-struct std_bdf_props {
- char *name;
- int type;
- int defaultable;
-};
-extern void XLFD_GetComponents(char *xlfd,struct xlfd_components *comp);
-extern void XLFD_CreateComponents(BDFFont *bdf,EncMap *map,int res,struct xlfd_components *comp);
-/* Two lines intersect in at most 1 point */
-/* Two quadratics intersect in at most 4 points */
-/* Two cubics intersect in at most 9 points */ /* Plus an extra space for a trailing -1 */
-extern int SplinesIntersect(const Spline *s1, const Spline *s2, BasePoint pts[9],
- extended t1s[10], extended t2s[10]);
-extern SplineSet *LayerAllSplines(Layer *layer);
-extern SplineSet *LayerUnAllSplines(Layer *layer);
-extern int SplineSetIntersect(SplineSet *spl, Spline **_spline, Spline **_spline2 );
-extern int LineTangentToSplineThroughPt(Spline *s, BasePoint *pt, extended ts[4],
- extended tmin, extended tmax);
-extern int CubicSolve(const Spline1D *sp,extended ts[3]);
-extern extended IterateSplineSolve(const Spline1D *sp, extended tmin, extended tmax, extended sought_y, double err);
-extern extended SplineSolve(const Spline1D *sp, real tmin, real tmax, extended sought_y, real err);
-extern int SplineSolveFull(const Spline1D *sp,extended val, extended ts[3]);
-extern void SplineFindExtrema(const Spline1D *sp, extended *_t1, extended *_t2 );
-
-SplineSet *SplineSetsInterpolate(SplineSet *base, SplineSet *other, real amount, SplineChar *sc);
-SplineChar *SplineCharInterpolate(SplineChar *base, SplineChar *other, real amount);
-extern SplineFont *InterpolateFont(SplineFont *base, SplineFont *other, real amount, Encoding *enc);
-
-double SFSerifHeight(SplineFont *sf);
-
-extern void DumpPfaEditEncodings(void);
-extern void ParseEncodingFile(char *filename);
-extern void LoadPfaEditEncodings(void);
-
-extern int GenerateScript(SplineFont *sf,char *filename,char *bitmaptype,
- int fmflags,int res, char *subfontdirectory,struct sflist *sfs,
- EncMap *map,NameList *rename_to,int layer);
-
-extern void _SCAutoTrace(SplineChar *sc, int layer, char **args);
-extern char **AutoTraceArgs(int ask);
-
-#define CURVATURE_ERROR -1e9
-extern double SplineCurvature(Spline *s, double t);
-
-#ifndef EXTENDED_IS_LONG_DOUBLE
-extern double CheckExtremaForSingleBitErrors(const Spline1D *sp, double t);
-#define esqrt(d) sqrt(d)
-#else
-extern extended esqrt(extended e);
-#endif
-extern int Spline2DFindExtrema(const Spline *sp, extended extrema[4] );
-extern int Spline2DFindPointsOfInflection(const Spline *sp, extended poi[2] );
-extern int SplineAtInflection(Spline1D *sp, double t );
-extern int SplineAtMinMax(Spline1D *sp, double t );
-extern void SplineRemoveExtremaTooClose(Spline1D *sp, extended *_t1, extended *_t2 );
-extern int NearSpline(struct findsel *fs, Spline *spline);
-extern real SplineNearPoint(Spline *spline, BasePoint *bp, real fudge);
-extern void SCMakeDependent(SplineChar *dependent,SplineChar *base);
-extern SplinePoint *SplineBisect(Spline *spline, extended t);
-extern Spline *SplineSplit(Spline *spline, extended ts[3]);
-extern Spline *ApproximateSplineFromPoints(SplinePoint *from, SplinePoint *to,
- TPoint *mid, int cnt,int order2);
-extern Spline *ApproximateSplineFromPointsSlopes(SplinePoint *from, SplinePoint *to,
- TPoint *mid, int cnt,int order2);
-extern double SplineLength(Spline *spline);
-extern double SplineLengthRange(Spline *spline, real from_t, real to_t);
-extern double PathLength(SplineSet *ss);
-extern Spline *PathFindDistance(SplineSet *path,double d,double *_t);
-extern SplineSet *SplineSetBindToPath(SplineSet *ss,int doscale, int glyph_as_unit,
- int align,real offset, SplineSet *path);
-extern int SplineIsLinear(Spline *spline);
-extern int SplineIsLinearMake(Spline *spline);
-extern int SSPointWithin(SplineSet *spl,BasePoint *pt);
-extern SplineSet *SSRemoveZeroLengthSplines(SplineSet *base);
-extern void SSRemoveStupidControlPoints(SplineSet *base);
-extern void SSOverlapClusterCpAngles(SplineSet *base,double within);
-extern void SplinesRemoveBetween(SplineChar *sc, SplinePoint *from, SplinePoint *to,int type);
-extern void SplineCharMerge(SplineChar *sc,SplineSet **head,int type);
-extern void SPLNearlyHvCps(SplineChar *sc,SplineSet *ss,double err);
-extern void SPLNearlyHvLines(SplineChar *sc,SplineSet *ss,double err);
-extern int SPLNearlyLines(SplineChar *sc,SplineSet *ss,double err);
-extern int SPInterpolate(SplinePoint *sp);
-extern void SplinePointListSimplify(SplineChar *sc,SplinePointList *spl,
- struct simplifyinfo *smpl);
-extern SplineSet *SplineCharSimplify(SplineChar *sc,SplineSet *head,
- struct simplifyinfo *smpl);
-extern void SPLStartToLeftmost(SplineChar *sc,SplinePointList *spl, int *changed);
-extern void SPLsStartToLeftmost(SplineChar *sc,int layer);
-extern void CanonicalContours(SplineChar *sc,int layer);
-extern void SplineSetJoinCpFixup(SplinePoint *sp);
-extern SplineSet *SplineSetJoin(SplineSet *start,int doall,real fudge,int *changed);
-enum ae_type { ae_all, ae_between_selected, ae_only_good, ae_only_good_rm_later };
-extern Spline *SplineAddExtrema(Spline *s,int always,real lenbound,
- real offsetbound,DBounds *b);
-extern void SplineSetAddExtrema(SplineChar *sc,SplineSet *ss,enum ae_type between_selected, int emsize);
-extern void SplineCharAddExtrema(SplineChar *sc,SplineSet *head,enum ae_type between_selected,int emsize);
-extern SplineSet *SplineCharRemoveTiny(SplineChar *sc,SplineSet *head);
-extern SplineFont *SplineFontNew(void);
-extern char *GetNextUntitledName(void);
-extern SplineFont *SplineFontEmpty(void);
-extern SplineFont *SplineFontBlank(int charcnt);
-extern void SFIncrementXUID(SplineFont *sf);
-extern void SFRandomChangeXUID(SplineFont *sf);
-extern SplineSet *SplineSetReverse(SplineSet *spl);
-extern SplineSet *SplineSetsExtractOpen(SplineSet **tbase);
-extern void SplineSetsInsertOpen(SplineSet **tbase,SplineSet *open);
-extern SplineSet *SplineSetsCorrect(SplineSet *base,int *changed);
-extern SplineSet *SplineSetsAntiCorrect(SplineSet *base);
-extern SplineSet *SplineSetsDetectDir(SplineSet **_base, int *lastscan);
-extern void SPAverageCps(SplinePoint *sp);
-extern void SPLAverageCps(SplinePointList *spl);
-extern void SPWeightedAverageCps(SplinePoint *sp);
-extern void SplineCharDefaultPrevCP(SplinePoint *base);
-extern void SplineCharDefaultNextCP(SplinePoint *base);
-extern void SplineCharTangentNextCP(SplinePoint *sp);
-extern void SplineCharTangentPrevCP(SplinePoint *sp);
-extern void SPHVCurveForce(SplinePoint *sp);
-extern void SPSmoothJoint(SplinePoint *sp);
-extern int PointListIsSelected(SplinePointList *spl);
-extern void SCSplinePointsUntick(SplineChar *sc,int layer);
-extern void SFOrderBitmapList(SplineFont *sf);
-extern int KernThreshold(SplineFont *sf, int cnt);
-extern real SFGuessItalicAngle(SplineFont *sf);
-
-extern SplinePoint *SplineTtfApprox(Spline *ps);
-extern SplineSet *SSttfApprox(SplineSet *ss);
-extern SplineSet *SplineSetsTTFApprox(SplineSet *ss);
-extern SplineSet *SSPSApprox(SplineSet *ss);
-extern SplineSet *SplineSetsPSApprox(SplineSet *ss);
-extern SplineSet *SplineSetsConvertOrder(SplineSet *ss, int to_order2);
-extern void SplineRefigure2(Spline *spline);
-extern void SplineRefigureFixup(Spline *spline);
-extern Spline *SplineMake2(SplinePoint *from, SplinePoint *to);
-extern Spline *SplineMake(SplinePoint *from, SplinePoint *to, int order2);
-extern Spline *SFSplineMake(SplineFont *sf,SplinePoint *from, SplinePoint *to);
-extern void SCConvertToOrder2(SplineChar *sc);
-extern void SFConvertToOrder2(SplineFont *sf);
-extern void SCConvertToOrder3(SplineChar *sc);
-extern void SFConvertToOrder3(SplineFont *sf);
-extern void SFConvertGridToOrder2(SplineFont *_sf);
-extern void SCConvertLayerToOrder2(SplineChar *sc,int layer);
-extern void SFConvertLayerToOrder2(SplineFont *sf,int layer);
-extern void SFConvertGridToOrder3(SplineFont *_sf);
-extern void SCConvertLayerToOrder3(SplineChar *sc,int layer);
-extern void SFConvertLayerToOrder3(SplineFont *sf,int layer);
-extern void SCConvertOrder(SplineChar *sc, int to_order2);
-extern void SplinePointPrevCPChanged2(SplinePoint *sp);
-extern void SplinePointNextCPChanged2(SplinePoint *sp);
-extern int IntersectLines(BasePoint *inter,
- BasePoint *line1_1, BasePoint *line1_2,
- BasePoint *line2_1, BasePoint *line2_2);
-extern int IntersectLinesClip(BasePoint *inter,
- BasePoint *line1_1, BasePoint *line1_2,
- BasePoint *line2_1, BasePoint *line2_2);
-
-#if 0
-extern void SSBisectTurners(SplineSet *spl);
-#endif
-extern SplineSet *SplineSetStroke(SplineSet *spl,StrokeInfo *si,SplineChar *sc);
-extern SplineSet *SSStroke(SplineSet *spl,StrokeInfo *si,SplineChar *sc);
-extern SplineSet *SplineSetRemoveOverlap(SplineChar *sc,SplineSet *base,enum overlap_type);
-extern SplineSet *SSShadow(SplineSet *spl,real angle, real outline_width,
- real shadow_length,SplineChar *sc, int wireframe);
-
-extern double BlueScaleFigureForced(struct psdict *private,real bluevalues[], real otherblues[]);
-extern double BlueScaleFigure(struct psdict *private,real bluevalues[], real otherblues[]);
-extern void FindBlues( SplineFont *sf, int layer, real blues[14], real otherblues[10]);
-extern void QuickBlues(SplineFont *sf, int layer, BlueData *bd);
-extern void FindHStems( SplineFont *sf, real snaps[12], real cnt[12]);
-extern void FindVStems( SplineFont *sf, real snaps[12], real cnt[12]);
-extern double SFStdVW(SplineFont *sf);
-extern int SplineCharIsFlexible(SplineChar *sc,int layer);
-extern void SCGuessHintInstancesList(SplineChar *sc,int layer,StemInfo *hstem,StemInfo *vstem,DStemInfo *dstem,int hvforce,int dforce);
-extern void SCGuessDHintInstances(SplineChar *sc, int layer,DStemInfo *ds );
-extern void SCGuessHHintInstancesAndAdd(SplineChar *sc, int layer,StemInfo *stem, real guess1, real guess2);
-extern void SCGuessVHintInstancesAndAdd(SplineChar *sc, int layer,StemInfo *stem, real guess1, real guess2);
-extern void SCGuessHHintInstancesList(SplineChar *sc, int layer);
-extern void SCGuessVHintInstancesList(SplineChar *sc, int layer);
-extern real HIlen( StemInfo *stems);
-extern real HIoverlap( HintInstance *mhi, HintInstance *thi);
-extern int StemInfoAnyOverlaps(StemInfo *stems);
-extern int StemListAnyConflicts(StemInfo *stems);
-extern HintInstance *HICopyTrans(HintInstance *hi, real mul, real offset);
-extern void MDAdd(SplineChar *sc, int x, SplinePoint *sp1, SplinePoint *sp2);
-extern int SFNeedsAutoHint( SplineFont *_sf,int layer);
-
-typedef struct bluezone {
- real base;
- int cvtindex;
- real family_base; /* NaN if none */
- int family_cvtindex;
- real overshoot; /* relative to baseline, NOT to base */
- int highest; /* used in autoinstructing for HStem positioning */
- int lowest; /* as above */
-} BlueZone;
-
-typedef struct stdstem {
- real width; /* -1 if none */
- int cvtindex;
- struct stdstem *snapto;/* NULL means stem isn't snapped to any other */
- int stopat; /* at which ppem stop snapping to snapto */
-} StdStem;
-
-typedef struct globalinstrct {
- SplineFont *sf;
- int layer;
- BlueData *bd;
- double fudge;
-
- /* Did we initialize the tables needed? 'maxp' is skipped because */
- /* its initialization always succeeds. */
- int cvt_done;
- int fpgm_done;
- int prep_done;
-
- /* PS private data with truetype-specific information added */
- BlueZone blues[12]; /* like in BlueData */
- int bluecnt;
- StdStem stdhw;
- StdStem *stemsnaph; /* StdHW excluded */
- int stemsnaphcnt;
- StdStem stdvw;
- StdStem *stemsnapv; /* StdVW excluded */
- int stemsnapvcnt;
-} GlobalInstrCt;
-
-extern void InitGlobalInstrCt( GlobalInstrCt *gic,SplineFont *sf,int layer,
- BlueData *bd );
-extern void FreeGlobalInstrCt( GlobalInstrCt *gic );
-extern void NowakowskiSCAutoInstr( GlobalInstrCt *gic,SplineChar *sc );
-extern void CVT_ImportPrivate(SplineFont *sf);
-
-extern void SCModifyHintMasksAdd(SplineChar *sc,int layer,StemInfo *new);
-extern void SCClearHints(SplineChar *sc);
-extern void SCClearHintMasks(SplineChar *sc,int layer,int counterstoo);
-extern void SCFigureVerticalCounterMasks(SplineChar *sc);
-extern void SCFigureCounterMasks(SplineChar *sc);
-extern void SCFigureHintMasks(SplineChar *sc,int layer);
-extern void _SplineCharAutoHint( SplineChar *sc, int layer, BlueData *bd, struct glyphdata *gd2, int gen_undoes );
-extern void SplineCharAutoHint( SplineChar *sc,int layer, BlueData *bd);
-extern void SFSCAutoHint( SplineChar *sc,int layer,BlueData *bd);
-extern void SplineFontAutoHint( SplineFont *sf, int layer);
-extern void SplineFontAutoHintRefs( SplineFont *sf, int layer);
-extern StemInfo *HintCleanup(StemInfo *stem,int dosort,int instance_count);
-extern int SplineFontIsFlexible(SplineFont *sf,int layer, int flags);
-extern int SCDrawsSomething(SplineChar *sc);
-#define SCWorthOutputting(a) 1
-extern int SFFindNotdef(SplineFont *sf, int fixed);
-extern int doesGlyphExpandHorizontally(SplineChar *sc);
-extern int IsntBDFChar(BDFChar *bdfc);
-extern int CIDWorthOutputting(SplineFont *cidmaster, int enc); /* Returns -1 on failure, font number on success */
-extern int AmfmSplineFont(FILE *afm, MMSet *mm,int formattype,EncMap *map,int layer);
-extern int AfmSplineFont(FILE *afm, SplineFont *sf,int formattype,EncMap *map, int docc, SplineFont *fullsf,int layer);
-extern int PfmSplineFont(FILE *pfm, SplineFont *sf,int type0,EncMap *map,int layer);
-extern int TfmSplineFont(FILE *afm, SplineFont *sf,int formattype,EncMap *map,int layer);
-extern int OfmSplineFont(FILE *afm, SplineFont *sf,int formattype,EncMap *map,int layer);
-extern char *EncodingName(Encoding *map);
-extern char *SFEncodingName(SplineFont *sf,EncMap *map);
-extern void SFLigaturePrepare(SplineFont *sf);
-extern void SFLigatureCleanup(SplineFont *sf);
-extern void SFKernClassTempDecompose(SplineFont *sf,int isv);
-extern void SFKernCleanup(SplineFont *sf,int isv);
-extern int SCSetMetaData(SplineChar *sc,char *name,int unienc,
- const char *comment);
-
-extern enum uni_interp interp_from_encoding(Encoding *enc,enum uni_interp interp);
-extern const char *EncName(Encoding *encname);
-extern const char*FindUnicharName(void);
-extern Encoding *_FindOrMakeEncoding(const char *name,int make_it);
-extern Encoding *FindOrMakeEncoding(const char *name);
-extern int SFDWrite(char *filename,SplineFont *sf,EncMap *map,EncMap *normal, int todir);
-extern int SFDWriteBak(SplineFont *sf,EncMap *map,EncMap *normal);
-extern SplineFont *SFDRead(char *filename);
-extern SplineFont *_SFDRead(char *filename,FILE *sfd);
-extern SplineFont *SFDirRead(char *filename);
-extern SplineChar *SFDReadOneChar(SplineFont *sf,const char *name);
-extern char *TTFGetFontName(FILE *ttf,int32 offset,int32 off2);
-extern char *TTFGetPSFontName(FILE *ttf,int32 offset,int32 off2);
-extern void TTFLoadBitmaps(FILE *ttf,struct ttfinfo *info, int onlyone);
-enum ttfflags { ttf_onlystrikes=1, ttf_onlyonestrike=2, ttf_onlykerns=4, ttf_onlynames=8 };
-extern SplineFont *_SFReadTTF(FILE *ttf,int flags,enum openflags openflags,
- char *filename,struct fontdict *fd);
-extern SplineFont *SFReadTTF(char *filename,int flags,enum openflags openflags);
-extern SplineFont *SFReadSVG(char *filename,int flags);
-extern SplineFont *SFReadUFO(char *filename,int flags);
-extern SplineFont *_CFFParse(FILE *temp,int len,char *fontsetname);
-extern SplineFont *CFFParse(char *filename);
-extern SplineFont *SFReadMacBinary(char *filename,int flags,enum openflags openflags);
-extern SplineFont *SFReadWinFON(char *filename,int toback);
-extern SplineFont *SFReadPalmPdb(char *filename,int toback);
-extern SplineFont *LoadSplineFont(char *filename,enum openflags);
-extern SplineFont *_ReadSplineFont(FILE *file,char *filename, enum openflags openflags);
-extern SplineFont *ReadSplineFont(char *filename,enum openflags); /* Don't use this, use LoadSF instead */
-extern FILE *URLToTempFile(char *url,void *lock);
-extern int URLFromFile(char *url,FILE *from);
-extern int HttpGetBuf(char *url, char *databuf, int *datalen, void *mutex);
-extern void ArchiveCleanup(char *archivedir);
-extern char *Unarchive(char *name, char **_archivedir);
-extern char *Decompress(char *name, int compression);
-extern SplineFont *SFFromBDF(char *filename,int ispk,int toback);
-extern SplineFont *SFFromMF(char *filename);
-extern void SFCheckPSBitmap(SplineFont *sf);
-extern uint16 _MacStyleCode( char *styles, SplineFont *sf, uint16 *psstyle );
-extern uint16 MacStyleCode( SplineFont *sf, uint16 *psstyle );
-extern SplineFont *SFReadIkarus(char *fontname);
-extern SplineFont *_SFReadPdfFont(FILE *ttf,char *filename,char *select_this_font, enum openflags openflags);
-extern SplineFont *SFReadPdfFont(char *filename, enum openflags openflags);
-extern char **GetFontNames(char *filename);
-extern char **NamesReadSFD(char *filename);
-extern char **NamesReadTTF(char *filename);
-extern char **NamesReadCFF(char *filename);
-extern char **NamesReadPostscript(char *filename);
-extern char **_NamesReadPostscript(FILE *ps);
-extern char **NamesReadSVG(char *filename);
-extern char **NamesReadUFO(char *filename);
-extern char **NamesReadMacBinary(char *filename);
-
-extern void SFSetOrder(SplineFont *sf,int order2);
-extern int SFFindOrder(SplineFont *sf);
-
-extern const char *UnicodeRange(int unienc);
-extern SplineChar *SCBuildDummy(SplineChar *dummy,SplineFont *sf,EncMap *map,int i);
-extern SplineChar *SFMakeChar(SplineFont *sf,EncMap *map,int i);
-extern char *AdobeLigatureFormat(char *name);
-extern uint32 LigTagFromUnicode(int uni);
-extern void SCLigCaretheck(SplineChar *sc,int clean);
-extern BDFChar *BDFMakeGID(BDFFont *bdf,int gid);
-extern BDFChar *BDFMakeChar(BDFFont *bdf,EncMap *map,int enc);
-
-extern RefChar *RefCharsCopyState(SplineChar *sc,int layer);
-extern int SCWasEmpty(SplineChar *sc, int skip_this_layer);
-extern void SCUndoSetLBearingChange(SplineChar *sc,int lb);
-extern Undoes *SCPreserveHints(SplineChar *sc,int layer);
-extern Undoes *SCPreserveLayer(SplineChar *sc,int layer,int dohints);
-extern Undoes *SCPreserveState(SplineChar *sc,int dohints);
-extern Undoes *SCPreserveBackground(SplineChar *sc);
-extern Undoes *SFPreserveGuide(SplineFont *sf);
-extern Undoes *SCPreserveWidth(SplineChar *sc);
-extern Undoes *SCPreserveVWidth(SplineChar *sc);
-extern Undoes *BCPreserveState(BDFChar *bc);
-extern void BCDoRedo(BDFChar *bc);
-extern void BCDoUndo(BDFChar *bc);
-
-extern int isaccent(int uni);
-extern int SFIsCompositBuildable(SplineFont *sf,int unicodeenc,SplineChar *sc, int layer);
-extern int SFIsSomethingBuildable(SplineFont *sf,SplineChar *sc, int layer,int onlyaccents);
-extern int SFIsRotatable(SplineFont *sf,SplineChar *sc, int layer);
-extern int SCMakeDotless(SplineFont *sf, SplineChar *dotless, int layer, int copybmp, int doit);
-extern void SCBuildComposit(SplineFont *sf, SplineChar *sc, int layer, int copybmp);
-extern int SCAppendAccent(SplineChar *sc,int layer, char *glyph_name,int uni,int pos);
-extern const unichar_t *SFGetAlternate(SplineFont *sf, int base,SplineChar *sc,int nocheck);
-
-extern int getAdobeEnc(char *name);
-
-extern void SFSplinesFromLayers(SplineFont *sf,int tostroke);
-extern void SFSetLayerWidthsStroked(SplineFont *sf, real strokewidth);
-extern SplineSet *SplinePointListInterpretSVG(char *filename,char *memory, int memlen, int em_size, int ascent,int stroked);
-extern SplineSet *SplinePointListInterpretGlif(char *filename,char *memory, int memlen, int em_size, int ascent,int stroked);
-#define UNDEFINED_WIDTH -999999
-extern SplinePointList *SplinePointListInterpretPS(FILE *ps,int flags,int stroked,int *width);
-extern void PSFontInterpretPS(FILE *ps,struct charprocs *cp,char **encoding);
-extern struct enc *PSSlurpEncodings(FILE *file);
-extern int EvaluatePS(char *str,real *stack,int size);
-struct pscontext {
- int is_type2;
- int painttype;
- int instance_count;
- real blend_values[17];
- int blend_warn;
-};
-extern int UnblendedCompare(real u1[MmMax], real u2[MmMax], int cnt);
-extern SplineChar *PSCharStringToSplines(uint8 *type1, int len, struct pscontext *context,
- struct pschars *subrs, struct pschars *gsubrs, const char *name);
-extern SplineChar *PSCharStringToBB(uint8 *type1, int len, struct pscontext *context,
- struct pschars *subrs, struct pschars *gsubrs, const char *name);
-extern void MatMultiply(real m1[6], real m2[6], real to[6]);
-
-extern int NameToEncoding(SplineFont *sf,EncMap *map,const char *uname);
-extern void GlyphHashFree(SplineFont *sf);
-extern void SFHashGlyph(SplineFont *sf,SplineChar *sc);
-extern SplineChar *SFHashName(SplineFont *sf,const char *name);
-extern int SFFindGID(SplineFont *sf, int unienc, const char *name );
-extern int SFFindSlot(SplineFont *sf, EncMap *map, int unienc, const char *name );
-extern int SFCIDFindCID(SplineFont *sf, int unienc, const char *name );
-extern SplineChar *SFGetChar(SplineFont *sf, int unienc, const char *name );
-extern int SFHasChar(SplineFont *sf, int unienc, const char *name );
-extern SplineChar *SFGetOrMakeChar(SplineFont *sf, int unienc, const char *name );
-extern int SFFindExistingSlot(SplineFont *sf, int unienc, const char *name );
-extern int SFCIDFindExistingChar(SplineFont *sf, int unienc, const char *name );
-extern int SFHasCID(SplineFont *sf, int cid);
-
-extern char *getPfaEditDir(char *buffer);
-extern void _DoAutoSaves(struct fontviewbase *);
-extern void CleanAutoRecovery(void);
-extern int DoAutoRecovery(int);
-extern SplineFont *SFRecoverFile(char *autosavename,int inquire, int *state);
-extern void SFAutoSave(SplineFont *sf,EncMap *map);
-extern void SFClearAutoSave(SplineFont *sf);
-
-extern void PSCharsFree(struct pschars *chrs);
-extern void PSDictFree(struct psdict *chrs);
-extern struct psdict *PSDictCopy(struct psdict *dict);
-extern int PSDictFindEntry(struct psdict *dict, char *key);
-extern char *PSDictHasEntry(struct psdict *dict, char *key);
-extern int PSDictRemoveEntry(struct psdict *dict, char *key);
-extern int PSDictChangeEntry(struct psdict *dict, char *key, char *newval);
-extern int SFPrivateGuess(SplineFont *sf,int layer, struct psdict *private,
- char *name, int onlyone);
-
-extern void SFRemoveLayer(SplineFont *sf,int l);
-extern void SFAddLayer(SplineFont *sf,char *name,int order2, int background);
-extern void SFLayerSetBackground(SplineFont *sf,int layer,int is_back);
-
-extern void SplineSetsRound2Int(SplineSet *spl,real factor,int inspiro,int onlysel);
-extern void SCRound2Int(SplineChar *sc,int layer, real factor);
-extern int SCRoundToCluster(SplineChar *sc,int layer,int sel,double within,double max);
-extern int SplineSetsRemoveAnnoyingExtrema(SplineSet *ss,double err);
-extern int hascomposing(SplineFont *sf,int u,SplineChar *sc);
-#if 0
-extern void SFFigureGrid(SplineFont *sf);
-#endif
-
-struct cidmap; /* private structure to encoding.c */
-extern int CIDFromName(char *name,SplineFont *cidmaster);
-extern int CID2Uni(struct cidmap *map,int cid);
-extern int CID2NameUni(struct cidmap *map,int cid, char *buffer, int len);
-extern int NameUni2CID(struct cidmap *map,int uni, const char *name);
-extern int MaxCID(struct cidmap *map);
-extern struct cidmap *FindCidMap(char *registry,char *ordering,int supplement,
- SplineFont *sf);
-extern void SFEncodeToMap(SplineFont *sf,struct cidmap *map);
-extern SplineFont *CIDFlatten(SplineFont *cidmaster,SplineChar **chars,int charcnt);
-extern void SFFlatten(SplineFont *cidmaster);
-extern int SFFlattenByCMap(SplineFont *sf,char *cmapname);
-extern SplineFont *MakeCIDMaster(SplineFont *sf,EncMap *oldmap,int bycmap,char *cmapfilename,struct cidmap *cidmap);
-
-int getushort(FILE *ttf);
-int32 getlong(FILE *ttf);
-int get3byte(FILE *ttf);
-real getfixed(FILE *ttf);
-real get2dot14(FILE *ttf);
-void putshort(FILE *file,int sval);
-void putlong(FILE *file,int val);
-void putfixed(FILE *file,real dval);
-int ttfcopyfile(FILE *ttf, FILE *other, int pos, char *table_name);
-
-extern void SCCopyLayerToLayer(SplineChar *sc, int from, int to,int doclear);
-
-extern int hasFreeType(void);
-extern int hasFreeTypeDebugger(void);
-extern int hasFreeTypeByteCode(void);
-extern int FreeTypeAtLeast(int major, int minor, int patch);
-extern void doneFreeType(void);
-extern void *_FreeTypeFontContext(SplineFont *sf,SplineChar *sc,struct fontviewbase *fv,
- int layer, enum fontformat ff,int flags,void *shared_ftc);
-extern void *FreeTypeFontContext(SplineFont *sf,SplineChar *sc,struct fontviewbase *fv,int layer);
-extern BDFFont *SplineFontFreeTypeRasterize(void *freetypecontext,int pixelsize,int depth);
-extern BDFChar *SplineCharFreeTypeRasterize(void *freetypecontext,int gid,
- int pixelsize,int depth);
-extern void FreeTypeFreeContext(void *freetypecontext);
-extern SplineSet *FreeType_GridFitChar(void *single_glyph_context,
- int enc, real ptsizey, real ptsizex, int dpi, uint16 *width, SplineChar *sc, int depth);
-extern struct freetype_raster *FreeType_GetRaster(void *single_glyph_context,
- int enc, real ptsizey, real ptsizex, int dpi,int depth);
-extern BDFChar *SplineCharFreeTypeRasterizeNoHints(SplineChar *sc,int layer,
- int pixelsize,int depth);
-extern BDFFont *SplineFontFreeTypeRasterizeNoHints(SplineFont *sf,int layer,
- int pixelsize,int depth);
-extern void FreeType_FreeRaster(struct freetype_raster *raster);
-struct TT_ExecContextRec_;
-extern struct freetype_raster *DebuggerCurrentRaster(struct TT_ExecContextRec_ *exc,int depth);
-
-extern int UniFromName(const char *name,enum uni_interp interp, Encoding *encname);
-extern const char *StdGlyphName(char *buffer, int uni, enum uni_interp interp, NameList *for_this_font);
-extern char **AllGlyphNames(int uni, NameList *for_this_font,SplineChar *sc/* May be NULL*/);
-extern char **AllNamelistNames(void);
-extern NameList *DefaultNameListForNewFonts(void);
-extern NameList *NameListByName(char *name);
-extern NameList *LoadNamelist(char *filename);
-extern void LoadNamelistDir(char *dir);
-extern const char *RenameGlyphToNamelist(char *buffer, SplineChar *sc,NameList *old,NameList *new);
-extern void SFRenameGlyphsToNamelist(SplineFont *sf,NameList *new);
-extern char **SFTemporaryRenameGlyphsToNamelist(SplineFont *sf,NameList *new);
-extern void SFTemporaryRestoreGlyphNames(SplineFont *sf,char **former);
-
-extern void doversion(const char *);
-
-extern AnchorPos *AnchorPositioning(SplineChar *sc,unichar_t *ustr,SplineChar **sstr );
-extern void AnchorPosFree(AnchorPos *apos);
-
-extern int SF_CloseAllInstrs(SplineFont *sf);
-extern int SSTtfNumberPoints(SplineSet *ss);
-extern int SCNumberPoints(SplineChar *sc,int layer);
-extern int SCPointsNumberedProperly(SplineChar *sc,int layer);
-extern int ttfFindPointInSC(SplineChar *sc,int layer,int pnum,BasePoint *pos,
- RefChar *bound);
-
-int SFFigureDefWidth(SplineFont *sf, int *_nomwid);
-
-extern int SFRenameTheseFeatureTags(SplineFont *sf, uint32 tag, int sli, int flags,
- uint32 totag, int tosli, int toflags, int ismac);
-extern int SFRemoveUnusedNestedFeatures(SplineFont *sf);
-
-extern char *utf8_verify_copy(const char *str);
-
-extern char *MacStrToUtf8(const char *str,int macenc,int maclang);
-extern char *Utf8ToMacStr(const char *ustr,int macenc,int maclang);
-extern uint8 MacEncFromMacLang(int maclang);
-extern uint16 WinLangFromMac(int maclang);
-extern uint16 WinLangToMac(int winlang);
-extern int CanEncodingWinLangAsMac(int winlang);
-extern const int32 *MacEncToUnicode(int script,int lang);
-extern int MacLangFromLocale(void);
-extern char *MacLanguageFromCode(int code);
-
-extern int32 UniFromEnc(int enc, Encoding *encname);
-extern int32 EncFromUni(int32 uni, Encoding *encname);
-extern int32 EncFromName(const char *name,enum uni_interp interp,Encoding *encname);
-
-extern void MatInverse(real into[6], real orig[6]);
-
-extern int BpColinear(BasePoint *first, BasePoint *mid, BasePoint *last);
-
-enum psstrokeflags { sf_toobigwarn=1, sf_removeoverlap=2, sf_handle_eraser=4,
- sf_correctdir=8, sf_clearbeforeinput=16 };
-
-extern char *MMAxisAbrev(char *axis_name);
-extern char *MMMakeMasterFontname(MMSet *mm,int ipos,char **fullname);
-extern char *MMGuessWeight(MMSet *mm,int ipos,char *def);
-extern char *MMExtractNth(char *pt,int ipos);
-extern char *MMExtractArrayNth(char *pt,int ipos);
-extern int MMValid(MMSet *mm,int complain);
-extern void MMKern(SplineFont *sf,SplineChar *first,SplineChar *second,int diff,
- struct lookup_subtable *sub,KernPair *oldkp);
-extern char *MMBlendChar(MMSet *mm, int gid);
-
-extern char *EnforcePostScriptName(char *old);
-
-extern char *ToAbsolute(char *filename);
-
-enum Compare_Ret { SS_DiffContourCount = 1,
- SS_MismatchOpenClosed = 2,
- SS_DisorderedContours = 4,
- SS_DisorderedStart = 8,
- SS_DisorderedDirection = 16,
- SS_PointsMatch = 32,
- SS_ContourMatch = 64,
- SS_NoMatch = 128,
- SS_RefMismatch = 256,
- SS_WidthMismatch = 512,
- SS_VWidthMismatch = 1024,
- SS_HintMismatch = 2048,
- SS_HintMaskMismatch = 4096,
- SS_LayerCntMismatch = 8192,
- SS_ContourMismatch = 16384,
- SS_UnlinkRefMatch = 32768,
-
- BC_DepthMismatch = 1<<16,
- BC_BoundingBoxMismatch = 2<<16,
- BC_BitmapMismatch = 4<<16,
- BC_NoMatch = 8<<16,
- BC_Match = 16<<16,
-
- SS_RefPtMismatch = 32<<16
- };
-
-extern enum Compare_Ret BitmapCompare(BDFChar *bc1, BDFChar *bc2, int err, int bb_err);
-extern enum Compare_Ret SSsCompare(const SplineSet *ss1, const SplineSet *ss2,
- real pt_err, real spline_err, SplinePoint **hmfail);
-enum font_compare_flags { fcf_outlines=1, fcf_exact=2, fcf_warn_not_exact=4,
- fcf_hinting=8, fcf_hintmasks=0x10, fcf_hmonlywithconflicts=0x20,
- fcf_warn_not_ref_exact=0x40,
- fcf_bitmaps=0x80, fcf_names = 0x100, fcf_gpos=0x200, fcf_gsub=0x400,
- fcf_adddiff2sf1=0x800, fcf_addmissing=0x1000 };
-extern int CompareFonts(SplineFont *sf1, EncMap *map1, SplineFont *sf2,
- FILE *diffs, int flags);
-extern int LayersSimilar(Layer *ly1, Layer *ly2, double spline_err);
-
-
-# if HANYANG
-extern void SFDDumpCompositionRules(FILE *sfd,struct compositionrules *rules);
-extern struct compositionrules *SFDReadCompositionRules(FILE *sfd);
-extern void SFModifyComposition(SplineFont *sf);
-extern void SFBuildSyllables(SplineFont *sf);
-# endif
-
-extern void DefaultOtherSubrs(void);
-extern int ReadOtherSubrsFile(char *filename);
-
-extern char *utf8toutf7_copy(const char *_str);
-extern char *utf7toutf8_copy(const char *_str);
-
-extern void SFSetModTime(SplineFont *sf);
-extern void SFTimesFromFile(SplineFont *sf,FILE *);
-
-extern int SFHasInstructions(SplineFont *sf);
-extern int RefDepth(RefChar *ref,int layer);
-
-extern SplineChar *SCHasSubs(SplineChar *sc,uint32 tag);
-
-extern char *TagFullName(SplineFont *sf,uint32 tag, int onlyifknown);
-
-extern uint32 *SFScriptsInLookups(SplineFont *sf,int gpos);
-extern uint32 *SFLangsInScript(SplineFont *sf,int gpos,uint32 script);
-extern uint32 *SFFeaturesInScriptLang(SplineFont *sf,int gpos,uint32 script,uint32 lang);
-extern OTLookup **SFLookupsInScriptLangFeature(SplineFont *sf,int gpos,uint32 script,uint32 lang, uint32 feature);
-extern SplineChar **SFGlyphsWithPSTinSubtable(SplineFont *sf,struct lookup_subtable *subtable);
-extern SplineChar **SFGlyphsWithLigatureinLookup(SplineFont *sf,struct lookup_subtable *subtable);
-extern void SFFindUnusedLookups(SplineFont *sf);
-extern void SFFindClearUnusedLookupBits(SplineFont *sf);
-extern int LookupUsedNested(SplineFont *sf,OTLookup *checkme);
-extern void SFRemoveUnusedLookupSubTables(SplineFont *sf,
- int remove_incomplete_anchorclasses,
- int remove_unused_lookups);
-extern void SFRemoveLookupSubTable(SplineFont *sf,struct lookup_subtable *sub);
-extern void SFRemoveLookup(SplineFont *sf,OTLookup *otl);
-extern struct lookup_subtable *SFFindLookupSubtable(SplineFont *sf,char *name);
-extern struct lookup_subtable *SFFindLookupSubtableAndFreeName(SplineFont *sf,char *name);
-extern OTLookup *SFFindLookup(SplineFont *sf,char *name);
-extern void NameOTLookup(OTLookup *otl,SplineFont *sf);
-extern void FListAppendScriptLang(FeatureScriptLangList *fl,uint32 script_tag,uint32 lang_tag);
-extern void FListsAppendScriptLang(FeatureScriptLangList *fl,uint32 script_tag,uint32 lang_tag);
-struct scriptlanglist *SLCopy(struct scriptlanglist *sl);
-struct scriptlanglist *SListCopy(struct scriptlanglist *sl);
-extern FeatureScriptLangList *FeatureListCopy(FeatureScriptLangList *fl);
-extern void SLMerge(FeatureScriptLangList *into, struct scriptlanglist *fsl);
-extern void FLMerge(OTLookup *into, OTLookup *from);
-extern FeatureScriptLangList *FLOrder(FeatureScriptLangList *fl);
-extern int FeatureScriptTagInFeatureScriptList(uint32 tag, uint32 script, FeatureScriptLangList *fl);
-extern FeatureScriptLangList *FindFeatureTagInFeatureScriptList(uint32 tag, FeatureScriptLangList *fl);
-extern int FeatureTagInFeatureScriptList(uint32 tag, FeatureScriptLangList *fl);
-extern int DefaultLangTagInOneScriptList(struct scriptlanglist *sl);
-extern struct scriptlanglist *DefaultLangTagInScriptList(struct scriptlanglist *sl, int DFLT_ok);
-extern int ScriptInFeatureScriptList(uint32 script, FeatureScriptLangList *fl);
-extern int _FeatureOrderId( int isgpos,uint32 tag );
-extern int FeatureOrderId( int isgpos,FeatureScriptLangList *fl );
-extern void SFSubTablesMerge(SplineFont *_sf,struct lookup_subtable *subfirst,
- struct lookup_subtable *subsecond);
-extern struct lookup_subtable *SFSubTableFindOrMake(SplineFont *sf,uint32 tag,uint32 script,
- int lookup_type );
-extern struct lookup_subtable *SFSubTableMake(SplineFont *sf,uint32 tag,uint32 script,
- int lookup_type );
-extern OTLookup *OTLookupCopyInto(SplineFont *into_sf,SplineFont *from_sf, OTLookup *from_otl);
-extern void OTLookupsCopyInto(SplineFont *into_sf,SplineFont *from_sf,
- OTLookup **from_list, OTLookup *before);
-extern struct opentype_str *ApplyTickedFeatures(SplineFont *sf,uint32 *flist, uint32 script, uint32 lang,
- int pixelsize, SplineChar **glyphs);
-extern int VerticalKernFeature(SplineFont *sf, OTLookup *otl, int ask);
-
-struct sllk { uint32 script; int cnt, max; OTLookup **lookups; int lcnt, lmax; uint32 *langs; };
-extern void SllkFree(struct sllk *sllk,int sllk_cnt);
-extern struct sllk *AddOTLToSllks( OTLookup *otl, struct sllk *sllk,
- int *_sllk_cnt, int *_sllk_max );
-extern OTLookup *NewAALTLookup(SplineFont *sf,struct sllk *sllk, int sllk_cnt, int i);
-extern void AddNewAALTFeatures(SplineFont *sf);
-
-extern void SplinePointRound(SplinePoint *,real);
-
-extern int KCFindName(char *name, char **classnames, int cnt );
-extern int KCFindIndex(KernClass *kc,char *name1, char *name2);
-extern KernClass *SFFindKernClass(SplineFont *sf,SplineChar *first,SplineChar *last,
- int *index,int allow_zero);
-extern KernClass *SFFindVKernClass(SplineFont *sf,SplineChar *first,SplineChar *last,
- int *index,int allow_zero);
-
-extern void SCClearRounds(SplineChar *sc,int layer);
-extern void MDReplace(MinimumDistance *md,SplineSet *old,SplineSet *rpl);
-extern void SCSynchronizeWidth(SplineChar *sc,real newwidth, real oldwidth,struct fontviewbase *fv);
-extern RefChar *HasUseMyMetrics(SplineChar *sc,int layer);
-extern void SCSynchronizeLBearing(SplineChar *sc,real off,int layer);
-extern void RevertedGlyphReferenceFixup(SplineChar *sc, SplineFont *sf);
-
-extern void SFUntickAll(SplineFont *sf);
-
-extern void BDFOrigFixup(BDFFont *bdf,int orig_cnt,SplineFont *sf);
-
-extern int HasSVG(void);
-extern void SCImportSVG(SplineChar *sc,int layer,char *path,char *memory, int memlen,int doclear);
-extern int HasUFO(void);
-extern void SCImportGlif(SplineChar *sc,int layer,char *path,char *memory, int memlen,int doclear);
-extern void SCImportPS(SplineChar *sc,int layer,char *path,int doclear, int flags);
-extern void SCImportPSFile(SplineChar *sc,int layer,FILE *ps,int doclear,int flags);
-extern void SCImportPDF(SplineChar *sc,int layer,char *path,int doclear, int flags);
-extern void SCImportPDFFile(SplineChar *sc,int layer,FILE *ps,int doclear,int flags);
-extern void SCImportPlateFile(SplineChar *sc,int layer,FILE *plate,int doclear,int flags);
-extern void SCAddScaleImage(SplineChar *sc,struct gimage *image,int doclear,int layer);
-extern void SCInsertImage(SplineChar *sc,struct gimage *image,real scale,real yoff, real xoff, int layer);
-extern void SCImportFig(SplineChar *sc,int layer,char *path,int doclear);
-
-extern int _ExportPlate(FILE *pdf,SplineChar *sc,int layer);
-extern int _ExportPDF(FILE *pdf,SplineChar *sc,int layer);
-extern int _ExportEPS(FILE *eps,SplineChar *sc,int layer, int gen_preview);
-extern int _ExportSVG(FILE *svg,SplineChar *sc,int layer);
-extern int _ExportGlif(FILE *glif,SplineChar *sc,int layer);
-extern int ExportEPS(char *filename,SplineChar *sc,int layer);
-extern int ExportPDF(char *filename,SplineChar *sc,int layer);
-extern int ExportPlate(char *filename,SplineChar *sc,int layer);
-extern int ExportSVG(char *filename,SplineChar *sc,int layer);
-extern int ExportGlif(char *filename,SplineChar *sc,int layer);
-extern int ExportFig(char *filename,SplineChar *sc,int layer);
-extern int BCExportXBM(char *filename,BDFChar *bdfc, int format);
-extern int ExportImage(char *filename,SplineChar *sc, int layer, int format, int pixelsize, int bitsperpixel);
-extern void ScriptExport(SplineFont *sf, BDFFont *bdf, int format, int gid,
- char *format_spec, EncMap *map);
-
-extern EncMap *EncMapFromEncoding(SplineFont *sf,Encoding *enc);
-extern void SFRemoveGlyph(SplineFont *sf,SplineChar *sc, int *flags);
-extern void SFAddEncodingSlot(SplineFont *sf,int gid);
-extern void SFAddGlyphAndEncode(SplineFont *sf,SplineChar *sc,EncMap *basemap, int baseenc);
-extern void SCDoRedo(SplineChar *sc,int layer);
-extern void SCDoUndo(SplineChar *sc,int layer);
-extern void SCCopyWidth(SplineChar *sc,enum undotype);
-extern void SCAppendPosSub(SplineChar *sc,enum possub_type type, char **d,SplineFont *copied_from);
-extern void SCClearBackground(SplineChar *sc);
-extern void BackgroundImageTransform(SplineChar *sc, ImageList *img,real transform[6]);
-extern int SFIsDuplicatable(SplineFont *sf, SplineChar *sc);
-
-extern void DoAutoSaves(void);
-
-extern void SCClearLayer(SplineChar *sc,int layer);
-extern void SCClearContents(SplineChar *sc,int layer);
-extern void SCClearAll(SplineChar *sc,int layer);
-extern void BCClearAll(BDFChar *bc);
-
-#if !defined(_NO_PYTHON)
-extern void FontForge_PythonInit(void);
-extern void PyFF_ErrorString(const char *msg,const char *str);
-extern void PyFF_ErrorF3(const char *frmt, const char *str, int size, int depth);
-extern void PyFF_Stdin(void);
-extern void PyFF_Main(int argc,char **argv,int start);
-extern void PyFF_ScriptFile(struct fontviewbase *fv,SplineChar *sc,char *filename);
-extern void PyFF_ScriptString(struct fontviewbase *fv,SplineChar *sc,int layer,char *str);
-extern void PyFF_FreeFV(struct fontviewbase *fv);
-extern void PyFF_FreeSC(SplineChar *sc);
-extern void PyFF_FreeSF(SplineFont *sf);
-extern void PyFF_ProcessInitFiles(void);
-extern char *PyFF_PickleMeToString(void *pydata);
-extern void *PyFF_UnPickleMeToObjects(char *str);
-struct _object; /* Python Object */
-extern void PyFF_CallDictFunc(struct _object *dict,char *key,char *argtypes, ... );
-extern void ff_init(void);
-#endif
-extern void doinitFontForgeMain(void);
-
-extern void InitSimpleStuff(void);
-
-extern int SSExistsInLayer(SplineSet *ss,SplineSet *lots );
-extern int SplineExistsInSS(Spline *s,SplineSet *ss);
-extern int SpExistsInSS(SplinePoint *sp,SplineSet *ss);
-
-extern int MSLanguageFromLocale(void);
-
-extern struct math_constants_descriptor {
- char *ui_name;
- char *script_name;
- int offset;
- int devtab_offset;
- char *message;
- int new_page;
-} math_constants_descriptor[];
-
-extern int BPTooFar(BasePoint *bp1, BasePoint *bp2);
-extern char *VSErrorsFromMask(int mask,int private_mask);
-extern int SCValidate(SplineChar *sc, int layer, int force);
-extern AnchorClass *SCValidateAnchors(SplineChar *sc);
-extern void SCTickValidationState(SplineChar *sc,int layer);
-extern int ValidatePrivate(SplineFont *sf);
-extern int SFValidate(SplineFont *sf, int layer, int force);
-extern int VSMaskFromFormat(SplineFont *sf, int layer, enum fontformat format);
-
-struct lang_frequencies;
-extern unichar_t *PrtBuildDef( SplineFont *sf, void *tf,
- void (*langsyscallback)(void *tf, int end, uint32 script, uint32 lang) );
-extern char *RandomParaFromScriptLang(uint32 script, uint32 lang, SplineFont *sf,
- struct lang_frequencies *freq);
-extern char *RandomParaFromScript(uint32 script, uint32 *lang, SplineFont *sf);
-extern int SF2Scripts(SplineFont *sf,uint32 scripts[100]);
-extern char **SFScriptLangs(SplineFont *sf,struct lang_frequencies ***freq);
-
-extern int SSHasClip(SplineSet *ss);
-extern int SSHasDrawn(SplineSet *ss);
-extern struct gradient *GradientCopy(struct gradient *old);
-extern void GradientFree(struct gradient *grad);
-extern struct pattern *PatternCopy(struct pattern *old);
-extern void PatternFree(struct pattern *pat);
-extern void BrushCopy(struct brush *into, struct brush *from);
-extern void PenCopy(struct pen *into, struct pen *from);
-extern void PatternSCBounds(SplineChar *sc,DBounds *b);
-
-extern char *SFDefaultImage(SplineFont *sf,char *filename);
-extern void SCClearInstrsOrMark(SplineChar *sc, int layer, int complain);
-extern void instrcheck(SplineChar *sc,int layer);
-extern void TTFPointMatches(SplineChar *sc,int layer,int top);
-
-#ifdef LUA_FF_LIB
-extern SplineFont *ReadSplineFontInfo(char *filename,enum openflags openflags); /* splinefont.c */
-extern SplineFont *SFReadTTFInfo(char *filename, int flags, enum openflags openflags); /* parsettf.c */
-extern SplineFont *SFReadMacBinaryInfo(char *filename,int flags,enum openflags openflags); /* macbinary.c */
-#endif
-
-
-
-#endif
diff --git a/Build/source/texk/web2c/luatexdir/luafontloader/fontforge/fontforge/splineorder2.c b/Build/source/texk/web2c/luatexdir/luafontloader/fontforge/fontforge/splineorder2.c
deleted file mode 100644
index e807b105e38..00000000000
--- a/Build/source/texk/web2c/luatexdir/luafontloader/fontforge/fontforge/splineorder2.c
+++ /dev/null
@@ -1,1508 +0,0 @@
-/* Copyright (C) 2000-2008 by George Williams */
-/*
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are met:
-
- * Redistributions of source code must retain the above copyright notice, this
- * list of conditions and the following disclaimer.
-
- * Redistributions in binary form must reproduce the above copyright notice,
- * this list of conditions and the following disclaimer in the documentation
- * and/or other materials provided with the distribution.
-
- * The name of the author may not be used to endorse or promote products
- * derived from this software without specific prior written permission.
-
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
- * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
- * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
- * EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
- * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
- * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
- * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
- * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-#include "pfaedit.h"
-#include <math.h>
-#include <unistd.h>
-#include <time.h>
-#include <locale.h>
-#include <utype.h>
-#include <ustring.h>
-#include <chardata.h>
-#ifdef HAVE_IEEEFP_H
-# include <ieeefp.h> /* Solaris defines isnan in ieeefp rather than math.h */
-#endif
-
-/* This file contains utility routines for second order bezier splines */
-/* (ie. truetype) */
-/* The most interesting thing */
-/* it does is to figure out a quadratic approximation to the cubic splines */
-/* that postscript uses. We do this by looking at each spline and running */
-/* from the end toward the beginning, checking approximately every emunit */
-/* There is only one quadratic spline possible for any given interval of the */
-/* cubic. The start and end points are the interval end points (obviously) */
-/* the control point is where the two slopes (at start and end) intersect. */
-/* If this spline is a close approximation to the cubic spline (doesn't */
-/* deviate from it by more than an emunit or so), then we use this interval */
-/* as one of our quadratic splines. */
-/* It may turn out that the "quadratic" spline above is actually linear. Well */
-/* that's ok. It may also turn out that we can't find a good approximation. */
-/* If that's true then just insert a linear segment for an emunit stretch. */
-/* (actually this failure mode may not be possible), but I'm not sure */
-/* Then we play the same trick for the rest of the cubic spline (if any) */
-
-/* Does the quadratic spline in ttf approximate the cubic spline in ps */
-/* within one pixel between tmin and tmax (on ps. presumably ttf between 0&1 */
-/* dim is the dimension in which there is the greatest change */
-static int comparespline(Spline *ps, Spline *ttf, real tmin, real tmax, real err) {
- int dim=0, other;
- real dx, dy, ddim, dt, t;
- real d, o;
- real ttf_t, sq, val;
- DBounds bb;
- extended ts[3];
- int i;
-
- /* Are all points on ttf near points on ps? */
- /* This doesn't answer that question, but rules out gross errors */
- bb.minx = bb.maxx = ps->from->me.x; bb.miny = bb.maxy = ps->from->me.y;
- if ( ps->from->nextcp.x>bb.maxx ) bb.maxx = ps->from->nextcp.x;
- else bb.minx = ps->from->nextcp.x;
- if ( ps->from->nextcp.y>bb.maxy ) bb.maxy = ps->from->nextcp.y;
- else bb.miny = ps->from->nextcp.y;
- if ( ps->to->prevcp.x>bb.maxx ) bb.maxx = ps->to->prevcp.x;
- else if ( ps->to->prevcp.x<bb.minx ) bb.minx = ps->to->prevcp.x;
- if ( ps->to->prevcp.y>bb.maxy ) bb.maxy = ps->to->prevcp.y;
- else if ( ps->to->prevcp.y<bb.miny ) bb.miny = ps->to->prevcp.y;
- if ( ps->to->me.x>bb.maxx ) bb.maxx = ps->to->me.x;
- else if ( ps->to->me.x<bb.minx ) bb.minx = ps->to->me.x;
- if ( ps->to->me.y>bb.maxy ) bb.maxy = ps->to->me.y;
- else if ( ps->to->me.y<bb.miny ) bb.miny = ps->to->me.y;
- for ( t=.1; t<1; t+= .1 ) {
- d = (ttf->splines[0].b*t+ttf->splines[0].c)*t+ttf->splines[0].d;
- o = (ttf->splines[1].b*t+ttf->splines[1].c)*t+ttf->splines[1].d;
- if ( d<bb.minx || d>bb.maxx || o<bb.miny || o>bb.maxy )
-return( false );
- }
-
- /* Are all points on ps near points on ttf? */
- dx = ((ps->splines[0].a*tmax+ps->splines[0].b)*tmax+ps->splines[0].c)*tmax -
- ((ps->splines[0].a*tmin+ps->splines[0].b)*tmin+ps->splines[0].c)*tmin ;
- dy = ((ps->splines[1].a*tmax+ps->splines[1].b)*tmax+ps->splines[1].c)*tmax -
- ((ps->splines[1].a*tmin+ps->splines[1].b)*tmin+ps->splines[1].c)*tmin ;
- if ( dx<0 ) dx = -dx;
- if ( dy<0 ) dy = -dy;
- if ( dx>dy ) {
- dim = 0;
- ddim = dx;
- } else {
- dim = 1;
- ddim = dy;
- }
- other = !dim;
-
- t = tmin;
- dt = (tmax-tmin)/ddim;
- for ( t=tmin; t<=tmax; t+= dt ) {
- if ( t>tmax-dt/8. ) t = tmax; /* Avoid rounding errors */
- d = ((ps->splines[dim].a*t+ps->splines[dim].b)*t+ps->splines[dim].c)*t+ps->splines[dim].d;
- o = ((ps->splines[other].a*t+ps->splines[other].b)*t+ps->splines[other].c)*t+ps->splines[other].d;
- if ( ttf->splines[dim].b == 0 ) {
- ttf_t = (d-ttf->splines[dim].d)/ttf->splines[dim].c;
- } else {
- sq = ttf->splines[dim].c*ttf->splines[dim].c -
- 4*ttf->splines[dim].b*(ttf->splines[dim].d-d);
- if ( sq<0 )
-return( false );
- sq = sqrt(sq);
- ttf_t = (-ttf->splines[dim].c-sq)/(2*ttf->splines[dim].b);
- if ( ttf_t>=-0.1 && ttf_t<=1.1 ) { /* Optimizer gives us rounding errors */
- /* And tmin/tmax are no longer exact */
- val = (ttf->splines[other].b*ttf_t+ttf->splines[other].c)*ttf_t+
- ttf->splines[other].d;
- if ( val>o-err && val<o+err )
- continue;
- }
- ttf_t = (-ttf->splines[dim].c+sq)/(2*ttf->splines[dim].b);
- }
- if ( ttf_t>=-0.1 && ttf_t<=1.1 ) {
- val = (ttf->splines[other].b*ttf_t+ttf->splines[other].c)*ttf_t+
- ttf->splines[other].d;
- if ( val>o-err && val<o+err )
- continue;
- }
-return( false );
- }
-
- /* Are representative points on ttf near points on ps? */
- for ( t=.125; t<1; t+= .125 ) {
- d = (ttf->splines[dim].b*t+ttf->splines[dim].c)*t+ttf->splines[dim].d;
- o = (ttf->splines[other].b*t+ttf->splines[other].c)*t+ttf->splines[other].d;
- SplineSolveFull(&ps->splines[dim],d,ts);
- for ( i=0; i<3; ++i ) if ( ts[i]!=-1 ) {
- val = ((ps->splines[other].a*ts[i]+ps->splines[other].b)*ts[i]+ps->splines[other].c)*ts[i]+ps->splines[other].d;
- if ( val>o-err && val<o+err )
- break;
- }
- if ( i==3 )
-return( false );
- }
-
-return( true );
-}
-
-static SplinePoint *MakeQuadSpline(SplinePoint *start,Spline *ttf,real x,
- real y, real tmax,SplinePoint *oldend) {
- Spline *new = chunkalloc(sizeof(Spline));
- SplinePoint *end = chunkalloc(sizeof(SplinePoint));
-
- if ( tmax==1 ) {
- end->roundx = oldend->roundx; end->roundy = oldend->roundy; end->dontinterpolate = oldend->dontinterpolate;
- x = oldend->me.x; y = oldend->me.y; /* Want it to compare exactly */
- }
- end->ttfindex = 0xfffe;
- end->nextcpindex = 0xfffe;
- end->me.x = end->nextcp.x = x;
- end->me.y = end->nextcp.y = y;
- end->nonextcp = true;
-
- *new = *ttf;
- new->from = start; start->next = new;
- new->to = end; end->prev = new;
- if ( new->splines[0].b==0 && new->splines[1].b==0 ) {
- end->noprevcp = true;
- end->prevcp.x = x; end->prevcp.y = y;
- new->islinear = new->knownlinear = true;
- } else {
- end->prevcp.x = start->nextcp.x = ttf->splines[0].c/2+ttf->splines[0].d;
- end->prevcp.y = start->nextcp.y = ttf->splines[1].c/2+ttf->splines[1].d;
- start->nonextcp = end->noprevcp = false;
- new->isquadratic = true;
- }
- new->order2 = true;
-return( end );
-}
-
-static int buildtestquads(Spline *ttf,real xmin,real ymin,real cx,real cy,
- real x,real y,real tmin,real t,real err,Spline *ps, DBounds *psbb) {
- real fudge;
-
- /* test the control points are reasonable */
- fudge = (psbb->maxx-psbb->minx) + (psbb->maxy-psbb->miny);
- if ( cx<psbb->minx-fudge || cx>psbb->maxx+fudge )
-return( false );
- if ( cy<psbb->miny-fudge || cy>psbb->maxy+fudge )
-return( false );
-
- ttf->splines[0].d = xmin;
- ttf->splines[0].c = 2*(cx-xmin);
- ttf->splines[0].b = xmin+x-2*cx;
- ttf->splines[1].d = ymin;
- ttf->splines[1].c = 2*(cy-ymin);
- ttf->splines[1].b = ymin+y-2*cy;
- if ( comparespline(ps,ttf,tmin,t,err) )
-return( true );
-
-#if 0
- /* In a few cases, the following code will find a match when the above */
- /* would not. We move the control point slightly along a vector normal */
- /* to the vector between the end-points. What I really want is along */
- /* a vector midway between the two slopes, but that's too hard to figure */
- sq = sqrt((x-xmin)*(x-xmin) + (y-ymin)*(y-ymin));
- norm.x = (ymin-y)/sq; norm.y = (x-xmin)/sq;
-
- ttf->splines[0].c += err*norm.x;
- ttf->splines[0].b -= err*norm.x;
- ttf->splines[1].c += err*norm.y;
- ttf->splines[1].b -= err*norm.y;
- if ( comparespline(ps,ttf,tmin,t,err) )
-return( true );
-
- ttf->splines[0].c -= 2*err*norm.x;
- ttf->splines[0].b += 2*err*norm.x;
- ttf->splines[1].c -= 2*err*norm.y;
- ttf->splines[1].b += 2*err*norm.y;
- if ( comparespline(ps,ttf,tmin,t,err) )
-return( true );
-
- ttf->splines[0].c = 2*(cx-xmin);
- ttf->splines[0].b = xmin+x-2*cx;
- ttf->splines[1].c = 2*(cy-ymin);
- ttf->splines[1].b = ymin+y-2*cy;
-#endif
-return( false );
-}
-
-static SplinePoint *LinearSpline(Spline *ps,SplinePoint *start, real tmax) {
- real x,y;
- Spline *new = chunkalloc(sizeof(Spline));
- SplinePoint *end = chunkalloc(sizeof(SplinePoint));
-
- x = ((ps->splines[0].a*tmax+ps->splines[0].b)*tmax+ps->splines[0].c)*tmax+ps->splines[0].d;
- y = ((ps->splines[1].a*tmax+ps->splines[1].b)*tmax+ps->splines[1].c)*tmax+ps->splines[1].d;
- if ( tmax==1 ) {
- SplinePoint *oldend = ps->to;
- end->roundx = oldend->roundx; end->roundy = oldend->roundy; end->dontinterpolate = oldend->dontinterpolate;
- x = oldend->me.x; y = oldend->me.y; /* Want it to compare exactly */
- }
- end->ttfindex = 0xfffe;
- end->nextcpindex = 0xfffe;
- end->me.x = end->nextcp.x = end->prevcp.x = x;
- end->me.y = end->nextcp.y = end->prevcp.y = y;
- end->nonextcp = end->noprevcp = start->nonextcp = true;
- new->from = start; start->next = new;
- new->to = end; end->prev = new;
- new->splines[0].d = start->me.x;
- new->splines[0].c = (x-start->me.x);
- new->splines[1].d = start->me.y;
- new->splines[1].c = (y-start->me.y);
- new->order2 = true;
- new->islinear = new->knownlinear = true;
-return( end );
-}
-
-static SplinePoint *_ttfapprox(Spline *ps,real tmin, real tmax, SplinePoint *start) {
- int dim=0;
- real dx, dy, ddim, dt, t, err;
- real x,y, xmin, ymin;
- real dxdtmin, dydtmin, dxdt, dydt;
- SplinePoint *sp;
- real cx, cy;
- Spline ttf;
- int cnt = -1, forceit, unforceable;
- BasePoint end, rend, dend;
- DBounds bb;
-
- rend.x = ((ps->splines[0].a*tmax+ps->splines[0].b)*tmax+ps->splines[0].c)*tmax + ps->splines[0].d;
- rend.y = ((ps->splines[1].a*tmax+ps->splines[1].b)*tmax+ps->splines[1].c)*tmax + ps->splines[1].d;
- end.x = rint( rend.x );
- end.y = rint( rend.y );
- dend.x = (3*ps->splines[0].a*tmax+2*ps->splines[0].b)*tmax+ps->splines[0].c;
- dend.y = (3*ps->splines[1].a*tmax+2*ps->splines[1].b)*tmax+ps->splines[1].c;
- memset(&ttf,'\0',sizeof(ttf));
-
- bb.minx = bb.maxx = ps->from->me.x;
- if ( ps->from->nextcp.x > bb.maxx ) bb.maxx = ps->from->nextcp.x;
- else if ( ps->from->nextcp.x < bb.minx ) bb.minx = ps->from->nextcp.x;
- if ( ps->to->prevcp.x > bb.maxx ) bb.maxx = ps->to->prevcp.x;
- else if ( ps->to->prevcp.x < bb.minx ) bb.minx = ps->to->prevcp.x;
- if ( ps->to->me.x > bb.maxx ) bb.maxx = ps->to->me.x;
- else if ( ps->to->me.x < bb.minx ) bb.minx = ps->to->me.x;
- bb.miny = bb.maxy = ps->from->me.y;
- if ( ps->from->nextcp.y > bb.maxy ) bb.maxy = ps->from->nextcp.y;
- else if ( ps->from->nextcp.y < bb.miny ) bb.miny = ps->from->nextcp.y;
- if ( ps->to->prevcp.y > bb.maxy ) bb.maxy = ps->to->prevcp.y;
- else if ( ps->to->prevcp.y < bb.miny ) bb.miny = ps->to->prevcp.y;
- if ( ps->to->me.y > bb.maxy ) bb.maxy = ps->to->me.y;
- else if ( ps->to->me.y < bb.miny ) bb.miny = ps->to->me.y;
-
- tail_recursion:
- ++cnt;
-
- xmin = start->me.x;
- ymin = start->me.y;
- dxdtmin = (3*ps->splines[0].a*tmin+2*ps->splines[0].b)*tmin + ps->splines[0].c;
- dydtmin = (3*ps->splines[1].a*tmin+2*ps->splines[1].b)*tmin + ps->splines[1].c;
-
- dx = ((ps->splines[0].a*tmax+ps->splines[0].b)*tmax+ps->splines[0].c)*tmax -
- ((ps->splines[0].a*tmin+ps->splines[0].b)*tmin+ps->splines[0].c)*tmin ;
- dy = ((ps->splines[1].a*tmax+ps->splines[1].b)*tmax+ps->splines[1].c)*tmax -
- ((ps->splines[1].a*tmin+ps->splines[1].b)*tmin+ps->splines[1].c)*tmin ;
- if ( dx<0 ) dx = -dx;
- if ( dy<0 ) dy = -dy;
- if ( dx>dy ) {
- dim = 0;
- ddim = dx;
- } else {
- dim = 1;
- ddim = dy;
- }
- if (( err = ddim/3000 )<1 ) err = 1;
-
- if ( ddim<2 ||
- (dend.x==0 && rint(start->me.x)==end.x && dy<=10 && cnt!=0) ||
- (dend.y==0 && rint(start->me.y)==end.y && dx<=10 && cnt!=0) ) {
- if ( cnt==0 || start->noprevcp )
-return( LinearSpline(ps,start,tmax));
- /* If the end point is very close to where we want to be, then just */
- /* pretend it's right */
- start->prev->splines[0].b += ps->to->me.x-start->me.x;
- start->prev->splines[1].b += ps->to->me.y-start->me.y;
- start->prevcp.x += rend.x-start->me.x;
- start->prevcp.y += rend.y-start->me.y;
- if ( start->prev!=NULL && !start->prev->from->nonextcp )
- start->prev->from->nextcp = start->prevcp;
- start->me = rend;
-return( start );
- }
-
- dt = (tmax-tmin)/ddim;
- forceit = false;
- force_end:
- unforceable = false;
- for ( t=tmax; t>tmin+dt/128; t-= dt ) { /* dt/128 is a hack to avoid rounding errors */
- x = ((ps->splines[0].a*t+ps->splines[0].b)*t+ps->splines[0].c)*t+ps->splines[0].d;
- y = ((ps->splines[1].a*t+ps->splines[1].b)*t+ps->splines[1].c)*t+ps->splines[1].d;
- dxdt = (3*ps->splines[0].a*t+2*ps->splines[0].b)*t + ps->splines[0].c;
- dydt = (3*ps->splines[1].a*t+2*ps->splines[1].b)*t + ps->splines[1].c;
- /* if the slopes are parallel at the ends there can be no bezier quadratic */
- /* (control point is where the splines intersect. But if they are */
- /* parallel and colinear then there is a line between 'em */
- if ( ( dxdtmin==0 && dxdt==0 ) || (dydtmin==0 && dydt==0) ||
- ( dxdt!=0 && dxdtmin!=0 &&
- RealNearish(dydt/dxdt,dydtmin/dxdtmin)) )
- continue;
-
- if ( dxdt==0 )
- cx=x;
- else if ( dxdtmin==0 )
- cx=xmin;
- else
- cx = -(ymin-(dydtmin/dxdtmin)*xmin-y+(dydt/dxdt)*x)/(dydtmin/dxdtmin-dydt/dxdt);
- if ( dydt==0 )
- cy=y;
- else if ( dydtmin==0 )
- cy=ymin;
- else
- cy = -(xmin-(dxdtmin/dydtmin)*ymin-x+(dxdt/dydt)*y)/(dxdtmin/dydtmin-dxdt/dydt);
- if ( t==tmax && ((cy==y && cx==x) || (cy==ymin && cx==xmin)) )
- unforceable = true;
- /* Make the quadratic spline from (xmin,ymin) through (cx,cy) to (x,y)*/
- if ( forceit || buildtestquads(&ttf,xmin,ymin,cx,cy,x,y,tmin,t,err,ps,&bb)) {
- if ( !forceit && !unforceable && (rend.x-x)*(rend.x-x)+(rend.y-y)*(rend.y-y)<4*4 ) {
- forceit = true;
- goto force_end;
- }
- sp = MakeQuadSpline(start,&ttf,x,y,t,ps->to);
- forceit = false;
- if ( t==tmax )
-return( sp );
- tmin = t;
- start = sp;
- goto tail_recursion;
- }
- ttf.splines[0].d = xmin;
- ttf.splines[0].c = x-xmin;
- ttf.splines[0].b = 0;
- ttf.splines[1].d = ymin;
- ttf.splines[1].c = y-ymin;
- ttf.splines[1].b = 0;
- if ( comparespline(ps,&ttf,tmin,t,err) ) {
- sp = LinearSpline(ps,start,t);
- if ( t==tmax )
-return( sp );
- tmin = t;
- start = sp;
- goto tail_recursion;
- }
- }
- tmin += dt;
- start = LinearSpline(ps,start,tmin);
- goto tail_recursion;
-}
-
-static SplinePoint *__ttfApprox(Spline *ps,real tmin, real tmax, SplinePoint *start) {
- extended inflect[2];
- int i=0;
-#if 1
- SplinePoint *end;
- Spline *s, *next;
-
- end = _ttfapprox(ps,tmin,tmax,start);
- if ( ps->knownlinear )
-return( end );
- for ( s=start->next; s!=NULL && !s->islinear; s=s->to->next );
- if ( s==NULL )
-return( end );
- for ( s=start->next; s!=NULL ; s=next ) {
- next = s->to->next;
- SplinePointFree(s->to);
- SplineFree(s);
- }
-#endif
-/* Hmm. With my algorithem, checking for points of inflection actually makes */
-/* things worse. It uses more points and the splines don't join as nicely */
-/* However if we get a bad match (a line) in the normal approx, then check */
-/* Err... I was computing POI incorrectly. Above statement might not be correct*/
- /* no points of inflection in quad splines */
-
- i = Spline2DFindPointsOfInflection(ps, inflect);
- if ( i==2 ) {
- if ( RealNearish(inflect[0],inflect[1]) )
- --i;
- else if ( inflect[0]>inflect[1] ) {
- real temp = inflect[0];
- inflect[0] = inflect[1];
- inflect[1] = temp;
- }
- }
- if ( i!=0 ) {
- start = _ttfapprox(ps,tmin,inflect[0],start);
- tmin = inflect[0];
- if ( i==2 ) {
- start = _ttfapprox(ps,tmin,inflect[1],start);
- tmin = inflect[1];
- }
- }
-return( _ttfapprox(ps,tmin,tmax,start));
-}
-
-#if !defined(FONTFORGE_CONFIG_NON_SYMMETRIC_QUADRATIC_CONVERSION)
-typedef struct qpoint {
- BasePoint bp;
- BasePoint cp;
- double t;
-} QPoint;
-
-static int comparedata(Spline *ps,QPoint *data,int qfirst,int qlast,
- int round_to_int ) {
- Spline ttf;
- int i;
- double err = round_to_int ? 1.5 : 1;
-
- if ( qfirst==qlast ) /* happened (was a bug) */
-return( false );
-
- /* Control points diametrically opposed */
- if ( (data[qlast-2].cp.x-ps->to->me.x)*(ps->to->prevcp.x-ps->to->me.x) +
- (data[qlast-2].cp.y-ps->to->me.y)*(ps->to->prevcp.y-ps->to->me.y)<0 )
-return( false );
- if ( (data[qfirst-1].cp.x-ps->from->me.x)*(ps->from->nextcp.x-ps->from->me.x) +
- (data[qfirst-1].cp.y-ps->from->me.y)*(ps->from->nextcp.y-ps->from->me.y)<0 )
-return( false );
-
- memset(&ttf,0,sizeof(ttf));
- for ( i=qfirst; i<qlast; ++i ) {
- ttf.splines[0].d = data[i-1].bp.x;
- ttf.splines[0].c = 2*(data[i-1].cp.x-data[i-1].bp.x);
- ttf.splines[0].b = data[i-1].bp.x+data[i].bp.x-2*data[i-1].cp.x;
- ttf.splines[1].d = data[i-1].bp.y;
- ttf.splines[1].c = 2*(data[i-1].cp.y-data[i-1].bp.y);
- ttf.splines[1].b = data[i-1].bp.y+data[i].bp.y-2*data[i-1].cp.y;
- if ( !comparespline(ps,&ttf,data[i-1].t,data[i].t,err) )
-return( false );
- }
-return( true );
-}
-
-static SplinePoint *CvtDataToSplines(QPoint *data,int qfirst,int qlast,SplinePoint *start) {
- SplinePoint *end;
- int i;
-
- for ( i=qfirst; i<qlast; ++i ) {
- end = SplinePointCreate(data[i].bp.x,data[i].bp.y);
- start->nextcp = end->prevcp = data[i-1].cp;
- start->nonextcp = end->noprevcp = false;
- if (( data[i-1].cp.x == data[i].bp.x && data[i-1].cp.y == data[i].bp.y ) ||
- ( data[i-1].cp.x == start->me.x && data[i-1].cp.y == start->me.y ))
- start->nonextcp = end->noprevcp = true;
- SplineMake2(start,end);
- start = end;
- }
-return( start );
-}
-
-static int SplineWithWellBehavedControlPoints(Spline *ps) {
- BasePoint splineunit;
- double splinelen, npos, ppos;
-
- splineunit.x = ps->to->me.x - ps->from->me.x;
- splineunit.y = ps->to->me.y - ps->from->me.y;
- splinelen = sqrt(splineunit.x*splineunit.x + splineunit.y*splineunit.y);
- if ( splinelen!=0 ) {
- splineunit.x /= splinelen;
- splineunit.y /= splinelen;
- }
-
- npos = (ps->from->nextcp.x-ps->from->me.x) * splineunit.x +
- (ps->from->nextcp.y-ps->from->me.y) * splineunit.y;
- ppos = (ps->to->prevcp.x-ps->from->me.x) * splineunit.x +
- (ps->to->prevcp.y-ps->from->me.y) * splineunit.y;
-return( npos>=0 && /* npos<=ppos &&*/ ppos<=splinelen );
-}
-
-static int PrettyApprox(Spline *ps,double tmin, double tmax,
- QPoint *data, int qcnt, int round_to_int ) {
- int ptcnt, q, i;
- double distance, dx, dy, tstart;
- BasePoint end, mid, slopemin, slopemid, slopeend;
- BasePoint splineunit, start;
- double splinelen, midpos, lastpos, lastpos2, cppos;
- int do_good_spline_check;
- QPoint data2[12];
-
- if ( qcnt==-1 )
-return( -1 );
-
- slopemin.x = (3*ps->splines[0].a*tmin+2*ps->splines[0].b)*tmin+ps->splines[0].c;
- slopemin.y = (3*ps->splines[1].a*tmin+2*ps->splines[1].b)*tmin+ps->splines[1].c;
- if ( slopemin.x==0 && slopemin.y==0 ) {
- double t = tmin + (tmax-tmin)/256;
- /* If there is no control point for this end point, then the slope is */
- /* 0/0 at the end point. Which isn't useful, it leads to a quadratic */
- /* control point at the end point, but this one is real because it */
- /* is used to interpolate the next point, but we get all confused */
- /* because we don't expect a real cp to be on the base point. */
- slopemin.x = (3*ps->splines[0].a*t+2*ps->splines[0].b)*t+ps->splines[0].c;
- slopemin.y = (3*ps->splines[1].a*t+2*ps->splines[1].b)*t+ps->splines[1].c;
- }
-
- end.x = ((ps->splines[0].a*tmax+ps->splines[0].b)*tmax+ps->splines[0].c)*tmax+ps->splines[0].d;
- end.y = ((ps->splines[1].a*tmax+ps->splines[1].b)*tmax+ps->splines[1].c)*tmax+ps->splines[1].d;
- slopeend.x = (3*ps->splines[0].a*tmax+2*ps->splines[0].b)*tmax+ps->splines[0].c;
- slopeend.y = (3*ps->splines[1].a*tmax+2*ps->splines[1].b)*tmax+ps->splines[1].c;
- if ( slopemin.x==0 && slopemin.y==0 ) {
- double t = tmax - (tmax-tmin)/256;
- /* Same problem as above, except at the other end */
- slopeend.x = (3*ps->splines[0].a*t+2*ps->splines[0].b)*t+ps->splines[0].c;
- slopeend.y = (3*ps->splines[1].a*t+2*ps->splines[1].b)*t+ps->splines[1].c;
- }
-
- start.x = data[qcnt-1].bp.x;
- start.y = data[qcnt-1].bp.y;
- splineunit.x = end.x - start.x;
- splineunit.y = end.y - start.y;
- splinelen = sqrt(splineunit.x*splineunit.x + splineunit.y*splineunit.y);
- if ( splinelen!=0 ) {
- splineunit.x /= splinelen;
- splineunit.y /= splinelen;
- }
- do_good_spline_check = SplineWithWellBehavedControlPoints(ps);
-
- if ( round_to_int && tmax!=1 ) {
- end.x = rint( end.x );
- end.y = rint( end.y );
- }
-
- dx = end.x-data[qcnt-1].bp.x; dy = end.y-data[qcnt-1].bp.y;
- distance = dx*dx + dy*dy;
-
- if ( distance<.3 ) {
- /* This is meaningless in truetype, use a line */
- data[qcnt-1].cp = data[qcnt-1].bp;
- data[qcnt].bp = end;
- data[qcnt].t = 1;
-return( qcnt+1 );
- }
-
- for ( ptcnt=0; ptcnt<10; ++ptcnt ) {
- if ( ptcnt>1 && distance/(ptcnt*ptcnt)<100 )
-return( -1 ); /* Points too close for a good approx */
- q = qcnt;
- data2[ptcnt+1].bp = end;
- lastpos=0; lastpos2 = splinelen;
- for ( i=0; i<=ptcnt; ++i ) {
- tstart = (tmin*(ptcnt-i) + tmax*(i+1))/(ptcnt+1);
- mid.x = ((ps->splines[0].a*tstart+ps->splines[0].b)*tstart+ps->splines[0].c)*tstart+ps->splines[0].d;
- mid.y = ((ps->splines[1].a*tstart+ps->splines[1].b)*tstart+ps->splines[1].c)*tstart+ps->splines[1].d;
- if ( i==0 ) {
- slopemid.x = (3*ps->splines[0].a*tstart+2*ps->splines[0].b)*tstart+ps->splines[0].c;
- slopemid.y = (3*ps->splines[1].a*tstart+2*ps->splines[1].b)*tstart+ps->splines[1].c;
- if ( slopemid.x==0 )
- data[q-1].cp.x=mid.x;
- else if ( slopemin.x==0 )
- data[q-1].cp.x=data[q-1].bp.x;
- else if ( RealNear(slopemin.y/slopemin.x,slopemid.y/slopemid.x) )
- break;
- else
- data[q-1].cp.x = -(data[q-1].bp.y-(slopemin.y/slopemin.x)*data[q-1].bp.x-mid.y+(slopemid.y/slopemid.x)*mid.x)/(slopemin.y/slopemin.x-slopemid.y/slopemid.x);
- if ( slopemid.y==0 )
- data[q-1].cp.y=mid.y;
- else if ( slopemin.y==0 )
- data[q-1].cp.y=data[q-1].bp.y;
- else if ( RealNear(slopemin.x/slopemin.y,slopemid.x/slopemid.y) )
- break;
- else
- data[q-1].cp.y = -(data[q-1].bp.x-(slopemin.x/slopemin.y)*data[q-1].bp.y-mid.x+(slopemid.x/slopemid.y)*mid.y)/(slopemin.x/slopemin.y-slopemid.x/slopemid.y);
- } else {
- data[q-1].cp.x = 2*data[q-1].bp.x - data[q-2].cp.x;
- data[q-1].cp.y = 2*data[q-1].bp.y - data[q-2].cp.y;
- }
-
- midpos = (mid.x-start.x)*splineunit.x + (mid.y-start.y)*splineunit.y;
- cppos = (data[q-1].cp.x-start.x)*splineunit.x + (data[q-1].cp.y-start.y)*splineunit.y;
-
- if ( ((do_good_spline_check || i!=0 ) && cppos<lastpos) || cppos>midpos ) {
- i = 0; /* Means we failed */
- break;
- }
- lastpos = midpos;
-
- data[q].bp = mid;
- data[q++].t = tstart;
-
- tstart = (tmax*(ptcnt-i) + tmin*(i+1))/(ptcnt+1);
- mid.x = ((ps->splines[0].a*tstart+ps->splines[0].b)*tstart+ps->splines[0].c)*tstart+ps->splines[0].d;
- mid.y = ((ps->splines[1].a*tstart+ps->splines[1].b)*tstart+ps->splines[1].c)*tstart+ps->splines[1].d;
- if ( i==0 ) {
- slopemid.x = (3*ps->splines[0].a*tstart+2*ps->splines[0].b)*tstart+ps->splines[0].c;
- slopemid.y = (3*ps->splines[1].a*tstart+2*ps->splines[1].b)*tstart+ps->splines[1].c;
- if ( slopemid.x==0 )
- data2[ptcnt-i].cp.x=mid.x;
- else if ( slopeend.x==0 )
- data2[ptcnt-i].cp.x=data2[ptcnt-i+1].bp.x;
- else if ( RealNear(slopeend.y/slopeend.x,slopemid.y/slopemid.x) )
- break;
- else
- data2[ptcnt-i].cp.x = -(data2[ptcnt-i+1].bp.y-(slopeend.y/slopeend.x)*data2[ptcnt-i+1].bp.x-mid.y+(slopemid.y/slopemid.x)*mid.x)/(slopeend.y/slopeend.x-slopemid.y/slopemid.x);
- if ( slopemid.y==0 )
- data2[ptcnt-i].cp.y=mid.y;
- else if ( slopeend.y==0 )
- data2[ptcnt-i].cp.y=data2[ptcnt-i+1].bp.y;
- else if ( RealNear(slopeend.x/slopeend.y,slopemid.x/slopemid.y) )
- break;
- else
- data2[ptcnt-i].cp.y = -(data2[ptcnt-i+1].bp.x-(slopeend.x/slopeend.y)*data2[ptcnt-i+1].bp.y-mid.x+(slopemid.x/slopemid.y)*mid.y)/(slopeend.x/slopeend.y-slopemid.x/slopemid.y);
- } else {
- data2[ptcnt-i].cp.x = 2*data2[ptcnt-i+1].bp.x - data2[ptcnt-i+1].cp.x;
- data2[ptcnt-i].cp.y = 2*data2[ptcnt-i+1].bp.y - data2[ptcnt-i+1].cp.y;
- }
- data2[ptcnt-i].bp = mid;
-
- midpos = (mid.x-start.x)*splineunit.x + (mid.y-start.y)*splineunit.y;
- cppos = (data2[ptcnt-i].cp.x-start.x)*splineunit.x + (data2[ptcnt-i].cp.y-start.y)*splineunit.y;
- if ( ((do_good_spline_check || i!=0 ) && cppos>lastpos2) || cppos<midpos ) {
- i = 0; /* Means we failed */
- break;
- }
- lastpos2 = midpos;
-
- }
- if ( i==0 )
- continue;
- if ( (data2[ptcnt+1].bp.x-data2[ptcnt].bp.x)*(data2[ptcnt].cp.x-data2[ptcnt].bp.x)<0 ||
- (data2[ptcnt+1].bp.y-data2[ptcnt].bp.y)*(data2[ptcnt].cp.y-data2[ptcnt].bp.y)<0 ) {
- /* data2 are bad ... don't use them */;
- } else if ( (data[qcnt-1].bp.x-data[qcnt].bp.x)*(data[qcnt-1].cp.x-data[qcnt].bp.x)<0 ||
- (data[qcnt-1].bp.y-data[qcnt].bp.y)*(data[qcnt-1].cp.y-data[qcnt].bp.y)<0 ) {
- /* data are bad */;
- for ( i=0; i<=ptcnt; ++i ) {
- data[qcnt+i-1].cp = data2[i].cp;
- data[qcnt+i-1].bp = data2[i].bp;
- }
- } else {
- for ( i=0; i<=ptcnt; ++i ) {
- if ( ptcnt!=0 ) {
- data[qcnt+i-1].cp.x = (data[qcnt+i-1].cp.x*(ptcnt-i) + data2[i].cp.x*i)/ptcnt;
- data[qcnt+i-1].cp.y = (data[qcnt+i-1].cp.y*(ptcnt-i) + data2[i].cp.y*i)/ptcnt;
- }
- }
- }
- if ( round_to_int ) {
- for ( i=0; i<=ptcnt; ++i ) {
- data[qcnt+i-1].cp.x = rint( data[qcnt+i-1].cp.x );
- data[qcnt+i-1].cp.y = rint( data[qcnt+i-1].cp.y );
- }
- }
- for ( i=0; i<ptcnt; ++i ) {
- data[qcnt+i].bp.x = (data[qcnt+i].cp.x + data[qcnt+i-1].cp.x)/2;
- data[qcnt+i].bp.y = (data[qcnt+i].cp.y + data[qcnt+i-1].cp.y)/2;
- }
- if ( comparedata(ps,data,qcnt,q,round_to_int))
-return( q );
- }
-return( -1 );
-}
-#endif
-
-static SplinePoint *AlreadyQuadraticCheck(Spline *ps, SplinePoint *start) {
- SplinePoint *sp;
-
- if ( (RealNearish(ps->splines[0].a,0) && RealNearish(ps->splines[1].a,0)) ||
- ((ps->splines[0].b!=0 && RealNearish(ps->splines[0].a/ps->splines[0].b,0)) &&
- (ps->splines[1].b!=0 && RealNearish(ps->splines[1].a/ps->splines[1].b,0))) ) {
- /* Already Quadratic, just need to find the control point */
- /* Or linear, in which case we don't need to do much of anything */
- Spline *spline;
- sp = chunkalloc(sizeof(SplinePoint));
- sp->me.x = ps->to->me.x; sp->me.y = ps->to->me.y;
- sp->roundx = ps->to->roundx; sp->roundy = ps->to->roundy; sp->dontinterpolate = ps->to->dontinterpolate;
- sp->ttfindex = 0xfffe;
- sp->nextcpindex = 0xfffe;
- sp->nonextcp = true;
- spline = chunkalloc(sizeof(Spline));
- spline->order2 = true;
- spline->from = start;
- spline->to = sp;
- spline->splines[0] = ps->splines[0]; spline->splines[1] = ps->splines[1];
- start->next = sp->prev = spline;
- if ( ps->knownlinear ) {
- spline->islinear = spline->knownlinear = true;
- start->nonextcp = sp->noprevcp = true;
- start->nextcp = start->me;
- sp->prevcp = sp->me;
- } else {
- start->nonextcp = sp->noprevcp = false;
- start->nextcp.x = sp->prevcp.x = (ps->splines[0].c+2*ps->splines[0].d)/2;
- start->nextcp.y = sp->prevcp.y = (ps->splines[1].c+2*ps->splines[1].d)/2;
- }
-return( sp );
- }
-return( NULL );
-}
-
-static SplinePoint *ttfApprox(Spline *ps, SplinePoint *start) {
-#if !defined(FONTFORGE_CONFIG_NON_SYMMETRIC_QUADRATIC_CONVERSION)
- extended magicpoints[6], last;
- int cnt, i, j, qcnt;
- QPoint data[8*10];
- int round_to_int =
- /* The end points are at integer points, or one coord is at half while */
- /* the other is at an integer (ie. condition for ttf interpolated point)*/
- ((ps->from->me.x==rint(ps->from->me.x) &&
- ps->from->me.y==rint(ps->from->me.y)) ||
- (ps->from->me.x==rint(ps->from->me.x) &&
- ps->from->me.x==ps->from->nextcp.x &&
- ps->from->me.y!=ps->from->nextcp.y &&
- 2*ps->from->me.y==rint(2*ps->from->me.y)) ||
- (ps->from->me.y==rint(ps->from->me.y) &&
- ps->from->me.y==ps->from->nextcp.y &&
- ps->from->me.x!=ps->from->nextcp.x &&
- 2*ps->from->me.x==rint(2*ps->from->me.x)) ) &&
- ((ps->to->me.x == rint(ps->to->me.x) &&
- ps->to->me.y == rint(ps->to->me.y)) ||
- (ps->to->me.x==rint(ps->to->me.x) &&
- ps->to->me.x==ps->to->prevcp.x &&
- ps->to->me.y!=ps->to->prevcp.y &&
- 2*ps->to->me.y==rint(2*ps->to->me.y)) ||
- (ps->to->me.y==rint(ps->to->me.y) &&
- ps->to->me.y==ps->to->prevcp.y &&
- ps->to->me.x!=ps->to->prevcp.x &&
- 2*ps->to->me.x==rint(2*ps->to->me.x)) );
-#endif
- SplinePoint *ret;
-/* Divide the spline up at extrema and points of inflection. The first */
-/* because ttf splines should have points at their extrema, the second */
-/* because quadratic splines can't have points of inflection. */
-/* Let's not do the first (extrema) AddExtrema does this better and we */
-/* don't want unneeded extrema. */
-/* And sometimes we don't want to look at the points of inflection either*/
-
- if (( ret = AlreadyQuadraticCheck(ps,start))!=NULL )
-return( ret );
-
-#if !defined(FONTFORGE_CONFIG_NON_SYMMETRIC_QUADRATIC_CONVERSION)
- qcnt = 1;
- data[0].bp = ps->from->me;
- data[0].t = 0;
- qcnt = PrettyApprox(ps,0,1,data,qcnt,round_to_int);
- if ( qcnt!=-1 )
-return( CvtDataToSplines(data,1,qcnt,start));
-
- cnt = 0;
- /* cnt = Spline2DFindExtrema(ps,magicpoints);*/
-
- cnt += Spline2DFindPointsOfInflection(ps,magicpoints+cnt);
-
- /* remove points outside range */
- for ( i=0; i<cnt; ++i ) {
- if ( magicpoints[i]<=0 || magicpoints[i]>=1 ) {
- for ( j=i+1; j<cnt; ++j )
- magicpoints[j-1] = magicpoints[j];
- --cnt;
- --i;
- }
- }
- /* sort points */
- for ( i=0; i<cnt; ++i ) for ( j=i+1; j<cnt; ++j ) {
- if ( magicpoints[i]>magicpoints[j] ) {
- double temp = magicpoints[i];
- magicpoints[i] = magicpoints[j];
- magicpoints[j] = temp;
- }
- }
- /* Remove duplicates */
- for ( i=1; i<cnt; ++i ) {
- while ( i<cnt && RealNear(magicpoints[i-1],magicpoints[i])) {
- --cnt;
- for ( j=i ; j<cnt; ++j )
- magicpoints[j] = magicpoints[j+1];
- magicpoints[cnt] = -1;
- }
- }
-
- qcnt = 1;
- last = 0;
- for ( i=0; i<cnt; ++i ) {
- qcnt = PrettyApprox(ps,last,magicpoints[i],data,qcnt,round_to_int);
- last = magicpoints[i];
- }
- qcnt = PrettyApprox(ps,last,1,data,qcnt,round_to_int);
- if ( qcnt!=-1 )
-return( CvtDataToSplines(data,1,qcnt,start));
-#endif
-
-return( __ttfApprox(ps,0,1,start));
-}
-
-static void ttfCleanup(SplinePoint *from) {
- SplinePoint *test, *next;
-
- for ( test = from; test->next!=NULL; test = next ) {
- next = test->next->to;
- /* Too close together to be meaningful when output as ttf */
- if ( rint(test->me.x) == rint(next->me.x) &&
- rint(test->me.y) == rint(next->me.y) ) {
- if ( next->next==NULL || next==from ) {
- if ( test==from )
- break;
- next->prevcp = test->prevcp;
- next->noprevcp = test->noprevcp;
- next->prev = test->prev;
- next->prev->to = next;
- SplineFree(test->next);
- SplinePointFree(test);
- } else {
- test->nextcp = next->nextcp;
- test->nonextcp = next->nonextcp;
- test->next = next->next;
- test->next->from = test;
- SplineFree(next->prev);
- SplinePointFree(next);
- next = test->next->to;
- }
- }
- if ( next==from )
- break;
- }
-}
-
-SplinePoint *SplineTtfApprox(Spline *ps) {
- SplinePoint *from;
- from = chunkalloc(sizeof(SplinePoint));
- *from = *ps->from;
- from->hintmask = NULL;
- ttfApprox(ps,from);
-return( from );
-}
-
-SplineSet *SSttfApprox(SplineSet *ss) {
- SplineSet *ret = chunkalloc(sizeof(SplineSet));
- Spline *spline, *first;
-
- ret->first = chunkalloc(sizeof(SplinePoint));
- *ret->first = *ss->first;
- if ( ret->first->hintmask != NULL ) {
- ret->first->hintmask = chunkalloc(sizeof(HintMask));
- memcpy(ret->first->hintmask,ss->first->hintmask,sizeof(HintMask));
- }
- ret->last = ret->first;
-
- first = NULL;
- for ( spline=ss->first->next; spline!=NULL && spline!=first; spline=spline->to->next ) {
- ret->last = ttfApprox(spline,ret->last);
- ret->last->ptindex = spline->to->ptindex;
- ret->last->ttfindex = spline->to->ttfindex;
- ret->last->nextcpindex = spline->to->nextcpindex;
- if ( spline->to->hintmask != NULL ) {
- ret->last->hintmask = chunkalloc(sizeof(HintMask));
- memcpy(ret->last->hintmask,spline->to->hintmask,sizeof(HintMask));
- }
- if ( first==NULL ) first = spline;
- }
- if ( ss->first==ss->last ) {
- if ( ret->last!=ret->first ) {
- ret->first->prevcp = ret->last->prevcp;
- ret->first->noprevcp = ret->last->noprevcp;
- ret->first->prev = ret->last->prev;
- ret->last->prev->to = ret->first;
- SplinePointFree(ret->last);
- ret->last = ret->first;
- }
- }
- ttfCleanup(ret->first);
- SPLCatagorizePoints(ret);
-return( ret );
-}
-
-SplineSet *SplineSetsTTFApprox(SplineSet *ss) {
- SplineSet *head=NULL, *last, *cur;
-
- while ( ss!=NULL ) {
- cur = SSttfApprox(ss);
- if ( head==NULL )
- head = cur;
- else
- last->next = cur;
- last = cur;
- ss = ss->next;
- }
-return( head );
-}
-
-SplineSet *SSPSApprox(SplineSet *ss) {
- SplineSet *ret = chunkalloc(sizeof(SplineSet));
- Spline *spline, *first;
- SplinePoint *to;
-
- ret->first = chunkalloc(sizeof(SplinePoint));
- *ret->first = *ss->first;
- if ( ret->first->hintmask != NULL ) {
- ret->first->hintmask = chunkalloc(sizeof(HintMask));
- memcpy(ret->first->hintmask,ss->first->hintmask,sizeof(HintMask));
- }
- ret->last = ret->first;
-
- first = NULL;
- for ( spline=ss->first->next; spline!=NULL && spline!=first; spline=spline->to->next ) {
- to = chunkalloc(sizeof(SplinePoint));
- *to = *spline->to;
- if ( to->hintmask != NULL ) {
- to->hintmask = chunkalloc(sizeof(HintMask));
- memcpy(to->hintmask,spline->to->hintmask,sizeof(HintMask));
- }
- if ( !spline->knownlinear ) {
- ret->last->nextcp.x = spline->splines[0].c/3 + ret->last->me.x;
- ret->last->nextcp.y = spline->splines[1].c/3 + ret->last->me.y;
- to->prevcp.x = ret->last->nextcp.x+ (spline->splines[0].b+spline->splines[0].c)/3;
- to->prevcp.y = ret->last->nextcp.y+ (spline->splines[1].b+spline->splines[1].c)/3;
- }
- SplineMake3(ret->last,to);
- ret->last = to;
- if ( first==NULL ) first = spline;
- }
- if ( ss->first==ss->last ) {
- if ( ret->last!=ret->first ) {
- ret->first->prevcp = ret->last->prevcp;
- ret->first->noprevcp = ret->last->noprevcp;
- ret->first->prev = ret->last->prev;
- ret->last->prev->to = ret->first;
- SplinePointFree(ret->last);
- ret->last = ret->first;
- }
- }
- ret->is_clip_path = ss->is_clip_path;
-return( ret );
-}
-
-SplineSet *SplineSetsPSApprox(SplineSet *ss) {
- SplineSet *head=NULL, *last, *cur;
-
- while ( ss!=NULL ) {
- cur = SSPSApprox(ss);
- if ( head==NULL )
- head = cur;
- else
- last->next = cur;
- last = cur;
- ss = ss->next;
- }
-return( head );
-}
-
-void SCConvertLayerToOrder2(SplineChar *sc,int layer) {
- SplineSet *new;
-
- if ( sc==NULL )
-return;
-
- new = SplineSetsTTFApprox(sc->layers[layer].splines);
- SplinePointListsFree(sc->layers[layer].splines);
- sc->layers[layer].splines = new;
-
- UndoesFree(sc->layers[layer].undoes);
- UndoesFree(sc->layers[layer].redoes);
- sc->layers[layer].undoes = NULL;
- sc->layers[layer].redoes = NULL;
- sc->layers[layer].order2 = true;
-
- MinimumDistancesFree(sc->md); sc->md = NULL;
-}
-
-void SCConvertToOrder2(SplineChar *sc) {
- int layer;
-
- if ( sc==NULL )
-return;
-
- for ( layer=ly_back; layer<sc->layer_cnt; ++layer )
- SCConvertLayerToOrder2(sc,layer);
-}
-
-
-/* ************************************************************************** */
-
-void SplineRefigure2(Spline *spline) {
- SplinePoint *from = spline->from, *to = spline->to;
- Spline1D *xsp = &spline->splines[0], *ysp = &spline->splines[1];
- Spline old;
-
-#ifdef DEBUG
- if ( RealNear(from->me.x,to->me.x) && RealNear(from->me.y,to->me.y))
- IError("Zero length spline created");
-#endif
- if ( spline->acceptableextrema )
- old = *spline;
-
- if ( from->nonextcp || to->noprevcp ||
- ( from->nextcp.x==from->me.x && from->nextcp.y == from->me.y ) ||
- ( to->prevcp.x==to->me.x && to->prevcp.y == to->me.y )) {
- from->nonextcp = to->noprevcp = true;
- from->nextcp = from->me;
- to->prevcp = to->me;
- }
-
- if ( from->nonextcp && to->noprevcp )
- /* Ok */;
- else if ( from->nonextcp || to->noprevcp || from->nextcp.x!=to->prevcp.x ||
- from->nextcp.y!=to->prevcp.y ) {
- if ( RealNear(from->nextcp.x,to->prevcp.x) &&
- RealNear(from->nextcp.y,to->prevcp.y)) {
- from->nextcp.x = to->prevcp.x = (from->nextcp.x+to->prevcp.x)/2;
- from->nextcp.y = to->prevcp.y = (from->nextcp.y+to->prevcp.y)/2;
- } else {
- IError("Invalid 2nd order spline in SplineRefigure2" );
-#ifndef GWW_TEST
- /* I don't want these to go away when I'm debugging. I want to */
- /* know how I got them */
- from->nextcp.x = to->prevcp.x = (from->nextcp.x+to->prevcp.x)/2;
- from->nextcp.y = to->prevcp.y = (from->nextcp.y+to->prevcp.y)/2;
-#endif
- }
- }
-
- xsp->d = from->me.x; ysp->d = from->me.y;
- if ( from->nonextcp && to->noprevcp ) {
- spline->islinear = true;
- xsp->c = to->me.x-from->me.x;
- ysp->c = to->me.y-from->me.y;
- xsp->a = xsp->b = 0;
- ysp->a = ysp->b = 0;
- } else {
- /* from p. 393 (Operator Details, curveto) Postscript Lang. Ref. Man. (Red book) */
- xsp->c = 2*(from->nextcp.x-from->me.x);
- ysp->c = 2*(from->nextcp.y-from->me.y);
- xsp->b = to->me.x-from->me.x-xsp->c;
- ysp->b = to->me.y-from->me.y-ysp->c;
- xsp->a = 0;
- ysp->a = 0;
- if ( RealNear(xsp->c,0)) xsp->c=0;
- if ( RealNear(ysp->c,0)) ysp->c=0;
- if ( RealNear(xsp->b,0)) xsp->b=0;
- if ( RealNear(ysp->b,0)) ysp->b=0;
- spline->islinear = false;
- if ( ysp->b==0 && xsp->b==0 )
- spline->islinear = true; /* This seems extremely unlikely... */
- }
- if ( isnan(ysp->b) || isnan(xsp->b) )
- IError("NaN value in spline creation");
- LinearApproxFree(spline->approx);
- spline->approx = NULL;
- spline->knowncurved = false;
- spline->knownlinear = spline->islinear;
- SplineIsLinear(spline);
- spline->isquadratic = !spline->knownlinear;
- spline->order2 = true;
-
- if ( spline->acceptableextrema ) {
- /* I don't check "d", because changes to that reflect simple */
- /* translations which will not affect the shape of the spline */
- /* (I don't check "a" because it is always 0 in a quadratic spline) */
- if ( !RealNear(old.splines[0].b,spline->splines[0].b) ||
- !RealNear(old.splines[0].c,spline->splines[0].c) ||
- !RealNear(old.splines[1].b,spline->splines[1].b) ||
- !RealNear(old.splines[1].c,spline->splines[1].c) )
- spline->acceptableextrema = false;
- }
-}
-
-void SplineRefigure(Spline *spline) {
- if ( spline==NULL )
-return;
- if ( spline->order2 )
- SplineRefigure2(spline);
- else
- SplineRefigure3(spline);
-}
-
-static int IsHV(Spline *spline, int isfrom) {
- SplinePoint *sp;
-
- if ( spline==NULL )
-return( false );
-
- if ( !isfrom ) {
- sp = spline->to;
- if ( sp->noprevcp )
-return( false );
- if ( sp->me.x == sp->prevcp.x )
-return( 2 ); /* Vertical */
- else if ( sp->me.y == sp->prevcp.y )
-return( 1 ); /* Horizontal */
- else
-return( 0 ); /* Neither */
- } else {
- sp = spline->from;
- if ( sp->nonextcp )
-return( false );
- if ( sp->me.x == sp->nextcp.x )
-return( 2 ); /* Vertical */
- else if ( sp->me.y == sp->nextcp.y )
-return( 1 ); /* Horizontal */
- else
-return( 0 ); /* Neither */
- }
-}
-
-void SplineRefigureFixup(Spline *spline) {
- SplinePoint *from, *to, *prev, *next;
- BasePoint foff, toff, unit, new;
- double len;
- enum pointtype fpt, tpt;
- int done = false;
- extern int snaptoint;
-
- if ( !spline->order2 ) {
- SplineRefigure3(spline);
-return;
- }
- from = spline->from; to = spline->to;
- if ( from->pointtype==pt_hvcurve && to->pointtype==pt_hvcurve ) {
- done = true;
- if ( !IsHV(from->prev,0) && !IsHV(to->next,1) ) {
- if ( to->me.x == from->me.x ) {
- from->nextcp.x = to->prevcp.x = to->me.x;
- from->nextcp.y = to->prevcp.y = (from->me.y+from->me.y)/2;
- } else if ( to->me.y==from->me.y ) {
- from->nextcp.y = to->prevcp.y = to->me.y;
- from->nextcp.x = to->prevcp.x = (from->me.x+from->me.x)/2;
- /* Assume they are drawing clockwise */
- } else if (( to->me.x>from->me.x && to->me.y>=from->me.y ) ||
- (to->me.x<from->me.x && to->me.y<=from->me.y )) {
- from->nextcp.x = to->prevcp.x = from->me.x;
- from->nextcp.y = to->prevcp.y = to->me.y;
- } else {
- from->nextcp.x = to->prevcp.x = to->me.x;
- from->nextcp.y = to->prevcp.y = from->me.y;
- }
- } else if ( !IsHV(to->next,1)) {
- if ( IsHV(from->prev,0)==1 ) {
- from->nextcp.x = to->prevcp.x = to->me.x;
- from->nextcp.y = to->prevcp.y = from->me.y;
- } else {
- from->nextcp.x = to->prevcp.x = from->me.x;
- from->nextcp.y = to->prevcp.y = to->me.y;
- }
- } else if ( !IsHV(from->prev,0)) {
- if ( IsHV(to->next,1)==1 ) {
- from->nextcp.x = to->prevcp.x = from->me.x;
- from->nextcp.y = to->prevcp.y = to->me.y;
- } else {
- from->nextcp.x = to->prevcp.x = to->me.x;
- from->nextcp.y = to->prevcp.y = from->me.y;
- }
- } else {
- if ( IsHV(from->prev,0)==1 && IsHV(to->next,1)==2 ) {
- from->nextcp.x = to->prevcp.x = to->me.x;
- from->nextcp.y = to->prevcp.y = from->me.y;
- } else if ( IsHV(from->prev,0)==2 && IsHV(to->next,1)==1 ) {
- from->nextcp.x = to->prevcp.x = from->me.x;
- from->nextcp.y = to->prevcp.y = to->me.y;
- } else
- done = false;
- }
- if ( done )
- to->noprevcp = from->nonextcp = false;
- }
-
- if ( !done ) {
- unit.x = from->nextcp.x-from->me.x;
- unit.y = from->nextcp.y-from->me.y;
- len = sqrt(unit.x*unit.x + unit.y*unit.y);
- if ( len!=0 )
- unit.x /= len; unit.y /= len;
-
- if ( (fpt = from->pointtype)==pt_hvcurve ) fpt = pt_curve;
- if ( (tpt = to->pointtype)==pt_hvcurve ) tpt = pt_curve;
- if ( from->nextcpdef && to->prevcpdef ) switch ( fpt*3+tpt ) {
- case pt_corner*3+pt_corner:
- case pt_corner*3+pt_tangent:
- case pt_tangent*3+pt_corner:
- case pt_tangent*3+pt_tangent:
- from->nonextcp = to->noprevcp = true;
- from->nextcp = from->me;
- to->prevcp = to->me;
- break;
- case pt_curve*3+pt_curve:
- case pt_curve*3+pt_corner:
- case pt_corner*3+pt_curve:
- case pt_tangent*3+pt_curve:
- case pt_curve*3+pt_tangent:
- if ( from->prev!=NULL && (from->pointtype==pt_tangent || from->pointtype==pt_hvcurve)) {
- prev = from->prev->from;
- foff.x = prev->me.x;
- foff.y = prev->me.y;
- } else if ( from->prev!=NULL ) {
- prev = from->prev->from;
- foff.x = to->me.x-prev->me.x + from->me.x;
- foff.y = to->me.y-prev->me.y + from->me.y;
- } else {
- foff.x = from->me.x + (to->me.x-from->me.x)-(to->me.y-from->me.y);
- foff.y = from->me.y + (to->me.x-from->me.x)+(to->me.y-from->me.y);
- prev = NULL;
- }
- if ( to->next!=NULL && (to->pointtype==pt_tangent || to->pointtype==pt_hvcurve)) {
- next = to->next->to;
- toff.x = next->me.x;
- toff.y = next->me.y;
- } else if ( to->next!=NULL ) {
- next = to->next->to;
- toff.x = next->me.x-from->me.x + to->me.x;
- toff.y = next->me.y-from->me.y + to->me.y;
- } else {
- toff.x = to->me.x + (to->me.x-from->me.x)+(to->me.y-from->me.y);
- toff.y = to->me.y - (to->me.x-from->me.x)+(to->me.y-from->me.y);
- next = NULL;
- }
- if (( from->pointtype==pt_hvcurve && foff.x!=from->me.x && foff.y!=from->me.y ) ||
- ( to->pointtype==pt_hvcurve && toff.x!=to->me.x && toff.y!=to->me.y )) {
- if ( from->me.x == to->me.x ) {
- if ( from->pointtype==pt_hvcurve )
- foff.x = from->me.x;
- if ( to->pointtype==pt_hvcurve )
- toff.x = to->me.x;
- } else if ( from->me.y == to->me.y ) {
- if ( from->pointtype==pt_hvcurve )
- foff.y = from->me.y;
- if ( to->pointtype==pt_hvcurve )
- toff.y = to->me.y;
- } else {
- if ( from->pointtype==pt_hvcurve && foff.x!=from->me.x && foff.y!=from->me.y ) {
- if ( fabs(foff.x-from->me.x) > fabs(foff.y-from->me.y) )
- foff.y = from->me.y;
- else
- foff.x = from->me.x;
- }
- if ( to->pointtype==pt_hvcurve && toff.x!=to->me.x && toff.y!=to->me.y ) {
- if ( from->pointtype==pt_hvcurve ) {
- if ( from->me.x==foff.x )
- toff.y = to->me.y;
- else
- toff.x = to->me.x;
- } else if ( fabs(toff.x-to->me.x) > fabs(toff.y-to->me.y) )
- toff.y = to->me.y;
- else
- toff.x = to->me.x;
- }
- }
- }
- if ( IntersectLinesClip(&from->nextcp,&foff,&from->me,&toff,&to->me)) {
- from->nonextcp = to->noprevcp = false;
- to->prevcp = from->nextcp;
- if ( (from->pointtype==pt_curve || from->pointtype==pt_hvcurve ) &&
- !from->noprevcp && from->prev!=NULL ) {
- prev = from->prev->from;
- if ( IntersectLinesClip(&from->prevcp,&from->nextcp,&from->me,&prev->nextcp,&prev->me)) {
- prev->nextcp = from->prevcp;
- SplineRefigure2(from->prev);
- }
- }
- if ( (to->pointtype==pt_curve || to->pointtype==pt_hvcurve) &&
- !to->nonextcp && to->next!=NULL ) {
- next = to->next->to;
- if ( IntersectLinesClip(&to->nextcp,&to->prevcp,&to->me,&next->prevcp,&next->me)) {
- next->prevcp = to->nextcp;
- SplineRefigure(to->next);
- }
- }
- }
- break;
- } else {
- /* Can't set things arbetrarily here, but make sure they are consistant */
- if ( (from->pointtype==pt_curve || from->pointtype==pt_hvcurve ) &&
- !from->noprevcp && !from->nonextcp ) {
- unit.x = from->nextcp.x-from->me.x;
- unit.y = from->nextcp.y-from->me.y;
- len = sqrt(unit.x*unit.x + unit.y*unit.y);
- if ( len!=0 ) {
- unit.x /= len; unit.y /= len;
- len = sqrt((from->prevcp.x-from->me.x)*(from->prevcp.x-from->me.x) + (from->prevcp.y-from->me.y)*(from->prevcp.y-from->me.y));
- new.x = -len*unit.x + from->me.x; new.y = -len*unit.y + from->me.y;
- if ( new.x-from->prevcp.x<-1 || new.x-from->prevcp.x>1 ||
- new.y-from->prevcp.y<-1 || new.y-from->prevcp.y>1 ) {
- prev = NULL;
- if ( from->prev!=NULL && (prev = from->prev->from)!=NULL &&
- IntersectLinesClip(&from->prevcp,&new,&from->me,&prev->nextcp,&prev->me)) {
- prev->nextcp = from->prevcp;
- SplineRefigure2(from->prev);
- } else {
- from->prevcp = new;
- if ( prev!=NULL )
- prev->nextcp = new;
- }
- }
- }
- } else if ( from->pointtype==pt_tangent ) {
- if ( from->prev!=NULL ) {
- prev = from->prev->from;
- if ( !from->noprevcp && !prev->nonextcp &&
- IntersectLinesClip(&from->prevcp,&to->me,&from->me,&prev->nextcp,&prev->me)) {
- prev->nextcp = from->prevcp;
- SplineRefigure2(from->prev);
- }
- if ( !from->nonextcp && !to->noprevcp &&
- IntersectLinesClip(&from->nextcp,&prev->me,&from->me,&to->prevcp,&to->me))
- to->prevcp = from->nextcp;
- }
- }
- if ( (to->pointtype==pt_curve || to->pointtype==pt_hvcurve ) &&
- !to->noprevcp && !to->nonextcp ) {
- unit.x = to->prevcp.x-to->nextcp.x;
- unit.y = to->prevcp.y-to->nextcp.y;
- len = sqrt(unit.x*unit.x + unit.y*unit.y);
- if ( len!=0 ) {
- unit.x /= len; unit.y /= len;
- len = sqrt((to->nextcp.x-to->me.x)*(to->nextcp.x-to->me.x) + (to->nextcp.y-to->me.y)*(to->nextcp.y-to->me.y));
- new.x = -len*unit.x + to->me.x; new.y = -len*unit.y + to->me.y;
- if ( new.x-to->nextcp.x<-1 || new.x-to->nextcp.x>1 ||
- new.y-to->nextcp.y<-1 || new.y-to->nextcp.y>1 ) {
- if ( to->next!=NULL && (next = to->next->to)!=NULL &&
- IntersectLinesClip(&to->nextcp,&new,&to->me,&next->prevcp,&next->me)) {
- next->prevcp = to->nextcp;
- SplineRefigure2(to->next);
- } else {
- to->nextcp = new;
- if ( to->next!=NULL ) {
- to->next->to->prevcp = new;
- SplineRefigure(to->next);
- }
- }
- }
- }
- } else if ( to->pointtype==pt_tangent ) {
- if ( to->next!=NULL ) {
- next = to->next->to;
- if ( !to->nonextcp && !next->noprevcp &&
- IntersectLinesClip(&to->nextcp,&from->me,&to->me,&next->prevcp,&next->me)) {
- next->prevcp = to->nextcp;
- SplineRefigure2(to->next);
- }
- if ( !from->nonextcp && !to->noprevcp &&
- IntersectLinesClip(&from->nextcp,&next->me,&to->me,&from->nextcp,&from->me))
- to->prevcp = from->nextcp;
- }
- }
- }
- if ( from->nonextcp && to->noprevcp )
- /* Ok */;
- else if ( from->nonextcp || to->noprevcp ) {
- from->nonextcp = to->noprevcp = true;
- } else if (( from->nextcp.x==from->me.x && from->nextcp.y==from->me.y ) ||
- ( to->prevcp.x==to->me.x && to->prevcp.y==to->me.y ) ) {
- from->nonextcp = to->noprevcp = true;
- } else if ( from->nonextcp || to->noprevcp || from->nextcp.x!=to->prevcp.x ||
- from->nextcp.y!=to->prevcp.y ) {
- if ( !IntersectLinesClip(&from->nextcp,
- (from->pointtype==pt_tangent && from->prev!=NULL)?&from->prev->from->me:&from->nextcp, &from->me,
- (to->pointtype==pt_tangent && to->next!=NULL)?&to->next->to->me:&to->prevcp, &to->me)) {
- from->nextcp.x = (from->me.x+to->me.x)/2;
- from->nextcp.y = (from->me.y+to->me.y)/2;
- }
- to->prevcp = from->nextcp;
- if (( from->nextcp.x==from->me.x && from->nextcp.y==from->me.y ) ||
- ( to->prevcp.x==to->me.x && to->prevcp.y==to->me.y ) ) {
- from->nonextcp = to->noprevcp = true;
- from->nextcp = from->me;
- to->prevcp = to->me;
- }
- }
- }
- if ( snaptoint && !from->nonextcp ) {
- from->nextcp.x = to->prevcp.x = rint(from->nextcp.x);
- from->nextcp.y = to->prevcp.y = rint(from->nextcp.y);
- }
- SplineRefigure2(spline);
-
- /* Now in order2 splines it is possible to request combinations that are */
- /* mathematically impossible -- two adjacent hv points often don't work */
- if ( to->pointtype==pt_hvcurve &&
- !(to->prevcp.x == to->me.x && to->prevcp.y != to->me.y ) &&
- !(to->prevcp.y == to->me.y && to->prevcp.x != to->me.x ) )
- to->pointtype = pt_curve;
- if ( from->pointtype==pt_hvcurve &&
- !(from->nextcp.x == from->me.x && from->nextcp.y != from->me.y ) &&
- !(from->nextcp.y == from->me.y && from->nextcp.x != from->me.x ) )
- from->pointtype = pt_curve;
-}
-
-Spline *SplineMake2(SplinePoint *from, SplinePoint *to) {
- Spline *spline = chunkalloc(sizeof(Spline));
-
- spline->from = from; spline->to = to;
- from->next = to->prev = spline;
- spline->order2 = true;
- SplineRefigure2(spline);
-return( spline );
-}
-
-Spline *SplineMake(SplinePoint *from, SplinePoint *to, int order2) {
- if ( order2 )
-return( SplineMake2(from,to));
- else
-return( SplineMake3(from,to));
-}
-
-int IntersectLines(BasePoint *inter,
- BasePoint *line1_1, BasePoint *line1_2,
- BasePoint *line2_1, BasePoint *line2_2) {
- double s1, s2;
-
- if ( line1_1->x == line1_2->x ) {
- inter->x = line1_1->x;
- if ( line2_1->x == line2_2->x ) {
- if ( line2_1->x!=line1_1->x )
-return( false ); /* Parallel vertical lines */
- inter->y = (line1_1->y+line2_1->y)/2;
- } else
- inter->y = line2_1->y + (inter->x-line2_1->x) * (line2_2->y - line2_1->y)/(line2_2->x - line2_1->x);
-return( true );
- } else if ( line2_1->x == line2_2->x ) {
- inter->x = line2_1->x;
- inter->y = line1_1->y + (inter->x-line1_1->x) * (line1_2->y - line1_1->y)/(line1_2->x - line1_1->x);
-return( true );
- } else {
- s1 = (line1_2->y - line1_1->y)/(line1_2->x - line1_1->x);
- s2 = (line2_2->y - line2_1->y)/(line2_2->x - line2_1->x);
- if ( RealNear(s1,s2)) {
- if ( !RealNear(line1_1->y + (line2_1->x-line1_1->x) * s1,line2_1->y))
-return( false );
- inter->x = (line1_2->x+line2_2->x)/2;
- inter->y = (line1_2->y+line2_2->y)/2;
- } else {
- inter->x = (s1*line1_1->x - s2*line2_1->x - line1_1->y + line2_1->y)/(s1-s2);
- inter->y = line1_1->y + (inter->x-line1_1->x) * s1;
- }
-return( true );
- }
-}
-
-int IntersectLinesClip(BasePoint *inter,
- BasePoint *line1_1, BasePoint *line1_2,
- BasePoint *line2_1, BasePoint *line2_2) {
- BasePoint old = *inter, unit;
- double len, val;
-
- if ( !IntersectLines(inter,line1_1,line1_2,line2_1,line2_2))
-return( false );
- else {
- unit.x = line2_2->x-line1_2->x;
- unit.y = line2_2->y-line1_2->y;
- len = sqrt(unit.x*unit.x + unit.y*unit.y);
- if ( len==0 )
-return( false );
- else {
- unit.x /= len; unit.y /= len;
- val = unit.x*(inter->x-line1_2->x) + unit.y*(inter->y-line1_2->y);
- if ( val<=0 || val>=len ) {
- *inter = old;
-return( false );
- }
- }
- }
-return( true );
-}
-
-
diff --git a/Build/source/texk/web2c/luatexdir/luafontloader/fontforge/fontforge/splineoverlap.c b/Build/source/texk/web2c/luatexdir/luafontloader/fontforge/fontforge/splineoverlap.c
deleted file mode 100644
index 7e9bb76e17e..00000000000
--- a/Build/source/texk/web2c/luatexdir/luafontloader/fontforge/fontforge/splineoverlap.c
+++ /dev/null
@@ -1,2394 +0,0 @@
-/* Copyright (C) 2000-2008 by George Williams */
-/*
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are met:
-
- * Redistributions of source code must retain the above copyright notice, this
- * list of conditions and the following disclaimer.
-
- * Redistributions in binary form must reproduce the above copyright notice,
- * this list of conditions and the following disclaimer in the documentation
- * and/or other materials provided with the distribution.
-
- * The name of the author may not be used to endorse or promote products
- * derived from this software without specific prior written permission.
-
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
- * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
- * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
- * EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
- * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
- * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
- * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
- * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-#include "pfaedit.h"
-#include "splinefont.h"
-#include "edgelist2.h"
-#include <math.h>
-#ifdef HAVE_IEEEFP_H
-# include <ieeefp.h> /* Solaris defines isnan in ieeefp rather than math.h */
-#endif
-#include <stdarg.h>
-
-/* First thing we do is divide each spline into a set of sub-splines each of */
-/* which is monotonic in both x and y (always increasing or decreasing) */
-/* Then we compare each monotonic spline with every other one and see if they*/
-/* intersect. If they do, split each up into sub-sub-segments and create an*/
-/* intersection point (note we need to be a little careful if an intersec- */
-/* tion happens at an end point. We don't need to create a intersection for */
-/* two adjacent splines, there isn't a real intersection... but if a third */
-/* spline crosses that point (or ends there) then all three (four) splines */
-/* need to be joined into an intersection point) */
-/* Nasty things happen if splines are coincident. They will almost never be */
-/* perfectly coincident and will keep crossing and recrossing as rounding */
-/* errors suggest one is before the other. Look for coincident splines and */
-/* treat the places they start and stop being coincident as intersections */
-/* then when we find needed splines below look for these guys and ignore */
-/* recrossings of splines which are close together */
-/* Figure out if each monotonic sub-spline is needed or not */
-/* (Note: It was tempting to split the bits up into real splines rather */
-/* than keeping them as sub-sections of the original. Unfortunately this */
-/* splitting introduced rounding errors which meant that we got more */
-/* intersections, which meant that splines could be both needed and un. */
-/* so I don't do that until later) */
-/* if the spline hasn't been tagged yet: */
-/* does the spline change greater in x or y? */
-/* draw a line parallel to the OTHER axis which hits our spline and doesn't*/
-/* hit any endpoints (or intersections, which are end points too now) */
-/* count the winding number (as we do this we can mark other splines as */
-/* needed or not) and figure out if our spline is needed */
-/* So run through the list of intersections */
-/* At an intersection there should be an even number of needed monos. */
-/* Use this as the basis of a new splineset, trace it around until */
-/* we get back to the start intersection (should happen) */
-/* (Note: We may need to reverse a monotonic sub-spline or two) */
-/* As we go, mark each monotonic as having been used */
-/* Keep doing this until all needed exits from all intersections have been */
-/* used. */
-/* The free up our temporary data structures, merge in any open splinesets */
-/* free the old closed splinesets */
-
-typedef struct mlist {
- Spline *s;
- Monotonic *m; /* May get slightly munched but will */
- /* always have right spline. we fix when we need it */
- extended t;
- int isend;
- BasePoint unit;
- struct mlist *next;
-} MList;
-
-typedef struct intersection {
- MList *monos;
- BasePoint inter;
- struct intersection *next;
-} Intersection;
-
-static char *glyphname=NULL;
-
-static void SOError(char *format,...) {
- va_list ap;
- va_start(ap,format);
- if ( glyphname==NULL )
- fprintf(stderr, "Internal Error: " );
- else
- fprintf(stderr, "Internal Error in %s: ", glyphname );
- vfprintf(stderr,format,ap);
-}
-
-static Monotonic *SplineToMonotonic(Spline *s,extended startt,extended endt,
- Monotonic *last,int exclude) {
- Monotonic *m;
- BasePoint start, end;
-
- start.x = ((s->splines[0].a*startt+s->splines[0].b)*startt+s->splines[0].c)*startt
- + s->splines[0].d;
- start.y = ((s->splines[1].a*startt+s->splines[1].b)*startt+s->splines[1].c)*startt
- + s->splines[1].d;
- end.x = ((s->splines[0].a*endt+s->splines[0].b)*endt+s->splines[0].c)*endt
- + s->splines[0].d;
- end.y = ((s->splines[1].a*endt+s->splines[1].b)*endt+s->splines[1].c)*endt
- + s->splines[1].d;
- if ( (real) (((start.x+end.x)/2)==start.x || (real) ((start.x+end.x)/2)==end.x) &&
- (real) (((start.y+end.y)/2)==start.y || (real) ((start.y+end.y)/2)==end.y) ) {
- /* The distance between the two extrema is so small */
- /* as to be unobservable. In other words we'd end up with a zero*/
- /* length spline */
- if ( endt==1.0 && last!=NULL && last->s==s )
- last->tend = endt;
-return( last );
- }
-
- m = chunkalloc(sizeof(Monotonic));
- m->s = s;
- m->tstart = startt;
- m->tend = endt;
- m->exclude = exclude;
-
- if ( end.x>start.x ) {
- m->xup = true;
- m->b.minx = start.x;
- m->b.maxx = end.x;
- } else {
- m->b.minx = end.x;
- m->b.maxx = start.x;
- }
- if ( end.y>start.y ) {
- m->yup = true;
- m->b.miny = start.y;
- m->b.maxy = end.y;
- } else {
- m->b.miny = end.y;
- m->b.maxy = start.y;
- }
-
- if ( last!=NULL ) {
- last->next = m;
- last->linked = m;
- m->prev = last;
- }
-return( m );
-}
-
-static int SSIsSelected(SplineSet *spl) {
- SplinePoint *sp;
-
- for ( sp=spl->first; ; ) {
- if ( sp->selected )
-return( true );
- if ( sp->next==NULL )
-return( false );
- sp = sp->next->to;
- if ( sp==spl->first )
-return( false );
- }
-}
-
-static int BpSame(BasePoint *bp1, BasePoint *bp2) {
- BasePoint mid;
-
- mid.x = (bp1->x+bp2->x)/2; mid.y = (bp1->y+bp2->y)/2;
- if ( (bp1->x==mid.x || bp2->x==mid.x) &&
- (bp1->y==mid.y || bp2->y==mid.y))
-return( true );
-
-return( false );
-}
-
-static int SSRmNullSplines(SplineSet *spl) {
- Spline *s, *first, *next;
-
- first = NULL;
- for ( s=spl->first->next ; s!=first; s=next ) {
- next = s->to->next;
- if ( ((s->splines[0].a>-.01 && s->splines[0].a<.01 &&
- s->splines[0].b>-.01 && s->splines[0].b<.01 &&
- s->splines[1].a>-.01 && s->splines[1].a<.01 &&
- s->splines[1].b>-.01 && s->splines[1].b<.01) ||
- /* That describes a null spline (a line between the same end-point) */
- RealNear((s->from->nextcp.x-s->from->me.x)*(s->to->me.y-s->to->prevcp.y)-
- (s->from->nextcp.y-s->from->me.y)*(s->to->me.x-s->to->prevcp.x),0)) &&
- /* And the above describes a point with a spline between it */
- /* and itself where the spline covers no area (the two cps */
- /* point in the same direction) */
- BpSame(&s->from->me,&s->to->me)) {
- if ( next==s )
-return( true );
- if ( next->from->selected ) s->from->selected = true;
- s->from->next = next;
- s->from->nextcp = next->from->nextcp;
- s->from->nonextcp = next->from->nonextcp;
- s->from->nextcpdef = next->from->nextcpdef;
- SplinePointFree(next->from);
- if ( spl->first==next->from )
- spl->last = spl->first = s->from;
- next->from = s->from;
- SplineFree(s);
- } else {
- if ( first==NULL )
- first = s;
- }
- }
-return( false );
-}
-
-static Monotonic *SSToMContour(SplineSet *spl, Monotonic *start,
- Monotonic **end, enum overlap_type ot) {
- extended ts[4];
- Spline *first, *s;
- Monotonic *head=NULL, *last=NULL;
- int cnt, i, selected = false;
- extended lastt;
-
- if ( spl->first->prev==NULL )
-return( start ); /* Open contours have no interior, ignore 'em */
- if ( spl->first->prev->from==spl->first &&
- spl->first->noprevcp && spl->first->nonextcp )
-return( start ); /* Let's just remove single points */
-
- if ( ot==over_rmselected || ot==over_intersel || ot==over_fisel || ot==over_exclude ) {
- selected = SSIsSelected(spl);
- if ( ot==over_rmselected || ot==over_intersel || ot==over_fisel ) {
- if ( !selected )
-return( start );
- selected = false;
- }
- }
-
- /* We blow up on zero length splines. And a zero length contour is nasty */
- if ( SSRmNullSplines(spl))
-return( start );
-
- first = NULL;
- for ( s=spl->first->next; s!=first; s=s->to->next ) {
- if ( first==NULL ) first = s;
- cnt = Spline2DFindExtrema(s,ts);
- lastt = 0;
- for ( i=0; i<cnt; ++i ) {
- last = SplineToMonotonic(s,lastt,ts[i],last,selected);
- if ( head==NULL ) head = last;
- lastt=ts[i];
- }
- if ( lastt!=1.0 ) {
- last = SplineToMonotonic(s,lastt,1.0,last,selected);
- if ( head==NULL ) head = last;
- }
- }
- head->prev = last;
- last->next = head;
- if ( start==NULL )
- start = head;
- else
- (*end)->linked = head;
- *end = last;
-return( start );
-}
-
-static Monotonic *SSsToMContours(SplineSet *spl, enum overlap_type ot) {
- Monotonic *head=NULL, *last = NULL;
-
- while ( spl!=NULL ) {
- if ( spl->first->prev!=NULL )
- head = SSToMContour(spl,head,&last,ot);
- spl = spl->next;
- }
-return( head );
-}
-
-static void _AddSpline(Intersection *il,Monotonic *m,extended t,int isend) {
- MList *ml;
-
- for ( ml=il->monos; ml!=NULL; ml=ml->next ) {
- if ( ml->s==m->s && RealNear( ml->t,t ) && ml->isend==isend )
-return;
- }
-
- ml = chunkalloc(sizeof(MList));
- ml->next = il->monos;
- il->monos = ml;
- ml->s = m->s;
- ml->m = m; /* This may change. We'll fix it up later */
- ml->t = t;
- ml->isend = isend;
- if ( isend ) {
- if ( m->end!=NULL && m->end!=il )
- SOError("Resetting end.\n");
- m->end = il;
- } else {
- if ( m->start!=NULL && m->start!=il )
- SOError("Resetting start.\n");
- m->start = il;
- }
-return;
-}
-
-static void AddSpline(Intersection *il,Monotonic *m,extended t) {
- MList *ml;
-
- if ( m->start==il || m->end==il )
-return;
-
- for ( ml=il->monos; ml!=NULL; ml=ml->next ) {
- if ( ml->s==m->s && RealWithin( ml->t,t,.0001 ))
-return;
- }
-
- ml = chunkalloc(sizeof(MList));
- ml->next = il->monos;
- il->monos = ml;
- ml->s = m->s;
- ml->m = m; /* This may change. We'll fix it up later */
- ml->t = t;
- ml->isend = true;
- if ( t-m->tstart < m->tend-t && RealNear(m->tstart,t) ) {
- if ( m->start!=NULL && m->start!=il )
- SOError("Resetting start.\n");
- m->start = il;
- ml->t = m->tstart;
- ml->isend = false;
- _AddSpline(il,m->prev,m->prev->tend,true);
- } else if ( RealNear(m->tend,t)) {
- if ( m->end!=NULL && m->end!=il )
- SOError("Resetting end.\n");
- m->end = il;
- ml->t = m->tend;
- _AddSpline(il,m->next,m->next->tstart,false);
- } else {
- /* Ok, if we've got a new intersection on this spline then break up */
- /* the monotonic into two bits which end and start at this inter */
- if ( t<m->tstart || t>m->tend )
- SOError( "Attempt to subset monotonic rejoin inappropriately: %g should be [%g,%g]\n",
- t, m->tstart, m->tend );
- else {
- /* It is monotonic, so a subset of it must also be */
- Monotonic *m2 = chunkalloc(sizeof(Monotonic));
- BasePoint pt;
- *m2 = *m;
- m->next = m2;
- m2->prev = m;
- m2->next->prev = m2;
- m->linked = m2;
- m->tend = t;
- m->end = il;
- m2->start = il;
- m2->tstart = t;
- pt.x = ((m->s->splines[0].a*m->tstart+m->s->splines[0].b)*m->tstart+
- m->s->splines[0].c)*m->tstart+m->s->splines[0].d;
- pt.y = ((m->s->splines[1].a*m->tstart+m->s->splines[1].b)*m->tstart+
- m->s->splines[1].c)*m->tstart+m->s->splines[1].d;
- if ( pt.x>il->inter.x ) {
- m->b.minx = il->inter.x;
- m->b.maxx = pt.x;
- } else {
- m->b.minx = pt.x;
- m->b.maxx = il->inter.x;
- }
- if ( pt.y>il->inter.y ) {
- m->b.miny = il->inter.y;
- m->b.maxy = pt.y;
- } else {
- m->b.miny = pt.y;
- m->b.maxy = il->inter.y;
- }
- pt.x = ((m2->s->splines[0].a*m2->tend+m2->s->splines[0].b)*m2->tend+
- m2->s->splines[0].c)*m2->tend+m2->s->splines[0].d;
- pt.y = ((m2->s->splines[1].a*m2->tend+m2->s->splines[1].b)*m2->tend+
- m2->s->splines[1].c)*m2->tend+m2->s->splines[1].d;
- if ( pt.x>il->inter.x ) {
- m2->b.minx = il->inter.x;
- m2->b.maxx = pt.x;
- } else {
- m2->b.minx = pt.x;
- m2->b.maxx = il->inter.x;
- }
- if ( pt.y>il->inter.y ) {
- m2->b.miny = il->inter.y;
- m2->b.maxy = pt.y;
- } else {
- m2->b.miny = pt.y;
- m2->b.maxy = il->inter.y;
- }
- _AddSpline(il,m2,t,false);
- }
- }
-}
-
-static void SetStartPoint(BasePoint *pt,Monotonic *m) {
- if ( m->tstart==0 )
- *pt = m->s->from->me;
- else if ( m->start!=NULL )
- *pt = m->start->inter;
- else {
- pt->x = ((m->s->splines[0].a*m->tstart+m->s->splines[0].b)*m->tstart +
- m->s->splines[0].c)*m->tstart + m->s->splines[0].d;
- pt->y = ((m->s->splines[1].a*m->tstart+m->s->splines[1].b)*m->tstart +
- m->s->splines[1].c)*m->tstart + m->s->splines[1].d;
- }
-}
-
-static void SetEndPoint(BasePoint *pt,Monotonic *m) {
- if ( m->tend==1.0 )
- *pt = m->s->to->me;
- else if ( m->end!=NULL )
- *pt = m->end->inter;
- else {
- pt->x = ((m->s->splines[0].a*m->tend+m->s->splines[0].b)*m->tend +
- m->s->splines[0].c)*m->tend + m->s->splines[0].d;
- pt->y = ((m->s->splines[1].a*m->tend+m->s->splines[1].b)*m->tend +
- m->s->splines[1].c)*m->tend + m->s->splines[1].d;
- }
-}
-
-static extended RoundToEndpoints(Monotonic *m,extended t,BasePoint *inter) {
- BasePoint end;
- extended bound;
-
- if ( t==0 || t==1 ) {
- if ( t==0 )
- *inter = m->s->from->me;
- else
- *inter = m->s->to->me;
-return( t );
- }
-
- if ( t-m->tstart < m->tend-t ) {
- bound = m->tstart;
- SetStartPoint(&end,m);
- } else {
- bound = m->tend;
- SetEndPoint(&end,m);
- }
- if ( BpSame(&end,inter) || RealWithin(t,bound,.00001)) {
- *inter = end;
-return( bound );
- }
-
-return( t );
-}
-
-static extended Grad1(Spline1D *s1, Spline1D *s2,
- extended t1,extended t2 ) {
- /* d/dt[12] (m1(t1).x-m2(t2).x)^2 + (m1(t1).y-m2(t2).y)^2 */
- /* d/dt[12] (m1(t1).x^2 -2m1(t1).x*m2(t2).x + m2(t2).x^2) + (m1(t1).y^2 -2m1(t1).y*m2(t2).y + m2(t2).y^2) */
- extended val2 = ((s2->a*t2+s2->b)*t2+s2->c)*t2+s2->d;
-
-return( ((((6*(extended)s1->a*s1->a*t1 +
- 5*2*(extended)s1->a*s1->b)*t1 +
- 4*(s1->b*(extended)s1->b+2*s1->a*(extended)s1->c))*t1 +
- 3*2*(s1->a*(extended)s1->d+s1->b*(extended)s1->c))*t1 +
- 2*(s1->c*(extended)s1->c+2*s1->b*(extended)s1->d))*t1 +
- 2*s1->c*(extended)s1->d -
- 2*val2 * ((3*s1->a*t1 + 2*s1->b)*t1 + s1->c) );
-}
-
-static void GradImproveInter(Monotonic *m1, Monotonic *m2,
- extended *_t1,extended *_t2,BasePoint *inter) {
- Spline *s1 = m1->s, *s2 = m2->s;
- extended x1, x2, y1, y2;
- extended gt1=0, gt2=0, glen=1;
- extended error, olderr=1e10;
- extended factor = 4096;
- extended t1=*_t1, t2=*_t2;
- extended off, off2, yoff;
- int cnt=0;
- /* We want to find (t1,t2) so that (m1(t1)-m2(t2))^2==0 */
- /* Find the gradiant and move in the reverse direction */
- /* We know that the current values of (t1,t2) are close to an intersection*/
- /* so the grad should point correctly */
- /* d/dt[12] (m1(t1).x-m2(t2).x)^2 + (m1(t1).y-m2(t2).y)^2 */
- /* d/dt[12] (m1(t1).x^2 -2m1(t1).x*m2(t2).x + m2(t2).x^2) + (m1(t1).y^2 -2m1(t1).y*m2(t2).y + m2(t2).y^2) */
-
- forever {
- x1 = ((s1->splines[0].a*t1 + s1->splines[0].b)*t1 + s1->splines[0].c)*t1 + s1->splines[0].d;
- x2 = ((s2->splines[0].a*t2 + s2->splines[0].b)*t2 + s2->splines[0].c)*t2 + s2->splines[0].d;
- y1 = ((s1->splines[1].a*t1 + s1->splines[1].b)*t1 + s1->splines[1].c)*t1 + s1->splines[1].d;
- y2 = ((s2->splines[1].a*t2 + s2->splines[1].b)*t2 + s2->splines[1].c)*t2 + s2->splines[1].d;
- error = (x1-x2)*(x1-x2) + (y1-y2)*(y1-y2);
- if ( error>olderr ) {
- if ( olderr==1e10 )
- break;
- factor *= 2;
- if ( factor>4096*4096 )
- break;
- glen *= 2;
- t1 += gt1/glen;
- t2 += gt2/glen;
- continue;
- } else
- factor /= 1.4;
- if ( error<1e-11 ) /* Error is actually the square of the error */
- break; /* So this isn't as constraining as it looks */
-
- gt1 = Grad1(&s1->splines[0],&s2->splines[0],t1,t2) + Grad1(&s1->splines[1],&s2->splines[1],t1,t2);
- gt2 = Grad1(&s2->splines[0],&s1->splines[0],t2,t1) + Grad1(&s2->splines[1],&s1->splines[1],t2,t1);
- glen = esqrt(gt1*gt1 + gt2*gt2) * factor;
- if ( glen==0 )
- break;
- *_t1 = t1; *_t2 = t2;
- t1 -= gt1/glen;
- t2 -= gt2/glen;
- if ( isnan(t1) || isnan(t2)) {
- IError( "Nan in grad" );
- break;
- }
- olderr = error;
- ++cnt;
- if ( cnt>1000 )
- break;
- }
-#if 0
- if ( cnt<=1 && error>=1e-11 )
- fprintf(stderr,"No Improvement\n" );
- else if ( cnt>1 )
- fprintf(stderr,"Improvement\n" );
-#endif
- t1 = *_t1; t2 = *_t2;
- if ( t1<0 && t1>-.00001 ) *_t1 = t1 = 0;
- else if ( t1>1 && t1<1.00001 ) *_t1 = t1 = 1.0;
- if ( t2<0 && t2>-.00001 ) *_t2 = t2 = 0;
- else if ( t2>1 && t2<1.00001 ) *_t2 = t2 = 1.0;
- x1 = ((s1->splines[0].a*t1 + s1->splines[0].b)*t1 + s1->splines[0].c)*t1 + s1->splines[0].d;
- x2 = ((s2->splines[0].a*t2 + s2->splines[0].b)*t2 + s2->splines[0].c)*t2 + s2->splines[0].d;
- y1 = ((s1->splines[1].a*t1 + s1->splines[1].b)*t1 + s1->splines[1].c)*t1 + s1->splines[1].d;
- y2 = ((s2->splines[1].a*t2 + s2->splines[1].b)*t2 + s2->splines[1].c)*t2 + s2->splines[1].d;
- inter->x = (x1+x2)/2; inter->y = (y1+y2)/2;
-
- if ( (off=x1-x2)<0 ) off = -off;
- if ( (yoff=y1-y2)<0 ) yoff = -yoff;
- off += yoff;
-
- if ( t1<.0001 ) {
- t1 = 0;
- x1 = s1->splines[0].d;
- y1 = s1->splines[1].d;
- } else if ( t1>.9999 ) {
- t1 = 1.0;
- x1 = s1->splines[0].a+s1->splines[0].b+s1->splines[0].c+s1->splines[0].d;
- y1 = s1->splines[1].a+s1->splines[1].b+s1->splines[1].c+s1->splines[1].d;
- }
- if ( t2<.0001 ) {
- t2=0;
- x2 = s2->splines[0].d;
- y2 = s2->splines[1].d;
- } else if ( t2>.9999 ) {
- t2=1.0;
- x2 = s2->splines[0].a+s2->splines[0].b+s2->splines[0].c+s2->splines[0].d;
- y2 = s2->splines[1].a+s2->splines[1].b+s2->splines[1].c+s2->splines[1].d;
- }
- if ( (off2=x1-x2)<0 ) off2 = -off2;
- if ( (yoff=y1-y2)<0 ) yoff = -yoff;
- off2 += yoff;
- if ( off2<=off ) {
- *_t1 = t1; *_t2 = t2;
- inter->x = (x1+x2)/2; inter->y = (y1+y2)/2;
- }
-}
-
-static Intersection *AddIntersection(Intersection *ilist,Monotonic *m1,
- Monotonic *m2,extended t1,extended t2,BasePoint *inter) {
- Intersection *il;
- extended ot1 = t1, ot2 = t2;
-
- /* Fixup some rounding errors */
- GradImproveInter(m1,m2,&t1,&t2,inter);
- if ( t1<m1->tstart || t1>m1->tend || t2<m2->tstart || t2>m2->tend )
-return( ilist );
-
- t1 = RoundToEndpoints(m1,t1,inter);
- t2 = RoundToEndpoints(m2,t2,inter);
- t1 = RoundToEndpoints(m1,t1,inter); /* Do it twice. rounding t2 can mean we now need to round t1 */
-
- if (( m1->s->to == m2->s->from && RealWithin(t1,1.0,.01) && RealWithin(t2,0,.01)) ||
- ( m1->s->from == m2->s->to && RealWithin(t1,0,.01) && RealWithin(t2,1.0,.01)))
-return( ilist );
-
- if (( t1==m1->tstart && m1->start!=NULL &&
- (inter->x!=m1->start->inter.x || inter->y!=m1->start->inter.y)) ||
- ( t1==m1->tend && m1->end!=NULL &&
- (inter->x!=m1->end->inter.x || inter->y!=m1->end->inter.y)))
- t1 = ot1;
- if (( t2==m2->tstart && m2->start!=NULL &&
- (inter->x!=m2->start->inter.x || inter->y!=m2->start->inter.y)) ||
- ( t2==m2->tend && m2->end!=NULL &&
- (inter->x!=m2->end->inter.x || inter->y!=m2->end->inter.y)))
- t2 = ot2;
-
- /* The ordinary join of one spline to the next doesn't really count */
- /* Or one monotonic sub-spline to the next either */
- if (( m1->next==m2 && RealNear(t1,m1->tend) && RealNear(t2,m2->tstart)) ||
- (m2->next==m1 && RealNear(t1,m1->tstart) && RealNear(t2,m2->tend)) )
-return( ilist );
-
- if ( RealWithin(m1->tstart,t1,.01) )
- il = m1->start;
- else if ( RealWithin(m1->tend,t1,.01) )
- il = m1->end;
- else
- il = NULL;
- if ( il!=NULL &&
- ((RealWithin(m2->tstart,t2,.01) && m2->start==il) ||
- (RealWithin(m2->tend,t2,.01) && m2->end==il)) )
-return( ilist );
-
- for ( il = ilist; il!=NULL; il=il->next ) {
- if ( RealWithin(il->inter.x,inter->x,.01) && RealWithin(il->inter.y,inter->y,.01)) {
- AddSpline(il,m1,t1);
- AddSpline(il,m2,t2);
-return( ilist );
- }
- }
-
- il = chunkalloc(sizeof(Intersection));
- il->inter = *inter;
- il->next = ilist;
- AddSpline(il,m1,t1);
- AddSpline(il,m2,t2);
-return( il );
-}
-
-static extended BoundIterateSplineSolve(Spline1D *sp, extended tmin, extended tmax,
- extended sought,double err) {
- extended t = IterateSplineSolve(sp,tmin,tmax,sought,err);
- if ( t<tmin || t>tmax )
-return( -1 );
-
-return( t );
-}
-
-static Intersection *FindMonotonicIntersection(Intersection *ilist,Monotonic *m1,Monotonic *m2) {
- /* I believe that two monotonic cubics can still intersect in two points */
- /* so we can't just check if the splines are on oposite sides of each */
- /* other at top and bottom */
- DBounds b;
- const double error = .0001;
- BasePoint pt;
- extended t1,t2;
-
- b.minx = m1->b.minx>m2->b.minx ? m1->b.minx : m2->b.minx;
- b.maxx = m1->b.maxx<m2->b.maxx ? m1->b.maxx : m2->b.maxx;
- b.miny = m1->b.miny>m2->b.miny ? m1->b.miny : m2->b.miny;
- b.maxy = m1->b.maxy<m2->b.maxy ? m1->b.maxy : m2->b.maxy;
-
- if ( b.maxy==b.miny && b.minx==b.maxx ) {
- extended x1,y1, x2,y2;
- if ( m1->next==m2 || m2->next==m1 )
-return( ilist ); /* Not interesting. Only intersection is at an endpoint */
- if ( ((m1->start==m2->start || m1->end==m2->start) && m2->start!=NULL) ||
- ((m1->start==m2->end || m1->end==m2->end ) && m2->end!=NULL ))
-return( ilist );
- pt.x = b.minx; pt.y = b.miny;
- if ( m1->b.maxx-m1->b.minx > m1->b.maxy-m1->b.miny )
- t1 = BoundIterateSplineSolve(&m1->s->splines[0],m1->tstart,m1->tend,b.minx,error);
- else
- t1 = BoundIterateSplineSolve(&m1->s->splines[1],m1->tstart,m1->tend,b.miny,error);
- if ( m2->b.maxx-m2->b.minx > m2->b.maxy-m2->b.miny )
- t2 = BoundIterateSplineSolve(&m2->s->splines[0],m2->tstart,m2->tend,b.minx,error);
- else
- t2 = BoundIterateSplineSolve(&m2->s->splines[1],m2->tstart,m2->tend,b.miny,error);
- if ( t1!=-1 && t2!=-1 ) {
- x1 = ((m1->s->splines[0].a*t1+m1->s->splines[0].b)*t1+m1->s->splines[0].c)*t1+m1->s->splines[0].d;
- y1 = ((m1->s->splines[1].a*t1+m1->s->splines[1].b)*t1+m1->s->splines[1].c)*t1+m1->s->splines[1].d;
- x2 = ((m2->s->splines[0].a*t2+m2->s->splines[0].b)*t2+m2->s->splines[0].c)*t2+m2->s->splines[0].d;
- y2 = ((m2->s->splines[1].a*t2+m2->s->splines[1].b)*t2+m2->s->splines[1].c)*t2+m2->s->splines[1].d;
- if ( x1-x2>-.01 && x1-x2<.01 && y1-y2>-.01 && y1-y2<.01 )
- ilist = AddIntersection(ilist,m1,m2,t1,t2,&pt);
- }
- } else if ( b.maxy==b.miny ) {
- extended x1,x2;
- if ( m1->next==m2 || m2->next==m1 )
-return( ilist ); /* Not interesting. Only intersection is at an endpoint */
- t1 = BoundIterateSplineSolve(&m1->s->splines[1],m1->tstart,m1->tend,b.miny,error);
- t2 = BoundIterateSplineSolve(&m2->s->splines[1],m2->tstart,m2->tend,b.miny,error);
- if ( t1!=-1 && t2!=-1 ) {
- x1 = ((m1->s->splines[0].a*t1+m1->s->splines[0].b)*t1+m1->s->splines[0].c)*t1+m1->s->splines[0].d;
- x2 = ((m2->s->splines[0].a*t2+m2->s->splines[0].b)*t2+m2->s->splines[0].c)*t2+m2->s->splines[0].d;
- if ( x1-x2>-.01 && x1-x2<.01 ) {
- pt.x = (x1+x2)/2; pt.y = b.miny;
- ilist = AddIntersection(ilist,m1,m2,t1,t2,&pt);
- }
- }
- } else if ( b.maxx==b.minx ) {
- extended y1,y2;
- if ( m1->next==m2 || m2->next==m1 )
-return( ilist ); /* Not interesting. Only intersection is at an endpoint */
- t1 = BoundIterateSplineSolve(&m1->s->splines[0],m1->tstart,m1->tend,b.minx,error);
- t2 = BoundIterateSplineSolve(&m2->s->splines[0],m2->tstart,m2->tend,b.minx,error);
- if ( t1!=-1 && t2!=-1 ) {
- y1 = ((m1->s->splines[1].a*t1+m1->s->splines[1].b)*t1+m1->s->splines[1].c)*t1+m1->s->splines[1].d;
- y2 = ((m2->s->splines[1].a*t2+m2->s->splines[1].b)*t2+m2->s->splines[1].c)*t2+m2->s->splines[1].d;
- if ( y1-y2>-.01 && y1-y2<.01 ) {
- pt.x = b.minx; pt.y = (y1+y2)/2;
- ilist = AddIntersection(ilist,m1,m2,t1,t2,&pt);
- }
- }
- } else if ( b.maxy-b.miny > b.maxx-b.minx ) {
- extended diff, y, x1,x2, x1o,x2o;
- extended t1,t2, t1o,t2o ;
-
- diff = (b.maxy-b.miny)/32;
- y = b.miny;
- x1o = x2o = 0;
- while ( y<b.maxy ) {
- while ( y<b.maxy ) {
- t1o = BoundIterateSplineSolve(&m1->s->splines[1],m1->tstart,m1->tend,b.miny,error);
- t2o = BoundIterateSplineSolve(&m2->s->splines[1],m2->tstart,m2->tend,b.miny,error);
- if ( t1o!=-1 && t2o!=-1 )
- break;
- y += diff;
- }
- x1o = ((m1->s->splines[0].a*t1o+m1->s->splines[0].b)*t1o+m1->s->splines[0].c)*t1o+m1->s->splines[0].d;
- x2o = ((m2->s->splines[0].a*t2o+m2->s->splines[0].b)*t2o+m2->s->splines[0].c)*t2o+m2->s->splines[0].d;
- if ( x1o!=x2o )
- break;
- y += diff;
- }
- for ( y+=diff; ; y += diff ) {
- /* I used to say y<=b.maxy in the above for statement. */
- /* that seemed to get rounding errors on the mac, so we do it */
- /* like this now: */
- if ( y>b.maxy ) {
- if ( y<b.maxy+diff/4 ) y = b.maxy;
- else
- break;
- }
- t1 = BoundIterateSplineSolve(&m1->s->splines[1],m1->tstart,m1->tend,y,error);
- t2 = BoundIterateSplineSolve(&m2->s->splines[1],m2->tstart,m2->tend,y,error);
- if ( t1==-1 || t2==-1 )
- continue;
- x1 = ((m1->s->splines[0].a*t1+m1->s->splines[0].b)*t1+m1->s->splines[0].c)*t1+m1->s->splines[0].d;
- x2 = ((m2->s->splines[0].a*t2+m2->s->splines[0].b)*t2+m2->s->splines[0].c)*t2+m2->s->splines[0].d;
- if ( x1o!=x2o && (x1o>x2o) != ( x1>x2 ) ) {
- /* A cross over has occured. (assume we have a small enough */
- /* region that three cross-overs can't have occurred) */
- /* Use a binary search to track it down */
- extended ytop, ybot;
- ytop = y;
- ybot = y-diff;
- while ( ytop!=ybot ) {
- extended ytest = (ytop+ybot)/2;
- extended t1t, t2t;
- t1t = BoundIterateSplineSolve(&m1->s->splines[1],m1->tstart,m1->tend,ytest,error);
- t2t = BoundIterateSplineSolve(&m2->s->splines[1],m2->tstart,m2->tend,ytest,error);
- x1 = ((m1->s->splines[0].a*t1t+m1->s->splines[0].b)*t1t+m1->s->splines[0].c)*t1t+m1->s->splines[0].d;
- x2 = ((m2->s->splines[0].a*t2t+m2->s->splines[0].b)*t2t+m2->s->splines[0].c)*t2t+m2->s->splines[0].d;
- if ( t1t==-1 || t2t==-1 ) {
- SOError( "Can't find something in range.\n" );
- break;
- } else if (( x1-x2<error && x1-x2>-error ) || ytop==ytest || ybot==ytest ) {
- pt.y = ytest; pt.x = (x1+x2)/2;
- ilist = AddIntersection(ilist,m1,m2,t1t,t2t,&pt);
- b.maxy = m1->b.maxy<m2->b.maxy ? m1->b.maxy : m2->b.maxy;
- break;
- } else if ( (x1o>x2o) != ( x1>x2 ) ) {
- ytop = ytest;
- } else {
- ybot = ytest;
- }
- }
- x1 = x1o; x1o = x2o; x2o = x1;
- } else {
- x1o = x1; x2o = x2;
- }
- }
- } else {
- extended diff, x, y1,y2, y1o,y2o;
- extended t1,t2, t1o,t2o ;
-
- diff = (b.maxx-b.minx)/32;
- x = b.minx;
- y1o = y2o = 0;
- while ( x<b.maxx ) {
- while ( x<b.maxx ) {
- t1o = BoundIterateSplineSolve(&m1->s->splines[0],m1->tstart,m1->tend,b.minx,error);
- t2o = BoundIterateSplineSolve(&m2->s->splines[0],m2->tstart,m2->tend,b.minx,error);
- if ( t1o!=-1 && t2o!=-1 )
- break;
- x += diff;
- }
- y1o = ((m1->s->splines[1].a*t1o+m1->s->splines[1].b)*t1o+m1->s->splines[1].c)*t1o+m1->s->splines[1].d;
- y2o = ((m2->s->splines[1].a*t2o+m2->s->splines[1].b)*t2o+m2->s->splines[1].c)*t2o+m2->s->splines[1].d;
- if ( y1o!=y2o )
- break;
- x += diff;
- }
- y1 = y2 = 0;
- for ( x+=diff; ; x += diff ) {
- if ( x>b.maxx ) {
- if ( x<b.maxx+diff/4 ) x = b.maxx;
- else
- break;
- }
- t1 = BoundIterateSplineSolve(&m1->s->splines[0],m1->tstart,m1->tend,x,error);
- t2 = BoundIterateSplineSolve(&m2->s->splines[0],m2->tstart,m2->tend,x,error);
- if ( t1==-1 || t2==-1 )
- continue;
- y1 = ((m1->s->splines[1].a*t1+m1->s->splines[1].b)*t1+m1->s->splines[1].c)*t1+m1->s->splines[1].d;
- y2 = ((m2->s->splines[1].a*t2+m2->s->splines[1].b)*t2+m2->s->splines[1].c)*t2+m2->s->splines[1].d;
- if ( (y1o>y2o) != ( y1>y2 ) ) {
- /* A cross over has occured. (assume we have a small enough */
- /* region that three cross-overs can't have occurred) */
- /* Use a binary search to track it down */
- extended xtop, xbot;
- xtop = x;
- xbot = x-diff;
- while ( xtop!=xbot ) {
- extended xtest = (xtop+xbot)/2;
- extended t1t, t2t;
- t1t = BoundIterateSplineSolve(&m1->s->splines[0],m1->tstart,m1->tend,xtest,error);
- t2t = BoundIterateSplineSolve(&m2->s->splines[0],m2->tstart,m2->tend,xtest,error);
- y1 = ((m1->s->splines[1].a*t1t+m1->s->splines[1].b)*t1t+m1->s->splines[1].c)*t1t+m1->s->splines[1].d;
- y2 = ((m2->s->splines[1].a*t2t+m2->s->splines[1].b)*t2t+m2->s->splines[1].c)*t2t+m2->s->splines[1].d;
- if ( t1t==-1 || t2t==-1 ) {
- SOError( "Can't find something in range.\n" );
- break;
- } else if (( y1-y2<error && y1-y2>-error ) || xtop==xtest || xbot==xtest ) {
- pt.x = xtest; pt.y = (y1+y2)/2;
- ilist = AddIntersection(ilist,m1,m2,t1t,t2t,&pt);
- b.maxx = m1->b.maxx<m2->b.maxx ? m1->b.maxx : m2->b.maxx;
- break;
- } else if ( (y1o>y2o) != ( y1>y2 ) ) {
- xtop = xtest;
- } else {
- xbot = xtest;
- }
- }
- y1 = y1o; y1o = y2o; y2o = y1;
- } else {
- y1o = y1; y2o = y2;
- }
- }
- }
-return( ilist );
-}
-
-
-static extended SplineContainsPoint(Monotonic *m,BasePoint *pt) {
- int which, nw;
- extended t;
- BasePoint slope;
- const double error = .0001;
-
- which = ( m->b.maxx-m->b.minx > m->b.maxy-m->b.miny )? 0 : 1;
- nw = !which;
- t = BoundIterateSplineSolve(&m->s->splines[which],m->tstart,m->tend,(&pt->x)[which],error);
- if ( (slope.x = (3*m->s->splines[0].a*t+2*m->s->splines[0].b)*t+m->s->splines[0].c)<0 )
- slope.x = -slope.x;
- if ( (slope.y = (3*m->s->splines[1].a*t+2*m->s->splines[1].b)*t+m->s->splines[1].c)<0 )
- slope.y = -slope.y;
- if ( t==-1 || (slope.y>slope.x)!=which ) {
- nw = which;
- which = 1-which;
- t = BoundIterateSplineSolve(&m->s->splines[which],m->tstart,m->tend,(&pt->x)[which],error);
- }
- if ( t!=-1 && RealWithin((&pt->x)[nw],
- ((m->s->splines[nw].a*t+m->s->splines[nw].b)*t +
- m->s->splines[nw].c)*t + m->s->splines[nw].d,.1 ))
-return( t );
-
-return( -1 );
-}
-
-/* If two splines are coincident, then pretend they intersect at both */
-/* end-points and nowhere else */
-static int CoincidentIntersect(Monotonic *m1,Monotonic *m2,BasePoint *pts,
- extended *t1s,extended *t2s) {
- const double error = .0001;
- int cnt=0;
- extended t, t2, diff;
-
- if ( m1==m2 || m1->next==m2 || m1->prev==m2 )
-return( false ); /* Can't be coincident. Adjacent */
- /* Actually adjacent splines can double back on themselves */
-
- if ( (m1->xup==m2->xup && m1->yup==m2->yup) ||
- ((m1->xup!=m2->xup || (m1->b.minx==m1->b.maxx && m2->b.minx==m2->b.maxx)) ||
- (m1->yup!=m2->yup || (m1->b.miny==m1->b.maxy && m2->b.miny==m2->b.maxy))))
- /* A match is possible */;
- else
-return( false );
-
- SetStartPoint(&pts[cnt],m1);
- t1s[cnt] = m1->tstart;
- if ( (t2s[cnt] = SplineContainsPoint(m2,&pts[cnt]))!=-1 )
- ++cnt;
-
- SetEndPoint(&pts[cnt],m1);
- t1s[cnt] = m1->tend;
- if ( (t2s[cnt] = SplineContainsPoint(m2,&pts[cnt]))!=-1 )
- ++cnt;
-
- if ( cnt!=2 ) {
- SetStartPoint(&pts[cnt],m2);
- t2s[cnt] = m2->tstart;
- if ( (t1s[cnt] = SplineContainsPoint(m1,&pts[cnt]))!=-1 )
- ++cnt;
- }
-
- if ( cnt!=2 ) {
- SetEndPoint(&pts[cnt],m2);
- t2s[cnt] = m2->tend;
- if ( (t1s[cnt] = SplineContainsPoint(m1,&pts[cnt]))!=-1 )
- ++cnt;
- }
-
- if ( cnt!=2 )
-return( false );
-
- if ( RealWithin(t1s[0],t1s[1],.01) )
-return( false );
-
- /* Ok, if we've gotten this far we know that two of the end points are */
- /* on both splines. */
- t1s[2] = t2s[2] = -1;
- if ( !m1->s->knownlinear || !m1->s->knownlinear ) {
- if ( t1s[1]<t1s[0] ) {
- extended temp = t1s[1]; t1s[1] = t1s[0]; t1s[0] = temp;
- temp = t2s[1]; t2s[1] = t2s[0]; t2s[0] = temp;
- }
- diff = (t1s[1]-t1s[0])/16;
- for ( t=t1s[0]+diff; t<t1s[1]-diff/4; t += diff ) {
- BasePoint here, slope;
- here.x = ((m1->s->splines[0].a*t+m1->s->splines[0].b)*t+m1->s->splines[0].c)*t+m1->s->splines[0].d;
- here.y = ((m1->s->splines[1].a*t+m1->s->splines[1].b)*t+m1->s->splines[1].c)*t+m1->s->splines[1].d;
- if ( (slope.x = (3*m1->s->splines[0].a*t+2*m1->s->splines[0].b)*t+m1->s->splines[0].c)<0 )
- slope.x = -slope.x;
- if ( (slope.y = (3*m1->s->splines[1].a*t+2*m1->s->splines[1].b)*t+m1->s->splines[1].c)<0 )
- slope.y = -slope.y;
- if ( slope.y>slope.x ) {
- t2 = BoundIterateSplineSolve(&m2->s->splines[1],t2s[0],t2s[1],here.y,error);
- if ( t2==-1 || !RealWithin(here.x,((m2->s->splines[0].a*t2+m2->s->splines[0].b)*t2+m2->s->splines[0].c)*t2+m2->s->splines[0].d,.1))
-return( false );
- } else {
- t2 = BoundIterateSplineSolve(&m2->s->splines[0],t2s[0],t2s[1],here.x,error);
- if ( t2==-1 || !RealWithin(here.y,((m2->s->splines[1].a*t2+m2->s->splines[1].b)*t2+m2->s->splines[1].c)*t2+m2->s->splines[1].d,.1))
-return( false );
- }
- }
- }
-
-return( true );
-}
-
-static void FigureProperMonotonicsAtIntersections(Intersection *ilist) {
- MList *ml, *ml2, *mlnext, *prev, *p2;
-
- while ( ilist!=NULL ) {
- for ( ml=ilist->monos; ml!=NULL; ml=ml->next ) {
- if ( (ml->t==ml->m->tstart && !ml->isend) ||
- (ml->t==ml->m->tend && ml->isend))
- /* It's right */;
- else if ( ml->t>ml->m->tstart ) {
- while ( ml->t>ml->m->tend ) {
- ml->m = ml->m->next;
- if ( ml->m->s!=ml->s ) {
- SOError("we could not find a matching monotonic\n" );
- break;
- }
- }
- } else {
- while ( ml->t<ml->m->tstart ) {
- ml->m = ml->m->prev;
- if ( ml->m->s!=ml->s ) {
- SOError( "we could not find a matching monotonic\n" );
- break;
- }
- }
- }
- if ( ml->t==ml->m->tstart && ml->isend )
- ml->m = ml->m->prev;
- else if ( ml->t==ml->m->tend && !ml->isend )
- ml->m = ml->m->next;
- if ( ml->t!=ml->m->tstart && ml->t!=ml->m->tend )
- SOError( "we could not find a matching monotonic time\n" );
- }
- for ( prev=NULL, ml=ilist->monos; ml!=NULL; ml = mlnext ) {
- mlnext = ml->next;
- if ( ml->m->start==ml->m->end ) {
- for ( p2 = ml, ml2=ml->next; ml2!=NULL; p2=ml2, ml2 = ml2->next ) {
- if ( ml2->m==ml->m )
- break;
- }
- if ( ml2!=NULL ) {
- if ( ml2==mlnext ) mlnext = ml2->next;
- p2->next = ml2->next;
- chunkfree(ml2,sizeof(*ml2));
- }
- if ( prev==NULL )
- ilist->monos = mlnext;
- else
- prev->next = mlnext;
- chunkfree(ml,sizeof(*ml));
- }
- }
-#if 0
- for ( ml=ilist->monos; ml!=NULL; ml=ml->next ) {
- Monotonic *search;
- MList *ml2;
- extended t;
- if ( ml->m->start == ilist ) {
- search = ml->m->prev;
- t = ( ml->m->tstart==0 ) ? 1.0 : ml->m->tstart;
- } else {
- search = ml->m->next;
- t = ( ml->m->tend==1.0 ) ? 0.0 : ml->m->tend;
- }
- for ( ml2=ilist->monos; ml2!=NULL && ml2->m!=search; ml2=ml2->next );
- if ( ml2==NULL ) {
- ml2 = chunkalloc(sizeof(MList));
- ml2->m = search;
- ml2->s = search->s;
- ml2->t = t;
- ml2->next = ml->next;
- ml->next = ml2;
- ml = ml2;
- }
- }
-#endif
- ilist = ilist->next;
- }
-}
-
-static void Validate(Monotonic *ms, Intersection *ilist) {
- MList *ml;
- int mcnt;
-
- while ( ilist!=NULL ) {
- for ( mcnt=0, ml=ilist->monos; ml!=NULL; ml=ml->next ) {
- if ( ml->m->isneeded ) ++mcnt;
- if ( ml->m->start!=ilist && ml->m->end!=ilist )
- SOError( "Intersection (%g,%g) not on a monotonic which should contain it.\n",
- ilist->inter.x, ilist->inter.y );
- }
- if ( mcnt&1 )
- SOError( "Odd number of needed monotonic sections at intersection. (%g,%g)\n",
- ilist->inter.x,ilist->inter.y );
- ilist = ilist->next;
- }
-
- while ( ms!=NULL ) {
- if ( ms->prev->end!=ms->start )
- SOError( "Mismatched intersection.\n");
- ms = ms->linked;
- }
-}
-
-static Intersection *FindIntersections(Monotonic *ms, enum overlap_type ot) {
- Monotonic *m1, *m2;
- BasePoint pts[9];
- extended t1s[10], t2s[10];
- Intersection *ilist=NULL;
- int i;
- int wasc;
-
- for ( m1=ms; m1!=NULL; m1=m1->linked ) {
- for ( m2=m1->linked; m2!=NULL; m2=m2->linked ) {
- if ( m2->b.minx > m1->b.maxx ||
- m2->b.maxx < m1->b.minx ||
- m2->b.miny > m1->b.maxy ||
- m2->b.maxy < m1->b.miny )
- continue; /* Can't intersect */;
- wasc = CoincidentIntersect(m1,m2,pts,t1s,t2s);
- if ( wasc || m1->s->knownlinear || m2->s->knownlinear ||
- (m1->s->splines[0].a==0 && m1->s->splines[1].a==0 &&
- m2->s->splines[0].a==0 && m2->s->splines[1].a==0 )) {
- if ( !wasc && SplinesIntersect(m1->s,m2->s,pts,t1s,t2s)<=0 )
- continue;
- for ( i=0; i<4 && t1s[i]!=-1; ++i ) {
- if ( t1s[i]>=m1->tstart && t1s[i]<=m1->tend &&
- t2s[i]>=m2->tstart && t2s[i]<=m2->tend ) {
- ilist = AddIntersection(ilist,m1,m2,t1s[i],t2s[i],&pts[i]);
- }
- }
- continue;
- }
- ilist = FindMonotonicIntersection(ilist,m1,m2);
- }
- }
-
- FigureProperMonotonicsAtIntersections(ilist);
-
- /* Now suppose we have a contour which intersects nothing? */
- /* with no intersections we lose track of it and it will vanish */
- /* That's not a good idea. Make sure each contour has at least one inter */
- if ( ot!=over_findinter && ot!=over_fisel ) {
- for ( m1=ms; m1!=NULL; m1=m2->linked ) {
- if ( m1->start==NULL && m1->end==NULL ) {
- Intersection *il;
- il = chunkalloc(sizeof(Intersection));
- il->inter = m1->s->from->me;
- il->next = ilist;
- AddSpline(il,m1,0);
- AddSpline(il,m1->prev,1.0);
- ilist = il;
- }
- for ( m2=m1; m2->linked==m2->next; m2=m2->linked );
- }
- }
-
-return( ilist );
-}
-
-static int dcmp(const void *_p1, const void *_p2) {
- const extended *dpt1 = _p1, *dpt2 = _p2;
- if ( *dpt1>*dpt2 )
-return( 1 );
- else if ( *dpt1<*dpt2 )
-return( -1 );
-
-return( 0 );
-}
-
-static extended *FindOrderedEndpoints(Monotonic *ms,int which) {
- int cnt;
- Monotonic *m;
- extended *ends;
- int i,j,k;
-
- for ( m=ms, cnt=0; m!=NULL; m=m->linked, ++cnt );
- ends = galloc((2*cnt+1)*sizeof(extended));
- for ( m=ms, cnt=0; m!=NULL; m=m->linked, cnt+=2 ) {
- if ( m->start!=NULL )
- ends[cnt] = (&m->start->inter.x)[which];
- else if ( m->tstart==0 )
- ends[cnt] = (&m->s->from->me.x)[which];
- else
- ends[cnt] = ((m->s->splines[which].a*m->tstart+m->s->splines[which].b)*m->tstart+
- m->s->splines[which].c)*m->tstart+m->s->splines[which].d;
- if ( m->end!=NULL )
- ends[cnt+1] = (&m->end->inter.x)[which];
- else if ( m->tend==1.0 )
- ends[cnt+1] = (&m->s->to->me.x)[which];
- else
- ends[cnt+1] = ((m->s->splines[which].a*m->tend+m->s->splines[which].b)*m->tend+
- m->s->splines[which].c)*m->tend+m->s->splines[which].d;
- }
-
- qsort(ends,cnt,sizeof(extended),dcmp);
- for ( i=0; i<cnt; ++i ) {
- for ( j=i; j<cnt && ends[i]==ends[j]; ++j );
- if ( j>i+1 ) {
- for ( k=i+1; j<cnt; ends[k++] = ends[j++]);
- cnt-= j-k;
- }
- }
- ends[cnt] = 1e10;
-return( ends );
-}
-
-static int mcmp(const void *_p1, const void *_p2) {
- const Monotonic * const *mpt1 = _p1, * const *mpt2 = _p2;
- if ( (*mpt1)->other>(*mpt2)->other )
-return( 1 );
- else if ( (*mpt1)->other<(*mpt2)->other )
-return( -1 );
-
-return( 0 );
-}
-
-static int MonotonicFindAt(Monotonic *ms,int which, extended test, Monotonic **space ) {
- /* Find all monotonic sections which intersect the line (x,y)[which] == test */
- /* find the value of the other coord on that line */
- /* Order them (by the other coord) */
- /* then run along that line figuring out which monotonics are needed */
- extended t;
- Monotonic *m, *mm;
- int i, j, k, cnt;
- const double error = .0001;
- int nw = !which;
-
- for ( m=ms, i=0; m!=NULL; m=m->linked ) {
- if (( which==0 && test >= m->b.minx && test <= m->b.maxx ) ||
- ( which==1 && test >= m->b.miny && test <= m->b.maxy )) {
- /* Lines parallel to the direction we are testing just get in the */
- /* way and don't add any useful info */
- if ( m->s->knownlinear &&
- (( which==1 && m->s->from->me.y==m->s->to->me.y ) ||
- (which==0 && m->s->from->me.x==m->s->to->me.x)))
- continue;
- t = BoundIterateSplineSolve(&m->s->splines[which],m->tstart,m->tend,test,error);
- if ( t==-1 )
- continue;
- m->t = t;
- if ( t==m->tend ) t -= (m->tend-m->tstart)/100;
- else if ( t==m->tstart ) t += (m->tend-m->tstart)/100;
- m->other = ((m->s->splines[nw].a*t+m->s->splines[nw].b)*t+
- m->s->splines[nw].c)*t+m->s->splines[nw].d;
- space[i++] = m;
- }
- }
- cnt = i;
-
- /* Things get a little tricky at end-points */
- for ( i=0; i<cnt; ++i ) {
- m = space[i];
- if ( m->t==m->tend ) {
- /* Ignore horizontal/vertical lines (as appropriate) */
- for ( mm=m->next; mm!=m; mm=mm->next ) {
- if ( !mm->s->knownlinear )
- break;
- if (( which==1 && mm->s->from->me.y!=m->s->to->me.y ) ||
- (which==0 && mm->s->from->me.x!=m->s->to->me.x))
- break;
- }
- } else if ( m->t==m->tstart ) {
- for ( mm=m->prev; mm!=m; mm=mm->prev ) {
- if ( !mm->s->knownlinear )
- break;
- if (( which==1 && mm->s->from->me.y!=m->s->to->me.y ) ||
- (which==0 && mm->s->from->me.x!=m->s->to->me.x))
- break;
- }
- } else
- break;
- /* If the next monotonic continues in the same direction, and we found*/
- /* it too, then don't count both. They represent the same intersect */
- /* If they are in oposite directions then they cancel each other out */
- /* and that is correct */
- if ( mm!=m && /* Should always be true */
- (&mm->xup)[which]==(&m->xup)[which] ) {
- for ( j=cnt-1; j>=0; --j )
- if ( space[j]==mm )
- break;
- if ( j!=-1 ) {
- /* remove mm */
- for ( k=j+1; k<cnt; ++k )
- space[k-1] = space[k];
- --cnt;
- if ( i>j ) --i;
- }
- }
- }
-
- space[cnt] = NULL; space[cnt+1] = NULL;
- qsort(space,cnt,sizeof(Monotonic *),mcmp);
-return(cnt);
-}
-
-static void FigureNeeds(Monotonic *ms,int which, extended test, Monotonic **space,
- enum overlap_type ot, int ignore_close) {
- /* Find all monotonic sections which intersect the line (x,y)[which] == test */
- /* find the value of the other coord on that line */
- /* Order them (by the other coord) */
- /* then run along that line figuring out which monotonics are needed */
- int i, j, winding, ew, was_close, close;
-
- MonotonicFindAt(ms,which,test,space);
-
- winding = 0; ew = 0; was_close = false;
- for ( i=0; space[i]!=NULL; ++i ) {
- int needed, unneeded, inverted=false;
- Monotonic *m;
- int new;
- int nwinding;
- retry:
- needed = false, unneeded = false;
- nwinding=winding;
- new=ew;
- m = space[i];
- if ( m->exclude )
- new += ( (&m->xup)[which] ? 1 : -1 );
- else
- nwinding += ( (&m->xup)[which] ? 1 : -1 );
- if ( ot==over_remove || ot==over_rmselected ) {
- if ( winding==0 || nwinding==0 )
- needed = true;
- else
- unneeded = true;
- } else if ( ot==over_intersect || ot==over_intersel ) {
- if ( (winding>-2 && winding<2 && nwinding>-2 && nwinding<2) ||
- ((winding<=-2 || winding>=2) && (nwinding<=-2 && nwinding>=2)))
- unneeded = true;
- else
- needed = true;
- } else if ( ot == over_exclude ) {
- if ( (( winding==0 || nwinding==0 ) && ew==0 && new==0 ) ||
- (winding!=0 && (( ew!=0 && new==0 ) || ( ew==0 && new!=0))) )
- needed = true;
- else
- unneeded = true;
- }
- if ( space[i+1]!=NULL )
- close = space[i+1]->other-space[i]->other < 1;
- else
- close = false;
- if (( !close && !was_close ) || ignore_close ) {
- if (( m->isneeded || m->isunneeded ) && m->isneeded!=needed ) {
- for ( j=i+1; space[j]!=NULL && space[j]->other-m->other<.5; ++j ) {
- if ( space[j]->start==m->start && space[j]->end==m->end &&
- (space[j]->isneeded == needed ||
- (!space[j]->isneeded && !space[j]->isunneeded))) {
- space[i] = space[j];
- space[j] = m;
- m = space[i];
- break;
- } else if ( !inverted && space[j]->other-m->other<.001 &&
- (((&space[j]->xup)[which] == (&m->xup)[which] &&
- (space[j]->isneeded == needed ||
- (!space[j]->isneeded && !space[j]->isunneeded))) ||
- ((&space[j]->xup)[which] != (&m->xup)[which] &&
- (space[j]->isneeded != needed ||
- (!space[j]->isneeded && !space[j]->isunneeded)))) ) {
- space[i] = space[j];
- space[j] = m;
- inverted = true;
- goto retry;
- }
- }
- }
- if ( !m->isneeded && !m->isunneeded ) {
- m->isneeded = needed; m->isunneeded = unneeded;
- m->when_set = test; /* Debugging */
- } else if ( m->isneeded!=needed || m->isunneeded!=unneeded )
- SOError( "monotonic is both needed and unneeded.\n" );
- }
- winding = nwinding;
- ew = new;
- was_close = close;
- }
- if ( winding!=0 )
- SOError( "Winding number did not return to 0 when %s=%g\n",
- which ? "y" : "x", test );
-}
-
-struct gaps { extended test, len; int which; };
-
-static int gcmp(const void *_p1, const void *_p2) {
- const struct gaps *gpt1 = _p1, *gpt2 = _p2;
- if ( gpt1->len > gpt2->len )
-return( 1 );
- else if ( gpt1->len < gpt2->len )
-return( -1 );
-
-return( 0 );
-}
-
-static void FindNeeded(Monotonic *ms,enum overlap_type ot) {
- extended *ends[2];
- Monotonic *m, **space;
- extended top, bottom, test;
- int t,b,i,j,k,cnt,which;
- struct gaps *gaps;
- extended min_gap;
-
- if ( ms==NULL )
-return;
-
- ends[0] = FindOrderedEndpoints(ms,0);
- ends[1] = FindOrderedEndpoints(ms,1);
-
- for ( m=ms, cnt=0; m!=NULL; m=m->linked, ++cnt );
- space = galloc((cnt+2)*sizeof(Monotonic*));
- gaps = galloc(2*cnt*sizeof(struct gaps));
-
- /* Look for the longest splines without interruptions first. These are */
- /* least likely to cause problems and will give us a good basis from which*/
- /* to make guesses should rounding errors occur later */
- for ( j=k=0; j<2; ++j )
- for ( i=0; ends[j][i+1]!=1e10; ++i ) {
- gaps[k].which = j;
- gaps[k].len = (ends[j][i+1]-ends[j][i]);
- gaps[k++].test = (ends[j][i+1]+ends[j][i])/2;
- }
- qsort(gaps,k,sizeof(struct gaps),gcmp);
- min_gap = 1e10;
- for ( m=ms; m!=NULL; m=m->linked ) {
- if ( m->b.maxx-m->b.minx > m->b.maxy-m->b.miny ) {
- if ( min_gap > m->b.maxx-m->b.minx ) min_gap = m->b.maxx-m->b.minx;
- } else {
- if ( m->b.maxy-m->b.miny==0 )
- fprintf( stderr, "Foo\n");
- if ( min_gap > m->b.maxy-m->b.miny ) min_gap = m->b.maxy-m->b.miny;
- }
- }
- if ( min_gap<.5 ) min_gap = .5;
- for ( i=0; i<k && gaps[i].len>=min_gap; ++i )
- FigureNeeds(ms,gaps[i].which,gaps[i].test,space,ot,0);
-
- for ( m=ms; m!=NULL; m=m->linked ) if ( !m->isneeded && !m->isunneeded ) {
- if ( m->b.maxx-m->b.minx > m->b.maxy-m->b.miny ) {
- top = m->b.maxx;
- bottom = m->b.minx;
- which = 0;
- } else {
- top = m->b.maxy;
- bottom = m->b.miny;
- which = 1;
- }
- for ( b=0; ends[which][b]<=bottom; ++b );
- for ( t=b; ends[which][t]<top; ++t );
- --t;
- /* b points to an endpoint which is greater than bottom */
- /* t points to an endpoint which is less than top */
- test = (top+bottom)/2;
- for ( i=b; i<=t; ++i ) {
- if ( RealNearish(test,ends[which][i]) ) {
- if ( i==b )
- test = (bottom+ends[which][i])/2;
- else
- test = (ends[which][i-1]+ends[which][i])/2;
- break;
- }
- }
- FigureNeeds(ms,which,test,space,ot,1);
- }
- free(ends[0]);
- free(ends[1]);
- free(space);
- free(gaps);
-}
-
-static void FindUnitVectors(Intersection *ilist) {
- MList *ml;
- Intersection *il;
- BasePoint u;
- double len;
-
- for ( il=ilist; il!=NULL; il=il->next ) {
- for ( ml=il->monos; ml!=NULL; ml=ml->next ) {
- if ( ml->m->isneeded ) {
- Spline *s = ml->m->s;
- double t1, t2;
- t1 = ml->t;
- if ( ml->isend )
- t2 = ml->t - (ml->t-ml->m->tstart)/20.0;
- else
- t2 = ml->t + (ml->m->tend-ml->t)/20.0;
- u.x = ((s->splines[0].a*t1 + s->splines[0].b)*t1 + s->splines[0].c)*t1 -
- ((s->splines[0].a*t2 + s->splines[0].b)*t2 + s->splines[0].c)*t2;
- u.y = ((s->splines[1].a*t1 + s->splines[1].b)*t1 + s->splines[1].c)*t1 -
- ((s->splines[1].a*t2 + s->splines[1].b)*t2 + s->splines[1].c)*t2;
- len = u.x*u.x + u.y*u.y;
- if ( len!=0 ) {
- len = sqrt(len);
- u.x /= len;
- u.y /= len;
- }
- ml->unit = u;
- }
- }
- }
-}
-
-static void TestForBadDirections(Intersection *ilist) {
- /* If we have a glyph with at least two contours one drawn clockwise, */
- /* one counter, and these two intersect, then our algorithm will */
- /* not remove what appears to the user to be an overlap. Warn about */
- /* this. */
- /* I think it happens iff all exits from an intersection are needed */
- MList *ml, *ml2;
- int cnt, ncnt;
- Intersection *il;
-
- /* If we have two splines one going from a->b and the other from b->a */
- /* tracing exactly the same route, then they should cancel each other */
- /* out. But depending on the order we hit them they may both be marked */
- /* needed */ /* OverlapBugs.sfd: asciicircumflex */
- for ( il=ilist; il!=NULL; il=il->next ) {
- for ( ml=il->monos; ml!=NULL; ml=ml->next ) {
- if ( ml->m->isneeded && ml->m->s->knownlinear &&
- ml->m->start!=NULL && ml->m->end!=NULL ) {
- for ( ml2 = ml->next; ml2!=NULL; ml2=ml2->next ) {
- if ( ml2->m->isneeded && ml2->m->s->knownlinear &&
- ml2->m->start == ml->m->end &&
- ml2->m->end == ml->m->start ) {
- ml2->m->isneeded = false;
- ml->m->isneeded = false;
- ml2->m->isunneeded = true;
- ml->m->isunneeded = true;
- break;
- }
- }
- }
- }
- }
-
- while ( ilist!=NULL ) {
- cnt = ncnt = 0;
- for ( ml = ilist->monos; ml!=NULL; ml=ml->next ) {
- ++cnt;
- if ( ml->m->isneeded ) ++ncnt;
- }
- ilist = ilist->next;
- }
-}
-
-static void MonoFigure(Spline *s,extended firstt,extended endt, SplinePoint *first,
- SplinePoint *end) {
- extended f;
- Spline1D temp;
-
- f = endt - firstt;
- /*temp.d = first->me.x;*/
- /*temp.a = s->splines[0].a*f*f*f;*/
- temp.b = (s->splines[0].b + 3*s->splines[0].a*firstt) *f*f;
- temp.c = (s->splines[0].c + 2*s->splines[0].b*firstt + 3*s->splines[0].a*firstt*firstt) * f;
- first->nextcp.x = first->me.x + temp.c/3;
- end->prevcp.x = first->nextcp.x + (temp.b+temp.c)/3;
- if ( temp.c>-.01 && temp.c<.01 ) first->nextcp.x = first->me.x;
- if ( (temp.b+temp.c)>-.01 && (temp.b+temp.c)<.01 ) end->prevcp.x = end->me.x;
-
- temp.b = (s->splines[1].b + 3*s->splines[1].a*firstt) *f*f;
- temp.c = (s->splines[1].c + 2*s->splines[1].b*firstt + 3*s->splines[1].a*firstt*firstt) * f;
- first->nextcp.y = first->me.y + temp.c/3;
- end->prevcp.y = first->nextcp.y + (temp.b+temp.c)/3;
- if ( temp.c>-.01 && temp.c<.01 ) first->nextcp.y = first->me.y;
- if ( (temp.b+temp.c)>-.01 && (temp.b+temp.c)<.01 ) end->prevcp.y = end->me.y;
- first->nonextcp = false; end->noprevcp = false;
- SplineMake3(first,end);
- if ( SplineIsLinear(first->next)) {
- first->nextcp = first->me;
- end->prevcp = end->me;
- first->nonextcp = end->noprevcp = true;
- SplineRefigure(first->next);
- }
-}
-
-static Intersection *MonoFollow(Intersection *curil, Monotonic *m) {
- Monotonic *mstart=m;
-
- if ( m->start==curil ) {
- while ( m!=NULL && m->end==NULL ) {
- m=m->next;
- if ( m==mstart )
- break;
- }
- if ( m==NULL )
-return( NULL );
-
-return( m->end );
- } else {
- while ( m!=NULL && m->start==NULL ) {
- m=m->prev;
- if ( m==mstart )
- break;
- }
- if ( m==NULL )
-return( NULL );
-
-return( m->start );
- }
-}
-
-static int MonoGoesSomewhereUseful(Intersection *curil, Monotonic *m) {
- Intersection *nextil = MonoFollow(curil,m);
- MList *ml;
- int cnt;
-
- if ( nextil==NULL )
-return( false );
- cnt = 0;
- for ( ml=nextil->monos; ml!=NULL ; ml=ml->next )
- if ( ml->m->isneeded )
- ++cnt;
- if ( cnt>=2 ) /* One for the mono that one in, one for another going out... */
-return( true );
-
-return( false );
-}
-
-static MList *FindMLOfM(Intersection *curil,Monotonic *finalm) {
- MList *ml;
-
- for ( ml=curil->monos; ml!=NULL; ml=ml->next ) {
- if ( ml->m==finalm )
-return( ml );
- }
-return( NULL );
-}
-
-static SplinePoint *MonoFollowForward(Intersection **curil, MList *ml,
- SplinePoint *last, Monotonic **finalm) {
- SplinePoint *mid;
- Monotonic *m = ml->m, *mstart;
-
- forever {
- for ( mstart = m; m->s==mstart->s; m=m->next) {
- if ( !m->isneeded )
- SOError( "Expected needed monotonic.\n" );
- m->isneeded = false; /* Mark as used */
- if ( m->end!=NULL )
- break;
- }
- if ( m->s==mstart->s ) {
- if ( m->end==NULL ) SOError( "Invariant condition does not hold.\n" );
- mid = SplinePointCreate(m->end->inter.x,m->end->inter.y);
- } else {
- m = m->prev;
- mid = SplinePointCreate(m->s->to->me.x,m->s->to->me.y);
- }
- if ( mstart->tstart==0 && m->tend==1.0 ) {
- /* I check for this special case to avoid rounding errors */
- last->nextcp = m->s->from->nextcp;
- last->nonextcp = m->s->from->nonextcp;
- mid->prevcp = m->s->to->prevcp;
- mid->noprevcp = m->s->to->noprevcp;
- SplineMake3(last,mid);
- } else {
- MonoFigure(m->s,mstart->tstart,m->tend,last,mid);
- }
- last = mid;
- if ( m->end!=NULL ) {
- *curil = m->end;
- *finalm = m;
-return( last );
- }
- m = m->next;
- }
-}
-
-static SplinePoint *MonoFollowBackward(Intersection **curil, MList *ml,
- SplinePoint *last, Monotonic **finalm) {
- SplinePoint *mid;
- Monotonic *m = ml->m, *mstart;
-
- forever {
- for ( mstart=m; m->s==mstart->s; m=m->prev) {
- if ( !m->isneeded )
- SOError( "Expected needed monotonic.\n" );
- m->isneeded = false; /* Mark as used */
- if ( m->start!=NULL )
- break;
- }
- if ( m->s==mstart->s ) {
- if ( m->start==NULL ) SOError( "Invariant condition does not hold.\n" );
- mid = SplinePointCreate(m->start->inter.x,m->start->inter.y);
- } else {
- m = m->next;
- mid = SplinePointCreate(m->s->from->me.x,m->s->from->me.y);
- }
- if ( m->s->knownlinear ) mid->pointtype = pt_corner;
- if ( mstart->tend==1.0 && m->tstart==0 ) {
- /* I check for this special case to avoid rounding errors */
- last->nextcp = m->s->to->prevcp;
- last->nonextcp = m->s->to->noprevcp;
- mid->prevcp = m->s->from->nextcp;
- mid->noprevcp = m->s->from->nonextcp;
- SplineMake3(last,mid);
- } else {
- MonoFigure(m->s,mstart->tend,m->tstart,last,mid);
- }
- last = mid;
- if ( m->start!=NULL ) {
- *curil = m->start;
- *finalm = m;
-return( last );
- }
- m = m->prev;
- }
-}
-
-static SplineSet *JoinAContour(Intersection *startil,MList *ml) {
- SplineSet *ss = chunkalloc(sizeof(SplineSet));
- SplinePoint *last;
- Intersection *curil;
- int allexclude = ml->m->exclude;
- Monotonic *finalm;
- MList *lastml;
-
- ss->first = last = SplinePointCreate(startil->inter.x,startil->inter.y);
- curil = startil;
- forever {
- if ( allexclude && !ml->m->exclude ) allexclude = false;
- finalm = NULL;
- if ( ml->m->start==curil ) {
- last = MonoFollowForward(&curil,ml,last,&finalm);
- } else if ( ml->m->end==curil ) {
- last = MonoFollowBackward(&curil,ml,last,&finalm);
- } else {
- SOError( "Couldn't find endpoint (%g,%g).\n",
- curil->inter.x, curil->inter.y );
- ml->m->isneeded = false; /* Prevent infinite loops */
- ss->last = last;
- break;
- }
- if ( curil==startil ) {
- ss->first->prev = last->prev;
- ss->first->prevcp = last->prevcp;
- ss->first->noprevcp = last->noprevcp;
- last->prev->to = ss->first;
- SplinePointFree(last);
- ss->last = ss->first;
- break;
- }
- lastml = FindMLOfM(curil,finalm);
- if ( lastml==NULL ) {
- IError("Could not find finalm");
- /* Try to preserve direction */
- for ( ml=curil->monos; ml!=NULL && (!ml->m->isneeded || ml->m->end==curil); ml=ml->next );
- if ( ml==NULL )
- for ( ml=curil->monos; ml!=NULL && !ml->m->isneeded; ml=ml->next );
- } else {
- int k; MList *bestml; double bestdot;
- for ( k=0; k<2; ++k ) {
- bestml = NULL; bestdot = -2;
- for ( ml=curil->monos; ml!=NULL ; ml=ml->next ) {
- if ( ml->m->isneeded && (ml->m->start==curil || k) ) {
- double dot = lastml->unit.x*ml->unit.x + lastml->unit.y*ml->unit.y;
- if ( dot>bestdot ) {
- bestml = ml;
- bestdot = dot;
- }
- }
- }
- if ( bestml!=NULL )
- break;
- }
- ml = bestml;
- }
- if ( ml==NULL ) {
- for ( ml=curil->monos; ml!=NULL ; ml=ml->next )
- if ( ml->m->isunneeded && ml->m->start==curil &&
- MonoFollow(curil,ml->m)==startil )
- break;
- if ( ml==NULL )
- for ( ml=curil->monos; ml!=NULL ; ml=ml->next )
- if ( ml->m->isunneeded && ml->m->end==curil &&
- MonoFollow(curil,ml->m)==startil )
- break;
- if ( ml!=NULL ) {
- SOError("Closing contour with unneeded path\n" );
- ml->m->isneeded = true;
- }
- }
- if ( ml==NULL ) {
- SOError( "couldn't find a needed exit from an intersection\n" );
- ss->last = last;
- break;
- }
- }
- SPLCatagorizePoints(ss);
- if ( allexclude && SplinePointListIsClockwise(ss))
- SplineSetReverse(ss);
-return( ss );
-}
-
-static SplineSet *FindMatchingContour(SplineSet *head,SplineSet *cur) {
- SplineSet *test;
-
- for ( test=head; test!=NULL; test=test->next ) {
- if ( test->first->prev==NULL &&
- test->first->me.x==cur->last->me.x && test->first->me.y==cur->last->me.y &&
- test->last->me.x==cur->first->me.x && test->last->me.y==cur->first->me.y )
- break;
- }
- if ( test==NULL ) {
- for ( test=head; test!=NULL; test=test->next ) {
- if ( test->first->prev==NULL &&
- test->last->me.x==cur->last->me.x && test->last->me.y==cur->last->me.y &&
- test->first->me.x==cur->first->me.x && test->first->me.y==cur->first->me.y ) {
- SplineSetReverse(cur);
- break;
- }
- }
- }
- if ( test==NULL ) {
- for ( test=head; test!=NULL; test=test->next ) {
- if ( test->first->prev==NULL &&
- ((test->first->me.x==cur->last->me.x && test->first->me.y==cur->last->me.y) ||
- (test->last->me.x==cur->first->me.x && test->last->me.y==cur->first->me.y )))
- break;
- }
- }
- if ( test==NULL ) {
- for ( test=head; test!=NULL; test=test->next ) {
- if ( test->first->prev==NULL &&
- ((test->last->me.x==cur->last->me.x && test->last->me.y==cur->last->me.y) ||
- (test->first->me.x==cur->first->me.x && test->first->me.y==cur->first->me.y ))) {
- SplineSetReverse(cur);
- break;
- }
- }
- }
-return( test );
-}
-
-static SplineSet *JoinAllNeeded(Intersection *ilist) {
- Intersection *il;
- SplineSet *head=NULL, *last=NULL, *cur, *test;
- MList *ml;
-
- for ( il=ilist; il!=NULL; il=il->next ) {
- /* Try to preserve direction */
- forever {
- for ( ml=il->monos; ml!=NULL && (!ml->m->isneeded || ml->m->end==il); ml=ml->next );
- if ( ml==NULL )
- for ( ml=il->monos; ml!=NULL && !ml->m->isneeded; ml=ml->next );
- if ( ml==NULL )
- break;
- if ( !MonoGoesSomewhereUseful(il,ml->m)) {
- SOError("Humph. This monotonic leads nowhere.\n" );
- /* break; */
- }
- cur = JoinAContour(il,ml);
- if ( head==NULL )
- head = cur;
- else {
- if ( cur->first->prev==NULL ) {
- /* Open contours are errors. See if we had an earlier error */
- /* to which we can join this */
- test = FindMatchingContour(head,cur);
- if ( test!=NULL ) {
- if ( test->first->me.x==cur->last->me.x && test->first->me.y==cur->last->me.y ) {
- test->first->prev = cur->last->prev;
- cur->last->prev->to = test->first;
- SplinePointFree(cur->last);
- if ( test->last->me.x==cur->first->me.x && test->last->me.y==cur->first->me.y ) {
- test->last->next = cur->first->next;
- cur->first->next->from = test->last;
- SplinePointFree(cur->first);
- test->last = test->first;
- } else
- test->first = cur->first;
- } else {
- if ( test->last->me.x!=cur->first->me.x || test->last->me.y!=cur->first->me.y )
- SOError( "Join failed");
- else {
- test->last->next = cur->first->next;
- cur->first->next->from = test->last;
- SplinePointFree(cur->first);
- test->last = test->first;
- }
- }
- cur->first = cur->last = NULL;
- SplinePointListFree(cur);
- cur=NULL;
- }
- }
- if ( cur!=NULL )
- last->next = cur;
- }
- if ( cur!=NULL )
- last = cur;
- }
- }
-return( head );
-}
-
-static SplineSet *MergeOpenAndFreeClosed(SplineSet *new,SplineSet *old,
- enum overlap_type ot) {
- SplineSet *next;
-
- while ( old!=NULL ) {
- next = old->next;
- if ( old->first->prev==NULL ||
- (( ot==over_rmselected || ot==over_intersel || ot==over_fisel) &&
- !SSIsSelected(old)) ) {
- old->next = new;
- new = old;
- } else {
- old->next = NULL;
- SplinePointListFree(old);
- }
- old = next;
- }
-return(new);
-}
-
-static void FreeMonotonics(Monotonic *m) {
- Monotonic *next;
-
- while ( m!=NULL ) {
- next = m->linked;
- chunkfree(m,sizeof(*m));
- m = next;
- }
-}
-
-static void FreeMList(MList *ml) {
- MList *next;
-
- while ( ml!=NULL ) {
- next = ml->next;
- chunkfree(ml,sizeof(*ml));
- ml = next;
- }
-}
-
-static void FreeIntersections(Intersection *ilist) {
- Intersection *next;
-
- while ( ilist!=NULL ) {
- next = ilist->next;
- FreeMList(ilist->monos);
- chunkfree(ilist,sizeof(*ilist));
- ilist = next;
- }
-}
-
-static void MonoSplit(Monotonic *m) {
- Spline *s = m->s;
- SplinePoint *last = s->from;
- SplinePoint *final = s->to;
- extended lastt = 0;
-
- last->next = NULL;
- final->prev = NULL;
- while ( m!=NULL && m->s==s && m->tend<1 ) {
- if ( m->end!=NULL ) {
- SplinePoint *mid = SplinePointCreate(m->end->inter.x,m->end->inter.y);
- if ( m->s->knownlinear ) mid->pointtype = pt_corner;
- MonoFigure(s,lastt,m->tend,last,mid);
- lastt = m->tend;
- last = mid;
- }
- m = m->linked;
- }
- MonoFigure(s,lastt,1.0,last,final);
- SplineFree(s);
-}
-
-static void FixupIntersectedSplines(Monotonic *ms) {
- /* If all we want is intersections, then the contours are already correct */
- /* all we need to do is run through the Monotonic list and when we find */
- /* an intersection, make sure it has real splines around it */
- Monotonic *m;
- int needs_split;
-
- while ( ms!=NULL ) {
- needs_split = false;
- for ( m=ms; m!=NULL && m->s==ms->s; m=m->linked ) {
- if ( (m->tstart!=0 && m->start!=NULL) || (m->tend!=1 && m->end!=NULL))
- needs_split = true;
- }
- if ( needs_split )
- MonoSplit(ms);
- ms = m;
- }
-}
-
-static int BpClose(BasePoint *here, BasePoint *there, double error) {
- extended dx, dy;
-
- if ( (dx = here->x-there->x)<0 ) dx= -dx;
- if ( (dy = here->y-there->y)<0 ) dy= -dy;
- if ( dx<error && dy<error )
-return( true );
-
-return( false );
-}
-
-static SplineSet *SSRemoveTiny(SplineSet *base) {
- DBounds b;
- double error;
- extended test, dx, dy;
- SplineSet *prev = NULL, *head = base, *ssnext;
- SplinePoint *sp, *nsp;
-
- SplineSetQuickBounds(base,&b);
- error = b.maxy-b.miny;
- test = b.maxx-b.minx;
- if ( test>error ) error = test;
- if ( (test = b.maxy)<0 ) test = -test;
- if ( test>error ) error = test;
- if ( (test = b.maxx)<0 ) test = -test;
- if ( test>error ) error = test;
- error /= 30000;
-
- while ( base!=NULL ) {
- ssnext = base->next;
- for ( sp=base->first; ; ) {
- if ( sp->next==NULL )
- break;
- nsp = sp->next->to;
- if ( BpClose(&sp->me,&nsp->me,error) ) {
- if ( BpClose(&sp->me,&sp->nextcp,2*error) &&
- BpClose(&nsp->me,&nsp->prevcp,2*error)) {
- /* Remove the spline */
- if ( nsp==sp ) {
- /* Only this spline in the contour, so remove the contour */
- base->next = NULL;
- SplinePointListFree(base);
- if ( prev==NULL )
- head = ssnext;
- else
- prev->next = ssnext;
- base = NULL;
- break;
- }
- SplineFree(sp->next);
- if ( nsp->nonextcp ) {
- sp->nextcp = sp->me;
- sp->nonextcp = true;
- } else {
- sp->nextcp = nsp->nextcp;
- sp->nonextcp = false;
- }
- sp->nextcpdef = nsp->nextcpdef;
- sp->next = nsp->next;
- if ( nsp->next!=NULL ) {
- nsp->next->from = sp;
- SplineRefigure(sp->next);
- }
- if ( nsp==base->last )
- base->last = sp;
- if ( nsp==base->first )
- base->first = sp;
- SplinePointFree(nsp);
- if ( sp->next==NULL )
- break;
- nsp = sp->next->to;
- } else {
- /* Leave the spline, but move the two points together */
- BasePoint new;
- new.x = (sp->me.x+nsp->me.x)/2;
- new.y = (sp->me.y+nsp->me.y)/2;
- dx = new.x-sp->me.x; dy = new.y-sp->me.y;
- sp->me = new;
- sp->nextcp.x += dx; sp->nextcp.y += dy;
- sp->prevcp.x += dx; sp->prevcp.y += dy;
- dx = new.x-nsp->me.x; dy = new.y-nsp->me.y;
- nsp->me = new;
- nsp->nextcp.x += dx; nsp->nextcp.y += dy;
- nsp->prevcp.x += dx; nsp->prevcp.y += dy;
- SplineRefigure(sp->next);
- if ( sp->prev ) SplineRefigure(sp->prev);
- if ( nsp->next ) SplineRefigure(nsp->next);
- }
- }
- sp = nsp;
- if ( sp==base->first )
- break;
- }
- if ( sp->prev!=NULL && !sp->noprevcp ) {
- int refigure = false;
- if ( sp->me.x-sp->prevcp.x>-error && sp->me.x-sp->prevcp.x<error ) {
- sp->prevcp.x = sp->me.x;
- refigure = true;
- }
- if ( sp->me.y-sp->prevcp.y>-error && sp->me.y-sp->prevcp.y<error ) {
- sp->prevcp.y = sp->me.y;
- refigure = true;
- }
- if ( sp->me.x==sp->prevcp.x && sp->me.y==sp->prevcp.y )
- sp->noprevcp = true;
- if ( refigure )
- SplineRefigure(sp->prev);
- }
- if ( sp->next!=NULL && !sp->nonextcp ) {
- int refigure = false;
- if ( sp->me.x-sp->nextcp.x>-error && sp->me.x-sp->nextcp.x<error ) {
- sp->nextcp.x = sp->me.x;
- refigure = true;
- }
- if ( sp->me.y-sp->nextcp.y>-error && sp->me.y-sp->nextcp.y<error ) {
- sp->nextcp.y = sp->me.y;
- refigure = true;
- }
- if ( sp->me.x==sp->nextcp.x && sp->me.y==sp->nextcp.y )
- sp->nonextcp = true;
- if ( refigure )
- SplineRefigure(sp->next);
- }
- if ( base!=NULL )
- prev = base;
- base = ssnext;
- }
-
-return( head );
-}
-
-static void RemoveNextSP(SplinePoint *psp,SplinePoint *sp,SplinePoint *nsp,
- SplineSet *base) {
- if ( psp==nsp ) {
- SplineFree(psp->next);
- psp->next = psp->prev;
- psp->next->from = psp;
- SplinePointFree(sp);
- SplineRefigure(psp->prev);
- } else {
- psp->next = nsp->next;
- psp->next->from = psp;
- psp->nextcp = nsp->nextcp;
- psp->nonextcp = nsp->nonextcp;
- psp->nextcpdef = nsp->nextcpdef;
- SplineFree(sp->prev);
- SplineFree(sp->next);
- SplinePointFree(sp);
- SplinePointFree(nsp);
- SplineRefigure(psp->next);
- }
- if ( base->first==sp || base->first==nsp )
- base->first = psp;
- if ( base->last==sp || base->last==nsp )
- base->last = psp;
-}
-
-static void RemovePrevSP(SplinePoint *psp,SplinePoint *sp,SplinePoint *nsp,
- SplineSet *base) {
- if ( psp==nsp ) {
- SplineFree(nsp->prev);
- nsp->prev = nsp->next;
- nsp->prev->to = nsp;
- SplinePointFree(sp);
- SplineRefigure(nsp->next);
- } else {
- nsp->prev = psp->prev;
- nsp->prev->to = nsp;
- nsp->prevcp = nsp->me;
- nsp->noprevcp = true;
- nsp->prevcpdef = psp->prevcpdef;
- SplineFree(sp->prev);
- SplineFree(sp->next);
- SplinePointFree(sp);
- SplinePointFree(psp);
- SplineRefigure(nsp->prev);
- }
- if ( base->first==sp || base->first==psp )
- base->first = nsp;
- if ( base->last==sp || base->last==psp )
- base->last = nsp;
-}
-
-static SplinePoint *SameLine(SplinePoint *psp, SplinePoint *sp, SplinePoint *nsp) {
- BasePoint noff, poff;
- real nlen, plen, normal;
-
- noff.x = nsp->me.x-sp->me.x; noff.y = nsp->me.y-sp->me.y;
- poff.x = psp->me.x-sp->me.x; poff.y = psp->me.y-sp->me.y;
- nlen = esqrt(noff.x*noff.x + noff.y*noff.y);
- plen = esqrt(poff.x*poff.x + poff.y*poff.y);
- if ( nlen==0 )
-return( nsp );
- if ( plen==0 )
-return( psp );
- normal = (noff.x*poff.y - noff.y*poff.x)/nlen/plen;
- if ( normal<-.0001 || normal>.0001 )
-return( NULL );
-
- if ( noff.x*poff.x < 0 || noff.y*poff.y < 0 )
-return( NULL ); /* Same line, but different directions */
- if ( (noff.x>0 && noff.x>poff.x) ||
- (noff.x<0 && noff.x<poff.x) ||
- (noff.y>0 && noff.y>poff.y) ||
- (noff.y<0 && noff.y<poff.y))
-return( nsp );
-
-return( psp );
-}
-
-static double AdjacentSplinesMatch(Spline *s1,Spline *s2,int s2forward) {
- /* Is every point on s2 close to a point on s1 */
- double t, tdiff, t1 = -1;
- double xoff, yoff;
- double t1start, t1end;
- extended ts[2];
- int i;
-
- if ( (xoff = s2->to->me.x-s2->from->me.x)<0 ) xoff = -xoff;
- if ( (yoff = s2->to->me.y-s2->from->me.y)<0 ) yoff = -yoff;
- if ( xoff>yoff )
- SplineFindExtrema(&s1->splines[0],&ts[0],&ts[1]);
- else
- SplineFindExtrema(&s1->splines[1],&ts[0],&ts[1]);
- if ( s2forward ) {
- t = 0;
- tdiff = 1/16.0;
- t1end = 1;
- for ( i=1; i>=0 && ts[i]==-1; --i );
- t1start = i<0 ? 0 : ts[i];
- } else {
- t = 1;
- tdiff = -1/16.0;
- t1start = 0;
- t1end = ( ts[0]==-1 ) ? 1.0 : ts[0];
- }
-
- for ( ; (s2forward && t<=1) || (!s2forward && t>=0 ); t += tdiff ) {
- double x1, y1, xo, yo;
- double x = ((s2->splines[0].a*t+s2->splines[0].b)*t+s2->splines[0].c)*t+s2->splines[0].d;
- double y = ((s2->splines[1].a*t+s2->splines[1].b)*t+s2->splines[1].c)*t+s2->splines[1].d;
- if ( xoff>yoff )
- t1 = IterateSplineSolve(&s1->splines[0],t1start,t1end,x,.001);
- else
- t1 = IterateSplineSolve(&s1->splines[1],t1start,t1end,y,.001);
- if ( t1<0 || t1>1 )
-return( -1 );
- x1 = ((s1->splines[0].a*t1+s1->splines[0].b)*t1+s1->splines[0].c)*t1+s1->splines[0].d;
- y1 = ((s1->splines[1].a*t1+s1->splines[1].b)*t1+s1->splines[1].c)*t1+s1->splines[1].d;
- if ( (xo = (x-x1))<0 ) xo = -xo;
- if ( (yo = (y-y1))<0 ) yo = -yo;
- if ( xo+yo>.5 )
-return( -1 );
- }
-return( t1 );
-}
-
-static void SSRemoveBacktracks(SplineSet *ss) {
- SplinePoint *sp;
-
- if ( ss==NULL )
-return;
- for ( sp=ss->first; ; ) {
- if ( sp->next!=NULL && sp->prev!=NULL ) {
- SplinePoint *nsp = sp->next->to, *psp = sp->prev->from, *isp;
- BasePoint ndir, pdir;
- double dot, pdot, nlen, plen, t = -1;
-
- ndir.x = (nsp->me.x - sp->me.x); ndir.y = (nsp->me.y - sp->me.y);
- pdir.x = (psp->me.x - sp->me.x); pdir.y = (psp->me.y - sp->me.y);
- nlen = ndir.x*ndir.x + ndir.y*ndir.y; plen = pdir.x*pdir.x + pdir.y*pdir.y;
- dot = ndir.x*pdir.x + ndir.y*pdir.y;
- if ( (pdot = ndir.x*pdir.y - ndir.y*pdir.x)<0 ) pdot = -pdot;
- if ( dot>0 && dot>pdot ) {
- if ( nlen>plen && (t=AdjacentSplinesMatch(sp->next,sp->prev,false))!=-1 ) {
- isp = SplineBisect(sp->next,t);
- psp->nextcp.x = psp->me.x + (isp->nextcp.x-isp->me.x);
- psp->nextcp.y = psp->me.y + (isp->nextcp.y-isp->me.y);
- psp->nonextcp = isp->nonextcp;
- psp->next = isp->next;
- isp->next->from = psp;
- SplineFree(isp->prev);
- SplineFree(sp->prev);
- SplinePointFree(isp);
- SplinePointFree(sp);
- if ( psp->next->order2 ) {
- psp->nextcp.x = nsp->prevcp.x = (psp->nextcp.x+nsp->prevcp.x)/2;
- psp->nextcp.y = nsp->prevcp.y = (psp->nextcp.y+nsp->prevcp.y)/2;
- if ( psp->nonextcp || nsp->noprevcp )
- psp->nonextcp = nsp->noprevcp = true;
- }
- SplineRefigure(psp->next);
- if ( ss->first==sp )
- ss->first = psp;
- if ( ss->last==sp )
- ss->last = psp;
- sp=psp;
- } else if ( nlen<plen && (t=AdjacentSplinesMatch(sp->prev,sp->next,true))!=-1 ) {
- isp = SplineBisect(sp->prev,t);
- nsp->prevcp.x = nsp->me.x + (isp->prevcp.x-isp->me.x);
- nsp->prevcp.y = nsp->me.y + (isp->prevcp.y-isp->me.y);
- nsp->noprevcp = isp->noprevcp;
- nsp->prev = isp->prev;
- isp->prev->to = nsp;
- SplineFree(isp->next);
- SplineFree(sp->next);
- SplinePointFree(isp);
- SplinePointFree(sp);
- if ( psp->next->order2 ) {
- psp->nextcp.x = nsp->prevcp.x = (psp->nextcp.x+nsp->prevcp.x)/2;
- psp->nextcp.y = nsp->prevcp.y = (psp->nextcp.y+nsp->prevcp.y)/2;
- if ( psp->nonextcp || nsp->noprevcp )
- psp->nonextcp = nsp->noprevcp = true;
- }
- SplineRefigure(nsp->prev);
- if ( ss->first==sp )
- ss->first = psp;
- if ( ss->last==sp )
- ss->last = psp;
- sp=psp;
- }
- }
- }
- if ( sp->next==NULL )
- break;
- sp=sp->next->to;
- if ( sp==ss->first )
- break;
- }
-}
-
-/* If we have a contour with no width, say a line from A to B and then from B */
-/* to A, then it will be ambiguous, depending on how we hit the contour, as */
-/* to whether it is needed or not. Which will cause us to complain. Since */
-/* they contain no area, they achieve nothing, so we might as well say they */
-/* overlap themselves and remove them here */
-static SplineSet *SSRemoveReversals(SplineSet *base) {
- SplineSet *head = base, *prev=NULL, *next;
- SplinePoint *sp;
- int changed;
-
- while ( base!=NULL ) {
- next = base->next;
- changed = true;
- while ( changed ) {
- changed = false;
- if ( base->first->next==NULL ||
- (base->first->next->to==base->first &&
- base->first->nextcp.x==base->first->prevcp.x &&
- base->first->nextcp.y==base->first->prevcp.y)) {
- /* remove single points */
- if ( prev==NULL )
- head = next;
- else
- prev->next = next;
- base->next = NULL;
- SplinePointListFree(base);
- base = prev;
- break;
- }
- for ( sp=base->first; ; ) {
- if ( sp->next!=NULL && sp->prev!=NULL &&
- sp->nextcp.x==sp->prevcp.x && sp->nextcp.y==sp->prevcp.y ) {
- SplinePoint *nsp = sp->next->to, *psp = sp->prev->from, *isp;
- if ( psp->me.x==nsp->me.x && psp->me.y==nsp->me.y &&
- psp->nextcp.x==nsp->prevcp.x && psp->nextcp.y==nsp->prevcp.y ) {
- /* We wish to remove sp, sp->next, sp->prev & one of nsp/psp */
- RemoveNextSP(psp,sp,nsp,base);
- changed = true;
- break;
- } else if ( sp->nonextcp /* which implies sp->noprevcp */ &&
- psp->nonextcp && nsp->noprevcp &&
- (isp = SameLine(psp,sp,nsp))!=NULL ) {
- /* We have a line that backtracks, but doesn't cover */
- /* the entire spline, so we intersect */
- /* We want to remove sp, the shorter of sp->next, sp->prev */
- /* and a bit of the other one. Also reomve one of nsp,psp */
- if ( isp==psp ) {
- RemoveNextSP(psp,sp,nsp,base);
- psp->nextcp = psp->me;
- psp->nonextcp = true;
- } else {
- RemovePrevSP(psp,sp,nsp,base);
- }
- changed = true;
- break;
- }
- }
- if ( sp->next==NULL )
- break;
- sp = sp->next->to;
- if ( sp==base->first )
- break;
- }
- }
- SSRemoveBacktracks(base);
- prev = base;
- base = next;
- }
-return( head );
-}
-
-SplineSet *SplineSetRemoveOverlap(SplineChar *sc, SplineSet *base,enum overlap_type ot) {
- Monotonic *ms;
- Intersection *ilist;
- SplineSet *ret;
- SplineSet *order3 = NULL;
- int is_o2 = false;
- SplineSet *ss;
-
- for ( ss=base; ss!=NULL; ss=ss->next )
- if ( ss->first->next!=NULL ) {
- is_o2 = ss->first->next->order2;
- break;
- }
- if ( is_o2 ) {
- order3 = SplineSetsPSApprox(base);
- SplinePointListsFree(base);
- base = order3;
- }
-
- if ( sc!=NULL )
- glyphname = sc->name;
-
- base = SSRemoveTiny(base);
- SSRemoveStupidControlPoints(base);
- SplineSetsRemoveAnnoyingExtrema(base,.3);
- SSOverlapClusterCpAngles(base,.01);
- base = SSRemoveReversals(base);
- ms = SSsToMContours(base,ot);
- ilist = FindIntersections(ms,ot);
- Validate(ms,ilist);
- if ( ot==over_findinter || ot==over_fisel ) {
- FixupIntersectedSplines(ms);
- ret = base;
- } else {
- FindNeeded(ms,ot);
- FindUnitVectors(ilist);
- if ( ot==over_remove || ot == over_rmselected )
- TestForBadDirections(ilist);
- ret = JoinAllNeeded(ilist);
- ret = MergeOpenAndFreeClosed(ret,base,ot);
- }
- FreeMonotonics(ms);
- FreeIntersections(ilist);
- glyphname = NULL;
- if ( order3!=NULL ) {
- ss = SplineSetsTTFApprox(ret);
- SplinePointListsFree(ret);
- ret = ss;
- }
-return( ret );
-}
diff --git a/Build/source/texk/web2c/luatexdir/luafontloader/fontforge/fontforge/splinerefigure.c b/Build/source/texk/web2c/luatexdir/luafontloader/fontforge/fontforge/splinerefigure.c
deleted file mode 100644
index 9d7694de739..00000000000
--- a/Build/source/texk/web2c/luatexdir/luafontloader/fontforge/fontforge/splinerefigure.c
+++ /dev/null
@@ -1,101 +0,0 @@
-/* Copyright (C) 2000-2008 by George Williams */
-/*
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are met:
-
- * Redistributions of source code must retain the above copyright notice, this
- * list of conditions and the following disclaimer.
-
- * Redistributions in binary form must reproduce the above copyright notice,
- * this list of conditions and the following disclaimer in the documentation
- * and/or other materials provided with the distribution.
-
- * The name of the author may not be used to endorse or promote products
- * derived from this software without specific prior written permission.
-
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
- * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
- * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
- * EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
- * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
- * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
- * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
- * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-#include "pfaedit.h"
-#include <stdio.h>
-#include <math.h>
-#include "splinefont.h"
-#ifdef HAVE_IEEEFP_H
-# include <ieeefp.h> /* Solaris defines isnan in ieeefp rather than math.h */
-#endif
-
-/* The slight errors introduced by the optimizer turn out to have nasty */
-/* side effects. An error on the order of 7e-8 in splines[1].b caused */
-/* the rasterizer to have kaniptions */
-void SplineRefigure3(Spline *spline) {
- SplinePoint *from = spline->from, *to = spline->to;
- Spline1D *xsp = &spline->splines[0], *ysp = &spline->splines[1];
- Spline old;
-
-#ifdef DEBUG
- if ( RealNear(from->me.x,to->me.x) && RealNear(from->me.y,to->me.y))
- IError("Zero length spline created");
-#endif
- if ( spline->acceptableextrema )
- old = *spline;
- xsp->d = from->me.x; ysp->d = from->me.y;
- if ( from->nonextcp ) from->nextcp = from->me;
- else if ( from->nextcp.x==from->me.x && from->nextcp.y == from->me.y ) from->nonextcp = true;
- if ( to->noprevcp ) to->prevcp = to->me;
- else if ( to->prevcp.x==to->me.x && to->prevcp.y == to->me.y ) to->noprevcp = true;
- if ( from->nonextcp && to->noprevcp ) {
- spline->islinear = true;
- xsp->c = to->me.x-from->me.x;
- ysp->c = to->me.y-from->me.y;
- xsp->a = xsp->b = 0;
- ysp->a = ysp->b = 0;
- } else {
- /* from p. 393 (Operator Details, curveto) Postscript Lang. Ref. Man. (Red book) */
- xsp->c = 3*(from->nextcp.x-from->me.x);
- ysp->c = 3*(from->nextcp.y-from->me.y);
- xsp->b = 3*(to->prevcp.x-from->nextcp.x)-xsp->c;
- ysp->b = 3*(to->prevcp.y-from->nextcp.y)-ysp->c;
- xsp->a = to->me.x-from->me.x-xsp->c-xsp->b;
- ysp->a = to->me.y-from->me.y-ysp->c-ysp->b;
- if ( RealNear(xsp->c,0)) xsp->c=0;
- if ( RealNear(ysp->c,0)) ysp->c=0;
- if ( RealNear(xsp->b,0)) xsp->b=0;
- if ( RealNear(ysp->b,0)) ysp->b=0;
- if ( RealNear(xsp->a,0)) xsp->a=0;
- if ( RealNear(ysp->a,0)) ysp->a=0;
- spline->islinear = false;
- if ( ysp->a==0 && xsp->a==0 && ysp->b==0 && xsp->b==0 )
- spline->islinear = true; /* This seems extremely unlikely... */
- }
- if ( !isfinite(ysp->a) || !isfinite(xsp->a) || !isfinite(ysp->c) || !isfinite(xsp->c) || !isfinite(ysp->d) || !isfinite(xsp->d))
- IError("NaN value in spline creation");
- LinearApproxFree(spline->approx);
- spline->approx = NULL;
- spline->knowncurved = false;
- spline->knownlinear = spline->islinear;
- SplineIsLinear(spline);
- spline->isquadratic = false;
- if ( !spline->knownlinear && xsp->a==0 && ysp->a==0 )
- spline->isquadratic = true; /* Only likely if we read in a TTF */
- spline->order2 = false;
-
- if ( spline->acceptableextrema ) {
- /* I don't check "d", because changes to that reflect simple */
- /* translations which will not affect the shape of the spline */
- if ( !RealNear(old.splines[0].a,spline->splines[0].a) ||
- !RealNear(old.splines[0].b,spline->splines[0].b) ||
- !RealNear(old.splines[0].c,spline->splines[0].c) ||
- !RealNear(old.splines[1].a,spline->splines[1].a) ||
- !RealNear(old.splines[1].b,spline->splines[1].b) ||
- !RealNear(old.splines[1].c,spline->splines[1].c) )
- spline->acceptableextrema = false;
- }
-}
diff --git a/Build/source/texk/web2c/luatexdir/luafontloader/fontforge/fontforge/splinesave.c b/Build/source/texk/web2c/luatexdir/luafontloader/fontforge/fontforge/splinesave.c
deleted file mode 100644
index 75f95103858..00000000000
--- a/Build/source/texk/web2c/luatexdir/luafontloader/fontforge/fontforge/splinesave.c
+++ /dev/null
@@ -1,2011 +0,0 @@
-/* Copyright (C) 2000-2008 by George Williams */
-/*
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are met:
-
- * Redistributions of source code must retain the above copyright notice, this
- * list of conditions and the following disclaimer.
-
- * Redistributions in binary form must reproduce the above copyright notice,
- * this list of conditions and the following disclaimer in the documentation
- * and/or other materials provided with the distribution.
-
- * The name of the author may not be used to endorse or promote products
- * derived from this software without specific prior written permission.
-
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
- * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
- * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
- * EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
- * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
- * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
- * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
- * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-#include "pfaedit.h"
-#include <stdio.h>
-#include <math.h>
-#include "splinefont.h"
-#include "psfont.h"
-#include <ustring.h>
-#include <string.h>
-#include <utype.h>
-
-int autohint_before_generate = 1;
-
-/* Let's talk about references. */
-/* If we are doing Type1 output, then the obvious way of doing them is seac */
-/* but that's so limitting. It only works for exactly two characters both */
-/* of which are in Adobe's Standard Enc. Only translations allowed. Only */
-/* one reference may be translated and the width of the char must match */
-/* that of the non-translated reference */
-/* The first extension we can make is to allow a single character reference */
-/* by making the other character be a space */
-/* But if we want to do more than that we must use subrs. If we have two */
-/* refs in subrs then we can do translations by preceding the subr calls by */
-/* appropriate rmovetos. Actually the specs say that only one rmoveto should */
-/* precede a path, so that means we can't allow the subroutines to position */
-/* themselves, they must just assume that they are called with the current */
-/* position correct for the first point. But then we need to know where the */
-/* first point should be placed, so we allocate a BasePoint to hold that info*/
-/* and store it into the "keys" array (which the subrs don't use). Similarly */
-/* we need to know where the subr will leave us, so we actually allocate 2 */
-/* BasePoints, one containing the start point, one the end point */
-/* But that's still not good enough, hints are defined in such a way that */
-/* they are not relocateable. So our subrs can't include any hint definitions*/
-/* (or if they do then that subr can't be translated at all). So hints must */
-/* be set outside the subrs, and the subrs can't be for chars that need hint */
-/* substitution. Unless... The subr will never be relocated. */
-/* So we generate two types of reference subrs, one containing no hints, the*/
-/* other containing all the hints, stems and flexes. The first type may be */
-/* translated, the second cannot */
-/* Type2 doesn't allow any seacs */
-/* So everything must go in subrs. We have a slightly different problem here:*/
-/* hintmasks need to know exactly how many stem hints there are in the char */
-/* so we can't include any hintmask operators inside a subr (unless we */
-/* guarantee that all invocations of that subr are done with the same number */
-/* of hints in the character). This again means that no char with hint subs- */
-/* titutions may be put in a subr. UNLESS all the other references in a */
-/* refering character contain no hints */
-
-/* That's very complex. And it doesn't do a very good job. */
-/* Instead let's take all strings bounded by either moveto or hintmask operators */
-/* store these as potential subroutines. So a glyph becomes a sequence of */
-/* potential subroutine calls preceded by the glyph header (width, hint decl,*/
-/* counter declarations, etc.) and intersperced by hintmask/moveto operators */
-/* Each time we get a potential subr we hash it and see if we've used that */
-/* string before. If we have then we merge the two. Otherwise it's a new one.*/
-/* Then at the end we see what strings get used often enough to go into subrs */
-/* we create the subrs array from that. */
-/* Then each glyph. We insert the preamble. We check of the potential subroutine */
-/* became a real subroutine. If so we call it, else we insert the data inline*/
-/* Do the same for the next hintmask/moveto and potential subroutine... */
-
-/* Then, on top of that I tried generating some full glyph subroutines, and */
-/* to my surprise, it just made things worse. */
-
-typedef struct growbuf {
- unsigned char *pt;
- unsigned char *base;
- unsigned char *end;
-} GrowBuf;
-
-#define HSH_SIZE 511
-/* In type2 charstrings we divide every character into bits where a bit is */
-/* bounded by a hintmask/moveto. Each of these is a potential subroutine and */
-/* is stored here */
-typedef struct glyphinfo {
- struct potentialsubrs {
- uint8 *data; /* the charstring of the subr */
- int len; /* the length of the charstring */
- int idx; /* initially index into psubrs array */
- /* then index into subrs array or -1 if none */
- int cnt; /* the usage count */
- int fd; /* Which sub font is it in */
- /* -1 => used in more than one */
- int next;
- int full_glyph_index; /* Into the glyphbits array */
- /* for full references */
- BasePoint *startstop; /* Again for full references */
- } *psubrs;
- int pcnt, pmax;
- int hashed[HSH_SIZE];
- struct glyphbits {
- SplineChar *sc;
- int fd; /* Which subfont is it in */
- int bcnt;
- struct bits {
- uint8 *data;
- int dlen;
- int psub_index;
- } *bits;
- uint8 wasseac;
- } *gb, *active;
- SplineFont *sf;
- int layer;
- int glyphcnt;
- int subfontcnt;
- int bcnt, bmax;
- struct bits *bits; /* For current glyph */
- const int *bygid;
- int justbroken;
- int instance_count;
-} GlyphInfo;
-
-struct mhlist {
- uint8 mask[HntMax/8];
- int subr;
- struct mhlist *next;
-};
-
-struct hintdb {
- uint8 mask[HntMax/8];
- int cnt; /* number of hints */
- struct mhlist *sublist;
- struct pschars *subrs;
- /*SplineChar *sc;*/
- SplineChar **scs;
- int instance_count;
- unsigned int iscjk: 1; /* If cjk then don't do stem3 hints */
- /* Will be done with counters instead */
- /* actually, most of the time we can't use stem3s, only if those three*/
- /* stems are always active and there are no other stems !(h/v)hasoverlap*/
- unsigned int noconflicts: 1;
- unsigned int startset: 1;
- unsigned int skiphm: 1; /* Set when coming back to the start point of a contour. hintmask should be set the first time, not the second */
- unsigned int donefirsthm: 1;
- int cursub; /* Current subr number */
- DBasePoint current;
- GlyphInfo *gi;
-};
-
-static void GIContentsFree(GlyphInfo *gi,SplineChar *dummynotdef) {
- int i,j;
-
- if ( gi->glyphcnt>0 && gi->gb[0].sc == dummynotdef ) {
- if ( dummynotdef->layers!=NULL ) {
- SplinePointListsFree(dummynotdef->layers[gi->layer].splines);
- dummynotdef->layers[gi->layer].splines = NULL;
- }
- StemInfosFree(dummynotdef->hstem);
- StemInfosFree(dummynotdef->vstem);
- dummynotdef->vstem = dummynotdef->hstem = NULL;
- free(dummynotdef->layers);
- dummynotdef->layers = NULL;
- }
-
- for ( i=0; i<gi->pcnt; ++i ) {
- free(gi->psubrs[i].data);
- free(gi->psubrs[i].startstop);
- gi->psubrs[i].data = NULL;
- gi->psubrs[i].startstop = NULL;
- }
- for ( i=0; i<gi->glyphcnt; ++i ) {
- for ( j=0; j<gi->gb[i].bcnt; ++j )
- free(gi->gb[i].bits[j].data);
- free(gi->gb[i].bits);
- gi->gb[i].bits = NULL;
- gi->gb[i].bcnt = 0;
- }
-
- gi->pcnt = 0;
- gi->bcnt = 0;
- gi->justbroken = 0;
-}
-
-static void GIFree(GlyphInfo *gi,SplineChar *dummynotdef) {
-
- GIContentsFree(gi,dummynotdef);
-
- free(gi->gb);
- free(gi->psubrs);
- free(gi->bits);
-}
-
-static void GrowBuffer(GrowBuf *gb) {
- if ( gb->base==NULL ) {
- gb->base = gb->pt = galloc(200);
- gb->end = gb->base + 200;
- } else {
- int len = (gb->end-gb->base) + 400;
- int off = gb->pt-gb->base;
- gb->base = grealloc(gb->base,len);
- gb->end = gb->base + len;
- gb->pt = gb->base+off;
- }
-}
-
-static void StartNextSubroutine(GrowBuf *gb,struct hintdb *hdb) {
- GlyphInfo *gi;
-
- if ( hdb==NULL )
-return;
- gi = hdb->gi;
- if ( gi==NULL )
-return;
- /* Store everything in the grow buf into the data/dlen of the next bit */
- if ( gi->bcnt==-1 ) gi->bcnt = 0;
- if ( gi->bcnt>=gi->bmax )
- gi->bits = grealloc(gi->bits,(gi->bmax+=20)*sizeof(struct bits));
- gi->bits[gi->bcnt].dlen = gb->pt-gb->base;
- gi->bits[gi->bcnt].data = galloc(gi->bits[gi->bcnt].dlen);
- gi->bits[gi->bcnt].psub_index = -1;
- memcpy(gi->bits[gi->bcnt].data,gb->base,gi->bits[gi->bcnt].dlen);
- gb->pt = gb->base;
- gi->justbroken = false;
-}
-
-static int hashfunc(uint8 *data, int len) {
- uint8 *end = data+len;
- unsigned int hash = 0, r;
-
- while ( data<end ) {
- r = (hash>>30)&3;
- hash <<= 2;
- hash = (hash|r)&0xffffffff;
- hash ^= *data++;
- }
-return( hash%HSH_SIZE );
-}
-
-static void BreakSubroutine(GrowBuf *gb,struct hintdb *hdb) {
- GlyphInfo *gi;
- struct potentialsubrs *ps;
- int hash;
- int pi;
-
- if ( hdb==NULL )
-return;
- gi = hdb->gi;
- if ( gi==NULL )
-return;
- /* The stuff before the first moveto in a glyph (the header that sets */
- /* the width, sets up the hints, counters, etc.) can't go into a subr */
- if ( gi->bcnt==-1 ) {
- gi->bcnt=0;
- gi->justbroken = true;
-return;
- } else if ( gi->justbroken )
-return;
- /* Otherwise stuff everything in the growbuffer into a subr */
- hash = hashfunc(gb->base,gb->pt-gb->base);
- ps = NULL;
- for ( pi=gi->hashed[hash]; pi!=-1; pi=gi->psubrs[pi].next ) {
- ps = &gi->psubrs[pi];
- if ( ps->len==gb->pt-gb->base && memcmp(ps->data,gb->base,gb->pt-gb->base)==0 )
- break;
- }
- if ( pi==-1 ) {
- if ( gi->pcnt>=gi->pmax )
- gi->psubrs = grealloc(gi->psubrs,(gi->pmax+=gi->glyphcnt)*sizeof(struct potentialsubrs));
- ps = &gi->psubrs[gi->pcnt];
- memset(ps,0,sizeof(*ps)); /* set cnt to 0 */
- ps->idx = gi->pcnt++;
- ps->len = gb->pt-gb->base;
- ps->data = galloc(ps->len);
- memcpy(ps->data,gb->base,ps->len);
- ps->next = gi->hashed[hash];
- gi->hashed[hash] = ps->idx;
- ps->fd = gi->active->fd;
- ps->full_glyph_index = -1;
- }
- if ( ps->fd!=gi->active->fd )
- ps->fd = -1; /* used in multiple cid sub-fonts */
- gi->bits[gi->bcnt].psub_index = ps->idx;
- ++ps->cnt;
- gb->pt = gb->base;
- ++gi->bcnt;
- gi->justbroken = true;
-}
-
-static void MoveSubrsToChar(GlyphInfo *gi) {
- struct glyphbits *active;
-
- if ( gi==NULL )
-return;
- active = gi->active;
- active->bcnt = gi->bcnt;
- active->bits = galloc(active->bcnt*sizeof(struct bits));
- memcpy(active->bits,gi->bits,active->bcnt*sizeof(struct bits));
- gi->bcnt = 0;
-}
-
-static int NumberHints(SplineChar *scs[MmMax], int instance_count) {
- int i,j, cnt=-1;
- StemInfo *s;
-
- for ( j=0; j<instance_count; ++j ) {
- for ( s=scs[j]->hstem, i=0; s!=NULL; s=s->next ) {
- if ( i<HntMax )
- s->hintnumber = i++;
- else
- s->hintnumber = -1;
- }
- for ( s=scs[j]->vstem; s!=NULL; s=s->next ) {
- if ( i<HntMax )
- s->hintnumber = i++;
- else
- s->hintnumber = -1;
- }
- if ( cnt==-1 )
- cnt = i;
- else if ( cnt!=i )
- IError("MM font with different hint counts");
- }
-return( cnt );
-}
-
-void RefCharsFreeRef(RefChar *ref) {
- RefChar *rnext;
-
- while ( ref!=NULL ) {
- rnext = ref->next;
- /* don't free the splines */
- chunkfree(ref,sizeof(RefChar));
- ref = rnext;
- }
-}
-
-static void MarkTranslationRefs(SplineFont *sf,int layer) {
- int i;
- SplineChar *sc;
- RefChar *r;
-
- for ( i=0; i<sf->glyphcnt; ++i ) if ( (sc = sf->glyphs[i])!=NULL ) {
- for ( r = sc->layers[layer].refs; r!=NULL; r=r->next )
- r->justtranslated = (r->transform[0]==1 && r->transform[3]==1 &&
- r->transform[1]==0 && r->transform[2]==0);
- }
-}
-
-/* ************************************************************************** */
-/* ********************** Type1 PostScript CharStrings ********************** */
-/* ************************************************************************** */
-
-static real myround( real pos, int round ) {
- if ( round )
-return( rint( pos ));
- else
-return( rint( pos*100. )/100. );
-}
-
-static void AddNumber(GrowBuf *gb, real pos, int round) {
- int dodiv = 0;
- int val;
- unsigned char *str;
-
- if ( gb->pt+8>=gb->end )
- GrowBuffer(gb);
-
- pos = rint(100*pos)/100;
-
- if ( !round && pos!=floor(pos)) {
- pos *= 100;
- dodiv = true;
- }
- str = gb->pt;
- val = rint(pos);
- if ( pos>=-107 && pos<=107 )
- *str++ = val+139;
- else if ( pos>=108 && pos<=1131 ) {
- val -= 108;
- *str++ = (val>>8)+247;
- *str++ = val&0xff;
- } else if ( pos>=-1131 && pos<=-108 ) {
- val = -val;
- val -= 108;
- *str++ = (val>>8)+251;
- *str++ = val&0xff;
- } else {
- *str++ = '\377';
- *str++ = (val>>24)&0xff;
- *str++ = (val>>16)&0xff;
- *str++ = (val>>8)&0xff;
- *str++ = val&0xff;
- }
- if ( dodiv ) {
- *str++ = 100+139; /* 100 */
- *str++ = 12; /* div (byte1) */
- *str++ = 12; /* div (byte2) */
- }
- gb->pt = str;
-}
-
-/* When doing a multiple master font we have multiple instances of the same data */
-/* which must all be added, and then a call made to the appropriate blend routine */
-/* This is complicated because all the data may not fit on the stack so we */
-/* may need to make multiple calls */
-static void AddData(GrowBuf *gb, real data[MmMax][6], int instances, int num_coords,
- int round) {
- int allsame = true, alls[6];
- int i,j, chunk,min,max,subr;
-
- for ( j=0; j<num_coords; ++j ) {
- alls[j] = true;
- for ( i=1; i<instances; ++i ) {
- if ( data[i][j]!=data[0][j] ) {
- alls[j] = false;
- allsame = false;
- break;
- }
- }
- }
-
- if ( allsame ) { /* No need for blending */
- /* Probably a normal font, but possible in an mm */
- for ( j=0; j<num_coords; ++j )
- AddNumber(gb,data[0][j],round);
-return;
- }
-
- chunk = 22/instances;
- if ( chunk == 5 ) chunk = 4; /* No subroutine for 5 items */
- min = 0;
- while ( min<num_coords ) {
- while ( min<num_coords && alls[min] ) {
- AddNumber(gb,data[0][min],round);
- ++min;
- }
- max = min+chunk;
- if ( max>num_coords ) max = num_coords;
- while ( max-1>min && alls[max-1] )
- --max;
- if ( max-min==5 ) max=min+4;
- if ( min<max ) {
- for ( j=min; j<max; ++j )
- AddNumber(gb,data[0][j],round);
- for ( j=min; j<max; ++j )
- for ( i=1; i<instances; ++i )
- AddNumber(gb,data[i][j]-data[0][j],round);
- subr = (j-min) + 4;
- if ( j-min==6 ) subr = 9;
- AddNumber(gb,subr,round);
- if ( gb->pt+1>=gb->end )
- GrowBuffer(gb);
- *gb->pt++ = 10; /* callsubr */
- min = j;
- }
- }
-}
-
-int CvtPsStem3(GrowBuf *gb, SplineChar *scs[MmMax], int instance_count,
- int ishstem, int round) {
- StemInfo *h1, *h2, *h3;
- StemInfo _h1, _h2, _h3;
- real data[MmMax][6];
- int i;
- real off;
-
- for ( i=0; i<instance_count; ++i ) {
- if ( (ishstem && scs[i]->hconflicts) || (!ishstem && scs[i]->vconflicts))
-return( false );
- h1 = ishstem ? scs[i]->hstem : scs[i]->vstem;
- if ( h1==NULL || (h2 = h1->next)==NULL || (h3=h2->next)==NULL )
-return( false );
- if ( h3->next!=NULL )
-return( false );
- off = ishstem ? 0 : scs[i]->lsidebearing;
- if ( h1->width<0 ) {
- _h1 = *h1;
- _h1.start += _h1.width;
- _h1.width = -_h1.width;
- h1 = &_h1;
- }
- if ( h2->width<0 ) {
- _h2 = *h2;
- _h2.start += _h2.width;
- _h2.width = -_h2.width;
- h2 = &_h2;
- }
- if ( h3->width<0 ) {
- _h3 = *h3;
- _h3.start += _h3.width;
- _h3.width = -_h3.width;
- h3 = &_h3;
- }
-
- if ( h1->start>h2->start ) {
- StemInfo *ht = h1; h1 = h2; h2 = ht;
- }
- if ( h1->start>h3->start ) {
- StemInfo *ht = h1; h1 = h3; h3 = ht;
- }
- if ( h2->start>h3->start ) {
- StemInfo *ht = h2; h2 = h3; h3 = ht;
- }
- if ( h1->width != h3->width )
-return( false );
- if ( (h2->start+h2->width/2) - (h1->start+h1->width/2) !=
- (h3->start+h3->width/2) - (h2->start+h2->width/2) )
-return( false );
- data[i][0] = h1->start-off;
- data[i][1] = h1->width;
- data[i][2] = h2->start-off;
- data[i][3] = h2->width;
- data[i][4] = h3->start-off;
- data[i][5] = h3->width;
- }
- if ( gb==NULL )
-return( true );
- AddData(gb,data,instance_count,6,round);
- if ( gb->pt+3>=gb->end )
- GrowBuffer(gb);
- *(gb->pt)++ = 12;
- *(gb->pt)++ = ishstem?2:1; /* h/v stem3 */
-return( true );
-}
-
-static int _SCNeedsSubsPts(SplineChar *sc,int layer) {
- RefChar *ref;
-
- if ( sc->hstem==NULL && sc->vstem==NULL )
-return( false );
-
- if ( sc->layers[layer].splines!=NULL )
-return( sc->layers[layer].splines->first->hintmask==NULL );
-
- for ( ref = sc->layers[layer].refs; ref!=NULL; ref=ref->next )
- if ( ref->layers[0].splines!=NULL )
-return( ref->layers[0].splines->first->hintmask==NULL );
-
-return( false ); /* It's empty. that's easy. */
-}
-
-static int SCNeedsSubsPts(SplineChar *sc,enum fontformat format,int layer) {
- if ( (format!=ff_mma && format!=ff_mmb) || sc->parent->mm==NULL ) {
- if ( !sc->hconflicts && !sc->vconflicts )
-return( false ); /* No conflicts, no swap-over points needed */
-return( _SCNeedsSubsPts(sc,layer));
- } else {
- MMSet *mm = sc->parent->mm;
- int i;
- for ( i=0; i<mm->instance_count; ++i ) if ( sc->orig_pos<mm->instances[i]->glyphcnt ) {
- if ( _SCNeedsSubsPts(mm->instances[i]->glyphs[sc->orig_pos],layer) )
-return( true );
- }
-return( false );
- }
-}
-
-/* Mark those glyphs which can live totally in subrs */
-static void SplineFont2FullSubrs1(int flags,GlyphInfo *gi) {
- int i;
- SplineChar *sc;
-
- for ( i=0; i<gi->glyphcnt; ++i ) if ( (sc=gi->gb[i].sc)!=NULL )
- sc->ttf_glyph = 0x7fff;
-
-}
-
-int SFOneWidth(SplineFont *sf) {
- int width, i;
-
- width = -2;
- for ( i=0; i<sf->glyphcnt; ++i ) if ( SCWorthOutputting(sf->glyphs[i]) &&
- (strcmp(sf->glyphs[i]->name,".notdef")!=0 || sf->glyphs[i]->layers[ly_fore].splines!=NULL)) {
- /* Only trust the width of notdef if it's got some content */
- /* (at least as far as fixed pitch determination goes) */
- if ( width==-2 ) width = sf->glyphs[i]->width;
- else if ( width!=sf->glyphs[i]->width ) {
- width = -1;
- break;
- }
- }
-return(width);
-}
-
-int CIDOneWidth(SplineFont *_sf) {
- int width, i;
- int k;
- SplineFont *sf;
-
- if ( _sf->cidmaster!=NULL ) _sf = _sf->cidmaster;
- width = -2;
- k=0;
- do {
- sf = _sf->subfonts==NULL? _sf : _sf->subfonts[k];
- for ( i=0; i<sf->glyphcnt; ++i ) if ( SCWorthOutputting(sf->glyphs[i]) &&
- strcmp(sf->glyphs[i]->name,".null")!=0 &&
- strcmp(sf->glyphs[i]->name,"nonmarkingreturn")!=0 &&
- (strcmp(sf->glyphs[i]->name,".notdef")!=0 || sf->glyphs[i]->layers[ly_fore].splines!=NULL)) {
- /* Only trust the width of notdef if it's got some content */
- /* (at least as far as fixed pitch determination goes) */
- if ( width==-2 ) width = sf->glyphs[i]->width;
- else if ( width!=sf->glyphs[i]->width ) {
- width = -1;
- break;
- }
- }
- ++k;
- } while ( k<_sf->subfontcnt );
-return(width);
-}
-
-
-static void SetupType1Subrs(struct pschars *subrs,GlyphInfo *gi) {
- int scnt, call_size;
- int i;
-
- scnt = subrs->next;
- call_size = gi->pcnt+scnt<1131 ? 3 : 6;
- for ( i=0; i<gi->pcnt; ++i ) {
- /* A subroutine call takes somewhere between 2 and 6 bytes itself. */
- /* and we must add a return statement to the end. We don't want to */
- /* make things bigger */
- if ( gi->psubrs[i].full_glyph_index!=-1 )
- gi->psubrs[i].idx = scnt++;
- else if ( gi->psubrs[i].cnt*gi->psubrs[i].len>(gi->psubrs[i].cnt*call_size)+gi->psubrs[i].len+1 )
- gi->psubrs[i].idx = scnt++;
- else
- gi->psubrs[i].idx = -1;
- }
-
- subrs->cnt = scnt;
- subrs->next = scnt;
- subrs->lens = grealloc(subrs->lens,scnt*sizeof(int));
- subrs->values = grealloc(subrs->values,scnt*sizeof(unsigned char *));
-
- for ( i=0; i<gi->pcnt; ++i ) {
- scnt = gi->psubrs[i].idx;
- if ( scnt==-1 || gi->psubrs[i].full_glyph_index != -1 )
- continue;
- subrs->lens[scnt] = gi->psubrs[i].len+1;
- subrs->values[scnt] = galloc(subrs->lens[scnt]);
- memcpy(subrs->values[scnt],gi->psubrs[i].data,gi->psubrs[i].len);
- subrs->values[scnt][gi->psubrs[i].len] = 11; /* Add a return to end of subr */
- }
-}
-
-static void SetupType1Chrs(struct pschars *chrs,struct pschars *subrs,GlyphInfo *gi, int iscid) {
- int i,k,j;
-
- /* If a glyph lives entirely in a subroutine then we need to create both */
- /* the subroutine entry, and the char entry which calls the subr. */
- /* The subroutine entry will be everything EXCEPT the glyph header */
- /* the char entry will be the glyph header and a subroutine call */
- /* If the glyph does not go into a subr then everything goes into the char */
- for ( i=0; i<gi->glyphcnt; ++i ) {
- int len=0;
- struct glyphbits *gb = &gi->gb[i];
- if ( gb->sc==NULL )
- continue;
- if ( !iscid )
- chrs->keys[i] = copy(gb->sc->name);
- for ( k=0; k<2; ++k ) if ( k!=0 || gb->sc->ttf_glyph!=0x7fff ) {
- uint8 *vals;
- for ( j=0; j<gb->bcnt; ++j ) {
- if ( k!=0 || j!=0 )
- len += gb->bits[j].dlen;
- if ( k==1 && gb->sc->ttf_glyph!=0x7fff ) {
- int si = gi->psubrs[ gb->sc->ttf_glyph ].idx;
- len += 1 + (si<=107?1:si<=1131?2:5);
- break;
- }
- if ( gi->psubrs[ gb->bits[j].psub_index ].idx==-1 )
- len += gi->psubrs[ gb->bits[j].psub_index ].len;
- else {
- int si = gi->psubrs[ gb->bits[j].psub_index ].idx;
- len += 1 + (si<=107?1:si<=1131?2:5);
- /* Space for a subr call & the sub number to call */
- }
- }
- if ( k==0 ) {
- int si = gi->psubrs[ gb->sc->ttf_glyph ].idx;
- subrs->lens[si] = len+1;
- vals = subrs->values[si] = galloc(len+2);
- } else {
- /* Don't need or want and endchar if we are using seac */
- chrs->lens[i] = len + !gb->wasseac;
- vals = chrs->values[i] = galloc(len+2); /* space for endchar and a final NUL (which is really meaningless, but makes me feel better) */
- }
-
- len = 0;
- for ( j=0; j<gb->bcnt; ++j ) {
- int si;
- if ( k!=0 || j!=0 ) {
- memcpy(vals+len,gb->bits[j].data,gb->bits[j].dlen);
- len += gb->bits[j].dlen;
- }
- si = -1;
- if ( k==1 && gb->sc->ttf_glyph!=0x7fff )
- si = gi->psubrs[ gb->sc->ttf_glyph ].idx;
- else if ( gi->psubrs[ gb->bits[j].psub_index ].idx==-1 ) {
- memcpy(vals+len,gi->psubrs[ gb->bits[j].psub_index ].data,
- gi->psubrs[ gb->bits[j].psub_index ].len);
- len += gi->psubrs[ gb->bits[j].psub_index ].len;
- } else
- si = gi->psubrs[ gb->bits[j].psub_index ].idx;
- if ( si!=-1 ) {
- /* space for the number (subroutine index) */
- if ( si<=107 )
- vals[len++] = si+139;
- else if ( si>0 && si<=1131 ) {
- si-=108;
- vals[len++] = (si>>8)+247;
- vals[len++] = si&0xff;
- } else {
- vals[len++] = '\377';
- vals[len++] = (si>>24)&0xff;
- vals[len++] = (si>>16)&0xff;
- vals[len++] = (si>>8)&0xff;
- vals[len++] = si&0xff;
- }
- /* space for the subroutine operator */
- vals[len++] = 10;
- }
- if ( k==1 && gb->sc->ttf_glyph!=0x7fff )
- break;
- }
- if ( k==0 ) {
- vals[len++] = 11; /* return */
- vals[len] = '\0';
- } else if ( gb->wasseac ) {
- /* Don't want an endchar */
- vals[len] = '\0';
- } else {
- vals[len++] = 14; /* endchar */
- vals[len] = '\0';
- }
- }
- }
-}
-
-/* ************************************************************************** */
-/* ********************** Type2 PostScript CharStrings ********************** */
-/* ************************************************************************** */
-
-#if 0
-static int real_warn = false;
-#endif
-
-static real myround2(real pos, int round) {
- if ( round )
-return( rint(pos));
-
-return( rint(65536*pos)/65536 );
-}
-
-static void AddNumber2(GrowBuf *gb, real pos, int round) {
- int val, factor;
- unsigned char *str;
-
- if ( gb->pt+5>=gb->end )
- GrowBuffer(gb);
-
- pos = rint(65536*pos)/65536;
- if ( round )
- pos = rint(pos);
-
- str = gb->pt;
- if ( pos>32767.99 || pos<-32768 ) {
- /* same logic for big ints and reals */
- if ( pos>0x3fffffff || pos<-0x40000000 ) {
- LogError( _("Number out of range: %g in type2 output (must be [-65536,65535])\n"),
- pos );
- if ( pos>0 ) pos = 0x3fffffff; else pos = -0x40000000;
- }
- for ( factor=2; factor<32768; factor<<=2 )
- if ( pos/factor<32767.99 && pos/factor>-32768 )
- break;
- AddNumber2(gb,pos/factor,false);
- AddNumber2(gb,factor,false);
- if ( gb->pt+2>=gb->end )
- GrowBuffer(gb);
- *(gb->pt++) = 0x0c; /* Multiply operator */
- *(gb->pt++) = 0x18;
- } else if ( pos!=floor(pos )) {
- val = pos*65536;
- *str++ = '\377';
- *str++ = (val>>24)&0xff;
- *str++ = (val>>16)&0xff;
- *str++ = (val>>8)&0xff;
- *str++ = val&0xff;
- } else {
- val = rint(pos);
- if ( pos>=-107 && pos<=107 )
- *str++ = val+139;
- else if ( pos>=108 && pos<=1131 ) {
- val -= 108;
- *str++ = (val>>8)+247;
- *str++ = val&0xff;
- } else if ( pos>=-1131 && pos<=-108 ) {
- val = -val;
- val -= 108;
- *str++ = (val>>8)+251;
- *str++ = val&0xff;
- } else {
- *str++ = 28;
- *str++ = (val>>8)&0xff;
- *str++ = val&0xff;
- }
- }
- gb->pt = str;
-}
-
-static void AddMask2(GrowBuf *gb,uint8 mask[12],int cnt, int oper) {
- int i;
-
- if ( gb->pt+1+((cnt+7)>>3)>=gb->end )
- GrowBuffer(gb);
- *gb->pt++ = oper; /* hintmask,cntrmask */
- for ( i=0; i< ((cnt+7)>>3); ++i )
- *gb->pt++ = mask[i];
-}
-
-static void CounterHints2(GrowBuf *gb, SplineChar *sc, int hcnt) {
- int i;
-
- for ( i=0; i<sc->countermask_cnt; ++i )
- AddMask2(gb,sc->countermasks[i],hcnt,20); /* cntrmask */
-}
-
-static int HintSetup2(GrowBuf *gb,struct hintdb *hdb, SplinePoint *to, int break_subr ) {
-
- /* We might get a point with a hintmask in a glyph with no conflicts */
- /* (ie. the initial point when we return to it at the end of the splineset*/
- /* in that case hdb->cnt will be 0 and we should ignore it */
- /* components in subroutines depend on not having any hintmasks */
- if ( to->hintmask==NULL || hdb->cnt==0 || hdb->noconflicts || hdb->skiphm )
-return( false );
-
- if ( memcmp(hdb->mask,*to->hintmask,(hdb->cnt+7)/8)==0 )
-return( false );
-
- if ( break_subr )
- BreakSubroutine(gb,hdb);
-
- AddMask2(gb,*to->hintmask,hdb->cnt,19); /* hintmask */
- memcpy(hdb->mask,*to->hintmask,sizeof(HintMask));
- hdb->donefirsthm = true;
- if ( break_subr )
- StartNextSubroutine(gb,hdb);
-return( true );
-}
-
-static void moveto2(GrowBuf *gb,struct hintdb *hdb,SplinePoint *to, int round) {
- BasePoint temp, *tom;
-
- if ( gb->pt+18 >= gb->end )
- GrowBuffer(gb);
-
- BreakSubroutine(gb,hdb);
- HintSetup2(gb,hdb,to,false);
- tom = &to->me;
- if ( round ) {
- temp.x = rint(tom->x);
- temp.y = rint(tom->y);
- tom = &temp;
- }
-#if 0
- if ( hdb->current.x==tom->x && hdb->current.y==tom->y ) {
- /* we're already here */
- /* Yes, but a move is required anyway at char start */
- } else
-#endif
- if ( hdb->current.x==tom->x ) {
- AddNumber2(gb,tom->y-hdb->current.y,round);
- *(gb->pt)++ = 4; /* v move to */
- } else if ( hdb->current.y==tom->y ) {
- AddNumber2(gb,tom->x-hdb->current.x,round);
- *(gb->pt)++ = 22; /* h move to */
- } else {
- AddNumber2(gb,tom->x-hdb->current.x,round);
- AddNumber2(gb,tom->y-hdb->current.y,round);
- *(gb->pt)++ = 21; /* r move to */
- }
- hdb->current.x = rint(32768*tom->x)/32768;
- hdb->current.y = rint(32768*tom->y)/32768;
- StartNextSubroutine(gb,hdb);
-}
-
-static Spline *lineto2(GrowBuf *gb,struct hintdb *hdb,Spline *spline, Spline *done, int round) {
- int cnt, hv, hvcnt;
- Spline *test, *lastgood, *lasthvgood;
- BasePoint temp1, temp2, *tom, *fromm;
- int donehm;
-
- lastgood = NULL;
- for ( test=spline, cnt=0; test->knownlinear && cnt<15; ) {
- ++cnt;
- lastgood = test;
- test = test->to->next;
- /* it will be smaller to use a closepath operator so ignore the */
- /* ultimate spline */
- if ( test==done || test==NULL || test->to->next==done )
- break;
- }
-
- HintSetup2(gb,hdb,spline->to,true);
-
- hv = -1; hvcnt=1; lasthvgood = NULL;
- if ( spline->from->me.x==spline->to->me.x )
- hv = 1; /* Vertical */
- else if ( spline->from->me.y==spline->to->me.y )
- hv = 0; /* Horizontal */
- donehm = true;
- if ( hv!=-1 ) {
- lasthvgood = spline; hvcnt = 1;
- if ( cnt!=1 ) {
- for ( test=spline->to->next; test!=NULL ; test = test->to->next ) {
- fromm = &test->from->me;
- if ( round ) {
- temp2.x = rint(fromm->x);
- temp2.y = rint(fromm->y);
- fromm = &temp2;
- }
- tom = &test->to->me;
- if ( round ) {
- temp1.x = rint(tom->x);
- temp1.y = rint(tom->y);
- tom = &temp1;
- }
- if ( hv==1 && tom->y==fromm->y )
- hv = 0;
- else if ( hv==0 && tom->x==fromm->x )
- hv = 1;
- else
- break;
- lasthvgood = test;
- ++hvcnt;
- if ( test==lastgood )
- break;
- }
- }
- donehm = true;
- if ( hvcnt==cnt || hvcnt>=2 ) {
- /* It's more efficient to do some h/v linetos */
- for ( test=spline; ; test = test->to->next ) {
- if ( !donehm && test->to->hintmask!=NULL )
- break;
- donehm = false;
- fromm = &test->from->me;
- if ( round ) {
- temp2.x = rint(fromm->x);
- temp2.y = rint(fromm->y);
- fromm = &temp2;
- }
- tom = &test->to->me;
- if ( round ) {
- temp1.x = rint(tom->x);
- temp1.y = rint(tom->y);
- tom = &temp1;
- }
- if ( fromm->x==tom->x )
- AddNumber2(gb,tom->y-fromm->y,round);
- else
- AddNumber2(gb,tom->x-fromm->x,round);
- hdb->current.x = rint(32768*tom->x)/32768;
- hdb->current.y = rint(32768*tom->y)/32768;
- if ( test==lasthvgood ) {
- test = test->to->next;
- break;
- }
- }
- if ( gb->pt+1 >= gb->end )
- GrowBuffer(gb);
- *(gb->pt)++ = spline->from->me.x==spline->to->me.x? 7 : 6;
-return( test );
- }
- }
-
- for ( test=spline; test!=NULL; test = test->to->next ) {
- if ( !donehm && test->to->hintmask!=NULL )
- break;
- donehm = false;
- fromm = &test->from->me;
- if ( round ) {
- temp2.x = rint(fromm->x);
- temp2.y = rint(fromm->y);
- fromm = &temp2;
- }
- tom = &test->to->me;
- if ( round ) {
- temp1.x = rint(tom->x);
- temp1.y = rint(tom->y);
- tom = &temp1;
- }
- AddNumber2(gb,tom->x-fromm->x,round);
- AddNumber2(gb,tom->y-fromm->y,round);
- hdb->current.x = rint(32768*tom->x)/32768;
- hdb->current.y = rint(32768*tom->y)/32768;
- if ( test==lastgood ) {
- test = test->to->next;
- break;
- }
- }
- if ( gb->pt+1 >= gb->end )
- GrowBuffer(gb);
- *(gb->pt)++ = 5; /* r line to */
-return( test );
-}
-
-static Spline *curveto2(GrowBuf *gb,struct hintdb *hdb,Spline *spline, Spline *done, int round) {
- int cnt=0, hv;
- Spline *first;
- DBasePoint start;
- int donehm;
-
- HintSetup2(gb,hdb,spline->to,true);
-
- hv = -1;
- if ( hdb->current.x==myround2(spline->from->nextcp.x,round) &&
- myround2(spline->to->prevcp.y,round)==myround2(spline->to->me.y,round) )
- hv = 1;
- else if ( hdb->current.y==myround2(spline->from->nextcp.y,round) &&
- myround2(spline->to->prevcp.x,round)==myround2(spline->to->me.x,round) )
- hv = 0;
- donehm = true;
- if ( hv!=-1 ) {
- first = spline; start = hdb->current;
- while (
- (hv==1 && hdb->current.x==myround2(spline->from->nextcp.x,round) &&
- myround2(spline->to->prevcp.y,round)==myround2(spline->to->me.y,round) ) ||
- (hv==0 && hdb->current.y==myround2(spline->from->nextcp.y,round) &&
- myround2(spline->to->prevcp.x,round)==myround2(spline->to->me.x,round) ) ) {
- if ( !donehm && spline->to->hintmask!=NULL )
- break;
- donehm = false;
- if ( hv==1 ) {
- AddNumber2(gb,myround2(spline->from->nextcp.y,round)-hdb->current.y,round);
- AddNumber2(gb,myround2(spline->to->prevcp.x,round)-myround2(spline->from->nextcp.x,round),round);
- AddNumber2(gb,myround2(spline->to->prevcp.y,round)-myround2(spline->from->nextcp.y,round),round);
- AddNumber2(gb,myround2(spline->to->me.x,round)-myround2(spline->to->prevcp.x,round),round);
- hv = 0;
- } else {
- AddNumber2(gb,myround2(spline->from->nextcp.x,round)-hdb->current.x,round);
- AddNumber2(gb,myround2(spline->to->prevcp.x,round)-myround2(spline->from->nextcp.x,round),round);
- AddNumber2(gb,myround2(spline->to->prevcp.y,round)-myround2(spline->from->nextcp.y,round),round);
- AddNumber2(gb,myround2(spline->to->me.y,round)-myround2(spline->to->prevcp.y,round),round);
- hv = 1;
- }
- hdb->current.x = myround2(spline->to->me.x,round);
- hdb->current.y = myround2(spline->to->me.y,round);
- ++cnt;
- spline = spline->to->next;
- if ( spline==done || spline==NULL || cnt>9 || spline->knownlinear )
- break;
- }
- if ( gb->pt+1 >= gb->end )
- GrowBuffer(gb);
- *(gb->pt)++ = ( start.x==myround2(first->from->nextcp.x,round) && myround2(first->to->prevcp.y,round)==myround2(first->to->me.y,round) )?
- 30:31; /* vhcurveto:hvcurveto */
-return( spline );
- }
- while ( cnt<6 ) {
- if ( !donehm && spline->to->hintmask!=NULL )
- break;
- donehm = false;
- hv = -1;
- if ( hdb->current.x==myround2(spline->from->nextcp.x,round) &&
- myround2(spline->to->prevcp.y,round)==myround2(spline->to->me.y,round) &&
- spline->to->next!=NULL &&
- myround2(spline->to->me.y,round)==myround2(spline->to->nextcp.y,round) &&
- myround2(spline->to->next->to->prevcp.x,round)==myround2(spline->to->next->to->me.x,round) )
- break;
- else if ( hdb->current.y==myround2(spline->from->nextcp.y,round) &&
- myround2(spline->to->prevcp.x,round)==myround2(spline->to->me.x,round) &&
- spline->to->next!=NULL &&
- myround2(spline->to->me.x,round)==myround2(spline->to->nextcp.x,round) &&
- myround2(spline->to->next->to->prevcp.y,round)==myround2(spline->to->next->to->me.y,round) )
- break;
- AddNumber2(gb,myround2(spline->from->nextcp.x,round)-hdb->current.x,round);
- AddNumber2(gb,myround2(spline->from->nextcp.y,round)-hdb->current.y,round);
- AddNumber2(gb,myround2(spline->to->prevcp.x,round)-myround2(spline->from->nextcp.x,round),round);
- AddNumber2(gb,myround2(spline->to->prevcp.y,round)-myround2(spline->from->nextcp.y,round),round);
- AddNumber2(gb,myround2(spline->to->me.x,round)-myround2(spline->to->prevcp.x,round),round);
- AddNumber2(gb,myround2(spline->to->me.y,round)-myround2(spline->to->prevcp.y,round),round);
- hdb->current.x = myround2(spline->to->me.x,round);
- hdb->current.y = myround2(spline->to->me.y,round);
- ++cnt;
- spline = spline->to->next;
- if ( spline==done || spline==NULL || spline->knownlinear )
- break;
- }
- if ( gb->pt+1 >= gb->end )
- GrowBuffer(gb);
- *(gb->pt)++ = 8; /* rrcurveto */
-return( spline );
-}
-
-static void flexto2(GrowBuf *gb,struct hintdb *hdb,Spline *pspline,int round) {
- BasePoint *c0, *c1, *mid, *end, *nc0, *nc1;
- Spline *nspline;
-
- c0 = &pspline->from->nextcp;
- c1 = &pspline->to->prevcp;
- mid = &pspline->to->me;
- nspline = pspline->to->next;
- nc0 = &nspline->from->nextcp;
- nc1 = &nspline->to->prevcp;
- end = &nspline->to->me;
-
- HintSetup2(gb,hdb,nspline->to,true);
-
- if ( myround2(c0->y,round)==hdb->current.y && myround2(nc1->y,round)==hdb->current.y &&
- myround2(end->y,round)==hdb->current.y &&
- myround2(c1->y,round)==myround2(mid->y,round) && myround2(nc0->y,round)==myround2(mid->y,round) ) {
- if ( gb->pt+7*6+2 >= gb->end )
- GrowBuffer(gb);
- AddNumber2(gb,myround2(c0->x,round)-hdb->current.x,round);
- AddNumber2(gb,myround2(c1->x,round)-myround2(c0->x,round),round);
- AddNumber2(gb,myround2(c1->y,round)-myround2(c0->y,round),round);
- AddNumber2(gb,myround2(mid->x,round)-myround2(c1->x,round),round);
- AddNumber2(gb,myround2(nc0->x,round)-myround2(mid->x,round),round);
- AddNumber2(gb,myround2(nc1->x,round)-myround2(nc0->x,round),round);
- AddNumber2(gb,myround2(end->x,round)-myround2(nc1->x,round),round);
- *gb->pt++ = 12; *gb->pt++ = 34; /* hflex */
- } else {
- if ( gb->pt+11*6+2 >= gb->end )
- GrowBuffer(gb);
- AddNumber2(gb,myround2(c0->x,round)-hdb->current.x,round);
- AddNumber2(gb,myround2(c0->y,round)-hdb->current.y,round);
- AddNumber2(gb,myround2(c1->x,round)-myround2(c0->x,round),round);
- AddNumber2(gb,myround2(c1->y,round)-myround2(c0->y,round),round);
- AddNumber2(gb,myround2(mid->x,round)-myround2(c1->x,round),round);
- AddNumber2(gb,myround2(mid->y,round)-myround2(c1->y,round),round);
- AddNumber2(gb,myround2(nc0->x,round)-myround2(mid->x,round),round);
- AddNumber2(gb,myround2(nc0->y,round)-myround2(mid->y,round),round);
- AddNumber2(gb,myround2(nc1->x,round)-myround2(nc0->x,round),round);
- AddNumber2(gb,myround2(nc1->y,round)-myround2(nc0->y,round),round);
- if ( hdb->current.y==myround2(end->y,round) )
- AddNumber2(gb,myround2(end->x,round)-myround2(nc1->x,round),round);
- else
- AddNumber2(gb,myround2(end->y,round)-myround2(nc1->y,round),round);
- *gb->pt++ = 12; *gb->pt++ = 37; /* flex1 */
- }
-
- hdb->current.x = rint(32768*end->x)/32768;
- hdb->current.y = rint(32768*end->y)/32768;
-}
-
-static void CvtPsSplineSet2(GrowBuf *gb, SplinePointList *spl,
- struct hintdb *hdb, int is_order2,int round ) {
- Spline *spline, *first;
- SplinePointList temp, *freeme = NULL;
- int unhinted = true;;
-
- if ( is_order2 )
- freeme = spl = SplineSetsPSApprox(spl);
-
- for ( ; spl!=NULL; spl = spl->next ) {
- first = NULL;
- SplineSetReverse(spl);
- /* PostScript and TrueType store their splines in in reverse */
- /* orientations. Annoying. Oh well. I shall adopt TrueType and */
- /* If I reverse the PS splinesets after reading them in, and then */
- /* again when saving them out, all should be well */
- if ( spl->first->flexy || spl->first->flexx ) {
- /* can't handle a flex (mid) point as the first point. rotate the */
- /* list by one, this is possible because only closed paths have */
- /* points marked as flex, and because we can't have two flex mid- */
- /* points in a row */
- if ( spl->first->hintmask==NULL || spl->first->next->to->hintmask!=NULL ) {
- /* But we can't rotate it if we expect it to provide us with */
- /* a hintmask. */
- temp = *spl;
- temp.first = temp.last = spl->first->next->to;
- spl = &temp;
- }
- if ( spl->first->flexy || spl->first->flexx ) {
- /* If we couldn't rotate, or if we rotated to something that */
- /* also is flexible, then just turn off flex. That's safe */
- spl->first->flexx = spl->first->flexy = false;
- }
- }
- if ( unhinted && hdb->cnt>0 && spl->first->hintmask!=NULL ) {
- hdb->mask[0] = ~(*spl->first->hintmask)[0]; /* Make it different */
- unhinted = false;
- }
- moveto2(gb,hdb,spl->first,round);
- for ( spline = spl->first->next; spline!=NULL && spline!=first; ) {
- if ( first==NULL ) first = spline;
- else if ( first->from==spline->to )
- hdb->skiphm = true;
- if ( spline->to->flexx || spline->to->flexy ) {
- flexto2(gb,hdb,spline,round); /* does two adjacent splines */
- spline = spline->to->next->to->next;
- } else if ( spline->knownlinear && spline->to == spl->first )
- /* In Type2 we don't even need a closepath to finish this off */
- /* (which is good, because there isn't a close path) */
- break;
- else if ( spline->knownlinear )
- spline = lineto2(gb,hdb,spline,first,round);
- else
- spline = curveto2(gb,hdb,spline,first,round);
- }
- hdb->skiphm = false;
- /* No closepath oper in type2 fonts, it's implied */
- SplineSetReverse(spl);
- /* Of course, I have to Reverse again to get back to my convention after*/
- /* saving */
- }
- SplinePointListsFree(freeme);
-}
-
-static void DumpHints(GrowBuf *gb,StemInfo *h,int oper,int midoper,int round) {
- real last = 0, cur;
- int cnt;
-
- if ( h==NULL )
-return;
- cnt = 0;
- while ( h!=NULL && h->hintnumber!=-1 ) {
- /* Type2 hints do not support negative widths except in the case of */
- /* ghost (now called edge) hints */
- if ( cnt>24-1 ) { /* stack max = 48 numbers, => 24 hints, leave a bit of slop for the width */
- if ( gb->pt+1>=gb->end )
- GrowBuffer(gb);
- *gb->pt++ = midoper;
- cnt = 0;
- }
- cur = myround2(h->start,round) + myround2(h->width,round);
- if ( h->width<0 ) {
- AddNumber2(gb,cur-last,round);
- AddNumber2(gb,-myround2(h->width,round),round);
- cur -= myround2(h->width,round);
- } else if ( h->ghost ) {
- if ( h->width==20 ) {
- AddNumber2(gb,myround2(h->start,round)-last+20,round);
- AddNumber2(gb,-20,round);
- cur = myround2(h->start,round);
- } else {
- AddNumber2(gb,myround2(h->start+21,round)-last,round);
- AddNumber2(gb,-21,round);
- cur = myround2(h->start+21,round)-21;
- }
- } else {
- AddNumber2(gb,myround2(h->start,round)-last,round);
- AddNumber2(gb,myround2(h->width,round),round);
- }
- last = cur;
- h = h->next;
- ++cnt;
- }
- if ( oper!=-1 ) {
- if ( gb->pt+1>=gb->end )
- GrowBuffer(gb);
- *gb->pt++ = oper;
- }
-}
-
-static void DumpRefsHints(GrowBuf *gb, struct hintdb *hdb,RefChar *cur,StemInfo *h,StemInfo *v,
- BasePoint *trans, int round,int layer) {
- uint8 masks[12];
- int cnt, sets=0;
- StemInfo *rs;
-
- /* trans has already been rounded (whole char is translated by an integral amount) */
-
- /* If we have a subroutine containing conflicts, then its hints will match*/
- /* ours exactly, and we can use its hintmasks directly */
- if (( cur->sc->hconflicts || cur->sc->vconflicts ) &&
- cur->sc->layers[layer].splines!=NULL &&
- cur->sc->layers[layer].splines->first->hintmask!=NULL ) {
- AddMask2(gb,*cur->sc->layers[layer].splines->first->hintmask,hdb->cnt,19); /* hintmask */
- hdb->donefirsthm = true;
- memcpy(hdb->mask,*cur->sc->layers[layer].splines->first->hintmask,sizeof(HintMask));
-return;
- }
-
- if ( h==NULL && v==NULL )
- IError("hintmask invoked when there are no hints");
- memset(masks,'\0',sizeof(masks));
- cnt = 0;
- while ( h!=NULL && h->hintnumber>=0 ) {
- /* Horizontal stems are defined by vertical bounds */
- real pos = (round ? rint(h->start) : h->start) - trans->y;
- for ( rs = cur->sc->hstem; rs!=NULL; rs=rs->next ) {
- real rpos = round ? rint(rs->start) : rs->start;
- if ( rpos==pos && (round ? (rint(rs->width)==rint(h->width)) : (rs->width==h->width)) ) {
- masks[h->hintnumber>>3] |= 0x80>>(h->hintnumber&7);
- ++sets;
- break;
- } else if ( rpos>pos )
- break;
- }
- h = h->next; ++cnt;
- }
- while ( v!=NULL && v->hintnumber>=0 ) {
- real pos = (round ? rint(v->start) : v->start) - trans->x;
- for ( rs = cur->sc->vstem; rs!=NULL; rs=rs->next ) {
- real rpos = round ? rint(rs->start) : rs->start;
- if ( rpos==pos && (round ? (rint(rs->width)==rint(v->width)) : (rs->width==v->width)) ) {
- masks[v->hintnumber>>3] |= 0x80>>(v->hintnumber&7);
- ++sets;
- break;
- } else if ( rpos>pos )
- break;
- }
- v = v->next; ++cnt;
- }
- BreakSubroutine(gb,hdb);
- hdb->donefirsthm = true;
- /* if ( sets!=0 ) */ /* First ref will need a hintmask even if it has no hints (if there are conflicts) */
- AddMask2(gb,masks,cnt,19); /* hintmask */
-}
-
-static void DummyHintmask(GrowBuf *gb,struct hintdb *hdb) {
- HintMask hm;
-
- memset(hm,0,sizeof(hm));
- if ( hdb->cnt!=0 ) {
- BreakSubroutine(gb,hdb);
- hdb->donefirsthm = true;
- AddMask2(gb,hm,hdb->cnt,19); /* hintmask */
- }
-}
-
-static void SetTransformedHintMask(GrowBuf *gb,struct hintdb *hdb,
- SplineChar *sc, RefChar *ref, BasePoint *trans, int round) {
- HintMask hm;
-
- if ( HintMaskFromTransformedRef(ref,trans,sc,&hm)!=NULL ) {
- BreakSubroutine(gb,hdb);
- hdb->donefirsthm = true;
- AddMask2(gb,hm,hdb->cnt,19); /* hintmask */
- } else if ( !hdb->donefirsthm )
- DummyHintmask(gb,hdb);
-}
-
-static void ExpandRef2(GrowBuf *gb, SplineChar *sc, struct hintdb *hdb,
- RefChar *r, BasePoint *trans,
- struct pschars *subrs, int round,int layer) {
- BasePoint *bpt;
- BasePoint temp, rtrans;
- GlyphInfo *gi;
- /* The only refs I deal with here have no hint conflicts within them */
-
- rtrans.x = r->transform[4]+trans->x;
- rtrans.y = r->transform[5]+trans->y;
- if ( round ) {
- rtrans.x = rint(rtrans.x);
- rtrans.y = rint(rtrans.y);
- }
-
- BreakSubroutine(gb,hdb);
- if ( hdb->cnt>0 && !hdb->noconflicts )
- DumpRefsHints(gb,hdb,r,sc->hstem,sc->vstem,&rtrans,round,layer);
-
- /* Translate from end of last character to where this one should */
- /* start (we must have one moveto operator to start off, none */
- /* in the subr) */
- bpt = hdb->gi->psubrs[r->sc->lsidebearing].startstop;
- temp.x = bpt[0].x+rtrans.x;
- temp.y = bpt[0].y+rtrans.y;
- if ( hdb->current.x!=temp.x )
- AddNumber2(gb,temp.x-hdb->current.x,round);
- if ( hdb->current.y!=temp.y || hdb->current.x==temp.x )
- AddNumber2(gb,temp.y-hdb->current.y,round);
- if ( gb->pt+1>=gb->end )
- GrowBuffer(gb);
- *gb->pt++ = hdb->current.x==temp.x?4: /* vmoveto */
- hdb->current.y==temp.y?22: /* hmoveto */
- 21; /* rmoveto */
- if ( r->sc->lsidebearing==0x7fff )
- IError("Attempt to reference an unreferenceable glyph %s", r->sc->name );
-
- gi = hdb->gi;
- StartNextSubroutine(gb,hdb);
- gi->bits[gi->bcnt].psub_index = r->sc->lsidebearing;
- ++gi->bcnt;
- gi->justbroken = true;
- hdb->current.x = bpt[1].x+rtrans.x;
- hdb->current.y = bpt[1].y+rtrans.y;
-}
-
-static void RSC2PS2(GrowBuf *gb, SplineChar *base,SplineChar *rsc,
- struct hintdb *hdb, BasePoint *trans, struct pschars *subrs,
- int flags, int layer ) {
- BasePoint subtrans;
- int stationary = trans->x==0 && trans->y==0;
- RefChar *r, *unsafe=NULL;
- int unsafecnt=0, allwithouthints=true;
- int round = (flags&ps_flag_round)? true : false;
- StemInfo *oldh = NULL, *oldv = NULL;
- int hc = 0, vc = 0;
- SplineSet *freeme, *temp;
- int wasntconflicted = hdb->noconflicts;
-
- if ( flags&ps_flag_nohints ) {
- oldh = rsc->hstem; oldv = rsc->vstem;
- hc = rsc->hconflicts; vc = rsc->vconflicts;
- rsc->hstem = NULL; rsc->vstem = NULL;
- rsc->hconflicts = false; rsc->vconflicts = false;
- } else {
- for ( r=rsc->layers[layer].refs; r!=NULL; r=r->next ) {
- if ( !r->justtranslated )
- continue;
- if ( r->sc->hconflicts || r->sc->vconflicts ) {
- ++unsafecnt;
- unsafe = r;
- } else if ( r->sc->hstem!=NULL || r->sc->vstem!=NULL )
- allwithouthints = false;
- }
- if ( !stationary )
- allwithouthints = false;
- if ( allwithouthints && unsafe!=NULL && hdb->cnt!=NumberHints(&unsafe->sc,1))
- allwithouthints = false; /* There are other hints elsewhere in the base glyph */
- }
-
- if ( unsafe && allwithouthints ) {
- if ( unsafe->sc->lsidebearing!=0x7fff ) {
- ExpandRef2(gb,base,hdb,unsafe,trans,subrs,round,layer);
- } else if ( unsafe->transform[4]==0 && unsafe->transform[5]==0 )
- RSC2PS2(gb,base,unsafe->sc,hdb,trans,subrs,flags,layer);
- else
- unsafe = NULL;
- } else
- unsafe = NULL;
-
- /* What is the hintmask state here? It should not matter */
- freeme = NULL; temp = rsc->layers[layer].splines;
- if ( base!=rsc )
- temp = freeme = SPLCopyTranslatedHintMasks(temp,base,rsc,trans);
- CvtPsSplineSet2(gb,temp,hdb,rsc->layers[layer].order2,round);
- SplinePointListsFree(freeme);
-
- for ( r = rsc->layers[layer].refs; r!=NULL; r = r->next ) if ( r!=unsafe ) {
- if ( !r->justtranslated ) {
- if ( !r->sc->hconflicts && !r->sc->vconflicts && !hdb->noconflicts &&
- r->transform[1]==0 && r->transform[2]==0 &&
- r->transform[0]>0 && r->transform[3]>0 )
- SetTransformedHintMask(gb,hdb,base,r,trans,round);
- if ( !hdb->donefirsthm )
- DummyHintmask(gb,hdb);
- temp = SPLCopyTransformedHintMasks(r,base,trans,layer);
- CvtPsSplineSet2(gb,temp,hdb,rsc->layers[layer].order2,round);
- SplinePointListsFree(temp);
- } else if ( r->sc->lsidebearing!=0x7fff &&
- ((flags&ps_flag_nohints) ||
- (!r->sc->hconflicts && !r->sc->vconflicts)) ) {
- ExpandRef2(gb,base,hdb,r,trans,subrs,round,layer);
- } else {
- subtrans.x = trans->x + r->transform[4];
- subtrans.y = trans->y + r->transform[5];
- if ( !hdb->noconflicts && !r->sc->hconflicts && !r->sc->vconflicts) {
- SetTransformedHintMask(gb,hdb,base,r,trans,round);
- hdb->noconflicts = true;
- }
- RSC2PS2(gb,base,r->sc,hdb,&subtrans,subrs,flags,layer);
- hdb->noconflicts = wasntconflicted;
- }
- }
-
- if ( flags&ps_flag_nohints ) {
- rsc->hstem = oldh; rsc->vstem = oldv;
- rsc->hconflicts = hc; rsc->vconflicts = vc;
- }
-}
-
-static unsigned char *SplineChar2PS2(SplineChar *sc,int *len, int nomwid,
- int defwid, struct pschars *subrs, int flags,
- GlyphInfo *gi) {
- GrowBuf gb;
- unsigned char *ret;
- struct hintdb hdb;
- StemInfo *oldh = NULL, *oldv = NULL;
- int hc = 0, vc = 0;
- SplineChar *scs[MmMax];
- int round = (flags&ps_flag_round)? true : false;
- HintMask *hm = NULL;
- BasePoint trans;
-
- if ( !(flags&ps_flag_nohints) && SCNeedsSubsPts(sc,ff_otf,gi->layer))
- SCFigureHintMasks(sc,gi->layer);
-
- if ( flags&ps_flag_nohints ) {
- oldh = sc->hstem; oldv = sc->vstem;
- hc = sc->hconflicts; vc = sc->vconflicts;
- sc->hstem = NULL; sc->vstem = NULL;
- sc->hconflicts = false; sc->vconflicts = false;
- } else if ( sc->layers[gi->layer].splines!=NULL && !sc->vconflicts &&
- !sc->hconflicts ) {
- hm = sc->layers[gi->layer].splines->first->hintmask;
- sc->layers[gi->layer].splines->first->hintmask = NULL;
- }
-
- memset(&gb,'\0',sizeof(gb));
-
- GrowBuffer(&gb);
-
- /* store the width on the stack */
- if ( sc->width==defwid )
- /* Don't need to do anything for the width */;
- else
- AddNumber2(&gb,sc->width-nomwid,round);
-
- memset(&trans,'\0',sizeof(trans));
- memset(&hdb,'\0',sizeof(hdb));
- hdb.scs = scs;
- hdb.gi = gi;
- if ( gi!=NULL )
- gi->bcnt = -1;
- scs[0] = sc;
- hdb.noconflicts = !sc->hconflicts && !sc->vconflicts;
- hdb.cnt = NumberHints(hdb.scs,1);
- DumpHints(&gb,sc->hstem,sc->hconflicts || sc->vconflicts?18:1,
- sc->hconflicts || sc->vconflicts?18:1,round);
- DumpHints(&gb,sc->vstem,sc->hconflicts || sc->vconflicts?-1:3,
- sc->hconflicts || sc->vconflicts?23:3,round);
- CounterHints2(&gb, sc, hdb.cnt );
- RSC2PS2(&gb,sc,sc,&hdb,&trans,subrs,flags,gi->layer);
-
- if ( gi->bcnt==-1 ) { /* If it's whitespace */
- gi->bcnt = 0;
- StartNextSubroutine(&gb,&hdb);
- }
- BreakSubroutine(&gb,&hdb);
- MoveSubrsToChar(gi);
- ret = NULL;
-
- free(gb.base);
- if ( flags&ps_flag_nohints ) {
- sc->hstem = oldh; sc->vstem = oldv;
- sc->hconflicts = hc; sc->vconflicts = vc;
- } else if ( hm!=NULL )
- sc->layers[gi->layer].splines->first->hintmask = hm;
-return( ret );
-}
-
-static SplinePoint *FFLineTo(SplinePoint *last, int x, int y) {
- SplinePoint *sp = SplinePointCreate(x,y);
- SplineMake3(last,sp);
-return( sp );
-}
-
-static void Type2NotDefSplines(SplineFont *sf,SplineChar *sc,int layer) {
- /* I'd always assumed that Type2 notdefs would look like type1 notdefs */
- /* but they don't, they look like truetype notdefs. And Ralf Stubner */
- /* points out that the spec says they should. So make a box here */
- int stem, ymax;
- SplineSet *inner, *ss;
- StemInfo *h, *hints;
-
- stem = (sf->ascent+sf->descent)/20;
- ymax = 2*sf->ascent/3;
-
- ss = chunkalloc(sizeof(SplineSet));
- ss->first = ss->last = SplinePointCreate(stem,0);
- ss->last = FFLineTo(ss->last,stem,ymax);
- ss->last = FFLineTo(ss->last,sc->width-stem,ymax);
- ss->last = FFLineTo(ss->last,sc->width-stem,0);
- SplineMake3(ss->last,ss->first);
- ss->last = ss->first;
-
- ss->next = inner = chunkalloc(sizeof(SplineSet));
- inner->first = inner->last = SplinePointCreate(2*stem,stem);
- inner->last = FFLineTo(inner->last,sc->width-2*stem,stem);
- inner->last = FFLineTo(inner->last,sc->width-2*stem,ymax-stem);
- inner->last = FFLineTo(inner->last,2*stem,ymax-stem);
- SplineMake3(inner->last,inner->first);
- inner->last = inner->first;
-
- sc->layers[layer].splines = ss;
-
- hints = chunkalloc(sizeof(StemInfo));
- hints->start = stem;
- hints->width = stem;
- hints->next = h = chunkalloc(sizeof(StemInfo));
- h->start = sc->width-2*stem;
- h->width = stem;
- sc->vstem = hints;
-
- hints = chunkalloc(sizeof(StemInfo));
- hints->start = 0;
- hints->width = stem;
- hints->next = h = chunkalloc(sizeof(StemInfo));
- h->start = ymax-stem;
- h->width = stem;
- sc->hstem = hints;
-}
-
-/* Mark those glyphs which can live totally in subrs */
-static void SplineFont2FullSubrs2(int flags,GlyphInfo *gi) {
- int i;
- SplineChar *sc;
-
- for ( i=0; i<gi->glyphcnt; ++i ) if ( (sc=gi->gb[i].sc)!=NULL )
- sc->lsidebearing = 0x7fff;
-
-}
-
-struct pschars *SplineFont2ChrsSubrs2(SplineFont *sf, int nomwid, int defwid,
- const int *bygid, int cnt, int flags, struct pschars **_subrs, int layer) {
- struct pschars *subrs, *chrs;
- int i,j,k,scnt;
- SplineChar *sc;
- GlyphInfo gi;
- SplineChar dummynotdef;
-
- memset(&gi,0,sizeof(gi));
- memset(&gi.hashed,-1,sizeof(gi.hashed));
- gi.instance_count = 1;
- gi.sf = sf;
- gi.layer = layer;
- gi.glyphcnt = cnt;
- gi.bygid = bygid;
- gi.gb = gcalloc(cnt,sizeof(struct glyphbits));
- gi.pmax = 3*cnt;
- gi.psubrs = galloc(gi.pmax*sizeof(struct potentialsubrs));
- for ( i=0; i<cnt; ++i ) {
- int gid = bygid[i];
- if ( i==0 && gid==-1 ) {
- sc = &dummynotdef;
- memset(sc,0,sizeof(dummynotdef));
- dummynotdef.name = ".notdef";
- dummynotdef.parent = sf;
- dummynotdef.layer_cnt = sf->layer_cnt;
- dummynotdef.layers = gcalloc(sf->layer_cnt,sizeof(Layer));
- dummynotdef.width = SFOneWidth(sf);
- if ( dummynotdef.width==-1 )
- dummynotdef.width = (sf->ascent+sf->descent)/2;
- Type2NotDefSplines(sf,&dummynotdef,layer);
- } else if ( gid!=-1 )
- sc = sf->glyphs[gid];
- else
- continue;
- gi.gb[i].sc = sc;
- sc->lsidebearing = 0x7fff;
- }
- MarkTranslationRefs(sf,layer);
- SplineFont2FullSubrs2(flags,&gi);
-
- for ( i=0; i<cnt; ++i ) {
- if ( (sc = gi.gb[i].sc)==NULL )
- continue;
- gi.active = &gi.gb[i];
- SplineChar2PS2(sc,NULL,nomwid,defwid,NULL,flags,&gi);
- ff_progress_next();
- }
-
- for ( i=scnt=0; i<gi.pcnt; ++i ) {
- /* A subroutine call takes somewhere between 2 and 4 bytes itself. */
- /* and we must add a return statement to the end. We don't want to */
- /* make things bigger */
- /* if we have more than 65535 subrs a subr call can take 9 bytes */
- if ( gi.psubrs[i].full_glyph_index!=-1 )
- gi.psubrs[i].idx = scnt++;
- else if ( gi.psubrs[i].cnt*gi.psubrs[i].len>(gi.psubrs[i].cnt*4)+gi.psubrs[i].len+1 )
- gi.psubrs[i].idx = scnt++;
- else
- gi.psubrs[i].idx = -1;
- }
- subrs = gcalloc(1,sizeof(struct pschars));
- subrs->cnt = scnt;
- subrs->next = scnt;
- subrs->lens = galloc(scnt*sizeof(int));
- subrs->values = galloc(scnt*sizeof(unsigned char *));
- subrs->bias = scnt<1240 ? 107 :
- scnt<33900 ? 1131 : 32768;
- for ( i=0; i<gi.pcnt; ++i ) {
- if ( gi.psubrs[i].idx != -1 ) {
- scnt = gi.psubrs[i].idx;
- subrs->lens[scnt] = gi.psubrs[i].len+1;
- subrs->values[scnt] = galloc(subrs->lens[scnt]);
- memcpy(subrs->values[scnt],gi.psubrs[i].data,gi.psubrs[i].len);
- subrs->values[scnt][gi.psubrs[i].len] = 11; /* Add a return to end of subr */
- }
- }
-
- chrs = gcalloc(1,sizeof(struct pschars));
- chrs->cnt = cnt;
- chrs->next = cnt;
- chrs->lens = galloc(cnt*sizeof(int));
- chrs->values = galloc(cnt*sizeof(unsigned char *));
- chrs->keys = galloc(cnt*sizeof(char *));
- for ( i=0; i<cnt; ++i ) {
- int len=0;
- uint8 *vals;
- struct glyphbits *gb = &gi.gb[i];
- if ( gb->sc==NULL )
- continue;
- chrs->keys[i] = copy(gb->sc->name);
- for ( k=0; k<2; ++k ) if ( k!=0 || gb->sc->lsidebearing!=0x7fff ) {
- for ( j=0; j<gb->bcnt; ++j ) {
- if ( k!=0 || j!=0 )
- len += gb->bits[j].dlen;
- if ( k==1 && gb->sc->lsidebearing!=0x7fff ) {
- int si = gi.psubrs[ gb->sc->lsidebearing ].idx;
- len += 1 + (si<=107 && si>=-107?1:si<=1131 && si>=-1131?2:si>=-32768 && si<32767?3:8);
- break;
- }
- if ( gi.psubrs[ gb->bits[j].psub_index ].idx==-1 )
- len += gi.psubrs[ gb->bits[j].psub_index ].len;
- else {
- int si = gi.psubrs[ gb->bits[j].psub_index ].idx - subrs->bias;
- /* space for the number (subroutine index) */
- if ( si>=-107 && si<=107 )
- ++len;
- else if ( si>=-1131 && si<=1131 )
- len += 2;
- else if ( si>=-32768 && si<=32767 )
- len += 3;
- else
- len += 8;
- /* space for the subroutine operator */
- ++len;
- }
- }
- if ( k==0 ) {
- int si = gi.psubrs[ gb->sc->lsidebearing ].idx;
- subrs->lens[si] = len+1;
- vals = subrs->values[si] = galloc(len+2);
- } else {
- chrs->lens[i] = len+1;
- vals = chrs->values[i] = galloc(len+2); /* space for endchar and a final NUL (which is really meaningless, but makes me feel better) */
- }
-
- len = 0;
- for ( j=0; j<gb->bcnt; ++j ) {
- int si;
- if ( k!=0 || j!=0 ) {
- memcpy(vals+len,gb->bits[j].data,gb->bits[j].dlen);
- len += gb->bits[j].dlen;
- }
- si = 0x80000000;
- if ( k==1 && gb->sc->lsidebearing!=0x7fff )
- si = gi.psubrs[ gb->sc->lsidebearing ].idx - subrs->bias;
- else if ( gi.psubrs[ gb->bits[j].psub_index ].idx==-1 ) {
- memcpy(vals+len,gi.psubrs[ gb->bits[j].psub_index ].data,
- gi.psubrs[ gb->bits[j].psub_index ].len);
- len += gi.psubrs[ gb->bits[j].psub_index ].len;
- } else
- si = gi.psubrs[ gb->bits[j].psub_index ].idx - subrs->bias;
- if ( si!=0x80000000 ) {
- /* space for the number (subroutine index) */
- if ( si>=-107 && si<=107 )
- vals[len++] = si+139;
- else if ( si>0 && si<=1131 ) {
- si-=108;
- vals[len++] = (si>>8)+247;
- vals[len++] = si&0xff;
- } else if ( si>=-1131 && si<0 ) {
- si=(-si)-108;
- vals[len++] = (si>>8)+251;
- vals[len++] = si&0xff;
- } else if ( si>=-32768 && si<=32767 ) {
- vals[len++] = 28;
- vals[len++] = (si>>8)&0xff;
- vals[len++] = si&0xff;
- } else {
- /* store as fixed point, then multiply by 64. Takes 8 bytes */
- si *= (65536/64);
- vals[len++] = '\377';
- vals[len++] = (si>>24)&0xff;
- vals[len++] = (si>>16)&0xff;
- vals[len++] = (si>>8)&0xff;
- vals[len++] = si&0xff;
- vals[len++] = 64 + 139;
- vals[len++] = 0xc; vals[len++] = 0x18; /* Multiply */
- }
-
- /* space for the subroutine operator */
- vals[len++] = 10;
- }
- if ( k==1 && gb->sc->lsidebearing!=0x7fff )
- break;
- }
- if ( k==0 ) {
- vals[len++] = 11; /* return */
- vals[len] = '\0';
- } else {
- vals[len++] = 14; /* endchar */
- vals[len] = '\0';
- }
- }
- }
-
- GIFree(&gi,&dummynotdef);
- *_subrs = subrs;
-return( chrs );
-}
-
-struct pschars *CID2ChrsSubrs2(SplineFont *cidmaster,struct fd2data *fds,
- int flags, struct pschars **_glbls, int layer) {
- struct pschars *chrs, *glbls;
- int i, j, cnt, cid, max, fd;
- int *scnts;
- SplineChar *sc;
- SplineFont *sf = NULL;
- /* In a cid-keyed font, cid 0 is defined to be .notdef so there are no */
- /* special worries. If it is defined we use it. If it is not defined */
- /* we add it. */
- GlyphInfo gi;
- SplineChar dummynotdef;
-
- max = 0;
- for ( i=0; i<cidmaster->subfontcnt; ++i ) {
- if ( max<cidmaster->subfonts[i]->glyphcnt )
- max = cidmaster->subfonts[i]->glyphcnt;
- MarkTranslationRefs(cidmaster->subfonts[i],layer);
- }
- cnt = 1; /* for .notdef */
- for ( cid = 1; cid<max; ++cid ) {
- for ( i=0; i<cidmaster->subfontcnt; ++i ) {
- sf = cidmaster->subfonts[i];
- if ( cid<sf->glyphcnt && (sc=sf->glyphs[cid])!=NULL ) {
- sc->ttf_glyph = -1;
- sc->lsidebearing = 0x7fff;
- if ( SCWorthOutputting(sc))
- ++cnt;
- break;
- }
- }
- }
-
- memset(&gi,0,sizeof(gi));
- memset(&gi.hashed,-1,sizeof(gi.hashed));
- gi.instance_count = 1;
- gi.sf = sf;
- gi.glyphcnt = cnt;
- gi.bygid = NULL;
- gi.gb = gcalloc(cnt,sizeof(struct glyphbits));
- gi.pmax = 3*cnt;
- gi.psubrs = galloc(gi.pmax*sizeof(struct potentialsubrs));
- gi.layer = layer;
-
- for ( cid = cnt = 0; cid<max; ++cid ) {
- sf = NULL;
- for ( i=0; i<cidmaster->subfontcnt; ++i ) {
- sf = cidmaster->subfonts[i];
- if ( cid<sf->glyphcnt && SCWorthOutputting(sf->glyphs[cid]) )
- break;
- }
- if ( cid!=0 && i==cidmaster->subfontcnt ) {
- sc=NULL;
- } else if ( i==cidmaster->subfontcnt ) {
- /* They didn't define CID 0 */
- sc = &dummynotdef;
- /* Place it in the final subfont (which is what sf points to) */
- memset(sc,0,sizeof(dummynotdef));
- dummynotdef.name = ".notdef";
- dummynotdef.parent = sf;
- dummynotdef.layer_cnt = layer+1;
- dummynotdef.layers = gcalloc(layer+1,sizeof(Layer));
- dummynotdef.width = SFOneWidth(sf);
- if ( dummynotdef.width==-1 )
- dummynotdef.width = (sf->ascent+sf->descent);
- Type2NotDefSplines(sf,&dummynotdef,layer);
- gi.gb[cnt].sc = sc;
- gi.gb[cnt].fd = i = cidmaster->subfontcnt-1;
-#if 0 && HANYANG /* Too much stuff knows the glyph cnt, can't refigure it here at the end */
- } else if ( sf->glyphs[cid]->compositionunit ) {
- sc=NULL; /* don't output it, should be in a subroutine */;
-#endif
- } else {
- gi.gb[cnt].sc = sc = sf->glyphs[cid];
- gi.gb[cnt].fd = i;
- }
- if ( sc!=NULL ) {
- sc->lsidebearing = 0x7fff;
- gi.active = &gi.gb[cnt];
- sc->ttf_glyph = cnt++;
- SplineChar2PS2(sc,NULL,fds[i].nomwid,fds[i].defwid,NULL,flags,&gi);
- }
- ff_progress_next();
- }
-
- scnts = gcalloc( cidmaster->subfontcnt+1,sizeof(int));
- for ( i=0; i<gi.pcnt; ++i ) {
- gi.psubrs[i].idx = -1;
- if ( gi.psubrs[i].cnt*gi.psubrs[i].len>(gi.psubrs[i].cnt*4)+gi.psubrs[i].len+1 )
- gi.psubrs[i].idx = scnts[gi.psubrs[i].fd+1]++;
- }
-
- glbls = gcalloc(1,sizeof(struct pschars));
- glbls->cnt = scnts[0];
- glbls->next = scnts[0];
- glbls->lens = galloc(scnts[0]*sizeof(int));
- glbls->values = galloc(scnts[0]*sizeof(unsigned char *));
- glbls->bias = scnts[0]<1240 ? 107 :
- scnts[0]<33900 ? 1131 : 32768;
- for ( fd=0; fd<cidmaster->subfontcnt; ++fd ) {
- fds[fd].subrs = gcalloc(1,sizeof(struct pschars));
- fds[fd].subrs->cnt = scnts[fd+1];
- fds[fd].subrs->next = scnts[fd+1];
- fds[fd].subrs->lens = galloc(scnts[fd+1]*sizeof(int));
- fds[fd].subrs->values = galloc(scnts[fd+1]*sizeof(unsigned char *));
- fds[fd].subrs->bias = scnts[fd+1]<1240 ? 107 :
- scnts[fd+1]<33900 ? 1131 : 32768;
- }
- free( scnts);
-
- for ( i=0; i<gi.pcnt; ++i ) {
- if ( gi.psubrs[i].idx != -1 ) {
- struct pschars *subrs = gi.psubrs[i].fd==-1 ? glbls : fds[gi.psubrs[i].fd].subrs;
- int scnt = gi.psubrs[i].idx;
- subrs->lens[scnt] = gi.psubrs[i].len+1;
- subrs->values[scnt] = galloc(subrs->lens[scnt]);
- memcpy(subrs->values[scnt],gi.psubrs[i].data,gi.psubrs[i].len);
- subrs->values[scnt][gi.psubrs[i].len] = 11; /* Add a return to end of subr */
- }
- }
-
-
- chrs = gcalloc(1,sizeof(struct pschars));
- chrs->cnt = cnt;
- chrs->next = cnt;
- chrs->lens = galloc(cnt*sizeof(int));
- chrs->values = galloc(cnt*sizeof(unsigned char *));
- chrs->keys = galloc(cnt*sizeof(char *));
- for ( i=0; i<cnt; ++i ) {
- int len=0;
- struct glyphbits *gb = &gi.gb[i];
- chrs->keys[i] = copy(gb->sc->name);
- for ( j=0; j<gb->bcnt; ++j ) {
- len += gb->bits[j].dlen;
- if ( gi.psubrs[ gb->bits[j].psub_index ].idx==-1 )
- len += gi.psubrs[ gb->bits[j].psub_index ].len;
- else {
- struct pschars *subrs = gi.psubrs[gb->bits[j].psub_index].fd==-1 ? glbls : fds[gi.psubrs[gb->bits[j].psub_index].fd].subrs;
- int si = gi.psubrs[ gb->bits[j].psub_index ].idx - subrs->bias;
- /* space for the number (subroutine index) */
- if ( si>=-107 && si<=107 )
- ++len;
- else if ( si>=-1131 && si<=1131 )
- len += 2;
- else if ( si>=-32768 && si<=32767 )
- len += 3;
- else
- len += 8;
- /* space for the subroutine operator */
- ++len;
- }
- }
- chrs->lens[i] = len+1;
- chrs->values[i] = galloc(len+2); /* space for endchar and a final NUL (which is really meaningless, but makes me feel better) */
-
- len = 0;
- for ( j=0; j<gb->bcnt; ++j ) {
- memcpy(chrs->values[i]+len,gb->bits[j].data,gb->bits[j].dlen);
- len += gb->bits[j].dlen;
- if ( gi.psubrs[ gb->bits[j].psub_index ].idx==-1 ) {
- memcpy(chrs->values[i]+len,gi.psubrs[ gb->bits[j].psub_index ].data,
- gi.psubrs[ gb->bits[j].psub_index ].len);
- len += gi.psubrs[ gb->bits[j].psub_index ].len;
- } else {
- struct pschars *subrs = gi.psubrs[gb->bits[j].psub_index].fd==-1 ? glbls : fds[gi.psubrs[gb->bits[j].psub_index].fd].subrs;
- int si = gi.psubrs[ gb->bits[j].psub_index ].idx - subrs->bias;
- /* space for the number (subroutine index) */
- if ( si>=-107 && si<=107 )
- chrs->values[i][len++] = si+139;
- else if ( si>0 && si<=1131 ) {
- si-=108;
- chrs->values[i][len++] = (si>>8)+247;
- chrs->values[i][len++] = si&0xff;
- } else if ( si>=-1131 && si<0 ) {
- si=(-si)-108;
- chrs->values[i][len++] = (si>>8)+251;
- chrs->values[i][len++] = si&0xff;
- } else if ( si>=-32768 && si<=32767 ) {
- chrs->values[i][len++] = 28;
- chrs->values[i][len++] = (si>>8)&0xff;
- chrs->values[i][len++] = si&0xff;
- } else {
- /* store as fixed point, then multiply by 64. Takes 8 bytes */
- si *= (65536/64);
- chrs->values[i][len++] = '\377';
- chrs->values[i][len++] = (si>>24)&0xff;
- chrs->values[i][len++] = (si>>16)&0xff;
- chrs->values[i][len++] = (si>>8)&0xff;
- chrs->values[i][len++] = si&0xff;
- chrs->values[i][len++] = 64 + 139;
- chrs->values[i][len++] = 0xc; chrs->values[i][len++] = 0x18; /* Multiply */
- }
- /* space for the subroutine operator */
- if ( gi.psubrs[ gb->bits[j].psub_index ].fd==-1 ) {
- chrs->values[i][len++] = 29;
- } else
- chrs->values[i][len++] = 10;
- }
- }
- chrs->values[i][len++] = 14; /* endchar */
- chrs->values[i][len] = '\0';
- }
- GIFree(&gi,&dummynotdef);
- *_glbls = glbls;
-return( chrs );
-}
-
diff --git a/Build/source/texk/web2c/luatexdir/luafontloader/fontforge/fontforge/splinesaveafm.c b/Build/source/texk/web2c/luatexdir/luafontloader/fontforge/fontforge/splinesaveafm.c
deleted file mode 100644
index 781e9e26f09..00000000000
--- a/Build/source/texk/web2c/luatexdir/luafontloader/fontforge/fontforge/splinesaveafm.c
+++ /dev/null
@@ -1,261 +0,0 @@
-/* Copyright (C) 2000-2008 by George Williams */
-/*
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are met:
-
- * Redistributions of source code must retain the above copyright notice, this
- * list of conditions and the following disclaimer.
-
- * Redistributions in binary form must reproduce the above copyright notice,
- * this list of conditions and the following disclaimer in the documentation
- * and/or other materials provided with the distribution.
-
- * The name of the author may not be used to endorse or promote products
- * derived from this software without specific prior written permission.
-
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
- * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
- * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
- * EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
- * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
- * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
- * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
- * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-#include "fontforgevw.h" /* For Error */
-#include <stdio.h>
-#include "splinefont.h"
-#include <utype.h>
-#include <ustring.h>
-#include <time.h>
-#include <math.h>
-
-#include <sys/types.h> /* For stat */
-#include <sys/stat.h>
-#include <unistd.h>
-
-#ifdef __CygWin
- #include <sys/types.h>
- #include <sys/stat.h>
- #include <unistd.h>
-#endif
-
-static void *mygets(FILE *file,char *buffer,int size) {
- char *end = buffer+size-1;
- char *pt = buffer;
- int ch;
-
- while ( (ch=getc(file))!=EOF && ch!='\r' && ch!='\n' && pt<end )
- *pt++ = ch;
- *pt = '\0';
- if ( ch==EOF && pt==buffer )
-return( NULL );
- if ( ch=='\r' ) {
- ch = getc(file);
- if ( ch!='\n' )
- ungetc(ch,file);
- }
-return( buffer );
-}
-
-/* ************************************************************************** */
-/* **************************** Reading AFM files *************************** */
-/* ************************************************************************** */
-static void KPInsert( SplineChar *sc1, SplineChar *sc2, int off, int isv ) {
- KernPair *kp;
- int32 script;
-
- if ( sc1!=NULL && sc2!=NULL ) {
- for ( kp=sc1->kerns; kp!=NULL && kp->sc!=sc2; kp = kp->next );
- if ( kp!=NULL )
- kp->off = off;
- else if ( off!=0 ) {
- kp = chunkalloc(sizeof(KernPair));
- kp->sc = sc2;
- kp->off = off;
- script = SCScriptFromUnicode(sc1);
- if ( script==DEFAULT_SCRIPT )
- script = SCScriptFromUnicode(sc2);
- kp->subtable = SFSubTableFindOrMake(sc1->parent,
- isv?CHR('v','k','r','n'):CHR('k','e','r','n'),
- script, gpos_pair);
- if ( isv ) {
- kp->next = sc1->vkerns;
- sc1->vkerns = kp;
- } else {
- kp->next = sc1->kerns;
- sc1->kerns = kp;
- }
- }
- }
-}
-
-int LoadKerningDataFromAfm(SplineFont *sf, char *filename,EncMap *map) {
- FILE *file = fopen(filename,"r");
- char buffer[200], *pt, *ept, ch;
- SplineChar *sc1, *sc2;
- int off;
- char name[44], second[44], lig[44], buf2[100];
- PST *liga;
- double scale = (sf->ascent+sf->descent)/1000.0;
-
- if ( file==NULL )
-return( 0 );
- ff_progress_change_line2(_("Reading AFM file"));
- while ( mygets(file,buffer,sizeof(buffer))!=NULL ) {
- if ( strncmp(buffer,"KPX",3)==0 || strncmp(buffer,"KPY",3)==0 ) {
- int isv = strncmp(buffer,"KPY",3)==0;
- for ( pt=buffer+3; isspace(*pt); ++pt);
- for ( ept = pt; *ept!='\0' && !isspace(*ept); ++ept );
- ch = *ept; *ept = '\0';
- sc1 = SFGetChar(sf,-1,pt);
- *ept = ch;
- for ( pt=ept; isspace(*pt); ++pt);
- for ( ept = pt; *ept!='\0' && !isspace(*ept); ++ept );
- ch = *ept; *ept = '\0';
- sc2 = SFGetChar(sf,-1,pt);
- *ept = ch;
- off = strtol(ept,NULL,10);
- KPInsert(sc1,sc2,rint(off*scale),isv);
- } else if ( buffer[0]=='C' && isspace(buffer[1])) {
- char *pt;
- sc2 = NULL;
- for ( pt= strchr(buffer,';'); pt!=NULL; pt=strchr(pt+1,';') ) {
- if ( sscanf( pt, "; N %40s", name )==1 )
- sc2 = SFGetChar(sf,-1,name);
- else if ( sc2!=NULL &&
- sscanf( pt, "; L %40s %40s", second, lig)==2 ) {
- sc1 = SFGetChar(sf,-1,lig);
- if ( sc1!=NULL ) {
- sprintf( buf2, "%s %s", name, second);
- for ( liga=sc1->possub; liga!=NULL; liga=liga->next ) {
- if ( liga->type == pst_ligature && strcmp(liga->u.lig.components,buf2)==0 )
- break;
- }
- if ( liga==NULL ) {
- liga = chunkalloc(sizeof(PST));
- liga->subtable = SFSubTableFindOrMake(sf,
- CHR('l','i','g','a'),SCScriptFromUnicode(sc2),
- gsub_ligature);
- liga->subtable->lookup->store_in_afm = true;
- liga->type = pst_ligature;
- liga->next = sc1->possub;
- sc1->possub = liga;
- liga->u.lig.lig = sc1;
- liga->u.lig.components = copy( buf2 );
- }
- }
- }
- }
- }
- }
- fclose(file);
-return( 1 );
-}
-
-static void CheckMMAfmFile(SplineFont *sf,char *amfm_filename,char *fontname,EncMap *map) {
- /* the afm file should be in the same directory as the amfm file */
- /* with the fontname as the filename */
- char *temp, *pt;
-
- free(sf->fontname);
- sf->fontname = copy(fontname);
-
- temp = galloc(strlen(amfm_filename)+strlen(fontname)+strlen(".afm")+1);
- strcpy(temp, amfm_filename);
- pt = strrchr(temp,'/');
- if ( pt==NULL ) pt = temp;
- else ++pt;
- strcpy(pt,fontname);
- pt += strlen(pt);
- strcpy(pt,".afm");
- if ( !LoadKerningDataFromAfm(sf,temp,map) ) {
- strcpy(pt,".AFM");
- LoadKerningDataFromAfm(sf,temp,map);
- }
- free(temp);
-}
-
-int LoadKerningDataFromAmfm(SplineFont *sf, char *filename,EncMap *map) {
- FILE *file=NULL;
- char buffer[280], *pt, lastname[257];
- int index, i;
- MMSet *mm = sf->mm;
-
- if ( mm!=NULL )
- file = fopen(filename,"r");
- pt = strstrmatch(filename,".amfm");
- if ( pt!=NULL ) {
- char *afmname = copy(filename);
- strcpy(afmname+(pt-filename),isupper(pt[1])?".AFM":".afm");
- LoadKerningDataFromAfm(mm->normal,afmname,map);
- free(afmname);
- }
- if ( file==NULL )
-return( 0 );
-
- ff_progress_change_line2(_("Reading AFM file"));
- while ( fgets(buffer,sizeof(buffer),file)!=NULL ) {
- if ( strstrmatch(buffer,"StartMaster")!=NULL )
- break;
- }
- index = -1; lastname[0] = '\0';
- while ( fgets(buffer,sizeof(buffer),file)!=NULL ) {
- if ( strstrmatch(buffer,"EndMaster")!=NULL ) {
- if ( lastname[0]!='\0' && index!=-1 && index<mm->instance_count )
- CheckMMAfmFile(mm->instances[index],filename,lastname,map);
- index = -1; lastname[0] = '\0';
- } else if ( sscanf(buffer,"FontName %256s", lastname )== 1 ) {
- /* Do Nothing, all done */
- } else if ( (pt = strstr(buffer,"WeightVector"))!=NULL ) {
- pt += strlen("WeightVector");
- while ( *pt==' ' || *pt=='[' ) ++pt;
- i = 0;
- while ( *pt!=']' && *pt!='\0' ) {
- if ( *pt=='0' )
- ++i;
- else if ( *pt=='1' ) {
- index = i;
- break;
- }
- ++pt;
- }
- }
- }
- fclose(file);
-return( true );
-}
-
-int CheckAfmOfPostscript(SplineFont *sf, const char *psname, EncMap *map) {
- char *new, *pt;
- int ret;
- int wasuc=false;
-
- new = galloc(strlen(psname)+6);
- strcpy(new,psname);
- pt = strrchr(new,'.');
- if ( pt==NULL ) pt = new+strlen(new);
- else wasuc = isupper(pt[1]);
-
- if ( sf->mm!=NULL ) {
- strcpy(pt,wasuc?".AMFM":".amfm");
- if ( !LoadKerningDataFromAmfm(sf,new,map)) {
- strcpy(pt,wasuc?".amfm":".AMFM");
- ret = LoadKerningDataFromAmfm(sf,new,map);
- } else
- ret = true;
- /* The above routine reads from the afm file if one exist */
- } else {
- strcpy(pt,wasuc?".AFM":".afm");
- if ( !LoadKerningDataFromAfm(sf,new,map)) {
- strcpy(pt,wasuc?".afm":".AFM");
- ret = LoadKerningDataFromAfm(sf,new,map);
- } else
- ret = true;
- }
- free(new);
-return( ret );
-}
-
diff --git a/Build/source/texk/web2c/luatexdir/luafontloader/fontforge/fontforge/splinestroke.c b/Build/source/texk/web2c/luatexdir/luafontloader/fontforge/fontforge/splinestroke.c
deleted file mode 100644
index 6d9e7fc86c3..00000000000
--- a/Build/source/texk/web2c/luatexdir/luafontloader/fontforge/fontforge/splinestroke.c
+++ /dev/null
@@ -1,1874 +0,0 @@
-/* Copyright (C) 2000-2008 by George Williams */
-/*
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are met:
-
- * Redistributions of source code must retain the above copyright notice, this
- * list of conditions and the following disclaimer.
-
- * Redistributions in binary form must reproduce the above copyright notice,
- * this list of conditions and the following disclaimer in the documentation
- * and/or other materials provided with the distribution.
-
- * The name of the author may not be used to endorse or promote products
- * derived from this software without specific prior written permission.
-
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
- * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
- * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
- * EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
- * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
- * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
- * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
- * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-#include "pfaedit.h"
-#include "splinefont.h"
-#include <math.h>
-
-#define PI 3.1415926535897932
-
-typedef struct joininfo {
- SplinePoint *from, *to;
- real tprev;
- real tnext;
- BasePoint inter;
-} JointPoint;
-
-
-static real SplineAngle(Spline *spline,real t) {
- Spline1D *xsp = &spline->splines[0], *ysp = &spline->splines[1];
- real xslope = (3*xsp->a*t+2*xsp->b)*t + xsp->c;
- real yslope = (3*ysp->a*t+2*ysp->b)*t + ysp->c;
-
- if ( xslope==0 && yslope==0 ) {
- real faket = (t>.5) ? t-.01 : t+.01;
- xslope = (3*xsp->a*faket+2*xsp->b)*faket + xsp->c;
- yslope = (3*ysp->a*faket+2*ysp->b)*faket + ysp->c;
- }
- if ( spline->knownlinear || ( xslope==0 && yslope==0 )) {
- xslope = spline->to->me.x-spline->from->me.x;
- yslope = spline->to->me.y-spline->from->me.y;
- }
-return( atan2(yslope,xslope) );
-}
-
-static int PenCorner(double lineangle,StrokeInfo *si) {
-
- if ( ( lineangle>=si->penangle && lineangle<=si->penangle+PI/2 ) ||
- ( lineangle+2*PI>=si->penangle && lineangle+2*PI<=si->penangle+PI/2 ) ||
- ( lineangle-2*PI>=si->penangle && lineangle-2*PI<=si->penangle+PI/2 ) ) {
-return( 0 );
- } else if ( ( lineangle>=si->penangle+PI/2 && lineangle<=si->penangle+PI ) ||
- ( lineangle+2*PI>=si->penangle+PI/2 && lineangle+2*PI<=si->penangle+PI ) ||
- ( lineangle-2*PI>=si->penangle+PI/2 && lineangle-2*PI<=si->penangle+PI ) ) {
-return( 1 );
- } else if ( ( lineangle>=si->penangle+PI && lineangle<=si->penangle+3*PI/2 ) ||
- ( lineangle+2*PI>=si->penangle+PI && lineangle+2*PI<=si->penangle+3*PI/2 ) ||
- ( lineangle-2*PI>=si->penangle+PI && lineangle-2*PI<=si->penangle+3*PI/2 ) ) {
-return( 2 );
- } else {
-return( 3 );
- }
-}
-
-/* the plus point is where we go when we rotate the line's direction by +90degrees */
-/* and then move radius in that direction. minus is when we rotate -90 and */
-/* then move */ /* counter-clockwise */
-static double SplineExpand(Spline *spline,real t,real toff, StrokeInfo *si,
- BasePoint *plus, BasePoint *minus) {
- Spline1D *xsp = &spline->splines[0], *ysp = &spline->splines[1];
- BasePoint base;
- double lineangle, c,s, factor = 1.0;
-
- if ( si->factor!=NULL )
- factor = (si->factor)(si->data,spline,t);
-
- base.x = ((xsp->a*t+xsp->b)*t+xsp->c)*t + xsp->d;
- base.y = ((ysp->a*t+ysp->b)*t+ysp->c)*t + ysp->d;
-
- lineangle = SplineAngle(spline,t+toff);
- if ( si->stroke_type != si_caligraphic ) {
- c = si->radius*factor*cos(lineangle+PI/2);
- s = si->radius*factor*sin(lineangle+PI/2);
- plus->y = base.y+s;
- plus->x = base.x+c;
- minus->y = base.y-s;
- minus->x = base.x-c;
- } else {
- int corner = PenCorner(lineangle,si);
- plus->x = base.x + factor*si->xoff[corner];
- plus->y = base.y + factor*si->yoff[corner];
- corner += 2;
- minus->x = base.x + factor*si->xoff[corner];
- minus->y = base.y + factor*si->yoff[corner];
- }
-return( lineangle );
-}
-
-static SplinePoint *makequartercircle(real x, real y, real radius,
- real xmul, real ymul,SplinePoint *prev) {
- SplinePoint *here = SplinePointCreate(x,y);
-
- if ( xmul==0 ) {
- here->nextcp.x = here->prevcp.x = x;
- here->nextcp.y = y + .552*ymul*radius;
- here->prevcp.y = y - .552*ymul*radius;
- } else {
- here->nextcp.y = here->prevcp.y = y;
- here->nextcp.x = x + .552*xmul*radius;
- here->prevcp.x = x - .552*xmul*radius;
- }
- here->nonextcp = here->noprevcp = false;
- if ( prev!=NULL )
- SplineMake3(prev,here);
-return( here );
-}
-
-static SplinePoint *makeline(SplinePoint *prev, real x, real y) {
- SplinePoint *here = SplinePointCreate(x,y);
- here->pointtype = pt_corner;
- if ( prev!=NULL )
- SplineMake3(prev,here);
-return( here );
-}
-
-static void SinglePointStroke(SplinePoint *base, StrokeInfo *si, SplinePoint **_plus, SplinePoint **_minus) {
- SplinePoint *plus, *cur;
-
- /* A single point, is kind of dull.
- For a caligraphic pen, it's just a copy of the pen
- For a linecap of lc_butt it's still a point
- For a linecap of lc_round it's a circle
- For a linecap of lc_square it should be a square...
- but how does one orient that square? probably a circle is best
- here too
- */
- /* We don't have a spline, so don't try guessing factor */
- if ( si->stroke_type == si_caligraphic ) {
- plus = SplinePointCreate(base->me.x+si->xoff[0],base->me.y+si->yoff[0]);
- plus->pointtype = pt_corner;
- cur = makeline(plus,base->me.x+si->xoff[1],base->me.y+si->yoff[1]);
- cur = makeline(cur,base->me.x+si->xoff[2],base->me.y+si->yoff[2]);
- cur = makeline(cur,base->me.x+si->xoff[3],base->me.y+si->yoff[3]);
- SplineMake3(cur,plus);
- *_plus = *_minus = plus;
- } else if ( si->cap!=lc_butt ) {
- plus = makequartercircle(base->me.x-si->radius,base->me.y,si->radius,0,1,NULL);
- cur = makequartercircle(base->me.x,base->me.y+si->radius,si->radius,1,0,plus);
- cur = makequartercircle(base->me.x+si->radius,base->me.y,si->radius,0,-1,cur);
- cur = makequartercircle(base->me.x,base->me.y-si->radius,si->radius,-1,0,cur);
- SplineMake3(cur,plus);
- *_plus = *_minus = plus;
- } else {
- *_plus = *_minus = cur = chunkalloc(sizeof(SplinePoint));
- *cur = *base;
- cur->next = cur->prev = NULL;
- cur->hintmask = NULL;
- }
-}
-
-static SplinePoint *StrokeEnd(SplinePoint *base, StrokeInfo *si, int isstart,
- SplinePoint **_to) {
- BasePoint junk;
- SplinePoint *mid1, *mid2, *cur, *from, *to;
- real len;
- real c,s;
- real angle;
- real sign;
- real factor = si->factor==NULL ? 1.0 :
- base->next!=NULL ? (si->factor)(si->data,base->next,0) :
- base->prev!=NULL ? (si->factor)(si->data,base->prev,1) :
- 1.0;
-
- from = chunkalloc(sizeof(SplinePoint));
- to = chunkalloc(sizeof(SplinePoint));
- from->nonextcp = to->nonextcp = from->noprevcp = to->noprevcp = true;
- from->pointtype = pt_corner; to->pointtype = pt_corner;
-
- if ( isstart )
- angle = SplineExpand(base->next,0,0,si,&from->me,&to->me)+ PI;
- else
- angle = SplineExpand(base->prev,1,0,si,&to->me,&from->me);
-
- if ( (len = to->me.x-from->me.x)<0 )
- len = -len;
- len += ( to->me.y > from->me.y ) ? (to->me.y - from->me.y) : (from->me.y - to->me.y);
-
- if ( si->stroke_type == si_caligraphic ) {
- int corner;
- corner = PenCorner(angle,si);
- cur = makeline(from,base->me.x+factor*si->xoff[corner+1],base->me.y+factor*si->yoff[corner+1]);
- SplineMake3(cur,to);
- } else {
- if ( isstart ) {
- SplineIsLinearMake(base->next);
- angle = SplineExpand(base->next,0,0,si,&junk,&junk)+ PI;
- sign = -1;
- } else {
- SplineIsLinearMake(base->prev);
- angle = SplineExpand(base->prev,1,0,si,&junk,&junk);
- sign = -1;
- }
- if ( si->cap==lc_butt ) {
- SplineMake3(from,to); /* draw a line between */
- } else if ( si->cap==lc_square ) {
- mid1 = SplinePointCreate(
- from->me.x+ sign*(from->me.y-base->me.y),
- from->me.y- sign*(from->me.x-base->me.x));
- mid2 = SplinePointCreate(
- to->me.x+ sign*(from->me.y-base->me.y),
- to->me.y- sign*(from->me.x-base->me.x));
- mid1->pointtype = pt_corner; mid2->pointtype = pt_corner;
- SplineMake3(from,mid1);
- SplineMake3(mid1,mid2);
- SplineMake3(mid2,to);
- } else if ( si->cap==lc_round ) {
- mid1 = chunkalloc(sizeof(SplinePoint));
- mid1->me.x = base->me.x+ sign*(from->me.y-base->me.y);
- mid1->me.y = base->me.y- sign*(from->me.x-base->me.x);
- mid1->pointtype = pt_curve;
- c = .552*si->radius*factor*cos(angle);
- s = .552*si->radius*factor*sin(angle);
- from->nextcp.x = from->me.x + c;
- from->nextcp.y = from->me.y + s;
- from->nonextcp = false;
- to->prevcp.x = to->me.x +c;
- to->prevcp.y = to->me.y +s;
- to->noprevcp = false;
- mid1->prevcp.x = mid1->me.x - sign*s;
- mid1->prevcp.y = mid1->me.y + sign*c;
- mid1->nextcp.x = mid1->me.x + sign*s;
- mid1->nextcp.y = mid1->me.y - sign*c;
- SplineMake3(from,mid1);
- SplineMake3(mid1,to);
- }
- }
- SplinePointCatagorize(to);
- SplinePointCatagorize(from);
- *_to = to;
-return( from );
-}
-
-/* Is this the inner intersection or the outer one (the inner one is on both splines) */
-/* the outer one is beyond both */
-static int Intersect_Lines(BasePoint *inter,BasePoint *p1,real sx1, real sy1,
- BasePoint *p2, real sx2, real sy2, real radius) {
- real t1/*,t2*/;
- real denom;
-
- denom = (sx1*sy2-sx2*sy1);
- if ( denom>-.0001 && denom<.0001 ) {
- /* Lines are parallel. Might be coincident, might not */
- t1 = 10000;
- } else {
- /* t2 = (sy1*(p2->x-p1->x)-sx1*(p2->y-p1->y))/denom;*/
- t1 = (sy2*(p2->x-p1->x)-sx2*(p2->y-p1->y))/denom;
- }
- if ( t1>1000 || t1<-1000 ) {
- denom = sqrt(sx1*sx1 + sy1*sy1)/radius;
- if ( denom==0 ) {
- inter->x = (p1->x+p2->x)/2;
- inter->y = (p1->y+p2->y)/2;
- } else {
- inter->x = (p1->x+p2->x)/2 + sx1/denom;
- inter->y = (p1->y+p2->y)/2 + sy1/denom;
- }
-return( -1 );
- } else {
- inter->x = p1->x + t1*sx1;
- inter->y = p1->y + t1*sy1;
-return( t1<=0 ); /* if t1 < 0 then the intersection point is actually */
- /* on both of the spline segments. if it isn't then */
- /* it will be on the continuation of the spline */
- /* but beyond its endpoint... */
- }
-}
-
-static double CircleCpDist(double angle) {
- /* To draw an arc of length angle on a unit circle, the control points */
- /* should be this far from their base points. Determined empirically, */
- /* fit by least squares */
-
- if ( angle<0 ) angle = -angle;
- while ( angle>2*PI ) angle -= 2*PI;
- if ( angle>PI ) angle = 2*PI-angle;
-return( ((0.0115445*angle - 0.0111987)*angle + 0.357114)*angle );
-}
-
-static SplinePoint *ChordMid(double angle,BasePoint *center,BasePoint *from,
- double *_cpratio) {
- BasePoint off, new;
- double s,c,cpratio;
- SplinePoint *sp;
-
- if ( angle<0 ) angle = -angle;
- while ( angle>2*PI ) angle -= 2*PI;
- if ( angle>PI ) angle = 2*PI-angle;
- angle /= 2;
-
- off.x = from->x-center->x;
- off.y = from->y-center->y;
- s = sin(angle); c = cos(angle);
- new.x = c*off.x - s*off.y;
- new.y = s*off.x + c*off.y;
- sp = SplinePointCreate(new.x+center->x,new.y+center->y);
-
- *_cpratio = cpratio = CircleCpDist(angle);
- new.x *= cpratio; new.y *= cpratio; /* new is a vector of length radius pointing perp to the direction of the cps */
- /* We need to multiply by cp ratio and rotate 90 degrees */
- sp->prevcp.x = sp->me.x + new.y;
- sp->prevcp.y = sp->me.y - new.x;
- sp->nextcp.x = sp->me.x - new.y;
- sp->nextcp.y = sp->me.y + new.x;
- sp->nonextcp = sp->noprevcp = false;
-return( sp );
-}
-
-static int IntersectionTooFar(BasePoint *inter,SplinePoint *from,SplinePoint *to,StrokeInfo *si) {
- /* Things look really ugly when we try to miter acute angles -- we get */
- /* huge spikes. So if mitering is going to give bad results, just bevel */
- double len, xoff, yoff;
-
- xoff = inter->x-from->me.x; yoff = inter->y-from->me.y;
- len = xoff*xoff + yoff*yoff;
- if ( len > (5*si->radius * 5*si->radius) )
-return( true );
-
- xoff = inter->x-to->me.x; yoff = inter->y-to->me.y;
- len = xoff*xoff + yoff*yoff;
- if ( len > (5*si->radius * 5*si->radius) )
-return( true );
-
-return( false );
-}
-
-static void MakeJoints(SplinePoint *from,SplinePoint *to,StrokeInfo *si,
- BasePoint *inter, BasePoint *center,
- int incr,double pangle, double nangle, real factor) {
- SplinePoint *mid;
- int cstart, cend, i;
-
- if ( si->stroke_type == si_caligraphic ) {
- cstart = PenCorner(pangle,si);
- cend = PenCorner(nangle,si);
- if ( cstart==cend ) {
- /* same as a miter join */
- mid = SplinePointCreate(inter->x,inter->y);
- mid->pointtype = pt_corner;
- SplineMake3(from,mid);
- SplineMake3(mid,to);
- } else {
- if ( incr<0 ) {
- if ((cstart += 2)>=4 ) cstart -= 4;
- if ((cend += 2)>=4 ) cend -= 4;
- incr = 1; /* Why??? */
- }
- if ( incr>0 && cstart>cend )
- cend += 4;
- else if ( incr<0 && cstart<cend )
- cstart += 4;
- i = cstart + incr; /* First one is from */
- mid = from;
- while ( i!=cend ) {
- mid = makeline(mid,center->x+factor*si->xoff[i],center->y+factor*si->yoff[i]);
- i += incr;
- }
- SplineMake3(mid,to);
- }
- } else if ( si->join == lj_miter && !IntersectionTooFar(inter,from,to,si)) {
- mid = SplinePointCreate(inter->x,inter->y);
- mid->pointtype = pt_corner;
- SplineMake3(from,mid);
- SplineMake3(mid,to);
- if ( from->ptindex == to->ptindex )
- mid->ptindex = from->ptindex;
- } else if ( si->join==lj_bevel ) {
- SplineMake3(from,to);
- } else {
- double cplen = CircleCpDist(nangle-pangle);
- mid = NULL;
- if ( cplen>.6 ) {
- /* If angle of the arc is more than about 90 degrees a cubic */
- /* spline is noticeably different from a circle's arc */
- /* So add an extra point to help things out */
- mid = ChordMid(nangle-pangle,center,&from->me,&cplen);
- }
- cplen *= si->radius*factor;
- from->pointtype = to->pointtype = pt_curve;
- from->nextcp.x = from->me.x-cplen*cos(nangle);
- from->nextcp.y = from->me.y-cplen*sin(nangle);
- to->prevcp.x = to->me.x+cplen*cos(pangle);
- to->prevcp.y = to->me.y+cplen*sin(pangle);
- from->nonextcp = false; to->noprevcp = false;
- if ( mid==NULL )
- SplineMake3(from,to);
- else {
- SplineMake3(from,mid);
- SplineMake3(mid,to);
- }
- }
-}
-
-static int OnEdge(BasePoint *plus,BasePoint *minus,Spline *sp, double t,
- double heret, Spline *hsp,
- StrokeInfo *si, double *_ppt, double *_pmt, double *_mpt, double *_mmt) {
- double rsq = si->radius*si->radius;
- double tt, xdiff, ydiff, loopdiff;
- double pptval= -1, pmtval= -1, mptval= -1, mmtval = -1;
- BasePoint here, test;
-
- here.x = ((hsp->splines[0].a*heret+hsp->splines[0].b)*heret+hsp->splines[0].c)*heret+hsp->splines[0].d;
- here.y = ((hsp->splines[1].a*heret+hsp->splines[1].b)*heret+hsp->splines[1].c)*heret+hsp->splines[1].d;
-
- if ( (xdiff = sp->to->me.x-sp->from->me.x)<0 ) xdiff = -xdiff;
- if ( (ydiff = sp->to->me.y-sp->from->me.y)<0 ) ydiff = -ydiff;
- loopdiff = (xdiff+ydiff==0) ? 2 : 1.0/(4*(xdiff+ydiff)/si->radius);
-
- if ( _ppt!=NULL ) {
- for ( tt = t+loopdiff; tt<=1 ; tt += loopdiff ) {
- test.x = ((sp->splines[0].a*tt+sp->splines[0].b)*tt+sp->splines[0].c)*tt+sp->splines[0].d;
- test.y = ((sp->splines[1].a*tt+sp->splines[1].b)*tt+sp->splines[1].c)*tt+sp->splines[1].d;
- if ( (test.x-here.x)*(test.x-here.x)+(test.y-here.y)*(test.y-here.y)> 2*rsq )
- break;
- if ( (plus->x-test.x)*(plus->x-test.x)+(plus->y-test.y)*(plus->y-test.y)<= rsq )
- pptval = tt;
- if ( (minus->x-test.x)*(minus->x-test.x)+(minus->y-test.y)*(minus->y-test.y)<= rsq )
- pmtval = tt;
- }
- *_ppt = pptval; *_pmt = pmtval;
- }
-
- if ( _mmt!=NULL ) {
- for ( tt = t-loopdiff; tt>=0 ; tt -= loopdiff ) {
- test.x = ((sp->splines[0].a*tt+sp->splines[0].b)*tt+sp->splines[0].c)*tt+sp->splines[0].d;
- test.y = ((sp->splines[1].a*tt+sp->splines[1].b)*tt+sp->splines[1].c)*tt+sp->splines[1].d;
- if ( (test.x-here.x)*(test.x-here.x)+(test.y-here.y)*(test.y-here.y)> 2*rsq )
- break;
- if ( (plus->x-test.x)*(plus->x-test.x)+(plus->y-test.y)*(plus->y-test.y)< rsq )
- mptval = tt;
- if ( (minus->x-test.x)*(minus->x-test.x)+(minus->y-test.y)*(minus->y-test.y)< rsq )
- mmtval = tt;
- }
- *_mmt = mmtval; *_mpt = mptval;
- }
-
-return( pptval!=-1 || mmtval!=-1 || pmtval!=-1 || mptval==-1 );
-}
-
-#define BasePtDistance(pt1, pt2) sqrt(((pt1)->x-(pt2)->x)*((pt1)->x-(pt2)->x) + ((pt1)->y-(pt2)->y)*((pt1)->y-(pt2)->y))
-
-
-static SplinePoint *MergeSplinePoint(SplinePoint *sp1,SplinePoint *sp2) {
- /* sp1 and sp2 should be close together, use their average for the */
- /* new position, get rid of one, and add its spline to the other */
- /* sp1->next==NULL, sp2->prev==NULL */
- double offx, offy;
-
- offx = (sp1->me.x-sp2->me.x)/2;
- offy = (sp1->me.y-sp2->me.y)/2;
- sp1->me.x -= offx; sp1->prevcp.x -= offx;
- sp1->me.y -= offy; sp1->prevcp.y -= offy;
- sp1->nextcp.x = sp2->nextcp.x + offx;
- sp1->nextcp.y = sp2->nextcp.y + offy;
- sp1->nonextcp = sp2->nonextcp;
- sp1->next = sp2->next;
- SplinePointFree(sp2);
- if ( sp1->next!=NULL )
- sp1->next->from = sp1;
- SplinePointCatagorize(sp1);
- if ( sp1->prev!=NULL )
- SplineRefigure(sp1->prev);
- if ( sp1->next!=NULL )
- SplineRefigure(sp1->next);
-return( sp1 );
-}
-
-static void MSP(SplinePoint *sp1,SplinePoint **sp2, SplinePoint **sp2alt) {
- int same2 = *sp2==*sp2alt;
-
- *sp2 = MergeSplinePoint(sp1,*sp2);
- if ( same2 )
- *sp2alt = *sp2;
-}
-
-static SplinePoint *SplineMaybeBisect(Spline *s,double t) {
- /* Things get very confused if I have a splineset with just a single point */
- SplinePoint *temp, *sp;
-
- if ( t<.0001 ) {
- temp = chunkalloc(sizeof(SplinePoint));
- sp = s->from;
- *temp = *sp;
- temp->hintmask = NULL;
- temp->next->from = temp;
- sp->next = NULL;
- sp->nextcp = sp->me;
- sp->nonextcp = true;
- temp->prevcp = temp->me;
- temp->noprevcp = true;
- SplineMake3(sp,temp);
-return( temp );
- } else if ( t>.9999 ) {
- temp = chunkalloc(sizeof(SplinePoint));
- sp = s->to;
- *temp = *sp;
- temp->hintmask = NULL;
- temp->prev->to = temp;
- sp->prev = NULL;
- sp->prevcp = sp->me;
- sp->noprevcp = true;
- temp->nextcp = temp->me;
- temp->nonextcp = true;
- SplineMake3(temp,sp);
-return( temp );
- }
-
-return( SplineBisect(s,t));
-}
-
-static void SplineFreeBetween(SplinePoint *from,SplinePoint *to,int freefrom,int freeto) {
- Spline *s;
-
- if ( from==to ) {
- if ( freefrom && freeto )
- SplinePointFree(from);
-return;
- }
-
- while ( from!=to && from!=NULL ) {
- s = from->next;
- if ( freefrom )
- SplinePointFree(from);
- else
- from->next = NULL;
- if ( s==NULL )
-return;
- freefrom = true;
- from = s->to;
- SplineFree(s);
- }
- if ( freeto )
- SplinePointFree(to);
- else
- to->prev = NULL;
-}
-
-static void SplineFreeForeward(SplinePoint *from) {
- Spline *s;
-
- while ( from!=NULL ) {
- s = from->next;
- SplinePointFree(from);
- if ( s==NULL )
-return;
- from = s->to;
- SplineFree(s);
- }
-}
-
-static void SplineFreeBackward(SplinePoint *to) {
- Spline *s;
-
- while ( to!=NULL ) {
- s = to->prev;
- SplinePointFree(to);
- if ( s==NULL )
-return;
- to = s->from;
- SplineFree(s);
- }
-}
-
-static SplinePoint *SplineCopyAfter(SplinePoint *from,SplinePoint **end) {
- SplinePoint *head, *last;
-
- last = head = chunkalloc(sizeof(SplinePoint));
- *head = *from;
- head->hintmask = NULL;
- head->prev = NULL;
- while ( from->next!=NULL ) {
- last->next = chunkalloc(sizeof(Spline));
- *last->next = *from->next;
- last->next->from = last;
- last->next->to = chunkalloc(sizeof(SplinePoint));
- *last->next->to = *from->next->to;
- last->next->to->hintmask = NULL;
- last->next->to->prev = last->next;
- last = last->next->to;
- from = from->next->to;
- }
- *end = last;
-return( head );
-}
-
-static SplinePoint *SplineCopyBefore(SplinePoint *to,SplinePoint **end) {
- SplinePoint *head, *last;
-
- last = head = chunkalloc(sizeof(SplinePoint));
- *head = *to;
- head->hintmask = NULL;
- head->next = NULL;
- while ( to->prev!=NULL ) {
- last->prev = chunkalloc(sizeof(Spline));
- *last->prev = *to->prev;
- last->prev->to = last;
- last->prev->from = chunkalloc(sizeof(SplinePoint));
- *last->prev->from = *to->prev->from;
- last->prev->from->hintmask = NULL;
- last->prev->from->next = last->prev;
- last = last->prev->from;
- to = to->prev->from;
- }
- *end = last;
-return( head );
-}
-
-static SplinePoint *Intersect_Splines(SplinePoint *from,SplinePoint *to,
- SplinePoint **ret) {
- Spline *test1, *test2;
- BasePoint pts[9];
- extended t1s[9], t2s[9];
-
- for ( test1=from->next; test1!=NULL; test1=test1->to->next ) {
- for ( test2=to->prev; test2!=NULL; test2=test2->from->prev ) {
- if ( SplinesIntersect(test1,test2,pts,t1s,t2s)>0 ) {
- *ret = SplineMaybeBisect(test2,t2s[0]);
-return( SplineMaybeBisect(test1,t1s[0]));
- }
- }
- }
- *ret = NULL;
-return( NULL );
-}
-
-struct strokedspline {
- Spline *s;
- SplinePoint *plusfrom, *plusto, *origplusfrom;
- SplinePoint *minusfrom, *minusto, *origminusto;
- int8 plusskip, minusskip; /* If this spline is so small that it is totally within the region stroked by an adjacent spline */
- int8 pinnerto, minnerto; /* to and from as defined on original spline s */
- BasePoint minterto, pinterto;
- double nangle, pangle;
- struct strokedspline *next, *prev;
-};
-
-static void StrokeEndComplete(struct strokedspline *cur,StrokeInfo *si,int isstart) {
- SplinePoint *edgestart, *edgeend, *curat, *edgeat;
- struct strokedspline *lastp, *lastm;
-
- if ( isstart ) {
- edgestart = StrokeEnd(cur->s->from,si,true,&edgeend);
- for ( lastp=cur; lastp!=NULL && lastp->plusskip ; lastp=lastp->next );
- for ( lastm=cur; lastm!=NULL && lastm->minusskip ; lastm=lastm->next );
- if ( lastm==cur )
- MSP(edgeend,&cur->minusfrom,&cur->minusto);
- else {
- curat = Intersect_Splines(lastm->minusfrom,edgeend,&edgeat);
- if ( curat!=NULL ) {
- SplineFreeBetween(lastm->minusfrom,curat,true,false);
- SplineFreeBetween(edgeat,edgeend,false,true);
- } else
- MSP(edgeend,&lastm->minusfrom,&lastm->minusto);
- }
- if ( lastp==cur )
- MergeSplinePoint(cur->plusto,edgestart);
- else {
- edgeat = Intersect_Splines(edgestart,lastp->plusto,&curat);
- if ( curat!=NULL ) {
- SplineFreeBetween(curat,lastp->plusto,false,true);
- SplineFreeBetween(edgestart,edgeat,true,false);
- } else
- MergeSplinePoint(lastp->plusto,edgestart);
- }
- } else {
- edgestart = StrokeEnd(cur->s->to,si,false,&edgeend);
- for ( lastp=cur; lastp!=NULL && lastp->plusskip ; lastp=lastp->prev );
- for ( lastm=cur; lastm!=NULL && lastm->minusskip ; lastm=lastm->prev );
- if ( lastp==cur )
- MSP(edgeend,&cur->plusfrom,&cur->plusto);
- else {
- curat = Intersect_Splines(lastp->plusfrom,edgeend,&edgeat);
- if ( curat!=NULL ) {
- SplineFreeBetween(lastp->plusfrom,curat,true,false);
- lastp->plusfrom = curat;
- SplineFreeBetween(edgeat,edgeend,false,true);
- lastp->plusfrom = MergeSplinePoint(edgeat,curat);
- } else
- MSP(edgeend,&lastp->plusfrom,&lastp->plusto);
- }
- if ( lastm==cur )
- MergeSplinePoint(cur->minusto,edgestart);
- else {
- edgeat = Intersect_Splines(edgestart,lastm->minusto,&curat);
- if ( curat!=NULL ) {
- SplineFreeBetween(curat,lastm->minusto,false,true);
- lastm->minusto = curat;
- SplineFreeBetween(edgestart,edgeat,true,false);
- MergeSplinePoint(lastm->minusto,edgeat);
- } else
- MergeSplinePoint(lastm->minusto,edgestart);
- }
- }
-}
-
-static void StrokedSplineFree(struct strokedspline *head) {
- struct strokedspline *next, *cur=head;
-
- while ( cur!=NULL ) {
- next = cur->next;
- chunkfree(cur,sizeof(*cur));
- cur = next;
- if ( cur==head )
- break;
- }
-}
-
-static void FreeOrigStuff(struct strokedspline *before) {
-
- if ( before->origminusto!=NULL )
- SplineFreeBackward(before->origminusto);
- before->origminusto = NULL;
- if ( before->origplusfrom!=NULL )
- SplineFreeForeward(before->origplusfrom);
- before->origplusfrom = NULL;
-}
-
-static void SplineMakeRound(SplinePoint *from,SplinePoint *to, real radius) {
- /* I believe this only gets called when we have a line join where the */
- /* contour makes a U-Turn (opposite of being colinear) */
- BasePoint dir;
- SplinePoint *center;
-
- dir.x = (to->me.y-from->me.y)/2;
- dir.y = -(to->me.x-from->me.x)/2;
- center = SplinePointCreate((to->me.x+from->me.x)/2+dir.x,
- (to->me.y+from->me.y)/2+dir.y);
- from->nextcp.x = from->me.x + .552*dir.x;
- from->nextcp.y = from->me.y + .552*dir.y;
- to->prevcp.x = to->me.x + .552*dir.x;
- to->prevcp.y = to->me.y + .552*dir.y;
- from->nonextcp = to->noprevcp = false;
- center->prevcp.x = center->me.x + .552*dir.y;
- center->nextcp.x = center->me.x - .552*dir.y;
- center->prevcp.y = center->me.y - .552*dir.x;
- center->nextcp.y = center->me.y + .552*dir.x;
- center->nonextcp = center->noprevcp = false;
- SplineMake3(from,center);
- SplineMake3(center,to);
-}
-
-static int DoIntersect_Splines(struct strokedspline *before,
- struct strokedspline *after, int doplus,StrokeInfo *si,SplineChar *sc,
- int force_connect ) {
- SplinePoint *beforeat, *afterat;
- int ret = true;
- int toobig = false;
-
- if ( doplus ) {
- beforeat = Intersect_Splines(before->plusfrom,after->plusto,&afterat);
- if ( beforeat!=NULL ) {
- after->origplusfrom = after->plusfrom;
- after->plusto = SplineCopyBefore(afterat,&after->plusfrom);
- SplineFreeBetween(before->plusfrom,beforeat,true/*free before->plusfrom*/,false/* keep beforeat */);
- before->plusfrom = beforeat;
- } else if ( before->origplusfrom!=NULL &&
- (beforeat = Intersect_Splines(before->origplusfrom,after->plusto,&afterat))!=NULL ) {
- toobig = true;
- after->origplusfrom = after->plusfrom;
- after->plusto = SplineCopyBefore(afterat,&after->plusfrom);
- SplineFreeBetween(before->plusfrom,before->plusto,true/*free plusfrom*/,false);
- before->plusfrom = SplinePointCreate(afterat->me.x,afterat->me.y);
- before->plusfrom->nextcp = before->plusfrom->me;
- before->plusfrom->nonextcp = true;
- SplineMake3(before->plusfrom,before->plusto); /* This line goes backwards */
-#if 0 /* This introduces lots of bugs, it gets invoked when it */
- /* shouldn't, and I can't figure out how to distinguish */
- } else if ( EntirelyWithin(before->plusfrom,after->s,true,si->radius) ) {
- /* the splines at before are all within radius units of the original */
- /* after spline. This means that they will make no contribution */
- /* to the outline. */
- if ( before->prev!=NULL && before->prev!=after )
- ret = DoIntersect_Splines(before->prev,after,doplus,si,sc);
- before->plusskip = true;
- toobig = ret;
- } else if ( EntirelyWithin(after->plusto,before->s,false,si->radius) ) {
- /* the splines at after are entirely within radius units of the original */
- if ( after->next!=NULL && after->next!=before )
- ret = DoIntersect_Splines(before,after->next,doplus,si,sc);
- after->plusskip = true;
- toobig = ret;
-#endif
- } else {
- /* No intersection everything can stay as it is */
- if ( force_connect && BasePtDistance(&after->plusto->me,&before->plusfrom->me)>3 ) {
- beforeat = SplinePointCreate(after->plusto->me.x,after->plusto->me.y);
- if ( si->join==lj_round )
- SplineMakeRound(beforeat,before->plusfrom,si->radius);
- else
- SplineMake3(beforeat,before->plusfrom);
- before->plusfrom = beforeat;
- toobig = true;
- }
- ret = false;
- }
- } else {
- afterat = Intersect_Splines(after->minusfrom,before->minusto,&beforeat);
- if ( afterat!=NULL ) {
- after->origminusto = after->minusto;
- after->minusfrom = SplineCopyAfter(afterat,&after->minusto);
- SplineFreeBetween(beforeat,before->minusto,false/*keep beforeat*/,true);
- before->minusto = beforeat;
- } else if ( before->origminusto!=NULL &&
- (afterat = Intersect_Splines(after->minusfrom,before->origminusto,&beforeat))!=NULL ) {
- toobig = true;
- after->origminusto = after->minusto;
- after->minusfrom = SplineCopyAfter(afterat,&after->minusto);
- SplineFreeBetween(before->minusfrom,before->minusto,false/*keep minusfrom*/,true);
- before->minusto = SplinePointCreate(afterat->me.x,afterat->me.y);
- before->minusto->ptindex = afterat->ptindex;
- before->minusfrom->nextcp = before->minusfrom->me;
- before->minusfrom->nonextcp = true;
- SplineMake3(before->minusfrom,before->minusto); /* This line goes backwards */
-#if 0 /* This introduces lots of bugs, it gets invoked when it */
- /* shouldn't, and I can't figure out how to distinguish */
- } else if ( EntirelyWithin(before->minusto,after->s,false,si->radius) ) {
- /* the splines at before are all within radius units of the original */
- /* after spline. This means that they will make no contribution */
- /* to the outline. */
- ret = false;
- if ( before->prev!=NULL && before->prev!=after && before->prev!=after->next )
- ret = DoIntersect_Splines(before->prev,after,doplus,si,sc);
- before->minusskip = true;
- toobig = ret;
- } else if ( EntirelyWithin(after->minusfrom,before->s,true,si->radius) ) {
- /* the splines at after are entirely within radius units of the original */
- ret = false;
- if ( after->next!=NULL && after->next!=before && before->prev!=after->next )
- ret = DoIntersect_Splines(before,after->next,doplus,si,sc);
- after->minusskip = true;
- toobig = ret;
-#endif
- } else {
- /* No intersection everything can stay as it is */
- if ( force_connect && BasePtDistance(&after->minusfrom->me,&before->minusto->me)>3 ) {
- beforeat = SplinePointCreate(after->minusfrom->me.x,after->minusfrom->me.y);
- beforeat->ptindex = after->minusfrom->ptindex;
- if ( si->join==lj_round )
- SplineMakeRound(before->minusto,beforeat,si->radius);
- else
- SplineMake3(before->minusto,beforeat);
- before->minusto = beforeat;
- toobig = true;
- }
- ret = false;
- }
- }
-
- if ( toobig ) {
- si->gottoobig = si->gottoobiglocal = true;
- if ( !si->toobigwarn ) {
- si->toobigwarn = true;
- ff_post_error( _("Bad Stroke"), _("The stroke width is so big that the generated path\nmay intersect itself in %.100s"),
- sc==NULL?"<nameless char>": sc->name );
- }
- }
-return( ret );
-}
-
-/* Plus joins run from prev to next, minus joins run from next to prev */
-/* This makes plus joins clockwise and minus joins counter */
-static void StrokeJoint(SplinePoint *base,StrokeInfo *si,
- struct strokedspline *before,struct strokedspline *after,
- SplineChar *sc) {
- BasePoint nplus, nminus, pplus,pminus;
- double nangle, pangle;
- int pinner, minner;
-#if 0
- double pt, mt;
- double tt, xdiff, ydiff;
-#endif
-
- before->pangle = pangle = SplineExpand(base->prev,1,0,si,&pplus,&pminus);
- before->nangle = nangle = SplineExpand(base->next,0,0,si,&nplus,&nminus);
-
- if ( RealWithin(pangle,nangle,.1) || RealWithin(pangle+2*PI,nangle,.1) ||
- RealWithin(pangle,nangle+2*PI,.1)) {
- /* If the two splines are tangent at the base, then everything is */
- /* simple, there is no join, things match up perfectly */
- /* Um. No. If there is a sharp bend or a corner nearby then it may */
- /* have the same effect as a corner, in extreme cases the entire */
- /* spline may be eaten up */
- /* Actually, that's probably done best in Remove Overlap. If we try */
- /* to do it here, we unlease lots of potentials for bugs in other */
- /* cases */
-
-#if 0
- if ( (xdiff = base->me.x-base->prev->from->me.x)<0 ) xdiff = -xdiff;
- if ( (ydiff = base->me.y-base->prev->from->me.y)<0 ) ydiff = -ydiff;
- if ( xdiff+ydiff==0 ) xdiff = 1;
- tt = si->radius/(2*(xdiff+ydiff));
- if ( tt>.2 ) tt = .2;
- OnEdge(&pplus,&pminus,base->next,0,1.0-tt,base->prev,
- si,&pt,&mt,NULL,NULL);
- if ( pt!=-1 )
- DoIntersect_Splines(before,after,true,si,sc,true);
- else {
- if ( (xdiff = base->me.x-base->next->to->me.x)<0 ) xdiff = -xdiff;
- if ( (ydiff = base->me.y-base->next->to->me.y)<0 ) ydiff = -ydiff;
- tt = si->radius/(2*(xdiff+ydiff));
- if ( tt>.2 ) tt = .2;
- OnEdge(&nplus,&nminus,base->prev,1.,tt,base->next,
- si,NULL,NULL,&pt,&mt);
- if ( mt!=-1 )
- DoIntersect_Splines(before,after,false,si,sc,true);
- }
-#endif
- before->pinnerto = before->minnerto = -1;
- } else {
- pinner = Intersect_Lines(&before->pinterto,&pplus,
- 3*base->prev->splines[0].a+2*base->prev->splines[0].b+base->prev->splines[0].c,
- 3*base->prev->splines[1].a+2*base->prev->splines[1].b+base->prev->splines[1].c,
- &nplus,
- base->next->splines[0].c,
- base->next->splines[1].c,si->radius);
- minner = Intersect_Lines(&before->minterto,&pminus,
- 3*base->prev->splines[0].a+2*base->prev->splines[0].b+base->prev->splines[0].c,
- 3*base->prev->splines[1].a+2*base->prev->splines[1].b+base->prev->splines[1].c,
- &nminus,
- base->next->splines[0].c,
- base->next->splines[1].c,si->radius);
- if ( pinner==-1 && minner!=-1 )
- pinner = !minner;
- before->pinnerto = pinner; before->minnerto = (pinner!=-1?!pinner:-1);
- if ( pinner==1 ) {
- DoIntersect_Splines(before,after,true,si,sc,true);
- } else if ( pinner==0 ) {
- DoIntersect_Splines(before,after,false,si,sc,true);
- } else { /* splines are parallel, but moving in same dir */
- if ( DoIntersect_Splines(before,after,true,si,sc,false)) {
- before->pinnerto = 1;
- before->minnerto = 0;
- } else {
- if ( DoIntersect_Splines(before,after,false,si,sc,true)) {
- before->pinnerto = 0;
- before->minnerto = 1;
- } else
- DoIntersect_Splines(before,after,true,si,sc,true);
- }
- }
- }
-}
-
-static int SplineSolveForPen(Spline *s,StrokeInfo *si,double *ts,int *pinners,
- double tstart,double tend) {
- /* Find all the places at which the spline has the same slope as one of the */
- /* edges of the pen. There can be at most 8 (we get four quadratics) */
- double a, b, c, sq, t1, t2;
- int i, cnt=0, j;
- Spline1D *xsp = &s->splines[0], *ysp = &s->splines[1];
- BasePoint pp, pm, np, nm, testp, testm;
-
- ts[cnt++] = tstart;
- for ( i=0; i<2; ++i ) {
- if ( i==0 ) {
- a = 3*(ysp->a*si->c-xsp->a*si->s);
- b = 2*(ysp->b*si->c-xsp->b*si->s);
- c = ysp->c*si->c-xsp->c*si->s;
- } else if ( i==1 ) {
- a = 3*(-ysp->a*si->c-xsp->a*si->s);
- b = 2*(-ysp->b*si->c-xsp->b*si->s);
- c = -ysp->c*si->c-xsp->c*si->s;
-#if 0 /* These two are just the negatives of the first two and as such have the same roots */
- } else if ( i==2 ) {
- a = 3*(-ysp->a*si->c+xsp->a*si->s);
- b = 2*(-ysp->b*si->c+xsp->b*si->s);
- c = -ysp->c*si->c+xsp->c*si->s;
- } else {
- a = 3*(ysp->a*si->c+xsp->a*si->s);
- b = 2*(ysp->b*si->c+xsp->b*si->s);
- c = ysp->c*si->c+xsp->c*si->s;
-#endif
- }
- sq = b*b-4*a*c;
- if ( sq==0 ) {
- t1 = -b/(2*a);
- t2 = -1;
- } else if ( sq>0 ) {
- sq = sqrt(sq);
- t1 = (-b+sq)/(2*a);
- t2 = (-b-sq)/(2*a);
- } else
- t1 = t2 = -1;
- if ( t1>tstart && t1<tend )
- ts[cnt++] = t1;
- if ( t2>tstart && t2<tend )
- ts[cnt++] = t2;
- }
- ts[cnt++] = tend;
- if ( cnt<=2 )
-return(cnt);
- /* Order them */
- for ( i=1; i<cnt-1; ++i ) for ( j=i+1; j<cnt; ++j )
- if ( ts[i]>ts[j] ) {
- double temp = ts[i];
- ts[i] = ts[j];
- ts[j] = temp;
- }
- /* Figure which side is inner */
- for ( i=1; i<cnt-1; ++i ) {
- SplineExpand(s,ts[i],-(ts[i]-ts[i-1])/20.,si,&pp,&pm);
- SplineExpand(s,ts[i],(ts[i+1]-ts[i])/20.,si,&np,&nm);
- SplineExpand(s,ts[i]+(ts[i+1]-ts[i])/20.,0,si,&testp,&testm);
- pinners[i] = ( (testp.x-np.x)*(pp.x-np.x)+(testp.y-np.y)*(pp.y-np.y)> 0 );
- }
-return( cnt );
-}
-
-
-static void SplineSetFixCPs(SplineSet *ss) {
- SplinePoint *sp;
-
- for ( sp=ss->first; ; ) {
- SPWeightedAverageCps(sp);
- if ( sp->next==NULL )
- break;
- sp = sp->next->to;
- if ( sp==ss->first )
- break;
- }
- SPLCatagorizePoints(ss);
-}
-
-static SplinePoint *SPNew(SplinePoint *base,BasePoint *pos,BasePoint *cp,int isnext) {
- SplinePoint *sp = SplinePointCreate(pos->x,pos->y);
-
- sp->pointtype = base->pointtype;
- /* Embolden wants these three preserved */
- sp->ptindex = base->ptindex;
- sp->ttfindex = base->ttfindex;
- sp->nextcpindex = base->nextcpindex;
- if ( isnext ) {
- sp->nextcp.x = pos->x + (cp->x-base->me.x);
- sp->nextcp.y = pos->y + (cp->y-base->me.y);
- sp->nonextcp = (sp->nextcp.x==pos->x) && (sp->nextcp.y==pos->y);
- } else {
- sp->prevcp.x = pos->x + (cp->x-base->me.x);
- sp->prevcp.y = pos->y + (cp->y-base->me.y);
- sp->noprevcp = (sp->prevcp.x==pos->x) && (sp->prevcp.y==pos->y);
- }
-return( sp );
-}
-
-static void NormalizeT(TPoint *mids,int cnt,double tbase,double tend) {
- int i;
-
- for ( i=0; i<cnt; ++i )
- mids[i].t = (mids[i].t - tbase)/(tend - tbase);
-}
-
-static void SPFigureCP(SplinePoint *sp,double t,Spline *spline,int isnext) {
- Spline temp;
- double tn;
- Spline1D *s1;
- BasePoint off;
-
- s1 = &spline->splines[0];
- off.x = sp->me.x - ( ((s1->a*t+s1->b)*t+s1->c)*t+s1->d );
- s1 = &spline->splines[1];
- off.y = sp->me.y - ( ((s1->a*t+s1->b)*t+s1->c)*t+s1->d );
-
- if ( isnext ) {
- double s = (1.0-t);
- /* We want to renormalize the spline so that it runs from [t,1] and */
- /* then figure what the control point at t should be */
- s1 = &spline->splines[0];
- temp.splines[0].d = s1->d + t*(s1->c + t*(s1->b + t*s1->a));
- temp.splines[0].c = s*(s1->c + t*(2*s1->b + 3*s1->a*t));
- temp.splines[0].b = s*s*(s1->b+3*s1->a*t);
-#if 0
- temp.splines[0].a = s*s*s*s1->a;
-#endif
- s1 = &spline->splines[1];
- temp.splines[1].d = s1->d + t*(s1->c + t*(s1->b + t*s1->a));
- temp.splines[1].c = s*(s1->c + t*(2*s1->b + 3*s1->a*t));
- temp.splines[1].b = s*s*(s1->b+3*s1->a*t);
-#if 0
- temp.splines[1].a = s*s*s*s1->a;
-#endif
- if ( spline->order2 ) {
- sp->nextcp.x = temp.splines[0].d + temp.splines[0].c/2 + off.x;
- sp->nextcp.y = temp.splines[1].d + temp.splines[1].c/2 + off.y;
- } else {
- sp->nextcp.x = temp.splines[0].d + temp.splines[0].c/3 + off.x;
- sp->nextcp.y = temp.splines[1].d + temp.splines[1].c/3 + off.y;
- }
- sp->nonextcp = false;
- } else {
- /* We want to renormalize the spline so that it runs from [0,t] and */
- /* then figure what the control point at t should be */
- temp = *spline;
- temp.splines[0].c *= t; temp.splines[1].c *= t;
- tn = t*t;
- temp.splines[0].b *= tn; temp.splines[1].b *= tn;
-#if 0
- tn *= t;
- temp.splines[0].a *= tn; temp.splines[1].a *= tn;
-#endif
- if ( spline->order2 ) {
- sp->prevcp.x = temp.splines[0].d + temp.splines[0].c/2 + off.x;
- sp->prevcp.y = temp.splines[1].d + temp.splines[1].c/2 + off.y;
- } else {
- sp->prevcp.x = temp.splines[0].d + (2*temp.splines[0].c+temp.splines[0].b)/3 + off.x;
- sp->prevcp.y = temp.splines[1].d + (2*temp.splines[1].c+temp.splines[1].b)/3 + off.y;
- }
- sp->noprevcp = false;
- }
-}
-
-static void SPFigurePlusCP(SplinePoint *sp,double t,Spline *spline,int isnext) {
- SplinePoint dummy;
-
- /* Plus splines run in the oposite direction */
- dummy = *sp;
- SPFigureCP(&dummy,t,spline,!isnext);
- if ( isnext ) {
- sp->nextcp = dummy.prevcp;
- sp->nonextcp = false;
- } else {
- sp->prevcp = dummy.nextcp;
- sp->noprevcp = false;
- }
-}
-
-static int Overlaps(TPoint *expanded,TPoint *inner,double rsq) {
- double len;
- BasePoint dir;
-
- dir.x = (expanded->x-inner->x); dir.y = (expanded->y-inner->y);
- len = (dir.x*dir.x) + (dir.y*dir.y);
- if ( len>=rsq )
-return( false );
- len = sqrt(rsq/len);
- expanded->x = inner->x + len*dir.x;
- expanded->y = inner->y + len*dir.y;
-return( true );
-}
-
-#define Approx 10
-
-static struct strokedspline *_SplineSetApprox(SplineSet *spl,StrokeInfo *si,SplineChar *sc) {
- struct strokedspline *head=NULL, *last=NULL, *cur;
- int max=Approx;
- TPoint *pmids=galloc(max*sizeof(TPoint)),
- *mmids=galloc(max*sizeof(TPoint)),
- *mids=galloc(max*sizeof(TPoint));
- uint8 *knots=galloc(max);
- BasePoint pto, mto, pfrom, mfrom;
- double approx, xdiff, ydiff, loopdiff;
- Spline *spline, *first;
- int i,j,k;
- SplinePoint *p_to, *m_to, *p_from, *m_from;
- int cnt, anyknots;
- double ts[9];
- BasePoint m,p,temp;
- double mt1, pt1, mt2, pt2, rsq;
- int pinners[10];
- int mwascovered, pwascovered;
- enum knot_type { kt_knot=1, kt_pgood=2, kt_mgood=4 };
- int toobig;
-
- first = NULL;
- for ( spline = spl->first->next; spline!=NULL && spline!=first; spline = spline->to->next ) {
- cur = chunkalloc(sizeof(struct strokedspline));
- if ( last==NULL )
- head = cur;
- else {
- last->next = cur;
- cur->prev = last;
- }
- last = cur;
- cur->s = spline;
- SplineIsLinearMake(spline);
- SplineExpand(spline,0,0,si,&pto,&mfrom);
- SplineExpand(spline,1,0,si,&pfrom,&mto);
- cur->minusfrom = SPNew(spline->from,&mfrom,&spline->from->nextcp,true);
- cur->plusto = SPNew(spline->from,&pto,&spline->from->nextcp,false);
- cur->minusto = SPNew(spline->to,&mto,&spline->to->prevcp,false);
- cur->plusfrom = SPNew(spline->to,&pfrom,&spline->to->prevcp,true);
-
- if ( si->stroke_type == si_caligraphic ) {
- /* At each t where the spline is tangent to one of the pen-angles */
- /* we need to figure out which side is inner and which is outer */
- /* the outer side gets a copy of the appropriate pen side (with corner points tangent) */
- /* the inner side is going to be a single corner point at the */
- /* intersection of the splines from the two corners */
- /* And if (god help us) we've got a point of inflection here then */
- /* we get half the pen on each side */
- /* I ignore the case of a point of inflection, and I don't */
- /* find the real intersection point, I just guess that it is */
- /* near the mid point of the pen */
- cnt = SplineSolveForPen(spline,si,ts,pinners+1,0,1);
- p_to = m_to = NULL;
- p_from = NULL; /* Make gcc happy */
- for ( j=1; j<cnt; ++j ) {
- for ( i=0; i<Approx; ++i ) {
- real t = ts[j-1] + (i+1)*(ts[j]-ts[j-1])/(Approx+1);
- mmids[i].t = (i+1)/(double) (Approx+1); pmids[i].t = 1-mmids[i].t;
- SplineExpand(spline,t,0,si,&p,&m);
- pmids[i].x = p.x; pmids[i].y = p.y;
- mmids[i].x = m.x; mmids[i].y = m.y;
- }
- if ( j==1 ) {
- p_to = cur->plusto; m_from = cur->minusfrom;
- } else if ( pinners[j-1] ) {
- p_to = p_from;
- SplineExpand(spline,ts[j-1],(ts[j-1]-ts[j-2])/20.,si,&p,&m);
- m_from = SplinePointCreate(m.x,m.y);
- m_from->pointtype = pt_tangent;
- SplineMake3(m_to,m_from);
- } else {
- m_from = m_to;
- SplineExpand(spline,ts[j-1],(ts[j-1]-ts[j-2])/20.,si,&p,&m);
- p_to = SplinePointCreate(p.x,p.y);
- p_to->pointtype = pt_tangent;
- SplineMake3(p_to,p_from);
- }
- if ( j==cnt-1 ) {
- p_from = cur->plusfrom;
- m_to = cur->minusto;
- } else if ( pinners[j] ) {
- SplineExpand(spline,ts[j],(ts[j+1]-ts[j-1])/20.,si,&p,&m);
- SplineExpand(spline,ts[j],-(ts[j+1]-ts[j-1])/20.,si,&temp,&m);
- p_from = SplinePointCreate((p.x+temp.x)/2,(p.y+temp.y)/2);
- p_from->pointtype = pt_corner;
- m_to = SplinePointCreate(m.x,m.y);
- m_to->pointtype = pt_tangent;
- } else {
- SplineExpand(spline,ts[j],(ts[j+1]-ts[j-1])/20.,si,&p,&m);
- SplineExpand(spline,ts[j],-(ts[j+1]-ts[j-1])/20.,si,&p,&temp);
- p_from = SplinePointCreate(p.x,p.y);
- p_from->pointtype = pt_tangent;
- m_to = SplinePointCreate((m.x+temp.x)/2,(m.y+temp.y)/2);
- m_to->pointtype = pt_corner;
- }
- ApproximateSplineFromPoints(p_from,p_to,pmids,Approx,false);
- ApproximateSplineFromPoints(m_from,m_to,mmids,Approx,false);
- if ( m_from!=cur->minusfrom && m_from->pointtype!=pt_corner )
- m_from->pointtype = pt_tangent;
- }
- } else {
- /* Figure out where the curve starts to bend sharply, and add */
- /* New points there. I used to strip out the curve where it */
- /* overlapped itself, but I think that's better done by remove */
- /* overlap rather than here */
- if ( (xdiff = spline->to->me.x-spline->from->me.x)<0 ) xdiff = -xdiff;
- if ( (ydiff = spline->to->me.y-spline->from->me.y)<0 ) ydiff = -ydiff;
- loopdiff = (xdiff+ydiff==0) ? .1 : 1.0/(4*(xdiff+ydiff)/si->radius);
- approx = rint(1.0/loopdiff);
- if ( approx<0 || approx>3000 ) approx=3000;
- if ( approx>max ) {
- max = approx+10;
- pmids = grealloc(pmids,max*sizeof(TPoint));
- mmids = grealloc(mmids,max*sizeof(TPoint));
- mids = grealloc(mids,max*sizeof(TPoint));
- knots = grealloc(knots,max);
- }
-
- mwascovered = pwascovered = false;
- toobig = false;
- for ( i=0; i<approx; ++i ) {
- real t = (i+1)/(approx+1);
- SplineExpand(spline,t,0,si,&p,&m);
- OnEdge(&p,&m,spline,t,t,spline,si,&pt1,&mt1,&pt2,&mt2);
- knots[i] = 0;
- if ( ((pt1!=-1 || pt2!=-1) && !pwascovered && i!=0) ||
- ((mt1!=-1 || mt2!=-1) && !mwascovered && i!=0))
- knots[i] = kt_knot;
- if ( ((pt1==-1 && pt2==-1) && pwascovered && i!=0 ) ||
- ((mt1==-1 && mt2==-1) && mwascovered && i!=0 )) {
- if ( knots[i-1]&kt_knot )
- knots[i] = kt_knot;
- else
- knots[i-1] |= kt_knot;
- }
- pwascovered = pt1!=-1 || pt2!=-1;
- mwascovered = mt1!=-1 || mt2!=-1;
- pmids[i].t = 1-(i+1)/(approx+1);
- pmids[i].x = p.x; pmids[i].y = p.y;
- mmids[i].t = (i+1)/(approx+1);
- mmids[i].x = m.x; mmids[i].y = m.y;
- mids[i].x = (m.x+p.x)/2; mids[i].y = (m.y+p.y)/2;
- /*if ( !pwascovered )*/ knots[i] |= kt_pgood;
- /*if ( !mwascovered )*/ knots[i] |= kt_mgood;
- if ( pwascovered || mwascovered )
- toobig = true;
- }
- rsq = si->radius*si->radius;
- for ( i=0; i<approx; ++i ) {
- for ( j=1; j<approx/2; ++j ) {
- if ( i+j<approx ) {
- Overlaps(&mmids[i],&mids[i+j],rsq);
- Overlaps(&pmids[i],&mids[i+j],rsq);
- }
- if ( i-j>0 ) {
- Overlaps(&mmids[i],&mids[i-j],rsq);
- Overlaps(&pmids[i],&mids[i-j],rsq);
- }
- }
- }
- anyknots = false;
- for ( i=0; i<approx; ++i ) if ( knots[i]&kt_knot ) { anyknots=true; break; }
- if ( toobig ) {
- si->gottoobig = si->gottoobiglocal = true;
- if ( !si->toobigwarn ) {
- si->toobigwarn = true;
- ff_post_error( _("Bad Stroke"), _("The stroke width is so big that the generated path\nmay intersect itself in %.100s"),
- sc==NULL?"<nameless char>": sc->name );
- }
- }
-
- /* Look for any sharp bends, they give us problems which are */
- /* eased by creating a new point. */
- if ( !anyknots ) {
- double radius = si->radius;
- si->radius *= 2;
- mwascovered = pwascovered = false;
- for ( i=0; i<approx; ++i ) {
- real t = (i+1)/(approx+1);
- SplineExpand(spline,t,0,si,&p,&m);
- OnEdge(&p,&m,spline,t,t,spline,si,&pt1,&mt1,&pt2,&mt2);
- if ( ((pt1!=-1 || pt2!=-1) && !pwascovered && i!=0) ||
- ((mt1!=-1 || mt2!=-1) && !mwascovered && i!=0))
- knots[i] |= kt_knot;
- if ( ((pt1==-1 && pt2==-1) && pwascovered && i!=0 ) ||
- ((mt1==-1 && mt2==-1) && mwascovered && i!=0 )) {
- if ( knots[i-1]&kt_knot )
- knots[i] |= kt_knot;
- else
- knots[i-1] |= kt_knot;
- }
- pwascovered = pt1!=-1 || pt2!=-1;
- mwascovered = mt1!=-1 || mt2!=-1;
- }
- si->radius = radius;
- }
-
- p_to = cur->plusto;
- m_from = cur->minusfrom;
- for ( i=0, j=1; i<approx; ++i ) {
- if ( knots[i]&kt_knot ) {
- for ( k=i+1; k<approx && !(knots[k]&kt_knot); ++k );
- if ( i>0 && (knots[i-1]&kt_mgood) ) {
- if ( i+1<approx && !(knots[i+1]&kt_mgood) && k<approx )
- m_to = SplinePointCreate((mmids[i].x+mmids[k].x)/2,(mmids[i].y+mmids[k].y)/2);
- else
- m_to = SplinePointCreate(mmids[i].x,mmids[i].y);
- m_to->pointtype = pt_corner;
- SPFigureCP(m_from,(j)/(approx+1),spline,true);
- SPFigureCP(m_to,(i+1)/(approx+1),spline,false);
- NormalizeT(mmids+j,i-j,mmids[j-1].t,mmids[i].t);
- ApproximateSplineFromPointsSlopes(m_from,m_to,mmids+j,i-j,false);
- m_from = m_to;
- }
-
- if ( i>0 && (knots[i-1]&kt_pgood) ) {
- if ( i+1<approx && !(knots[i+1]&kt_pgood) && k<approx )
- p_from = SplinePointCreate((pmids[i].x+pmids[k].x)/2,(pmids[i].y+pmids[k].y)/2);
- else
- p_from = SplinePointCreate(pmids[i].x,pmids[i].y);
- p_from->pointtype = pt_corner;
- SPFigurePlusCP(p_to,j/(approx+1),spline,false);
- SPFigurePlusCP(p_from,(i+1)/(approx+1),spline,true);
- NormalizeT(pmids+j,i-j,pmids[i].t,pmids[j-1].t);
- ApproximateSplineFromPointsSlopes(p_from,p_to,pmids+j,i-j,false);
- p_to = p_from;
- }
-
- j=i+1;
- }
- }
-
- if ( j!=1 ) {
- NormalizeT(pmids+j,i-j,0.0,pmids[j-1].t);
- NormalizeT(mmids+j,i-j,mmids[j-1].t,1.0);
- SPFigureCP(m_from,(j)/(approx+1),spline,true);
- SPFigurePlusCP(p_to,(j)/(approx+1),spline,false);
- }
- ApproximateSplineFromPointsSlopes(cur->plusfrom,p_to,pmids+j,i-j,false);
- ApproximateSplineFromPointsSlopes(m_from,cur->minusto,mmids+j,i-j,false);
- }
- if ( spline->to->next==NULL ) {
- /* Done */
- break;
- }
- if ( first==NULL ) first = spline;
- }
- if ( spline==first ) {
- head->prev = last;
- last->next = head;
- }
- free(mmids); free(pmids); free(knots); free(mids);
-return( head );
-}
-
-static void SPLCheckValidity(SplineSet *ss) {
- SplinePoint *sp, *nsp;
-
- for ( sp=ss->first; ; sp = nsp ) {
- if ( sp->next==NULL )
- break;
- nsp = sp->next->to;
- if ( nsp->prev != sp->next || sp->next->from!=sp )
- IError("Bad SPL");
- if ( nsp==ss->first )
- break;
- }
-
- for ( sp=ss->last; ; sp = nsp ) {
- if ( sp->prev==NULL )
- break;
- nsp = sp->prev->from;
- if ( nsp->next != sp->prev || sp->prev->to!=sp )
- IError("Bad SPL");
- if ( nsp==ss->last )
- break;
- }
-}
-
-static SplineSet *_SplineSetStroke(SplineSet *spl,StrokeInfo *si,SplineChar *sc) {
- SplineSet *ssplus, *ssminus;
- int reversed = false;
- struct strokedspline *head, *cur, *first, *lastp, *lastm;
- Spline *s1, *s2;
-
- si->gottoobiglocal = false;
-
- if ( spl->first->next==NULL || spl->first->next->to==spl->first ) {
- /* Only one point in the SplineSet. */
- ssplus = chunkalloc(sizeof(SplineSet));
- SinglePointStroke(spl->first,si,&ssplus->first,&ssplus->last);
-return( ssplus );
- }
-
- SplineSetAddExtrema(NULL,spl,ae_all,1000/* Not used*/);
-
- if ( spl->first==spl->last && spl->first->next!=NULL ) {
- /* My routine gets screwed up by counter-clockwise triangles */
- if ( !SplinePointListIsClockwise(spl)) {
- reversed = true;
- SplineSetReverse(spl);
- }
- }
-
- head = cur = _SplineSetApprox(spl,si,sc);
-
- first = NULL;
- for ( cur=head; cur!=NULL && cur!=first; cur=cur->next ) {
- if ( first==NULL ) first = cur;
- if ( cur->s->to->next!=NULL )
- StrokeJoint(cur->s->to,si,cur,cur->next,sc);
- FreeOrigStuff(cur);
- }
- FreeOrigStuff(head); /* normally gets freed when we look at the next item on list. But we did that for head first */
-
- /* Finish off intersections, before doing joins */
- if ( spl->first->prev==NULL ) {
- StrokeEndComplete(head,si,true);
- for ( cur=head; cur->next!=NULL; cur=cur->next );
- StrokeEndComplete(cur,si,false);
- }
-
- lastp = lastm = head;
- if ( lastp->plusskip ) lastp = NULL;
- if ( lastm->minusskip ) lastm = NULL;
-
- first = NULL;
- for ( cur=head; cur!=NULL && cur!=first; cur=cur->next ) {
- real factor = si->factor==NULL ? 1.0 : (si->factor)(si->data,cur->s,1.0);
- if ( first==NULL ) first = cur;
-
- if ( cur->s->to->next!=NULL ) {
- if ( !cur->plusskip ) lastp = cur;
- if ( lastp!=NULL && !cur->next->plusskip ) {
- if ( cur->pinnerto==-1 )
- MSP(cur->next->plusto,&lastp->plusfrom,&lastp->plusto);
- else if ( cur->pinnerto )
- MSP(cur->next->plusto,&lastp->plusfrom,&lastp->plusto);
- else if ( cur==lastp )
- MakeJoints(cur->next->plusto,cur->plusfrom,si,&cur->pinterto,
- &cur->s->to->me,-1,cur->pangle,cur->nangle,factor);
- else
- IError("Lastp not cur" );
- }
- if ( !cur->minusskip ) lastm = cur;
- if ( lastm!=NULL && !cur->next->minusskip ) {
- if ( cur->minnerto==-1 )
- MSP(lastm->minusto,&cur->next->minusfrom,&cur->next->minusto);
- else if ( cur->minnerto )
- MSP(lastm->minusto,&cur->next->minusfrom,&cur->next->minusto);
- else if ( cur==lastm )
- MakeJoints(lastm->minusto,cur->next->minusfrom,si,&cur->minterto,
- &cur->s->to->me,1,PI+cur->nangle,PI+cur->pangle,factor);
- else
- IError("Lastm not cur");
- }
- }
- }
-
- for ( cur=head; cur!=NULL && cur->plusskip; ) { cur=cur->next; if ( cur==head ) cur=NULL; }
- if ( cur!=NULL ) {
- ssplus = chunkalloc(sizeof(SplineSet));
- ssplus->first = ssplus->last = cur->plusfrom;
- SplineSetFixCPs(ssplus);
- SPLCheckValidity(ssplus);
- } else
- /* It is possible to have a contour completely swallowed by the pen */
- ssplus = NULL;
- for ( cur=head; cur!=NULL && cur->minusskip; ) { cur=cur->next; if ( cur==head ) cur=NULL; }
- if ( spl->first==spl->last && cur!=NULL ) {
- ssminus = chunkalloc(sizeof(SplineSet));
- ssminus->first = ssminus->last = cur->minusfrom;
- SPLCheckValidity(ssminus);
- /*SplineSetFixRidiculous(ssplus); SplineSetFixRidiculous(ssminus);*/
- SplineSetFixCPs(ssminus);
- if ( reversed ) {
- SplineSet *temp = ssplus;
- ssplus = ssminus;
- ssminus = temp;
- }
- SplineSetReverse(ssminus);
- if ( ssplus != NULL )
- SplineSetReverse(ssplus);
- if ( si->removeinternal && ssplus!=NULL ) {
- SplinePointListFree(ssminus);
- } else if ( si->removeexternal ) {
- SplinePointListFree(ssplus);
- SplineSetReverse(ssminus);
- ssplus = ssminus;
- } else {
- if ( ssplus != NULL )
- ssplus->next = ssminus;
- else
- ssplus = ssminus;
- /* I used to do a splineset correct dir here on both, but */
- /* that doesn't work always if a contour self intersects */
- /* I think it should always be correct */
- }
- /* I can't always detect an overlap, so let's always do the remove */
- /* Sigh, no. That is still too dangerous */
- if ( si->removeoverlapifneeded && ssplus!=NULL && SplineSetIntersect(ssplus,&s1,&s2))
- ssplus = SplineSetRemoveOverlap(sc,ssplus,over_remove);
- if ( reversed ) /* restore original, just in case we want it */
- SplineSetReverse(spl);
- } else if ( si->stroke_type==si_std || si->stroke_type==si_elipse )
- SplineSetReverse(ssplus);
- StrokedSplineFree(head);
-return( ssplus );
-}
-
-static SplineSet *SSRemoveUTurns(SplineSet *base, StrokeInfo *si) {
- /* All too often in MetaPost output splines have tiny cps which */
- /* make the slope at the end-points irrelevant when looking at */
- /* the curve. Since we assume the slope at the end-points is */
- /* similar to the slope at t=.01 this confuses us greatly and */
- /* produces nasty results. In this case try to approximate a new */
- /* spline with very different cps. Note: We break continuity! */
- /* A special case of this is the following: */
- /* My stroking algorithem gets confused by sharp turns. For example */
- /* if we have a spline which is all in a line, but the control points */
- /* are such that it doubles back on itself ( "* + * +", ie. cps */
- /* outside of the points) then things get very unhappy */
- SplineSet *spl= base;
- Spline *first, *s, *next, *snew;
- double dx,dy, offx,offy, diff, n,l, slen, len, bound;
- int linear, bad, i, cnt;
- SplinePoint fakefrom, faketo;
- TPoint *tps;
-
- bound = si->radius*si->radius;
- first = NULL;
- if ( spl->first->next!=NULL && !spl->first->next->order2 )
- for ( s = spl->first->next; s!=NULL && s!=first; s=s->to->next ) {
- if ( first==NULL ) first = s;
-
- bad = false;
- dx = s->to->me.x-s->from->me.x;
- dy = s->to->me.y-s->from->me.y;
- slen = dx*dx + dy*dy;
-
- offx = s->from->nextcp.x-s->from->me.x;
- offy = s->from->nextcp.y-s->from->me.y;
- l= offx*dx + offy*dy;
- if ( l<0 ) {
- l = -l;
- if ( (n= offx*dy - offy*dx)<0 ) n = -n;
- len = offx*offx + offy*offy;
- if ( (n/l>2*len/si->radius || (n>l/3 && s->from->prev==NULL )) && len<bound && len< slen/4 )
- bad = 1;
- }
-
- offx = s->to->me.x-s->to->prevcp.x;
- offy = s->to->me.y-s->to->prevcp.y;
- l= offx*dx + offy*dy;
- if ( l<0 ) {
- l = -l;
- if ( (n= offx*dy - offy*dx)<0 ) n = -n;
- len = offx*offx + offy*offy;
- if ( (n/l>2*len/si->radius || (n>l/3 && s->to->next==NULL)) && len<bound && len< slen/4 )
- bad |= 2;
- }
-
- if ( bad ) {
- fakefrom = *s->from; fakefrom.next = fakefrom.prev = NULL;
- faketo = *s->to; faketo.next = faketo.prev = NULL;
-
- slen = sqrt(slen);
- dx /= slen; dy/=slen;
-
- if ( bad&1 ) { /* from->nextcp is nasty */
- offx = s->from->nextcp.x-s->from->me.x;
- offy = s->from->nextcp.y-s->from->me.y;
- len = sqrt(offx*offx + offy*offy);
- offx /= len; offy/=len;
-
- n = offx*dy - offy*dx;
- fakefrom.nextcp.x = fakefrom.me.x + slen*dx + 3*len*dy;
- fakefrom.nextcp.y = fakefrom.me.y + slen*dy - 3*len*dx;
- }
-
- if ( bad&2 ) { /* from->nextcp is nasty */
- offx = s->to->prevcp.x-s->to->me.x;
- offy = s->to->prevcp.y-s->to->me.y;
- len = sqrt(offx*offx + offy*offy);
- offx /= len; offy/=len;
-
- n = offx*dy - offy*dx;
- faketo.prevcp.x = faketo.me.x - slen*dx + 3*len*dy;
- faketo.prevcp.y = faketo.me.y - slen*dy - 3*len*dx;
- }
-
- if (( cnt = slen/2)<10 ) cnt = 10;
- tps = galloc(cnt*sizeof(TPoint));
- for ( i=0; i<cnt; ++i ) {
- double t = ((double) (i+1))/(cnt+1);
- tps[i].t = t;
- tps[i].x = ((s->splines[0].a*t + s->splines[0].b)*t + s->splines[0].c)*t + s->splines[0].d;
- tps[i].y = ((s->splines[1].a*t + s->splines[1].b)*t + s->splines[1].c)*t + s->splines[1].d;
- }
- snew = ApproximateSplineFromPointsSlopes(&fakefrom,&faketo,tps,cnt,false);
- snew->from = s->from;
- snew->to = s->to;
- snew->from->next = snew;
- snew->to->prev = snew;
- snew->from->nextcp = fakefrom.nextcp;
- snew->from->nonextcp = fakefrom.nonextcp;
- if ( bad&1 ) snew->from->pointtype = pt_corner;
- snew->to->prevcp = faketo.prevcp;
- snew->to->noprevcp = faketo.noprevcp;
- if ( bad&2 ) snew->to->pointtype = pt_corner;
- if ( first==s ) first=snew;
- SplineFree(s);
- free(tps);
- s = snew;
- }
- }
-
- first = NULL;
- for ( s = spl->first->next; s!=NULL && s!=first; s=s->to->next ) {
- if ( first==NULL ) first = s;
- dx = s->to->me.x-s->from->me.x;
- dy = s->to->me.y-s->from->me.y;
- offx = s->from->nextcp.x-s->from->me.x;
- offy = s->from->nextcp.y-s->from->me.y;
- if ( offx*dx + offy*dy<0 ) {
- diff = offx*dy-offy*dx;
- linear = ( diff<1 && diff>-1 );
- if ( offx<0 ) offx = -offx;
- if ( offy<0 ) offy = -offy;
- if ( offx+offy<1 || linear ) {
- s->from->nextcp = s->from->me;
- s->from->nonextcp = true;
- if ( s->from->pointtype == pt_curve || s->from->pointtype == pt_hvcurve )
- s->from->pointtype = pt_corner;
- if ( s->order2 ) {
- s->to->prevcp = s->to->me;
- s->to->noprevcp = true;
- if ( s->to->pointtype==pt_curve || s->to->pointtype == pt_hvcurve )
- s->to->pointtype = pt_corner;
- }
- SplineRefigure(s);
- }
- }
- offx = s->to->me.x-s->to->prevcp.x;
- offy = s->to->me.y-s->to->prevcp.y;
- if ( offx*dx + offy*dy<0 ) {
- diff = offx*dy-offy*dx;
- linear = ( diff<1 && diff>-1 );
- if ( offx<0 ) offx = -offx;
- if ( offy<0 ) offy = -offy;
- if ( offx+offy<1 || linear ) {
- s->to->prevcp = s->to->me;
- s->to->noprevcp = true;
- if ( s->to->pointtype==pt_curve || s->to->pointtype == pt_hvcurve )
- s->to->pointtype = pt_corner;
- if ( s->order2 ) {
- s->from->nextcp = s->from->me;
- s->from->nonextcp = true;
- if ( s->from->pointtype == pt_curve || s->from->pointtype == pt_hvcurve )
- s->from->pointtype = pt_corner;
- }
- SplineRefigure(s);
- }
- }
- }
-
- /* Zero length splines are bad too */
- /* As are splines of length .000003 */
- first = NULL;
- for ( s = spl->first->next; s!=NULL && s!=first; s=next ) {
- if ( first==NULL ) first = s;
- next = s->to->next;
- if ( s->from->nonextcp && s->to->noprevcp && s!=next &&
- s->from->me.x >= s->to->me.x-.1 && s->from->me.x <= s->to->me.x+.1 &&
- s->from->me.y >= s->to->me.y-.1 && s->from->me.y <= s->to->me.y+.1 ) {
- s->from->next = next;
- if ( next!=NULL ) {
- s->from->nextcp = next->from->nextcp;
- s->from->nonextcp = next->from->nonextcp;
- s->from->nextcpdef = next->from->nextcpdef;
- next->from = s->from;
- }
- SplinePointCatagorize(s->from);
- if ( spl->last == s->to ) {
- if ( next==NULL )
- spl->last = s->from;
- else
- spl->first = spl->last = s->from;
- }
- if ( spl->first==s->to ) spl->first = s->from;
- if ( spl->last==s->to ) spl->last = s->from;
- SplinePointFree(s->to);
- SplineFree(s);
- if ( first==s ) first = NULL;
- }
- }
-
-return( base );
-}
-
-static void SSRemoveColinearPoints(SplineSet *ss) {
- SplinePoint *sp, *nsp, *nnsp;
- BasePoint dir, ndir;
- double len;
- int removed;
-
- sp = ss->first;
- if ( sp->prev==NULL )
-return;
- nsp = sp->next->to;
- if ( nsp==sp )
-return;
- dir.x = nsp->me.x - sp->me.x; dir.y = nsp->me.y - sp->me.y;
- len = dir.x*dir.x + dir.y*dir.y;
- if ( len!=0 ) {
- len = sqrt(len);
- dir.x /= len; dir.y /= len;
- }
- nnsp = nsp->next->to;
- if ( nnsp==sp )
-return;
- memset(&ndir,0,sizeof(ndir));
- forever {
- removed = false;
- if ( nsp->next->islinear ) {
- ndir.x = nnsp->me.x - nsp->me.x; ndir.y = nnsp->me.y - nsp->me.y;
- len = ndir.x*ndir.x + ndir.y*ndir.y;
- if ( len!=0 ) {
- len = sqrt(len);
- ndir.x /= len; ndir.y /= len;
- }
- }
- if ( sp->next->islinear && nsp->next->islinear ) {
- double dot =dir.x*ndir.y - dir.y*ndir.x;
- if ( dot<.001 && dot>-.001 ) {
- sp->next->to = nnsp;
- nnsp->prev = sp->next;
- SplineRefigure(sp->next);
- SplineFree(nsp->next);
- SplinePointFree(nsp);
- if ( ss->first==nsp ) ss->first = sp;
- if ( ss->last ==nsp ) ss->last = sp;
- removed = true;
- } else
- sp = nsp;
- } else
- sp = nsp;
- dir = ndir;
- nsp = nnsp;
- nnsp = nsp->next->to;
- if ( !removed && sp==ss->first )
- break;
- }
-}
-
-static void SSesRemoveColinearPoints(SplineSet *ss) {
- while ( ss!=NULL ) {
- SSRemoveColinearPoints(ss);
- ss = ss->next;
- }
-}
-
-SplineSet *SplineSetStroke(SplineSet *spl,StrokeInfo *si,SplineChar *sc) {
- SplineSet *ret, *temp, *temp2;
- SplineSet *order3 = NULL;
-
- if ( spl->first->next!=NULL && spl->first->next->order2 )
- order3 = spl = SSPSApprox(spl);
- if ( si->radius==0 )
- si->radius=1;
- temp2 = SSRemoveUTurns(SplinePointListCopy(spl),si);
- if ( si->stroke_type == si_elipse ) {
- real trans[6], factor;
- StrokeInfo si2;
- trans[0] = trans[3] = si->c;
- trans[1] = -si->s;
- trans[2] = si->s;
- trans[4] = trans[5] = 0;
- factor = si->radius/si->minorradius;
- trans[0] *= factor; trans[2] *= factor;
- temp = SplinePointListCopy(temp2);
-#if 0
- BisectTurners(temp);
-#endif
- temp = SplinePointListTransform(temp,trans,true);
- si2 = *si;
- si2.stroke_type = si_std;
- ret = SplineSetStroke(temp,&si2,sc);
- SplinePointListFree(temp);
- trans[0] = trans[3] = si->c;
- trans[1] = si->s;
- trans[2] = -si->s;
- trans[4] = trans[5] = 0;
- factor = si->minorradius/si->radius;
- trans[0] *= factor; trans[1] *= factor;
- ret = SplinePointListTransform(ret,trans,true);
- } else
- ret = _SplineSetStroke(temp2,si,sc);
- SplinePointListFree(temp2);
- if ( order3!=NULL ) {
- temp = SplineSetsTTFApprox(ret);
- SplinePointListsFree(ret);
- SplinePointListFree(order3);
- ret = temp;
- }
- /* We tend to get (small) rounding errors */
- SplineSetsRound2Int(ret,1024.,false,false);
- /* If we use butt line caps or miter joins then we will likely have */
- /* some spurious colinear points. If we do, remove them */
- SSesRemoveColinearPoints(ret);
-return( ret );
-}
-
diff --git a/Build/source/texk/web2c/luatexdir/luafontloader/fontforge/fontforge/splineutil.c b/Build/source/texk/web2c/luatexdir/luafontloader/fontforge/fontforge/splineutil.c
deleted file mode 100644
index af2e72dad76..00000000000
--- a/Build/source/texk/web2c/luatexdir/luafontloader/fontforge/fontforge/splineutil.c
+++ /dev/null
@@ -1,4576 +0,0 @@
-/* Copyright (C) 2000-2008 by George Williams */
-/*
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are met:
-
- * Redistributions of source code must retain the above copyright notice, this
- * list of conditions and the following disclaimer.
-
- * Redistributions in binary form must reproduce the above copyright notice,
- * this list of conditions and the following disclaimer in the documentation
- * and/or other materials provided with the distribution.
-
- * The name of the author may not be used to endorse or promote products
- * derived from this software without specific prior written permission.
-
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
- * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
- * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
- * EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
- * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
- * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
- * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
- * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-#include "fontforgevw.h"
-#include <math.h>
-#include "psfont.h"
-#include "ustring.h"
-#include "utype.h"
-#ifdef HAVE_IEEEFP_H
-# include <ieeefp.h> /* Solaris defines isnan in ieeefp rather than math.h */
-#endif
-
-/*#define DEBUG 1*/
-
-typedef struct quartic {
- double a,b,c,d,e;
-} Quartic;
-
-
-#ifdef HAVE_FABS
-#define FABS(x) fabs((x))
-#else
-#define FABS(x) ((x)>=0?(x):(-(x)))
-#endif
-
-
-/* In an attempt to make allocation more efficient I just keep preallocated */
-/* lists of certain common sizes. It doesn't seem to make much difference */
-/* when allocating stuff, but does when freeing. If the extra complexity */
-/* is bad then put: */
-/* #define chunkalloc(size) gcalloc(1,size) */
-/* #define chunkfree(item,size) free(item) */
-/* into splinefont.h after (or instead of) the definition of chunkalloc()*/
-
-#ifndef chunkalloc
-#define ALLOC_CHUNK 100 /* Number of small chunks to malloc at a time */
-#if !defined(FONTFORGE_CONFIG_USE_LONGDOUBLE) && !defined(FONTFORGE_CONFIG_USE_DOUBLE)
-# define CHUNK_MAX 100 /* Maximum size (in chunk units) that we are prepared to allocate */
- /* The size of our data structures */
-#else
-# define CHUNK_MAX 129
-#endif
-# define CHUNK_UNIT sizeof(void *) /* will vary with the word size of */
- /* the machine. if pointers are 64 bits*/
- /* we may need twice as much space as for 32 bits */
-
-#ifdef FLAG
-#undef FLAG
-#define FLAG 0xbadcafe
-#endif
-
-#ifdef CHUNKDEBUG
-static int chunkdebug = 0; /* When this is set we never free anything, insuring that each chunk is unique */
-#endif
-
-#if ALLOC_CHUNK>1
-struct chunk { struct chunk *next; };
-struct chunk2 { struct chunk2 *next; int flag; };
-static struct chunk *chunklists[CHUNK_MAX] = { 0 };
-#endif
-
-#if defined(FLAG) && ALLOC_CHUNK>1
-void chunktest(void) {
- int i;
- struct chunk2 *c;
-
- for ( i=2; i<CHUNK_MAX; ++i )
- for ( c=(struct chunk2 *) chunklists[i]; c!=NULL; c=c->next )
- if ( c->flag!=FLAG ) {
- fprintf( stderr, "Chunk memory list has been corrupted\n" );
- abort();
- }
-}
-#endif
-
-
-
-void *chunkalloc(int size) {
-# if ALLOC_CHUNK<=1
-return( gcalloc(1,size));
-# else
- struct chunk *item;
- int index;
-
- if ( size&(CHUNK_UNIT-1) )
- size = (size+CHUNK_UNIT-1)&~(CHUNK_UNIT-1);
-
- if ( (size&(CHUNK_UNIT-1)) || size>=(int)(CHUNK_MAX*CHUNK_UNIT) || size<=(int)sizeof(struct chunk)) {
- fprintf( stderr, "Attempt to allocate something of size %d\n", size );
-return( gcalloc(1,size));
- }
-#ifdef FLAG
- chunktest();
-#endif
- index = (size+CHUNK_UNIT-1)/CHUNK_UNIT;
- if ( chunklists[index]==NULL ) {
- char *pt, *end;
- pt = galloc(ALLOC_CHUNK*size);
- chunklists[index] = (struct chunk *) pt;
- end = pt+(ALLOC_CHUNK-1)*size;
- while ( pt<end ) {
- ((struct chunk *) pt)->next = (struct chunk *) (pt + size);
-#ifdef FLAG
- ((struct chunk2 *) pt)->flag = FLAG;
-#endif
- pt += size;
- }
- ((struct chunk *) pt)->next = NULL;
-#ifdef FLAG
- ((struct chunk2 *) pt)->flag = FLAG;
-#endif
- }
- item = chunklists[index];
- chunklists[index] = item->next;
- memset(item,'\0',size);
-return( item );
-# endif
-}
-
-void chunkfree(void *item,int size) {
- int index = (size+CHUNK_UNIT-1)/CHUNK_UNIT;
-#ifdef CHUNKDEBUG
- if ( chunkdebug )
-return;
-#endif
-# if ALLOC_CHUNK<=1
- free(item);
-# else
- if ( item==NULL )
-return;
-
- if ( size&(CHUNK_UNIT-1) )
- size = (size+CHUNK_UNIT-1)&~(CHUNK_UNIT-1);
-
- if ( (size&(CHUNK_UNIT-1)) || size>=(int)(CHUNK_MAX*CHUNK_UNIT) || size<=(int)sizeof(struct chunk)) {
- fprintf( stderr, "Attempt to free something of size %d\n", size );
- free(item);
- } else {
-#ifdef LOCAL_DEBUG
- if ( (char *) (chunklists[index]) == (char *) item ||
- ( ((char *) (chunklists[index]))<(char *) item &&
- ((char *) (chunklists[index]))+size>(char *) item) ||
- ( ((char *) (chunklists[index]))>(char *) item &&
- ((char *) (chunklists[index]))<((char *) item)+size))
- IError( "Memory mixup. Chunk list is wrong!!!" );
-#endif
- ((struct chunk *) item)->next = chunklists[index];
-# ifdef FLAG
- if ( size>=sizeof(struct chunk2))
- ((struct chunk2 *) item)->flag = FLAG;
-# endif
- chunklists[index] = (struct chunk *) item;
- }
-# ifdef FLAG
- chunktest();
-# endif
-# endif
-}
-#endif
-
-
-
-
-char *strconcat(const char *str1,const char *str2) {
- int len1 = strlen(str1);
- char *ret = galloc(len1+strlen(str2)+1);
- strcpy(ret,str1);
- strcpy(ret+len1,str2);
-return( ret );
-}
-
-char *strconcat3(const char *str1,const char *str2, const char *str3) {
- int len1 = strlen(str1), len2 = strlen(str2);
- char *ret = galloc(len1+len2+strlen(str3)+1);
- strcpy(ret,str1);
- strcpy(ret+len1,str2);
- strcpy(ret+len1+len2,str3);
-return( ret );
-}
-
-void LineListFree(LineList *ll) {
- LineList *next;
-
- while ( ll!=NULL ) {
- next = ll->next;
- chunkfree(ll,sizeof(LineList));
- ll = next;
- }
-}
-
-void LinearApproxFree(LinearApprox *la) {
- LinearApprox *next;
-
- while ( la!=NULL ) {
- next = la->next;
- LineListFree(la->lines);
- chunkfree(la,sizeof(LinearApprox));
- la = next;
- }
-}
-
-void SplineFree(Spline *spline) {
- LinearApproxFree(spline->approx);
- chunkfree(spline,sizeof(Spline));
-}
-
-SplinePoint *SplinePointCreate(real x, real y) {
- SplinePoint *sp = chunkalloc(sizeof(SplinePoint));
- sp->me.x = x; sp->me.y = y;
- sp->nextcp = sp->prevcp = sp->me;
- sp->nonextcp = sp->noprevcp = true;
- sp->nextcpdef = sp->prevcpdef = false;
- sp->ttfindex = sp->nextcpindex = 0xfffe;
-return( sp );
-}
-
-Spline *SplineMake3(SplinePoint *from, SplinePoint *to) {
- Spline *spline = chunkalloc(sizeof(Spline));
-
- spline->from = from; spline->to = to;
- from->next = to->prev = spline;
- SplineRefigure3(spline);
-return( spline );
-}
-
-void SplinePointFree(SplinePoint *sp) {
- chunkfree(sp->hintmask,sizeof(HintMask));
- chunkfree(sp,sizeof(SplinePoint));
-}
-
-void SplinePointMDFree(SplineChar *sc, SplinePoint *sp) {
- MinimumDistance *md, *prev, *next;
-
- if ( sc!=NULL ) {
- prev = NULL;
- for ( md = sc->md; md!=NULL; md = next ) {
- next = md->next;
- if ( md->sp1==sp || md->sp2==sp ) {
- if ( prev==NULL )
- sc->md = next;
- else
- prev->next = next;
- chunkfree(md,sizeof(MinimumDistance));
- } else
- prev = md;
- }
- }
-
- chunkfree(sp->hintmask,sizeof(HintMask));
- chunkfree(sp,sizeof(SplinePoint));
-}
-
-void SplinePointsFree(SplinePointList *spl) {
- Spline *first, *spline, *next;
- int nonext;
-
- if ( spl==NULL )
-return;
- nonext = spl->first->next==NULL;
- if ( spl->first!=NULL ) {
- first = NULL;
- for ( spline = spl->first->next; spline!=NULL && spline!=first; spline = next ) {
- next = spline->to->next;
- SplinePointFree(spline->to);
- SplineFree(spline);
- if ( first==NULL ) first = spline;
- }
- if ( spl->last!=spl->first || nonext )
- SplinePointFree(spl->first);
- }
-}
-
-void SplineSetBeziersClear(SplinePointList *spl) {
- Spline *first, *spline, *next;
- int nonext;
-
- if ( spl==NULL )
-return;
- if ( spl->first!=NULL ) {
- nonext = spl->first->next==NULL;
- first = NULL;
- for ( spline = spl->first->next; spline!=NULL && spline!=first; spline = next ) {
- next = spline->to->next;
- SplinePointFree(spline->to);
- SplineFree(spline);
- if ( first==NULL ) first = spline;
- }
- if ( spl->last!=spl->first || nonext )
- SplinePointFree(spl->first);
- }
- spl->first = spl->last = NULL;
-}
-
-void SplinePointListFree(SplinePointList *spl) {
- Spline *first, *spline, *next;
- int nonext;
-
- if ( spl==NULL )
-return;
- if ( spl->first!=NULL ) {
- nonext = spl->first->next==NULL;
- first = NULL;
- for ( spline = spl->first->next; spline!=NULL && spline!=first; spline = next ) {
- next = spline->to->next;
- SplinePointFree(spline->to);
- SplineFree(spline);
- if ( first==NULL ) first = spline;
- }
- if ( spl->last!=spl->first || nonext )
- SplinePointFree(spl->first);
- }
- free(spl->contour_name);
- chunkfree(spl,sizeof(SplinePointList));
-}
-
-void SplinePointListMDFree(SplineChar *sc,SplinePointList *spl) {
- Spline *first, *spline, *next;
- int freefirst;
-
- if ( spl==NULL )
-return;
- if ( spl->first!=NULL ) {
- first = NULL;
- freefirst = ( spl->last!=spl->first || spl->first->next==NULL );
- for ( spline = spl->first->next; spline!=NULL && spline!=first; spline = next ) {
- next = spline->to->next;
- SplinePointMDFree(sc,spline->to);
- SplineFree(spline);
- if ( first==NULL ) first = spline;
- }
- if ( freefirst )
- SplinePointMDFree(sc,spl->first);
- }
- free(spl->contour_name);
- chunkfree(spl,sizeof(SplinePointList));
-}
-
-void SplinePointListsMDFree(SplineChar *sc,SplinePointList *spl) {
- SplinePointList *next;
-
- while ( spl!=NULL ) {
- next = spl->next;
- SplinePointListMDFree(sc,spl);
- spl = next;
- }
-}
-
-void SplinePointListsFree(SplinePointList *head) {
- SplinePointList *spl, *next;
-
- for ( spl=head; spl!=NULL; spl=next ) {
- next = spl->next;
- SplinePointListFree(spl);
- }
-}
-
-void ImageListsFree(ImageList *imgs) {
- ImageList *inext;
-
- while ( imgs!=NULL ) {
- inext = imgs->next;
- chunkfree(imgs,sizeof(ImageList));
- imgs = inext;
- }
-}
-
-void RefCharFree(RefChar *ref) {
- int i;
-
- if ( ref==NULL )
-return;
- for ( i=0; i<ref->layer_cnt; ++i ) {
- SplinePointListsFree(ref->layers[i].splines);
- ImageListsFree(ref->layers[i].images);
- }
- free(ref->layers);
- chunkfree(ref,sizeof(RefChar));
-}
-
-RefChar *RefCharCreate(void) {
- RefChar *ref = chunkalloc(sizeof(RefChar));
- ref->layer_cnt = 1;
- ref->layers = gcalloc(1,sizeof(struct reflayer));
- ref->round_translation_to_grid = true;
-return( ref );
-}
-
-void RefCharsFree(RefChar *ref) {
- RefChar *rnext;
-
- while ( ref!=NULL ) {
- rnext = ref->next;
- RefCharFree(ref);
- ref = rnext;
- }
-}
-
-
-typedef struct spline1 {
- Spline1D sp;
- real s0, s1;
- real c0, c1;
-} Spline1;
-
-static void FigureSpline1(Spline1 *sp1,bigreal t0, bigreal t1, Spline1D *sp ) {
- bigreal s = (t1-t0);
- if ( sp->a==0 && sp->b==0 ) {
- sp1->sp.d = sp->d + t0*sp->c;
- sp1->sp.c = s*sp->c;
- sp1->sp.b = sp1->sp.a = 0;
- } else {
- sp1->sp.d = sp->d + t0*(sp->c + t0*(sp->b + t0*sp->a));
- sp1->sp.c = s*(sp->c + t0*(2*sp->b + 3*sp->a*t0));
- sp1->sp.b = s*s*(sp->b+3*sp->a*t0);
- sp1->sp.a = s*s*s*sp->a;
-#if 0 /* Got invoked once on a perfectly good spline */
- sp1->s1 = sp1->sp.a+sp1->sp.b+sp1->sp.c+sp1->sp.d;
- if ( ((sp1->s1>.001 || sp1->s1<-.001) && !RealNear((double) sp1->sp.a+sp1->sp.b+sp1->sp.c+sp1->sp.d,sp1->s1)) ||
- !RealNear(sp1->sp.d,sp1->s0))
- IError( "Created spline does not work in FigureSpline1");
-#endif
- }
- sp1->c0 = sp1->sp.c/3 + sp1->sp.d;
- sp1->c1 = sp1->c0 + (sp1->sp.b+sp1->sp.c)/3;
-}
-
-
-static void SplineFindBounds(const Spline *sp, DBounds *bounds) {
- real t, b2_fourac, v;
- real min, max;
- const Spline1D *sp1;
- int i;
-
- /* first try the end points */
- for ( i=0; i<2; ++i ) {
- sp1 = &sp->splines[i];
- if ( i==0 ) {
- if ( sp->to->me.x<bounds->minx ) bounds->minx = sp->to->me.x;
- if ( sp->to->me.x>bounds->maxx ) bounds->maxx = sp->to->me.x;
- min = bounds->minx; max = bounds->maxx;
- } else {
- if ( sp->to->me.y<bounds->miny ) bounds->miny = sp->to->me.y;
- if ( sp->to->me.y>bounds->maxy ) bounds->maxy = sp->to->me.y;
- min = bounds->miny; max = bounds->maxy;
- }
-
- /* then try the extrema of the spline (assuming they are between t=(0,1) */
- /* (I don't bother fixing up for tiny rounding errors here. they don't matter */
- /* But we could call CheckExtremaForSingleBitErrors */
- if ( sp1->a!=0 ) {
- b2_fourac = 4*sp1->b*sp1->b - 12*sp1->a*sp1->c;
- if ( b2_fourac>=0 ) {
- b2_fourac = sqrt(b2_fourac);
- t = (-2*sp1->b + b2_fourac) / (6*sp1->a);
- if ( t>0 && t<1 ) {
- v = ((sp1->a*t+sp1->b)*t+sp1->c)*t + sp1->d;
- if ( v<min ) min = v;
- if ( v>max ) max = v;
- }
- t = (-2*sp1->b - b2_fourac) / (6*sp1->a);
- if ( t>0 && t<1 ) {
- v = ((sp1->a*t+sp1->b)*t+sp1->c)*t + sp1->d;
- if ( v<min ) min = v;
- if ( v>max ) max = v;
- }
- }
- } else if ( sp1->b!=0 ) {
- t = -sp1->c/(2.0*sp1->b);
- if ( t>0 && t<1 ) {
- v = (sp1->b*t+sp1->c)*t + sp1->d;
- if ( v<min ) min = v;
- if ( v>max ) max = v;
- }
- }
- if ( i==0 ) {
- bounds->minx = min; bounds->maxx = max;
- } else {
- bounds->miny = min; bounds->maxy = max;
- }
- }
-}
-
-static void _SplineSetFindBounds(const SplinePointList *spl, DBounds *bounds) {
- Spline *spline, *first;
- /* Ignore contours consisting of a single point (used for hinting, anchors */
- /* for mark to base, etc. */
-
- for ( ; spl!=NULL; spl = spl->next ) if ( spl->first->next!=NULL && spl->first->next->to != spl->first ) {
- first = NULL;
- if ( bounds->minx==0 && bounds->maxx==0 && bounds->miny==0 && bounds->maxy == 0 ) {
- bounds->minx = bounds->maxx = spl->first->me.x;
- bounds->miny = bounds->maxy = spl->first->me.y;
- } else {
- if ( spl->first->me.x<bounds->minx ) bounds->minx = spl->first->me.x;
- if ( spl->first->me.x>bounds->maxx ) bounds->maxx = spl->first->me.x;
- if ( spl->first->me.y<bounds->miny ) bounds->miny = spl->first->me.y;
- if ( spl->first->me.y>bounds->maxy ) bounds->maxy = spl->first->me.y;
- }
- for ( spline = spl->first->next; spline!=NULL && spline!=first; spline=spline->to->next ) {
- SplineFindBounds(spline,bounds);
- if ( first==NULL ) first = spline;
- }
- }
-}
-
-
-void SplineSetFindBounds(const SplinePointList *spl, DBounds *bounds) {
- memset(bounds,'\0',sizeof(*bounds));
- _SplineSetFindBounds(spl,bounds);
-}
-
-static void _SplineCharLayerFindBounds(SplineChar *sc,int layer, DBounds *bounds) {
- RefChar *rf;
-
- for ( rf=sc->layers[layer].refs; rf!=NULL; rf = rf->next ) {
- if ( bounds->minx==0 && bounds->maxx==0 && bounds->miny==0 && bounds->maxy == 0 )
- *bounds = rf->bb;
- else if ( rf->bb.minx!=0 || rf->bb.maxx != 0 || rf->bb.maxy != 0 || rf->bb.miny!=0 ) {
- if ( rf->bb.minx < bounds->minx ) bounds->minx = rf->bb.minx;
- if ( rf->bb.miny < bounds->miny ) bounds->miny = rf->bb.miny;
- if ( rf->bb.maxx > bounds->maxx ) bounds->maxx = rf->bb.maxx;
- if ( rf->bb.maxy > bounds->maxy ) bounds->maxy = rf->bb.maxy;
- }
- }
- _SplineSetFindBounds(sc->layers[layer].splines,bounds);
-
- if ( sc->parent!=NULL && sc->parent->strokedfont &&
- (bounds->minx!=bounds->maxx || bounds->miny!=bounds->maxy)) {
- real sw = sc->parent->strokewidth;
- bounds->minx -= sw; bounds->miny -= sw;
- bounds->maxx += sw; bounds->maxy += sw;
- }
-}
-
-void SplineCharLayerFindBounds(SplineChar *sc,int layer,DBounds *bounds) {
-
- if ( sc->parent!=NULL && sc->parent->multilayer ) {
- SplineCharFindBounds(sc,bounds);
-return;
- }
-
- /* a char with no splines (ie. a space) must have an lbearing of 0 */
- bounds->minx = bounds->maxx = 0;
- bounds->miny = bounds->maxy = 0;
-
- _SplineCharLayerFindBounds(sc,layer,bounds);
-}
-
-void SplineCharFindBounds(SplineChar *sc,DBounds *bounds) {
- int i;
- int first,last;
-
- /* a char with no splines (ie. a space) must have an lbearing of 0 */
- bounds->minx = bounds->maxx = 0;
- bounds->miny = bounds->maxy = 0;
-
- first = last = ly_fore;
- if ( sc->parent!=NULL && sc->parent->multilayer )
- last = sc->layer_cnt-1;
- for ( i=first; i<=last; ++i )
- _SplineCharLayerFindBounds(sc,i,bounds);
-}
-
-void SplineFontLayerFindBounds(SplineFont *sf,int layer,DBounds *bounds) {
- int i, k, first, last;
- (void)layer;
- if ( sf->multilayer ) {
- SplineFontFindBounds(sf,bounds);
-return;
- }
-
- bounds->minx = bounds->maxx = 0;
- bounds->miny = bounds->maxy = 0;
-
- for ( i = 0; i<sf->glyphcnt; ++i ) {
- SplineChar *sc = sf->glyphs[i];
- if ( sc!=NULL ) {
- first = last = ly_fore;
- if ( sc->parent != NULL && sc->parent->multilayer )
- last = sc->layer_cnt-1;
- for ( k=first; k<=last; ++k )
- _SplineCharLayerFindBounds(sc,k,bounds);
- }
- }
-}
-
-void SplineFontFindBounds(SplineFont *sf,DBounds *bounds) {
- int i, k, first, last;
-
- bounds->minx = bounds->maxx = 0;
- bounds->miny = bounds->maxy = 0;
-
- for ( i = 0; i<sf->glyphcnt; ++i ) {
- SplineChar *sc = sf->glyphs[i];
- if ( sc!=NULL ) {
- first = last = ly_fore;
- if ( sf->multilayer )
- last = sc->layer_cnt-1;
- for ( k=first; k<=last; ++k )
- _SplineCharLayerFindBounds(sc,k,bounds);
- }
- }
-}
-
-void CIDLayerFindBounds(SplineFont *cidmaster,int layer,DBounds *bounds) {
- SplineFont *sf;
- int i;
- DBounds b;
- real factor;
-
- if ( cidmaster->cidmaster )
- cidmaster = cidmaster->cidmaster;
- if ( cidmaster->subfonts==NULL ) {
- SplineFontLayerFindBounds(cidmaster,layer,bounds);
-return;
- }
-
- sf = cidmaster->subfonts[0];
- SplineFontLayerFindBounds(sf,layer,bounds);
- factor = 1000.0/(sf->ascent+sf->descent);
- bounds->maxx *= factor; bounds->minx *= factor; bounds->miny *= factor; bounds->maxy *= factor;
- for ( i=1; i<cidmaster->subfontcnt; ++i ) {
- sf = cidmaster->subfonts[i];
- SplineFontLayerFindBounds(sf,layer,&b);
- factor = 1000.0/(sf->ascent+sf->descent);
- b.maxx *= factor; b.minx *= factor; b.miny *= factor; b.maxy *= factor;
- if ( b.maxx>bounds->maxx ) bounds->maxx = b.maxx;
- if ( b.maxy>bounds->maxy ) bounds->maxy = b.maxy;
- if ( b.miny<bounds->miny ) bounds->miny = b.miny;
- if ( b.minx<bounds->minx ) bounds->minx = b.minx;
- }
-}
-
-static void _SplineSetFindTop(SplineSet *ss,BasePoint *top) {
- SplinePoint *sp;
-
- for ( ; ss!=NULL; ss=ss->next ) {
- for ( sp=ss->first; ; ) {
- if ( sp->me.y > top->y ) *top = sp->me;
- if ( sp->next==NULL )
- break;
- sp = sp->next->to;
- if ( sp==ss->first )
- break;
- }
- }
-}
-
-static void SplineSetFindTop(SplineSet *ss,BasePoint *top) {
-
- top->y = -1e10;
- _SplineSetFindTop(ss,top);
- if ( top->y < -65536 ) top->y = top->x = 0;
-}
-
-void SplineSetQuickBounds(SplineSet *ss,DBounds *b) {
- SplinePoint *sp;
-
- b->minx = b->miny = 1e10;
- b->maxx = b->maxy = -1e10;
- for ( ; ss!=NULL; ss=ss->next ) {
- for ( sp=ss->first; ; ) {
- if ( sp->me.y < b->miny ) b->miny = sp->me.y;
- if ( sp->me.x < b->minx ) b->minx = sp->me.x;
- if ( sp->me.y > b->maxy ) b->maxy = sp->me.y;
- if ( sp->me.x > b->maxx ) b->maxx = sp->me.x;
- if ( sp->next==NULL )
- break;
- sp = sp->next->to;
- if ( sp==ss->first )
- break;
- }
- }
- if ( b->minx>65536 ) b->minx = 0;
- if ( b->miny>65536 ) b->miny = 0;
- if ( b->maxx<-65536 ) b->maxx = 0;
- if ( b->maxy<-65536 ) b->maxy = 0;
-}
-
-void SplineCharQuickBounds(SplineChar *sc, DBounds *b) {
- RefChar *ref;
- int i,first, last;
- DBounds temp;
-
- memset(b,0,sizeof(*b));
- first = last = ly_fore;
- if ( sc->parent!=NULL && sc->parent->multilayer )
- last = sc->layer_cnt-1;
- for ( i=first; i<=last; ++i ) {
- SplineSetQuickBounds(sc->layers[i].splines,&temp);
- if ( temp.minx!=0 || temp.maxx != 0 || temp.maxy != 0 || temp.miny!=0 ) {
- if ( temp.minx < b->minx ) b->minx = temp.minx;
- if ( temp.miny < b->miny ) b->miny = temp.miny;
- if ( temp.maxx > b->maxx ) b->maxx = temp.maxx;
- if ( temp.maxy > b->maxy ) b->maxy = temp.maxy;
- }
- for ( ref = sc->layers[i].refs; ref!=NULL; ref = ref->next ) {
- /*SplineSetQuickBounds(ref->layers[0].splines,&temp);*/
- if ( b->minx==0 && b->maxx==0 && b->miny==0 && b->maxy == 0 )
- *b = ref->bb;
- else if ( ref->bb.minx!=0 || ref->bb.maxx != 0 || ref->bb.maxy != 0 || ref->bb.miny!=0 ) {
- if ( ref->bb.minx < b->minx ) b->minx = ref->bb.minx;
- if ( ref->bb.miny < b->miny ) b->miny = ref->bb.miny;
- if ( ref->bb.maxx > b->maxx ) b->maxx = ref->bb.maxx;
- if ( ref->bb.maxy > b->maxy ) b->maxy = ref->bb.maxy;
- }
- }
- }
- if ( sc->parent!=NULL && sc->parent->strokedfont &&
- (b->minx!=b->maxx || b->miny!=b->maxy)) {
- real sw = sc->parent->strokewidth;
- b->minx -= sw; b->miny -= sw;
- b->maxx += sw; b->maxy += sw;
- }
-}
-
-void SplineSetQuickConservativeBounds(SplineSet *ss,DBounds *b) {
- SplinePoint *sp;
-
- b->minx = b->miny = 1e10;
- b->maxx = b->maxy = -1e10;
- for ( ; ss!=NULL; ss=ss->next ) {
- for ( sp=ss->first; ; ) {
- if ( sp->me.y < b->miny ) b->miny = sp->me.y;
- if ( sp->me.x < b->minx ) b->minx = sp->me.x;
- if ( sp->me.y > b->maxy ) b->maxy = sp->me.y;
- if ( sp->me.x > b->maxx ) b->maxx = sp->me.x;
- if ( sp->nextcp.y < b->miny ) b->miny = sp->nextcp.y;
- if ( sp->nextcp.x < b->minx ) b->minx = sp->nextcp.x;
- if ( sp->nextcp.y > b->maxy ) b->maxy = sp->nextcp.y;
- if ( sp->nextcp.x > b->maxx ) b->maxx = sp->nextcp.x;
- if ( sp->prevcp.y < b->miny ) b->miny = sp->prevcp.y;
- if ( sp->prevcp.x < b->minx ) b->minx = sp->prevcp.x;
- if ( sp->prevcp.y > b->maxy ) b->maxy = sp->prevcp.y;
- if ( sp->prevcp.x > b->maxx ) b->maxx = sp->prevcp.x;
- if ( sp->next==NULL )
- break;
- sp = sp->next->to;
- if ( sp==ss->first )
- break;
- }
- }
- if ( b->minx>65536 ) b->minx = 0;
- if ( b->miny>65536 ) b->miny = 0;
- if ( b->maxx<-65536 ) b->maxx = 0;
- if ( b->maxy<-65536 ) b->maxy = 0;
-}
-
-void SplineCharQuickConservativeBounds(SplineChar *sc, DBounds *b) {
- RefChar *ref;
- int i, first,last;
- DBounds temp;
-
- memset(b,0,sizeof(*b));
- first = last = ly_fore;
- if ( sc->parent!=NULL && sc->parent->multilayer )
- last = sc->layer_cnt-1;
- for ( i=first; i<=last; ++i ) {
- SplineSetQuickConservativeBounds(sc->layers[i].splines,&temp);
- if ( temp.minx!=0 || temp.maxx != 0 || temp.maxy != 0 || temp.miny!=0 ) {
- if ( temp.minx < b->minx ) b->minx = temp.minx;
- if ( temp.miny < b->miny ) b->miny = temp.miny;
- if ( temp.maxx > b->maxx ) b->maxx = temp.maxx;
- if ( temp.maxy > b->maxy ) b->maxy = temp.maxy;
- }
- for ( ref = sc->layers[i].refs; ref!=NULL; ref = ref->next ) {
- /*SplineSetQuickConservativeBounds(ref->layers[0].splines,&temp);*/
- if ( b->minx==0 && b->maxx==0 && b->miny==0 && b->maxy == 0 )
- *b = ref->bb;
- else if ( ref->bb.minx!=0 || ref->bb.maxx != 0 || ref->bb.maxy != 0 || ref->bb.miny!=0 ) {
- if ( ref->bb.minx < b->minx ) b->minx = ref->bb.minx;
- if ( ref->bb.miny < b->miny ) b->miny = ref->bb.miny;
- if ( ref->bb.maxx > b->maxx ) b->maxx = ref->bb.maxx;
- if ( ref->bb.maxy > b->maxy ) b->maxy = ref->bb.maxy;
- }
- }
- }
- if ( sc->parent->strokedfont && (b->minx!=b->maxx || b->miny!=b->maxy)) {
- real sw = sc->parent->strokewidth;
- b->minx -= sw; b->miny -= sw;
- b->maxx += sw; b->maxy += sw;
- }
-}
-
-void SplineFontQuickConservativeBounds(SplineFont *sf,DBounds *b) {
- DBounds bb;
- int i;
-
- b->minx = b->miny = 1e10;
- b->maxx = b->maxy = -1e10;
- for ( i=0; i<sf->glyphcnt; ++i ) if ( sf->glyphs[i]!=NULL ) {
- SplineCharQuickConservativeBounds(sf->glyphs[i],&bb);
- if ( bb.minx < b->minx ) b->minx = bb.minx;
- if ( bb.miny < b->miny ) b->miny = bb.miny;
- if ( bb.maxx > b->maxx ) b->maxx = bb.maxx;
- if ( bb.maxy > b->maxy ) b->maxy = bb.maxy;
- }
- if ( b->minx>65536 ) b->minx = 0;
- if ( b->miny>65536 ) b->miny = 0;
- if ( b->maxx<-65536 ) b->maxx = 0;
- if ( b->maxy<-65536 ) b->maxy = 0;
-}
-
-void SplinePointCatagorize(SplinePoint *sp) {
- int oldpointtype = sp->pointtype;
-
- sp->pointtype = pt_corner;
- if ( sp->next==NULL && sp->prev==NULL )
- ;
- else if ( (sp->next!=NULL && sp->next->to->me.x==sp->me.x && sp->next->to->me.y==sp->me.y) ||
- (sp->prev!=NULL && sp->prev->from->me.x==sp->me.x && sp->prev->from->me.y==sp->me.y ))
- ;
- else if ( sp->next==NULL ) {
- sp->pointtype = sp->noprevcp ? pt_corner : pt_curve;
- } else if ( sp->prev==NULL ) {
- sp->pointtype = sp->nonextcp ? pt_corner : pt_curve;
- } else if ( sp->nonextcp && sp->noprevcp ) {
- ;
- } else {
- BasePoint ndir, ncdir, ncunit, pdir, pcdir, pcunit;
- double nlen, nclen, plen, pclen;
- double dot;
-
- ncdir.x = sp->nextcp.x - sp->me.x; ncdir.y = sp->nextcp.y - sp->me.y;
- pcdir.x = sp->prevcp.x - sp->me.x; pcdir.y = sp->prevcp.y - sp->me.y;
- ndir.x = ndir.y = pdir.x = pdir.y = 0;
- if ( sp->next!=NULL ) {
- ndir.x = sp->next->to->me.x - sp->me.x; ndir.y = sp->next->to->me.y - sp->me.y;
- }
- if ( sp->prev!=NULL ) {
- pdir.x = sp->prev->from->me.x - sp->me.x; pdir.y = sp->prev->from->me.y - sp->me.y;
- }
- nclen = sqrt(ncdir.x*ncdir.x + ncdir.y*ncdir.y);
- pclen = sqrt(pcdir.x*pcdir.x + pcdir.y*pcdir.y);
- nlen = sqrt(ndir.x*ndir.x + ndir.y*ndir.y);
- plen = sqrt(pdir.x*pdir.x + pdir.y*pdir.y);
- ncunit = ncdir; pcunit = pcdir;
- if ( nclen!=0 ) { ncunit.x /= nclen; ncunit.y /= nclen; }
- if ( pclen!=0 ) { pcunit.x /= pclen; pcunit.y /= pclen; }
- if ( nlen!=0 ) { ndir.x /= nlen; ndir.y /= nlen; }
- if ( plen!=0 ) { pdir.x /= plen; pdir.y /= plen; }
-
- /* find out which side has the shorter control vector. Dot that vector */
- /* with the normal of the unit vector on the other side. If the */
- /* result is less than 1 em-unit then we've got colinear control points */
- /* (within the resolution of the integer grid) */
- if ( nclen!=0 && pclen!=0 &&
- ((nclen>=pclen && (dot = pcdir.x*ncunit.y - pcdir.y*ncunit.x)<1.0 && dot>-1.0 ) ||
- (pclen>nclen && (dot = ncdir.x*pcunit.y - ncdir.y*pcunit.x)<1.0 && dot>-1.0 )))
- sp->pointtype = pt_curve;
- /* Dot product of control point with unit vector normal to line in */
- /* opposite direction should be less than an em-unit for a tangent */
- else if (( nclen==0 && pclen!=0 && (dot = pcdir.x*ndir.y-pcdir.y*ndir.x)<1.0 && dot>-1.0 ) ||
- ( pclen==0 && nclen!=0 && (dot = ncdir.x*pdir.y-ncdir.y*pdir.x)<1.0 && dot>-1.0 ))
- sp->pointtype = pt_tangent;
-
- /* If a point started out hv, and could still be hv, them make it so */
- /* but don't make hv points de novo, Alexey doesn't like change */
- /* (this only works because hv isn't a default setting, so if it's */
- /* there it was done intentionally) */
- if ( sp->pointtype == pt_curve && oldpointtype == pt_hvcurve &&
- ((sp->nextcp.x==sp->me.x && sp->prevcp.x==sp->me.x && sp->nextcp.y!=sp->me.y) ||
- (sp->nextcp.y==sp->me.y && sp->prevcp.y==sp->me.y && sp->nextcp.x!=sp->me.x)))
- sp->pointtype = pt_hvcurve;
- }
-}
-
-int SplinePointIsACorner(SplinePoint *sp) {
- enum pointtype old = sp->pointtype, new;
-
- SplinePointCatagorize(sp);
- new = sp->pointtype;
- sp->pointtype = old;
-return( new==pt_corner );
-}
-
-void SPLCatagorizePoints(SplinePointList *spl) {
- Spline *spline, *first, *last=NULL;
-
- for ( ; spl!=NULL; spl = spl->next ) {
- first = NULL;
- for ( spline = spl->first->next; spline!=NULL && spline!=first; spline=spline->to->next ) {
- SplinePointCatagorize(spline->from);
- last = spline;
- if ( first==NULL ) first = spline;
- }
- if ( spline==NULL && last!=NULL )
- SplinePointCatagorize(last->to);
- }
-}
-
-void SCCatagorizePoints(SplineChar *sc) {
- SPLCatagorizePoints(sc->layers[ly_fore].splines);
-}
-
-static int CharsNotInEncoding(FontDict *fd) {
- int i, cnt, j;
-
- for ( i=cnt=0; i<fd->chars->cnt; ++i ) {
- if ( fd->chars->keys[i]!=NULL ) {
- for ( j=0; j<256; ++j )
- if ( fd->encoding[j]!=NULL &&
- strcmp(fd->encoding[j],fd->chars->keys[i])==0 )
- break;
- if ( j==256 )
- ++cnt;
- }
- }
- /* And for type 3 fonts... */
- if ( fd->charprocs!=NULL ) for ( i=0; i<fd->charprocs->cnt; ++i ) {
- if ( fd->charprocs->keys[i]!=NULL ) {
- for ( j=0; j<256; ++j )
- if ( fd->encoding[j]!=NULL &&
- strcmp(fd->encoding[j],fd->charprocs->keys[i])==0 )
- break;
- if ( j==256 )
- ++cnt;
- }
- }
-return( cnt );
-}
-
-static int LookupCharString(char *encname,struct pschars *chars) {
- int k;
-
- if ( encname==NULL ) encname = ".notdef"; /* In case of an incomplete encoding array */
-
- for ( k=0; k<chars->cnt; ++k ) {
- if ( chars->keys[k]!=NULL )
- if ( strcmp(encname,chars->keys[k])==0 )
-return( k );
- }
-return( -1 );
-}
-
-SplinePointList *SplinePointListCopy1(const SplinePointList *spl) {
- SplinePointList *cur;
- const SplinePoint *pt; SplinePoint *cpt;
- Spline *spline;
-
- cur = chunkalloc(sizeof(SplinePointList));
- cur->is_clip_path = spl->is_clip_path;
-
- for ( pt=spl->first; ; ) {
- cpt = chunkalloc(sizeof(SplinePoint));
- *cpt = *pt;
- if ( pt->hintmask!=NULL ) {
- cpt->hintmask = chunkalloc(sizeof(HintMask));
- memcpy(cpt->hintmask,pt->hintmask,sizeof(HintMask));
- }
- cpt->next = cpt->prev = NULL;
- if ( cur->first==NULL )
- cur->first = cur->last = cpt;
- else {
- spline = chunkalloc(sizeof(Spline));
- *spline = *pt->prev;
- spline->from = cur->last;
- cur->last->next = spline;
- cpt->prev = spline;
- spline->to = cpt;
- spline->approx = NULL;
- cur->last = cpt;
- }
- if ( pt->next==NULL )
- break;
- pt = pt->next->to;
- if ( pt==spl->first )
- break;
- }
- if ( spl->first->prev!=NULL ) {
- cpt = cur->first;
- spline = chunkalloc(sizeof(Spline));
- *spline = *pt->prev;
- spline->from = cur->last;
- cur->last->next = spline;
- cpt->prev = spline;
- spline->to = cpt;
- spline->approx = NULL;
- cur->last = cpt;
- }
-return( cur );
-}
-
-/* If this routine is called we are guarenteed that:
- at least one point on the splineset is selected
- not all points on the splineset are selected
-*/
-static SplinePointList *SplinePointListCopySelected1(SplinePointList *spl) {
- SplinePointList *head=NULL, *last=NULL, *cur;
- SplinePoint *cpt, *first, *start;
- Spline *spline;
-
- start = spl->first;
- if ( spl->first==spl->last ) {
- /* If it's a closed contour and the start point is selected then we */
- /* don't know where that selection began (and we have to keep it with */
- /* the things that precede it when we make the new splinesets), so */
- /* loop until we find something unselected */
- while ( start->selected )
- start = start->next->to;
- }
- first = NULL;
- while ( start != NULL && start!=first ) {
- while ( start!=NULL && start!=first && !start->selected ) {
- if ( first==NULL ) first = start;
- if ( start->next==NULL ) {
- start = NULL;
- break;
- }
- start = start->next->to;
- }
- if ( start==NULL || start==first )
- break;
- cur = chunkalloc(sizeof(SplinePointList));
- if ( head==NULL )
- head = cur;
- else
- last->next = cur;
- last = cur;
-
- while ( start!=NULL && start->selected && start!=first ) {
- cpt = chunkalloc(sizeof(SplinePoint));
- *cpt = *start;
- cpt->hintmask = NULL;
- cpt->next = cpt->prev = NULL;
- if ( cur->first==NULL )
- cur->first = cur->last = cpt;
- else {
- spline = chunkalloc(sizeof(Spline));
- *spline = *start->prev;
- spline->from = cur->last;
- cur->last->next = spline;
- cpt->prev = spline;
- spline->to = cpt;
- spline->approx = NULL;
- cur->last = cpt;
- }
- if ( first==NULL ) first = start;
- if ( start->next==NULL ) {
- start = NULL;
- break;
- }
- start = start->next->to;
- }
- }
-return( head );
-}
-
-
-SplinePointList *SplinePointListCopy(const SplinePointList *base) {
- SplinePointList *head=NULL, *last=NULL, *cur;
-
- for ( ; base!=NULL; base = base->next ) {
- cur = SplinePointListCopy1(base);
- if ( head==NULL )
- head = cur;
- else
- last->next = cur;
- last = cur;
- }
-return( head );
-}
-
-SplinePointList *SplinePointListCopySelected(SplinePointList *base) {
- SplinePointList *head=NULL, *last=NULL, *cur=NULL;
- SplinePoint *pt, *first;
- int anysel, allsel;
-
- for ( ; base!=NULL; base = base->next ) {
- anysel = false; allsel = true;
- first = NULL;
- for ( pt=base->first; pt!=NULL && pt!=first; pt = pt->next->to ) {
- if ( pt->selected ) anysel = true;
- else allsel = false;
- if ( first==NULL ) first = pt;
- if ( pt->next==NULL )
- break;
- }
- if ( allsel )
- cur = SplinePointListCopy1(base);
- else if ( anysel )
- cur = SplinePointListCopySelected1(base);
- if ( anysel ) {
- if ( head==NULL )
- head = cur;
- else
- last->next = cur;
- for ( last = cur; last->next ; last = last->next );
- }
- }
-return( head );
-}
-
-
-
-static SplinePointList *SplinePointListSplit(SplineChar *sc,SplinePointList *spl) {
- SplinePointList *head=NULL, *last=NULL, *cur;
- SplinePoint *first, *start, *next;
-
- start = spl->first;
- if ( spl->first==spl->last ) {
- /* If it's a closed contour and the start point is selected then we */
- /* don't know where that selection began (and we have to keep it with */
- /* the things that precede it when we make the new splinesets), so */
- /* loop until we find something unselected */
- while ( !start->selected )
- start = start->next->to;
- }
- first = NULL;
- while ( start != NULL && start!=first ) {
- while ( start!=NULL && start!=first && start->selected ) {
- if ( first==NULL ) first = start;
- if ( start->prev!=NULL ) {
- start->prev->from->next = NULL;
- SplineFree(start->prev);
- }
- if ( start->next!=NULL ) {
- next = start->next->to;
- next->prev = NULL;
- SplineFree(start->next);
- } else
- next = NULL;
- SplinePointMDFree(sc,start);
- start = next;
- }
- if ( start==NULL || start==first )
- break;
- if ( head==NULL ) {
- head = cur = spl;
- spl->first = spl->last = NULL;
- } else {
- cur = chunkalloc(sizeof(SplinePointList));
- last->next = cur;
- }
- last = cur;
-
- while ( start!=NULL && !start->selected && start!=first ) {
- if ( cur->first==NULL )
- cur->first = start;
- cur->last = start;
- if ( start->next!=NULL ) {
- next = start->next->to;
- if ( next->selected ) {
- SplineFree(start->next);
- start->next = NULL;
- next->prev = NULL;
- }
- } else
- next = NULL;
- if ( first==NULL ) first = start;
- start = next;
- }
- }
-return( last );
-}
-
-SplinePointList *SplinePointListRemoveSelected(SplineChar *sc,SplinePointList *base) {
- SplinePointList *head=NULL, *last=NULL, *next;
- SplinePoint *pt, *first;
- int anysel, allsel;
-
- for ( ; base!=NULL; base = next ) {
- next = base->next;
- anysel = false; allsel = true;
- first = NULL;
- for ( pt=base->first; pt!=NULL && pt!=first; pt = pt->next->to ) {
- if ( pt->selected ) anysel = true;
- else allsel = false;
- if ( first==NULL ) first = pt;
- if ( pt->next==NULL )
- break;
- }
- if ( allsel ) {
- SplinePointListMDFree(sc,base);
- continue;
- }
- if ( !anysel ) {
- if ( head==NULL )
- head = base;
- else
- last->next = base;
- last = base;
- if ( anysel )
- last = SplinePointListSplit(sc,base);
- }
- }
- if ( last!=NULL ) last->next = NULL;
-return( head );
-}
-
-ImageList *ImageListCopy(ImageList *cimg) {
- ImageList *head=NULL, *last=NULL, *new;
-
- for ( ; cimg!=NULL; cimg=cimg->next ) {
- new = chunkalloc(sizeof(ImageList));
- *new = *cimg;
- new->next = NULL;
- if ( last==NULL )
- head = last = new;
- else {
- last->next = new;
- last = new;
- }
- }
-return( head );
-}
-
-
-void ApTransform(AnchorPoint *ap, real transform[6]) {
- BasePoint p;
- p.x = transform[0]*ap->me.x + transform[2]*ap->me.y + transform[4];
- p.y = transform[1]*ap->me.x + transform[3]*ap->me.y + transform[5];
- ap->me.x = rint(1024*p.x)/1024;
- ap->me.y = rint(1024*p.y)/1024;
-}
-
-static void TransformPoint(SplinePoint *sp, real transform[6]) {
- BasePoint p;
- p.x = transform[0]*sp->me.x + transform[2]*sp->me.y + transform[4];
- p.y = transform[1]*sp->me.x + transform[3]*sp->me.y + transform[5];
- p.x = rint(1024*p.x)/1024;
- p.y = rint(1024*p.y)/1024;
- sp->me = p;
- if ( !sp->nonextcp ) {
- p.x = transform[0]*sp->nextcp.x + transform[2]*sp->nextcp.y + transform[4];
- p.y = transform[1]*sp->nextcp.x + transform[3]*sp->nextcp.y + transform[5];
- p.x = rint(1024*p.x)/1024;
- p.y = rint(1024*p.y)/1024;
- sp->nextcp = p;
- } else
- sp->nextcp = sp->me;
- if ( !sp->noprevcp ) {
- p.x = transform[0]*sp->prevcp.x + transform[2]*sp->prevcp.y + transform[4];
- p.y = transform[1]*sp->prevcp.x + transform[3]*sp->prevcp.y + transform[5];
- p.x = rint(1024*p.x)/1024;
- p.y = rint(1024*p.y)/1024;
- sp->prevcp = p;
- } else
- sp->prevcp = sp->me;
- if ( sp->pointtype == pt_hvcurve ) {
- if (
- ((sp->nextcp.x==sp->me.x && sp->prevcp.x==sp->me.x && sp->nextcp.y!=sp->me.y) ||
- (sp->nextcp.y==sp->me.y && sp->prevcp.y==sp->me.y && sp->nextcp.x!=sp->me.x)))
- /* Do Nothing */;
- else
- sp->pointtype = pt_curve;
- }
-}
-
-SplinePointList *SplinePointListTransform(SplinePointList *base, real transform[6], int allpoints ) {
- Spline *spline, *first;
- SplinePointList *spl;
- SplinePoint *spt, *pfirst;
- int allsel, anysel, alldone=true;
-
- for ( spl = base; spl!=NULL; spl = spl->next ) {
- pfirst = NULL;
- allsel = true; anysel=false;
- for ( spt = spl->first ; spt!=pfirst; spt = spt->next->to ) {
- if ( pfirst==NULL ) pfirst = spt;
- if ( allpoints || spt->selected ) {
- TransformPoint(spt,transform);
- if ( !allpoints ) {
- if ( spt->next!=NULL && spt->next->order2 && !spt->next->to->selected && spt->next->to->ttfindex==0xffff ) {
- SplinePoint *to = spt->next->to;
- to->prevcp = spt->nextcp;
- to->me.x = (to->prevcp.x+to->nextcp.x)/2;
- to->me.y = (to->prevcp.y+to->nextcp.y)/2;
- }
- if ( spt->prev!=NULL && spt->prev->order2 && !spt->prev->from->selected && spt->prev->from->ttfindex==0xffff ) {
- SplinePoint *from = spt->prev->from;
- from->nextcp = spt->prevcp;
- from->me.x = (from->prevcp.x+from->nextcp.x)/2;
- from->me.y = (from->prevcp.y+from->nextcp.y)/2;
- }
- }
- anysel = true;
- } else
- allsel = alldone = false;
- if ( spt->next==NULL )
- break;
- }
- if ( !anysel ) /* This splineset had no selected points it's unchanged */
- continue;
-
- /* if we changed all the points then the control points are right */
- /* otherwise those near the edges may be wonky, fix 'em up */
- /* Figuring out where the edges of the selection are is difficult */
- /* so let's just tweak all points, it shouldn't matter */
- /* It does matter. Let's tweak all default points */
- if ( !allpoints && !allsel && spl->first->next!=NULL && !spl->first->next->order2 ) {
- pfirst = NULL;
- for ( spt = spl->first ; spt!=pfirst; spt = spt->next->to ) {
- if ( pfirst==NULL ) pfirst = spt;
- if ( spt->selected && spt->prev!=NULL && !spt->prev->from->selected &&
- spt->prev->from->pointtype == pt_tangent )
- SplineCharTangentPrevCP(spt->prev->from);
- if ( spt->selected && spt->next!=NULL && !spt->next->to->selected &&
- spt->next->to->pointtype == pt_tangent )
- SplineCharTangentNextCP(spt->next->to);
- if ( spt->prev!=NULL && spt->prevcpdef )
- SplineCharDefaultPrevCP(spt);
- if ( spt->next==NULL )
- break;
- if ( spt->nextcpdef )
- SplineCharDefaultNextCP(spt);
- }
- }
- first = NULL;
- for ( spline = spl->first->next; spline!=NULL && spline!=first; spline=spline->to->next ) {
- if ( !alldone ) SplineRefigureFixup(spline); else SplineRefigure(spline);
- if ( first==NULL ) first = spline;
- }
- }
-return( base );
-}
-
-
-SplinePointList *SplinePointListShift(SplinePointList *base,real xoff,int allpoints ) {
- real transform[6];
- if ( xoff==0 )
-return( base );
- transform[0] = transform[3] = 1;
- transform[1] = transform[2] = transform[5] = 0;
- transform[4] = xoff;
-return( SplinePointListTransform(base,transform,allpoints));
-}
-
-HintMask *HintMaskFromTransformedRef(RefChar *ref,BasePoint *trans,
- SplineChar *basesc,HintMask *hm) {
- StemInfo *st, *st2;
- int hst_cnt, bcnt;
- real start, width;
- int i;
-
- if ( ref->transform[1]!=0 || ref->transform[2]!=0 )
-return(NULL);
-
- memset(hm,0,sizeof(HintMask));
- for ( st = ref->sc->hstem; st!=NULL; st=st->next ) {
- start = st->start*ref->transform[3] + ref->transform[5] + trans->y;
- width = st->width*ref->transform[3];
- for ( st2=basesc->hstem,bcnt=0; st2!=NULL; st2=st2->next, bcnt++ )
- if ( st2->start == start && st2->width == width )
- break;
- if ( st2!=NULL )
- (*hm)[bcnt>>3] |= (0x80>>(bcnt&7));
- }
- for ( st2=basesc->hstem,hst_cnt=0; st2!=NULL; st2=st2->next, hst_cnt++ );
-
- for ( st = ref->sc->vstem; st!=NULL; st=st->next ) {
- start = st->start*ref->transform[0] + ref->transform[4] + trans->x;
- width = st->width*ref->transform[0];
- for ( st2=basesc->vstem,bcnt=hst_cnt; st2!=NULL; st2=st2->next, bcnt++ )
- if ( st2->start == start && st2->width == width )
- break;
- if ( st2!=NULL )
- (*hm)[bcnt>>3] |= (0x80>>(bcnt&7));
- }
- for ( i=0; i<HntMax/8; ++i )
- if ( (*hm)[i]!=0 )
-return( hm );
-
-return( NULL );
-}
-
-static HintMask *HintMaskTransform(HintMask *oldhm,real transform[6],
- SplineChar *basesc,SplineChar *subsc) {
- HintMask *newhm;
- StemInfo *st, *st2;
- int cnt, hst_cnt, bcnt;
- real start, width;
-
- if ( transform[1]!=0 || transform[2]!=0 )
-return( NULL );
-
- newhm = chunkalloc(sizeof(HintMask));
- for ( st = subsc->hstem,cnt = 0; st!=NULL; st=st->next, cnt++ ) {
- if ( (*oldhm)[cnt>>3]&(0x80>>(cnt&7)) ) {
- start = st->start*transform[3] + transform[5];
- width = st->width*transform[3];
- for ( st2=basesc->hstem,bcnt=0; st2!=NULL; st2=st2->next, bcnt++ )
- if ( st2->start == start && st2->width == width )
- break;
- if ( st2!=NULL )
- (*newhm)[bcnt>>3] |= (0x80>>(bcnt&7));
- }
- }
- for ( st2=basesc->hstem,hst_cnt=0; st2!=NULL; st2=st2->next, hst_cnt++ );
-
- for ( st = subsc->vstem; st!=NULL; st=st->next, cnt++ ) {
- if ( (*oldhm)[cnt>>3]&(0x80>>(cnt&7)) ) {
- start = st->start*transform[0] + transform[4];
- width = st->width*transform[0];
- for ( st2=basesc->vstem,bcnt=hst_cnt; st2!=NULL; st2=st2->next, bcnt++ )
- if ( st2->start == start && st2->width == width )
- break;
- if ( st2!=NULL )
- (*newhm)[bcnt>>3] |= (0x80>>(bcnt&7));
- }
- }
-return( newhm );
-}
-
-SplinePointList *SPLCopyTranslatedHintMasks(SplinePointList *base,
- SplineChar *basesc, SplineChar *subsc, BasePoint *trans ) {
- SplinePointList *spl, *spl2, *head;
- SplinePoint *spt, *spt2, *pfirst;
- real transform[6];
- Spline *s, *first;
-
- head = SplinePointListCopy(base);
-
- transform[0] = transform[3] = 1; transform[1] = transform[2] = 0;
- transform[4] = trans->x; transform[5] = trans->y;
-
- for ( spl = head, spl2=base; spl!=NULL; spl = spl->next, spl2 = spl2->next ) {
- pfirst = NULL;
- for ( spt = spl->first, spt2 = spl2->first ; spt!=pfirst; spt = spt->next->to, spt2 = spt2->next->to ) {
- if ( pfirst==NULL ) pfirst = spt;
- TransformPoint(spt,transform);
- if ( spt2->hintmask ) {
- chunkfree(spt->hintmask,sizeof(HintMask));
- spt->hintmask = HintMaskTransform(spt2->hintmask,transform,basesc,subsc);
- }
- if ( spt->next==NULL )
- break;
- }
- first = NULL;
- for ( s = spl->first->next; s!=NULL && s!=first; s=s->to->next ) {
- SplineRefigure(s);
- if ( first==NULL ) first = s;
- }
- }
-return( head );
-}
-
-static SplinePointList *_SPLCopyTransformedHintMasks(SplineChar *subsc,int layer,
- real transform[6], SplineChar *basesc ) {
- SplinePointList *spl, *spl2, *head, *last=NULL, *cur, *base;
- SplinePoint *spt, *spt2, *pfirst;
- Spline *s, *first;
- real trans[6];
- RefChar *rf;
-
- base = subsc->layers[layer].splines;
- head = SplinePointListCopy(base);
- if ( head!=NULL )
- for ( last = head; last->next!=NULL; last=last->next );
-
- for ( spl = head, spl2=base; spl!=NULL; spl = spl->next, spl2=spl2->next ) {
- pfirst = NULL;
- for ( spt = spl->first, spt2 = spl2->first ; spt!=pfirst; spt = spt->next->to, spt2 = spt2->next->to ) {
- if ( pfirst==NULL ) pfirst = spt;
- TransformPoint(spt,transform);
- if ( spt2->hintmask ) {
- chunkfree(spt->hintmask,sizeof(HintMask));
- spt->hintmask = HintMaskTransform(spt2->hintmask,transform,basesc,subsc);
- }
- if ( spt->next==NULL )
- break;
- }
- first = NULL;
- for ( s = spl->first->next; s!=NULL && s!=first; s=s->to->next ) {
- SplineRefigure(s);
- if ( first==NULL ) first = s;
- }
- }
- for ( rf=subsc->layers[layer].refs; rf!=NULL; rf=rf->next ) {
- trans[0] = rf->transform[0]*transform[0] +
- rf->transform[1]*transform[2];
- trans[1] = rf->transform[0]*transform[1] +
- rf->transform[1]*transform[3];
- trans[2] = rf->transform[2]*transform[0] +
- rf->transform[3]*transform[2];
- trans[3] = rf->transform[2]*transform[1] +
- rf->transform[3]*transform[3];
- trans[4] = rf->transform[4]*transform[0] +
- rf->transform[5]*transform[2] +
- transform[4];
- trans[5] = rf->transform[4]*transform[1] +
- rf->transform[5]*transform[3] +
- transform[5];
- cur = _SPLCopyTransformedHintMasks(rf->sc,layer,trans,basesc);
- if ( head==NULL )
- head = cur;
- else
- last->next = cur;
- if ( cur!=NULL ) {
- while ( cur->next!=NULL ) cur = cur->next;
- last = cur;
- }
- }
-return( head );
-}
-
-SplinePointList *SPLCopyTransformedHintMasks(RefChar *r,
- SplineChar *basesc, BasePoint *trans,int layer ) {
- real transform[6];
-
- memcpy(transform,r->transform,sizeof(transform));
- transform[4] += trans->x; transform[5] += trans->y;
-return( _SPLCopyTransformedHintMasks(r->sc,layer,transform,basesc));
-}
-
-void SplinePointListSelect(SplinePointList *spl,int sel) {
- Spline *spline, *first;
-
- for ( ; spl!=NULL; spl = spl->next ) {
- first = NULL;
- spl->first->selected = sel;
- for ( spline = spl->first->next; spline!=NULL && spline!=first; spline=spline->to->next ) {
- spline->to->selected = sel;
- if ( first==NULL ) first = spline;
- }
- }
-}
-
-void SCMakeDependent(SplineChar *dependent,SplineChar *base) {
- struct splinecharlist *dlist;
-
- if ( dependent->searcherdummy )
-return;
-
- for ( dlist=base->dependents; dlist!=NULL && dlist->sc!=dependent; dlist = dlist->next);
- if ( dlist==NULL ) {
- dlist = chunkalloc(sizeof(struct splinecharlist));
- dlist->sc = dependent;
- dlist->next = base->dependents;
- base->dependents = dlist;
- }
-}
-
-static void InstanciateReference(SplineFont *sf, RefChar *topref, RefChar *refs,
- real transform[6], SplineChar *dsc, int layer) {
- real trans[6];
- RefChar *rf;
- SplineChar *rsc;
- SplinePointList *spl, *new;
- int i;
-
- if ( !refs->checked ) {
- if ( refs->sc!=NULL )
- i = refs->sc->orig_pos; /* Can happen in type3 fonts */
- else for ( i=0; i<sf->glyphcnt; ++i ) if ( sf->glyphs[i]!=NULL )
- if ( strcmp(sf->glyphs[i]->name,AdobeStandardEncoding[refs->adobe_enc])==0 )
- break;
- if ( i!=sf->glyphcnt && !sf->glyphs[i]->ticked ) {
- refs->checked = true;
- refs->sc = rsc = sf->glyphs[i];
- refs->orig_pos = rsc->orig_pos;
- refs->unicode_enc = rsc->unicodeenc;
- SCMakeDependent(dsc,rsc);
- } else {
- LogError( _("Couldn't find referenced character \"%s\" in %s\n"),
- AdobeStandardEncoding[refs->adobe_enc], dsc->name);
-return;
- }
- } else if ( refs->sc->ticked )
-return;
-
- rsc = refs->sc;
- rsc->ticked = true;
-
- for ( rf=rsc->layers[ly_fore].refs; rf!=NULL; rf = rf->next ) {
- trans[0] = rf->transform[0]*transform[0] +
- rf->transform[1]*transform[2];
- trans[1] = rf->transform[0]*transform[1] +
- rf->transform[1]*transform[3];
- trans[2] = rf->transform[2]*transform[0] +
- rf->transform[3]*transform[2];
- trans[3] = rf->transform[2]*transform[1] +
- rf->transform[3]*transform[3];
- trans[4] = rf->transform[4]*transform[0] +
- rf->transform[5]*transform[2] +
- transform[4];
- trans[5] = rf->transform[4]*transform[1] +
- rf->transform[5]*transform[3] +
- transform[5];
- InstanciateReference(sf,topref,rf,trans,rsc,layer);
- }
- rsc->ticked = false;
-
- {
- new = SplinePointListTransform(SplinePointListCopy(rsc->layers[layer].splines),transform,true);
- if ( new!=NULL ) {
- for ( spl = new; spl->next!=NULL; spl = spl->next );
- spl->next = topref->layers[0].splines;
- topref->layers[0].splines = new;
- }
- }
-}
-
-static char *copyparse(char *str) {
- char *ret, *rpt;
- int ch,i;
-
- if ( str==NULL )
-return( str );
-
- rpt=ret=galloc(strlen(str)+1);
- while ( *str ) {
- if ( *str=='\\' ) {
- ++str;
- if ( *str=='n' ) ch = '\n';
- else if ( *str=='r' ) ch = '\r';
- else if ( *str=='t' ) ch = '\t';
- else if ( *str=='b' ) ch = '\b';
- else if ( *str=='f' ) ch = '\f';
- else if ( *str=='\\' ) ch = '\\';
- else if ( *str=='(' ) ch = '(';
- else if ( *str==')' ) ch = ')';
- else if ( *str>='0' && *str<='7' ) {
- for ( i=ch = 0; i<3 && *str>='0' && *str<='7'; ++i )
- ch = (ch<<3) + *str++-'0';
- --str;
- } else
- ch = *str;
- ++str;
- *rpt++ = ch;
- } else
- *rpt++ = *str++;
- }
- *rpt = '\0';
- if ( !utf8_valid(ret)) {
- /* Assume latin1, convert to utf8 */
- rpt = latin1_2_utf8_copy(ret);
- free(ret);
- ret = rpt;
- }
-return(ret);
-}
-
-char *XUIDFromFD(int xuid[20]) {
- int i;
- char *ret=NULL;
-
- for ( i=19; i>=0 && xuid[i]==0; --i );
- if ( i>=0 ) {
- int j; char *pt;
- ret = galloc(2+20*(i+1));
- pt = ret;
- *pt++ = '[';
- for ( j=0; j<=i; ++j ) {
- sprintf(pt,"%d ", xuid[j]);
- pt += strlen(pt);
- }
- pt[-1] = ']';
- }
-return( ret );
-}
-
-static void SplineFontMetaData(SplineFont *sf,struct fontdict *fd) {
- int em;
-
- sf->fontname = utf8_verify_copy(fd->cidfontname?fd->cidfontname:fd->fontname);
- sf->display_size = -default_fv_font_size;
- sf->display_antialias = default_fv_antialias;
- if ( fd->fontinfo!=NULL ) {
- if ( sf->fontname==NULL && fd->fontinfo->fullname!=NULL ) {
- sf->fontname = EnforcePostScriptName(fd->fontinfo->fullname);
- }
- if ( sf->fontname==NULL ) sf->fontname = EnforcePostScriptName(fd->fontinfo->familyname);
- sf->fullname = copyparse(fd->fontinfo->fullname);
- sf->familyname = copyparse(fd->fontinfo->familyname);
- sf->weight = copyparse(fd->fontinfo->weight);
- sf->version = copyparse(fd->fontinfo->version);
- sf->copyright = copyparse(fd->fontinfo->notice);
- sf->italicangle = fd->fontinfo->italicangle;
- sf->upos = fd->fontinfo->underlineposition;
- sf->uwidth = fd->fontinfo->underlinethickness;
- sf->strokedfont = fd->painttype==2;
- sf->strokewidth = fd->strokewidth;
- sf->ascent = fd->fontinfo->ascent;
- sf->descent = fd->fontinfo->descent;
- }
- if ( sf->uniqueid==0 ) sf->uniqueid = fd->uniqueid;
- if ( sf->fontname==NULL ) sf->fontname = GetNextUntitledName();
- if ( sf->fullname==NULL ) sf->fullname = copy(sf->fontname);
- if ( sf->familyname==NULL ) sf->familyname = copy(sf->fontname);
- if ( sf->weight==NULL ) sf->weight = copy("");
- if ( fd->modificationtime!=0 ) {
- sf->modificationtime = fd->modificationtime;
- sf->creationtime = fd->creationtime;
- }
- sf->cidversion = fd->cidversion;
- sf->xuid = XUIDFromFD(fd->xuid);
- /*sf->wasbinary = fd->wasbinary;*/
- if ( fd->fontmatrix[0]==0 )
- em = 1000;
- else
- em = rint(1/fd->fontmatrix[0]);
- if ( sf->ascent==0 && sf->descent!=0 )
- sf->ascent = em-sf->descent;
- else if ( fd->fontbb[3]-fd->fontbb[1]==em ) {
- if ( sf->ascent==0 ) sf->ascent = fd->fontbb[3];
- if ( sf->descent==0 ) sf->descent = fd->fontbb[1];
- } else if ( sf->ascent==0 )
- sf->ascent = 8*em/10;
- sf->descent = em-sf->ascent;
-
- sf->private = fd->private->private; fd->private->private = NULL;
- PSDictRemoveEntry(sf->private, "OtherSubrs");
-
- sf->cidregistry = copy(fd->registry);
- sf->ordering = copy(fd->ordering);
- sf->supplement = fd->supplement;
- sf->pfminfo.fstype = fd->fontinfo->fstype;
- if ( sf->ordering!=NULL ) {
- if ( strnmatch(sf->ordering,"Japan",5)==0 )
- sf->uni_interp = ui_japanese;
- else if ( strnmatch(sf->ordering,"Korea",5)==0 )
- sf->uni_interp = ui_korean;
- else if ( strnmatch(sf->ordering,"CNS",3)==0 )
- sf->uni_interp = ui_trad_chinese;
- else if ( strnmatch(sf->ordering,"GB",2)==0 )
- sf->uni_interp = ui_simp_chinese;
- }
-}
-
-static void TransByFontMatrix(SplineFont *sf,real fontmatrix[6]) {
- real trans[6];
- int em = sf->ascent+sf->descent, i;
- SplineChar *sc;
- RefChar *refs;
-
- if ( fontmatrix[0]==fontmatrix[3] &&
- fontmatrix[1]==0 && fontmatrix[2]==0 &&
- fontmatrix[4]==0 && fontmatrix[5]==0 )
-return; /* It's just the expected matrix */
-
- trans[0] = 1;
- if ( fontmatrix[0]==fontmatrix[3] ) trans[3] = 1;
- else trans[3] = rint(fontmatrix[3]*em);
- trans[1] = fontmatrix[1]*em;
- trans[2] = fontmatrix[2]*em;
- trans[4] = rint(fontmatrix[4]*em);
- trans[5] = rint(fontmatrix[5]*em);
-
- for ( i=0; i<sf->glyphcnt; ++i ) if ( (sc=sf->glyphs[i])!=NULL ) {
- SplinePointListTransform(sc->layers[ly_fore].splines,trans,true);
- for ( refs=sc->layers[ly_fore].refs; refs!=NULL; refs=refs->next ) {
- /* Just scale the offsets. we'll do all the base characters */
- real temp = refs->transform[4]*trans[0] +
- refs->transform[5]*trans[2] +
- /*transform[4]*/0;
- refs->transform[5] = refs->transform[4]*trans[1] +
- refs->transform[5]*trans[3] +
- /*transform[5]*/0;
- refs->transform[4] = temp;
- }
- sc->changedsincelasthinted = true;
- sc->manualhints = false;
- }
- for ( i=0; i<sf->glyphcnt; ++i ) if ( (sc=sf->glyphs[i])!=NULL ) {
- for ( refs=sc->layers[ly_fore].refs; refs!=NULL; refs=refs->next )
- SCReinstanciateRefChar(sc,refs,ly_fore);
- }
-}
-
-void SFInstanciateRefs(SplineFont *sf) {
- int i, layer;
- RefChar *refs, *next, *pr;
-
- for ( i=0; i<sf->glyphcnt; ++i ) if ( sf->glyphs[i]!=NULL )
- sf->glyphs[i]->ticked = false;
-
- for ( i=0; i<sf->glyphcnt; ++i ) if ( sf->glyphs[i]!=NULL ) {
- SplineChar *sc = sf->glyphs[i];
-
- for ( layer=ly_back; layer<sc->layer_cnt; ++layer ) {
- for ( pr=NULL, refs = sc->layers[layer].refs; refs!=NULL; refs=next ) {
- next = refs->next;
- sc->ticked = true;
- InstanciateReference(sf, refs, refs, refs->transform,sc,layer);
- if ( refs->sc!=NULL ) {
- SplineSetFindBounds(refs->layers[0].splines,&refs->bb);
- sc->ticked = false;
- pr = refs;
- } else {
- /* In some mal-formed postscript fonts we can have a reference */
- /* to a character that is not actually in the font. I even */
- /* generated one by mistake once... */
- if ( pr==NULL )
- sc->layers[layer].refs = next;
- else
- pr->next = next;
- refs->next = NULL;
- RefCharsFree(refs);
- }
- }
- }
- }
-}
-
-/* Also handles type3s */
-static void _SplineFontFromType1(SplineFont *sf, FontDict *fd, struct pscontext *pscontext) {
- int i, j, notdefpos;
- RefChar *refs, *next;
- int istype2 = fd->fonttype==2; /* Easy enough to deal with even though it will never happen... */
- int istype3 = fd->charprocs->next!=0;
- EncMap *map;
-
- if ( istype2 )
- fd->private->subrs->bias = fd->private->subrs->cnt<1240 ? 107 :
- fd->private->subrs->cnt<33900 ? 1131 : 32768;
- sf->glyphmax = sf->glyphcnt = istype3 ? fd->charprocs->next : fd->chars->next;
- if ( sf->map==NULL ) {
- sf->map = map = EncMapNew(256+CharsNotInEncoding(fd),sf->glyphcnt,fd->encoding_name);
- } else
- map = sf->map;
- sf->glyphs = gcalloc(map->backmax,sizeof(SplineChar *));
- if ( istype3 )
- notdefpos = LookupCharString(".notdef",(struct pschars *) (fd->charprocs));
- else
- notdefpos = LookupCharString(".notdef",fd->chars);
- for ( i=0; i<256; ++i ) {
- int k;
- if ( istype3 ) {
- k = LookupCharString(fd->encoding[i],(struct pschars *) (fd->charprocs));
- } else {
- k = LookupCharString(fd->encoding[i],fd->chars);
- }
- if ( k==-1 ) k = notdefpos;
- map->map[i] = k;
- if ( k!=-1 && map->backmap[k]==-1 )
- map->backmap[k] = i;
- }
- if ( map->enccount>256 ) {
- int k, j;
- for ( k=0; k<fd->chars->cnt; ++k ) {
- if ( fd->chars->keys[k]!=NULL ) {
- for ( j=0; j<256; ++j )
- if ( fd->encoding[j]!=NULL &&
- strcmp(fd->encoding[j],fd->chars->keys[k])==0 )
- break;
- if ( j==256 ) {
- map->map[i] = k;
- if ( map->backmap[k]==-1 )
- map->backmap[k] = i;
- ++i;
- }
- }
- }
- /* And for type3s */
- for ( k=0; k<fd->charprocs->cnt; ++k ) {
- if ( fd->charprocs->keys[k]!=NULL ) {
- for ( j=0; j<256; ++j )
- if ( fd->encoding[j]!=NULL &&
- strcmp(fd->encoding[j],fd->charprocs->keys[k])==0 )
- break;
- if ( j==256 ) {
- map->map[i] = k;
- if ( map->backmap[k]==-1 )
- map->backmap[k] = i;
- ++i;
- }
- }
- }
- }
- for ( i=0; i<map->enccount; ++i ) if ( map->map[i]==-1 )
- map->map[i] = notdefpos;
-
- for ( i=0; i<sf->glyphcnt; ++i ) {
- if ( !istype3 )
- sf->glyphs[i] = PSCharStringToSplines(fd->chars->values[i],fd->chars->lens[i],
- pscontext,fd->private->subrs,NULL,fd->chars->keys[i]);
- else
- sf->glyphs[i] = fd->charprocs->values[i];
- if ( sf->glyphs[i]!=NULL ) {
- sf->glyphs[i]->orig_pos = i;
- sf->glyphs[i]->vwidth = sf->ascent+sf->descent;
- sf->glyphs[i]->unicodeenc = UniFromName(sf->glyphs[i]->name,sf->uni_interp,map->enc);
- sf->glyphs[i]->parent = sf;
- /* SCLigDefault(sf->glyphs[i]);*/ /* Also reads from AFM file, but it probably doesn't exist */
- }
- ff_progress_next();
- }
- SFInstanciateRefs(sf);
- if ( fd->metrics!=NULL ) {
- for ( i=0; i<fd->metrics->next; ++i ) {
- int width = strtol(fd->metrics->values[i],NULL,10);
- for ( j=sf->glyphcnt-1; j>=0; --j ) {
- if ( sf->glyphs[j]!=NULL && sf->glyphs[j]->name!=NULL &&
- strcmp(fd->metrics->keys[i],sf->glyphs[j]->name)==0 ) {
- sf->glyphs[j]->width = width;
- break;
- }
- }
- }
- }
- for ( i=0; i<sf->glyphcnt; ++i ) if ( sf->glyphs[i]!=NULL )
- for ( refs = sf->glyphs[i]->layers[ly_fore].refs; refs!=NULL; refs=next ) {
- next = refs->next;
- if ( refs->adobe_enc==' ' && refs->layers[0].splines==NULL ) {
- /* When I have a link to a single character I will save out a */
- /* seac to that character and a space (since I can only make */
- /* real char links), so if we find a space link, get rid of*/
- /* it. It's an artifact */
- SCRefToSplines(sf->glyphs[i],refs,ly_fore);
- }
- }
- /* sometimes (some apple oblique fonts) the fontmatrix is not just a */
- /* formality, it acutally contains a skew. So be ready */
- if ( fd->fontmatrix[0]!=0 )
- TransByFontMatrix(sf,fd->fontmatrix);
-}
-
-static void SplineFontFromType1(SplineFont *sf, FontDict *fd, struct pscontext *pscontext) {
- int i;
- SplineChar *sc;
-
- _SplineFontFromType1(sf,fd,pscontext);
-
- /* Clean up the hint masks, We create an initial hintmask whether we need */
- /* it or not */
- for ( i=0; i<sf->glyphcnt; ++i ) {
- if ( (sc = sf->glyphs[i])!=NULL && !sc->hconflicts && !sc->vconflicts &&
- sc->layers[ly_fore].splines!=NULL ) {
- chunkfree( sc->layers[ly_fore].splines->first->hintmask,sizeof(HintMask) );
- sc->layers[ly_fore].splines->first->hintmask = NULL;
- }
- }
-}
-
-static SplineFont *SplineFontFromMMType1(SplineFont *sf, FontDict *fd, struct pscontext *pscontext) {
- char *pt, *end, *origweight;
- MMSet *mm;
- int ipos, apos, ppos, item, i;
- real blends[12]; /* At most twelve points/axis in a blenddesignmap */
- real designs[12];
- EncMap *map;
-
- if ( fd->weightvector==NULL || fd->fontinfo->blenddesignpositions==NULL ||
- fd->fontinfo->blenddesignmap==NULL || fd->fontinfo->blendaxistypes==NULL ) {
- ff_post_error(_("Bad Multiple Master Font"),_("Bad Multiple Master Font"));
- SplineFontFree(sf);
-return( NULL );
- }
-
- mm = chunkalloc(sizeof(MMSet));
-
- pt = fd->weightvector;
- while ( *pt==' ' || *pt=='[' ) ++pt;
- while ( *pt!=']' && *pt!='\0' ) {
- pscontext->blend_values[ pscontext->instance_count ] =
- strtod(pt,&end);
- if ( pt==end )
- break;
- ++(pscontext->instance_count);
- if ( pscontext->instance_count>=(int)(sizeof(pscontext->blend_values)/sizeof(pscontext->blend_values[0]))) {
- LogError( _("Multiple master font with more than 16 instances\n") );
- break;
- }
- for ( pt = end; *pt==' '; ++pt );
- }
-
- mm->instance_count = pscontext->instance_count;
- mm->instances = galloc(pscontext->instance_count*sizeof(SplineFont *));
- mm->defweights = galloc(mm->instance_count*sizeof(real));
- memcpy(mm->defweights,pscontext->blend_values,mm->instance_count*sizeof(real));
- mm->normal = sf;
- _SplineFontFromType1(mm->normal,fd,pscontext);
- map = sf->map;
- for ( i=0; i<sf->glyphcnt; ++i ) if ( sf->glyphs[i]!=NULL )
- sf->glyphs[i]->blended = true;
- sf->mm = mm;
-
- pt = fd->fontinfo->blendaxistypes;
- while ( *pt==' ' || *pt=='[' ) ++pt;
- while ( *pt!=']' && *pt!='\0' ) {
- if ( *pt=='/' ) ++pt;
- for ( end=pt; *end!=' ' && *end!=']' && *end!='\0'; ++end );
- if ( pt==end )
- break;
- if ( mm->axis_count>=(int)(sizeof(mm->axes)/sizeof(mm->axes[0]))) {
- LogError( _("Multiple master font with more than 4 axes\n") );
- break;
- }
- mm->axes[ mm->axis_count++ ] = copyn( pt,end-pt );
- for ( pt = end; *pt==' '; ++pt );
- }
-
- if ( mm->instance_count < (1<<mm->axis_count) )
- ff_post_error(_("Bad Multiple Master Font"),_("This multiple master font has %1$d instance fonts, but it needs at least %2$d master fonts for %3$d axes. FontForge will not be able to edit this correctly"),mm->instance_count,1<<mm->axis_count,mm->axis_count);
- else if ( mm->instance_count > (1<<mm->axis_count) )
- ff_post_error(_("Bad Multiple Master Font"),_("This multiple master font has %1$d instance fonts, but FontForge can only handle %2$d master fonts for %3$d axes. FontForge will not be able to edit this correctly"),mm->instance_count,1<<mm->axis_count,mm->axis_count);
- mm->positions = gcalloc(mm->axis_count*mm->instance_count,sizeof(real));
- pt = fd->fontinfo->blenddesignpositions;
- while ( *pt==' ' ) ++pt;
- if ( *pt=='[' ) ++pt;
- ipos = 0;
- while ( *pt!=']' && *pt!='\0' ) {
- while ( *pt==' ' ) ++pt;
- if ( *pt==']' || *pt=='\0' )
- break;
- if ( ipos>=mm->instance_count )
- break;
- if ( *pt=='[' ) {
- ++pt;
- apos=0;
- while ( *pt!=']' && *pt!='\0' ) {
- if ( apos>=mm->axis_count ) {
- LogError( _("Too many axis positions specified in /BlendDesignPositions.\n") );
- break;
- }
- mm->positions[ipos*mm->axis_count+apos] =
- strtod(pt,&end);
- if ( pt==end )
- break;
- ++apos;
- for ( pt = end; *pt==' '; ++pt );
- }
- if ( *pt==']' ) ++pt;
- ++ipos;
- } else
- ++pt;
- }
-
- mm->axismaps = gcalloc(mm->axis_count,sizeof(struct axismap));
- pt = fd->fontinfo->blenddesignmap;
- while ( *pt==' ' ) ++pt;
- if ( *pt=='[' ) ++pt;
- apos = 0;
- while ( *pt!=']' && *pt!='\0' ) {
- while ( *pt==' ' ) ++pt;
- if ( *pt==']' || *pt=='\0' )
- break;
- if ( apos>=mm->axis_count )
- break;
- if ( *pt=='[' ) {
- ++pt;
- ppos=0;
- while ( *pt!=']' && *pt!='\0' ) {
- if ( ppos>=12 ) {
- LogError( _("Too many mapping data points specified in /BlendDesignMap for axis %s.\n"), mm->axes[apos] );
- break;
- }
- while ( *pt==' ' ) ++pt;
- if ( *pt=='[' ) {
- ++pt;
- designs[ppos] = strtod(pt,&end);
- blends[ppos] = strtod(end,&end);
- if ( blends[ppos]<0 || blends[ppos]>1 ) {
- LogError( _("Bad value for blend in /BlendDesignMap for axis %s.\n"), mm->axes[apos] );
- if ( blends[ppos]<0 ) blends[ppos] = 0;
- if ( blends[ppos]>1 ) blends[ppos] = 1;
- }
- pt = end;
- while ( *pt!=']' && *pt!='\0' ) ++pt;
- ppos ++;
- }
- ++pt;
- while ( *pt==' ' ) ++pt;
- }
- if ( *pt==']' ) ++pt;
- if ( ppos<2 )
- LogError( _("Bad few values in /BlendDesignMap for axis %s.\n"), mm->axes[apos] );
- mm->axismaps[apos].points = ppos;
- mm->axismaps[apos].blends = galloc(ppos*sizeof(real));
- mm->axismaps[apos].designs = galloc(ppos*sizeof(real));
- memcpy(mm->axismaps[apos].blends,blends,ppos*sizeof(real));
- memcpy(mm->axismaps[apos].designs,designs,ppos*sizeof(real));
- ++apos;
- } else
- ++pt;
- }
-
- mm->cdv = copy(fd->cdv);
- mm->ndv = copy(fd->ndv);
-
- origweight = fd->fontinfo->weight;
-
- /* Now figure out the master designs, being careful to interpolate */
- /* BlueValues, ForceBold, UnderlinePosition etc. We need to copy private */
- /* generate a font name */
- for ( ipos = 0; ipos<mm->instance_count; ++ipos ) {
- free(fd->fontname);
- free(fd->fontinfo->fullname);
- fd->fontname = MMMakeMasterFontname(mm,ipos,&fd->fontinfo->fullname);
- fd->fontinfo->weight = MMGuessWeight(mm,ipos,copy(origweight));
- if ( fd->blendfontinfo!=NULL ) {
- for ( item=0; item<3; ++item ) {
- static char *names[] = { "ItalicAngle", "UnderlinePosition", "UnderlineThickness" };
- pt = PSDictHasEntry(fd->blendfontinfo,names[item]);
- if ( pt!=NULL ) {
- pt = MMExtractNth(pt,ipos);
- if ( pt!=NULL ) {
- double val = strtod(pt,NULL);
- free(pt);
- switch ( item ) {
- case 0: fd->fontinfo->italicangle = val; break;
- case 1: fd->fontinfo->underlineposition = val; break;
- case 2: fd->fontinfo->underlinethickness = val; break;
- }
- }
- }
- }
- }
- fd->private->private = PSDictCopy(sf->private);
- if ( fd->blendprivate!=NULL ) {
- static char *arrnames[] = { "BlueValues", "OtherBlues", "FamilyBlues", "FamilyOtherBlues", "StdHW", "StdVW", "StemSnapH", "StemSnapV", NULL };
- static char *scalarnames[] = { "ForceBold", "BlueFuzz", "BlueScale", "BlueShift", NULL };
- for ( item=0; scalarnames[item]!=NULL; ++item ) {
- pt = PSDictHasEntry(fd->blendprivate,scalarnames[item]);
- if ( pt!=NULL ) {
- pt = MMExtractNth(pt,ipos);
- PSDictChangeEntry(fd->private->private,scalarnames[item],pt);
- free(pt);
- }
- }
- for ( item=0; arrnames[item]!=NULL; ++item ) {
- pt = PSDictHasEntry(fd->blendprivate,arrnames[item]);
- if ( pt!=NULL ) {
- pt = MMExtractArrayNth(pt,ipos);
- PSDictChangeEntry(fd->private->private,arrnames[item],pt);
- free(pt);
- }
- }
- }
- for ( item=0; item<mm->instance_count; ++item )
- pscontext->blend_values[item] = 0;
- pscontext->blend_values[ipos] = 1;
-
- mm->instances[ipos] = SplineFontEmpty();
- SplineFontMetaData(mm->instances[ipos],fd);
- free(fd->fontinfo->weight);
- mm->instances[ipos]->map = map;
- _SplineFontFromType1(mm->instances[ipos],fd,pscontext);
- mm->instances[ipos]->mm = mm;
- }
- fd->fontinfo->weight = origweight;
-
- /* Clean up hintmasks. We always create a hintmask on the first point */
- /* only keep them if we actually have conflicts. */
- for ( i=0; i<mm->normal->glyphcnt; ++i )
- if ( mm->normal->glyphs[i]!=NULL &&
- mm->normal->glyphs[i]->layers[ly_fore].splines != NULL ) {
- for ( item=0; item<mm->instance_count; ++item )
- if ( mm->instances[item]->glyphs[i]->vconflicts ||
- mm->instances[item]->glyphs[i]->hconflicts )
- break;
- if ( item==mm->instance_count ) { /* No conflicts */
- for ( item=0; item<mm->instance_count; ++item ) {
- chunkfree( mm->instances[item]->glyphs[i]->layers[ly_fore].splines->first->hintmask, sizeof(HintMask) );
- mm->instances[item]->glyphs[i]->layers[ly_fore].splines->first->hintmask = NULL;
- }
- chunkfree( mm->normal->glyphs[i]->layers[ly_fore].splines->first->hintmask, sizeof(HintMask) );
- mm->normal->glyphs[i]->layers[ly_fore].splines->first->hintmask = NULL;
- }
- }
-
-return( sf );
-}
-
-static SplineFont *SplineFontFromCIDType1(SplineFont *sf, FontDict *fd,
- struct pscontext *pscontext) {
- int i,j,k, uni;
- unsigned bad;
- SplineChar **chars;
- char buffer[100];
- struct cidmap *map;
- SplineFont *_sf;
- SplineChar *sc;
- EncMap *encmap;
-
- bad = 0x80000000;
- for ( i=0; i<fd->fdcnt; ++i )
- if ( fd->fds[i]->fonttype!=1 && fd->fds[i]->fonttype!=2 )
- bad = fd->fds[i]->fonttype;
- if ( bad!=0x80000000 || fd->cidfonttype!=0 ) {
- LogError( _("Could not parse a CID font, %sCIDFontType %d, %sfonttype %d\n"),
- ( fd->cidfonttype!=0 ) ? "unexpected " : "",
- ( bad!=0x80000000 ) ? "unexpected " : "",
- fd->cidfonttype, bad );
- SplineFontFree(sf);
-return( NULL );
- }
- if ( fd->cidstrs==NULL || fd->cidcnt==0 ) {
- LogError( _("CID format doesn't contain what we expected it to.\n") );
- SplineFontFree(sf);
-return( NULL );
- }
-
- encmap = EncMap1to1(fd->cidcnt);
-
- sf->subfontcnt = fd->fdcnt;
- sf->subfonts = galloc((sf->subfontcnt+1)*sizeof(SplineFont *));
- for ( i=0; i<fd->fdcnt; ++i ) {
- if ( fd->fontmatrix[0]!=0 ) {
- MatMultiply(fd->fontmatrix,fd->fds[i]->fontmatrix,fd->fds[i]->fontmatrix);
- }
- sf->subfonts[i] = SplineFontEmpty();
- SplineFontMetaData(sf->subfonts[i],fd->fds[i]);
- sf->subfonts[i]->cidmaster = sf;
- sf->subfonts[i]->uni_interp = sf->uni_interp;
- sf->subfonts[i]->map = encmap;
- if ( fd->fds[i]->fonttype==2 )
- fd->fds[i]->private->subrs->bias =
- fd->fds[i]->private->subrs->cnt<1240 ? 107 :
- fd->fds[i]->private->subrs->cnt<33900 ? 1131 : 32768;
- }
-
- map = FindCidMap(sf->cidregistry,sf->ordering,sf->supplement,sf);
-
- chars = gcalloc(fd->cidcnt,sizeof(SplineChar *));
- for ( i=0; i<fd->cidcnt; ++i ) if ( fd->cidlens[i]>0 ) {
- j = fd->cidfds[i]; /* We get font indexes of 255 for non-existant chars */
- uni = CID2NameUni(map,i,buffer,sizeof(buffer));
- pscontext->is_type2 = fd->fds[j]->fonttype==2;
- chars[i] = PSCharStringToSplines(fd->cidstrs[i],fd->cidlens[i],
- pscontext,fd->fds[j]->private->subrs,
- NULL,buffer);
- chars[i]->vwidth = sf->subfonts[j]->ascent+sf->subfonts[j]->descent;
- chars[i]->unicodeenc = uni;
- chars[i]->orig_pos = i;
- /* There better not be any references (seac's) because we have no */
- /* encoding on which to base any fixups */
- if ( chars[i]->layers[ly_fore].refs!=NULL )
- IError( "Reference found in CID font. Can't fix it up");
- sf->subfonts[j]->glyphcnt = sf->subfonts[j]->glyphmax = i+1;
- ff_progress_next();
- }
- for ( i=0; i<fd->fdcnt; ++i )
- sf->subfonts[i]->glyphs = gcalloc(sf->subfonts[i]->glyphcnt,sizeof(SplineChar *));
- for ( i=0; i<fd->cidcnt; ++i ) if ( chars[i]!=NULL ) {
- j = fd->cidfds[i];
- if ( j<sf->subfontcnt ) {
- sf->subfonts[j]->glyphs[i] = chars[i];
- chars[i]->parent = sf->subfonts[j];
- }
- }
- free(chars);
-
- /* Clean up the hint masks, We create an initial hintmask whether we */
- /* need it or not */
- k=0;
- do {
- _sf = k<sf->subfontcnt?sf->subfonts[k]:sf;
- for ( i=0; i<_sf->glyphcnt; ++i ) {
- if ( (sc = _sf->glyphs[i])!=NULL && !sc->hconflicts && !sc->vconflicts &&
- sc->layers[ly_fore].splines!=NULL ) {
- chunkfree( sc->layers[ly_fore].splines->first->hintmask,sizeof(HintMask) );
- sc->layers[ly_fore].splines->first->hintmask = NULL;
- }
- }
- ++k;
- } while ( k<sf->subfontcnt );
-return( sf );
-}
-
-SplineFont *SplineFontFromPSFont(FontDict *fd) {
- SplineFont *sf;
- struct pscontext pscontext;
-
- if ( fd->sf!=NULL )
- sf = fd->sf;
- else {
- memset(&pscontext,0,sizeof(pscontext));
- pscontext.is_type2 = fd->fonttype==2;
- pscontext.painttype = fd->painttype;
-
- sf = SplineFontEmpty();
- SplineFontMetaData(sf,fd);
- if ( fd->wascff ) {
- SplineFontFree(sf);
- sf = fd->sf;
- } else if ( fd->fdcnt!=0 )
- sf = SplineFontFromCIDType1(sf,fd,&pscontext);
- else if ( fd->weightvector!=NULL )
- SplineFontFromMMType1(sf,fd,&pscontext);
- else
- SplineFontFromType1(sf,fd,&pscontext);
- }
-return( sf );
-}
-
-void RefCharFindBounds(RefChar *rf) {
- SplineSetFindBounds(rf->layers[0].splines,&rf->bb);
- SplineSetFindTop(rf->layers[0].splines,&rf->top);
-}
-
-void SCReinstanciateRefChar(SplineChar *sc,RefChar *rf,int layer) {
- SplinePointList *new, *last;
- RefChar *refs;
- (void)sc;
- {
- if ( rf->layer_cnt>0 ) {
- SplinePointListsFree(rf->layers[0].splines);
- rf->layers[0].splines = NULL;
- }
- rf->layers = gcalloc(1,sizeof(struct reflayer));
- rf->layer_cnt = 1;
- new = SplinePointListTransform(SplinePointListCopy(rf->sc->layers[layer].splines),rf->transform,true);
- rf->layers[0].splines = new;
- last = NULL;
- if ( new!=NULL )
- for ( last = new; last->next!=NULL; last = last->next );
- for ( refs = rf->sc->layers[layer].refs; refs!=NULL; refs = refs->next ) {
- new = SplinePointListTransform(SplinePointListCopy(refs->layers[0].splines),rf->transform,true);
- if ( last!=NULL )
- last->next = new;
- else
- rf->layers[0].splines = new;
- if ( new!=NULL )
- for ( last = new; last->next!=NULL; last = last->next );
- }
- }
- RefCharFindBounds(rf);
-}
-
-static void _SFReinstanciateRefs(SplineFont *sf) {
- int i, undone, undoable, j, cnt;
- RefChar *ref;
-
- for ( i=0; i<sf->glyphcnt; ++i ) if ( sf->glyphs[i]!=NULL )
- sf->glyphs[i]->ticked = false;
-
- undone = true;
- cnt = 0;
- while ( undone && cnt<200) {
- undone = false;
- for ( i=0; i<sf->glyphcnt; ++i ) if ( sf->glyphs[i]!=NULL && !sf->glyphs[i]->ticked ) {
- undoable = false;
- for ( j=0; j<sf->glyphs[i]->layer_cnt; ++j ) {
- for ( ref=sf->glyphs[i]->layers[j].refs; ref!=NULL; ref=ref->next ) {
- if ( !ref->sc->ticked )
- undoable = true;
- }
- }
- if ( undoable )
- undone = true;
- else {
- for ( j=0; j<sf->glyphs[i]->layer_cnt; ++j ) {
- for ( ref=sf->glyphs[i]->layers[j].refs; ref!=NULL; ref=ref->next )
- SCReinstanciateRefChar(sf->glyphs[i],ref,j);
- }
- sf->glyphs[i]->ticked = true;
- }
- }
- ++cnt;
- }
-}
-
-void SFReinstanciateRefs(SplineFont *sf) {
- int i;
-
- if ( sf->cidmaster!=NULL || sf->subfontcnt!=0 ) {
- if ( sf->cidmaster!=NULL ) sf = sf->cidmaster;
- for ( i=0; i<sf->subfontcnt; ++i )
- _SFReinstanciateRefs(sf->subfonts[i]);
- } else
- _SFReinstanciateRefs(sf);
-}
-
-void SCReinstanciateRef(SplineChar *sc,SplineChar *rsc,int layer) {
- RefChar *rf;
-
- for ( rf=sc->layers[layer].refs; rf!=NULL; rf=rf->next ) if ( rf->sc==rsc ) {
- SCReinstanciateRefChar(sc,rf,layer);
- }
-}
-
-void SCRemoveDependent(SplineChar *dependent,RefChar *rf,int layer) {
- struct splinecharlist *dlist, *pd;
- RefChar *prev;
-
- if ( dependent->layers[layer].refs==rf )
- dependent->layers[layer].refs = rf->next;
- else {
- for ( prev = dependent->layers[layer].refs; prev->next!=rf; prev=prev->next );
- prev->next = rf->next;
- }
- /* Check for multiple dependencies (colon has two refs to period) */
- /* if there are none, then remove dependent from ref->sc's dependents list */
- for ( prev = dependent->layers[ly_fore].refs; prev!=NULL && (prev==rf || prev->sc!=rf->sc); prev = prev->next );
- if ( prev==NULL ) {
- dlist = rf->sc->dependents;
- if ( dlist==NULL )
- /* Do nothing */;
- else if ( dlist->sc==dependent ) {
- rf->sc->dependents = dlist->next;
- } else {
- for ( pd=dlist, dlist = pd->next; dlist!=NULL && dlist->sc!=dependent; pd=dlist, dlist = pd->next );
- if ( dlist!=NULL )
- pd->next = dlist->next;
- }
- chunkfree(dlist,sizeof(struct splinecharlist));
- }
- RefCharFree(rf);
-}
-
-void SCRemoveLayerDependents(SplineChar *dependent,int layer) {
- RefChar *rf, *next;
-
- for ( rf=dependent->layers[layer].refs; rf!=NULL; rf=next ) {
- next = rf->next;
- SCRemoveDependent(dependent,rf,layer);
- }
- dependent->layers[layer].refs = NULL;
-}
-
-void SCRemoveDependents(SplineChar *dependent) {
- int layer;
-
- for ( layer=ly_fore; layer<dependent->layer_cnt; ++layer )
- SCRemoveLayerDependents(dependent,layer);
-}
-
-void SCRefToSplines(SplineChar *sc,RefChar *rf,int layer) {
- SplineSet *spl;
- {
- if ( (spl = rf->layers[0].splines)!=NULL ) {
- while ( spl->next!=NULL )
- spl = spl->next;
- spl->next = sc->layers[layer].splines;
- sc->layers[layer].splines = rf->layers[0].splines;
- rf->layers[0].splines = NULL;
- }
- }
- SCRemoveDependent(sc,rf,layer);
-}
-
-/* This returns all real solutions, even those out of bounds */
-/* I use -999999 as an error flag, since we're really only interested in */
-/* solns near 0 and 1 that should be ok. -1 is perhaps a little too close */
-static int _CubicSolve(const Spline1D *sp,extended ts[3]) {
- extended d, xN, yN, delta2, temp, delta, h, t2, t3, theta;
- int i=0;
-
- ts[0] = ts[1] = ts[2] = -999999;
- if ( sp->d==0 && sp->a!=0 ) {
- /* one of the roots is 0, the other two are the soln of a quadratic */
- ts[0] = 0;
- if ( sp->c==0 ) {
- ts[1] = -sp->b/(extended) sp->a; /* two zero roots */
- } else {
- temp = sp->b*(extended) sp->b-4*(extended) sp->a*sp->c;
- if ( RealNear(temp,0))
- ts[1] = -sp->b/(2*(extended) sp->a);
- else if ( temp>=0 ) {
- temp = sqrt(temp);
- ts[1] = (-sp->b+temp)/(2*(extended) sp->a);
- ts[2] = (-sp->b-temp)/(2*(extended) sp->a);
- }
- }
- } else if ( sp->a!=0 ) {
- /* http://www.m-a.org.uk/eb/mg/mg077ch.pdf */
- /* this nifty solution to the cubic neatly avoids complex arithmatic */
- xN = -sp->b/(3*(extended) sp->a);
- yN = ((sp->a*xN + sp->b)*xN+sp->c)*xN + sp->d;
-
- delta2 = (sp->b*(extended) sp->b-3*(extended) sp->a*sp->c)/(9*(extended) sp->a*sp->a);
- if ( RealNear(delta2,0) ) delta2 = 0;
-
- /* the descriminant is yN^2-h^2, but delta might be <0 so avoid using h */
- d = yN*yN - 4*sp->a*sp->a*delta2*delta2*delta2;
- if ( ((yN>.01 || yN<-.01) && RealNear(d/yN,0)) || ((yN<=.01 && yN>=-.01) && RealNear(d,0)) )
- d = 0;
- if ( d>0 ) {
- temp = sqrt(d);
- t2 = (-yN-temp)/(2*sp->a);
- t2 = (t2==0) ? 0 : (t2<0) ? -pow(-t2,1./3.) : pow(t2,1./3.);
- t3 = (-yN+temp)/(2*sp->a);
- t3 = t3==0 ? 0 : (t3<0) ? -pow(-t3,1./3.) : pow(t3,1./3.);
- ts[0] = xN + t2 + t3;
- } else if ( d<0 ) {
- if ( delta2>=0 ) {
- delta = sqrt(delta2);
- h = 2*sp->a*delta2*delta;
- temp = -yN/h;
- if ( temp>=-1.0001 && temp<=1.0001 ) {
- if ( temp<-1 ) temp = -1; else if ( temp>1 ) temp = 1;
- theta = acos(temp)/3;
- ts[i++] = xN+2*delta*cos(theta);
- ts[i++] = xN+2*delta*cos(2.0943951+theta);
- ts[i++] = xN+2*delta*cos(4.1887902+theta);
- }
- }
- } else if ( /* d==0 && */ delta2!=0 ) {
- delta = yN/(2*sp->a);
- delta = delta==0 ? 0 : delta>0 ? pow(delta,1./3.) : -pow(-delta,1./3.);
- ts[i++] = xN + delta; /* this root twice, but that's irrelevant to me */
- ts[i++] = xN - 2*delta;
- } else if ( /* d==0 && */ delta2==0 ) {
- if ( xN>=-0.0001 && xN<=1.0001 ) ts[0] = xN;
- }
- } else if ( sp->b!=0 ) {
- extended d = sp->c*(extended) sp->c-4*(extended) sp->b*sp->d;
- if ( RealNear(d,0)) d=0;
- if ( d<0 )
-return(false); /* All roots imaginary */
- d = sqrt(d);
- ts[0] = (-sp->c-d)/(2*(extended) sp->b);
- ts[1] = (-sp->c+d)/(2*(extended) sp->b);
- } else if ( sp->c!=0 ) {
- ts[0] = -sp->d/(extended) sp->c;
- } else {
- /* If it's a point then either everything is a solution, or nothing */
- }
-return( ts[0]!=-999999 );
-}
-
-int CubicSolve(const Spline1D *sp,extended ts[3]) {
- extended t;
- int i;
- /* This routine gives us all solutions between [0,1] with -1 as an error flag */
- /* http://mathforum.org/dr.math/faq/faq.cubic.equations.html */
-
- if ( !_CubicSolve(sp,ts)) {
- ts[0] = ts[1] = ts[2] = -1;
-return( false );
- }
-
- for ( i=0; i<3; ++i )
- if ( ts[i]==-999999 ) ts[i] = -1;
- if (ts[0]>1.0001 || ts[0]<-.0001 ) ts[0] = -1;
- else if ( ts[0]<0 ) ts[0] = 0; else if ( ts[0]>1 ) ts[0] = 1;
- if (ts[1]>1.0001 || ts[1]<-.0001 ) ts[1] = -1;
- else if ( ts[1]<0 ) ts[1] = 0; else if ( ts[1]>1 ) ts[1] = 1;
- if (ts[2]>1.0001 || ts[2]<-.0001 ) ts[2] = -1;
- else if ( ts[2]<0 ) ts[2] = 0; else if ( ts[2]>1 ) ts[2] = 1;
- if ( ts[1]==-1 ) { ts[1] = ts[2]; ts[2] = -1;}
- if ( ts[0]==-1 ) { ts[0] = ts[1]; ts[1] = ts[2]; ts[2] = -1; }
- if ( ts[0]==-1 )
-return( false );
- if ( ts[0]>ts[2] && ts[2]!=-1 ) {
- t = ts[0]; ts[0] = ts[2]; ts[2] = t;
- }
- if ( ts[0]>ts[1] && ts[1]!=-1 ) {
- t = ts[0]; ts[0] = ts[1]; ts[1] = t;
- }
- if ( ts[1]>ts[2] && ts[2]!=-1 ) {
- t = ts[1]; ts[1] = ts[2]; ts[2] = t;
- }
-return( true );
-}
-
-
-extended SplineSolve(const Spline1D *sp, real tmin, real tmax, extended sought,real err) {
- /* We want to find t so that spline(t) = sought */
- /* the curve must be monotonic */
- /* returns t which is near sought or -1 */
- Spline1D temp;
- extended ts[3];
- int i;
- extended t;
- (void)err;
- temp = *sp;
- temp.d -= sought;
- CubicSolve(&temp,ts);
- if ( tmax<tmin ) { t = tmax; tmax = tmin; tmin = t; }
- for ( i=0; i<3; ++i )
- if ( ts[i]>=tmin && ts[i]<=tmax )
-return( ts[i] );
-
-return( -1 );
-}
-
-#ifndef EXTENDED_IS_LONG_DOUBLE
-double CheckExtremaForSingleBitErrors(const Spline1D *sp, double t) {
- union { double dval; int32 ival[2]; } u1, um1, temp;
- double slope, slope1, slopem1;
-#ifdef WORDS_BIGENDIAN
- const int index = 1;
-#else
- const int index = 0;
-#endif
-
- slope = (3*(double) sp->a*t+2*sp->b)*t+sp->c;
-
- u1.dval = t;
- u1.ival[index] += 1;
- slope1 = (3*(double) sp->a*u1.dval+2*sp->b)*u1.dval+sp->c;
-
- um1.dval = t;
- um1.ival[index] -= 1;
- slopem1 = (3*(double) sp->a*um1.dval+2*sp->b)*um1.dval+sp->c;
-
- if ( slope<0 ) slope = -slope;
- if ( slope1<0 ) slope1 = -slope1;
- if ( slopem1<0 ) slopem1 = -slopem1;
-
- if ( slope1<slope && slope1<=slopem1 ) {
- /* Ok, things got better when we added 1. */
- /* Do they improve further if we add 1 more? */
- temp = u1;
- temp.ival[index] += 1;
- slope = (3*(double) sp->a*temp.dval+2*sp->b)*temp.dval+sp->c;
- if ( slope<0 ) slope = -slope;
- if ( slope<slope1 )
-return( temp.dval );
- else
-return( u1.dval );
- } else if ( slopem1<slope && slopem1<=slope ) {
- /* Ok, things got better when we subtracted 1. */
- /* Do they improve further if we subtract 1 more? */
- temp = um1;
- temp.ival[index] -= 1;
- slope = (3*(double) sp->a*temp.dval+2*sp->b)*temp.dval+sp->c;
- if ( slope<0 ) slope = -slope;
- if ( slope<slopem1 )
-return( temp.dval );
- else
-return( um1.dval );
- }
- /* that seems as good as it gets */
-
-return( t );
-}
-#else
-extended esqrt(extended e) {
- extended rt, temp;
-
- rt = sqrt( (double) e );
- if ( e<=0 )
-return( rt );
-
- temp = e/rt;
- rt = (rt+temp)/2;
- temp = e/rt;
- rt = (rt+temp)/2;
-return( rt );
-}
-#endif
-
-static void _SplineFindExtrema(const Spline1D *sp, extended *_t1, extended *_t2 ) {
- extended t1= -1, t2= -1;
- extended b2_fourac;
-
- /* Find the extreme points on the curve */
- /* Set to -1 if there are none or if they are outside the range [0,1] */
- /* Order them so that t1<t2 */
- /* If only one valid extremum it will be t1 */
- /* (Does not check the end points unless they have derivative==0) */
- /* (Does not check to see if d/dt==0 points are inflection points (rather than extrema) */
- if ( sp->a!=0 ) {
- /* cubic, possibly 2 extrema (possibly none) */
- b2_fourac = 4*(extended)sp->b*sp->b - 12*(extended)sp->a*sp->c;
- if ( b2_fourac>=0 ) {
- b2_fourac = esqrt(b2_fourac);
- t1 = (-2*sp->b - b2_fourac) / (6*sp->a);
- t2 = (-2*sp->b + b2_fourac) / (6*sp->a);
- t1 = CheckExtremaForSingleBitErrors(sp,t1);
- t2 = CheckExtremaForSingleBitErrors(sp,t2);
- if ( t1>t2 ) { extended temp = t1; t1 = t2; t2 = temp; }
- else if ( t1==t2 ) t2 = -1;
- if ( RealNear(t1,0)) t1=0; else if ( RealNear(t1,1)) t1=1;
- if ( RealNear(t2,0)) t2=0; else if ( RealNear(t2,1)) t2=1;
- }
- } else if ( sp->b!=0 ) {
- /* Quadratic, at most one extremum */
- t1 = -sp->c/(2.0*(extended) sp->b);
- } else /*if ( sp->c!=0 )*/ {
- /* linear, no extrema */
- }
- *_t1 = t1; *_t2 = t2;
-}
-
-void SplineFindExtrema(const Spline1D *sp, extended *_t1, extended *_t2 ) {
- extended t1= -1, t2= -1;
- extended b2_fourac;
-
- /* Find the extreme points on the curve */
- /* Set to -1 if there are none or if they are outside the range [0,1] */
- /* Order them so that t1<t2 */
- /* If only one valid extremum it will be t1 */
- /* (Does not check the end points unless they have derivative==0) */
- /* (Does not check to see if d/dt==0 points are inflection points (rather than extrema) */
- if ( sp->a!=0 ) {
- /* cubic, possibly 2 extrema (possibly none) */
- b2_fourac = 4*(extended) sp->b*sp->b - 12*(extended) sp->a*sp->c;
- if ( b2_fourac>=0 ) {
- b2_fourac = esqrt(b2_fourac);
- t1 = (-2*sp->b - b2_fourac) / (6*sp->a);
- t2 = (-2*sp->b + b2_fourac) / (6*sp->a);
- t1 = CheckExtremaForSingleBitErrors(sp,t1);
- t2 = CheckExtremaForSingleBitErrors(sp,t2);
- if ( t1>t2 ) { extended temp = t1; t1 = t2; t2 = temp; }
- else if ( t1==t2 ) t2 = -1;
- if ( RealNear(t1,0)) t1=0; else if ( RealNear(t1,1)) t1=1;
- if ( RealNear(t2,0)) t2=0; else if ( RealNear(t2,1)) t2=1;
- if ( t2<=0 || t2>=1 ) t2 = -1;
- if ( t1<=0 || t1>=1 ) { t1 = t2; t2 = -1; }
- }
- } else if ( sp->b!=0 ) {
- /* Quadratic, at most one extremum */
- t1 = -sp->c/(2.0*(extended) sp->b);
- if ( t1<=0 || t1>=1 ) t1 = -1;
- } else /*if ( sp->c!=0 )*/ {
- /* linear, no extrema */
- }
- *_t1 = t1; *_t2 = t2;
-}
-
-double SplineCurvature(Spline *s, double t) {
- /* Kappa = (x'y'' - y'x'') / (x'^2 + y'^2)^(3/2) */
- double dxdt, dydt, d2xdt2, d2ydt2, denom, numer;
-
- if ( s==NULL )
-return( CURVATURE_ERROR );
-
- dxdt = (3*s->splines[0].a*t+2*s->splines[0].b)*t+s->splines[0].c;
- dydt = (3*s->splines[1].a*t+2*s->splines[1].b)*t+s->splines[1].c;
- d2xdt2 = 6*s->splines[0].a*t + 2*s->splines[0].b;
- d2ydt2 = 6*s->splines[1].a*t + 2*s->splines[1].b;
- denom = pow( dxdt*dxdt + dydt*dydt, 3.0/2.0 );
- numer = dxdt*d2ydt2 - dydt*d2xdt2;
-
- if ( numer==0 )
-return( 0 );
- if ( denom==0 )
-return( CURVATURE_ERROR );
-
-return( numer/denom );
-}
-
-int SplineAtInflection(Spline1D *sp, double t ) {
- /* It's a point of inflection if d sp/dt==0 and d2 sp/dt^2==0 */
-return ( RealNear( (3*sp->a*t + 2*sp->b)*t + sp->c,0) &&
- RealNear( 6*sp->a*t + 2*sp->b, 0));
-}
-
-int SplineAtMinMax(Spline1D *sp, double t ) {
- /* It's a point of inflection if d sp/dt==0 and d2 sp/dt^2!=0 */
-return ( RealNear( (3*sp->a*t + 2*sp->b)*t + sp->c,0) &&
- !RealNear( 6*sp->a*t + 2*sp->b, 0));
-}
-
-int Spline2DFindExtrema(const Spline *sp, extended extrema[4] ) {
- int i,j;
- BasePoint last, cur, mid;
-
- SplineFindExtrema(&sp->splines[0],&extrema[0],&extrema[1]);
- SplineFindExtrema(&sp->splines[1],&extrema[2],&extrema[3]);
-
- for ( i=0; i<3; ++i ) for ( j=i+1; j<4; ++j ) {
- if ( (extrema[i]==-1 && extrema[j]!=-1) || (extrema[i]>extrema[j] && extrema[j]!=-1) ) {
- extended temp = extrema[i];
- extrema[i] = extrema[j];
- extrema[j] = temp;
- }
- }
- for ( i=j=0; i<3 && extrema[i]!=-1; ++i ) {
- if ( extrema[i]==extrema[i+1] ) {
- for ( j=i+1; j<3; ++j )
- extrema[j] = extrema[j+1];
- extrema[3] = -1;
- }
- }
-
- /* Extrema which are too close together are not interesting */
- last = sp->from->me;
- for ( i=0; i<4 && extrema[i]!=-1; ++i ) {
- cur.x = ((sp->splines[0].a*extrema[i]+sp->splines[0].b)*extrema[i]+
- sp->splines[0].c)*extrema[i]+sp->splines[0].d;
- cur.y = ((sp->splines[1].a*extrema[i]+sp->splines[1].b)*extrema[i]+
- sp->splines[1].c)*extrema[i]+sp->splines[1].d;
- mid.x = (last.x+cur.x)/2; mid.y = (last.y+cur.y)/2;
- if ( (mid.x==last.x || mid.x==cur.x) &&
- (mid.y==last.y || mid.y==cur.y)) {
- for ( j=i+1; j<3; ++j )
- extrema[j] = extrema[j+1];
- } else
- last = cur;
- }
- for ( i=0; i<4 && extrema[i]!=-1; ++i );
- if ( i!=0 ) {
- cur = sp->to->me;
- mid.x = (last.x+cur.x)/2; mid.y = (last.y+cur.y)/2;
- if ( (mid.x==last.x || mid.x==cur.x) &&
- (mid.y==last.y || mid.y==cur.y))
- extrema[--i] = -1;
- }
-
-return( i );
-}
-
-int Spline2DFindPointsOfInflection(const Spline *sp, extended poi[2] ) {
- int cnt=0;
- extended a, b, c, b2_fourac, t;
- /* A POI happens when d2 y/dx2 is zero. This is not the same as d2y/dt2 / d2x/dt2 */
- /* d2 y/dx^2 = d/dt ( dy/dt / dx/dt ) / dx/dt */
- /* = ( (dx/dt) * d2 y/dt2 - ((dy/dt) * d2 x/dt2) )/ (dx/dt)^3 */
- /* (3ax*t^2+2bx*t+cx) * (6ay*t+2by) - (3ay*t^2+2by*t+cy) * (6ax*t+2bx) == 0 */
- /* (3ax*t^2+2bx*t+cx) * (3ay*t+by) - (3ay*t^2+2by*t+cy) * (3ax*t+bx) == 0 */
- /* 9*ax*ay*t^3 + (3ax*by+6bx*ay)*t^2 + (2bx*by+3cx*ay)*t + cx*by */
- /* -(9*ax*ay*t^3 + (3ay*bx+6by*ax)*t^2 + (2by*bx+3cy*ax)*t + cy*bx)==0 */
- /* 3*(ax*by-ay*bx)*t^2 + 3*(cx*ay-cy*ax)*t+ (cx*by-cy*bx) == 0 */
-
- a = 3*((extended) sp->splines[1].a*sp->splines[0].b-(extended) sp->splines[0].a*sp->splines[1].b);
- b = 3*((extended) sp->splines[0].c*sp->splines[1].a - (extended) sp->splines[1].c*sp->splines[0].a);
- c = (extended) sp->splines[0].c*sp->splines[1].b-(extended) sp->splines[1].c*sp->splines[0].b;
- if ( !RealNear(a,0) ) {
- b2_fourac = b*b - 4*a*c;
- poi[0] = poi[1] = -1;
- if ( b2_fourac<0 )
-return( 0 );
- b2_fourac = esqrt( b2_fourac );
- t = (-b+b2_fourac)/(2*a);
- if ( t>=0 && t<=1.0 )
- poi[cnt++] = t;
- t = (-b-b2_fourac)/(2*a);
- if ( t>=0 && t<=1.0 ) {
- if ( cnt==1 && poi[0]>t ) {
- poi[1] = poi[0];
- poi[0] = t;
- ++cnt;
- } else
- poi[cnt++] = t;
- }
- } else if ( !RealNear(b,0) ) {
- t = -c/b;
- if ( t>=0 && t<=1.0 )
- poi[cnt++] = t;
- }
- if ( cnt<2 )
- poi[cnt] = -1;
-
-return( cnt );
-}
-
-/* Ok, if the above routine finds an extremum that less than 1 unit */
-/* from an endpoint or another extremum, then many things are */
-/* just going to skip over it, and other things will be confused by this */
-/* so just remove it. It should be so close the difference won't matter */
-void SplineRemoveExtremaTooClose(Spline1D *sp, extended *_t1, extended *_t2 ) {
- extended last, test;
- extended t1= *_t1, t2 = *_t2;
-
- if ( t1>t2 && t2!=-1 ) {
- t1 = t2;
- t2 = *_t1;
- }
- last = sp->d;
- if ( t1!=-1 ) {
- test = ((sp->a*t1+sp->b)*t1+sp->c)*t1+sp->d;
- if ( (test-last)*(test-last)<1 )
- t1 = -1;
- else
- last = test;
- }
- if ( t2!=-1 ) {
- test = ((sp->a*t2+sp->b)*t2+sp->c)*t2+sp->d;
- if ( (test-last)*(test-last)<1 )
- t2 = -1;
- else
- last = test;
- }
- test = sp->a+sp->b+sp->c+sp->d;
- if ( (test-last)*(test-last)<1 ) {
- if ( t2!=-1 )
- t2 = -1;
- else if ( t1!=-1 )
- t1 = -1;
- else {
- /* Well we should just remove the whole spline? */;
- }
- }
- *_t1 = t1; *_t2 = t2;
-}
-
-int SplineSolveFull(const Spline1D *sp,extended val, extended ts[3]) {
- Spline1D temp;
-
- temp = *sp;
- temp.d -= val;
- CubicSolve(&temp,ts);
-return( ts[0]!=-1 );
-}
-
-static int AddPoint(extended x,extended y,extended t,extended s,BasePoint *pts,
- extended t1s[3],extended t2s[3], int soln) {
- int i;
-
- for ( i=0; i<soln; ++i )
- if ( x==pts[i].x && y==pts[i].y )
-return( soln );
- if ( soln>=9 )
- IError( "Too many solutions!\n" );
- t1s[soln] = t;
- t2s[soln] = s;
- pts[soln].x = x;
- pts[soln].y = y;
-return( soln+1 );
-}
-
-static void IterateSolve(const Spline1D *sp,extended ts[3]) {
- /* The closed form solution has too many rounding errors for my taste... */
- int i,j;
-
- ts[0] = ts[1] = ts[2] = -1;
-
- if ( sp->a!=0 ) {
- extended e[4];
- e[0] = 0; e[1] = e[2] = e[3] = 1.0;
- SplineFindExtrema(sp,&e[1],&e[2]);
- if ( e[1]==-1 ) e[1] = 1;
- if ( e[2]==-1 ) e[2] = 1;
- for ( i=j=0; i<3; ++i ) {
- ts[j] = IterateSplineSolve(sp,e[i],e[i+1],0,.0001);
- if ( ts[j]!=-1 ) ++j;
- if ( e[i+1]==1.0 )
- break;
- }
- } else if ( sp->b!=0 ) {
- extended b2_4ac = sp->c*(extended) sp->c - 4*sp->b*(extended) sp->d;
- if ( b2_4ac>=0 ) {
- b2_4ac = esqrt(b2_4ac);
- ts[0] = (-sp->c-b2_4ac)/(2*sp->b);
- ts[1] = (-sp->c+b2_4ac)/(2*sp->b);
- if ( ts[0]>ts[1] ) { bigreal t = ts[0]; ts[0] = ts[1]; ts[1] = t; }
- }
- } else if ( sp->c!=0 ) {
- ts[0] = -sp->d/(extended) sp->c;
- } else {
- /* No solutions, or all solutions */;
- }
- for ( i=j=0; i<3; ++i )
- if ( ts[i]>=0 && ts[i]<=1 )
- ts[j++] = ts[i];
- for ( i=0; i<j-1; ++i )
- if ( ts[i]+.0000001>ts[i+1]) {
- ts[i] = (ts[i]+ts[i+1])/2;
- --j;
- for ( ++i; i<j; ++i )
- ts[i] = ts[i+1];
- }
- if ( j!=0 ) {
- if ( ts[0]!=0 ) {
- extended d0 = sp->d;
- extended dt = ((sp->a*ts[0]+sp->b)*ts[0]+sp->c)*ts[0]+sp->d;
- if ( d0<0 ) d0=-d0;
- if ( dt<0 ) dt=-dt;
- if ( d0<dt )
- ts[0] = 0;
- }
- if ( ts[j-1]!=1.0 ) {
- extended d1 = sp->a+(extended) sp->b+sp->c+sp->d;
- extended dt = ((sp->a*ts[j-1]+sp->b)*ts[j-1]+sp->c)*ts[j-1]+sp->d;
- if ( d1<0 ) d1=-d1;
- if ( dt<0 ) dt=-dt;
- if ( d1<dt )
- ts[j-1] = 1;
- }
- }
- for ( ; j<3; ++j )
- ts[j] = -1;
-}
-
-static extended ISolveWithin(const Spline1D *sp,extended val,extended tlow, extended thigh) {
- Spline1D temp;
- extended ts[3];
- int i;
-
- temp = *sp;
- temp.d -= val;
- IterateSolve(&temp,ts);
- if ( tlow<thigh ) {
- for ( i=0; i<3; ++i )
- if ( ts[i]>=tlow && ts[i]<=thigh )
-return( ts[i] );
- for ( i=0; i<3; ++i ) {
- if ( ts[i]>=tlow-1./1024. && ts[i]<=tlow )
-return( tlow );
- if ( ts[i]>=thigh && ts[i]<=thigh+1./1024 )
-return( thigh );
- }
- } else {
- for ( i=0; i<3; ++i )
- if ( ts[i]>=thigh && ts[i]<=tlow )
-return( ts[i] );
- for ( i=0; i<3; ++i ) {
- if ( ts[i]>=thigh-1./1024. && ts[i]<=thigh )
-return( thigh );
- if ( ts[i]>=tlow && ts[i]<=tlow+1./1024 )
-return( tlow );
- }
- }
-return( -1 );
-}
-
-static int ICAddInter(int cnt,BasePoint *foundpos,extended *foundt1,extended *foundt2,
- const Spline *s1,const Spline *s2,extended t1,extended t2, int maxcnt) {
- (void)s2;
- if ( cnt>=maxcnt )
-return( cnt );
-
- foundt1[cnt] = t1;
- foundt2[cnt] = t2;
- foundpos[cnt].x = ((s1->splines[0].a*t1+s1->splines[0].b)*t1+
- s1->splines[0].c)*t1+s1->splines[0].d;
- foundpos[cnt].y = ((s1->splines[1].a*t1+s1->splines[1].b)*t1+
- s1->splines[1].c)*t1+s1->splines[1].d;
-return( cnt+1 );
-}
-
-static int ICBinarySearch(int cnt,BasePoint *foundpos,extended *foundt1,extended *foundt2,
- int other,
- const Spline *s1,const Spline *s2,extended t1low,extended t1high,extended t2low,extended t2high,
- int maxcnt) {
- int major;
- extended t1, t2;
- extended o1o, o2o, o1n, o2n, m;
-
- major = !other;
- o1o = ((s1->splines[other].a*t1low+s1->splines[other].b)*t1low+
- s1->splines[other].c)*t1low+s1->splines[other].d;
- o2o = ((s2->splines[other].a*t2low+s2->splines[other].b)*t2low+
- s2->splines[other].c)*t2low+s2->splines[other].d;
- forever {
- t1 = (t1low+t1high)/2;
- m = ((s1->splines[major].a*t1+s1->splines[major].b)*t1+
- s1->splines[major].c)*t1+s1->splines[major].d;
- t2 = ISolveWithin(&s2->splines[major],m,t2low,t2high);
- if ( t2==-1 )
-return( cnt );
-
- o1n = ((s1->splines[other].a*t1+s1->splines[other].b)*t1+
- s1->splines[other].c)*t1+s1->splines[other].d;
- o2n = ((s2->splines[other].a*t2+s2->splines[other].b)*t2+
- s2->splines[other].c)*t2+s2->splines[other].d;
- if (( o1n-o2n<.001 && o1n-o2n>-.001) ||
- (t1-t1low<.0001 && t1-t1low>-.0001))
-return( ICAddInter(cnt,foundpos,foundt1,foundt2,s1,s2,t1,t2,maxcnt));
- if ( (o1o>o2o && o1n<o2n) || (o1o<o2o && o1n>o2n)) {
- t1high = t1;
- t2high = t2;
- } else {
- t1low = t1;
- t2low = t2;
- }
- }
-}
-
-static int CubicsIntersect(const Spline *s1,extended lowt1,extended hight1,BasePoint *min1,BasePoint *max1,
- const Spline *s2,extended lowt2,extended hight2,BasePoint *min2,BasePoint *max2,
- BasePoint *foundpos,extended *foundt1,extended *foundt2,
- int maxcnt) {
- int major, other;
- BasePoint max, min;
- extended t1max, t1min, t2max, t2min, t1, t2, t1diff, oldt2;
- extended o1o, o2o, o1n, o2n, m;
- int cnt=0;
-
- if ( (min.x = min1->x)<min2->x ) min.x = min2->x;
- if ( (min.y = min1->y)<min2->y ) min.y = min2->y;
- if ( (max.x = max1->x)>max2->x ) max.x = max2->x;
- if ( (max.y = max1->y)>max2->y ) max.y = max2->y;
- if ( max.x<min.x || max.y<min.y )
-return( 0 );
- if ( max.x-min.x > max.y-min.y )
- major = 0;
- else
- major = 1;
- other = 1-major;
-
- t1max = ISolveWithin(&s1->splines[major],(&max.x)[major],lowt1,hight1);
- t1min = ISolveWithin(&s1->splines[major],(&min.x)[major],lowt1,hight1);
- t2max = ISolveWithin(&s2->splines[major],(&max.x)[major],lowt2,hight2);
- t2min = ISolveWithin(&s2->splines[major],(&min.x)[major],lowt2,hight2);
- if ( t1max==-1 || t1min==-1 || t2max==-1 || t1min==-1 )
-return( 0 );
- t1diff = (t1max-t1min)/64.0;
- if ( t1diff==0 )
-return( 0 );
-
- t1 = t1min; t2 = t2min;
- o1o = ((s1->splines[other].a*t1+s1->splines[other].b)*t1+
- s1->splines[other].c)*t1+s1->splines[other].d;
- o2o = ((s2->splines[other].a*t2+s2->splines[other].b)*t2+
- s2->splines[other].c)*t2+s2->splines[other].d;
- if ( o1o==o2o )
- cnt = ICAddInter(cnt,foundpos,foundt1,foundt2,s1,s2,t1,t2,maxcnt);
- forever {
- if ( cnt>=maxcnt )
- break;
- t1 += t1diff;
- if (( t1max>t1min && t1>t1max ) || (t1max<t1min && t1<t1max) || cnt>3 )
- break;
- m = ((s1->splines[major].a*t1+s1->splines[major].b)*t1+
- s1->splines[major].c)*t1+s1->splines[major].d;
- oldt2 = t2;
- t2 = ISolveWithin(&s2->splines[major],m,lowt2,hight2);
- if ( t2==-1 )
- continue;
-
- o1n = ((s1->splines[other].a*t1+s1->splines[other].b)*t1+
- s1->splines[other].c)*t1+s1->splines[other].d;
- o2n = ((s2->splines[other].a*t2+s2->splines[other].b)*t2+
- s2->splines[other].c)*t2+s2->splines[other].d;
- if ( o1n==o2n )
- cnt = ICAddInter(cnt,foundpos,foundt1,foundt2,s1,s2,t1,t2,maxcnt);
- if ( (o1o>o2o && o1n<o2n) || (o1o<o2o && o1n>o2n))
- cnt = ICBinarySearch(cnt,foundpos,foundt1,foundt2,other,
- s1,s2,t1-t1diff,t1,oldt2,t2,maxcnt);
- o1o = o1n; o2o = o2n;
- }
-return( cnt );
-}
-
-
-
-
-static int Closer(const Spline *s1,const Spline *s2,extended t1,extended t2,extended t1p,extended t2p) {
- double dx,dy;
- double x1 = ((s1->splines[0].a*t1+s1->splines[0].b)*t1+s1->splines[0].c)*t1+s1->splines[0].c;
- double y1 = ((s1->splines[1].a*t1+s1->splines[1].b)*t1+s1->splines[1].c)*t1+s1->splines[1].c;
- double x2 = ((s2->splines[0].a*t2+s2->splines[0].b)*t2+s2->splines[0].c)*t2+s2->splines[0].c;
- double y2 = ((s2->splines[1].a*t2+s2->splines[1].b)*t2+s2->splines[1].c)*t2+s2->splines[1].c;
- double diff = FABS(x1-x2) + FABS(y1-y2);
- double x1p = ((s1->splines[0].a*t1p+s1->splines[0].b)*t1p+s1->splines[0].c)*t1p+s1->splines[0].c;
- double y1p = ((s1->splines[1].a*t1p+s1->splines[1].b)*t1p+s1->splines[1].c)*t1p+s1->splines[1].c;
- double x2p = ((s2->splines[0].a*t2p+s2->splines[0].b)*t2p+s2->splines[0].c)*t2p+s2->splines[0].c;
- double y2p = ((s2->splines[1].a*t2p+s2->splines[1].b)*t2p+s2->splines[1].c)*t2p+s2->splines[1].c;
- double diffp = FABS(x1p-x2p) + FABS(y1p-y2p);
- if ( diff<diffp )
-return( false );
-
-return( true );
-}
-
-/* returns 0=>no intersection, 1=>at least one, location in pts, t1s, t2s */
-/* -1 => We couldn't figure it out in a closed form, have to do a numerical */
-/* approximation */
-int SplinesIntersect(const Spline *s1, const Spline *s2, BasePoint pts[9],
- extended t1s[10], extended t2s[10]) { /* One extra for a trailing -1 */
- BasePoint min1, max1, min2, max2;
- int soln = 0;
- extended x,y,t, ac0, ac1;
- int i,j,found;
- Spline1D spline;
- extended tempts[4]; /* 3 solns for cubics, 4 for quartics */
- extended extrema1[6], extrema2[6];
- int ecnt1, ecnt2;
-
- t1s[0] = t1s[1] = t1s[2] = t1s[3] = -1;
- t2s[0] = t2s[1] = t2s[2] = t2s[3] = -1;
-
- if ( s1==s2 && !s1->knownlinear && !s1->isquadratic )
- /* Special case see if it doubles back on itself anywhere */;
- else if ( s1==s2 )
-return( 0 ); /* Linear and quadratics can't double back, can't self-intersect */
- else if ( s1->splines[0].a == s2->splines[0].a &&
- s1->splines[0].b == s2->splines[0].b &&
- s1->splines[0].c == s2->splines[0].c &&
- s1->splines[0].d == s2->splines[0].d &&
- s1->splines[1].a == s2->splines[1].a &&
- s1->splines[1].b == s2->splines[1].b &&
- s1->splines[1].c == s2->splines[1].c &&
- s1->splines[1].d == s2->splines[1].d )
-return( -1 ); /* Same spline. Intersects everywhere */
-
- /* Ignore splines which are just a point */
- if ( s1->knownlinear && s1->splines[0].c==0 && s1->splines[1].c==0 )
-return( 0 );
- if ( s2->knownlinear && s2->splines[0].c==0 && s2->splines[1].c==0 )
-return( 0 );
-
- if ( s1->knownlinear )
- /* Do Nothing */;
- else if ( s2->knownlinear || (!s1->isquadratic && s2->isquadratic)) {
- const Spline *stemp = s1;
- extended *ts = t1s;
- t1s = t2s; t2s = ts;
- s1 = s2; s2 = stemp;
- }
-
- min1 = s1->from->me; max1 = min1;
- min2 = s2->from->me; max2 = min2;
- if ( s1->from->nextcp.x>max1.x ) max1.x = s1->from->nextcp.x;
- else if ( s1->from->nextcp.x<min1.x ) min1.x = s1->from->nextcp.x;
- if ( s1->from->nextcp.y>max1.y ) max1.y = s1->from->nextcp.y;
- else if ( s1->from->nextcp.y<min1.y ) min1.y = s1->from->nextcp.y;
- if ( s1->to->prevcp.x>max1.x ) max1.x = s1->to->prevcp.x;
- else if ( s1->to->prevcp.x<min1.x ) min1.x = s1->to->prevcp.x;
- if ( s1->to->prevcp.y>max1.y ) max1.y = s1->to->prevcp.y;
- else if ( s1->to->prevcp.y<min1.y ) min1.y = s1->to->prevcp.y;
- if ( s1->to->me.x>max1.x ) max1.x = s1->to->me.x;
- else if ( s1->to->me.x<min1.x ) min1.x = s1->to->me.x;
- if ( s1->to->me.y>max1.y ) max1.y = s1->to->me.y;
- else if ( s1->to->me.y<min1.y ) min1.y = s1->to->me.y;
-
- if ( s2->from->nextcp.x>max2.x ) max2.x = s2->from->nextcp.x;
- else if ( s2->from->nextcp.x<min2.x ) min2.x = s2->from->nextcp.x;
- if ( s2->from->nextcp.y>max2.y ) max2.y = s2->from->nextcp.y;
- else if ( s2->from->nextcp.y<min2.y ) min2.y = s2->from->nextcp.y;
- if ( s2->to->prevcp.x>max2.x ) max2.x = s2->to->prevcp.x;
- else if ( s2->to->prevcp.x<min2.x ) min2.x = s2->to->prevcp.x;
- if ( s2->to->prevcp.y>max2.y ) max2.y = s2->to->prevcp.y;
- else if ( s2->to->prevcp.y<min2.y ) min2.y = s2->to->prevcp.y;
- if ( s2->to->me.x>max2.x ) max2.x = s2->to->me.x;
- else if ( s2->to->me.x<min2.x ) min2.x = s2->to->me.x;
- if ( s2->to->me.y>max2.y ) max2.y = s2->to->me.y;
- else if ( s2->to->me.y<min2.y ) min2.y = s2->to->me.y;
- if ( min1.x>max2.x || min2.x>max1.x || min1.y>max2.y || min2.y>max1.y )
-return( false ); /* no intersection of bounding boxes */
-
-#if 0
- soln = CheckEndpoint(&s1->from->me,s2,0,pts,t1s,t2s,soln);
- soln = CheckEndpoint(&s1->to->me,s2,1,pts,t1s,t2s,soln);
- soln = CheckEndpoint(&s2->from->me,s1,0,pts,t2s,t1s,soln);
- soln = CheckEndpoint(&s2->to->me,s1,1,pts,t2s,t1s,soln);
-#endif
-
- if ( s1->knownlinear ) {
- spline.d = s1->splines[1].c*((bigreal) s2->splines[0].d-(bigreal) s1->splines[0].d)-
- s1->splines[0].c*((bigreal) s2->splines[1].d-(bigreal) s1->splines[1].d);
- spline.c = s1->splines[1].c*(bigreal) s2->splines[0].c - s1->splines[0].c*(bigreal) s2->splines[1].c;
- spline.b = s1->splines[1].c*(bigreal) s2->splines[0].b - s1->splines[0].c*(bigreal) s2->splines[1].b;
- spline.a = s1->splines[1].c*(bigreal) s2->splines[0].a - s1->splines[0].c*(bigreal) s2->splines[1].a;
- IterateSolve(&spline,tempts);
- if ( tempts[0]==-1 )
-return( false );
- for ( i = 0; i<3 && tempts[i]!=-1; ++i ) {
- x = ((s2->splines[0].a*tempts[i]+s2->splines[0].b)*tempts[i]+
- s2->splines[0].c)*tempts[i]+s2->splines[0].d;
- y = ((s2->splines[1].a*tempts[i]+s2->splines[1].b)*tempts[i]+
- s2->splines[1].c)*tempts[i]+s2->splines[1].d;
- if ( (ac0 = s1->splines[0].c)<0 ) ac0 = -ac0;
- if ( (ac1 = s1->splines[1].c)<0 ) ac1 = -ac1;
- if ( ac0>ac1 )
- t = (x-s1->splines[0].d)/s1->splines[0].c;
- else
- t = (y-s1->splines[1].d)/s1->splines[1].c;
- if ( tempts[i]>.999 && Closer(s1,s2,tempts[i],t,1,t))
- tempts[i] = 1;
- else if ( tempts[i]<.001 && Closer(s1,s2,tempts[i],t,0,t))
- tempts[i] = 0;
- if ( t>.999 && Closer(s1,s2,tempts[i],t,tempts[i],1))
- t = 1;
- else if ( t<.001 && Closer(s1,s2,tempts[i],t,tempts[i],0))
- t = 0;
- if ( t<-.001 || t>1.001 || x<min1.x-.01 || y<min1.y-.01 || x>max1.x+.01 || y>max1.y+.01 )
- continue;
- if ( t<=0 ) {t=0; x=s1->from->me.x; y = s1->from->me.y; }
- else if ( t>=1 ) { t=1; x=s1->to->me.x; y = s1->to->me.y; }
- if ( s1->from->me.x==s1->to->me.x ) /* Avoid rounding errors */
- x = s1->from->me.x; /* on hor/vert lines */
- else if ( s1->from->me.y==s1->to->me.y )
- y = s1->from->me.y;
- if ( s2->knownlinear ) {
- if ( s2->from->me.x==s2->to->me.x )
- x = s2->from->me.x;
- else if ( s2->from->me.y==s2->to->me.y )
- y = s2->from->me.y;
- }
- soln = AddPoint(x,y,t,tempts[i],pts,t1s,t2s,soln);
- }
-return( soln!=0 );
-#if 0 /* This doesn't work. */
- } else if ( s1->isquadratic && s2->isquadratic ) {
- temp.a = 0;
- temp.b = s1->splines[1].b*s2->splines[0].b - s1->splines[0].b*s2->splines[1].b;
- temp.c = s1->splines[1].b*s2->splines[0].c - s1->splines[0].b*s2->splines[1].c;
- temp.d = s1->splines[1].b*(s2->splines[0].d-s1->splines[0].d) -
- s1->splines[0].b*(s2->splines[1].d-s1->splines[1].d);
- d = s1->splines[1].b*s1->splines[0].c - s1->splines[0].b*s1->splines[1].c;
- if ( RealNear(d,0)) d=0;
- if ( d!=0 ) {
- temp.b /= d; temp.c /= d; temp.d /= d;
- /* At this point t= temp.b*s^2 + temp.c*s + temp.d */
- /* We substitute this back into one of our equations and get a */
- /* quartic in s */
- quad.a = s1->splines[0].b*temp.b*temp.b;
- quad.b = s1->splines[0].b*2*temp.b*temp.c;
- quad.c = s1->splines[0].b*(2*temp.b*temp.d+temp.c*temp.c);
- quad.d = s1->splines[0].b*2*temp.d*temp.c;
- quad.e = s1->splines[0].b*temp.d*temp.d;
- quad.b+= s1->splines[0].c*temp.b;
- quad.c+= s1->splines[0].c*temp.c;
- quad.d+= s1->splines[0].c*temp.d;
- quad.e+= s1->splines[0].d;
- quad.e-= s2->splines[0].d;
- quad.d-= s2->splines[0].c;
- quad.c-= s2->splines[0].b;
- if ( QuarticSolve(&quad,tempts)==-1 )
-return( -1 );
- for ( i=0; i<4 && tempts[i]!=-999999; ++i )
- soln = AddQuadraticSoln(tempts[i],s1,s2,pts,t1s,t2s,soln);
- } else {
- d = temp.c*temp.c-4*temp.b*temp.c;
- if ( RealNear(d,0)) d = 0;
- if ( d<0 )
-return( soln!=0 );
- d = sqrt(d);
- s = (-temp.c-d)/(2*temp.b);
- soln = AddQuadraticSoln(s,s1,s2,pts,t1s,t2s,soln);
- s = (-temp.c+d)/(2*temp.b);
- soln = AddQuadraticSoln(s,s1,s2,pts,t1s,t2s,soln);
- }
-return( soln!=0 );
-#endif
- }
- /* if one of the splines is quadratic then we can get an expression */
- /* relating c*t+d to poly(s^3), and substituting this back we get */
- /* a poly of degree 6 in s which could be solved iteratively */
- /* however mixed quadratics and cubics are unlikely */
-
- /* but if both splines are degree 3, the t is expressed as the sqrt of */
- /* a third degree poly, which must be substituted into a cubic, and */
- /* then squared to get rid of the sqrts leaving us with an ?18? degree */
- /* poly. Ick. */
-
- /* So let's do it the hard way... we break the splines into little bits */
- /* where they are monotonic in both dimensions, then check these for */
- /* possible intersections */
- extrema1[0] = extrema2[0] = 0;
- ecnt1 = Spline2DFindExtrema(s1,extrema1+1);
- ecnt2 = Spline2DFindExtrema(s2,extrema2+1);
- extrema1[++ecnt1] = 1.0;
- extrema2[++ecnt2] = 1.0;
- found=0;
- for ( i=0; i<ecnt1; ++i ) {
- min1.x = ((s1->splines[0].a*extrema1[i]+s1->splines[0].b)*extrema1[i]+
- s1->splines[0].c)*extrema1[i]+s1->splines[0].d;
- min1.y = ((s1->splines[1].a*extrema1[i]+s1->splines[1].b)*extrema1[i]+
- s1->splines[1].c)*extrema1[i]+s1->splines[1].d;
- max1.x = ((s1->splines[0].a*extrema1[i+1]+s1->splines[0].b)*extrema1[i+1]+
- s1->splines[0].c)*extrema1[i+1]+s1->splines[0].d;
- max1.y = ((s1->splines[1].a*extrema1[i+1]+s1->splines[1].b)*extrema1[i+1]+
- s1->splines[1].c)*extrema1[i+1]+s1->splines[1].d;
- if ( max1.x<min1.x ) { extended temp = max1.x; max1.x = min1.x; min1.x = temp; }
- if ( max1.y<min1.y ) { extended temp = max1.y; max1.y = min1.y; min1.y = temp; }
- for ( j=(s1==s2)?i+1:0; j<ecnt2; ++j ) {
- min2.x = ((s2->splines[0].a*extrema2[j]+s2->splines[0].b)*extrema2[j]+
- s2->splines[0].c)*extrema2[j]+s2->splines[0].d;
- min2.y = ((s2->splines[1].a*extrema2[j]+s2->splines[1].b)*extrema2[j]+
- s2->splines[1].c)*extrema2[j]+s2->splines[1].d;
- max2.x = ((s2->splines[0].a*extrema2[j+1]+s2->splines[0].b)*extrema2[j+1]+
- s2->splines[0].c)*extrema2[j+1]+s2->splines[0].d;
- max2.y = ((s2->splines[1].a*extrema2[j+1]+s2->splines[1].b)*extrema2[j+1]+
- s2->splines[1].c)*extrema2[j+1]+s2->splines[1].d;
- if ( max2.x<min2.x ) { extended temp = max2.x; max2.x = min2.x; min2.x = temp; }
- if ( max2.y<min2.y ) { extended temp = max2.y; max2.y = min2.y; min2.y = temp; }
- if ( min1.x>max2.x || min2.x>max1.x || min1.y>max2.y || min2.y>max1.y )
- /* No possible intersection */;
- else if ( s1!=s2 )
- found += CubicsIntersect(s1,extrema1[i],extrema1[i+1],&min1,&max1,
- s2,extrema2[j],extrema2[j+1],&min2,&max2,
- &pts[found],&t1s[found],&t2s[found],9-found);
- else {
- int k,l;
- int cnt = CubicsIntersect(s1,extrema1[i],extrema1[i+1],&min1,&max1,
- s2,extrema2[j],extrema2[j+1],&min2,&max2,
- &pts[found],&t1s[found],&t2s[found],9-found);
- for ( k=0; k<cnt; ++k ) {
- if ( RealNear(t1s[found+k],t2s[found+k]) ) {
- for ( l=k+1; l<cnt; ++l ) {
- pts[found+l-1] = pts[found+l];
- t1s[found+l-1] = t1s[found+l];
- t2s[found+l-1] = t2s[found+l];
- }
- --cnt; --k;
- }
- }
- found += cnt;
- }
- if ( found>=8 ) {
- /* If the splines are colinear then we might get an unbounded */
- /* number of intersections */
- break;
- }
- }
- }
- t1s[found] = t2s[found] = -1;
-return( found!=0 );
-}
-
-int SplineSetIntersect(SplineSet *spl, Spline **_spline, Spline **_spline2) {
- BasePoint pts[9];
- extended t1s[10], t2s[10];
- int found = false,i;
- SplineSet *test, *test2;
- Spline *spline, *spline2, *first, *first2;
-
- for ( test=spl; test!=NULL ; test=test->next ) {
- first = NULL;
- for ( spline = test->first->next; spline!=NULL && spline!=first; spline=spline->to->next ) {
- if ( first==NULL ) first = spline;
- for ( test2=test; test2!=NULL; test2=test2->next ) {
- first2 = test2==test && first!=spline ? first : NULL;
- for ( spline2=(test2==test)?spline : test2->first->next;
- spline2!=NULL && spline2!=first2; spline2 = spline2->to->next ) {
- if ( first2==NULL ) first2 = spline2;
- if ( SplinesIntersect(spline,spline2,pts,t1s,t2s)) {
- if ( spline->to->next!=spline2 && spline->from->prev!=spline2 )
- found = true;
- else for ( i=0; i<10 && t1s[i]!=-1; ++i ) {
- if ( (t1s[i]<.9 && t1s[i]>.1) || (t2s[i]<.9 && t2s[i]>.1)) {
- found = true;
- break;
- }
- }
- if ( found )
- break;
- }
- }
- if ( found )
- break;
- }
- if ( found )
- break;
- }
- if ( found )
- break;
- }
- if ( found ) {
- *_spline = spline;
- *_spline2 = spline2;
- }
-return( found );
-}
-
-void StemInfoFree(StemInfo *h) {
- HintInstance *hi, *n;
-
- for ( hi=h->where; hi!=NULL; hi=n ) {
- n = hi->next;
- chunkfree(hi,sizeof(HintInstance));
- }
- chunkfree(h,sizeof(StemInfo));
-}
-
-void StemInfosFree(StemInfo *h) {
- StemInfo *hnext;
- HintInstance *hi, *n;
-
- for ( ; h!=NULL; h = hnext ) {
- for ( hi=h->where; hi!=NULL; hi=n ) {
- n = hi->next;
- chunkfree(hi,sizeof(HintInstance));
- }
- hnext = h->next;
- chunkfree(h,sizeof(StemInfo));
- }
-}
-
-void DStemInfoFree(DStemInfo *h) {
- HintInstance *hi, *n;
-
- for ( hi=h->where; hi!=NULL; hi=n ) {
- n = hi->next;
- chunkfree(hi,sizeof(HintInstance));
- }
- chunkfree(h,sizeof(DStemInfo));
-}
-
-void DStemInfosFree(DStemInfo *h) {
- DStemInfo *hnext;
- HintInstance *hi, *n;
-
- for ( ; h!=NULL; h = hnext ) {
- for ( hi=h->where; hi!=NULL; hi=n ) {
- n = hi->next;
- chunkfree(hi,sizeof(HintInstance));
- }
- hnext = h->next;
- chunkfree(h,sizeof(DStemInfo));
- }
-}
-
-StemInfo *StemInfoCopy(StemInfo *h) {
- StemInfo *head=NULL, *last=NULL, *cur;
- HintInstance *hilast, *hicur, *hi;
-
- for ( ; h!=NULL; h = h->next ) {
- cur = chunkalloc(sizeof(StemInfo));
- *cur = *h;
- cur->next = NULL;
- if ( head==NULL )
- head = last = cur;
- else {
- last->next = cur;
- last = cur;
- }
- cur->where = hilast = NULL;
- for ( hi=h->where; hi!=NULL; hi=hi->next ) {
- hicur = chunkalloc(sizeof(StemInfo));
- *hicur = *hi;
- hicur->next = NULL;
- if ( hilast==NULL )
- cur->where = hilast = hicur;
- else {
- hilast->next = hicur;
- hilast = hicur;
- }
- }
- }
-return( head );
-}
-
-DStemInfo *DStemInfoCopy(DStemInfo *h) {
- DStemInfo *head=NULL, *last=NULL, *cur;
- HintInstance *hilast, *hicur, *hi;
-
- for ( ; h!=NULL; h = h->next ) {
- cur = chunkalloc(sizeof(DStemInfo));
- *cur = *h;
- cur->next = NULL;
- if ( head==NULL )
- head = last = cur;
- else {
- last->next = cur;
- last = cur;
- }
- cur->where = hilast = NULL;
- for ( hi=h->where; hi!=NULL; hi=hi->next ) {
- hicur = chunkalloc(sizeof(StemInfo));
- *hicur = *hi;
- hicur->next = NULL;
- if ( hilast==NULL )
- cur->where = hilast = hicur;
- else {
- hilast->next = hicur;
- hilast = hicur;
- }
- }
- }
-return( head );
-}
-
-MinimumDistance *MinimumDistanceCopy(MinimumDistance *md) {
- MinimumDistance *head=NULL, *last=NULL, *cur;
-
- for ( ; md!=NULL; md = md->next ) {
- cur = chunkalloc(sizeof(DStemInfo));
- *cur = *md;
- cur->next = NULL;
- if ( head==NULL )
- head = last = cur;
- else {
- last->next = cur;
- last = cur;
- }
- }
-return( head );
-}
-
-void KernPairsFree(KernPair *kp) {
- KernPair *knext;
- for ( ; kp!=NULL; kp = knext ) {
- knext = kp->next;
- chunkfree(kp,sizeof(KernPair));
- }
-}
-
-static AnchorPoint *AnchorPointsRemoveName(AnchorPoint *alist,AnchorClass *an) {
- AnchorPoint *prev=NULL, *ap, *next;
-
- for ( ap=alist; ap!=NULL; ap=next ) {
- next = ap->next;
- if ( ap->anchor == an ) {
- if ( prev==NULL )
- alist = next;
- else
- prev->next = next;
- ap->next = NULL;
- AnchorPointsFree(ap);
- if ( an->type == act_mark || (an->type==act_mklg && ap->type==at_mark))
- next = NULL; /* Only one instance of an anchor class in a glyph for mark to base anchors */
- /* Or for the mark glyphs of ligature classes */
- /* Mark to mark & cursive will (probably) have 2 occurances */
- /* and ligatures may have lots */
- } else
- prev = ap;
- }
-return( alist );
-}
-
-static void SCRemoveAnchorClass(SplineChar *sc,AnchorClass *an) {
- Undoes *test;
-
- if ( sc==NULL )
-return;
- sc->anchor = AnchorPointsRemoveName(sc->anchor,an);
- for ( test = sc->layers[ly_fore].undoes; test!=NULL; test=test->next )
- if ( test->undotype==ut_state || test->undotype==ut_tstate ||
- test->undotype==ut_statehint || test->undotype==ut_statename )
- test->u.state.anchor = AnchorPointsRemoveName(test->u.state.anchor,an);
- for ( test = sc->layers[ly_fore].redoes; test!=NULL; test=test->next )
- if ( test->undotype==ut_state || test->undotype==ut_tstate ||
- test->undotype==ut_statehint || test->undotype==ut_statename )
- test->u.state.anchor = AnchorPointsRemoveName(test->u.state.anchor,an);
-}
-
-void SFRemoveAnchorClass(SplineFont *sf,AnchorClass *an) {
- int i;
- AnchorClass *prev, *test;
-
- for ( i=0; i<sf->glyphcnt; ++i )
- SCRemoveAnchorClass(sf->glyphs[i],an);
- prev = NULL;
- for ( test=sf->anchor; test!=NULL; test=test->next ) {
- if ( test==an ) {
- if ( prev==NULL )
- sf->anchor = test->next;
- else
- prev->next = test->next;
- chunkfree(test,sizeof(AnchorClass));
- break;
- } else
- prev = test;
- }
-}
-
-AnchorPoint *APAnchorClassMerge(AnchorPoint *anchors,AnchorClass *into,AnchorClass *from) {
- AnchorPoint *api=NULL, *prev, *ap, *next;
-
- prev = NULL;
- for ( ap=anchors; ap!=NULL; ap=next ) {
- next = ap->next;
- if ( ap->anchor==from ) {
- for ( api=anchors; api!=NULL; api=api->next ) {
- if ( api->anchor==into &&
- (api->type!=at_baselig || ap->type!=at_baselig || api->lig_index==ap->lig_index))
- break;
- }
- if ( api==NULL && into!=NULL ) {
- ap->anchor = into;
- prev = ap;
- } else {
- if ( prev==NULL )
- anchors = next;
- else
- prev->next = next;
- ap->next = NULL;
- AnchorPointsFree(ap);
- }
- } else
- prev = ap;
- }
-return( anchors );
-}
-
-AnchorPoint *AnchorPointsCopy(AnchorPoint *alist) {
- AnchorPoint *head=NULL, *last=NULL, *ap;
-
- while ( alist!=NULL ) {
- ap = chunkalloc(sizeof(AnchorPoint));
- *ap = *alist;
- if ( head==NULL )
- head = ap;
- else
- last->next = ap;
- last = ap;
- alist = alist->next;
- }
-return( head );
-}
-
-void AnchorPointsFree(AnchorPoint *ap) {
- AnchorPoint *anext;
- for ( ; ap!=NULL; ap = anext ) {
- anext = ap->next;
- chunkfree(ap,sizeof(AnchorPoint));
- }
-}
-
-
-void PSTFree(PST *pst) {
- PST *pnext;
- for ( ; pst!=NULL; pst = pnext ) {
- pnext = pst->next;
- if ( pst->type==pst_lcaret )
- free(pst->u.lcaret.carets);
- else if ( pst->type==pst_pair ) {
- free(pst->u.pair.paired);
- chunkfree(pst->u.pair.vr,sizeof(struct vr [2]));
- } else if ( pst->type!=pst_position ) {
- free(pst->u.subs.variant);
- } else if ( pst->type==pst_position ) {
- }
- chunkfree(pst,sizeof(PST));
- }
-}
-
-void FPSTRuleContentsFree(struct fpst_rule *r, enum fpossub_format format) {
- int j;
-
- switch ( format ) {
- case pst_glyphs:
- free(r->u.glyph.names);
- free(r->u.glyph.back);
- free(r->u.glyph.fore);
- break;
- case pst_class:
- free(r->u.class.nclasses);
- free(r->u.class.bclasses);
- free(r->u.class.fclasses);
- break;
- case pst_reversecoverage:
- free(r->u.rcoverage.replacements);
- case pst_coverage:
- for ( j=0 ; j<r->u.coverage.ncnt ; ++j )
- free(r->u.coverage.ncovers[j]);
- free(r->u.coverage.ncovers);
- for ( j=0 ; j<r->u.coverage.bcnt ; ++j )
- free(r->u.coverage.bcovers[j]);
- free(r->u.coverage.bcovers);
- for ( j=0 ; j<r->u.coverage.fcnt ; ++j )
- free(r->u.coverage.fcovers[j]);
- free(r->u.coverage.fcovers);
- break;
- default:
- break;
- }
- free(r->lookups);
-}
-
-void FPSTRulesFree(struct fpst_rule *r, enum fpossub_format format, int rcnt) {
- int i;
- for ( i=0; i<rcnt; ++i )
- FPSTRuleContentsFree(&r[i],format);
- free(r);
-}
-
-static struct fpst_rule *RulesCopy(struct fpst_rule *from, int cnt,
- enum fpossub_format format ) {
- int i, j;
- struct fpst_rule *to, *f, *t;
-
- if ( cnt==0 )
-return( NULL );
-
- to = gcalloc(cnt,sizeof(struct fpst_rule));
- for ( i=0; i<cnt; ++i ) {
- f = from+i; t = to+i;
- switch ( format ) {
- case pst_glyphs:
- t->u.glyph.names = copy(f->u.glyph.names);
- t->u.glyph.back = copy(f->u.glyph.back);
- t->u.glyph.fore = copy(f->u.glyph.fore);
- break;
- case pst_class:
- t->u.class.ncnt = f->u.class.ncnt;
- t->u.class.bcnt = f->u.class.bcnt;
- t->u.class.fcnt = f->u.class.fcnt;
- t->u.class.nclasses = galloc( f->u.class.ncnt*sizeof(uint16));
- memcpy(t->u.class.nclasses,f->u.class.nclasses,
- f->u.class.ncnt*sizeof(uint16));
- if ( t->u.class.bcnt!=0 ) {
- t->u.class.bclasses = galloc( f->u.class.bcnt*sizeof(uint16));
- memcpy(t->u.class.bclasses,f->u.class.bclasses,
- f->u.class.bcnt*sizeof(uint16));
- }
- if ( t->u.class.fcnt!=0 ) {
- t->u.class.fclasses = galloc( f->u.class.fcnt*sizeof(uint16));
- memcpy(t->u.class.fclasses,f->u.class.fclasses,
- f->u.class.fcnt*sizeof(uint16));
- }
- break;
- case pst_reversecoverage:
- t->u.rcoverage.replacements = copy(f->u.rcoverage.replacements);
- case pst_coverage:
- t->u.coverage.ncnt = f->u.coverage.ncnt;
- t->u.coverage.bcnt = f->u.coverage.bcnt;
- t->u.coverage.fcnt = f->u.coverage.fcnt;
- t->u.coverage.ncovers = galloc( f->u.coverage.ncnt*sizeof(char *));
- for ( j=0; j<t->u.coverage.ncnt; ++j )
- t->u.coverage.ncovers[j] = copy(f->u.coverage.ncovers[j]);
- if ( t->u.coverage.bcnt!=0 ) {
- t->u.coverage.bcovers = galloc( f->u.coverage.bcnt*sizeof(char *));
- for ( j=0; j<t->u.coverage.bcnt; ++j )
- t->u.coverage.bcovers[j] = copy(f->u.coverage.bcovers[j]);
- }
- if ( t->u.coverage.fcnt!=0 ) {
- t->u.coverage.fcovers = galloc( f->u.coverage.fcnt*sizeof(char *));
- for ( j=0; j<t->u.coverage.fcnt; ++j )
- t->u.coverage.fcovers[j] = copy(f->u.coverage.fcovers[j]);
- }
- break;
- default:
- break;
- }
- if ( f->lookup_cnt!=0 ) {
- t->lookup_cnt = f->lookup_cnt;
- t->lookups = galloc(t->lookup_cnt*sizeof(struct seqlookup));
- memcpy(t->lookups,f->lookups,t->lookup_cnt*sizeof(struct seqlookup));
- }
- }
-return( to );
-}
-
-FPST *FPSTCopy(FPST *fpst) {
- FPST *nfpst;
- int i;
-
- nfpst = chunkalloc(sizeof(FPST));
- *nfpst = *fpst;
- nfpst->next = NULL;
- if ( nfpst->nccnt!=0 ) {
- nfpst->nclass = galloc(nfpst->nccnt*sizeof(char *));
- for ( i=0; i<nfpst->nccnt; ++i )
- nfpst->nclass[i] = copy(fpst->nclass[i]);
- }
- if ( nfpst->bccnt!=0 ) {
- nfpst->bclass = galloc(nfpst->bccnt*sizeof(char *));
- for ( i=0; i<nfpst->bccnt; ++i )
- nfpst->bclass[i] = copy(fpst->bclass[i]);
- }
- if ( nfpst->fccnt!=0 ) {
- nfpst->fclass = galloc(nfpst->fccnt*sizeof(char *));
- for ( i=0; i<nfpst->fccnt; ++i )
- nfpst->fclass[i] = copy(fpst->fclass[i]);
- }
- nfpst->rules = RulesCopy(fpst->rules,fpst->rule_cnt,fpst->format);
-return( nfpst );
-}
-
-void FPSTFree(FPST *fpst) {
- FPST *next;
- int i;
-
- while ( fpst!=NULL ) {
- next = fpst->next;
- for ( i=0; i<fpst->nccnt; ++i )
- free(fpst->nclass[i]);
- for ( i=0; i<fpst->bccnt; ++i )
- free(fpst->bclass[i]);
- for ( i=0; i<fpst->fccnt; ++i )
- free(fpst->fclass[i]);
- free(fpst->nclass); free(fpst->bclass); free(fpst->fclass);
- for ( i=0; i<fpst->rule_cnt; ++i ) {
- FPSTRuleContentsFree( &fpst->rules[i],fpst->format );
- }
- free(fpst->rules);
- chunkfree(fpst,sizeof(FPST));
- fpst = next;
- }
-}
-
-void MinimumDistancesFree(MinimumDistance *md) {
- MinimumDistance *next;
-
- while ( md!=NULL ) {
- next = md->next;
- chunkfree(md,sizeof(MinimumDistance));
- md = next;
- }
-}
-
-void TTFLangNamesFree(struct ttflangname *l) {
- struct ttflangname *next;
- int i;
-
- while ( l!=NULL ) {
- next = l->next;
- for ( i=0; i<ttf_namemax; ++i )
- free(l->names[i]);
- chunkfree(l,sizeof(*l));
- l = next;
- }
-}
-
-void AltUniFree(struct altuni *altuni) {
- struct altuni *next;
-
- while ( altuni ) {
- next = altuni->next;
- chunkfree(altuni,sizeof(struct altuni));
- altuni = next;
- }
-}
-
-void LayerDefault(Layer *layer) {
- memset(layer,0,sizeof(Layer));
-}
-
-SplineChar *SplineCharCreate(int layer_cnt) {
- SplineChar *sc = chunkalloc(sizeof(SplineChar));
- int i;
-
- sc->color = COLOR_DEFAULT;
- sc->orig_pos = 0xffff;
- sc->unicodeenc = -1;
- sc->layer_cnt = layer_cnt;
- sc->layers = gcalloc(layer_cnt,sizeof(Layer));
- for ( i=0; i<layer_cnt; ++i )
- LayerDefault(&sc->layers[i]);
- sc->tex_height = sc->tex_depth = sc->italic_correction = sc->top_accent_horiz =
- TEX_UNDEF;
-return( sc );
-}
-
-SplineChar *SFSplineCharCreate(SplineFont *sf) {
- SplineChar *sc = SplineCharCreate(sf->layer_cnt);
- int i;
-
- for ( i=0; i<sf->layer_cnt; ++i ) {
- sc->layers[i].background = sf->layers[i].background;
- sc->layers[i].order2 = sf->layers[i].order2;
- }
- sc->parent = sf;
-return( sc );
-}
-
-void GlyphVariantsFree(struct glyphvariants *gv) {
- int i;
-
- if ( gv==NULL )
-return;
- free(gv->variants);
- for ( i=0; i<gv->part_cnt; ++i )
- free( gv->parts[i].component );
- free(gv->parts);
- chunkfree(gv,sizeof(*gv));
-}
-
-struct mathkern *MathKernCopy(struct mathkern *mk) {
- int i,j;
- struct mathkern *mknew;
-
- if ( mk==NULL )
-return( NULL );
- mknew = chunkalloc(sizeof(*mknew));
- for ( i=0; i<4; ++i ) {
- struct mathkernvertex *mkv = &(&mk->top_right)[i];
- struct mathkernvertex *mknewv = &(&mknew->top_right)[i];
- mknewv->cnt = mkv->cnt;
- if ( mknewv->cnt!=0 ) {
- mknewv->mkd = gcalloc(mkv->cnt,sizeof(struct mathkerndata));
- for ( j=0; j<mkv->cnt; ++j ) {
- mknewv->mkd[j].height = mkv->mkd[j].height;
- mknewv->mkd[j].kern = mkv->mkd[j].kern;
- }
- }
- }
-return( mknew );
-}
-
-void MathKernVContentsFree(struct mathkernvertex *mk) {
- free(mk->mkd);
-}
-
-void MathKernFree(struct mathkern *mk) {
- int i;
-
- if ( mk==NULL )
-return;
- for ( i=0; i<4; ++i )
- MathKernVContentsFree( &(&mk->top_right)[i] );
- chunkfree(mk,sizeof(*mk));
-}
-
-void SplineCharListsFree(struct splinecharlist *dlist) {
- struct splinecharlist *dnext;
- for ( ; dlist!=NULL; dlist = dnext ) {
- dnext = dlist->next;
- chunkfree(dlist,sizeof(struct splinecharlist));
- }
-}
-
-void LayerFreeContents(SplineChar *sc,int layer) {
- SplinePointListsFree(sc->layers[layer].splines);
- RefCharsFree(sc->layers[layer].refs);
- ImageListsFree(sc->layers[layer].images);
- /* image garbage collection????!!!! */
- UndoesFree(sc->layers[layer].undoes);
- UndoesFree(sc->layers[layer].redoes);
-}
-
-void SplineCharFreeContents(SplineChar *sc) {
- int i;
-
- if ( sc==NULL )
-return;
- free(sc->name);
- free(sc->comment);
- for ( i=0; i<sc->layer_cnt; ++i )
- LayerFreeContents(sc,i);
- StemInfosFree(sc->hstem);
- StemInfosFree(sc->vstem);
- DStemInfosFree(sc->dstem);
- MinimumDistancesFree(sc->md);
- KernPairsFree(sc->kerns);
- KernPairsFree(sc->vkerns);
- AnchorPointsFree(sc->anchor);
- SplineCharListsFree(sc->dependents);
- PSTFree(sc->possub);
- free(sc->ttf_instrs);
- free(sc->countermasks);
- free(sc->layers);
- AltUniFree(sc->altuni);
- GlyphVariantsFree(sc->horiz_variants);
- GlyphVariantsFree(sc->vert_variants);
- MathKernFree(sc->mathkern);
-#if defined(_NO_PYTHON)
- free( sc->python_persistent ); /* It's a string of pickled data which we leave as a string */
-#else
- PyFF_FreeSC(sc);
-#endif
-}
-
-void SplineCharFree(SplineChar *sc) {
-
- if ( sc==NULL )
-return;
- SplineCharFreeContents(sc);
- chunkfree(sc,sizeof(SplineChar));
-}
-
-void AnchorClassesFree(AnchorClass *an) {
- AnchorClass *anext;
- for ( ; an!=NULL; an = anext ) {
- anext = an->next;
- free(an->name);
- chunkfree(an,sizeof(AnchorClass));
- }
-}
-
-void TtfTablesFree(struct ttf_table *tab) {
- struct ttf_table *next;
-
- for ( ; tab!=NULL; tab = next ) {
- next = tab->next;
- free(tab->data);
- chunkfree(tab,sizeof(struct ttf_table));
- }
-}
-
-void ScriptLangListFree(struct scriptlanglist *sl) {
- struct scriptlanglist *next;
-
- while ( sl!=NULL ) {
- next = sl->next;
- free(sl->morelangs);
- chunkfree(sl,sizeof(*sl));
- sl = next;
- }
-}
-
-void FeatureScriptLangListFree(FeatureScriptLangList *fl) {
- FeatureScriptLangList *next;
-
- while ( fl!=NULL ) {
- next = fl->next;
- ScriptLangListFree(fl->scripts);
- chunkfree(fl,sizeof(*fl));
- fl = next;
- }
-}
-
-void OTLookupFree(OTLookup *lookup) {
- struct lookup_subtable *st, *stnext;
-
- free(lookup->lookup_name);
- FeatureScriptLangListFree(lookup->features);
- for ( st=lookup->subtables; st!=NULL; st=stnext ) {
- stnext = st->next;
- free(st->subtable_name);
- free(st->suffix);
- chunkfree(st,sizeof(struct lookup_subtable));
- }
- chunkfree( lookup,sizeof(OTLookup) );
-}
-
-void OTLookupListFree(OTLookup *lookup ) {
- OTLookup *next;
-
- for ( ; lookup!=NULL; lookup = next ) {
- next = lookup->next;
- OTLookupFree(lookup);
- }
-}
-
-KernClass *KernClassCopy(KernClass *kc) {
- KernClass *new;
- int i;
-
- if ( kc==NULL )
-return( NULL );
- new = chunkalloc(sizeof(KernClass));
- *new = *kc;
- new->firsts = galloc(new->first_cnt*sizeof(char *));
- new->seconds = galloc(new->second_cnt*sizeof(char *));
- new->offsets = galloc(new->first_cnt*new->second_cnt*sizeof(int16));
- memcpy(new->offsets,kc->offsets, new->first_cnt*new->second_cnt*sizeof(int16));
- for ( i=0; i<new->first_cnt; ++i )
- new->firsts[i] = copy(kc->firsts[i]);
- for ( i=0; i<new->second_cnt; ++i )
- new->seconds[i] = copy(kc->seconds[i]);
- new->next = NULL;
-return( new );
-}
-
-void KernClassFreeContents(KernClass *kc) {
- int i;
- /* Issue 863 */
- for ( i=0; i<kc->first_cnt; ++i )
- free(kc->firsts[i]);
- for ( i=0; i<kc->second_cnt; ++i )
- free(kc->seconds[i]);
- free(kc->firsts);
- free(kc->seconds);
- free(kc->offsets);
-}
-
-void KernClassListFree(KernClass *kc) {
- KernClass *n;
-
- while ( kc ) {
- KernClassFreeContents(kc);
- n = kc->next;
- chunkfree(kc,sizeof(KernClass));
- kc = n;
- }
-}
-
-void OtfNameListFree(struct otfname *on) {
- struct otfname *on_next;
-
- for ( ; on!=NULL; on = on_next ) {
- on_next = on->next;
- free(on->name);
- chunkfree(on,sizeof(*on));
- }
-}
-
-EncMap *EncMapNew(int enccount,int backmax,Encoding *enc) {
- EncMap *map = chunkalloc(sizeof(EncMap));
-
- map->enccount = map->encmax = enccount;
- map->backmax = backmax;
- map->map = galloc(enccount*sizeof(int));
- memset(map->map,-1,enccount*sizeof(int));
- map->backmap = galloc(backmax*sizeof(int));
- memset(map->backmap,-1,backmax*sizeof(int));
- map->enc = enc;
-return(map);
-}
-
-EncMap *EncMap1to1(int enccount) {
- EncMap *map = chunkalloc(sizeof(EncMap));
- /* Used for CID fonts where CID is same as orig_pos */
- int i;
-
- map->enccount = map->encmax = map->backmax = enccount;
- map->map = galloc(enccount*sizeof(int));
- map->backmap = galloc(enccount*sizeof(int));
- for ( i=0; i<enccount; ++i )
- map->map[i] = map->backmap[i] = i;
- map->enc = &custom;
-return(map);
-}
-
-static void EncodingFree(Encoding *enc) {
- int i;
-
- if ( enc==NULL )
-return;
- free(enc->enc_name);
- free(enc->unicode);
- if ( enc->psnames!=NULL ) {
- for ( i=0; i<enc->char_cnt; ++i )
- free(enc->psnames[i]);
- free(enc->psnames);
- }
- free(enc);
-}
-
-void EncMapFree(EncMap *map) {
- if ( map==NULL )
-return;
-
- if ( map->enc->is_temporary )
- EncodingFree(map->enc);
- free(map->map);
- free(map->backmap);
- free(map->remap);
- chunkfree(map,sizeof(EncMap));
-}
-
-EncMap *EncMapCopy(EncMap *map) {
- EncMap *new;
-
- new = chunkalloc(sizeof(EncMap));
- *new = *map;
- new->map = galloc(new->encmax*sizeof(int));
- new->backmap = galloc(new->backmax*sizeof(int));
- memcpy(new->map,map->map,new->enccount*sizeof(int));
- memcpy(new->backmap,map->backmap,new->backmax*sizeof(int));
- if ( map->remap ) {
- int n;
- for ( n=0; map->remap[n].infont!=-1; ++n );
- new->remap = galloc(n*sizeof(struct remap));
- memcpy(new->remap,map->remap,n*sizeof(struct remap));
- }
-return( new );
-}
-
-void MarkClassFree(int cnt,char **classes,char **names) {
- int i;
-
- for ( i=1; i<cnt; ++i ) {
- free( classes[i] );
- free( names[i] );
- }
- free( classes );
- free( names );
-}
-
-struct baselangextent *BaseLangCopy(struct baselangextent *extent) {
- struct baselangextent *head, *last, *cur;
-
- last = head = NULL;
- for ( ; extent!=NULL; extent = extent->next ) {
- cur = chunkalloc(sizeof(struct baselangextent));
- *cur = *extent;
- cur->features = BaseLangCopy(cur->features);
- if ( head==NULL )
- head = cur;
- else
- last->next = cur;
- last = cur;
- }
-return( head );
-}
-
-void BaseLangFree(struct baselangextent *extent) {
- struct baselangextent *next;
-
- while ( extent!=NULL ) {
- next = extent->next;
- BaseLangFree(extent->features);
- chunkfree(extent,sizeof(struct baselangextent));
- extent = next;
- }
-}
-
-void BaseScriptFree(struct basescript *bs) {
- struct basescript *next;
-
- while ( bs!=NULL ) {
- next = bs->next;
- free(bs->baseline_pos);
- BaseLangFree(bs->langs);
- chunkfree(bs,sizeof(struct basescript));
- bs = next;
- }
-}
-
-void BaseFree(struct Base *base) {
- if ( base==NULL )
-return;
-
- free(base->baseline_tags);
- BaseScriptFree(base->scripts);
- chunkfree(base,sizeof(struct Base));
-}
-
-void SplineFontFree(SplineFont *sf) {
- int i;
-
- if ( sf==NULL )
-return;
- if ( sf->mm!=NULL ) {
- MMSetFree(sf->mm);
-return;
- }
- for ( i=0; i<sf->glyphcnt; ++i ) if ( sf->glyphs[i]!=NULL )
- SplineCharFree(sf->glyphs[i]);
- free(sf->glyphs);
- free(sf->fontname);
- free(sf->fullname);
- free(sf->familyname);
- free(sf->weight);
- free(sf->copyright);
- free(sf->comments);
- free(sf->filename);
- free(sf->origname);
- free(sf->autosavename);
- free(sf->version);
- free(sf->xuid);
- free(sf->cidregistry);
- free(sf->ordering);
- /* We don't free the EncMap. That field is only a temporary pointer. Let the FontViewBase free it, that's where it really lives */
- SplinePointListsFree(sf->grid.splines);
- AnchorClassesFree(sf->anchor);
- TtfTablesFree(sf->ttf_tables);
- TtfTablesFree(sf->ttf_tab_saved);
- UndoesFree(sf->grid.undoes);
- UndoesFree(sf->grid.redoes);
- PSDictFree(sf->private);
- TTFLangNamesFree(sf->names);
- for ( i=0; i<sf->subfontcnt; ++i )
- SplineFontFree(sf->subfonts[i]);
- free(sf->subfonts);
- GlyphHashFree(sf);
- OTLookupListFree(sf->gpos_lookups);
- OTLookupListFree(sf->gsub_lookups);
- KernClassListFree(sf->kerns);
- KernClassListFree(sf->vkerns);
- FPSTFree(sf->possub);
- OtfNameListFree(sf->fontstyle_name);
- MarkClassFree(sf->mark_class_cnt,sf->mark_classes,sf->mark_class_names);
- free( sf->gasp );
-#if defined(_NO_PYTHON)
- free( sf->python_persistent ); /* It's a string of pickled data which we leave as a string */
-#else
- PyFF_FreeSF(sf);
-#endif
- BaseFree(sf->horiz_base);
- BaseFree(sf->vert_base);
- /* issue 863 */
- for ( i=0; i < sf->layer_cnt; ++i )
- free (sf->layers[i].name);
- free(sf->layers);
- free(sf->MATH);
- free(sf);
-}
-
-void MMSetFreeContents(MMSet *mm) {
- int i;
-
- free(mm->instances);
-
- free(mm->positions);
- free(mm->defweights);
-
- for ( i=0; i<mm->axis_count; ++i ) {
- free(mm->axes[i]);
- free(mm->axismaps[i].blends);
- free(mm->axismaps[i].designs);
- }
- free(mm->axismaps);
- free(mm->cdv);
- free(mm->ndv);
-}
-
-void MMSetFree(MMSet *mm) {
- int i;
-
- for ( i=0; i<mm->instance_count; ++i ) {
- mm->instances[i]->mm = NULL;
- mm->instances[i]->map = NULL;
- SplineFontFree(mm->instances[i]);
- }
- mm->normal->mm = NULL;
- SplineFontFree(mm->normal); /* EncMap gets freed here */
- MMSetFreeContents(mm);
-
- chunkfree(mm,sizeof(*mm));
-}
-
-static int SplineRemoveAnnoyingExtrema1(Spline *s,int which,double err_sq) {
- /* Remove extrema which are very close to one of the spline end-points */
- /* and which are in the oposite direction (along the normal of the */
- /* close end-point's cp) from the other end-point */
- extended ts[2], t1, t2;
- bigreal df, dt;
- bigreal dp, d_o;
- int i;
- BasePoint pos, norm;
- SplinePoint *close, *other;
- BasePoint *ccp;
- bigreal c_, b_, nextcp, prevcp, prop;
- int changed = false;
-
- SplineFindExtrema(&s->splines[which],&ts[0],&ts[1]);
-
- for ( i=0; i<2; ++i ) if ( ts[i]!=-1 && ts[i]!=0 && ts[i]!=1 ) {
- pos.x = ((s->splines[0].a*ts[i]+s->splines[0].b)*ts[i]+s->splines[0].c)*ts[i]+s->splines[0].d;
- pos.y = ((s->splines[1].a*ts[i]+s->splines[1].b)*ts[i]+s->splines[1].c)*ts[i]+s->splines[1].d;
- df = (pos.x-s->from->me.x)*(pos.x-s->from->me.x) + (pos.y-s->from->me.y)*(pos.y-s->from->me.y);
- dt = (pos.x-s->to->me.x)*(pos.x-s->to->me.x) + (pos.y-s->to->me.y)*(pos.y-s->to->me.y);
- if ( df<dt && df<err_sq ) {
- close = s->from;
- ccp = &s->from->nextcp;
- other = s->to;
- } else if ( dt<df && dt<err_sq ) {
- close = s->to;
- ccp = &s->to->prevcp;
- other = s->from;
- } else
- continue;
- if ( ccp->x==close->me.x && ccp->y==close->me.y )
- continue;
-
- norm.x = (ccp->y-close->me.y);
- norm.y = -(ccp->x-close->me.x);
- dp = (pos.x-close->me.x)*norm.x + (pos.y-close->me.y)*norm.y;
- d_o = (other->me.x-close->me.x)*norm.x + (other->me.y-close->me.y)*norm.y;
- if ( dp!=0 && dp*d_o>=0 )
- continue;
-
- _SplineFindExtrema(&s->splines[which],&t1,&t2);
- if ( t1==ts[i] ) {
- if ( close==s->from ) t1=0;
- else t1 = 1;
- } else if ( t2==ts[i] ) {
- if ( close==s->from ) t2=0;
- else t2 = 1;
- } else
- continue;
-
- if ( t2==-1 ) /* quadratic */
- continue; /* Can't happen in a quadratic */
-
- /* The roots of the "slope" quadratic were t1, t2. We have shifted one*/
- /* root so that that extremum is exactly on an end point */
- /* Figure out the new slope quadratic, from that what the cubic must */
- /* be, and from that what the control points must be */
- /* Quad = 3at^2 + 2bt + c */
- /* New quad = 3a * (t^2 -(t1+t2)t + t1*t2) */
- /* a' = a, b' = -(t1+t2)/6a, c' = t1*t2/3a, d' = d */
- /* nextcp = from + c'/3, prevcp = nextcp + (b' + c')/3 */
- /* Then for each cp figure what percentage of the original cp vector */
- /* (or at least this one dimension of that vector) this represents */
- /* and scale both dimens by this amount */
- b_ = -(t1+t2)*3*s->splines[which].a/2;
- c_ = (t1*t2)*3*s->splines[which].a;
- nextcp = (&s->from->me.x)[which] + c_/3;
- prevcp = nextcp + (b_ + c_)/3;
-
- if ( (&s->from->nextcp.x)[which] != (&s->from->me.x)[which] ) {
- prop = (c_/3) / ( (&s->from->nextcp.x)[which] - (&s->from->me.x)[which] );
- if ( prop<0 && (c_/3 < .1 && c_/3 > -.1))
- (&s->to->prevcp.x)[which] = nextcp;
- else if ( prop>=0 && prop<=10 ) {
- s->from->nextcp.x = s->from->me.x + prop*(s->from->nextcp.x-s->from->me.x);
- s->from->nextcp.y = s->from->me.y + prop*(s->from->nextcp.y-s->from->me.y);
- s->from->nonextcp = (prop == 0);
- }
- }
-
- if ( (&s->to->prevcp.x)[which] != (&s->to->me.x)[which] ) {
- prop = ( prevcp - (&s->to->me.x)[which]) /
- ( (&s->to->prevcp.x)[which] - (&s->to->me.x)[which] );
- if ( prop<0 && (prevcp - (&s->to->me.x)[which] < .1 && prevcp - (&s->to->me.x)[which] > -.1))
- (&s->to->prevcp.x)[which] = prevcp;
- else if ( prop>=0 && prop<=10 ) {
- s->to->prevcp.x = s->to->me.x + prop*(s->to->prevcp.x-s->to->me.x);
- s->to->prevcp.y = s->to->me.y + prop*(s->to->prevcp.y-s->to->me.y);
- s->to->noprevcp = (prop == 0);
- }
- }
- SplineRefigure(s);
- changed = true;
- }
-return( changed );
-}
-
-static int SplineRemoveAnnoyingExtrema(Spline *s,double err_sq) {
- int changed;
-
- changed = SplineRemoveAnnoyingExtrema1(s,0,err_sq);
- if ( SplineRemoveAnnoyingExtrema1(s,1,err_sq) )
- changed = true;
-return( changed );
-}
-
-int SplineSetsRemoveAnnoyingExtrema(SplineSet *ss,double err) {
- int changed = false;
- double err_sq = err*err;
- Spline *s, *first;
-
-
- while ( ss!=NULL ) {
- first = NULL;
- for ( s = ss->first->next; s!=NULL && s!=first; s = s->to->next ) {
- if ( first == NULL ) first = s;
- if ( SplineRemoveAnnoyingExtrema(s,err_sq))
- changed = true;
- }
- ss = ss->next;
- }
-return( changed );
-}
-
-SplinePoint *SplineBisect(Spline *spline, extended t) {
- Spline1 xstart, xend;
- Spline1 ystart, yend;
- Spline *spline1, *spline2;
- SplinePoint *mid;
- SplinePoint *old0, *old1;
- Spline1D *xsp = &spline->splines[0], *ysp = &spline->splines[1];
- int order2 = spline->order2;
-
-#ifdef DEBUG
- if ( t<=1e-3 || t>=1-1e-3 )
- IError("Bisection to create a zero length spline");
-#endif
- xstart.s0 = xsp->d; ystart.s0 = ysp->d;
- xend.s1 = (extended) xsp->a+xsp->b+xsp->c+xsp->d;
- yend.s1 = (extended) ysp->a+ysp->b+ysp->c+ysp->d;
- xstart.s1 = xend.s0 = ((xsp->a*t+xsp->b)*t+xsp->c)*t + xsp->d;
- ystart.s1 = yend.s0 = ((ysp->a*t+ysp->b)*t+ysp->c)*t + ysp->d;
- FigureSpline1(&xstart,0,t,xsp);
- FigureSpline1(&xend,t,1,xsp);
- FigureSpline1(&ystart,0,t,ysp);
- FigureSpline1(&yend,t,1,ysp);
-
- mid = chunkalloc(sizeof(SplinePoint));
- mid->me.x = xstart.s1; mid->me.y = ystart.s1;
- if ( order2 ) {
- mid->nextcp.x = xend.sp.d + xend.sp.c/2;
- mid->nextcp.y = yend.sp.d + yend.sp.c/2;
- mid->prevcp.x = xstart.sp.d + xstart.sp.c/2;
- mid->prevcp.y = ystart.sp.d + ystart.sp.c/2;
- } else {
- mid->nextcp.x = xend.c0; mid->nextcp.y = yend.c0;
- mid->prevcp.x = xstart.c1; mid->prevcp.y = ystart.c1;
- }
- if ( mid->me.x==mid->nextcp.x && mid->me.y==mid->nextcp.y )
- mid->nonextcp = true;
- if ( mid->me.x==mid->prevcp.x && mid->me.y==mid->prevcp.y )
- mid->noprevcp = true;
-
- old0 = spline->from; old1 = spline->to;
- if ( order2 ) {
- old0->nextcp = mid->prevcp;
- old1->prevcp = mid->nextcp;
- } else {
- old0->nextcp.x = xstart.c0; old0->nextcp.y = ystart.c0;
- old1->prevcp.x = xend.c1; old1->prevcp.y = yend.c1;
- }
- old0->nonextcp = (old0->nextcp.x==old0->me.x && old0->nextcp.y==old0->me.y);
- old1->noprevcp = (old1->prevcp.x==old1->me.x && old1->prevcp.y==old1->me.y);
- old0->nextcpdef = false;
- old1->prevcpdef = false;
- SplineFree(spline);
-
- spline1 = chunkalloc(sizeof(Spline));
- spline1->splines[0] = xstart.sp; spline1->splines[1] = ystart.sp;
- spline1->from = old0;
- spline1->to = mid;
- spline1->order2 = order2;
- old0->next = spline1;
- mid->prev = spline1;
- if ( SplineIsLinear(spline1)) {
- spline1->islinear = spline1->from->nonextcp = spline1->to->noprevcp = true;
- spline1->from->nextcp = spline1->from->me;
- spline1->to->prevcp = spline1->to->me;
- }
- SplineRefigure(spline1);
-
- spline2 = chunkalloc(sizeof(Spline));
- spline2->splines[0] = xend.sp; spline2->splines[1] = xend.sp;
- spline2->from = mid;
- spline2->to = old1;
- spline2->order2 = order2;
- mid->next = spline2;
- old1->prev = spline2;
- if ( SplineIsLinear(spline2)) {
- spline2->islinear = spline2->from->nonextcp = spline2->to->noprevcp = true;
- spline2->from->nextcp = spline2->from->me;
- spline2->to->prevcp = spline2->to->me;
- }
- SplineRefigure(spline2);
-return( mid );
-}
-
diff --git a/Build/source/texk/web2c/luatexdir/luafontloader/fontforge/fontforge/splineutil2.c b/Build/source/texk/web2c/luatexdir/luafontloader/fontforge/fontforge/splineutil2.c
deleted file mode 100644
index 8de073da4ce..00000000000
--- a/Build/source/texk/web2c/luatexdir/luafontloader/fontforge/fontforge/splineutil2.c
+++ /dev/null
@@ -1,2328 +0,0 @@
-/* Copyright (C) 2000-2008 by George Williams */
-/*
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are met:
-
- * Redistributions of source code must retain the above copyright notice, this
- * list of conditions and the following disclaimer.
-
- * Redistributions in binary form must reproduce the above copyright notice,
- * this list of conditions and the following disclaimer in the documentation
- * and/or other materials provided with the distribution.
-
- * The name of the author may not be used to endorse or promote products
- * derived from this software without specific prior written permission.
-
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
- * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
- * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
- * EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
- * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
- * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
- * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
- * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-#include "pfaedit.h"
-#include <math.h>
-#include "ustring.h"
-#include "chardata.h"
-#include <unistd.h>
-#include <time.h>
-#include <stdlib.h>
-
-int new_em_size = 1000;
-int new_fonts_are_order2 = false;
-int loaded_fonts_same_as_new = false;
-int default_fv_row_count = 4;
-int default_fv_col_count = 16;
-int default_fv_font_size = 24;
-int default_fv_antialias=true;
-int default_fv_bbsized=true;
-int snaptoint=0;
-
-/*#define DEBUG 1*/
-
-int RealNear(real a,real b) {
- real d;
-
-#if 0 /* def FONTFORGE_CONFIG_USE_DOUBLE*/
- if ( a==0 )
-return( b>-1e-8 && b<1e-8 );
- if ( b==0 )
-return( a>-1e-8 && a<1e-8 );
-
- d = a/(1024*1024.);
- if ( d<0 ) d = -d;
-return( b>a-d && b<a+d );
-#else /* For floats */
- if ( a==0 )
-return( b>-1e-5 && b<1e-5 );
- if ( b==0 )
-return( a>-1e-5 && a<1e-5 );
-
- d = a/(1024*64.);
- if ( d<0 ) d = -d;
-return( b>a-d && b<a+d );
-#endif
-}
-
-int RealNearish(real a,real b) {
-
- if ( a-b<.001 && a-b>-.001 )
-return( true );
-return( false );
-}
-
-int RealApprox(real a,real b) {
-
- if ( a==0 ) {
- if ( b<.0001 && b>-.0001 )
-return( true );
- } else if ( b==0 ) {
- if ( a<.0001 && a>-.0001 )
-return( true );
- } else {
- a /= b;
- if ( a>=.95 && a<=1.05 )
-return( true );
- }
-return( false );
-}
-
-int RealWithin(real a,real b,real fudge) {
-
-return( b>=a-fudge && b<=a+fudge );
-}
-
-int RealRatio(real a,real b,real fudge) {
-
- if ( b==0 )
-return( RealWithin(a,b,fudge));
-
-return( RealWithin(a/b,1.0,fudge));
-}
-
-static int MinMaxWithin(Spline *spline) {
- extended dx, dy;
- int which;
- extended t1, t2;
- extended w;
- /* We know that this "spline" is basically one dimensional. As long as its*/
- /* extrema are between the start and end points on that line then we can */
- /* treat it as a line. If the extrema are way outside the line segment */
- /* then it's a line that backtracks on itself */
-
- if ( (dx = spline->to->me.x - spline->from->me.x)<0 ) dx = -dx;
- if ( (dy = spline->to->me.y - spline->from->me.y)<0 ) dy = -dy;
- which = dx<dy;
- SplineFindExtrema(&spline->splines[which],&t1,&t2);
- if ( t1==-1 )
-return( true );
- w = ((spline->splines[which].a*t1 + spline->splines[which].b)*t1
- + spline->splines[which].c)*t1 + spline->splines[which].d;
- if ( RealNear(w, (&spline->to->me.x)[which]) || RealNear(w, (&spline->from->me.x)[which]) )
- /* Close enough */;
- else if ( (w<(&spline->to->me.x)[which] && w<(&spline->from->me.x)[which]) ||
- (w>(&spline->to->me.x)[which] && w>(&spline->from->me.x)[which]) )
-return( false ); /* Outside */
-
- w = ((spline->splines[which].a*t2 + spline->splines[which].b)*t2
- + spline->splines[which].c)*t2 + spline->splines[which].d;
- if ( RealNear(w, (&spline->to->me.x)[which]) || RealNear(w, (&spline->from->me.x)[which]) )
- /* Close enough */;
- else if ( (w<(&spline->to->me.x)[which] && w<(&spline->from->me.x)[which]) ||
- (w>(&spline->to->me.x)[which] && w>(&spline->from->me.x)[which]) )
-return( false ); /* Outside */
-
-return( true );
-}
-
-int SplineIsLinear(Spline *spline) {
- double t1,t2, t3,t4;
- int ret;
-
- if ( spline->knownlinear )
-return( true );
- if ( spline->knowncurved )
-return( false );
-
- if ( spline->splines[0].a==0 && spline->splines[0].b==0 &&
- spline->splines[1].a==0 && spline->splines[1].b==0 )
-return( true );
-
- /* Something is linear if the control points lie on the line between the */
- /* two base points */
-
- /* Vertical lines */
- if ( RealNear(spline->from->me.x,spline->to->me.x) ) {
- ret = RealNear(spline->from->me.x,spline->from->nextcp.x) &&
- RealNear(spline->from->me.x,spline->to->prevcp.x);
- if ( ! ((spline->from->nextcp.y >= spline->from->me.y &&
- spline->from->nextcp.y <= spline->to->me.y &&
- spline->to->prevcp.y >= spline->from->me.y &&
- spline->to->prevcp.y <= spline->to->me.y ) ||
- (spline->from->nextcp.y <= spline->from->me.y &&
- spline->from->nextcp.y >= spline->to->me.y &&
- spline->to->prevcp.y <= spline->from->me.y &&
- spline->to->prevcp.y >= spline->to->me.y )) )
- ret = MinMaxWithin(spline);
- /* Horizontal lines */
- } else if ( RealNear(spline->from->me.y,spline->to->me.y) ) {
- ret = RealNear(spline->from->me.y,spline->from->nextcp.y) &&
- RealNear(spline->from->me.y,spline->to->prevcp.y);
- if ( ! ((spline->from->nextcp.x >= spline->from->me.x &&
- spline->from->nextcp.x <= spline->to->me.x &&
- spline->to->prevcp.x >= spline->from->me.x &&
- spline->to->prevcp.x <= spline->to->me.x) ||
- (spline->from->nextcp.x <= spline->from->me.x &&
- spline->from->nextcp.x >= spline->to->me.x &&
- spline->to->prevcp.x <= spline->from->me.x &&
- spline->to->prevcp.x >= spline->to->me.x)) )
- ret = MinMaxWithin(spline);
- } else {
- ret = true;
- t1 = (spline->from->nextcp.y-spline->from->me.y)/(spline->to->me.y-spline->from->me.y);
- t2 = (spline->from->nextcp.x-spline->from->me.x)/(spline->to->me.x-spline->from->me.x);
- t3 = (spline->to->me.y-spline->to->prevcp.y)/(spline->to->me.y-spline->from->me.y);
- t4 = (spline->to->me.x-spline->to->prevcp.x)/(spline->to->me.x-spline->from->me.x);
- ret = (RealApprox(t1,t2) || (RealApprox(t1,0) && RealApprox(t2,0))) &&
- (RealApprox(t3,t4) || (RealApprox(t3,0) && RealApprox(t4,0)));
- if ( ret ) {
- if ( t1<0 || t2<0 || t3<0 || t4<0 ||
- t1>1 || t2>1 || t3>1 || t4>1 )
- ret = MinMaxWithin(spline);
- }
- }
- spline->knowncurved = !ret;
- spline->knownlinear = ret;
- if ( ret ) {
- /* A few places that if the spline is knownlinear then its splines[?] */
- /* are linear. So give the linear version and not that suggested by */
- /* the control points */
- spline->splines[0].a = spline->splines[0].b = 0;
- spline->splines[0].d = spline->from->me.x;
- spline->splines[0].c = spline->to->me.x-spline->from->me.x;
- spline->splines[1].a = spline->splines[1].b = 0;
- spline->splines[1].d = spline->from->me.y;
- spline->splines[1].c = spline->to->me.y-spline->from->me.y;
- }
-return( ret );
-}
-
-int SplineIsLinearMake(Spline *spline) {
-
- if ( spline->islinear )
-return( true );
- if ( SplineIsLinear(spline)) {
- spline->islinear = spline->from->nonextcp = spline->to->noprevcp = true;
- spline->from->nextcp = spline->from->me;
- if ( spline->from->nonextcp && spline->from->noprevcp )
- spline->from->pointtype = pt_corner;
- else if ( spline->from->pointtype == pt_curve || spline->from->pointtype == pt_hvcurve )
- spline->from->pointtype = pt_tangent;
- spline->to->prevcp = spline->to->me;
- if ( spline->to->nonextcp && spline->to->noprevcp )
- spline->to->pointtype = pt_corner;
- else if ( spline->to->pointtype == pt_curve || spline->to->pointtype == pt_hvcurve )
- spline->to->pointtype = pt_tangent;
- SplineRefigure(spline);
- }
-return( spline->islinear );
-}
-
-static Spline *IsLinearApprox(SplinePoint *from, SplinePoint *to,
- TPoint *mid, int cnt, int order2) {
- double vx, vy, slope;
- int i;
-
- vx = to->me.x-from->me.x; vy = to->me.y-from->me.y;
- if ( vx==0 && vy==0 ) {
- for ( i=0; i<cnt; ++i )
- if ( mid[i].x != from->me.x || mid[i].y != from->me.y )
-return( NULL );
- } else if ( fabs(vx)>fabs(vy) ) {
- slope = vy/vx;
- for ( i=0; i<cnt; ++i )
- if ( !RealWithin(mid[i].y,from->me.y+slope*(mid[i].x-from->me.x),.7) )
-return( NULL );
- } else {
- slope = vx/vy;
- for ( i=0; i<cnt; ++i )
- if ( !RealWithin(mid[i].x,from->me.x+slope*(mid[i].y-from->me.y),.7) )
-return( NULL );
- }
- from->nonextcp = to->noprevcp = true;
-return( SplineMake(from,to,order2) );
-}
-
-/* Least squares tells us that:
- | S(xi*ti^3) | | S(ti^6) S(ti^5) S(ti^4) S(ti^3) | | a |
- | S(xi*ti^2) | = | S(ti^5) S(ti^4) S(ti^3) S(ti^2) | * | b |
- | S(xi*ti) | | S(ti^4) S(ti^3) S(ti^2) S(ti) | | c |
- | S(xi) | | S(ti^3) S(ti^2) S(ti) n | | d |
- and the definition of a spline tells us:
- | x1 | = | 1 1 1 1 | * (a b c d)
- | x0 | = | 0 0 0 1 | * (a b c d)
-So we're a bit over specified. Let's use the last two lines of least squares
-and the 2 from the spline defn. So d==x0. Now we've got three unknowns
-and only three equations...
-
-For order2 splines we've got
- | S(xi*ti^2) | | S(ti^4) S(ti^3) S(ti^2) | | b |
- | S(xi*ti) | = | S(ti^3) S(ti^2) S(ti) | * | c |
- | S(xi) | | S(ti^2) S(ti) n | | d |
- and the definition of a spline tells us:
- | x1 | = | 1 1 1 | * (b c d)
- | x0 | = | 0 0 1 | * (b c d)
-=>
- d = x0
- b+c = x1-x0
- S(ti^2)*b + S(ti)*c = S(xi)-n*x0
- S(ti^2)*b + S(ti)*(x1-x0-b) = S(xi)-n*x0
- [ S(ti^2)-S(ti) ]*b = S(xi)-S(ti)*(x1-x0) - n*x0
-*/
-static int _ApproximateSplineFromPoints(SplinePoint *from, SplinePoint *to,
- TPoint *mid, int cnt, BasePoint *nextcp, BasePoint *prevcp,
- int order2) {
- double tt, ttn;
- int i, j, ret;
- double vx[3], vy[3], m[3][3];
- double ts[7], xts[4], yts[4];
- BasePoint nres, pres;
- int nrescnt=0, prescnt=0;
- double nmin, nmax, pmin, pmax, test, ptest;
- double bx, by, cx, cy;
-
- memset(&nres,0,sizeof(nres)); memset(&pres,0,sizeof(pres));
-
- /* Add the initial and end points */
- ts[0] = 2; for ( i=1; i<7; ++i ) ts[i] = 1;
- xts[0] = from->me.x+to->me.x; yts[0] = from->me.y+to->me.y;
- xts[3] = xts[2] = xts[1] = to->me.x; yts[3] = yts[2] = yts[1] = to->me.y;
- nmin = pmin = 0; nmax = pmax = (to->me.x-from->me.x)*(to->me.x-from->me.x)+(to->me.y-from->me.y)*(to->me.y-from->me.y);
- for ( i=0; i<cnt; ++i ) {
- xts[0] += mid[i].x;
- yts[0] += mid[i].y;
- ++ts[0];
- tt = mid[i].t;
- xts[1] += tt*mid[i].x;
- yts[1] += tt*mid[i].y;
- ts[1] += tt;
- ts[2] += (ttn=tt*tt);
- xts[2] += ttn*mid[i].x;
- yts[2] += ttn*mid[i].y;
- ts[3] += (ttn*=tt);
- xts[3] += ttn*mid[i].x;
- yts[3] += ttn*mid[i].y;
- ts[4] += (ttn*=tt);
- ts[5] += (ttn*=tt);
- ts[6] += (ttn*=tt);
-
- test = (mid[i].x-from->me.x)*(to->me.x-from->me.x) + (mid[i].y-from->me.y)*(to->me.y-from->me.y);
- if ( test<nmin ) nmin=test;
- if ( test>nmax ) nmax=test;
- test = (mid[i].x-to->me.x)*(from->me.x-to->me.x) + (mid[i].y-to->me.y)*(from->me.y-to->me.y);
- if ( test<pmin ) pmin=test;
- if ( test>pmax ) pmax=test;
- }
- pmin *= 1.2; pmax *= 1.2; nmin *= 1.2; nmax *= 1.2;
-
- for ( j=0; j<3; ++j ) {
- if ( order2 ) {
- if ( RealNear(ts[j+2],ts[j+1]) )
- continue;
- /* This produces really bad results!!!! But I don't see what I can do to improve it */
- bx = (xts[j]-ts[j+1]*(to->me.x-from->me.x) - ts[j]*from->me.x) / (ts[j+2]-ts[j+1]);
- by = (yts[j]-ts[j+1]*(to->me.y-from->me.y) - ts[j]*from->me.y) / (ts[j+2]-ts[j+1]);
- cx = to->me.x-from->me.x-bx;
- cy = to->me.y-from->me.y-by;
-
- nextcp->x = from->me.x + cx/2;
- nextcp->y = from->me.y + cy/2;
- *prevcp = *nextcp;
- } else {
- vx[0] = xts[j+1]-ts[j+1]*from->me.x;
- vx[1] = xts[j]-ts[j]*from->me.x;
- vx[2] = to->me.x-from->me.x; /* always use the defn of spline */
-
- vy[0] = yts[j+1]-ts[j+1]*from->me.y;
- vy[1] = yts[j]-ts[j]*from->me.y;
- vy[2] = to->me.y-from->me.y;
-
- m[0][0] = ts[j+4]; m[0][1] = ts[j+3]; m[0][2] = ts[j+2];
- m[1][0] = ts[j+3]; m[1][1] = ts[j+2]; m[1][2] = ts[j+1];
- m[2][0] = 1; m[2][1] = 1; m[2][2] = 1;
-
- /* Remove a terms from rows 0 and 1 */
- vx[0] -= ts[j+4]*vx[2];
- vy[0] -= ts[j+4]*vy[2];
- m[0][0] = 0; m[0][1] -= ts[j+4]; m[0][2] -= ts[j+4];
- vx[1] -= ts[j+3]*vx[2];
- vy[1] -= ts[j+3]*vy[2];
- m[1][0] = 0; m[1][1] -= ts[j+3]; m[1][2] -= ts[j+3];
-
- if ( fabs(m[1][1])<fabs(m[0][1]) ) {
- double temp;
- temp = vx[1]; vx[1] = vx[0]; vx[0] = temp;
- temp = vy[1]; vy[1] = vy[0]; vy[0] = temp;
- temp = m[1][1]; m[1][1] = m[0][1]; m[0][1] = temp;
- temp = m[1][2]; m[1][2] = m[0][2]; m[0][2] = temp;
- }
- /* remove b terms from rows 0 and 2 (first normalize row 1 so m[1][1] is 1*/
- vx[1] /= m[1][1];
- vy[1] /= m[1][1];
- m[1][2] /= m[1][1];
- m[1][1] = 1;
- vx[0] -= m[0][1]*vx[1];
- vy[0] -= m[0][1]*vy[1];
- m[0][2] -= m[0][1]*m[1][2]; m[0][1] = 0;
- vx[2] -= m[2][1]*vx[1];
- vy[2] -= m[2][1]*vy[1];
- m[2][2] -= m[2][1]*m[1][2]; m[2][1] = 0;
-
- vx[0] /= m[0][2]; /* This is cx */
- vy[0] /= m[0][2]; /* This is cy */
- /*m[0][2] = 1;*/
-
- vx[1] -= m[1][2]*vx[0]; /* This is bx */
- vy[1] -= m[1][2]*vy[0]; /* This is by */
- /* m[1][2] = 0; */
- vx[2] -= m[2][2]*vx[0]; /* This is ax */
- vy[2] -= m[2][2]*vy[0]; /* This is ay */
- /* m[2][2] = 0; */
-
- nextcp->x = from->me.x + vx[0]/3;
- nextcp->y = from->me.y + vy[0]/3;
- prevcp->x = nextcp->x + (vx[0]+vx[1])/3;
- prevcp->y = nextcp->y + (vy[0]+vy[1])/3;
- }
-
- test = (nextcp->x-from->me.x)*(to->me.x-from->me.x) +
- (nextcp->y-from->me.y)*(to->me.y-from->me.y);
- ptest = (prevcp->x-to->me.x)*(from->me.x-to->me.x) +
- (prevcp->y-to->me.y)*(from->me.y-to->me.y);
- if ( order2 &&
- (test<nmin || test>nmax || ptest<pmin || ptest>pmax))
- continue;
- if ( test>=nmin && test<=nmax ) {
- nres.x += nextcp->x; nres.y += nextcp->y;
- ++nrescnt;
- }
- if ( test>=pmin && test<=pmax ) {
- pres.x += prevcp->x; pres.y += prevcp->y;
- ++prescnt;
- }
- if ( nrescnt==1 && prescnt==1 )
- break;
- }
-
- ret = 0;
- if ( nrescnt>0 ) {
- ret |= 1;
- nextcp->x = nres.x/nrescnt;
- nextcp->y = nres.y/nrescnt;
- } else
- *nextcp = from->nextcp;
- if ( prescnt>0 ) {
- ret |= 2;
- prevcp->x = pres.x/prescnt;
- prevcp->y = pres.y/prescnt;
- } else
- *prevcp = to->prevcp;
- if ( order2 && ret!=3 ) {
- nextcp->x = (nextcp->x + prevcp->x)/2;
- nextcp->y = (nextcp->y + prevcp->y)/2;
- }
- if ( order2 )
- *prevcp = *nextcp;
-return( ret );
-}
-
-static void TestForLinear(SplinePoint *from,SplinePoint *to) {
- BasePoint off, cpoff, cpoff2;
- double len, co, co2;
-
- /* Did we make a line? */
- off.x = to->me.x-from->me.x; off.y = to->me.y-from->me.y;
- len = sqrt(off.x*off.x + off.y*off.y);
- if ( len!=0 ) {
- off.x /= len; off.y /= len;
- cpoff.x = from->nextcp.x-from->me.x; cpoff.y = from->nextcp.y-from->me.y;
- len = sqrt(cpoff.x*cpoff.x + cpoff.y*cpoff.y);
- if ( len!=0 ) {
- cpoff.x /= len; cpoff.y /= len;
- }
- cpoff2.x = to->prevcp.x-from->me.x; cpoff2.y = to->prevcp.y-from->me.y;
- len = sqrt(cpoff2.x*cpoff2.x + cpoff2.y*cpoff2.y);
- if ( len!=0 ) {
- cpoff2.x /= len; cpoff2.y /= len;
- }
- co = cpoff.x*off.y - cpoff.y*off.x; co2 = cpoff2.x*off.y - cpoff2.y*off.x;
- if ( co<.05 && co>-.05 && co2<.05 && co2>-.05 ) {
- from->nextcp = from->me; from->nonextcp = true;
- to->prevcp = to->me; to->noprevcp = true;
- } else {
- Spline temp;
- memset(&temp,0,sizeof(temp));
- temp.from = from; temp.to = to;
- SplineRefigure(&temp);
- if ( SplineIsLinear(&temp)) {
- from->nextcp = from->me; from->nonextcp = true;
- to->prevcp = to->me; to->noprevcp = true;
- }
- }
- }
-}
-
-/* Find a spline which best approximates the list of intermediate points we */
-/* are given. No attempt is made to fix the slopes */
-Spline *ApproximateSplineFromPoints(SplinePoint *from, SplinePoint *to,
- TPoint *mid, int cnt, int order2) {
- int ret;
- Spline *spline;
- BasePoint nextcp, prevcp;
-
- if ( (spline = IsLinearApprox(from,to,mid,cnt,order2))!=NULL )
-return( spline );
-
- ret = _ApproximateSplineFromPoints(from,to,mid,cnt,&nextcp,&prevcp,order2);
-
- if ( ret&1 ) {
- from->nextcp = nextcp;
- from->nonextcp = false;
- } else {
- from->nextcp = from->me;
- from->nonextcp = true;
- }
- if ( ret&2 ) {
- to->prevcp = prevcp;
- to->noprevcp = false;
- } else {
- to->prevcp = to->me;
- to->noprevcp = true;
- }
- TestForLinear(from,to);
- spline = SplineMake(from,to,order2);
-return( spline );
-}
-
-static double ClosestSplineSolve(Spline1D *sp,double sought,double close_to_t) {
- /* We want to find t so that spline(t) = sought */
- /* find the value which is closest to close_to_t */
- /* on error return closetot */
- Spline1D temp;
- extended ts[3];
- int i;
- double t, best, test;
-
- temp = *sp;
- temp.d -= sought;
- CubicSolve(&temp,ts);
- best = 9e20; t= close_to_t;
- for ( i=0; i<3; ++i ) if ( ts[i]!=-1 ) {
- if ( (test=ts[i]-close_to_t)<0 ) test = -test;
- if ( test<best ) {
- best = test;
- t = ts[i];
- }
- }
-
-return( t );
-}
-
-struct dotbounds {
- BasePoint unit;
- BasePoint base;
- double len;
- double min,max; /* If min<0 || max>len the spline extends beyond its endpoints */
-};
-
-static double SigmaDeltas(Spline *spline,TPoint *mid, int cnt, DBounds *b, struct dotbounds *db) {
- int i, lasti;
- double xdiff, ydiff, sum, temp, t, lastt;
- SplinePoint *to = spline->to, *from = spline->from;
- extended ts[2], x,y;
- struct dotbounds db2;
- double dot;
-
- if ( (xdiff = to->me.x-from->me.x)<0 ) xdiff = -xdiff;
- if ( (ydiff = to->me.y-from->me.y)<0 ) ydiff = -ydiff;
-
- sum = 0; lastt = -1; lasti = -1;
- for ( i=0; i<cnt; ++i ) {
- if ( ydiff>2*xdiff ) {
- t = ClosestSplineSolve(&spline->splines[1],mid[i].y,mid[i].t);
- } else if ( xdiff>2*ydiff ) {
- t = ClosestSplineSolve(&spline->splines[0],mid[i].x,mid[i].t);
- } else {
- t = (ClosestSplineSolve(&spline->splines[1],mid[i].y,mid[i].t) +
- ClosestSplineSolve(&spline->splines[0],mid[i].x,mid[i].t))/2;
- }
- if ( t==lastt ) /* These last* values appear to be debugging */
- t = lastt + (mid[i].t - mid[lasti].t);
- else {
- lastt = t;
- lasti = i;
- }
- temp = mid[i].x - ( ((spline->splines[0].a*t+spline->splines[0].b)*t+spline->splines[0].c)*t + spline->splines[0].d );
- sum += temp*temp;
- temp = mid[i].y - ( ((spline->splines[1].a*t+spline->splines[1].b)*t+spline->splines[1].c)*t + spline->splines[1].d );
- sum += temp*temp;
- }
-
- /* Ok, we've got distances from a set of points on the old spline to the */
- /* new one. Let's do the reverse: find the extrema of the new and see how*/
- /* close they get to the bounding box of the old */
- /* And get really unhappy if the spline extends beyond the end-points */
- db2.min = 0; db2.max = db->len;
- SplineFindExtrema(&spline->splines[0],&ts[0],&ts[1]);
- for ( i=0; i<2; ++i ) {
- if ( ts[i]!=-1 ) {
- x = ((spline->splines[0].a*ts[i]+spline->splines[0].b)*ts[i]+spline->splines[0].c)*ts[i] + spline->splines[0].d;
- y = ((spline->splines[1].a*ts[i]+spline->splines[1].b)*ts[i]+spline->splines[1].c)*ts[i] + spline->splines[1].d;
- if ( x<b->minx )
- sum += (x-b->minx)*(x-b->minx);
- else if ( x>b->maxx )
- sum += (x-b->maxx)*(x-b->maxx);
- dot = (x-db->base.x)*db->unit.x + (y-db->base.y)*db->unit.y;
- if ( dot<db2.min ) db2.min = dot;
- if ( dot>db2.max ) db2.max = dot;
- }
- }
- SplineFindExtrema(&spline->splines[1],&ts[0],&ts[1]);
- for ( i=0; i<2; ++i ) {
- if ( ts[i]!=-1 ) {
- x = ((spline->splines[0].a*ts[i]+spline->splines[0].b)*ts[i]+spline->splines[0].c)*ts[i] + spline->splines[0].d;
- y = ((spline->splines[1].a*ts[i]+spline->splines[1].b)*ts[i]+spline->splines[1].c)*ts[i] + spline->splines[1].d;
- if ( y<b->miny )
- sum += (y-b->miny)*(y-b->miny);
- else if ( y>b->maxy )
- sum += (y-b->maxy)*(y-b->maxy);
- dot = (x-db->base.x)*db->unit.x + (y-db->base.y)*db->unit.y;
- if ( dot<db2.min ) db2.min = dot;
- if ( dot>db2.max ) db2.max = dot;
- }
- }
-
- /* Big penalty for going beyond the range of the desired spline */
- if ( db->min==0 && db2.min<0 )
- sum += 10000 + db2.min*db2.min;
- else if ( db2.min<db->min )
- sum += 100 + (db2.min-db->min)*(db2.min-db->min);
- if ( db->max==db->len && db2.max>db->len )
- sum += 10000 + (db2.max-db->max)*(db2.max-db->max);
- else if ( db2.max>db->max )
- sum += 100 + (db2.max-db->max)*(db2.max-db->max);
-
-return( sum );
-}
-
-static void ApproxBounds(DBounds *b,TPoint *mid, int cnt, struct dotbounds *db) {
- int i;
- double dot;
-
- b->minx = b->maxx = mid[0].x;
- b->miny = b->maxy = mid[0].y;
- db->min = 0; db->max = db->len;
- for ( i=1; i<cnt; ++i ) {
- if ( mid[i].x>b->maxx ) b->maxx = mid[i].x;
- if ( mid[i].x<b->minx ) b->minx = mid[i].x;
- if ( mid[i].y>b->maxy ) b->maxy = mid[i].y;
- if ( mid[i].y<b->miny ) b->miny = mid[i].y;
- dot = (mid[i].x-db->base.x)*db->unit.x + (mid[i].y-db->base.y)*db->unit.y;
- if ( dot<db->min ) db->min = dot;
- if ( dot>db->max ) db->max = dot;
- }
-}
-
-static int GoodCurve(SplinePoint *sp, int check_prev ) {
- double dx, dy, lenx, leny;
-
- if ( sp->pointtype!=pt_curve && sp->pointtype!=pt_hvcurve )
-return( false );
- if ( check_prev ) {
- dx = sp->me.x - sp->prevcp.x;
- dy = sp->me.y - sp->prevcp.y;
- } else {
- dx = sp->me.x - sp->nextcp.x;
- dy = sp->me.y - sp->nextcp.y;
- }
- /* If the cp is very close to the base point the point might as well be a corner */
- if ( dx<0 ) dx = -dx;
- if ( dy<0 ) dy = -dy;
- if ( dx+dy<1 )
-return( false );
-
- if ( check_prev ) {
- if ( sp->prev==NULL )
-return( true );
- lenx = sp->me.x - sp->prev->from->me.x;
- leny = sp->me.y - sp->prev->from->me.y;
- } else {
- if ( sp->next==NULL )
-return( true );
- lenx = sp->me.x - sp->next->to->me.x;
- leny = sp->me.y - sp->next->to->me.y;
- }
- if ( lenx<0 ) lenx = -lenx;
- if ( leny<0 ) leny = -leny;
- if ( 50*(dx+dy) < lenx+leny )
-return( false );
-
-return( true );
-}
-
-#if 0
-static int totcnt_cnt, nocnt_cnt, incr_cnt, curdiff_cnt;
-#endif
-
-/* I used to do a least squares aproach adding two more to the above set of equations */
-/* which held the slopes constant. But that didn't work very well. So instead*/
-/* Then I tried doing the approximation, and then forcing the control points */
-/* to be in line (witht the original slopes), getting a better approximation */
-/* to "t" for each data point and then calculating an error array, approximating*/
-/* it, and using that to fix up the final result */
-/* Then I tried checking various possible cp lengths in the desired directions*/
-/* finding the best one or two, and doing a 2D binary search using that as a */
-/* starting point. */
-/* And sometimes a least squares approach will give us the right answer, so */
-/* try that too. */
-/* This still isn't as good as I'd like it... But I haven't been able to */
-/* improve it further yet */
-#define TRY_CNT 2
-#define DECIMATION 5
-Spline *ApproximateSplineFromPointsSlopes(SplinePoint *from, SplinePoint *to,
- TPoint *mid, int cnt, int order2) {
- BasePoint tounit, fromunit, ftunit;
- double flen,tlen,ftlen;
- Spline *spline, temp;
- BasePoint nextcp;
- int bettern, betterp;
- double offn, offp, incrn, incrp, trylen;
- int nocnt = 0, totcnt;
- double curdiff, bestdiff[TRY_CNT];
- int i,j,besti[TRY_CNT],bestj[TRY_CNT],k,l;
- double fdiff, tdiff, fmax, tmax, fdotft, tdotft;
- DBounds b;
- struct dotbounds db;
- double offn_, offp_, finaldiff;
-
- /* If all the selected points are at the same spot, and one of the */
- /* end-points is also at that spot, then just copy the control point */
- /* But our caller seems to have done that for us */
-
- /* If the two end-points are corner points then allow the slope to vary */
- /* Or if one end-point is a tangent but the point defining the tangent's */
- /* slope is being removed then allow the slope to vary */
- /* Except if the slope is horizontal or vertical then keep it fixed */
- if ( ( !from->nonextcp && ( from->nextcp.x==from->me.x || from->nextcp.y==from->me.y)) ||
- (!to->noprevcp && ( to->prevcp.x==to->me.x || to->prevcp.y==to->me.y)) )
- /* Preserve the slope */;
- else if ( ((from->pointtype == pt_corner && from->nonextcp) ||
- (from->pointtype == pt_tangent &&
- ((from->nonextcp && from->noprevcp) || !from->noprevcp))) &&
- ((to->pointtype == pt_corner && to->noprevcp) ||
- (to->pointtype == pt_tangent &&
- ((to->nonextcp && to->noprevcp) || !to->nonextcp))) ) {
- from->pointtype = to->pointtype = pt_corner;
-return( ApproximateSplineFromPoints(from,to,mid,cnt,order2) );
- }
-
- /* If we are going to honour the slopes of a quadratic spline, there is */
- /* only one possibility */
- if ( order2 ) {
- if ( from->nonextcp )
- from->nextcp = from->next->to->me;
- if ( to->noprevcp )
- to->prevcp = to->prev->from->me;
- from->nonextcp = to->noprevcp = false;
- fromunit.x = from->nextcp.x-from->me.x; fromunit.y = from->nextcp.y-from->me.y;
- tounit.x = to->prevcp.x-to->me.x; tounit.y = to->prevcp.y-to->me.y;
-
- if ( !IntersectLines(&nextcp,&from->nextcp,&from->me,&to->prevcp,&to->me) ||
- (nextcp.x-from->me.x)*fromunit.x + (nextcp.y-from->me.y)*fromunit.y < 0 ||
- (nextcp.x-to->me.x)*tounit.x + (nextcp.y-to->me.y)*tounit.y < 0 ) {
- /* If the slopes don't intersect then use a line */
- /* (or if the intersection is patently absurd) */
- from->nonextcp = to->noprevcp = true;
- from->nextcp = from->me;
- to->prevcp = to->me;
- TestForLinear(from,to);
- } else {
- from->nextcp = to->prevcp = nextcp;
- from->nonextcp = to->noprevcp = false;
- }
-return( SplineMake2(from,to));
- }
- /* From here down we are only working with cubic splines */
-
- if ( cnt==0 ) {
- /* Just use what we've got, no data to improve it */
- /* But we do sometimes get some cps which are too big */
- double len = sqrt((to->me.x-from->me.x)*(to->me.x-from->me.x) + (to->me.y-from->me.y)*(to->me.y-from->me.y));
- if ( len==0 ) {
- from->nonextcp = to->noprevcp = true;
- from->nextcp = from->me;
- to->prevcp = to->me;
- } else {
- BasePoint noff, poff;
- double nlen, plen;
- noff.x = from->nextcp.x-from->me.x; noff.y = from->nextcp.y-from->me.y;
- poff.x = to->me.x-to->prevcp.x; poff.y = to->me.y-to->prevcp.y;
- nlen = sqrt(noff.x*noff.x + noff.y+noff.y);
- plen = sqrt(poff.x*poff.x + poff.y+poff.y);
- if ( nlen>len/3 ) {
- noff.x *= len/3/nlen; noff.y *= len/3/nlen;
- from->nextcp.x = from->me.x + noff.x;
- from->nextcp.y = from->me.y + noff.y;
- }
- if ( plen>len/3 ) {
- poff.x *= len/3/plen; poff.y *= len/3/plen;
- to->prevcp.x = to->me.x + poff.x;
- to->prevcp.y = to->me.y + poff.y;
- }
- }
-return( SplineMake3(from,to));
- }
-
- if ( to->prev!=NULL && (( to->noprevcp && to->nonextcp ) || to->prev->knownlinear )) {
- tounit.x = to->prev->from->me.x-to->me.x; tounit.y = to->prev->from->me.y-to->me.y;
- } else if ( !to->noprevcp || to->pointtype == pt_corner ) {
- tounit.x = to->prevcp.x-to->me.x; tounit.y = to->prevcp.y-to->me.y;
- } else {
- tounit.x = to->me.x-to->nextcp.x; tounit.y = to->me.y-to->nextcp.y;
- }
- tlen = sqrt(tounit.x*tounit.x + tounit.y*tounit.y);
- if ( from->next!=NULL && (( from->noprevcp && from->nonextcp ) || from->next->knownlinear) ) {
- fromunit.x = from->next->to->me.x-from->me.x; fromunit.y = from->next->to->me.y-from->me.y;
- } else if ( !from->nonextcp || from->pointtype == pt_corner ) {
- fromunit.x = from->nextcp.x-from->me.x; fromunit.y = from->nextcp.y-from->me.y;
- } else {
- fromunit.x = from->me.x-from->prevcp.x; fromunit.y = from->me.y-from->prevcp.y;
- }
- flen = sqrt(fromunit.x*fromunit.x + fromunit.y*fromunit.y);
- if ( tlen==0 || flen==0 ) {
- if ( from->next!=NULL )
- temp = *from->next;
- else {
- memset(&temp,0,sizeof(temp));
- temp.from = from; temp.to = to;
- SplineRefigure(&temp);
- from->next = to->prev = NULL;
- }
- }
- if ( tlen==0 ) {
- if ( (to->pointtype==pt_curve || to->pointtype==pt_hvcurve) &&
- to->next && !to->nonextcp ) {
- tounit.x = to->me.x-to->nextcp.x; tounit.y = to->me.y-to->nextcp.y;
-/* Doesn't work
- } else if ( to->pointtype==pt_tangent && to->next ) {
- tounit.x = to->me.x-to->next->to->me.x; tounit.y = to->me.y-to->next->to->me.y;
-*/
- } else {
- tounit.x = -( (3*temp.splines[0].a*.9999+2*temp.splines[0].b)*.9999+temp.splines[0].c );
- tounit.y = -( (3*temp.splines[1].a*.9999+2*temp.splines[1].b)*.9999+temp.splines[1].c );
- }
- tlen = sqrt(tounit.x*tounit.x + tounit.y*tounit.y);
- }
- tounit.x /= tlen; tounit.y /= tlen;
-
- if ( flen==0 ) {
- if ( (from->pointtype==pt_curve || from->pointtype==pt_hvcurve) &&
- from->prev && !from->noprevcp ) {
- fromunit.x = from->me.x-from->prevcp.x; fromunit.y = from->me.y-from->prevcp.y;
-/*
- } else if ( from->pointtype==pt_tangent && from->prev ) {
- fromunit.x = from->me.x-from->prev->from->me.x; fromunit.y = from->me.y-from->prev->from->me.y;
-*/
- } else {
- fromunit.x = ( (3*temp.splines[0].a*.0001+2*temp.splines[0].b)*.0001+temp.splines[0].c );
- fromunit.y = ( (3*temp.splines[1].a*.0001+2*temp.splines[1].b)*.0001+temp.splines[1].c );
- }
- flen = sqrt(fromunit.x*fromunit.x + fromunit.y*fromunit.y);
- }
- fromunit.x /= flen; fromunit.y /= flen;
-
- trylen = (to->me.x-from->me.x)*fromunit.x + (to->me.y-from->me.y)*fromunit.y;
- if ( trylen>flen ) flen = trylen;
-
- trylen = (from->me.x-to->me.x)*tounit.x + (from->me.y-to->me.y)*tounit.y;
- if ( trylen>tlen ) tlen = trylen;
-
- ftunit.x = (to->me.x-from->me.x); ftunit.y = (to->me.y-from->me.y);
- ftlen = sqrt(ftunit.x*ftunit.x + ftunit.y*ftunit.y);
- if ( ftlen!=0 ) {
- ftunit.x /= ftlen; ftunit.y /= ftlen;
- }
- fdotft = fromunit.x*ftunit.x + fromunit.y*ftunit.y;
- fmax = fdotft>0 ? ftlen/fdotft : 1e10;
- tdotft = -tounit.x*ftunit.x - tounit.y*ftunit.y;
- tmax = tdotft>0 ? ftlen/tdotft : 1e10;
- /* At fmax, tmax the control points will stretch beyond the other endpoint*/
- /* when projected along the line between the two endpoints */
-
- db.base = from->me;
- db.unit.x = (to->me.x-from->me.x); db.unit.y = (to->me.y-from->me.y);
- db.len = sqrt(db.unit.x*db.unit.x + db.unit.y*db.unit.y);
- if ( db.len!=0 ) {
- db.unit.x /= db.len;
- db.unit.y /= db.len;
- }
- ApproxBounds(&b,mid,cnt,&db);
-
- for ( k=0; k<TRY_CNT; ++k ) {
- bestdiff[k] = 1e20;
- besti[k] = -1; bestj[k] = -1;
- }
- fdiff = flen/DECIMATION;
- tdiff = tlen/DECIMATION;
- from->nextcp = from->me;
- from->nonextcp = false;
- to->noprevcp = false;
- memset(&temp,0,sizeof(Spline));
- temp.from = from; temp.to = to;
- for ( i=1; i<DECIMATION; ++i ) {
- from->nextcp.x += fdiff*fromunit.x; from->nextcp.y += fdiff*fromunit.y;
- to->prevcp = to->me;
- for ( j=1; j<DECIMATION; ++j ) {
- to->prevcp.x += tdiff*tounit.x; to->prevcp.y += tdiff*tounit.y;
- SplineRefigure(&temp);
- curdiff = SigmaDeltas(&temp,mid,cnt,&b,&db);
- for ( k=0; k<TRY_CNT; ++k ) {
- if ( curdiff<bestdiff[k] ) {
- for ( l=TRY_CNT-1; l>k; --l ) {
- bestdiff[l] = bestdiff[l-1];
- besti[l] = besti[l-1];
- bestj[l] = bestj[l-1];
- }
- bestdiff[k] = curdiff;
- besti[k] = i; bestj[k]=j;
- break;
- }
- }
- }
- }
-
- finaldiff = 1e20;
- offn_ = offp_ = -1;
- spline = SplineMake(from,to,false);
- for ( k=-1; k<TRY_CNT; ++k ) {
- if ( k<0 ) {
- BasePoint nextcp, prevcp;
- double temp1, temp2;
- int ret = _ApproximateSplineFromPoints(from,to,mid,cnt,&nextcp,&prevcp,false);
- /* sometimes least squares gives us the right answer */
- if ( !(ret&1) || !(ret&2))
- continue;
- temp1 = (prevcp.x-to->me.x)*tounit.x + (prevcp.y-to->me.y)*tounit.y;
- temp2 = (nextcp.x-from->me.x)*fromunit.x + (nextcp.y-from->me.y)*fromunit.y;
- if ( temp1<=0 || temp2<=0 ) /* A nice solution... but the control points are diametrically opposed to what they should be */
- continue;
- tlen = temp1; flen = temp2;
- } else {
- if ( bestj[k]<0 || besti[k]<0 )
- continue;
- tlen = bestj[k]*tdiff; flen = besti[k]*fdiff;
- }
- to->prevcp.x = to->me.x + tlen*tounit.x; to->prevcp.y = to->me.y + tlen*tounit.y;
- from->nextcp.x = from->me.x + flen*fromunit.x; from->nextcp.y = from->me.y + flen*fromunit.y;
- SplineRefigure(spline);
-
- bettern = betterp = false;
- incrn = tdiff/2.0; incrp = fdiff/2.0;
- offn = flen; offp = tlen;
- nocnt = 0;
- curdiff = SigmaDeltas(spline,mid,cnt,&b,&db);
- totcnt = 0;
- forever {
- double fadiff, fsdiff;
- double tadiff, tsdiff;
-
- from->nextcp.x = from->me.x + (offn+incrn)*fromunit.x; from->nextcp.y = from->me.y + (offn+incrn)*fromunit.y;
- to->prevcp.x = to->me.x + offp*tounit.x; to->prevcp.y = to->me.y + offp*tounit.y;
- SplineRefigure(spline);
- fadiff = SigmaDeltas(spline,mid,cnt,&b,&db);
- from->nextcp.x = from->me.x + (offn-incrn)*fromunit.x; from->nextcp.y = from->me.y + (offn-incrn)*fromunit.y;
- SplineRefigure(spline);
- fsdiff = SigmaDeltas(spline,mid,cnt,&b,&db);
- from->nextcp.x = from->me.x + offn*fromunit.x; from->nextcp.y = from->me.y + offn*fromunit.y;
- if ( offn-incrn<=0 )
- fsdiff += 1e10;
-
- to->prevcp.x = to->me.x + (offp+incrp)*tounit.x; to->prevcp.y = to->me.y + (offp+incrp)*tounit.y;
- SplineRefigure(spline);
- tadiff = SigmaDeltas(spline,mid,cnt,&b,&db);
- to->prevcp.x = to->me.x + (offp-incrp)*tounit.x; to->prevcp.y = to->me.y + (offp-incrp)*tounit.y;
- SplineRefigure(spline);
- tsdiff = SigmaDeltas(spline,mid,cnt,&b,&db);
- to->prevcp.x = to->me.x + offp*tounit.x; to->prevcp.y = to->me.y + offp*tounit.y;
- if ( offp-incrp<=0 )
- tsdiff += 1e10;
-
- if ( offn>=incrn && fsdiff<curdiff &&
- (fsdiff<fadiff && fsdiff<tsdiff && fsdiff<tadiff)) {
- offn -= incrn;
- if ( bettern>0 )
- incrn /= 2;
- bettern = -1;
- nocnt = 0;
- curdiff = fsdiff;
- } else if ( offn+incrn<fmax && fadiff<curdiff &&
- (fadiff<=fsdiff && fadiff<tsdiff && fadiff<tadiff)) {
- offn += incrn;
- if ( bettern<0 )
- incrn /= 2;
- bettern = 1;
- nocnt = 0;
- curdiff = fadiff;
- } else if ( offp>=incrp && tsdiff<curdiff &&
- (tsdiff<=fsdiff && tsdiff<=fadiff && tsdiff<tadiff)) {
- offp -= incrp;
- if ( betterp>0 )
- incrp /= 2;
- betterp = -1;
- nocnt = 0;
- curdiff = tsdiff;
- } else if ( offp+incrp<tmax && tadiff<curdiff &&
- (tadiff<=fsdiff && tadiff<=fadiff && tadiff<=tsdiff)) {
- offp += incrp;
- if ( betterp<0 )
- incrp /= 2;
- betterp = 1;
- nocnt = 0;
- curdiff = tadiff;
- } else {
- if ( ++nocnt > 6 )
- break;
- incrn /= 2;
- incrp /= 2;
- }
- if ( curdiff<1 )
- break;
- if ( incrp<tdiff/1024 || incrn<fdiff/1024 )
- break;
- if ( ++totcnt>200 )
- break;
- if ( offn<0 || offp<0 ) {
- IError("Approximation got inverse control points");
- break;
- }
- }
-#if 0
- if ( nocnt>6 )
- nocnt_cnt++;
- else if ( curdiff<1 )
- curdiff_cnt++;
- else if ( totcnt>200 )
- totcnt_cnt++;
- else
- incr_cnt++;
-#endif
- if ( curdiff<finaldiff ) {
- finaldiff = curdiff;
- offn_ = offn;
- offp_ = offp;
- }
- }
-
- to->noprevcp = offp_==0;
- from->nonextcp = offn_==0;
- to->prevcp.x = to->me.x + offp_*tounit.x; to->prevcp.y = to->me.y + offp_*tounit.y;
- from->nextcp.x = from->me.x + offn_*fromunit.x; from->nextcp.y = from->me.y + offn_*fromunit.y;
- /* I used to check for a spline very close to linear (and if so, make it */
- /* linear). But in when stroking a path with an eliptical pen we transform*/
- /* the coordinate system and our normal definitions of "close to linear" */
- /* don't apply */
- /*TestForLinear(from,to);*/
- SplineRefigure(spline);
-
-return( spline );
-}
-#undef TRY_CNT
-#undef DECIMATION
-
- /* calculating the actual length of a spline is hard, this gives a very */
- /* rough (but quick) approximation */
-static double SplineLenApprox(Spline *spline) {
- double len, slen, temp;
-
- if ( (temp = spline->to->me.x-spline->from->me.x)<0 ) temp = -temp;
- len = temp;
- if ( (temp = spline->to->me.y-spline->from->me.y)<0 ) temp = -temp;
- len += temp;
- if ( !spline->to->noprevcp || !spline->from->nonextcp ) {
- if ( (temp = spline->from->nextcp.x-spline->from->me.x)<0 ) temp = -temp;
- slen = temp;
- if ( (temp = spline->from->nextcp.y-spline->from->me.y)<0 ) temp = -temp;
- slen += temp;
- if ( (temp = spline->to->prevcp.x-spline->from->nextcp.x)<0 ) temp = -temp;
- slen += temp;
- if ( (temp = spline->to->prevcp.y-spline->from->nextcp.y)<0 ) temp = -temp;
- slen += temp;
- if ( (temp = spline->to->me.x-spline->to->prevcp.x)<0 ) temp = -temp;
- slen += temp;
- if ( (temp = spline->to->me.y-spline->to->prevcp.y)<0 ) temp = -temp;
- slen += temp;
- len = (len + slen)/2;
- }
-return( len );
-}
-
-double SplineLength(Spline *spline) {
- /* I ignore the constant term. It's just an unneeded addition */
- double len, t;
- double lastx = 0, lasty = 0;
- double curx, cury;
-
- len = 0;
- for ( t=1.0/128; t<=1.0001 ; t+=1.0/128 ) {
- curx = ((spline->splines[0].a*t+spline->splines[0].b)*t+spline->splines[0].c)*t;
- cury = ((spline->splines[1].a*t+spline->splines[1].b)*t+spline->splines[1].c)*t;
- len += sqrt( (curx-lastx)*(curx-lastx) + (cury-lasty)*(cury-lasty) );
- lastx = curx; lasty = cury;
- }
-return( len );
-}
-
-
-static TPoint *SplinesFigureTPsBetween(SplinePoint *from, SplinePoint *to,
- int *tot) {
- int cnt, i, j, pcnt;
- double len, slen, lbase;
- SplinePoint *np;
- TPoint *tp;
- double _lens[10], *lens = _lens;
- int _cnts[10], *cnts = _cnts;
- /* I used just to give every spline 10 points. But that gave much more */
- /* weight to small splines than to big ones */
-
- cnt = 0;
- for ( np = from->next->to; ; np = np->next->to ) {
- ++cnt;
- if ( np==to )
- break;
- }
- if ( cnt>10 ) {
- lens = galloc(cnt*sizeof(double));
- cnts = galloc(cnt*sizeof(int));
- }
- cnt = 0; len = 0;
- for ( np = from->next->to; ; np = np->next->to ) {
- lens[cnt] = SplineLenApprox(np->prev);
- len += lens[cnt];
- ++cnt;
- if ( np==to )
- break;
- }
- if ( len!=0 ) {
- pcnt = 0;
- for ( i=0; i<cnt; ++i ) {
- int pnts = rint( (10*cnt*lens[i])/len );
- if ( pnts<2 ) pnts = 2;
- cnts[i] = pnts;
- pcnt += pnts;
- }
- } else
- pcnt = 2*cnt;
-
- tp = galloc((pcnt+1)*sizeof(TPoint)); i = 0;
- if ( len==0 ) {
- for ( i=0; i<=pcnt; ++i ) {
- tp[i].t = i/(pcnt);
- tp[i].x = from->me.x;
- tp[i].y = from->me.y;
- }
- } else {
- lbase = 0;
- for ( i=cnt=0, np = from->next->to; ; np = np->next->to, ++cnt ) {
- slen = SplineLenApprox(np->prev);
- for ( j=0; j<cnts[cnt]; ++j ) {
- double t = j/(double) cnts[cnt];
- tp[i].t = (lbase+ t*slen)/len;
- tp[i].x = ((np->prev->splines[0].a*t+np->prev->splines[0].b)*t+np->prev->splines[0].c)*t + np->prev->splines[0].d;
- tp[i++].y = ((np->prev->splines[1].a*t+np->prev->splines[1].b)*t+np->prev->splines[1].c)*t + np->prev->splines[1].d;
- }
- lbase += slen;
- if ( np==to )
- break;
- }
- }
- if ( cnts!=_cnts ) free(cnts);
- if ( lens!=_lens ) free(lens);
-
- *tot = i;
-
-return( tp );
-}
-
-static void SplinePointReCatagorize(SplinePoint *sp,int oldpt) {
- SplinePointCatagorize(sp);
- if ( sp->pointtype!=oldpt ) {
- if ( sp->pointtype==pt_curve && oldpt==pt_hvcurve &&
- ((sp->nextcp.x == sp->me.x && sp->nextcp.y != sp->me.y ) ||
- (sp->nextcp.y == sp->me.y && sp->nextcp.x != sp->me.x )))
- sp->pointtype = pt_hvcurve;
- }
-}
-
-void SplinesRemoveBetween(SplineChar *sc, SplinePoint *from, SplinePoint *to,int type) {
- int tot;
- TPoint *tp;
- SplinePoint *np, oldfrom;
- int oldfpt = from->pointtype, oldtpt = to->pointtype;
- Spline *sp;
- int order2 = from->next->order2;
-
- oldfrom = *from;
- tp = SplinesFigureTPsBetween(from,to,&tot);
-
- if ( type==1 )
- ApproximateSplineFromPointsSlopes(from,to,tp,tot-1,order2);
- else
- ApproximateSplineFromPoints(from,to,tp,tot-1,order2);
-
- /* Have to do the frees after the approximation because the approx */
- /* uses the splines to determine slopes */
- for ( sp = oldfrom.next; ; ) {
- np = sp->to;
- SplineFree(sp);
- if ( np==to )
- break;
- sp = np->next;
- SplinePointMDFree(sc,np);
- }
-
- free(tp);
-
- SplinePointReCatagorize(from,oldfpt);
- SplinePointReCatagorize(to,oldtpt);
-}
-
-
-static void RemoveStupidControlPoints(SplineSet *spl) {
- double len, normal, dir;
- Spline *s, *first;
- BasePoint unit, off;
-
- /* Also remove really stupid control points: Tiny offsets pointing in */
- /* totally the wrong direction. Some of the TeX fonts we get have these */
- /* We get equally bad results with a control point that points beyond the */
- /* other end point */
- first = NULL;
- for ( s = spl->first->next; s!=NULL && s!=first; s=s->to->next ) {
- unit.x = s->to->me.x-s->from->me.x;
- unit.y = s->to->me.y-s->from->me.y;
- len = sqrt(unit.x*unit.x+unit.y*unit.y);
- if ( len!=0 ) {
- int refigure = false;
- unit.x /= len; unit.y /= len;
- if ( !s->from->nonextcp ) {
- off.x = s->from->nextcp.x-s->from->me.x;
- off.y = s->from->nextcp.y-s->from->me.y;
- if ((normal = off.x*unit.y - off.y*unit.x)<0 ) normal = -normal;
- dir = off.x*unit.x + off.y*unit.y;
- if (( normal<dir && normal<1 && dir<0 ) || (normal<.5 && dir<-.5) ||
- (normal<.1 && dir>len)) {
- s->from->nextcp = s->from->me;
- s->from->nonextcp = true;
- refigure = true;
- }
- }
- if ( !s->to->noprevcp ) {
- off.x = s->to->me.x - s->to->prevcp.x;
- off.y = s->to->me.y - s->to->prevcp.y;
- if ((normal = off.x*unit.y - off.y*unit.x)<0 ) normal = -normal;
- dir = off.x*unit.x + off.y*unit.y;
- if (( normal<-dir && normal<1 && dir<0 ) || (normal<.5 && dir>-.5 && dir<0) ||
- (normal<.1 && dir>len)) {
- s->to->prevcp = s->to->me;
- s->to->noprevcp = true;
- refigure = true;
- }
- }
- if ( refigure )
- SplineRefigure(s);
- }
- if ( first==NULL ) first = s;
- }
-}
-
-void SSRemoveStupidControlPoints(SplineSet *base) {
- SplineSet *spl;
-
- for (spl=base; spl!=NULL; spl=spl->next )
- RemoveStupidControlPoints(spl);
-}
-
-static void OverlapClusterCpAngles(SplineSet *spl,double within) {
- double len, nlen, plen;
- double startoff, endoff;
- SplinePoint *sp, *nsp, *psp;
- BasePoint *nbp, *pbp;
- BasePoint pdir, ndir, fpdir, fndir;
- int nbad, pbad;
-
- /* If we have a junction point (right mid of 3) where the two splines */
- /* are almost, but not quite moving in the same direction as they go */
- /* away from the point, and if there is a tiny overlap because of this */
- /* "almost" same, then we will probably get a bit confused in remove */
- /* overlap */
-
- for ( sp = spl->first; ; ) {
- if ( sp->next==NULL )
- break;
- nsp = sp->next->to;
- if (( !sp->nonextcp || !sp->noprevcp ) && sp->prev!=NULL ) {
- psp = sp->prev->from;
- nbp = !sp->nonextcp ? &sp->nextcp : !nsp->noprevcp ? &nsp->prevcp : &nsp->me;
- pbp = !sp->noprevcp ? &sp->prevcp : !psp->nonextcp ? &psp->nextcp : &psp->me;
-
- pdir.x = pbp->x-sp->me.x; pdir.y = pbp->y-sp->me.y;
- ndir.x = nbp->x-sp->me.x; ndir.y = nbp->y-sp->me.y;
- fpdir.x = psp->me.x-sp->me.x; fpdir.y = psp->me.y-sp->me.y;
- fndir.x = nsp->me.x-sp->me.x; fndir.y = nsp->me.y-sp->me.y;
-
- plen = sqrt(pdir.x*pdir.x+pdir.y*pdir.y);
- if ( plen!=0 ) {
- pdir.x /= plen; pdir.y /= plen;
- }
-
- nlen = sqrt(ndir.x*ndir.x+ndir.y*ndir.y);
- if ( nlen!=0 ) {
- ndir.x /= nlen; ndir.y /= nlen;
- }
-
- nbad = pbad = false;
- if ( !sp->nonextcp && plen!=0 && nlen!=0 ) {
- len = sqrt(fndir.x*fndir.x+fndir.y*fndir.y);
- if ( len!=0 ) {
- fndir.x /= len; fndir.y /= len;
- startoff = ndir.x*pdir.y - ndir.y*pdir.x;
- endoff = fndir.x*pdir.y - fndir.y*pdir.x;
- if (( (startoff<0 && endoff>0) || (startoff>0 && endoff<0)) &&
- startoff > -within && startoff < within )
- nbad = true;
- }
- }
- if ( !sp->noprevcp && plen!=0 && nlen!=0 ) {
- len = sqrt(fpdir.x*fpdir.x+fpdir.y*fpdir.y);
- if ( len!=0 ) {
- fpdir.x /= len; fpdir.y /= len;
- startoff = pdir.x*ndir.y - pdir.y*ndir.x;
- endoff = fpdir.x*ndir.y - fpdir.y*ndir.x;
- if (( (startoff<0 && endoff>0) || (startoff>0 && endoff<0)) &&
- startoff > -within && startoff < within )
- pbad = true;
- }
- }
- if ( nbad && pbad ) {
- if ( ndir.x==0 || ndir.y==0 )
- nbad = false;
- else if ( pdir.x==0 || pdir.y==0 )
- pbad = false;
- }
- if ( nbad && pbad ) {
- if ( ndir.x*pdir.x + ndir.y*pdir.y > 0 ) {
- ndir.x = pdir.x = (ndir.x + pdir.x)/2;
- ndir.y = pdir.y = (ndir.x + pdir.x)/2;
- } else {
- ndir.x = (ndir.x - pdir.x)/2;
- ndir.y = (ndir.y - pdir.y)/2;
- pdir.x = -ndir.x; pdir.y = -ndir.y;
- }
- sp->nextcp.x = sp->me.x + nlen*ndir.x;
- sp->nextcp.y = sp->me.y + nlen*ndir.y;
- sp->prevcp.x = sp->me.x + plen*pdir.x;
- sp->prevcp.y = sp->me.y + plen*pdir.y;
- SplineRefigure(sp->next); SplineRefigure(sp->prev);
- } else if ( nbad ) {
- if ( ndir.x*pdir.x + ndir.y*pdir.y < 0 ) {
- pdir.x = -pdir.x;
- pdir.y = -pdir.y;
- }
- sp->nextcp.x = sp->me.x + nlen*pdir.x;
- sp->nextcp.y = sp->me.y + nlen*pdir.y;
- SplineRefigure(sp->next);
- } else if ( pbad ) {
- if ( ndir.x*pdir.x + ndir.y*pdir.y < 0 ) {
- ndir.x = -ndir.x;
- ndir.y = -ndir.y;
- }
- sp->prevcp.x = sp->me.x + plen*ndir.x;
- sp->prevcp.y = sp->me.y + plen*ndir.y;
- SplineRefigure(sp->prev);
- }
- }
- if ( nsp==spl->first )
- break;
- sp = nsp;
- }
-}
-
-void SSOverlapClusterCpAngles(SplineSet *base,double within) {
- SplineSet *spl;
-
- for (spl=base; spl!=NULL; spl=spl->next )
- OverlapClusterCpAngles(spl,within);
-}
-
-
-Spline *SplineAddExtrema(Spline *s,int always,real lenbound, real offsetbound,
- DBounds *b) {
- /* First find the extrema, if any */
- bigreal t[4], min;
- uint8 rmfrom[4], rmto[4];
- int p, i,j, p_s, mini;
- SplinePoint *sp;
- real len = 0; /* Init variable to silence compiler warnings */
-
- if ( !always ) {
- real xlen, ylen;
- xlen = (s->from->me.x-s->to->me.x);
- ylen = (s->from->me.y-s->to->me.y);
- len = xlen*xlen + ylen*ylen;
- lenbound *= lenbound;
- if ( len < lenbound ) {
- len = SplineLength(s);
- len *= len;
- }
- }
-
- memset(rmfrom,0,sizeof(rmfrom));
- memset(rmto,0,sizeof(rmto));
-
- forever {
- if ( s->knownlinear )
-return(s);
- p = 0;
- if ( s->splines[0].a!=0 ) {
- double d = 4*s->splines[0].b*s->splines[0].b-4*3*s->splines[0].a*s->splines[0].c;
- if ( d>0 ) {
- d = sqrt(d);
- t[p++] = CheckExtremaForSingleBitErrors(&s->splines[0],(-2*s->splines[0].b+d)/(2*3*s->splines[0].a));
- t[p++] = CheckExtremaForSingleBitErrors(&s->splines[0],(-2*s->splines[0].b-d)/(2*3*s->splines[0].a));
- }
- } else if ( s->splines[0].b!=0 )
- t[p++] = -s->splines[0].c/(2*s->splines[0].b);
- if ( !always ) {
- /* Generally we are only interested in extrema on long splines, or */
- /* extrema which are extrema for the entire contour, not just this */
- /* spline */
- /* Also extrema which are very close to one of the end-points can */
- /* be ignored. */
- /* No they can't. But we need to remove the original point in this*/
- /* case */
- for ( i=0; i<p; ++i ) {
- real x = ((s->splines[0].a*t[i]+s->splines[0].b)*t[i]+s->splines[0].c)*t[i]+s->splines[0].d;
- real y = ((s->splines[1].a*t[i]+s->splines[1].b)*t[i]+s->splines[1].c)*t[i]+s->splines[1].d;
- int close_from = ( x-s->from->me.x<offsetbound && x-s->from->me.x>-offsetbound) &&
- ( y-s->from->me.y<10*offsetbound && y-s->from->me.y>-10*offsetbound );
- int close_to = ( x-s->to->me.x<offsetbound && x-s->to->me.x>-offsetbound) &&
- ( y-s->to->me.y<10*offsetbound && y-s->to->me.y>-10*offsetbound );
- int remove_from = close_from && GoodCurve(s->from,true);
- int remove_to = close_to && GoodCurve(s->to,false);
- if (( x>b->minx && x<b->maxx && len<lenbound ) ||
- (close_from && !remove_from) || (close_to && !remove_to) ) {
- --p;
- for ( j=i; j<p; ++j )
- t[j] = t[j+1];
- --i;
- } else {
- rmfrom[i] = remove_from;
- rmto[i] = remove_to;
- }
- }
- }
-
- p_s = p;
- if ( s->splines[1].a!=0 ) {
- double d = 4*s->splines[1].b*s->splines[1].b-4*3*s->splines[1].a*s->splines[1].c;
- if ( d>0 ) {
- d = sqrt(d);
- t[p++] = CheckExtremaForSingleBitErrors(&s->splines[1],(-2*s->splines[1].b+d)/(2*3*s->splines[1].a));
- t[p++] = CheckExtremaForSingleBitErrors(&s->splines[1],(-2*s->splines[1].b-d)/(2*3*s->splines[1].a));
- }
- } else if ( s->splines[1].b!=0 )
- t[p++] = -s->splines[1].c/(2*s->splines[1].b);
- if ( !always ) {
- for ( i=p_s; i<p; ++i ) {
- real x = ((s->splines[0].a*t[i]+s->splines[0].b)*t[i]+s->splines[0].c)*t[i]+s->splines[0].d;
- real y = ((s->splines[1].a*t[i]+s->splines[1].b)*t[i]+s->splines[1].c)*t[i]+s->splines[1].d;
- int close_from =( y-s->from->me.y<offsetbound && y-s->from->me.y>-offsetbound ) &&
- ( x-s->from->me.x<offsetbound && x-s->from->me.x>-offsetbound);
- int close_to = ( y-s->to->me.y<offsetbound && y-s->to->me.y>-offsetbound ) &&
- ( x-s->to->me.x<offsetbound && x-s->to->me.x>-offsetbound);
- int remove_from = close_from && GoodCurve(s->from,true);
- int remove_to = close_to && GoodCurve(s->to,false);
- if (( y>b->miny && y<b->maxy && len<lenbound ) ||
- (close_from && !remove_from) || (close_to && !remove_to) ) {
- --p;
- for ( j=i; j<p; ++j )
- t[j] = t[j+1];
- --i;
- } else {
- rmfrom[i] = remove_from;
- rmto[i] = remove_to;
- }
- }
- }
-
- /* Throw out any t values which are not between 0 and 1 */
- /* (we do a little fudging near the endpoints so we don't get confused */
- /* by rounding errors) */
- for ( i=0; i<p; ++i ) {
- if ( t[i]>0 && t[i]<.05 ) {
- BasePoint test;
- /* Expand strong gets very confused on zero-length splines so */
- /* don't let that happen */
- test.x = ((s->splines[0].a*t[i]+s->splines[0].b)*t[i]+s->splines[0].c)*t[i]+s->splines[0].d;
- test.y = ((s->splines[1].a*t[i]+s->splines[1].b)*t[i]+s->splines[1].c)*t[i]+s->splines[1].d;
- if ( test.x== s->from->me.x && test.y==s->from->me.y )
- t[i] = 0; /* Throw it out */
- }
- if ( t[i]<1 && t[i]>.95 ) {
- BasePoint test;
- test.x = ((s->splines[0].a*t[i]+s->splines[0].b)*t[i]+s->splines[0].c)*t[i]+s->splines[0].d;
- test.y = ((s->splines[1].a*t[i]+s->splines[1].b)*t[i]+s->splines[1].c)*t[i]+s->splines[1].d;
- if ( test.x== s->to->me.x && test.y==s->to->me.y )
- t[i] = 1.0; /* Throw it out */
- }
-
- if ( t[i]<.0001 || t[i]>.9999 ) {
- --p;
- for ( j=i; j<p; ++j ) {
- t[j] = t[j+1];
- rmfrom[j] = rmfrom[j+1];
- rmto[j] = rmto[j+1];
- }
- --i;
- }
- }
-
- if ( p==0 )
-return(s);
-
- /* Find the smallest of all the interesting points */
- min = t[0]; mini = 0;
- for ( i=1; i<p; ++i ) {
- if ( t[i]<min ) {
- min=t[i];
- mini = i;
- }
- }
- sp = SplineBisect(s,min);
-/* On the mac we get rounding errors in the bisect routine */
- { double dx, dy;
- if ( (dx = sp->me.x - sp->prevcp.x)<0 ) dx=-dx;
- if ( (dy = sp->me.y - sp->prevcp.y)<0 ) dy=-dy;
- if ( dx!=0 && dy!=0 ) {
- if ( dx<dy )
- sp->prevcp.x = sp->me.x;
- else
- sp->prevcp.y = sp->me.y;
- }
- if ( (dx = sp->me.x - sp->nextcp.x)<0 ) dx=-dx;
- if ( (dy = sp->me.y - sp->nextcp.y)<0 ) dy=-dy;
- if ( dx!=0 && dy!=0 ) {
- if ( dx<dy )
- sp->nextcp.x = sp->me.x;
- else
- sp->nextcp.y = sp->me.y;
- }
- }
-
- if ( rmfrom[mini] ) sp->prev->from->ticked = true;
- if ( rmto[mini] ) sp->next->to->ticked = true;
- s = sp->next;
- if ( p==1 )
-return( s );
- /* Don't try to use any other computed t values, it is easier to */
- /* recompute them than to try and figure out what they map to on the */
- /* new spline */
- }
-}
-
-void SplineSetAddExtrema(SplineChar *sc, SplineSet *ss,enum ae_type between_selected, int emsize) {
- Spline *s, *first;
- DBounds b;
- int always = true;
- real lenbound = 0;
- real offsetbound=0;
- SplinePoint *sp, *nextp;
-
- if ( between_selected==ae_only_good ) {
- SplineSetQuickBounds(ss,&b);
- lenbound = (emsize)/32.0;
- always = false;
- offsetbound = .5;
- between_selected = ae_only_good_rm_later;
- for ( sp = ss->first; ; ) {
- sp->ticked = false;
- if ( sp->next==NULL )
- break;
- sp = sp->next->to;
- if ( sp==ss->first )
- break;
- }
- }
-
- first = NULL;
- for ( s = ss->first->next; s!=NULL && s!=first; s = s->to->next ) {
- if ( between_selected!=ae_between_selected ||
- (s->from->selected && s->to->selected))
- s = SplineAddExtrema(s,always,lenbound,offsetbound,&b);
- if ( first==NULL ) first = s;
- }
- if ( between_selected == ae_only_good_rm_later ) {
- for ( sp = ss->first; ; ) {
- if ( sp->next==NULL )
- break;
- nextp = sp->next->to;
- if ( sp->ticked ) {
- if ( sp==ss->first )
- ss->first = ss->last = nextp;
- SplinesRemoveBetween(sc,sp->prev->from,nextp,1);
- }
- sp = nextp;
- if ( sp==ss->first )
- break;
- }
- }
-}
-
-
-char *GetNextUntitledName(void) {
- static int untitled_cnt=1;
- char buffer[80];
-
- sprintf( buffer, "Untitled%d", untitled_cnt++ );
-return( copy(buffer));
-}
-
-SplineFont *SplineFontEmpty(void) {
- extern int default_fv_row_count, default_fv_col_count;
- time_t now;
- SplineFont *sf;
-
- sf = gcalloc(1,sizeof(SplineFont));
- sf->pfminfo.fstype = -1;
- sf->top_enc = -1;
- sf->macstyle = -1;
- sf->desired_row_cnt = default_fv_row_count; sf->desired_col_cnt = default_fv_col_count;
- sf->display_antialias = default_fv_antialias;
- sf->display_bbsized = default_fv_bbsized;
- sf->display_size = -default_fv_font_size;
- sf->display_layer = ly_fore;
- sf->pfminfo.winascent_add = sf->pfminfo.windescent_add = true;
- sf->pfminfo.hheadascent_add = sf->pfminfo.hheaddescent_add = true;
- sf->pfminfo.typoascent_add = sf->pfminfo.typodescent_add = true;
- if ( TTFFoundry!=NULL )
- strncpy(sf->pfminfo.os2_vendor,TTFFoundry,4);
- else
- memcpy(sf->pfminfo.os2_vendor,"PfEd",4);
- sf->for_new_glyphs = DefaultNameListForNewFonts();
- time(&now);
- sf->creationtime = sf->modificationtime = now;
-
- sf->layer_cnt = 2;
- sf->layers = gcalloc(2,sizeof(LayerInfo));
- sf->layers[0].name = copy(_("Back"));
- sf->layers[0].background = true;
- sf->layers[1].name = copy(_("Fore"));
- sf->layers[1].background = false;
- sf->grid.background = true;
-
-return( sf );
-}
-
-
-static void SFChangeXUID(SplineFont *sf, int random) {
- char *pt, *new, *npt;
- int val;
-
- if ( sf->xuid==NULL )
-return;
- pt = strrchr(sf->xuid,' ');
- if ( pt==NULL )
- pt = strchr(sf->xuid,'[');
- if ( pt==NULL )
- pt = sf->xuid;
- else
- ++pt;
- if ( random )
- val = rand()&0xffffff;
- else {
- val = strtol(pt,NULL,10);
- val = (val+1)&0xffffff;
- }
-
- new = galloc(pt-sf->xuid+12);
- strncpy(new,sf->xuid,pt-sf->xuid);
- npt = new + (pt-sf->xuid);
- if ( npt==new ) *npt++ = '[';
- sprintf(npt, "%d]", val );
- free(sf->xuid); sf->xuid = new;
- sf->changed = true;
- sf->changed_since_xuidchanged = false;
-}
-
-void SFIncrementXUID(SplineFont *sf) {
- SFChangeXUID(sf,false);
-}
-
-void SFRandomChangeXUID(SplineFont *sf) {
- SFChangeXUID(sf,true);
-}
-
-void SPWeightedAverageCps(SplinePoint *sp) {
- double pangle, nangle, angle, plen, nlen, c, s;
- if ( sp->noprevcp || sp->nonextcp )
- /*SPAverageCps(sp)*/; /* Expand Stroke wants this case to hold still */
- else if (( sp->pointtype==pt_curve || sp->pointtype==pt_hvcurve) &&
- sp->prev && sp->next ) {
- pangle = atan2(sp->me.y-sp->prevcp.y,sp->me.x-sp->prevcp.x);
- nangle = atan2(sp->nextcp.y-sp->me.y,sp->nextcp.x-sp->me.x);
- if ( pangle<0 && nangle>0 && nangle-pangle>=3.1415926 )
- pangle += 2*3.1415926535897932;
- else if ( pangle>0 && nangle<0 && pangle-nangle>=3.1415926 )
- nangle += 2*3.1415926535897932;
- plen = sqrt((sp->me.y-sp->prevcp.y)*(sp->me.y-sp->prevcp.y) +
- (sp->me.x-sp->prevcp.x)*(sp->me.x-sp->prevcp.x));
- nlen = sqrt((sp->nextcp.y-sp->me.y)*(sp->nextcp.y-sp->me.y) +
- (sp->nextcp.x-sp->me.x)*(sp->nextcp.x-sp->me.x));
- if ( plen+nlen==0 )
- angle = (nangle+pangle)/2;
- else
- angle = (plen*pangle + nlen*nangle)/(plen+nlen);
- plen = -plen;
- c = cos(angle); s=sin(angle);
- sp->nextcp.x = c*nlen + sp->me.x;
- sp->nextcp.y = s*nlen + sp->me.y;
- sp->prevcp.x = c*plen + sp->me.x;
- sp->prevcp.y = s*plen + sp->me.y;
- SplineRefigure(sp->prev);
- SplineRefigure(sp->next);
- } else
- SPAverageCps(sp);
-}
-
-void SPAverageCps(SplinePoint *sp) {
- double pangle, nangle, angle, plen, nlen, c, s;
- if (( sp->pointtype==pt_curve || sp->pointtype==pt_hvcurve) &&
- sp->prev && sp->next ) {
- if ( sp->noprevcp )
- pangle = atan2(sp->me.y-sp->prev->from->me.y,sp->me.x-sp->prev->from->me.x);
- else
- pangle = atan2(sp->me.y-sp->prevcp.y,sp->me.x-sp->prevcp.x);
- if ( sp->nonextcp )
- nangle = atan2(sp->next->to->me.y-sp->me.y,sp->next->to->me.x-sp->me.x);
- else
- nangle = atan2(sp->nextcp.y-sp->me.y,sp->nextcp.x-sp->me.x);
- if ( pangle<0 && nangle>0 && nangle-pangle>=3.1415926 )
- pangle += 2*3.1415926535897932;
- else if ( pangle>0 && nangle<0 && pangle-nangle>=3.1415926 )
- nangle += 2*3.1415926535897932;
- angle = (nangle+pangle)/2;
- plen = -sqrt((sp->me.y-sp->prevcp.y)*(sp->me.y-sp->prevcp.y) +
- (sp->me.x-sp->prevcp.x)*(sp->me.x-sp->prevcp.x));
- nlen = sqrt((sp->nextcp.y-sp->me.y)*(sp->nextcp.y-sp->me.y) +
- (sp->nextcp.x-sp->me.x)*(sp->nextcp.x-sp->me.x));
- c = cos(angle); s=sin(angle);
- sp->nextcp.x = c*nlen + sp->me.x;
- sp->nextcp.y = s*nlen + sp->me.y;
- sp->prevcp.x = c*plen + sp->me.x;
- sp->prevcp.y = s*plen + sp->me.y;
- SplineRefigure(sp->prev);
- SplineRefigure(sp->next);
- } else if ( sp->pointtype==pt_tangent && sp->prev && sp->next ) {
- if ( !sp->noprevcp ) {
- nangle = atan2(sp->next->to->me.y-sp->me.y,sp->next->to->me.x-sp->me.x);
- plen = -sqrt((sp->me.y-sp->prevcp.y)*(sp->me.y-sp->prevcp.y) +
- (sp->me.x-sp->prevcp.x)*(sp->me.x-sp->prevcp.x));
- c = cos(nangle); s=sin(nangle);
- sp->prevcp.x = c*plen + sp->me.x;
- sp->prevcp.y = s*plen + sp->me.y;
- SplineRefigure(sp->prev);
- }
- if ( !sp->nonextcp ) {
- pangle = atan2(sp->me.y-sp->prev->from->me.y,sp->me.x-sp->prev->from->me.x);
- nlen = sqrt((sp->nextcp.y-sp->me.y)*(sp->nextcp.y-sp->me.y) +
- (sp->nextcp.x-sp->me.x)*(sp->nextcp.x-sp->me.x));
- c = cos(pangle); s=sin(pangle);
- sp->nextcp.x = c*nlen + sp->me.x;
- sp->nextcp.y = s*nlen + sp->me.y;
- SplineRefigure(sp->next);
- }
- }
-}
-
-
-void SplineCharTangentNextCP(SplinePoint *sp) {
- double len;
- BasePoint *bp, unit;
- extern int snaptoint;
-
- if ( sp->prev==NULL )
-return;
- bp = &sp->prev->from->me;
-
- unit.y = sp->me.y-bp->y; unit.x = sp->me.x-bp->x;
- len = sqrt( unit.x*unit.x + unit.y*unit.y );
- if ( len!=0 ) {
- unit.x /= len;
- unit.y /= len;
- }
- len = sqrt((sp->nextcp.y-sp->me.y)*(sp->nextcp.y-sp->me.y) + (sp->nextcp.x-sp->me.x)*(sp->nextcp.x-sp->me.x));
- sp->nextcp.x = sp->me.x + len*unit.x;
- sp->nextcp.y = sp->me.y + len*unit.y;
- if ( snaptoint ) {
- sp->nextcp.x = rint(sp->nextcp.x);
- sp->nextcp.y = rint(sp->nextcp.y);
- } else {
- sp->nextcp.x = rint(sp->nextcp.x*1024)/1024;
- sp->nextcp.y = rint(sp->nextcp.y*1024)/1024;
- }
- if ( sp->next!=NULL && sp->next->order2 )
- sp->next->to->prevcp = sp->nextcp;
-}
-
-void SplineCharTangentPrevCP(SplinePoint *sp) {
- double len;
- BasePoint *bp, unit;
- extern int snaptoint;
-
- if ( sp->next==NULL )
-return;
- bp = &sp->next->to->me;
-
- unit.y = sp->me.y-bp->y; unit.x = sp->me.x-bp->x;
- len = sqrt( unit.x*unit.x + unit.y*unit.y );
- if ( len!=0 ) {
- unit.x /= len;
- unit.y /= len;
- }
- len = sqrt((sp->prevcp.y-sp->me.y)*(sp->prevcp.y-sp->me.y) + (sp->prevcp.x-sp->me.x)*(sp->prevcp.x-sp->me.x));
- sp->prevcp.x = sp->me.x + len*unit.x;
- sp->prevcp.y = sp->me.y + len*unit.y;
- if ( snaptoint ) {
- sp->prevcp.x = rint(sp->prevcp.x);
- sp->prevcp.y = rint(sp->prevcp.y);
- } else {
- sp->prevcp.x = rint(sp->prevcp.x*1024)/1024;
- sp->prevcp.y = rint(sp->prevcp.y*1024)/1024;
- }
- if ( sp->prev!=NULL && sp->prev->order2 )
- sp->prev->from->nextcp = sp->prevcp;
-}
-
-static void BP_HVForce(BasePoint *vector) {
- /* Force vector to be horizontal/vertical */
- double dx, dy, len;
-
- if ( (dx= vector->x)<0 ) dx = -dx;
- if ( (dy= vector->y)<0 ) dy = -dy;
- if ( dx==0 || dy==0 )
-return;
- len = sqrt(dx*dx + dy*dy);
- if ( dx>dy ) {
- vector->x = vector->x<0 ? -len : len;
- vector->y = 0;
- } else {
- vector->y = vector->y<0 ? -len : len;
- vector->x = 0;
- }
-}
-
-#define NICE_PROPORTION .39
-void SplineCharDefaultNextCP(SplinePoint *base) {
- SplinePoint *prev=NULL, *next;
- double len, plen, ulen;
- BasePoint unit;
- extern int snaptoint;
-
- if ( base->next==NULL )
-return;
- if ( base->next->order2 ) {
- SplineRefigureFixup(base->next);
-return;
- }
- if ( !base->nextcpdef ) {
- if ( base->pointtype==pt_tangent )
- SplineCharTangentNextCP(base);
-return;
- }
- next = base->next->to;
- if ( base->prev!=NULL )
- prev = base->prev->from;
-
- len = NICE_PROPORTION * sqrt((base->me.x-next->me.x)*(base->me.x-next->me.x) +
- (base->me.y-next->me.y)*(base->me.y-next->me.y));
- unit.x = next->me.x - base->me.x;
- unit.y = next->me.y - base->me.y;
- ulen = sqrt(unit.x*unit.x + unit.y*unit.y);
- if ( ulen!=0 )
- unit.x /= ulen, unit.y /= ulen;
- base->nonextcp = false;
-
- if ( base->pointtype == pt_curve || base->pointtype == pt_hvcurve ) {
- if ( prev!=NULL && (base->prevcpdef || base->noprevcp)) {
- unit.x = next->me.x - prev->me.x;
- unit.y = next->me.y - prev->me.y;
- ulen = sqrt(unit.x*unit.x + unit.y*unit.y);
- if ( ulen!=0 )
- unit.x /= ulen, unit.y /= ulen;
- if ( base->pointtype == pt_hvcurve )
- BP_HVForce(&unit);
- plen = sqrt((base->prevcp.x-base->me.x)*(base->prevcp.x-base->me.x) +
- (base->prevcp.y-base->me.y)*(base->prevcp.y-base->me.y));
- base->prevcp.x = base->me.x - plen*unit.x;
- base->prevcp.y = base->me.y - plen*unit.y;
- if ( snaptoint ) {
- base->prevcp.x = rint(base->prevcp.x);
- base->prevcp.y = rint(base->prevcp.y);
- }
- SplineRefigureFixup(base->prev);
- } else if ( prev!=NULL ) {
- /* The prev control point is fixed. So we've got to use the same */
- /* angle it uses */
- unit.x = base->me.x-base->prevcp.x;
- unit.y = base->me.y-base->prevcp.y;
- ulen = sqrt(unit.x*unit.x + unit.y*unit.y);
- if ( ulen!=0 )
- unit.x /= ulen, unit.y /= ulen;
- } else {
- base->prevcp = base->me;
- base->noprevcp = true;
- base->prevcpdef = true;
- }
- if ( base->pointtype == pt_hvcurve )
- BP_HVForce(&unit);
- } else if ( base->pointtype == pt_corner ) {
- if ( next->pointtype != pt_curve && next->pointtype != pt_hvcurve ) {
- base->nonextcp = true;
- }
- } else /* tangent */ {
- if ( next->pointtype != pt_curve ) {
- base->nonextcp = true;
- } else {
- if ( prev!=NULL ) {
- if ( !base->noprevcp ) {
- plen = sqrt((base->prevcp.x-base->me.x)*(base->prevcp.x-base->me.x) +
- (base->prevcp.y-base->me.y)*(base->prevcp.y-base->me.y));
- base->prevcp.x = base->me.x - plen*unit.x;
- base->prevcp.y = base->me.y - plen*unit.y;
- SplineRefigureFixup(base->prev);
- }
- unit.x = base->me.x-prev->me.x;
- unit.y = base->me.y-prev->me.y;
- ulen = sqrt(unit.x*unit.x + unit.y*unit.y);
- if ( ulen!=0 )
- unit.x /= ulen, unit.y /= ulen;
- }
- }
- }
- if ( base->nonextcp )
- base->nextcp = base->me;
- else {
- base->nextcp.x = base->me.x + len*unit.x;
- base->nextcp.y = base->me.y + len*unit.y;
- if ( snaptoint ) {
- base->nextcp.x = rint(base->nextcp.x);
- base->nextcp.y = rint(base->nextcp.y);
- } else {
- base->nextcp.x = rint(base->nextcp.x*1024)/1024;
- base->nextcp.y = rint(base->nextcp.y*1024)/1024;
- }
- if ( base->next != NULL )
- SplineRefigureFixup(base->next);
- }
-}
-
-void SplineCharDefaultPrevCP(SplinePoint *base) {
- SplinePoint *next=NULL, *prev;
- double len, nlen, ulen;
- BasePoint unit;
- extern int snaptoint;
-
- if ( base->prev==NULL )
-return;
- if ( base->prev->order2 ) {
- SplineRefigureFixup(base->prev);
-return;
- }
- if ( !base->prevcpdef ) {
- if ( base->pointtype==pt_tangent )
- SplineCharTangentPrevCP(base);
-return;
- }
- prev = base->prev->from;
- if ( base->next!=NULL )
- next = base->next->to;
-
- len = NICE_PROPORTION * sqrt((base->me.x-prev->me.x)*(base->me.x-prev->me.x) +
- (base->me.y-prev->me.y)*(base->me.y-prev->me.y));
- unit.x = prev->me.x - base->me.x;
- unit.y = prev->me.y - base->me.y;
- ulen = sqrt(unit.x*unit.x + unit.y*unit.y);
- if ( ulen!=0 )
- unit.x /= ulen, unit.y /= ulen;
- base->noprevcp = false;
-
- if ( base->pointtype == pt_curve || base->pointtype == pt_hvcurve ) {
- if ( next!=NULL && (base->nextcpdef || base->nonextcp)) {
- unit.x = prev->me.x - next->me.x;
- unit.y = prev->me.y - next->me.y;
- ulen = sqrt(unit.x*unit.x + unit.y*unit.y);
- if ( ulen!=0 )
- unit.x /= ulen, unit.y /= ulen;
- if ( base->pointtype == pt_hvcurve )
- BP_HVForce(&unit);
- nlen = sqrt((base->nextcp.x-base->me.x)*(base->nextcp.x-base->me.x) +
- (base->nextcp.y-base->me.y)*(base->nextcp.y-base->me.y));
- base->nextcp.x = base->me.x - nlen*unit.x;
- base->nextcp.y = base->me.y - nlen*unit.y;
- if ( snaptoint ) {
- base->nextcp.x = rint(base->nextcp.x);
- base->nextcp.y = rint(base->nextcp.y);
- }
- SplineRefigureFixup(base->next);
- } else if ( next!=NULL ) {
- /* The next control point is fixed. So we got to use the same */
- /* angle it uses */
- unit.x = base->me.x-base->nextcp.x;
- unit.y = base->me.y-base->nextcp.y;
- ulen = sqrt(unit.x*unit.x + unit.y*unit.y);
- if ( ulen!=0 )
- unit.x /= ulen, unit.y /= ulen;
- } else {
- base->nextcp = base->me;
- base->nonextcp = true;
- base->nextcpdef = true;
- }
- if ( base->pointtype == pt_hvcurve )
- BP_HVForce(&unit);
- } else if ( base->pointtype == pt_corner ) {
- if ( prev->pointtype != pt_curve && prev->pointtype != pt_hvcurve ) {
- base->noprevcp = true;
- }
- } else /* tangent */ {
- if ( prev->pointtype != pt_curve ) {
- base->noprevcp = true;
- } else {
- if ( next!=NULL ) {
- if ( !base->nonextcp ) {
- nlen = sqrt((base->nextcp.x-base->me.x)*(base->nextcp.x-base->me.x) +
- (base->nextcp.y-base->me.y)*(base->nextcp.y-base->me.y));
- base->nextcp.x = base->me.x - nlen*unit.x;
- base->nextcp.y = base->me.y - nlen*unit.y;
- SplineRefigureFixup(base->next);
- }
- unit.x = base->me.x-next->me.x;
- unit.y = base->me.y-next->me.y;
- ulen = sqrt(unit.x*unit.x + unit.y*unit.y);
- if ( ulen!=0 )
- unit.x /= ulen, unit.y /= ulen;
- }
- }
- }
- if ( base->noprevcp )
- base->prevcp = base->me;
- else {
- base->prevcp.x = base->me.x + len*unit.x;
- base->prevcp.y = base->me.y + len*unit.y;
- if ( snaptoint ) {
- base->prevcp.x = rint(base->prevcp.x);
- base->prevcp.y = rint(base->prevcp.y);
- } else {
- base->prevcp.x = rint(base->prevcp.x*1024)/1024;
- base->prevcp.y = rint(base->prevcp.y*1024)/1024;
- }
- if ( base->prev!=NULL )
- SplineRefigureFixup(base->prev);
- }
-}
-
-
-SplineSet *SplineSetReverse(SplineSet *spl) {
- Spline *spline, *first, *next;
- BasePoint tp;
- SplinePoint *temp;
- int bool;
- /* reverse the splineset so that what was the start point becomes the end */
- /* and vice versa. This entails reversing every individual spline, and */
- /* each point */
-
- first = NULL;
- spline = spl->first->next;
- if ( spline==NULL )
-return( spl ); /* Only one point, reversal is meaningless */
-
- tp = spline->from->nextcp;
- spline->from->nextcp = spline->from->prevcp;
- spline->from->prevcp = tp;
- bool = spline->from->nonextcp;
- spline->from->nonextcp = spline->from->noprevcp;
- spline->from->noprevcp = bool;
- bool = spline->from->nextcpdef;
- spline->from->nextcpdef = spline->from->prevcpdef;
- spline->from->prevcpdef = bool;
-
- for ( ; spline!=NULL && spline!=first; spline=next ) {
- next = spline->to->next;
-
- if ( spline->to!=spl->first ) { /* On a closed spline don't want to reverse the first point twice */
- tp = spline->to->nextcp;
- spline->to->nextcp = spline->to->prevcp;
- spline->to->prevcp = tp;
- bool = spline->to->nonextcp;
- spline->to->nonextcp = spline->to->noprevcp;
- spline->to->noprevcp = bool;
- bool = spline->to->nextcpdef;
- spline->to->nextcpdef = spline->to->prevcpdef;
- spline->to->prevcpdef = bool;
- }
-
- temp = spline->to;
- spline->to = spline->from;
- spline->from = temp;
- spline->from->next = spline;
- spline->to->prev = spline;
- SplineRefigure(spline);
- if ( first==NULL ) first = spline;
- }
-
- if ( spl->first!=spl->last ) {
- temp = spl->first;
- spl->first = spl->last;
- spl->last = temp;
- spl->first->prev = NULL;
- spl->last->next = NULL;
- }
-
-return( spl );
-}
-
-static void SplineSetsUntick(SplineSet *spl) {
- Spline *spline, *first;
-
- while ( spl!=NULL ) {
- first = NULL;
- spl->first->isintersection = false;
- for ( spline=spl->first->next; spline!=first && spline!=NULL; spline = spline->to->next ) {
- spline->isticked = false;
- spline->isneeded = false;
- spline->isunneeded = false;
- spline->ishorvert = false;
- spline->to->isintersection = false;
- if ( first==NULL ) first = spline;
- }
- spl = spl->next;
- }
-}
-
-static void SplineSetTick(SplineSet *spl) {
- Spline *spline, *first;
-
- first = NULL;
- for ( spline=spl->first->next; spline!=first && spline!=NULL; spline = spline->to->next ) {
- spline->isticked = true;
- if ( first==NULL ) first = spline;
- }
-}
-
-static SplineSet *SplineSetOfSpline(SplineSet *spl,Spline *search) {
- Spline *spline, *first;
-
- while ( spl!=NULL ) {
- first = NULL;
- for ( spline=spl->first->next; spline!=first && spline!=NULL; spline = spline->to->next ) {
- if ( spline==search )
-return( spl );
- if ( first==NULL ) first = spline;
- }
- spl = spl->next;
- }
-return( NULL );
-}
-
-static int SplineInSplineSet(Spline *spline, SplineSet *spl) {
- Spline *first, *s;
-
- first = NULL;
- for ( s = spl->first->next; s!=NULL && s!=first; s = s->to->next ) {
- if ( s==spline )
-return( true );
- if ( first==NULL ) first = s;
- }
-return( false );
-}
-
-#include "edgelist.h"
-
-static void EdgeListReverse(EdgeList *es, SplineSet *spl) {
- int i;
-
- if ( es->edges!=NULL ) {
- for ( i=0; i<es->cnt; ++i ) {
- Edge *e;
- for ( e = es->edges[i]; e!=NULL; e = e->esnext ) {
- if ( SplineInSplineSet(e->spline,spl)) {
- e->up = !e->up;
- e->t_mmin = 1-e->t_mmin;
- e->t_mmax = 1-e->t_mmax;
- e->t_cur = 1-e->t_cur;
- }
- }
- }
- }
-}
-
-static int SSCheck(SplineSet *base,Edge *active, int up, EdgeList *es,int *changed) {
- SplineSet *spl;
- if ( active->spline->isticked )
-return( 0 );
- spl = SplineSetOfSpline(base,active->spline);
- if ( active->up!=up ) {
- SplineSetReverse(spl);
- *changed = true;
- EdgeListReverse(es,spl);
- }
- SplineSetTick(spl);
-return( 1 );
-}
-
-
-/* The idea behind SplineSetsCorrect is simple. However there are many splinesets */
-/* where it is impossible, so bear in mind that this only works for nice */
-/* splines. Figure 8's, interesecting splines all cause problems */
-/* The outermost spline should be clockwise (up), the next splineset we find */
-/* should be down, if it isn't reverse it (if it's already been dealt with */
-/* then ignore it) */
-SplineSet *SplineSetsCorrect(SplineSet *base,int *changed) {
- SplineSet *spl;
- int sscnt, check_cnt;
- EdgeList es;
- DBounds b;
- Edge *active=NULL, *apt, *pr, *e;
- int i, winding;
-
- *changed = false;
-
- SplineSetsUntick(base);
- for (sscnt=0,spl=base; spl!=NULL; spl=spl->next, ++sscnt );
-
- SplineSetFindBounds(base,&b);
- memset(&es,'\0',sizeof(es));
- es.scale = 1.0;
- es.mmin = floor(b.miny*es.scale);
- es.mmax = ceil(b.maxy*es.scale);
- es.omin = b.minx*es.scale;
- es.omax = b.maxx*es.scale;
- es.layer = ly_fore; /* Not meaningful */
-
-/* Give up if we are given unreasonable values (ie. if rounding errors might screw us up) */
- if ( es.mmin<1e5 && es.mmax>-1e5 && es.omin<1e5 && es.omax>-1e5 ) {
- es.cnt = (int) (es.mmax-es.mmin) + 1;
- es.edges = gcalloc(es.cnt,sizeof(Edge *));
- es.interesting = gcalloc(es.cnt,sizeof(char));
- es.sc = NULL;
- es.major = 1; es.other = 0;
- FindEdgesSplineSet(base,&es,false);
-
- check_cnt = 0;
- for ( i=0; i<es.cnt && check_cnt<sscnt; ++i ) {
- active = ActiveEdgesRefigure(&es,active,i);
- if ( es.edges[i]!=NULL )
- continue; /* Just too hard to get the edges sorted when we are at a start vertex */
- if ( /*es.edges[i]==NULL &&*/ !es.interesting[i] &&
- !(i>0 && es.interesting[i-1]) && !(i>0 && es.edges[i-1]!=NULL) &&
- !(i<es.cnt-1 && es.edges[i+1]!=NULL) &&
- !(i<es.cnt-1 && es.interesting[i+1])) /* interesting things happen when we add (or remove) entries */
- continue; /* and where we have extrema */
- for ( apt=active; apt!=NULL; apt = e) {
- check_cnt += SSCheck(base,apt,true,&es,changed);
- winding = apt->up?1:-1;
- for ( pr=apt, e=apt->aenext; e!=NULL && winding!=0; pr=e, e=e->aenext ) {
- if ( !e->spline->isticked )
- check_cnt += SSCheck(base,e,winding<0,&es,changed);
- if ( pr->up!=e->up )
- winding += (e->up?1:-1);
- else if ( (pr->before==e || pr->after==e ) &&
- (( pr->mmax==i && e->mmin==i ) ||
- ( pr->mmin==i && e->mmax==i )) )
- /* This just continues the line and doesn't change count */;
- else
- winding += (e->up?1:-1);
- }
- /* color a horizontal line that comes out of the last vertex */
- if ( e!=NULL && (e->before==pr || e->after==pr) &&
- (( pr->mmax==i && e->mmin==i ) ||
- ( pr->mmin==i && e->mmax==i )) ) {
- pr = e;
- e = e->aenext;
- }
- }
- }
- FreeEdges(&es);
- }
-return( base );
-}
-
-
-int SplinePointListIsClockwise(const SplineSet *spl) {
- EIList el;
- EI *active=NULL, *apt, *e;
- int i, change,waschange;
- SplineChar dummy;
- SplineSet *next;
- int ret = -1, maybe=-1;
- Layer layers[2];
-
- if ( spl->first!=spl->last || spl->first->next == NULL )
-return( -1 ); /* Open paths, (open paths with only one point are a special case) */
-
- memset(&el,'\0',sizeof(el));
- memset(&dummy,'\0',sizeof(dummy));
- memset(layers,0,sizeof(layers));
- el.layer = ly_fore;
- dummy.layers = layers;
- dummy.layer_cnt = 2;
- dummy.layers[ly_fore].splines = (SplineSet *) spl;
- next = spl->next; ((SplineSet *) spl)->next = NULL;
- ELFindEdges(&dummy,&el);
- if ( el.coordmax[1]-el.coordmin[1] > 1.e6 ) {
- LogError( _("Warning: Unreasonably big splines. They will be ignored.\n") );
-return( -1 );
- }
- el.major = 1;
- ELOrder(&el,el.major);
-
- waschange = false;
- for ( i=0; i<el.cnt && ret==-1; ++i ) {
- active = EIActiveEdgesRefigure(&el,active,i,1,&change);
- if ( el.ordered[i]!=NULL || el.ends[i] || waschange || change ) {
- waschange = change;
- if ( active!=NULL )
- maybe = active->up;
- continue; /* Just too hard to get the edges sorted when we are at a start vertex */
- }
- waschange = change;
- for ( apt=active; apt!=NULL && ret==-1; apt = e) {
- if ( EISkipExtremum(apt,i+el.low,1)) {
- e = apt->aenext->aenext;
- continue;
- }
- ret = apt->up;
- break;
- }
- }
- free(el.ordered);
- free(el.ends);
- ElFreeEI(&el);
- ((SplineSet *) spl)->next = next;
- if ( ret==-1 )
- ret = maybe;
-return( ret );
-}
diff --git a/Build/source/texk/web2c/luatexdir/luafontloader/fontforge/fontforge/start.c b/Build/source/texk/web2c/luatexdir/luafontloader/fontforge/fontforge/start.c
deleted file mode 100644
index 71fb1b4ee8d..00000000000
--- a/Build/source/texk/web2c/luatexdir/luafontloader/fontforge/fontforge/start.c
+++ /dev/null
@@ -1,77 +0,0 @@
-/* Copyright (C) 2000-2008 by George Williams */
-/*
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are met:
-
- * Redistributions of source code must retain the above copyright notice, this
- * list of conditions and the following disclaimer.
-
- * Redistributions in binary form must reproduce the above copyright notice,
- * this list of conditions and the following disclaimer in the documentation
- * and/or other materials provided with the distribution.
-
- * The name of the author may not be used to endorse or promote products
- * derived from this software without specific prior written permission.
-
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
- * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
- * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
- * EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
- * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
- * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
- * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
- * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-#include "fontforgevw.h"
-#include <gfile.h>
-#include <time.h>
-#include <sys/time.h>
-#include <locale.h>
-#include <unistd.h>
-
-int32 unicode_from_adobestd[256];
-struct lconv localeinfo;
-char *coord_sep = ",";
-const struct unicode_nameannot * const *const *_UnicodeNameAnnot = NULL;
-
-static void initadobeenc(void) {
- int i,j;
-
- for ( i=0; i<0x100; ++i ) {
- if ( strcmp(AdobeStandardEncoding[i],".notdef")==0 )
- unicode_from_adobestd[i] = 0xfffd;
- else {
- j = UniFromName(AdobeStandardEncoding[i],ui_none,&custom);
- if ( j==-1 ) j = 0xfffd;
- unicode_from_adobestd[i] = j;
- }
- }
-}
-
-static void initrand(void) {
- struct timeval tv;
-
- gettimeofday(&tv,NULL);
- srand(tv.tv_usec);
-}
-
-void InitSimpleStuff(void) {
- initrand();
- initadobeenc();
-
- setlocale(LC_ALL,"");
- localeinfo = *localeconv();
- coord_sep = ",";
- if ( *localeinfo.decimal_point=='.' ) coord_sep=",";
- else if ( *localeinfo.decimal_point!='.' ) coord_sep=" ";
-
- SetDefaults();
-}
-
-void doversion(const char *source_version_str) {
- if ( source_version_str!=NULL )
- printf( "fontforge %s\n", source_version_str );
-exit(0);
-}
diff --git a/Build/source/texk/web2c/luatexdir/luafontloader/fontforge/fontforge/stemdb.c b/Build/source/texk/web2c/luatexdir/luafontloader/fontforge/fontforge/stemdb.c
deleted file mode 100644
index 60ecac660d5..00000000000
--- a/Build/source/texk/web2c/luatexdir/luafontloader/fontforge/fontforge/stemdb.c
+++ /dev/null
@@ -1,40 +0,0 @@
-/* Copyright (C) 2005-2008 by George Williams and Alexey Kryukov */
-/*
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are met:
-
- * Redistributions of source code must retain the above copyright notice, this
- * list of conditions and the following disclaimer.
-
- * Redistributions in binary form must reproduce the above copyright notice,
- * this list of conditions and the following disclaimer in the documentation
- * and/or other materials provided with the distribution.
-
- * The name of the author may not be used to endorse or promote products
- * derived from this software without specific prior written permission.
-
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
- * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
- * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
- * EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
- * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
- * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
- * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
- * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-#include "pfaedit.h"
-#include "edgelist2.h"
-#include "stemdb.h"
-
-#include <math.h>
-#include <utype.h>
-
-/* A diagonal end is like the top or bottom of a slash. Should we add a vertical stem at the end? */
-/* A diagonal corner is like the bottom of circumflex. Should we add a horizontal stem? */
-int hint_diagonal_ends = 0,
- hint_diagonal_intersections = 0,
- hint_bounding_boxes = 1,
- detect_diagonal_stems = 0;
-
diff --git a/Build/source/texk/web2c/luatexdir/luafontloader/fontforge/fontforge/stemdb.h b/Build/source/texk/web2c/luatexdir/luafontloader/fontforge/fontforge/stemdb.h
deleted file mode 100644
index 83a02842a6a..00000000000
--- a/Build/source/texk/web2c/luatexdir/luafontloader/fontforge/fontforge/stemdb.h
+++ /dev/null
@@ -1,210 +0,0 @@
-/* Copyright (C) 2005-2008 by George Williams */
-/*
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are met:
-
- * Redistributions of source code must retain the above copyright notice, this
- * list of conditions and the following disclaimer.
-
- * Redistributions in binary form must reproduce the above copyright notice,
- * this list of conditions and the following disclaimer in the documentation
- * and/or other materials provided with the distribution.
-
- * The name of the author may not be used to endorse or promote products
- * derived from this software without specific prior written permission.
-
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
- * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
- * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
- * EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
- * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
- * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
- * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
- * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-#ifndef _STEMDB_H_
-# define _STEMDB_H_
-
-# include "pfaedit.h"
-
-typedef struct glyphdata {
- SplineFont *sf;
- BlueData bd;
- int fuzz;
- SplineChar *sc;
- int layer;
- int emsize;
- int order2;
- int has_slant;
- BasePoint slant_unit;
- int ccnt;
- int *contourends;
- int realcnt; /* Includes control points, excludes implied points */
- int norefpcnt; /* Does not include points in glyphs with references */
- int pcnt; /* Includes control points, includes implied points */
- struct pointdata *points; /* Entries corresponding to control points are empty */
- int stemcnt;
- struct stemdata *stems;
- int linecnt;
- struct linedata *lines;
- struct stembundle *hbundle;
- struct stembundle *vbundle;
- struct stembundle *ibundle;
-
- /* Temporary values, quickly freed */
- int mcnt;
- struct monotonic *ms;
- struct monotonic **space;
- int scnt;
- Spline **sspace;
- struct st *stspace;
- DBounds size;
- struct pointdata **pspace;
- struct segment {
- double start, end, sbase, ebase;
- int curved, scurved, ecurved;
- } *lspace, *rspace, *bothspace, *activespace;
-
- int only_hv;
-} GlyphData;
-
-typedef struct pointdata {
- SplinePoint *sp;
- SplineSet *ss;
- int ttfindex; /* normally same as sp->ttfindex, but needed for offcurve points */
- BasePoint base; /* normally same as sp->me, but needed for offcurve points */
- BasePoint nextunit, prevunit; /* unit vectors pointing in the next/prev directions */
- struct linedata *nextline, *prevline; /* any other points lying on approximately the same line */
- Spline *nextedges[2], *prevedges[2]; /* There should always be a matching spline, which may end up as part of a stem, and may not */
- Spline *bothedge;
- double next_e_t[2], prev_e_t[2]; /* Location on other edge where our normal hits it */
- double both_e_t;
- int next_e_cnt, prev_e_cnt;
- double next_dist[2], prev_dist[2]; /* Distance from the point to the matching edge */
- struct stemdata **nextstems, **prevstems;
- int *next_is_l, *prev_is_l;
- int nextcnt, prevcnt;
- double nextlen, prevlen;
- int value; /* Temporary value, used to compare points assigned to the same edge and determine which one can be used as a reference point*/
- unsigned int nextlinear: 1;
- unsigned int nextzero: 1;
- unsigned int prevlinear: 1;
- unsigned int prevzero: 1;
- unsigned int colinear: 1;
- unsigned int symetrical_h: 1; /* Are next & prev symetrical? */
- unsigned int symetrical_v: 1; /* Are next & prev symetrical? */
- unsigned int next_hor: 1;
- unsigned int next_ver: 1;
- unsigned int prev_hor: 1;
- unsigned int prev_ver: 1;
- unsigned int ticked: 1;
- uint8 touched, affected;
- uint8 x_extr, y_extr;
- uint8 x_corner, y_corner;
- BasePoint newpos;
- BasePoint newnext, newprev;
- BasePoint posdir; /* If point has been positioned in 1 direction, this is that direction */
- double projection; /* temporary value */
-} PointData;
-
-typedef struct linedata {
- BasePoint unit;
- BasePoint online;
- uint8 is_left;
- int pcnt;
- double length;
- struct pointdata **points;
-} LineData;
-
-typedef struct stemdata {
- BasePoint unit; /* Unit vector pointing in direction of stem */
- BasePoint l_to_r; /* Unit vector pointing from left to right (across stem) */
- BasePoint left; /* a point on one side of the stem (not necissarily left, even for vertical stems) */
- BasePoint right; /* and one on the other */
- BasePoint newunit; /* Unit vector after repositioning (e. g. in Metafont routines) */
- BasePoint newleft, newright;/* Left and right edges after repositioning */
- int leftidx, rightidx; /* TTF indices of the left and right key points */
- struct pointdata *keypts[4];/* Uppest and lowest points on left and right edges. Used for positioning diagonal stems */
- double lmin, lmax, rmin, rmax;
- double width;
- int chunk_cnt; /* number of separate point-pairs on this stem */
- struct stem_chunk {
- struct stemdata *parent;
- struct pointdata *l;
- struct pointdata *r;
- uint8 lpotential, rpotential;
- uint8 lnext, rnext; /* are we using the next/prev side of the left/right points */
- uint8 ltick, rtick;
- uint8 stub;
- uint8 stemcheat; /* It's not a real stem, but it's something we'd like PostScript to hint for us */
- uint8 is_ball; /* Specifies if this chunk marks the opposite sides of a ball terminal (useful for TTF instructions) */
- int l_e_idx, r_e_idx; /* Which of the opposed edges assigned to the left and right points corresponds to this chunk */
- } *chunks;
- int activecnt;
- struct segment *active;
- uint8 toobig; /* Stem is fatter than tall, unlikely to be a real stem */
- uint8 positioned;
- uint8 ticked;
- uint8 ghost;
- uint8 bbox;
- uint8 ldone, rdone;
- uint8 italic;
- int blue; /* Blue zone a ghost hint is attached to */
- double len, clen; /* Length of linear segments. clen adds "length" of curved bits */
- struct stembundle *bundle;
- int lpcnt, rpcnt; /* Count of points assigned to left and right edges of this stem */
- struct linedata *leftline, *rightline;
- struct stemdata *master, *next_c_m, *prev_c_m;
- int confl_cnt;
- int dep_cnt;
- int serif_cnt;
- struct dependent_stem {
- struct stemdata *stem;
- uint8 lbase;
- char dep_type; /* can be 'a' (align), 'i' (interpolate), 'm' (move) or 's' (serif) */
- } *dependent; /* Lists other stems dependent from the given stem */
- struct dependent_serif {
- struct stemdata *stem;
- double width; /* The distance from an edge of the main stem to the opposite edge of the serif stem */
- uint8 lbase;
- uint8 is_ball;
- } *serifs; /* Lists serifs and other elements protruding from the base stem */
-} StemData;
-
-typedef struct vchunk {
- struct stem_chunk *chunk;
- double dist;
- int parallel;
- int value;
-} VChunk;
-
-struct stembounds {
- struct stembounds *next;
- struct stemdata *stem;
- double tstart, tend;
- uint8 isr;
-};
-
-struct splinesteminfo {
- Spline *s;
- struct stembounds *sb;
-};
-
-typedef struct stembundle {
- BasePoint unit; /* All these stems are parallel, pointing in unit direction */
- BasePoint l_to_r; /* Axis along which these stems are ordered (normal to unit) */
- BasePoint bp; /* Base point for measuring by l_to_r (stem->lpos,rpos) */
- int cnt; /* Number of stems in the bundle */
- struct stemdata **stemlist;
-} StemBundle;
-
-extern struct glyphdata *GlyphDataBuild(SplineChar *sc, int layer, BlueData *bd, int use_existing);
-extern struct glyphdata *GlyphDataInit(SplineChar *sc, int layer, double em_size, int only_hv);
-extern struct glyphdata *StemInfoToStemData( struct glyphdata *gd,StemInfo *si,int is_v );
-extern struct glyphdata *DStemInfoToStemData( struct glyphdata *gd,DStemInfo *dsi );
-extern int IsStemAssignedToPoint( struct pointdata *pd,struct stemdata *stem,int is_next );
-extern void GlyphDataFree(struct glyphdata *gd);
-
-#endif /* _STEMDB_H_ */
diff --git a/Build/source/texk/web2c/luatexdir/luafontloader/fontforge/fontforge/tottf.c b/Build/source/texk/web2c/luatexdir/luafontloader/fontforge/fontforge/tottf.c
deleted file mode 100644
index 3a1f02c273e..00000000000
--- a/Build/source/texk/web2c/luatexdir/luafontloader/fontforge/fontforge/tottf.c
+++ /dev/null
@@ -1,2032 +0,0 @@
-/* Copyright (C) 2000-2008 by George Williams */
-/*
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are met:
-
- * Redistributions of source code must retain the above copyright notice, this
- * list of conditions and the following disclaimer.
-
- * Redistributions in binary form must reproduce the above copyright notice,
- * this list of conditions and the following disclaimer in the documentation
- * and/or other materials provided with the distribution.
-
- * The name of the author may not be used to endorse or promote products
- * derived from this software without specific prior written permission.
-
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
- * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
- * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
- * EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
- * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
- * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
- * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
- * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-#include "pfaedit.h"
-#include <math.h>
-#include <unistd.h>
-#include <time.h>
-#include <locale.h>
-#include <utype.h>
-#include <ustring.h>
-#include <chardata.h>
-
-#ifdef __CygWin
- #include <sys/types.h>
- #include <sys/stat.h>
- #include <unistd.h>
-#endif
-
-#include "ttf.h"
-
-char *TTFFoundry=NULL;
-
-/* This file produces a ttf file given a splinefont. */
-
-/* ************************************************************************** */
-
-/* Required tables:
- cmap encoding
- head header data
- hhea horizontal metrics header data
- hmtx horizontal metrics (widths, lsidebearing)
- maxp various maxima in the font
- name various names associated with the font
- post postscript names and other stuff
-Required by windows but not mac
- OS/2 bleah.
-Required for TrueType
- loca pointers to the glyphs
- glyf character shapes
-Required for OpenType (Postscript)
- CFF A complete postscript CFF font here with all its internal tables
-Required for bitmaps
- bdat/EBDT bitmap data
- bloc/EBLC pointers to bitmaps
- bhed for apple bitmap only fonts, replaces head
-Optional for bitmaps
- EBSC bitmap scaling table (used in windows "bitmap-only" fonts)
-OpenType
- GPOS (opentype, if kern,anchor data are present)
- GSUB (opentype, if ligature (other subs) data are present)
- GDEF (opentype, if anchor data are present)
-MATH
- MATH (MS proposal, if math data present)
-additional tables
- cvt for hinting
- gasp to control when things should be hinted
- fpgm for hinting (currently only copied and dumped verbatim)
- prep for hinting (currently only copied and dumped verbatim)
-FontForge
- PfEd My own table
-TeX
- TeX TeX specific info (stuff that used to live in tfm files)
-*/
-
-const char *ttfstandardnames[258] = {
-".notdef",
-".null",
-"nonmarkingreturn",
-"space",
-"exclam",
-"quotedbl",
-"numbersign",
-"dollar",
-"percent",
-"ampersand",
-"quotesingle",
-"parenleft",
-"parenright",
-"asterisk",
-"plus",
-"comma",
-"hyphen",
-"period",
-"slash",
-"zero",
-"one",
-"two",
-"three",
-"four",
-"five",
-"six",
-"seven",
-"eight",
-"nine",
-"colon",
-"semicolon",
-"less",
-"equal",
-"greater",
-"question",
-"at",
-"A",
-"B",
-"C",
-"D",
-"E",
-"F",
-"G",
-"H",
-"I",
-"J",
-"K",
-"L",
-"M",
-"N",
-"O",
-"P",
-"Q",
-"R",
-"S",
-"T",
-"U",
-"V",
-"W",
-"X",
-"Y",
-"Z",
-"bracketleft",
-"backslash",
-"bracketright",
-"asciicircum",
-"underscore",
-"grave",
-"a",
-"b",
-"c",
-"d",
-"e",
-"f",
-"g",
-"h",
-"i",
-"j",
-"k",
-"l",
-"m",
-"n",
-"o",
-"p",
-"q",
-"r",
-"s",
-"t",
-"u",
-"v",
-"w",
-"x",
-"y",
-"z",
-"braceleft",
-"bar",
-"braceright",
-"asciitilde",
-"Adieresis",
-"Aring",
-"Ccedilla",
-"Eacute",
-"Ntilde",
-"Odieresis",
-"Udieresis",
-"aacute",
-"agrave",
-"acircumflex",
-"adieresis",
-"atilde",
-"aring",
-"ccedilla",
-"eacute",
-"egrave",
-"ecircumflex",
-"edieresis",
-"iacute",
-"igrave",
-"icircumflex",
-"idieresis",
-"ntilde",
-"oacute",
-"ograve",
-"ocircumflex",
-"odieresis",
-"otilde",
-"uacute",
-"ugrave",
-"ucircumflex",
-"udieresis",
-"dagger",
-"degree",
-"cent",
-"sterling",
-"section",
-"bullet",
-"paragraph",
-"germandbls",
-"registered",
-"copyright",
-"trademark",
-"acute",
-"dieresis",
-"notequal",
-"AE",
-"Oslash",
-"infinity",
-"plusminus",
-"lessequal",
-"greaterequal",
-"yen",
-"mu",
-"partialdiff",
-"summation",
-"product",
-"pi",
-"integral",
-"ordfeminine",
-"ordmasculine",
-"Omega",
-"ae",
-"oslash",
-"questiondown",
-"exclamdown",
-"logicalnot",
-"radical",
-"florin",
-"approxequal",
-"Delta",
-"guillemotleft",
-"guillemotright",
-"ellipsis",
-"nonbreakingspace",
-"Agrave",
-"Atilde",
-"Otilde",
-"OE",
-"oe",
-"endash",
-"emdash",
-"quotedblleft",
-"quotedblright",
-"quoteleft",
-"quoteright",
-"divide",
-"lozenge",
-"ydieresis",
-"Ydieresis",
-"fraction",
-"currency",
-"guilsinglleft",
-"guilsinglright",
-"fi",
-"fl",
-"daggerdbl",
-"periodcentered",
-"quotesinglbase",
-"quotedblbase",
-"perthousand",
-"Acircumflex",
-"Ecircumflex",
-"Aacute",
-"Edieresis",
-"Egrave",
-"Iacute",
-"Icircumflex",
-"Idieresis",
-"Igrave",
-"Oacute",
-"Ocircumflex",
-"apple",
-"Ograve",
-"Uacute",
-"Ucircumflex",
-"Ugrave",
-"dotlessi",
-"circumflex",
-"tilde",
-"macron",
-"breve",
-"dotaccent",
-"ring",
-"cedilla",
-"hungarumlaut",
-"ogonek",
-"caron",
-"Lslash",
-"lslash",
-"Scaron",
-"scaron",
-"Zcaron",
-"zcaron",
-"brokenbar",
-"Eth",
-"eth",
-"Yacute",
-"yacute",
-"Thorn",
-"thorn",
-"minus",
-"multiply",
-"onesuperior",
-"twosuperior",
-"threesuperior",
-"onehalf",
-"onequarter",
-"threequarters",
-"franc",
-"Gbreve",
-"gbreve",
-"Idotaccent",
-"Scedilla",
-"scedilla",
-"Cacute",
-"cacute",
-"Ccaron",
-"ccaron",
-"dcroat"
-};
-
-
-void putshort(FILE *file,int sval) {
- putc((sval>>8)&0xff,file);
- putc(sval&0xff,file);
-}
-
-void putlong(FILE *file,int val) {
- putc((val>>24)&0xff,file);
- putc((val>>16)&0xff,file);
- putc((val>>8)&0xff,file);
- putc(val&0xff,file);
-}
-#define dumpabsoffset putlong
-
-static void dumpoffset(FILE *file,int offsize,int val) {
- if ( offsize==1 )
- putc(val,file);
- else if ( offsize==2 )
- putshort(file,val);
- else if ( offsize==3 ) {
- putc((val>>16)&0xff,file);
- putc((val>>8)&0xff,file);
- putc(val&0xff,file);
- } else
- putlong(file,val);
-}
-
-void putfixed(FILE *file,real dval) {
- int val;
- int mant;
-
- val = floor(dval);
- mant = floor(65536.*(dval-val));
- val = (val<<16) | mant;
- putlong(file,val);
-}
-
-int ttfcopyfile(FILE *ttf, FILE *other, int pos, char *tab_name) {
- int ch;
- int ret = 1;
-
- if ( ferror(ttf) || ferror(other)) {
- IError("Disk error of some nature. Perhaps no space on device?\nGenerated font will be unusable" );
- } else if ( pos!=ftell(ttf)) {
- IError("File Offset wrong for ttf table (%s), %d expected %d", tab_name, ftell(ttf), pos );
- }
- rewind(other);
- while (( ch = getc(other))!=EOF )
- putc(ch,ttf);
- if ( ferror(other)) ret = 0;
- if ( fclose(other)) ret = 0;
-return( ret );
-}
-
-static void FigureFullMetricsEnd(SplineFont *sf,struct glyphinfo *gi, int istt ) {
- /* We can reduce the size of the width array by removing a run at the end */
- /* of the same width. So start at the end, find the width of the last */
- /* character we'll output, then run backwards as long as we've got the */
- /* same width */
- /* (do same thing for vertical metrics too */
- int i, lasti, lastv, lastdefault = istt ? 3 : 1;
- int width, vwidth;
-
- lasti = lastv = gi->gcnt-1;
- for ( i=gi->gcnt-1; i>lastdefault && gi->bygid[i]==-1; --i );
- if ( i>=lastdefault ) {
- width = sf->glyphs[gi->bygid[i]]->width;
- vwidth = sf->glyphs[gi->bygid[i]]->vwidth;
- lasti = lastv = i;
- for ( i=lasti-1; i>=lastdefault; --i ) {
- if ( SCWorthOutputting(sf->glyphs[gi->bygid[i]]) ) {
- if ( sf->glyphs[gi->bygid[i]]->width!=width )
- break;
- else
- lasti = i;
- }
- }
- gi->lasthwidth = lasti;
- if ( sf->hasvmetrics ) {
- for ( i=lastv-1; i>=lastdefault; --i ) {
- if ( SCWorthOutputting(sf->glyphs[gi->bygid[i]]) ) {
- if ( sf->glyphs[gi->bygid[i]]->vwidth!=vwidth )
- break;
- else
- lastv = i;
- }
- }
- gi->lastvwidth = lastv;
- }
- } else {
- gi->lasthwidth = 0;
- gi->lastvwidth = 0;
- }
-}
-
-
-#define _On_Curve 1
-#define _X_Short 2
-#define _Y_Short 4
-#define _Repeat 8
-#define _X_Same 0x10
-#define _Y_Same 0x20
-
-int RefDepth(RefChar *ref,int layer) {
- int rd, temp;
- SplineChar *sc = ref->sc;
-
- if ( sc->layers[layer].refs==NULL || sc->layers[layer].splines!=NULL )
-return( 1 );
- rd = 0;
- for ( ref = sc->layers[layer].refs; ref!=NULL; ref=ref->next ) {
- if ( ref->transform[0]>=-2 || ref->transform[0]<=1.999939 ||
- ref->transform[1]>=-2 || ref->transform[1]<=1.999939 ||
- ref->transform[2]>=-2 || ref->transform[2]<=1.999939 ||
- ref->transform[3]>=-2 || ref->transform[3]<=1.999939 ) {
- temp = RefDepth(ref,layer);
- if ( temp>rd ) rd = temp;
- }
- }
-return( rd+1 );
-}
-
-void SFDummyUpCIDs(struct glyphinfo *gi,SplineFont *sf) {
- int i,j,k,max;
- int *bygid;
-
- max = 0;
- for ( k=0; k<sf->subfontcnt; ++k )
- if ( sf->subfonts[k]->glyphcnt>max ) max = sf->subfonts[k]->glyphcnt;
- if ( max == 0 )
-return;
-
- sf->glyphs = gcalloc(max,sizeof(SplineChar *));
- sf->glyphcnt = sf->glyphmax = max;
- sf->glyphmin = 0;
- for ( k=0; k<sf->subfontcnt; ++k )
- for ( i=0; i<sf->subfonts[k]->glyphcnt; ++i ) if ( sf->subfonts[k]->glyphs[i]!=NULL )
- sf->glyphs[i] = sf->subfonts[k]->glyphs[i];
-
- if ( gi==NULL )
-return;
-
- bygid = galloc((sf->glyphcnt+3)*sizeof(int));
- memset(bygid,0xff, (sf->glyphcnt+3)*sizeof(int));
-
- j=1;
- for ( i=0; i<sf->glyphcnt; ++i ) if ( sf->glyphs[i]!=NULL ) {
- if ( bygid[0]== -1 && strcmp(sf->glyphs[i]->name,".notdef")==0 ) {
- sf->glyphs[i]->ttf_glyph = 0;
- bygid[0] = i;
- } else if ( SCWorthOutputting(sf->glyphs[i])) {
- sf->glyphs[i]->ttf_glyph = j;
- bygid[j++] = i;
- }
- }
- gi->bygid = bygid;
- gi->gcnt = j;
-}
-
-static void AssignNotdefNull(SplineFont *sf,int *bygid, int iscff) {
- int i;
-
- /* The first three glyphs are magic, glyph 0 is .notdef */
- /* glyph 1 is .null and glyph 2 is nonmarking return */
- /* We may generate them automagically */
-
- bygid[0] = bygid[1] = bygid[2] = -1;
- for ( i=0; i<sf->glyphcnt; ++i ) if ( sf->glyphs[i]!=NULL ) {
- if ( bygid[0]== -1 && strcmp(sf->glyphs[i]->name,".notdef")==0 ) {
- sf->glyphs[i]->ttf_glyph = 0;
- bygid[0] = i;
- } else if ( !iscff && bygid[1]== -1 &&
- (strcmp(sf->glyphs[i]->name,".null")==0 ||
- strcmp(sf->glyphs[i]->name,"uni0000")==0 ||
- (i==1 && strcmp(sf->glyphs[1]->name,"glyph1")==0)) ) {
- sf->glyphs[i]->ttf_glyph = 1;
- bygid[1] = i;
- } else if ( !iscff && bygid[2]== -1 &&
- (strcmp(sf->glyphs[i]->name,"nonmarkingreturn")==0 ||
- strcmp(sf->glyphs[i]->name,"uni000D")==0 ||
- (i==2 && strcmp(sf->glyphs[2]->name,"glyph2")==0)) ) {
- sf->glyphs[i]->ttf_glyph = 2;
- bygid[2] = i;
- }
- }
-}
-
-static int AssignTTFGlyph(struct glyphinfo *gi,SplineFont *sf,EncMap *map,int iscff) {
- int *bygid = galloc((sf->glyphcnt+3)*sizeof(int));
- int i,j;
-
- memset(bygid,0xff, (sf->glyphcnt+3)*sizeof(int));
-
- AssignNotdefNull(sf,bygid,iscff);
-
- j = iscff ? 1 : 3;
- for ( i=0; i<map->enccount; ++i ) if ( map->map[i]!=-1 ) {
- SplineChar *sc = sf->glyphs[map->map[i]];
- if ( SCWorthOutputting(sc) && sc->ttf_glyph==-1
-#if HANYANG
- && (!iscff || !sc->compositionunit)
-#endif
- ) {
- sc->ttf_glyph = j;
- bygid[j++] = sc->orig_pos;
- }
- }
-
- for ( i=0; i<sf->glyphcnt; ++i ) if ( sf->glyphs[i]!=NULL ) {
- SplineChar *sc = sf->glyphs[i];
- if ( SCWorthOutputting(sc) && sc->ttf_glyph==-1
-#if HANYANG
- && (!iscff || !sc->compositionunit)
-#endif
- ) {
- sc->ttf_glyph = j;
- bygid[j++] = i;
- }
- }
- gi->bygid = bygid;
- gi->gcnt = j;
-return j;
-}
-
-/* Standard names for cff */
-extern const char *cffnames[];
-extern const int nStdStrings;
-
-static int storesid(struct alltabs *at,char *str) {
- int i;
- FILE *news;
- char *pt;
- long pos;
-
- if ( str!=NULL ) { /* NULL is the magic string at end of array */
- for ( i=0; cffnames[i]!=NULL; ++i ) {
- if ( strcmp(cffnames[i],str)==0 )
-return( i );
- }
- }
-
- pos = ftell(at->sidf)+1;
- if ( pos>=65536 && !at->sidlongoffset ) {
- at->sidlongoffset = true;
- news = tmpfile();
- rewind(at->sidh);
- for ( i=0; i<at->sidcnt; ++i )
- putlong(news,getushort(at->sidh));
- fclose(at->sidh);
- at->sidh = news;
- }
- if ( at->sidlongoffset )
- putlong(at->sidh,pos);
- else
- putshort(at->sidh,pos);
-
- if ( str!=NULL ) {
- for ( pt=str; *pt; ++pt )
- putc(*pt,at->sidf);
- }
-return( at->sidcnt++ + nStdStrings );
-}
-
-static void dumpint(FILE *cfff,int num) {
-
- if ( num>=-107 && num<=107 )
- putc(num+139,cfff);
- else if ( num>=108 && num<=1131 ) {
- num -= 108;
- putc((num>>8)+247,cfff);
- putc(num&0xff,cfff);
- } else if ( num>=-1131 && num<=-108 ) {
- num = -num;
- num -= 108;
- putc((num>>8)+251,cfff);
- putc(num&0xff,cfff);
- } else if ( num>=-32768 && num<32768 ) {
- putc(28,cfff);
- putc(num>>8,cfff);
- putc(num&0xff,cfff);
- } else { /* In dict data we have 4 byte ints, in type2 strings we don't */
- putc(29,cfff);
- putc((num>>24)&0xff,cfff);
- putc((num>>16)&0xff,cfff);
- putc((num>>8)&0xff,cfff);
- putc(num&0xff,cfff);
- }
-}
-
-static void dumpdbl(FILE *cfff,double d) {
- if ( d-rint(d)>-.00001 && d-rint(d)<.00001 )
- dumpint(cfff,(int) d);
- else {
- /* The type2 strings have a fixed format, but the dict data does not */
- char buffer[20], *pt;
- int sofar,n,odd;
- sprintf( buffer, "%g", d);
- sofar = 0; odd=true;
- putc(30,cfff); /* Start a double */
- for ( pt=buffer; *pt; ++pt ) {
- if ( isdigit(*pt) )
- n = *pt-'0';
- else if ( *pt=='.' )
- n = 0xa;
- else if ( *pt=='-' )
- n = 0xe;
- else if (( *pt=='E' || *pt=='e') && pt[1]=='-' ) {
- n = 0xc;
- ++pt;
- } else if ( *pt=='E' || *pt=='e')
- n = 0xb;
- else
- n = 0; /* Should never happen */
- if ( odd ) {
- sofar = n<<4;
- odd = false;
- } else {
- putc(sofar|n,cfff);
- sofar=0;
- odd = true;
- }
- }
- if ( sofar==0 )
- putc(0xff,cfff);
- else
- putc(sofar|0xf,cfff);
- }
-}
-
-static void dumpoper(FILE *cfff,int oper ) {
- if ( oper!=-1 ) {
- if ( oper>=256 )
- putc(oper>>8,cfff);
- putc(oper&0xff,cfff);
- }
-}
-
-static void dumpdbloper(FILE *cfff,double d, int oper ) {
- dumpdbl(cfff,d);
- dumpoper(cfff,oper);
-}
-
-static void dumpintoper(FILE *cfff,int v, int oper ) {
- dumpint(cfff,v);
- dumpoper(cfff,oper);
-}
-
-static void dumpsizedint(FILE *cfff,int big,int num, int oper ) {
- if ( big ) {
- putc(29,cfff);
- putc((num>>24)&0xff,cfff);
- putc((num>>16)&0xff,cfff);
- putc((num>>8)&0xff,cfff);
- putc(num&0xff,cfff);
- } else {
- putc(28,cfff);
- putc(num>>8,cfff);
- putc(num&0xff,cfff);
- }
- dumpoper(cfff,oper);
-}
-
-static void dumpsid(FILE *cfff,struct alltabs *at,char *str,int oper) {
- if ( str==NULL )
-return;
- dumpint(cfff,storesid(at,str));
- dumpoper(cfff,oper);
-}
-
-static void DumpStrDouble(char *pt,FILE *cfff,int oper) {
- real d;
- if ( *pt=='[' ) ++pt; /* For StdHW, StdVW */
- d = strtod(pt,NULL);
- dumpdbloper(cfff,d,oper);
-}
-
-static void DumpDblArray(real *arr,int n,FILE *cfff, int oper) {
- int mi,i;
-
- for ( mi=n-1; mi>=0 && arr[mi]==0; --mi );
- if ( mi<0 )
-return;
- dumpdbl(cfff,arr[0]);
- for ( i=1; i<=mi; ++i )
- dumpdbl(cfff,arr[i]-arr[i-1]);
- dumpoper(cfff,oper);
-}
-
-static void DumpStrArray(char *pt,FILE *cfff,int oper) {
- real d, last=0;
- char *end;
-
- while ( *pt==' ' ) ++pt;
- if ( *pt=='\0' )
-return;
- if ( *pt=='[' ) ++pt;
- while ( *pt==' ' ) ++pt;
- while ( *pt!=']' && *pt!='\0' ) {
- d = strtod(pt,&end);
- if ( pt==end ) /* User screwed up. Should be a number */
- break;
- dumpdbl(cfff,d-last);
- last = d;
- pt = end;
- while ( *pt==' ' ) ++pt;
- }
- dumpoper(cfff,oper);
-}
-
-static void dumpcffheader(SplineFont *sf,FILE *cfff) {
- putc('\1',cfff); /* Major version: 1 */
- putc('\0',cfff); /* Minor version: 0 */
- putc('\4',cfff); /* Header size in bytes */
- putc('\4',cfff); /* Absolute Offset size. */
- /* I don't think there are any absolute offsets that aren't encoded */
- /* in a dict as numbers (ie. inherently variable sized items) */
-}
-
-static void dumpcffnames(SplineFont *sf,FILE *cfff) {
- char *pt;
-
- putshort(cfff,1); /* One font name */
- putc('\1',cfff); /* Offset size */
- putc('\1',cfff); /* Offset to first name */
- putc('\1'+strlen(sf->fontname),cfff);
- for ( pt=sf->fontname; *pt; ++pt )
- putc(*pt,cfff);
-}
-
-static void dumpcffcharset(SplineFont *sf,struct alltabs *at) {
- int i;
-
- at->gn_sid = gcalloc(at->gi.gcnt,sizeof(uint32));
- putc(0,at->charset);
- /* I always use a format 0 charset. ie. an array of SIDs in random order */
-
- /* First element must be ".notdef" and is omitted */
-
- for ( i=1; i<at->gi.gcnt; ++i )
- if ( at->gi.bygid[i]!=-1 && SCWorthOutputting(sf->glyphs[at->gi.bygid[i]])) {
- at->gn_sid[i] = storesid(at,sf->glyphs[at->gi.bygid[i]]->name);
- putshort(at->charset,at->gn_sid[i]);
- }
-}
-
-static void dumpcffcidset(SplineFont *sf,struct alltabs *at) {
- int gid, start;
-
- putc(2,at->charset);
-
- start = -1; /* Glyph 0 always maps to CID 0, and is omitted */
- for ( gid = 1; gid<at->gi.gcnt; ++gid ) {
- if ( start==-1 )
- start = gid;
- else if ( at->gi.bygid[gid]-at->gi.bygid[start]!=gid-start ) {
- putshort(at->charset,at->gi.bygid[start]);
- putshort(at->charset,at->gi.bygid[gid-1]-at->gi.bygid[start]);
- start = gid;
- }
- }
- if ( start!=-1 ) {
- putshort(at->charset,at->gi.bygid[start]);
- putshort(at->charset,at->gi.bygid[gid-1]-at->gi.bygid[start]);
- }
-}
-
-static void dumpcfffdselect(SplineFont *sf,struct alltabs *at) {
- int cid, k, lastfd, cnt;
- int gid;
-
- putc(3,at->fdselect);
- putshort(at->fdselect,0); /* number of ranges, fill in later */
-
- for ( k=0; k<sf->subfontcnt; ++k )
- if ( SCWorthOutputting(sf->subfonts[k]->glyphs[0]))
- break;
- if ( k==sf->subfontcnt ) --k; /* If CID 0 not defined, put it in last font */
- putshort(at->fdselect,0);
- putc(k,at->fdselect);
- lastfd = k;
- cnt = 1;
- for ( gid = 1; gid<at->gi.gcnt; ++gid ) {
- cid = at->gi.bygid[gid];
- for ( k=0; k<sf->subfontcnt; ++k ) {
- if ( cid<sf->subfonts[k]->glyphcnt &&
- SCWorthOutputting(sf->subfonts[k]->glyphs[cid]) )
- break;
- }
- if ( k==sf->subfontcnt )
- /* Doesn't map to a glyph, irrelevant */;
- else {
- if ( k!=lastfd ) {
- putshort(at->fdselect,gid);
- putc(k,at->fdselect);
- lastfd = k;
- ++cnt;
- }
- }
- }
- putshort(at->fdselect,gid);
- fseek(at->fdselect,1,SEEK_SET);
- putshort(at->fdselect,cnt);
- fseek(at->fdselect,0,SEEK_END);
-}
-
-static void dumpcffencoding(SplineFont *sf,struct alltabs *at) {
- int i, cnt, anydups;
- uint32 start_pos = ftell(at->encoding);
- SplineChar *sc;
- EncMap *map = at->map;
-
- putc(0,at->encoding);
- /* I always use a format 0 encoding. ie. an array of glyph indexes */
- putc(0xff,at->encoding); /* fixup later */
-
- for ( i=0; i<sf->glyphcnt; ++i ) if ( sf->glyphs[i]!=NULL )
- sf->glyphs[i]->ticked = false;
-
- cnt = 0;
- anydups = 0;
- for ( i=0; i<256 && i<map->enccount; ++i ) if ( map->map[i]!=-1 && (sc=sf->glyphs[map->map[i]])!=NULL ) {
- if ( sc->ttf_glyph>255 )
- continue;
- if ( sc->ticked ) {
- ++anydups;
- } else if ( sc->ttf_glyph>0 ) {
- if ( cnt>=255 )
- break;
- putc(i,at->encoding);
- ++cnt;
- sc->ticked = true;
- }
- }
- if ( anydups ) {
- fseek(at->encoding,start_pos,SEEK_SET);
- putc(0x80,at->encoding);
- putc(cnt,at->encoding);
- fseek(at->encoding,0,SEEK_END);
- putc(anydups,at->encoding);
-
- for ( i=0; i<sf->glyphcnt; ++i ) if ( sf->glyphs[i]!=NULL )
- sf->glyphs[i]->ticked = false;
- for ( i=0; i<256 && i<map->enccount; ++i ) if ( map->map[i]!=-1 && (sc=sf->glyphs[map->map[i]])!=NULL ) {
- if ( sc->ttf_glyph>255 )
- continue;
- if ( sc->ticked ) {
- putc(i,at->encoding);
- putshort(at->encoding,at->gn_sid[sc->ttf_glyph]);
- }
- sc->ticked = true;
- }
- } else {
- fseek(at->encoding,start_pos+1,SEEK_SET);
- putc(cnt,at->encoding);
- fseek(at->encoding,0,SEEK_END);
- }
- free( at->gn_sid );
- at->gn_sid = NULL;
-}
-
-static void _dumpcffstrings(FILE *file, struct pschars *strs) {
- int i, len, offsize;
-
- /* First figure out the offset size */
- len = 1;
- for ( i=0; i<strs->next; ++i )
- len += strs->lens[i];
-
- /* Then output the index size and offsets */
- putshort( file, strs->next );
- if ( strs->next!=0 ) {
- /* presumably offsets are unsigned. But the docs don't state this in the obvious place */
- offsize = len<=255?1:len<=65535?2:len<=0xffffff?3:4;
- putc(offsize,file);
- len = 1;
- for ( i=0; i<strs->next; ++i ) {
- dumpoffset(file,offsize,len);
- len += strs->lens[i];
- }
- dumpoffset(file,offsize,len);
-
- /* last of all the strings */
- for ( i=0; i<strs->next; ++i ) {
- uint8 *pt = strs->values[i], *end = pt+strs->lens[i];
- while ( pt<end )
- putc( *pt++, file );
- }
- }
-}
-
-static FILE *dumpcffstrings(struct pschars *strs) {
- FILE *file = tmpfile();
- _dumpcffstrings(file,strs);
- PSCharsFree(strs);
-return( file );
-}
-
-int SFFigureDefWidth(SplineFont *sf, int *_nomwid) {
- uint16 *widths; uint32 *cumwid;
- int nomwid, defwid, i, sameval=(int) 0x80000000, maxw=0, allsame=true;
- int cnt,j;
-
- for ( i=0; i<sf->glyphcnt; ++i )
- if ( SCWorthOutputting(sf->glyphs[i]) ) {
- if ( maxw<sf->glyphs[i]->width ) maxw = sf->glyphs[i]->width;
- if ( sameval == 0x8000000 )
- sameval = sf->glyphs[i]->width;
- else if ( sameval!=sf->glyphs[i]->width )
- allsame = false;
- }
- if ( allsame ) {
- nomwid = defwid = sameval;
- } else {
- ++maxw;
- if ( maxw>65535 ) maxw = 3*(sf->ascent+sf->descent);
- widths = gcalloc(maxw,sizeof(uint16));
- cumwid = gcalloc(maxw,sizeof(uint32));
- defwid = 0; cnt=0;
- for ( i=0; i<sf->glyphcnt; ++i )
- if ( SCWorthOutputting(sf->glyphs[i]) &&
- sf->glyphs[i]->width>=0 &&
- sf->glyphs[i]->width<maxw )
- if ( ++widths[sf->glyphs[i]->width] > cnt ) {
- defwid = sf->glyphs[i]->width;
- cnt = widths[defwid];
- }
- widths[defwid] = 0;
- for ( i=0; i<maxw; ++i )
- for ( j=-107; j<=107; ++j )
- if ( i+j>=0 && i+j<maxw )
- cumwid[i] += widths[i+j];
- cnt = 0; nomwid = 0;
- for ( i=0; i<maxw; ++i )
- if ( cnt<cumwid[i] ) {
- cnt = cumwid[i];
- nomwid = i;
- }
- free(widths); free(cumwid);
- }
- if ( _nomwid!=NULL )
- *_nomwid = nomwid;
-return( defwid );
-}
-
-static void ATFigureDefWidth(SplineFont *sf, struct alltabs *at, int subfont) {
- int nomwid, defwid;
-
- defwid = SFFigureDefWidth(sf,&nomwid);
- if ( subfont==-1 )
- at->defwid = defwid;
- else
- at->fds[subfont].defwid = defwid;
- if ( subfont==-1 )
- at->nomwid = nomwid;
- else
- at->fds[subfont].nomwid = nomwid;
-}
-
-static void dumpcffprivate(SplineFont *sf,struct alltabs *at,int subfont,
- int subrcnt) {
- char *pt;
- FILE *private = subfont==-1?at->private:at->fds[subfont].private;
- int mi,i;
- real bluevalues[14], otherblues[10];
- real snapcnt[12];
- real stemsnaph[12], stemsnapv[12];
- real stdhw[1], stdvw[1];
- int hasblue=0, hash=0, hasv=0, bs;
- int nomwid, defwid;
- EncMap *map = at->map;
- double bluescale;
-
- /* The private dict is not in an index, so no index header. Just the data */
-
- if ( subfont==-1 )
- defwid = at->defwid;
- else
- defwid = at->fds[subfont].defwid;
- dumpintoper(private,defwid,20); /* Default Width */
- if ( subfont==-1 )
- nomwid = at->nomwid;
- else
- nomwid = at->fds[subfont].nomwid;
- dumpintoper(private,nomwid,21); /* Nominative Width */
-
- bs = SplineFontIsFlexible(sf,at->gi.layer,at->gi.flags);
- hasblue = PSDictHasEntry(sf->private,"BlueValues")!=NULL;
- hash = PSDictHasEntry(sf->private,"StdHW")!=NULL;
- hasv = PSDictHasEntry(sf->private,"StdVW")!=NULL;
- ff_progress_change_stages(2+autohint_before_generate+!hasblue);
-
- otherblues[0] = otherblues[1] = bluevalues[0] = bluevalues[1] = 0;
- if ( !hasblue ) {
- FindBlues(sf,at->gi.layer,bluevalues,otherblues);
- ff_progress_next_stage();
- }
-
- stdhw[0] = stdvw[0] = 0;
- if ( !hash ) {
- FindHStems(sf,stemsnaph,snapcnt);
- mi = -1;
- for ( i=0; stemsnaph[i]!=0 && i<12; ++i )
- if ( mi==-1 ) mi = i;
- else if ( snapcnt[i]>snapcnt[mi] ) mi = i;
- if ( mi!=-1 ) stdhw[0] = stemsnaph[mi];
- }
-
- if ( !hasv ) {
- FindVStems(sf,stemsnapv,snapcnt);
- mi = -1;
- for ( i=0; stemsnapv[i]!=0 && i<12; ++i )
- if ( mi==-1 ) mi = i;
- else if ( snapcnt[i]>snapcnt[mi] ) mi = i;
- if ( mi!=-1 ) stdvw[0] = stemsnapv[mi];
- }
- ff_progress_change_line1(_("Saving OpenType Font"));
-
- if ( hasblue )
- DumpStrArray(PSDictHasEntry(sf->private,"BlueValues"),private,6);
- else
- DumpDblArray(bluevalues,sizeof(bluevalues)/sizeof(bluevalues[0]),private,6);
- if ( (pt=PSDictHasEntry(sf->private,"OtherBlues"))!=NULL )
- DumpStrArray(pt,private,7);
- else if ( !hasblue )
- DumpDblArray(otherblues,sizeof(otherblues)/sizeof(otherblues[0]),private,7);
- if ( (pt=PSDictHasEntry(sf->private,"FamilyBlues"))!=NULL )
- DumpStrArray(pt,private,8);
- bluescale = BlueScaleFigure(sf->private,bluevalues,otherblues);
- if ( (pt=PSDictHasEntry(sf->private,"FamilyOtherBlues"))!=NULL )
- DumpStrArray(pt,private,9);
- if ( (pt=PSDictHasEntry(sf->private,"BlueScale"))!=NULL )
- DumpStrDouble(pt,private,(12<<8)+9);
- else if ( bluescale!=-1 )
- dumpdbloper(private,bluescale,(12<<8)+9);
- if ( (pt=PSDictHasEntry(sf->private,"BlueShift"))!=NULL )
- DumpStrDouble(pt,private,(12<<8)+10);
- else
- dumpintoper(private,bs,(12<<8)+10);
- if ( (pt=PSDictHasEntry(sf->private,"BlueFuzz"))!=NULL )
- DumpStrDouble(pt,private,(12<<8)+11);
- if ( hash ) {
- DumpStrDouble(PSDictHasEntry(sf->private,"StdHW"),private,10);
- if ( (pt=PSDictHasEntry(sf->private,"StemSnapH"))!=NULL )
- DumpStrArray(pt,private,(12<<8)|12);
- } else {
- if ( stdhw[0]!=0 )
- dumpdbloper(private,stdhw[0],10);
- DumpDblArray(stemsnaph,sizeof(stemsnaph)/sizeof(stemsnaph[0]),private,(12<<8)|12);
- }
- if ( hasv ) {
- DumpStrDouble(PSDictHasEntry(sf->private,"StdVW"),private,11);
- if ( (pt=PSDictHasEntry(sf->private,"StemSnapV"))!=NULL )
- DumpStrArray(pt,private,(12<<8)|13);
- } else {
- if ( stdvw[0]!=0 )
- dumpdbloper(private,stdvw[0],11);
- DumpDblArray(stemsnapv,sizeof(stemsnapv)/sizeof(stemsnapv[0]),private,(12<<8)|13);
- }
- if ( (pt=PSDictHasEntry(sf->private,"ForceBold"))!=NULL ) {
- dumpintoper(private,*pt=='t'||*pt=='T',(12<<8)|14);
- } else if ( sf->weight!=NULL &&
- (strstrmatch(sf->weight,"Bold")!=NULL ||
- strstrmatch(sf->weight,"Demi")!=NULL ||
- strstrmatch(sf->weight,"Fett")!=NULL ||
- strstrmatch(sf->weight,"Gras")!=NULL ||
- strstrmatch(sf->weight,"Heavy")!=NULL ||
- strstrmatch(sf->weight,"Black")!=NULL))
- dumpintoper(private,1,(12<<8)|14);
- if ( (pt=PSDictHasEntry(sf->private,"LanguageGroup"))!=NULL )
- DumpStrDouble(pt,private,(12<<8)+17);
- else if ( map->enc->is_japanese ||
- map->enc->is_korean ||
- map->enc->is_tradchinese ||
- map->enc->is_simplechinese )
- dumpintoper(private,1,(12<<8)|17);
- if ( (pt=PSDictHasEntry(sf->private,"ExpansionFactor"))!=NULL )
- DumpStrDouble(pt,private,(12<<8)+18);
- if ( subrcnt!=0 )
- dumpsizedint(private,false,ftell(private)+3+1,19); /* Subrs */
-
- if ( subfont==-1 )
- at->privatelen = ftell(private);
- else
- at->fds[subfont].privatelen = ftell(private);
-}
-
-/* When we exit this the topdict is not complete, we still need to fill in */
-/* values for charset,encoding,charstrings and private. Then we need to go */
-/* back and fill in the table length (at lenpos) */
-static void dumpcfftopdict(SplineFont *sf,struct alltabs *at) {
- char *pt, *end;
- FILE *cfff = at->cfff;
- DBounds b;
-
- putshort(cfff,1); /* One top dict */
- putc('\2',cfff); /* Offset size */
- putshort(cfff,1); /* Offset to topdict */
- at->lenpos = ftell(cfff);
- putshort(cfff,0); /* placeholder for final position (final offset in index points beyond last element) */
- dumpsid(cfff,at,sf->version,0);
- dumpsid(cfff,at,sf->copyright,1);
- dumpsid(cfff,at,sf->fullname?sf->fullname:sf->fontname,2);
- dumpsid(cfff,at,sf->familyname,3);
- dumpsid(cfff,at,sf->weight,4);
- if ( at->gi.fixed_width!=-1 ) dumpintoper(cfff,1,(12<<8)|1);
- if ( sf->italicangle!=0 ) dumpdbloper(cfff,sf->italicangle,(12<<8)|2);
- if ( sf->upos!=-100 ) dumpdbloper(cfff,sf->upos,(12<<8)|3);
- if ( sf->uwidth!=50 ) dumpdbloper(cfff,sf->uwidth,(12<<8)|4);
- if ( sf->strokedfont ) {
- dumpintoper(cfff,2,(12<<8)|5);
- dumpdbloper(cfff,sf->strokewidth,(12<<8)|8);
- }
- /* We'll never set CharstringType */
- if ( sf->ascent+sf->descent!=1000 ) {
- dumpdbl(cfff,1.0/(sf->ascent+sf->descent));
- dumpint(cfff,0);
- dumpint(cfff,0);
- dumpdbl(cfff,1.0/(sf->ascent+sf->descent));
- dumpint(cfff,0);
- dumpintoper(cfff,0,(12<<8)|7);
- }
- if ( sf->uniqueid!=-1 && sf->use_uniqueid )
- dumpintoper(cfff, sf->uniqueid?sf->uniqueid:4000000 + (rand()&0x3ffff), 13 );
- SplineFontLayerFindBounds(sf,at->gi.layer,&b);
- at->gi.xmin = b.minx;
- at->gi.ymin = b.miny;
- at->gi.xmax = b.maxx;
- at->gi.ymax = b.maxy;
- dumpdbl(cfff,floor(b.minx));
- dumpdbl(cfff,floor(b.miny));
- dumpdbl(cfff,ceil(b.maxx));
- dumpdbloper(cfff,ceil(b.maxy),5);
- /* We'll never set StrokeWidth */
- if ( sf->xuid!=NULL && sf->use_xuid ) {
- pt = sf->xuid; if ( *pt=='[' ) ++pt;
- while ( *pt && *pt!=']' ) {
- dumpint(cfff,strtol(pt,&end,10));
- if ( pt==end ) /* garbage in XUID */
- break;
- for ( pt = end; *pt==' '; ++pt );
- }
- putc(14,cfff);
- if ( sf->changed_since_xuidchanged )
- SFIncrementXUID(sf);
- }
- /* Offset to charset (oper=15) needed here */
- /* Offset to encoding (oper=16) needed here (not for CID )*/
- /* Offset to charstrings (oper=17) needed here */
- /* Length of, and Offset to private (oper=18) needed here (not for CID )*/
-}
-
-static int dumpcffdict(SplineFont *sf,struct alltabs *at) {
- FILE *fdarray = at->fdarray;
- int pstart;
- /* according to the PSRef Man v3, only fontname, fontmatrix and private */
- /* appear in this dictionary */
-
- dumpsid(fdarray,at,sf->fontname,(12<<8)|38);
- if ( sf->ascent+sf->descent!=1000 ) {
- dumpdbl(fdarray,1.0/(sf->ascent+sf->descent));
- dumpint(fdarray,0);
- dumpint(fdarray,0);
- dumpdbl(fdarray,1.0/(sf->ascent+sf->descent));
- dumpint(fdarray,0);
- dumpintoper(fdarray,0,(12<<8)|7);
- }
- pstart = ftell(fdarray);
- dumpsizedint(fdarray,false,0,-1); /* private length */
- dumpsizedint(fdarray,true,0,18); /* private offset */
-return( pstart );
-}
-
-static void dumpcffdictindex(SplineFont *sf,struct alltabs *at) {
- int i;
- int pos;
-
- putshort(at->fdarray,sf->subfontcnt);
- putc('\2',at->fdarray); /* DICTs aren't very big, and there are at most 255 */
- putshort(at->fdarray,1); /* Offset to first dict */
- for ( i=0; i<sf->subfontcnt; ++i )
- putshort(at->fdarray,0); /* Dump offset placeholders (note there's one extra to mark the end) */
- pos = ftell(at->fdarray)-1;
- for ( i=0; i<sf->subfontcnt; ++i ) {
- at->fds[i].fillindictmark = dumpcffdict(sf->subfonts[i],at);
- at->fds[i].eodictmark = ftell(at->fdarray);
- if ( at->fds[i].eodictmark>65536 )
- IError("The DICT INDEX got too big, result won't work");
- }
- fseek(at->fdarray,2*sizeof(short)+sizeof(char),SEEK_SET);
- for ( i=0; i<sf->subfontcnt; ++i )
- putshort(at->fdarray,at->fds[i].eodictmark-pos);
- fseek(at->fdarray,0,SEEK_END);
-}
-
-static void dumpcffcidtopdict(SplineFont *sf,struct alltabs *at) {
- char *pt, *end;
- FILE *cfff = at->cfff;
- DBounds b;
- int cidcnt=0, k;
-
- for ( k=0; k<sf->subfontcnt; ++k )
- if ( sf->subfonts[k]->glyphcnt>cidcnt ) cidcnt = sf->subfonts[k]->glyphcnt;
-
- putshort(cfff,1); /* One top dict */
- putc('\2',cfff); /* Offset size */
- putshort(cfff,1); /* Offset to topdict */
- at->lenpos = ftell(cfff);
- putshort(cfff,0); /* placeholder for final position */
- dumpsid(cfff,at,sf->cidregistry,-1);
- dumpsid(cfff,at,sf->ordering,-1);
- dumpintoper(cfff,sf->supplement,(12<<8)|30); /* ROS operator must be first */
- dumpdbloper(cfff,sf->cidversion,(12<<8)|31);
- dumpintoper(cfff,cidcnt,(12<<8)|34);
- if ( sf->use_uniqueid )
- dumpintoper(cfff, sf->uniqueid?sf->uniqueid:4000000 + (rand()&0x3ffff), (12<<8)|35 );
-
- dumpsid(cfff,at,sf->copyright,1);
- dumpsid(cfff,at,sf->fullname?sf->fullname:sf->fontname,2);
- dumpsid(cfff,at,sf->familyname,3);
- dumpsid(cfff,at,sf->weight,4);
- /* FontMatrix (identity here, real ones in sub fonts)*/
- /* Actually there is no fontmatrix in the adobe cid font I'm looking at */
- /* which means it should default to [.001...] but it doesn't so the */
- /* docs aren't completely accurate */
- /* I now see I've no idea what the FontMatrix means in a CID keyed font */
- /* it seems to be ignored everywhere */
-#if 0
- dumpdbl(cfff,1.0);
- dumpint(cfff,0);
- dumpint(cfff,0);
- dumpdbl(cfff,1.0);
- dumpint(cfff,0);
- dumpintoper(cfff,0,(12<<8)|7);
-#endif
-
- CIDLayerFindBounds(sf,at->gi.layer,&b);
- at->gi.xmin = b.minx;
- at->gi.ymin = b.miny;
- at->gi.xmax = b.maxx;
- at->gi.ymax = b.maxy;
- dumpdbl(cfff,floor(b.minx));
- dumpdbl(cfff,floor(b.miny));
- dumpdbl(cfff,ceil(b.maxx));
- dumpdbloper(cfff,ceil(b.maxy),5);
- /* We'll never set StrokeWidth */
- if ( sf->xuid!=NULL && sf->use_xuid ) {
- pt = sf->xuid; if ( *pt=='[' ) ++pt;
- while ( *pt && *pt!=']' ) {
- dumpint(cfff,strtol(pt,&end,10));
- for ( pt = end; *pt==' '; ++pt );
- }
- putc(14,cfff);
- if ( sf->changed_since_xuidchanged )
- SFIncrementXUID(sf);
- }
-#if 0
- /* Acrobat doesn't seem to care about a private dict here. Ghostscript */
- /* dies. Tech Note: 5176.CFF.PDF, top of page 23 says: */
- /* A Private DICT is required, but may be specified as having */
- /* a length of 0 if there are no non-default values to be stored*/
- /* No indication >where< it is required. I assumed everywhere. Perhaps */
- /* just in basefonts? */
- dumpint(cfff,0); /* Docs say a private dict is required and they don't specifically omit CID top dicts */
- dumpintoper(cfff,0,18); /* But they do say it can be zero */
-#endif
- /* Offset to charset (oper=15) needed here */
- /* Offset to charstrings (oper=17) needed here */
- /* Offset to FDArray (oper=12,36) needed here */
- /* Offset to FDSelect (oper=12,37) needed here */
-}
-
-static int isStdEncoding(SplineFont *sf,EncMap *map) {
- int i;
-
- for ( i=0; i<256 && i<map->enccount; ++i ) if ( map->map[i]!=-1 && sf->glyphs[map->map[i]]!=NULL )
- if ( sf->glyphs[map->map[i]]->unicodeenc!=-1 )
- if ( sf->glyphs[map->map[i]]->unicodeenc!=unicode_from_adobestd[i] )
-return( 0 );
-
-return( 1 );
-}
-
-static void finishup(SplineFont *sf,struct alltabs *at) {
- int strlen, shlen, glen,enclen,csetlen,cstrlen,prvlen;
- int base, eotop, strhead;
- int output_enc = ( at->format==ff_cff && !isStdEncoding(sf,at->map));
-
- storesid(at,NULL); /* end the strings index */
- strlen = ftell(at->sidf) + (shlen = ftell(at->sidh));
- glen = sizeof(short); /* Single entry: 0, no globals */
- enclen = ftell(at->encoding);
- csetlen = ftell(at->charset);
- cstrlen = ftell(at->charstrings);
- prvlen = ftell(at->private);
- base = ftell(at->cfff);
- if ( base+6*3+strlen+glen+enclen+csetlen+cstrlen+prvlen > 32767 ) {
- at->cfflongoffset = true;
- base += 5*5+4;
- } else
- base += 5*3+4;
- strhead = 2+(at->sidcnt>1);
- base += strhead;
-
- dumpsizedint(at->cfff,at->cfflongoffset,base+strlen+glen,15); /* Charset */
- if ( output_enc ) /* encoding offset */
- dumpsizedint(at->cfff,at->cfflongoffset,base+strlen+glen+csetlen,16); /* encoding offset */
- else {
- dumpsizedint(at->cfff,at->cfflongoffset,0,16);
- enclen = 0;
- }
- dumpsizedint(at->cfff,at->cfflongoffset,base+strlen+glen+csetlen+enclen,17);/* charstrings */
- dumpsizedint(at->cfff,at->cfflongoffset,at->privatelen,-1);
- dumpsizedint(at->cfff,at->cfflongoffset,base+strlen+glen+csetlen+enclen+cstrlen,18); /* private size */
- eotop = base-strhead-at->lenpos-1;
- if ( at->cfflongoffset ) {
- fseek(at->cfff,3,SEEK_SET);
- putc(4,at->cfff);
- }
- fseek(at->cfff,at->lenpos,SEEK_SET);
- putshort(at->cfff,eotop);
- fseek(at->cfff,0,SEEK_END);
-
- /* String Index */
- putshort(at->cfff,at->sidcnt-1);
- if ( at->sidcnt!=1 ) { /* Everybody gets an added NULL */
- putc(at->sidlongoffset?4:2,at->cfff);
- if ( !ttfcopyfile(at->cfff,at->sidh,base,"CFF-StringBase")) at->error = true;
- if ( !ttfcopyfile(at->cfff,at->sidf,base+shlen,"CFF-StringData")) at->error = true;
- }
-
- /* Global Subrs */
- putshort(at->cfff,0);
-
- /* Charset */
- if ( !ttfcopyfile(at->cfff,at->charset,base+strlen+glen,"CFF-Charset")) at->error = true;
-
- /* Encoding */
- if ( !ttfcopyfile(at->cfff,at->encoding,base+strlen+glen+csetlen,"CFF-Encoding")) at->error = true;
-
- /* Char Strings */
- if ( !ttfcopyfile(at->cfff,at->charstrings,base+strlen+glen+csetlen+enclen,"CFF-CharStrings")) at->error = true;
-
- /* Private & Subrs */
- if ( !ttfcopyfile(at->cfff,at->private,base+strlen+glen+csetlen+enclen+cstrlen,"CFF-Private")) at->error = true;
-}
-
-static void finishupcid(SplineFont *sf,struct alltabs *at) {
- int strlen, shlen, glen,csetlen,cstrlen,fdsellen,fdarrlen,prvlen;
- int base, eotop, strhead;
- int i;
-
- storesid(at,NULL); /* end the strings index */
- strlen = ftell(at->sidf) + (shlen = ftell(at->sidh));
- glen = ftell(at->globalsubrs);
- /* No encodings */
- csetlen = ftell(at->charset);
- fdsellen = ftell(at->fdselect);
- cstrlen = ftell(at->charstrings);
- fdarrlen = ftell(at->fdarray);
- base = ftell(at->cfff);
-
- at->cfflongoffset = true;
- base += 5*4+4+2; /* two of the opers below are two byte opers */
- strhead = 2+(at->sidcnt>1);
- base += strhead;
-
- prvlen = 0;
- for ( i=0; i<sf->subfontcnt; ++i ) {
- fseek(at->fdarray,at->fds[i].fillindictmark,SEEK_SET);
- dumpsizedint(at->fdarray,false,at->fds[i].privatelen,-1); /* Private len */
- dumpsizedint(at->fdarray,true,base+strlen+glen+csetlen+fdsellen+cstrlen+fdarrlen+prvlen,18); /* Private offset */
- prvlen += ftell(at->fds[i].private); /* private & subrs */
- }
-
- dumpsizedint(at->cfff,at->cfflongoffset,base+strlen+glen,15); /* charset */
- dumpsizedint(at->cfff,at->cfflongoffset,base+strlen+glen+csetlen,(12<<8)|37); /* fdselect */
- dumpsizedint(at->cfff,at->cfflongoffset,base+strlen+glen+csetlen+fdsellen,17); /* charstrings */
- dumpsizedint(at->cfff,at->cfflongoffset,base+strlen+glen+csetlen+fdsellen+cstrlen,(12<<8)|36); /* fdarray */
- eotop = base-strhead-at->lenpos-1;
- fseek(at->cfff,at->lenpos,SEEK_SET);
- putshort(at->cfff,eotop);
- fseek(at->cfff,0,SEEK_END);
-
- /* String Index */
- putshort(at->cfff,at->sidcnt-1);
- if ( at->sidcnt!=1 ) { /* Everybody gets an added NULL */
- putc(at->sidlongoffset?4:2,at->cfff);
- if ( !ttfcopyfile(at->cfff,at->sidh,base,"CFF-StringBase")) at->error = true;
- if ( !ttfcopyfile(at->cfff,at->sidf,base+shlen,"CFF-StringData")) at->error = true;
- }
-
- /* Global Subrs */
- if ( !ttfcopyfile(at->cfff,at->globalsubrs,base+strlen,"CFF-GlobalSubrs")) at->error = true;
-
- /* Charset */
- if ( !ttfcopyfile(at->cfff,at->charset,base+strlen+glen,"CFF-Charset")) at->error = true;
-
- /* FDSelect */
- if ( !ttfcopyfile(at->cfff,at->fdselect,base+strlen+glen+csetlen,"CFF-FDSelect")) at->error = true;
-
- /* Char Strings */
- if ( !ttfcopyfile(at->cfff,at->charstrings,base+strlen+glen+csetlen+fdsellen,"CFF-CharStrings")) at->error = true;
-
- /* FDArray (DICT Index) */
- if ( !ttfcopyfile(at->cfff,at->fdarray,base+strlen+glen+csetlen+fdsellen+cstrlen,"CFF-FDArray")) at->error = true;
-
- /* Private & Subrs */
- prvlen = 0;
- for ( i=0; i<sf->subfontcnt; ++i ) {
- int temp = ftell(at->fds[i].private);
- if ( !ttfcopyfile(at->cfff,at->fds[i].private,
- base+strlen+glen+csetlen+fdsellen+cstrlen+fdarrlen+prvlen,"CFF-PrivateSubrs")) at->error = true;
- prvlen += temp;
- }
-
- free(at->fds);
-}
-
-static int dumpcffhmtx(struct alltabs *at,SplineFont *sf,int bitmaps) {
- DBounds b;
- SplineChar *sc;
- int i,cnt;
- int dovmetrics = sf->hasvmetrics;
- int width = at->gi.fixed_width;
-
- at->gi.hmtx = tmpfile();
- if ( dovmetrics )
- at->gi.vmtx = tmpfile();
- FigureFullMetricsEnd(sf,&at->gi,bitmaps); /* Bitmap fonts use ttf convention of 3 magic glyphs */
- if ( at->gi.bygid[0]!=-1 && (sf->glyphs[at->gi.bygid[0]]->width==width || width==-1 )) {
- putshort(at->gi.hmtx,sf->glyphs[at->gi.bygid[0]]->width);
- SplineCharLayerFindBounds(sf->glyphs[at->gi.bygid[0]],at->gi.layer,&b);
- putshort(at->gi.hmtx,b.minx);
- if ( dovmetrics ) {
- putshort(at->gi.vmtx,sf->glyphs[at->gi.bygid[0]]->vwidth);
- putshort(at->gi.vmtx,/*sf->vertical_origin-*/b.miny);
- }
- } else {
- putshort(at->gi.hmtx,width==-1?(sf->ascent+sf->descent)/2:width);
- putshort(at->gi.hmtx,0);
- if ( dovmetrics ) {
- putshort(at->gi.vmtx,sf->ascent+sf->descent);
- putshort(at->gi.vmtx,0);
- }
- }
- cnt = 1;
- if ( bitmaps ) {
- if ( width==-1 ) width = (sf->ascent+sf->descent)/3;
- putshort(at->gi.hmtx,width);
- putshort(at->gi.hmtx,0);
- if ( dovmetrics ) {
- putshort(at->gi.vmtx,sf->ascent+sf->descent);
- putshort(at->gi.vmtx,0);
- }
- putshort(at->gi.hmtx,width);
- putshort(at->gi.hmtx,0);
- if ( dovmetrics ) {
- putshort(at->gi.vmtx,sf->ascent+sf->descent);
- putshort(at->gi.vmtx,0);
- }
- cnt = 3;
- }
-
- for ( i=cnt; i<at->gi.gcnt; ++i ) if ( at->gi.bygid[i]!=-1 ) {
- sc = sf->glyphs[at->gi.bygid[i]];
- if ( SCWorthOutputting(sc) ) {
- if ( i<=at->gi.lasthwidth )
- putshort(at->gi.hmtx,sc->width);
- SplineCharLayerFindBounds(sc,at->gi.layer,&b);
- putshort(at->gi.hmtx,b.minx);
- if ( dovmetrics ) {
- if ( i<=at->gi.lastvwidth )
- putshort(at->gi.vmtx,sc->vwidth);
- putshort(at->gi.vmtx,/*sf->vertical_origin-*/b.maxy);
- }
- ++cnt;
- if ( i==at->gi.lasthwidth )
- at->gi.hfullcnt = cnt;
- if ( i==at->gi.lastvwidth )
- at->gi.vfullcnt = cnt;
- }
- }
- at->gi.hmtxlen = ftell(at->gi.hmtx);
- if ( at->gi.hmtxlen&2 ) putshort(at->gi.hmtx,0);
- if ( dovmetrics ) {
- at->gi.vmtxlen = ftell(at->gi.vmtx);
- if ( at->gi.vmtxlen&2 ) putshort(at->gi.vmtx,0);
- }
-
- at->gi.maxp->numGlyphs = cnt;
-return( true );
-}
-
-static void dumpcffcidhmtx(struct alltabs *at,SplineFont *_sf) {
- DBounds b;
- SplineChar *sc;
- int cid,i,cnt=0,max;
- SplineFont *sf = NULL;
- int dovmetrics = _sf->hasvmetrics;
-
- at->gi.hmtx = tmpfile();
- if ( dovmetrics )
- at->gi.vmtx = tmpfile();
- FigureFullMetricsEnd(_sf,&at->gi,false);
-
- max = 0;
- for ( i=0; i<_sf->subfontcnt; ++i )
- if ( max<_sf->subfonts[i]->glyphcnt )
- max = _sf->subfonts[i]->glyphcnt;
- for ( cid = 0; cid<max; ++cid ) {
- for ( i=0; i<_sf->subfontcnt; ++i ) {
- sf = _sf->subfonts[i];
- if ( cid<sf->glyphcnt && SCWorthOutputting(sf->glyphs[cid]))
- break;
- }
- if ( i!=_sf->subfontcnt ) {
- sc = sf->glyphs[cid];
- if ( sc->ttf_glyph<=at->gi.lasthwidth )
- putshort(at->gi.hmtx,sc->width);
- SplineCharLayerFindBounds(sc,at->gi.layer,&b);
- putshort(at->gi.hmtx,b.minx);
- if ( dovmetrics ) {
- if ( sc->ttf_glyph<=at->gi.lastvwidth )
- putshort(at->gi.vmtx,sc->vwidth);
- putshort(at->gi.vmtx,/*sf->vertical_origin-*/b.maxy);
- }
- ++cnt;
- if ( sc->ttf_glyph==at->gi.lasthwidth )
- at->gi.hfullcnt = cnt;
- if ( sc->ttf_glyph==at->gi.lastvwidth )
- at->gi.vfullcnt = cnt;
- } else if ( cid==0 ) {
- /* Create a dummy entry for .notdef */
- sf = _sf->subfonts[0];
- putshort(at->gi.hmtx,sf->ascent+sf->descent);
- putshort(at->gi.hmtx,0);
- ++cnt;
- if ( dovmetrics ) {
- putshort(at->gi.vmtx,sf->ascent+sf->descent);
- putshort(at->gi.vmtx,0);
- }
- }
- }
- at->gi.hmtxlen = ftell(at->gi.hmtx);
- if ( at->gi.hmtxlen&2 ) putshort(at->gi.hmtx,0);
- if ( dovmetrics ) {
- at->gi.vmtxlen = ftell(at->gi.vmtx);
- if ( at->gi.vmtxlen&2 ) putshort(at->gi.vmtx,0);
- }
-
- at->gi.maxp->numGlyphs = cnt;
-}
-
-static int dumptype2glyphs(SplineFont *sf,struct alltabs *at) {
- int i;
- struct pschars *subrs, *chrs;
-
- at->cfff = tmpfile();
- at->sidf = tmpfile();
- at->sidh = tmpfile();
- at->charset = tmpfile();
- at->encoding = tmpfile();
- at->private = tmpfile();
-
- dumpcffheader(sf,at->cfff);
- dumpcffnames(sf,at->cfff);
- dumpcffcharset(sf,at);
- ff_progress_change_stages(2+at->gi.strikecnt);
-
- ATFigureDefWidth(sf,at,-1);
- if ((chrs =SplineFont2ChrsSubrs2(sf,at->nomwid,at->defwid,at->gi.bygid,at->gi.gcnt,at->gi.flags,&subrs,at->gi.layer))==NULL )
-return( false );
- dumpcffprivate(sf,at,-1,subrs->next);
- if ( subrs->next!=0 )
- _dumpcffstrings(at->private,subrs);
- ff_progress_next_stage();
- at->charstrings = dumpcffstrings(chrs);
- PSCharsFree(subrs);
- if ( at->charstrings == NULL )
-return( false );
- if ( at->format==ff_cff && !isStdEncoding(sf,at->map))
- dumpcffencoding(sf,at); /* Do this after we've assigned glyph ids */
- dumpcfftopdict(sf,at);
- finishup(sf,at);
-
- at->cfflen = ftell(at->cfff);
- if ( at->cfflen&3 ) {
- for ( i=4-(at->cfflen&3); i>0; --i )
- putc('\0',at->cfff);
- }
-
- if ( at->format!=ff_cff )
- dumpcffhmtx(at,sf,false);
- free(at->gn_sid); at->gn_sid=NULL;
-return( true );
-}
-
-static int dumpcidglyphs(SplineFont *sf,struct alltabs *at) {
- int i;
- struct pschars *glbls = NULL, *chrs;
-
- at->cfff = tmpfile();
- at->sidf = tmpfile();
- at->sidh = tmpfile();
- at->charset = tmpfile();
- at->fdselect = tmpfile();
- at->fdarray = tmpfile();
- at->globalsubrs = tmpfile();
-
- at->fds = gcalloc(sf->subfontcnt,sizeof(struct fd2data));
- for ( i=0; i<sf->subfontcnt; ++i ) {
- at->fds[i].private = tmpfile();
- ATFigureDefWidth(sf->subfonts[i],at,i);
- }
- if ( (chrs = CID2ChrsSubrs2(sf,at->fds,at->gi.flags,&glbls,at->gi.layer))==NULL )
-return( false );
- for ( i=0; i<sf->subfontcnt; ++i ) {
- dumpcffprivate(sf->subfonts[i],at,i,at->fds[i].subrs->next);
- if ( at->fds[i].subrs->next!=0 )
- _dumpcffstrings(at->fds[i].private,at->fds[i].subrs);
- PSCharsFree(at->fds[i].subrs);
- }
- _dumpcffstrings(at->globalsubrs,glbls);
- PSCharsFree(glbls);
-
- dumpcffheader(sf,at->cfff);
- dumpcffnames(sf,at->cfff);
- dumpcffcidset(sf,at);
- dumpcfffdselect(sf,at);
- dumpcffdictindex(sf,at);
- if ( (at->charstrings = dumpcffstrings(chrs))==NULL )
-return( false );
- dumpcffcidtopdict(sf,at);
- finishupcid(sf,at);
-
- at->cfflen = ftell(at->cfff);
- if ( at->cfflen&3 ) {
- for ( i=4-(at->cfflen&3); i>0; --i )
- putc('\0',at->cfff);
- }
-
- if ( at->format!=ff_cffcid )
- dumpcffcidhmtx(at,sf);
-return( true );
-}
-
-
-
-static void OS2WeightCheck(struct pfminfo *pfminfo,char *weight) {
- if ( weight==NULL ) {
- /* default it */
- } else if ( strstrmatch(weight,"medi")!=NULL ) {
- pfminfo->weight = 500;
- pfminfo->panose[2] = 6;
- } else if ( strstrmatch(weight,"demi")!=NULL ||
- strstrmatch(weight,"halb")!=NULL ||
- (strstrmatch(weight,"semi")!=NULL &&
- strstrmatch(weight,"bold")!=NULL) ) {
- pfminfo->weight = 600;
- pfminfo->panose[2] = 7;
- } else if ( strstrmatch(weight,"bold")!=NULL ||
- strstrmatch(weight,"fett")!=NULL ||
- strstrmatch(weight,"gras")!=NULL ) {
- pfminfo->weight = 700;
- pfminfo->panose[2] = 8;
- } else if ( strstrmatch(weight,"heavy")!=NULL ) {
- pfminfo->weight = 800;
- pfminfo->panose[2] = 9;
- } else if ( strstrmatch(weight,"black")!=NULL ) {
- pfminfo->weight = 900;
- pfminfo->panose[2] = 10;
- } else if ( strstrmatch(weight,"nord")!=NULL ) {
- pfminfo->weight = 950;
- pfminfo->panose[2] = 11;
- } else if ( strstrmatch(weight,"thin")!=NULL ) {
- pfminfo->weight = 100;
- pfminfo->panose[2] = 2;
- } else if ( strstrmatch(weight,"extra")!=NULL ||
- strstrmatch(weight,"light")!=NULL ) {
- pfminfo->weight = 200;
- pfminfo->panose[2] = 3;
- } else if ( strstrmatch(weight,"light")!=NULL ) {
- pfminfo->weight = 300;
- pfminfo->panose[2] = 4;
- }
-}
-
-void SFDefaultOS2Simple(struct pfminfo *pfminfo,SplineFont *sf) {
- pfminfo->pfmfamily = 0x11;
- pfminfo->panose[0] = 2;
- pfminfo->weight = 400;
- pfminfo->panose[2] = 5;
- pfminfo->width = 5;
- pfminfo->panose[3] = 3;
- pfminfo->winascent_add = pfminfo->windescent_add = true;
- pfminfo->hheadascent_add = pfminfo->hheaddescent_add = true;
- pfminfo->typoascent_add = pfminfo->typodescent_add = true;
- pfminfo->os2_winascent = pfminfo->os2_windescent = 0;
-
- if ( sf->subfonts!=NULL ) sf = sf->subfonts[0];
- pfminfo->linegap = pfminfo->vlinegap = pfminfo->os2_typolinegap =
- rint(.09*(sf->ascent+sf->descent));
-}
-
-void SFDefaultOS2SubSuper(struct pfminfo *pfminfo,int emsize,double italic_angle) {
- double s = sin(italic_angle*3.1415926535897932/180.0);
- pfminfo->os2_supysize = pfminfo->os2_subysize = .7*emsize;
- pfminfo->os2_supxsize = pfminfo->os2_subxsize = .65*emsize;
- pfminfo->os2_subyoff = .14*emsize;
- pfminfo->os2_supyoff = .48*emsize;
- pfminfo->os2_supxoff = s*pfminfo->os2_supyoff;
- pfminfo->os2_subxoff = -s*pfminfo->os2_subyoff;
- pfminfo->os2_strikeysize = 102*emsize/2048;
- pfminfo->os2_strikeypos = 530*emsize/2048;
-}
-
-void SFDefaultOS2Info(struct pfminfo *pfminfo,SplineFont *sf,char *fontname) {
- int samewid= -1;
- char *weight = sf->cidmaster==NULL ? sf->weight : sf->cidmaster->weight;
-
- if ( sf->pfminfo.pfmset ) {
- if ( pfminfo!=&sf->pfminfo )
- *pfminfo = sf->pfminfo;
- if ( !pfminfo->panose_set ) {
- struct pfminfo info;
- memset(&info,0,sizeof(info));
- sf->pfminfo.pfmset = false;
- SFDefaultOS2Info(&info,sf,fontname);
- sf->pfminfo.pfmset = true;
- memcpy(pfminfo->panose,info.panose,sizeof(info.panose));
- }
- } else {
- struct pfminfo hold;
- if ( pfminfo->hheadset || pfminfo->vheadset )
- hold = *pfminfo;
- else
- hold.hheadset = hold.vheadset = false;
- memset(pfminfo,'\0',sizeof(*pfminfo));
- SFDefaultOS2Simple(pfminfo,sf);
- samewid = CIDOneWidth(sf);
-
- pfminfo->pfmfamily = 0x10;
- if ( samewid>0 ) {
- pfminfo->pfmfamily = 0x30;
- /* pfminfo->panose[3] = 9; */ /* This is done later */
- } else if ( strstrmatch(fontname,"sans")!=NULL )
- pfminfo->pfmfamily = 0x20;
- else if ( strstrmatch(fontname,"script")!=NULL ) {
- pfminfo->pfmfamily = 0x40;
- pfminfo->panose[0] = 3;
- }
- if ( samewid==-1 )
- pfminfo->pfmfamily |= 0x1; /* Else it assumes monospace */
-
-/* urw uses 4 character abreviations */
- if ( weight!=NULL )
- OS2WeightCheck(pfminfo,weight);
- OS2WeightCheck(pfminfo,fontname);
-
- if ( strstrmatch(fontname,"ultra")!=NULL &&
- strstrmatch(fontname,"condensed")!=NULL ) {
- pfminfo->width = 1;
- pfminfo->panose[3] = 8;
- } else if ( strstrmatch(fontname,"extra")!=NULL &&
- strstrmatch(fontname,"condensed")!=NULL ) {
- pfminfo->width = 2;
- pfminfo->panose[3] = 8;
- } else if ( strstrmatch(fontname,"semi")!=NULL &&
- strstrmatch(fontname,"condensed")!=NULL ) {
- pfminfo->width = 4;
- pfminfo->panose[3] = 6;
- } else if ( strstrmatch(fontname,"condensed")!=NULL ||
- strstrmatch(fontname,"narrow")!=NULL ) {
- pfminfo->width = 3;
- pfminfo->panose[3] = 6;
- } else if ( strstrmatch(fontname,"ultra")!=NULL &&
- strstrmatch(fontname,"expanded")!=NULL ) {
- pfminfo->width = 9;
- pfminfo->panose[3] = 7;
- } else if ( strstrmatch(fontname,"extra")!=NULL &&
- strstrmatch(fontname,"expanded")!=NULL ) {
- pfminfo->width = 8;
- pfminfo->panose[3] = 7;
- } else if ( strstrmatch(fontname,"semi")!=NULL &&
- strstrmatch(fontname,"expanded")!=NULL ) {
- pfminfo->width = 6;
- pfminfo->panose[3] = 5;
- } else if ( strstrmatch(fontname,"expanded")!=NULL ) {
- pfminfo->width = 7;
- pfminfo->panose[3] = 5;
- }
- if ( samewid>0 )
- pfminfo->panose[3] = 9;
- if ( hold.hheadset ) {
- pfminfo->hheadset = true;
- pfminfo->hheadascent_add = hold.hheadascent_add;
- pfminfo->hheaddescent_add = hold.hheaddescent_add;
- pfminfo->hhead_ascent = hold.hhead_ascent;
- pfminfo->hhead_descent = hold.hhead_descent;
- pfminfo->linegap = hold.linegap;
- }
- if ( hold.vheadset ) {
- pfminfo->vheadset = true;
- pfminfo->vlinegap = hold.vlinegap;
- }
- }
- if ( !pfminfo->subsuper_set )
- SFDefaultOS2SubSuper(pfminfo,sf->ascent+sf->descent,sf->italicangle);
-}
-
-char *utf8_verify_copy(const char *str) {
- /* When given a postscript string it SHOULD be in ASCII. But it will often*/
- /* contain a copyright symbol (sometimes in latin1, sometimes in macroman)*/
- /* unfortunately both encodings use 0xa9 for copyright so we can't distinguish */
- /* guess that it's latin1 (or that copyright is the only odd char which */
- /* means a latin1 conversion will work for macs too). */
-
- if ( str==NULL )
-return( NULL );
-
- if ( utf8_valid(str))
-return( copy(str)); /* Either in ASCII (good) or appears to be utf8*/
-return( latin1_2_utf8_copy(str));
-}
-
-int SFHasInstructions(SplineFont *sf) {
- int i;
-
- if ( sf->subfontcnt!=0 )
-return( false ); /* Truetype doesn't support cid keyed fonts */
-
- for ( i=0; i<sf->glyphcnt; ++i ) if ( sf->glyphs[i]!=NULL ) {
- if ( strcmp(sf->glyphs[i]->name,".notdef")==0 )
- continue; /* ff produces fonts with instructions in .notdef & not elsewhere. Ignore these */
- if ( sf->glyphs[i]->ttf_instrs!=NULL )
-return( true );
- }
-return( false );
-}
-
-static int dumpcff(struct alltabs *at,SplineFont *sf,enum fontformat format,
- FILE *cff) {
- int ret;
-
- if ( format==ff_cff ) {
- AssignTTFGlyph(&at->gi,sf,at->map,true);
- ret = dumptype2glyphs(sf,at);
- } else {
- SFDummyUpCIDs(&at->gi,sf); /* life is easier if we ignore the seperate fonts of a cid keyed fonts and treat it as flat */
- ret = dumpcidglyphs(sf,at);
- free(sf->glyphs); sf->glyphs = NULL;
- sf->glyphcnt = sf->glyphmax = sf->glyphmin = 0;
- }
- free( at->gi.bygid );
-
- if ( !ret )
- at->error = true;
- else if ( at->gi.flags & ps_flag_nocffsugar ) {
- if ( !ttfcopyfile(cff,at->cfff,0,"CFF"))
- at->error = true;
- } else {
- long len;
- char buffer[80];
- fprintf(cff,"%%!PS-Adobe-3.0 Resource-FontSet\n");
- fprintf(cff,"%%%%DocumentNeedResources:ProcSet (FontSetInit)\n");
- fprintf(cff,"%%%%Title: (FontSet/%s)\n", sf->fontname);
- fprintf(cff,"%%%%EndComments\n" );
- fprintf(cff,"%%%%IncludeResource: ProcSet(FontSetInit)\n" );
- fprintf(cff,"%%%%BeginResource: FontSet(%s)\n", sf->fontname );
- fprintf(cff,"/FontSetInit /ProcSet findresource begin\n" );
- fseek(at->cfff,0,SEEK_END);
- len = ftell(at->cfff);
- rewind(at->cfff);
- sprintf( buffer, "/%s %ld StartData\n", sf->fontname, len );
- fprintf(cff,"%%%%BeginData: %ld Binary Bytes\n", (long) (len+strlen(buffer)) );
- fputs(buffer,cff);
- if ( !ttfcopyfile(cff,at->cfff,ftell(cff),"CFF"))
- at->error = true;
- fprintf(cff,"\n%%%%EndData\n" );
- fprintf(cff,"%%%%EndResource\n" );
- fprintf(cff,"%%%%EOF\n" );
- }
-return( !at->error );
-}
-
-int _WriteTTFFont(FILE *ttf,SplineFont *sf,enum fontformat format,
- int32 *bsizes, enum bitmapformat bf,int flags,EncMap *map, int layer) {
- struct alltabs at;
- char *oldloc;
- int i, anyglyphs;
-
- oldloc = setlocale(LC_NUMERIC,"C"); /* TrueType probably doesn't need this, but OpenType does for floats in dictionaries */
- if ( format==ff_otfcid || format== ff_cffcid ) {
- if ( sf->cidmaster ) sf = sf->cidmaster;
- } else {
- if ( sf->subfontcnt!=0 ) sf = sf->subfonts[0];
- }
-
- if ( sf->subfontcnt==0 ) {
- anyglyphs = false;
- for ( i=sf->glyphcnt-1; i>0 ; --i ) {
- if ( SCWorthOutputting(sf->glyphs[i])) {
- anyglyphs = true;
- if ( sf->glyphs[i]->unicodeenc!=-1 )
- break;
- }
- }
- if ( !anyglyphs && !sf->internal_temp ) {
- ff_post_error(_("No Encoded Glyphs"),_("Warning: Font contained no glyphs"));
- }
- if ( format!=ff_ttfsym && !(flags&ttf_flag_symbol) && !sf->internal_temp ) {
- if ( i==0 && anyglyphs ) {
- if ( map->enccount<=256 ) {
- char *buts[3];
- buts[0] = _("_Yes"); buts[1] = _("_No"); buts[2] = NULL;
- if ( ff_ask(_("No Encoded Glyphs"),(const char **) buts,0,1,_("This font contains no glyphs with unicode encodings.\nWould you like to use a \"Symbol\" encoding instead of Unicode?"))==0 )
- flags |= ttf_flag_symbol;
- } else
- ff_post_error(_("No Encoded Glyphs"),_("This font contains no glyphs with unicode encodings.\nYou will probably not be able to use the output."));
- }
- }
- }
-
- for ( i=0; i<sf->glyphcnt; ++i ) if ( sf->glyphs[i]!=NULL )
- sf->glyphs[i]->ttf_glyph = -1;
-
- memset(&at,'\0',sizeof(struct alltabs));
- at.gi.flags = flags;
- at.gi.layer = layer;
- at.gi.is_ttf = false;
- at.applemode = 0;
- at.opentypemode = 0;
- at.msbitmaps = false;
- at.applebitmaps = false;
- at.gi.onlybitmaps = false;
- at.gi.bsizes = bsizes;
- at.gi.fixed_width = CIDOneWidth(sf);
- at.isotf = false;
- at.format = format;
- at.next_strid = 256;
- at.sf = sf;
- at.map = map;
-
- if ( format==ff_cff || format==ff_cffcid ) {
- dumpcff(&at,sf,format,ttf);
- } else {
- /* TODO: remove top function layers here */
- }
- setlocale(LC_NUMERIC,oldloc);
- if ( at.error || ferror(ttf))
-return( 0 );
-
-#ifdef __CygWin
- /* Modern versions of windows want the execute bit set on a ttf file */
- /* I've no idea what this corresponds to in windows, nor any idea on */
- /* how to set it from the windows UI, but this seems to work */
- {
- struct stat buf;
- fstat(fileno(ttf),&buf);
- fchmod(fileno(ttf),S_IXUSR | buf.st_mode );
- }
-#endif
-
-return( 1 );
-}
-
-int WriteTTFFont(char *fontname,SplineFont *sf,enum fontformat format,
- int32 *bsizes, enum bitmapformat bf,int flags,EncMap *map, int layer) {
- FILE *ttf;
- int ret;
-
- if ( strstr(fontname,"://")!=NULL ) {
- if (( ttf = tmpfile())==NULL )
-return( 0 );
- } else {
- if (( ttf=fopen(fontname,"wb+"))==NULL )
-return( 0 );
- }
- ret = _WriteTTFFont(ttf,sf,format,bsizes,bf,flags,map,layer);
- if ( fclose(ttf)==-1 )
-return( 0 );
-return( ret );
-}
-
diff --git a/Build/source/texk/web2c/luatexdir/luafontloader/fontforge/fontforge/tottfgpos.c b/Build/source/texk/web2c/luatexdir/luafontloader/fontforge/fontforge/tottfgpos.c
deleted file mode 100644
index d89177e211f..00000000000
--- a/Build/source/texk/web2c/luatexdir/luafontloader/fontforge/fontforge/tottfgpos.c
+++ /dev/null
@@ -1,366 +0,0 @@
-/* Copyright (C) 2000-2008 by George Williams */
-/*
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are met:
-
- * Redistributions of source code must retain the above copyright notice, this
- * list of conditions and the following disclaimer.
-
- * Redistributions in binary form must reproduce the above copyright notice,
- * this list of conditions and the following disclaimer in the documentation
- * and/or other materials provided with the distribution.
-
- * The name of the author may not be used to endorse or promote products
- * derived from this software without specific prior written permission.
-
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
- * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
- * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
- * EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
- * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
- * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
- * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
- * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-#include "fontforgevw.h"
-#include <utype.h>
-#include <ustring.h>
-
-int coverageformatsallowed=3;
-int use_second_indic_scripts = false;
-
-#include "ttf.h"
-
-/* This file contains routines to create the otf gpos and gsub tables and their */
-/* attendant subtables */
-
-/* Undocumented fact: ATM (which does kerning for otf fonts in Word) can't handle features with multiple lookups */
-
-/* Undocumented fact: Only one feature with a given tag allowed per script/lang */
-/* So if we have multiple lookups with the same tag they must be merged into */
-/* one feature with many lookups */
-
-/* scripts (for opentype) that I understand */
- /* see also list in lookups.c mapping script tags to friendly names */
-
-static uint32 scripts[][15] = {
-/* Arabic */ { CHR('a','r','a','b'), 0x0600, 0x06ff, 0xfb50, 0xfdff, 0xfe70, 0xfefe },
-/* Aramaic */ { CHR('a','r','a','m'), 0x820, 0x83f },
-/* Armenian */ { CHR('a','r','m','n'), 0x0530, 0x058f, 0xfb13, 0xfb17 },
-/* Balinese */ { CHR('b','a','l','i'), 0x1b00, 0x1b7f },
-/* Bengali */ { CHR('b','e','n','g'), 0x0980, 0x09ff },
-/* Bliss symb */{ CHR('b','l','i','s'), 0x12200, 0x124ff },
-/* Bopomofo */ { CHR('b','o','p','o'), 0x3100, 0x312f, 0x31a0, 0x31bf },
-/* Braille */ { CHR('b','r','a','i'), 0x2800, 0x28ff },
-/* Buginese */ { CHR('b','u','g','i'), 0x1a00, 0x1a1f },
-/* Buhid */ { CHR('b','u','h','d'), 0x1740, 0x1753 },
-/* Byzantine M*/{ CHR('b','y','z','m'), 0x1d000, 0x1d0ff },
-/* Canadian Syl*/{CHR('c','a','n','s'), 0x1400, 0x167f },
-/* Carian */ {CHR('c','a','r','i'), 0x0, 0x0 },
-/* Cham */ {CHR('c','h','a','m'), 0x0, 0x0 },
-/* Cherokee */ { CHR('c','h','e','r'), 0x13a0, 0x13ff },
-/* Cirth */ { CHR('c','i','r','t'), 0x12080, 0x120ff },
-/* CJKIdeogra */{ CHR('h','a','n','i'), 0x3300, 0x9fff, 0xf900, 0xfaff, 0x020000, 0x02ffff },
-/* Coptic */ { CHR('c','o','p','t'), 0x2c80, 0x2cff },
-/* Cypriot */ { CHR('c','p','m','n'), 0x10800, 0x1083f },
-/* Cyrillic */ { CHR('c','y','r','l'), 0x0400, 0x052f, 0x1d2b, 0x1d2b, 0x1d78, 0x1d78,
- 0x2de0, 0x2dff, 0xa640, 0xa6ff },
-/* Deseret */ { CHR('d','s','r','t'), 0x10400, 0x1044f },
-/* Devanagari */{ CHR('d','e','v','a'), 0x0900, 0x097f },
-/* Ethiopic */ { CHR('e','t','h','i'), 0x1200, 0x139f },
-/* Georgian */ { CHR('g','e','o','r'), 0x1080, 0x10ff },
-/* Glagolitic */{ CHR('g','l','a','g'), 0x1080, 0x10ff },
-/* Gothic */ { CHR('g','o','t','h'), 0x10330, 0x1034a },
-/* Greek */ { CHR('g','r','e','k'), 0x0370, 0x03ff, 0x1f00, 0x1fff },
-/* Gujarati */ { CHR('g','u','j','r'), 0x0a80, 0x0aff },
-/* Gurmukhi */ { CHR('g','u','r','u'), 0x0a00, 0x0a7f },
-/* Hangul */ { CHR('h','a','n','g'), 0xac00, 0xd7af, 0x3130, 0x319f, 0xffa0, 0xff9f },
-/* Hanunoo */ { CHR('h','a','n','o'), 0x1720, 0x1734 },
- /* I'm not sure what the difference is between the 'hang' tag and the 'jamo' */
- /* tag. 'Jamo' is said to be the precomposed forms, but what's 'hang'? */
-/* Hebrew */ { CHR('h','e','b','r'), 0x0590, 0x05ff, 0xfb1e, 0xfb4f },
-#if 0 /* Hiragana used to have its own tag, but has since been merged with katakana */
-/* Hiragana */ { CHR('h','i','r','a'), 0x3040, 0x309f },
-#endif
-/* Hangul Jamo*/{ CHR('j','a','m','o'), 0x1100, 0x11ff, 0x3130, 0x319f, 0xffa0, 0xffdf },
-/* Javanese */ { CHR('j','a','v','a'), 0 }, /* MS has a tag, but there is no unicode range */
-/* Katakana */ { CHR('k','a','n','a'), 0x3040, 0x30ff, 0xff60, 0xff9f },
-/* Kayah Li */ { CHR('k','a','l','i'), 0 },
-/* Kannada */ { CHR('k','n','d','a'), 0x0c80, 0x0cff },
-/* Kharosthi */ { CHR('k','h','a','r'), 0x10a00, 0x10a5f },
-/* Khmer */ { CHR('k','h','m','r'), 0x1780, 0x17ff },
-/* Latin */ { CHR('l','a','t','n'), 0x0041, 0x005a, 0x0061, 0x007a,
- 0x00c0, 0x02af, 0x1d00, 0x1eff, 0xfb00, 0xfb0f, 0xff00, 0xff5f, 0xa770, 0xa7ff },
-/* Lao */ { CHR('l','a','o',' '), 0x0e80, 0x0eff },
-/* Lepcha */ { CHR('l','e','p','c'), 0 },
-/* Limbu */ { CHR('l','i','m','b'), 0x1900, 0x194f },
-/* Linear A */ /*{ CHR('l','i','n','a'), 0x10180, 0x102cf },*/ /* What happened to linear A? */
-/* Linear B */ { CHR('l','i','n','b'), 0x10000, 0x100fa },
-/* Lycian */ { CHR('l','y','c','i'), 0 },
-/* Lydian */ { CHR('l','y','d','i'), 0 },
-/* Malayalam */ { CHR('m','l','y','m'), 0x0d00, 0x0d7f },
-/* Mathematical Alphanumeric Symbols */
- { CHR('m','a','t','h'), 0x1d400, 0x1d7ff },
-/* Mongolian */ { CHR('m','o','n','g'), 0x1800, 0x18af },
-/* Musical */ { CHR('m','u','s','i'), 0x1d100, 0x1d1ff },
-/* Myanmar */ { CHR('m','y','m','r'), 0x1000, 0x107f },
-/* New Tai Lue*/{ CHR('t','a','l','u'), 0 },
-/* N'Ko */ { CHR('n','k','o',' '), 0x07c0, 0x07fa },
-/* Ogham */ { CHR('o','g','a','m'), 0x1680, 0x169f },
-/* Ol Chiki */ { CHR('o','l','c','k'), 0 },
-/* Old Italic */{ CHR('i','t','a','l'), 0x10300, 0x1031e },
-/* Old Permic */{ CHR('p','e','r','m'), 0x10350, 0x1037f },
-/* Old Persian cuneiform */
- { CHR('x','p','e','o'), 0x103a0, 0x103df },
-/* Oriya */ { CHR('o','r','y','a'), 0x0b00, 0x0b7f },
-/* Osmanya */ { CHR('o','s','m','a'), 0x10480, 0x104a9 },
-/* Phags-pa */ { CHR('p','h','a','g'), 0xa840, 0xa87f },
-/* Phoenician */{ CHR('p','h','n','x'), 0x10900, 0x1091f },
-/* Pollard */ { CHR('p','l','r','d'), 0x104b0, 0x104d9 },
-/* Rejang */ { CHR('r','j','n','g'), 0 },
-/* Rongorongo */{ CHR('r','o','r','o'), 0 },
-/* Runic */ { CHR('r','u','n','r'), 0x16a0, 0x16ff },
-/* Saurashtra*/ { CHR('s','a','u','r'), 0 },
-/* Shavian */ { CHR('s','h','a','w'), 0x10450, 0x1047f },
-/* Sinhala */ { CHR('s','i','n','h'), 0x0d80, 0x0dff },
-/* Sumero-Akkadian Cuneiform */
- { CHR('x','s','u','x'), 0x12000, 0x1236e },
-/* Sundanese */ { CHR('s','u','n','d'), 0 },
-/* Syloti Nagri */
- { CHR('s','y','l','o'), 0xa800, 0xa82f },
-/* Syriac */ { CHR('s','y','r','c'), 0x0700, 0x074f },
-/* Tagalog */ { CHR('t','a','g','l'), 0x1700, 0x1714 },
-/* Tagbanwa */ { CHR('t','a','g','b'), 0x1760, 0x1773 },
-/* Tai Le */ { CHR('t','a','l','e'), 0x1950, 0x1974 },
-/* Tai Lu */ { CHR('t','a','l','u'), 0x1980, 0x19df },
-/* Tamil */ { CHR('t','a','m','l'), 0x0b80, 0x0bff },
-/* Telugu */ { CHR('t','e','l','u'), 0x0c00, 0x0c7f },
-/* Tengwar */ { CHR('t','e','n','g'), 0x12000, 0x1207f },
-/* Thaana */ { CHR('t','h','a','a'), 0x0780, 0x07bf },
-/* Thai */ { CHR('t','h','a','i'), 0x0e00, 0x0e7f },
-/* Tibetan */ { CHR('t','i','b','t'), 0x0f00, 0x0fff },
-/* Tifinagh */ { CHR('t','f','n','g'), 0x2d30, 0x2d7f },
-/* Ugaritic */ { CHR('u','g','a','r'), 0x10380, 0x1039d },
-/* Yi */ { CHR('y','i',' ',' '), 0xa000, 0xa4c6 },
- { 0 }
-};
-
-int ScriptIsRightToLeft(uint32 script) {
- if ( script==CHR('a','r','a','b') || script==CHR('h','e','b','r') ||
- script==CHR('c','p','m','n') || script==CHR('k','h','a','r') ||
- script==CHR('s','y','r','c') || script==CHR('t','h','a','a') ||
- script==CHR('n','k','o',' '))
-return( true );
-
-return( false );
-}
-
-uint32 ScriptFromUnicode(int u,SplineFont *sf) {
- int s, k;
-
- if ( u!=-1 ) {
- for ( s=0; scripts[s][0]!=0; ++s ) {
- for ( k=1; scripts[s][k+1]!=0; k += 2 )
- if ( u>=scripts[s][k] && u<=scripts[s][k+1] )
- break;
- if ( scripts[s][k+1]!=0 )
- break;
- }
- if ( scripts[s][0]!=0 ) {
- uint32 script = scripts[s][0];
- if ( use_second_indic_scripts ) {
- /* MS has a parallel set of script tags for their new */
- /* Indic font shaper */
- if ( script == CHR('b','e','n','g' )) script = CHR('b','n','g','2');
- else if ( script == CHR('d','e','v','a' )) script = CHR('d','e','v','2');
- else if ( script == CHR('g','u','j','r' )) script = CHR('g','j','r','2');
- else if ( script == CHR('g','u','r','u' )) script = CHR('g','u','r','2');
- else if ( script == CHR('k','n','d','a' )) script = CHR('k','n','d','2');
- else if ( script == CHR('m','l','y','m' )) script = CHR('m','l','y','2');
- else if ( script == CHR('o','r','y','a' )) script = CHR('o','r','y','2');
- else if ( script == CHR('t','a','m','l' )) script = CHR('t','m','l','2');
- else if ( script == CHR('t','e','l','u' )) script = CHR('t','e','l','2');
- }
-return( script );
- }
- } else if ( sf!=NULL ) {
- if ( sf->cidmaster!=NULL || sf->subfontcnt!=0 ) {
- if ( sf->cidmaster!=NULL ) sf = sf->cidmaster;
- if ( strmatch(sf->ordering,"Identity")==0 )
-return( DEFAULT_SCRIPT );
- else if ( strmatch(sf->ordering,"Korean")==0 )
-return( CHR('h','a','n','g'));
- else
-return( CHR('h','a','n','i') );
- }
- }
-
-return( DEFAULT_SCRIPT );
-}
-
-uint32 SCScriptFromUnicode(SplineChar *sc) {
- char *pt;
- PST *pst;
- SplineFont *sf;
- int i; unsigned uni;
- FeatureScriptLangList *features;
-
- if ( sc==NULL )
-return( DEFAULT_SCRIPT );
-
- sf = sc->parent;
- if ( sc->unicodeenc!=-1 &&
- !(sc->unicodeenc>=0xe000 && sc->unicodeenc<0xf8ff) &&
- !(sc->unicodeenc>=0xf0000 && sc->unicodeenc<0x10ffff))
-return( ScriptFromUnicode( sc->unicodeenc,sf ));
-
- pt = sc->name;
- if ( *pt ) for ( ++pt; *pt!='\0' && *pt!='_' && *pt!='.'; ++pt );
- if ( *pt!='\0' ) {
- char *str = copyn(sc->name,pt-sc->name);
- int uni = sf==NULL || sf->fv==NULL ? UniFromName(str,ui_none,&custom) :
- UniFromName(str,sf->uni_interp,sf->fv->map->enc);
- free(str);
- if ( uni!=-1 )
-return( ScriptFromUnicode( uni,sf ));
- }
- /* Adobe ligature uniXXXXXXXX */
- if ( strncmp(sc->name,"uni",3)==0 && sscanf(sc->name+3,"%4x", &uni)==1 )
-return( ScriptFromUnicode( uni,sf ));
-
- if ( sf==NULL )
-return( DEFAULT_SCRIPT );
-
- if ( sf->cidmaster ) sf=sf->cidmaster;
- else if ( sf->mm!=NULL ) sf=sf->mm->normal;
- for ( i=0; i<2; ++i ) {
- for ( pst=sc->possub; pst!=NULL; pst=pst->next ) {
- if ( pst->type == pst_lcaret )
- continue;
- for ( features = pst->subtable->lookup->features; features!=NULL; features=features->next ) {
- if ( features->scripts!=NULL )
-return( features->scripts->script );
- }
- }
- }
-return( ScriptFromUnicode( sc->unicodeenc,sf ));
-}
-
-
-SplineChar **SFGlyphsFromNames(SplineFont *sf,char *names) {
- int cnt, ch;
- char *pt, *end;
- SplineChar *sc, **glyphs;
-
- cnt = 0;
- for ( pt = names; *pt; pt = end+1 ) {
- ++cnt;
- end = strchr(pt,' ');
- if ( end==NULL )
- break;
- }
-
- glyphs = galloc((cnt+1)*sizeof(SplineChar *));
- cnt = 0;
- for ( pt = names; *pt; pt = end+1 ) {
- end = strchr(pt,' ');
- if ( end==NULL )
- end = pt+strlen(pt);
- ch = *end;
- *end = '\0';
- sc = SFGetChar(sf,-1,pt);
- if ( sc!=NULL && sc->ttf_glyph!=-1 )
- glyphs[cnt++] = sc;
- *end = ch;
- if ( ch=='\0' )
- break;
- }
- glyphs[cnt] = NULL;
-return( glyphs );
-}
-
-
-static int glyphnameinlist(char *haystack,char *name) {
- char *start, *pt;
- int ch, match, slen = strlen(name);
-
- for ( pt=haystack ; ; ) {
- while ( *pt==' ' ) ++pt;
- if ( *pt=='\0' )
-return( false );
- start=pt;
- while ( *pt!=' ' && *pt!='\0' ) ++pt;
- if ( pt-start==slen ) {
- ch = *pt; *pt='\0';
- match = strcmp(start,name);
- *pt = ch;
- if ( match==0 )
-return( true );
- }
- }
-}
-
-static int ReferencedByGSUB(SplineChar *sc) {
- PST *pst;
- SplineFont *sf = sc->parent;
- int gid;
- SplineChar *testsc;
- char *name = sc->name;
-
- /* If it is itself a ligature it will be referenced by GSUB */
- /* (because we store ligatures on the glyph generated) */
- for ( pst=sc->possub; pst!=NULL; pst=pst->next )
- if ( pst->type == pst_ligature )
-return( true );
-
- for ( gid=0; gid<sf->glyphcnt; ++gid ) if ( (testsc=sf->glyphs[gid])!=NULL ) {
- for ( pst=testsc->possub; pst!=NULL; pst=pst->next ) {
- if ( pst->type==pst_substitution || pst->type==pst_alternate ||
- pst->type==pst_multiple ) {
- if ( glyphnameinlist(pst->u.mult.components,name) )
-return( true );
- }
- }
- }
-return( false );
-}
-
-int gdefclass(SplineChar *sc) {
- PST *pst;
- AnchorPoint *ap;
-
- if ( sc->glyph_class!=0 )
-return( sc->glyph_class-1 );
-
- if ( strcmp(sc->name,".notdef")==0 )
-return( 0 );
-
- /* It isn't clear to me what should be done if a glyph is both a ligature */
- /* and a mark (There are some greek accent ligatures, it is probably more*/
- /* important that they be indicated as marks). Here I chose mark rather */
- /* than ligature as the mark class is far more likely to be used */
- ap=sc->anchor;
- while ( ap!=NULL && (ap->type==at_centry || ap->type==at_cexit) )
- ap = ap->next;
- if ( ap!=NULL && (ap->type==at_mark || ap->type==at_basemark) )
-return( 3 );
-
- for ( pst=sc->possub; pst!=NULL; pst=pst->next ) {
- if ( pst->type == pst_ligature )
-return( 2 ); /* Ligature */
- }
-
- /* I not quite sure what a componant glyph is. Probably something */
- /* that is not in the cmap table and is referenced in other glyphs */
- /* (I've never seen it used by others) */
- /* (Note: No glyph in a CID font can be components as all CIDs mean */
- /* something) (I think) */
- if ( sc->unicodeenc==-1 && sc->dependents!=NULL &&
- sc->parent->cidmaster!=NULL && !ReferencedByGSUB(sc))
-return( 4 );
- else
-return( 1 );
-}
-
diff --git a/Build/source/texk/web2c/luatexdir/luafontloader/fontforge/fontforge/ttf.h b/Build/source/texk/web2c/luatexdir/luafontloader/fontforge/fontforge/ttf.h
deleted file mode 100644
index ab2ddac803d..00000000000
--- a/Build/source/texk/web2c/luatexdir/luafontloader/fontforge/fontforge/ttf.h
+++ /dev/null
@@ -1,762 +0,0 @@
-/* Copyright (C) 2001-2008 by George Williams */
-/*
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are met:
-
- * Redistributions of source code must retain the above copyright notice, this
- * list of conditions and the following disclaimer.
-
- * Redistributions in binary form must reproduce the above copyright notice,
- * this list of conditions and the following disclaimer in the documentation
- * and/or other materials provided with the distribution.
-
- * The name of the author may not be used to endorse or promote products
- * derived from this software without specific prior written permission.
-
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
- * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
- * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
- * EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
- * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
- * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
- * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
- * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include "psfont.h" /* for struct fddata */
-
-#define MAC_DELETED_GLYPH_NAME "<Delete>"
-
-/* Some glyphs have multiple encodings ("A" might be used for Alpha and Cyrillic A) */
-struct dup {
- SplineChar *sc;
- int enc;
- int uni;
- struct dup *prev;
-};
-
-struct ttfinfo {
- int emsize; /* ascent + descent? from the head table */
- int ascent, descent; /* from the hhea table */
- /* not the usWinAscent from the OS/2 table */
- int vertical_origin; /* if vmetrics are present */
- int width_cnt; /* from the hhea table, in the hmtx table */
- int glyph_cnt; /* from maxp table (or cff table) */
- unsigned int index_to_loc_is_long:1; /* in head table */
- unsigned int is_ttc:1; /* Is it a font collection? */
- unsigned int is_onebyte:1; /* Is it a one byte encoding? */
- unsigned int twobytesymbol:1; /* it had a symbol encoding which we converted to unicode */
- unsigned int complainedbeyondglyfend:1; /* Don't complain about this more than once */
- unsigned int extensionrequested:1; /* Only ask once for a copy of a font containing extension subtables */
- unsigned int to_order2:1; /* We are to leave the font as truetype (order2) splines, else convert to ps */
- unsigned int complainedmultname:1; /* Don't complain about this more than once */
- unsigned int strokedfont: 1; /* painttype==2 for otf */
- unsigned int use_typo_metrics: 1;
- unsigned int weight_width_slope_only: 1;
- unsigned int optimized_for_cleartype: 1;
- unsigned int apply_lsb: 1;
- enum openflags openflags;
- /* Mac fonts platform=0/1, platform specific enc id, roman=0, english is lang code 0 */
- /* iso platform=2, platform specific enc id, latin1=0/2, no language */
- /* microsoft platform=3, platform specific enc id, 1, english is lang code 0x??09 */
- char *copyright; /* from the name table, nameid=0 */
- char *familyname; /* nameid=1 */
- char *fullname; /* nameid=4 */
- char *weight;
- char *version; /* nameid=5 */
- char *fontname; /* postscript font name, nameid=6 */
- char *xuid; /* Only for open type cff fonts */
- int uniqueid;
- real italicAngle; /* from post table */
- int upos, uwidth; /* underline pos, width from post table */
- real strokewidth;
- int fstype;
- struct psdict *private; /* Only for open type cff fonts */
- EncMap *map;
- enum uni_interp uni_interp;
- struct pfminfo pfminfo;
- short os2_version;
- short gasp_version;
- int dupnamestate;
- struct ttflangname *names;
- char *fontcomments, *fontlog;
- char **cvt_names;
- SplineChar **chars; /* from all over, glyf table for contours */
- /* cmap table for encodings */
- /* hmtx table for widths */
- /* post table for names */
- /* Or from CFF table for everything in opentype */
- LayerInfo *layers;
- int layer_cnt;
- BDFFont *bitmaps;
- char *cidregistry, *ordering;
- int supplement;
- real cidfontversion;
- int subfontcnt;
- SplineFont **subfonts;
- char *inuse; /* What glyphs are used by this font in the ttc */
-
- int numtables;
- /* BASE */
- uint32 base_start; /* Offset from sof to start of 'BASE' table */
- /* CFF */
- uint32 cff_start; /* Offset from sof to start of postscript compact font format */
- uint32 cff_length;
- /* cmap */
- uint32 encoding_start; /* Offset from sof to start of encoding table */
- uint32 vs_start; /* Offset within 'cmap' to variant selector table */
- /* gasp */
- uint32 gasp_start;
- /* glyf */
- uint32 glyph_start; /* Offset from sof to start of glyph table */
- uint32 glyph_length;
- /* GDEF */
- uint32 gdef_start; /* Offset from sof to start of GDEF table (glyph class defn, ligature carets) */
- uint32 gdef_length;
- /* GPOS */
- uint32 gpos_start; /* Offset from sof to start of GPOS table */
- uint32 gpos_length;
- /* GSUB */
- uint32 gsub_start; /* Offset from sof to start of GSUB table */
- uint32 gsub_length;
- uint32 g_bounds; /* Filled in with g???_start+g???_length */
- /* EBDT, bdat */
- uint32 bitmapdata_start; /* Offset to start of bitmap data */
- uint32 bitmapdata_length;
- /* EBLT, bloc */
- uint32 bitmaploc_start; /* Offset to start of bitmap locator data */
- uint32 bitmaploc_length;
- /* head */
- uint32 head_start;
- /* hhea */
- uint32 hhea_start;
- /* hmtx */
- uint32 hmetrics_start;
- /* kern */
- uint32 kern_start;
- /* loca */
- uint32 glyphlocations_start;/* there are glyph_cnt of these, from maxp tab */
- uint32 loca_length; /* actually glypn_cnt is wrong. Use the table length (divided by size) instead */
- /* maxp */
- uint32 maxp_start; /* maximum number of glyphs */
- uint32 maxp_len;
- /* name */
- uint32 copyright_start; /* copyright and fontname */
- /* post */
- uint32 postscript_start; /* names for the glyphs, italic angle, etc. */
- /* OS/2 */
- uint32 os2_start;
- /* TYP1 */
- uint32 typ1_start; /* For Adobe's? Apple's? attempt to stuff a type1 font into an sfnt wrapper */
- uint32 typ1_length;
- /* vhea */
- uint32 vhea_start;
- /* vmtx */
- uint32 vmetrics_start;
- /* VORG */
- uint32 vorg_start;
-
- /* PfEd -- FontForge/PfaEdit specific info */
- uint32 pfed_start;
- /* TeX -- TeX table, also non-standard */
- uint32 tex_start;
- /* BDF -- BDF properties, also non-standard */
- uint32 bdf_start;
- /* FFTM -- FontForge timestamps */
- uint32 fftm_start;
-
- /* MATH Table */
- uint32 math_start;
- uint32 math_length;
-
- /* Info for instructions */
- uint32 cvt_start, cvt_len;
- uint32 prep_start, prep_len;
- uint32 fpgm_start, fpgm_len;
-
- unsigned int one_of_many: 1; /* A TTCF file, or a opentype font with multiple fonts */
- unsigned int obscomplain: 1; /* We've complained about obsolete format 3 in EBDT table */
- unsigned int cmpcomplain: 1; /* We've complained about compressed format 4 in EBDT */
- unsigned int unkcomplain: 1; /* We've complained about unknown formats in EBDT */
- unsigned int comcomplain: 1; /* We've complained about composit formats in EBDT */
- unsigned int onlystrikes: 1; /* Only read in the bitmaps, not the outlines */
- unsigned int onlyonestrike: 1; /* Only read in one bitmap (strike) */
- unsigned int barecff: 1; /* pay attention to the encoding in the cff file, we won't have a cmap */
-
- int platform, specific; /* values of the encoding we chose to use */
-
- int anchor_class_cnt; /* For GPOS */
- int anchor_merge_cnt;
- AnchorClass *ahead, *alast;
-
- KernClass *khead, *klast, *vkhead, *vklast;
-
- OTLookup *gpos_lookups, *gsub_lookups, *cur_lookups;
-
- struct ttf_table *tabs;
- FPST *possub;
- char *chosenname;
- int macstyle;
- int lookup_cnt; /* Max lookup in current GPOS/GSUB table */
- int feature_cnt; /* Max feature in current GPOS/GSUB table */
- struct fontdict *fd; /* For reading in Type42 fonts. Glyph names in postscript section must be associated with glyphs in TTF section */
- int savecnt;
- struct savetab {
- uint32 tag;
- uint32 offset;
- int len;
- } *savetab;
- int32 last_size_pos;
- uint16 design_size;
- uint16 fontstyle_id;
- struct otfname *fontstyle_name;
- uint16 design_range_bottom, design_range_top;
- struct texdata texdata;
- int mark_class_cnt;
- char **mark_classes; /* glyph name list */
- char **mark_class_names; /* used within ff (utf8) */
- SplineChar **badgids; /* which use out of range glyph IDs as temporary flags */
-#ifdef _HAS_LONGLONG
- long long creationtime; /* seconds since 1970 */
- long long modificationtime;
-#else
- long creationtime;
- long modificationtime;
-#endif
- int gasp_cnt;
- struct gasp *gasp;
- struct MATH *math;
- /* Set of errors we found when loading the font */
- unsigned int bad_ps_fontname: 1;
- unsigned int bad_glyph_data: 1;
- unsigned int bad_cff: 1;
- unsigned int bad_metrics: 1;
- unsigned int bad_cmap: 1;
- unsigned int bad_embedded_bitmap: 1;
- unsigned int bad_gx: 1;
- unsigned int bad_ot: 1;
- unsigned int bad_os2_version: 1;
- unsigned int bad_sfnt_header: 1;
- Layer guidelines;
- struct Base *horiz_base, *vert_base;
-};
-
-enum gsub_inusetype { git_normal, git_justinuse, git_findnames };
-
-#define MAX_TAB 48
-struct tabdir {
- int32 version; /* 0x00010000 */
- uint16 numtab;
- uint16 searchRange; /* (Max power of 2 <= numtab) *16 */
- uint16 entrySel; /* Log2(Max power of 2 <= numtab ) */
- uint16 rangeShift; /* numtab*16 - searchRange */
- struct taboff {
- uint32 tag; /* Table name */
- uint32 checksum;/* for table */
- uint32 offset; /* to start of table in file */
- uint32 length;
- FILE *data;
- uint16 dup_of;
- uint16 orderingval;
- } tabs[MAX_TAB]; /* room for all the above tables */
- /* Not in any particular order. */
- struct taboff *ordered[MAX_TAB]; /* Ordered the way the tables should be output in file */
- struct taboff *alpha[MAX_TAB]; /* Ordered alphabetically by tag for the ttf header */
-};
-
-struct glyphhead {
- int16 numContours;
- int16 xmin;
- int16 ymin;
- int16 xmax;
- int16 ymax;
-};
-
-struct head {
- int32 version; /* 0x00010000 */
- int32 revision; /* 0 */
- uint32 checksumAdj; /* set to 0, sum entire font, store 0xb1b0afba-sum */
- uint32 magicNum; /* 0x5f0f3cf5 */
- uint16 flags; /* 1 */
- uint16 emunits; /* sf->ascent+sf->descent */
- int32 createtime[2];/* number of seconds since 1904 */
- int32 modtime[2];
- int16 xmin; /* min for entire font */
- int16 ymin;
- int16 xmax;
- int16 ymax;
- uint16 macstyle; /* 1=>Bold, 2=>Italic */
- uint16 lowestreadable; /* size in pixels. Say about 10? */
- int16 dirhint; /* 0=>mixed directional characters, */
- int16 locais32; /* is the location table 32bits or 16, 0=>16, 1=>32 */
- int16 glyphformat; /* 0 */
- uint16 mbz; /* padding */
-};
-
-struct hhead {
- int32 version; /* 0x00010000 */
- int16 ascender; /* sf->ascender */
- int16 descender; /* -sf->descender */
- int16 linegap; /* 0 */
- int16 maxwidth; /* of all characters */
- int16 minlsb; /* How is this different from xmin above? */
- int16 minrsb;
- int16 maxextent; /* How is this different from xmax above? */
- int16 caretSlopeRise;/* Uh... let's say 1? */
- int16 caretSlopeRun;/* Uh... let's say 0 */
- /* not exactly specified, but FontValidator wants this to match italicangle */
- int16 mbz[5];
- int16 metricformat; /* 0 */
- uint16 numMetrics; /* just set to glyph count */
-};
-
-struct hmtx {
- uint16 width; /* NOTE: TTF only allows positive widths!!! */
- int16 lsb;
-};
-
-struct kern {
- uint16 version; /* 0 */
- uint16 ntab; /* 1, number of subtables */
- /* first (and only) subtable */
- uint16 stversion; /* 0 */
- uint16 length; /* length of subtable beginning at &stversion */
- uint16 coverage; /* 1, (set of flags&format) */
- uint16 nPairs; /* number of kern pairs */
- uint16 searchRange; /* (Max power of 2 <= nPairs) *6 */
- uint16 entrySel; /* Log2(Max power of 2 <= nPairs ) */
- uint16 rangeShift; /* numtab*6 - searchRange */
- struct kp {
- uint16 left; /* left glyph num */
- uint16 right; /* right glyph num */
- /* table is ordered by these two above treated as uint32 */
- int16 offset; /* kern amount */
- } *kerns; /* Array should be nPairs big */
-};
-
-struct maxp {
- int32 version; /* 0x00010000 */
- uint16 numGlyphs;
- uint16 maxPoints; /* max number of points in a simple glyph */
- uint16 maxContours; /* max number of paths in a simple glyph */
- uint16 maxCompositPts;
- uint16 maxCompositCtrs;
- uint16 maxZones; /* 1 */
- uint16 maxTwilightPts; /* 0 */
- uint16 maxStorage; /* 0 */
- uint16 maxFDEFs; /* 0 */
- uint16 maxIDEFs; /* 0 */
- uint16 maxStack; /* 0 */
- uint16 maxglyphInstr;/* 0 */
- uint16 maxnumcomponents; /* Maximum number of refs in any composit */
- uint16 maxcomponentdepth;
- /* Apple docs say: 0 (if no composits), maximum value 1 (one level of composit) */
- /* OpenType docs say: 1 (if no composits), any depth allowed */
-};
-
-struct nametab {
- uint16 format; /* 0 */
- uint16 numrec; /* 1 */
- uint16 startOfStrings; /* offset from start of table to start of strings */
- struct namerec {
- uint16 platform; /* 3 => MS */
- uint16 specific; /* 1 */
- uint16 language; /* 0x0409 */
- uint16 nameid; /* 0=>copyright, 1=>family, 2=>weight, 4=>fullname */
- /* 5=>version, 6=>postscript name */
- uint16 strlen;
- uint16 stroff;
- } nr[6];
-};
-
-struct os2 {
- uint16 version; /* 1 */
- int16 avgCharWid; /* average all chars (v3) see v2 definition below */
- uint16 weightClass; /* 100=>thin, 200=>extra-light, 300=>light, 400=>normal, */
- /* 500=>Medium, 600=>semi-bold, 700=>bold, 800=>extra-bold, */
- /* 900=>black */
- uint16 widthClass; /* 75=>condensed, 100, 125=>expanded */
- int16 fstype; /* 0x0008 => allow embedded editing */
- int16 ysubXSize; /* emsize/5 */
- int16 ysubYSize; /* emsize/5 */
- int16 ysubXOff; /* 0 */
- int16 ysubYOff; /* emsize/5 */
- int16 ysupXSize; /* emsize/5 */
- int16 ysupYSize; /* emsize/5 */
- int16 ysupXOff; /* 0 */
- int16 ysupYOff; /* emsize/5 */
- int16 yStrikeoutSize; /* 102/2048 *emsize */
- int16 yStrikeoutPos; /* 530/2048 *emsize */
- int16 sFamilyClass; /* ??? 0 */
- /* high order byte is the "class", low order byte the sub class */
- /* class = 0 => no classification */
- /* class = 1 => old style serifs */
- /* subclass 0, no class; 1 ibm rounded; 2 garalde; 3 venetian; 4 mod venitian; 5 dutch modern; 6 dutch trad; 7 contemporary; 8 caligraphic; 15 misc */
- /* class = 2 => transitional serifs */
- /* subclass 0, no class; 1 drect line; 2 script; 15 misc */
- /* class = 3 => modern serifs */
- /* subclass: 1, italian; 2, script */
- /* class = 4 => clarendon serifs */
- /* subclass: 1, clarendon; 2, modern; 3 trad; 4 newspaper; 5 stub; 6 monotone; 7 typewriter */
- /* class = 5 => slab serifs */
- /* subclass: 1, monotone; 2, humanist; 3 geometric; 4 swiss; 5 typewriter */
- /* class = 7 => freeform serifs */
- /* subclass: 1, modern */
- /* class = 8 => sans serif */
- /* subclass: 1, ibm neogrotesque; 2 humanist; 3 low-x rounded; 4 high-x rounded; 5 neo-grotesque; 6 mod neo-grot; 9 typewriter; 10 matrix */
- /* class = 9 => ornamentals */
- /* subclass: 1, engraver; 2 black letter; 3 decorative; 4 3D */
- /* class = 10 => scripts */
- /* subclass: 1, uncial; 2 brush joined; 3 formal joined; 4 monotone joined; 5 calligraphic; 6 brush unjoined; 7 formal unjoined; 8 monotone unjoined */
- /* class = 12 => symbolic */
- /* subclass: 3 mixed serif; 6 old style serif; 7 neo-grotesque sans; */
- char panose[10]; /* can be set to zero */
- uint32 unicoderange[4];
- /* 1<<0=>ascii, 1<<1 => latin1, 2=>100-17f, 3=>180-24f, 4=>250-2af */
- /* 5=> 2b0-2ff, 6=>300-36f, ... */
- char achVendID[4]; /* can be zero */
- uint16 fsSel; /* 1=> italic, 32=>bold, 64 => regular */
- /* 2=>underscore, 4=>negative, 8->outlined, 16=>strikeout */
- /* version 4 of OS/2 */
- /* 128->don't use win_ascent/descent for line spacing */
- /* 256=>family varies on weight width slope only */
- /* 512=>oblique (as opposed to italic) */
- uint16 firstcharindex; /* minimum unicode encoding */
- uint16 lastcharindex; /* maximum unicode encoding */
- uint16 ascender; /* font ascender height (not ascent) */
- uint16 descender; /* font descender height */
- uint16 linegap; /* 0 */
- uint16 winascent; /* ymax */
- uint16 windescent; /* ymin */
- uint32 ulCodePage[2];
- /* 1<<0 => latin1, 1<<1=>latin2, cyrillic, greek, turkish, hebrew, arabic */
- /* 1<<30 => mac, 1<<31 => symbol */
- /* OTF stuff (version 2 of OS/2) */
- short xHeight;
- short capHeight;
- short defChar;
- short breakChar;
- short maxContext;
- /* V3 of OS/2 has no additional data */
- /* V4 of OS/2 has no additional data */
-
- int v1_avgCharWid; /* 1&2 Weighted average of the lower case letters and space */
- int v3_avgCharWid; /* 3&4 average over all non-zero width glyphs */
-};
-
-struct post {
- int32 formattype; /* 0x00020000 */
- int32 italicAngle; /* in fixed format */
- int16 upos;
- int16 uwidth;
- uint32 isfixed;
- uint32 minmem42;
- uint32 maxmem42;
- uint32 minmem1;
- uint32 maxmem1;
- uint16 numglyphs;
- uint16 glyphnameindex[1];
-};
-
-struct glyphinfo {
- struct maxp *maxp; /* this one is given to dumpglyphs, rest blank */
- uint32 *loca;
- FILE *glyphs;
- FILE *hmtx;
- int hmtxlen;
- FILE *vmtx;
- int vmtxlen;
- int next_glyph;
- int glyph_len;
- int xmin, ymin, xmax, ymax;
- BlueData bd;
- int strikecnt; /* number of bitmaps to dump */
- int lasthwidth, lastvwidth; /* encoding of last glyph for which we generate a full metrics entry */
- int hfullcnt, vfullcnt;
- int flags;
- int fixed_width;
- int32 *bsizes;
- unsigned int onlybitmaps: 1;
- unsigned int has_instrs: 1;
- unsigned int is_ttf: 1;
- SplineFont *sf;
- int32 *pointcounts;
- int *bygid; /* glyph list */
- int gcnt;
- int layer;
-};
-
-struct vorg {
- uint16 majorVersion; /* 1 */
- uint16 minorVersion; /* 0 */
- short defaultVertOriginY; /* Y coord of default vertical origin in the design coordinate system */
- uint16 numVertOriginYMetrics; /* exceptions to the above, elements in following array */
-#if 0
- struct {
- uint16 glyphindex; /* ordered */
- short vertOrigin;
- } origins[];
-#endif
-};
-
-struct alltabs {
- struct tabdir tabdir;
- struct head head;
- struct hhead hhead;
- struct hhead vhead;
- struct maxp maxp;
- struct os2 os2;
- struct vorg vorg;
- FILE *loca;
- int localen;
- FILE *name;
- int namelen;
- FILE *post;
- int postlen;
- FILE *gpos; /* Used instead of kern for opentype (and other glyph positioning) */
- int gposlen;
- FILE *gsub; /* Used for ligatures and other substitutions */
- int gsublen;
- FILE *gdef; /* If we use mark to base we need this to tell the text processor what things are marks (the opentype docs say it is optional. They are wrong) */
- int gdeflen;
- FILE *kern;
- int kernlen;
- FILE *cmap;
- int cmaplen;
- FILE *headf;
- int headlen;
- FILE *hheadf;
- int hheadlen;
- FILE *maxpf;
- int maxplen;
- FILE *os2f;
- int os2len;
- FILE *math;
- int mathlen;
- FILE *base;
- int baselen;
- FILE *cvtf;
- int cvtlen;
- FILE *fpgmf; /* Copied from an original ttf file and dumped out. Never generated */
- int fpgmlen;
- FILE *prepf; /* Copied from an original ttf file and dumped out. Never generated */
- int preplen;
- FILE *vheadf;
- int vheadlen;
- FILE *vorgf;
- int vorglen;
- FILE *gaspf;
- int gasplen;
- FILE *cfff;
- int cfflen;
- FILE *sidf;
- FILE *sidh;
- FILE *charset;
- FILE *encoding;
- FILE *globalsubrs;
- FILE *private;
- FILE *charstrings;
- FILE *fdselect;
- FILE *fdarray;
- FILE *bdat; /* might be EBDT */
- int bdatlen;
- FILE *bloc; /* might be EBLC */
- int bloclen;
- FILE *ebsc;
- int ebsclen;
- FILE *pfed;
- int pfedlen;
- FILE *tex;
- int texlen;
- FILE *bdf;
- int bdflen;
- FILE *fftmf;
- int fftmlen;
- FILE *dsigf;
- int dsiglen;
- FILE *hdmxf;
- int hdmxlen;
- int defwid, nomwid;
- int sidcnt;
- int lenpos;
- int privatelen;
- unsigned int sidlongoffset: 1;
- unsigned int cfflongoffset: 1;
- unsigned int applemode: 1; /* Where apple & ms differ do things apple's way (bitmaps, name table PostScript) */
- unsigned int opentypemode: 1; /* Where apple & ms differ do things opentype's way (bitmaps, name table PostScript) */
- /* If both are set then try to generate both types of tables. Some things can't be fudged though (name table postscript) */
- unsigned int msbitmaps: 1;
- unsigned int applebitmaps: 1;
- unsigned int otbbitmaps: 1;
- unsigned int isotf: 1;
- unsigned int error: 1;
- struct glyphinfo gi;
- int isfixed;
- struct fd2data *fds;
- int next_strid;
-
- int next_lookup; /* for doing nested lookups in contextual features */
- short *gn_sid;
- enum fontformat format;
- int fontstyle_name_strid; /* For GPOS 'size' */
- SplineFont *sf;
- EncMap *map;
- struct ttf_table *oldcvt;
- int oldcvtlen;
-};
-
-struct subhead { uint16 first, cnt, delta, rangeoff; }; /* a sub header in 8/16 cmap table */
-
-enum touchflags { tf_x=1, tf_y=2, tf_d=4, tf_endcontour=0x80, tf_startcontour=0x40 };
-
-struct contexttree {
- int depth;
- int branch_cnt; /* count of subbranches of this node */
- struct ct_branch {
- uint16 classnum;
- struct contexttree *branch;
- } *branches;
- struct fpst_rule *ends_here;
- int rule_cnt; /* count of rules which are active here */
- struct ct_subs {
- struct fpst_rule *rule;
- struct contexttree *branch;/* if the rule ends here this will be null */
- uint16 thisclassnum;
- } *rules;
- int pending_pos;
- OTLookup *applymarkedsubs;
- OTLookup *applycursubs;
- uint16 marked_index, cur_index;
- uint8 markme;
- int state, next_state;
- struct contexttree *parent;
-};
-
- /* TrueType Composite glyph flags */
-#define _ARGS_ARE_WORDS 1
-#define _ARGS_ARE_XY 2
-#define _ROUND 4 /* round offsets so componant is on grid */
-#define _SCALE 8
-/* 0x10 is reserved */
-#define _MORE 0x20
-#define _XY_SCALE 0x40
-#define _MATRIX 0x80
-#define _INSTR 0x100
-#define _USE_MY_METRICS 0x200
-#define _OVERLAP_COMPOUND 0x400 /* Used in Apple GX fonts */
- /* Means the components overlap (which? this one and what other?) */
-/* Described in OpenType specs, not by Apple */
-/* amusingly, Apple supports but MS does not */
-/* MS says they support this after Win 2000 */
-#define _SCALED_OFFSETS 0x800 /* Use Apple definition of offset interpretation */
-#define _UNSCALED_OFFSETS 0x1000 /* Use MS definition */
-
-extern int ttfFixupRef(SplineChar **chars,int i);
-
- /* Open type Advanced Typography Tables */
-extern void otf_dumpgpos(struct alltabs *at, SplineFont *sf);
-extern void otf_dumpgsub(struct alltabs *at, SplineFont *sf);
-extern void otf_dumpgdef(struct alltabs *at, SplineFont *sf);
-extern void otf_dumpbase(struct alltabs *at, SplineFont *sf);
-extern void otf_dump_dummydsig(struct alltabs *at, SplineFont *sf);
-extern int gdefclass(SplineChar *sc);
-
-extern void ttf_dumpkerns(struct alltabs *at, SplineFont *sf);
-
- /* TrueType instructions */
-extern struct ttf_table *SFFindTable(SplineFont *sf,uint32 tag);
-extern int TTF__getcvtval(SplineFont *sf,int val);
-extern int TTF_getcvtval(SplineFont *sf,int val);
-extern void SCinitforinstrs(SplineChar *sc);
-extern int SSAddPoints(SplineSet *ss,int ptcnt,BasePoint *bp, char *flags);
-
- /* Used by both otf and apple */
-extern int LigCaretCnt(SplineChar *sc);
-extern uint16 *ClassesFromNames(SplineFont *sf,char **classnames,int class_cnt,
- int numGlyphs, SplineChar ***glyphs, int apple_kc);
-extern SplineChar **SFGlyphsFromNames(SplineFont *sf,char *names);
-
-
-extern void AnchorClassOrder(SplineFont *sf);
-extern SplineChar **EntryExitDecompose(SplineFont *sf,AnchorClass *ac,
- struct glyphinfo *gi);
-extern void AnchorClassDecompose(SplineFont *sf,AnchorClass *_ac, int classcnt, int *subcnts,
- SplineChar ***marks,SplineChar ***base,
- SplineChar ***lig,SplineChar ***mkmk,
- struct glyphinfo *gi);
-
-#ifdef _HAS_LONGLONG
-extern void cvt_unix_to_1904( long long time, int32 result[2]);
-#else
-extern void cvt_unix_to_1904( long time, int32 result[2]);
-#endif
-
-
- /* Non-standard tables */
- /* My PfEd table for FontForge/PfaEdit specific info */
-extern void pfed_dump(struct alltabs *at, SplineFont *sf);
-extern void pfed_read(FILE *ttf,struct ttfinfo *info);
- /* The TeX table, to contain stuff the TeX people want */
-extern void tex_dump(struct alltabs *at, SplineFont *sf);
-extern void tex_read(FILE *ttf,struct ttfinfo *info);
- /* The BDF table, to contain bdf properties the X people want */
-extern int ttf_bdf_dump(SplineFont *sf,struct alltabs *at,int32 *sizes);
-extern void ttf_bdf_read(FILE *ttf,struct ttfinfo *info);
- /* The FFTM table, to some timestamps I'd like */
-extern int ttf_fftm_dump(SplineFont *sf,struct alltabs *at);
-
- /* The MATH table */
-extern void otf_dump_math(struct alltabs *at, SplineFont *sf);
-extern void otf_read_math(FILE *ttf,struct ttfinfo *info);
-extern void otf_read_math_used(FILE *ttf,struct ttfinfo *info);
-extern void GuessNamesFromMATH(FILE *ttf,struct ttfinfo *info);
-
- /* Parsing advanced typography */
-extern void readttfkerns(FILE *ttf,struct ttfinfo *info);
-extern void readttfgsubUsed(FILE *ttf,struct ttfinfo *info);
-extern void GuessNamesFromGSUB(FILE *ttf,struct ttfinfo *info);
-extern void readttfgpossub(FILE *ttf,struct ttfinfo *info,int gpos);
-extern void readttfgdef(FILE *ttf,struct ttfinfo *info);
-extern void readttfbase(FILE *ttf,struct ttfinfo *info);
-
-extern struct otfname *FindAllLangEntries(FILE *ttf, struct ttfinfo *info, int id );
-
-/* Known font parameters for 'TeX ' table (fontdims, spacing params, whatever you want to call them) */
- /* Used by all fonts */
-#define TeX_Slant CHR('S','l','n','t')
-#define TeX_Space CHR('S','p','a','c')
-#define TeX_Stretch CHR('S','t','r','e')
-#define TeX_Shrink CHR('S','h','n','k')
-#define TeX_XHeight CHR('X','H','g','t')
-#define TeX_Quad CHR('Q','u','a','d')
- /* Used by text fonts */
-#define TeX_ExtraSp CHR('E','x','S','p')
- /* Used by all math fonts */
-#define TeX_MathSp CHR('M','t','S','p')
- /* Used by math fonts */
-#define TeX_Num1 CHR('N','u','m','1')
-#define TeX_Num2 CHR('N','u','m','2')
-#define TeX_Num3 CHR('N','u','m','3')
-#define TeX_Denom1 CHR('D','n','m','1')
-#define TeX_Denom2 CHR('D','n','m','2')
-#define TeX_Sup1 CHR('S','u','p','1')
-#define TeX_Sup2 CHR('S','u','p','2')
-#define TeX_Sup3 CHR('S','u','p','3')
-#define TeX_Sub1 CHR('S','u','b','1')
-#define TeX_Sub2 CHR('S','u','b','2')
-#define TeX_SupDrop CHR('S','p','D','p')
-#define TeX_SubDrop CHR('S','b','D','p')
-#define TeX_Delim1 CHR('D','l','m','1')
-#define TeX_Delim2 CHR('D','l','m','2')
-#define TeX_AxisHeight CHR('A','x','H','t')
- /* Used by math extension fonts */
-#define TeX_DefRuleThick CHR('R','l','T','k')
-#define TeX_BigOpSpace1 CHR('B','O','S','1')
-#define TeX_BigOpSpace2 CHR('B','O','S','2')
-#define TeX_BigOpSpace3 CHR('B','O','S','3')
-#define TeX_BigOpSpace4 CHR('B','O','S','4')
-#define TeX_BigOpSpace5 CHR('B','O','S','5')
-
-extern void SFDummyUpCIDs(struct glyphinfo *gi,SplineFont *sf);
diff --git a/Build/source/texk/web2c/luatexdir/luafontloader/fontforge/fontforge/ttfspecial.c b/Build/source/texk/web2c/luatexdir/luafontloader/fontforge/fontforge/ttfspecial.c
deleted file mode 100644
index dad61caa268..00000000000
--- a/Build/source/texk/web2c/luatexdir/luafontloader/fontforge/fontforge/ttfspecial.c
+++ /dev/null
@@ -1,903 +0,0 @@
-/* Copyright (C) 2000-2008 by George Williams */
-/*
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are met:
-
- * Redistributions of source code must retain the above copyright notice, this
- * list of conditions and the following disclaimer.
-
- * Redistributions in binary form must reproduce the above copyright notice,
- * this list of conditions and the following disclaimer in the documentation
- * and/or other materials provided with the distribution.
-
- * The name of the author may not be used to endorse or promote products
- * derived from this software without specific prior written permission.
-
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
- * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
- * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
- * EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
- * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
- * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
- * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
- * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-#include "pfaedit.h"
-#include <math.h>
-#include <time.h>
-#include <utype.h>
-#include <ustring.h>
-#include <gimage.h> /* For COLOR_DEFAULT */
-
-#include "ttf.h"
-
-/* This file contains routines to generate non-standard true/opentype tables */
-/* The first is the 'PfEd' table containing PfaEdit specific information */
-/* glyph comments & colours ... perhaps other info later */
-
-/* ************************************************************************** */
-/* ************************* The 'PfEd' table ************************* */
-/* ************************* Output ************************* */
-/* ************************************************************************** */
-
-#include "PfEd.h" /* This describes the format of the 'PfEd' table */
- /* and its many subtables. */
-
-#define MAX_SUBTABLE_TYPES 20
-
-/* ************************* The 'PfEd' table ************************* */
-/* ************************* Input ************************* */
-
-static void pfed_readfontcomment(FILE *ttf,struct ttfinfo *info,uint32 base,
- uint32 tag) {
- int len;
- char *start, *pt, *end;
- int use_utf8;
-
- fseek(ttf,base,SEEK_SET);
- use_utf8 = getushort(ttf);
- if ( use_utf8!=0 && use_utf8!=1 )
-return; /* Bad version number */
- len = getushort(ttf);
- start = pt = galloc(len+1);
-
- end = pt+len;
- if ( use_utf8 ) {
- while ( pt<end )
- *pt++ = getc(ttf);
- } else {
- while ( pt<end )
- *pt++ = getushort(ttf);
- }
- *pt = '\0';
- if ( !use_utf8 ) {
- pt = latin1_2_utf8_copy(info->fontcomments);
- free(start);
- start = pt;
- }
- if ( tag==flog_TAG )
- info->fontlog = start;
- else
- info->fontcomments = start;
-}
-
-static char *pfed_read_utf8(FILE *ttf, uint32 start) {
- int ch, len;
- char *str, *pt;
-
- fseek( ttf, start, SEEK_SET);
- len = 0;
- while ( (ch=getc(ttf))!='\0' && ch!=EOF )
- ++len;
- fseek( ttf, start, SEEK_SET);
- str = pt = galloc(len+1);
- while ( (ch=getc(ttf))!='\0' && ch!=EOF )
- *pt++ = ch;
- *pt = '\0';
-return( str );
-}
-
-static char *pfed_read_ucs2_len(FILE *ttf,uint32 offset,int len) {
- char *pt, *str;
- uint32 uch, uch2;
- int i;
-
- if ( len<0 )
-return( NULL );
-
- len>>=1;
- pt = str = galloc(3*len);
- fseek(ttf,offset,SEEK_SET);
- for ( i=0; i<len; ++i ) {
- uch = getushort(ttf);
- if ( uch>=0xd800 && uch<0xdc00 ) {
- uch2 = getushort(ttf);
- if ( uch2>=0xdc00 && uch2<0xe000 )
- uch = ((uch-0xd800)<<10) | (uch2&0x3ff);
- else {
- pt = utf8_idpb(pt,uch);
- uch = uch2;
- }
- }
- pt = utf8_idpb(pt,uch);
- }
- *pt++ = 0;
-return( grealloc(str,pt-str) );
-}
-
-static char *pfed_read_utf8_len(FILE *ttf,uint32 offset,int len) {
- char *pt, *str;
- int i;
-
- if ( len<0 )
-return( NULL );
-
- pt = str = galloc(len+1);
- fseek(ttf,offset,SEEK_SET);
- for ( i=0; i<len; ++i )
- *pt++ = getc(ttf);
- *pt = '\0';
-return( str );
-}
-
-static void pfed_readcvtcomments(FILE *ttf,struct ttfinfo *info,uint32 base ) {
- int count, i;
- uint16 *offsets;
-
- fseek(ttf,base,SEEK_SET);
- if ( getushort(ttf)!=0 )
-return; /* Bad version number */
- count = getushort(ttf);
-
- offsets = galloc(count*sizeof(uint16));
- info->cvt_names = galloc((count+1)*sizeof(char *));
- for ( i=0; i<count; ++i )
- offsets[i] = getushort(ttf);
- for ( i=0; i<count; ++i ) {
- if ( offsets[i]==0 )
- info->cvt_names[i] = NULL;
- else
- info->cvt_names[i] = pfed_read_utf8(ttf,base+offsets[i]);
- }
- free(offsets);
-}
-
-static void pfed_readglyphcomments(FILE *ttf,struct ttfinfo *info,uint32 base) {
- int n, i, j;
- struct grange { int start, end; uint32 offset; } *grange;
- uint32 offset, next;
- int use_utf8;
-
- fseek(ttf,base,SEEK_SET);
- use_utf8 = getushort(ttf);
- if ( use_utf8!=0 && use_utf8!=1 )
-return; /* Bad version number */
- n = getushort(ttf);
- grange = galloc(n*sizeof(struct grange));
- for ( i=0; i<n; ++i ) {
- grange[i].start = getushort(ttf);
- grange[i].end = getushort(ttf);
- grange[i].offset = getlong(ttf);
- if ( grange[i].start>grange[i].end || grange[i].end>info->glyph_cnt ) {
- LogError( _("Bad glyph range specified in glyph comment subtable of PfEd table\n") );
- grange[i].start = 1; grange[i].end = 0;
- }
- }
- for ( i=0; i<n; ++i ) {
- for ( j=grange[i].start; j<=grange[i].end; ++j ) {
- fseek( ttf,base+grange[i].offset+(j-grange[i].start)*sizeof(uint32),SEEK_SET);
- offset = getlong(ttf);
- next = getlong(ttf);
- if ( use_utf8 )
- info->chars[j]->comment = pfed_read_utf8_len(ttf,base+offset,next-offset);
- else
- info->chars[j]->comment = pfed_read_ucs2_len(ttf,base+offset,next-offset);
- if ( info->chars[j]->comment == NULL )
- LogError("Invalid comment string (negative length?) in 'PfEd' table for glyph %s.",
- info->chars[j]->name );
- }
- }
- free(grange);
-}
-
-static void pfed_readcolours(FILE *ttf,struct ttfinfo *info,uint32 base) {
- int n, i, j, start, end;
- uint32 col;
-
- fseek(ttf,base,SEEK_SET);
- if ( getushort(ttf)!=0 )
-return; /* Bad version number */
- n = getushort(ttf);
- for ( i=0; i<n; ++i ) {
- start = getushort(ttf);
- end = getushort(ttf);
- col = getlong(ttf);
- if ( start>end || end>info->glyph_cnt )
- LogError( _("Bad glyph range specified in colour subtable of PfEd table\n") );
- else {
- for ( j=start; j<=end; ++j )
- info->chars[j]->color = col;
- }
- }
-}
-
-static void pfed_readlookupnames(FILE *ttf,struct ttfinfo *info,uint32 base,
- OTLookup *lookups) {
- OTLookup *otl;
- struct lookup_subtable *sub;
- AnchorClass *ac;
- int i, j, k, n, s, a;
- struct lstruct { int name_off, subs_off; } *ls, *ss, *as;
-
- fseek(ttf,base,SEEK_SET);
- if ( getushort(ttf)!=0 )
-return; /* Bad version number */
- n = getushort(ttf);
- ls = galloc(n*sizeof(struct lstruct));
- for ( i=0; i<n; ++i ) {
- ls[i].name_off = getushort(ttf);
- ls[i].subs_off = getushort(ttf);
- }
- for ( i=0, otl=lookups; i<n && otl!=NULL; ++i, otl=otl->next ) {
- if ( ls[i].name_off!=0 ) {
- free( otl->lookup_name );
- otl->lookup_name = pfed_read_utf8(ttf,base+ls[i].name_off);
- }
- if ( ls[i].subs_off!=0 ) {
- fseek(ttf,base+ls[i].subs_off,SEEK_SET);
- s = getushort(ttf);
- ss = galloc(s*sizeof(struct lstruct));
- for ( j=0; j<s; ++j ) {
- ss[j].name_off = getushort(ttf);
- ss[j].subs_off = getushort(ttf);
- }
- for ( j=0, sub=otl->subtables; j<s && sub!=NULL; ++j, sub=sub->next ) {
- if ( ss[j].name_off!=0 ) {
- free( sub->subtable_name );
- sub->subtable_name = pfed_read_utf8(ttf,base+ss[j].name_off);
- }
- if ( ss[j].subs_off!=0 ) {
- if ( !sub->anchor_classes )
- LogError("Whoops, attempt to name anchors in a subtable which doesn't contain any\n");
- else {
- fseek(ttf,base+ss[j].subs_off,SEEK_SET);
- a = getushort(ttf);
- as = galloc(a*sizeof(struct lstruct));
- for ( k=0; k<a; ++k ) {
- as[k].name_off = getushort(ttf);
- }
- k=0;
- for ( ac=info->ahead; ac!=NULL; ac=ac->next ) {
- if ( ac->subtable==sub ) {
- if ( as[k].name_off!=0 ) {
- free( ac->name );
- ac->name = pfed_read_utf8(ttf,base+as[k].name_off);
- }
- ++k;
- }
- }
- free(as);
- }
- }
- }
- /* I guess it's ok for some subtables to be unnamed, so no check for sub!=NULL */
- if ( j<s )
- LogError("Whoops, more names than subtables of lookup %s\n", otl->lookup_name );
- free(ss);
- }
- }
- /* I guess it's ok for some lookups to be unnamed, so no check for otf!=NULL */
- if ( i<n )
- LogError("Whoops, more names than lookups\n" );
- free(ls);
-}
-
-static float pfed_get_coord(FILE *ttf,int mod) {
- if ( mod==V_B )
-return( (float) (signed char) getc(ttf) );
- else if ( mod==V_S )
-return( (float) (short) getushort(ttf));
- else if ( mod==V_F )
-return( getlong(ttf)/256.0 );
- else {
- LogError( "Bad data type in contour verb in 'PfEd'\n");
-return( 0 );
- }
-}
-
-static void pfed_read_normal_contour(FILE *ttf,SplineSet *ss,
- uint32 base, int type) {
- SplinePoint *sp, *current;
- int verb, v, m;
- float offx, offy, offx1 = 0, offy1 = 0, offx2, offy2;
- int was_implicit=false;
-
- fseek(ttf,base,SEEK_SET);
-
- verb = getc(ttf);
- if ( COM_VERB(verb)!=V_MoveTo ) {
- LogError("Whoops, contours must begin with a move to\n" );
- ss->first = ss->last = SplinePointCreate(0,0);
-return;
- }
- offx = pfed_get_coord(ttf,COM_MOD(verb));
- offy = pfed_get_coord(ttf,COM_MOD(verb));
- ss->first = current = SplinePointCreate(offx,offy);
- forever {
- verb = getc(ttf);
- v = COM_VERB(verb); m = COM_MOD(verb);
- if ( m==3 ) {
- LogError("Bad data modifier in contour command in 'PfEd'\n" );
- break;
- }
- if ( verb==V_Close || verb==V_End )
- break;
- else if ( v>=V_LineTo && v<=V_VLineTo ) {
- offx = offy = 0;
- if ( v==V_LineTo ) {
- offx = pfed_get_coord(ttf,m);
- offy = pfed_get_coord(ttf,m);
- } else if ( v==V_HLineTo )
- offx = pfed_get_coord(ttf,m);
- else if ( v==V_VLineTo )
- offy = pfed_get_coord(ttf,m);
- sp = SplinePointCreate(current->me.x+offx,current->me.y+offy);
- } else if ( v>=V_QCurveTo && v<=V_QVImplicit ) {
- int will_be_implicit = true;
- offx = offy = 0; offx1 = offy1 = 1; /* else implicit points become straight lines too soon */
- if ( v==V_QCurveTo ) {
- offx = pfed_get_coord(ttf,m);
- offy = pfed_get_coord(ttf,m);
- offx1 = pfed_get_coord(ttf,m);
- offy1 = pfed_get_coord(ttf,m);
- will_be_implicit = false;
- } else if ( v==V_QImplicit ) {
- offx = pfed_get_coord(ttf,m);
- offy = pfed_get_coord(ttf,m);
- } else if ( v==V_QHImplicit ) {
- offx = pfed_get_coord(ttf,m);
- } else if ( v==V_QVImplicit ) {
- offy = pfed_get_coord(ttf,m);
- }
-
- current->nextcp.x = current->me.x+offx;
- current->nextcp.y = current->me.y+offy;
- current->nonextcp = false;
- sp = SplinePointCreate(current->nextcp.x+offx1,current->nextcp.y+offy1);
- sp->prevcp = current->nextcp;
- sp->noprevcp = false;
- if ( was_implicit ) {
- current->me.x = (current->prevcp.x + current->nextcp.x)/2;
- current->me.y = (current->prevcp.y + current->nextcp.y)/2;
- SplineRefigure(current->prev);
- }
- was_implicit = will_be_implicit;
- } else if ( v>=V_CurveTo && v<=V_HVCurveTo ) {
- offx=offy=offx2=offy2=0;
- if ( v==V_CurveTo ) {
- offx = pfed_get_coord(ttf,m);
- offy = pfed_get_coord(ttf,m);
- offx1 = pfed_get_coord(ttf,m);
- offy1 = pfed_get_coord(ttf,m);
- offx2 = pfed_get_coord(ttf,m);
- offy2 = pfed_get_coord(ttf,m);
- } else if ( v==V_VHCurveTo ) {
- offy = pfed_get_coord(ttf,m);
- offx1 = pfed_get_coord(ttf,m);
- offy1 = pfed_get_coord(ttf,m);
- offx2 = pfed_get_coord(ttf,m);
- } else if ( v==V_HVCurveTo ) {
- offx = pfed_get_coord(ttf,m);
- offx1 = pfed_get_coord(ttf,m);
- offy1 = pfed_get_coord(ttf,m);
- offy2 = pfed_get_coord(ttf,m);
- }
- current->nextcp.x = current->me.x+offx;
- current->nextcp.y = current->me.y+offy;
- current->nonextcp = false;
- sp = SplinePointCreate(current->nextcp.x+offx1+offx2,current->nextcp.y+offy1+offy2);
- sp->prevcp.x = current->nextcp.x+offx1;
- sp->prevcp.y = current->nextcp.y+offy1;
- sp->noprevcp = false;
- } else {
- LogError("Whoops, unexpected verb in contour %d.%d\n", v, m );
- break;
- }
- SplineMake(current,sp,type==2);
- current = sp;
- }
- if ( verb==V_Close ) {
- if ( was_implicit ) {
- current->me.x = (current->prevcp.x + ss->first->nextcp.x)/2;
- current->me.y = (current->prevcp.y + ss->first->nextcp.y)/2;
- }
- if ( current->me.x==ss->first->me.x && current->me.y==ss->first->me.y ) {
- current->prev->to = ss->first;
- ss->first->prev = current->prev;
- ss->first->prevcp = current->prevcp;
- ss->first->noprevcp = current->noprevcp;
- SplinePointFree(current);
- } else
- SplineMake(current,ss->first,type==2);
- ss->last = ss->first;
- } else {
- ss->last = current;
- }
- SPLCatagorizePoints(ss);
-}
-
-
-static void pfed_read_glyph_layer(FILE *ttf,struct ttfinfo *info,Layer *ly,
- uint32 base, int type, int version) {
- int cc, ic, rc, i, j;
- SplineSet *ss;
- struct contours { int data_off, name_off; SplineSet *ss; } *contours;
- int gid;
- RefChar *last, *cur;
-
- fseek(ttf,base,SEEK_SET);
- cc = getushort(ttf);
- rc = 0;
- if ( version==1 )
- rc = getushort(ttf);
- ic = getushort(ttf);
- contours = galloc(cc*sizeof(struct contours));
- for ( i=0; i<cc; ++i ) {
- contours[i].data_off = getushort(ttf);
- contours[i].name_off = getushort(ttf);
- }
- last = NULL;
- for ( i=0; i<rc; ++i ) {
- cur = RefCharCreate();
- for ( j=0; j<6; ++j )
- cur->transform[j] = getlong(ttf)/32768.0;
- gid = getushort(ttf);
- cur->sc = info->chars[gid];
- cur->orig_pos = gid;
- cur->unicode_enc = cur->sc->unicodeenc;
- if ( last==NULL )
- ly->refs = cur;
- else
- last->next = cur;
- last = cur;
- }
-
- ss = ly->splines; /* Only relevant for spiros where they live in someone else's layer */
- for ( i=0; i<cc; ++i ) {
- if ( type!=1 ) { /* Not spiros */
- contours[i].ss = chunkalloc(sizeof(SplineSet));
- if ( i==0 )
- ly->splines = contours[i].ss;
- else
- contours[i-1].ss->next = contours[i].ss;
- if ( contours[i].name_off!=0 )
- contours[i].ss->contour_name = pfed_read_utf8(ttf,base+contours[i].name_off);
- pfed_read_normal_contour(ttf,contours[i].ss,base+contours[i].data_off,type);
- }
- }
- free(contours);
-}
-
-static void pfed_readguidelines(FILE *ttf,struct ttfinfo *info,uint32 base) {
- int i,v,h,off;
- int version;
- SplinePoint *sp, *nsp;
- SplineSet *ss;
-
- fseek(ttf,base,SEEK_SET);
- version = getushort(ttf);
- if ( version>1 )
-return; /* Bad version number */
- v = getushort(ttf);
- h = getushort(ttf);
- (void) getushort(ttf);
- off = getushort(ttf);
-
- if ( off!=0 ) {
- pfed_read_glyph_layer(ttf,info,&info->guidelines,base+off,info->to_order2?2:3,version);
- } else {
- struct npos { int pos; int offset; } *vs, *hs;
- vs = galloc(v*sizeof(struct npos));
- hs = galloc(h*sizeof(struct npos));
- for ( i=0; i<v; ++i ) {
- vs[i].pos = (short) getushort(ttf);
- vs[i].offset = getushort(ttf);
- }
- for ( i=0; i<h; ++i ) {
- hs[i].pos = (short) getushort(ttf);
- hs[i].offset = getushort(ttf);
- }
- for ( i=0; i<v; ++i ) {
- sp = SplinePointCreate(vs[i].pos,-info->emsize);
- nsp = SplinePointCreate(vs[i].pos,2*info->emsize);
- SplineMake(sp,nsp,info->to_order2);
- ss = chunkalloc(sizeof(SplineSet));
- ss->first = sp; ss->last = nsp;
- if ( vs[i].offset!=0 )
- ss->contour_name = pfed_read_utf8(ttf,base+vs[i].offset);
- ss->next = info->guidelines.splines;
- info->guidelines.splines = ss;
- }
- for ( i=0; i<h; ++i ) {
- sp = SplinePointCreate(-info->emsize,hs[i].pos);
- nsp = SplinePointCreate(2*info->emsize,hs[i].pos);
- SplineMake(sp,nsp,info->to_order2);
- ss = chunkalloc(sizeof(SplineSet));
- ss->first = sp; ss->last = nsp;
- if ( hs[i].offset!=0 )
- ss->contour_name = pfed_read_utf8(ttf,base+hs[i].offset);
- ss->next = info->guidelines.splines;
- info->guidelines.splines = ss;
- }
- SPLCatagorizePoints(info->guidelines.splines);
- free(vs); free(hs);
- }
-}
-
-static void pfed_redo_refs(SplineChar *sc,int layer) {
- RefChar *refs;
-
- sc->ticked = true;
- for ( refs=sc->layers[layer].refs; refs!=NULL; refs=refs->next ) {
- if ( !refs->sc->ticked )
- pfed_redo_refs(refs->sc,layer);
- SCReinstanciateRefChar(sc,refs,layer);
- }
-}
-
-static void pfed_read_layer(FILE *ttf,struct ttfinfo *info,int layer,int type, uint32 base,
- uint32 start,int version) {
- uint32 *loca = gcalloc(info->glyph_cnt,sizeof(uint32));
- int i,j;
- SplineChar *sc;
- int rcnt;
- struct range { int start, last; uint32 offset; } *ranges;
-
- fseek(ttf,start,SEEK_SET);
- rcnt = getushort(ttf);
- ranges = galloc(rcnt*sizeof(struct range));
- for ( i=0; i<rcnt; ++i ) {
- ranges[i].start = getushort(ttf);
- ranges[i].last = getushort(ttf);
- ranges[i].offset = getlong(ttf);
- }
- for ( i=0; i<rcnt; ++i ) {
- fseek(ttf,base+ranges[i].offset,SEEK_SET);
- for ( j=ranges[i].start; j<=ranges[i].last; ++j )
- loca[j] = getlong(ttf);
- for ( j=ranges[i].start; j<=ranges[i].last; ++j ) {
- Layer *ly;
- sc = info->chars[j];
- ly = &sc->layers[layer];
- if ( loca[j]!=0 )
- pfed_read_glyph_layer(ttf,info,ly,base+loca[j],type,version);
- }
- }
- free(ranges); free(loca);
-
- for ( i=0; i<info->glyph_cnt; ++i ) if ( info->chars[i]!=NULL )
- info->chars[i]->ticked = false;
- for ( i=0; i<info->glyph_cnt; ++i ) if ( info->chars[i]!=NULL )
- pfed_redo_refs(info->chars[i],layer);
-}
-
-static void pfed_readotherlayers(FILE *ttf,struct ttfinfo *info,uint32 base) {
- int i, l, lcnt, spiro_index, gid;
- int version;
- struct layer_info { int type, name_off, data_off, sf_layer; char *name; } *layers;
- int non_spiro_cnt=0;
- SplineChar *sc;
-
- fseek(ttf,base,SEEK_SET);
- version = getushort(ttf);
- if ( version>1 )
-return; /* Bad version number */
- lcnt = getushort(ttf);
- layers = galloc(lcnt*sizeof(struct layer_info));
- for ( i=0; i<lcnt; ++i ) {
- layers[i].type = getushort(ttf);
- layers[i].name_off = getushort(ttf);
- layers[i].data_off = getlong(ttf);
- layers[i].sf_layer = -1;
- }
- spiro_index = -1;
- non_spiro_cnt = 0;
- for ( i=0; i<lcnt; ++i ) {
- if ( layers[i].name_off==0 )
- layers[i].name = copy("Unnamed");
- else {
- layers[i].name = pfed_read_utf8(ttf,base+layers[i].name_off);
- if ( layers[i].type==1 && strcmp(layers[i].name,"Spiro")==0 )
- spiro_index = i;
- }
- if ( layers[i].type==2 || layers[i].type==3 || layers[i].type==0x102 || layers[i].type==0x103 )
- ++non_spiro_cnt;
- }
- if ( spiro_index==-1 ) {
- for ( i=0; i<lcnt; ++i )
- if ( layers[i].type==1 ) {
- spiro_index=i;
- break;
- }
- }
-
- if ( non_spiro_cnt!=0 ) {
- info->layer_cnt = non_spiro_cnt+1;
- info->layers = gcalloc(info->layer_cnt+1,sizeof(LayerInfo));
- info->layers[ly_back].background = true;
- info->layers[ly_fore].order2 = info->to_order2;
- info->layers[ly_fore].background = false;
- l = i = 0;
- if ( (layers[i].type&0xff)==1 )
- ++i;
- if ( layers[i].type&0x100 ) {
- /* first layer output is foreground, so it can't replace the background layer */
- ++info->layer_cnt;
- l = 2;
- info->layers[ly_back].order2 = info->to_order2;
- }
- for ( ; i<lcnt; ++i ) if ( (layers[i].type&0xff)==2 || (layers[i].type&0xff)==3 ) {
- info->layers[l].name = layers[i].name;
- layers[i].name = NULL;
- layers[i].sf_layer = l;
- info->layers[l].order2 = (layers[i].type&0xff)==2;
- info->layers[l].background = (layers[i].type&0x100)?0:1;
- if ( l==0 ) l=2; else ++l;
- }
- if ( info->layer_cnt!=2 ) {
- for ( gid = 0; gid<info->glyph_cnt; ++gid ) if ((sc=info->chars[gid])!=NULL ) {
- sc->layers = grealloc(sc->layers,info->layer_cnt*sizeof(Layer));
- memset(sc->layers+2,0,(info->layer_cnt-2)*sizeof(Layer));
- sc->layer_cnt = info->layer_cnt;
- }
- }
- }
- if ( spiro_index!=-1 )
- pfed_read_layer(ttf,info,ly_fore,layers[spiro_index].type,base,base+layers[spiro_index].data_off,version);
- for ( i=0; i<lcnt; ++i ) if ( layers[i].sf_layer!=-1 ) {
- pfed_read_layer(ttf,info,layers[i].sf_layer,layers[i].type&0xff,
- base,base+layers[i].data_off,version);
- }
- for ( i=0; i<lcnt; ++i )
- free( layers[i].name );
- free( layers );
-}
-
-void pfed_read(FILE *ttf,struct ttfinfo *info) {
- int n,i;
- struct tagoff { uint32 tag, offset; } tagoff[MAX_SUBTABLE_TYPES+30];
-
- fseek(ttf,info->pfed_start,SEEK_SET);
-
- if ( getlong(ttf)!=0x00010000 )
-return;
- n = getlong(ttf);
- if ( n>=MAX_SUBTABLE_TYPES+30 )
- n = MAX_SUBTABLE_TYPES+30;
- for ( i=0; i<n; ++i ) {
- tagoff[i].tag = getlong(ttf);
- tagoff[i].offset = getlong(ttf);
- }
- for ( i=0; i<n; ++i ) switch ( tagoff[i].tag ) {
- case fcmt_TAG: case flog_TAG:
- pfed_readfontcomment(ttf,info,info->pfed_start+tagoff[i].offset, tagoff[i].tag);
- break;
- case cvtc_TAG:
- pfed_readcvtcomments(ttf,info,info->pfed_start+tagoff[i].offset);
- break;
- case cmnt_TAG:
- pfed_readglyphcomments(ttf,info,info->pfed_start+tagoff[i].offset);
- break;
- case colr_TAG:
- pfed_readcolours(ttf,info,info->pfed_start+tagoff[i].offset);
- break;
- case GPOS_TAG:
- pfed_readlookupnames(ttf,info,info->pfed_start+tagoff[i].offset,info->gpos_lookups);
- break;
- case GSUB_TAG:
- pfed_readlookupnames(ttf,info,info->pfed_start+tagoff[i].offset,info->gsub_lookups);
- break;
- case layr_TAG:
- pfed_readotherlayers(ttf,info,info->pfed_start+tagoff[i].offset);
- break;
- case guid_TAG:
- pfed_readguidelines(ttf,info,info->pfed_start+tagoff[i].offset);
- break;
- default:
- LogError( _("Unknown subtable '%c%c%c%c' in 'PfEd' table, ignored\n"),
- tagoff[i].tag>>24, (tagoff[i].tag>>16)&0xff, (tagoff[i].tag>>8)&0xff, tagoff[i].tag&0xff );
- break;
- }
-}
-
-/* 'TeX ' table format is as follows... */
-/* uint32 version number 0x00010000 */
-/* uint32 subtable count */
-/* struct { uint32 tab, offset } tag/offset for first subtable */
-/* struct { uint32 tab, offset } tag/offset for second subtable */
-/* ... */
-
-/* 'TeX ' 'ftpm' font parameter subtable format */
-/* short version number 0 */
-/* parameter count */
-/* array of { 4chr tag, value } */
-
-/* 'TeX ' 'htdp' per-glyph height/depth subtable format */
-/* short version number 0 */
-/* short glyph-count */
-/* array[glyph-count] of { int16 height,depth } */
-
-/* 'TeX ' 'itlc' per-glyph italic correction subtable */
-/* short version number 0 */
-/* short glyph-count */
-/* array[glyph-count] of int16 italic_correction */
-
-/* !!!!!!!!!!! OBSOLETE !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! */
-/* 'TeX ' 'sbsp' per-glyph sub/super script positioning subtable */
-/* short version number 0 */
-/* short glyph-count */
-/* array[glyph-count] of { int16 sub,super } */
-
-#undef MAX_SUBTABLE_TYPES
-#define MAX_SUBTABLE_TYPES 4
-
-struct TeX_subtabs {
- int next;
- struct {
- FILE *data;
- uint32 tag;
- uint32 offset;
- } subtabs[MAX_SUBTABLE_TYPES];
-};
-
-static uint32 tex_text_params[] = {
- TeX_Slant,
- TeX_Space,
- TeX_Stretch,
- TeX_Shrink,
- TeX_XHeight,
- TeX_Quad,
- TeX_ExtraSp,
- 0
-};
-static uint32 tex_math_params[] = {
- TeX_Slant,
- TeX_Space,
- TeX_Stretch,
- TeX_Shrink,
- TeX_XHeight,
- TeX_Quad,
- TeX_MathSp,
- TeX_Num1,
- TeX_Num2,
- TeX_Num3,
- TeX_Denom1,
- TeX_Denom2,
- TeX_Sup1,
- TeX_Sup2,
- TeX_Sup3,
- TeX_Sub1,
- TeX_Sub2,
- TeX_SupDrop,
- TeX_SubDrop,
- TeX_Delim1,
- TeX_Delim2,
- TeX_AxisHeight,
- 0};
-static uint32 tex_mathext_params[] = {
- TeX_Slant,
- TeX_Space,
- TeX_Stretch,
- TeX_Shrink,
- TeX_XHeight,
- TeX_Quad,
- TeX_MathSp,
- TeX_DefRuleThick,
- TeX_BigOpSpace1,
- TeX_BigOpSpace2,
- TeX_BigOpSpace3,
- TeX_BigOpSpace4,
- TeX_BigOpSpace5,
- 0};
-
-
-/* ************************* The 'TeX ' table ************************* */
-/* ************************* Input ************************* */
-
-static void TeX_readFontParams(FILE *ttf,struct ttfinfo *info,uint32 base) {
- int i,pcnt;
- static uint32 *alltags[] = { tex_text_params, tex_math_params, tex_mathext_params };
- int j,k;
- uint32 tag;
- int32 val;
-
- fseek(ttf,base,SEEK_SET);
- if ( getushort(ttf)!=0 ) /* Don't know how to read this version of the subtable */
-return;
- pcnt = getushort(ttf);
- if ( pcnt==22 ) info->texdata.type = tex_math;
- else if ( pcnt==13 ) info->texdata.type = tex_mathext;
- else if ( pcnt>=7 ) info->texdata.type = tex_text;
- for ( i=0; i<pcnt; ++i ) {
- tag = getlong(ttf);
- val = getlong(ttf);
- for ( j=0; j<3; ++j ) {
- for ( k=0; alltags[j][k]!=0; ++k )
- if ( alltags[j][k]==tag )
- break;
- if ( alltags[j][k]==tag )
- break;
- }
- if ( j<3 )
- info->texdata.params[k] = val;
- }
-}
-
-static void TeX_readHeightDepth(FILE *ttf,struct ttfinfo *info,uint32 base) {
- int i,gcnt;
-
- fseek(ttf,base,SEEK_SET);
- if ( getushort(ttf)!=0 ) /* Don't know how to read this version of the subtable */
-return;
- gcnt = getushort(ttf);
- for ( i=0; i<gcnt && i<info->glyph_cnt; ++i ) {
- int h, d;
- h = getushort(ttf);
- d = getushort(ttf);
- if ( info->chars[i]!=NULL ) {
- info->chars[i]->tex_height = h;
- info->chars[i]->tex_depth = d;
- }
- }
-}
-
-static void TeX_readItalicCorr(FILE *ttf,struct ttfinfo *info,uint32 base) {
- int i,gcnt;
-
- fseek(ttf,base,SEEK_SET);
- if ( getushort(ttf)!=0 ) /* Don't know how to read this version of the subtable */
-return;
- gcnt = getushort(ttf);
- for ( i=0; i<gcnt && i<info->glyph_cnt; ++i ) {
- int ital;
- ital = getushort(ttf);
- if ( info->chars[i]!=NULL ) {
- info->chars[i]->italic_correction = ital;
- }
- }
-}
-
-void tex_read(FILE *ttf,struct ttfinfo *info) {
- int n,i;
- struct tagoff { uint32 tag, offset; } tagoff[MAX_SUBTABLE_TYPES+30];
-
- fseek(ttf,info->tex_start,SEEK_SET);
-
- if ( getlong(ttf)!=0x00010000 )
-return;
- n = getlong(ttf);
- if ( n>=MAX_SUBTABLE_TYPES+30 )
- n = MAX_SUBTABLE_TYPES+30;
- for ( i=0; i<n; ++i ) {
- tagoff[i].tag = getlong(ttf);
- tagoff[i].offset = getlong(ttf);
- }
- for ( i=0; i<n; ++i ) switch ( tagoff[i].tag ) {
- case CHR('f','t','p','m'):
- TeX_readFontParams(ttf,info,info->tex_start+tagoff[i].offset);
- break;
- case CHR('h','t','d','p'):
- TeX_readHeightDepth(ttf,info,info->tex_start+tagoff[i].offset);
- break;
- case CHR('i','t','l','c'):
- TeX_readItalicCorr(ttf,info,info->tex_start+tagoff[i].offset);
- break;
- default:
- LogError( _("Unknown subtable '%c%c%c%c' in 'TeX ' table, ignored\n"),
- tagoff[i].tag>>24, (tagoff[i].tag>>16)&0xff, (tagoff[i].tag>>8)&0xff, tagoff[i].tag&0xff );
- break;
- }
-}
-
diff --git a/Build/source/texk/web2c/luatexdir/luafontloader/fontforge/fontforge/uiinterface.h b/Build/source/texk/web2c/luatexdir/luafontloader/fontforge/fontforge/uiinterface.h
deleted file mode 100644
index 81409b72499..00000000000
--- a/Build/source/texk/web2c/luatexdir/luafontloader/fontforge/fontforge/uiinterface.h
+++ /dev/null
@@ -1,511 +0,0 @@
-/* Copyright (C) 2007,2008 by George Williams */
-/*
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are met:
-
- * Redistributions of source code must retain the above copyright notice, this
- * list of conditions and the following disclaimer.
-
- * Redistributions in binary form must reproduce the above copyright notice,
- * this list of conditions and the following disclaimer in the documentation
- * and/or other materials provided with the distribution.
-
- * The name of the author may not be used to endorse or promote products
- * derived from this software without specific prior written permission.
-
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
- * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
- * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
- * EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
- * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
- * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
- * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
- * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-#ifndef _UIINTERFACE_H
-#define _UIINTERFACE_H
-# include "basics.h"
-/* This encapsulates a set of callbacks and stubs. The callbacks get activated*/
-/* when an event happens (a glyph in a font changes for example, then all */
-/* charviews looking at it must be updated), and the stubs provide some simple*/
-/* UI routines: Post an error, etc. */
-
-/* ************************************************************************** */
-/* Basic, low-level UI routines for events we discover deep inside script code*/
-/* ************************************************************************** */
-
-struct ui_interface {
- /* The following is used to post a fontforge internal error */
- /* currently it puts up a dlg displaying the error text */
- void (*ierror)(const char *fmt,...);
-
- /* The following is a simple dialog to alert the user that s/he has */
- /* made an error. Currently it posts a modal dlg and waits for the */
- /* user to dismiss it */
- /* The title argument is the window's title. The error argument is the */
- /* text of the message. It may contain printf formatting. It may contain */
- /* newlines to force line breaks -- even if it doesn't contain new lines */
- /* the routine will wrap the text if a line is too long */
- void (*post_error)(const char *title,const char *error,...);
-
- /* The following is used to post a warning message in such a way that it */
- /* will not impede the user. Currently it creates a little window at the */
- /* bottom right of the screen and writes successive messages there */
- void (*logwarning)(const char *fmt,...);
-
- /* The following is another way to post a warning message in such a way */
- /* that it will not impede the user. Currently it pops up a little */
- /* non-modal dlg which vanishes after a minute or two (or if the user */
- /* dismisses it, of course */
- void (*post_warning)(const char *title,const char *statement,...);
-
- /* Occasionally we we be deep in a non-ui routine and we find we must ask */
- /* the user a question. In this routine the choices are displayed as */
- /* buttons, one button is the default, another is a cancel choice */
- int (*ask)(const char *title, const char **answers,
- int def, int cancel,const char *question,...);
-
- /* Similar to the above, except here the choices are presented as a */
- /* scrolled list. Return -1 if the user cancels */
- int (*choose)(const char *title, const char **answers,
- int def, int cancel,const char *question,...);
-
- /* Multiple things can be selected, sel is an in/out parameter, one byte */
- /* per entry in the choice array. 0=> not selected, 1=>selected */
- int (*choose_multiple)(char *title, const char **choices,char *sel,
- int cnt, char *buts[2], const char *question,...);
-
- /* Here we want a string. We are passed a default answer (or NULL) */
- /* The return is NULL on cancel, otherwise a string which must be freed */
- char *(*ask_string)(const char *title,
- const char *def,const char *question,...);
- /* Same as above, except for entering a password */
- char *(*ask_password)(const char *title,
- const char *def,const char *question,...);
-
- /* The next two routines are only used in the python interface to provide */
- /* a python script running in ff a way to open a file */
- /* Arguments are a window title for the dlg, a default file (or NULL), and */
- /* an initial filter (unix wildcards) or NULL */
- char *(*open_file)(const char *title, const char *defaultfile,
- const char *initial_filter);
- char *(*saveas_file)(const char *title, const char *defaultfile,
- const char *initial_filter);
-
- /* These routines are for a progress indicator */
- void (*progress_start)(int delay, const char *title, const char *line1,
- const char *line2, int tot, int stages);
- void (*progress_end)(void);
- void (*progress_show)(void);
- void (*progress_enable_stop)(int);
- int (*progress_next)(void);
- int (*progress_next_stage)(void);
- int (*progress_increment)(int);
- void (*progress_change_line1)(const char *);
- void (*progress_change_line2)(const char *);
- void (*progress_pause)(void);
- void (*progress_resume)(void);
- void (*progress_change_stages)(int);
- void (*progress_change_total)(int);
- int (*progress_reset)(void);
-
- void (*allow_events)(void);
-
- /* These next few provide friendly names of various opentype tags */
- /* The ui version will probably be translated, while the non-ui list */
- /* will probably not. The distinction isn't necessary, but is present in ff*/
- const char *(*strid)(int);
- const char *(*mslang)(int);
-
- /* pops up a dlg asking user whether to do remove overlap (and other stuff)*/
- /* when loading an eps file with strokes, etc. */
- int (*stroke_flags)(void);
-};
-extern struct ui_interface *ui_interface;
-
-#define IError (ui_interface->ierror)
-#define LogError (ui_interface->logwarning)
-#define ff_post_notice (ui_interface->post_warning)
-#define ff_post_error (ui_interface->post_error)
-#define ff_ask (ui_interface->ask)
-#define ff_choose (ui_interface->choose)
-#define ff_choose_multiple (ui_interface->choose_multiple)
-#define ff_ask_string (ui_interface->ask_string)
-#define ff_ask_password (ui_interface->ask_password)
-
-#define ff_open_filename (ui_interface->open_file)
-#define ff_save_filename (ui_interface->saveas_file)
-
-#define ff_progress_start_indicator (ui_interface->progress_start)
-#define ff_progress_end_indicator (ui_interface->progress_end)
-#define ff_progress_show (ui_interface->progress_show)
-#define ff_progress_enable_stop (ui_interface->progress_enable_stop)
-#define ff_progress_next (ui_interface->progress_next)
-#define ff_progress_next_stage (ui_interface->progress_next_stage)
-#define ff_progress_increment (ui_interface->progress_increment)
-#define ff_progress_change_line1 (ui_interface->progress_change_line1)
-#define ff_progress_change_line2 (ui_interface->progress_change_line2)
-#define ff_progress_pause_timer (ui_interface->progress_pause)
-#define ff_progress_resume_timer (ui_interface->progress_resume)
-#define ff_progress_change_stages (ui_interface->progress_change_stages)
-#define ff_progress_change_total (ui_interface->progress_change_total)
-#define ff_progress_reset (ui_interface->progress_reset)
-
-#define ff_progress_allow_events (ui_interface->allow_events)
-
-#define TTFNameIds (ui_interface->strid)
-#define MSLangString (ui_interface->mslang)
-
-#define PsStrokeFlagsDlg (ui_interface->stroke_flags)
-
-void FF_SetUiInterface(struct ui_interface *uii);
-
-/* ************************************************************************** */
-/* Preferences */
-/* ************************************************************************** */
-struct val;
-
-struct prefs_interface {
- void (*save_prefs)(int not_if_running_script);
- void (*load_prefs)(void);
- int (*get_prefs)(char *name,struct val *value);
- int (*set_prefs)(char *name,struct val *val1, struct val *val2);
- char *(*get_exe_share_dir)(void);
- void (*init_prefs)(void);
-};
-extern struct prefs_interface *prefs_interface;
-
-#define SavePrefs (prefs_interface->save_prefs)
-#define LoadPrefs (prefs_interface->load_prefs)
-#define GetPrefs (prefs_interface->get_prefs)
-#define SetPrefs (prefs_interface->set_prefs)
-#define getFontForgeShareDir (prefs_interface->get_exe_share_dir)
-#define SetDefaults (prefs_interface->init_prefs)
-
-void FF_SetPrefsInterface(struct prefs_interface *prefsi);
-
-/* ************************************************************************** */
-/* Updating glyph windows */
-/* ************************************************************************** */
-
-struct splinechar;
-struct layer;
-
-struct sc_interface {
- /* Update all windows looking at this glyph */
- void (*update_all)(struct splinechar *);
-
- /* Background images or kerning info have changed for this glyph and */
- /* all windows displaying them need to be refreshed */
- void (*out_of_date_background)(struct splinechar *);
-
- /* The name or code point or encoding of this glyph has changed */
- /* update all window titles of any windows looking at us */
- void (*refresh_titles)(struct splinechar *);
-
- /* The hints of the glyph have changed */
- void (*hints_changed)(struct splinechar *);
-
- /* Mark the glyph as changed, and force an update */
- void (*glyph_changed_update)(struct splinechar *,int layer);
-
- /* As above, except this time the change might take the glyph back to */
- /* an "unchanged" state (ie. an Undo) */
- void (*glyph__changed_update)(struct splinechar *,int layer,int);
-
- /* The glyph's instructions have changed, so any dlgs looking at */
- /* our instructions need to be updated */
- void (*instructions_changed)(struct splinechar *sc);
-
- /* We are removing this glyph (or something like it), get rid of any */
- /* glyph outline windows which display it */
- void (*close_all_windows)(struct splinechar *);
-
- /* Called when a multilayered glyph increases its layer count */
- /* the charview needs to add more layers to its layer window, etc. */
- void (*more_layers)(struct splinechar *, struct layer *);
-};
-extern struct sc_interface *sc_interface;
-
-#define SCUpdateAll (sc_interface->update_all)
-#define SCOutOfDateBackground (sc_interface->out_of_date_background)
-#define SCRefreshTitles (sc_interface->refresh_titles)
-#define SCHintsChanged (sc_interface->hints_changed)
-#define _SCCharChangedUpdate (sc_interface->glyph__changed_update)
-#define SCCharChangedUpdate (sc_interface->glyph_changed_update)
-#define SCMarkInstrDlgAsChanged (sc_interface->instructions_changed)
-#define SCCloseAllViews (sc_interface->close_all_windows)
-#define SCMoreLayers (sc_interface->more_layers)
-
-void FF_SetSCInterface(struct sc_interface *sci);
-
-/* ************************************************************************** */
-/* Updating glyph windows 2 */
-/* ************************************************************************** */
-
-struct charviewbase;
-struct splinefont;
-
-struct cv_interface {
- /* Update all windows looking at what this char window looks at */
- /* which might be a glyph, or perhaps the grid layer */
- /* And mark as changed */
- void (*glyph_changed_update)(struct charviewbase *);
- void (*_glyph_changed_update)(struct charviewbase *, int);
-
- /* A glyph's name has changed find all charviews with tabs with that name */
- /* and update those tabs */
- void (*glyph_name_change)(struct splinefont *sf, char *oldname, char *newname);
-
- /* We've added a layer to a font */
- void (*layer_palette_check)(struct splinefont *sf);
-};
-extern struct cv_interface *cv_interface;
-
-#define CVCharChangedUpdate (cv_interface->glyph_changed_update)
-#define _CVCharChangedUpdate (cv_interface->_glyph_changed_update)
-#define CVGlyphRenameFixup (cv_interface->glyph_name_change)
-#define CVLayerPaletteCheck (cv_interface->layer_palette_check)
-
-void FF_SetCVInterface(struct cv_interface *cvi);
-
-/* ************************************************************************** */
-/* Updating bitmap windows */
-/* ************************************************************************** */
-
-struct bdfchar;
-
-struct bc_interface {
- /* Update all windows looking at this bitmap glyph */
- /* And mark as changed */
- void (*glyph_changed_update)(struct bdfchar *);
-
- /* Force a refresh on all open bitmap windows of this glyph */
- void (*refresh_all)(struct bdfchar *);
-
- /* Destroy all open bitmap windows of this glyph */
- void (*destroy_all)(struct bdfchar *);
-};
-extern struct bc_interface *bc_interface;
-
-#define BCCharChangedUpdate (bc_interface->glyph_changed_update)
-#define BCRefreshAll (bc_interface->refresh_all)
-#define BCDestroyAll (bc_interface->destroy_all)
-
-void FF_SetBCInterface(struct bc_interface *bci);
-
-/* ************************************************************************** */
-/* Access to metrics views */
-/* ************************************************************************** */
-
-struct metricsview;
-struct splinefont;
-
-struct mv_interface {
- /* Number of glyphs displayed in the view */
- int (*glyph_cnt)(struct metricsview *);
-
- /* Access to the i'th member */
- struct splinechar *(*get_glyph)(struct metricsview *,int);
-
- /* Kerning information for this font has changed. Remetric the metric views*/
- /* Now-a-days, call this when any kind of lookup information changes, not */
- /* just kerning */
- void (*rekern)(struct splinefont *);
-
- /* Close any metrics views associated with this font */
- void (*sf_close_metrics)(struct splinefont *sf);
-};
-extern struct mv_interface *mv_interface;
-
-#define MVGlyphCount (mv_interface->glyph_cnt)
-#define MVGlyphIndex (mv_interface->get_glyph)
-#define MVReKernAll (mv_interface->rekern)
-#define MVDestroyAll (mv_interface->sf_close_metrics)
-
-void FF_SetMVInterface(struct mv_interface *mvi);
-
-/* ************************************************************************** */
-/* Access to font info */
-/* ************************************************************************** */
-struct otlookup;
-
-struct fi_interface {
- /* Insert a new lookup into the fontinfo lookup list */
- void (*insert_lookup)(struct splinefont *, struct otlookup *);
-
- /* Merge lookup in from another font */
- void (*copy_into)(struct splinefont *, struct splinefont *,
- struct otlookup *, struct otlookup *, int, struct otlookup *);
-
- /* Removes any font info window for this font */
- void (*destroy)(struct splinefont *);
-};
-extern struct fi_interface *fi_interface;
-
-#define FISortInsertLookup (fi_interface->insert_lookup)
-#define FIOTLookupCopyInto (fi_interface->copy_into)
-#define FontInfo_Destroy (fi_interface->destroy)
-
-void FF_SetFIInterface(struct fi_interface *fii);
-
-/* ************************************************************************** */
-/* Updating font windows */
-/* ************************************************************************** */
-
-struct fontviewbase;
-struct bdffont;
-
-struct fv_interface {
- /* Create a new font view. Whatever that may entail */
- struct fontviewbase *(*create)(struct splinefont *,int hide);
-
- /* Create a new font view but without attaching it to a window */
- struct fontviewbase *(*_create)(struct splinefont *);
-
- /* Free a font view (we assume all windows have already been destroyed) */
- void (*close)(struct fontviewbase *);
-
- /* Free a font view (we assume all windows have already been destroyed) */
- void (*free)(struct fontviewbase *);
-
- /* Set the window title of this fontview */
- void (*set_title)(struct fontviewbase *);
-
- /* Set the window title of all fontviews associated with this font */
- void (*set_titles)(struct splinefont *);
-
- /* Refresh all displays of all fontviews associated with this font */
- void (*refresh_all)(struct splinefont *);
-
- /* Reformat this particular fontview (after encoding change, etc) */
- void (*reformat_one)(struct fontviewbase *);
-
- /* Reformat all fontviews associated with this font */
- void (*reformat_all)(struct splinefont *);
-
- /* The active layer has changed. Possibly because the old one was deleted */
- void (*layer_changed)(struct fontviewbase *);
-
- /* toggle the change indicator of this glyph in the font view */
- void (*flag_glyph_changed)(struct splinechar *);
-
- /* Retrieve the window's size in rows and columns */
- int (*win_info)(struct fontviewbase *, int *cols, int *rows);
-
- /* Is this font currently open? (It was open once, this check is to make */
- /* sure the user hasn't closed it since they copied from it -- so we can */
- /* follow references appropriately if the font we are pasting into doesn't*/
- /* have the needed glyph */
- int (*font_is_active)(struct splinefont *);
-
- /* Sometimes we just need a fontview, any fontview as a last resort fallback*/
- struct fontviewbase *(*first_font)(void);
-
- /* Append this fontview to the list of them */
- struct fontviewbase *(*append)(struct fontviewbase *);
-
- /* Look through all loaded fontviews and see if any contains a font */
- /* which lives in the given filename */
- struct splinefont *(*font_of_filename)(const char *);
-
- /* We've just added some extra encoding slots, which means we may need */
- /* to increase the number of rows in the fontview display and perhaps */
- /* adjust its scrollbar */
- void (*extra_enc_slots)(struct fontviewbase *,int new_enc_max);
-
- /* My fontviews contain a glyph cache (a BDFPieceMeal font) whenever */
- /* more glyphs are added to the font, more bitmap glyph slots need to */
- /* be added to the font cache */
- void (*bigger_glyph_cache)(struct fontviewbase *,int new_glyph_cnt);
-
- /* If we want to change the font displayed in a fontview */
- void (*change_display_bitmap)(struct fontviewbase *, struct bdffont *);
-
- /* We just deleted the active bitmap, so switch to a rasteriztion of the outlines */
- void (*display_filled)(struct fontviewbase *);
-
- /* When we revert a font we need to change the alegence of all outline */
- /* glyph windows to the new value of the font */
- void (*reattach_cvs)(struct splinefont *old, struct splinefont *new);
-
- /* deselect any selected glyphs */
- void (*deselect_all)(struct fontviewbase *);
-
- /* Scroll (or whatever) the fontview so that the desired */
- /* gid is displayed */
- void (*display_gid)(struct fontviewbase *,int gid);
-
- /* Scroll (or whatever) the fontview so that the desired */
- /* encoding is displayed */
- void (*display_enc)(struct fontviewbase *,int enc);
-
- /* Scroll (or whatever) the fontview so that the desired */
- /* glyph is displayed */
- void (*select_gid)(struct fontviewbase *,int gid);
-
- /* Close any open glyph instruction windows in the font */
- int (*close_all_instrs)(struct splinefont *);
-};
-extern struct fv_interface *fv_interface;
-
-#define FontViewCreate (fv_interface->create)
-#define _FontViewCreate (fv_interface->_create)
-#define FontViewClose (fv_interface->close)
-#define FontViewFree (fv_interface->free)
-#define FVSetTitle (fv_interface->set_title)
-#define FVSetTitles (fv_interface->set_titles)
-#define FVRefreshAll (fv_interface->refresh_all)
-#define FontViewReformatOne (fv_interface->reformat_one)
-#define FontViewReformatAll (fv_interface->reformat_all)
-#define FontViewLayerChanged (fv_interface->layer_changed)
-#define FVToggleCharChanged (fv_interface->flag_glyph_changed)
-#define FVWinInfo (fv_interface->win_info)
-#define SFIsActive (fv_interface->font_is_active)
-#define FontViewFirst (fv_interface->first_font)
-#define FVAppend (fv_interface->append)
-#define FontWithThisFilename (fv_interface->font_of_filename)
-#define FVAdjustScrollBarRows (fv_interface->extra_enc_slots)
-#define FVBiggerGlyphCache (fv_interface->bigger_glyph_cache)
-#define FVChangeDisplayBitmap (fv_interface->change_display_bitmap)
-#define FVShowFilled (fv_interface->display_filled)
-#define FVReattachCVs (fv_interface->reattach_cvs)
-#define FVDisplayGID (fv_interface->display_gid)
-#define FVDisplayEnc (fv_interface->display_enc)
-#define FVChangeGID (fv_interface->select_gid)
-#define SFCloseAllInstrs (fv_interface->close_all_instrs)
-
-void FF_SetFVInterface(struct fv_interface *fvi);
-
-/* ************************************************************************** */
-/* Clibboard access (copy/paste) */
-/* ************************************************************************** */
-
-struct clip_interface {
- /* Announce we own the clipboard selection */
- void (*grab_clip)(void);
- /* Either place data in the clipboard of a given type, or */
- /* provide a routine to call which will give data on demand */
- /* (and another routine to clean things up) */
- void (*add_data_type)(const char *type, void *data, int cnt, int size,
- void *(*gendata)(void *,int32 *len), void (*freedata)(void *));
- /* Does the clipboard contain something of the given type? */
- int (*clip_has_type)(const char *mimetype);
- /* Ask for the clipboard, and waits (and returns) for the response */
- void *(*request_clip)(const char *mimetype,int *len);
-
-};
-extern struct clip_interface *clip_interface;
-
-#define ClipboardGrab (clip_interface->grab_clip)
-#define ClipboardAddDataType (clip_interface->add_data_type)
-#define ClipboardRequest (clip_interface->request_clip)
-#define ClipboardHasType (clip_interface->clip_has_type)
-
-void FF_SetClipInterface(struct clip_interface *clipi);
-
-extern const char *NOUI_TTFNameIds(int id);
-extern const char *NOUI_MSLangString(int language);
-#endif
diff --git a/Build/source/texk/web2c/luatexdir/luafontloader/fontforge/fontforge/unicoderange.h b/Build/source/texk/web2c/luatexdir/luafontloader/fontforge/fontforge/unicoderange.h
deleted file mode 100644
index 02dca59b0cd..00000000000
--- a/Build/source/texk/web2c/luatexdir/luafontloader/fontforge/fontforge/unicoderange.h
+++ /dev/null
@@ -1,38 +0,0 @@
-/* Copyright (C) 2006-2008 by George Williams */
-/*
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are met:
-
- * Redistributions of source code must retain the above copyright notice, this
- * list of conditions and the following disclaimer.
-
- * Redistributions in binary form must reproduce the above copyright notice,
- * this list of conditions and the following disclaimer in the documentation
- * and/or other materials provided with the distribution.
-
- * The name of the author may not be used to endorse or promote products
- * derived from this software without specific prior written permission.
-
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
- * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
- * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
- * EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
- * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
- * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
- * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
- * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-extern struct unicoderange {
- char *name; /* The range's name */
- int32 first, last, defined;
- /* The first codepoint, last codepoint in the range */
- /* and a codepoint which actually has a character */
- /* associated with it */
- uint8 display;
- uint8 unassigned; /* No characters in this range are assigned */
- int actual; /* Count of assigned codepoints in this range */
-} unicoderange[];
-