~ubuntu-branches/ubuntu/jaunty/luatex/jaunty

« back to all changes in this revision

Viewing changes to src/libs/luafontforge/fontforge/fontforge/fontinfo.c

  • Committer: Bazaar Package Importer
  • Author(s): Norbert Preining
  • Date: 2007-09-24 12:56:11 UTC
  • Revision ID: james.westby@ubuntu.com-20070924125611-a8ge689azbptxvla
Tags: upstream-0.11.2
ImportĀ upstreamĀ versionĀ 0.11.2

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/* Copyright (C) 2000-2007 by George Williams */
 
2
/*
 
3
 * Redistribution and use in source and binary forms, with or without
 
4
 * modification, are permitted provided that the following conditions are met:
 
5
 
 
6
 * Redistributions of source code must retain the above copyright notice, this
 
7
 * list of conditions and the following disclaimer.
 
8
 
 
9
 * Redistributions in binary form must reproduce the above copyright notice,
 
10
 * this list of conditions and the following disclaimer in the documentation
 
11
 * and/or other materials provided with the distribution.
 
12
 
 
13
 * The name of the author may not be used to endorse or promote products
 
14
 * derived from this software without specific prior written permission.
 
15
 
 
16
 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
 
17
 * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
 
18
 * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
 
19
 * EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
 
20
 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
 
21
 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
 
22
 * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
 
23
 * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
 
24
 * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
 
25
 * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 
26
 */
 
27
#include "pfaeditui.h"
 
28
#include "ofl.h"
 
29
#include <ustring.h>
 
30
#include <chardata.h>
 
31
#include <utype.h>
 
32
#include "unicoderange.h"
 
33
#ifndef FONTFORGE_CONFIG_NO_WINDOWING_UI
 
34
extern int _GScrollBar_Width;
 
35
#endif
 
36
#include <gkeysym.h>
 
37
#include <math.h>
 
38
#include <unistd.h>
 
39
#include <time.h>
 
40
 
 
41
#ifdef LUA_FF_LIB
 
42
#define Isspace(a) (a==' ')
 
43
#else
 
44
#define Isspace isspace
 
45
#endif
 
46
 
 
47
#ifndef LUA_FF_LIB
 
48
static int last_aspect=0;
 
49
#endif
 
50
 
 
51
GTextInfo emsizes[] = {
 
52
    { (unichar_t *) "1000", NULL, 0, 0, NULL, NULL, 0, 0, 0, 0, 0, 0, 1},
 
53
    { (unichar_t *) "1024", NULL, 0, 0, NULL, NULL, 0, 0, 0, 0, 0, 0, 1},
 
54
    { (unichar_t *) "2048", NULL, 0, 0, NULL, NULL, 0, 0, 0, 0, 0, 0, 1},
 
55
    { (unichar_t *) "4096", NULL, 0, 0, NULL, NULL, 0, 0, 0, 0, 0, 0, 1},
 
56
    { NULL }
 
57
};
 
58
 
 
59
GTextInfo interpretations[] = {
 
60
/* GT: See the long comment at "Property|New" */
 
61
/* GT: The msgstr should contain a translation of "None", ignore "Interpretation|" */
 
62
/* GT: In french this could be "Aucun" or "Aucune" depending on the gender */
 
63
/* GT:  of "Interpretation" */
 
64
    { (unichar_t *) N_("Interpretation|None"), NULL, 0, 0, (void *) ui_none, NULL, 0, 0, 0, 0, 0, 0, 1},
 
65
/*  { (unichar_t *) N_("Adobe Public Use Defs."), NULL, 0, 0, (void *) ui_adobe, NULL, 0, 0, 0, 0, 0, 0, 1}, */
 
66
/*  { (unichar_t *) N_("Greek"), NULL, 0, 0, (void *) ui_greek, NULL, 0, 0, 0, 0, 0, 0, 1}, */
 
67
    { (unichar_t *) N_("Japanese"), NULL, 0, 0, (void *) ui_japanese, NULL, 0, 0, 0, 0, 0, 0, 1},
 
68
    { (unichar_t *) N_("Traditional Chinese"), NULL, 0, 0, (void *) ui_trad_chinese, NULL, 0, 0, 0, 0, 0, 0, 1},
 
69
    { (unichar_t *) N_("Simplified Chinese"), NULL, 0, 0, (void *) ui_simp_chinese, NULL, 0, 0, 0, 0, 0, 0, 1},
 
70
    { (unichar_t *) N_("Korean"), NULL, 0, 0, (void *) ui_korean, NULL, 0, 0, 0, 0, 0, 0, 1},
 
71
/*  { (unichar_t *) N_("AMS Public Use"), NULL, 0, 0, (void *) ui_ams, NULL, 0, 0, 0, 0, 0, 0, 1}, */
 
72
    { NULL }};
 
73
GTextInfo macstyles[] = {
 
74
    { (unichar_t *) N_("MacStyles|Bold"), NULL, 0, 0, (void *) sf_bold, NULL, 0, 0, 0, 0, 0, 0, 1},
 
75
    { (unichar_t *) N_("MacStyles|Italic"), NULL, 0, 0, (void *) sf_italic, NULL, 0, 0, 0, 0, 0, 0, 1},
 
76
    { (unichar_t *) N_("MacStyles|Condense"), NULL, 0, 0, (void *) sf_condense, NULL, 0, 0, 0, 0, 0, 0, 1},
 
77
    { (unichar_t *) N_("MacStyles|Expand"), NULL, 0, 0, (void *) sf_extend, NULL, 0, 0, 0, 0, 0, 0, 1},
 
78
    { (unichar_t *) N_("MacStyles|Underline"), NULL, 0, 0, (void *) sf_underline, NULL, 0, 0, 0, 0, 0, 0, 1},
 
79
    { (unichar_t *) N_("MacStyles|Outline"), NULL, 0, 0, (void *) sf_outline, NULL, 0, 0, 0, 0, 0, 0, 1},
 
80
    { (unichar_t *) N_("MacStyles|Shadow"), NULL, 0, 0, (void *) sf_shadow, NULL, 0, 0, 0, 0, 0, 0, 1},
 
81
    { NULL }};
 
82
static GTextInfo widthclass[] = {
 
83
    { (unichar_t *) N_("Ultra-Condensed (50%)"), NULL, 0, 0, (void *) 1, NULL, 0, 0, 0, 0, 0, 0, 1},
 
84
    { (unichar_t *) N_("Extra-Condensed (62.5%)"), NULL, 0, 0, (void *) 2, NULL, 0, 0, 0, 0, 0, 0, 1},
 
85
    { (unichar_t *) N_("Condensed (75%)"), NULL, 0, 0, (void *) 3, NULL, 0, 0, 0, 0, 0, 0, 1},
 
86
    { (unichar_t *) N_("Semi-Condensed (87.5%)"), NULL, 0, 0, (void *) 4, NULL, 0, 0, 0, 0, 0, 0, 1},
 
87
    { (unichar_t *) N_("Medium (100%)"), NULL, 0, 0, (void *) 5, NULL, 0, 0, 0, 0, 0, 0, 1},
 
88
    { (unichar_t *) N_("Semi-Expanded (112.5%)"), NULL, 0, 0, (void *) 6, NULL, 0, 0, 0, 0, 0, 0, 1},
 
89
    { (unichar_t *) N_("Expanded (125%)"), NULL, 0, 0, (void *) 7, NULL, 0, 0, 0, 0, 0, 0, 1},
 
90
    { (unichar_t *) N_("Extra-Expanded (150%)"), NULL, 0, 0, (void *) 8, NULL, 0, 0, 0, 0, 0, 0, 1},
 
91
    { (unichar_t *) N_("Ultra-Expanded (200%)"), NULL, 0, 0, (void *) 9, NULL, 0, 0, 0, 0, 0, 0, 1},
 
92
    { NULL }};
 
93
static GTextInfo weightclass[] = {
 
94
    { (unichar_t *) N_("100 Thin"), NULL, 0, 0, NULL, NULL, 0, 0, 0, 0, 0, 0, 1},
 
95
    { (unichar_t *) N_("200 Extra-Light"), NULL, 0, 0, NULL, NULL, 0, 0, 0, 0, 0, 0, 1},
 
96
    { (unichar_t *) N_("300 Light"), NULL, 0, 0, NULL, NULL, 0, 0, 0, 0, 0, 0, 1},
 
97
    { (unichar_t *) N_("400 Book"), NULL, 0, 0, NULL, NULL, 0, 0, 0, 0, 0, 0, 1},
 
98
    { (unichar_t *) N_("500 Medium"), NULL, 0, 0, NULL, NULL, 0, 0, 0, 0, 0, 0, 1},
 
99
    { (unichar_t *) N_("600 Demi-Bold"), NULL, 0, 0, NULL, NULL, 0, 0, 0, 0, 0, 0, 1},
 
100
    { (unichar_t *) N_("700 Bold"), NULL, 0, 0, NULL, NULL, 0, 0, 0, 0, 0, 0, 1},
 
101
    { (unichar_t *) N_("800 Heavy"), NULL, 0, 0, NULL, NULL, 0, 0, 0, 0, 0, 0, 1},
 
102
    { (unichar_t *) N_("900 Black"), NULL, 0, 0, NULL, NULL, 0, 0, 0, 0, 0, 0, 1},
 
103
    { NULL }};
 
104
static GTextInfo fstype[] = {
 
105
    { (unichar_t *) N_("Never Embed/No Editing"), NULL, 0, 0, (void *) 0x02, NULL, 0, 0, 0, 0, 0, 0, 1},
 
106
    { (unichar_t *) N_("Printable Document"), NULL, 0, 0, (void *) 0x04, NULL, 0, 0, 0, 0, 0, 0, 1},
 
107
    { (unichar_t *) N_("Editable Document"), NULL, 0, 0, (void *) 0x08, NULL, 0, 0, 0, 0, 0, 0, 1},
 
108
    { (unichar_t *) N_("Installable Font"), NULL, 0, 0, (void *) 0x00, NULL, 0, 0, 0, 0, 0, 0, 1},
 
109
    { NULL }};
 
110
static GTextInfo pfmfamily[] = {
 
111
    { (unichar_t *) N_("Serif"), NULL, 0, 0, (void *) 0x11, NULL, 0, 0, 0, 0, 0, 0, 1},
 
112
    { (unichar_t *) N_("Sans-Serif"), NULL, 0, 0, (void *) 0x21, NULL, 0, 0, 0, 0, 0, 0, 1},
 
113
    { (unichar_t *) N_("Monospace"), NULL, 0, 0, (void *) 0x31, NULL, 0, 0, 0, 0, 0, 0, 1},
 
114
/* GT: See the long comment at "Property|New" */
 
115
/* GT: The msgstr should contain a translation of "Script", ignore "cursive|" */
 
116
/* GT: English uses "script" to me a general writing style (latin, greek, kanji) */
 
117
/* GT: and the cursive handwriting style. Here we mean cursive handwriting. */
 
118
    { (unichar_t *) N_("cursive|Script"), NULL, 0, 0, (void *) 0x41, NULL, 0, 0, 0, 0, 0, 0, 1},
 
119
    { (unichar_t *) N_("Decorative"), NULL, 0, 0, (void *) 0x51, NULL, 0, 0, 0, 0, 0, 0, 1},
 
120
    { NULL }};
 
121
static GTextInfo ibmfamily[] = {
 
122
    { (unichar_t *) N_("No Classification"), NULL, 0, 0, (void *) 0, NULL, 0, 0, 0, 0, 0, 0, 1},
 
123
    { (unichar_t *) N_("Old Style Serifs"), NULL, 0, 0, (void *) 0x100, NULL, 0, 0, 0, 0, 0, 0, 1},
 
124
    { (unichar_t *) N_("OSS Rounded Legibility"), NULL, 0, 0, (void *) 0x101, NULL, 0, 0, 0, 0, 0, 0, 1},
 
125
    { (unichar_t *) N_("OSS Geralde"), NULL, 0, 0, (void *) 0x102, NULL, 0, 0, 0, 0, 0, 0, 1},
 
126
    { (unichar_t *) N_("OSS Venetian"), NULL, 0, 0, (void *) 0x103, NULL, 0, 0, 0, 0, 0, 0, 1},
 
127
    { (unichar_t *) N_("OSS Modified Venetian"), NULL, 0, 0, (void *) 0x104, NULL, 0, 0, 0, 0, 0, 0, 1},
 
128
    { (unichar_t *) N_("OSS Dutch Modern"), NULL, 0, 0, (void *) 0x105, NULL, 0, 0, 0, 0, 0, 0, 1},
 
129
    { (unichar_t *) N_("OSS Dutch Trad"), NULL, 0, 0, (void *) 0x106, NULL, 0, 0, 0, 0, 0, 0, 1},
 
130
    { (unichar_t *) N_("OSS Contemporary"), NULL, 0, 0, (void *) 0x107, NULL, 0, 0, 0, 0, 0, 0, 1},
 
131
    { (unichar_t *) N_("OSS Calligraphic"), NULL, 0, 0, (void *) 0x108, NULL, 0, 0, 0, 0, 0, 0, 1},
 
132
    { (unichar_t *) N_("OSS Miscellaneous"), NULL, 0, 0, (void *) 0x10f, NULL, 0, 0, 0, 0, 0, 0, 1},
 
133
    { (unichar_t *) N_("Transitional Serifs"), NULL, 0, 0, (void *) 0x200, NULL, 0, 0, 0, 0, 0, 0, 1},
 
134
    { (unichar_t *) N_("TS Direct Line"), NULL, 0, 0, (void *) 0x201, NULL, 0, 0, 0, 0, 0, 0, 1},
 
135
    { (unichar_t *) N_("TS Script"), NULL, 0, 0, (void *) 0x202, NULL, 0, 0, 0, 0, 0, 0, 1},
 
136
    { (unichar_t *) N_("TS Miscellaneous"), NULL, 0, 0, (void *) 0x20f, NULL, 0, 0, 0, 0, 0, 0, 1},
 
137
    { (unichar_t *) N_("Modern Serifs"), NULL, 0, 0, (void *) 0x300, NULL, 0, 0, 0, 0, 0, 0, 1},
 
138
    { (unichar_t *) N_("MS Italian"), NULL, 0, 0, (void *) 0x301, NULL, 0, 0, 0, 0, 0, 0, 1},
 
139
    { (unichar_t *) N_("MS Script"), NULL, 0, 0, (void *) 0x302, NULL, 0, 0, 0, 0, 0, 0, 1},
 
140
    { (unichar_t *) N_("MS Miscellaneous"), NULL, 0, 0, (void *) 0x30f, NULL, 0, 0, 0, 0, 0, 0, 1},
 
141
    { (unichar_t *) N_("Clarendon Serifs"), NULL, 0, 0, (void *) 0x400, NULL, 0, 0, 0, 0, 0, 0, 1},
 
142
    { (unichar_t *) N_("CS Clarendon"), NULL, 0, 0, (void *) 0x401, NULL, 0, 0, 0, 0, 0, 0, 1},
 
143
    { (unichar_t *) N_("CS Modern"), NULL, 0, 0, (void *) 0x402, NULL, 0, 0, 0, 0, 0, 0, 1},
 
144
    { (unichar_t *) N_("CS Traditional"), NULL, 0, 0, (void *) 0x403, NULL, 0, 0, 0, 0, 0, 0, 1},
 
145
    { (unichar_t *) N_("CS Newspaper"), NULL, 0, 0, (void *) 0x404, NULL, 0, 0, 0, 0, 0, 0, 1},
 
146
    { (unichar_t *) N_("CS Stub Serif"), NULL, 0, 0, (void *) 0x405, NULL, 0, 0, 0, 0, 0, 0, 1},
 
147
    { (unichar_t *) N_("CS Monotone"), NULL, 0, 0, (void *) 0x406, NULL, 0, 0, 0, 0, 0, 0, 1},
 
148
    { (unichar_t *) N_("CS Typewriter"), NULL, 0, 0, (void *) 0x407, NULL, 0, 0, 0, 0, 0, 0, 1},
 
149
    { (unichar_t *) N_("CS Miscellaneous"), NULL, 0, 0, (void *) 0x40f, NULL, 0, 0, 0, 0, 0, 0, 1},
 
150
    { (unichar_t *) N_("Slab Serifs"), NULL, 0, 0, (void *) 0x500, NULL, 0, 0, 0, 0, 0, 0, 1},
 
151
    { (unichar_t *) N_("Slab Serifs|SS Monotone"), NULL, 0, 0, (void *) 0x501, NULL, 0, 0, 0, 0, 0, 0, 1},
 
152
    { (unichar_t *) N_("Slab Serifs|SS Humanist"), NULL, 0, 0, (void *) 0x502, NULL, 0, 0, 0, 0, 0, 0, 1},
 
153
    { (unichar_t *) N_("Slab Serifs|SS Geometric"), NULL, 0, 0, (void *) 0x503, NULL, 0, 0, 0, 0, 0, 0, 1},
 
154
    { (unichar_t *) N_("Slab Serifs|SS Swiss"), NULL, 0, 0, (void *) 0x504, NULL, 0, 0, 0, 0, 0, 0, 1},
 
155
    { (unichar_t *) N_("Slab Serifs|SS Typewriter"), NULL, 0, 0, (void *) 0x505, NULL, 0, 0, 0, 0, 0, 0, 1},
 
156
    { (unichar_t *) N_("Slab Serifs|SS Miscellaneous"), NULL, 0, 0, (void *) 0x50f, NULL, 0, 0, 0, 0, 0, 0, 1},
 
157
    { (unichar_t *) N_("Freeform Serifs"), NULL, 0, 0, (void *) 0x700, NULL, 0, 0, 0, 0, 0, 0, 1},
 
158
    { (unichar_t *) N_("FS Modern"), NULL, 0, 0, (void *) 0x701, NULL, 0, 0, 0, 0, 0, 0, 1},
 
159
    { (unichar_t *) N_("FS Miscellaneous"), NULL, 0, 0, (void *) 0x70f, NULL, 0, 0, 0, 0, 0, 0, 1},
 
160
    { (unichar_t *) N_("Sans-Serif"), NULL, 0, 0, (void *) 0x800, NULL, 0, 0, 0, 0, 0, 0, 1},
 
161
    { (unichar_t *) N_("Sans-Serif|SS IBM NeoGrotesque Gothic"), NULL, 0, 0, (void *) 0x801, NULL, 0, 0, 0, 0, 0, 0, 1},
 
162
    { (unichar_t *) N_("Sans-Serif|SS Humanist"), NULL, 0, 0, (void *) 0x802, NULL, 0, 0, 0, 0, 0, 0, 1},
 
163
    { (unichar_t *) N_("Sans-Serif|SS Low-x Round Geometric"), NULL, 0, 0, (void *) 0x803, NULL, 0, 0, 0, 0, 0, 0, 1},
 
164
    { (unichar_t *) N_("Sans-Serif|SS High-x Round Geometric"), NULL, 0, 0, (void *) 0x804, NULL, 0, 0, 0, 0, 0, 0, 1},
 
165
    { (unichar_t *) N_("Sans-Serif|SS NeoGrotesque Gothic"), NULL, 0, 0, (void *) 0x805, NULL, 0, 0, 0, 0, 0, 0, 1},
 
166
    { (unichar_t *) N_("Sans-Serif|SS Modified Grotesque Gothic"), NULL, 0, 0, (void *) 0x806, NULL, 0, 0, 0, 0, 0, 0, 1},
 
167
    { (unichar_t *) N_("Sans-Serif|SS Typewriter Gothic"), NULL, 0, 0, (void *) 0x809, NULL, 0, 0, 0, 0, 0, 0, 1},
 
168
    { (unichar_t *) N_("Sans-Serif|SS Matrix"), NULL, 0, 0, (void *) 0x80a, NULL, 0, 0, 0, 0, 0, 0, 1},
 
169
    { (unichar_t *) N_("Sans-Serif|SS Miscellaneous"), NULL, 0, 0, (void *) 0x80f, NULL, 0, 0, 0, 0, 0, 0, 1},
 
170
    { (unichar_t *) N_("Ornamentals"), NULL, 0, 0, (void *) 0x900, NULL, 0, 0, 0, 0, 0, 0, 1},
 
171
    { (unichar_t *) N_("O Engraver"), NULL, 0, 0, (void *) 0x901, NULL, 0, 0, 0, 0, 0, 0, 1},
 
172
    { (unichar_t *) N_("O Black Letter"), NULL, 0, 0, (void *) 0x902, NULL, 0, 0, 0, 0, 0, 0, 1},
 
173
    { (unichar_t *) N_("O Decorative"), NULL, 0, 0, (void *) 0x903, NULL, 0, 0, 0, 0, 0, 0, 1},
 
174
    { (unichar_t *) N_("O Three Dimensional"), NULL, 0, 0, (void *) 0x904, NULL, 0, 0, 0, 0, 0, 0, 1},
 
175
    { (unichar_t *) N_("O Miscellaneous"), NULL, 0, 0, (void *) 0x90f, NULL, 0, 0, 0, 0, 0, 0, 1},
 
176
    { (unichar_t *) N_("Scripts"), NULL, 0, 0, (void *) 0xa00, NULL, 0, 0, 0, 0, 0, 0, 1},
 
177
    { (unichar_t *) N_("S Uncial"), NULL, 0, 0, (void *) 0xa01, NULL, 0, 0, 0, 0, 0, 0, 1},
 
178
    { (unichar_t *) N_("S Brush Joined"), NULL, 0, 0, (void *) 0xa02, NULL, 0, 0, 0, 0, 0, 0, 1},
 
179
    { (unichar_t *) N_("S Formal Joined"), NULL, 0, 0, (void *) 0xa03, NULL, 0, 0, 0, 0, 0, 0, 1},
 
180
    { (unichar_t *) N_("S Monotone Joined"), NULL, 0, 0, (void *) 0xa04, NULL, 0, 0, 0, 0, 0, 0, 1},
 
181
    { (unichar_t *) N_("S Calligraphic"), NULL, 0, 0, (void *) 0xa05, NULL, 0, 0, 0, 0, 0, 0, 1},
 
182
    { (unichar_t *) N_("S Brush Unjoined"), NULL, 0, 0, (void *) 0xa06, NULL, 0, 0, 0, 0, 0, 0, 1},
 
183
    { (unichar_t *) N_("S Formal Unjoined"), NULL, 0, 0, (void *) 0xa07, NULL, 0, 0, 0, 0, 0, 0, 1},
 
184
    { (unichar_t *) N_("S Monotone Unjoined"), NULL, 0, 0, (void *) 0xa08, NULL, 0, 0, 0, 0, 0, 0, 1},
 
185
    { (unichar_t *) N_("S Miscellaneous"), NULL, 0, 0, (void *) 0xa0f, NULL, 0, 0, 0, 0, 0, 0, 1},
 
186
    { (unichar_t *) N_("Symbolic"), NULL, 0, 0, (void *) 0xc00, NULL, 0, 0, 0, 0, 0, 0, 1},
 
187
    { (unichar_t *) N_("Sy Mixed Serif"), NULL, 0, 0, (void *) 0xc03, NULL, 0, 0, 0, 0, 0, 0, 1},
 
188
    { (unichar_t *) N_("Sy Old Style Serif"), NULL, 0, 0, (void *) 0xc06, NULL, 0, 0, 0, 0, 0, 0, 1},
 
189
    { (unichar_t *) N_("Sy Neo-grotesque Sans Serif"), NULL, 0, 0, (void *) 0xc07, NULL, 0, 0, 0, 0, 0, 0, 1},
 
190
    { (unichar_t *) N_("Sy Miscellaneous"), NULL, 0, 0, (void *) 0xc0f, NULL, 0, 0, 0, 0, 0, 0, 1},
 
191
    { NULL }};
 
192
static GTextInfo os2versions[] = {
 
193
    { (unichar_t *) N_("OS2Version|Automatic"), NULL, 0, 0, (void *) 0, NULL, 0, 0, 0, 0, 0, 0, 1},
 
194
    { (unichar_t *) N_("1"), NULL, 0, 0, (void *) 1, NULL, 0, 0, 0, 0, 0, 0, 1},
 
195
    { (unichar_t *) N_("2"), NULL, 0, 0, (void *) 2, NULL, 0, 0, 0, 0, 0, 0, 1},
 
196
    { (unichar_t *) N_("3"), NULL, 0, 0, (void *) 3, NULL, 0, 0, 0, 0, 0, 0, 1},
 
197
    { (unichar_t *) N_("4"), NULL, 0, 0, (void *) 4, NULL, 0, 0, 0, 0, 0, 0, 1},
 
198
    { NULL }};
 
199
#ifndef LUA_FF_LIB
 
200
static GTextInfo gaspversions[] = {
 
201
    { (unichar_t *) N_("0"), NULL, 0, 0, (void *) 0, NULL, 0, 0, 0, 0, 0, 0, 1},
 
202
    { (unichar_t *) N_("1"), NULL, 0, 0, (void *) 1, NULL, 0, 0, 0, 0, 0, 0, 1},
 
203
    { NULL }};
 
204
#endif
 
205
static GTextInfo panfamily[] = {
 
206
    { (unichar_t *) N_("PanoseFamily|Any"), NULL, 0, 0, (void *) 0, NULL, 0, 0, 0, 0, 0, 0, 1},
 
207
    { (unichar_t *) N_("PanoseFamily|No Fit"), NULL, 0, 0, (void *) 1, NULL, 0, 0, 0, 0, 0, 0, 1},
 
208
    { (unichar_t *) N_("Text & Display"), NULL, 0, 0, (void *) 2, NULL, 0, 0, 0, 0, 0, 0, 1},
 
209
/* GT: See the long comment at "Property|New" */
 
210
/* GT: The msgstr should contain a translation of "Script", ignore "cursive|" */
 
211
/* GT: English uses "script" to me a general writing style (latin, greek, kanji) */
 
212
/* GT: and the cursive handwriting style. Here we mean cursive handwriting. */
 
213
    { (unichar_t *) N_("cursive|Script"), NULL, 0, 0, (void *) 3, NULL, 0, 0, 0, 0, 0, 0, 1},
 
214
    { (unichar_t *) N_("Decorative"), NULL, 0, 0, (void *) 4, NULL, 0, 0, 0, 0, 0, 0, 1},
 
215
    { (unichar_t *) N_("Pictorial"), NULL, 0, 0, (void *) 5, NULL, 0, 0, 0, 0, 0, 0, 1},
 
216
    { (unichar_t *) "6", NULL, 0, 0, (void *) 6, NULL, 0, 0, 0, 0, 0, 0, 1},
 
217
    { (unichar_t *) "7", NULL, 0, 0, (void *) 7, NULL, 0, 0, 0, 0, 0, 0, 1},
 
218
    { (unichar_t *) "8", NULL, 0, 0, (void *) 8, NULL, 0, 0, 0, 0, 0, 0, 1},
 
219
    { (unichar_t *) "9", NULL, 0, 0, (void *) 9, NULL, 0, 0, 0, 0, 0, 0, 1},
 
220
    { (unichar_t *) "10", NULL, 0, 0, (void *) 10, NULL, 0, 0, 0, 0, 0, 0, 1},
 
221
    { (unichar_t *) "11", NULL, 0, 0, (void *) 11, NULL, 0, 0, 0, 0, 0, 0, 1},
 
222
    { (unichar_t *) "12", NULL, 0, 0, (void *) 12, NULL, 0, 0, 0, 0, 0, 0, 1},
 
223
    { (unichar_t *) "13", NULL, 0, 0, (void *) 13, NULL, 0, 0, 0, 0, 0, 0, 1},
 
224
    { (unichar_t *) "14", NULL, 0, 0, (void *) 14, NULL, 0, 0, 0, 0, 0, 0, 1},
 
225
    { (unichar_t *) "15", NULL, 0, 0, (void *) 15, NULL, 0, 0, 0, 0, 0, 0, 1},
 
226
    { NULL }};
 
227
static GTextInfo panserifs[] = {
 
228
    { (unichar_t *) N_("PanoseSerifs|Any"), NULL, 0, 0, (void *) 0, NULL, 0, 0, 0, 0, 0, 0, 1},
 
229
    { (unichar_t *) N_("PanoseSerifs|No Fit"), NULL, 0, 0, (void *) 1, NULL, 0, 0, 0, 0, 0, 0, 1},
 
230
    { (unichar_t *) N_("Cove"), NULL, 0, 0, (void *) 2, NULL, 0, 0, 0, 0, 0, 0, 1},
 
231
    { (unichar_t *) N_("Obtuse Cove"), NULL, 0, 0, (void *) 3, NULL, 0, 0, 0, 0, 0, 0, 1},
 
232
    { (unichar_t *) N_("Square Cove"), NULL, 0, 0, (void *) 4, NULL, 0, 0, 0, 0, 0, 0, 1},
 
233
    { (unichar_t *) N_("Obtuse Square Cove"), NULL, 0, 0, (void *) 5, NULL, 0, 0, 0, 0, 0, 0, 1},
 
234
    { (unichar_t *) N_("PanoseSerivfs|Square"), NULL, 0, 0, (void *) 6, NULL, 0, 0, 0, 0, 0, 0, 1},
 
235
    { (unichar_t *) N_("PanoseSerifs|Thin"), NULL, 0, 0, (void *) 7, NULL, 0, 0, 0, 0, 0, 0, 1},
 
236
    { (unichar_t *) N_("Bone"), NULL, 0, 0, (void *) 8, NULL, 0, 0, 0, 0, 0, 0, 1},
 
237
    { (unichar_t *) N_("Exaggerated"), NULL, 0, 0, (void *) 9, NULL, 0, 0, 0, 0, 0, 0, 1},
 
238
    { (unichar_t *) N_("Triangle"), NULL, 0, 0, (void *) 10, NULL, 0, 0, 0, 0, 0, 0, 1},
 
239
    { (unichar_t *) N_("Normal Sans"), NULL, 0, 0, (void *) 11, NULL, 0, 0, 0, 0, 0, 0, 1},
 
240
    { (unichar_t *) N_("Obtuse Sans"), NULL, 0, 0, (void *) 12, NULL, 0, 0, 0, 0, 0, 0, 1},
 
241
    { (unichar_t *) N_("Perp Sans"), NULL, 0, 0, (void *) 13, NULL, 0, 0, 0, 0, 0, 0, 1},
 
242
    { (unichar_t *) N_("Flared"), NULL, 0, 0, (void *) 14, NULL, 0, 0, 0, 0, 0, 0, 1},
 
243
    { (unichar_t *) N_("PanoseSerivfs|Rounded"), NULL, 0, 0, (void *) 15, NULL, 0, 0, 0, 0, 0, 0, 1},
 
244
    { NULL }};
 
245
static GTextInfo panweight[] = {
 
246
    { (unichar_t *) N_("PanoseWeight|Any"), NULL, 0, 0, (void *) 0, NULL, 0, 0, 0, 0, 0, 0, 1},
 
247
    { (unichar_t *) N_("PanoseWeight|No Fit"), NULL, 0, 0, (void *) 1, NULL, 0, 0, 0, 0, 0, 0, 1},
 
248
    { (unichar_t *) N_("Very Light"), NULL, 0, 0, (void *) 2, NULL, 0, 0, 0, 0, 0, 0, 1},
 
249
    { (unichar_t *) N_("Light"), NULL, 0, 0, (void *) 3, NULL, 0, 0, 0, 0, 0, 0, 1},
 
250
    { (unichar_t *) N_("PanoseWeight|Thin"), NULL, 0, 0, (void *) 4, NULL, 0, 0, 0, 0, 0, 0, 1},
 
251
    { (unichar_t *) N_("Book"), NULL, 0, 0, (void *) 5, NULL, 0, 0, 0, 0, 0, 0, 1},
 
252
    { (unichar_t *) N_("Medium"), NULL, 0, 0, (void *) 6, NULL, 0, 0, 0, 0, 0, 0, 1},
 
253
    { (unichar_t *) N_("Demi"), NULL, 0, 0, (void *) 7, NULL, 0, 0, 0, 0, 0, 0, 1},
 
254
    { (unichar_t *) N_("Bold"), NULL, 0, 0, (void *) 8, NULL, 0, 0, 0, 0, 0, 0, 1},
 
255
    { (unichar_t *) N_("Heavy"), NULL, 0, 0, (void *) 9, NULL, 0, 0, 0, 0, 0, 0, 1},
 
256
    { (unichar_t *) N_("Black"), NULL, 0, 0, (void *) 10, NULL, 0, 0, 0, 0, 0, 0, 1},
 
257
    { (unichar_t *) N_("Nord"), NULL, 0, 0, (void *) 11, NULL, 0, 0, 0, 0, 0, 0, 1},
 
258
    { (unichar_t *) "12", NULL, 0, 0, (void *) 12, NULL, 0, 0, 0, 0, 0, 0, 1},
 
259
    { (unichar_t *) "13", NULL, 0, 0, (void *) 13, NULL, 0, 0, 0, 0, 0, 0, 1},
 
260
    { (unichar_t *) "14", NULL, 0, 0, (void *) 14, NULL, 0, 0, 0, 0, 0, 0, 1},
 
261
    { (unichar_t *) "15", NULL, 0, 0, (void *) 15, NULL, 0, 0, 0, 0, 0, 0, 1},
 
262
    { NULL }};
 
263
static GTextInfo panprop[] = {
 
264
    { (unichar_t *) N_("PanoseProportion|Any"), NULL, 0, 0, (void *) 0, NULL, 0, 0, 0, 0, 0, 0, 1},
 
265
    { (unichar_t *) N_("PanoseProportion|No Fit"), NULL, 0, 0, (void *) 1, NULL, 0, 0, 0, 0, 0, 0, 1},
 
266
    { (unichar_t *) N_("Old Style"), NULL, 0, 0, (void *) 2, NULL, 0, 0, 0, 0, 0, 0, 1},
 
267
    { (unichar_t *) N_("Modern"), NULL, 0, 0, (void *) 3, NULL, 0, 0, 0, 0, 0, 0, 1},
 
268
    { (unichar_t *) N_("Even Width"), NULL, 0, 0, (void *) 4, NULL, 0, 0, 0, 0, 0, 0, 1},
 
269
    { (unichar_t *) N_("Expanded"), NULL, 0, 0, (void *) 5, NULL, 0, 0, 0, 0, 0, 0, 1},
 
270
    { (unichar_t *) N_("Condensed"), NULL, 0, 0, (void *) 6, NULL, 0, 0, 0, 0, 0, 0, 1},
 
271
    { (unichar_t *) N_("Very Expanded"), NULL, 0, 0, (void *) 7, NULL, 0, 0, 0, 0, 0, 0, 1},
 
272
    { (unichar_t *) N_("Very Condensed"), NULL, 0, 0, (void *) 8, NULL, 0, 0, 0, 0, 0, 0, 1},
 
273
    { (unichar_t *) N_("Monospaced"), NULL, 0, 0, (void *) 9, NULL, 0, 0, 0, 0, 0, 0, 1},
 
274
    { (unichar_t *) "10", NULL, 0, 0, (void *) 10, NULL, 0, 0, 0, 0, 0, 0, 1},
 
275
    { (unichar_t *) "11", NULL, 0, 0, (void *) 11, NULL, 0, 0, 0, 0, 0, 0, 1},
 
276
    { (unichar_t *) "12", NULL, 0, 0, (void *) 12, NULL, 0, 0, 0, 0, 0, 0, 1},
 
277
    { (unichar_t *) "13", NULL, 0, 0, (void *) 13, NULL, 0, 0, 0, 0, 0, 0, 1},
 
278
    { (unichar_t *) "14", NULL, 0, 0, (void *) 14, NULL, 0, 0, 0, 0, 0, 0, 1},
 
279
    { (unichar_t *) "15", NULL, 0, 0, (void *) 15, NULL, 0, 0, 0, 0, 0, 0, 1},
 
280
    { NULL }};
 
281
static GTextInfo pancontrast[] = {
 
282
    { (unichar_t *) N_("PanoseContrast|Any"), NULL, 0, 0, (void *) 0, NULL, 0, 0, 0, 0, 0, 0, 1},
 
283
    { (unichar_t *) N_("PanoseContrast|No Fit"), NULL, 0, 0, (void *) 1, NULL, 0, 0, 0, 0, 0, 0, 1},
 
284
    { (unichar_t *) N_("PanoseContrast|None"), NULL, 0, 0, (void *) 2, NULL, 0, 0, 0, 0, 0, 0, 1},
 
285
    { (unichar_t *) N_("PanoseContrast|Very Low"), NULL, 0, 0, (void *) 3, NULL, 0, 0, 0, 0, 0, 0, 1},
 
286
    { (unichar_t *) N_("PanoseContrast|Low"), NULL, 0, 0, (void *) 4, NULL, 0, 0, 0, 0, 0, 0, 1},
 
287
    { (unichar_t *) N_("PanoseContrast|Medium Low"), NULL, 0, 0, (void *) 5, NULL, 0, 0, 0, 0, 0, 0, 1},
 
288
    { (unichar_t *) N_("PanoseContrast|Medium"), NULL, 0, 0, (void *) 6, NULL, 0, 0, 0, 0, 0, 0, 1},
 
289
    { (unichar_t *) N_("PanoseContrast|Medium High"), NULL, 0, 0, (void *) 7, NULL, 0, 0, 0, 0, 0, 0, 1},
 
290
    { (unichar_t *) N_("PanoseContrast|High"), NULL, 0, 0, (void *) 8, NULL, 0, 0, 0, 0, 0, 0, 1},
 
291
    { (unichar_t *) N_("PanoseContrast|Very High"), NULL, 0, 0, (void *) 9, NULL, 0, 0, 0, 0, 0, 0, 1},
 
292
    { (unichar_t *) "10", NULL, 0, 0, (void *) 10, NULL, 0, 0, 0, 0, 0, 0, 1},
 
293
    { (unichar_t *) "11", NULL, 0, 0, (void *) 11, NULL, 0, 0, 0, 0, 0, 0, 1},
 
294
    { (unichar_t *) "12", NULL, 0, 0, (void *) 12, NULL, 0, 0, 0, 0, 0, 0, 1},
 
295
    { (unichar_t *) "13", NULL, 0, 0, (void *) 13, NULL, 0, 0, 0, 0, 0, 0, 1},
 
296
    { (unichar_t *) "14", NULL, 0, 0, (void *) 14, NULL, 0, 0, 0, 0, 0, 0, 1},
 
297
    { (unichar_t *) "15", NULL, 0, 0, (void *) 15, NULL, 0, 0, 0, 0, 0, 0, 1},
 
298
    { NULL }};
 
299
static GTextInfo panstrokevar[] = {
 
300
    { (unichar_t *) N_("PanoseStrokeVariation|Any"), NULL, 0, 0, (void *) 0, NULL, 0, 0, 0, 0, 0, 0, 1},
 
301
    { (unichar_t *) N_("PanoseStrokeVariation|No Fit"), NULL, 0, 0, (void *) 1, NULL, 0, 0, 0, 0, 0, 0, 1},
 
302
    { (unichar_t *) N_("Gradual/Diagonal"), NULL, 0, 0, (void *) 2, NULL, 0, 0, 0, 0, 0, 0, 1},
 
303
    { (unichar_t *) N_("Gradual/Transitional"), NULL, 0, 0, (void *) 3, NULL, 0, 0, 0, 0, 0, 0, 1},
 
304
    { (unichar_t *) N_("Gradual/Vertical"), NULL, 0, 0, (void *) 4, NULL, 0, 0, 0, 0, 0, 0, 1},
 
305
    { (unichar_t *) N_("Gradual/Horizontal"), NULL, 0, 0, (void *) 5, NULL, 0, 0, 0, 0, 0, 0, 1},
 
306
    { (unichar_t *) N_("Rapid/Vertical"), NULL, 0, 0, (void *) 6, NULL, 0, 0, 0, 0, 0, 0, 1},
 
307
    { (unichar_t *) N_("Rapid/Horizontal"), NULL, 0, 0, (void *) 7, NULL, 0, 0, 0, 0, 0, 0, 1},
 
308
    { (unichar_t *) N_("Instant/Vertical"), NULL, 0, 0, (void *) 8, NULL, 0, 0, 0, 0, 0, 0, 1},
 
309
    { (unichar_t *) "9", NULL, 0, 0, (void *) 9, NULL, 0, 0, 0, 0, 0, 0, 1},
 
310
    { (unichar_t *) "10", NULL, 0, 0, (void *) 10, NULL, 0, 0, 0, 0, 0, 0, 1},
 
311
    { (unichar_t *) "11", NULL, 0, 0, (void *) 11, NULL, 0, 0, 0, 0, 0, 0, 1},
 
312
    { (unichar_t *) "12", NULL, 0, 0, (void *) 12, NULL, 0, 0, 0, 0, 0, 0, 1},
 
313
    { (unichar_t *) "13", NULL, 0, 0, (void *) 13, NULL, 0, 0, 0, 0, 0, 0, 1},
 
314
    { (unichar_t *) "14", NULL, 0, 0, (void *) 14, NULL, 0, 0, 0, 0, 0, 0, 1},
 
315
    { (unichar_t *) "15", NULL, 0, 0, (void *) 15, NULL, 0, 0, 0, 0, 0, 0, 1},
 
316
    { NULL }};
 
317
static GTextInfo panarmstyle[] = {
 
318
    { (unichar_t *) N_("PanoseArmStyle|Any"), NULL, 0, 0, (void *) 0, NULL, 0, 0, 0, 0, 0, 0, 1},
 
319
    { (unichar_t *) N_("PanoseArmStyle|No Fit"), NULL, 0, 0, (void *) 1, NULL, 0, 0, 0, 0, 0, 0, 1},
 
320
    { (unichar_t *) N_("Straight Arms/Horizontal"), NULL, 0, 0, (void *) 2, NULL, 0, 0, 0, 0, 0, 0, 1},
 
321
    { (unichar_t *) N_("Straight Arms/Wedge"), NULL, 0, 0, (void *) 3, NULL, 0, 0, 0, 0, 0, 0, 1},
 
322
    { (unichar_t *) N_("Straight Arms/Vertical"), NULL, 0, 0, (void *) 4, NULL, 0, 0, 0, 0, 0, 0, 1},
 
323
    { (unichar_t *) N_("Straight Arms/Single Serif"), NULL, 0, 0, (void *) 5, NULL, 0, 0, 0, 0, 0, 0, 1},
 
324
    { (unichar_t *) N_("Straight Arms/Double Serif"), NULL, 0, 0, (void *) 6, NULL, 0, 0, 0, 0, 0, 0, 1},
 
325
    { (unichar_t *) N_("Non-Straight Arms/Horizontal"), NULL, 0, 0, (void *) 7, NULL, 0, 0, 0, 0, 0, 0, 1},
 
326
    { (unichar_t *) N_("Non-Straight Arms/Wedge"), NULL, 0, 0, (void *) 8, NULL, 0, 0, 0, 0, 0, 0, 1},
 
327
    { (unichar_t *) N_("Non-Straight Arms/Vertical"), NULL, 0, 0, (void *) 9, NULL, 0, 0, 0, 0, 0, 0, 1},
 
328
    { (unichar_t *) N_("Non-Straight Arms/Single Serif"), NULL, 0, 0, (void *) 10, NULL, 0, 0, 0, 0, 0, 0, 1},
 
329
    { (unichar_t *) N_("Non-Straight Arms/Double Serif"), NULL, 0, 0, (void *) 11, NULL, 0, 0, 0, 0, 0, 0, 1},
 
330
    { (unichar_t *) "12", NULL, 0, 0, (void *) 12, NULL, 0, 0, 0, 0, 0, 0, 1},
 
331
    { (unichar_t *) "13", NULL, 0, 0, (void *) 13, NULL, 0, 0, 0, 0, 0, 0, 1},
 
332
    { (unichar_t *) "14", NULL, 0, 0, (void *) 14, NULL, 0, 0, 0, 0, 0, 0, 1},
 
333
    { (unichar_t *) "15", NULL, 0, 0, (void *) 15, NULL, 0, 0, 0, 0, 0, 0, 1},
 
334
    { NULL }};
 
335
static GTextInfo panletterform[] = {
 
336
    { (unichar_t *) N_("PanoseLetterform|Any"), NULL, 0, 0, (void *) 0, NULL, 0, 0, 0, 0, 0, 0, 1},
 
337
    { (unichar_t *) N_("PanoseLetterform|No Fit"), NULL, 0, 0, (void *) 1, NULL, 0, 0, 0, 0, 0, 0, 1},
 
338
    { (unichar_t *) N_("Normal/Contact"), NULL, 0, 0, (void *) 2, NULL, 0, 0, 0, 0, 0, 0, 1},
 
339
    { (unichar_t *) N_("Normal/Weighted"), NULL, 0, 0, (void *) 3, NULL, 0, 0, 0, 0, 0, 0, 1},
 
340
    { (unichar_t *) N_("Normal/Boxed"), NULL, 0, 0, (void *) 4, NULL, 0, 0, 0, 0, 0, 0, 1},
 
341
    { (unichar_t *) N_("Normal/Flattened"), NULL, 0, 0, (void *) 5, NULL, 0, 0, 0, 0, 0, 0, 1},
 
342
    { (unichar_t *) N_("Normal/Rounded"), NULL, 0, 0, (void *) 6, NULL, 0, 0, 0, 0, 0, 0, 1},
 
343
    { (unichar_t *) N_("Normal/Off-Center"), NULL, 0, 0, (void *) 7, NULL, 0, 0, 0, 0, 0, 0, 1},
 
344
    { (unichar_t *) N_("Normal/Square"), NULL, 0, 0, (void *) 8, NULL, 0, 0, 0, 0, 0, 0, 1},
 
345
    { (unichar_t *) N_("Oblique/Contact"), NULL, 0, 0, (void *) 9, NULL, 0, 0, 0, 0, 0, 0, 1},
 
346
    { (unichar_t *) N_("Oblique/Weighted"), NULL, 0, 0, (void *) 10, NULL, 0, 0, 0, 0, 0, 0, 1},
 
347
    { (unichar_t *) N_("Oblique/Boxed"), NULL, 0, 0, (void *) 11, NULL, 0, 0, 0, 0, 0, 0, 1},
 
348
    { (unichar_t *) N_("Oblique/Rounded"), NULL, 0, 0, (void *) 12, NULL, 0, 0, 0, 0, 0, 0, 1},
 
349
    { (unichar_t *) N_("Oblique/Off-Center"), NULL, 0, 0, (void *) 13, NULL, 0, 0, 0, 0, 0, 0, 1},
 
350
    { (unichar_t *) N_("Oblique/Square"), NULL, 0, 0, (void *) 14, NULL, 0, 0, 0, 0, 0, 0, 1},
 
351
    { (unichar_t *) "15", NULL, 0, 0, (void *) 15, NULL, 0, 0, 0, 0, 0, 0, 1},
 
352
    { NULL }};
 
353
static GTextInfo panmidline[] = {
 
354
    { (unichar_t *) N_("PanoseMidline|Any"), NULL, 0, 0, (void *) 0, NULL, 0, 0, 0, 0, 0, 0, 1},
 
355
    { (unichar_t *) N_("PanoseMidline|No Fit"), NULL, 0, 0, (void *) 1, NULL, 0, 0, 0, 0, 0, 0, 1},
 
356
    { (unichar_t *) N_("PanoseMidline|Standard/Trimmed"), NULL, 0, 0, (void *) 2, NULL, 0, 0, 0, 0, 0, 0, 1},
 
357
    { (unichar_t *) N_("PanoseMidline|Standard/Pointed"), NULL, 0, 0, (void *) 3, NULL, 0, 0, 0, 0, 0, 0, 1},
 
358
    { (unichar_t *) N_("PanoseMidline|Standard/Serifed"), NULL, 0, 0, (void *) 4, NULL, 0, 0, 0, 0, 0, 0, 1},
 
359
    { (unichar_t *) N_("PanoseMidline|High/Trimmed"), NULL, 0, 0, (void *) 5, NULL, 0, 0, 0, 0, 0, 0, 1},
 
360
    { (unichar_t *) N_("PanoseMidline|High/Pointed"), NULL, 0, 0, (void *) 6, NULL, 0, 0, 0, 0, 0, 0, 1},
 
361
    { (unichar_t *) N_("PanoseMidline|High/Serifed"), NULL, 0, 0, (void *) 7, NULL, 0, 0, 0, 0, 0, 0, 1},
 
362
    { (unichar_t *) N_("PanoseMidline|Constant/Trimmed"), NULL, 0, 0, (void *) 8, NULL, 0, 0, 0, 0, 0, 0, 1},
 
363
    { (unichar_t *) N_("PanoseMidline|Constant/Pointed"), NULL, 0, 0, (void *) 9, NULL, 0, 0, 0, 0, 0, 0, 1},
 
364
    { (unichar_t *) N_("PanoseMidline|Constant/Serifed"), NULL, 0, 0, (void *) 10, NULL, 0, 0, 0, 0, 0, 0, 1},
 
365
    { (unichar_t *) N_("PanoseMidline|Low/Trimmed"), NULL, 0, 0, (void *) 11, NULL, 0, 0, 0, 0, 0, 0, 1},
 
366
    { (unichar_t *) N_("PanoseMidline|Low/Pointed"), NULL, 0, 0, (void *) 12, NULL, 0, 0, 0, 0, 0, 0, 1},
 
367
    { (unichar_t *) N_("PanoseMidline|Low/Serifed"), NULL, 0, 0, (void *) 13, NULL, 0, 0, 0, 0, 0, 0, 1},
 
368
    { (unichar_t *) "14", NULL, 0, 0, (void *) 14, NULL, 0, 0, 0, 0, 0, 0, 1},
 
369
    { (unichar_t *) "15", NULL, 0, 0, (void *) 15, NULL, 0, 0, 0, 0, 0, 0, 1},
 
370
    { NULL }};
 
371
static GTextInfo panxheight[] = {
 
372
    { (unichar_t *) N_("PanoseXHeight|Any"), NULL, 0, 0, (void *) 0, NULL, 0, 0, 0, 0, 0, 0, 1},
 
373
    { (unichar_t *) N_("PanoseXHeight|No Fit"), NULL, 0, 0, (void *) 1, NULL, 0, 0, 0, 0, 0, 0, 1},
 
374
    { (unichar_t *) N_("PanoseXHeight|Constant/Small"), NULL, 0, 0, (void *) 2, NULL, 0, 0, 0, 0, 0, 0, 1},
 
375
    { (unichar_t *) N_("PanoseXHeight|Constant/Standard"), NULL, 0, 0, (void *) 3, NULL, 0, 0, 0, 0, 0, 0, 1},
 
376
    { (unichar_t *) N_("PanoseXHeight|Constant/Large"), NULL, 0, 0, (void *) 4, NULL, 0, 0, 0, 0, 0, 0, 1},
 
377
    { (unichar_t *) N_("PanoseXHeight|Ducking/Small"), NULL, 0, 0, (void *) 5, NULL, 0, 0, 0, 0, 0, 0, 1},
 
378
    { (unichar_t *) N_("PanoseXHeight|Ducking/Standard"), NULL, 0, 0, (void *) 6, NULL, 0, 0, 0, 0, 0, 0, 1},
 
379
    { (unichar_t *) N_("PanoseXHeight|Ducking/Large"), NULL, 0, 0, (void *) 7, NULL, 0, 0, 0, 0, 0, 0, 1},
 
380
    { (unichar_t *) "8", NULL, 0, 0, (void *) 8, NULL, 0, 0, 0, 0, 0, 0, 1},
 
381
    { (unichar_t *) "9", NULL, 0, 0, (void *) 9, NULL, 0, 0, 0, 0, 0, 0, 1},
 
382
    { (unichar_t *) "10", NULL, 0, 0, (void *) 10, NULL, 0, 0, 0, 0, 0, 0, 1},
 
383
    { (unichar_t *) "11", NULL, 0, 0, (void *) 11, NULL, 0, 0, 0, 0, 0, 0, 1},
 
384
    { (unichar_t *) "12", NULL, 0, 0, (void *) 12, NULL, 0, 0, 0, 0, 0, 0, 1},
 
385
    { (unichar_t *) "13", NULL, 0, 0, (void *) 13, NULL, 0, 0, 0, 0, 0, 0, 1},
 
386
    { (unichar_t *) "14", NULL, 0, 0, (void *) 14, NULL, 0, 0, 0, 0, 0, 0, 1},
 
387
    { (unichar_t *) "15", NULL, 0, 0, (void *) 15, NULL, 0, 0, 0, 0, 0, 0, 1},
 
388
    { NULL }};
 
389
 
 
390
#ifndef LUA_FF_LIB
 
391
static struct ms_2_locales { char *loc_name; int local_id; } ms_2_locals[] = {
 
392
    { "af", 0x436 },
 
393
    { "sq_AL", 0x41c },
 
394
    { "am", 0x45e },
 
395
    { "ar_SA", 0x401 },
 
396
    { "ar_IQ", 0x801 },
 
397
    { "ar_EG", 0xc01 },
 
398
    { "ar_LY", 0x1001 },
 
399
    { "ar_DZ", 0x1401 },
 
400
    { "ar_MA", 0x1801 },
 
401
    { "ar_TN", 0x1C01 },
 
402
    { "ar_OM", 0x2001 },
 
403
    { "ar_YE", 0x2401 },
 
404
    { "ar_SY", 0x2801 },
 
405
    { "ar_JO", 0x2c01 },
 
406
    { "ar_LB", 0x3001 },
 
407
    { "ar_KW", 0x3401 },
 
408
    { "ar_AE", 0x3801 },
 
409
    { "ar_BH", 0x3c01 },
 
410
    { "ar_QA", 0x4001 },
 
411
    { "hy", 0x42b },
 
412
    { "as", 0x44d },
 
413
    { "az", 0x42c },
 
414
    { "az", 0x82c },
 
415
    { "eu", 0x42d },
 
416
    { "be_BY", 0x423 },
 
417
    { "bn_IN", 0x445 },
 
418
    { "bn_BD", 0x845 },
 
419
    { "bg_BG", 0x402 },
 
420
    { "my", 0x455 },
 
421
    { "ca", 0x403 },
 
422
    { "km", 0x453 },
 
423
    { "zh_TW", 0x404 },         /* Trad */
 
424
    { "zh_CN", 0x804 },         /* Simp */
 
425
    { "zh_HK", 0xc04 },         /* Trad */
 
426
    { "zh_SG", 0x1004 },        /* Simp */
 
427
    { "zh_MO", 0x1404 },        /* Trad */
 
428
    { "hr", 0x41a },
 
429
    { "hr_BA", 0x101a },
 
430
    { "cs_CZ", 0x405 },
 
431
    { "da_DK", 0x406 },
 
432
    { "div", 0x465 },
 
433
    { "nl_NL", 0x413 },
 
434
    { "nl_BE", 0x813 },
 
435
    { "en_UK", 0x809 },
 
436
    { "en_US", 0x409 },
 
437
    { "en_CA", 0x1009 },
 
438
    { "en_AU", 0xc09 },
 
439
    { "en_NZ", 0x1409 },
 
440
    { "en_IE", 0x1809 },
 
441
    { "en_ZA", 0x1c09 },
 
442
    { "en_JM", 0x2009 },
 
443
    { "en", 0x2409 },
 
444
    { "en_BZ", 0x2809 },
 
445
    { "en_TT", 0x2c09 },
 
446
    { "en_ZW", 0x3009 },
 
447
    { "en_PH", 0x3409 },
 
448
    { "en_ID", 0x3809 },
 
449
    { "en_HK", 0x3c09 },
 
450
    { "en_IN", 0x4009 },
 
451
    { "en_MY", 0x4409 },
 
452
    { "et_EE", 0x425 },
 
453
    { "fo", 0x438 },
 
454
/* No language code for filipino */
 
455
    { "fa", 0x429 },
 
456
    { "fi_FI", 0x40b },
 
457
    { "fr_FR", 0x40c },
 
458
    { "fr_BE", 0x80c },
 
459
    { "fr_CA", 0xc0c },
 
460
    { "fr_CH", 0x100c },
 
461
    { "fr_LU", 0x140c },
 
462
    { "fr_MC", 0x180c },
 
463
    { "fr", 0x1c0c },           /* West Indes */
 
464
    { "fr_RE", 0x200c },
 
465
    { "fr_CD", 0x240c },
 
466
    { "fr_SN", 0x280c },
 
467
    { "fr_CM", 0x2c0c },
 
468
    { "fr_CI", 0x300c },
 
469
    { "fr_ML", 0x340c },
 
470
    { "fr_MA", 0x380c },
 
471
    { "fr_HT", 0x3c0c },
 
472
    { "fr_DZ", 0xe40c },        /* North African is most likely to be Algeria, possibly Tunisia */
 
473
    { "fy", 0x462 },
 
474
    { "gl", 0x456 },
 
475
    { "ka", 0x437 },
 
476
    { "de_DE", 0x407 },
 
477
    { "de_CH", 0x807 },
 
478
    { "de_AT", 0xc07 },
 
479
    { "de_LU", 0x1007 },
 
480
    { "de_LI", 0x1407 },
 
481
    { "el_GR", 0x408 },
 
482
    { "ga", 0x83c },
 
483
    { "gd", 0x43c },
 
484
    { "gn", 0x474 },
 
485
    { "gu", 0x447 },
 
486
    { "ha", 0x468 },
 
487
    { "he_IL", 0x40d },
 
488
    { "iw", 0x40d },            /* Obsolete name for Hebrew */
 
489
    { "hi", 0x439 },
 
490
    { "hu_HU", 0x40e },
 
491
    { "is_IS", 0x40f },
 
492
    { "id", 0x421 },
 
493
    { "in", 0x421 },            /* Obsolete name for Indonesean */
 
494
    { "iu", 0x45d },
 
495
    { "it_IT", 0x410 },
 
496
    { "it_CH", 0x810 },
 
497
    { "ja_JP", 0x411 },
 
498
    { "kn", 0x44b },
 
499
    { "ks_IN", 0x860 },
 
500
    { "kk", 0x43f },
 
501
    { "ky", 0x440 },
 
502
    { "km", 0x453 },
 
503
    { "kok", 0x457 },
 
504
    { "ko", 0x412 },
 
505
    { "ko", 0x812 },    /*Johab */
 
506
    { "lo", 0x454 },
 
507
    { "la", 0x476 },
 
508
    { "lv_LV", 0x426 },
 
509
    { "lt_LT", 0x427 },
 
510
    { "lt", 0x827 },    /* Classic */
 
511
    { "mk", 0x42f },
 
512
    { "ms", 0x43e },
 
513
    { "ms", 0x83e },
 
514
    { "ml", 0x44c },
 
515
    { "mt", 0x43a },
 
516
    { "mr", 0x44e },
 
517
    { "mn", 0x450 },
 
518
    { "ne_NP", 0x461 },
 
519
    { "ne_IN", 0x861 },
 
520
    { "no_NO", 0x414 }, /* Bokmal */
 
521
    { "no_NO", 0x814 }, /* Nynorsk */
 
522
    { "or", 0x448 },
 
523
    { "om", 0x472 },
 
524
    { "ps", 0x463 },
 
525
    { "pl_PL", 0x415 },
 
526
    { "pt_PT", 0x416 },
 
527
    { "pt_BR", 0x816 },
 
528
    { "pa_IN", 0x446 },
 
529
    { "pa_PK", 0x846 },
 
530
    { "qu_BO", 0x46b },
 
531
    { "qu_EC", 0x86b },
 
532
    { "qu_PE", 0xc6b },
 
533
    { "rm", 0x417 },
 
534
    { "ro_RO", 0x418 },
 
535
    { "ro_MD", 0x818 },
 
536
    { "ru_RU", 0x419 },
 
537
    { "ru_MD", 0x819 },
 
538
    { "smi", 0x43b },
 
539
    { "sa", 0x43b },
 
540
/* No language code for Sepedi */
 
541
    { "sr", 0xc1a },    /* Cyrillic */
 
542
    { "sr", 0x81a },    /* Latin */
 
543
    { "sd_IN", 0x459 },
 
544
    { "sd_PK", 0x859 },
 
545
    { "si", 0x45b },
 
546
    { "sk_SK", 0x41b },
 
547
    { "sl_SI", 0x424 },
 
548
    { "wen", 0x42e },
 
549
    { "es_ES", 0x40a }, /* traditional spanish */
 
550
    { "es_MX", 0x80a },
 
551
    { "es_ES", 0xc0a }, /* Modern spanish */
 
552
    { "es_GT", 0x100a },
 
553
    { "es_CR", 0x140a },
 
554
    { "es_PA", 0x180a },
 
555
    { "es_DO", 0x1c0a },
 
556
    { "es_VE", 0x200a },
 
557
    { "es_CO", 0x240a },
 
558
    { "es_PE", 0x280a },
 
559
    { "es_AR", 0x2c0a },
 
560
    { "es_EC", 0x300a },
 
561
    { "es_CL", 0x340a },
 
562
    { "es_UY", 0x380a },
 
563
    { "es_PY", 0x3c0a },
 
564
    { "es_BO", 0x400a },
 
565
    { "es_SV", 0x440a },
 
566
    { "es_HN", 0x480a },
 
567
    { "es_NI", 0x4c0a },
 
568
    { "es_PR", 0x500a },
 
569
    { "es_US", 0x540a },
 
570
    { "sutu", 0x430 },
 
571
    { "sw_KE", 0x441 },
 
572
    { "sv_SE", 0x41d },
 
573
    { "sv_FI", 0x81d },
 
574
    { "tl", 0x464 },
 
575
    { "tg", 0x464 },
 
576
    { "ta", 0x449 },
 
577
    { "tt", 0x444 },
 
578
    { "te", 0x44a },
 
579
    { "th", 0x41e },
 
580
    { "bo_CN", 0x451 },
 
581
    { "bo_BT", 0x451 },
 
582
    { "ti_ET", 0x473 },
 
583
    { "ti_ER", 0x873 },
 
584
    { "ts", 0x431 },
 
585
    { "tn", 0x432 },
 
586
    { "tr_TR", 0x41f },
 
587
    { "tk", 0x442 },
 
588
    { "uk_UA", 0x422 },
 
589
    { "ug", 0x480 },
 
590
    { "ur_PK", 0x420 },
 
591
    { "ur_IN", 0x820 },
 
592
    { "uz", 0x443 },    /* Latin */
 
593
    { "uz", 0x843 },    /* Cyrillic */
 
594
    { "ven", 0x433 },
 
595
    { "vi", 0x42a },
 
596
    { "cy", 0x452 },
 
597
    { "xh", 0x434 },
 
598
    { "yi", 0x43d },
 
599
    { "ji", 0x43d },    /* Obsolete Yiddish */
 
600
    { "yo", 0x46a },
 
601
    { "zu", 0x435 },
 
602
    { NULL }};
 
603
#endif
 
604
 
 
605
static GTextInfo mslanguages[] = {
 
606
    { (unichar_t *) N_("Afrikaans"), NULL, 0, 0, (void *) 0x436, NULL, 0, 0, 0, 0, 0, 0, 1},
 
607
    { (unichar_t *) N_("Albanian"), NULL, 0, 0, (void *) 0x41c, NULL, 0, 0, 0, 0, 0, 0, 1},
 
608
/* GT: See the long comment at "Property|New" */
 
609
/* GT: The msgstr should contain a translation of "Malayalam", ignore "Lang|" */
 
610
    { (unichar_t *) N_("Lang|Amharic"), NULL, 0, 0, (void *) 0x45e, NULL, 0, 0, 0, 0, 0, 0, 1},
 
611
    { (unichar_t *) N_("Arabic (Saudi Arabia)"), NULL, 0, 0, (void *) 0x401, NULL, 0, 0, 0, 0, 0, 0, 1},
 
612
    { (unichar_t *) N_("Arabic (Iraq)"), NULL, 0, 0, (void *) 0x801, NULL, 0, 0, 0, 0, 0, 0, 1},
 
613
    { (unichar_t *) N_("Arabic (Egypt)"), NULL, 0, 0, (void *) 0xc01, NULL, 0, 0, 0, 0, 0, 0, 1},
 
614
    { (unichar_t *) N_("Arabic (Libya)"), NULL, 0, 0, (void *) 0x1001, NULL, 0, 0, 0, 0, 0, 0, 1},
 
615
    { (unichar_t *) N_("Arabic (Algeria)"), NULL, 0, 0, (void *) 0x1401, NULL, 0, 0, 0, 0, 0, 0, 1},
 
616
    { (unichar_t *) N_("Arabic (Morocco)"), NULL, 0, 0, (void *) 0x1801, NULL, 0, 0, 0, 0, 0, 0, 1},
 
617
    { (unichar_t *) N_("Arabic (Tunisia)"), NULL, 0, 0, (void *) 0x1C01, NULL, 0, 0, 0, 0, 0, 0, 1},
 
618
    { (unichar_t *) N_("Arabic (Oman)"), NULL, 0, 0, (void *) 0x2001, NULL, 0, 0, 0, 0, 0, 0, 1},
 
619
    { (unichar_t *) N_("Arabic (Yemen)"), NULL, 0, 0, (void *) 0x2401, NULL, 0, 0, 0, 0, 0, 0, 1},
 
620
    { (unichar_t *) N_("Arabic (Syria)"), NULL, 0, 0, (void *) 0x2801, NULL, 0, 0, 0, 0, 0, 0, 1},
 
621
    { (unichar_t *) N_("Arabic (Jordan)"), NULL, 0, 0, (void *) 0x2c01, NULL, 0, 0, 0, 0, 0, 0, 1},
 
622
    { (unichar_t *) N_("Arabic (Lebanon)"), NULL, 0, 0, (void *) 0x3001, NULL, 0, 0, 0, 0, 0, 0, 1},
 
623
    { (unichar_t *) N_("Arabic (Kuwait)"), NULL, 0, 0, (void *) 0x3401, NULL, 0, 0, 0, 0, 0, 0, 1},
 
624
    { (unichar_t *) N_("Arabic (U.A.E.)"), NULL, 0, 0, (void *) 0x3801, NULL, 0, 0, 0, 0, 0, 0, 1},
 
625
    { (unichar_t *) N_("Arabic (Bahrain)"), NULL, 0, 0, (void *) 0x3c01, NULL, 0, 0, 0, 0, 0, 0, 1},
 
626
    { (unichar_t *) N_("Arabic (Qatar)"), NULL, 0, 0, (void *) 0x4001, NULL, 0, 0, 0, 0, 0, 0, 1},
 
627
    { (unichar_t *) N_("Lang|Armenian"), NULL, 0, 0, (void *) 0x42b, NULL, 0, 0, 0, 0, 0, 0, 1},
 
628
    { (unichar_t *) N_("Assamese"), NULL, 0, 0, (void *) 0x44d, NULL, 0, 0, 0, 0, 0, 0, 1},
 
629
    { (unichar_t *) N_("Azeri (Latin)"), NULL, 0, 0, (void *) 0x42c, NULL, 0, 0, 0, 0, 0, 0, 1},
 
630
    { (unichar_t *) N_("Azeri (Cyrillic)"), NULL, 0, 0, (void *) 0x82c, NULL, 0, 0, 0, 0, 0, 0, 1},
 
631
    { (unichar_t *) N_("Basque"), NULL, 0, 0, (void *) 0x42d, NULL, 0, 0, 0, 0, 0, 0, 1},
 
632
    { (unichar_t *) N_("Byelorussian"), NULL, 0, 0, (void *) 0x423, NULL, 0, 0, 0, 0, 0, 0, 1},
 
633
    { (unichar_t *) N_("Lang|Bengali"), NULL, 0, 0, (void *) 0x445, NULL, 0, 0, 0, 0, 0, 0, 1},
 
634
    { (unichar_t *) N_("Bengali Bangladesh"), NULL, 0, 0, (void *) 0x845, NULL, 0, 0, 0, 0, 0, 0, 1},
 
635
    { (unichar_t *) N_("Bulgarian"), NULL, 0, 0, (void *) 0x402, NULL, 0, 0, 0, 0, 0, 0, 1},
 
636
    { (unichar_t *) N_("Burmese"), NULL, 0, 0, (void *) 0x455, NULL, 0, 0, 0, 0, 0, 0, 1},
 
637
    { (unichar_t *) N_("Catalan"), NULL, 0, 0, (void *) 0x403, NULL, 0, 0, 0, 0, 0, 0, 1},
 
638
    { (unichar_t *) N_("Cambodian"), NULL, 0, 0, (void *) 0x453, NULL, 0, 0, 0, 0, 0, 0, 1},
 
639
    { (unichar_t *) N_("Lang|Cherokee"), NULL, 0, 0, (void *) 0x45c, NULL, 0, 0, 0, 0, 0, 0, 1},
 
640
    { (unichar_t *) N_("Chinese (Taiwan)"), NULL, 0, 0, (void *) 0x404, NULL, 0, 0, 0, 0, 0, 0, 1},
 
641
    { (unichar_t *) N_("Chinese (PRC)"), NULL, 0, 0, (void *) 0x804, NULL, 0, 0, 0, 0, 0, 0, 1},
 
642
    { (unichar_t *) N_("Chinese (Hong Kong)"), NULL, 0, 0, (void *) 0xc04, NULL, 0, 0, 0, 0, 0, 0, 1},
 
643
    { (unichar_t *) N_("Chinese (Singapore)"), NULL, 0, 0, (void *) 0x1004, NULL, 0, 0, 0, 0, 0, 0, 1},
 
644
    { (unichar_t *) N_("Chinese (Macau)"), NULL, 0, 0, (void *) 0x1404, NULL, 0, 0, 0, 0, 0, 0, 1},
 
645
    { (unichar_t *) N_("Croatian"), NULL, 0, 0, (void *) 0x41a, NULL, 0, 0, 0, 0, 0, 0, 1},
 
646
    { (unichar_t *) N_("Croatian Bosnia/Herzegovina"), NULL, 0, 0, (void *) 0x101a, NULL, 0, 0, 0, 0, 0, 0, 1},
 
647
    { (unichar_t *) N_("Czech"), NULL, 0, 0, (void *) 0x405, NULL, 0, 0, 0, 0, 0, 0, 1},
 
648
    { (unichar_t *) N_("Danish"), NULL, 0, 0, (void *) 0x406, NULL, 0, 0, 0, 0, 0, 0, 1},
 
649
    { (unichar_t *) N_("Divehi"), NULL, 0, 0, (void *) 0x465, NULL, 0, 0, 0, 0, 0, 0, 1},
 
650
    { (unichar_t *) N_("Dutch"), NULL, 0, 0, (void *) 0x413, NULL, 0, 0, 0, 0, 0, 0, 1},
 
651
    { (unichar_t *) N_("Flemish (Belgian Dutch)"), NULL, 0, 0, (void *) 0x813, NULL, 0, 0, 0, 0, 0, 0, 1},
 
652
    { (unichar_t *) N_("Edo"), NULL, 0, 0, (void *) 0x466, NULL, 0, 0, 0, 0, 0, 0, 1},
 
653
    { (unichar_t *) N_("English (British)"), NULL, 0, 0, (void *) 0x809, NULL, 0, 0, 0, 0, 0, 0, 1},
 
654
    { (unichar_t *) N_("English (US)"), NULL, 0, 0, (void *) 0x409, NULL, 0, 0, 0, 0, 0, 0, 1},
 
655
    { (unichar_t *) N_("English (Canada)"), NULL, 0, 0, (void *) 0x1009, NULL, 0, 0, 0, 0, 0, 0, 1},
 
656
    { (unichar_t *) N_("English (Australian)"), NULL, 0, 0, (void *) 0xc09, NULL, 0, 0, 0, 0, 0, 0, 1},
 
657
    { (unichar_t *) N_("English (New Zealand)"), NULL, 0, 0, (void *) 0x1409, NULL, 0, 0, 0, 0, 0, 0, 1},
 
658
    { (unichar_t *) N_("English (Irish)"), NULL, 0, 0, (void *) 0x1809, NULL, 0, 0, 0, 0, 0, 0, 1},
 
659
    { (unichar_t *) N_("English (South Africa)"), NULL, 0, 0, (void *) 0x1c09, NULL, 0, 0, 0, 0, 0, 0, 1},
 
660
    { (unichar_t *) N_("English (Jamaica)"), NULL, 0, 0, (void *) 0x2009, NULL, 0, 0, 0, 0, 0, 0, 1},
 
661
    { (unichar_t *) N_("English (Caribbean)"), NULL, 0, 0, (void *) 0x2409, NULL, 0, 0, 0, 0, 0, 0, 1},
 
662
    { (unichar_t *) N_("English (Belize)"), NULL, 0, 0, (void *) 0x2809, NULL, 0, 0, 0, 0, 0, 0, 1},
 
663
    { (unichar_t *) N_("English (Trinidad)"), NULL, 0, 0, (void *) 0x2c09, NULL, 0, 0, 0, 0, 0, 0, 1},
 
664
    { (unichar_t *) N_("English (Zimbabwe)"), NULL, 0, 0, (void *) 0x3009, NULL, 0, 0, 0, 0, 0, 0, 1},
 
665
    { (unichar_t *) N_("English (Philippines)"), NULL, 0, 0, (void *) 0x3409, NULL, 0, 0, 0, 0, 0, 0, 1},
 
666
    { (unichar_t *) N_("English (Indonesia)"), NULL, 0, 0, (void *) 0x3809, NULL, 0, 0, 0, 0, 0, 0, 1},
 
667
    { (unichar_t *) N_("English (Hong Kong)"), NULL, 0, 0, (void *) 0x3c09, NULL, 0, 0, 0, 0, 0, 0, 1},
 
668
    { (unichar_t *) N_("English (India)"), NULL, 0, 0, (void *) 0x4009, NULL, 0, 0, 0, 0, 0, 0, 1},
 
669
    { (unichar_t *) N_("English (Malaysia)"), NULL, 0, 0, (void *) 0x4409, NULL, 0, 0, 0, 0, 0, 0, 1},
 
670
    { (unichar_t *) N_("Estonian"), NULL, 0, 0, (void *) 0x425, NULL, 0, 0, 0, 0, 0, 0, 1},
 
671
    { (unichar_t *) N_("Faeroese"), NULL, 0, 0, (void *) 0x438, NULL, 0, 0, 0, 0, 0, 0, 1},
 
672
    { (unichar_t *) N_("Lang|Farsi"), NULL, 0, 0, (void *) 0x429, NULL, 0, 0, 0, 0, 0, 0, 1},
 
673
    { (unichar_t *) N_("Filipino"), NULL, 0, 0, (void *) 0x464, NULL, 0, 0, 0, 0, 0, 0, 1},
 
674
    { (unichar_t *) N_("Finnish"), NULL, 0, 0, (void *) 0x40b, NULL, 0, 0, 0, 0, 0, 0, 1},
 
675
    { (unichar_t *) N_("French French"), NULL, 0, 0, (void *) 0x40c, NULL, 0, 0, 0, 0, 0, 0, 1},
 
676
    { (unichar_t *) N_("French Belgium"), NULL, 0, 0, (void *) 0x80c, NULL, 0, 0, 0, 0, 0, 0, 1},
 
677
    { (unichar_t *) N_("French Canadian"), NULL, 0, 0, (void *) 0xc0c, NULL, 0, 0, 0, 0, 0, 0, 1},
 
678
    { (unichar_t *) N_("French Swiss"), NULL, 0, 0, (void *) 0x100c, NULL, 0, 0, 0, 0, 0, 0, 1},
 
679
    { (unichar_t *) N_("French Luxembourg"), NULL, 0, 0, (void *) 0x140c, NULL, 0, 0, 0, 0, 0, 0, 1},
 
680
    { (unichar_t *) N_("French Monaco"), NULL, 0, 0, (void *) 0x180c, NULL, 0, 0, 0, 0, 0, 0, 1},
 
681
    { (unichar_t *) N_("French West Indies"), NULL, 0, 0, (void *) 0x1c0c, NULL, 0, 0, 0, 0, 0, 0, 1},
 
682
    { (unichar_t *) NU_("French R\303\251union"), NULL, 0, 0, (void *) 0x200c, NULL, 0, 0, 0, 0, 0, 0, 1},
 
683
    { (unichar_t *) N_("French D.R. Congo"), NULL, 0, 0, (void *) 0x240c, NULL, 0, 0, 0, 0, 0, 0, 1},
 
684
    { (unichar_t *) N_("French Senegal"), NULL, 0, 0, (void *) 0x280c, NULL, 0, 0, 0, 0, 0, 0, 1},
 
685
    { (unichar_t *) N_("French Camaroon"), NULL, 0, 0, (void *) 0x2c0c, NULL, 0, 0, 0, 0, 0, 0, 1},
 
686
    { (unichar_t *) NU_("French C\303\264te d'Ivoire"), NULL, 0, 0, (void *) 0x300c, NULL, 0, 0, 0, 0, 0, 0, 1},
 
687
    { (unichar_t *) N_("French Mali"), NULL, 0, 0, (void *) 0x340c, NULL, 0, 0, 0, 0, 0, 0, 1},
 
688
    { (unichar_t *) N_("French Morocco"), NULL, 0, 0, (void *) 0x380c, NULL, 0, 0, 0, 0, 0, 0, 1},
 
689
    { (unichar_t *) N_("French Haiti"), NULL, 0, 0, (void *) 0x3c0c, NULL, 0, 0, 0, 0, 0, 0, 1},
 
690
    { (unichar_t *) N_("French North Africa"), NULL, 0, 0, (void *) 0xe40c, NULL, 0, 0, 0, 0, 0, 0, 1},
 
691
    { (unichar_t *) N_("Frisian"), NULL, 0, 0, (void *) 0x462, NULL, 0, 0, 0, 0, 0, 0, 1},
 
692
    { (unichar_t *) N_("Fulfulde"), NULL, 0, 0, (void *) 0x467, NULL, 0, 0, 0, 0, 0, 0, 1},
 
693
    { (unichar_t *) N_("Gaelic (Scottish)"), NULL, 0, 0, (void *) 0x43c, NULL, 0, 0, 0, 0, 0, 0, 1},
 
694
    { (unichar_t *) N_("Gaelic (Irish)"), NULL, 0, 0, (void *) 0x83c, NULL, 0, 0, 0, 0, 0, 0, 1},
 
695
    { (unichar_t *) N_("Galician"), NULL, 0, 0, (void *) 0x467, NULL, 0, 0, 0, 0, 0, 0, 1},
 
696
    { (unichar_t *) N_("Lang|Georgian"), NULL, 0, 0, (void *) 0x437, NULL, 0, 0, 0, 0, 0, 0, 1},
 
697
    { (unichar_t *) N_("German German"), NULL, 0, 0, (void *) 0x407, NULL, 0, 0, 0, 0, 0, 0, 1},
 
698
    { (unichar_t *) N_("German Swiss"), NULL, 0, 0, (void *) 0x807, NULL, 0, 0, 0, 0, 0, 0, 1},
 
699
    { (unichar_t *) N_("German Austrian"), NULL, 0, 0, (void *) 0xc07, NULL, 0, 0, 0, 0, 0, 0, 1},
 
700
    { (unichar_t *) N_("German Luxembourg"), NULL, 0, 0, (void *) 0x1007, NULL, 0, 0, 0, 0, 0, 0, 1},
 
701
    { (unichar_t *) N_("German Liechtenstein"), NULL, 0, 0, (void *) 0x1407, NULL, 0, 0, 0, 0, 0, 0, 1},
 
702
    { (unichar_t *) N_("Lang|Greek"), NULL, 0, 0, (void *) 0x408, NULL, 0, 0, 0, 0, 0, 0, 1},
 
703
    { (unichar_t *) N_("Guarani"), NULL, 0, 0, (void *) 0x474, NULL, 0, 0, 0, 0, 0, 0, 1},
 
704
    { (unichar_t *) N_("Lang|Gujarati"), NULL, 0, 0, (void *) 0x447, NULL, 0, 0, 0, 0, 0, 0, 1},
 
705
    { (unichar_t *) N_("Hausa"), NULL, 0, 0, (void *) 0x468, NULL, 0, 0, 0, 0, 0, 0, 1},
 
706
    { (unichar_t *) N_("Hawaiian"), NULL, 0, 0, (void *) 0x475, NULL, 0, 0, 0, 0, 0, 0, 1},
 
707
    { (unichar_t *) N_("Lang|Hebrew"), NULL, 0, 0, (void *) 0x40d, NULL, 0, 0, 0, 0, 0, 0, 1},
 
708
    { (unichar_t *) N_("Hindi"), NULL, 0, 0, (void *) 0x439, NULL, 0, 0, 0, 0, 0, 0, 1},
 
709
    { (unichar_t *) N_("Hungarian"), NULL, 0, 0, (void *) 0x40e, NULL, 0, 0, 0, 0, 0, 0, 1},
 
710
    { (unichar_t *) N_("Ibibio"), NULL, 0, 0, (void *) 0x469, NULL, 0, 0, 0, 0, 0, 0, 1},
 
711
    { (unichar_t *) N_("Icelandic"), NULL, 0, 0, (void *) 0x40f, NULL, 0, 0, 0, 0, 0, 0, 1},
 
712
    { (unichar_t *) N_("Igbo"), NULL, 0, 0, (void *) 0x470, NULL, 0, 0, 0, 0, 0, 0, 1},
 
713
    { (unichar_t *) N_("Indonesian"), NULL, 0, 0, (void *) 0x421, NULL, 0, 0, 0, 0, 0, 0, 1},
 
714
    { (unichar_t *) N_("Inuktitut"), NULL, 0, 0, (void *) 0x45d, NULL, 0, 0, 0, 0, 0, 0, 1},
 
715
    { (unichar_t *) N_("Italian"), NULL, 0, 0, (void *) 0x410, NULL, 0, 0, 0, 0, 0, 0, 1},
 
716
    { (unichar_t *) N_("Italian Swiss"), NULL, 0, 0, (void *) 0x810, NULL, 0, 0, 0, 0, 0, 0, 1},
 
717
    { (unichar_t *) N_("Japanese"), NULL, 0, 0, (void *) 0x411, NULL, 0, 0, 0, 0, 0, 0, 1},
 
718
    { (unichar_t *) N_("Lang|Kannada"), NULL, 0, 0, (void *) 0x44b, NULL, 0, 0, 0, 0, 0, 0, 1},
 
719
    { (unichar_t *) N_("Kanuri"), NULL, 0, 0, (void *) 0x471, NULL, 0, 0, 0, 0, 0, 0, 1},
 
720
    { (unichar_t *) N_("Kashmiri (India)"), NULL, 0, 0, (void *) 0x860, NULL, 0, 0, 0, 0, 0, 0, 1},
 
721
    { (unichar_t *) N_("Kazakh"), NULL, 0, 0, (void *) 0x43f, NULL, 0, 0, 0, 0, 0, 0, 1},
 
722
    { (unichar_t *) N_("Lang|Khmer"), NULL, 0, 0, (void *) 0x453, NULL, 0, 0, 0, 0, 0, 0, 1},
 
723
    { (unichar_t *) N_("Kirghiz"), NULL, 0, 0, (void *) 0x440, NULL, 0, 0, 0, 0, 0, 0, 1},
 
724
    { (unichar_t *) N_("Konkani"), NULL, 0, 0, (void *) 0x457, NULL, 0, 0, 0, 0, 0, 0, 1},
 
725
    { (unichar_t *) N_("Korean"), NULL, 0, 0, (void *) 0x412, NULL, 0, 0, 0, 0, 0, 0, 1},
 
726
    { (unichar_t *) N_("Korean (Johab)"), NULL, 0, 0, (void *) 0x812, NULL, 0, 0, 0, 0, 0, 0, 1},
 
727
    { (unichar_t *) N_("Lao"), NULL, 0, 0, (void *) 0x454, NULL, 0, 0, 0, 0, 0, 0, 1},
 
728
    { (unichar_t *) N_("Latvian"), NULL, 0, 0, (void *) 0x426, NULL, 0, 0, 0, 0, 0, 0, 1},
 
729
    { (unichar_t *) N_("Lang|Latin"), NULL, 0, 0, (void *) 0x476, NULL, 0, 0, 0, 0, 0, 0, 1},
 
730
    { (unichar_t *) N_("Lithuanian"), NULL, 0, 0, (void *) 0x427, NULL, 0, 0, 0, 0, 0, 0, 1},
 
731
    { (unichar_t *) N_("Lithuanian (Classic)"), NULL, 0, 0, (void *) 0x827, NULL, 0, 0, 0, 0, 0, 0, 1},
 
732
    { (unichar_t *) N_("Macedonian"), NULL, 0, 0, (void *) 0x42f, NULL, 0, 0, 0, 0, 0, 0, 1},
 
733
    { (unichar_t *) N_("Malay"), NULL, 0, 0, (void *) 0x43e, NULL, 0, 0, 0, 0, 0, 0, 1},
 
734
    { (unichar_t *) N_("Malay (Brunei)"), NULL, 0, 0, (void *) 0x83e, NULL, 0, 0, 0, 0, 0, 0, 1},
 
735
    { (unichar_t *) N_("Lang|Malayalam"), NULL, 0, 0, (void *) 0x44c, NULL, 0, 0, 0, 0, 0, 0, 1},
 
736
    { (unichar_t *) N_("Maltese"), NULL, 0, 0, (void *) 0x43a, NULL, 0, 0, 0, 0, 0, 0, 1},
 
737
    { (unichar_t *) N_("Manipuri"), NULL, 0, 0, (void *) 0x458, NULL, 0, 0, 0, 0, 0, 0, 1},
 
738
    { (unichar_t *) N_("Maori"), NULL, 0, 0, (void *) 0x481, NULL, 0, 0, 0, 0, 0, 0, 1},
 
739
    { (unichar_t *) N_("Marathi"), NULL, 0, 0, (void *) 0x44e, NULL, 0, 0, 0, 0, 0, 0, 1},
 
740
    { (unichar_t *) N_("Mongolian (Cyrillic)"), NULL, 0, 0, (void *) 0x450, NULL, 0, 0, 0, 0, 0, 0, 1},
 
741
    { (unichar_t *) N_("Mongolian (Mongolian)"), NULL, 0, 0, (void *) 0x850, NULL, 0, 0, 0, 0, 0, 0, 1},
 
742
    { (unichar_t *) N_("Nepali"), NULL, 0, 0, (void *) 0x461, NULL, 0, 0, 0, 0, 0, 0, 1},
 
743
    { (unichar_t *) N_("Nepali (India)"), NULL, 0, 0, (void *) 0x861, NULL, 0, 0, 0, 0, 0, 0, 1},
 
744
    { (unichar_t *) N_("Norwegian (Bokmal)"), NULL, 0, 0, (void *) 0x414, NULL, 0, 0, 0, 0, 0, 0, 1},
 
745
    { (unichar_t *) N_("Norwegian (Nynorsk)"), NULL, 0, 0, (void *) 0x814, NULL, 0, 0, 0, 0, 0, 0, 1},
 
746
    { (unichar_t *) N_("Lang|Oriya"), NULL, 0, 0, (void *) 0x448, NULL, 0, 0, 0, 0, 0, 0, 1},
 
747
    { (unichar_t *) N_("Oromo"), NULL, 0, 0, (void *) 0x472, NULL, 0, 0, 0, 0, 0, 0, 1},
 
748
    { (unichar_t *) N_("Papiamentu"), NULL, 0, 0, (void *) 0x479, NULL, 0, 0, 0, 0, 0, 0, 1},
 
749
    { (unichar_t *) N_("Pashto"), NULL, 0, 0, (void *) 0x463, NULL, 0, 0, 0, 0, 0, 0, 1},
 
750
    { (unichar_t *) N_("Polish"), NULL, 0, 0, (void *) 0x415, NULL, 0, 0, 0, 0, 0, 0, 1},
 
751
    { (unichar_t *) N_("Portugese (Portugal)"), NULL, 0, 0, (void *) 0x416, NULL, 0, 0, 0, 0, 0, 0, 1},
 
752
    { (unichar_t *) N_("Portuguese (Brasil)"), NULL, 0, 0, (void *) 0x816, NULL, 0, 0, 0, 0, 0, 0, 1},
 
753
    { (unichar_t *) N_("Punjabi (India)"), NULL, 0, 0, (void *) 0x446, NULL, 0, 0, 0, 0, 0, 0, 1},
 
754
    { (unichar_t *) N_("Punjabi (Pakistan)"), NULL, 0, 0, (void *) 0x846, NULL, 0, 0, 0, 0, 0, 0, 1},
 
755
    { (unichar_t *) N_("Quecha (Bolivia)"), NULL, 0, 0, (void *) 0x46b, NULL, 0, 0, 0, 0, 0, 0, 1},
 
756
    { (unichar_t *) N_("Quecha (Ecuador)"), NULL, 0, 0, (void *) 0x86b, NULL, 0, 0, 0, 0, 0, 0, 1},
 
757
    { (unichar_t *) N_("Quecha (Peru)"), NULL, 0, 0, (void *) 0xc6b, NULL, 0, 0, 0, 0, 0, 0, 1},
 
758
    { (unichar_t *) N_("Rhaeto-Romanic"), NULL, 0, 0, (void *) 0x417, NULL, 0, 0, 0, 0, 0, 0, 1},
 
759
    { (unichar_t *) N_("Romanian"), NULL, 0, 0, (void *) 0x418, NULL, 0, 0, 0, 0, 0, 0, 1},
 
760
    { (unichar_t *) N_("Romanian (Moldova)"), NULL, 0, 0, (void *) 0x818, NULL, 0, 0, 0, 0, 0, 0, 1},
 
761
    { (unichar_t *) N_("Russian"), NULL, 0, 0, (void *) 0x419, NULL, 0, 0, 0, 0, 0, 0, 1},
 
762
    { (unichar_t *) N_("Russian (Moldova)"), NULL, 0, 0, (void *) 0x819, NULL, 0, 0, 0, 0, 0, 0, 1},
 
763
    { (unichar_t *) N_("Sami (Lappish)"), NULL, 0, 0, (void *) 0x43b, NULL, 0, 0, 0, 0, 0, 0, 1},
 
764
    { (unichar_t *) N_("Sanskrit"), NULL, 0, 0, (void *) 0x43b, NULL, 0, 0, 0, 0, 0, 0, 1},
 
765
    { (unichar_t *) N_("Sepedi"), NULL, 0, 0, (void *) 0x46c, NULL, 0, 0, 0, 0, 0, 0, 1},
 
766
    { (unichar_t *) N_("Serbian (Cyrillic)"), NULL, 0, 0, (void *) 0xc1a, NULL, 0, 0, 0, 0, 0, 0, 1},
 
767
    { (unichar_t *) N_("Serbian (Latin)"), NULL, 0, 0, (void *) 0x81a, NULL, 0, 0, 0, 0, 0, 0, 1},
 
768
    { (unichar_t *) N_("Sindhi India"), NULL, 0, 0, (void *) 0x459, NULL, 0, 0, 0, 0, 0, 0, 1},
 
769
    { (unichar_t *) N_("Sindhi Pakistan"), NULL, 0, 0, (void *) 0x859, NULL, 0, 0, 0, 0, 0, 0, 1},
 
770
    { (unichar_t *) N_("Lang|Sinhalese"), NULL, 0, 0, (void *) 0x45b, NULL, 0, 0, 0, 0, 0, 0, 1},
 
771
    { (unichar_t *) N_("Slovak"), NULL, 0, 0, (void *) 0x41b, NULL, 0, 0, 0, 0, 0, 0, 1},
 
772
    { (unichar_t *) N_("Slovenian"), NULL, 0, 0, (void *) 0x424, NULL, 0, 0, 0, 0, 0, 0, 1},
 
773
    { (unichar_t *) N_("Sorbian"), NULL, 0, 0, (void *) 0x42e, NULL, 0, 0, 0, 0, 0, 0, 1},
 
774
    { (unichar_t *) N_("Spanish (Traditional)"), NULL, 0, 0, (void *) 0x40a, NULL, 0, 0, 0, 0, 0, 0, 1},
 
775
    { (unichar_t *) N_("Spanish Mexico"), NULL, 0, 0, (void *) 0x80a, NULL, 0, 0, 0, 0, 0, 0, 1},
 
776
    { (unichar_t *) N_("Spanish (Modern)"), NULL, 0, 0, (void *) 0xc0a, NULL, 0, 0, 0, 0, 0, 0, 1},
 
777
    { (unichar_t *) N_("Spanish (Guatemala)"), NULL, 0, 0, (void *) 0x100a, NULL, 0, 0, 0, 0, 0, 0, 1},
 
778
    { (unichar_t *) N_("Spanish (Costa Rica)"), NULL, 0, 0, (void *) 0x140a, NULL, 0, 0, 0, 0, 0, 0, 1},
 
779
    { (unichar_t *) N_("Spanish (Panama)"), NULL, 0, 0, (void *) 0x180a, NULL, 0, 0, 0, 0, 0, 0, 1},
 
780
    { (unichar_t *) N_("Spanish (Dominican Republic)"), NULL, 0, 0, (void *) 0x1c0a, NULL, 0, 0, 0, 0, 0, 0, 1},
 
781
    { (unichar_t *) N_("Spanish (Venezuela)"), NULL, 0, 0, (void *) 0x200a, NULL, 0, 0, 0, 0, 0, 0, 1},
 
782
    { (unichar_t *) N_("Spanish (Colombia)"), NULL, 0, 0, (void *) 0x240a, NULL, 0, 0, 0, 0, 0, 0, 1},
 
783
    { (unichar_t *) N_("Spanish (Peru)"), NULL, 0, 0, (void *) 0x280a, NULL, 0, 0, 0, 0, 0, 0, 1},
 
784
    { (unichar_t *) N_("Spanish (Argentina)"), NULL, 0, 0, (void *) 0x2c0a, NULL, 0, 0, 0, 0, 0, 0, 1},
 
785
    { (unichar_t *) N_("Spanish (Ecuador)"), NULL, 0, 0, (void *) 0x300a, NULL, 0, 0, 0, 0, 0, 0, 1},
 
786
    { (unichar_t *) N_("Spanish (Chile)"), NULL, 0, 0, (void *) 0x340a, NULL, 0, 0, 0, 0, 0, 0, 1},
 
787
    { (unichar_t *) N_("Spanish (Uruguay)"), NULL, 0, 0, (void *) 0x380a, NULL, 0, 0, 0, 0, 0, 0, 1},
 
788
    { (unichar_t *) N_("Spanish (Paraguay)"), NULL, 0, 0, (void *) 0x3c0a, NULL, 0, 0, 0, 0, 0, 0, 1},
 
789
    { (unichar_t *) N_("Spanish (Bolivia)"), NULL, 0, 0, (void *) 0x400a, NULL, 0, 0, 0, 0, 0, 0, 1},
 
790
    { (unichar_t *) N_("Spanish (El Salvador)"), NULL, 0, 0, (void *) 0x440a, NULL, 0, 0, 0, 0, 0, 0, 1},
 
791
    { (unichar_t *) N_("Spanish (Honduras)"), NULL, 0, 0, (void *) 0x480a, NULL, 0, 0, 0, 0, 0, 0, 1},
 
792
    { (unichar_t *) N_("Spanish (Nicaragua)"), NULL, 0, 0, (void *) 0x4c0a, NULL, 0, 0, 0, 0, 0, 0, 1},
 
793
    { (unichar_t *) N_("Spanish (Puerto Rico)"), NULL, 0, 0, (void *) 0x500a, NULL, 0, 0, 0, 0, 0, 0, 1},
 
794
    { (unichar_t *) N_("Spanish (United States)"), NULL, 0, 0, (void *) 0x540a, NULL, 0, 0, 0, 0, 0, 0, 1},
 
795
    { (unichar_t *) N_("Spanish (Latin America)"), NULL, 0, 0, (void *) 0xe40a, NULL, 0, 0, 0, 0, 0, 0, 1},
 
796
    { (unichar_t *) N_("Sutu"), NULL, 0, 0, (void *) 0x430, NULL, 0, 0, 0, 0, 0, 0, 1},
 
797
    { (unichar_t *) N_("Swahili (Kenyan)"), NULL, 0, 0, (void *) 0x441, NULL, 0, 0, 0, 0, 0, 0, 1},
 
798
    { (unichar_t *) N_("Swedish (Sweden)"), NULL, 0, 0, (void *) 0x41d, NULL, 0, 0, 0, 0, 0, 0, 1},
 
799
    { (unichar_t *) N_("Swedish (Finland)"), NULL, 0, 0, (void *) 0x81d, NULL, 0, 0, 0, 0, 0, 0, 1},
 
800
    { (unichar_t *) N_("Lang|Syriac"), NULL, 0, 0, (void *) 0x45a, NULL, 0, 0, 0, 0, 0, 0, 1},
 
801
    { (unichar_t *) N_("Lang|Tagalog"), NULL, 0, 0, (void *) 0x464, NULL, 0, 0, 0, 0, 0, 0, 1},
 
802
    { (unichar_t *) N_("Tajik"), NULL, 0, 0, (void *) 0x428, NULL, 0, 0, 0, 0, 0, 0, 1},
 
803
    { (unichar_t *) N_("Tamazight (Arabic)"), NULL, 0, 0, (void *) 0x45f, NULL, 0, 0, 0, 0, 0, 0, 1},
 
804
    { (unichar_t *) N_("Tamazight (Latin)"), NULL, 0, 0, (void *) 0x85f, NULL, 0, 0, 0, 0, 0, 0, 1},
 
805
    { (unichar_t *) N_("Lang|Tamil"), NULL, 0, 0, (void *) 0x449, NULL, 0, 0, 0, 0, 0, 0, 1},
 
806
    { (unichar_t *) N_("Tatar (Tatarstan)"), NULL, 0, 0, (void *) 0x444, NULL, 0, 0, 0, 0, 0, 0, 1},
 
807
    { (unichar_t *) N_("Lang|Telugu"), NULL, 0, 0, (void *) 0x44a, NULL, 0, 0, 0, 0, 0, 0, 1},
 
808
    { (unichar_t *) N_("Lang|Thai"), NULL, 0, 0, (void *) 0x41e, NULL, 0, 0, 0, 0, 0, 0, 1},
 
809
    { (unichar_t *) N_("Tibetan (PRC)"), NULL, 0, 0, (void *) 0x451, NULL, 0, 0, 0, 0, 0, 0, 1},
 
810
    { (unichar_t *) N_("Tibetan Bhutan"), NULL, 0, 0, (void *) 0x851, NULL, 0, 0, 0, 0, 0, 0, 1},
 
811
    { (unichar_t *) N_("Tigrinya Ethiopia"), NULL, 0, 0, (void *) 0x473, NULL, 0, 0, 0, 0, 0, 0, 1},
 
812
    { (unichar_t *) N_("Tigrinyan Eritrea"), NULL, 0, 0, (void *) 0x873, NULL, 0, 0, 0, 0, 0, 0, 1},
 
813
    { (unichar_t *) N_("Tsonga"), NULL, 0, 0, (void *) 0x431, NULL, 0, 0, 0, 0, 0, 0, 1},
 
814
    { (unichar_t *) N_("Tswana"), NULL, 0, 0, (void *) 0x432, NULL, 0, 0, 0, 0, 0, 0, 1},
 
815
    { (unichar_t *) N_("Turkish"), NULL, 0, 0, (void *) 0x41f, NULL, 0, 0, 0, 0, 0, 0, 1},
 
816
    { (unichar_t *) N_("Turkmen"), NULL, 0, 0, (void *) 0x442, NULL, 0, 0, 0, 0, 0, 0, 1},
 
817
    { (unichar_t *) N_("Lang|Uighur"), NULL, 0, 0, (void *) 0x480, NULL, 0, 0, 0, 0, 0, 0, 1},
 
818
    { (unichar_t *) N_("Ukrainian"), NULL, 0, 0, (void *) 0x422, NULL, 0, 0, 0, 0, 0, 0, 1},
 
819
    { (unichar_t *) N_("Urdu (Pakistan)"), NULL, 0, 0, (void *) 0x420, NULL, 0, 0, 0, 0, 0, 0, 1},
 
820
    { (unichar_t *) N_("Urdu (India)"), NULL, 0, 0, (void *) 0x820, NULL, 0, 0, 0, 0, 0, 0, 1},
 
821
    { (unichar_t *) N_("Uzbek (Latin)"), NULL, 0, 0, (void *) 0x443, NULL, 0, 0, 0, 0, 0, 0, 1},
 
822
    { (unichar_t *) N_("Uzbek (Cyrillic)"), NULL, 0, 0, (void *) 0x843, NULL, 0, 0, 0, 0, 0, 0, 1},
 
823
    { (unichar_t *) N_("Venda"), NULL, 0, 0, (void *) 0x433, NULL, 0, 0, 0, 0, 0, 0, 1},
 
824
    { (unichar_t *) N_("Vietnamese"), NULL, 0, 0, (void *) 0x42a, NULL, 0, 0, 0, 0, 0, 0, 1},
 
825
    { (unichar_t *) N_("Welsh"), NULL, 0, 0, (void *) 0x452, NULL, 0, 0, 0, 0, 0, 0, 1},
 
826
    { (unichar_t *) N_("Xhosa"), NULL, 0, 0, (void *) 0x434, NULL, 0, 0, 0, 0, 0, 0, 1},
 
827
    { (unichar_t *) N_("Lang|Yi"), NULL, 0, 0, (void *) 0x478, NULL, 0, 0, 0, 0, 0, 0, 1},
 
828
    { (unichar_t *) N_("Yiddish"), NULL, 0, 0, (void *) 0x43d, NULL, 0, 0, 0, 0, 0, 0, 1},
 
829
    { (unichar_t *) N_("Yoruba"), NULL, 0, 0, (void *) 0x46a, NULL, 0, 0, 0, 0, 0, 0, 1},
 
830
    { (unichar_t *) N_("Zulu"), NULL, 0, 0, (void *) 0x435, NULL, 0, 0, 0, 0, 0, 0, 1},
 
831
    { NULL }};
 
832
static GTextInfo ttfnameids[] = {
 
833
/* Put styles (docs call it subfamily) first because it is most likely to change */
 
834
    { (unichar_t *) N_("Styles (SubFamily)"), NULL, 0, 0, (void *) 2, NULL, 0, 0, 0, 0, 1, 0, 1},
 
835
    { (unichar_t *) N_("Copyright"), NULL, 0, 0, (void *) 0, NULL, 0, 0, 0, 0, 0, 0, 1},
 
836
    { (unichar_t *) N_("Family"), NULL, 0, 0, (void *) 1, NULL, 0, 0, 0, 0, 0, 0, 1},
 
837
    { (unichar_t *) N_("Fullname"), NULL, 0, 0, (void *) 4, NULL, 0, 0, 0, 0, 0, 0, 1},
 
838
    { (unichar_t *) N_("UniqueID"), NULL, 0, 0, (void *) 3, NULL, 0, 0, 0, 0, 0, 0, 1},
 
839
    { (unichar_t *) N_("Version"), NULL, 0, 0, (void *) 5, NULL, 0, 0, 0, 0, 0, 0, 1},
 
840
/* Don't give user access to PostscriptName, we set that elsewhere */
 
841
    { (unichar_t *) N_("Trademark"), NULL, 0, 0, (void *) 7, NULL, 0, 0, 0, 0, 0, 0, 1},
 
842
    { (unichar_t *) N_("Manufacturer"), NULL, 0, 0, (void *) 8, NULL, 0, 0, 0, 0, 0, 0, 1},
 
843
    { (unichar_t *) N_("Designer"), NULL, 0, 0, (void *) 9, NULL, 0, 0, 0, 0, 0, 0, 1},
 
844
    { (unichar_t *) N_("Descriptor"), NULL, 0, 0, (void *) 10, NULL, 0, 0, 0, 0, 0, 0, 1},
 
845
    { (unichar_t *) N_("Vendor URL"), NULL, 0, 0, (void *) 11, NULL, 0, 0, 0, 0, 0, 0, 1},
 
846
    { (unichar_t *) N_("Designer URL"), NULL, 0, 0, (void *) 12, NULL, 0, 0, 0, 0, 0, 0, 1},
 
847
    { (unichar_t *) N_("License"), NULL, 0, 0, (void *) 13, NULL, 0, 0, 0, 0, 0, 0, 1},
 
848
    { (unichar_t *) N_("License URL"), NULL, 0, 0, (void *) 14, NULL, 0, 0, 0, 0, 0, 0, 1},
 
849
/* slot 15 is reserved */
 
850
    { (unichar_t *) N_("Preferred Family"), NULL, 0, 0, (void *) 16, NULL, 0, 0, 0, 0, 0, 0, 1},
 
851
    { (unichar_t *) N_("Preferred Styles"), NULL, 0, 0, (void *) 17, NULL, 0, 0, 0, 0, 0, 0, 1},
 
852
    { (unichar_t *) N_("Compatible Full"), NULL, 0, 0, (void *) 18, NULL, 0, 0, 0, 0, 0, 0, 1},
 
853
    { (unichar_t *) N_("Sample Text"), NULL, 0, 0, (void *) 19, NULL, 0, 0, 0, 0, 0, 0, 1},
 
854
    { (unichar_t *) N_("CID findfont Name"), NULL, 0, 0, (void *) 20, NULL, 0, 0, 0, 0, 0, 0, 1},
 
855
    { NULL }};
 
856
#ifndef FONTFORGE_CONFIG_NO_WINDOWING_UI
 
857
static char *TN_DefaultName(GGadget *g, int r, int c);
 
858
static void TN_StrIDEnable(GGadget *g,GMenuItem *mi, int r, int c);
 
859
static void TN_LangEnable(GGadget *g,GMenuItem *mi, int r, int c);
 
860
static struct col_init ci[3] = {
 
861
    { me_enum, NULL, mslanguages, TN_LangEnable, N_("Language") },
 
862
    { me_enum, NULL, ttfnameids, TN_StrIDEnable, N_("String ID") },
 
863
    { me_func, TN_DefaultName, NULL, NULL, N_("String") }
 
864
    };
 
865
#endif
 
866
static GTextInfo gridfit[] = {
 
867
    { (unichar_t *) N_("No Grid Fit"), NULL, 0, 0, (void *) 0, NULL, 0, 0, 0, 0, 1, 0, 1},
 
868
    { (unichar_t *) N_("Grid Fit"), NULL, 0, 0, (void *) 1, NULL, 0, 0, 0, 0, 0, 0, 1},
 
869
    { NULL }};
 
870
static GTextInfo antialias[] = {
 
871
    { (unichar_t *) N_("No Anti-Alias"), NULL, 0, 0, (void *) 0, NULL, 0, 0, 0, 0, 1, 0, 1},
 
872
    { (unichar_t *) N_("Anti-Alias"), NULL, 0, 0, (void *) 1, NULL, 0, 0, 0, 0, 0, 0, 1},
 
873
    { NULL }};
 
874
#ifndef FONTFORGE_CONFIG_NO_WINDOWING_UI
 
875
static GTextInfo symsmooth[] = {
 
876
    { (unichar_t *) N_("No Symmetric-Smooth"), NULL, 0, 0, (void *) 0, NULL, 0, 0, 0, 0, 1, 0, 1},
 
877
    { (unichar_t *) N_("Symmetric-Smoothing"), NULL, 0, 0, (void *) 1, NULL, 0, 0, 0, 0, 0, 0, 1},
 
878
    { NULL }};
 
879
static GTextInfo gfsymsmooth[] = {
 
880
    { (unichar_t *) N_("No Grid Fit w/ Sym-Smooth"), NULL, 0, 0, (void *) 0, NULL, 0, 0, 0, 0, 1, 0, 1},
 
881
    { (unichar_t *) N_("Grid Fit w/ Sym-Smooth"), NULL, 0, 0, (void *) 1, NULL, 0, 0, 0, 0, 0, 0, 1},
 
882
    { NULL }};
 
883
static struct col_init gaspci[5] = {
 
884
    { me_int , NULL, NULL, NULL, N_("Gasp|Pixels Per EM") },
 
885
    { me_enum, NULL, gridfit, NULL, N_("Gasp|Grid Fit") },
 
886
    { me_enum, NULL, antialias, NULL, N_("Gasp|Anti-Alias") },
 
887
    { me_enum, NULL, symsmooth, NULL, N_("Gasp|Symmetric Smoothing") },
 
888
    { me_enum, NULL, gfsymsmooth, NULL, N_("Gasp|Grid Fit w/ Sym Smooth") }
 
889
    };
 
890
#endif
 
891
 
 
892
struct langstyle { int lang; const char *str; };
 
893
static const char regulareng[] = "Regular";
 
894
static const char demiboldeng[] = "DemiBold";
 
895
static const char demiboldeng3[] = "Demi";
 
896
static const char demiboldeng5[] = "SemiBold";
 
897
static const char boldeng[] = "Bold";
 
898
static const char thineng[] = "Thin";
 
899
static const char lighteng[] = "Light";
 
900
static const char extralighteng[] = "ExtraLight";
 
901
static const char extralighteng2[] = "VeryLight";
 
902
static const char mediumeng[] = "Medium";
 
903
static const char bookeng[] = "Book";
 
904
static const char heavyeng[] = "Heavy";
 
905
static const char blackeng[] = "Black";
 
906
static const char italiceng[] = "Italic";
 
907
static const char obliqueeng[] = "Oblique";
 
908
static const char condensedeng[] = "Condensed";
 
909
static const char expandedeng[] = "Expanded";
 
910
static const char outlineeng[] = "Outline";
 
911
 
 
912
static const char regularfren[] = "Normal";
 
913
static const char boldfren[] = "Gras";
 
914
static const char demiboldfren[] = "DemiGras";
 
915
static const char demiboldfren2[] = "Demi";
 
916
static const char mediumfren[] = "Normal";
 
917
static const char lightfren[] = "Maigre";
 
918
static const char blackfren[] = "ExtraGras";
 
919
static const char italicfren[] = "Italique";
 
920
static const char obliquefren[] = "Oblique";
 
921
static const char condensedfren[] = "Etroite";
 
922
static const char expandedfren[] = "Elargi";
 
923
static const char outlinefren[] = "Contour";
 
924
 
 
925
static const char regulargerm[] = "Standard";
 
926
static const char demiboldgerm[] = "Halbfett";
 
927
static const char demiboldgerm2[] = "Schmallfett";
 
928
static const char boldgerm[] = "Fett";
 
929
static const char boldgerm2[] = "Dick";
 
930
static const char blackgerm[] = "Schwarz";
 
931
static const char lightgerm[] = "Mager";
 
932
static const char mediumgerm[] = "Mittel";
 
933
static const char bookgerm[] = "Buchschrift";
 
934
static const char italicgerm[] = "Kursiv";
 
935
static const char obliquegerm[] = "Schr\303\244g";
 
936
static const char condensedgerm[] = "Schmal";
 
937
static const char expandedgerm[] = "Breit";
 
938
static const char outlinegerm[] = "Konturert";
 
939
 
 
940
static const char regularspan[] = "Normal";
 
941
static const char boldspan[] = "Negrita";
 
942
static const char lightspan[] = "Fina";
 
943
static const char blackspan[] = "Supernegra";
 
944
static const char italicspan[] = "Cursiva";
 
945
static const char condensedspan[] = "Condensada";
 
946
static const char expandedspan[] = "Amplida";
 
947
 
 
948
static const char regulardutch[] = "Normaal";
 
949
static const char mediumdutch[] = "Normaal";
 
950
static const char bookdutch[] = "Normaal";
 
951
static const char bolddutch[] = "Vet";
 
952
static const char demibolddutch[] = "Halfvet";
 
953
static const char lightdutch[] = "Licht mager";
 
954
static const char blackdutch[] = "Extra vet";
 
955
static const char italicdutch[] = "Cursief";
 
956
static const char italicdutch2[] = "italiek";
 
957
static const char obliquedutch[] = "oblique";
 
958
static const char obliquedutch2[] = "schuin";
 
959
static const char condenseddutch[] = "Smal";
 
960
static const char expandeddutch[] = "Breed";
 
961
static const char outlinedutch[] = "Contour";
 
962
 
 
963
static const char regularswed[] = "Mager";
 
964
static const char boldswed[] = "Fet";
 
965
static const char lightswed[] = "Extrafin";
 
966
static const char blackswed[] = "Extrafet";
 
967
static const char italicswed[] = "Kursiv";
 
968
static const char condensedswed[] = "Smal";
 
969
static const char expandedswed[] = "Bred";
 
970
 
 
971
static const char regulardanish[] = "Normal";
 
972
static const char bolddanish[] = "Fed";
 
973
static const char demibolddanish[] = "Halvfed";
 
974
static const char lightdanish[] = "Fin";
 
975
static const char mediumdanish[] = "Medium";
 
976
static const char blackdanish[] = "Extrafed";
 
977
static const char italicdanish[] = "Kursiv";
 
978
static const char condenseddanish[] = "Smal";
 
979
static const char expandeddanish[] = "Bred";
 
980
static const char outlinedanish[] = "Kontour";
 
981
 
 
982
static const char regularnor[] = "Vanlig";
 
983
static const char boldnor[] = "Halvfet";
 
984
static const char lightnor[] = "Mager";
 
985
static const char blacknor[] = "Fet";
 
986
static const char italicnor[] = "Kursiv";
 
987
static const char condensednor[] = "Smal";
 
988
static const char expandednor[] = "Sperret";
 
989
 
 
990
static const char regularital[] = "Normale";
 
991
static const char demiboldital[] = "Nerretto";
 
992
static const char boldital[] = "Nero";
 
993
static const char thinital[] = "Fine";
 
994
static const char lightital[] = "Chiaro";
 
995
static const char mediumital[] = "Medio";
 
996
static const char bookital[] = "Libro";
 
997
static const char heavyital[] = "Nerissimo";
 
998
static const char blackital[] = "ExtraNero";
 
999
static const char italicital[] = "Cursivo";
 
1000
static const char obliqueital[] = "Obliquo";
 
1001
static const char condensedital[] = "Condensato";
 
1002
static const char expandedital[] = "Allargato";
 
1003
 
 
1004
static const char regularru[] = "\320\236\320\261\321\213\321\207\320\275\321\213\320\271";
 
1005
static const char demiboldru[] = "\320\237\320\276\320\273\321\203\320\266\320\270\321\200\320\275\321\213\320\271";
 
1006
static const char boldru[] = "\320\236\320\261\321\213\321\207\320\275\321\213\320\271";
 
1007
static const char heavyru[] = "\320\241\320\262\320\265\321\200\321\205\320\266\320\270\321\200\320\275\321\213\320\271";
 
1008
static const char blackru[] = "\320\247\321\221\321\200\320\275\321\213\320\271";
 
1009
static const char thinru[] = "\320\242\320\276\320\275\320\272\320\270\320\271";
 
1010
static const char lightru[] = "\320\241\320\262\320\265\321\202\320\273\321\213\320\271";
 
1011
static const char italicru[] = "\320\232\321\203\321\200\321\201\320\270\320\262";
 
1012
static const char obliqueru[] = "\320\235\320\260\320\272\320\273\320\276\320\275";
 
1013
static const char condensedru[] = "\320\243\320\267\320\272\320\270\320\271";
 
1014
static const char expandedru[] = "\320\250\320\270\321\200\320\276\320\272\320\270\320\271";
 
1015
 
 
1016
static const char regularhu[] = "Norm\303\241l";
 
1017
static const char demiboldhu[] = "Negyedk\303\266v\303\251r";
 
1018
static const char demiboldhu2[] = "F\303\251lk\303\266v\303\251r";
 
1019
static const char boldhu[] = "F\303\251lk\303\266v\303\251r";
 
1020
static const char boldhu2[] = "H\303\241romnegyedk\303\266v\303\251r";
 
1021
static const char thinhu[] = "Sov\303\241ny";
 
1022
static const char lighthu[] = "Vil\303\241gos";
 
1023
static const char mediumhu[] = "K\303\266zepes";
 
1024
static const char bookhu[] = "Halv\303\241ny";
 
1025
static const char bookhu2[] = "K\303\266nyv";
 
1026
static const char heavyhu[] = "K\303\266v\303\251r";
 
1027
static const char heavyhu2[] = "Extrak\303\266v\303\251r";
 
1028
static const char blackhu[] = "Fekete";
 
1029
static const char blackhu2[] = "S\303\266t\303\251t";
 
1030
static const char italichu[] = "D\305\221lt";
 
1031
static const char obliquehu[] = "D\303\266nt\303\266tt";
 
1032
static const char obliquehu2[] = "Ferde";
 
1033
static const char condensedhu[] = "Keskeny";
 
1034
static const char expandedhu[] = "Sz\303\251les";
 
1035
static const char outlinehu[] = "Kont\303\272ros";
 
1036
 
 
1037
static const char regularpl[] = "podstawowa";
 
1038
static const char demiboldpl[] = "p\303\263\305\202gruba";
 
1039
static const char boldpl[] = "pogrubiona";
 
1040
static const char thinpl[] = "cienka";
 
1041
static const char lightpl[] = "bardzo cienka";
 
1042
static const char heavypl[] = "bardzo gruba";
 
1043
static const char italicpl[] = "pochy\305\202a";
 
1044
static const char obliquepl[] = "pochy\305\202a";
 
1045
static const char condensedpl[] = "w\304\205ska";
 
1046
static const char expandedpl[] = "szeroka";
 
1047
static const char outlinepl[] = "konturowa";
 
1048
static const char mediumpl[] = "zwyk\305\202a";
 
1049
static const char bookpl[] = "zwyk\305\202a";
 
1050
 
 
1051
 
 
1052
#ifndef LUA_FF_LIB
 
1053
 
 
1054
static struct langstyle regs[] = { {0x409, regulareng}, { 0x40c, regularfren }, { 0x410, regularital }, { 0x407, regulargerm }, { 0x40a, regularspan }, { 0x419, regularru }, { 0x40e, regularhu },
 
1055
        { 0x413, regulardutch}, { 0x41d, regularswed }, { 0x414, regularnor },
 
1056
        { 0x406, regulardanish}, {0x415, regularpl }, { 0x804, "\346\255\243\345\270\270"},
 
1057
        { 0x408, "\316\272\316\261\316\275\316\277\316\275\316\271\316\272\316\256"}, { 0x42a, "Chu\341\272\251n"}, { 0 }};
 
1058
static struct langstyle meds[] = { {0x409, mediumeng}, { 0x410, mediumital },
 
1059
        { 0x40c, mediumfren }, { 0x407, mediumgerm }, { 0x40e, mediumhu },
 
1060
        { 0x406, mediumdanish}, {0x415, mediumpl }, { 0x804, "\344\270\255\347\255\211"}, 
 
1061
        { 0x408, "\302\265\316\265\317\203\316\261\316\257\316\261"}, { 0x42a, "V\341\273\253a"}, { 0x413, mediumdutch}, { 0 }};
 
1062
static struct langstyle books[] = { {0x409, bookeng}, { 0x410, bookital },
 
1063
        { 0x407, bookgerm }, { 0x40e, bookhu }, { 0x40e, bookhu2 },
 
1064
        { 0x415, bookpl}, { 0x804, "\344\271\246\344\275\223"}, { 0x408, "\303\237\316\271\303\237\316\273\316\257\316\277\317\205"},
 
1065
        { 0x42a, "S\303\241ch"}, { 0x413, bookdutch}, { 0 }};
 
1066
static struct langstyle bolds[] = { {0x409, boldeng}, { 0x410, boldital }, { 0x40c, boldfren }, { 0x407, boldgerm }, { 0x407, boldgerm2 }, { 0x40a, boldspan}, { 0x419, boldru }, { 0x40e, boldhu }, { 0x40e, boldhu2 }, 
 
1067
        { 0x413, bolddutch}, { 0x41d, boldswed }, { 0x414, boldnor },
 
1068
        { 0x406, bolddanish}, { 0x415, boldpl}, { 0x804, "\347\262\227\344\275\223"},  
 
1069
        { 0x408, "\316\255\316\275\317\204\316\277\316\275\316\267"}, { 0x42a, "\304\220\341\272\255m"}, { 0 }};
 
1070
static struct langstyle italics[] = { {0x409, italiceng}, { 0x410, italicital }, { 0x40c, italicfren }, { 0x407, italicgerm }, { 0x40a, italicspan}, { 0x419, italicru }, { 0x40e, italichu },
 
1071
        { 0x413, italicdutch}, { 0x413, italicdutch2}, { 0x41d, italicswed }, { 0x414, italicnor },
 
1072
        { 0x406, italicdanish}, { 0x415, italicpl}, { 0x804, "\346\226\234\344\275\223"},
 
1073
        { 0x408, "\316\233\316\265\316\271\317\210\316\257\316\261\317\202"}, { 0x42a, "Nghi\303\252ng" }, { 0 }};
 
1074
static struct langstyle obliques[] = { {0x409, obliqueeng}, { 0x410, obliqueital },
 
1075
        { 0x40c, obliquefren }, { 0x407, obliquegerm }, { 0x419, obliqueru },
 
1076
        { 0x40e, obliquehu }, { 0x40e, obliquehu2 }, {0x415, obliquepl},
 
1077
        { 0x804, "\346\226\234\344\275\223"}, { 0x408, "\317\200\316\273\316\254\316\263\316\271\316\261"},
 
1078
        { 0x42a, "Xi\303\252n" }, { 0x413, obliquedutch}, { 0x413, obliquedutch2}, { 0 }};
 
1079
static struct langstyle demibolds[] = { {0x409, demiboldeng}, {0x409, demiboldeng3}, {0x409, demiboldeng5},
 
1080
        { 0x410, demiboldital }, { 0x40c, demiboldfren }, { 0x40c, demiboldfren2 }, { 0x407, demiboldgerm }, { 0x407, demiboldgerm2 },
 
1081
        { 0x419, demiboldru }, { 0x40e, demiboldhu }, { 0x40e, demiboldhu2 },
 
1082
        { 0x406, demibolddanish}, { 0x415, demiboldpl },
 
1083
        { 0x804, "\347\225\245\347\262\227"}, { 0x408, "\316\267\302\265\316\271\316\255\316\275\317\204\316\277\316\275\316\267"},
 
1084
        { 0x42a, "N\341\273\255a \304\221\341\272\255m"}, { 0x413, demibolddutch}, { 0 }};
 
1085
static struct langstyle heavys[] = { {0x409, heavyeng}, { 0x410, heavyital },
 
1086
        { 0x419, heavyru }, { 0x40e, heavyhu }, { 0x40e, heavyhu2 },
 
1087
        { 0x415, heavypl }, { 0x804, "\347\262\227"}, { 0 }};
 
1088
static struct langstyle blacks[] = { {0x409, blackeng}, { 0x410, blackital }, { 0x40c, blackfren }, { 0x407, blackgerm }, { 0x419, blackru }, { 0x40e, blackhu }, { 0x40e, blackhu2 }, { 0x40a, blackspan }, 
 
1089
        { 0x413, blackdutch}, { 0x41d, blackswed }, { 0x414, blacknor }, { 0x406, blackdanish}, 
 
1090
        { 0x415, heavypl }, { 0x804, "\351\273\221"},  { 0x408, "\302\265\316\261\317\215\317\201\316\261"},
 
1091
                                                                         { 0x42a, "\304\220en"}, {0} };
 
1092
static struct langstyle thins[] = { {0x409, thineng}, { 0x410, thinital },
 
1093
        { 0x419, thinru }, { 0x40e, thinhu }, { 0x415, thinpl},
 
1094
        { 0x804, "\347\273\206"}, { 0 }};
 
1095
static struct langstyle extralights[] = { {0x409, extralighteng}, {0x409, extralighteng2},
 
1096
        { 0x804, "\346\236\201\347\273\206"}, {0}};
 
1097
static struct langstyle lights[] = { {0x409, lighteng}, {0x410, lightital}, {0x40c, lightfren}, {0x407, lightgerm}, { 0x419, lightru }, { 0x40e, lighthu }, { 0x40a, lightspan }, 
 
1098
        { 0x413, lightdutch}, { 0x41d, lightswed }, { 0x414, lightnor },
 
1099
        { 0x406, lightdanish}, { 0x415, lightpl}, { 0x804, "\347\273\206"},
 
1100
        { 0x408, "\316\273\316\265\317\200\317\204\316\256"}, { 0x42a, "Nh\341\272\271" }, { 0 }};
 
1101
static struct langstyle condenseds[] = { {0x409, condensedeng}, {0x410, condensedital}, {0x40c, condensedfren}, {0x407, condensedgerm}, { 0x419, condensedru }, { 0x40e, condensedhu }, { 0x40a, condensedspan }, 
 
1102
        { 0x413, condenseddutch}, { 0x41d, condensedswed },
 
1103
        { 0x414, condensednor }, { 0x406, condenseddanish},
 
1104
        { 0x415, condensedpl }, { 0x804, "\345\216\213\347\274\251"},
 
1105
        { 0x408, "\317\200\317\205\316\272\316\275\316\256"}, { 0x42a, "H\341\272\271p" }, { 0 }};
 
1106
static struct langstyle expandeds[] = { {0x409, expandedeng}, {0x410, expandedital}, {0x40c, expandedfren}, {0x407, expandedgerm}, { 0x419, expandedru }, { 0x40e, expandedhu }, { 0x40a, expandedspan }, 
 
1107
        { 0x413, expandeddutch}, { 0x41d, expandedswed }, { 0x414, expandednor },
 
1108
        { 0x406, expandeddanish}, { 0x415, expandedpl }, { 0x804, "\345\212\240\345\256\275"},
 
1109
        { 0x408, "\316\261\317\201\316\261\316\271\316\256"}, { 0x42a, "R\341\273\231ng" }, { 0 }};
 
1110
static struct langstyle outlines[] = { {0x409, outlineeng}, {0x40c, outlinefren},
 
1111
        {0x407, outlinegerm}, {0x40e, outlinehu}, { 0x406, outlinedanish},
 
1112
        {0x415, outlinepl}, { 0x804, "\350\275\256\345\273\223"}, { 0x408, "\317\200\316\265\317\201\316\271\316\263\317\201\316\254\316\274\316\274\316\261\317\204\316\277\317\202"},
 
1113
        {0x42a, "N\303\251t ngo\303\240i" }, { 0x413, outlinedutch}, { 0 }};
 
1114
static struct langstyle *stylelist[] = {regs, meds, books, demibolds, bolds, heavys, blacks,
 
1115
        extralights, lights, thins, italics, obliques, condenseds, expandeds, outlines, NULL };
 
1116
#endif
 
1117
 
 
1118
#define CID_Features    101             /* Mac stuff */
 
1119
#define CID_FeatureDel  103
 
1120
#define CID_FeatureEdit 105
 
1121
 
 
1122
#define CID_Family      1002
 
1123
#define CID_Weight      1003
 
1124
#define CID_ItalicAngle 1004
 
1125
#define CID_UPos        1005
 
1126
#define CID_UWidth      1006
 
1127
#define CID_Ascent      1007
 
1128
#define CID_Descent     1008
 
1129
#define CID_Notice      1010
 
1130
#define CID_Version     1011
 
1131
#define CID_UniqueID    1012
 
1132
#define CID_HasVerticalMetrics  1013
 
1133
#define CID_VOriginLab  1014
 
1134
#define CID_VOrigin     1015
 
1135
#define CID_Fontname    1016
 
1136
#define CID_Em          1017
 
1137
#define CID_Scale       1018
 
1138
#define CID_IsOrder2    1019
 
1139
#define CID_IsMultiLayer        1020
 
1140
#define CID_Interpretation      1021
 
1141
#define CID_IsStrokedFont       1022
 
1142
#define CID_StrokeWidth         1023
 
1143
#define CID_Namelist    1024
 
1144
#define CID_XUID        1113
 
1145
#define CID_Human       1114
 
1146
#define CID_SameAsFontname      1115
 
1147
#define CID_HasDefBase  1116
 
1148
#define CID_DefBaseName 1117
 
1149
 
 
1150
#define CID_PrivateEntries      2001
 
1151
#define CID_PrivateValues       2002
 
1152
#define CID_Add                 2003
 
1153
#define CID_Guess               2004
 
1154
#define CID_Remove              2005
 
1155
#define CID_Hist                2006
 
1156
 
 
1157
#define CID_TTFTabs             3000
 
1158
#define CID_WeightClass         3001
 
1159
#define CID_WidthClass          3002
 
1160
#define CID_PFMFamily           3003
 
1161
#define CID_FSType              3004
 
1162
#define CID_NoSubsetting        3005
 
1163
#define CID_OnlyBitmaps         3006
 
1164
#define CID_LineGap             3007
 
1165
#define CID_VLineGap            3008
 
1166
#define CID_VLineGapLab         3009
 
1167
#define CID_WinAscent           3010
 
1168
#define CID_WinAscentLab        3011
 
1169
#define CID_WinAscentIsOff      3012
 
1170
#define CID_WinDescent          3013
 
1171
#define CID_WinDescentLab       3014
 
1172
#define CID_WinDescentIsOff     3015
 
1173
#define CID_TypoAscent          3016
 
1174
#define CID_TypoAscentLab       3017
 
1175
#define CID_TypoAscentIsOff     3018
 
1176
#define CID_TypoDescent         3019
 
1177
#define CID_TypoDescentLab      3020
 
1178
#define CID_TypoDescentIsOff    3021
 
1179
#define CID_TypoLineGap         3022
 
1180
#define CID_HHeadAscent         3023
 
1181
#define CID_HHeadAscentLab      3024
 
1182
#define CID_HHeadAscentIsOff    3025
 
1183
#define CID_HHeadDescent        3026
 
1184
#define CID_HHeadDescentLab     3027
 
1185
#define CID_HHeadDescentIsOff   3028
 
1186
#define CID_Vendor              3029
 
1187
#define CID_IBMFamily           3030
 
1188
#define CID_OS2Version          3031
 
1189
#define CID_UseTypoMetrics      3032
 
1190
#define CID_WeightWidthSlopeOnly        3033
 
1191
 
 
1192
#define CID_SubSuperDefault     3100
 
1193
#define CID_SubXSize            3101
 
1194
#define CID_SubYSize            3102
 
1195
#define CID_SubXOffset          3103
 
1196
#define CID_SubYOffset          3104
 
1197
#define CID_SuperXSize          3105
 
1198
#define CID_SuperYSize          3106
 
1199
#define CID_SuperXOffset        3107
 
1200
#define CID_SuperYOffset        3108
 
1201
#define CID_StrikeoutSize       3109
 
1202
#define CID_StrikeoutPos        3110
 
1203
 
 
1204
#define CID_PanFamily           4001
 
1205
#define CID_PanSerifs           4002
 
1206
#define CID_PanWeight           4003
 
1207
#define CID_PanProp             4004
 
1208
#define CID_PanContrast         4005
 
1209
#define CID_PanStrokeVar        4006
 
1210
#define CID_PanArmStyle         4007
 
1211
#define CID_PanLetterform       4008
 
1212
#define CID_PanMidLine          4009
 
1213
#define CID_PanXHeight          4010
 
1214
#define CID_PanDefault          4011
 
1215
#define CID_PanFamilyLab        4021
 
1216
#define CID_PanSerifsLab        4022
 
1217
#define CID_PanWeightLab        4023
 
1218
#define CID_PanPropLab          4024
 
1219
#define CID_PanContrastLab      4025
 
1220
#define CID_PanStrokeVarLab     4026
 
1221
#define CID_PanArmStyleLab      4027
 
1222
#define CID_PanLetterformLab    4028
 
1223
#define CID_PanMidLineLab       4029
 
1224
#define CID_PanXHeightLab       4030
 
1225
 
 
1226
#define CID_TNLangSort          5001
 
1227
#define CID_TNStringSort        5002
 
1228
#define CID_TNVScroll           5003
 
1229
#define CID_TNHScroll           5004
 
1230
#define CID_TNames              5005
 
1231
 
 
1232
#define CID_Language            5006    /* Used by AskForLangNames */
 
1233
 
 
1234
#define CID_Gasp                5100
 
1235
#define CID_GaspVersion         5101
 
1236
#define CID_HeadClearType       5102
 
1237
 
 
1238
#define CID_Comment             6001
 
1239
 
 
1240
#define CID_MarkClasses         7101
 
1241
#define CID_MarkNew             7102
 
1242
#define CID_MarkEdit            7103
 
1243
 
 
1244
#define CID_TeXText             8001
 
1245
#define CID_TeXMathSym          8002
 
1246
#define CID_TeXMathExt          8003
 
1247
#define CID_MoreParams          8005
 
1248
#define CID_TeXExtraSpLabel     8006
 
1249
#define CID_TeX                 8007    /* through 8014 */
 
1250
 
 
1251
#define CID_DesignSize          8301
 
1252
#define CID_DesignBottom        8302
 
1253
#define CID_DesignTop           8303
 
1254
#define CID_StyleID             8304
 
1255
#define CID_StyleName           8305
 
1256
#define CID_StyleNameNew        8306
 
1257
#define CID_StyleNameDel        8307
 
1258
#define CID_StyleNameRename     8308
 
1259
 
 
1260
#define CID_Tabs                10001
 
1261
#define CID_OK                  10002
 
1262
#define CID_Cancel              10003
 
1263
#define CID_MainGroup           10004
 
1264
 
 
1265
#define CID_Lookups             11000
 
1266
#define CID_LookupTop           11001
 
1267
#define CID_LookupUp            11002
 
1268
#define CID_LookupDown          11003
 
1269
#define CID_LookupBottom        11004
 
1270
#define CID_AddLookup           11005
 
1271
#define CID_AddSubtable         11006
 
1272
#define CID_EditMetadata                11007
 
1273
#define CID_EditSubtable        11008
 
1274
#define CID_DeleteLookup        11009
 
1275
#define CID_MergeLookup         11010
 
1276
#define CID_RevertLookups       11011
 
1277
#define CID_LookupSort          11012
 
1278
#define CID_ImportLookups       11013
 
1279
#define CID_LookupWin           11020           /* (GSUB, add 1 for GPOS) */
 
1280
#define CID_LookupVSB           11022           /* (GSUB, add 1 for GPOS) */
 
1281
#define CID_LookupHSB           11024           /* (GSUB, add 1 for GPOS) */
 
1282
#define CID_SaveLookup          11026
 
1283
#define CID_SaveFeat            11027
 
1284
#define CID_AddAllAlternates    11028
 
1285
#define CID_AddDFLT             11029
 
1286
 
 
1287
#define CID_MacAutomatic        16000
 
1288
#define CID_MacStyles           16001
 
1289
#define CID_MacFOND             16002
 
1290
 
 
1291
#define CID_Unicode             16100
 
1292
#define CID_UnicodeEmpties      16101
 
1293
 
 
1294
const char *TTFNameIds(int id) {
 
1295
    int i;
 
1296
 
 
1297
    FontInfoInit();
 
1298
    for ( i=0; ttfnameids[i].text!=NULL; ++i )
 
1299
        if ( ttfnameids[i].userdata == (void *) (intpt) id )
 
1300
return( (char *) ttfnameids[i].text );
 
1301
 
 
1302
    if ( id==6 )
 
1303
return( "Postscript" );
 
1304
 
 
1305
return( _("Unknown") );
 
1306
}
 
1307
 
 
1308
const char *MSLangString(int language) {
 
1309
    int i;
 
1310
 
 
1311
    FontInfoInit();
 
1312
    for ( i=0; mslanguages[i].text!=NULL; ++i )
 
1313
        if ( mslanguages[i].userdata == (void *) (intpt) language )
 
1314
return( (char *) mslanguages[i].text );
 
1315
 
 
1316
    language &= 0xff;
 
1317
    for ( i=0; mslanguages[i].text!=NULL; ++i )
 
1318
        if ( ((intpt) mslanguages[i].userdata & 0xff) == language )
 
1319
return( (char *) mslanguages[i].text );
 
1320
 
 
1321
return( _("Unknown") );
 
1322
}
 
1323
 
 
1324
 
 
1325
struct psdict *PSDictCopy(struct psdict *dict) {
 
1326
    struct psdict *ret;
 
1327
    int i;
 
1328
 
 
1329
    if ( dict==NULL )
 
1330
return( NULL );
 
1331
 
 
1332
    ret = gcalloc(1,sizeof(struct psdict));
 
1333
    ret->cnt = dict->cnt; ret->next = dict->next;
 
1334
    ret->keys = gcalloc(ret->cnt,sizeof(char *));
 
1335
    ret->values = gcalloc(ret->cnt,sizeof(char *));
 
1336
    for ( i=0; i<dict->next; ++i ) {
 
1337
        ret->keys[i] = copy(dict->keys[i]);
 
1338
        ret->values[i] = copy(dict->values[i]);
 
1339
    }
 
1340
 
 
1341
return( ret );
 
1342
}
 
1343
 
 
1344
int PSDictFindEntry(struct psdict *dict, char *key) {
 
1345
    int i;
 
1346
 
 
1347
    if ( dict==NULL )
 
1348
return( -1 );
 
1349
 
 
1350
    for ( i=0; i<dict->next; ++i )
 
1351
        if ( strcmp(dict->keys[i],key)==0 )
 
1352
return( i );
 
1353
 
 
1354
return( -1 );
 
1355
}
 
1356
 
 
1357
char *PSDictHasEntry(struct psdict *dict, char *key) {
 
1358
    int i;
 
1359
 
 
1360
    if ( dict==NULL )
 
1361
return( NULL );
 
1362
 
 
1363
    for ( i=0; i<dict->next; ++i )
 
1364
        if ( strcmp(dict->keys[i],key)==0 )
 
1365
return( dict->values[i] );
 
1366
 
 
1367
return( NULL );
 
1368
}
 
1369
 
 
1370
int PSDictRemoveEntry(struct psdict *dict, char *key) {
 
1371
    int i;
 
1372
 
 
1373
    if ( dict==NULL )
 
1374
return( false );
 
1375
 
 
1376
    for ( i=0; i<dict->next; ++i )
 
1377
        if ( strcmp(dict->keys[i],key)==0 )
 
1378
    break;
 
1379
    if ( i==dict->next )
 
1380
return( false );
 
1381
    free( dict->keys[i]);
 
1382
    free( dict->values[i] );
 
1383
    --dict->next;
 
1384
    while ( i<dict->next ) {
 
1385
        dict->keys[i] = dict->keys[i+1];
 
1386
        dict->values[i] = dict->values[i+1];
 
1387
        ++i;
 
1388
    }
 
1389
 
 
1390
return( true );
 
1391
}
 
1392
 
 
1393
int PSDictChangeEntry(struct psdict *dict, char *key, char *newval) {
 
1394
    int i;
 
1395
 
 
1396
    if ( dict==NULL )
 
1397
return( -1 );
 
1398
 
 
1399
    for ( i=0; i<dict->next; ++i )
 
1400
        if ( strcmp(dict->keys[i],key)==0 )
 
1401
    break;
 
1402
    if ( i==dict->next ) {
 
1403
        if ( dict->next>=dict->cnt ) {
 
1404
            dict->cnt += 10;
 
1405
            dict->keys = grealloc(dict->keys,dict->cnt*sizeof(char *));
 
1406
            dict->values = grealloc(dict->values,dict->cnt*sizeof(char *));
 
1407
        }
 
1408
        dict->keys[dict->next] = copy(key);
 
1409
        dict->values[dict->next] = NULL;
 
1410
        ++dict->next;
 
1411
    }
 
1412
    free(dict->values[i]);
 
1413
    dict->values[i] = copy(newval);
 
1414
return( i );
 
1415
}
 
1416
 
 
1417
#ifndef FONTFORGE_CONFIG_NO_WINDOWING_UI
 
1418
/* These are Postscript names, and as such should not be translated */
 
1419
enum { pt_number, pt_boolean, pt_array, pt_code };
 
1420
static struct { const char *name; short type, arr_size, present; } KnownPrivates[] = {
 
1421
    { "BlueValues", pt_array, 14 },
 
1422
    { "OtherBlues", pt_array, 10 },
 
1423
    { "BlueFuzz", pt_number },
 
1424
    { "FamilyBlues", pt_array, 14 },
 
1425
    { "FamilyOtherBlues", pt_array, 10 },
 
1426
    { "BlueScale", pt_number },
 
1427
    { "BlueShift", pt_number },
 
1428
    { "StdHW", pt_array, 1 },
 
1429
    { "StdVW", pt_array, 1 },
 
1430
    { "StemSnapH", pt_array, 12 },
 
1431
    { "StemSnapV", pt_array, 12 },
 
1432
    { "ForceBold", pt_boolean },
 
1433
    { "LanguageGroup", pt_number },
 
1434
    { "RndStemUp", pt_number },
 
1435
    { "lenIV", pt_number },
 
1436
    { "ExpansionFactor", pt_number },
 
1437
    { "Erode", pt_code },
 
1438
/* I am deliberately not including Subrs and OtherSubrs */
 
1439
/* The first could not be entered (because it's a set of binary strings) */
 
1440
/* And the second has special meaning to us and must be handled with care */
 
1441
    { NULL }
 
1442
};
 
1443
 
 
1444
struct ask_data {
 
1445
    int ret;
 
1446
    int done;
 
1447
};
 
1448
 
 
1449
static int Ask_Cancel(GGadget *g, GEvent *e) {
 
1450
    GWindow gw;
 
1451
    struct ask_data *d;
 
1452
 
 
1453
    if ( e->type==et_controlevent && e->u.control.subtype == et_buttonactivate ) {
 
1454
        gw = GGadgetGetWindow(g);
 
1455
        d = GDrawGetUserData(gw);
 
1456
        d->done = true;
 
1457
    }
 
1458
return( true );
 
1459
}
 
1460
 
 
1461
static int Ask_OK(GGadget *g, GEvent *e) {
 
1462
    GWindow gw;
 
1463
    struct ask_data *d;
 
1464
 
 
1465
    if ( e->type==et_controlevent && e->u.control.subtype == et_buttonactivate ) {
 
1466
        gw = GGadgetGetWindow(g);
 
1467
        d = GDrawGetUserData(gw);
 
1468
        d->done = d->ret = true;
 
1469
    }
 
1470
return( true );
 
1471
}
 
1472
 
 
1473
static int ask_e_h(GWindow gw, GEvent *event) {
 
1474
    if ( event->type==et_close ) {
 
1475
        struct ask_data *d = GDrawGetUserData(gw);
 
1476
        d->done = true;
 
1477
    } else if ( event->type == et_char ) {
 
1478
return( false );
 
1479
    }
 
1480
return( true );
 
1481
}
 
1482
 
 
1483
static char *AskKey(SplineFont *sf) {
 
1484
    int i,j, cnt=0;
 
1485
    GTextInfo *ti;
 
1486
    GRect pos;
 
1487
    GWindow gw;
 
1488
    GWindowAttrs wattrs;
 
1489
    GGadgetCreateData gcd[8], boxes[3], *varray[9], *harray[7];
 
1490
    GTextInfo label[8];
 
1491
    struct ask_data d;
 
1492
    char *ret;
 
1493
    int ptwidth;
 
1494
 
 
1495
    if ( sf->private==NULL )
 
1496
        for ( i=0; KnownPrivates[i].name!=NULL; ++i ) {
 
1497
            KnownPrivates[i].present = 0;
 
1498
            ++cnt;
 
1499
        }
 
1500
    else {
 
1501
        for ( i=0; KnownPrivates[i].name!=NULL; ++i ) {
 
1502
            for ( j=0; j<sf->private->next; ++j )
 
1503
                if ( strcmp(KnownPrivates[i].name,sf->private->keys[j])==0 )
 
1504
            break;
 
1505
            if ( !(KnownPrivates[i].present = (j<sf->private->next)) )
 
1506
                ++cnt;
 
1507
        }
 
1508
    }
 
1509
    if ( cnt==0 )
 
1510
        ti = NULL;
 
1511
    else {
 
1512
        ti = gcalloc(cnt+1,sizeof(GTextInfo));
 
1513
        for ( i=cnt=0; KnownPrivates[i].name!=NULL; ++i )
 
1514
            if ( !KnownPrivates[i].present )
 
1515
                ti[cnt++].text = uc_copy(KnownPrivates[i].name);
 
1516
    }
 
1517
 
 
1518
    memset(&d,'\0',sizeof(d));
 
1519
 
 
1520
    memset(&wattrs,0,sizeof(wattrs));
 
1521
    wattrs.mask = wam_events|wam_cursor|wam_utf8_wtitle|wam_undercursor|wam_restrict;
 
1522
    wattrs.event_masks = ~(1<<et_charup);
 
1523
    wattrs.restrict_input_to_me = 1;
 
1524
    wattrs.undercursor = 1;
 
1525
    wattrs.cursor = ct_pointer;
 
1526
    wattrs.utf8_window_title = _("Private Key");
 
1527
    pos.x = pos.y = 0;
 
1528
    ptwidth = 2*GIntGetResource(_NUM_Buttonsize)+GGadgetScale(60);
 
1529
    pos.width =GDrawPointsToPixels(NULL,ptwidth);
 
1530
    pos.height = GDrawPointsToPixels(NULL,90);
 
1531
    gw = GDrawCreateTopWindow(NULL,&pos,ask_e_h,&d,&wattrs);
 
1532
 
 
1533
    memset(&label,0,sizeof(label));
 
1534
    memset(&gcd,0,sizeof(gcd));
 
1535
 
 
1536
    label[0].text = (unichar_t *) _("Key (in Private dictionary)");
 
1537
    label[0].text_is_1byte = true;
 
1538
    gcd[0].gd.label = &label[0];
 
1539
    gcd[0].gd.pos.x = 10; gcd[0].gd.pos.y = 6;
 
1540
    gcd[0].gd.flags = gg_visible | gg_enabled;
 
1541
    gcd[0].creator = GLabelCreate;
 
1542
    varray[0] = &gcd[0]; varray[1] = NULL;
 
1543
 
 
1544
    gcd[1].gd.pos.x = 10; gcd[1].gd.pos.y = 18; gcd[1].gd.pos.width = ptwidth-20;
 
1545
    gcd[1].gd.flags = gg_visible | gg_enabled;
 
1546
    gcd[1].creator = GTextFieldCreate;
 
1547
    if ( ti!=NULL ) {
 
1548
        gcd[1].gd.u.list = ti;
 
1549
        gcd[1].creator = GListFieldCreate;
 
1550
    }
 
1551
    varray[2] = &gcd[1]; varray[3] = NULL;
 
1552
    varray[4] = GCD_Glue; varray[5] = NULL;
 
1553
 
 
1554
    gcd[2].gd.pos.x = 20-3; gcd[2].gd.pos.y = 90-35-3;
 
1555
    gcd[2].gd.pos.width = -1; gcd[2].gd.pos.height = 0;
 
1556
    gcd[2].gd.flags = gg_visible | gg_enabled | gg_but_default;
 
1557
    label[2].text = (unichar_t *) _("_OK");
 
1558
    label[2].text_is_1byte = true;
 
1559
    label[2].text_in_resource = true;
 
1560
    gcd[2].gd.label = &label[2];
 
1561
    gcd[2].gd.handle_controlevent = Ask_OK;
 
1562
    gcd[2].creator = GButtonCreate;
 
1563
    harray[0] = GCD_Glue; harray[1] = &gcd[2]; harray[2] = GCD_Glue;
 
1564
 
 
1565
    gcd[3].gd.pos.x = -20; gcd[3].gd.pos.y = 90-35;
 
1566
    gcd[3].gd.pos.width = -1; gcd[3].gd.pos.height = 0;
 
1567
    gcd[3].gd.flags = gg_visible | gg_enabled | gg_but_cancel;
 
1568
    label[3].text = (unichar_t *) _("_Cancel");
 
1569
    label[3].text_is_1byte = true;
 
1570
    label[3].text_in_resource = true;
 
1571
    gcd[3].gd.label = &label[3];
 
1572
    gcd[3].gd.handle_controlevent = Ask_Cancel;
 
1573
    gcd[3].creator = GButtonCreate;
 
1574
    harray[3] = GCD_Glue; harray[4] = &gcd[3]; harray[5] = GCD_Glue;
 
1575
    harray[6] = NULL;
 
1576
    varray[6] = &boxes[2]; varray[7] = NULL;
 
1577
    varray[8] = NULL;
 
1578
 
 
1579
    gcd[4].gd.pos.x = 2; gcd[4].gd.pos.y = 2;
 
1580
    gcd[4].gd.pos.width = pos.width-4; gcd[4].gd.pos.height = pos.height-2;
 
1581
    gcd[4].gd.flags = gg_enabled | gg_visible | gg_pos_in_pixels;
 
1582
    gcd[4].creator = GGroupCreate;
 
1583
 
 
1584
    memset(boxes,0,sizeof(boxes));
 
1585
    boxes[0].gd.pos.x = boxes[0].gd.pos.y = 2;
 
1586
    boxes[0].gd.flags = gg_enabled|gg_visible;
 
1587
    boxes[0].gd.u.boxelements = varray;
 
1588
    boxes[0].creator = GHVGroupCreate;
 
1589
 
 
1590
    boxes[2].gd.flags = gg_enabled|gg_visible;
 
1591
    boxes[2].gd.u.boxelements = harray;
 
1592
    boxes[2].creator = GHBoxCreate;
 
1593
 
 
1594
    GGadgetsCreate(gw,boxes);
 
1595
    GHVBoxSetExpandableRow(boxes[0].ret,gb_expandglue);
 
1596
    GHVBoxSetExpandableCol(boxes[2].ret,gb_expandgluesame);
 
1597
    GHVBoxFitWindow(boxes[0].ret);
 
1598
    GWidgetHidePalettes();
 
1599
    GDrawSetVisible(gw,true);
 
1600
    while ( !d.done )
 
1601
        GDrawProcessOneEvent(NULL);
 
1602
    ret = NULL;
 
1603
    if ( d.ret )
 
1604
        ret = cu_copy(_GGadgetGetTitle(gcd[1].ret));
 
1605
    GTextInfoListFree(ti);
 
1606
    GDrawDestroyWindow(gw);
 
1607
return( ret );
 
1608
}
 
1609
 
 
1610
static GTextInfo *PI_ListSet(SplineFont *sf) {
 
1611
    GTextInfo *ti = gcalloc((sf->private==NULL?0:sf->private->next)+1,sizeof( GTextInfo ));
 
1612
    int i=0;
 
1613
 
 
1614
    if ( sf->private!=NULL ) {
 
1615
        for ( i=0; i<sf->private->next; ++i ) {
 
1616
            ti[i].text = uc_copy(sf->private->keys[i]);
 
1617
        }
 
1618
    }
 
1619
    if ( i!=0 )
 
1620
        ti[0].selected = true;
 
1621
return( ti );
 
1622
}
 
1623
 
 
1624
static GTextInfo **PI_ListArray(struct psdict *private) {
 
1625
    GTextInfo **ti = gcalloc((private==NULL?0:private->next)+1,sizeof( GTextInfo *));
 
1626
    int i=0;
 
1627
 
 
1628
    if ( private!=NULL ) {
 
1629
        for ( i=0; i<private->next; ++i ) {
 
1630
            ti[i] = gcalloc(1,sizeof(GTextInfo));
 
1631
            ti[i]->fg = ti[i]->bg = COLOR_DEFAULT;
 
1632
            ti[i]->text = uc_copy(private->keys[i]);
 
1633
        }
 
1634
    }
 
1635
    ti[i] = gcalloc(1,sizeof(GTextInfo));
 
1636
    if ( i!=0 )
 
1637
        ti[0]->selected = true;
 
1638
return( ti );
 
1639
}
 
1640
 
 
1641
static void PIPrivateCheck(struct gfi_data *d) {
 
1642
    if ( d->private==NULL ) {
 
1643
        if ( d->sf->private==NULL ) {
 
1644
            d->private = gcalloc(1,sizeof(struct psdict));
 
1645
            d->private->cnt = 10;
 
1646
            d->private->keys = gcalloc(10,sizeof(char *));
 
1647
            d->private->values = gcalloc(10,sizeof(char *));
 
1648
        } else
 
1649
            d->private = PSDictCopy(d->sf->private);
 
1650
    }
 
1651
}
 
1652
 
 
1653
static int PIFinishFormer(struct gfi_data *d) {
 
1654
    unichar_t *end;
 
1655
#if defined(FONTFORGE_CONFIG_GDRAW)
 
1656
    char *buts[3];
 
1657
    buts[0] = _("_OK"); buts[1] = _("_Cancel"); buts[2]=NULL;
 
1658
#elif defined(FONTFORGE_CONFIG_GTK)
 
1659
    static char *buts[] = { GTK_STOCK_OK, GTK_STOCK_CANCEL, NULL };
 
1660
#endif
 
1661
 
 
1662
    if ( d->old_sel < 0 )
 
1663
return( true );
 
1664
    if ( d->private==NULL && d->sf->private!=NULL ) {
 
1665
        const unichar_t *val = _GGadgetGetTitle(GWidgetGetControl(d->gw,CID_PrivateValues));
 
1666
        if ( uc_strcmp(val,d->sf->private->values[d->old_sel])==0 )
 
1667
return( true );                 /* Didn't change */
 
1668
        PIPrivateCheck(d);
 
1669
    }
 
1670
    if ( d->private!=NULL && d->old_sel>=0 && d->old_sel!=d->private->next ) {
 
1671
        const unichar_t *val = _GGadgetGetTitle(GWidgetGetControl(d->gw,CID_PrivateValues));
 
1672
        const unichar_t *pt = val;
 
1673
        int i;
 
1674
 
 
1675
        /* does the type appear reasonable? */
 
1676
        while ( isspace(*pt)) ++pt;
 
1677
        for ( i=0; KnownPrivates[i].name!=NULL; ++i )
 
1678
            if ( strcmp(KnownPrivates[i].name,d->private->keys[d->old_sel])==0 )
 
1679
        break;
 
1680
        if ( KnownPrivates[i].name!=NULL ) {
 
1681
            if ( KnownPrivates[i].type==pt_array ) {
 
1682
                if ( *pt!='[' && gwwv_ask(_("Bad type"),(const char **) buts,0,1,_("Expected array.\nProceed anyway?"))==1 )
 
1683
return( false );
 
1684
            } else if ( KnownPrivates[i].type==pt_boolean ) {
 
1685
                if ( uc_strcmp(pt,"true")!=0 && uc_strcmp(pt,"false")!=0 &&
 
1686
                        gwwv_ask(_("Bad type"),(const char **) buts,0,1,_("Expected boolean.\nProceed anyway?"))==1 )
 
1687
return( false );
 
1688
            } else if ( KnownPrivates[i].type==pt_code ) {
 
1689
                if ( *pt!='{' && gwwv_ask(_("Bad type"),(const char **) buts,0,1,_("Expected code.\nProceed anyway?"))==1 )
 
1690
return( false );
 
1691
            } else if ( KnownPrivates[i].type==pt_number ) {
 
1692
                u_strtod(pt,&end);
 
1693
                while ( isspace(*end)) ++end;
 
1694
                if ( *end!='\0' && gwwv_ask(_("Bad type"),(const char **) buts,0,1,_("Expected number.\nProceed anyway?"))==1 )
 
1695
return( false );
 
1696
            }
 
1697
        }
 
1698
 
 
1699
        /* Ok then set it */
 
1700
        free(d->private->values[d->old_sel]);
 
1701
        d->private->values[d->old_sel] = cu_copy(val);
 
1702
        d->old_sel = -1;
 
1703
    }
 
1704
return( true );
 
1705
}
 
1706
 
 
1707
static void ProcessListSel(struct gfi_data *d) {
 
1708
    GGadget *list = GWidgetGetControl(d->gw,CID_PrivateEntries);
 
1709
    int sel = GGadgetGetFirstListSelectedItem(list);
 
1710
    unichar_t *temp;
 
1711
    static const unichar_t nullstr[] = { 0 };
 
1712
    SplineFont *sf = d->sf;
 
1713
    struct psdict *private;
 
1714
 
 
1715
    if ( d->old_sel==sel )
 
1716
return;
 
1717
 
 
1718
    if ( !PIFinishFormer(d)) {
 
1719
        /*GGadgetSelectListItem(list,sel,false);*/
 
1720
        GGadgetSelectListItem(list,d->old_sel,true);
 
1721
return;
 
1722
    }
 
1723
    private = d->private ? d->private : sf->private;
 
1724
    if ( sel==-1 ) {
 
1725
        GGadgetSetEnabled(GWidgetGetControl(d->gw,CID_Remove),false);
 
1726
        GGadgetSetEnabled(GWidgetGetControl(d->gw,CID_Guess),false);
 
1727
        GGadgetSetEnabled(GWidgetGetControl(d->gw,CID_Hist),false);
 
1728
        GGadgetSetEnabled(GWidgetGetControl(d->gw,CID_PrivateValues),false);
 
1729
        GGadgetSetTitle(GWidgetGetControl(d->gw,CID_PrivateValues),nullstr);
 
1730
    } else {
 
1731
        GGadgetSetEnabled(GWidgetGetControl(d->gw,CID_Remove),true);
 
1732
        if ( strcmp(private->keys[sel],"BlueValues")==0 ||
 
1733
                strcmp(private->keys[sel],"OtherBlues")==0 ||
 
1734
                strcmp(private->keys[sel],"StdHW")==0 ||
 
1735
                strcmp(private->keys[sel],"StemSnapH")==0 ||
 
1736
                strcmp(private->keys[sel],"StdVW")==0 ||
 
1737
                strcmp(private->keys[sel],"StemSnapV")==0 ) {
 
1738
            GGadgetSetEnabled(GWidgetGetControl(d->gw,CID_Guess),true);
 
1739
            GGadgetSetEnabled(GWidgetGetControl(d->gw,CID_Hist),true);
 
1740
        } else {
 
1741
            GGadgetSetEnabled(GWidgetGetControl(d->gw,CID_Guess),false);
 
1742
            GGadgetSetEnabled(GWidgetGetControl(d->gw,CID_Hist),false);
 
1743
        }
 
1744
        GGadgetSetEnabled(GWidgetGetControl(d->gw,CID_PrivateValues),true);
 
1745
        GGadgetSetTitle(GWidgetGetControl(d->gw,CID_PrivateValues),
 
1746
                temp = uc_copy( private->values[sel]));
 
1747
        free( temp );
 
1748
        GTextFieldShow(GWidgetGetControl(d->gw,CID_PrivateValues),0);
 
1749
    }
 
1750
    d->old_sel = sel;
 
1751
}
 
1752
 
 
1753
static int PI_Add(GGadget *g, GEvent *e) {
 
1754
    GWindow gw;
 
1755
    struct gfi_data *d;
 
1756
    GGadget *list;
 
1757
    int i;
 
1758
    char *newkey;
 
1759
    GTextInfo **ti;
 
1760
 
 
1761
    if ( e->type==et_controlevent && e->u.control.subtype == et_buttonactivate ) {
 
1762
        gw = GGadgetGetWindow(g);
 
1763
        d = GDrawGetUserData(gw);
 
1764
        if ( !PIFinishFormer(d))
 
1765
return(true);
 
1766
        newkey = AskKey(d->sf);
 
1767
        if ( newkey==NULL )
 
1768
return( true );
 
1769
        PIPrivateCheck(d);
 
1770
        if (( i = PSDictFindEntry(d->private,newkey))==-1 )
 
1771
            i = PSDictChangeEntry(d->private,newkey,"");
 
1772
        list = GWidgetGetControl(d->gw,CID_PrivateEntries);
 
1773
        ti = PI_ListArray(d->private);
 
1774
        if ( i>0 ) {
 
1775
            ti[0]->selected = false;
 
1776
            ti[i]->selected = true;
 
1777
        }
 
1778
        GGadgetSetList(list,ti,false);
 
1779
        d->old_sel = -1;
 
1780
        ProcessListSel(d);
 
1781
        free(newkey);
 
1782
    }
 
1783
return( true );
 
1784
}
 
1785
 
 
1786
static void arraystring(char *buffer,real *array,int cnt) {
 
1787
    int i, ei;
 
1788
 
 
1789
    for ( ei=cnt; ei>1 && array[ei-1]==0; --ei );
 
1790
    *buffer++ = '[';
 
1791
    for ( i=0; i<ei; ++i ) {
 
1792
        sprintf(buffer, "%d ", (int) array[i]);
 
1793
        buffer += strlen(buffer);
 
1794
    }
 
1795
    if ( buffer[-1] ==' ' ) --buffer;
 
1796
    *buffer++ = ']'; *buffer='\0';
 
1797
}
 
1798
 
 
1799
static void SnapSet(struct psdict *private,real stemsnap[12], real snapcnt[12],
 
1800
        char *name1, char *name2 ) {
 
1801
    int i, mi;
 
1802
    char buffer[211];
 
1803
 
 
1804
    mi = -1;
 
1805
    for ( i=0; stemsnap[i]!=0 && i<12; ++i )
 
1806
        if ( mi==-1 ) mi = i;
 
1807
        else if ( snapcnt[i]>snapcnt[mi] ) mi = i;
 
1808
    if ( mi==-1 )
 
1809
return;
 
1810
    sprintf( buffer, "[%d]", (int) stemsnap[mi]);
 
1811
    PSDictChangeEntry(private,name1,buffer);
 
1812
    arraystring(buffer,stemsnap,12);
 
1813
    PSDictChangeEntry(private,name2,buffer);
 
1814
}
 
1815
 
 
1816
static int PI_Guess(GGadget *g, GEvent *e) {
 
1817
    GWindow gw;
 
1818
    struct gfi_data *d;
 
1819
    GGadget *list;
 
1820
    int sel;
 
1821
    SplineFont *sf;
 
1822
    real bluevalues[14], otherblues[10];
 
1823
    real snapcnt[12];
 
1824
    real stemsnap[12];
 
1825
    char buffer[211];
 
1826
    unichar_t *temp;
 
1827
    struct psdict *private;
 
1828
#if defined(FONTFORGE_CONFIG_GDRAW)
 
1829
    char *buts[3];
 
1830
    buts[0] = _("_OK"); buts[1] = _("_Cancel"); buts[2]=NULL;
 
1831
#elif defined(FONTFORGE_CONFIG_GTK)
 
1832
    static char *buts[] = { GTK_STOCK_OK, GTK_STOCK_CANCEL, NULL };
 
1833
#endif
 
1834
 
 
1835
    if ( e->type==et_controlevent && e->u.control.subtype == et_buttonactivate ) {
 
1836
        gw = GGadgetGetWindow(g);
 
1837
        d = GDrawGetUserData(gw);
 
1838
        sf = d->sf;
 
1839
        private = d->private ? d->private : sf->private;
 
1840
        list = GWidgetGetControl(d->gw,CID_PrivateEntries);
 
1841
        sel = GGadgetGetFirstListSelectedItem(list);
 
1842
        if ( strcmp(private->keys[sel],"BlueValues")==0 ||
 
1843
                strcmp(private->keys[sel],"OtherBlues")==0 ) {
 
1844
            if ( gwwv_ask(_("Guess"),(const char **) buts,0,1,_("This will change both BlueValues and OtherBlues.\nDo you want to continue?"))==1 )
 
1845
return( true );
 
1846
            PIPrivateCheck(d);
 
1847
            private = d->private;
 
1848
            FindBlues(sf,bluevalues,otherblues);
 
1849
            arraystring(buffer,bluevalues,14);
 
1850
            PSDictChangeEntry(private,"BlueValues",buffer);
 
1851
            if ( otherblues[0]!=0 || otherblues[1]!=0 ) {
 
1852
                arraystring(buffer,otherblues,10);
 
1853
                PSDictChangeEntry(private,"OtherBlues",buffer);
 
1854
            }
 
1855
        } else if ( strcmp(private->keys[sel],"StdHW")==0 ||
 
1856
                strcmp(private->keys[sel],"StemSnapH")==0 ) {
 
1857
            if ( gwwv_ask(_("Guess"),(const char **) buts,0,1,_("This will change both StdHW and StemSnapH.\nDo you want to continue?"))==1 )
 
1858
return( true );
 
1859
            FindHStems(sf,stemsnap,snapcnt);
 
1860
            PIPrivateCheck(d);
 
1861
            SnapSet(d->private,stemsnap,snapcnt,"StdHW","StemSnapH");
 
1862
        } else if ( strcmp(private->keys[sel],"StdVW")==0 ||
 
1863
                strcmp(private->keys[sel],"StemSnapV")==0 ) {
 
1864
            if ( gwwv_ask(_("Guess"),(const char **) buts,0,1,_("This will change both StdVW and StemSnapV.\nDo you want to continue?"))==1 )
 
1865
return( true );
 
1866
            FindVStems(sf,stemsnap,snapcnt);
 
1867
            PIPrivateCheck(d);
 
1868
            SnapSet(d->private,stemsnap,snapcnt,"StdVW","StemSnapV");
 
1869
        }
 
1870
        GGadgetSetTitle(GWidgetGetControl(d->gw,CID_PrivateValues),
 
1871
                temp = uc_copy( d->private->values[sel]));
 
1872
        free( temp );
 
1873
    }
 
1874
return( true );
 
1875
}
 
1876
 
 
1877
static int PI_Hist(GGadget *g, GEvent *e) {
 
1878
    GWindow gw;
 
1879
    struct gfi_data *d;
 
1880
    GGadget *list;
 
1881
    int sel;
 
1882
    SplineFont *sf;
 
1883
    struct psdict *private;
 
1884
    enum hist_type h;
 
1885
    unichar_t *temp;
 
1886
 
 
1887
    if ( e->type==et_controlevent && e->u.control.subtype == et_buttonactivate ) {
 
1888
        gw = GGadgetGetWindow(g);
 
1889
        d = GDrawGetUserData(gw);
 
1890
        sf = d->sf;
 
1891
        PIPrivateCheck(d);
 
1892
        private = d->private ? d->private : sf->private;
 
1893
        list = GWidgetGetControl(d->gw,CID_PrivateEntries);
 
1894
        sel = GGadgetGetFirstListSelectedItem(list);
 
1895
        if ( strcmp(private->keys[sel],"BlueValues")==0 ||
 
1896
                strcmp(private->keys[sel],"OtherBlues")==0 )
 
1897
            h = hist_blues;
 
1898
        else if ( strcmp(private->keys[sel],"StdHW")==0 ||
 
1899
                strcmp(private->keys[sel],"StemSnapH")==0 )
 
1900
            h = hist_hstem;
 
1901
        else if ( strcmp(private->keys[sel],"StdVW")==0 ||
 
1902
                strcmp(private->keys[sel],"StemSnapV")==0 )
 
1903
            h = hist_vstem;
 
1904
        else
 
1905
return( true );         /* can't happen */
 
1906
        SFHistogram(sf,private,NULL,NULL,h);
 
1907
        GGadgetSetTitle(GWidgetGetControl(d->gw,CID_PrivateValues),
 
1908
                temp = uc_copy( d->private->values[sel]));
 
1909
        free( temp );
 
1910
    }
 
1911
return( true );
 
1912
}
 
1913
 
 
1914
static int PI_Delete(GGadget *g, GEvent *e) {
 
1915
    GWindow gw;
 
1916
    struct gfi_data *d;
 
1917
    GGadget *list;
 
1918
    int sel;
 
1919
    SplineFont *sf;
 
1920
    GTextInfo **ti;
 
1921
 
 
1922
    if ( e->type==et_controlevent && e->u.control.subtype == et_buttonactivate ) {
 
1923
        gw = GGadgetGetWindow(g);
 
1924
        d = GDrawGetUserData(gw);
 
1925
        PIPrivateCheck(d);
 
1926
        sf = d->sf;
 
1927
        list = GWidgetGetControl(d->gw,CID_PrivateEntries);
 
1928
        sel = GGadgetGetFirstListSelectedItem(list);
 
1929
        PSDictRemoveEntry(d->private, d->private->keys[sel]);
 
1930
        sf->changed = true;
 
1931
        ti = PI_ListArray(d->private);
 
1932
        --sel;
 
1933
        if ( d->private!=NULL && sel>=d->private->next )
 
1934
            sel = d->private->next-1;
 
1935
        if ( sel>0 ) {
 
1936
            ti[0]->selected = false;
 
1937
            ti[sel]->selected = true;
 
1938
        }
 
1939
        GGadgetSetList(list,ti,false);
 
1940
        d->old_sel = -2;
 
1941
        ProcessListSel(d);
 
1942
    }
 
1943
return( true );
 
1944
}
 
1945
 
 
1946
static int PI_ListSel(GGadget *g, GEvent *e) {
 
1947
 
 
1948
    if ( e->type==et_controlevent && e->u.control.subtype == et_listselected ) {
 
1949
        ProcessListSel(GDrawGetUserData(GGadgetGetWindow(g)));
 
1950
    }
 
1951
return( true );
 
1952
}
 
1953
#endif          /* FONTFORGE_CONFIG_NO_WINDOWING_UI */
 
1954
 
 
1955
/* Use URW 4 letter abbreviations */
 
1956
static char *knownweights[] = { "Demi", "Bold", "Regu", "Medi", "Book", "Thin",
 
1957
        "Ligh", "Heav", "Blac", "Ultr", "Nord", "Norm", "Gras", "Stan", "Halb",
 
1958
        "Fett", "Mage", "Mitt", "Buch", NULL };
 
1959
static char *realweights[] = { "Demi", "Bold", "Regular", "Medium", "Book", "Thin",
 
1960
        "Light", "Heavy", "Black", "Ultra", "Nord", "Normal", "Gras", "Standard", "Halbfett",
 
1961
        "Fett", "Mager", "Mittel", "Buchschrift", NULL};
 
1962
#ifndef LUA_FF_LIB
 
1963
static char *moreweights[] = { "ExtraLight", "VeryLight", NULL };
 
1964
static char **noticeweights[] = { moreweights, realweights, knownweights, NULL };
 
1965
#endif
 
1966
 
 
1967
#ifndef FONTFORGE_CONFIG_NO_WINDOWING_UI
 
1968
static int GFI_NameChange(GGadget *g, GEvent *e) {
 
1969
    if ( e->type==et_controlevent && e->u.control.subtype == et_textchanged ) {
 
1970
        GWindow gw = GGadgetGetWindow(g);
 
1971
        struct gfi_data *gfi = GDrawGetUserData(gw);
 
1972
        const unichar_t *uname = _GGadgetGetTitle(GWidgetGetControl(gw,CID_Fontname));
 
1973
        unichar_t ubuf[50];
 
1974
        int i,j;
 
1975
        for ( j=0; noticeweights[j]!=NULL; ++j ) {
 
1976
            for ( i=0; noticeweights[j][i]!=NULL; ++i ) {
 
1977
                if ( uc_strstrmatch(uname,noticeweights[j][i])!=NULL ) {
 
1978
                    uc_strcpy(ubuf, noticeweights[j]==knownweights ?
 
1979
                            realweights[i] : noticeweights[j][i]);
 
1980
                    GGadgetSetTitle(GWidgetGetControl(gw,CID_Weight),ubuf);
 
1981
            break;
 
1982
                }
 
1983
            }
 
1984
            if ( noticeweights[j][i]!=NULL )
 
1985
        break;
 
1986
        }
 
1987
        if ( gfi->human_untitled )
 
1988
            GGadgetSetTitle(GWidgetGetControl(gw,CID_Human),uname);
 
1989
        if ( gfi->family_untitled ) {
 
1990
            const unichar_t *ept = uname+u_strlen(uname); unichar_t *temp;
 
1991
            for ( i=0; knownweights[i]!=NULL; ++i ) {
 
1992
                if (( temp = uc_strstrmatch(uname,knownweights[i]))!=NULL && temp<ept && temp!=uname )
 
1993
                    ept = temp;
 
1994
            }
 
1995
            if (( temp = uc_strstrmatch(uname,"ital"))!=NULL && temp<ept && temp!=uname )
 
1996
                ept = temp;
 
1997
            if (( temp = uc_strstrmatch(uname,"obli"))!=NULL && temp<ept && temp!=uname )
 
1998
                ept = temp;
 
1999
            if (( temp = uc_strstrmatch(uname,"kurs"))!=NULL && temp<ept && temp!=uname )
 
2000
                ept = temp;
 
2001
            if (( temp = uc_strstrmatch(uname,"slanted"))!=NULL && temp<ept && temp!=uname )
 
2002
                ept = temp;
 
2003
            if (( temp = u_strchr(uname,'-'))!=NULL && temp!=uname )
 
2004
                ept = temp;
 
2005
            temp = u_copyn(uname,ept-uname);
 
2006
            GGadgetSetTitle(GWidgetGetControl(gw,CID_Family),temp);
 
2007
        }
 
2008
    }
 
2009
return( true );
 
2010
}
 
2011
 
 
2012
static int GFI_FamilyChange(GGadget *g, GEvent *e) {
 
2013
    if ( e->type==et_controlevent && e->u.control.subtype == et_textchanged ) {
 
2014
        struct gfi_data *gfi = GDrawGetUserData(GGadgetGetWindow(g));
 
2015
        gfi->family_untitled = false;
 
2016
    }
 
2017
return( true );
 
2018
}
 
2019
 
 
2020
static int GFI_DefBaseChange(GGadget *g, GEvent *e) {
 
2021
    if ( e->type==et_controlevent && e->u.control.subtype == et_textchanged ) {
 
2022
        struct gfi_data *gfi = GDrawGetUserData(GGadgetGetWindow(g));
 
2023
        GGadgetSetChecked(GWidgetGetControl(gfi->gw,*_GGadgetGetTitle(g)!='\0'?CID_HasDefBase:CID_SameAsFontname),
 
2024
                true);
 
2025
    }
 
2026
return( true );
 
2027
}
 
2028
 
 
2029
static int GFI_HumanChange(GGadget *g, GEvent *e) {
 
2030
    if ( e->type==et_controlevent && e->u.control.subtype == et_textchanged ) {
 
2031
        struct gfi_data *gfi = GDrawGetUserData(GGadgetGetWindow(g));
 
2032
        gfi->human_untitled = false;
 
2033
    }
 
2034
return( true );
 
2035
}
 
2036
 
 
2037
static int GFI_VMetricsCheck(GGadget *g, GEvent *e) {
 
2038
    if ( e->type==et_controlevent && e->u.control.subtype == et_radiochanged ) {
 
2039
        GWindow gw = GGadgetGetWindow(g);
 
2040
        const unichar_t *vo = _GGadgetGetTitle(GWidgetGetControl(gw,CID_VOrigin));
 
2041
        int checked = GGadgetIsChecked(g);
 
2042
        if ( checked && *vo=='\0' ) {
 
2043
            struct gfi_data *d = GDrawGetUserData(GGadgetGetWindow(g));
 
2044
            char space[10]; unichar_t uspace[10];
 
2045
            sprintf( space, "%d", d->sf->ascent );
 
2046
            uc_strcpy(uspace,space);
 
2047
            GGadgetSetTitle(GWidgetGetControl(gw,CID_VOrigin),uspace);
 
2048
        }
 
2049
        GGadgetSetEnabled(GWidgetGetControl(gw,CID_VOrigin),checked);
 
2050
        GGadgetSetEnabled(GWidgetGetControl(gw,CID_VOriginLab),checked);
 
2051
        GGadgetSetEnabled(GWidgetGetControl(GDrawGetParentWindow(gw),CID_VLineGap),checked);
 
2052
        GGadgetSetEnabled(GWidgetGetControl(GDrawGetParentWindow(gw),CID_VLineGapLab),checked);
 
2053
    }
 
2054
return( true );
 
2055
}
 
2056
 
 
2057
static int GFI_EmChanged(GGadget *g, GEvent *e) {
 
2058
    if ( e->type==et_controlevent && e->u.control.subtype == et_textchanged ) {
 
2059
        char buf[20]; unichar_t ubuf[20];
 
2060
        struct gfi_data *d = GDrawGetUserData(GGadgetGetWindow(g));
 
2061
        const unichar_t *ret = _GGadgetGetTitle(g); unichar_t *end;
 
2062
        int val = u_strtol(ret,&end,10), ascent, descent;
 
2063
        if ( *end )
 
2064
return( true );
 
2065
        switch ( GGadgetGetCid(g)) {
 
2066
          case CID_Em:
 
2067
            ascent = rint( ((double) val)*d->sf->ascent/(d->sf->ascent+d->sf->descent) );
 
2068
            descent = val - ascent;
 
2069
          break;
 
2070
          case CID_Ascent:
 
2071
            ascent = val;
 
2072
            ret = _GGadgetGetTitle(GWidgetGetControl(d->gw,CID_Descent));
 
2073
            descent = u_strtol(ret,&end,10);
 
2074
            if ( *end )
 
2075
return( true );
 
2076
          break;
 
2077
          case CID_Descent:
 
2078
            descent = val;
 
2079
            ret = _GGadgetGetTitle(GWidgetGetControl(d->gw,CID_Ascent));
 
2080
            ascent = u_strtol(ret,&end,10);
 
2081
            if ( *end )
 
2082
return( true );
 
2083
          break;
 
2084
        }
 
2085
        sprintf( buf, "%d", ascent ); if ( ascent==0 ) buf[0]='\0'; uc_strcpy(ubuf,buf);
 
2086
        GGadgetSetTitle(GWidgetGetControl(d->gw,CID_Ascent),ubuf);
 
2087
        sprintf( buf, "%d", descent ); if ( descent==0 ) buf[0]='\0'; uc_strcpy(ubuf,buf);
 
2088
        GGadgetSetTitle(GWidgetGetControl(d->gw,CID_Descent),ubuf);
 
2089
        sprintf( buf, "%d", ascent+descent ); if ( ascent+descent==0 ) buf[0]='\0'; uc_strcpy(ubuf,buf);
 
2090
        GGadgetSetTitle(GWidgetGetControl(d->gw,CID_Em),ubuf);
 
2091
    }
 
2092
return( true );
 
2093
}
 
2094
 
 
2095
static int GFI_GuessItalic(GGadget *g, GEvent *e) {
 
2096
    if ( e->type==et_controlevent && e->u.control.subtype == et_buttonactivate ) {
 
2097
        struct gfi_data *d = GDrawGetUserData(GGadgetGetWindow(g));
 
2098
        double val = SFGuessItalicAngle(d->sf);
 
2099
        char buf[30]; unichar_t ubuf[30];
 
2100
        sprintf( buf, "%.1f", val);
 
2101
        uc_strcpy(ubuf,buf);
 
2102
        GGadgetSetTitle(GWidgetGetControl(d->gw,CID_ItalicAngle),ubuf);
 
2103
    }
 
2104
return( true );
 
2105
}
 
2106
 
 
2107
static void MCD_Close(struct markclassdlg *mcd);
 
2108
 
 
2109
static void GFI_Close(struct gfi_data *d) {
 
2110
    FontView *fvs;
 
2111
    SplineFont *sf = d->sf;
 
2112
 
 
2113
    if ( d->ccd )
 
2114
        CCD_Close(d->ccd);
 
2115
    if ( d->smd )
 
2116
        SMD_Close(d->smd);
 
2117
    if ( d->mcd )
 
2118
        MCD_Close(d->mcd );
 
2119
 
 
2120
    PSDictFree(d->private);
 
2121
 
 
2122
    GDrawDestroyWindow(d->gw);
 
2123
    if ( d->sf->fontinfo == d )
 
2124
        d->sf->fontinfo = NULL;
 
2125
    for ( fvs = d->sf->fv; fvs!=NULL; fvs = fvs->nextsame ) {
 
2126
        GDrawRequestExpose(sf->fv->v,NULL,false);
 
2127
    }
 
2128
    d->done = true;
 
2129
    /* d will be freed by destroy event */;
 
2130
}
 
2131
 
 
2132
static void GFI_CancelClose(struct gfi_data *d) {
 
2133
    int isgpos,i,j;
 
2134
 
 
2135
    MacFeatListFree(GGadgetGetUserData((GWidgetGetControl(
 
2136
            d->gw,CID_Features))));
 
2137
    MarkClassFree(d->mark_class_cnt,d->mark_classes,d->mark_class_names);
 
2138
    for ( isgpos=0; isgpos<2; ++isgpos ) {
 
2139
        struct lkdata *lk = &d->tables[isgpos];
 
2140
        for ( i=0; i<lk->cnt; ++i ) {
 
2141
            if ( lk->all[i].new )
 
2142
                SFRemoveLookup(d->sf,lk->all[i].lookup);
 
2143
            else for ( j=0; j<lk->all[i].subtable_cnt; ++j ) {
 
2144
                if ( lk->all[i].subtables[j].new )
 
2145
                    SFRemoveLookupSubTable(d->sf,lk->all[i].subtables[j].subtable);
 
2146
            }
 
2147
            free(lk->all[i].subtables);
 
2148
        }
 
2149
        free(lk->all);
 
2150
    }
 
2151
    GFI_Close(d);
 
2152
}
 
2153
 
 
2154
static GTextInfo *MarkClassesList(SplineFont *sf) {
 
2155
    int cnt;
 
2156
    GTextInfo *ti;
 
2157
 
 
2158
    if ( sf->mark_class_cnt==0 )
 
2159
return( NULL );
 
2160
 
 
2161
    ti = gcalloc(sf->mark_class_cnt+1,sizeof(GTextInfo));
 
2162
    for ( cnt=1; cnt<sf->mark_class_cnt; ++cnt ) {
 
2163
        ti[cnt-1].text = uc_copy(sf->mark_class_names[cnt]);
 
2164
        ti[cnt-1].fg = ti[cnt-1].bg = COLOR_DEFAULT;
 
2165
    }
 
2166
return( ti );
 
2167
}
 
2168
 
 
2169
#define CID_MCD_Name            1001
 
2170
#define CID_MCD_Set             1002
 
2171
#define CID_MCD_Select          1003
 
2172
#define CID_MCD_GlyphList       1004
 
2173
 
 
2174
#define MCD_Width       250
 
2175
#define MCD_Height      210
 
2176
 
 
2177
typedef struct markclassdlg {
 
2178
    GWindow gw;
 
2179
    struct gfi_data *d;
 
2180
    GGadget *list;
 
2181
    int which;
 
2182
} MarkClassDlg;
 
2183
 
 
2184
static void MCD_Close(MarkClassDlg *mcd) {
 
2185
    mcd->d->mcd = NULL;
 
2186
    GDrawDestroyWindow(mcd->gw);
 
2187
    free(mcd);
 
2188
}
 
2189
 
 
2190
static void MCD_DoCancel(MarkClassDlg *mcd) {
 
2191
    MCD_Close(mcd);
 
2192
}
 
2193
 
 
2194
static int MCD_Cancel(GGadget *g, GEvent *e) {
 
2195
    if ( e->type==et_controlevent && e->u.control.subtype == et_buttonactivate ) {
 
2196
        MarkClassDlg *mcd = GDrawGetUserData(GGadgetGetWindow(g));
 
2197
        MCD_DoCancel(mcd);
 
2198
    }
 
2199
return( true );
 
2200
}
 
2201
 
 
2202
static int MCD_InvalidClassList(const char *ret,char **classes, char **names,
 
2203
        int nclass, int which) {
 
2204
    const char *pt, *end;
 
2205
    char *tpt, *tend;
 
2206
    int i;
 
2207
 
 
2208
    for ( pt = ret; *pt; pt = end ) {
 
2209
        while ( *pt==' ' ) ++pt;
 
2210
        if ( *pt=='\0' )
 
2211
    break;
 
2212
        end = strchr(pt,' ');
 
2213
        if ( end==NULL ) end = pt+strlen(pt);
 
2214
        for ( i=1; (i < nclass) && (classes[i]!=NULL); ++i ) {
 
2215
            if ( which==i )
 
2216
        continue;
 
2217
            for ( tpt=classes[i]; *tpt; tpt = tend ) {
 
2218
                while ( *tpt==' ' ) ++tpt;
 
2219
                tend = strchr(tpt,' ');
 
2220
                if ( tend==NULL ) tend = tpt+strlen(tpt);
 
2221
                if ( tend-tpt==end-pt && strncmp(pt,tpt,end-pt)==0 ) {
 
2222
                    char *dupname = copyn(pt,end-pt);
 
2223
                    gwwv_post_error(_("Bad Class"),_("No glyphs from another class may appear here, but %.30s appears here and in class %.30s"), dupname, names[i]);
 
2224
                    free(dupname);
 
2225
return( true );
 
2226
                }
 
2227
            }
 
2228
        }
 
2229
    }
 
2230
return( false );
 
2231
}
 
2232
 
 
2233
static int MCD_OK(GGadget *g, GEvent *e) {
 
2234
    char *newname;
 
2235
    char *glyphs;
 
2236
    struct gfi_data *d;
 
2237
 
 
2238
    if ( e->type==et_controlevent && e->u.control.subtype == et_buttonactivate ) {
 
2239
        MarkClassDlg *mcd = GDrawGetUserData(GGadgetGetWindow(g));
 
2240
        newname = GGadgetGetTitle8(GWidgetGetControl(mcd->gw,CID_MCD_Name));
 
2241
        glyphs = GGadgetGetTitle8(GWidgetGetControl(mcd->gw,CID_MCD_GlyphList));
 
2242
        d = mcd->d;
 
2243
 
 
2244
        if ( !CCD_NameListCheck(d->sf,glyphs,true,_("Bad Class")) ||
 
2245
                MCD_InvalidClassList(glyphs,d->mark_classes,d->mark_class_names,
 
2246
                        d->mark_class_cnt,mcd->which )) {
 
2247
            free(newname); free(glyphs);
 
2248
return( true );
 
2249
        }
 
2250
 
 
2251
        if ( mcd->which==-1 ) {         /* New */
 
2252
            
 
2253
            if ( d->mark_class_cnt==0 ) {
 
2254
                d->mark_class_cnt = 2;          /* Class 0 is magic */
 
2255
                d->mark_classes = gcalloc(2,sizeof(char *));
 
2256
                d->mark_class_names = gcalloc(2,sizeof(unichar_t *));
 
2257
            } else {
 
2258
                ++d->mark_class_cnt;
 
2259
                d->mark_classes = grealloc(d->mark_classes,d->mark_class_cnt*sizeof(char*));
 
2260
                d->mark_class_names = grealloc(d->mark_class_names,d->mark_class_cnt*sizeof(unichar_t*));
 
2261
            }
 
2262
            d->mark_classes[d->mark_class_cnt-1] = copy(glyphs);
 
2263
            d->mark_class_names[d->mark_class_cnt-1] = copy(newname);
 
2264
            GListAppendLine8(mcd->list,newname,false);
 
2265
        } else {
 
2266
            free(d->mark_classes[mcd->which]); d->mark_classes[mcd->which] = copy(glyphs);
 
2267
            free(d->mark_class_names[mcd->which]); d->mark_class_names[mcd->which] = copy(newname);
 
2268
            GListChangeLine8(mcd->list,mcd->which,newname);
 
2269
        }
 
2270
        MCD_Close(mcd);
 
2271
        free(newname); free(glyphs);
 
2272
    }
 
2273
return( true );
 
2274
}
 
2275
 
 
2276
static int MCD_ToSelection(GGadget *g, GEvent *e) {
 
2277
    if ( e->type==et_controlevent && e->u.control.subtype == et_buttonactivate ) {
 
2278
        MarkClassDlg *mcd = GDrawGetUserData(GGadgetGetWindow(g));
 
2279
        const unichar_t *ret = _GGadgetGetTitle(GWidgetGetControl(mcd->gw,CID_MCD_GlyphList));
 
2280
        SplineFont *sf = mcd->d->sf;
 
2281
        FontView *fv = sf->fv;
 
2282
        const unichar_t *end;
 
2283
        int pos, found=-1;
 
2284
        char *nm;
 
2285
 
 
2286
        GDrawSetVisible(fv->gw,true);
 
2287
        GDrawRaise(fv->gw);
 
2288
        memset(fv->selected,0,fv->map->enccount);
 
2289
        while ( *ret ) {
 
2290
            end = u_strchr(ret,' ');
 
2291
            if ( end==NULL ) end = ret+u_strlen(ret);
 
2292
            nm = cu_copybetween(ret,end);
 
2293
            for ( ret = end; isspace(*ret); ++ret);
 
2294
            if (( pos = SFFindSlot(sf,fv->map,-1,nm))!=-1 ) {
 
2295
                if ( found==-1 ) found = pos;
 
2296
                if ( pos!=-1 )
 
2297
                    fv->selected[pos] = true;
 
2298
            }
 
2299
            free(nm);
 
2300
        }
 
2301
 
 
2302
        if ( found!=-1 )
 
2303
            FVScrollToChar(fv,found);
 
2304
        GDrawRequestExpose(fv->v,NULL,false);
 
2305
    }
 
2306
return( true );
 
2307
}
 
2308
 
 
2309
static int MCD_FromSelection(GGadget *g, GEvent *e) {
 
2310
    if ( e->type==et_controlevent && e->u.control.subtype == et_buttonactivate ) {
 
2311
        MarkClassDlg *mcd = GDrawGetUserData(GGadgetGetWindow(g));
 
2312
        SplineFont *sf = mcd->d->sf;
 
2313
        FontView *fv = sf->fv;
 
2314
        unichar_t *vals, *pt;
 
2315
        int i, len, max, gid;
 
2316
        SplineChar *sc, dummy;
 
2317
    
 
2318
        for ( i=len=max=0; i<fv->map->enccount; ++i ) if ( fv->selected[i]) {
 
2319
            gid = fv->map->map[i];
 
2320
            if ( gid!=-1 && sf->glyphs[gid]!=NULL )
 
2321
                sc = sf->glyphs[gid];
 
2322
            else
 
2323
                sc = SCBuildDummy(&dummy,sf,fv->map,i);
 
2324
            len += strlen(sc->name)+1;
 
2325
            if ( fv->selected[i]>max ) max = fv->selected[i];
 
2326
        }
 
2327
        pt = vals = galloc((len+1)*sizeof(unichar_t));
 
2328
        *pt = '\0';
 
2329
        /* in a class the order of selection is irrelevant */
 
2330
        for ( i=0; i<fv->map->enccount; ++i ) if ( fv->selected[i]) {
 
2331
            gid = fv->map->map[i];
 
2332
            if ( gid!=-1 && sf->glyphs[gid]!=NULL )
 
2333
                sc = sf->glyphs[gid];
 
2334
            else
 
2335
                sc = SCBuildDummy(&dummy,sf,fv->map,i);
 
2336
            uc_strcpy(pt,sc->name);
 
2337
            pt += u_strlen(pt);
 
2338
            *pt++ = ' ';
 
2339
        }
 
2340
        if ( pt>vals ) pt[-1]='\0';
 
2341
    
 
2342
        GGadgetSetTitle(GWidgetGetControl(mcd->gw,CID_MCD_GlyphList),vals);
 
2343
        free(vals);
 
2344
    }
 
2345
return( true );
 
2346
}
 
2347
 
 
2348
void DropChars2Text(GWindow gw, GGadget *glyphs,GEvent *event) {
 
2349
    char *cnames;
 
2350
    const unichar_t *old;
 
2351
    unichar_t *new;
 
2352
    int32 len;
 
2353
 
 
2354
    if ( !GDrawSelectionHasType(gw,sn_drag_and_drop,"STRING"))
 
2355
return;
 
2356
    cnames = GDrawRequestSelection(gw,sn_drag_and_drop,"STRING",&len);
 
2357
    if ( cnames==NULL )
 
2358
return;
 
2359
 
 
2360
    old = _GGadgetGetTitle(glyphs);
 
2361
    if ( old==NULL || *old=='\0' ) {
 
2362
        new = uc_copy(cnames);
 
2363
    } else {
 
2364
        new = galloc(strlen(cnames)+u_strlen(old)+5);
 
2365
        u_strcpy(new,old);
 
2366
        if ( new[u_strlen(new)-1]!=' ' )
 
2367
            uc_strcat(new," ");
 
2368
        uc_strcat(new,cnames);
 
2369
    }
 
2370
    GGadgetSetTitle(glyphs,new);
 
2371
    free( cnames );
 
2372
    free( new );
 
2373
}
 
2374
 
 
2375
static void MCD_Drop(MarkClassDlg *mcd,GEvent *event) {
 
2376
    DropChars2Text(mcd->gw,GWidgetGetControl(mcd->gw,CID_MCD_GlyphList),event);
 
2377
}
 
2378
 
 
2379
static int mcd_e_h(GWindow gw, GEvent *event) {
 
2380
    MarkClassDlg *mcd = GDrawGetUserData(gw);
 
2381
 
 
2382
    switch ( event->type ) {
 
2383
      case et_close:
 
2384
        MCD_DoCancel(mcd);
 
2385
      break;
 
2386
      case et_char:
 
2387
        if ( event->u.chr.keysym == GK_F1 || event->u.chr.keysym == GK_Help ) {
 
2388
            help("fontinfo.html#MarkClass");
 
2389
return( true );
 
2390
        }
 
2391
return( false );
 
2392
      break;
 
2393
      case et_drop:
 
2394
        MCD_Drop(mcd,event);
 
2395
      break;
 
2396
    }
 
2397
return( true );
 
2398
}
 
2399
 
 
2400
static void CreateMarkClassDlg(struct gfi_data *d, GGadget *list, int which) {
 
2401
    MarkClassDlg *mcd;
 
2402
    GWindow gw;
 
2403
    GRect pos;
 
2404
    GWindowAttrs wattrs;
 
2405
    GGadgetCreateData gcd[10];
 
2406
    GTextInfo label[10];
 
2407
    int k;
 
2408
    unichar_t *freeme = NULL;
 
2409
 
 
2410
    if ( d->mcd!=NULL ) {
 
2411
        GDrawSetVisible(d->mcd->gw,true);
 
2412
        GDrawRaise(d->mcd->gw);
 
2413
return;
 
2414
    }
 
2415
 
 
2416
    memset(&wattrs,0,sizeof(wattrs));
 
2417
    memset(&gcd,0,sizeof(gcd));
 
2418
    memset(&label,0,sizeof(label));
 
2419
 
 
2420
    mcd = gcalloc(1,sizeof(MarkClassDlg));
 
2421
    mcd->d = d; mcd->list = list; mcd->which = which;
 
2422
 
 
2423
    wattrs.mask = wam_events|wam_cursor|wam_utf8_wtitle|wam_undercursor|wam_isdlg|wam_restrict;
 
2424
    wattrs.event_masks = ~(1<<et_charup);
 
2425
    wattrs.restrict_input_to_me = false;
 
2426
    wattrs.undercursor = 1;
 
2427
    wattrs.cursor = ct_pointer;
 
2428
    wattrs.utf8_window_title = _("Mark Classes");
 
2429
    wattrs.is_dlg = false;
 
2430
    pos.x = pos.y = 0;
 
2431
    pos.width = GGadgetScale(GDrawPointsToPixels(NULL,MCD_Width));
 
2432
    pos.height = GDrawPointsToPixels(NULL,MCD_Height);
 
2433
    mcd->gw = gw = GDrawCreateTopWindow(NULL,&pos,mcd_e_h,mcd,&wattrs);
 
2434
 
 
2435
    k = 0;
 
2436
 
 
2437
    label[k].text = (unichar_t *) _("Class Name:");
 
2438
    label[k].text_is_1byte = true;
 
2439
    gcd[k].gd.label = &label[k];
 
2440
    gcd[k].gd.pos.x = 10; gcd[k].gd.pos.y = 10;
 
2441
    gcd[k].gd.flags = gg_visible | gg_enabled;
 
2442
    gcd[k++].creator = GLabelCreate;
 
2443
 
 
2444
    if ( which!=-1 ) {
 
2445
        gcd[k].gd.label = &label[k];
 
2446
        label[k].text = (unichar_t *) d->mark_class_names[which];
 
2447
        label[k].text_is_1byte = true;
 
2448
    }
 
2449
    gcd[k].gd.pos.x = 70; gcd[k].gd.pos.y = gcd[k-1].gd.pos.y-4;
 
2450
    gcd[k].gd.flags = gg_visible | gg_enabled;
 
2451
    gcd[k].gd.cid = CID_MCD_Name;
 
2452
    gcd[k++].creator = GTextFieldCreate;
 
2453
 
 
2454
    label[k].text = (unichar_t *) _("Set From Font");
 
2455
    label[k].text_is_1byte = true;
 
2456
    gcd[k].gd.label = &label[k];
 
2457
    gcd[k].gd.pos.x = 5; gcd[k].gd.pos.y = gcd[k-1].gd.pos.y+28;
 
2458
    gcd[k].gd.popup_msg = (unichar_t *) _("Set this glyph list to be the glyphs selected in the fontview");
 
2459
    gcd[k].gd.flags = gg_visible | gg_enabled | gg_utf8_popup;
 
2460
    gcd[k].gd.handle_controlevent = MCD_FromSelection;
 
2461
    gcd[k].gd.cid = CID_MCD_Set;
 
2462
    gcd[k++].creator = GButtonCreate;
 
2463
 
 
2464
    label[k].text = (unichar_t *) _("Select In Font");
 
2465
    label[k].text_is_1byte = true;
 
2466
    gcd[k].gd.label = &label[k];
 
2467
    gcd[k].gd.pos.x = 110; gcd[k].gd.pos.y = gcd[k-1].gd.pos.y;
 
2468
    gcd[k].gd.popup_msg = (unichar_t *) _("Set the fontview's selection to be the glyphs named here");
 
2469
    gcd[k].gd.flags = gg_visible | gg_enabled | gg_utf8_popup;
 
2470
    gcd[k].gd.handle_controlevent = MCD_ToSelection;
 
2471
    gcd[k].gd.cid = CID_MCD_Select;
 
2472
    gcd[k++].creator = GButtonCreate;
 
2473
 
 
2474
    if ( which!=-1 ) {
 
2475
        gcd[k].gd.label = &label[k];
 
2476
        label[k].text = freeme = uc_copy(d->mark_classes[which]);
 
2477
    }
 
2478
    gcd[k].gd.pos.x = 10; gcd[k].gd.pos.y = gcd[k-1].gd.pos.y+30;
 
2479
    gcd[k].gd.pos.width = MCD_Width-20; gcd[k].gd.pos.height = 8*13+4;
 
2480
    gcd[k].gd.flags = gg_visible | gg_enabled | gg_textarea_wrap;       /* Just ASCII text for glyph names, no need for xim */
 
2481
    gcd[k].gd.cid = CID_MCD_GlyphList;
 
2482
    gcd[k++].creator = GTextAreaCreate;
 
2483
 
 
2484
    label[k].text = (unichar_t *) _("_OK");
 
2485
    label[k].text_is_1byte = true;
 
2486
    label[k].text_in_resource = true;
 
2487
    gcd[k].gd.label = &label[k];
 
2488
    gcd[k].gd.pos.x = 30; gcd[k].gd.pos.y = MCD_Height-30-3;
 
2489
    gcd[k].gd.pos.width = -1;
 
2490
    gcd[k].gd.flags = gg_visible|gg_enabled | gg_but_default;
 
2491
    gcd[k].gd.handle_controlevent = MCD_OK;
 
2492
    gcd[k++].creator = GButtonCreate;
 
2493
 
 
2494
    label[k].text = (unichar_t *) _("_Cancel");
 
2495
    label[k].text_is_1byte = true;
 
2496
    label[k].text_in_resource = true;
 
2497
    gcd[k].gd.label = &label[k];
 
2498
    gcd[k].gd.pos.x = -30+3; gcd[k].gd.pos.y = MCD_Height-30;
 
2499
    gcd[k].gd.pos.width = -1;
 
2500
    gcd[k].gd.flags = gg_visible|gg_enabled | gg_but_cancel;
 
2501
    gcd[k].gd.handle_controlevent = MCD_Cancel;
 
2502
    gcd[k++].creator = GButtonCreate;
 
2503
 
 
2504
    gcd[k].gd.pos.x = 2; gcd[k].gd.pos.y = 2;
 
2505
    gcd[k].gd.pos.width = pos.width-4;
 
2506
    gcd[k].gd.pos.height = pos.height-4;
 
2507
    gcd[k].gd.flags = gg_visible | gg_enabled | gg_pos_in_pixels;
 
2508
    gcd[k++].creator = GGroupCreate;
 
2509
 
 
2510
    GGadgetsCreate(mcd->gw,gcd);
 
2511
    GDrawSetVisible(mcd->gw,true);
 
2512
 
 
2513
    free(freeme);
 
2514
}
 
2515
 
 
2516
static int GFI_MarkNew(GGadget *g, GEvent *e) {
 
2517
 
 
2518
    if ( e->type==et_controlevent && e->u.control.subtype == et_buttonactivate ) {
 
2519
        struct gfi_data *d = GDrawGetUserData(GGadgetGetWindow(g));
 
2520
        CreateMarkClassDlg(d, GWidgetGetControl(GGadgetGetWindow(g),CID_MarkClasses), -1);
 
2521
    }
 
2522
return( true );
 
2523
}
 
2524
 
 
2525
static int GFI_MarkEdit(GGadget *g, GEvent *e) {
 
2526
    int i;
 
2527
    GGadget *list;
 
2528
 
 
2529
    if ( e->type==et_controlevent && e->u.control.subtype == et_buttonactivate ) {
 
2530
        struct gfi_data *d = GDrawGetUserData(GGadgetGetWindow(g));
 
2531
        list = GWidgetGetControl(GGadgetGetWindow(g),CID_MarkClasses);
 
2532
        if ( (i = GGadgetGetFirstListSelectedItem(list))==-1 && i+1 < d->mark_class_cnt )
 
2533
return( true );
 
2534
        CreateMarkClassDlg(d, list, i+1);
 
2535
    }
 
2536
return( true );
 
2537
}
 
2538
 
 
2539
static int GFI_MarkSelChanged(GGadget *g, GEvent *e) {
 
2540
    if ( e->type==et_controlevent && e->u.control.subtype == et_listselected ) {
 
2541
        struct gfi_data *d = GDrawGetUserData(GGadgetGetWindow(g));
 
2542
        int sel = GGadgetGetFirstListSelectedItem(g);
 
2543
        GGadgetSetEnabled(GWidgetGetControl(d->gw,CID_MarkEdit),sel!=-1);
 
2544
    } else if ( e->type==et_controlevent && e->u.control.subtype == et_listdoubleclick ) {
 
2545
        e->u.control.subtype = et_buttonactivate;
 
2546
        GFI_MarkEdit(g,e);
 
2547
    }
 
2548
return( true );
 
2549
}
 
2550
 
 
2551
static char *OtfNameToText(int lang, const char *name) {
 
2552
    const char *langname;
 
2553
    char *text;
 
2554
    int i;
 
2555
 
 
2556
    for ( i=sizeof(mslanguages)/sizeof(mslanguages[0])-1; i>=0 ; --i )
 
2557
        if ( mslanguages[i].userdata == (void *) (intpt) lang )
 
2558
    break;
 
2559
    if ( i==-1 )
 
2560
        for ( i=sizeof(mslanguages)/sizeof(mslanguages[0])-1; i>=0 ; --i )
 
2561
            if ( ((intpt) mslanguages[i].userdata&0xff) == (lang&0xff) )
 
2562
        break;
 
2563
    if ( i==-1 )
 
2564
        langname = "";
 
2565
    else
 
2566
        langname = (char*) (mslanguages[i].text);
 
2567
 
 
2568
    text = galloc((strlen(langname)+strlen(name)+4));
 
2569
    strcpy(text,name);
 
2570
    strcat(text," | ");
 
2571
    strcat(text,langname);
 
2572
return( text );
 
2573
}
 
2574
 
 
2575
static GTextInfo **StyleNames(struct otfname *otfn) {
 
2576
    int cnt;
 
2577
    struct otfname *on;
 
2578
    GTextInfo **tis;
 
2579
    char *cname;
 
2580
 
 
2581
    for ( cnt=0, on=otfn; on!=NULL; on=on->next )
 
2582
        ++cnt;
 
2583
    tis = galloc((cnt+1)*sizeof(GTextInfo *));
 
2584
    for ( cnt=0, on=otfn; on!=NULL; on=on->next, ++cnt ) {
 
2585
        tis[cnt] = gcalloc(1,sizeof(GTextInfo));
 
2586
        tis[cnt]->fg = tis[cnt]->bg = COLOR_DEFAULT;
 
2587
        tis[cnt]->userdata = (void *) (intpt) otfn->lang;
 
2588
        cname = OtfNameToText(on->lang,on->name);
 
2589
        tis[cnt]->text = utf82u_copy(cname);
 
2590
        free(cname);
 
2591
    }
 
2592
    tis[cnt] = gcalloc(1,sizeof(GTextInfo));
 
2593
return( tis );
 
2594
}
 
2595
 
 
2596
static struct otfname *OtfNameFromStyleNames(GGadget *list) {
 
2597
    int32 len; int i;
 
2598
    GTextInfo **old = GGadgetGetList(list,&len);
 
2599
    struct otfname *head=NULL, *last, *cur;
 
2600
    unichar_t *pt, *temp;
 
2601
 
 
2602
    for ( i=0; i<len; ++i ) {
 
2603
        cur = chunkalloc(sizeof(struct otfname));
 
2604
        cur->lang = (intpt) old[i]->userdata;
 
2605
        pt = uc_strstr(old[i]->text," | ");
 
2606
        temp = u_copyn(old[i]->text,pt-old[i]->text);
 
2607
        cur->name = u2utf8_copy(temp);
 
2608
        free(temp);
 
2609
        if ( head==NULL )
 
2610
            head = cur;
 
2611
        else
 
2612
            last->next = cur;
 
2613
        last = cur;
 
2614
    }
 
2615
return( head );
 
2616
}
 
2617
 
 
2618
static int sn_e_h(GWindow gw, GEvent *event) {
 
2619
 
 
2620
    if ( event->type==et_close ) {
 
2621
        int *d = GDrawGetUserData(gw);
 
2622
        *d = true;
 
2623
    } else if ( event->type == et_char ) {
 
2624
return( false );
 
2625
    } else if ( event->type==et_controlevent && event->u.control.subtype == et_buttonactivate ) {
 
2626
        int *d = GDrawGetUserData(gw);
 
2627
        *d = GGadgetGetCid(event->u.control.g)+1;
 
2628
    }
 
2629
return( true );
 
2630
}
 
2631
 
 
2632
static void AskForLangName(GGadget *list,int sel) {
 
2633
    int32 len; int i;
 
2634
    GTextInfo **old = GGadgetGetList(list,&len);
 
2635
    unichar_t *name, *pt;
 
2636
    char *cname;
 
2637
    int lang_index;
 
2638
    GGadgetCreateData gcd[7];
 
2639
    GTextInfo label[5];
 
2640
    GRect pos;
 
2641
    GWindow gw;
 
2642
    GWindowAttrs wattrs;
 
2643
    int done = 0;
 
2644
    int k;
 
2645
    GTextInfo **ti;
 
2646
    char *temp;
 
2647
 
 
2648
    for ( i=sizeof(mslanguages)/sizeof(mslanguages[0])-1; i>=0 ; --i )
 
2649
        mslanguages[i].fg = mslanguages[i].bg = COLOR_DEFAULT;
 
2650
    if ( sel==-1 ) {
 
2651
        for ( i=0; i<len; ++i )
 
2652
            if ( old[i]->userdata == (void *) 0x409 )
 
2653
        break;
 
2654
        if ( i==len ) {
 
2655
            for ( i=sizeof(mslanguages)/sizeof(mslanguages[0])-1; i>=0 ; --i )
 
2656
                if ( mslanguages[i].userdata == (void *) 0x409 )
 
2657
            break;
 
2658
            lang_index = i;
 
2659
        } else {
 
2660
            for ( lang_index=sizeof(mslanguages)/sizeof(mslanguages[0])-1; lang_index>=0 ; --lang_index ) {
 
2661
                for ( i=0; i<len; ++i )
 
2662
                    if ( mslanguages[lang_index].userdata == old[i]->userdata )
 
2663
                break;
 
2664
                if ( i==len )
 
2665
            break;
 
2666
            }
 
2667
        }
 
2668
        if ( lang_index < 0 )
 
2669
            lang_index = 0;
 
2670
        name = uc_copy("");
 
2671
    } else {
 
2672
        for ( lang_index=sizeof(mslanguages)/sizeof(mslanguages[0])-1; lang_index>=0 ; --lang_index )
 
2673
            if ( mslanguages[lang_index].userdata == old[sel]->userdata )
 
2674
        break;
 
2675
        if ( lang_index < 0 )
 
2676
            lang_index = 0;
 
2677
        pt = uc_strstr(old[sel]->text," | ");
 
2678
        name = u_copyn(old[sel]->text,pt-old[sel]->text);
 
2679
    }
 
2680
 
 
2681
    memset(gcd,0,sizeof(gcd));
 
2682
    memset(label,0,sizeof(label));
 
2683
 
 
2684
    gcd[0].gd.pos.x = 7; gcd[0].gd.pos.y = 7;
 
2685
    gcd[0].gd.flags = gg_visible | gg_enabled | gg_list_alphabetic;
 
2686
    gcd[0].gd.cid = CID_Language;
 
2687
    gcd[0].gd.u.list = mslanguages;
 
2688
    gcd[0].creator = GListButtonCreate;
 
2689
    for ( i=0; mslanguages[i].text!=NULL; ++i )
 
2690
        mslanguages[i].selected = false;
 
2691
    mslanguages[lang_index].selected = true;
 
2692
 
 
2693
    k = 1;
 
2694
    label[k].text = (unichar_t *) _("_Name:");
 
2695
    label[k].text_is_1byte = true;
 
2696
    label[k].text_in_resource = true;
 
2697
    gcd[k].gd.label = &label[k];
 
2698
    gcd[k].gd.pos.x = 10; gcd[k].gd.pos.y = gcd[k-1].gd.pos.y+30;
 
2699
    gcd[k].gd.flags = gg_visible | gg_enabled;
 
2700
    gcd[k++].creator = GLabelCreate;
 
2701
 
 
2702
    label[k].text = name;
 
2703
    gcd[k].gd.label = &label[k];
 
2704
    gcd[k].gd.pos.x = 50; gcd[k].gd.pos.y = gcd[k-1].gd.pos.y-4;
 
2705
    gcd[k].gd.pos.width = 122;
 
2706
    gcd[k].gd.flags = gg_visible | gg_enabled;
 
2707
    gcd[k].gd.cid = CID_StyleName;
 
2708
    gcd[k++].creator = GTextFieldCreate;
 
2709
 
 
2710
    gcd[k].gd.pos.x = 25-3; gcd[k].gd.pos.y = gcd[k-1].gd.pos.y+30;
 
2711
    gcd[k].gd.pos.width = -1; gcd[k].gd.pos.height = 0;
 
2712
    gcd[k].gd.flags = gg_visible | gg_enabled | gg_but_default;
 
2713
    label[k].text = (unichar_t *) _("_OK");
 
2714
    label[k].text_is_1byte = true;
 
2715
    label[k].text_in_resource = true;
 
2716
    gcd[k].gd.label = &label[k];
 
2717
    gcd[k].gd.cid = true;
 
2718
    gcd[k++].creator = GButtonCreate;
 
2719
 
 
2720
    gcd[k].gd.pos.x = -25; gcd[k].gd.pos.y = gcd[k-1].gd.pos.y+3;
 
2721
    gcd[k].gd.pos.width = -1; gcd[k].gd.pos.height = 0;
 
2722
    gcd[k].gd.flags = gg_visible | gg_enabled | gg_but_cancel;
 
2723
    label[k].text = (unichar_t *) _("_Cancel");
 
2724
    label[k].text_is_1byte = true;
 
2725
    label[k].text_in_resource = true;
 
2726
    gcd[k].gd.label = &label[k];
 
2727
    gcd[k].gd.cid = false;
 
2728
    gcd[k++].creator = GButtonCreate;
 
2729
 
 
2730
    memset(&wattrs,0,sizeof(wattrs));
 
2731
    wattrs.mask = wam_events|wam_cursor|wam_utf8_wtitle|wam_undercursor|wam_isdlg|wam_restrict;
 
2732
    wattrs.event_masks = ~(1<<et_charup);
 
2733
    wattrs.is_dlg = true;
 
2734
    wattrs.restrict_input_to_me = 1;
 
2735
    wattrs.undercursor = 1;
 
2736
    wattrs.cursor = ct_pointer;
 
2737
    wattrs.utf8_window_title = _("Style Name:");
 
2738
    pos.x = pos.y = 0;
 
2739
    pos.width =GDrawPointsToPixels(NULL,GGadgetScale(180));
 
2740
    pos.height = GDrawPointsToPixels(NULL,2*26+45);
 
2741
    gw = GDrawCreateTopWindow(NULL,&pos,sn_e_h,&done,&wattrs);
 
2742
 
 
2743
    GGadgetsCreate(gw,gcd);
 
2744
    free(name);
 
2745
    ti = GGadgetGetList(gcd[0].ret,&len);
 
2746
    for ( i=0; i<len; ++i )
 
2747
        if ( ti[i]->userdata == mslanguages[lang_index].userdata ) {
 
2748
            GGadgetSelectOneListItem(gcd[0].ret,i);
 
2749
    break;
 
2750
        }
 
2751
    GDrawSetVisible(gw,true);
 
2752
 
 
2753
    while ( !done )
 
2754
        GDrawProcessOneEvent(NULL);
 
2755
 
 
2756
    if ( done==2 ) {
 
2757
        lang_index = GGadgetGetFirstListSelectedItem(gcd[0].ret);
 
2758
        cname = OtfNameToText((intpt) ti[lang_index]->userdata,
 
2759
                (temp = GGadgetGetTitle8(GWidgetGetControl(gw,CID_StyleName))));
 
2760
        free(temp);
 
2761
        if ( sel==-1 )
 
2762
            GListAppendLine8(list,cname,false)->userdata =
 
2763
                    ti[lang_index]->userdata;
 
2764
        else
 
2765
            GListChangeLine8(list,sel,cname)->userdata =
 
2766
                    ti[lang_index]->userdata;
 
2767
        free(name);
 
2768
    }
 
2769
 
 
2770
    GDrawDestroyWindow(gw);
 
2771
}
 
2772
 
 
2773
static int GFI_StyleNameNew(GGadget *g, GEvent *e) {
 
2774
    GGadget *list;
 
2775
 
 
2776
    if ( e->type==et_controlevent && e->u.control.subtype == et_buttonactivate ) {
 
2777
        list = GWidgetGetControl(GGadgetGetWindow(g),CID_StyleName);
 
2778
        AskForLangName(list,-1);
 
2779
    }
 
2780
return( true );
 
2781
}
 
2782
 
 
2783
static int GFI_StyleNameDel(GGadget *g, GEvent *e) {
 
2784
    GGadget *list;
 
2785
    if ( e->type==et_controlevent && e->u.control.subtype == et_buttonactivate ) {
 
2786
        list = GWidgetGetControl(GGadgetGetWindow(g),CID_StyleName);
 
2787
        GListDelSelected(list);
 
2788
        GGadgetSetEnabled(GWidgetGetControl(GGadgetGetWindow(g),CID_StyleNameDel),false);
 
2789
        GGadgetSetEnabled(GWidgetGetControl(GGadgetGetWindow(g),CID_StyleNameRename),false);
 
2790
    }
 
2791
return( true );
 
2792
}
 
2793
 
 
2794
static int GFI_StyleNameRename(GGadget *g, GEvent *e) {
 
2795
    GGadget *list;
 
2796
    int sel;
 
2797
 
 
2798
    if ( e->type==et_controlevent && e->u.control.subtype == et_buttonactivate ) {
 
2799
        list = GWidgetGetControl(GGadgetGetWindow(g),CID_StyleName);
 
2800
        if ( (sel=GGadgetGetFirstListSelectedItem(list))==-1 )
 
2801
return( true );
 
2802
        AskForLangName(list,sel);
 
2803
    }
 
2804
return( true );
 
2805
}
 
2806
 
 
2807
static int GFI_StyleNameSelChanged(GGadget *g, GEvent *e) {
 
2808
    if ( e->type==et_controlevent && e->u.control.subtype == et_listselected ) {
 
2809
        struct gfi_data *d = GDrawGetUserData(GGadgetGetWindow(g));
 
2810
        int sel = GGadgetGetFirstListSelectedItem(g);
 
2811
        GGadgetSetEnabled(GWidgetGetControl(d->gw,CID_StyleNameDel),sel!=-1);
 
2812
        GGadgetSetEnabled(GWidgetGetControl(d->gw,CID_StyleNameRename),sel!=-1);
 
2813
    } else if ( e->type==et_controlevent && e->u.control.subtype == et_listdoubleclick ) {
 
2814
        e->u.control.subtype = et_buttonactivate;
 
2815
        GFI_StyleNameRename(g,e);
 
2816
    }
 
2817
return( true );
 
2818
}
 
2819
 
 
2820
void GListMoveSelected(GGadget *list,int offset) {
 
2821
    int32 len; int i,j;
 
2822
    GTextInfo **old, **new;
 
2823
 
 
2824
    old = GGadgetGetList(list,&len);
 
2825
    new = gcalloc(len+1,sizeof(GTextInfo *));
 
2826
    j = (offset<0 ) ? 0 : len-1;
 
2827
    for ( i=0; i<len; ++i ) if ( old[i]->selected ) {
 
2828
        if ( offset==0x80000000 || offset==0x7fffffff )
 
2829
            /* Do Nothing */;
 
2830
        else if ( offset<0 ) {
 
2831
            if ( (j= i+offset)<0 ) j=0;
 
2832
            while ( new[j] ) ++j;
 
2833
        } else {
 
2834
            if ( (j= i+offset)>=len ) j=len-1;
 
2835
            while ( new[j] ) --j;
 
2836
        }
 
2837
        new[j] = galloc(sizeof(GTextInfo));
 
2838
        *new[j] = *old[i];
 
2839
        new[j]->text = u_copy(new[j]->text);
 
2840
        if ( offset<0 ) ++j; else --j;
 
2841
    }
 
2842
    for ( i=j=0; i<len; ++i ) if ( !old[i]->selected ) {
 
2843
        while ( new[j] ) ++j;
 
2844
        new[j] = galloc(sizeof(GTextInfo));
 
2845
        *new[j] = *old[i];
 
2846
        new[j]->text = u_copy(new[j]->text);
 
2847
        ++j;
 
2848
    }
 
2849
    new[len] = gcalloc(1,sizeof(GTextInfo));
 
2850
    GGadgetSetList(list,new,false);
 
2851
}
 
2852
 
 
2853
void GListDelSelected(GGadget *list) {
 
2854
    int32 len; int i,j;
 
2855
    GTextInfo **old, **new;
 
2856
 
 
2857
    old = GGadgetGetList(list,&len);
 
2858
    new = gcalloc(len+1,sizeof(GTextInfo *));
 
2859
    for ( i=j=0; i<len; ++i ) if ( !old[i]->selected ) {
 
2860
        new[j] = galloc(sizeof(GTextInfo));
 
2861
        *new[j] = *old[i];
 
2862
        new[j]->text = u_copy(new[j]->text);
 
2863
        ++j;
 
2864
    }
 
2865
    new[j] = gcalloc(1,sizeof(GTextInfo));
 
2866
    GGadgetSetList(list,new,false);
 
2867
}
 
2868
 
 
2869
GTextInfo *GListChangeLine(GGadget *list,int pos, const unichar_t *line) {
 
2870
    GTextInfo **old, **new;
 
2871
    int32 i,len;
 
2872
    
 
2873
    old = GGadgetGetList(list,&len);
 
2874
    new = gcalloc(len+1,sizeof(GTextInfo *));
 
2875
    for ( i=0; i<len; ++i ) {
 
2876
        new[i] = galloc(sizeof(GTextInfo));
 
2877
        *new[i] = *old[i];
 
2878
        if ( i!=pos )
 
2879
            new[i]->text = u_copy(new[i]->text);
 
2880
        else
 
2881
            new[i]->text = u_copy(line);
 
2882
    }
 
2883
    new[i] = gcalloc(1,sizeof(GTextInfo));
 
2884
    GGadgetSetList(list,new,false);
 
2885
    GGadgetScrollListToPos(list,pos);
 
2886
return( new[pos]);
 
2887
}
 
2888
 
 
2889
GTextInfo *GListAppendLine(GGadget *list,const unichar_t *line,int select) {
 
2890
    GTextInfo **old, **new;
 
2891
    int32 i,len;
 
2892
    
 
2893
    old = GGadgetGetList(list,&len);
 
2894
    new = gcalloc(len+2,sizeof(GTextInfo *));
 
2895
    for ( i=0; i<len; ++i ) {
 
2896
        new[i] = galloc(sizeof(GTextInfo));
 
2897
        *new[i] = *old[i];
 
2898
        new[i]->text = u_copy(new[i]->text);
 
2899
        if ( select ) new[i]->selected = false;
 
2900
    }
 
2901
    new[i] = gcalloc(1,sizeof(GTextInfo));
 
2902
    new[i]->fg = new[i]->bg = COLOR_DEFAULT;
 
2903
    new[i]->userdata = NULL;
 
2904
    new[i]->text = u_copy(line);
 
2905
    new[i]->selected = select;
 
2906
    new[i+1] = gcalloc(1,sizeof(GTextInfo));
 
2907
    GGadgetSetList(list,new,false);
 
2908
    GGadgetScrollListToPos(list,i);
 
2909
return( new[i]);
 
2910
}
 
2911
 
 
2912
GTextInfo *GListChangeLine8(GGadget *list,int pos, const char *line) {
 
2913
    GTextInfo **old, **new;
 
2914
    int32 i,len;
 
2915
    
 
2916
    old = GGadgetGetList(list,&len);
 
2917
    new = gcalloc(len+1,sizeof(GTextInfo *));
 
2918
    for ( i=0; i<len; ++i ) {
 
2919
        new[i] = galloc(sizeof(GTextInfo));
 
2920
        *new[i] = *old[i];
 
2921
        if ( i!=pos )
 
2922
            new[i]->text = u_copy(new[i]->text);
 
2923
        else
 
2924
            new[i]->text = utf82u_copy(line);
 
2925
    }
 
2926
    new[i] = gcalloc(1,sizeof(GTextInfo));
 
2927
    GGadgetSetList(list,new,false);
 
2928
    GGadgetScrollListToPos(list,pos);
 
2929
return( new[pos]);
 
2930
}
 
2931
 
 
2932
GTextInfo *GListAppendLine8(GGadget *list,const char *line,int select) {
 
2933
    GTextInfo **old, **new;
 
2934
    int32 i,len;
 
2935
    
 
2936
    old = GGadgetGetList(list,&len);
 
2937
    new = gcalloc(len+2,sizeof(GTextInfo *));
 
2938
    for ( i=0; i<len; ++i ) {
 
2939
        new[i] = galloc(sizeof(GTextInfo));
 
2940
        *new[i] = *old[i];
 
2941
        new[i]->text = u_copy(new[i]->text);
 
2942
        if ( select ) new[i]->selected = false;
 
2943
    }
 
2944
    new[i] = gcalloc(1,sizeof(GTextInfo));
 
2945
    new[i]->fg = new[i]->bg = COLOR_DEFAULT;
 
2946
    new[i]->userdata = NULL;
 
2947
    new[i]->text = utf82u_copy(line);
 
2948
    new[i]->selected = select;
 
2949
    new[i+1] = gcalloc(1,sizeof(GTextInfo));
 
2950
    GGadgetSetList(list,new,false);
 
2951
    GGadgetScrollListToPos(list,i);
 
2952
return( new[i]);
 
2953
}
 
2954
 
 
2955
static int GFI_Cancel(GGadget *g, GEvent *e) {
 
2956
    if ( e->type==et_controlevent && e->u.control.subtype == et_buttonactivate ) {
 
2957
        struct gfi_data *d = GDrawGetUserData(GGadgetGetWindow(g));
 
2958
        GFI_CancelClose(d);
 
2959
    }
 
2960
return( true );
 
2961
}
 
2962
 
 
2963
static int AskLoseUndoes() {
 
2964
#if defined(FONTFORGE_CONFIG_GDRAW)
 
2965
    char *buts[3];
 
2966
    buts[0] = _("_OK"); buts[1] = _("_Cancel"); buts[2]=NULL;
 
2967
#elif defined(FONTFORGE_CONFIG_GTK)
 
2968
    static char *buts[] = { GTK_STOCK_OK, GTK_STOCK_CANCEL, NULL };
 
2969
#endif
 
2970
return( gwwv_ask(_("Losing Undoes"),(const char **) buts,0,1,_("Changing the order of the splines in the font will lose all undoes.\nContinue anyway?")) );
 
2971
}
 
2972
 
 
2973
static void BadFamily() {
 
2974
    gwwv_post_error(_("Bad Family Name"),_("Bad Family Name, must begin with an alphabetic character."));
 
2975
}
 
2976
#endif          /* FONTFORGE_CONFIG_NO_WINDOWING_UI */
 
2977
 
 
2978
static char *modifierlist[] = { "Ital", "Obli", "Kursive", "Cursive", "Slanted",
 
2979
        "Expa", "Cond", NULL };
 
2980
static char *modifierlistfull[] = { "Italic", "Oblique", "Kursive", "Cursive", "Slanted",
 
2981
    "Expanded", "Condensed", NULL };
 
2982
static char **mods[] = { knownweights, modifierlist, NULL };
 
2983
static char **fullmods[] = { realweights, modifierlistfull, NULL };
 
2984
 
 
2985
char *_GetModifiers(char *fontname, char *familyname,char *weight) {
 
2986
    char *pt, *fpt;
 
2987
    int i, j;
 
2988
 
 
2989
    /* URW fontnames don't match the familyname */
 
2990
    /* "NimbusSanL-Regu" vs "Nimbus Sans L" (note "San" vs "Sans") */
 
2991
    /* so look for a '-' if there is one and use that as the break point... */
 
2992
 
 
2993
    if ( (fpt=strchr(fontname,'-'))!=NULL ) {
 
2994
        ++fpt;
 
2995
        if ( *fpt=='\0' )
 
2996
            fpt = NULL;
 
2997
    } else if ( familyname!=NULL ) {
 
2998
        for ( pt = fontname, fpt=familyname; *fpt!='\0' && *pt!='\0'; ) {
 
2999
            if ( *fpt == *pt ) {
 
3000
                ++fpt; ++pt;
 
3001
            } else if ( *fpt==' ' )
 
3002
                ++fpt;
 
3003
            else if ( *pt==' ' )
 
3004
                ++pt;
 
3005
            else if ( *fpt=='a' || *fpt=='e' || *fpt=='i' || *fpt=='o' || *fpt=='u' )
 
3006
                ++fpt;  /* allow vowels to be omitted from family when in fontname */
 
3007
            else
 
3008
        break;
 
3009
        }
 
3010
        if ( *fpt=='\0' && *pt!='\0' )
 
3011
            fpt = pt;
 
3012
        else
 
3013
            fpt = NULL;
 
3014
    }
 
3015
 
 
3016
    if ( fpt == NULL ) {
 
3017
        for ( i=0; mods[i]!=NULL; ++i ) for ( j=0; mods[i][j]!=NULL; ++j ) {
 
3018
            pt = strstr(fontname,mods[i][j]);
 
3019
            if ( pt!=NULL && (fpt==NULL || pt<fpt))
 
3020
                fpt = pt;
 
3021
        }
 
3022
    }
 
3023
    if ( fpt!=NULL ) {
 
3024
        for ( i=0; mods[i]!=NULL; ++i ) for ( j=0; mods[i][j]!=NULL; ++j ) {
 
3025
            if ( strcmp(fpt,mods[i][j])==0 )
 
3026
return( fullmods[i][j]);
 
3027
        }
 
3028
        if ( strcmp(fpt,"BoldItal")==0 )
 
3029
return( "BoldItalic" );
 
3030
        else if ( strcmp(fpt,"BoldObli")==0 )
 
3031
return( "BoldOblique" );
 
3032
 
 
3033
return( fpt );
 
3034
    }
 
3035
 
 
3036
return( weight==NULL || *weight=='\0' ? "Regular": weight );
 
3037
}
 
3038
 
 
3039
char *SFGetModifiers(SplineFont *sf) {
 
3040
return( _GetModifiers(sf->fontname,sf->familyname,sf->weight));
 
3041
}
 
3042
 
 
3043
#ifndef FONTFORGE_CONFIG_NO_WINDOWING_UI
 
3044
static const unichar_t *_uGetModifiers(const unichar_t *fontname, const unichar_t *familyname,
 
3045
        const unichar_t *weight) {
 
3046
    const unichar_t *pt, *fpt;
 
3047
    static unichar_t regular[] = { 'R','e','g','u','l','a','r', 0 };
 
3048
    static unichar_t space[20];
 
3049
    int i,j;
 
3050
 
 
3051
    /* URW fontnames don't match the familyname */
 
3052
    /* "NimbusSanL-Regu" vs "Nimbus Sans L" (note "San" vs "Sans") */
 
3053
    /* so look for a '-' if there is one and use that as the break point... */
 
3054
 
 
3055
    if ( (fpt=u_strchr(fontname,'-'))!=NULL ) {
 
3056
        ++fpt;
 
3057
        if ( *fpt=='\0' )
 
3058
            fpt = NULL;
 
3059
    } else if ( familyname!=NULL ) {
 
3060
        for ( pt = fontname, fpt=familyname; *fpt!='\0' && *pt!='\0'; ) {
 
3061
            if ( *fpt == *pt ) {
 
3062
                ++fpt; ++pt;
 
3063
            } else if ( *fpt==' ' )
 
3064
                ++fpt;
 
3065
            else if ( *pt==' ' )
 
3066
                ++pt;
 
3067
            else if ( *fpt=='a' || *fpt=='e' || *fpt=='i' || *fpt=='o' || *fpt=='u' )
 
3068
                ++fpt;  /* allow vowels to be omitted from family when in fontname */
 
3069
            else
 
3070
        break;
 
3071
        }
 
3072
        if ( *fpt=='\0' && *pt!='\0' )
 
3073
            fpt = pt;
 
3074
        else
 
3075
            fpt = NULL;
 
3076
    }
 
3077
 
 
3078
    if ( fpt==NULL ) {
 
3079
        for ( i=0; mods[i]!=NULL; ++i ) for ( j=0; mods[i][j]!=NULL; ++j ) {
 
3080
            pt = uc_strstr(fontname,mods[i][j]);
 
3081
            if ( pt!=NULL && (fpt==NULL || pt<fpt))
 
3082
                fpt = pt;
 
3083
        }
 
3084
    }
 
3085
 
 
3086
    if ( fpt!=NULL ) {
 
3087
        for ( i=0; mods[i]!=NULL; ++i ) for ( j=0; mods[i][j]!=NULL; ++j ) {
 
3088
            if ( uc_strcmp(fpt,mods[i][j])==0 ) {
 
3089
                uc_strcpy(space,fullmods[i][j]);
 
3090
return( space );
 
3091
            }
 
3092
        }
 
3093
        if ( uc_strcmp(fpt,"BoldItal")==0 ) {
 
3094
            uc_strcpy(space,"BoldItalic");
 
3095
return( space );
 
3096
        } else if ( uc_strcmp(fpt,"BoldObli")==0 ) {
 
3097
            uc_strcpy(space,"BoldOblique");
 
3098
return( space );
 
3099
        }
 
3100
return( fpt );
 
3101
    }
 
3102
 
 
3103
return( weight==NULL || *weight=='\0' ? regular: weight );
 
3104
}
 
3105
#endif          /* FONTFORGE_CONFIG_NO_WINDOWING_UI */
 
3106
 
 
3107
void SFSetFontName(SplineFont *sf, char *family, char *mods,char *full) {
 
3108
    char *n;
 
3109
    char *pt, *tpt;
 
3110
 
 
3111
    n = galloc(strlen(family)+strlen(mods)+2);
 
3112
    strcpy(n,family); strcat(n," "); strcat(n,mods);
 
3113
    if ( full==NULL || *full == '\0' )
 
3114
        full = copy(n);
 
3115
    for ( pt=tpt=n; *pt; ) {
 
3116
        if ( !Isspace(*pt))
 
3117
            *tpt++ = *pt++;
 
3118
        else
 
3119
            ++pt;
 
3120
    }
 
3121
    *tpt = '\0';
 
3122
#if 0
 
3123
    for ( pt=tpt=family; *pt; ) {
 
3124
        if ( !Isspace(*pt))
 
3125
            *tpt++ = *pt++;
 
3126
        else
 
3127
            ++pt;
 
3128
    }
 
3129
    *tpt = '\0';
 
3130
#endif
 
3131
 
 
3132
    free(sf->fullname); sf->fullname = copy(full);
 
3133
 
 
3134
    /* In the URW world fontnames aren't just a simple concatenation of */
 
3135
    /*  family name and modifiers, so neither the family name nor the modifiers */
 
3136
    /*  changed, then don't change the font name */
 
3137
    if ( strcmp(family,sf->familyname)==0 && strcmp(n,sf->fontname)==0 )
 
3138
        /* Don't change the fontname */;
 
3139
        /* or anything else */
 
3140
    else {
 
3141
        free(sf->fontname); sf->fontname = n;
 
3142
        free(sf->familyname); sf->familyname = copy(family);
 
3143
        free(sf->weight); sf->weight = NULL;
 
3144
        if ( strstrmatch(mods,"extralight")!=NULL || strstrmatch(mods,"extra-light")!=NULL )
 
3145
            sf->weight = copy("ExtraLight");
 
3146
        else if ( strstrmatch(mods,"demilight")!=NULL || strstrmatch(mods,"demi-light")!=NULL )
 
3147
            sf->weight = copy("DemiLight");
 
3148
        else if ( strstrmatch(mods,"demibold")!=NULL || strstrmatch(mods,"demi-bold")!=NULL )
 
3149
            sf->weight = copy("DemiBold");
 
3150
        else if ( strstrmatch(mods,"semibold")!=NULL || strstrmatch(mods,"semi-bold")!=NULL )
 
3151
            sf->weight = copy("SemiBold");
 
3152
        else if ( strstrmatch(mods,"demiblack")!=NULL || strstrmatch(mods,"demi-black")!=NULL )
 
3153
            sf->weight = copy("DemiBlack");
 
3154
        else if ( strstrmatch(mods,"extrabold")!=NULL || strstrmatch(mods,"extra-bold")!=NULL )
 
3155
            sf->weight = copy("ExtraBold");
 
3156
        else if ( strstrmatch(mods,"extrablack")!=NULL || strstrmatch(mods,"extra-black")!=NULL )
 
3157
            sf->weight = copy("ExtraBlack");
 
3158
        else if ( strstrmatch(mods,"book")!=NULL )
 
3159
            sf->weight = copy("Book");
 
3160
        else if ( strstrmatch(mods,"regular")!=NULL )
 
3161
            sf->weight = copy("Regular");
 
3162
        else if ( strstrmatch(mods,"roman")!=NULL )
 
3163
            sf->weight = copy("Roman");
 
3164
        else if ( strstrmatch(mods,"normal")!=NULL )
 
3165
            sf->weight = copy("Normal");
 
3166
        else if ( strstrmatch(mods,"demi")!=NULL )
 
3167
            sf->weight = copy("Demi");
 
3168
        else if ( strstrmatch(mods,"medium")!=NULL )
 
3169
            sf->weight = copy("Medium");
 
3170
        else if ( strstrmatch(mods,"bold")!=NULL )
 
3171
            sf->weight = copy("Bold");
 
3172
        else if ( strstrmatch(mods,"heavy")!=NULL )
 
3173
            sf->weight = copy("Heavy");
 
3174
        else if ( strstrmatch(mods,"black")!=NULL )
 
3175
            sf->weight = copy("Black");
 
3176
        else if ( strstrmatch(mods,"Nord")!=NULL )
 
3177
            sf->weight = copy("Nord");
 
3178
/* Sigh. URW uses 4 letter abreviations... */
 
3179
        else if ( strstrmatch(mods,"Regu")!=NULL )
 
3180
            sf->weight = copy("Regular");
 
3181
        else if ( strstrmatch(mods,"Medi")!=NULL )
 
3182
            sf->weight = copy("Medium");
 
3183
        else if ( strstrmatch(mods,"blac")!=NULL )
 
3184
            sf->weight = copy("Black");
 
3185
        else
 
3186
            sf->weight = copy("Medium");
 
3187
    }
 
3188
 
 
3189
#ifndef FONTFORGE_CONFIG_NO_WINDOWING_UI
 
3190
    if ( sf->fv!=NULL && sf->fv->gw!=NULL ) {
 
3191
        unichar_t *temp;
 
3192
        int i;
 
3193
        GDrawSetWindowTitles(sf->fv->gw,temp = uc_copy(sf->fontname),NULL);
 
3194
        free(temp);
 
3195
        for ( i=0; i<sf->glyphcnt; ++i ) if ( sf->glyphs[i]!=NULL && sf->glyphs[i]->views!=NULL ) {
 
3196
            char buffer[300]; unichar_t ubuf[300]; CharView *cv;
 
3197
            sprintf( buffer, "%.90s from %.90s", sf->glyphs[i]->name, sf->fontname );
 
3198
            uc_strcpy(ubuf,buffer);
 
3199
            for ( cv = sf->glyphs[i]->views; cv!=NULL; cv=cv->next )
 
3200
                GDrawSetWindowTitles(cv->gw,ubuf,NULL);
 
3201
        }
 
3202
    }
 
3203
#endif          /* FONTFORGE_CONFIG_NO_WINDOWING_UI */
 
3204
}
 
3205
#ifndef FONTFORGE_CONFIG_NO_WINDOWING_UI
 
3206
 
 
3207
static int SetFontName(GWindow gw, SplineFont *sf) {
 
3208
    const unichar_t *ufamily = _GGadgetGetTitle(GWidgetGetControl(gw,CID_Family));
 
3209
    const unichar_t *ufont = _GGadgetGetTitle(GWidgetGetControl(gw,CID_Fontname));
 
3210
    const unichar_t *uweight = _GGadgetGetTitle(GWidgetGetControl(gw,CID_Weight));
 
3211
    const unichar_t *uhum = _GGadgetGetTitle(GWidgetGetControl(gw,CID_Human));
 
3212
    int diff = uc_strcmp(ufont,sf->fontname)!=0;
 
3213
 
 
3214
    free(sf->familyname);
 
3215
    free(sf->fontname);
 
3216
    free(sf->weight);
 
3217
    free(sf->fullname);
 
3218
    sf->familyname = cu_copy(ufamily);
 
3219
    sf->fontname = cu_copy(ufont);
 
3220
    sf->weight = cu_copy(uweight);
 
3221
    sf->fullname = cu_copy(uhum);
 
3222
return( diff );
 
3223
}
 
3224
 
 
3225
static int CheckNames(struct gfi_data *d) {
 
3226
    const unichar_t *ufamily = _GGadgetGetTitle(GWidgetGetControl(d->gw,CID_Family));
 
3227
    const unichar_t *ufont = _GGadgetGetTitle(GWidgetGetControl(d->gw,CID_Fontname));
 
3228
    unichar_t *end; const unichar_t *pt;
 
3229
#if defined(FONTFORGE_CONFIG_GDRAW)
 
3230
    char *buts[3];
 
3231
    buts[0] = _("_OK"); buts[1] = _("_Cancel"); buts[2]=NULL;
 
3232
#elif defined(FONTFORGE_CONFIG_GTK)
 
3233
    static char *buts[] = { GTK_STOCK_OK, GTK_STOCK_CANCEL, NULL };
 
3234
#endif
 
3235
 
 
3236
    if ( u_strlen(ufont)>63 ) {
 
3237
        gwwv_post_error(_("Bad Font Name"),_("A Postscript name should be ASCII\nand must not contain (){}[]<>%%/ or space\nand must be shorter than 63 characters"));
 
3238
return( false );
 
3239
    }
 
3240
 
 
3241
    if ( *ufamily=='\0' ) {
 
3242
        gwwv_post_error(_("A Font Family name is required"),_("A Font Family name is required"));
 
3243
return( false );
 
3244
    }
 
3245
    /* A postscript name cannot be a number. There are two ways it can be a */
 
3246
    /*  number, it can be a real (which we can check for with strtod) or */
 
3247
    /*  it can be a "radix number" which is <intval>'#'<intval>. I'll only */
 
3248
    /*  do a cursory test for that */
 
3249
    u_strtod(ufamily,&end);
 
3250
    if ( *end=='\0' || (isdigit(ufamily[0]) && u_strchr(ufamily,'#')!=NULL) ) {
 
3251
        gwwv_post_error(_("Bad Font Family Name"),_("A Postscript name may not be a number"));
 
3252
return( false );
 
3253
    }
 
3254
    if ( u_strlen(ufamily)>31 ) {
 
3255
        if ( gwwv_ask(_("Bad Font Family Name"),(const char **) buts,0,1,_("Some versions of Windows will refuse to install postscript fonts if the familyname is longer than 31 characters. Do you want to continue anyway?"))==1 )
 
3256
return( false );
 
3257
    } else {
 
3258
        if ( u_strlen(ufont)>31 ) {
 
3259
            if ( gwwv_ask(_("Bad Font Name"),(const char **) buts,0,1,_("Some versions of Windows will refuse to install postscript fonts if the fontname is longer than 31 characters. Do you want to continue anyway?"))==1 )
 
3260
return( false );
 
3261
        } else if ( u_strlen(ufont)>29 ) {
 
3262
            if ( gwwv_ask(_("Bad Font Name"),(const char **) buts,0,1,_("Adobe's fontname spec (5088.FontNames.pdf) says that fontnames must not be longer than 29 characters. Do you want to continue anyway?"))==1 )
 
3263
return( false );
 
3264
        }
 
3265
    }
 
3266
    while ( *ufamily ) {
 
3267
        if ( *ufamily<' ' || *ufamily>=0x7f ) {
 
3268
            gwwv_post_error(_("Bad Font Family Name"),_("A Postscript name should be ASCII\nand must not contain (){}[]<>%%/ or space"));
 
3269
return( false );
 
3270
        }
 
3271
        ++ufamily;
 
3272
    }
 
3273
 
 
3274
    u_strtod(ufont,&end);
 
3275
    if ( (*end=='\0' || (isdigit(ufont[0]) && u_strchr(ufont,'#')!=NULL)) &&
 
3276
            *ufont!='\0' ) {
 
3277
        gwwv_post_error(_("Bad Font Name"),_("A Postscript name may not be a number"));
 
3278
return( false );
 
3279
    }
 
3280
    for ( pt=ufont; *pt; ++pt ) {
 
3281
        if ( *pt<=' ' || *pt>=0x7f ||
 
3282
                *pt=='(' || *pt=='[' || *pt=='{' || *pt=='<' ||
 
3283
                *pt==')' || *pt==']' || *pt=='}' || *pt=='>' ||
 
3284
                *pt=='%' || *pt=='/' ) {
 
3285
            gwwv_post_error(_("Bad Font Name"),_("A Postscript name should be ASCII\nand must not contain (){}[]<>%%/ or space"));
 
3286
return( false );
 
3287
        }
 
3288
    }
 
3289
return( true );
 
3290
}
 
3291
#endif          /* FONTFORGE_CONFIG_NO_WINDOWING_UI */
 
3292
 
 
3293
void TTF_PSDupsDefault(SplineFont *sf) {
 
3294
    struct ttflangname *english;
 
3295
    char versionbuf[40];
 
3296
 
 
3297
    /* Ok, if we've just loaded a ttf file then we've got a bunch of langnames*/
 
3298
    /*  we copied some of them (copyright, family, fullname, etc) into equiv */
 
3299
    /*  postscript entries in the sf. If we then use FontInfo and change the */
 
3300
    /*  obvious postscript entries we are left with the old ttf entries. If */
 
3301
    /*  we generate a ttf file and then load it the old values pop up. */
 
3302
    /* Solution: Anything we can generate by default should be set to NULL */
 
3303
    for ( english=sf->names; english!=NULL && english->lang!=0x409; english=english->next );
 
3304
    if ( english==NULL )
 
3305
return;
 
3306
    if ( english->names[ttf_family]!=NULL &&
 
3307
            strcmp(english->names[ttf_family],sf->familyname)==0 ) {
 
3308
        free(english->names[ttf_family]);
 
3309
        english->names[ttf_family]=NULL;
 
3310
    }
 
3311
    if ( english->names[ttf_copyright]!=NULL &&
 
3312
            strcmp(english->names[ttf_copyright],sf->copyright)==0 ) {
 
3313
        free(english->names[ttf_copyright]);
 
3314
        english->names[ttf_copyright]=NULL;
 
3315
    }
 
3316
    if ( english->names[ttf_fullname]!=NULL &&
 
3317
            strcmp(english->names[ttf_fullname],sf->fullname)==0 ) {
 
3318
        free(english->names[ttf_fullname]);
 
3319
        english->names[ttf_fullname]=NULL;
 
3320
    }
 
3321
    if ( sf->subfontcnt!=0 || sf->version!=NULL ) {
 
3322
        if ( sf->subfontcnt!=0 )
 
3323
            sprintf( versionbuf, "Version %f", sf->cidversion );
 
3324
        else
 
3325
            sprintf(versionbuf,"Version %.20s ", sf->version);
 
3326
        if ( english->names[ttf_version]!=NULL &&
 
3327
                strcmp(english->names[ttf_version],versionbuf)==0 ) {
 
3328
            free(english->names[ttf_version]);
 
3329
            english->names[ttf_version]=NULL;
 
3330
        }
 
3331
    }
 
3332
    if ( english->names[ttf_subfamily]!=NULL &&
 
3333
            strcmp(english->names[ttf_subfamily],SFGetModifiers(sf))==0 ) {
 
3334
        free(english->names[ttf_subfamily]);
 
3335
        english->names[ttf_subfamily]=NULL;
 
3336
    }
 
3337
 
 
3338
    /* User should not be allowed any access to this one, not ever */
 
3339
    free(english->names[ttf_postscriptname]);
 
3340
    english->names[ttf_postscriptname]=NULL;
 
3341
}
 
3342
 
 
3343
#ifndef FONTFORGE_CONFIG_NO_WINDOWING_UI
 
3344
static int ttfspecials[] = { ttf_copyright, ttf_family, ttf_fullname,
 
3345
        ttf_subfamily, ttf_version, -1 };
 
3346
 
 
3347
static char *tn_recalculatedef(struct gfi_data *d,int cur_id) {
 
3348
    char versionbuf[40], *v;
 
3349
 
 
3350
    switch ( cur_id ) {
 
3351
      case ttf_copyright:
 
3352
return( GGadgetGetTitle8(GWidgetGetControl(d->gw,CID_Notice)));
 
3353
      case ttf_family:
 
3354
return( GGadgetGetTitle8(GWidgetGetControl(d->gw,CID_Family)));
 
3355
      case ttf_fullname:
 
3356
return( GGadgetGetTitle8(GWidgetGetControl(d->gw,CID_Human)));
 
3357
      case ttf_subfamily:
 
3358
return( u2utf8_copy(_uGetModifiers(
 
3359
                _GGadgetGetTitle(GWidgetGetControl(d->gw,CID_Fontname)),
 
3360
                _GGadgetGetTitle(GWidgetGetControl(d->gw,CID_Family)),
 
3361
                _GGadgetGetTitle(GWidgetGetControl(d->gw,CID_Weight)))));
 
3362
      case ttf_version:
 
3363
        sprintf(versionbuf,_("Version %.20s"),
 
3364
                v=GGadgetGetTitle8(GWidgetGetControl(d->gw,CID_Version)));
 
3365
        free(v);
 
3366
return( copy(versionbuf));
 
3367
      default:
 
3368
return( NULL );
 
3369
    }
 
3370
}
 
3371
 
 
3372
static char *TN_DefaultName(GGadget *g, int r, int c) {
 
3373
    struct gfi_data *d = GGadgetGetUserData(g);
 
3374
    int rows;
 
3375
    struct matrix_data *strings = GMatrixEditGet(g, &rows);
 
3376
 
 
3377
    if ( strings==NULL || !strings[3*r+2].user_bits )
 
3378
return( NULL );
 
3379
 
 
3380
return( tn_recalculatedef(d,strings[3*r+1].u.md_ival ));
 
3381
}
 
3382
 
 
3383
static const char *langname(int lang,char *buffer) {
 
3384
    int i;
 
3385
    for ( i=0; mslanguages[i].text!=NULL; ++i )
 
3386
        if ( mslanguages[i].userdata == (void *) (intpt) lang )
 
3387
return( (char *) mslanguages[i].text );
 
3388
 
 
3389
    sprintf( buffer, "%04X", lang );
 
3390
return( buffer );
 
3391
}
 
3392
 
 
3393
static int strid_sorter(const void *pt1, const void *pt2) {
 
3394
    const struct matrix_data *n1 = pt1, *n2 = pt2;
 
3395
    char buf1[20], buf2[20];
 
3396
    const char *l1, *l2;
 
3397
 
 
3398
    if ( n1[1].u.md_ival!=n2[1].u.md_ival )
 
3399
return( n1[1].u.md_ival - n2[1].u.md_ival );
 
3400
 
 
3401
    l1 = langname(n1[0].u.md_ival,buf1);
 
3402
    l2 = langname(n2[0].u.md_ival,buf2);
 
3403
return( strcoll(l1,l2));
 
3404
}
 
3405
 
 
3406
static int lang_sorter(const void *pt1, const void *pt2) {
 
3407
    const struct matrix_data *n1 = pt1, *n2 = pt2;
 
3408
    char buf1[20], buf2[20];
 
3409
    const char *l1, *l2;
 
3410
 
 
3411
    if ( n1[0].u.md_ival==n2[0].u.md_ival )
 
3412
return( n1[1].u.md_ival - n2[1].u.md_ival );
 
3413
 
 
3414
    l1 = langname(n1[0].u.md_ival,buf1);
 
3415
    l2 = langname(n2[0].u.md_ival,buf2);
 
3416
return( strcoll(l1,l2));
 
3417
}
 
3418
 
 
3419
static int ms_thislocale = 0;
 
3420
static int specialvals(const struct matrix_data *n) {
 
3421
    if ( n[0].u.md_ival == ms_thislocale )
 
3422
return( -10000000 );
 
3423
    else if ( (n[0].u.md_ival&0x3ff) == (ms_thislocale&0x3ff) )
 
3424
return( -10000000 + (n[0].u.md_ival&~0x3ff) );
 
3425
    if ( n[0].u.md_ival == 0x409 )      /* English */
 
3426
return( -1000000 );
 
3427
    else if ( (n[0].u.md_ival&0x3ff) == 9 )
 
3428
return( -1000000 + (n[0].u.md_ival&~0x3ff) );
 
3429
 
 
3430
return( 1 );
 
3431
}
 
3432
 
 
3433
static int speciallang_sorter(const void *pt1, const void *pt2) {
 
3434
    const struct matrix_data *n1 = pt1, *n2 = pt2;
 
3435
    char buf1[20], buf2[20];
 
3436
    const char *l1, *l2;
 
3437
    int pos1=1, pos2=1;
 
3438
 
 
3439
    /* sort so that entries for the current language are first, then English */
 
3440
    /*  then alphabetical order */
 
3441
    if ( n1[0].u.md_ival==n2[0].u.md_ival )
 
3442
return( n1[1].u.md_ival - n2[1].u.md_ival );
 
3443
 
 
3444
    pos1 = specialvals(n1); pos2 = specialvals(n2);
 
3445
    if ( pos1<0 || pos2<0 )
 
3446
return( pos1-pos2 );
 
3447
    l1 = langname(n1[0].u.md_ival,buf1);
 
3448
    l2 = langname(n2[0].u.md_ival,buf2);
 
3449
return( strcoll(l1,l2));
 
3450
}
 
3451
 
 
3452
static void TTFNames_Resort(struct gfi_data *d) {
 
3453
    int(*compar)(const void *, const void *);
 
3454
    GGadget *edit = GWidgetGetControl(d->gw,CID_TNames);
 
3455
    int rows;
 
3456
    struct matrix_data *strings = GMatrixEditGet(edit, &rows);
 
3457
 
 
3458
    if ( strings==NULL )
 
3459
return;
 
3460
 
 
3461
    if ( GGadgetIsChecked(GWidgetGetControl(d->gw,CID_TNLangSort)) )
 
3462
        compar = lang_sorter;
 
3463
    else if ( GGadgetIsChecked(GWidgetGetControl(d->gw,CID_TNStringSort)) )
 
3464
        compar = strid_sorter;
 
3465
    else
 
3466
        compar = speciallang_sorter;
 
3467
    ms_thislocale = d->langlocalecode;
 
3468
    qsort(strings,rows,3*sizeof(struct matrix_data),compar);
 
3469
}
 
3470
 
 
3471
static void DefaultLanguage(struct gfi_data *d) {
 
3472
    const char *lang=NULL;
 
3473
    int i, langlen;
 
3474
    static char *envs[] = { "LC_ALL", "LC_MESSAGES", "LANG", NULL };
 
3475
    char langcountry[8], language[4];
 
3476
    int langcode, langlocalecode;
 
3477
 
 
3478
    for ( i=0; envs[i]!=NULL; ++i ) {
 
3479
        lang = getenv(envs[i]);
 
3480
        if ( lang!=NULL ) {
 
3481
            langlen = strlen(lang);
 
3482
            if (( langlen>5 && lang[5]=='.' && lang[2]=='_' ) ||
 
3483
                    (langlen==5 && lang[2]=='_' ) ||
 
3484
                    (langlen==2) ||
 
3485
                    (langlen==3))       /* Some obscure languages have a 3 letter code */
 
3486
                /* I understand this language */
 
3487
    break;
 
3488
        }
 
3489
    }
 
3490
    if ( lang==NULL )
 
3491
        lang = "en_US";
 
3492
    strncpy(langcountry,lang,5); langcountry[5] = '\0';
 
3493
    strncpy(language,lang,3); language[3] = '\0';
 
3494
    if ( language[2]=='_' ) language[2] = '\0';
 
3495
    langlen = strlen(language);
 
3496
 
 
3497
    langcode = langlocalecode = -1;
 
3498
    for ( i=0; ms_2_locals[i].loc_name!=NULL; ++i ) {
 
3499
        if ( strmatch(langcountry,ms_2_locals[i].loc_name)==0 ) {
 
3500
            langlocalecode = ms_2_locals[i].local_id;
 
3501
            langcode = langlocalecode&0x3ff;
 
3502
    break;
 
3503
        } else if ( strncmp(language,ms_2_locals[i].loc_name,langlen)==0 )
 
3504
            langcode = ms_2_locals[i].local_id&0x3ff;
 
3505
    }
 
3506
    if ( langcode==-1 )         /* Default to English */
 
3507
        langcode = 0x9;
 
3508
    d->langlocalecode = langlocalecode==-1 ? (langcode|0x400) : langlocalecode;
 
3509
}
 
3510
 
 
3511
static int GFI_Char(struct gfi_data *d,GEvent *event) {
 
3512
    if ( event->u.chr.keysym == GK_F1 || event->u.chr.keysym == GK_Help ) {
 
3513
        help("fontinfo.html");
 
3514
return( true );
 
3515
    } else if ( event->u.chr.keysym=='s' &&
 
3516
            (event->u.chr.state&ksm_control) &&
 
3517
            (event->u.chr.state&ksm_meta) ) {
 
3518
        MenuSaveAll(NULL,NULL,NULL);
 
3519
return( true );
 
3520
    } else if ( event->u.chr.keysym=='q' && (event->u.chr.state&ksm_control)) {
 
3521
        if ( event->u.chr.state&ksm_shift ) {
 
3522
            GFI_CancelClose(d);
 
3523
        } else
 
3524
            MenuExit(NULL,NULL,NULL);
 
3525
return( true );
 
3526
    }
 
3527
return( false );
 
3528
}
 
3529
 
 
3530
static int CheckActiveStyleTranslation(struct gfi_data *d,
 
3531
        struct matrix_data *strings,int r, int rows) {
 
3532
    int i,j, eng_pos, other_pos;
 
3533
    char *english, *new=NULL, *temp, *pt;
 
3534
    int other_lang = strings[3*r].u.md_ival;
 
3535
    int changed = false;
 
3536
 
 
3537
    for ( i=rows-1; i>=0 ; --i )
 
3538
        if ( strings[3*i+1].u.md_ival==ttf_subfamily &&
 
3539
                strings[3*i].u.md_ival == 0x409 )
 
3540
    break;
 
3541
    if ( i<0 || (english = strings[3*i+2].u.md_str)==NULL )
 
3542
        new = tn_recalculatedef(d,ttf_subfamily);
 
3543
    else
 
3544
        new = copy(english);
 
3545
    for ( i=0; stylelist[i]!=NULL; ++i ) {
 
3546
        eng_pos = other_pos = -1;
 
3547
        for ( j=0; stylelist[i][j].str!=NULL; ++j ) {
 
3548
            if ( stylelist[i][j].lang == other_lang ) {
 
3549
                other_pos = j;
 
3550
        break;
 
3551
            }
 
3552
        }
 
3553
        if ( other_pos==-1 )
 
3554
    continue;
 
3555
        for ( j=0; stylelist[i][j].str!=NULL; ++j ) {
 
3556
            if ( stylelist[i][j].lang == 0x409 &&
 
3557
                    (pt = strstrmatch(new,stylelist[i][j].str))!=NULL ) {
 
3558
                if ( pt==new && strlen(stylelist[i][j].str)==strlen(new) ) {
 
3559
                    free(new);
 
3560
                    free(strings[3*r+2].u.md_str);
 
3561
                    if ( other_lang==0x415 ) {
 
3562
                        /* polish needs a word before the translation */
 
3563
                        strings[3*r+2].u.md_str = galloc(strlen("odmiana ")+strlen(stylelist[i][other_pos].str)+1);
 
3564
                        strcpy(strings[3*r+2].u.md_str,"odmiana ");
 
3565
                        strcat(strings[3*r+2].u.md_str,stylelist[i][other_pos].str);
 
3566
                    } else
 
3567
                        strings[3*r+2].u.md_str = copy(stylelist[i][other_pos].str);
 
3568
return( true );
 
3569
                }
 
3570
                temp = galloc((strlen(new)
 
3571
                        + strlen(stylelist[i][other_pos].str)
 
3572
                        - strlen(stylelist[i][j].str)
 
3573
                        +1));
 
3574
                strncpy(temp,new,pt-new);
 
3575
                strcpy(temp+(pt-new),stylelist[i][other_pos].str);
 
3576
                strcat(temp+(pt-new),pt+strlen(stylelist[i][j].str));
 
3577
                free(new);
 
3578
                new = temp;
 
3579
                changed = true;
 
3580
        continue;
 
3581
            }
 
3582
        }
 
3583
    }
 
3584
    if ( changed ) {
 
3585
        free(strings[3*r+2].u.md_str);
 
3586
        if ( other_lang==0x415 ) {
 
3587
            /* polish needs a word before the translation */
 
3588
            strings[3*r+2].u.md_str = galloc(strlen("odmiana ")+strlen(new)+1);
 
3589
            strcpy(strings[3*r+2].u.md_str,"odmiana ");
 
3590
            strcat(strings[3*r+2].u.md_str,new);
 
3591
            free(new);
 
3592
        } else
 
3593
            strings[3*r+2].u.md_str = new;
 
3594
    } else
 
3595
        free(new);
 
3596
return( changed );
 
3597
}
 
3598
 
 
3599
#define MID_ToggleBase  1
 
3600
#define MID_MultiEdit   2
 
3601
#define MID_Delete      3
 
3602
 
 
3603
static void TN_StrPopupDispatch(GWindow gw, GMenuItem *mi, GEvent *e) {
 
3604
    struct gfi_data *d = GDrawGetUserData(GDrawGetParentWindow(gw));
 
3605
    GGadget *g = GWidgetGetControl(d->gw,CID_TNames);
 
3606
 
 
3607
    switch ( mi->mid ) {
 
3608
      case MID_ToggleBase: {
 
3609
        int rows;
 
3610
        struct matrix_data *strings = GMatrixEditGet(g, &rows);
 
3611
        strings[3*d->tn_active+2].frozen = !strings[3*d->tn_active+2].frozen;
 
3612
        if ( strings[3*d->tn_active+2].frozen ) {
 
3613
            free( strings[3*d->tn_active+2].u.md_str );
 
3614
            strings[3*d->tn_active+2].u.md_str = NULL;
 
3615
        } else {
 
3616
            strings[3*d->tn_active+2].u.md_str = tn_recalculatedef(d,strings[3*d->tn_active+1].u.md_ival);
 
3617
        }
 
3618
        GGadgetRedraw(g);
 
3619
      } break;
 
3620
      case MID_MultiEdit:
 
3621
        GMatrixEditStringDlg(g,d->tn_active,2);
 
3622
      break;
 
3623
      case MID_Delete:
 
3624
        GMatrixEditDeleteRow(g,d->tn_active);
 
3625
      break;
 
3626
    }
 
3627
}
 
3628
 
 
3629
static int menusort(const void *m1, const void *m2) {
 
3630
    const GMenuItem *mi1 = m1, *mi2 = m2;
 
3631
 
 
3632
    /* Should do a strcoll here, but I never wrote one */
 
3633
    if ( mi1->ti.text_is_1byte && mi2->ti.text_is_1byte )
 
3634
return( strcoll( (char *) (mi1->ti.text), (char *) (mi2->ti.text)) );
 
3635
    else
 
3636
return( u_strcmp(mi1->ti.text,mi2->ti.text));
 
3637
}
 
3638
 
 
3639
static void TN_StrIDEnable(GGadget *g,GMenuItem *mi, int r, int c) {
 
3640
    int rows, i, j;
 
3641
    struct matrix_data *strings = GMatrixEditGet(g, &rows);
 
3642
 
 
3643
    for ( i=0; mi[i].ti.text!=NULL; ++i ) {
 
3644
        int strid = (intpt) mi[i].ti.userdata;
 
3645
        for ( j=0; j<rows; ++j ) if ( j!=r )
 
3646
            if ( strings[3*j].u.md_ival == strings[3*r].u.md_ival &&
 
3647
                    strings[3*j+1].u.md_ival == strid ) {
 
3648
                mi[i].ti.disabled = true;
 
3649
        break;
 
3650
            }
 
3651
    }
 
3652
    qsort(mi,i,sizeof(mi[0]),menusort);
 
3653
}    
 
3654
 
 
3655
static void TN_LangEnable(GGadget *g,GMenuItem *mi, int r, int c) {
 
3656
    int i;
 
3657
 
 
3658
    for ( i=0; mi[i].ti.text!=NULL; ++i )
 
3659
    qsort(mi,i,sizeof(mi[0]),menusort);
 
3660
}    
 
3661
 
 
3662
static void TN_NewName(GGadget *g,int row) {
 
3663
    int rows;
 
3664
    struct matrix_data *strings = GMatrixEditGet(g, &rows);
 
3665
 
 
3666
    strings[3*row+1].u.md_ival = ttf_subfamily;
 
3667
}
 
3668
 
 
3669
static void TN_FinishEdit(GGadget *g,int row,int col,int wasnew) {
 
3670
    int i,rows;
 
3671
    struct matrix_data *strings = GMatrixEditGet(g, &rows);
 
3672
    uint8 found[ttf_namemax];
 
3673
    struct gfi_data *d = (struct gfi_data *) GGadgetGetUserData(g);
 
3674
    int ret = false;
 
3675
 
 
3676
    if ( col==2 ) {
 
3677
        if ( strings[3*row+2].u.md_str==NULL || *strings[3*row+2].u.md_str=='\0' ) {
 
3678
            GMatrixEditDeleteRow(g,row);
 
3679
            ret = true;
 
3680
        }
 
3681
    } else {
 
3682
        if ( col==0 ) {
 
3683
            memset(found,0,sizeof(found));
 
3684
            found[ttf_idontknow] = true;        /* reserved name id */
 
3685
            for ( i=0; i<rows; ++i ) if ( i!=row ) {
 
3686
                if ( strings[3*i].u.md_ival == strings[3*row].u.md_ival )       /* Same language */
 
3687
                    found[strings[3*i+1].u.md_ival] = true;
 
3688
            }
 
3689
            if ( found[ strings[3*row+1].u.md_ival ] ) {
 
3690
                /* This language already has an entry for this strid */
 
3691
                /* pick another */
 
3692
                if ( !found[ttf_subfamily] ) {
 
3693
                    strings[3*row+1].u.md_ival = ttf_subfamily;
 
3694
                    ret = true;
 
3695
                } else {
 
3696
                    for ( i=0; i<ttf_namemax; ++i )
 
3697
                        if ( !found[i] ) {
 
3698
                            strings[3*row+1].u.md_ival = i;
 
3699
                            ret = true;
 
3700
                    break;
 
3701
                        }
 
3702
                }
 
3703
            }
 
3704
        }
 
3705
        if ( (strings[3*row+2].u.md_str==NULL || *strings[3*row+2].u.md_str=='\0') ) {
 
3706
            for ( i=0; i<rows; ++i ) if ( i!=row ) {
 
3707
                if ( strings[3*row+1].u.md_ival == strings[3*i+1].u.md_ival &&
 
3708
                        (strings[3*row].u.md_ival&0xff) == (strings[3*i].u.md_ival&0xff)) {
 
3709
                    /* Same string, same language, different locale */
 
3710
                    /* first guess is the same as the other string. */
 
3711
                    if ( strings[3*i+2].u.md_str==NULL )
 
3712
                        strings[3*row+2].u.md_str = tn_recalculatedef(d,strings[3*row+1].u.md_ival );
 
3713
                    else
 
3714
                        strings[3*row+2].u.md_str = copy(strings[3*i+2].u.md_str);
 
3715
                    ret = true;
 
3716
            break;
 
3717
                }
 
3718
            }
 
3719
            /* If we didn't find anything above, and if we've got a style */
 
3720
            /*  (subfamily) see if we can guess a translation from the english */
 
3721
            if ( i==rows && strings[3*row+1].u.md_ival == ttf_subfamily )
 
3722
                ret |= CheckActiveStyleTranslation(d,strings,row,rows);
 
3723
        }
 
3724
    }
 
3725
    if ( ret )
 
3726
        GGadgetRedraw(g);
 
3727
}
 
3728
 
 
3729
static int TN_CanDelete(GGadget *g,int row) {
 
3730
    int rows;
 
3731
    struct matrix_data *strings = GMatrixEditGet(g, &rows);
 
3732
    if ( strings==NULL )
 
3733
return( false );
 
3734
 
 
3735
return( !strings[3*row+2].user_bits );
 
3736
}
 
3737
 
 
3738
static void TN_PopupMenu(GGadget *g,GEvent *event,int r,int c) {
 
3739
    struct gfi_data *d = (struct gfi_data *) GGadgetGetUserData(g);
 
3740
    int rows;
 
3741
    struct matrix_data *strings = GMatrixEditGet(g, &rows);
 
3742
    GMenuItem mi[5];
 
3743
    int i;
 
3744
 
 
3745
    if ( strings==NULL )
 
3746
return;
 
3747
 
 
3748
    d->tn_active = r;
 
3749
 
 
3750
    memset(mi,'\0',sizeof(mi));
 
3751
    for ( i=0; i<3; ++i ) {
 
3752
        mi[i].ti.fg = COLOR_DEFAULT;
 
3753
        mi[i].ti.bg = COLOR_DEFAULT;
 
3754
        mi[i].mid = i+1;
 
3755
        mi[i].invoke = TN_StrPopupDispatch;
 
3756
        mi[i].ti.text_is_1byte = true;
 
3757
    }
 
3758
    mi[MID_Delete-1].ti.disabled = strings[3*r+2].user_bits;
 
3759
    mi[MID_ToggleBase-1].ti.disabled = !strings[3*r+2].user_bits;
 
3760
    if ( strings[3*r+2].frozen ) {
 
3761
        mi[MID_MultiEdit-1].ti.disabled = true;
 
3762
        mi[MID_ToggleBase-1].ti.text = (unichar_t *) _("Detach from PostScript Names");
 
3763
    } else {
 
3764
        char *temp;
 
3765
        mi[MID_ToggleBase-1].ti.text = (unichar_t *) _("Same as PostScript Names");
 
3766
        temp = tn_recalculatedef(d,strings[3*r+1].u.md_ival);
 
3767
        mi[MID_ToggleBase-1].ti.disabled = (temp==NULL);
 
3768
        free(temp);
 
3769
    }
 
3770
    if ( c!=2 )
 
3771
        mi[MID_MultiEdit-1].ti.disabled = true;
 
3772
    mi[MID_MultiEdit-1].ti.text = (unichar_t *) _("Multi-line edit");
 
3773
    mi[MID_Delete-1].ti.text = (unichar_t *) _("Delete");
 
3774
    GMenuCreatePopupMenu(event->w,event, mi);
 
3775
}
 
3776
 
 
3777
static int TN_PassChar(GGadget *g,GEvent *e) {
 
3778
return( GFI_Char(GGadgetGetUserData(g),e));
 
3779
}
 
3780
 
 
3781
static char *TN_BigEditTitle(GGadget *g,int r, int c) {
 
3782
    char buf[100], buf2[20];
 
3783
    const char *lang;
 
3784
    int k;
 
3785
    int rows;
 
3786
    struct matrix_data *strings = GMatrixEditGet(g, &rows);
 
3787
 
 
3788
    lang = langname(strings[3*r].u.md_ival,buf2);
 
3789
    for ( k=0; ttfnameids[k].text!=NULL && ttfnameids[k].userdata!=(void *) (intpt) strings[3*r+1].u.md_ival;
 
3790
            ++k );
 
3791
    snprintf(buf,sizeof(buf),_("%1$.30s string for %2$.30s"),
 
3792
            lang, (char *) ttfnameids[k].text );
 
3793
return( copy( buf ));
 
3794
}
 
3795
 
 
3796
static void TNMatrixInit(struct matrixinit *mi,struct gfi_data *d) {
 
3797
    SplineFont *sf = d->sf;
 
3798
    int i,j,k,cnt;
 
3799
    uint8 sawEnglishUS[ttf_namemax];
 
3800
    struct ttflangname *tln;
 
3801
    struct matrix_data *md;
 
3802
 
 
3803
    DefaultLanguage(d);
 
3804
 
 
3805
    memset(mi,0,sizeof(*mi));
 
3806
    mi->col_cnt = 3;
 
3807
    mi->col_init = ci;
 
3808
 
 
3809
    md = NULL;
 
3810
    for ( k=0; k<2; ++k ) {
 
3811
        memset(sawEnglishUS,0,sizeof(sawEnglishUS));
 
3812
        cnt = 0;
 
3813
        for ( tln = sf->names; tln!=NULL; tln = tln->next ) {
 
3814
            for ( i=0; i<ttf_namemax; ++i ) if ( i!=ttf_postscriptname && tln->names[i]!=NULL ) {
 
3815
                if ( md!=NULL ) {
 
3816
                    md[3*cnt  ].u.md_ival = tln->lang;
 
3817
                    md[3*cnt+1].u.md_ival = i;
 
3818
                    md[3*cnt+2].u.md_str = copy(tln->names[i]);
 
3819
                }
 
3820
                ++cnt;
 
3821
                if ( tln->lang==0x409 )
 
3822
                    sawEnglishUS[i] = true;
 
3823
            }
 
3824
        }
 
3825
        for ( i=0; ttfspecials[i]!=-1; ++i ) if ( !sawEnglishUS[ttfspecials[i]] ) {
 
3826
            if ( md!=NULL ) {
 
3827
                md[3*cnt  ].u.md_ival = 0x409;
 
3828
                md[3*cnt+1].u.md_ival = ttfspecials[i];
 
3829
                md[3*cnt+2].u.md_str = NULL;
 
3830
/* if frozen is set then can't remove or edit. (old basedon bit) */
 
3831
                md[3*cnt].frozen = md[3*cnt+1].frozen = md[3*cnt+2].frozen = true;
 
3832
/* if user_bits is set then can't remove. (old cantremove bit) */
 
3833
                md[3*cnt].user_bits = md[3*cnt+1].user_bits = md[3*cnt+2].user_bits = true;
 
3834
            }
 
3835
            ++cnt;
 
3836
        }
 
3837
        if ( md==NULL )
 
3838
            md = gcalloc(3*(cnt+10),sizeof(struct matrix_data));
 
3839
    }
 
3840
    for ( i=0; i<cnt; ++i ) if ( md[3*cnt].u.md_ival==0x409 ) {
 
3841
        for ( j=0; ttfspecials[j]!=-1 && ttfspecials[j]!=md[3*cnt+1].u.md_ival; ++j );
 
3842
        md[3*i].user_bits = md[3*i+1].user_bits = md[3*i+2].user_bits = 
 
3843
                ( ttfspecials[j]!=-1 );
 
3844
    }
 
3845
    mi->matrix_data = md;
 
3846
    mi->initial_row_cnt = cnt;
 
3847
 
 
3848
    mi->initrow = TN_NewName;
 
3849
    mi->finishedit = TN_FinishEdit;
 
3850
    mi->candelete = TN_CanDelete;
 
3851
    mi->popupmenu = TN_PopupMenu;
 
3852
    mi->handle_key = TN_PassChar;
 
3853
    mi->bigedittitle = TN_BigEditTitle;
 
3854
}
 
3855
 
 
3856
static int GFI_HelpOFL(GGadget *g, GEvent *e) {
 
3857
    if ( e->type==et_controlevent && e->u.control.subtype == et_buttonactivate ) {
 
3858
        help("http://scripts.sil.org/OFL");
 
3859
    }
 
3860
return( true );
 
3861
}
 
3862
 
 
3863
static int GFI_AddOFL(GGadget *g, GEvent *e) {
 
3864
    if ( e->type==et_controlevent && e->u.control.subtype == et_buttonactivate ) {
 
3865
        struct gfi_data *d = GDrawGetUserData(GGadgetGetWindow(g));
 
3866
        GGadget *tng = GWidgetGetControl(GGadgetGetWindow(g),CID_TNames);
 
3867
        int rows;
 
3868
        struct matrix_data *tns, *newtns;
 
3869
        int i,j,k,l,m, extras, len;
 
3870
        char *all, *pt, **data;
 
3871
        char buffer[1024], *bpt;
 
3872
        const char *author = GetAuthor();
 
3873
        char *reservedname, *fallback;
 
3874
        time_t now;
 
3875
        struct tm *tm;
 
3876
 
 
3877
        time(&now);
 
3878
        tm = localtime(&now);
 
3879
 
 
3880
        tns = GMatrixEditGet(tng, &rows); newtns = NULL;
 
3881
        for ( k=0; k<2; ++k ) {
 
3882
            extras = 0;
 
3883
            for ( i=0; ofl_str_lang_data[i].data!=NULL; ++i ) {
 
3884
                for ( j=rows-1; j>=0; --j ) {
 
3885
                    if ( tns[j*3+1].u.md_ival==ofl_str_lang_data[i].strid &&
 
3886
                            tns[j*3+0].u.md_ival==ofl_str_lang_data[i].lang ) {
 
3887
                        if ( k ) {
 
3888
                            free(newtns[j*3+2].u.md_str);
 
3889
                            newtns[j*3+2].u.md_str = NULL;
 
3890
                        }
 
3891
                break;
 
3892
                    }
 
3893
                }
 
3894
                if ( j<0 )
 
3895
                    j = rows + extras++;
 
3896
                if ( k ) {
 
3897
                    newtns[j*3+1].u.md_ival = ofl_str_lang_data[i].strid;
 
3898
                    newtns[j*3+0].u.md_ival = ofl_str_lang_data[i].lang;
 
3899
                    data = ofl_str_lang_data[i].data;
 
3900
                    reservedname = fallback = NULL;
 
3901
                    for ( m=0; m<rows; ++m ) {
 
3902
                        if ( newtns[j*3+1].u.md_ival==ttf_family ) {
 
3903
                            if ( newtns[j*3+0].u.md_ival==0x409 )
 
3904
                                fallback = newtns[3*j+2].u.md_str;
 
3905
                            else if ( newtns[j*3+0].u.md_ival==ofl_str_lang_data[i].lang )
 
3906
                                reservedname = newtns[3*j+2].u.md_str;
 
3907
                        }
 
3908
                    }
 
3909
                    if ( reservedname==NULL )
 
3910
                        reservedname = fallback;
 
3911
                    if ( reservedname==NULL )
 
3912
                        reservedname = d->sf->familyname;
 
3913
                    for ( m=0; m<2; ++m ) {
 
3914
                        len = 0;
 
3915
                        for ( l=0; data[l]!=NULL; ++l ) {
 
3916
                            if ( l==0 || l==1 ) {
 
3917
                                sprintf( buffer, data[l], tm->tm_year+1900, author, reservedname );
 
3918
                                bpt = buffer;
 
3919
                            } else
 
3920
                                bpt = data[l];
 
3921
                            if ( m ) {
 
3922
                                strcpy( pt, bpt );
 
3923
                                pt += strlen( bpt );
 
3924
                                *pt++ = '\n';
 
3925
                            } else
 
3926
                                len += strlen( bpt ) + 1;               /* for a new line */
 
3927
                        }
 
3928
                        if ( !m )
 
3929
                            newtns[j*3+2].u.md_str = all = pt = galloc(len+2);
 
3930
                    }
 
3931
                    if ( pt>all ) pt[-1] = '\0';
 
3932
                    else *pt = '\0';
 
3933
                }
 
3934
            }
 
3935
            if ( !k ) {
 
3936
                newtns = gcalloc((rows+extras)*3,sizeof(struct matrix_data));
 
3937
                memcpy(newtns,tns,rows*3*sizeof(struct matrix_data));
 
3938
                for ( i=0; i<rows; ++i )
 
3939
                    newtns[3*i+2].u.md_str = copy(newtns[3*i+2].u.md_str);
 
3940
            }
 
3941
        }
 
3942
        GMatrixEditSet(tng, newtns, rows+extras, false);
 
3943
        gwwv_post_notice(_("Please read the OFL"),_(
 
3944
            "You should read the OFL and its FAQ \n"
 
3945
            "at http://scripts.sil.org/OFL."
 
3946
            "\n"
 
3947
            "If you are not very familiar with English,\n"
 
3948
            "please check if there is a translation of the \n"
 
3949
            "FAQ or an unofficial translation of the license \n"
 
3950
            "in your mother tongue or preferred language. \n"
 
3951
            "\n"
 
3952
            "Fontforge does not know about your email or URL,\n"
 
3953
            "you will need to add them manually. \n"
 
3954
            "Please fill in the copyright notice in the license\n"
 
3955
            "header along with any Reserved Font Name(s).\n"
 
3956
            "If you are branching from an existing font make sure\n"
 
3957
            "you have the right to do so and remember to add your\n"
 
3958
            "additional copyright notice along with any Reserved Font Name(s).\n" ));
 
3959
    }
 
3960
return( true );
 
3961
}
 
3962
        
 
3963
static int Gasp_Default(GGadget *g, GEvent *e) {
 
3964
    if ( e->type==et_controlevent && e->u.control.subtype == et_buttonactivate ) {
 
3965
        struct gfi_data *d = GDrawGetUserData(GGadgetGetWindow(g));
 
3966
        GGadget *gg = GWidgetGetControl(GGadgetGetWindow(g),CID_Gasp);
 
3967
        int rows;
 
3968
        struct matrix_data *gasp;
 
3969
 
 
3970
        if ( !SFHasInstructions(d->sf)) {
 
3971
            rows = 1;
 
3972
            gasp = gcalloc(5,sizeof(struct matrix_data));
 
3973
            gasp[0].u.md_ival = 65535;
 
3974
            gasp[1].u.md_ival = 0;      /* no grid fit (we have no instructions, we can't grid fit) */
 
3975
            gasp[2].u.md_ival = 1;      /* do anti-alias */
 
3976
            gasp[2].u.md_ival = 0;      /* do symmetric smoothing */
 
3977
            gasp[2].u.md_ival = 0;      /* do no grid fit w/ sym smooth */
 
3978
        } else {
 
3979
            rows = 3;
 
3980
            gasp = gcalloc(5,sizeof(struct matrix_data));
 
3981
            gasp[0].u.md_ival = 8;     gasp[1].u.md_ival = 0; gasp[2].u.md_ival = 1;
 
3982
                    gasp[3].u.md_ival = 0; gasp[4].u.md_ival = 0;
 
3983
            gasp[5].u.md_ival = 16;    gasp[6].u.md_ival = 1; gasp[7].u.md_ival = 0;
 
3984
                    gasp[8].u.md_ival = 0; gasp[9].u.md_ival = 0;
 
3985
            gasp[10].u.md_ival = 65535; gasp[11].u.md_ival = 1; gasp[12].u.md_ival = 1;
 
3986
                    gasp[13].u.md_ival = 0; gasp[14].u.md_ival = 0;
 
3987
        }
 
3988
        GMatrixEditSet(gg,gasp,rows,false);
 
3989
    }
 
3990
return( true );
 
3991
}
 
3992
 
 
3993
static int Gasp_CanDelete(GGadget *g,int row) {
 
3994
    int rows;
 
3995
    struct matrix_data *gasp = GMatrixEditGet(g, &rows);
 
3996
    if ( gasp==NULL )
 
3997
return( false );
 
3998
 
 
3999
    /* Only allow them to delete the sentinal entry if that would give us an */
 
4000
    /* empty gasp table */
 
4001
return( gasp[5*row].u.md_ival!=0xffff || rows==1 );
 
4002
}
 
4003
 
 
4004
static int gasp_comp(const void *_md1, const void *_md2) {
 
4005
    const struct matrix_data *md1 = _md1, *md2 = _md2;
 
4006
return( md1->u.md_ival - md2->u.md_ival );
 
4007
}
 
4008
 
 
4009
static void Gasp_FinishEdit(GGadget *g,int row,int col,int wasnew) {
 
4010
    int rows;
 
4011
    struct matrix_data *gasp = GMatrixEditGet(g, &rows);
 
4012
 
 
4013
    if ( col==0 ) {
 
4014
        qsort(gasp,rows,3*sizeof(struct matrix_data),gasp_comp);
 
4015
        GGadgetRedraw(g);
 
4016
    }
 
4017
}
 
4018
 
 
4019
static void GaspMatrixInit(struct matrixinit *mi,struct gfi_data *d) {
 
4020
    SplineFont *sf = d->sf;
 
4021
    int i;
 
4022
    struct matrix_data *md;
 
4023
 
 
4024
    memset(mi,0,sizeof(*mi));
 
4025
    mi->col_cnt = 5;
 
4026
    mi->col_init = gaspci;
 
4027
 
 
4028
    if ( sf->gasp_cnt==0 ) {
 
4029
        md = gcalloc(5,sizeof(struct matrix_data));
 
4030
        mi->initial_row_cnt = 0;
 
4031
    } else {
 
4032
        md = gcalloc(5*sf->gasp_cnt,sizeof(struct matrix_data));
 
4033
        for ( i=0; i<sf->gasp_cnt; ++i ) {
 
4034
            md[5*i  ].u.md_ival = sf->gasp[i].ppem;
 
4035
            md[5*i+1].u.md_ival = (sf->gasp[i].flags&1)?1:0;
 
4036
            md[5*i+2].u.md_ival = (sf->gasp[i].flags&2)?1:0;
 
4037
            md[5*i+3].u.md_ival = (sf->gasp[i].flags&4)?1:0;
 
4038
            md[5*i+4].u.md_ival = (sf->gasp[i].flags&8)?1:0;
 
4039
        }
 
4040
        mi->initial_row_cnt = sf->gasp_cnt;
 
4041
    }
 
4042
    mi->matrix_data = md;
 
4043
 
 
4044
    mi->finishedit = Gasp_FinishEdit;
 
4045
    mi->candelete = Gasp_CanDelete;
 
4046
    mi->handle_key = TN_PassChar;
 
4047
}
 
4048
 
 
4049
static int GFI_GaspVersion(GGadget *g, GEvent *e) {
 
4050
    if ( e->u.control.subtype == et_listselected ) {
 
4051
        int version = GGadgetGetFirstListSelectedItem(g);
 
4052
        GGadget *gasp = GWidgetGetControl(GGadgetGetWindow(g),CID_Gasp);
 
4053
        if ( version == 0 ) {
 
4054
            GMatrixEditEnableColumn(gasp,3,false);
 
4055
            GMatrixEditEnableColumn(gasp,4,false);
 
4056
        } else {
 
4057
            GMatrixEditEnableColumn(gasp,3,true);
 
4058
            GMatrixEditEnableColumn(gasp,4,true);
 
4059
        }
 
4060
        GGadgetRedraw(gasp);
 
4061
    }
 
4062
return( true );
 
4063
}
 
4064
 
 
4065
static int GFI_SortBy(GGadget *g, GEvent *e) {
 
4066
    if ( e->type==et_controlevent && e->u.control.subtype == et_radiochanged ) {
 
4067
        struct gfi_data *d = (struct gfi_data *) GDrawGetUserData(GGadgetGetWindow(g));
 
4068
        TTFNames_Resort(d);
 
4069
        GGadgetRedraw(GWidgetGetControl(d->gw,CID_TNames));
 
4070
    }
 
4071
return( true );
 
4072
}
 
4073
 
 
4074
static void BDFsSetAsDs(SplineFont *sf) {
 
4075
    BDFFont *bdf;
 
4076
    real scale;
 
4077
 
 
4078
    for ( bdf=sf->bitmaps; bdf!=NULL; bdf=bdf->next ) {
 
4079
        scale = bdf->pixelsize / (real) (sf->ascent+sf->descent);
 
4080
        bdf->ascent = rint(sf->ascent*scale);
 
4081
        bdf->descent = bdf->pixelsize-bdf->ascent;
 
4082
    }
 
4083
}
 
4084
 
 
4085
static char *texparams[] = { N_("Slant:"), N_("Space:"), N_("Stretch:"),
 
4086
        N_("Shrink:"), N_("XHeight:"), N_("Quad:"),
 
4087
/* GT: Extra Space, see below for a full comment */
 
4088
        N_("Extra Sp:"), NULL };
 
4089
static char *texpopups[] = { N_("In an italic font the horizontal change per unit vertical change"),
 
4090
    N_("The amount of space between words when using this font"),
 
4091
    N_("The amount of strechable space between words when using this font"),
 
4092
    N_("The amount the space between words may shrink when using this font"),
 
4093
    N_("The height of the lower case letters with flat tops"),
 
4094
    N_("The width of one em"),
 
4095
    N_("Either:\nThe amount of extra space to be added after a sentence\nOr the space to be used within math formulae"),
 
4096
    NULL};
 
4097
 
 
4098
static int ParseTeX(struct gfi_data *d) {
 
4099
    int i, err=false;
 
4100
    double em = (d->sf->ascent+d->sf->descent), val;
 
4101
 
 
4102
    for ( i=0; texparams[i]!=0 ; ++i ) {
 
4103
        val = GetReal8(d->gw,CID_TeX+i,texparams[i],&err);
 
4104
        d->texdata.params[i] = rint( val/em * (1<<20) );
 
4105
    }
 
4106
    if ( GGadgetIsChecked(GWidgetGetControl(d->gw,CID_TeXText)) )
 
4107
        d->texdata.type = tex_text;
 
4108
    else if ( GGadgetIsChecked(GWidgetGetControl(d->gw,CID_TeXMathSym)) )
 
4109
        d->texdata.type = tex_math;
 
4110
    else
 
4111
        d->texdata.type = tex_mathext;
 
4112
return( !err );
 
4113
}
 
4114
 
 
4115
static int ttfmultuniqueids(SplineFont *sf,struct gfi_data *d) {
 
4116
    struct ttflangname *tln;
 
4117
    int found = false;
 
4118
    int i;
 
4119
 
 
4120
    if ( d->names_set ) {
 
4121
        GGadget *edit = GWidgetGetControl(d->gw,CID_TNames);
 
4122
        int rows;
 
4123
        struct matrix_data *strings = GMatrixEditGet(edit, &rows);
 
4124
        for ( i=0; i<rows; ++i )
 
4125
            if ( strings[3*i+1].u.md_ival==ttf_uniqueid ) {
 
4126
                if ( found )
 
4127
return( true );
 
4128
                found = true;
 
4129
            }
 
4130
    } else {
 
4131
        for ( tln = sf->names; tln!=NULL; tln=tln->next )
 
4132
            if ( tln->names[ttf_uniqueid]!=NULL ) {
 
4133
                if ( found )
 
4134
return( true );
 
4135
                found = true;
 
4136
            }
 
4137
    }
 
4138
return( false );
 
4139
}
 
4140
 
 
4141
static int ttfuniqueidmatch(SplineFont *sf,struct gfi_data *d) {
 
4142
    struct ttflangname *tln;
 
4143
    int i;
 
4144
 
 
4145
    if ( sf->names==NULL )
 
4146
return( false );
 
4147
 
 
4148
    if ( !d->names_set ) {
 
4149
        for ( tln = sf->names; tln!=NULL; tln=tln->next )
 
4150
            if ( tln->names[ttf_uniqueid]!=NULL )
 
4151
return( true );
 
4152
    } else {
 
4153
        GGadget *edit = GWidgetGetControl(d->gw,CID_TNames);
 
4154
        int rows;
 
4155
        struct matrix_data *strings = GMatrixEditGet(edit, &rows);
 
4156
 
 
4157
        for ( tln = sf->names; tln!=NULL; tln=tln->next ) {
 
4158
            if ( tln->names[ttf_uniqueid]==NULL )
 
4159
        continue;               /* Not set, so if it has been given a new value */
 
4160
                                /*  that's a change, and if it hasn't that's ok */
 
4161
            for ( i=0; i<rows; ++i )
 
4162
                if ( strings[3*i+1].u.md_ival==ttf_uniqueid && strings[3*i].u.md_ival==tln->lang )
 
4163
            break;
 
4164
            if ( i==rows )
 
4165
        continue;               /* removed. That's a change */
 
4166
            if ( strcmp(tln->names[ttf_uniqueid],strings[3*i+2].u.md_str )==0 )
 
4167
return( true );         /* name unchanged */
 
4168
        }
 
4169
    }
 
4170
return( false );
 
4171
}
 
4172
 
 
4173
static void ttfuniqueidfixup(SplineFont *sf,struct gfi_data *d) {
 
4174
    struct ttflangname *tln;
 
4175
    char *changed = NULL;
 
4176
    int i;
 
4177
 
 
4178
    if ( sf->names==NULL )
 
4179
return;
 
4180
 
 
4181
    if ( !d->names_set ) {
 
4182
        for ( tln = sf->names; tln!=NULL; tln=tln->next ) {
 
4183
            free( tln->names[ttf_uniqueid]);
 
4184
            tln->names[ttf_uniqueid] = NULL;
 
4185
        }
 
4186
    } else {
 
4187
        GGadget *edit = GWidgetGetControl(d->gw,CID_TNames);
 
4188
        int rows;
 
4189
        struct matrix_data *strings = GMatrixEditGet(edit, &rows);
 
4190
 
 
4191
        /* see if any instances of the name have changed */
 
4192
        for ( tln = sf->names; tln!=NULL; tln=tln->next ) {
 
4193
            if ( tln->names[ttf_uniqueid]==NULL )
 
4194
        continue;
 
4195
            for ( i=0; i<rows; ++i )
 
4196
                if ( strings[3*i+1].u.md_ival==ttf_uniqueid && strings[3*i].u.md_ival==tln->lang )
 
4197
            break;
 
4198
            if ( i==rows )
 
4199
        continue;
 
4200
            if ( strcmp(tln->names[ttf_uniqueid],strings[3*i+2].u.md_str )!=0 )
 
4201
                changed = copy(strings[3*i+2].u.md_str );
 
4202
        break;
 
4203
        }
 
4204
        /* All unique ids should be the same, if any changed set the unchanged */
 
4205
        /*  ones to the one that did (or the first of many if several changed) */
 
4206
        for ( tln = sf->names; tln!=NULL; tln=tln->next ) {
 
4207
            if ( tln->names[ttf_uniqueid]==NULL )
 
4208
        continue;
 
4209
            for ( i=0; i<rows; ++i )
 
4210
                if ( strings[3*i+1].u.md_ival==ttf_uniqueid && strings[3*i].u.md_ival==tln->lang )
 
4211
            break;
 
4212
            if ( i==rows )
 
4213
        continue;
 
4214
            if ( strcmp(tln->names[ttf_uniqueid],strings[3*i+2].u.md_str)==0 ) {
 
4215
                free(strings[3*i+2].u.md_str);
 
4216
                strings[3*i+2].u.md_str = changed!=NULL
 
4217
                        ? copy( changed )
 
4218
                        : NULL;
 
4219
            }
 
4220
        }
 
4221
    }
 
4222
}
 
4223
 
 
4224
static void StoreTTFNames(struct gfi_data *d) {
 
4225
    struct ttflangname *tln;
 
4226
    SplineFont *sf = d->sf;
 
4227
    int i;
 
4228
    GGadget *edit = GWidgetGetControl(d->gw,CID_TNames);
 
4229
    int rows;
 
4230
    struct matrix_data *strings = GMatrixEditGet(edit, &rows);
 
4231
 
 
4232
    TTFLangNamesFree(sf->names); sf->names = NULL;
 
4233
 
 
4234
    for ( i=0; i<rows; ++i ) {
 
4235
        for ( tln=sf->names; tln!=NULL && tln->lang!=strings[3*i].u.md_ival; tln=tln->next );
 
4236
        if ( tln==NULL ) {
 
4237
            tln = chunkalloc(sizeof(struct ttflangname));
 
4238
            tln->lang = strings[3*i].u.md_ival;
 
4239
            tln->next = sf->names;
 
4240
            sf->names = tln;
 
4241
        }
 
4242
        tln->names[strings[3*i+1].u.md_ival] = copy(strings[3*i+2].u.md_str );
 
4243
    }
 
4244
    TTF_PSDupsDefault(sf);
 
4245
}
 
4246
#endif          /* FONTFORGE_CONFIG_NO_WINDOWING_UI */
 
4247
 
 
4248
/* If we change the ascent/descent of a sub font then consider changing the */
 
4249
/*  as/ds of the master font. I used to think this irrelevant, but as the */
 
4250
/*  typoAscent/Descent is based on the master's ascent/descent it actually */
 
4251
/*  is meaningful. Set the master to the subfont with the most glyphs */
 
4252
void CIDMasterAsDes(SplineFont *sf) {
 
4253
    SplineFont *cidmaster = sf->cidmaster;
 
4254
    SplineFont *best;
 
4255
    int i, cid, cnt, bcnt;
 
4256
 
 
4257
    if ( cidmaster==NULL )
 
4258
return;
 
4259
    best = NULL; bcnt = 0;
 
4260
    for ( i=0; i<cidmaster->subfontcnt; ++i ) {
 
4261
        sf = cidmaster->subfonts[i];
 
4262
        for ( cid=cnt=0; cid<sf->glyphcnt; ++cid )
 
4263
            if ( sf->glyphs[cid]!=NULL )
 
4264
                ++cnt;
 
4265
        if ( cnt>bcnt ) {
 
4266
            best = sf;
 
4267
            bcnt = cnt;
 
4268
        }
 
4269
    }
 
4270
    if ( best==NULL && cidmaster->subfontcnt>0 )
 
4271
        best = cidmaster->subfonts[0];
 
4272
    if ( best!=NULL ) {
 
4273
        double ratio = 1000.0/(best->ascent+best->descent);
 
4274
        int ascent = rint(best->ascent*ratio);
 
4275
        if ( cidmaster->ascent!=ascent || cidmaster->descent!=1000-ascent ) {
 
4276
            cidmaster->ascent = ascent;
 
4277
            cidmaster->descent = 1000-ascent;
 
4278
        }
 
4279
    }
 
4280
}
 
4281
 
 
4282
void SFSetModTime(SplineFont *sf) {
 
4283
    time_t now;
 
4284
    time(&now);
 
4285
    sf->modificationtime = now;
 
4286
}
 
4287
 
 
4288
#ifndef FONTFORGE_CONFIG_NO_WINDOWING_UI
 
4289
static void GFI_ApplyLookupChanges(struct gfi_data *gfi) {
 
4290
    int i,j, isgpos;
 
4291
    OTLookup *last;
 
4292
    SplineFont *sf = gfi->sf;
 
4293
    struct lookup_subtable *sublast;
 
4294
 
 
4295
    for ( isgpos=0; isgpos<2; ++isgpos ) {
 
4296
        struct lkdata *lk = &gfi->tables[isgpos];
 
4297
        for ( i=0; i<lk->cnt; ++i ) {
 
4298
            if ( lk->all[i].deleted )
 
4299
                SFRemoveLookup(gfi->sf,lk->all[i].lookup);
 
4300
            else for ( j=0; j<lk->all[i].subtable_cnt; ++j ) {
 
4301
                if ( lk->all[i].subtables[j].deleted )
 
4302
                    SFRemoveLookupSubTable(gfi->sf,lk->all[i].subtables[j].subtable);
 
4303
            }
 
4304
        }
 
4305
        last = NULL;
 
4306
        for ( i=0; i<lk->cnt; ++i ) {
 
4307
            if ( !lk->all[i].deleted ) {
 
4308
                if ( last!=NULL )
 
4309
                    last->next = lk->all[i].lookup;
 
4310
                else if ( isgpos )
 
4311
                    sf->gpos_lookups = lk->all[i].lookup;
 
4312
                else
 
4313
                    sf->gsub_lookups = lk->all[i].lookup;
 
4314
                last = lk->all[i].lookup;
 
4315
                sublast = NULL;
 
4316
                for ( j=0; j<lk->all[i].subtable_cnt; ++j ) {
 
4317
                    if ( !lk->all[i].subtables[j].deleted ) {
 
4318
                        if ( sublast!=NULL )
 
4319
                            sublast->next = lk->all[i].subtables[j].subtable;
 
4320
                        else
 
4321
                            last->subtables = lk->all[i].subtables[j].subtable;
 
4322
                        sublast = lk->all[i].subtables[j].subtable;
 
4323
                    }
 
4324
                }
 
4325
                if ( sublast!=NULL )
 
4326
                    sublast->next = NULL;
 
4327
                else
 
4328
                    last->subtables = NULL;
 
4329
            }
 
4330
            free(lk->all[i].subtables);
 
4331
        }
 
4332
        if ( last!=NULL )
 
4333
            last->next = NULL;
 
4334
        else if ( isgpos )
 
4335
            sf->gpos_lookups = NULL;
 
4336
        else
 
4337
            sf->gsub_lookups = NULL;
 
4338
        free(lk->all);
 
4339
    }
 
4340
}
 
4341
 
 
4342
static int GFI_OK(GGadget *g, GEvent *e) {
 
4343
    if ( e->type==et_controlevent && e->u.control.subtype == et_buttonactivate ) {
 
4344
        GWindow gw = GGadgetGetWindow(g);
 
4345
        struct gfi_data *d = GDrawGetUserData(gw);
 
4346
        SplineFont *sf = d->sf, *_sf;
 
4347
        int interp;
 
4348
        int reformat_fv=0, retitle_fv=false;
 
4349
        int upos, uwid, as, des, err = false, weight=0;
 
4350
        int uniqueid, linegap=0, vlinegap=0, winascent=0, windescent=0;
 
4351
        int tlinegap=0, tascent=0, tdescent=0, hascent=0, hdescent=0;
 
4352
        int winaoff=true, windoff=true;
 
4353
        int taoff=true, tdoff=true, haoff = true, hdoff = true;
 
4354
        real ia, cidversion;
 
4355
        const unichar_t *txt, *fond; unichar_t *end;
 
4356
        int i,j, mcs;
 
4357
        int vmetrics, vorigin, namechange, order2;
 
4358
        int xuidchanged = false;
 
4359
        GTextInfo *pfmfam, *ibmfam, *fstype, *nlitem;
 
4360
        int32 len;
 
4361
        GTextInfo **ti;
 
4362
        int subs[4], super[4], strike[2];
 
4363
        int design_size, size_top, size_bottom, styleid;
 
4364
        int strokedfont = false;
 
4365
        real strokewidth;
 
4366
#ifdef FONTFORGE_CONFIG_TYPE3
 
4367
        int multilayer = false;
 
4368
#endif
 
4369
        char os2_vendor[4];
 
4370
        NameList *nl;
 
4371
        extern int allow_utf8_glyphnames;
 
4372
        int os2version;
 
4373
        int rows, gasprows;
 
4374
        struct matrix_data *strings = GMatrixEditGet(GWidgetGetControl(d->gw,CID_TNames), &rows);
 
4375
        struct matrix_data *gasp    = GMatrixEditGet(GWidgetGetControl(d->gw,CID_Gasp), &gasprows);
 
4376
 
 
4377
        if ( strings==NULL || gasp==NULL )
 
4378
return( true );
 
4379
        if ( gasprows>0 && gasp[5*gasprows-5].u.md_ival!=65535 ) {
 
4380
            gwwv_post_error(_("Bad Grid Fiting table"),_("The 'gasp' (Grid Fit) table must end with a pixel entry of 65535"));
 
4381
return( true );
 
4382
        }
 
4383
        if ( !CheckNames(d))
 
4384
return( true );
 
4385
        if ( !PIFinishFormer(d))
 
4386
return( true );
 
4387
        if ( d->ccd )
 
4388
            CCD_Close(d->ccd);
 
4389
        if ( d->smd )
 
4390
            SMD_Close(d->smd);
 
4391
 
 
4392
        if ( ttfmultuniqueids(sf,d)) {
 
4393
#if defined(FONTFORGE_CONFIG_GDRAW)
 
4394
            char *buts[3];
 
4395
            buts[0] = _("_OK"); buts[1] = _("_Cancel"); buts[2]=NULL;
 
4396
#elif defined(FONTFORGE_CONFIG_GTK)
 
4397
            static char *buts[] = { GTK_STOCK_OK, GTK_STOCK_CANCEL, NULL };
 
4398
#endif
 
4399
            if ( gwwv_ask(_("Too many Unique Font IDs"),(const char **) buts,0,1,_("You should only specify the TrueType Unique Font Identification string in one language. This font has more. Do you want to continue anyway?"))==1 )
 
4400
return( true );
 
4401
        }
 
4402
        txt = _GGadgetGetTitle(GWidgetGetControl(gw,CID_Family));
 
4403
        if ( !isalpha(*txt)) {
 
4404
            BadFamily();
 
4405
return( true );
 
4406
        }
 
4407
        txt = _GGadgetGetTitle(GWidgetGetControl(gw,CID_ItalicAngle));
 
4408
        ia = u_strtod(txt,&end);
 
4409
        if ( *end!='\0' ) {
 
4410
            Protest8(_("_Italic Angle:"));
 
4411
return(true);
 
4412
        }
 
4413
        order2 = GGadgetIsChecked(GWidgetGetControl(gw,CID_IsOrder2));
 
4414
        strokedfont = GGadgetIsChecked(GWidgetGetControl(gw,CID_IsStrokedFont));
 
4415
        strokewidth = GetReal8(gw,CID_StrokeWidth,_("Stroke _Width:"),&err);
 
4416
#ifdef FONTFORGE_CONFIG_TYPE3
 
4417
        multilayer = GGadgetIsChecked(GWidgetGetControl(gw,CID_IsMultiLayer));
 
4418
#endif
 
4419
        vmetrics = GGadgetIsChecked(GWidgetGetControl(gw,CID_HasVerticalMetrics));
 
4420
        upos = GetReal8(gw,CID_UPos, _("Underline _Position:"),&err);
 
4421
        uwid = GetReal8(gw,CID_UWidth,S_("Underline|_Height:"),&err);
 
4422
        GetInt8(gw,CID_Em,_("_Em Size:"),&err); /* just check for errors. redundant info */
 
4423
        as = GetInt8(gw,CID_Ascent,_("_Ascent:"),&err);
 
4424
        des = GetInt8(gw,CID_Descent,_("_Descent:"),&err);
 
4425
        uniqueid = GetInt8(gw,CID_UniqueID,_("UniqueID"),&err);
 
4426
        design_size = rint(10*GetReal8(gw,CID_DesignSize,_("De_sign Size:"),&err));
 
4427
        size_bottom = rint(10*GetReal8(gw,CID_DesignBottom,_("_Bottom"),&err));
 
4428
        size_top = rint(10*GetReal8(gw,CID_DesignTop,_("_Top"),&err));
 
4429
        styleid = GetInt8(gw,CID_StyleID,_("Style _ID:"),&err);
 
4430
        if ( err )
 
4431
return(true);
 
4432
        if ( sf->subfontcnt!=0 ) {
 
4433
            cidversion = GetReal8(gw,CID_Version,_("_Version"),&err);
 
4434
            if ( err )
 
4435
return(true);
 
4436
        }
 
4437
        if ( vmetrics )
 
4438
            vorigin = GetInt8(gw,CID_VOrigin,_("Vertical _Origin:"),&err);
 
4439
        os2version = sf->os2_version;
 
4440
        if ( d->ttf_set ) {
 
4441
            char *os2v = GGadgetGetTitle8(GWidgetGetControl(gw,CID_OS2Version));
 
4442
            if ( strcasecmp(os2v,_( (char *) os2versions[0].text ))== 0 )
 
4443
                os2version = 0;
 
4444
            else
 
4445
                os2version = GetInt8(gw,CID_OS2Version,_("Weight, Width, Slope Only"),&err);
 
4446
            free(os2v);
 
4447
            /* Only use the normal routine if we get no value, because */
 
4448
            /*  "400 Book" is a reasonable setting, but would cause GetInt */
 
4449
            /*  to complain */
 
4450
            weight = u_strtol(_GGadgetGetTitle(GWidgetGetControl(gw,CID_WeightClass)),NULL,10);
 
4451
            if ( weight == 0 )
 
4452
                weight = GetInt8(gw,CID_WeightClass,_("_Weight Class"),&err);
 
4453
            linegap = GetInt8(gw,CID_LineGap,_("HHead _Line Gap:"),&err);
 
4454
            tlinegap = GetInt8(gw,CID_TypoLineGap,_("Typo Line _Gap:"),&err);
 
4455
            if ( vmetrics )
 
4456
                vlinegap = GetInt8(gw,CID_VLineGap,_("VHead _Column Spacing:"),&err);
 
4457
            winaoff = GGadgetIsChecked(GWidgetGetControl(gw,CID_WinAscentIsOff));
 
4458
            windoff = GGadgetIsChecked(GWidgetGetControl(gw,CID_WinDescentIsOff));
 
4459
            winascent  = GetInt8(gw,CID_WinAscent,winaoff ? _("Win _Ascent Offset:") : _("Win Ascent:"),&err);
 
4460
            windescent = GetInt8(gw,CID_WinDescent,windoff ? _("Win _Descent Offset:") : _("Win Descent:"),&err);
 
4461
            taoff = GGadgetIsChecked(GWidgetGetControl(gw,CID_TypoAscentIsOff));
 
4462
            tdoff = GGadgetIsChecked(GWidgetGetControl(gw,CID_TypoDescentIsOff));
 
4463
            tascent  = GetInt8(gw,CID_TypoAscent,taoff ? _("_Typo Ascent Offset:") : _("Typo Ascent:"),&err);
 
4464
            tdescent = GetInt8(gw,CID_TypoDescent,tdoff ? _("T_ypo Descent Offset:") : _("Typo Descent:"),&err);
 
4465
            haoff = GGadgetIsChecked(GWidgetGetControl(gw,CID_HHeadAscentIsOff));
 
4466
            hdoff = GGadgetIsChecked(GWidgetGetControl(gw,CID_HHeadDescentIsOff));
 
4467
            hascent  = GetInt8(gw,CID_HHeadAscent,haoff ? _("_HHead Ascent Offset:") : _("HHead Ascent:"),&err);
 
4468
            hdescent = GetInt8(gw,CID_HHeadDescent,hdoff ? _("HHead De_scent Offset:") : _("HHead Descent:"),&err);
 
4469
            if ( err )
 
4470
return(true);
 
4471
 
 
4472
            if ( !GGadgetIsChecked(GWidgetGetControl(gw,CID_SubSuperDefault)) ) {
 
4473
                for ( i=0; i<4; ++i )
 
4474
                    subs[i] = GetInt8(gw,CID_SubXSize+i,_("Subscript"),&err);
 
4475
                for ( i=0; i<4; ++i )
 
4476
                    super[i] = GetInt8(gw,CID_SuperXSize+i,_("Superscript"),&err);
 
4477
                for ( i=0; i<2; ++i )
 
4478
                    strike[i] = GetInt8(gw,CID_StrikeoutSize+i,_("Strikeout"),&err);
 
4479
            }
 
4480
            txt = _GGadgetGetTitle(GWidgetGetControl(gw,CID_Vendor));
 
4481
            if ( u_strlen(txt)>4 || txt[0]>0x7e || (txt[0]!='\0' && (txt[1]>0x7e ||
 
4482
                    (txt[1]!='\0' && (txt[2]>0x7e || (txt[2]!='\0' && txt[3]>0x7e))))) ) {
 
4483
                if ( u_strlen(txt)>4 )
 
4484
                    gwwv_post_error(_("Bad IBM Family"),_("Tag must be 4 characters long"));
 
4485
                else
 
4486
                    gwwv_post_error(_("Bad IBM Family"),_("A tag must be 4 ASCII characters"));
 
4487
return( true );
 
4488
            }
 
4489
            os2_vendor[0] = txt[0]==0 ? ' ' : txt[0];
 
4490
            os2_vendor[1] = txt[0]==0 || txt[1]=='\0' ? ' ' : txt[1];
 
4491
            os2_vendor[2] = txt[0]==0 || txt[1]=='\0' || txt[2]=='\0' ? ' ' : txt[2];
 
4492
            os2_vendor[3] = txt[0]==0 || txt[1]=='\0' || txt[2]=='\0' || txt[3]=='\0' ? ' ' : txt[3];
 
4493
        }
 
4494
        if ( err )
 
4495
return(true);
 
4496
        if ( d->tex_set ) {
 
4497
            if ( !ParseTeX(d))
 
4498
return( true );
 
4499
        }
 
4500
        if ( as+des>16384 || des<0 || as<0 ) {
 
4501
            gwwv_post_error(_("Bad Ascent/Descent"),_("Ascent and Descent must be positive and their sum less than 16384"));
 
4502
return( true );
 
4503
        }
 
4504
        mcs = -1;
 
4505
        if ( !GGadgetIsChecked(GWidgetGetControl(d->gw,CID_MacAutomatic)) ) {
 
4506
            mcs = 0;
 
4507
            ti = GGadgetGetList(GWidgetGetControl(d->gw,CID_MacStyles),&len);
 
4508
            for ( i=0; i<len; ++i )
 
4509
                if ( ti[i]->selected )
 
4510
                    mcs |= (int) (intpt) ti[i]->userdata;
 
4511
            if ( (mcs&sf_condense) && (mcs&sf_extend)) {
 
4512
                gwwv_post_error(_("Bad Style"),_("A style may not have both condense and extend set (it makes no sense)"));
 
4513
return( true );
 
4514
            }
 
4515
        }
 
4516
        if ( order2!=sf->order2 && sf->changed && AskLoseUndoes())
 
4517
return( true );
 
4518
        if ( order2!=sf->order2 && !SFCloseAllInstrs(sf))
 
4519
return( true );
 
4520
 
 
4521
        nlitem = GGadgetGetListItemSelected(GWidgetGetControl(gw,CID_Namelist));
 
4522
        if ( nlitem==NULL )
 
4523
            nl = DefaultNameListForNewFonts();
 
4524
        else {
 
4525
            char *name = u2utf8_copy(nlitem->text);
 
4526
            nl = NameListByName(name);
 
4527
            free(name);
 
4528
        }
 
4529
        if ( nl->uses_unicode && !allow_utf8_glyphnames ) {
 
4530
            gwwv_post_error(_("Namelist contains non-ASCII names"),_("Glyph names should be limited to characters in the ASCII character set,\nbut there are names in this namelist which use characters outside\nthat range."));
 
4531
return(true);
 
4532
        }
 
4533
#ifdef FONTFORGE_CONFIG_TYPE3
 
4534
        if ( strokedfont!=sf->strokedfont || multilayer!=sf->multilayer ) {
 
4535
            if ( sf->strokedfont && multilayer )
 
4536
                SFSetLayerWidthsStroked(sf,sf->strokewidth);
 
4537
            else if ( sf->multilayer )
 
4538
                SFSplinesFromLayers(sf,strokedfont);
 
4539
            SFReinstanciateRefs(sf);
 
4540
            if ( multilayer!=sf->multilayer ) {
 
4541
                sf->multilayer = multilayer;
 
4542
                SFLayerChange(sf);
 
4543
            }
 
4544
            for ( i=0; i<sf->glyphcnt; ++i ) if ( sf->glyphs[i]!=NULL )
 
4545
                sf->glyphs[i]->changedsincelasthinted = !strokedfont && !multilayer;
 
4546
        }
 
4547
#else
 
4548
        if ( strokedfont!=sf->strokedfont )
 
4549
            for ( i=0; i<sf->glyphcnt; ++i ) if ( sf->glyphs[i]!=NULL )
 
4550
                sf->glyphs[i]->changedsincelasthinted = !strokedfont;
 
4551
#endif
 
4552
        sf->strokedfont = strokedfont;
 
4553
        sf->strokewidth = strokewidth;
 
4554
        GDrawSetCursor(gw,ct_watch);
 
4555
        namechange = SetFontName(gw,sf);
 
4556
        if ( namechange ) retitle_fv = true;
 
4557
        txt = _GGadgetGetTitle(GWidgetGetControl(gw,CID_XUID));
 
4558
        xuidchanged = (sf->xuid==NULL && *txt!='\0') ||
 
4559
                        (sf->xuid!=NULL && uc_strcmp(txt,sf->xuid)==0);
 
4560
        if ( namechange &&
 
4561
                ((uniqueid!=0 && uniqueid==sf->uniqueid) ||
 
4562
                 (sf->xuid!=NULL && uc_strcmp(txt,sf->xuid)==0) ||
 
4563
                 ttfuniqueidmatch(sf,d)) ) {
 
4564
            char *buts[4];
 
4565
            int ans;
 
4566
            buts[0] = _("Change");
 
4567
            buts[1] = _("Retain");
 
4568
#if defined(FONTFORGE_CONFIG_GDRAW)
 
4569
            buts[2] = _("_Cancel");
 
4570
#elif defined(FONTFORGE_CONFIG_GTK)
 
4571
            buts[2] = GTK_STOCK_CANCEL;
 
4572
#endif
 
4573
            buts[3] = NULL;
 
4574
            ans = gwwv_ask(_("Change UniqueID?"),(const char **) buts,0,2,_("You have changed this font's name without changing the UniqueID (or XUID).\nThis is probably not a good idea, would you like me to\ngenerate a random new value?"));
 
4575
            if ( ans==2 ) {
 
4576
                GDrawSetCursor(gw,ct_pointer);
 
4577
return(true);
 
4578
            }
 
4579
            if ( ans==0 ) {
 
4580
                if ( uniqueid!=0 && uniqueid==sf->uniqueid )
 
4581
                    uniqueid = 4000000 + (rand()&0x3ffff);
 
4582
                if ( sf->xuid!=NULL && uc_strcmp(txt,sf->xuid)==0 ) {
 
4583
                    SFRandomChangeXUID(sf);
 
4584
                    xuidchanged = true;
 
4585
                }
 
4586
            }
 
4587
            if ( ttfuniqueidmatch(sf,d))
 
4588
                ttfuniqueidfixup(sf,d);
 
4589
        } else {
 
4590
            free(sf->xuid);
 
4591
            sf->xuid = *txt=='\0'?NULL:cu_copy(txt);
 
4592
        }
 
4593
 
 
4594
        free(sf->gasp);
 
4595
        sf->gasp_cnt = gasprows;
 
4596
        if ( gasprows==0 )
 
4597
            sf->gasp = NULL;
 
4598
        else {
 
4599
            sf->gasp = galloc(gasprows*sizeof(struct gasp));
 
4600
            sf->gasp_version = GGadgetGetFirstListSelectedItem(GWidgetGetControl(gw,CID_GaspVersion));
 
4601
            for ( i=0; i<gasprows; ++i ) {
 
4602
                sf->gasp[i].ppem = gasp[5*i].u.md_ival;
 
4603
                if ( sf->gasp_version==0 )
 
4604
                    sf->gasp[i].flags = gasp[5*i+1].u.md_ival |
 
4605
                            (gasp[5*i+2].u.md_ival<<1);
 
4606
                else
 
4607
                    sf->gasp[i].flags = gasp[5*i+1].u.md_ival |
 
4608
                            (gasp[5*i+2].u.md_ival<<1) |
 
4609
                            (gasp[5*i+2].u.md_ival<<2) |
 
4610
                            (gasp[5*i+2].u.md_ival<<3);
 
4611
            }
 
4612
        }
 
4613
        sf->head_optimized_for_cleartype = GGadgetIsChecked(GWidgetGetControl(gw,CID_HeadClearType));
 
4614
 
 
4615
        OtfNameListFree(sf->fontstyle_name);
 
4616
        sf->fontstyle_name = OtfNameFromStyleNames(GWidgetGetControl(gw,CID_StyleName));
 
4617
        sf->design_size = design_size;
 
4618
        sf->design_range_bottom = size_bottom;
 
4619
        sf->design_range_top = size_top;
 
4620
        sf->fontstyle_id = styleid;
 
4621
 
 
4622
        txt = _GGadgetGetTitle(GWidgetGetControl(gw,CID_Notice));
 
4623
        free(sf->copyright); sf->copyright = cu_copy(txt);
 
4624
        txt = _GGadgetGetTitle(GWidgetGetControl(gw,CID_Comment));
 
4625
        free(sf->comments); sf->comments = cu_copy(*txt?txt:NULL);
 
4626
        txt = _GGadgetGetTitle(GWidgetGetControl(gw,CID_DefBaseName));
 
4627
        if ( *txt=='\0' || GGadgetIsChecked(GWidgetGetControl(gw,CID_SameAsFontname)) )
 
4628
            txt = NULL;
 
4629
        free(sf->defbasefilename); sf->defbasefilename = u2utf8_copy(txt);
 
4630
        if ( sf->subfontcnt!=0 ) {
 
4631
            sf->cidversion = cidversion;
 
4632
        } else {
 
4633
            txt = _GGadgetGetTitle(GWidgetGetControl(gw,CID_Version));
 
4634
            free(sf->version); sf->version = cu_copy(txt);
 
4635
        }
 
4636
        fond = _GGadgetGetTitle(GWidgetGetControl(gw,CID_MacFOND));
 
4637
        free(sf->fondname); sf->fondname = NULL;
 
4638
        if ( *fond )
 
4639
            sf->fondname = cu_copy(fond);
 
4640
        sf->macstyle = mcs;
 
4641
        sf->italicangle = ia;
 
4642
        sf->upos = upos;
 
4643
        sf->uwidth = uwid;
 
4644
        sf->uniqueid = uniqueid;
 
4645
        sf->texdata = d->texdata;
 
4646
 
 
4647
        interp = GGadgetGetFirstListSelectedItem(GWidgetGetControl(gw,CID_Interpretation));
 
4648
        if ( interp==-1 ) sf->uni_interp = ui_none;
 
4649
        else sf->uni_interp = (intpt) interpretations[interp].userdata;
 
4650
 
 
4651
        sf->for_new_glyphs = nl;
 
4652
 
 
4653
        if ( sf->hasvmetrics!=vmetrics )
 
4654
            CVPaletteDeactivate();              /* Force a refresh later */
 
4655
        _sf = sf->cidmaster?sf->cidmaster:sf;
 
4656
        _sf->hasvmetrics = vmetrics;
 
4657
        for ( j=0; j<_sf->subfontcnt; ++j )
 
4658
            _sf->subfonts[j]->hasvmetrics = vmetrics;
 
4659
        if ( vmetrics ) {
 
4660
            _sf->vertical_origin = vorigin;
 
4661
            for ( j=0; j<_sf->subfontcnt; ++j )
 
4662
                _sf->subfonts[j]->vertical_origin = vorigin;
 
4663
        }
 
4664
 
 
4665
        if ( d->private!=NULL ) {
 
4666
            PSDictFree(sf->private);
 
4667
            sf->private = d->private;
 
4668
            d->private = NULL;
 
4669
        }
 
4670
        if ( d->names_set )
 
4671
            StoreTTFNames(d);
 
4672
        if ( d->ttf_set ) {
 
4673
            sf->os2_version = os2version;
 
4674
            sf->use_typo_metrics = GGadgetIsChecked(GWidgetGetControl(gw,CID_UseTypoMetrics));
 
4675
            sf->weight_width_slope_only = GGadgetIsChecked(GWidgetGetControl(gw,CID_WeightWidthSlopeOnly));
 
4676
            sf->pfminfo.weight = weight;
 
4677
            sf->pfminfo.width = GGadgetGetFirstListSelectedItem(GWidgetGetControl(gw,CID_WidthClass))+1;
 
4678
            pfmfam = GGadgetGetListItemSelected(GWidgetGetControl(gw,CID_PFMFamily));
 
4679
            if ( pfmfam!=NULL )
 
4680
                sf->pfminfo.pfmfamily = (intpt) (pfmfam->userdata);
 
4681
            else
 
4682
                sf->pfminfo.pfmfamily = 0x11;
 
4683
            ibmfam = GGadgetGetListItemSelected(GWidgetGetControl(gw,CID_IBMFamily));
 
4684
            if ( pfmfam!=NULL )
 
4685
                sf->pfminfo.os2_family_class = (intpt) (ibmfam->userdata);
 
4686
            else
 
4687
                sf->pfminfo.os2_family_class = 0x00;
 
4688
            memcpy(sf->pfminfo.os2_vendor,os2_vendor,sizeof(os2_vendor));
 
4689
            fstype = GGadgetGetListItemSelected(GWidgetGetControl(gw,CID_FSType));
 
4690
            if ( fstype!=NULL )
 
4691
                sf->pfminfo.fstype = (intpt) (fstype->userdata);
 
4692
            else
 
4693
                sf->pfminfo.fstype = 0xc;
 
4694
            if ( GGadgetIsChecked(GWidgetGetControl(gw,CID_NoSubsetting)))
 
4695
                sf->pfminfo.fstype |=0x100;
 
4696
            if ( GGadgetIsChecked(GWidgetGetControl(gw,CID_OnlyBitmaps)))
 
4697
                sf->pfminfo.fstype |=0x200;
 
4698
            for ( i=0; i<10; ++i )
 
4699
                sf->pfminfo.panose[i] = (intpt) (GGadgetGetListItemSelected(GWidgetGetControl(gw,CID_PanFamily+i))->userdata);
 
4700
            sf->pfminfo.panose_set = !GGadgetIsChecked(GWidgetGetControl(gw,CID_PanDefault));
 
4701
            sf->pfminfo.os2_typolinegap = tlinegap;
 
4702
            sf->pfminfo.linegap = linegap;
 
4703
            if ( vmetrics )
 
4704
                sf->pfminfo.vlinegap = vlinegap;
 
4705
            sf->pfminfo.os2_winascent = winascent;
 
4706
            sf->pfminfo.os2_windescent = windescent;
 
4707
            sf->pfminfo.winascent_add = winaoff;
 
4708
            sf->pfminfo.windescent_add = windoff;
 
4709
            sf->pfminfo.os2_typoascent = tascent;
 
4710
            sf->pfminfo.os2_typodescent = tdescent;
 
4711
            sf->pfminfo.typoascent_add = taoff;
 
4712
            sf->pfminfo.typodescent_add = tdoff;
 
4713
            sf->pfminfo.hhead_ascent = hascent;
 
4714
            sf->pfminfo.hhead_descent = hdescent;
 
4715
            sf->pfminfo.hheadascent_add = haoff;
 
4716
            sf->pfminfo.hheaddescent_add = hdoff;
 
4717
            sf->pfminfo.pfmset = true;
 
4718
 
 
4719
            sf->pfminfo.subsuper_set = !GGadgetIsChecked(GWidgetGetControl(gw,CID_PanDefault));
 
4720
            if ( sf->pfminfo.subsuper_set ) {
 
4721
                sf->pfminfo.os2_subxsize = subs[0];
 
4722
                sf->pfminfo.os2_subysize = subs[1];
 
4723
                sf->pfminfo.os2_subxoff = subs[2];
 
4724
                sf->pfminfo.os2_subyoff = subs[3];
 
4725
                sf->pfminfo.os2_supxsize = super[0];
 
4726
                sf->pfminfo.os2_supysize = super[1];
 
4727
                sf->pfminfo.os2_supxoff = super[2];
 
4728
                sf->pfminfo.os2_supyoff = super[3];
 
4729
                sf->pfminfo.os2_strikeysize = strike[0];
 
4730
                sf->pfminfo.os2_strikeypos = strike[1];
 
4731
            }
 
4732
        }
 
4733
        /* must come after all scaleable fields (linegap, etc.) */
 
4734
        if ( as!=sf->ascent || des!=sf->descent ) {
 
4735
            if ( as+des != sf->ascent+sf->descent && GGadgetIsChecked(GWidgetGetControl(gw,CID_Scale)) )
 
4736
                SFScaleToEm(sf,as,des);
 
4737
            else {
 
4738
                sf->ascent = as;
 
4739
                sf->descent = des;
 
4740
            }
 
4741
            BDFsSetAsDs(sf);
 
4742
            reformat_fv = true;
 
4743
            CIDMasterAsDes(sf);
 
4744
        }
 
4745
        if ( order2!=sf->order2 ) {
 
4746
            if ( order2 )
 
4747
                SFConvertToOrder2(sf);
 
4748
            else
 
4749
                SFConvertToOrder3(sf);
 
4750
        }
 
4751
        GFI_ApplyLookupChanges(d);
 
4752
        if ( retitle_fv ) { FontView *fvs;
 
4753
            for ( fvs=sf->fv; fvs!=NULL; fvs=fvs->nextsame )
 
4754
                FVSetTitle(fvs);
 
4755
        }
 
4756
        if ( reformat_fv )
 
4757
            FontViewReformatAll(sf);
 
4758
        sf->changed = true;
 
4759
        SFSetModTime(sf);
 
4760
        sf->changed_since_autosave = true;
 
4761
        sf->changed_since_xuidchanged = !xuidchanged;
 
4762
        /* Just in case they changed the blue values and we are showing blues */
 
4763
        /*  in outline views... */
 
4764
        for ( i=0; i<sf->glyphcnt; ++i ) if ( sf->glyphs[i]!=NULL ) {
 
4765
            CharView *cv;
 
4766
            for ( cv = sf->glyphs[i]->views; cv!=NULL; cv=cv->next ) {
 
4767
                cv->back_img_out_of_date = true;
 
4768
                GDrawRequestExpose(cv->v,NULL,false);
 
4769
            }
 
4770
        }
 
4771
        MacFeatListFree(sf->features);
 
4772
        sf->features = GGadgetGetUserData(GWidgetGetControl(d->gw,CID_Features));
 
4773
        last_aspect = d->old_aspect;
 
4774
 
 
4775
        MarkClassFree(sf->mark_class_cnt,sf->mark_classes,sf->mark_class_names);
 
4776
        sf->mark_class_cnt = d->mark_class_cnt;
 
4777
        sf->mark_classes = d->mark_classes;
 
4778
        sf->mark_class_names = d->mark_class_names;
 
4779
 
 
4780
        GFI_Close(d);
 
4781
 
 
4782
        SFReplaceFontnameBDFProps(sf);
 
4783
    }
 
4784
return( true );
 
4785
}
 
4786
 
 
4787
static void GFI_AsDsLab(struct gfi_data *d, int cid) {
 
4788
    int isoffset = GGadgetIsChecked(GWidgetGetControl(d->gw,cid));
 
4789
    DBounds b;
 
4790
    int ocid, labcid;
 
4791
    double val;
 
4792
    char buf[40];
 
4793
    char *offt, *baret;
 
4794
    int ismax=0;
 
4795
    unichar_t *end;
 
4796
 
 
4797
    switch ( cid ) {
 
4798
      case CID_WinAscentIsOff:
 
4799
        offt = _("Win Ascent Offset:"); baret = _("Win Ascent:");
 
4800
        ocid = CID_WinAscent; labcid = CID_WinAscentLab;
 
4801
        ismax = true;
 
4802
      break;
 
4803
      case CID_WinDescentIsOff:
 
4804
        offt = _("Win Descent Offset:"); baret = _("Win Descent:");
 
4805
        ocid = CID_WinDescent; labcid = CID_WinDescentLab;
 
4806
      break;
 
4807
      case CID_TypoAscentIsOff:
 
4808
        offt = _("Typo Ascent Offset:"); baret = _("Typo Ascent:");
 
4809
        ocid = CID_TypoAscent; labcid = CID_TypoAscentLab;
 
4810
        ismax = true;
 
4811
      break;
 
4812
      case CID_TypoDescentIsOff:
 
4813
        offt = _("Typo Descent Offset:"); baret = _("Typo Descent:");
 
4814
        ocid = CID_TypoDescent; labcid = CID_TypoDescentLab;
 
4815
      break;
 
4816
      case CID_HHeadAscentIsOff:
 
4817
        offt = _("HHead Ascent Offset:"); baret = _("HHead Ascent:");
 
4818
        ocid = CID_HHeadAscent; labcid = CID_HHeadAscentLab;
 
4819
        ismax = true;
 
4820
      break;
 
4821
      case CID_HHeadDescentIsOff:
 
4822
        offt = _("HHead Descent Offset:"); baret = _("HHead Descent:");
 
4823
        ocid = CID_HHeadDescent; labcid = CID_HHeadDescentLab;
 
4824
      break;
 
4825
      default:
 
4826
return;
 
4827
    }
 
4828
 
 
4829
    GGadgetSetTitle8(GWidgetGetControl(d->gw,labcid),
 
4830
            isoffset?offt:baret);
 
4831
    if ( cid == CID_TypoAscentIsOff ) {
 
4832
        const unichar_t *as = _GGadgetGetTitle(GWidgetGetControl(d->gw,CID_Ascent));
 
4833
        double av=u_strtod(as,&end);
 
4834
        b.maxy = *end=='\0' ? av : d->sf->ascent;
 
4835
    } else if ( cid == CID_TypoDescentIsOff ) {
 
4836
        const unichar_t *ds = _GGadgetGetTitle(GWidgetGetControl(d->gw,CID_Descent));
 
4837
        double dv=u_strtod(ds,&end);
 
4838
        b.miny = *end=='\0' ? -dv : -d->sf->descent;
 
4839
    } else {
 
4840
        CIDFindBounds(d->sf,&b);
 
4841
        if ( cid == CID_WinDescentIsOff ) b.miny = -b.miny;
 
4842
    }
 
4843
 
 
4844
    val = u_strtod(_GGadgetGetTitle(GWidgetGetControl(d->gw,ocid)),NULL);
 
4845
    if ( isoffset )
 
4846
        sprintf( buf,"%g",rint( val-(ismax ? b.maxy : b.miny)) );
 
4847
    else
 
4848
        sprintf( buf,"%g",rint( val+(ismax ? b.maxy : b.miny)) );
 
4849
    GGadgetSetTitle8(GWidgetGetControl(d->gw,ocid),buf);
 
4850
}
 
4851
 
 
4852
static int GFI_AsDesIsOff(GGadget *g, GEvent *e) {
 
4853
    if ( e->type==et_controlevent && e->u.control.subtype == et_radiochanged ) {
 
4854
        struct gfi_data *d = GDrawGetUserData(GGadgetGetWindow(g));
 
4855
        GFI_AsDsLab(d,GGadgetGetCid(g));
 
4856
    }
 
4857
return( true );
 
4858
}
 
4859
 
 
4860
static void _GFI_PanoseDefault(struct gfi_data *d) {
 
4861
    int i;
 
4862
    int isdefault = GGadgetIsChecked(GWidgetGetControl(d->gw,CID_PanDefault));
 
4863
 
 
4864
    for ( i=0; i<10; ++i ) {
 
4865
        GGadgetSetEnabled(GWidgetGetControl(d->gw,CID_PanFamily+i),!isdefault);
 
4866
        GGadgetSetEnabled(GWidgetGetControl(d->gw,CID_PanFamilyLab+i),!isdefault);
 
4867
    }
 
4868
    if ( isdefault ) {
 
4869
        char *n = cu_copy(_GGadgetGetTitle(GWidgetGetControl(d->gw,CID_Fontname)));
 
4870
        struct pfminfo info;
 
4871
        memset(&info,0,sizeof(info));
 
4872
        SFDefaultOS2Info(&info,d->sf,n);
 
4873
        free(n);
 
4874
        for ( i=0; i<10; ++i )
 
4875
            GGadgetSelectOneListItem(GWidgetGetControl(d->gw,CID_PanFamily+i),info.panose[i]);
 
4876
    }
 
4877
}
 
4878
 
 
4879
static int GFI_PanoseDefault(GGadget *g, GEvent *e) {
 
4880
    if ( e->type==et_controlevent && e->u.control.subtype == et_radiochanged ) {
 
4881
        struct gfi_data *d = GDrawGetUserData(GGadgetGetWindow(g));
 
4882
        _GFI_PanoseDefault(d);
 
4883
    }
 
4884
return( true );
 
4885
}
 
4886
 
 
4887
static void GFI_SubSuperSet(struct gfi_data *d, struct pfminfo *info) {
 
4888
    char buffer[40];
 
4889
    unichar_t ubuf[40];
 
4890
 
 
4891
    sprintf( buffer, "%d", info->os2_subxsize );
 
4892
    uc_strcpy(ubuf,buffer);
 
4893
    GGadgetSetTitle(GWidgetGetControl(d->gw,CID_SubXSize),ubuf);
 
4894
 
 
4895
    sprintf( buffer, "%d", info->os2_subysize );
 
4896
    uc_strcpy(ubuf,buffer);
 
4897
    GGadgetSetTitle(GWidgetGetControl(d->gw,CID_SubYSize),ubuf);
 
4898
 
 
4899
    sprintf( buffer, "%d", info->os2_subxoff );
 
4900
    uc_strcpy(ubuf,buffer);
 
4901
    GGadgetSetTitle(GWidgetGetControl(d->gw,CID_SubXOffset),ubuf);
 
4902
 
 
4903
    sprintf( buffer, "%d", info->os2_subyoff );
 
4904
    uc_strcpy(ubuf,buffer);
 
4905
    GGadgetSetTitle(GWidgetGetControl(d->gw,CID_SubYOffset),ubuf);
 
4906
 
 
4907
 
 
4908
    sprintf( buffer, "%d", info->os2_supxsize );
 
4909
    uc_strcpy(ubuf,buffer);
 
4910
    GGadgetSetTitle(GWidgetGetControl(d->gw,CID_SuperXSize),ubuf);
 
4911
 
 
4912
    sprintf( buffer, "%d", info->os2_supysize );
 
4913
    uc_strcpy(ubuf,buffer);
 
4914
    GGadgetSetTitle(GWidgetGetControl(d->gw,CID_SuperYSize),ubuf);
 
4915
 
 
4916
    sprintf( buffer, "%d", info->os2_supxoff );
 
4917
    uc_strcpy(ubuf,buffer);
 
4918
    GGadgetSetTitle(GWidgetGetControl(d->gw,CID_SuperXOffset),ubuf);
 
4919
 
 
4920
    sprintf( buffer, "%d", info->os2_supyoff );
 
4921
    uc_strcpy(ubuf,buffer);
 
4922
    GGadgetSetTitle(GWidgetGetControl(d->gw,CID_SuperYOffset),ubuf);
 
4923
 
 
4924
 
 
4925
    sprintf( buffer, "%d", info->os2_strikeysize );
 
4926
    uc_strcpy(ubuf,buffer);
 
4927
    GGadgetSetTitle(GWidgetGetControl(d->gw,CID_StrikeoutSize),ubuf);
 
4928
 
 
4929
    sprintf( buffer, "%d", info->os2_strikeypos );
 
4930
    uc_strcpy(ubuf,buffer);
 
4931
    GGadgetSetTitle(GWidgetGetControl(d->gw,CID_StrikeoutPos),ubuf);
 
4932
}
 
4933
 
 
4934
static void _GFI_SubSuperDefault(struct gfi_data *d) {
 
4935
    int i;
 
4936
    int isdefault = GGadgetIsChecked(GWidgetGetControl(d->gw,CID_SubSuperDefault));
 
4937
 
 
4938
    for ( i=0; i<10; ++i )
 
4939
        GGadgetSetEnabled(GWidgetGetControl(d->gw,CID_SubXSize+i),!isdefault);
 
4940
    if ( isdefault ) {
 
4941
        const unichar_t *as = _GGadgetGetTitle(GWidgetGetControl(d->gw,CID_Ascent));
 
4942
        const unichar_t *ds = _GGadgetGetTitle(GWidgetGetControl(d->gw,CID_Descent));
 
4943
        const unichar_t *ia = _GGadgetGetTitle(GWidgetGetControl(d->gw,CID_Descent));
 
4944
        unichar_t *aend, *dend, *iend;
 
4945
        double av=u_strtod(as,&aend),dv=u_strtod(ds,&dend),iav=u_strtod(ia,&iend);
 
4946
        struct pfminfo info;
 
4947
        if ( *aend!='\0' ) av = d->sf->ascent;
 
4948
        if ( *dend!='\0' ) dv = d->sf->descent;
 
4949
        if ( *iend!='\0' ) iav = d->sf->italicangle;
 
4950
        memset(&info,0,sizeof(info));
 
4951
        SFDefaultOS2SubSuper(&info,(int) (dv+av), iav);
 
4952
        GFI_SubSuperSet(d,&info);
 
4953
    }
 
4954
}
 
4955
 
 
4956
static int GFI_SubSuperDefault(GGadget *g, GEvent *e) {
 
4957
    if ( e->type==et_controlevent && e->u.control.subtype == et_radiochanged ) {
 
4958
        struct gfi_data *d = GDrawGetUserData(GGadgetGetWindow(g));
 
4959
        _GFI_SubSuperDefault(d);
 
4960
    }
 
4961
return( true );
 
4962
}
 
4963
 
 
4964
static void TTFSetup(struct gfi_data *d) {
 
4965
    struct pfminfo info;
 
4966
    char buffer[10]; unichar_t ubuf[10];
 
4967
    int i, lg, vlg, tlg;
 
4968
    const unichar_t *as = _GGadgetGetTitle(GWidgetGetControl(d->gw,CID_Ascent));
 
4969
    const unichar_t *ds = _GGadgetGetTitle(GWidgetGetControl(d->gw,CID_Descent));
 
4970
    unichar_t *aend, *dend;
 
4971
    double av=u_strtod(as,&aend),dv=u_strtod(ds,&dend);
 
4972
 
 
4973
    info = d->sf->pfminfo;
 
4974
    if ( !info.pfmset ) {
 
4975
        /* Base this stuff on the CURRENT name */
 
4976
        /* if the user just created a font, and named it *Bold, then the sf */
 
4977
        /*  won't yet have Bold in its name, and basing the weight on it would*/
 
4978
        /*  give the wrong answer. That's why we don't do this init until we */
 
4979
        /*  get to one of the ttf aspects, it gives the user time to set the */
 
4980
        /*  name properly */
 
4981
        /* And on CURRENT values of ascent and descent */
 
4982
        char *n = cu_copy(_GGadgetGetTitle(GWidgetGetControl(d->gw,CID_Fontname)));
 
4983
        if ( *aend=='\0' && *dend=='\0' ) {
 
4984
            if ( info.linegap==0 )
 
4985
                info.linegap = rint(.09*(av+dv));
 
4986
            if ( info.vlinegap==0 )
 
4987
                info.vlinegap = info.linegap;
 
4988
            if ( info.os2_typolinegap==0 )
 
4989
                info.os2_typolinegap = info.linegap;
 
4990
        }
 
4991
        lg = info.linegap; vlg = info.vlinegap; tlg = info.os2_typolinegap;
 
4992
        SFDefaultOS2Info(&info,d->sf,n);
 
4993
        if ( lg != 0 )
 
4994
            info.linegap = lg;
 
4995
        if ( vlg!= 0 )
 
4996
            info.vlinegap = vlg;
 
4997
        if ( tlg!=0 )
 
4998
            info.os2_typolinegap = tlg;
 
4999
        free(n);
 
5000
    }
 
5001
 
 
5002
    if ( info.weight>0 && info.weight<=900 && info.weight%100==0 )
 
5003
        GGadgetSetTitle8(GWidgetGetControl(d->gw,CID_WeightClass),
 
5004
                (char *) weightclass[info.weight/100-1].text);
 
5005
    else {
 
5006
        sprintf( buffer, "%d", info.weight );
 
5007
        GGadgetSetTitle8(GWidgetGetControl(d->gw,CID_WeightClass),buffer);
 
5008
    }
 
5009
    GGadgetSelectOneListItem(GWidgetGetControl(d->gw,CID_WidthClass),info.width-1);
 
5010
    for ( i=0; pfmfamily[i].text!=NULL; ++i )
 
5011
        if ( (intpt) (pfmfamily[i].userdata)==info.pfmfamily ) {
 
5012
            GGadgetSelectOneListItem(GWidgetGetControl(d->gw,CID_PFMFamily),i);
 
5013
    break;
 
5014
        }
 
5015
 
 
5016
    if ( d->sf->os2_version>=0 && d->sf->os2_version<=4 )
 
5017
        GGadgetSelectOneListItem(GWidgetGetControl(d->gw,CID_OS2Version),d->sf->os2_version);
 
5018
    else {
 
5019
        sprintf( buffer,"%d", d->sf->os2_version );
 
5020
        GGadgetSetTitle8(GWidgetGetControl(d->gw,CID_OS2Version),buffer);
 
5021
    }
 
5022
    GGadgetSetChecked(GWidgetGetControl(d->gw,CID_UseTypoMetrics),d->sf->use_typo_metrics);
 
5023
    GGadgetSetChecked(GWidgetGetControl(d->gw,CID_WeightWidthSlopeOnly),d->sf->weight_width_slope_only);
 
5024
    
 
5025
    for ( i=0; ibmfamily[i].text!=NULL; ++i )
 
5026
        if ( (intpt) (ibmfamily[i].userdata)==info.os2_family_class ) {
 
5027
            GGadgetSelectOneListItem(GWidgetGetControl(d->gw,CID_IBMFamily),i);
 
5028
    break;
 
5029
        }
 
5030
    if ( info.os2_vendor[0]!='\0' ) {
 
5031
        ubuf[0] = info.os2_vendor[0];
 
5032
        ubuf[1] = info.os2_vendor[1];
 
5033
        ubuf[2] = info.os2_vendor[2];
 
5034
        ubuf[3] = info.os2_vendor[3];
 
5035
        ubuf[4] = 0;
 
5036
    } else if ( TTFFoundry!=NULL )
 
5037
        uc_strncpy(ubuf,TTFFoundry,4);
 
5038
    else
 
5039
        uc_strcpy(ubuf,"PfEd");
 
5040
    GGadgetSetTitle(GWidgetGetControl(d->gw,CID_Vendor),ubuf);
 
5041
 
 
5042
 
 
5043
    GGadgetSetChecked(GWidgetGetControl(d->gw,CID_PanDefault),!info.panose_set);
 
5044
    _GFI_PanoseDefault(d);
 
5045
    if ( info.panose_set )
 
5046
        for ( i=0; i<10; ++i )
 
5047
            GGadgetSelectOneListItem(GWidgetGetControl(d->gw,CID_PanFamily+i),info.panose[i]);
 
5048
 
 
5049
    GGadgetSetChecked(GWidgetGetControl(d->gw,CID_SubSuperDefault),!info.subsuper_set);
 
5050
    if ( info.subsuper_set )
 
5051
        GFI_SubSuperSet(d,&info);
 
5052
    _GFI_SubSuperDefault(d);
 
5053
 
 
5054
    d->ttf_set = true;
 
5055
    /* FSType is already set */
 
5056
    sprintf( buffer, "%d", info.linegap );
 
5057
    uc_strcpy(ubuf,buffer);
 
5058
    GGadgetSetTitle(GWidgetGetControl(d->gw,CID_LineGap),ubuf);
 
5059
    sprintf( buffer, "%d", info.vlinegap );
 
5060
    uc_strcpy(ubuf,buffer);
 
5061
    GGadgetSetTitle(GWidgetGetControl(d->gw,CID_VLineGap),ubuf);
 
5062
    sprintf( buffer, "%d", info.os2_typolinegap );
 
5063
    uc_strcpy(ubuf,buffer);
 
5064
    GGadgetSetTitle(GWidgetGetControl(d->gw,CID_TypoLineGap),ubuf);
 
5065
 
 
5066
    GGadgetSetChecked(GWidgetGetControl(d->gw,CID_WinAscentIsOff),info.winascent_add);
 
5067
    GFI_AsDsLab(d,CID_WinAscentIsOff);
 
5068
    sprintf( buffer, "%d", info.os2_winascent );
 
5069
    uc_strcpy(ubuf,buffer);
 
5070
    GGadgetSetTitle(GWidgetGetControl(d->gw,CID_WinAscent),ubuf);
 
5071
    GGadgetSetChecked(GWidgetGetControl(d->gw,CID_WinDescentIsOff),info.windescent_add);
 
5072
    GFI_AsDsLab(d,CID_WinDescentIsOff);
 
5073
    sprintf( buffer, "%d", info.os2_windescent );
 
5074
    uc_strcpy(ubuf,buffer);
 
5075
    GGadgetSetTitle(GWidgetGetControl(d->gw,CID_WinDescent),ubuf);
 
5076
 
 
5077
    GGadgetSetChecked(GWidgetGetControl(d->gw,CID_TypoAscentIsOff),info.typoascent_add);
 
5078
    GFI_AsDsLab(d,CID_TypoAscentIsOff);
 
5079
    sprintf( buffer, "%d", info.os2_typoascent );
 
5080
    uc_strcpy(ubuf,buffer);
 
5081
    GGadgetSetTitle(GWidgetGetControl(d->gw,CID_TypoAscent),ubuf);
 
5082
    GGadgetSetChecked(GWidgetGetControl(d->gw,CID_TypoDescentIsOff),info.typodescent_add);
 
5083
    GFI_AsDsLab(d,CID_TypoDescentIsOff);
 
5084
    sprintf( buffer, "%d", info.os2_typodescent );
 
5085
    uc_strcpy(ubuf,buffer);
 
5086
    GGadgetSetTitle(GWidgetGetControl(d->gw,CID_TypoDescent),ubuf);
 
5087
 
 
5088
    GGadgetSetChecked(GWidgetGetControl(d->gw,CID_HHeadAscentIsOff),info.hheadascent_add);
 
5089
    GFI_AsDsLab(d,CID_HHeadAscentIsOff);
 
5090
    sprintf( buffer, "%d", info.hhead_ascent );
 
5091
    uc_strcpy(ubuf,buffer);
 
5092
    GGadgetSetTitle(GWidgetGetControl(d->gw,CID_HHeadAscent),ubuf);
 
5093
    GGadgetSetChecked(GWidgetGetControl(d->gw,CID_HHeadDescentIsOff),info.hheaddescent_add);
 
5094
    GFI_AsDsLab(d,CID_HHeadDescentIsOff);
 
5095
    sprintf( buffer, "%d", info.hhead_descent );
 
5096
    uc_strcpy(ubuf,buffer);
 
5097
    GGadgetSetTitle(GWidgetGetControl(d->gw,CID_HHeadDescent),ubuf);
 
5098
}
 
5099
 
 
5100
static char *mathparams[] = {
 
5101
/* GT: TeX parameters for math fonts. "Num" means numerator, "Denom" */
 
5102
/* GT: means denominator, "Sup" means superscript, "Sub" means subscript */
 
5103
    N_("Num1:"),
 
5104
    N_("Num2:"),  N_("Num3:"), N_("Denom1:"),
 
5105
    N_("Denom2:"), N_("Sup1:"), N_("Sup2:"), N_("Sup3:"), N_("Sub1:"), N_("Sub2:"),
 
5106
    N_("SupDrop:"), N_("SubDrop:"), N_("Delim1:"), N_("Delim2:"), N_("Axis Ht:"),
 
5107
    0 };
 
5108
static char *mathpopups[] = { N_("Amount to raise baseline for numerators in display styles"),
 
5109
    N_("Amount to raise baseline for numerators in non-display styles"),
 
5110
    N_("Amount to raise baseline for numerators in non-display atop styles"),
 
5111
    N_("Amount to lower baseline for denominators in display styles"),
 
5112
    N_("Amount to lower baseline for denominators in non-display styles"),
 
5113
    N_("Amount to raise baseline for superscripts in display styles"),
 
5114
    N_("Amount to raise baseline for superscripts in non-display styles"),
 
5115
    N_("Amount to raise baseline for superscripts in modified styles"),
 
5116
    N_("Amount to lower baseline for subscripts in display styles"),
 
5117
    N_("Amount to lower baseline for subscripts in non-display styles"),
 
5118
    N_("Amount above top of large box to place baseline of superscripts"),
 
5119
    N_("Amount below bottom of large box to place baseline of subscripts"),
 
5120
    N_("Size of comb delimiters in display styles"), 
 
5121
    N_("Size of comb delimiters in non-display styles"),
 
5122
    N_("Height of fraction bar above base line"),
 
5123
    0 };
 
5124
/* GT: Default Rule Thickness. A rule being a typographic term for a straight */
 
5125
/* GT: black line on a printed page. */
 
5126
static char *extparams[] = { N_("Def Rule Thick:"),
 
5127
/* GT: I don't really understand these "Big Op Space" things. They have */
 
5128
/* GT: something to do with TeX and are roughly defined a few strings down */
 
5129
        N_("Big Op Space1:"),
 
5130
        N_("Big Op Space2:"),
 
5131
        N_("Big Op Space3:"),
 
5132
        N_("Big Op Space4:"),
 
5133
        N_("Big Op Space5:"), 0 };
 
5134
static char *extpopups[] = { N_("Default thickness of over and overline bars"),
 
5135
        N_("The minimum glue space above a large displayed operator"),
 
5136
        N_("The minimum glue space below a large displayed operator"),
 
5137
        N_("The minimum distance between a limit's baseline and a large displayed\noperator when the limit is above the operator"),
 
5138
        N_("The minimum distance between a limit's baseline and a large displayed\noperator when the limit is below the operator"),
 
5139
        N_("The extra glue place above and below displayed limits"),
 
5140
        0 };
 
5141
 
 
5142
static int mp_e_h(GWindow gw, GEvent *event) {
 
5143
    int i;
 
5144
 
 
5145
    if ( event->type==et_close ) {
 
5146
        struct gfi_data *d = GDrawGetUserData(gw);
 
5147
        d->mpdone = true;
 
5148
    } else if ( event->type == et_char ) {
 
5149
return( false );
 
5150
    } else if ( event->type==et_controlevent && event->u.control.subtype == et_buttonactivate ) {
 
5151
        struct gfi_data *d = GDrawGetUserData(gw);
 
5152
        if ( GGadgetGetCid(event->u.control.g)) {
 
5153
            int err=false;
 
5154
            double em = (d->sf->ascent+d->sf->descent), val;
 
5155
            char **params;
 
5156
            if ( GGadgetIsChecked(GWidgetGetControl(d->gw,CID_TeXMathSym)) )
 
5157
                params = mathparams;
 
5158
            else
 
5159
                params = extparams;
 
5160
            for ( i=0; params[i]!=0 && !err; ++i ) {
 
5161
                val = GetReal8(gw,CID_TeX+i,params[i],&err);
 
5162
                if ( !err )
 
5163
                    d->texdata.params[i+7] = rint( val/em * (1<<20) );
 
5164
            }
 
5165
            if ( !err )
 
5166
                d->mpdone = true;
 
5167
        } else
 
5168
            d->mpdone = true;
 
5169
    }
 
5170
return( true );
 
5171
}
 
5172
 
 
5173
static int GFI_MoreParams(GGadget *g, GEvent *e) {
 
5174
    int tot;
 
5175
    GRect pos;
 
5176
    GWindow gw;
 
5177
    GWindowAttrs wattrs;
 
5178
    GGadgetCreateData txgcd[35];
 
5179
    GTextInfo txlabel[35];
 
5180
    int i,y,k;
 
5181
    char **params, **popups;
 
5182
    char values[20][20];
 
5183
 
 
5184
    if ( e->type==et_controlevent && e->u.control.subtype == et_buttonactivate ) {
 
5185
        struct gfi_data *d = GDrawGetUserData(GGadgetGetWindow(g));
 
5186
        if ( GGadgetIsChecked(GWidgetGetControl(d->gw,CID_TeXText)) )
 
5187
return( true );
 
5188
        else if ( GGadgetIsChecked(GWidgetGetControl(d->gw,CID_TeXMathSym)) ) {
 
5189
            tot = 22-7;
 
5190
            params = mathparams;
 
5191
            popups = mathpopups;
 
5192
        } else {
 
5193
            tot = 13-7;
 
5194
            params = extparams;
 
5195
            popups = extpopups;
 
5196
        }
 
5197
 
 
5198
        memset(&wattrs,0,sizeof(wattrs));
 
5199
        wattrs.mask = wam_events|wam_cursor|wam_utf8_wtitle|wam_undercursor|wam_isdlg|wam_restrict;
 
5200
        wattrs.event_masks = ~(1<<et_charup);
 
5201
        wattrs.is_dlg = true;
 
5202
        wattrs.restrict_input_to_me = 1;
 
5203
        wattrs.undercursor = 1;
 
5204
        wattrs.cursor = ct_pointer;
 
5205
/* GT: More Parameters */
 
5206
        wattrs.utf8_window_title = _("More Params");
 
5207
        pos.x = pos.y = 0;
 
5208
        pos.width =GDrawPointsToPixels(NULL,GGadgetScale(180));
 
5209
        pos.height = GDrawPointsToPixels(NULL,tot*26+60);
 
5210
        gw = GDrawCreateTopWindow(NULL,&pos,mp_e_h,d,&wattrs);
 
5211
 
 
5212
        memset(&txlabel,0,sizeof(txlabel));
 
5213
        memset(&txgcd,0,sizeof(txgcd));
 
5214
 
 
5215
        k=0; y = 10;
 
5216
        for ( i=0; params[i]!=0; ++i ) {
 
5217
            txlabel[k].text = (unichar_t *) params[i];
 
5218
            txlabel[k].text_is_1byte = true;
 
5219
            txgcd[k].gd.label = &txlabel[k];
 
5220
            txgcd[k].gd.pos.x = 10; txgcd[k].gd.pos.y = y+4;
 
5221
            txgcd[k].gd.flags = gg_visible | gg_enabled | gg_utf8_popup;
 
5222
            txgcd[k].gd.popup_msg = (unichar_t *) popups[i];
 
5223
            txgcd[k++].creator = GLabelCreate;
 
5224
 
 
5225
            sprintf( values[i], "%g", d->texdata.params[i+7]*(double) (d->sf->ascent+d->sf->descent)/(double) (1<<20));
 
5226
            txlabel[k].text = (unichar_t *) values[i];
 
5227
            txlabel[k].text_is_1byte = true;
 
5228
            txgcd[k].gd.label = &txlabel[k];
 
5229
            txgcd[k].gd.pos.x = 85; txgcd[k].gd.pos.y = y;
 
5230
            txgcd[k].gd.pos.width = 75;
 
5231
            txgcd[k].gd.flags = gg_visible | gg_enabled;
 
5232
            txgcd[k].gd.cid = CID_TeX + i;
 
5233
            txgcd[k++].creator = GTextFieldCreate;
 
5234
            y += 26;
 
5235
        }
 
5236
 
 
5237
        txgcd[k].gd.pos.x = 30-3; txgcd[k].gd.pos.y = GDrawPixelsToPoints(NULL,pos.height)-35-3;
 
5238
        txgcd[k].gd.pos.width = -1; txgcd[k].gd.pos.height = 0;
 
5239
        txgcd[k].gd.flags = gg_visible | gg_enabled | gg_but_default;
 
5240
        txlabel[k].text = (unichar_t *) _("_OK");
 
5241
        txlabel[k].text_is_1byte = true;
 
5242
        txlabel[k].text_in_resource = true;
 
5243
        txgcd[k].gd.label = &txlabel[k];
 
5244
        txgcd[k].gd.cid = true;
 
5245
        txgcd[k++].creator = GButtonCreate;
 
5246
 
 
5247
        txgcd[k].gd.pos.x = -30; txgcd[k].gd.pos.y = txgcd[k-1].gd.pos.y+3;
 
5248
        txgcd[k].gd.pos.width = -1; txgcd[k].gd.pos.height = 0;
 
5249
        txgcd[k].gd.flags = gg_visible | gg_enabled | gg_but_cancel;
 
5250
        txlabel[k].text = (unichar_t *) _("_Cancel");
 
5251
        txlabel[k].text_is_1byte = true;
 
5252
        txlabel[k].text_in_resource = true;
 
5253
        txgcd[k].gd.label = &txlabel[k];
 
5254
        txgcd[k].gd.cid = false;
 
5255
        txgcd[k++].creator = GButtonCreate;
 
5256
 
 
5257
        txgcd[k].gd.pos.x = 2; txgcd[k].gd.pos.y = 2;
 
5258
        txgcd[k].gd.pos.width = pos.width-4; txgcd[k].gd.pos.height = pos.height-4;
 
5259
        txgcd[k].gd.flags = gg_enabled | gg_visible | gg_pos_in_pixels;
 
5260
        txgcd[k].creator = GGroupCreate;
 
5261
 
 
5262
        GGadgetsCreate(gw,txgcd);
 
5263
        d->mpdone = false;
 
5264
        GDrawSetVisible(gw,true);
 
5265
 
 
5266
        while ( !d->mpdone )
 
5267
            GDrawProcessOneEvent(NULL);
 
5268
        GDrawDestroyWindow(gw);
 
5269
    }
 
5270
return( true );
 
5271
}
 
5272
 
 
5273
static int GFI_TeXChanged(GGadget *g, GEvent *e) {
 
5274
    if ( e->type==et_controlevent && e->u.control.subtype == et_radiochanged ) {
 
5275
        struct gfi_data *d = GDrawGetUserData(GGadgetGetWindow(g));
 
5276
        if ( GGadgetGetCid(g)==CID_TeXText ) {
 
5277
            GGadgetSetTitle8(GWidgetGetControl(d->gw,CID_TeXExtraSpLabel),
 
5278
/* GT: Extra Space */
 
5279
                    _("Extra Sp:"));
 
5280
            GGadgetSetEnabled(GWidgetGetControl(d->gw,CID_MoreParams),false);
 
5281
        } else {
 
5282
            GGadgetSetTitle8(GWidgetGetControl(d->gw,CID_TeXExtraSpLabel),
 
5283
                    _("Math Sp:"));
 
5284
            GGadgetSetEnabled(GWidgetGetControl(d->gw,CID_MoreParams),true);
 
5285
        }
 
5286
    }
 
5287
return( true );
 
5288
}
 
5289
 
 
5290
static void DefaultTeX(struct gfi_data *d) {
 
5291
    char buffer[20];
 
5292
    int i;
 
5293
    SplineFont *sf = d->sf;
 
5294
 
 
5295
    d->tex_set = true;
 
5296
 
 
5297
    if ( sf->texdata.type==tex_unset ) {
 
5298
        TeXDefaultParams(sf);
 
5299
        d->texdata = sf->texdata;
 
5300
    }
 
5301
 
 
5302
    for ( i=0; i<7; ++i ) {
 
5303
        sprintf( buffer,"%g", d->texdata.params[i]*(sf->ascent+sf->descent)/(double) (1<<20));
 
5304
        GGadgetSetTitle8(GWidgetGetControl(d->gw,CID_TeX+i),buffer);
 
5305
    }
 
5306
    if ( sf->texdata.type==tex_math )
 
5307
        GGadgetSetChecked(GWidgetGetControl(d->gw,CID_TeXMathSym), true);
 
5308
    else if ( sf->texdata.type == tex_mathext )
 
5309
        GGadgetSetChecked(GWidgetGetControl(d->gw,CID_TeXMathExt), true);
 
5310
    else {
 
5311
        GGadgetSetChecked(GWidgetGetControl(d->gw,CID_TeXText), true);
 
5312
        GGadgetSetTitle8(GWidgetGetControl(d->gw,CID_TeXExtraSpLabel),
 
5313
/* GT: Extra Space */
 
5314
                _("Extra Sp:"));
 
5315
        GGadgetSetEnabled(GWidgetGetControl(d->gw,CID_MoreParams),false);
 
5316
    }
 
5317
}
 
5318
 
 
5319
static int GFI_MacAutomatic(GGadget *g, GEvent *e) {
 
5320
    if ( e->type==et_controlevent && e->u.control.subtype == et_radiochanged ) {
 
5321
        struct gfi_data *d = GDrawGetUserData(GGadgetGetWindow(g));
 
5322
        int autom = GGadgetIsChecked(GWidgetGetControl(d->gw,CID_MacAutomatic));
 
5323
        GGadgetSetEnabled(GWidgetGetControl(d->gw,CID_MacStyles),!autom);
 
5324
    }
 
5325
return( true );
 
5326
}
 
5327
 
 
5328
static void FigureUnicode(struct gfi_data *d) {
 
5329
    int includeempties = GGadgetIsChecked(GWidgetGetControl(d->gw,CID_UnicodeEmpties));
 
5330
    GGadget *list = GWidgetGetControl(d->gw,CID_Unicode);
 
5331
    struct rangeinfo *ri;
 
5332
    int cnt, i;
 
5333
    GTextInfo **ti;
 
5334
    char buffer[200];
 
5335
 
 
5336
    GGadgetClearList(list);
 
5337
    ri = SFUnicodeRanges(d->sf,(includeempties?ur_includeempty:0)|ur_sortbyunicode);
 
5338
    if ( ri==NULL ) cnt=0;
 
5339
    else
 
5340
        for ( cnt=0; ri[cnt].range!=NULL; ++cnt );
 
5341
 
 
5342
    ti = galloc((cnt+1) * sizeof( GTextInfo * ));
 
5343
    for ( i=0; i<cnt; ++i ) {
 
5344
        if ( ri[i].range->first==-1 )
 
5345
            snprintf( buffer, sizeof(buffer),
 
5346
                    "%s  %d/0", _(ri[i].range->name), ri[i].cnt);
 
5347
        else
 
5348
            snprintf( buffer, sizeof(buffer),
 
5349
                    "%s  U+%04X-U+%04X %d/%d",
 
5350
                    _(ri[i].range->name),
 
5351
                    (int) ri[i].range->first, (int) ri[i].range->last,
 
5352
                    ri[i].cnt, ri[i].range->actual );
 
5353
        ti[i] = gcalloc(1,sizeof(GTextInfo));
 
5354
        ti[i]->fg = ti[i]->bg = COLOR_DEFAULT;
 
5355
        ti[i]->text = utf82u_copy(buffer);
 
5356
        ti[i]->userdata = ri[i].range;
 
5357
    }
 
5358
    ti[i] = gcalloc(1,sizeof(GTextInfo));
 
5359
    GGadgetSetList(list,ti,false);
 
5360
    free(ri);
 
5361
}
 
5362
 
 
5363
static int GFI_UnicodeRangeChange(GGadget *g, GEvent *e) {
 
5364
    struct gfi_data *d = GDrawGetUserData(GGadgetGetWindow(g));
 
5365
    GTextInfo *ti = GGadgetGetListItemSelected(g);
 
5366
    struct unicoderange *r;
 
5367
    int gid, first=-1;
 
5368
    SplineFont *sf = d->sf;
 
5369
    FontView *fv = sf->fv;
 
5370
    EncMap *map = fv->map;
 
5371
    int i, enc;
 
5372
 
 
5373
    if ( ti==NULL )
 
5374
return( true );
 
5375
    if ( e->type!=et_controlevent ||
 
5376
            (e->u.control.subtype != et_listselected &&e->u.control.subtype != et_listdoubleclick))
 
5377
return( true );
 
5378
 
 
5379
    r = ti->userdata;
 
5380
 
 
5381
    for ( i=0; i<map->enccount; ++i )
 
5382
        fv->selected[i] = 0;
 
5383
 
 
5384
    if ( e->u.control.subtype == et_listselected ) {
 
5385
        for ( gid=0; gid<sf->glyphcnt; ++gid ) if ( sf->glyphs[gid]!=NULL ) {
 
5386
            enc = map->backmap[gid];
 
5387
            if ( sf->glyphs[gid]->unicodeenc>=r->first && sf->glyphs[gid]->unicodeenc<=r->last &&
 
5388
                    enc!=-1 ) {
 
5389
                if ( first==-1 || enc<first ) first = enc;
 
5390
                fv->selected[enc] = true;
 
5391
            }
 
5392
        }
 
5393
    } else if ( e->u.control.subtype == et_listdoubleclick && !r->unassigned ) {
 
5394
        char *found = gcalloc(r->last-r->first+1,1);
 
5395
        for ( gid=0; gid<sf->glyphcnt; ++gid ) if ( sf->glyphs[gid]!=NULL ) {
 
5396
            int u = sf->glyphs[gid]->unicodeenc;
 
5397
            if ( u>=r->first && u<=r->last ) {
 
5398
                found[u-r->first] = true;
 
5399
            }
 
5400
        }
 
5401
        for ( i=0; i<=r->last-r->first; ++i ) {
 
5402
            if ( isunicodepointassigned(i+r->first) && !found[i] ) {
 
5403
                enc = EncFromUni(i+r->first,map->enc);
 
5404
                if ( enc!=-1 ) {
 
5405
                    if ( first==-1 || enc<first ) first = enc;
 
5406
                    fv->selected[enc] = true;
 
5407
                }
 
5408
            }
 
5409
        }
 
5410
        free(found);
 
5411
    }
 
5412
    if ( first==-1 ) {
 
5413
        GDrawBeep(NULL);
 
5414
    } else {
 
5415
        FVScrollToChar(fv,first);
 
5416
    }
 
5417
    GDrawRequestExpose(fv->v,NULL,false);
 
5418
return( true );
 
5419
}
 
5420
 
 
5421
static int GFI_UnicodeEmptiesChange(GGadget *g, GEvent *e) {
 
5422
    if ( e->type==et_controlevent && e->u.control.subtype == et_radiochanged ) {
 
5423
        struct gfi_data *d = GDrawGetUserData(GGadgetGetWindow(g));
 
5424
        FigureUnicode(d);
 
5425
    }
 
5426
return( true );
 
5427
}
 
5428
 
 
5429
static int GFI_AspectChange(GGadget *g, GEvent *e) {
 
5430
    if ( e==NULL || (e->type==et_controlevent && e->u.control.subtype == et_radiochanged )) {
 
5431
        struct gfi_data *d = GDrawGetUserData(GGadgetGetWindow(g));
 
5432
        int new_aspect = GTabSetGetSel(g);
 
5433
        int rows;
 
5434
 
 
5435
        if ( d->old_aspect == d->tn_aspect )
 
5436
            GMatrixEditGet(GWidgetGetControl(d->gw,CID_TNames), &rows);
 
5437
        if ( !d->ttf_set && new_aspect == d->ttfv_aspect )
 
5438
            TTFSetup(d);
 
5439
        else if ( !d->names_set && new_aspect == d->tn_aspect ) {
 
5440
            TTFNames_Resort(d);
 
5441
            d->names_set = true;
 
5442
        } else if ( !d->tex_set && new_aspect == d->tx_aspect )
 
5443
            DefaultTeX(d);
 
5444
        else if ( new_aspect == d->unicode_aspect )
 
5445
            FigureUnicode(d);
 
5446
        d->old_aspect = new_aspect;
 
5447
    }
 
5448
return( true );
 
5449
}
 
5450
 
 
5451
static int e_h(GWindow gw, GEvent *event) {
 
5452
    if ( event->type==et_close ) {
 
5453
        struct gfi_data *d = GDrawGetUserData(gw);
 
5454
        GFI_CancelClose(d);
 
5455
    } else if ( event->type==et_destroy ) {
 
5456
        struct gfi_data *d = GDrawGetUserData(gw);
 
5457
        free(d);
 
5458
    } else if ( event->type==et_char ) {
 
5459
return( GFI_Char(GDrawGetUserData(gw),event));
 
5460
    }
 
5461
return( true );
 
5462
}
 
5463
 
 
5464
static void GFI_InitMarkClasses(struct gfi_data *d) {
 
5465
    SplineFont *sf = d->sf;
 
5466
    int i;
 
5467
 
 
5468
    d->mark_class_cnt = sf->mark_class_cnt;
 
5469
    if ( d->mark_class_cnt!=0 ) {
 
5470
        d->mark_classes = galloc(d->mark_class_cnt*sizeof(char *));
 
5471
        d->mark_class_names = galloc(d->mark_class_cnt*sizeof(unichar_t *));
 
5472
        d->mark_classes[0] = NULL; d->mark_class_names[0] = NULL;
 
5473
        for ( i=1; i<d->mark_class_cnt; ++i ) {
 
5474
            d->mark_classes[i] = copy(sf->mark_classes[i]);
 
5475
            d->mark_class_names[i] = copy(sf->mark_class_names[i]);
 
5476
        }
 
5477
    }
 
5478
}
 
5479
 
 
5480
static void LookupSetup(struct lkdata *lk,OTLookup *lookups) {
 
5481
    int cnt, subcnt;
 
5482
    OTLookup *otl;
 
5483
    struct lookup_subtable *sub;
 
5484
 
 
5485
    for ( cnt=0, otl=lookups; otl!=NULL; ++cnt, otl=otl->next );
 
5486
    lk->cnt = cnt; lk->max = cnt+10;
 
5487
    lk->all = gcalloc(lk->max,sizeof(struct lkinfo));
 
5488
    for ( cnt=0, otl=lookups; otl!=NULL; ++cnt, otl=otl->next ) {
 
5489
        lk->all[cnt].lookup = otl;
 
5490
        for ( subcnt=0, sub=otl->subtables; sub!=NULL; ++subcnt, sub=sub->next );
 
5491
        lk->all[cnt].subtable_cnt = subcnt; lk->all[cnt].subtable_max = subcnt+10;
 
5492
        lk->all[cnt].subtables = gcalloc(lk->all[cnt].subtable_max,sizeof(struct lksubinfo));
 
5493
        for ( subcnt=0, sub=otl->subtables; sub!=NULL; ++subcnt, sub=sub->next )
 
5494
            lk->all[cnt].subtables[subcnt].subtable = sub;
 
5495
    }
 
5496
}
 
5497
 
 
5498
static void LookupInfoFree(struct lkdata *lk) {
 
5499
    int cnt;
 
5500
 
 
5501
    for ( cnt=0; cnt<lk->cnt; ++cnt )
 
5502
        free(lk->all[cnt].subtables);
 
5503
    free(lk->all);
 
5504
}
 
5505
 
 
5506
#define LK_MARGIN 2
 
5507
 
 
5508
struct selection_bits {
 
5509
    int lookup_cnt, sub_cnt;    /* Number of selected lookups, and selected sub tables */
 
5510
    int a_lookup, a_sub;        /* The index of one of those lookups, or subtables */
 
5511
    int a_sub_lookup;           /*  the index of the lookup containing a_sub */
 
5512
    int any_first, any_last;    /* Whether any of the selected items is first or last in its catagory */
 
5513
    int sub_table_mergeable;    /* Can we merge the selected subtables? */
 
5514
    int lookup_mergeable;       /* Can we merge the selected lookups? */
 
5515
};
 
5516
 
 
5517
static void LookupParseSelection(struct lkdata *lk, struct selection_bits *sel) {
 
5518
    int lookup_cnt, sub_cnt, any_first, any_last, all_one_lookup;
 
5519
    int a_lookup, a_sub, a_sub_lookup;
 
5520
    int sub_mergeable, lookup_mergeable;
 
5521
    int i,j;
 
5522
 
 
5523
    lookup_cnt = sub_cnt = any_first = any_last = 0;
 
5524
    all_one_lookup = a_lookup = a_sub = a_sub_lookup = -1;
 
5525
    sub_mergeable = lookup_mergeable = true;
 
5526
    for ( i=0; i<lk->cnt; ++i ) {
 
5527
        if ( lk->all[i].deleted )
 
5528
    continue;
 
5529
        if ( lk->all[i].selected ) {
 
5530
            ++lookup_cnt;
 
5531
            if ( a_lookup==-1 )
 
5532
                a_lookup = i;
 
5533
            else if ( lk->all[i].lookup->lookup_type!=lk->all[a_lookup].lookup->lookup_type ||
 
5534
                    lk->all[i].lookup->lookup_flags!=lk->all[a_lookup].lookup->lookup_flags )
 
5535
                lookup_mergeable = false;
 
5536
            if ( i==0 ) any_first=true;
 
5537
            if ( i==lk->cnt-1 ) any_last=true;
 
5538
        }
 
5539
        if ( lk->all[i].open ) {
 
5540
            for ( j=0; j<lk->all[i].subtable_cnt; ++j ) {
 
5541
                if ( lk->all[i].subtables[j].deleted )
 
5542
            continue;
 
5543
                if ( lk->all[i].subtables[j].selected ) {
 
5544
                    ++sub_cnt;
 
5545
                    if ( a_sub==-1 ) {
 
5546
                        a_sub = j; a_sub_lookup = i;
 
5547
                    }
 
5548
                    if ( j==0 ) any_first = true;
 
5549
                    if ( j==lk->all[i].subtable_cnt-1 ) any_last = true;
 
5550
                    if ( lk->all[i].subtables[j].subtable->kc!=NULL ||
 
5551
                            lk->all[i].subtables[j].subtable->fpst!=NULL ||
 
5552
                            lk->all[i].subtables[j].subtable->sm!=NULL )
 
5553
                        sub_mergeable = false;
 
5554
                    if ( all_one_lookup==-1 )
 
5555
                        all_one_lookup = i;
 
5556
                    else if ( all_one_lookup!=i )
 
5557
                        all_one_lookup = -2;
 
5558
                }
 
5559
            }
 
5560
        }
 
5561
    }
 
5562
 
 
5563
    sel->lookup_cnt = lookup_cnt;
 
5564
    sel->sub_cnt = sub_cnt;
 
5565
    sel->a_lookup = a_lookup;
 
5566
    sel->a_sub = a_sub;
 
5567
    sel->a_sub_lookup = a_sub_lookup;
 
5568
    sel->any_first = any_first;
 
5569
    sel->any_last = any_last;
 
5570
    sel->sub_table_mergeable = sub_mergeable && all_one_lookup && sub_cnt>=2 && lookup_cnt==0;
 
5571
    sel->lookup_mergeable = lookup_mergeable && lookup_cnt>=2 && sub_cnt==0;
 
5572
}
 
5573
 
 
5574
void GFI_LookupEnableButtons(struct gfi_data *gfi, int isgpos) {
 
5575
    struct lkdata *lk = &gfi->tables[isgpos];
 
5576
    struct selection_bits sel;
 
5577
    FontView *ofv;
 
5578
 
 
5579
    LookupParseSelection(lk,&sel);
 
5580
 
 
5581
    GGadgetSetEnabled(GWidgetGetControl(gfi->gw,CID_LookupTop),!sel.any_first &&
 
5582
            sel.lookup_cnt+sel.sub_cnt==1);
 
5583
    GGadgetSetEnabled(GWidgetGetControl(gfi->gw,CID_LookupUp),!sel.any_first &&
 
5584
            sel.lookup_cnt+sel.sub_cnt!=0);
 
5585
    GGadgetSetEnabled(GWidgetGetControl(gfi->gw,CID_LookupDown),!sel.any_last &&
 
5586
            sel.lookup_cnt+sel.sub_cnt!=0);
 
5587
    GGadgetSetEnabled(GWidgetGetControl(gfi->gw,CID_LookupBottom),!sel.any_last &&
 
5588
            sel.lookup_cnt+sel.sub_cnt==1);
 
5589
    GGadgetSetEnabled(GWidgetGetControl(gfi->gw,CID_AddLookup),
 
5590
            (sel.lookup_cnt+sel.sub_cnt<=1));
 
5591
    GGadgetSetEnabled(GWidgetGetControl(gfi->gw,CID_AddSubtable),
 
5592
            (sel.lookup_cnt==1 && sel.sub_cnt<=1) || (sel.lookup_cnt==0 && sel.sub_cnt==1));
 
5593
    GGadgetSetEnabled(GWidgetGetControl(gfi->gw,CID_EditMetadata),
 
5594
            (sel.lookup_cnt==1 && sel.sub_cnt==0) ||
 
5595
            (sel.lookup_cnt==0 && sel.sub_cnt==1));
 
5596
    GGadgetSetEnabled(GWidgetGetControl(gfi->gw,CID_EditSubtable),sel.lookup_cnt==0 &&
 
5597
            sel.sub_cnt==1);
 
5598
    GGadgetSetEnabled(GWidgetGetControl(gfi->gw,CID_DeleteLookup),sel.lookup_cnt!=0 ||
 
5599
            sel.sub_cnt!=0);
 
5600
    GGadgetSetEnabled(GWidgetGetControl(gfi->gw,CID_MergeLookup),
 
5601
            (sel.lookup_cnt>=2 && sel.sub_cnt==0 && sel.lookup_mergeable) ||
 
5602
            (sel.lookup_cnt==0 && sel.sub_cnt>=2 && sel.sub_table_mergeable));
 
5603
    GGadgetSetEnabled(GWidgetGetControl(gfi->gw,CID_RevertLookups),true);
 
5604
    GGadgetSetEnabled(GWidgetGetControl(gfi->gw,CID_LookupSort),lk->cnt>1 );
 
5605
 
 
5606
    for ( ofv=fv_list; ofv!=NULL; ofv = ofv->next ) {
 
5607
        SplineFont *osf = ofv->sf;
 
5608
        if ( osf->cidmaster ) osf = osf->cidmaster;
 
5609
        if ( osf==gfi->sf || gfi->sf->cidmaster==osf )
 
5610
    continue;
 
5611
        if ( (isgpos && osf->gpos_lookups!=NULL) || (!isgpos && osf->gsub_lookups!=NULL) )
 
5612
    break;
 
5613
    }
 
5614
    GGadgetSetEnabled(GWidgetGetControl(gfi->gw,CID_ImportLookups),ofv!=NULL);
 
5615
}
 
5616
 
 
5617
void GFI_LookupScrollbars(struct gfi_data *gfi, int isgpos, int refresh) {
 
5618
    int lcnt, i,j;
 
5619
    int width=0, wmax;
 
5620
    GWindow gw = GDrawableGetWindow(GWidgetGetControl(gfi->gw,CID_LookupWin+isgpos));
 
5621
    struct lkdata *lk = &gfi->tables[isgpos];
 
5622
    GGadget *vsb = GWidgetGetControl(gfi->gw,CID_LookupVSB+isgpos);
 
5623
    GGadget *hsb = GWidgetGetControl(gfi->gw,CID_LookupHSB+isgpos);
 
5624
    int off_top, off_left;
 
5625
 
 
5626
    GDrawSetFont(gw,gfi->font);
 
5627
    lcnt = 0;
 
5628
    for ( i=0; i<lk->cnt; ++i ) {
 
5629
        if ( lk->all[i].deleted )
 
5630
    continue;
 
5631
        ++lcnt;
 
5632
        wmax = GDrawGetText8Width(gw,lk->all[i].lookup->lookup_name,-1,NULL);
 
5633
        if ( wmax > width ) width = wmax;
 
5634
        if ( lk->all[i].open ) {
 
5635
            for ( j=0; j<lk->all[i].subtable_cnt; ++j ) {
 
5636
                if ( lk->all[i].subtables[j].deleted )
 
5637
            continue;
 
5638
                ++lcnt;
 
5639
                wmax = gfi->fh+GDrawGetText8Width(gw,lk->all[i].subtables[j].subtable->subtable_name,-1,NULL);
 
5640
                if ( wmax > width ) width = wmax;
 
5641
            }
 
5642
        }
 
5643
    }
 
5644
    width += gfi->fh;
 
5645
    GScrollBarSetBounds(vsb,0,lcnt,(gfi->lkheight-2*LK_MARGIN)/gfi->fh);
 
5646
    GScrollBarSetBounds(hsb,0,width,gfi->lkwidth-2*LK_MARGIN);
 
5647
    off_top = lk->off_top;
 
5648
    if ( off_top+((gfi->lkheight-2*LK_MARGIN)/gfi->fh) > lcnt )
 
5649
        off_top = lcnt - (gfi->lkheight-2*LK_MARGIN)/gfi->fh;
 
5650
    if ( off_top<0 )
 
5651
        off_top  = 0;
 
5652
    off_left = lk->off_left;
 
5653
    if ( off_left+gfi->lkwidth-2*LK_MARGIN > width )
 
5654
        off_left = width-(gfi->lkwidth-2*LK_MARGIN);
 
5655
    if ( off_left<0 )
 
5656
        off_left  = 0;
 
5657
    if ( off_top!=lk->off_top || off_left!=lk->off_left ) {
 
5658
        lk->off_top = off_top; lk->off_left = off_left;
 
5659
        GScrollBarSetPos(vsb,off_top);
 
5660
        GScrollBarSetPos(hsb,off_left);
 
5661
        refresh = true;
 
5662
    }
 
5663
    if ( refresh )
 
5664
        GDrawRequestExpose(gw,NULL,true);
 
5665
}
 
5666
 
 
5667
static int LookupsHScroll(GGadget *g,GEvent *event) {
 
5668
    struct gfi_data *gfi = GDrawGetUserData(GGadgetGetWindow(g));
 
5669
    int isgpos = GGadgetGetCid(g)-CID_LookupHSB;
 
5670
    struct lkdata *lk = &gfi->tables[isgpos];
 
5671
    int newpos = lk->off_left;
 
5672
    int32 sb_min, sb_max, sb_pagesize;
 
5673
 
 
5674
    if ( event->type!=et_controlevent || event->u.control.subtype != et_scrollbarchange )
 
5675
return( true );
 
5676
 
 
5677
    GScrollBarGetBounds(event->u.control.g,&sb_min,&sb_max,&sb_pagesize);
 
5678
    switch( event->u.control.u.sb.type ) {
 
5679
      case et_sb_top:
 
5680
        newpos = 0;
 
5681
      break;
 
5682
      case et_sb_uppage:
 
5683
        newpos -= 9*sb_pagesize/10;
 
5684
      break;
 
5685
      case et_sb_up:
 
5686
        newpos -= sb_pagesize/15;
 
5687
      break;
 
5688
      case et_sb_down:
 
5689
        newpos += sb_pagesize/15;
 
5690
      break;
 
5691
      case et_sb_downpage:
 
5692
        newpos += 9*sb_pagesize/10;
 
5693
      break;
 
5694
      case et_sb_bottom:
 
5695
        newpos = sb_max-sb_pagesize;
 
5696
      break;
 
5697
      case et_sb_thumb:
 
5698
      case et_sb_thumbrelease:
 
5699
        newpos = event->u.control.u.sb.pos;
 
5700
      break;
 
5701
      case et_sb_halfup:
 
5702
        newpos -= sb_pagesize/30;
 
5703
      break;
 
5704
      case et_sb_halfdown:
 
5705
        newpos += sb_pagesize/30;
 
5706
      break;
 
5707
    }
 
5708
    if ( newpos>sb_max-sb_pagesize )
 
5709
        newpos = sb_max-sb_pagesize;
 
5710
    if ( newpos<0 ) newpos = 0;
 
5711
    if ( newpos!=lk->off_left ) {
 
5712
        lk->off_left = newpos;
 
5713
        GScrollBarSetPos(event->u.control.g,newpos);
 
5714
        GDrawRequestExpose(GDrawableGetWindow(GWidgetGetControl(gfi->gw,CID_LookupWin+isgpos)),NULL,true);
 
5715
    }
 
5716
return( true );
 
5717
}
 
5718
 
 
5719
static int LookupsVScroll(GGadget *g,GEvent *event) {
 
5720
    struct gfi_data *gfi = GDrawGetUserData(GGadgetGetWindow(g));
 
5721
    int isgpos = GGadgetGetCid(g)-CID_LookupVSB;
 
5722
    struct lkdata *lk = &gfi->tables[isgpos];
 
5723
    int newpos = lk->off_top;
 
5724
    int32 sb_min, sb_max, sb_pagesize;
 
5725
 
 
5726
    if ( event->type!=et_controlevent || event->u.control.subtype != et_scrollbarchange )
 
5727
return( true );
 
5728
 
 
5729
    GScrollBarGetBounds(event->u.control.g,&sb_min,&sb_max,&sb_pagesize);
 
5730
    switch( event->u.control.u.sb.type ) {
 
5731
      case et_sb_top:
 
5732
        newpos = 0;
 
5733
      break;
 
5734
      case et_sb_uppage:
 
5735
        newpos -= 9*sb_pagesize/10;
 
5736
      break;
 
5737
      case et_sb_up:
 
5738
        --newpos;
 
5739
      break;
 
5740
      case et_sb_down:
 
5741
        ++newpos;
 
5742
      break;
 
5743
      case et_sb_downpage:
 
5744
        newpos += 9*sb_pagesize/10;
 
5745
      break;
 
5746
      case et_sb_bottom:
 
5747
        newpos = (sb_max-sb_pagesize);
 
5748
      break;
 
5749
      case et_sb_thumb:
 
5750
      case et_sb_thumbrelease:
 
5751
        newpos = event->u.control.u.sb.pos;
 
5752
      break;
 
5753
    }
 
5754
    if ( newpos>(sb_max-sb_pagesize) )
 
5755
        newpos = (sb_max-sb_pagesize);
 
5756
    if ( newpos<0 ) newpos = 0;
 
5757
    if ( newpos!=lk->off_top ) {
 
5758
        /*int diff = newpos-lk->off_top;*/
 
5759
        lk->off_top = newpos;
 
5760
        GScrollBarSetPos(event->u.control.g,newpos);
 
5761
        /*GDrawScroll(GDrawableGetWindow(GWidgetGetControl(gfi->gw,CID_LookupWin+isgpos)),NULL,0,diff*gfi->fh);*/
 
5762
        GDrawRequestExpose(GDrawableGetWindow(GWidgetGetControl(gfi->gw,CID_LookupWin+isgpos)),NULL,true);
 
5763
    }
 
5764
return( true );
 
5765
}
 
5766
 
 
5767
static int GFI_LookupOrder(GGadget *g, GEvent *e) {
 
5768
 
 
5769
    if ( e->type==et_controlevent && e->u.control.subtype == et_buttonactivate ) {
 
5770
        struct gfi_data *gfi = GDrawGetUserData(GGadgetGetWindow(g));
 
5771
        int isgpos = GTabSetGetSel(GWidgetGetControl(gfi->gw,CID_Lookups));
 
5772
        struct lkdata *lk = &gfi->tables[isgpos];
 
5773
        int i,j,k;
 
5774
        struct lkinfo temp;
 
5775
        struct lksubinfo temp2;
 
5776
        int cid = GGadgetGetCid(g);
 
5777
        GWindow gw = GDrawableGetWindow(GWidgetGetControl(gfi->gw,CID_LookupWin+isgpos));
 
5778
 
 
5779
        if ( cid==CID_LookupTop ) {
 
5780
            for ( i=0; i<lk->cnt; ++i ) {
 
5781
                if ( lk->all[i].deleted )
 
5782
            continue;
 
5783
                if ( lk->all[i].selected ) {
 
5784
                    temp = lk->all[i];
 
5785
                    for ( k=i-1; k>=0; --k )
 
5786
                        lk->all[k+1] = lk->all[k];
 
5787
                    lk->all[0] = temp;
 
5788
    goto done;
 
5789
                }
 
5790
                if ( lk->all[i].open ) {
 
5791
                    for ( j=0; j<lk->all[i].subtable_cnt; ++j ) {
 
5792
                        if ( lk->all[i].subtables[j].deleted )
 
5793
                    continue;
 
5794
                        if ( lk->all[i].subtables[j].selected ) {
 
5795
                            temp2 = lk->all[i].subtables[j];
 
5796
                            for ( k=j-1; k>=0; --k )
 
5797
                                lk->all[i].subtables[k+1] = lk->all[i].subtables[k];
 
5798
                            lk->all[i].subtables[0] = temp2;
 
5799
    goto done;
 
5800
                        }
 
5801
                    }
 
5802
                }
 
5803
            }
 
5804
        } else if ( cid==CID_LookupBottom ) {
 
5805
            for ( i=0; i<lk->cnt; ++i ) {
 
5806
                if ( lk->all[i].deleted )
 
5807
            continue;
 
5808
                if ( lk->all[i].selected ) {
 
5809
                    temp = lk->all[i];
 
5810
                    for ( k=i; k<lk->cnt-1; --k )
 
5811
                        lk->all[k] = lk->all[k+1];
 
5812
                    lk->all[lk->cnt-1] = temp;
 
5813
    goto done;
 
5814
                }
 
5815
                if ( lk->all[i].open ) {
 
5816
                    for ( j=0; j<lk->all[i].subtable_cnt; ++j ) {
 
5817
                        if ( lk->all[i].subtables[j].deleted )
 
5818
                    continue;
 
5819
                        if ( lk->all[i].subtables[j].selected ) {
 
5820
                            temp2 = lk->all[i].subtables[j];
 
5821
                            for ( k=j; k<lk->all[i].subtable_cnt-1; --k )
 
5822
                                lk->all[i].subtables[k] = lk->all[i].subtables[k+1];
 
5823
                            lk->all[i].subtables[lk->all[i].subtable_cnt-1] = temp2;
 
5824
    goto done;
 
5825
                        }
 
5826
                    }
 
5827
                }
 
5828
            }
 
5829
        } else if ( cid==CID_LookupUp ) {
 
5830
            for ( i=0; i<lk->cnt; ++i ) {
 
5831
                if ( lk->all[i].deleted )
 
5832
            continue;
 
5833
                if ( lk->all[i].selected && i!=0 ) {
 
5834
                    temp = lk->all[i];
 
5835
                    lk->all[i] = lk->all[i-1];
 
5836
                    lk->all[i-1] = temp;
 
5837
                }
 
5838
                if ( lk->all[i].open ) {
 
5839
                    for ( j=0; j<lk->all[i].subtable_cnt; ++j ) {
 
5840
                        if ( lk->all[i].subtables[j].deleted )
 
5841
                    continue;
 
5842
                        if ( lk->all[i].subtables[j].selected && j!=0 ) {
 
5843
                            temp2 = lk->all[i].subtables[j];
 
5844
                            lk->all[i].subtables[j] = lk->all[i].subtables[j-1];
 
5845
                            lk->all[i].subtables[j-1] = temp2;
 
5846
                        }
 
5847
                    }
 
5848
                }
 
5849
            }
 
5850
        } else if ( cid==CID_LookupDown ) {
 
5851
            for ( i=lk->cnt-1; i>=0; --i ) {
 
5852
                if ( lk->all[i].deleted )
 
5853
            continue;
 
5854
                if ( lk->all[i].selected && i!=lk->cnt-1 ) {
 
5855
                    temp = lk->all[i];
 
5856
                    lk->all[i] = lk->all[i+1];
 
5857
                    lk->all[i+1] = temp;
 
5858
                }
 
5859
                if ( lk->all[i].open ) {
 
5860
                    for ( j=0; j<lk->all[i].subtable_cnt; ++j ) {
 
5861
                        if ( lk->all[i].subtables[j].deleted )
 
5862
                    continue;
 
5863
                        if ( lk->all[i].subtables[j].selected && j!=lk->all[i].subtable_cnt-1 ) {
 
5864
                            temp2 = lk->all[i].subtables[j];
 
5865
                            lk->all[i].subtables[j] = lk->all[i].subtables[j+1];
 
5866
                            lk->all[i].subtables[j+1] = temp2;
 
5867
                        }
 
5868
                    }
 
5869
                }
 
5870
            }
 
5871
        }
 
5872
    done:
 
5873
        GFI_LookupEnableButtons(gfi,isgpos);
 
5874
        GDrawRequestExpose(gw,NULL,true);
 
5875
    }
 
5876
return( true );
 
5877
}
 
5878
 
 
5879
static int GFI_LookupSort(GGadget *g, GEvent *e) {
 
5880
 
 
5881
    if ( e->type==et_controlevent && e->u.control.subtype == et_buttonactivate ) {
 
5882
        struct gfi_data *gfi = GDrawGetUserData(GGadgetGetWindow(g));
 
5883
        int isgpos = GTabSetGetSel(GWidgetGetControl(gfi->gw,CID_Lookups));
 
5884
        struct lkdata *lk = &gfi->tables[isgpos];
 
5885
        struct lkinfo temp;
 
5886
        int i,j;
 
5887
 
 
5888
        for ( i=0; i<lk->cnt; ++i ) {
 
5889
            int order = FeatureOrderId(isgpos,lk->all[i].lookup->features);
 
5890
            for ( j=i+1; j<lk->cnt; ++j ) {
 
5891
                int jorder = FeatureOrderId(isgpos,lk->all[j].lookup->features);
 
5892
                if ( order>jorder) {
 
5893
                    temp = lk->all[i];
 
5894
                    lk->all[i] = lk->all[j];
 
5895
                    lk->all[j] = temp;
 
5896
                    order = jorder;
 
5897
                }
 
5898
            }
 
5899
        }
 
5900
        GFI_LookupEnableButtons(gfi,isgpos);
 
5901
    }
 
5902
return( true );
 
5903
}
 
5904
 
 
5905
/* ??? *//* How about a series of buttons to show only by lookup_type, feat-tag, script-tag */
 
5906
 
 
5907
void GFI_CCDEnd(struct gfi_data *d) {
 
5908
 
 
5909
    d->ccd = NULL;
 
5910
}
 
5911
 
 
5912
void GFI_FinishContextNew(struct gfi_data *d,FPST *fpst, int success) {
 
5913
    OTLookup *otl;
 
5914
    struct lookup_subtable *sub, *prev;
 
5915
    FPST *ftest, *fprev;
 
5916
 
 
5917
    if ( !success ) {
 
5918
        /* We can't allow incomplete FPSTs to float around */
 
5919
        /* If they didn't fill it in, delete it */
 
5920
        otl = fpst->subtable->lookup;
 
5921
        prev = NULL;
 
5922
        for ( sub=otl->subtables; sub!=NULL && sub!=fpst->subtable; prev = sub, sub=sub->next );
 
5923
        if ( sub!=NULL ) {
 
5924
            if ( prev==NULL )
 
5925
                otl->subtables = sub->next;
 
5926
            else
 
5927
                prev->next = sub->next;
 
5928
            free(sub->subtable_name);
 
5929
            chunkfree(sub,sizeof(struct lookup_subtable));
 
5930
        }
 
5931
        fprev = NULL;
 
5932
        for ( ftest=d->sf->possub; ftest!=NULL && ftest!=fpst; fprev = ftest, ftest=ftest->next );
 
5933
        if ( ftest!=NULL ) {
 
5934
            if ( fprev==NULL )
 
5935
                d->sf->possub = fpst->next;
 
5936
            else
 
5937
                fprev->next = fpst->next;
 
5938
        }
 
5939
 
 
5940
        chunkfree(fpst,sizeof(FPST));
 
5941
    }
 
5942
}
 
5943
 
 
5944
void GFI_SMDEnd(struct gfi_data *d) {
 
5945
 
 
5946
    d->smd = NULL;
 
5947
}
 
5948
 
 
5949
void GFI_FinishSMNew(struct gfi_data *d,ASM *sm, int success, int isnew) {
 
5950
    OTLookup *otl;
 
5951
    struct lookup_subtable *sub, *prev;
 
5952
    ASM *smtest, *smprev;
 
5953
 
 
5954
    if ( !success && isnew ) {
 
5955
        /* We can't allow incomplete state machines floating around */
 
5956
        /* If they didn't fill it in, delete it */
 
5957
        otl = sm->subtable->lookup;
 
5958
        prev = NULL;
 
5959
        for ( sub=otl->subtables; sub!=NULL && sub!=sm->subtable; prev = sub, sub=sub->next );
 
5960
        if ( sub!=NULL ) {
 
5961
            if ( prev==NULL )
 
5962
                otl->subtables = sub->next;
 
5963
            else
 
5964
                prev->next = sub->next;
 
5965
            free(sub->subtable_name);
 
5966
            chunkfree(sub,sizeof(struct lookup_subtable));
 
5967
        }
 
5968
        smprev = NULL;
 
5969
        for ( smtest=d->sf->sm; smtest!=NULL && smtest!=sm; smprev = smtest, smtest=smtest->next );
 
5970
        if ( smtest!=NULL ) {
 
5971
            if ( smprev==NULL )
 
5972
                d->sf->sm = sm->next;
 
5973
            else
 
5974
                smprev->next = sm->next;
 
5975
        }
 
5976
        chunkfree(sm,sizeof(ASM));
 
5977
    }
 
5978
}
 
5979
 
 
5980
static void LookupSubtableContents(struct gfi_data *gfi,int isgpos) {
 
5981
    struct lkdata *lk = &gfi->tables[isgpos];
 
5982
    int i,j;
 
5983
 
 
5984
    for ( i=0; i<lk->cnt; ++i ) {
 
5985
        if ( lk->all[i].deleted )
 
5986
    continue;
 
5987
        if ( lk->all[i].open ) {
 
5988
            for ( j=0; j<lk->all[i].subtable_cnt; ++j ) {
 
5989
                if ( lk->all[i].subtables[j].deleted )
 
5990
            continue;
 
5991
                if ( lk->all[i].subtables[j].selected ) {
 
5992
                    _LookupSubtableContents(gfi->sf,lk->all[i].subtables[j].subtable,NULL);
 
5993
return;
 
5994
                }
 
5995
            }
 
5996
        }
 
5997
    }
 
5998
}
 
5999
 
 
6000
static int GFI_LookupEditSubtableContents(GGadget *g, GEvent *e) {
 
6001
 
 
6002
    if ( e->type==et_controlevent && e->u.control.subtype == et_buttonactivate ) {
 
6003
        struct gfi_data *gfi = GDrawGetUserData(GGadgetGetWindow(g));
 
6004
        int isgpos = GTabSetGetSel(GWidgetGetControl(gfi->gw,CID_Lookups));
 
6005
        LookupSubtableContents(gfi,isgpos);
 
6006
    }
 
6007
return( true );
 
6008
}
 
6009
 
 
6010
static int GFI_LookupAddLookup(GGadget *g, GEvent *e) {
 
6011
 
 
6012
    if ( e->type==et_controlevent && e->u.control.subtype == et_buttonactivate ) {
 
6013
        struct gfi_data *gfi = GDrawGetUserData(GGadgetGetWindow(g));
 
6014
        int isgpos = GTabSetGetSel(GWidgetGetControl(gfi->gw,CID_Lookups));
 
6015
        struct lkdata *lk = &gfi->tables[isgpos];
 
6016
        int i,j,k,lcnt;
 
6017
        OTLookup *otl = chunkalloc(sizeof(OTLookup));
 
6018
 
 
6019
        if ( !EditLookup(otl,isgpos,gfi->sf)) {
 
6020
            chunkfree(otl,sizeof(OTLookup));
 
6021
return( true );
 
6022
        }
 
6023
        for ( i=lk->cnt-1; i>=0; --i ) {
 
6024
            if ( !lk->all[i].deleted && lk->all[i].selected ) {
 
6025
                lk->all[i].selected = false;
 
6026
        break;
 
6027
            }
 
6028
            if ( !lk->all[i].deleted && lk->all[i].open ) {
 
6029
                for ( j=0; j<lk->all[i].subtable_cnt; ++j )
 
6030
                    if ( !lk->all[i].subtables[j].deleted &&
 
6031
                            lk->all[i].subtables[j].selected ) {
 
6032
                        lk->all[i].subtables[j].selected = false;
 
6033
                break;
 
6034
                    }
 
6035
                if ( j<lk->all[i].subtable_cnt )
 
6036
        break;
 
6037
            }
 
6038
        }
 
6039
        if ( lk->cnt>=lk->max )
 
6040
            lk->all = grealloc(lk->all,(lk->max+=10)*sizeof(struct lkinfo));
 
6041
        for ( k=lk->cnt; k>i+1; --k )
 
6042
            lk->all[k] = lk->all[k-1];
 
6043
        memset(&lk->all[k],0,sizeof(struct lkinfo));
 
6044
        lk->all[k].lookup = otl;
 
6045
        lk->all[k].new = true;
 
6046
        lk->all[k].selected = true;
 
6047
        ++lk->cnt;
 
6048
        if ( isgpos ) {
 
6049
            otl->next = gfi->sf->gpos_lookups;
 
6050
            gfi->sf->gpos_lookups = otl;
 
6051
        } else {
 
6052
            otl->next = gfi->sf->gsub_lookups;
 
6053
            gfi->sf->gsub_lookups = otl;
 
6054
        }
 
6055
 
 
6056
        /* Make sure the window is scrolled to display the new lookup */
 
6057
        lcnt=0;
 
6058
        for ( i=0; i<lk->cnt; ++i ) {
 
6059
            if ( lk->all[i].deleted )
 
6060
        continue;
 
6061
            if ( i==k )
 
6062
        break;
 
6063
            ++lcnt;
 
6064
            for ( j=0; j<lk->all[i].subtable_cnt; ++j ) {
 
6065
                if ( lk->all[i].subtables[j].deleted )
 
6066
            continue;
 
6067
                ++lcnt;
 
6068
            }
 
6069
        }
 
6070
        if ( lcnt<lk->off_top || lcnt>=lk->off_top+(gfi->lkheight-2*LK_MARGIN)/gfi->fh )
 
6071
            lk->off_top = lcnt;
 
6072
 
 
6073
        GFI_LookupScrollbars(gfi,isgpos, true);
 
6074
        GFI_LookupEnableButtons(gfi,isgpos);
 
6075
    }
 
6076
return( true );
 
6077
}
 
6078
 
 
6079
static int GFI_LookupAddSubtable(GGadget *g, GEvent *e) {
 
6080
 
 
6081
    if ( e->type==et_controlevent && e->u.control.subtype == et_buttonactivate ) {
 
6082
        struct gfi_data *gfi = GDrawGetUserData(GGadgetGetWindow(g));
 
6083
        int isgpos = GTabSetGetSel(GWidgetGetControl(gfi->gw,CID_Lookups));
 
6084
        struct lkdata *lk = &gfi->tables[isgpos];
 
6085
        int i,j,k,lcnt;
 
6086
        struct lookup_subtable *sub;
 
6087
 
 
6088
        lcnt = 0;
 
6089
        for ( i=0; i<lk->cnt; ++i ) {
 
6090
            if ( lk->all[i].deleted )
 
6091
        continue;
 
6092
            j = -1;
 
6093
            ++lcnt;
 
6094
            if ( lk->all[i].selected )
 
6095
        break;
 
6096
            for ( j=0; j<lk->all[i].subtable_cnt; ++j ) {
 
6097
                if ( lk->all[i].subtables[j].deleted )
 
6098
            continue;
 
6099
                ++lcnt;
 
6100
                if ( lk->all[i].subtables[j].selected )
 
6101
        goto break_2_loops;
 
6102
            }
 
6103
        }
 
6104
        break_2_loops:
 
6105
        if ( i==lk->cnt )
 
6106
return( true );
 
6107
 
 
6108
        sub = chunkalloc(sizeof(struct lookup_subtable));
 
6109
        sub->lookup = lk->all[i].lookup;
 
6110
        if ( !EditSubtable(sub,isgpos,gfi->sf,NULL)) {
 
6111
            chunkfree(sub,sizeof(struct lookup_subtable));
 
6112
return( true );
 
6113
        }
 
6114
        if ( lk->all[i].subtable_cnt>=lk->all[i].subtable_max )
 
6115
            lk->all[i].subtables = grealloc(lk->all[i].subtables,(lk->all[i].subtable_max+=10)*sizeof(struct lksubinfo));
 
6116
        for ( k=lk->all[i].subtable_cnt; k>j+1; --k )
 
6117
            lk->all[i].subtables[k] = lk->all[i].subtables[k-1];
 
6118
        memset(&lk->all[i].subtables[k],0,sizeof(struct lksubinfo));
 
6119
        lk->all[i].subtables[k].subtable = sub;
 
6120
        lk->all[i].subtables[k].new = true;
 
6121
        sub->next = lk->all[i].lookup->subtables;
 
6122
        lk->all[i].lookup->subtables = sub;
 
6123
        ++lk->all[i].subtable_cnt;
 
6124
 
 
6125
        /* Make sure the window is scrolled to display the new subtable */
 
6126
        if ( lcnt<lk->off_top || lcnt>=lk->off_top+(gfi->lkheight-2*LK_MARGIN)/gfi->fh )
 
6127
            lk->off_top = lcnt;
 
6128
 
 
6129
        GFI_LookupScrollbars(gfi,isgpos, true);
 
6130
        GFI_LookupEnableButtons(gfi,isgpos);
 
6131
    }
 
6132
return( true );
 
6133
}
 
6134
 
 
6135
static int GFI_LookupEditMetadata(GGadget *g, GEvent *e) {
 
6136
 
 
6137
    if ( e->type==et_controlevent && e->u.control.subtype == et_buttonactivate ) {
 
6138
        struct gfi_data *gfi = GDrawGetUserData(GGadgetGetWindow(g));
 
6139
        int isgpos = GTabSetGetSel(GWidgetGetControl(gfi->gw,CID_Lookups));
 
6140
        struct lkdata *lk = &gfi->tables[isgpos];
 
6141
        int i,j;
 
6142
 
 
6143
        for ( i=0; i<lk->cnt; ++i ) {
 
6144
            if ( lk->all[i].deleted )
 
6145
        continue;
 
6146
            if ( lk->all[i].selected ) {
 
6147
                EditLookup(lk->all[i].lookup,isgpos,gfi->sf);
 
6148
return( true );
 
6149
            } else if ( lk->all[i].open ) {
 
6150
                for ( j=0; j<lk->all[i].subtable_cnt; ++j ) {
 
6151
                    if ( lk->all[i].subtables[j].deleted )
 
6152
                continue;
 
6153
                    if ( lk->all[i].subtables[j].selected ) {
 
6154
                        EditSubtable(lk->all[i].subtables[j].subtable,isgpos,gfi->sf,NULL);
 
6155
return( true );
 
6156
                    }
 
6157
                }
 
6158
            }
 
6159
        }
 
6160
    }
 
6161
return( true );
 
6162
}
 
6163
 
 
6164
static int GFI_LookupMergeLookup(GGadget *g, GEvent *e) {
 
6165
 
 
6166
    if ( e->type==et_controlevent && e->u.control.subtype == et_buttonactivate ) {
 
6167
        struct gfi_data *gfi = GDrawGetUserData(GGadgetGetWindow(g));
 
6168
        char *buts[3];
 
6169
        int isgpos = GTabSetGetSel(GWidgetGetControl(gfi->gw,CID_Lookups));
 
6170
        struct lkdata *lk = &gfi->tables[isgpos];
 
6171
        struct selection_bits sel;
 
6172
        int i,j;
 
6173
        struct lkinfo *lkfirst;
 
6174
        struct lksubinfo *sbfirst;
 
6175
        struct lookup_subtable *sub;
 
6176
 
 
6177
        LookupParseSelection(lk,&sel);
 
6178
        if ( !sel.sub_table_mergeable && !sel.lookup_mergeable )
 
6179
return( true );
 
6180
        
 
6181
        buts[0] = _("Do it");
 
6182
        buts[1] = _("_Cancel");
 
6183
        buts[2] = NULL;
 
6184
        if ( gwwv_ask(_("Cannot be Undone"),(const char **) buts,0,1,_("The Merge operation cannot be reverted.\nDo it anyway?"))==1 )
 
6185
return( true );
 
6186
        if ( sel.lookup_mergeable ) {
 
6187
            lkfirst = NULL;
 
6188
            for ( i=0; i<lk->cnt; ++i ) {
 
6189
                if ( lk->all[i].selected && !lk->all[i].deleted ) {
 
6190
                    if ( lkfirst==NULL )
 
6191
                        lkfirst = &lk->all[i];
 
6192
                    else {
 
6193
                        FLMerge(lkfirst->lookup,lk->all[i].lookup);
 
6194
                        if ( lkfirst->subtable_cnt+lk->all[i].subtable_cnt >= lkfirst->subtable_max )
 
6195
                            lkfirst->subtables = grealloc(lkfirst->subtables,(lkfirst->subtable_max+=lk->all[i].subtable_cnt)*sizeof(struct lksubinfo));
 
6196
                        memcpy(lkfirst->subtables+lkfirst->subtable_cnt,
 
6197
                                lk->all[i].subtables,lk->all[i].subtable_cnt*sizeof(struct lksubinfo));
 
6198
                        lkfirst->subtable_cnt += lk->all[i].subtable_cnt;
 
6199
                        for ( j=0; j<lk->all[i].subtable_cnt; ++j )
 
6200
                            lk->all[i].subtables[j].subtable->lookup = lkfirst->lookup;
 
6201
                        if ( lk->all[i].lookup->subtables!=NULL ) {
 
6202
                            for ( sub = lk->all[i].lookup->subtables; sub->next!=NULL; sub = sub->next );
 
6203
                            sub->next = lkfirst->lookup->subtables;
 
6204
                            lkfirst->lookup->subtables = lk->all[i].lookup->subtables;
 
6205
                            lk->all[i].lookup->subtables = NULL;
 
6206
                        }
 
6207
                        lk->all[i].subtable_cnt = 0;
 
6208
                        lk->all[i].deleted = true;
 
6209
                        lk->all[i].open = false;
 
6210
                        lk->all[i].selected = false;
 
6211
                    }
 
6212
                }
 
6213
            }
 
6214
        } else if ( sel.sub_table_mergeable ) {
 
6215
            sbfirst = NULL;
 
6216
            for ( i=0; i<lk->cnt; ++i ) if ( !lk->all[i].deleted && lk->all[i].open ) {
 
6217
                for ( j=0; j<lk->all[i].subtable_cnt; ++j ) if ( !lk->all[i].subtables[j].deleted ) {
 
6218
                    if ( lk->all[i].subtables[j].selected ) {
 
6219
                        if ( sbfirst == NULL )
 
6220
                            sbfirst = &lk->all[i].subtables[j];
 
6221
                        else {
 
6222
                            SFSubTablesMerge(gfi->sf,sbfirst->subtable,lk->all[i].subtables[j].subtable);
 
6223
                            lk->all[i].subtables[j].deleted = true;
 
6224
                            lk->all[i].subtables[j].selected = false;
 
6225
                        }
 
6226
                    }
 
6227
                }
 
6228
                if ( sbfirst!=NULL )    /* Can only merge subtables within a lookup, so if we found anything, in a lookup that's everything */
 
6229
            break;
 
6230
            }
 
6231
        }
 
6232
        GFI_LookupScrollbars(gfi,isgpos, true);
 
6233
        GFI_LookupEnableButtons(gfi,isgpos);
 
6234
    }
 
6235
return( true );
 
6236
}
 
6237
 
 
6238
static int GFI_LookupDeleteLookup(GGadget *g, GEvent *e) {
 
6239
 
 
6240
    if ( e->type==et_controlevent && e->u.control.subtype == et_buttonactivate ) {
 
6241
        struct gfi_data *gfi = GDrawGetUserData(GGadgetGetWindow(g));
 
6242
        int isgpos = GTabSetGetSel(GWidgetGetControl(gfi->gw,CID_Lookups));
 
6243
        struct lkdata *lk = &gfi->tables[isgpos];
 
6244
        int i,j;
 
6245
 
 
6246
        for ( i=0; i<lk->cnt; ++i ) {
 
6247
            if ( lk->all[i].deleted )
 
6248
        continue;
 
6249
            if ( lk->all[i].selected )
 
6250
                lk->all[i].deleted = true;
 
6251
            else if ( lk->all[i].open ) {
 
6252
                for ( j=0; j<lk->all[i].subtable_cnt; ++j ) {
 
6253
                    if ( lk->all[i].subtables[j].deleted )
 
6254
                continue;
 
6255
                    if ( lk->all[i].subtables[j].selected )
 
6256
                        lk->all[i].subtables[j].deleted = true;
 
6257
                }
 
6258
            }
 
6259
        }
 
6260
 
 
6261
        GFI_LookupScrollbars(gfi,isgpos, true);
 
6262
        GFI_LookupEnableButtons(gfi,isgpos);
 
6263
    }
 
6264
 
 
6265
return( true );
 
6266
}
 
6267
 
 
6268
static int GFI_LookupRevertLookup(GGadget *g, GEvent *e) {
 
6269
 
 
6270
    if ( e->type==et_controlevent && e->u.control.subtype == et_buttonactivate ) {
 
6271
        struct gfi_data *gfi = GDrawGetUserData(GGadgetGetWindow(g));
 
6272
        int isgpos = GTabSetGetSel(GWidgetGetControl(gfi->gw,CID_Lookups));
 
6273
        struct lkdata *lk = &gfi->tables[isgpos];
 
6274
        int i,j;
 
6275
 
 
6276
        /* First remove any new lookups, subtables */
 
6277
        for ( i=0; i<lk->cnt; ++i ) {
 
6278
            if ( lk->all[i].new )
 
6279
                SFRemoveLookup(gfi->sf,lk->all[i].lookup);
 
6280
            else {
 
6281
                for ( j=0; j<lk->all[i].subtable_cnt; ++j )
 
6282
                    if ( lk->all[i].subtables[j].new )
 
6283
                        SFRemoveLookupSubTable(gfi->sf,lk->all[i].subtables[j].subtable);
 
6284
            }
 
6285
        }
 
6286
 
 
6287
        /* Now since we didn't actually delete anything we don't need to do */
 
6288
        /*  anything to resurrect them */
 
6289
 
 
6290
        /* Finally we need to restore the original order. */
 
6291
        /* But that just means regenerating the lk structure. So free it and */
 
6292
        /*  regenerate it */
 
6293
 
 
6294
        LookupInfoFree(lk);
 
6295
        LookupSetup(lk,isgpos?gfi->sf->gpos_lookups:gfi->sf->gsub_lookups);
 
6296
 
 
6297
        GFI_LookupScrollbars(gfi,isgpos, true);
 
6298
        GFI_LookupEnableButtons(gfi,isgpos);
 
6299
    }
 
6300
return( true );
 
6301
}
 
6302
 
 
6303
static int import_e_h(GWindow gw, GEvent *event) {
 
6304
    int *done = GDrawGetUserData(gw);
 
6305
 
 
6306
    if ( event->type==et_close ) {
 
6307
        *done = true;
 
6308
    } else if ( event->type==et_char ) {
 
6309
        if ( event->u.chr.keysym == GK_F1 || event->u.chr.keysym == GK_Help ) {
 
6310
            help("fontinfo.html#Lookups");
 
6311
return( true );
 
6312
        }
 
6313
return( false );
 
6314
    } else if ( event->type==et_controlevent && event->u.control.subtype == et_buttonactivate ) {
 
6315
        switch ( GGadgetGetCid(event->u.control.g)) {
 
6316
          case CID_OK:
 
6317
            *done = 2;
 
6318
          break;
 
6319
          case CID_Cancel:
 
6320
            *done = true;
 
6321
          break;
 
6322
        }
 
6323
    }
 
6324
return( true );
 
6325
}
 
6326
 
 
6327
static int GFI_LookupImportLookup(GGadget *g, GEvent *e) {
 
6328
 
 
6329
    if ( e->type==et_controlevent && e->u.control.subtype == et_buttonactivate ) {
 
6330
        struct gfi_data *gfi = GDrawGetUserData(GGadgetGetWindow(g));
 
6331
        int isgpos = GTabSetGetSel(GWidgetGetControl(gfi->gw,CID_Lookups));
 
6332
        FontView *ofv;
 
6333
        SplineFont *osf;
 
6334
        OTLookup *otl;
 
6335
        int i, j, cnt;
 
6336
        GTextInfo *ti;
 
6337
        GGadgetCreateData gcd[7], *varray[8], *harray[7];
 
6338
        GTextInfo label[7];
 
6339
        GWindowAttrs wattrs;
 
6340
        GRect pos;
 
6341
        GWindow gw;
 
6342
        int done = 0;
 
6343
 
 
6344
        /* Figure out what lookups can be imported from which (open) fonts */
 
6345
        ti = NULL;
 
6346
        for ( j=0; j<2; ++j ) {
 
6347
            for ( ofv=fv_list; ofv!=NULL; ofv=ofv->next ) {
 
6348
                osf = ofv->sf;
 
6349
                if ( osf->cidmaster ) osf = osf->cidmaster;
 
6350
                osf->ticked = false;
 
6351
            }
 
6352
            cnt = 0;
 
6353
            for ( ofv=fv_list; ofv!=NULL; ofv=ofv->next ) {
 
6354
                osf = ofv->sf;
 
6355
                if ( osf->cidmaster ) osf = osf->cidmaster;
 
6356
                if ( osf->ticked || osf==gfi->sf || osf==gfi->sf->cidmaster ||
 
6357
                        ( isgpos && osf->gpos_lookups==NULL) ||
 
6358
                        (!isgpos && osf->gsub_lookups==NULL) )
 
6359
            continue;
 
6360
                osf->ticked = true;
 
6361
                if ( cnt!=0 ) {
 
6362
                    if ( ti )
 
6363
                        ti[cnt].line = true;
 
6364
                    ++cnt;
 
6365
                }
 
6366
                if ( ti ) {
 
6367
                    ti[cnt].text = (unichar_t *) copy( osf->fontname );
 
6368
                    ti[cnt].text_is_1byte = true;
 
6369
                    ti[cnt].disabled = true;
 
6370
                    ti[cnt].userdata = osf;
 
6371
                }
 
6372
                ++cnt;
 
6373
                for ( otl = isgpos ? osf->gpos_lookups : osf->gsub_lookups; otl!=NULL; otl=otl->next ) {
 
6374
                    if ( ti ) {
 
6375
                        ti[cnt].text = (unichar_t *) strconcat( " ", otl->lookup_name );
 
6376
                        ti[cnt].text_is_1byte = true;
 
6377
                        ti[cnt].userdata = otl;
 
6378
                    }
 
6379
                    ++cnt;
 
6380
                }
 
6381
            }
 
6382
            if ( ti==NULL )
 
6383
                ti = gcalloc((cnt+1),sizeof(GTextInfo));
 
6384
        }
 
6385
 
 
6386
        memset(gcd,0,sizeof(gcd));
 
6387
        memset(label,0,sizeof(label));
 
6388
 
 
6389
        i = 0;
 
6390
        label[i].text = (unichar_t *) _("Select lookups from other fonts");
 
6391
        label[i].text_is_1byte = true;
 
6392
        label[i].text_in_resource = true;
 
6393
        gcd[i].gd.label = &label[i];
 
6394
        gcd[i].gd.pos.x = 12; gcd[i].gd.pos.y = 6+6; 
 
6395
        gcd[i].gd.flags = gg_visible | gg_enabled;
 
6396
        gcd[i].creator = GLabelCreate;
 
6397
        varray[0] = &gcd[i++]; varray[1] = NULL;
 
6398
 
 
6399
        gcd[i].gd.pos.height = 12*12+6;
 
6400
        gcd[i].gd.flags = gg_enabled|gg_visible|gg_list_multiplesel|gg_utf8_popup;
 
6401
        gcd[i].gd.u.list = ti;
 
6402
        gcd[i].creator = GListCreate;
 
6403
        varray[2] = &gcd[i++]; varray[3] = NULL;
 
6404
 
 
6405
        gcd[i].gd.flags = gg_visible | gg_enabled | gg_but_default;
 
6406
        label[i].text = (unichar_t *) _("_Import");
 
6407
        label[i].text_is_1byte = true;
 
6408
        label[i].text_in_resource = true;
 
6409
        gcd[i].gd.label = &label[i];
 
6410
        gcd[i].gd.cid = CID_OK;
 
6411
        harray[0] = GCD_Glue; harray[1] = &gcd[i]; harray[2] = GCD_Glue;
 
6412
        gcd[i++].creator = GButtonCreate;
 
6413
 
 
6414
        gcd[i].gd.flags = gg_visible | gg_enabled | gg_but_cancel;
 
6415
        label[i].text = (unichar_t *) _("_Cancel");
 
6416
        label[i].text_is_1byte = true;
 
6417
        label[i].text_in_resource = true;
 
6418
        gcd[i].gd.label = &label[i];
 
6419
        gcd[i].gd.cid = CID_Cancel;
 
6420
        harray[3] = GCD_Glue; harray[4] = &gcd[i]; harray[5] = GCD_Glue; harray[6] = NULL;
 
6421
        gcd[i++].creator = GButtonCreate;
 
6422
 
 
6423
        gcd[i].gd.flags = gg_enabled|gg_visible;
 
6424
        gcd[i].gd.u.boxelements = harray;
 
6425
        gcd[i].creator = GHBoxCreate;
 
6426
        varray[4] = &gcd[i++]; varray[5] = NULL; varray[6] = NULL;
 
6427
 
 
6428
        gcd[i].gd.pos.x = gcd[i].gd.pos.y = 2;
 
6429
        gcd[i].gd.flags = gg_enabled|gg_visible;
 
6430
        gcd[i].gd.u.boxelements = varray;
 
6431
        gcd[i].creator = GHVGroupCreate;
 
6432
 
 
6433
        memset(&wattrs,0,sizeof(wattrs));
 
6434
        wattrs.mask = wam_events|wam_cursor|wam_utf8_wtitle|wam_undercursor|wam_isdlg|wam_restrict;
 
6435
        wattrs.event_masks = ~(1<<et_charup);
 
6436
        wattrs.restrict_input_to_me = 1;
 
6437
        wattrs.undercursor = 1;
 
6438
        wattrs.cursor = ct_pointer;
 
6439
        wattrs.utf8_window_title =  _("Import Lookup...");
 
6440
        wattrs.is_dlg = true;
 
6441
        pos.x = pos.y = 0;
 
6442
        pos.width = GGadgetScale(GDrawPointsToPixels(NULL,150));
 
6443
        pos.height = GDrawPointsToPixels(NULL,193);
 
6444
        gw = GDrawCreateTopWindow(NULL,&pos,import_e_h,&done,&wattrs);
 
6445
 
 
6446
        GGadgetsCreate(gw,&gcd[i]);
 
6447
        GHVBoxSetExpandableRow(gcd[i].ret,1);
 
6448
        GHVBoxSetExpandableCol(gcd[i-1].ret,gb_expandgluesame);
 
6449
        GHVBoxFitWindow(gcd[i].ret);
 
6450
        GTextInfoListFree(ti);
 
6451
        GDrawSetVisible(gw,true);
 
6452
 
 
6453
        while ( !done )
 
6454
            GDrawProcessOneEvent(NULL);
 
6455
        if ( done==2 ) {
 
6456
            int32 len;
 
6457
            GTextInfo **ti = GGadgetGetList(gcd[1].ret,&len);
 
6458
            osf = NULL;
 
6459
            for ( i=0; i<len; ++i ) {
 
6460
                if ( ti[i]->disabled )
 
6461
                    osf = ti[i]->userdata;
 
6462
                else if ( ti[i]->selected && ti[i]->text!=NULL )
 
6463
                    OTLookupCopyInto(gfi->sf,osf,(OTLookup *) ti[i]->userdata);
 
6464
            }
 
6465
        }
 
6466
        GDrawDestroyWindow(gw);
 
6467
 
 
6468
        GFI_LookupScrollbars(gfi,isgpos, true);
 
6469
        GFI_LookupEnableButtons(gfi,isgpos);
 
6470
    }
 
6471
return( true );
 
6472
}
 
6473
 
 
6474
static int GFI_LookupAspectChange(GGadget *g, GEvent *e) {
 
6475
 
 
6476
    if ( e->type==et_controlevent && e->u.control.subtype == et_radiochanged ) {
 
6477
        struct gfi_data *gfi = GDrawGetUserData(GGadgetGetWindow(g));
 
6478
        int isgpos = GTabSetGetSel(GWidgetGetControl(gfi->gw,CID_Lookups));
 
6479
        GFI_LookupEnableButtons(gfi,isgpos);
 
6480
    }
 
6481
return( true );
 
6482
}
 
6483
 
 
6484
static void LookupExpose(GWindow pixmap, struct gfi_data *gfi, int isgpos) {
 
6485
    int lcnt, i,j;
 
6486
    struct lkdata *lk = &gfi->tables[isgpos];
 
6487
    GRect r, old;
 
6488
 
 
6489
    r.x = LK_MARGIN; r.width = gfi->lkwidth-2*LK_MARGIN;
 
6490
    r.y = LK_MARGIN; r.height = gfi->lkheight-2*LK_MARGIN;
 
6491
    GDrawPushClip(pixmap,&r,&old);
 
6492
    GDrawSetFont(pixmap,gfi->font);
 
6493
 
 
6494
    lcnt = 0;
 
6495
    for ( i=0; i<lk->cnt; ++i ) {
 
6496
        if ( lk->all[i].deleted )
 
6497
    continue;
 
6498
        if ( lcnt>=lk->off_top ) {
 
6499
            if ( lk->all[i].selected ) {
 
6500
                r.x = LK_MARGIN; r.width = gfi->lkwidth-2*LK_MARGIN;
 
6501
                r.y = (lcnt-lk->off_top)*gfi->fh; r.height = gfi->fh;
 
6502
                GDrawFillRect(pixmap,&r,0xffff00);
 
6503
            }
 
6504
            r.x = LK_MARGIN-lk->off_left; r.width = (gfi->as&~1);
 
6505
            r.y = LK_MARGIN+(lcnt-lk->off_top)*gfi->fh; r.height = r.width;
 
6506
            GDrawDrawRect(pixmap,&r,0x000000);
 
6507
            GDrawDrawLine(pixmap,r.x+2,r.y+(r.height/2), r.x+r.width-2,r.y+(r.height/2), 0x000000);
 
6508
            if ( !lk->all[i].open )
 
6509
                GDrawDrawLine(pixmap,r.x+(r.width/2),r.y+2, r.x+(r.width/2),r.y+r.height-2, 0x000000);
 
6510
            GDrawDrawText8(pixmap,r.x+gfi->fh, r.y+gfi->as,
 
6511
                    lk->all[i].lookup->lookup_name,-1,NULL,0x000000);
 
6512
        }
 
6513
        ++lcnt;
 
6514
        if ( lk->all[i].open ) {
 
6515
            for ( j=0; j<lk->all[i].subtable_cnt; ++j ) {
 
6516
                if ( lk->all[i].subtables[j].deleted )
 
6517
            continue;
 
6518
                if ( lcnt>=lk->off_top ) {
 
6519
                    if ( lk->all[i].subtables[j].selected ) {
 
6520
                        r.x = LK_MARGIN; r.width = gfi->lkwidth-2*LK_MARGIN;
 
6521
                        r.y = LK_MARGIN+(lcnt-lk->off_top)*gfi->fh; r.height = gfi->fh;
 
6522
                        GDrawFillRect(pixmap,&r,0xffff00);
 
6523
                    }
 
6524
                    r.x = LK_MARGIN+2*gfi->fh-lk->off_left;
 
6525
                    r.y = LK_MARGIN+(lcnt-lk->off_top)*gfi->fh;
 
6526
                    GDrawDrawText8(pixmap,r.x, r.y+gfi->as,
 
6527
                            lk->all[i].subtables[j].subtable->subtable_name,-1,NULL,0x000000);
 
6528
                }
 
6529
                ++lcnt;
 
6530
            }
 
6531
        }
 
6532
    }
 
6533
    GDrawPopClip(pixmap,&old);
 
6534
}
 
6535
 
 
6536
static void LookupDeselect(struct lkdata *lk) {
 
6537
    int i,j;
 
6538
 
 
6539
    for ( i=0; i<lk->cnt; ++i ) {
 
6540
        lk->all[i].selected = false;
 
6541
        for ( j=0; j<lk->all[i].subtable_cnt; ++j )
 
6542
            lk->all[i].subtables[j].selected = false;
 
6543
    }
 
6544
}
 
6545
 
 
6546
static void LookupPopup(GWindow gw,OTLookup *otl,struct lookup_subtable *sub) {
 
6547
    extern char *lookup_type_names[2][10];
 
6548
    static char popup_msg[300];
 
6549
    int pos;
 
6550
    char *lookuptype;
 
6551
    FeatureScriptLangList *fl;
 
6552
    struct scriptlanglist *sl;
 
6553
    int l;
 
6554
 
 
6555
    if ( (otl->lookup_type&0xff)>= 0xf0 ) {
 
6556
        if ( otl->lookup_type==kern_statemachine )
 
6557
            lookuptype = _("Kerning State Machine");
 
6558
        else if ( otl->lookup_type==morx_indic )
 
6559
            lookuptype = _("Indic State Machine");
 
6560
        else if ( otl->lookup_type==morx_context )
 
6561
            lookuptype = _("Contextual State Machine");
 
6562
        else
 
6563
            lookuptype = _("Contextual State Machine");
 
6564
    } else if ( (otl->lookup_type>>8)<2 && (otl->lookup_type&0xff)<10 )
 
6565
        lookuptype = _(lookup_type_names[otl->lookup_type>>8][otl->lookup_type&0xff]);
 
6566
    else
 
6567
        lookuptype = S_("LookupType|Unknown");
 
6568
    snprintf(popup_msg,sizeof(popup_msg), "%s\n", lookuptype);
 
6569
    pos = strlen(popup_msg);
 
6570
 
 
6571
    if ( sub!=NULL && otl->lookup_type==gpos_pair && sub->kc!=NULL ) {
 
6572
        snprintf(popup_msg+pos,sizeof(popup_msg)-pos,_("(kerning class)\n") );
 
6573
        pos += strlen( popup_msg+pos );
 
6574
    }
 
6575
 
 
6576
    if ( otl->features==NULL )
 
6577
        snprintf(popup_msg+pos,sizeof(popup_msg)-pos,_("Not attached to a feature"));
 
6578
    else {
 
6579
        for ( fl=otl->features; fl!=NULL && pos<sizeof(popup_msg)-2; fl=fl->next ) {
 
6580
            snprintf(popup_msg+pos,sizeof(popup_msg)-pos,"%c%c%c%c: ",
 
6581
                    fl->featuretag>>24, fl->featuretag>>16,
 
6582
                    fl->featuretag>>8, fl->featuretag&0xff );
 
6583
            pos += strlen( popup_msg+pos );
 
6584
            for ( sl=fl->scripts; sl!=NULL; sl=sl->next ) {
 
6585
                snprintf(popup_msg+pos,sizeof(popup_msg)-pos,"%c%c%c%c{",
 
6586
                        sl->script>>24, sl->script>>16,
 
6587
                        sl->script>>8, sl->script&0xff );
 
6588
                pos += strlen( popup_msg+pos );
 
6589
                for ( l=0; l<sl->lang_cnt; ++l ) {
 
6590
                    uint32 lang = l<MAX_LANG ? sl->langs[l] : sl->morelangs[l-MAX_LANG];
 
6591
                    snprintf(popup_msg+pos,sizeof(popup_msg)-pos,"%c%c%c%c,",
 
6592
                            lang>>24, lang>>16,
 
6593
                            lang>>8, lang&0xff );
 
6594
                    pos += strlen( popup_msg+pos );
 
6595
                }
 
6596
                if ( popup_msg[pos-1]==',' )
 
6597
                    popup_msg[pos-1] = '}';
 
6598
                else if ( pos<sizeof(popup_msg)-2 )
 
6599
                    popup_msg[pos++] = '}';
 
6600
                if ( pos<sizeof(popup_msg)-2 )
 
6601
                    popup_msg[pos++] = ' ';
 
6602
            }
 
6603
            if ( pos<sizeof(popup_msg)-2 )
 
6604
                popup_msg[pos++] = '\n';
 
6605
        }
 
6606
    }
 
6607
    if ( pos>=sizeof(popup_msg) )
 
6608
        pos = sizeof(popup_msg)-1;
 
6609
    popup_msg[pos]='\0';
 
6610
    GGadgetPreparePopup8(gw,popup_msg);
 
6611
}
 
6612
 
 
6613
static void AddDFLT(OTLookup *otl) {
 
6614
    FeatureScriptLangList *fl;
 
6615
    struct scriptlanglist *sl;
 
6616
    int l;
 
6617
 
 
6618
    for ( fl = otl->features; fl!=NULL; fl=fl->next ) {
 
6619
        int hasDFLT = false, hasdflt=false;
 
6620
        for ( sl=fl->scripts; sl!=NULL; sl=sl->next ) {
 
6621
            if ( sl->script == DEFAULT_SCRIPT )
 
6622
                hasDFLT = true;
 
6623
            for ( l=0; l<sl->lang_cnt; ++l ) {
 
6624
                uint32 lang = l<MAX_LANG ? sl->langs[l] : sl->morelangs[l-MAX_LANG];
 
6625
                if ( lang==DEFAULT_LANG ) {
 
6626
                    hasdflt = true;
 
6627
            break;
 
6628
                }
 
6629
            }
 
6630
            if ( hasdflt && hasDFLT )
 
6631
        break;
 
6632
        }
 
6633
        if ( hasDFLT    /* Already there */ ||
 
6634
                !hasdflt /* Shouldn't add it */ )
 
6635
    continue;
 
6636
        sl = chunkalloc(sizeof(struct scriptlanglist));
 
6637
        sl->script = DEFAULT_SCRIPT;
 
6638
        sl->lang_cnt = 1;
 
6639
        sl->langs[0] = DEFAULT_LANG;
 
6640
        sl->next = fl->scripts;
 
6641
        fl->scripts = sl;
 
6642
    }
 
6643
}
 
6644
 
 
6645
static void AALTRemoveOld(SplineFont *sf,struct lkdata *lk) {
 
6646
    int i;
 
6647
    FeatureScriptLangList *fl, *prev;
 
6648
 
 
6649
    for ( i=0; i<lk->cnt; ++i ) {
 
6650
        if ( lk->all[i].deleted )
 
6651
    continue;
 
6652
        prev = NULL;
 
6653
        for ( fl = lk->all[i].lookup->features; fl!=NULL; prev=fl, fl=fl->next ) {
 
6654
            if ( fl->featuretag==CHR('a','a','l','t') ) {
 
6655
                if ( fl==lk->all[i].lookup->features && fl->next==NULL )
 
6656
                    lk->all[i].deleted = true;
 
6657
                else {
 
6658
                    if ( prev==NULL )
 
6659
                        lk->all[i].lookup->features = fl->next;
 
6660
                    else
 
6661
                        prev->next = fl->next;
 
6662
                    fl->next = NULL;
 
6663
                    FeatureScriptLangListFree(fl);
 
6664
                }
 
6665
        break;
 
6666
            }
 
6667
        }
 
6668
    }
 
6669
}
 
6670
 
 
6671
                
 
6672
struct sllk { uint32 script; int cnt, max; OTLookup **lookups; int lcnt, lmax; uint32 *langs; };
 
6673
 
 
6674
static void AddOTLToSllk(struct sllk *sllk, OTLookup *otl, struct scriptlanglist *sl) {
 
6675
    int i,j,k,l;
 
6676
 
 
6677
    if ( otl->lookup_type==gsub_single || otl->lookup_type==gsub_alternate ) {
 
6678
        for ( i=0; i<sllk->cnt; ++i )
 
6679
            if ( sllk->lookups[i]==otl )
 
6680
        break;
 
6681
        if ( i==sllk->cnt ) {
 
6682
            if ( sllk->cnt>=sllk->max )
 
6683
                sllk->lookups = grealloc(sllk->lookups,(sllk->max+=5)*sizeof(OTLookup *));
 
6684
            sllk->lookups[sllk->cnt++] = otl;
 
6685
            for ( l=0; l<sl->lang_cnt; ++l ) {
 
6686
                uint32 lang = l<MAX_LANG ? sl->langs[l] : sl->morelangs[l-MAX_LANG];
 
6687
                for ( j=0; j<sllk->lcnt; ++j )
 
6688
                    if ( sllk->langs[j]==lang )
 
6689
                break;
 
6690
                if ( j==sllk->lcnt ) {
 
6691
                    if ( sllk->lcnt>=sllk->lmax )
 
6692
                        sllk->langs = grealloc(sllk->langs,(sllk->lmax+=sl->lang_cnt+MAX_LANG)*sizeof(uint32));
 
6693
                    sllk->langs[sllk->lcnt++] = lang;
 
6694
                }
 
6695
            }
 
6696
        }
 
6697
    } else if ( otl->lookup_type==gsub_context || otl->lookup_type==gsub_contextchain ) {
 
6698
        struct lookup_subtable *sub;
 
6699
        for ( sub=otl->subtables; sub!=NULL; sub=sub->next ) {
 
6700
            FPST *fpst = sub->fpst;
 
6701
            for ( j=0; j<fpst->rule_cnt; ++j ) {
 
6702
                struct fpst_rule *r = &fpst->rules[j];
 
6703
                for ( k=0; k<r->lookup_cnt; ++k )
 
6704
                    AddOTLToSllk(sllk,r->lookups[k].lookup,sl);
 
6705
            }
 
6706
        }
 
6707
    }
 
6708
    /* reverse contextual chaining is weird and I shall ignore it. Adobe does too*/
 
6709
}
 
6710
 
 
6711
static char *ComponentsFromPSTs(PST **psts,int pcnt) {
 
6712
    char **names=NULL;
 
6713
    int ncnt=0, nmax=0;
 
6714
    int i,j,len;
 
6715
    char *ret;
 
6716
 
 
6717
    /* First find all the names */
 
6718
    for ( i=0; i<pcnt; ++i ) {
 
6719
        char *nlist = psts[i]->u.alt.components;
 
6720
        char *start, *pt, ch;
 
6721
 
 
6722
        for ( start = nlist; ; ) {
 
6723
            while ( *start==' ' )
 
6724
                ++start;
 
6725
            if ( *start=='\0' )
 
6726
        break;
 
6727
            for ( pt=start; *pt!=' ' && *pt!='\0'; ++pt );
 
6728
            ch = *pt; *pt = '\0';
 
6729
            for ( j=0; j<ncnt; ++j )
 
6730
                if ( strcmp( start,names[j])==0 )
 
6731
            break;
 
6732
            if ( j==ncnt ) {
 
6733
                if ( ncnt>=nmax )
 
6734
                    names = grealloc(names,(nmax+=10)*sizeof(char *));
 
6735
                names[ncnt++] = copy(start);
 
6736
            }
 
6737
            *pt = ch;
 
6738
            start = pt;
 
6739
        }
 
6740
    }
 
6741
 
 
6742
    len = 0;
 
6743
    for ( i=0; i<ncnt; ++i )
 
6744
        len += strlen(names[i])+1;
 
6745
    if ( len==0 ) len=1;
 
6746
    ret = galloc(len);
 
6747
    len = 0;
 
6748
    for ( i=0; i<ncnt; ++i ) {
 
6749
        strcpy(ret+len,names[i]);
 
6750
        len += strlen(names[i]);
 
6751
        ret[len++] = ' ';
 
6752
    }
 
6753
    if ( len==0 )
 
6754
        *ret = '\0';
 
6755
    else
 
6756
        ret[len-1] = '\0';
 
6757
 
 
6758
    for ( i=0; i<ncnt; ++i )
 
6759
        free(names[i]);
 
6760
    free(names);
 
6761
return( ret );
 
6762
}
 
6763
 
 
6764
static int SllkMatch(struct sllk *sllk,int s1,int s2) {
 
6765
    int i;
 
6766
 
 
6767
    if ( sllk[s1].cnt != sllk[s2].cnt )
 
6768
return( false );
 
6769
 
 
6770
    for ( i=0; i<sllk[s1].cnt; ++i ) {
 
6771
        if ( sllk[s1].lookups[i] != sllk[s2].lookups[i] )
 
6772
return( false );
 
6773
    }
 
6774
 
 
6775
return( true );
 
6776
}
 
6777
 
 
6778
static void AALTCreateNew(SplineFont *sf, struct lkdata *lk) {
 
6779
    /* different script/lang combinations may need different 'aalt' lookups */
 
6780
    /*  well, let's just say different script combinations */
 
6781
    /* for each script/lang combo find all single/alternate subs for each */
 
6782
    /*  glyph. Merge those choices and create new lookup with that info */
 
6783
    struct sllk *sllk = NULL;
 
6784
    int sllk_cnt=0, sllk_max = 0;
 
6785
    int i,s;
 
6786
    OTLookup *otl;
 
6787
    struct lookup_subtable *sub;
 
6788
    PST **psts, *pst;
 
6789
    FeatureScriptLangList *fl;
 
6790
    struct scriptlanglist *sl;
 
6791
    int l,k,j,gid,pcnt;
 
6792
    SplineFont *_sf;
 
6793
    SplineChar *sc;
 
6794
 
 
6795
    /* Find all scripts, and all the single/alternate lookups for each */
 
6796
    /*  and all the languages used for these in each script */
 
6797
    for ( i=0; i<lk->cnt; ++i ) {
 
6798
        otl = lk->all[i].lookup;
 
6799
        for ( fl=otl->features; fl!=NULL; fl=fl->next )
 
6800
            for ( sl=fl->scripts; sl!=NULL; sl=sl->next ) {
 
6801
                for ( s=0; s<sllk_cnt; ++s )
 
6802
                    if ( sl->script == sllk[s].script )
 
6803
                break;
 
6804
                if ( s==sllk_cnt ) {
 
6805
                    if ( sllk_cnt>=sllk_max )
 
6806
                        sllk = grealloc(sllk,(sllk_max+=10)*sizeof(struct sllk));
 
6807
                    memset(&sllk[sllk_cnt],0,sizeof(struct sllk));
 
6808
                    sllk[sllk_cnt++].script = sl->script;
 
6809
                }
 
6810
                AddOTLToSllk(&sllk[s], otl,sl);
 
6811
            }
 
6812
    }
 
6813
    /* Each of these gets its own gsub_alternate lookup which gets inserted */
 
6814
    /*  at the head of the lookup list. Each lookup has one subtable */
 
6815
    for ( i=0; i<sllk_cnt; ++i ) {
 
6816
        if ( sllk[i].cnt==0 )           /* Script used, but provides no alternates */
 
6817
    continue;
 
6818
        /* Make the new lookup (and all its supporting data structures) */
 
6819
        otl = chunkalloc(sizeof(OTLookup));
 
6820
        otl->lookup_type = gsub_alternate;
 
6821
        otl->lookup_flags = sllk[i].lookups[0]->lookup_flags & pst_r2l;
 
6822
        otl->features = fl = chunkalloc(sizeof(FeatureScriptLangList));
 
6823
        fl->featuretag = CHR('a','a','l','t');
 
6824
        /* Any other scripts with the same lookup set? */
 
6825
        for ( j=i; j<sllk_cnt; ++j ) {
 
6826
            if ( i==j || SllkMatch(sllk,i,j)) {
 
6827
                sl = chunkalloc(sizeof(struct scriptlanglist));
 
6828
                sl->next = fl->scripts;
 
6829
                fl->scripts = sl;
 
6830
                sl->script = sllk[j].script;
 
6831
                sl->lang_cnt = sllk[j].lcnt;
 
6832
                if ( sl->lang_cnt>MAX_LANG )
 
6833
                    sl->morelangs = galloc((sl->lang_cnt-MAX_LANG)*sizeof(uint32));
 
6834
                for ( l=0; l<sl->lang_cnt; ++l )
 
6835
                    if ( l<MAX_LANG )
 
6836
                        sl->langs[l] = sllk[j].langs[l];
 
6837
                    else
 
6838
                        sl->morelangs[l-MAX_LANG] = sllk[j].langs[l];
 
6839
                if ( i!=j ) sllk[j].cnt = 0;    /* Mark as processed */
 
6840
            }
 
6841
        }
 
6842
        otl->subtables = sub = chunkalloc(sizeof(struct lookup_subtable));
 
6843
        sub->lookup = otl;
 
6844
        sub->per_glyph_pst_or_kern = true;
 
6845
 
 
6846
        /* Add it to the various lists it needs to be in */
 
6847
        if ( lk->cnt>=lk->max )
 
6848
            lk->all = grealloc(lk->all,(lk->max+=10)*sizeof(struct lkinfo));
 
6849
        for ( k=lk->cnt; k>0; --k )
 
6850
            lk->all[k] = lk->all[k-1];
 
6851
        memset(&lk->all[0],0,sizeof(struct lkinfo));
 
6852
        lk->all[0].lookup = otl;
 
6853
        lk->all[0].new = true;
 
6854
        ++lk->cnt;
 
6855
        otl->next = sf->gsub_lookups;
 
6856
        sf->gsub_lookups = otl;
 
6857
 
 
6858
        /* Now add the new subtable */
 
6859
        lk->all[0].subtables = gcalloc(1,sizeof(struct lksubinfo));
 
6860
        lk->all[0].subtable_cnt = lk->all[0].subtable_max = 1;
 
6861
        lk->all[0].subtables[0].subtable = sub;
 
6862
        lk->all[0].subtables[0].new = true;
 
6863
 
 
6864
        /* Now look at every glyph in the font, and see if it has any of the */
 
6865
        /*  lookups we are interested in, and if it does, build a new pst */
 
6866
        /*  containing all posibilities listed on any of them */
 
6867
        if ( sf->cidmaster ) sf = sf->cidmaster;
 
6868
        psts = galloc(sllk[i].cnt*sizeof(PST *));
 
6869
        k=0;
 
6870
        do {
 
6871
            _sf = k<sf->subfontcnt ? sf->subfonts[k] : sf;
 
6872
            for ( gid=0; gid<_sf->glyphcnt; ++gid ) if ( (sc = _sf->glyphs[gid])!=NULL ) {
 
6873
                pcnt = 0;
 
6874
                for ( pst=sc->possub; pst!=NULL; pst=pst->next ) {
 
6875
                    if ( pst->subtable==NULL )
 
6876
                continue;
 
6877
                    for ( j=0; j<sllk[i].cnt; ++j )
 
6878
                        if ( pst->subtable->lookup == sllk[i].lookups[j] )
 
6879
                    break;
 
6880
                    if ( j<sllk[i].cnt )
 
6881
                        psts[pcnt++] = pst;
 
6882
                }
 
6883
                if ( pcnt==0 )
 
6884
            continue;
 
6885
                pst = chunkalloc(sizeof(PST));
 
6886
                pst->subtable = sub;
 
6887
                pst->type = pst_alternate;
 
6888
                pst->next = sc->possub;
 
6889
                sc->possub = pst;
 
6890
                pst->u.alt.components = ComponentsFromPSTs(psts,pcnt);
 
6891
            }
 
6892
            ++k;
 
6893
        } while ( k<sf->subfontcnt );
 
6894
        free(psts);
 
6895
        NameOTLookup(otl,sf);
 
6896
    }
 
6897
 
 
6898
    for ( i=0; i<sllk_cnt; ++i ) {
 
6899
        free( sllk[i].langs );
 
6900
        free( sllk[i].lookups );
 
6901
    }
 
6902
    free(sllk);
 
6903
}
 
6904
 
 
6905
static void lookupmenu_dispatch(GWindow v, GMenuItem *mi, GEvent *e) {
 
6906
    GEvent dummy;
 
6907
    struct gfi_data *gfi = GDrawGetUserData(v);
 
6908
    int i;
 
6909
    char *buts[4];
 
6910
 
 
6911
    if ( mi->mid==CID_SaveFeat || mi->mid==CID_SaveLookup ) {
 
6912
        char *filename, *defname;
 
6913
        FILE *out;
 
6914
        int isgpos = GTabSetGetSel(GWidgetGetControl(gfi->gw,CID_Lookups));
 
6915
        struct lkdata *lk = &gfi->tables[isgpos];
 
6916
        OTLookup *otl = NULL;
 
6917
 
 
6918
        if ( mi->mid==CID_SaveLookup ) {
 
6919
            for ( i=0; i<lk->cnt && (!lk->all[i].selected || lk->all[i].deleted); ++i );
 
6920
            if ( i==lk->cnt )
 
6921
return;
 
6922
            otl = lk->all[i].lookup;
 
6923
        }
 
6924
        defname = strconcat(gfi->sf->fontname,".fea");
 
6925
        filename = gwwv_save_filename(_("Feature file?"),defname,"*.fea");
 
6926
        free(defname);
 
6927
        if ( filename==NULL )
 
6928
return;
 
6929
        /* Convert to def encoding !!! */
 
6930
        out = fopen(filename,"w");
 
6931
        if ( out==NULL ) {
 
6932
            gwwv_post_error(_("Cannot open file"),_("Cannot open %s"), filename );
 
6933
            free(filename);
 
6934
return;
 
6935
        }
 
6936
        if ( otl!=NULL )
 
6937
            FeatDumpOneLookup( out,gfi->sf,otl );
 
6938
        else
 
6939
            FeatDumpFontLookups( out,gfi->sf );
 
6940
        if ( ferror(out)) {
 
6941
            gwwv_post_error(_("Output error"),_("An error occurred writing %s"), filename );
 
6942
            free(filename);
 
6943
            fclose(out);
 
6944
return;
 
6945
        }
 
6946
        free(filename);
 
6947
        fclose(out);
 
6948
    } else if ( mi->mid==CID_AddAllAlternates ) {
 
6949
        /* First we want to remove any old aalt-only lookups */
 
6950
        /*  (and remove the 'aalt' tag from any lookups with multiple features) */
 
6951
        /* Then add the new ones */
 
6952
        struct lkdata *lk = &gfi->tables[0];            /* GSUB */
 
6953
        int has_aalt_only=false, has_aalt_mixed = false;
 
6954
        int i, ret;
 
6955
        FeatureScriptLangList *fl;
 
6956
 
 
6957
        for ( i=0; i<lk->cnt; ++i ) {
 
6958
            if ( lk->all[i].deleted )
 
6959
        continue;
 
6960
            for ( fl = lk->all[i].lookup->features; fl!=NULL; fl=fl->next ) {
 
6961
                if ( fl->featuretag==CHR('a','a','l','t') ) {
 
6962
                    if ( fl==lk->all[i].lookup->features && fl->next==NULL )
 
6963
                        has_aalt_only = true;
 
6964
                    else
 
6965
                        has_aalt_mixed = true;
 
6966
            break;
 
6967
                }
 
6968
            }
 
6969
        }
 
6970
        if ( has_aalt_only || has_aalt_mixed ) {
 
6971
#if defined(FONTFORGE_CONFIG_GDRAW)
 
6972
            buts[0] = _("_OK"); buts[1] = _("_Cancel"); buts[2] = NULL;
 
6973
#elif defined(FONTFORGE_CONFIG_GTK)
 
6974
            buts[0] = GTK_STOCK_OK; buts[1] = GTK_STOCK_CANCEL; buts[2] = NULL;
 
6975
#endif
 
6976
            ret = gwwv_ask(has_aalt_only?_("Lookups will be removed"):_("Feature tags will be removed"),
 
6977
                    (const char **) buts,0,1,
 
6978
                    !has_aalt_mixed ?
 
6979
                    _("Warning: There are already some 'aalt' lookups in\n"
 
6980
                      "the font. If you proceed with this command those\n"
 
6981
                      "lookups will be removed and new lookups will be\n"
 
6982
                      "generated. The old information will be LOST.\n"
 
6983
                      " Is that what you want?") :
 
6984
                    !has_aalt_only ?
 
6985
                    _("Warning: There are already some 'aalt' lookups in\n"
 
6986
                      "the font but there are other feature tags associated\n"
 
6987
                      "with these lookups. If you proceed with this command\n"
 
6988
                      "the 'aalt' tag will be removed from those lookups,\n"
 
6989
                      "and new lookups will be generate which will NOT be\n"
 
6990
                      "associated with the other feature tag(s).\n"
 
6991
                      " Is that what you want?") :
 
6992
                    _("Warning: There are already some 'aalt' lookups in\n"
 
6993
                      "the font, some have no other feature tags associated\n"
 
6994
                      "with them and these will be removed, others have other\n"
 
6995
                      "tags associated and these will remain while the 'aalt'\n"
 
6996
                      "tag will be removed from the lookup -- a new lookup\n"
 
6997
                      "will be generated which is not associated with any\n"
 
6998
                      "other feature tags.\n"
 
6999
                      " Is that what you want?") );
 
7000
            if ( ret==1 )
 
7001
return;
 
7002
            AALTRemoveOld(gfi->sf,lk);
 
7003
        }
 
7004
        AALTCreateNew(gfi->sf,lk);            
 
7005
        GDrawRequestExpose(GDrawableGetWindow(GWidgetGetControl(gfi->gw,CID_LookupWin+0)),NULL,true);
 
7006
    } else if ( mi->mid==CID_AddDFLT ) {
 
7007
        struct selection_bits sel;
 
7008
        int toall, ret, i;
 
7009
        char *buts[4];
 
7010
        int isgpos = GTabSetGetSel(GWidgetGetControl(gfi->gw,CID_Lookups));
 
7011
        struct lkdata *lk = &gfi->tables[isgpos];
 
7012
 
 
7013
        LookupParseSelection(lk,&sel);
 
7014
#if defined(FONTFORGE_CONFIG_GDRAW)
 
7015
        if ( sel.lookup_cnt==0 ) {
 
7016
            buts[0] = _("_Apply to All"); buts[1] = _("_Cancel"); buts[2]=NULL;
 
7017
        } else {
 
7018
            buts[0] = _("_Apply to All"); buts[1] = _("_Apply to Selection"); buts[2] = _("_Cancel"); buts[3]=NULL;
 
7019
        }
 
7020
#elif defined(FONTFORGE_CONFIG_GTK)
 
7021
        if ( sel.lookup_cnt==0 ) {
 
7022
            buts[0] = _("_Apply to All"); buts[1] = GTK_STOCK_CANCEL; buts[2]=NULL;
 
7023
        } else {
 
7024
            buts[0] = _("_Apply to All"); buts[1] = _("_Apply to Selection"); buts[2] = GTK_STOCK_CANCEL; buts[3]=NULL;
 
7025
        }
 
7026
#endif
 
7027
        ret = gwwv_ask(_("Apply to:"),(const char **) buts,0,sel.lookup_cnt==0?1:2,_("Apply change to which lookups?"));
 
7028
        toall = false;
 
7029
        if ( ret==0 )
 
7030
            toall = true;
 
7031
        else if ( (ret==1 && sel.lookup_cnt==0) || (ret==2 && sel.lookup_cnt!=0))
 
7032
return;
 
7033
        for ( i=0; i<lk->cnt; ++i ) {
 
7034
            if ( lk->all[i].deleted )
 
7035
        continue;
 
7036
            if ( lk->all[i].selected || toall ) {
 
7037
                AddDFLT(lk->all[i].lookup);
 
7038
            }
 
7039
        }
 
7040
    } else {
 
7041
        memset(&dummy,0,sizeof(dummy));
 
7042
        dummy.type = et_controlevent;
 
7043
        dummy.u.control.subtype = et_buttonpress;
 
7044
        dummy.u.control.g = GWidgetGetControl(gfi->gw,mi->mid);
 
7045
        dummy.w = GGadgetGetWindow(dummy.u.control.g);
 
7046
        dummy.u.control.u.button.button = e->u.mouse.button;
 
7047
        GGadgetDispatchEvent(dummy.u.control.g,&dummy);
 
7048
    }
 
7049
}
 
7050
 
 
7051
static GMenuItem lookuppopupmenu[] = {
 
7052
    { { (unichar_t *) N_("_Top"), NULL, COLOR_DEFAULT, COLOR_DEFAULT, NULL, NULL, 0, 0, 0, 0, 0, 0, 1, 1, 0, 't' }, '\0', ksm_control, NULL, NULL, lookupmenu_dispatch, CID_LookupTop },
 
7053
    { { (unichar_t *) N_("_Up"), NULL, COLOR_DEFAULT, COLOR_DEFAULT, NULL, NULL, 0, 0, 0, 0, 0, 0, 1, 1, 0, 'C' }, '\0', ksm_control, NULL, NULL, lookupmenu_dispatch, CID_LookupUp },
 
7054
    { { (unichar_t *) N_("_Down"), NULL, COLOR_DEFAULT, COLOR_DEFAULT, NULL, NULL, 0, 0, 0, 0, 0, 0, 1, 1, 0, 'o' }, '\0', ksm_control, NULL, NULL, lookupmenu_dispatch, CID_LookupDown },
 
7055
    { { (unichar_t *) N_("_Bottom"), NULL, COLOR_DEFAULT, COLOR_DEFAULT, NULL, NULL, 0, 0, 0, 0, 0, 0, 1, 1, 0, 'o' }, '\0', ksm_control, NULL, NULL, lookupmenu_dispatch, CID_LookupBottom },
 
7056
    { { (unichar_t *) N_("_Sort"), NULL, COLOR_DEFAULT, COLOR_DEFAULT, NULL, NULL, 0, 0, 0, 0, 0, 0, 1, 1, 0, 'o' }, '\0', ksm_control, NULL, NULL, lookupmenu_dispatch, CID_LookupSort },
 
7057
    { { NULL, NULL, COLOR_DEFAULT, COLOR_DEFAULT, NULL, NULL, 0, 0, 0, 0, 0, 1, 0, 0, }},
 
7058
    { { (unichar_t *) N_("Add _Lookup"), NULL, COLOR_DEFAULT, COLOR_DEFAULT, NULL, NULL, 0, 0, 0, 0, 0, 0, 1, 1, 0, 'o' }, '\0', ksm_control, NULL, NULL, lookupmenu_dispatch, CID_AddLookup },
 
7059
    { { (unichar_t *) N_("Add Sub_table"), NULL, COLOR_DEFAULT, COLOR_DEFAULT, NULL, NULL, 0, 0, 0, 0, 0, 0, 1, 1, 0, 'o' }, '\0', ksm_control, NULL, NULL, lookupmenu_dispatch, CID_AddSubtable },
 
7060
    { { (unichar_t *) N_("Edit _Metadata"), NULL, COLOR_DEFAULT, COLOR_DEFAULT, NULL, NULL, 0, 0, 0, 0, 0, 0, 1, 1, 0, 'o' }, '\0', ksm_control, NULL, NULL, lookupmenu_dispatch, CID_EditMetadata },
 
7061
    { { (unichar_t *) N_("_Edit Data"), NULL, COLOR_DEFAULT, COLOR_DEFAULT, NULL, NULL, 0, 0, 0, 0, 0, 0, 1, 1, 0, 'o' }, '\0', ksm_control, NULL, NULL, lookupmenu_dispatch, CID_EditSubtable },
 
7062
    { { (unichar_t *) N_("De_lete"), NULL, COLOR_DEFAULT, COLOR_DEFAULT, NULL, NULL, 0, 0, 0, 0, 0, 0, 1, 1, 0, 'o' }, '\0', ksm_control, NULL, NULL, lookupmenu_dispatch, CID_DeleteLookup },
 
7063
    { { (unichar_t *) N_("_Merge"), NULL, COLOR_DEFAULT, COLOR_DEFAULT, NULL, NULL, 0, 0, 0, 0, 0, 0, 1, 1, 0, 'o' }, '\0', ksm_control, NULL, NULL, lookupmenu_dispatch, CID_MergeLookup },
 
7064
    { { (unichar_t *) N_("Sa_ve Lookup"), NULL, COLOR_DEFAULT, COLOR_DEFAULT, NULL, NULL, 0, 0, 0, 0, 0, 0, 1, 1, 0, 'o' }, '\0', ksm_control, NULL, NULL, lookupmenu_dispatch, CID_SaveLookup },
 
7065
    { { NULL, NULL, COLOR_DEFAULT, COLOR_DEFAULT, NULL, NULL, 0, 0, 0, 0, 0, 1, 0, 0, }},
 
7066
    { { (unichar_t *) N_("_Add 'aalt' features"), NULL, COLOR_DEFAULT, COLOR_DEFAULT, NULL, NULL, 0, 0, 0, 0, 0, 0, 1, 1, 0, 'o' }, '\0', ksm_control, NULL, NULL, lookupmenu_dispatch, CID_AddAllAlternates },
 
7067
    { { (unichar_t *) N_("Add 'D_FLT' script"), NULL, COLOR_DEFAULT, COLOR_DEFAULT, NULL, NULL, 0, 0, 0, 0, 0, 0, 1, 1, 0, 'o' }, '\0', ksm_control, NULL, NULL, lookupmenu_dispatch, CID_AddDFLT },
 
7068
    { { NULL, NULL, COLOR_DEFAULT, COLOR_DEFAULT, NULL, NULL, 0, 0, 0, 0, 0, 1, 0, 0, }},
 
7069
    { { (unichar_t *) N_("_Revert All"), NULL, COLOR_DEFAULT, COLOR_DEFAULT, NULL, NULL, 0, 0, 0, 0, 0, 0, 1, 1, 0, 'o' }, '\0', ksm_control, NULL, NULL, lookupmenu_dispatch, CID_RevertLookups },
 
7070
    { { (unichar_t *) N_("_Import"), NULL, COLOR_DEFAULT, COLOR_DEFAULT, NULL, NULL, 0, 0, 0, 0, 0, 0, 1, 1, 0, 'o' }, '\0', ksm_control, NULL, NULL, lookupmenu_dispatch, CID_RevertLookups },
 
7071
    { { (unichar_t *) N_("S_ave Feature File"), NULL, COLOR_DEFAULT, COLOR_DEFAULT, NULL, NULL, 0, 0, 0, 0, 0, 0, 1, 1, 0, 'o' }, '\0', ksm_control, NULL, NULL, lookupmenu_dispatch, CID_SaveFeat },
 
7072
    { NULL }};
 
7073
 
 
7074
static void LookupMenu(struct gfi_data *gfi,struct lkdata *lk,GEvent *event) {
 
7075
    struct selection_bits sel;
 
7076
    int i,j;
 
7077
 
 
7078
    LookupParseSelection(lk,&sel);
 
7079
    for ( i=0; lookuppopupmenu[i].ti.text!=NULL || lookuppopupmenu[i].ti.line; ++i ) {
 
7080
        switch ( lookuppopupmenu[i].mid ) {
 
7081
          case 0:
 
7082
            /* Lines */;
 
7083
          break;
 
7084
          case CID_LookupTop:
 
7085
            lookuppopupmenu[i].ti.disabled = sel.any_first || sel.lookup_cnt+sel.sub_cnt!=1;
 
7086
          break;
 
7087
          case CID_LookupUp:
 
7088
            lookuppopupmenu[i].ti.disabled = sel.any_first || sel.lookup_cnt+sel.sub_cnt==0;
 
7089
          break;
 
7090
          case CID_LookupDown:
 
7091
            lookuppopupmenu[i].ti.disabled = sel.any_last || sel.lookup_cnt+sel.sub_cnt==0;
 
7092
          break;
 
7093
          case CID_LookupBottom:
 
7094
            lookuppopupmenu[i].ti.disabled = sel.any_last || sel.lookup_cnt+sel.sub_cnt!=1;
 
7095
          break;
 
7096
          case CID_LookupSort:
 
7097
            lookuppopupmenu[i].ti.disabled = lk->cnt<=1;
 
7098
          break;
 
7099
          case CID_AddLookup:
 
7100
            lookuppopupmenu[i].ti.disabled = sel.lookup_cnt+sel.sub_cnt>1;
 
7101
          break;
 
7102
          case CID_AddSubtable:
 
7103
            lookuppopupmenu[i].ti.disabled = (sel.lookup_cnt!=1 || sel.sub_cnt>1) && (sel.lookup_cnt!=0 || sel.sub_cnt!=1);
 
7104
          break;
 
7105
          case CID_EditMetadata:
 
7106
            lookuppopupmenu[i].ti.disabled = (sel.lookup_cnt!=1 || sel.sub_cnt!=0) &&
 
7107
                        (sel.lookup_cnt!=0 || sel.sub_cnt!=1);
 
7108
          break;
 
7109
          case CID_EditSubtable:
 
7110
            lookuppopupmenu[i].ti.disabled = sel.lookup_cnt!=0 || sel.sub_cnt!=1;
 
7111
          break;
 
7112
          case CID_DeleteLookup:
 
7113
            lookuppopupmenu[i].ti.disabled = sel.lookup_cnt==0 && sel.sub_cnt==0;
 
7114
          break;
 
7115
          case CID_MergeLookup:
 
7116
            lookuppopupmenu[i].ti.disabled = !(
 
7117
                    (sel.lookup_cnt>=2 && sel.sub_cnt==0 && sel.lookup_mergeable) ||
 
7118
                    (sel.lookup_cnt==0 && sel.sub_cnt>=2 && sel.sub_table_mergeable)  );
 
7119
          break;
 
7120
          case CID_RevertLookups:
 
7121
            lookuppopupmenu[i].ti.disabled = false;
 
7122
          break;
 
7123
          case CID_SaveLookup:
 
7124
            lookuppopupmenu[i].ti.disabled = sel.lookup_cnt!=1 || sel.sub_cnt!=0;
 
7125
            for ( j=0; j<lk->cnt; ++j ) if ( lk->all[j].selected ) {
 
7126
                int type = lk->all[j].lookup->lookup_type;
 
7127
                if ( type==kern_statemachine || type==morx_indic ||
 
7128
                        type==morx_context || type==morx_insert )
 
7129
                    lookuppopupmenu[i].ti.disabled = true;
 
7130
            break;
 
7131
            }
 
7132
          break;
 
7133
          case CID_AddDFLT:
 
7134
            lookuppopupmenu[i].ti.disabled = lk->cnt==0;
 
7135
          break;
 
7136
          case CID_AddAllAlternates:
 
7137
            lookuppopupmenu[i].ti.disabled = lk->cnt==0 || lk==&gfi->tables[1]/*Only applies to GSUB*/;
 
7138
          break;
 
7139
          case CID_SaveFeat:
 
7140
            lookuppopupmenu[i].ti.disabled = lk->cnt<=1;
 
7141
          break;
 
7142
        }
 
7143
    }
 
7144
    GMenuCreatePopupMenu(event->w,event, lookuppopupmenu);
 
7145
}
 
7146
    
 
7147
 
 
7148
static void LookupMouse(struct gfi_data *gfi, int isgpos, GEvent *event) {
 
7149
    struct lkdata *lk = &gfi->tables[isgpos];
 
7150
    int l = (event->u.mouse.y-LK_MARGIN)/gfi->fh + lk->off_top;
 
7151
    int inbox = event->u.mouse.x>=LK_MARGIN &&
 
7152
            event->u.mouse.x>=LK_MARGIN-lk->off_left &&
 
7153
            event->u.mouse.x<=LK_MARGIN-lk->off_left+gfi->as+1;
 
7154
    GWindow gw = GDrawableGetWindow(GWidgetGetControl(gfi->gw,CID_LookupWin+isgpos));
 
7155
    int i,j,lcnt;
 
7156
 
 
7157
    if ( l<0 || event->u.mouse.y>=(gfi->lkheight-2*LK_MARGIN) )
 
7158
return;
 
7159
 
 
7160
    lcnt = 0;
 
7161
    for ( i=0; i<lk->cnt; ++i ) {
 
7162
        if ( lk->all[i].deleted )
 
7163
    continue;
 
7164
        if ( l==lcnt ) {
 
7165
            if ( event->type==et_mouseup )
 
7166
return;
 
7167
            else if ( event->type==et_mousemove ) {
 
7168
                LookupPopup(gw,lk->all[i].lookup,NULL);
 
7169
return;
 
7170
            } else {
 
7171
                if ( inbox || event->u.mouse.clicks>1 ) {
 
7172
                    lk->all[i].open = !lk->all[i].open;
 
7173
                    GFI_LookupScrollbars(gfi, isgpos, true);
 
7174
return;
 
7175
                }
 
7176
                if ( !(event->u.mouse.state&(ksm_shift|ksm_control)) ) {
 
7177
                    LookupDeselect(lk);
 
7178
                    lk->all[i].selected = true;
 
7179
                } else
 
7180
                    lk->all[i].selected = !lk->all[i].selected;
 
7181
                GFI_LookupEnableButtons(gfi,isgpos);
 
7182
                GDrawRequestExpose(gw,NULL,true);
 
7183
                if ( event->u.mouse.button==3 )
 
7184
                    LookupMenu(gfi,lk,event);
 
7185
return;
 
7186
            }
 
7187
        }
 
7188
        ++lcnt;
 
7189
        if ( lk->all[i].open ) {
 
7190
            for ( j=0; j<lk->all[i].subtable_cnt; ++j ) {
 
7191
                if ( lk->all[i].subtables[j].deleted )
 
7192
            continue;
 
7193
                if ( l==lcnt ) {
 
7194
                    if ( event->type==et_mouseup )
 
7195
return;
 
7196
                    else if ( event->type==et_mousemove ) {
 
7197
                        LookupPopup(gw,lk->all[i].lookup,lk->all[i].subtables[j].subtable);
 
7198
return;
 
7199
                    } else {
 
7200
                        if ( inbox )
 
7201
return;         /* Can't open this guy */
 
7202
                        if ( event->u.mouse.clicks>1 )
 
7203
                            LookupSubtableContents(gfi,isgpos);
 
7204
                        else {
 
7205
                            if ( !(event->u.mouse.state&(ksm_shift|ksm_control)) ) {
 
7206
                                LookupDeselect(lk);
 
7207
                                lk->all[i].subtables[j].selected = true;
 
7208
                            } else
 
7209
                                lk->all[i].subtables[j].selected = !lk->all[i].subtables[j].selected;
 
7210
                            GFI_LookupEnableButtons(gfi,isgpos);
 
7211
                            GDrawRequestExpose(gw,NULL,true);
 
7212
                            if ( event->u.mouse.button==3 )
 
7213
                                LookupMenu(gfi,lk,event);
 
7214
                        }
 
7215
return;
 
7216
                    }
 
7217
                }
 
7218
                ++lcnt;
 
7219
            }
 
7220
        }
 
7221
    }
 
7222
}
 
7223
 
 
7224
static int lookups_e_h(GWindow gw, GEvent *event, int isgpos) {
 
7225
    struct gfi_data *gfi = GDrawGetUserData(gw);
 
7226
 
 
7227
    if (( event->type==et_mouseup || event->type==et_mousedown ) &&
 
7228
            (event->u.mouse.button==4 || event->u.mouse.button==5) ) {
 
7229
return( GGadgetDispatchEvent(GWidgetGetControl(gw,CID_LookupVSB+isgpos),event));
 
7230
    }
 
7231
 
 
7232
    switch ( event->type ) {
 
7233
      case et_char:
 
7234
return( GFI_Char(gfi,event) );
 
7235
      case et_expose:
 
7236
        LookupExpose(gw,gfi,isgpos);
 
7237
      break;
 
7238
      case et_mousedown: case et_mousemove: case et_mouseup:
 
7239
        LookupMouse(gfi,isgpos,event);
 
7240
      break;
 
7241
      case et_resize: {
 
7242
        GRect r;
 
7243
        GDrawGetSize(gw,&r);
 
7244
        gfi->lkheight = r.height; gfi->lkwidth = r.width;
 
7245
        GFI_LookupScrollbars(gfi,false,false);
 
7246
        GFI_LookupScrollbars(gfi,true,false);
 
7247
      }
 
7248
      break;
 
7249
    }
 
7250
return( true );
 
7251
}
 
7252
 
 
7253
static int gposlookups_e_h(GWindow gw, GEvent *event) {
 
7254
return( lookups_e_h(gw,event,true));
 
7255
}
 
7256
 
 
7257
static int gsublookups_e_h(GWindow gw, GEvent *event) {
 
7258
return( lookups_e_h(gw,event,false));
 
7259
}
 
7260
 
 
7261
void FontInfo(SplineFont *sf,int defaspect,int sync) {
 
7262
    GRect pos;
 
7263
    GWindow gw;
 
7264
    GWindowAttrs wattrs;
 
7265
    GTabInfo aspects[22], vaspects[5], lkaspects[3];
 
7266
    GGadgetCreateData mgcd[10], ngcd[17], psgcd[30], tngcd[8],
 
7267
        pgcd[8], vgcd[19], pangcd[22], comgcd[3], txgcd[23],
 
7268
        mfgcd[8], mcgcd[8], szgcd[19], mkgcd[5], metgcd[29], vagcd[3], ssgcd[23],
 
7269
        xugcd[7], dgcd[6], ugcd[4], gaspgcd[5], gaspgcd_def[2], lksubgcd[2][4],
 
7270
        lkgcd[2], lkbuttonsgcd[15];
 
7271
    GGadgetCreateData mb[2], mb2, nb[2], nb2, nb3, xub[2], psb[2], psb2[3], ppbox[3],
 
7272
            vbox[4], metbox[2], ssbox[2], panbox[2], combox[2], mkbox[3],
 
7273
            txbox[5], ubox[2], dbox[2], 
 
7274
            mcbox[3], mfbox[3], szbox[6], tnboxes[4], gaspboxes[3],
 
7275
            lkbox[7];
 
7276
    GGadgetCreateData *marray[7], *marray2[9], *narray[26], *narray2[7], *narray3[3],
 
7277
        *xuarray[13], *psarray[10], *psarray2[21], *psarray3[3], *psarray4[10],
 
7278
        *ppbuttons[5], *pparray[4], *vradio[5], *varray[38], *metarray[46],
 
7279
        *ssarray[58], *panarray[38], *comarray[2],
 
7280
        *mkarray[3], *mkarray2[4], *txarray[5], *txarray2[30],
 
7281
        *txarray3[6], *txarray4[6], *uarray[3], *darray[10],
 
7282
        *mcarray[13], *mcarray2[7],
 
7283
        *mfarray[14], *szarray[7], *szarray2[5], *szarray3[7],
 
7284
        *szarray4[4], *szarray5[6], *tnvarray[4], *tnharray[6], *tnharray2[5], *gaspharray[6],
 
7285
        *gaspvarray[3], *lkarray[2][7], *lkbuttonsarray[17], *lkharray[3];
 
7286
    GTextInfo mlabel[10], nlabel[16], pslabel[30], tnlabel[7],
 
7287
        plabel[8], vlabel[19], panlabel[22], comlabel[3], txlabel[23],
 
7288
        mflabel[8], mclabel[8], szlabel[17], mklabel[5], metlabel[28],
 
7289
        sslabel[23], xulabel[6], dlabel[5], ulabel[1], gasplabel[5],
 
7290
        lkbuttonslabel[14];
 
7291
    GTextInfo *namelistnames;
 
7292
    struct gfi_data *d;
 
7293
    char iabuf[20], upbuf[20], uwbuf[20], asbuf[20], dsbuf[20],
 
7294
            vbuf[20], uibuf[12], vorig[20], embuf[20];
 
7295
    char dszbuf[20], dsbbuf[20], dstbuf[21], sibuf[20], swbuf[20];
 
7296
    int i,j,k, psrow;
 
7297
    int mcs;
 
7298
    char title[130];
 
7299
    /* static unichar_t monospace[] = { 'c','o','u','r','i','e','r',',','m', 'o', 'n', 'o', 's', 'p', 'a', 'c', 'e',',','c','a','s','l','o','n',',','c','l','e','a','r','l','y','u',',','u','n','i','f','o','n','t',  '\0' };*/
 
7300
    static unichar_t sans[] = { 'h','e','l','v','e','t','i','c','a',',','c','l','e','a','r','l','y','u',',','u','n','i','f','o','n','t',  '\0' };
 
7301
    FontRequest rq;
 
7302
    int as, ds, ld;
 
7303
    char **nlnames;
 
7304
    char createtime[200], modtime[200];
 
7305
    unichar_t *tmpcreatetime, *tmpmodtime;
 
7306
    time_t t;
 
7307
    const struct tm *tm;
 
7308
    struct matrixinit mi, gaspmi;
 
7309
 
 
7310
    FontInfoInit();
 
7311
 
 
7312
    if ( sf->fontinfo!=NULL ) {
 
7313
        GDrawSetVisible(((struct gfi_data *) (sf->fontinfo))->gw,true);
 
7314
        GDrawRaise( ((struct gfi_data *) (sf->fontinfo))->gw );
 
7315
return;
 
7316
    }
 
7317
    if ( defaspect==-1 )
 
7318
        defaspect = last_aspect;
 
7319
 
 
7320
    d = gcalloc(1,sizeof(struct gfi_data));
 
7321
    sf->fontinfo = d;
 
7322
 
 
7323
    memset(&wattrs,0,sizeof(wattrs));
 
7324
    wattrs.mask = wam_events|wam_cursor|wam_utf8_wtitle|wam_undercursor|wam_isdlg;
 
7325
    wattrs.event_masks = ~(1<<et_charup);
 
7326
    wattrs.is_dlg = true;
 
7327
    if ( sync ) {
 
7328
        wattrs.mask |= wam_restrict;
 
7329
        wattrs.restrict_input_to_me = 1;
 
7330
    }
 
7331
    wattrs.undercursor = 1;
 
7332
    wattrs.cursor = ct_pointer;
 
7333
    snprintf(title,sizeof(title),_("Font Information for %.90s"),
 
7334
            sf->fontname);
 
7335
    wattrs.utf8_window_title = title;
 
7336
    pos.x = pos.y = 0;
 
7337
#ifndef FONTFORGE_CONFIG_INFO_HORIZONTAL
 
7338
    pos.width =GDrawPointsToPixels(NULL,GGadgetScale(268+85));
 
7339
#else
 
7340
    pos.width =GDrawPointsToPixels(NULL,GGadgetScale(268));
 
7341
#endif
 
7342
    pos.height = GDrawPointsToPixels(NULL,375);
 
7343
    gw = GDrawCreateTopWindow(NULL,&pos,e_h,d,&wattrs);
 
7344
 
 
7345
    d->sf = sf;
 
7346
    d->gw = gw;
 
7347
    d->old_sel = -2;
 
7348
    d->texdata = sf->texdata;
 
7349
 
 
7350
    memset(&nlabel,0,sizeof(nlabel));
 
7351
    memset(&ngcd,0,sizeof(ngcd));
 
7352
 
 
7353
    nlabel[0].text = (unichar_t *) _("Fo_ntname:");
 
7354
    nlabel[0].text_is_1byte = true;
 
7355
    nlabel[0].text_in_resource = true;
 
7356
    ngcd[0].gd.label = &nlabel[0];
 
7357
    ngcd[0].gd.pos.x = 12; ngcd[0].gd.pos.y = 6+6; 
 
7358
    ngcd[0].gd.flags = gg_visible | gg_enabled;
 
7359
    ngcd[0].creator = GLabelCreate;
 
7360
 
 
7361
    ngcd[1].gd.pos.x = 115; ngcd[1].gd.pos.y = ngcd[0].gd.pos.y-6; ngcd[1].gd.pos.width = 137;
 
7362
    ngcd[1].gd.flags = gg_visible | gg_enabled;
 
7363
    nlabel[1].text = (unichar_t *) sf->fontname;
 
7364
    nlabel[1].text_is_1byte = true;
 
7365
    ngcd[1].gd.label = &nlabel[1];
 
7366
    ngcd[1].gd.cid = CID_Fontname;
 
7367
    ngcd[1].gd.handle_controlevent = GFI_NameChange;
 
7368
    ngcd[1].creator = GTextFieldCreate;
 
7369
 
 
7370
    nlabel[2].text = (unichar_t *) _("_Family Name:");
 
7371
    nlabel[2].text_is_1byte = true;
 
7372
    nlabel[2].text_in_resource = true;
 
7373
    ngcd[2].gd.label = &nlabel[2];
 
7374
    ngcd[2].gd.pos.x = 12; ngcd[2].gd.pos.y = ngcd[0].gd.pos.y+26; 
 
7375
    ngcd[2].gd.flags = gg_visible | gg_enabled;
 
7376
    ngcd[2].creator = GLabelCreate;
 
7377
 
 
7378
    ngcd[3].gd.pos.x = ngcd[1].gd.pos.x; ngcd[3].gd.pos.y = ngcd[2].gd.pos.y-6; ngcd[3].gd.pos.width = 137;
 
7379
    ngcd[3].gd.flags = gg_visible | gg_enabled;
 
7380
    nlabel[3].text = (unichar_t *) (sf->familyname?sf->familyname:sf->fontname);
 
7381
    nlabel[3].text_is_1byte = true;
 
7382
    ngcd[3].gd.label = &nlabel[3];
 
7383
    ngcd[3].gd.cid = CID_Family;
 
7384
    ngcd[3].gd.handle_controlevent = GFI_FamilyChange;
 
7385
    ngcd[3].creator = GTextFieldCreate;
 
7386
    if ( sf->familyname==NULL || strstr(sf->familyname,"Untitled")==sf->familyname )
 
7387
        d->family_untitled = true;
 
7388
 
 
7389
    ngcd[4].gd.pos.x = 12; ngcd[4].gd.pos.y = ngcd[3].gd.pos.y+26+6;
 
7390
    nlabel[4].text = (unichar_t *) _("Name For Human_s:");
 
7391
    nlabel[4].text_is_1byte = true;
 
7392
    nlabel[4].text_in_resource = true;
 
7393
    ngcd[4].gd.label = &nlabel[4];
 
7394
    ngcd[4].gd.flags = gg_visible | gg_enabled;
 
7395
    ngcd[4].creator = GLabelCreate;
 
7396
 
 
7397
    ngcd[5].gd.pos.x = 115; ngcd[5].gd.pos.y = ngcd[4].gd.pos.y-6; ngcd[5].gd.pos.width = 137;
 
7398
    ngcd[5].gd.flags = gg_visible | gg_enabled;
 
7399
    nlabel[5].text = (unichar_t *) (sf->fullname?sf->fullname:sf->fontname);
 
7400
    nlabel[5].text_is_1byte = true;
 
7401
    ngcd[5].gd.label = &nlabel[5];
 
7402
    ngcd[5].gd.cid = CID_Human;
 
7403
    ngcd[5].gd.handle_controlevent = GFI_HumanChange;
 
7404
    ngcd[5].creator = GTextFieldCreate;
 
7405
    if ( sf->fullname==NULL || strstr(sf->fullname,"Untitled")==sf->fullname )
 
7406
        d->human_untitled = true;
 
7407
 
 
7408
    nlabel[6].text = (unichar_t *) _("_Weight");
 
7409
    nlabel[6].text_is_1byte = true;
 
7410
    nlabel[6].text_in_resource = true;
 
7411
    ngcd[6].gd.label = &nlabel[6];
 
7412
    ngcd[6].gd.pos.x = ngcd[4].gd.pos.x; ngcd[6].gd.pos.y = ngcd[4].gd.pos.y+26; 
 
7413
    ngcd[6].gd.flags = gg_visible | gg_enabled;
 
7414
    ngcd[6].creator = GLabelCreate;
 
7415
 
 
7416
    ngcd[7].gd.pos.x = ngcd[1].gd.pos.x; ngcd[7].gd.pos.y = ngcd[6].gd.pos.y-6; ngcd[7].gd.pos.width = 137;
 
7417
    ngcd[7].gd.flags = gg_visible | gg_enabled;
 
7418
    nlabel[7].text = (unichar_t *) (sf->weight?sf->weight:"Regular");
 
7419
    nlabel[7].text_is_1byte = true;
 
7420
    ngcd[7].gd.label = &nlabel[7];
 
7421
    ngcd[7].gd.cid = CID_Weight;
 
7422
    ngcd[7].creator = GTextFieldCreate;
 
7423
 
 
7424
    ngcd[8].gd.pos.x = 12; ngcd[8].gd.pos.y = ngcd[6].gd.pos.y+26;
 
7425
    nlabel[8].text = (unichar_t *) _("_Version:");
 
7426
    nlabel[8].text_is_1byte = true;
 
7427
    nlabel[8].text_in_resource = true;
 
7428
    ngcd[8].gd.label = &nlabel[8];
 
7429
    ngcd[8].gd.flags = gg_visible | gg_enabled;
 
7430
    ngcd[8].creator = GLabelCreate;
 
7431
 
 
7432
    ngcd[9].gd.pos.x = 115; ngcd[9].gd.pos.y = ngcd[8].gd.pos.y-6; ngcd[9].gd.pos.width = 137;
 
7433
    ngcd[9].gd.flags = gg_visible | gg_enabled;
 
7434
    nlabel[9].text = (unichar_t *) (sf->version?sf->version:"");
 
7435
    nlabel[9].text_is_1byte = true;
 
7436
    if ( sf->subfontcnt!=0 ) {
 
7437
        sprintf( vbuf,"%g", sf->cidversion );
 
7438
        nlabel[9].text = (unichar_t *) vbuf;
 
7439
    }
 
7440
    ngcd[9].gd.label = &nlabel[9];
 
7441
    ngcd[9].gd.cid = CID_Version;
 
7442
    ngcd[9].creator = GTextFieldCreate;
 
7443
 
 
7444
    ngcd[10].gd.pos.x = 12; ngcd[10].gd.pos.y = ngcd[8].gd.pos.y+28;
 
7445
    nlabel[10].text = (unichar_t *) _("_Base Filename:");
 
7446
    nlabel[10].text_is_1byte = true;
 
7447
    nlabel[10].text_in_resource = true;
 
7448
    ngcd[10].gd.label = &nlabel[10];
 
7449
    ngcd[10].gd.popup_msg = (unichar_t *) _("Use this as the default base for the filename\nwhen generating a font." );
 
7450
    ngcd[10].gd.flags = gg_visible | gg_enabled | gg_utf8_popup;
 
7451
    ngcd[10].creator = GLabelCreate;
 
7452
 
 
7453
    ngcd[11].gd.pos.x = 95; ngcd[11].gd.pos.y = ngcd[10].gd.pos.y-11;
 
7454
/* GT: The space in front of "Same" makes things line up better */
 
7455
    nlabel[11].text = (unichar_t *) _(" Same as Fontname");
 
7456
    nlabel[11].text_is_1byte = true;
 
7457
    ngcd[11].gd.label = &nlabel[11];
 
7458
    ngcd[11].gd.flags = sf->defbasefilename==NULL ? (gg_visible | gg_enabled | gg_cb_on ) : (gg_visible | gg_enabled);
 
7459
    ngcd[11].gd.cid = CID_SameAsFontname;
 
7460
    ngcd[11].creator = GRadioCreate;
 
7461
 
 
7462
    ngcd[12].gd.pos.x = 95; ngcd[12].gd.pos.y = ngcd[10].gd.pos.y+11;
 
7463
    nlabel[12].text = (unichar_t *) "";
 
7464
    nlabel[12].text_is_1byte = true;
 
7465
    ngcd[12].gd.label = &nlabel[12];
 
7466
    ngcd[12].gd.flags = sf->defbasefilename!=NULL ?
 
7467
                (gg_visible | gg_enabled | gg_cb_on | gg_rad_continueold ) :
 
7468
                (gg_visible | gg_enabled | gg_rad_continueold);
 
7469
    ngcd[12].gd.cid = CID_HasDefBase;
 
7470
    ngcd[12].creator = GRadioCreate;
 
7471
 
 
7472
    ngcd[13].gd.pos.x = 115; ngcd[13].gd.pos.y = ngcd[12].gd.pos.y-4; ngcd[13].gd.pos.width = 137;
 
7473
    ngcd[13].gd.flags = gg_visible | gg_enabled;
 
7474
    nlabel[13].text = (unichar_t *) (sf->defbasefilename?sf->defbasefilename:"");
 
7475
    nlabel[13].text_is_1byte = true;
 
7476
    ngcd[13].gd.label = &nlabel[13];
 
7477
    ngcd[13].gd.cid = CID_DefBaseName;
 
7478
    ngcd[13].gd.handle_controlevent = GFI_DefBaseChange;
 
7479
    ngcd[13].creator = GTextFieldCreate;
 
7480
 
 
7481
    ngcd[14].gd.pos.x = 12; ngcd[14].gd.pos.y = ngcd[10].gd.pos.y+22;
 
7482
    ngcd[14].gd.flags = gg_visible | gg_enabled;
 
7483
    nlabel[14].text = (unichar_t *) _("Copy_right:");
 
7484
    nlabel[14].text_is_1byte = true;
 
7485
    nlabel[14].text_in_resource = true;
 
7486
    ngcd[14].gd.label = &nlabel[14];
 
7487
    ngcd[14].creator = GLabelCreate;
 
7488
 
 
7489
    ngcd[15].gd.pos.x = 12; ngcd[15].gd.pos.y = ngcd[14].gd.pos.y+14;
 
7490
    ngcd[15].gd.pos.width = ngcd[5].gd.pos.x+ngcd[5].gd.pos.width-26;
 
7491
    ngcd[15].gd.flags = gg_visible | gg_enabled | gg_textarea_wrap;
 
7492
    if ( sf->copyright!=NULL ) {
 
7493
        nlabel[15].text = (unichar_t *) sf->copyright;
 
7494
        nlabel[15].text_is_1byte = true;
 
7495
        ngcd[15].gd.label = &nlabel[15];
 
7496
    }
 
7497
    ngcd[15].gd.cid = CID_Notice;
 
7498
    ngcd[15].creator = GTextAreaCreate;
 
7499
 
 
7500
    memset(&nb,0,sizeof(nb)); memset(&nb2,0,sizeof(nb2)); memset(&nb3,0,sizeof(nb3));
 
7501
 
 
7502
    narray3[0] = &ngcd[12]; narray3[1] = &ngcd[13]; narray3[2] = NULL;
 
7503
 
 
7504
    narray2[0] = &ngcd[10]; narray2[1] = &ngcd[11]; narray2[2] = NULL;
 
7505
    narray2[3] = GCD_RowSpan; narray2[4] = &nb3; narray2[5] = NULL;
 
7506
    narray2[6] = NULL;
 
7507
 
 
7508
    narray[0] = &ngcd[0]; narray[1] = &ngcd[1]; narray[2] = NULL;
 
7509
    narray[3] = &ngcd[2]; narray[4] = &ngcd[3]; narray[5] = NULL;
 
7510
    narray[6] = &ngcd[4]; narray[7] = &ngcd[5]; narray[8] = NULL;
 
7511
    narray[9] = &ngcd[6]; narray[10] = &ngcd[7]; narray[11] = NULL;
 
7512
    narray[12] = &ngcd[8]; narray[13] = &ngcd[9]; narray[14] = NULL;
 
7513
    narray[15] = &nb2; narray[16] = GCD_ColSpan; narray[17] = NULL;
 
7514
    narray[18] = &ngcd[14]; narray[19] = GCD_ColSpan; narray[20] = NULL;
 
7515
    narray[21] = &ngcd[15]; narray[22] = GCD_ColSpan; narray[23] = NULL;
 
7516
    narray[24] = NULL;
 
7517
 
 
7518
    nb3.gd.flags = gg_enabled|gg_visible;
 
7519
    nb3.gd.u.boxelements = narray3;
 
7520
    nb3.creator = GHBoxCreate;
 
7521
 
 
7522
    nb2.gd.flags = gg_enabled|gg_visible;
 
7523
    nb2.gd.u.boxelements = narray2;
 
7524
    nb2.creator = GHVBoxCreate;
 
7525
 
 
7526
    nb[0].gd.flags = gg_enabled|gg_visible;
 
7527
    nb[0].gd.u.boxelements = narray;
 
7528
    nb[0].creator = GHVBoxCreate;
 
7529
 
 
7530
/******************************************************************************/
 
7531
    memset(&xulabel,0,sizeof(xulabel));
 
7532
    memset(&xugcd,0,sizeof(xugcd));
 
7533
 
 
7534
    xugcd[0].gd.pos.x = 12; xugcd[0].gd.pos.y = 10+6;
 
7535
    xugcd[0].gd.flags = gg_visible | gg_enabled;
 
7536
    xulabel[0].text = (unichar_t *) _("_XUID:");
 
7537
    xulabel[0].text_is_1byte = true;
 
7538
    xulabel[0].text_in_resource = true;
 
7539
    xugcd[0].gd.label = &xulabel[0];
 
7540
    xugcd[0].creator = GLabelCreate;
 
7541
 
 
7542
    xugcd[1].gd.pos.x = 103; xugcd[1].gd.pos.y = xugcd[0].gd.pos.y-6; xugcd[1].gd.pos.width = 142;
 
7543
    xugcd[1].gd.flags = gg_visible | gg_enabled;
 
7544
    if ( sf->xuid!=NULL ) {
 
7545
        xulabel[1].text = (unichar_t *) sf->xuid;
 
7546
        xulabel[1].text_is_1byte = true;
 
7547
        xugcd[1].gd.label = &xulabel[1];
 
7548
    }
 
7549
    xugcd[1].gd.cid = CID_XUID;
 
7550
    xugcd[1].creator = GTextFieldCreate;
 
7551
 
 
7552
    xugcd[2].gd.pos.x = 12; xugcd[2].gd.pos.y = xugcd[1].gd.pos.y+26+6;
 
7553
    xulabel[2].text = (unichar_t *) _("_UniqueID:");
 
7554
    xulabel[2].text_is_1byte = true;
 
7555
    xulabel[2].text_in_resource = true;
 
7556
    xugcd[2].gd.label = &xulabel[2];
 
7557
    xugcd[2].gd.flags = gg_visible | gg_enabled;
 
7558
    xugcd[2].creator = GLabelCreate;
 
7559
 
 
7560
    xugcd[3].gd.pos.x = xugcd[1].gd.pos.x; xugcd[3].gd.pos.y = xugcd[2].gd.pos.y-6; xugcd[3].gd.pos.width = 80;
 
7561
    xugcd[3].gd.flags = gg_visible | gg_enabled;
 
7562
    xulabel[3].text = (unichar_t *) "";
 
7563
    xulabel[3].text_is_1byte = true;
 
7564
    if ( sf->uniqueid!=0 ) {
 
7565
        sprintf( uibuf, "%d", sf->uniqueid );
 
7566
        xulabel[3].text = (unichar_t *) uibuf;
 
7567
    }
 
7568
    xugcd[3].gd.label = &xulabel[3];
 
7569
    xugcd[3].gd.cid = CID_UniqueID;
 
7570
    xugcd[3].creator = GTextFieldCreate;
 
7571
 
 
7572
    xugcd[4].gd.pos.x = 8; xugcd[4].gd.pos.y = xugcd[3].gd.pos.y+26+6;
 
7573
    xulabel[4].text = (unichar_t *) _("(Adobe now considers XUID/UniqueID unnecessary)");
 
7574
    xulabel[4].text_is_1byte = true;
 
7575
    xulabel[4].text_in_resource = true;
 
7576
    xugcd[4].gd.label = &xulabel[4];
 
7577
    xugcd[4].gd.flags = gg_visible | gg_enabled;
 
7578
    xugcd[4].creator = GLabelCreate;
 
7579
 
 
7580
    xuarray[0] = &xugcd[0]; xuarray[1] = &xugcd[1]; xuarray[2] = NULL;
 
7581
    xuarray[3] = &xugcd[2]; xuarray[4] = &xugcd[3]; xuarray[5] = NULL;
 
7582
    xuarray[6] = &xugcd[4]; xuarray[7] = GCD_ColSpan; xuarray[8] = NULL;
 
7583
    xuarray[9] = GCD_Glue; xuarray[10] = GCD_Glue; xuarray[11] = NULL;
 
7584
    xuarray[12] = NULL;
 
7585
 
 
7586
    memset(xub,0,sizeof(xub));
 
7587
    xub[0].gd.flags = gg_enabled|gg_visible;
 
7588
    xub[0].gd.u.boxelements = xuarray;
 
7589
    xub[0].creator = GHVBoxCreate;
 
7590
 
 
7591
/******************************************************************************/
 
7592
    memset(&pslabel,0,sizeof(pslabel));
 
7593
    memset(&psgcd,0,sizeof(psgcd));
 
7594
 
 
7595
    psgcd[0].gd.pos.x = 12; psgcd[0].gd.pos.y = 12;
 
7596
    psgcd[0].gd.flags = gg_visible | gg_enabled;
 
7597
    pslabel[0].text = (unichar_t *) _("_Ascent:");
 
7598
    pslabel[0].text_is_1byte = true;
 
7599
    pslabel[0].text_in_resource = true;
 
7600
    psgcd[0].gd.label = &pslabel[0];
 
7601
    psgcd[0].creator = GLabelCreate;
 
7602
 
 
7603
    psgcd[1].gd.pos.x = 103; psgcd[1].gd.pos.y = psgcd[0].gd.pos.y-6; psgcd[1].gd.pos.width = 47;
 
7604
    psgcd[1].gd.flags = gg_visible | gg_enabled;
 
7605
    sprintf( asbuf, "%d", sf->ascent );
 
7606
    pslabel[1].text = (unichar_t *) asbuf;
 
7607
    pslabel[1].text_is_1byte = true;
 
7608
    psgcd[1].gd.label = &pslabel[1];
 
7609
    psgcd[1].gd.cid = CID_Ascent;
 
7610
    psgcd[1].gd.handle_controlevent = GFI_EmChanged;
 
7611
    psgcd[1].creator = GTextFieldCreate;
 
7612
 
 
7613
    psgcd[2].gd.pos.x = 155; psgcd[2].gd.pos.y = psgcd[0].gd.pos.y;
 
7614
    psgcd[2].gd.flags = gg_visible | gg_enabled;
 
7615
    pslabel[2].text = (unichar_t *) _("_Descent:");
 
7616
    pslabel[2].text_is_1byte = true;
 
7617
    pslabel[2].text_in_resource = true;
 
7618
    psgcd[2].gd.label = &pslabel[2];
 
7619
    psgcd[2].creator = GLabelCreate;
 
7620
 
 
7621
    psgcd[3].gd.pos.x = 200; psgcd[3].gd.pos.y = psgcd[1].gd.pos.y; psgcd[3].gd.pos.width = 47;
 
7622
    psgcd[3].gd.flags = gg_visible | gg_enabled;
 
7623
    sprintf( dsbuf, "%d", sf->descent );
 
7624
    pslabel[3].text = (unichar_t *) dsbuf;
 
7625
    pslabel[3].text_is_1byte = true;
 
7626
    psgcd[3].gd.label = &pslabel[3];
 
7627
    psgcd[3].gd.cid = CID_Descent;
 
7628
    psgcd[3].gd.handle_controlevent = GFI_EmChanged;
 
7629
    psgcd[3].creator = GTextFieldCreate;
 
7630
 
 
7631
    psgcd[4].gd.pos.x = psgcd[0].gd.pos.x+5; psgcd[4].gd.pos.y = psgcd[0].gd.pos.y+24;
 
7632
    psgcd[4].gd.flags = gg_visible | gg_enabled;
 
7633
    pslabel[4].text = (unichar_t *) _(" _Em Size:");
 
7634
    pslabel[4].text_is_1byte = true;
 
7635
    pslabel[4].text_in_resource = true;
 
7636
    psgcd[4].gd.label = &pslabel[4];
 
7637
    psgcd[4].creator = GLabelCreate;
 
7638
 
 
7639
    psgcd[5].gd.pos.x = psgcd[1].gd.pos.x-20; psgcd[5].gd.pos.y = psgcd[1].gd.pos.y+24; psgcd[5].gd.pos.width = 67;
 
7640
    psgcd[5].gd.flags = gg_visible | gg_enabled;
 
7641
    sprintf( embuf, "%d", sf->descent+sf->ascent );
 
7642
    pslabel[5].text = (unichar_t *) embuf;
 
7643
    pslabel[5].text_is_1byte = true;
 
7644
    psgcd[5].gd.label = &pslabel[5];
 
7645
    psgcd[5].gd.cid = CID_Em;
 
7646
    psgcd[5].gd.u.list = emsizes;
 
7647
    psgcd[5].gd.handle_controlevent = GFI_EmChanged;
 
7648
    psgcd[5].creator = GListFieldCreate;
 
7649
 
 
7650
    psgcd[6].gd.pos.x = psgcd[2].gd.pos.x; psgcd[6].gd.pos.y = psgcd[4].gd.pos.y-4;
 
7651
    psgcd[6].gd.flags = gg_visible | gg_enabled | gg_cb_on;
 
7652
    pslabel[6].text = (unichar_t *) _("_Scale Outlines");
 
7653
    pslabel[6].text_is_1byte = true;
 
7654
    pslabel[6].text_in_resource = true;
 
7655
    psgcd[6].gd.label = &pslabel[6];
 
7656
    psgcd[6].gd.cid = CID_Scale;
 
7657
    psgcd[6].creator = GCheckBoxCreate;
 
7658
 
 
7659
/* I've reversed the label, text field order in the gcd here because */
 
7660
/*  that way the text field will be displayed on top of the label rather */
 
7661
/*  than the reverse, and in Russian that's important translation of */
 
7662
/*  "Italic Angle" is too long. Oops, no it's the next one, might as well leave in here though */
 
7663
    psgcd[8].gd.pos.x = 12; psgcd[8].gd.pos.y = psgcd[5].gd.pos.y+26+6;
 
7664
    psgcd[8].gd.flags = gg_visible | gg_enabled;
 
7665
    pslabel[8].text = (unichar_t *) _("_Italic Angle:");
 
7666
    pslabel[8].text_is_1byte = true;
 
7667
    pslabel[8].text_in_resource = true;
 
7668
    psgcd[8].gd.label = &pslabel[8];
 
7669
    psgcd[8].creator = GLabelCreate;
 
7670
 
 
7671
    psgcd[7].gd.pos.x = 103; psgcd[7].gd.pos.y = psgcd[8].gd.pos.y-6;
 
7672
    psgcd[7].gd.pos.width = 47;
 
7673
    psgcd[7].gd.flags = gg_visible | gg_enabled;
 
7674
    sprintf( iabuf, "%g", (double) sf->italicangle );
 
7675
    pslabel[7].text = (unichar_t *) iabuf;
 
7676
    pslabel[7].text_is_1byte = true;
 
7677
    psgcd[7].gd.label = &pslabel[7];
 
7678
    psgcd[7].gd.cid = CID_ItalicAngle;
 
7679
    psgcd[7].creator = GTextFieldCreate;
 
7680
 
 
7681
    psgcd[9].gd.pos.y = psgcd[7].gd.pos.y;
 
7682
    psgcd[9].gd.pos.width = -1; psgcd[9].gd.pos.height = 0;
 
7683
    psgcd[9].gd.pos.x = psgcd[3].gd.pos.x+psgcd[3].gd.pos.width-
 
7684
            GIntGetResource(_NUM_Buttonsize)*100/GIntGetResource(_NUM_ScaleFactor);
 
7685
    /*if ( strstrmatch(sf->fontname,"Italic")!=NULL ||strstrmatch(sf->fontname,"Oblique")!=NULL )*/
 
7686
        psgcd[9].gd.flags = gg_visible | gg_enabled;
 
7687
    pslabel[9].text = (unichar_t *) _("_Guess");
 
7688
    pslabel[9].text_is_1byte = true;
 
7689
    pslabel[9].text_in_resource = true;
 
7690
    psgcd[9].gd.label = &pslabel[9];
 
7691
    psgcd[9].gd.handle_controlevent = GFI_GuessItalic;
 
7692
    psgcd[9].creator = GButtonCreate;
 
7693
 
 
7694
/* I've reversed the label, text field order in the gcd here because */
 
7695
/*  that way the text field will be displayed on top of the label rather */
 
7696
/*  than the reverse, and in Russian that's important translation of */
 
7697
/*  "Underline position" is too long. */
 
7698
    psgcd[11].gd.pos.x = 12; psgcd[11].gd.pos.y = psgcd[7].gd.pos.y+26+6;
 
7699
    psgcd[11].gd.flags = gg_visible | gg_enabled;
 
7700
    pslabel[11].text = (unichar_t *) _("Underline _Position:");
 
7701
    pslabel[11].text_is_1byte = true;
 
7702
    pslabel[11].text_in_resource = true;
 
7703
    psgcd[11].gd.label = &pslabel[11];
 
7704
    psgcd[11].creator = GLabelCreate;
 
7705
 
 
7706
    psgcd[10].gd.pos.x = 103; psgcd[10].gd.pos.y = psgcd[11].gd.pos.y-6; psgcd[10].gd.pos.width = 47;
 
7707
    psgcd[10].gd.flags = gg_visible | gg_enabled;
 
7708
    sprintf( upbuf, "%g", (double) sf->upos );
 
7709
    pslabel[10].text = (unichar_t *) upbuf;
 
7710
    pslabel[10].text_is_1byte = true;
 
7711
    psgcd[10].gd.label = &pslabel[10];
 
7712
    psgcd[10].gd.cid = CID_UPos;
 
7713
    psgcd[10].creator = GTextFieldCreate;
 
7714
 
 
7715
    psgcd[12].gd.pos.x = 155; psgcd[12].gd.pos.y = psgcd[11].gd.pos.y;
 
7716
    psgcd[12].gd.flags = gg_visible | gg_enabled;
 
7717
    pslabel[12].text = (unichar_t *) S_("Underline|_Height:");
 
7718
    pslabel[12].text_is_1byte = true;
 
7719
    pslabel[12].text_in_resource = true;
 
7720
    psgcd[12].gd.label = &pslabel[12];
 
7721
    psgcd[12].creator = GLabelCreate;
 
7722
 
 
7723
    psgcd[13].gd.pos.x = 200; psgcd[13].gd.pos.y = psgcd[10].gd.pos.y; psgcd[13].gd.pos.width = 47;
 
7724
    psgcd[13].gd.flags = gg_visible | gg_enabled;
 
7725
    sprintf( uwbuf, "%g", (double) sf->uwidth );
 
7726
    pslabel[13].text = (unichar_t *) uwbuf;
 
7727
    pslabel[13].text_is_1byte = true;
 
7728
    psgcd[13].gd.label = &pslabel[13];
 
7729
    psgcd[13].gd.cid = CID_UWidth;
 
7730
    psgcd[13].creator = GTextFieldCreate;
 
7731
 
 
7732
    psgcd[14].gd.pos.x = 12; psgcd[14].gd.pos.y = psgcd[13].gd.pos.y+26;
 
7733
    pslabel[14].text = (unichar_t *) _("Has _Vertical Metrics");
 
7734
    pslabel[14].text_is_1byte = true;
 
7735
    pslabel[14].text_in_resource = true;
 
7736
    psgcd[14].gd.label = &pslabel[14];
 
7737
    psgcd[14].gd.cid = CID_HasVerticalMetrics;
 
7738
    psgcd[14].gd.flags = gg_visible | gg_enabled;
 
7739
    if ( sf->hasvmetrics )
 
7740
        psgcd[14].gd.flags |= gg_cb_on;
 
7741
    psgcd[14].gd.handle_controlevent = GFI_VMetricsCheck;
 
7742
    psgcd[14].creator = GCheckBoxCreate;
 
7743
 
 
7744
    psgcd[15].gd.pos.x = 12; psgcd[15].gd.pos.y = psgcd[14].gd.pos.y+22;
 
7745
    pslabel[15].text = (unichar_t *) _("Vertical _Origin:");
 
7746
    pslabel[15].text_is_1byte = true;
 
7747
    pslabel[15].text_in_resource = true;
 
7748
    psgcd[15].gd.label = &pslabel[15];
 
7749
    psgcd[15].gd.flags = sf->hasvmetrics ? (gg_visible | gg_enabled) : gg_visible;
 
7750
    psgcd[15].gd.cid = CID_VOriginLab;
 
7751
    psgcd[15].creator = GLabelCreate;
 
7752
 
 
7753
    psgcd[16].gd.pos.x = psgcd[7].gd.pos.x; psgcd[16].gd.pos.y = psgcd[15].gd.pos.y-4; psgcd[16].gd.pos.width = psgcd[15].gd.pos.width;
 
7754
    psgcd[16].gd.flags = sf->hasvmetrics ? (gg_visible | gg_enabled) : gg_visible;
 
7755
    pslabel[16].text = (unichar_t *) "";
 
7756
    pslabel[16].text_is_1byte = true;
 
7757
    if ( sf->vertical_origin!=0 || sf->hasvmetrics ) {
 
7758
        sprintf( vorig, "%d", sf->vertical_origin );
 
7759
        pslabel[16].text = (unichar_t *) vorig;
 
7760
    }
 
7761
    psgcd[16].gd.label = &pslabel[16];
 
7762
    psgcd[16].gd.cid = CID_VOrigin;
 
7763
    psgcd[16].creator = GTextFieldCreate;
 
7764
 
 
7765
    psgcd[17].gd.pos.x = 12; psgcd[17].gd.pos.y = psgcd[16].gd.pos.y+22;
 
7766
    pslabel[17].text = (unichar_t *) _("_Quadratic Splines");
 
7767
    pslabel[17].text_is_1byte = true;
 
7768
    pslabel[17].text_in_resource = true;
 
7769
    psgcd[17].gd.label = &pslabel[17];
 
7770
    psgcd[17].gd.flags = sf->order2 ? (gg_visible | gg_enabled | gg_cb_on | gg_utf8_popup) : (gg_visible | gg_enabled | gg_utf8_popup);
 
7771
    psgcd[17].gd.cid = CID_IsOrder2;
 
7772
    psgcd[17].creator = GCheckBoxCreate;
 
7773
    psgcd[17].gd.popup_msg = (unichar_t *) _("Use quadratic (that is truetype) splines to hold the outlines of this\nfont rather than cubic (postscript) splines. Set this option if you\nare editing truetype font. Unset it if you are editing an opentype\nor postscript font (FontForge will convert to the appropriate\nspline type when it generates fonts so this is not required).");
 
7774
 
 
7775
#ifdef FONTFORGE_CONFIG_TYPE3
 
7776
    psgcd[18].gd.pos.x = 12; psgcd[18].gd.pos.y = psgcd[17].gd.pos.y+18;
 
7777
    pslabel[18].text = (unichar_t *) _("_Outline Font");
 
7778
    pslabel[18].text_is_1byte = true;
 
7779
    pslabel[18].text_in_resource = true;
 
7780
    psgcd[18].gd.label = &pslabel[18];
 
7781
    psgcd[18].gd.flags = (!sf->strokedfont && !sf->multilayer)?
 
7782
            (gg_visible | gg_enabled | gg_cb_on) : (gg_visible | gg_enabled);
 
7783
    psgcd[18].creator = GRadioCreate;
 
7784
 
 
7785
    psgcd[19].gd.pos.x = 12; psgcd[19].gd.pos.y = psgcd[18].gd.pos.y+14;
 
7786
    pslabel[19].text = (unichar_t *) _("_Multi Layered Font");
 
7787
    pslabel[19].text_is_1byte = true;
 
7788
    pslabel[19].text_in_resource = true;
 
7789
    psgcd[19].gd.label = &pslabel[19];
 
7790
    psgcd[19].gd.flags = sf->multilayer ? (gg_visible | gg_enabled | gg_utf8_popup | gg_cb_on | gg_rad_continueold) : (gg_visible | gg_enabled | gg_utf8_popup | gg_rad_continueold);
 
7791
    psgcd[19].gd.cid = CID_IsMultiLayer;
 
7792
    psgcd[19].creator = GRadioCreate;
 
7793
    psgcd[19].gd.popup_msg = (unichar_t *) _("Allow editing of multiple colors and shades, fills and strokes.\nMulti layered fonts can only be output as type3 or svg fonts.");
 
7794
 
 
7795
    psgcd[20].gd.pos.x = 12; psgcd[20].gd.pos.y = psgcd[19].gd.pos.y+14;
 
7796
    pslabel[20].text = (unichar_t *) _("_Stroked Font");
 
7797
    pslabel[20].text_is_1byte = true;
 
7798
    pslabel[20].text_in_resource = true;
 
7799
    psgcd[20].gd.label = &pslabel[20];
 
7800
    psgcd[20].gd.flags = sf->strokedfont ? (gg_visible | gg_enabled | gg_utf8_popup | gg_cb_on) : (gg_visible | gg_enabled | gg_utf8_popup);
 
7801
    psgcd[20].gd.cid = CID_IsStrokedFont;
 
7802
    psgcd[20].creator = GRadioCreate;
 
7803
    psgcd[20].gd.popup_msg = (unichar_t *) _("Glyphs will be composed of stroked lines rather than filled outlines.\nAll glyphs are stroked at the following width");
 
7804
 
 
7805
    k=21;
 
7806
#else
 
7807
    psgcd[18].gd.pos.x = 12; psgcd[18].gd.pos.y = psgcd[17].gd.pos.y+16;
 
7808
    pslabel[18].text = (unichar_t *) _("_Stroked Font");
 
7809
    pslabel[18].text_is_1byte = true;
 
7810
    pslabel[18].text_in_resource = true;
 
7811
    psgcd[18].gd.label = &pslabel[18];
 
7812
    psgcd[18].gd.flags = sf->strokedfont ? (gg_visible | gg_enabled | gg_utf8_popup | gg_cb_on) : (gg_visible | gg_enabled | gg_utf8_popup);
 
7813
    psgcd[18].gd.cid = CID_IsStrokedFont;
 
7814
    psgcd[18].creator = GCheckBoxCreate;
 
7815
    psgcd[18].gd.popup_msg = (unichar_t *) _("Glyphs will be composed of stroked lines rather than filled outlines.\nAll glyphs are stroked at the following width");
 
7816
 
 
7817
    k=19;
 
7818
#endif
 
7819
 
 
7820
    psgcd[k].gd.pos.x = 12; psgcd[k].gd.pos.y = psgcd[k-1].gd.pos.y+20;
 
7821
    pslabel[k].text = (unichar_t *) _("Stroke _Width:");
 
7822
    pslabel[k].text_is_1byte = true;
 
7823
    pslabel[k].text_in_resource = true;
 
7824
    psgcd[k].gd.label = &pslabel[k];
 
7825
    psgcd[k].gd.flags = gg_visible | gg_enabled;
 
7826
    psgcd[k++].creator = GLabelCreate;
 
7827
 
 
7828
    sprintf( swbuf,"%g", (double) sf->strokewidth );
 
7829
    psgcd[k].gd.pos.x = 115; psgcd[k].gd.pos.y = psgcd[k-1].gd.pos.y-6; psgcd[k].gd.pos.width = 137;
 
7830
    psgcd[k].gd.flags = gg_visible | gg_enabled;
 
7831
    pslabel[k].text = (unichar_t *) swbuf;
 
7832
    pslabel[k].text_is_1byte = true;
 
7833
    psgcd[k].gd.label = &pslabel[k];
 
7834
    psgcd[k].gd.cid = CID_StrokeWidth;
 
7835
    psgcd[k++].creator = GTextFieldCreate;
 
7836
 
 
7837
    psgcd[k].gd.pos.x = psgcd[k-2].gd.pos.x; psgcd[k].gd.pos.y = psgcd[k-1].gd.pos.y+32;
 
7838
    psgcd[k].gd.flags = gg_visible | gg_enabled;
 
7839
    pslabel[k].text = (unichar_t *) _("Interpretation:");
 
7840
    pslabel[k].text_is_1byte = true;
 
7841
    pslabel[k].text_in_resource = true;
 
7842
    psgcd[k].gd.label = &pslabel[k];
 
7843
    psgcd[k++].creator = GLabelCreate;
 
7844
 
 
7845
    psgcd[k].gd.pos.x = psgcd[k-2].gd.pos.x; psgcd[k].gd.pos.y = psgcd[k-1].gd.pos.y-6;
 
7846
    psgcd[k].gd.flags = gg_visible | gg_enabled;
 
7847
    psgcd[k].gd.u.list = interpretations;
 
7848
    psgcd[k].gd.cid = CID_Interpretation;
 
7849
    psgcd[k].creator = GListButtonCreate;
 
7850
    for ( i=0; interpretations[i].text!=NULL || interpretations[i].line; ++i ) {
 
7851
        if ( (void *) (sf->uni_interp)==interpretations[i].userdata &&
 
7852
                interpretations[i].text!=NULL ) {
 
7853
            interpretations[i].selected = true;
 
7854
            psgcd[k].gd.label = &interpretations[i];
 
7855
        } else
 
7856
            interpretations[i].selected = false;
 
7857
    }
 
7858
    ++k;
 
7859
 
 
7860
    psgcd[k].gd.pos.x = psgcd[k-2].gd.pos.x; psgcd[k].gd.pos.y = psgcd[k-1].gd.pos.y+32;
 
7861
    psgcd[k].gd.flags = gg_visible | gg_enabled;
 
7862
    pslabel[k].text = (unichar_t *) _("Name List:");
 
7863
    pslabel[k].text_is_1byte = true;
 
7864
    pslabel[k].text_in_resource = true;
 
7865
    psgcd[k].gd.label = &pslabel[k];
 
7866
    psgcd[k++].creator = GLabelCreate;
 
7867
 
 
7868
    psgcd[k].gd.pos.x = psgcd[k-2].gd.pos.x; psgcd[k].gd.pos.y = psgcd[k-1].gd.pos.y-6;
 
7869
    psgcd[k].gd.flags = gg_visible | gg_enabled;
 
7870
    psgcd[k].gd.cid = CID_Namelist;
 
7871
    psgcd[k].creator = GListButtonCreate;
 
7872
    nlnames = AllNamelistNames();
 
7873
    for ( i=0; nlnames[i]!=NULL; ++i);
 
7874
    namelistnames = gcalloc(i+1,sizeof(GTextInfo));
 
7875
    for ( i=0; nlnames[i]!=NULL; ++i) {
 
7876
        namelistnames[i].text = (unichar_t *) nlnames[i];
 
7877
        namelistnames[i].text_is_1byte = true;
 
7878
        if ( strcmp(_(sf->for_new_glyphs->title),nlnames[i])==0 ) {
 
7879
            namelistnames[i].selected = true;
 
7880
            psgcd[k].gd.label = &namelistnames[i];
 
7881
        }
 
7882
    }
 
7883
    psgcd[k++].gd.u.list = namelistnames;
 
7884
    free(nlnames);
 
7885
 
 
7886
 
 
7887
    if ( sf->subfontcnt!=0 ) {
 
7888
        for ( i=0; i<=13; ++i )
 
7889
            psgcd[i].gd.flags &= ~gg_enabled;
 
7890
    } else if ( sf->cidmaster!=NULL ) {
 
7891
        for ( i=14; i<=16; ++i )
 
7892
            psgcd[i].gd.flags &= ~gg_enabled;
 
7893
    }
 
7894
 
 
7895
    psarray[0] = &psb2[0];
 
7896
    psarray[1] = &psgcd[14];
 
7897
    psarray[2] = &psb2[1];
 
7898
    psarray[3] = &psgcd[17];
 
7899
    psarray[4] = &psgcd[18];
 
7900
#ifdef FONTFORGE_CONFIG_TYPE3
 
7901
    psarray[5] = &psgcd[19];
 
7902
    psarray[6] = &psgcd[20];
 
7903
    j=7;
 
7904
#else
 
7905
    j=5;
 
7906
#endif
 
7907
    psarray[j++] = &psb2[2];
 
7908
    psrow = j;
 
7909
    psarray[j++] = GCD_Glue;
 
7910
    psarray[j++] = NULL;
 
7911
 
 
7912
    psarray2[0] = &psgcd[0]; psarray2[1] = &psgcd[1]; psarray2[2] = &psgcd[2]; psarray2[3] = &psgcd[3]; psarray2[4] = NULL;
 
7913
    psarray2[5] = &psgcd[4]; psarray2[6] = &psgcd[5]; psarray2[7] = &psgcd[6]; psarray2[8] = GCD_ColSpan; psarray2[9] = NULL;
 
7914
    psarray2[10] = &psgcd[8]; psarray2[11] = &psgcd[7]; psarray2[12] = &psgcd[9]; psarray2[13] = GCD_ColSpan; psarray2[14] = NULL;
 
7915
    psarray2[15] = &psgcd[11]; psarray2[16] = &psgcd[10]; psarray2[17] = &psgcd[12]; psarray2[18] = &psgcd[13]; psarray2[19] = NULL;
 
7916
    psarray2[20] = NULL;
 
7917
 
 
7918
    psarray3[0] = &psgcd[15]; psarray3[1] = &psgcd[16]; psarray3[2] = NULL;
 
7919
 
 
7920
    psarray4[0] = &psgcd[k-6]; psarray4[1] = &psgcd[k-5]; psarray4[2] = NULL;
 
7921
    psarray4[3] = &psgcd[k-4]; psarray4[4] = &psgcd[k-3]; psarray4[5] = NULL;
 
7922
    psarray4[6] = &psgcd[k-2]; psarray4[7] = &psgcd[k-1]; psarray4[8] = NULL;
 
7923
    psarray4[9] = NULL;
 
7924
 
 
7925
    memset(psb,0,sizeof(psb));
 
7926
    psb[0].gd.flags = gg_enabled|gg_visible;
 
7927
    psb[0].gd.u.boxelements = psarray;
 
7928
    psb[0].creator = GVBoxCreate;
 
7929
 
 
7930
    memset(psb2,0,sizeof(psb2));
 
7931
    psb2[0].gd.flags = gg_enabled|gg_visible;
 
7932
    psb2[0].gd.u.boxelements = psarray2;
 
7933
    psb2[0].creator = GHVBoxCreate;
 
7934
 
 
7935
    psb2[1].gd.flags = gg_enabled|gg_visible;
 
7936
    psb2[1].gd.u.boxelements = psarray3;
 
7937
    psb2[1].creator = GHBoxCreate;
 
7938
 
 
7939
    psb2[2].gd.flags = gg_enabled|gg_visible;
 
7940
    psb2[2].gd.u.boxelements = psarray4;
 
7941
    psb2[2].creator = GHVBoxCreate;
 
7942
/******************************************************************************/
 
7943
 
 
7944
    memset(&plabel,0,sizeof(plabel));
 
7945
    memset(&pgcd,0,sizeof(pgcd));
 
7946
 
 
7947
    pgcd[0].gd.pos.x = 10; pgcd[0].gd.pos.y = 6;
 
7948
    pgcd[0].gd.pos.width = 240; pgcd[0].gd.pos.height = 8*12+10;
 
7949
    pgcd[0].gd.flags = gg_visible | gg_enabled;
 
7950
    pgcd[0].gd.cid = CID_PrivateEntries;
 
7951
    pgcd[0].gd.u.list = PI_ListSet(sf);
 
7952
    pgcd[0].gd.handle_controlevent = PI_ListSel;
 
7953
    pgcd[0].creator = GListCreate;
 
7954
 
 
7955
    pgcd[1].gd.pos.x = 10; pgcd[1].gd.pos.y = pgcd[0].gd.pos.y+pgcd[0].gd.pos.height+10;
 
7956
    pgcd[1].gd.pos.width = pgcd[0].gd.pos.width; pgcd[1].gd.pos.height = 8*12+10;
 
7957
    pgcd[1].gd.flags = gg_visible | gg_enabled;
 
7958
    pgcd[1].gd.cid = CID_PrivateValues;
 
7959
    pgcd[1].creator = GTextAreaCreate;
 
7960
 
 
7961
    pgcd[2].gd.pos.x = 10; pgcd[2].gd.pos.y = 300-35-30;
 
7962
    pgcd[2].gd.pos.width = -1; pgcd[2].gd.pos.height = 0;
 
7963
    pgcd[2].gd.flags = gg_visible | gg_enabled ;
 
7964
    plabel[2].text = (unichar_t *) _("_Add");
 
7965
    plabel[2].text_is_1byte = true;
 
7966
    plabel[2].text_in_resource = true;
 
7967
    pgcd[2].gd.label = &plabel[2];
 
7968
    pgcd[2].gd.handle_controlevent = PI_Add;
 
7969
    pgcd[2].gd.cid = CID_Add;
 
7970
    pgcd[2].creator = GButtonCreate;
 
7971
 
 
7972
    pgcd[3].gd.pos.x = (260)/2-GIntGetResource(_NUM_Buttonsize)*100/GIntGetResource(_NUM_ScaleFactor)-5;
 
7973
    pgcd[3].gd.pos.y = pgcd[2].gd.pos.y;
 
7974
    pgcd[3].gd.pos.width = -1; pgcd[3].gd.pos.height = 0;
 
7975
    pgcd[3].gd.flags = gg_visible ;
 
7976
    plabel[3].text = (unichar_t *) _("_Guess");
 
7977
    plabel[3].text_is_1byte = true;
 
7978
    plabel[3].text_in_resource = true;
 
7979
    pgcd[3].gd.label = &plabel[3];
 
7980
    pgcd[3].gd.handle_controlevent = PI_Guess;
 
7981
    pgcd[3].gd.cid = CID_Guess;
 
7982
    pgcd[3].creator = GButtonCreate;
 
7983
 
 
7984
    pgcd[4].gd.pos.x = -(260/2-GIntGetResource(_NUM_Buttonsize)*100/GIntGetResource(_NUM_ScaleFactor)-5);
 
7985
    pgcd[4].gd.pos.y = pgcd[2].gd.pos.y;
 
7986
    pgcd[4].gd.pos.width = -1; pgcd[4].gd.pos.height = 0;
 
7987
    pgcd[4].gd.flags = gg_visible | gg_utf8_popup ;
 
7988
/* GT: This is an abbreviation for Histogram */
 
7989
    plabel[4].text = (unichar_t *) _("_Hist.");
 
7990
    plabel[4].text_is_1byte = true;
 
7991
    plabel[4].text_in_resource = true;
 
7992
    pgcd[4].gd.label = &plabel[4];
 
7993
    pgcd[4].gd.handle_controlevent = PI_Hist;
 
7994
    pgcd[4].gd.cid = CID_Hist;
 
7995
    pgcd[4].gd.popup_msg = (unichar_t *) _("Histogram Dialog");
 
7996
    pgcd[4].creator = GButtonCreate;
 
7997
 
 
7998
    pgcd[5].gd.pos.x = -10; pgcd[5].gd.pos.y = pgcd[2].gd.pos.y;
 
7999
    pgcd[5].gd.pos.width = -1; pgcd[5].gd.pos.height = 0;
 
8000
    pgcd[5].gd.flags = gg_visible | gg_enabled ;
 
8001
    plabel[5].text = (unichar_t *) _("_Remove");
 
8002
    plabel[5].text_is_1byte = true;
 
8003
    plabel[5].text_in_resource = true;
 
8004
    pgcd[5].gd.label = &plabel[5];
 
8005
    pgcd[5].gd.handle_controlevent = PI_Delete;
 
8006
    pgcd[5].gd.cid = CID_Remove;
 
8007
    pgcd[5].creator = GButtonCreate;
 
8008
 
 
8009
    ppbuttons[0] = &pgcd[2]; ppbuttons[1] = &pgcd[3];
 
8010
    ppbuttons[2] = &pgcd[4]; ppbuttons[3] = &pgcd[5]; ppbuttons[4] = NULL;
 
8011
 
 
8012
    pparray[0] = &pgcd[0]; pparray[1] = &pgcd[1]; pparray[2] = &ppbox[2];
 
8013
    pparray[3] = NULL;
 
8014
 
 
8015
    memset(ppbox,0,sizeof(ppbox));
 
8016
    ppbox[0].gd.flags = gg_enabled|gg_visible;
 
8017
    ppbox[0].gd.u.boxelements = pparray;
 
8018
    ppbox[0].creator = GVBoxCreate;
 
8019
 
 
8020
    ppbox[2].gd.flags = gg_enabled|gg_visible;
 
8021
    ppbox[2].gd.u.boxelements = ppbuttons;
 
8022
    ppbox[2].creator = GHBoxCreate;
 
8023
/******************************************************************************/
 
8024
    memset(&vlabel,0,sizeof(vlabel));
 
8025
    memset(&vgcd,0,sizeof(vgcd));
 
8026
 
 
8027
    vgcd[0].gd.pos.x = 10; vgcd[0].gd.pos.y = 12;
 
8028
    vlabel[0].text = (unichar_t *) _("_Weight Class");
 
8029
    vlabel[0].text_is_1byte = true;
 
8030
    vlabel[0].text_in_resource = true;
 
8031
    vgcd[0].gd.label = &vlabel[0];
 
8032
    vgcd[0].gd.flags = gg_visible | gg_enabled;
 
8033
    vgcd[0].creator = GLabelCreate;
 
8034
 
 
8035
    vgcd[1].gd.pos.x = 90; vgcd[1].gd.pos.y = vgcd[0].gd.pos.y-6; vgcd[1].gd.pos.width = 140;
 
8036
    vgcd[1].gd.flags = gg_visible | gg_enabled;
 
8037
    vgcd[1].gd.cid = CID_WeightClass;
 
8038
    vgcd[1].gd.u.list = weightclass;
 
8039
    vgcd[1].creator = GListFieldCreate;
 
8040
 
 
8041
    vgcd[2].gd.pos.x = 10; vgcd[2].gd.pos.y = vgcd[1].gd.pos.y+26+6;
 
8042
    vlabel[2].text = (unichar_t *) _("Width _Class");
 
8043
    vlabel[2].text_is_1byte = true;
 
8044
    vlabel[2].text_in_resource = true;
 
8045
    vgcd[2].gd.label = &vlabel[2];
 
8046
    vgcd[2].gd.flags = gg_visible | gg_enabled;
 
8047
    vgcd[2].creator = GLabelCreate;
 
8048
 
 
8049
    vgcd[3].gd.pos.x = 90; vgcd[3].gd.pos.y = vgcd[2].gd.pos.y-6;
 
8050
    vgcd[3].gd.flags = gg_visible | gg_enabled;
 
8051
    vgcd[3].gd.cid = CID_WidthClass;
 
8052
    vgcd[3].gd.u.list = widthclass;
 
8053
    vgcd[3].creator = GListButtonCreate;
 
8054
 
 
8055
    vgcd[4].gd.pos.x = 10; vgcd[4].gd.pos.y = vgcd[3].gd.pos.y+26+6;
 
8056
    vlabel[4].text = (unichar_t *) _("P_FM Family");
 
8057
    vlabel[4].text_is_1byte = true;
 
8058
    vlabel[4].text_in_resource = true;
 
8059
    vgcd[4].gd.label = &vlabel[4];
 
8060
    vgcd[4].gd.flags = gg_visible | gg_enabled;
 
8061
    vgcd[4].creator = GLabelCreate;
 
8062
 
 
8063
    vgcd[5].gd.pos.x = 90; vgcd[5].gd.pos.y = vgcd[4].gd.pos.y-6; vgcd[5].gd.pos.width = 140;
 
8064
    vgcd[5].gd.flags = gg_visible | gg_enabled;
 
8065
    vgcd[5].gd.cid = CID_PFMFamily;
 
8066
    vgcd[5].gd.u.list = pfmfamily;
 
8067
    vgcd[5].creator = GListButtonCreate;
 
8068
 
 
8069
    vgcd[6].gd.pos.x = 10; vgcd[6].gd.pos.y = vgcd[5].gd.pos.y+26+6;
 
8070
    vlabel[6].text = (unichar_t *) _("_Embeddable");
 
8071
    vlabel[6].text_is_1byte = true;
 
8072
    vlabel[6].text_in_resource = true;
 
8073
    vgcd[6].gd.label = &vlabel[6];
 
8074
    vgcd[6].gd.flags = gg_visible | gg_enabled | gg_utf8_popup;
 
8075
    vgcd[6].gd.popup_msg = (unichar_t *) _("Can this font be embedded in a downloadable (pdf)\ndocument, and if so, what behaviors are permitted on\nboth the document and the font.");
 
8076
    vgcd[6].creator = GLabelCreate;
 
8077
 
 
8078
    vgcd[7].gd.pos.x = 90; vgcd[7].gd.pos.y = vgcd[6].gd.pos.y-6;
 
8079
    vgcd[7].gd.pos.width = 140;
 
8080
    vgcd[7].gd.flags = gg_visible | gg_enabled | gg_utf8_popup;
 
8081
    vgcd[7].gd.cid = CID_FSType;
 
8082
    vgcd[7].gd.u.list = fstype;
 
8083
    vgcd[7].gd.popup_msg = vgcd[6].gd.popup_msg;
 
8084
    vgcd[7].creator = GListButtonCreate;
 
8085
    fstype[0].selected = fstype[1].selected =
 
8086
            fstype[2].selected = fstype[3].selected = false;
 
8087
    if ( sf->pfminfo.fstype&0x8 /* also catches the "not set" case == -1 */ )
 
8088
        i = 2;
 
8089
    else if ( sf->pfminfo.fstype&0x4 )
 
8090
        i = 1;
 
8091
    else if ( sf->pfminfo.fstype&0x2 )
 
8092
        i = 0;
 
8093
    else
 
8094
        i = 3;
 
8095
    fstype[i].selected = true;
 
8096
    vgcd[7].gd.label = &fstype[i];
 
8097
 
 
8098
    vgcd[8].gd.pos.x = 20; vgcd[8].gd.pos.y = vgcd[7].gd.pos.y+26;
 
8099
    vlabel[8].text = (unichar_t *) _("No Subsetting");
 
8100
    vlabel[8].text_is_1byte = true;
 
8101
    vgcd[8].gd.label = &vlabel[8];
 
8102
    vgcd[8].gd.flags = gg_visible | gg_enabled | gg_utf8_popup;
 
8103
    if ( sf->pfminfo.fstype!=-1 && (sf->pfminfo.fstype&0x100) )
 
8104
        vgcd[8].gd.flags |= gg_cb_on;
 
8105
    vgcd[8].gd.popup_msg = (unichar_t *) _("If set then the entire font must be\nembedded in a document when any character is.\nOtherwise the document creator need\nonly include the characters it uses.");
 
8106
    vgcd[8].gd.cid = CID_NoSubsetting;
 
8107
    vgcd[8].creator = GCheckBoxCreate;
 
8108
 
 
8109
    vgcd[9].gd.pos.x = 110; vgcd[9].gd.pos.y = vgcd[8].gd.pos.y;
 
8110
    vlabel[9].text = (unichar_t *) _("Only Embed Bitmaps");
 
8111
    vlabel[9].text_is_1byte = true;
 
8112
    vgcd[9].gd.label = &vlabel[9];
 
8113
    vgcd[9].gd.flags = gg_visible | gg_enabled | gg_utf8_popup;
 
8114
    if ( sf->pfminfo.fstype!=-1 && ( sf->pfminfo.fstype&0x200 ))
 
8115
        vgcd[9].gd.flags |= gg_cb_on;
 
8116
    vgcd[9].gd.popup_msg = (unichar_t *) _("Only Bitmaps may be embedded.\nOutline descriptions may not be\n(if font file contains no bitmaps\nthen nothing may be embedded).");
 
8117
    vgcd[9].gd.cid = CID_OnlyBitmaps;
 
8118
    vgcd[9].creator = GCheckBoxCreate;
 
8119
 
 
8120
    vgcd[10].gd.pos.x = 10; vgcd[10].gd.pos.y = vgcd[9].gd.pos.y+24;
 
8121
    vlabel[10].text = (unichar_t *) _("Vendor ID:");
 
8122
    vlabel[10].text_is_1byte = true;
 
8123
    vgcd[10].gd.label = &vlabel[10];
 
8124
    vgcd[10].gd.flags = gg_visible | gg_enabled;
 
8125
    vgcd[10].creator = GLabelCreate;
 
8126
 
 
8127
    vgcd[11].gd.pos.x = 90; vgcd[11].gd.pos.y = vgcd[11-1].gd.pos.y-4;
 
8128
    vgcd[11].gd.pos.width = 50;
 
8129
    vgcd[11].gd.flags = gg_visible | gg_enabled;
 
8130
        /* value set later */
 
8131
    vgcd[11].gd.cid = CID_Vendor;
 
8132
    vgcd[11].creator = GTextFieldCreate;
 
8133
 
 
8134
    vgcd[12].gd.pos.x = 10; vgcd[12].gd.pos.y = vgcd[11].gd.pos.y+24+6;
 
8135
    vlabel[12].text = (unichar_t *) _("_IBM Family:");
 
8136
    vlabel[12].text_is_1byte = true;
 
8137
    vlabel[12].text_in_resource = true;
 
8138
    vgcd[12].gd.label = &vlabel[12];
 
8139
    vgcd[12].gd.flags = gg_visible | gg_enabled;
 
8140
    vgcd[12].creator = GLabelCreate;
 
8141
 
 
8142
    vgcd[13].gd.pos.x = 90; vgcd[13].gd.pos.y = vgcd[12].gd.pos.y-4; vgcd[13].gd.pos.width = vgcd[7].gd.pos.width;
 
8143
    vgcd[13].gd.flags = gg_visible | gg_enabled;
 
8144
    vgcd[13].gd.cid = CID_IBMFamily;
 
8145
    vgcd[13].gd.u.list = ibmfamily;
 
8146
    vgcd[13].creator = GListButtonCreate;
 
8147
 
 
8148
    vgcd[14].gd.pos.x = 10; vgcd[14].gd.pos.y = vgcd[13].gd.pos.y+24+6;
 
8149
    vlabel[14].text = (unichar_t *) _("Weight, Width, Slope Only");
 
8150
    vlabel[14].text_is_1byte = true;
 
8151
    vlabel[14].text_in_resource = true;
 
8152
    vgcd[14].gd.label = &vlabel[14];
 
8153
    vgcd[14].gd.cid = CID_WeightWidthSlopeOnly;
 
8154
    vgcd[14].gd.popup_msg = (unichar_t *) _("MS needs to know whether a font family's members differ\nonly in weight, width and slope (and not in other variables\nlike optical size)." );
 
8155
    vgcd[14].gd.flags = gg_visible | gg_enabled | gg_utf8_popup;
 
8156
    vgcd[14].creator = GCheckBoxCreate;
 
8157
 
 
8158
    vgcd[15].gd.pos.x = 10; vgcd[15].gd.pos.y = vgcd[11].gd.pos.y+24+6;
 
8159
    vlabel[15].text = (unichar_t *) _("_OS/2 Version");
 
8160
    vlabel[15].text_is_1byte = true;
 
8161
    vlabel[15].text_in_resource = true;
 
8162
    vgcd[15].gd.label = &vlabel[15];
 
8163
    vgcd[15].gd.popup_msg = (unichar_t *) _("The 'OS/2' table has changed slightly over the years,\nGenerally fields have been added, but occasionally their\nmeanings have been redefined." );
 
8164
    vgcd[15].gd.flags = gg_visible | gg_enabled | gg_utf8_popup;
 
8165
    vgcd[15].creator = GLabelCreate;
 
8166
 
 
8167
    vgcd[16].gd.pos.x = 90; vgcd[16].gd.pos.y = vgcd[15].gd.pos.y-4; vgcd[16].gd.pos.width = vgcd[7].gd.pos.width;
 
8168
    vgcd[16].gd.flags = gg_visible | gg_enabled;
 
8169
    vgcd[16].gd.cid = CID_OS2Version;
 
8170
    vgcd[16].gd.u.list = os2versions;
 
8171
    vgcd[16].creator = GListFieldCreate;
 
8172
 
 
8173
    vradio[0] = GCD_Glue; vradio[1] = &vgcd[8]; vradio[2] = &vgcd[9]; vradio[3] = GCD_Glue; vradio[4] = NULL;
 
8174
 
 
8175
    varray[0] = &vgcd[15]; varray[1] = &vgcd[16]; varray[2] = NULL;
 
8176
    varray[3] = &vgcd[0]; varray[4] = &vgcd[1]; varray[5] = NULL;
 
8177
    varray[6] = &vgcd[2]; varray[7] = &vgcd[3]; varray[8] = NULL;
 
8178
    varray[9] = &vgcd[4]; varray[10] = &vgcd[5]; varray[11] = NULL;
 
8179
    varray[12] = &vgcd[6]; varray[13] = &vgcd[7]; varray[14] = NULL;
 
8180
    varray[15] = &vbox[2]; varray[16] = GCD_ColSpan; varray[17] = NULL;
 
8181
    varray[18] = &vgcd[10]; varray[19] = &vgcd[11]; varray[20] = NULL;
 
8182
    varray[21] = &vgcd[12]; varray[22] = &vgcd[13]; varray[23] = NULL;
 
8183
    varray[24] = &vgcd[14]; varray[25] = GCD_ColSpan; varray[26] = NULL;
 
8184
    varray[27] = GCD_Glue; varray[28] = GCD_Glue; varray[29] = NULL;
 
8185
    varray[30] = GCD_Glue; varray[31] = GCD_Glue; varray[32] = NULL;
 
8186
    varray[33] = varray[37] = NULL;
 
8187
 
 
8188
    memset(vbox,0,sizeof(vbox));
 
8189
    vbox[0].gd.flags = gg_enabled|gg_visible;
 
8190
    vbox[0].gd.u.boxelements = varray;
 
8191
    vbox[0].creator = GHVBoxCreate;
 
8192
 
 
8193
    vbox[2].gd.flags = gg_enabled|gg_visible;
 
8194
    vbox[2].gd.u.boxelements = vradio;
 
8195
    vbox[2].creator = GHBoxCreate;
 
8196
 
 
8197
/******************************************************************************/
 
8198
 
 
8199
    memset(&metgcd,0,sizeof(metgcd));
 
8200
    memset(&metlabel,'\0',sizeof(metlabel));
 
8201
 
 
8202
    i = j = 0;
 
8203
 
 
8204
    metgcd[i].gd.pos.x = 10; metgcd[i].gd.pos.y = 9;
 
8205
    metlabel[i].text = (unichar_t *) _("Win _Ascent Offset:");
 
8206
    metlabel[i].text_is_1byte = true;
 
8207
    metlabel[i].text_in_resource = true;
 
8208
    metgcd[i].gd.label = &metlabel[i];
 
8209
    metgcd[i].gd.flags = gg_visible | gg_enabled | gg_utf8_popup;
 
8210
    metgcd[i].gd.popup_msg = (unichar_t *) _("Anything outside the OS/2 WinAscent &\nWinDescent fields will be clipped by windows.\nThis includes marks, etc. that have been repositioned by GPOS.\n(The descent field is usually positive.)\nIf the \"[] Is Offset\" checkbox is clear then\nany number you enter will be the value used in OS/2.\nIf set then any number you enter will be added to the\nfont's bounds. You should leave this\nfield 0 and check \"[*] Is Offset\" in most cases.");
 
8211
    metgcd[i].gd.cid = CID_WinAscentLab;
 
8212
    metarray[j++] = &metgcd[i];
 
8213
    metgcd[i++].creator = GLabelCreate;
 
8214
 
 
8215
    metgcd[i].gd.pos.x = 125; metgcd[i].gd.pos.y = metgcd[i-1].gd.pos.y-4;
 
8216
    metgcd[i].gd.pos.width = 50;
 
8217
    metgcd[i].gd.flags = gg_visible | gg_enabled | gg_utf8_popup;
 
8218
        /* value set later */
 
8219
    metgcd[i].gd.cid = CID_WinAscent;
 
8220
    metgcd[i].gd.popup_msg = metgcd[i-1].gd.popup_msg;
 
8221
    metarray[j++] = &metgcd[i];
 
8222
    metgcd[i++].creator = GTextFieldCreate;
 
8223
 
 
8224
    metgcd[i].gd.pos.x = 178; metgcd[i].gd.pos.y = metgcd[i-1].gd.pos.y;
 
8225
    metlabel[i].text = (unichar_t *) _("Is Offset");
 
8226
    metlabel[i].text_is_1byte = true;
 
8227
    metgcd[i].gd.label = &metlabel[i];
 
8228
    metgcd[i].gd.flags = gg_visible | gg_enabled | gg_utf8_popup;
 
8229
        /* value set later */
 
8230
    metgcd[i].gd.cid = CID_WinAscentIsOff;
 
8231
    metgcd[i].gd.popup_msg = metgcd[i-1].gd.popup_msg;
 
8232
    metgcd[i].gd.handle_controlevent = GFI_AsDesIsOff;
 
8233
    metarray[j++] = &metgcd[i];
 
8234
    metgcd[i++].creator = GCheckBoxCreate;
 
8235
    metarray[j++] = NULL;
 
8236
 
 
8237
    metgcd[i].gd.pos.x = 10; metgcd[i].gd.pos.y = metgcd[i-2].gd.pos.y+26+4;
 
8238
    metlabel[i].text = (unichar_t *) _("Win _Descent Offset:");
 
8239
    metlabel[i].text_is_1byte = true;
 
8240
    metlabel[i].text_in_resource = true;
 
8241
    metgcd[i].gd.label = &metlabel[i];
 
8242
    metgcd[i].gd.flags = gg_visible | gg_enabled | gg_utf8_popup;
 
8243
    metgcd[i].gd.popup_msg = metgcd[i-1].gd.popup_msg;
 
8244
    metgcd[i].gd.cid = CID_WinDescentLab;
 
8245
    metarray[j++] = &metgcd[i];
 
8246
    metgcd[i++].creator = GLabelCreate;
 
8247
 
 
8248
    metgcd[i].gd.pos.x = 125; metgcd[i].gd.pos.y = metgcd[i-1].gd.pos.y-4;
 
8249
    metgcd[i].gd.pos.width = 50;
 
8250
    metgcd[i].gd.flags = gg_visible | gg_enabled | gg_utf8_popup;
 
8251
        /* value set later */
 
8252
    metgcd[i].gd.cid = CID_WinDescent;
 
8253
    metgcd[i].gd.popup_msg = metgcd[i-1].gd.popup_msg;
 
8254
    metarray[j++] = &metgcd[i];
 
8255
    metgcd[i++].creator = GTextFieldCreate;
 
8256
 
 
8257
    metgcd[i].gd.pos.x = 178; metgcd[i].gd.pos.y = metgcd[i-1].gd.pos.y;
 
8258
    metlabel[i].text = (unichar_t *) _("Is Offset");
 
8259
    metlabel[i].text_is_1byte = true;
 
8260
    metgcd[i].gd.label = &metlabel[i];
 
8261
    metgcd[i].gd.flags = gg_visible | gg_enabled | gg_utf8_popup;
 
8262
        /* value set later */
 
8263
    metgcd[i].gd.cid = CID_WinDescentIsOff;
 
8264
    metgcd[i].gd.popup_msg = metgcd[i-1].gd.popup_msg;
 
8265
    metgcd[i].gd.handle_controlevent = GFI_AsDesIsOff;
 
8266
    metarray[j++] = &metgcd[i];
 
8267
    metgcd[i++].creator = GCheckBoxCreate;
 
8268
    metarray[j++] = NULL;
 
8269
 
 
8270
    metgcd[i].gd.pos.x = 10; metgcd[i].gd.pos.y = metgcd[i-2].gd.pos.y+26+4;
 
8271
    metlabel[i].text = (unichar_t *) _("_Typo Ascent Offset:");
 
8272
    metlabel[i].text_is_1byte = true;
 
8273
    metlabel[i].text_in_resource = true;
 
8274
    metgcd[i].gd.label = &metlabel[i];
 
8275
    metgcd[i].gd.flags = gg_visible | gg_enabled | gg_utf8_popup;
 
8276
    metgcd[i].gd.popup_msg = (unichar_t *) _("The type ascent&descent fields are>supposed<\nto specify the line spacing on windows.\nIn fact usually the win ascent/descent fields do.\n(The descent field is usually negative.)\nIf the \"[] Is Offset\" checkbox is clear then\nany number you enter will be the value used in OS/2.\nIf set then any number you enter will be added to the\nEm-size. You should leave this\nfield 0 and check \"[*] Is Offset\" in most cases.");
 
8277
    metgcd[i].gd.cid = CID_TypoAscentLab;
 
8278
    metarray[j++] = &metgcd[i];
 
8279
    metgcd[i++].creator = GLabelCreate;
 
8280
 
 
8281
    metgcd[i].gd.pos.x = 125; metgcd[i].gd.pos.y = metgcd[i-1].gd.pos.y-4;
 
8282
    metgcd[i].gd.pos.width = 50;
 
8283
    metgcd[i].gd.flags = gg_visible | gg_enabled | gg_utf8_popup;
 
8284
        /* value set later */
 
8285
    metgcd[i].gd.cid = CID_TypoAscent;
 
8286
    metgcd[i].gd.popup_msg = metgcd[i-1].gd.popup_msg;
 
8287
    metarray[j++] = &metgcd[i];
 
8288
    metgcd[i++].creator = GTextFieldCreate;
 
8289
 
 
8290
    metgcd[i].gd.pos.x = 178; metgcd[i].gd.pos.y = metgcd[i-1].gd.pos.y;
 
8291
    metlabel[i].text = (unichar_t *) _("Is Offset");
 
8292
    metlabel[i].text_is_1byte = true;
 
8293
    metgcd[i].gd.label = &metlabel[i];
 
8294
    metgcd[i].gd.flags = gg_visible | gg_enabled | gg_utf8_popup;
 
8295
        /* value set later */
 
8296
    metgcd[i].gd.cid = CID_TypoAscentIsOff;
 
8297
    metgcd[i].gd.popup_msg = metgcd[i-1].gd.popup_msg;
 
8298
    metgcd[i].gd.handle_controlevent = GFI_AsDesIsOff;
 
8299
    metarray[j++] = &metgcd[i];
 
8300
    metgcd[i++].creator = GCheckBoxCreate;
 
8301
    metarray[j++] = NULL;
 
8302
 
 
8303
    metgcd[i].gd.pos.x = 5; metgcd[i].gd.pos.y = metgcd[i-1].gd.pos.y;
 
8304
    metlabel[i].text = (unichar_t *) _("Really use Typo metrics");
 
8305
    metlabel[i].text_is_1byte = true;
 
8306
    metgcd[i].gd.label = &metlabel[i];
 
8307
    metgcd[i].gd.flags = gg_visible | gg_enabled | gg_utf8_popup;
 
8308
        /* value set later */
 
8309
    metgcd[i].gd.cid = CID_UseTypoMetrics;
 
8310
    metgcd[i].gd.popup_msg = (unichar_t *) _("The spec already says that the typeo metrics should be\nused to determine line spacing. But so many\nprograms fail to follow the spec that MS desided a bit\nwas needed to remind them to do so.");
 
8311
    metarray[j++] = &metgcd[i]; metarray[j++] = GCD_ColSpan; metarray[j++] = GCD_Glue;
 
8312
    metgcd[i++].creator = GCheckBoxCreate;
 
8313
    metarray[j++] = NULL;
 
8314
 
 
8315
    metgcd[i].gd.pos.x = 10; metgcd[i].gd.pos.y = metgcd[i-2].gd.pos.y+26+4;
 
8316
    metlabel[i].text = (unichar_t *) _("T_ypo Descent Offset:");
 
8317
    metlabel[i].text_is_1byte = true;
 
8318
    metlabel[i].text_in_resource = true;
 
8319
    metgcd[i].gd.label = &metlabel[i];
 
8320
    metgcd[i].gd.flags = gg_visible | gg_enabled | gg_utf8_popup;
 
8321
    metgcd[i].gd.popup_msg = metgcd[i-1].gd.popup_msg;
 
8322
    metgcd[i].gd.cid = CID_TypoDescentLab;
 
8323
    metarray[j++] = &metgcd[i];
 
8324
    metgcd[i++].creator = GLabelCreate;
 
8325
 
 
8326
    metgcd[i].gd.pos.x = 125; metgcd[i].gd.pos.y = metgcd[i-1].gd.pos.y-4;
 
8327
    metgcd[i].gd.pos.width = 50;
 
8328
    metgcd[i].gd.flags = gg_visible | gg_enabled | gg_utf8_popup;
 
8329
        /* value set later */
 
8330
    metgcd[i].gd.cid = CID_TypoDescent;
 
8331
    metgcd[i].gd.popup_msg = metgcd[i-1].gd.popup_msg;
 
8332
    metarray[j++] = &metgcd[i];
 
8333
    metgcd[i++].creator = GTextFieldCreate;
 
8334
 
 
8335
    metgcd[i].gd.pos.x = 178; metgcd[i].gd.pos.y = metgcd[i-1].gd.pos.y;
 
8336
    metlabel[i].text = (unichar_t *) _("Is Offset");
 
8337
    metlabel[i].text_is_1byte = true;
 
8338
    metgcd[i].gd.label = &metlabel[i];
 
8339
    metgcd[i].gd.flags = gg_visible | gg_enabled | gg_utf8_popup;
 
8340
        /* value set later */
 
8341
    metgcd[i].gd.cid = CID_TypoDescentIsOff;
 
8342
    metgcd[i].gd.popup_msg = metgcd[i-1].gd.popup_msg;
 
8343
    metgcd[i].gd.handle_controlevent = GFI_AsDesIsOff;
 
8344
    metarray[j++] = &metgcd[i];
 
8345
    metgcd[i++].creator = GCheckBoxCreate;
 
8346
    metarray[j++] = NULL;
 
8347
 
 
8348
    metgcd[i].gd.pos.x = 10; metgcd[i].gd.pos.y = metgcd[i-2].gd.pos.y+26+4;
 
8349
    metlabel[i].text = (unichar_t *) _("Typo Line _Gap:");
 
8350
    metlabel[i].text_is_1byte = true;
 
8351
    metlabel[i].text_in_resource = true;
 
8352
    metgcd[i].gd.label = &metlabel[i];
 
8353
    metgcd[i].gd.flags = gg_visible | gg_enabled | gg_utf8_popup;
 
8354
    metgcd[i].gd.popup_msg = (unichar_t *) _("Sets the TypoLinegap field in the OS/2 table, used on MS Windows");
 
8355
    metarray[j++] = &metgcd[i];
 
8356
    metgcd[i++].creator = GLabelCreate;
 
8357
 
 
8358
    metgcd[i].gd.pos.x = 125; metgcd[i].gd.pos.y = metgcd[i-1].gd.pos.y-4;
 
8359
    metgcd[i].gd.pos.width = 50;
 
8360
    metgcd[i].gd.flags = gg_visible | gg_enabled | gg_utf8_popup;
 
8361
        /* Line gap value set later */
 
8362
    metgcd[i].gd.cid = CID_TypoLineGap;
 
8363
    metgcd[i].gd.popup_msg = metgcd[i-1].gd.popup_msg;
 
8364
    metarray[j++] = &metgcd[i];
 
8365
    metgcd[i++].creator = GTextFieldCreate;
 
8366
    metarray[j++] = GCD_Glue;
 
8367
    metarray[j++] = NULL;
 
8368
 
 
8369
    metgcd[i].gd.pos.x = 10; metgcd[i].gd.pos.y = metgcd[i-1].gd.pos.y+26+4;
 
8370
    metlabel[i].text = (unichar_t *) _("_HHead Ascent Offset:");
 
8371
    metlabel[i].text_is_1byte = true;
 
8372
    metlabel[i].text_in_resource = true;
 
8373
    metgcd[i].gd.label = &metlabel[i];
 
8374
    metgcd[i].gd.flags = gg_visible | gg_enabled | gg_utf8_popup;
 
8375
    metgcd[i].gd.popup_msg = (unichar_t *) _("This specifies the line spacing on the mac.\n(The descent field is usually negative.)\nIf the \"[] Is Offset\" checkbox is clear then\nany number you enter will be the value used in hhea.\nIf set then any number you enter will be added to the\nfont's bounds. You should leave this\nfield 0 and check \"[*] Is Offset\" in most cases.");
 
8376
    metgcd[i].gd.cid = CID_HHeadAscentLab;
 
8377
    metarray[j++] = &metgcd[i];
 
8378
    metgcd[i++].creator = GLabelCreate;
 
8379
 
 
8380
    metgcd[i].gd.pos.x = 125; metgcd[i].gd.pos.y = metgcd[i-1].gd.pos.y-4;
 
8381
    metgcd[i].gd.pos.width = 50;
 
8382
    metgcd[i].gd.flags = gg_visible | gg_enabled | gg_utf8_popup;
 
8383
        /* value set later */
 
8384
    metgcd[i].gd.cid = CID_HHeadAscent;
 
8385
    metgcd[i].gd.popup_msg = metgcd[i-1].gd.popup_msg;
 
8386
    metarray[j++] = &metgcd[i];
 
8387
    metgcd[i++].creator = GTextFieldCreate;
 
8388
 
 
8389
    metgcd[i].gd.pos.x = 178; metgcd[i].gd.pos.y = metgcd[i-1].gd.pos.y;
 
8390
    metlabel[i].text = (unichar_t *) _("Is Offset");
 
8391
    metlabel[i].text_is_1byte = true;
 
8392
    metgcd[i].gd.label = &metlabel[i];
 
8393
    metgcd[i].gd.flags = gg_visible | gg_enabled | gg_utf8_popup;
 
8394
        /* value set later */
 
8395
    metgcd[i].gd.cid = CID_HHeadAscentIsOff;
 
8396
    metgcd[i].gd.popup_msg = metgcd[i-1].gd.popup_msg;
 
8397
    metgcd[i].gd.handle_controlevent = GFI_AsDesIsOff;
 
8398
    metarray[j++] = &metgcd[i];
 
8399
    metgcd[i++].creator = GCheckBoxCreate;
 
8400
    metarray[j++] = NULL;
 
8401
 
 
8402
    metgcd[i].gd.pos.x = 10; metgcd[i].gd.pos.y = metgcd[i-2].gd.pos.y+26+4;
 
8403
    metlabel[i].text = (unichar_t *) _("HHead De_scent Offset:");
 
8404
    metlabel[i].text_in_resource = true;
 
8405
    metlabel[i].text_is_1byte = true;
 
8406
    metgcd[i].gd.label = &metlabel[i];
 
8407
    metgcd[i].gd.flags = gg_visible | gg_enabled | gg_utf8_popup;
 
8408
    metgcd[i].gd.popup_msg = metgcd[i-1].gd.popup_msg;
 
8409
    metgcd[i].gd.cid = CID_HHeadDescentLab;
 
8410
    metarray[j++] = &metgcd[i];
 
8411
    metgcd[i++].creator = GLabelCreate;
 
8412
 
 
8413
    metgcd[i].gd.pos.x = 125; metgcd[i].gd.pos.y = metgcd[i-1].gd.pos.y-4;
 
8414
    metgcd[i].gd.pos.width = 50;
 
8415
    metgcd[i].gd.flags = gg_visible | gg_enabled | gg_utf8_popup;
 
8416
        /* value set later */
 
8417
    metgcd[i].gd.cid = CID_HHeadDescent;
 
8418
    metgcd[i].gd.popup_msg = metgcd[i-1].gd.popup_msg;
 
8419
    metarray[j++] = &metgcd[i];
 
8420
    metgcd[i++].creator = GTextFieldCreate;
 
8421
 
 
8422
    metgcd[i].gd.pos.x = 178; metgcd[i].gd.pos.y = metgcd[i-1].gd.pos.y;
 
8423
    metlabel[i].text = (unichar_t *) _("Is Offset");
 
8424
    metlabel[i].text_is_1byte = true;
 
8425
    metgcd[i].gd.label = &metlabel[i];
 
8426
    metgcd[i].gd.flags = gg_visible | gg_enabled | gg_utf8_popup;
 
8427
        /* value set later */
 
8428
    metgcd[i].gd.cid = CID_HHeadDescentIsOff;
 
8429
    metgcd[i].gd.popup_msg = metgcd[i-1].gd.popup_msg;
 
8430
    metgcd[i].gd.handle_controlevent = GFI_AsDesIsOff;
 
8431
    metarray[j++] = &metgcd[i];
 
8432
    metgcd[i++].creator = GCheckBoxCreate;
 
8433
    metarray[j++] = NULL;
 
8434
 
 
8435
    metgcd[i].gd.pos.x = 10; metgcd[i].gd.pos.y = metgcd[i-2].gd.pos.y+26+4;
 
8436
    metlabel[i].text = (unichar_t *) _("HHead _Line Gap:");
 
8437
    metlabel[i].text_is_1byte = true;
 
8438
    metlabel[i].text_in_resource = true;
 
8439
    metgcd[i].gd.label = &metlabel[i];
 
8440
    metgcd[i].gd.flags = gg_visible | gg_enabled | gg_utf8_popup;
 
8441
    metgcd[i].gd.popup_msg = (unichar_t *) _("Sets the linegap field in the hhea table, used on the mac");
 
8442
    metarray[j++] = &metgcd[i];
 
8443
    metgcd[i++].creator = GLabelCreate;
 
8444
 
 
8445
    metgcd[i].gd.pos.x = 125; metgcd[i].gd.pos.y = metgcd[i-1].gd.pos.y-4;
 
8446
    metgcd[i].gd.pos.width = 50;
 
8447
    metgcd[i].gd.flags = gg_visible | gg_enabled | gg_utf8_popup;
 
8448
        /* Line gap value set later */
 
8449
    metgcd[i].gd.cid = CID_LineGap;
 
8450
    metgcd[i].gd.popup_msg = metgcd[i-1].gd.popup_msg;
 
8451
    metarray[j++] = &metgcd[i];
 
8452
    metgcd[i++].creator = GTextFieldCreate;
 
8453
    metarray[j++] = GCD_Glue;
 
8454
    metarray[j++] = NULL;
 
8455
 
 
8456
    metgcd[i].gd.pos.x = 10; metgcd[i].gd.pos.y = metgcd[i-1].gd.pos.y+26+6;
 
8457
    metlabel[i].text = (unichar_t *) _("VHead _Column Spacing:");
 
8458
    metlabel[i].text_is_1byte = true;
 
8459
    metlabel[i].text_in_resource = true;
 
8460
    metgcd[i].gd.label = &metlabel[i];
 
8461
    metgcd[i].gd.flags = sf->hasvmetrics ? (gg_visible | gg_enabled | gg_utf8_popup) : (gg_visible | gg_utf8_popup);
 
8462
    metgcd[i].gd.popup_msg = (unichar_t *) _("Sets the linegap field in the vhea table.\nThis is the horizontal spacing between rows\nof vertically set text.");
 
8463
    metgcd[i].gd.cid = CID_VLineGapLab;
 
8464
    metarray[j++] = &metgcd[i];
 
8465
    metgcd[i++].creator = GLabelCreate;
 
8466
 
 
8467
    metgcd[i].gd.pos.x = 125; metgcd[i].gd.pos.y = metgcd[i-1].gd.pos.y-6;
 
8468
    metgcd[i].gd.pos.width = 50;
 
8469
    metgcd[i].gd.flags = sf->hasvmetrics ? (gg_visible | gg_enabled | gg_utf8_popup) : (gg_visible | gg_utf8_popup);
 
8470
        /* V Line gap value set later */
 
8471
    metgcd[i].gd.cid = CID_VLineGap;
 
8472
    metgcd[i].gd.popup_msg = metgcd[17].gd.popup_msg;
 
8473
    metarray[j++] = &metgcd[i];
 
8474
    metgcd[i++].creator = GTextFieldCreate;
 
8475
    metarray[j++] = GCD_Glue;
 
8476
    metarray[j++] = NULL;
 
8477
    metarray[j++] = GCD_Glue; metarray[j++] = GCD_Glue; metarray[j++] = GCD_Glue;
 
8478
 
 
8479
    metarray[j++] = NULL; metarray[j++] = NULL;
 
8480
 
 
8481
    memset(metbox,0,sizeof(metbox));
 
8482
    metbox[0].gd.flags = gg_enabled|gg_visible;
 
8483
    metbox[0].gd.u.boxelements = metarray;
 
8484
    metbox[0].creator = GHVBoxCreate;
 
8485
/******************************************************************************/
 
8486
 
 
8487
    memset(&ssgcd,0,sizeof(ssgcd));
 
8488
    memset(&sslabel,'\0',sizeof(sslabel));
 
8489
 
 
8490
    i = j = 0;
 
8491
 
 
8492
    ssgcd[i].gd.pos.x = 5; ssgcd[i].gd.pos.y = 5;
 
8493
    sslabel[i].text = (unichar_t *) S_("SubscriptSuperUse|Default");
 
8494
    sslabel[i].text_is_1byte = true;
 
8495
    ssgcd[i].gd.label = &sslabel[i];
 
8496
    ssgcd[i].gd.flags = gg_visible | gg_enabled;
 
8497
        /* value set later */
 
8498
    ssgcd[i].gd.cid = CID_SubSuperDefault;
 
8499
    ssgcd[i].gd.handle_controlevent = GFI_SubSuperDefault;
 
8500
    ssarray[j++] = &ssgcd[i];
 
8501
    ssgcd[i++].creator = GCheckBoxCreate;
 
8502
    ssarray[j++] = GCD_Glue; ssarray[j++] = GCD_Glue; ssarray[j++] = GCD_Glue;
 
8503
    ssarray[j++] = NULL;
 
8504
 
 
8505
    ssgcd[i].gd.pos.x = 5; ssgcd[i].gd.pos.y = ssgcd[i-1].gd.pos.y+16;
 
8506
    sslabel[i].text = (unichar_t *) _("Subscript");
 
8507
    sslabel[i].text_is_1byte = true;
 
8508
    ssgcd[i].gd.label = &sslabel[i];
 
8509
    ssgcd[i].gd.flags = gg_visible | gg_enabled;
 
8510
    ssarray[j++] = &ssgcd[i];
 
8511
    ssgcd[i++].creator = GLabelCreate;
 
8512
 
 
8513
    ssgcd[i].gd.pos.x = 120; ssgcd[i].gd.pos.y = ssgcd[i-1].gd.pos.y-4;
 
8514
/* GT: X is a coordinate, the leading spaces help to align it */
 
8515
    sslabel[i].text = (unichar_t *) _("  X");
 
8516
    sslabel[i].text_is_1byte = true;
 
8517
    ssgcd[i].gd.label = &sslabel[i];
 
8518
    ssgcd[i].gd.flags = gg_visible | gg_enabled;
 
8519
    ssarray[j++] = &ssgcd[i];
 
8520
    ssgcd[i++].creator = GLabelCreate;
 
8521
 
 
8522
    ssgcd[i].gd.pos.x = 180; ssgcd[i].gd.pos.y = ssgcd[i-1].gd.pos.y;
 
8523
/* GT: Y is a coordinate, the leading spaces help to align it */
 
8524
    sslabel[i].text = (unichar_t *) _("Y");
 
8525
    sslabel[i].text_is_1byte = true;
 
8526
    ssgcd[i].gd.label = &sslabel[i];
 
8527
    ssgcd[i].gd.flags = gg_visible | gg_enabled;
 
8528
    ssarray[j++] = &ssgcd[i];
 
8529
    ssgcd[i++].creator = GLabelCreate;
 
8530
    ssarray[j++] = GCD_Glue; ssarray[j++] = NULL;
 
8531
 
 
8532
    ssgcd[i].gd.pos.x = 10; ssgcd[i].gd.pos.y = ssgcd[i-3].gd.pos.y+14+4;
 
8533
    sslabel[i].text = (unichar_t *) _("Size");
 
8534
    sslabel[i].text_is_1byte = true;
 
8535
    ssgcd[i].gd.label = &sslabel[i];
 
8536
    ssgcd[i].gd.flags = gg_visible | gg_enabled;
 
8537
    ssarray[j++] = &ssgcd[i];
 
8538
    ssgcd[i++].creator = GLabelCreate;
 
8539
 
 
8540
    ssgcd[i].gd.pos.x = 100; ssgcd[i].gd.pos.y = ssgcd[i-1].gd.pos.y-6;
 
8541
    ssgcd[i].gd.pos.width = 50;
 
8542
    ssgcd[i].gd.flags = gg_visible | gg_enabled;
 
8543
        /* set later */
 
8544
    ssgcd[i].gd.cid = CID_SubXSize;
 
8545
    ssarray[j++] = &ssgcd[i];
 
8546
    ssgcd[i++].creator = GTextFieldCreate;
 
8547
 
 
8548
    ssgcd[i].gd.pos.x = 160; ssgcd[i].gd.pos.y = ssgcd[i-1].gd.pos.y;
 
8549
    ssgcd[i].gd.pos.width = 50;
 
8550
    ssgcd[i].gd.flags = gg_visible | gg_enabled;
 
8551
        /* set later */
 
8552
    ssgcd[i].gd.cid = CID_SubYSize;
 
8553
    ssarray[j++] = &ssgcd[i];
 
8554
    ssgcd[i++].creator = GTextFieldCreate;
 
8555
    ssarray[j++] = GCD_Glue; ssarray[j++] = NULL;
 
8556
 
 
8557
    ssgcd[i].gd.pos.x = 10; ssgcd[i].gd.pos.y = ssgcd[i-3].gd.pos.y+26;
 
8558
    sslabel[i].text = (unichar_t *) _("Offset");
 
8559
    sslabel[i].text_is_1byte = true;
 
8560
    ssgcd[i].gd.label = &sslabel[i];
 
8561
    ssgcd[i].gd.flags = gg_visible | gg_enabled;
 
8562
    ssarray[j++] = &ssgcd[i];
 
8563
    ssgcd[i++].creator = GLabelCreate;
 
8564
 
 
8565
    ssgcd[i].gd.pos.x = 100; ssgcd[i].gd.pos.y = ssgcd[i-1].gd.pos.y-6;
 
8566
    ssgcd[i].gd.pos.width = 50;
 
8567
    ssgcd[i].gd.flags = gg_visible | gg_enabled;
 
8568
        /* set later */
 
8569
    ssgcd[i].gd.cid = CID_SubXOffset;
 
8570
    ssarray[j++] = &ssgcd[i];
 
8571
    ssgcd[i++].creator = GTextFieldCreate;
 
8572
 
 
8573
    ssgcd[i].gd.pos.x = 160; ssgcd[i].gd.pos.y = ssgcd[i-1].gd.pos.y;
 
8574
    ssgcd[i].gd.pos.width = 50;
 
8575
    ssgcd[i].gd.flags = gg_visible | gg_enabled;
 
8576
        /* set later */
 
8577
    ssgcd[i].gd.cid = CID_SubYOffset;
 
8578
    ssarray[j++] = &ssgcd[i];
 
8579
    ssgcd[i++].creator = GTextFieldCreate;
 
8580
    ssarray[j++] = GCD_Glue; ssarray[j++] = NULL;
 
8581
 
 
8582
 
 
8583
    ssgcd[i].gd.pos.x = 5; ssgcd[i].gd.pos.y = ssgcd[i-1].gd.pos.y+30;
 
8584
    sslabel[i].text = (unichar_t *) _("Superscript");
 
8585
    sslabel[i].text_is_1byte = true;
 
8586
    ssgcd[i].gd.label = &sslabel[i];
 
8587
    ssgcd[i].gd.flags = gg_visible | gg_enabled;
 
8588
    ssarray[j++] = &ssgcd[i];
 
8589
    ssgcd[i++].creator = GLabelCreate;
 
8590
    ssarray[j++] = GCD_Glue; ssarray[j++] = GCD_Glue; ssarray[j++] = GCD_Glue;
 
8591
    ssarray[j++] = NULL;
 
8592
 
 
8593
    ssgcd[i].gd.pos.x = 10; ssgcd[i].gd.pos.y = ssgcd[i-1].gd.pos.y+14+4;
 
8594
    sslabel[i].text = (unichar_t *) _("Size");
 
8595
    sslabel[i].text_is_1byte = true;
 
8596
    ssgcd[i].gd.label = &sslabel[i];
 
8597
    ssgcd[i].gd.flags = gg_visible | gg_enabled;
 
8598
    ssarray[j++] = &ssgcd[i];
 
8599
    ssgcd[i++].creator = GLabelCreate;
 
8600
 
 
8601
    ssgcd[i].gd.pos.x = 100; ssgcd[i].gd.pos.y = ssgcd[i-1].gd.pos.y-6;
 
8602
    ssgcd[i].gd.pos.width = 50;
 
8603
    ssgcd[i].gd.flags = gg_visible | gg_enabled;
 
8604
        /* set later */
 
8605
    ssgcd[i].gd.cid = CID_SuperXSize;
 
8606
    ssarray[j++] = &ssgcd[i];
 
8607
    ssgcd[i++].creator = GTextFieldCreate;
 
8608
 
 
8609
    ssgcd[i].gd.pos.x = 160; ssgcd[i].gd.pos.y = ssgcd[i-1].gd.pos.y;
 
8610
    ssgcd[i].gd.pos.width = 50;
 
8611
    ssgcd[i].gd.flags = gg_visible | gg_enabled;
 
8612
        /* set later */
 
8613
    ssgcd[i].gd.cid = CID_SuperYSize;
 
8614
    ssarray[j++] = &ssgcd[i];
 
8615
    ssgcd[i++].creator = GTextFieldCreate;
 
8616
    ssarray[j++] = GCD_Glue; ssarray[j++] = NULL;
 
8617
 
 
8618
    ssgcd[i].gd.pos.x = 10; ssgcd[i].gd.pos.y = ssgcd[i-3].gd.pos.y+26;
 
8619
    sslabel[i].text = (unichar_t *) _("Offset");
 
8620
    sslabel[i].text_is_1byte = true;
 
8621
    ssgcd[i].gd.label = &sslabel[i];
 
8622
    ssgcd[i].gd.flags = gg_visible | gg_enabled;
 
8623
    ssarray[j++] = &ssgcd[i];
 
8624
    ssgcd[i++].creator = GLabelCreate;
 
8625
 
 
8626
    ssgcd[i].gd.pos.x = 100; ssgcd[i].gd.pos.y = ssgcd[i-1].gd.pos.y-6;
 
8627
    ssgcd[i].gd.pos.width = 50;
 
8628
    ssgcd[i].gd.flags = gg_visible | gg_enabled;
 
8629
        /* set later */
 
8630
    ssgcd[i].gd.cid = CID_SuperXOffset;
 
8631
    ssarray[j++] = &ssgcd[i];
 
8632
    ssgcd[i++].creator = GTextFieldCreate;
 
8633
 
 
8634
    ssgcd[i].gd.pos.x = 160; ssgcd[i].gd.pos.y = ssgcd[i-1].gd.pos.y;
 
8635
    ssgcd[i].gd.pos.width = 50;
 
8636
    ssgcd[i].gd.flags = gg_visible | gg_enabled;
 
8637
        /* set later */
 
8638
    ssgcd[i].gd.cid = CID_SuperYOffset;
 
8639
    ssarray[j++] = &ssgcd[i];
 
8640
    ssgcd[i++].creator = GTextFieldCreate;
 
8641
    ssarray[j++] = GCD_Glue; ssarray[j++] = NULL;
 
8642
 
 
8643
 
 
8644
    ssgcd[i].gd.pos.x = 5; ssgcd[i].gd.pos.y = ssgcd[i-1].gd.pos.y+30;
 
8645
    sslabel[i].text = (unichar_t *) _("Strikeout");
 
8646
    sslabel[i].text_is_1byte = true;
 
8647
    ssgcd[i].gd.label = &sslabel[i];
 
8648
    ssgcd[i].gd.flags = gg_visible | gg_enabled;
 
8649
    ssarray[j++] = &ssgcd[i];
 
8650
    ssgcd[i++].creator = GLabelCreate;
 
8651
    ssarray[j++] = GCD_Glue; ssarray[j++] = GCD_Glue; ssarray[j++] = GCD_Glue;
 
8652
    ssarray[j++] = NULL;
 
8653
 
 
8654
    ssgcd[i].gd.pos.x = 10; ssgcd[i].gd.pos.y = ssgcd[i-1].gd.pos.y+14+4;
 
8655
    sslabel[i].text = (unichar_t *) _("Size");
 
8656
    sslabel[i].text_is_1byte = true;
 
8657
    ssgcd[i].gd.label = &sslabel[i];
 
8658
    ssgcd[i].gd.flags = gg_visible | gg_enabled;
 
8659
    ssarray[j++] = &ssgcd[i];
 
8660
    ssgcd[i++].creator = GLabelCreate;
 
8661
    ssarray[j++] = GCD_Glue;
 
8662
 
 
8663
    ssgcd[i].gd.pos.x = 160; ssgcd[i].gd.pos.y = ssgcd[i-1].gd.pos.y-6;
 
8664
    ssgcd[i].gd.pos.width = 50;
 
8665
    ssgcd[i].gd.flags = gg_visible | gg_enabled;
 
8666
        /* set later */
 
8667
    ssgcd[i].gd.cid = CID_StrikeoutSize;
 
8668
    ssarray[j++] = &ssgcd[i];
 
8669
    ssgcd[i++].creator = GTextFieldCreate;
 
8670
    ssarray[j++] = GCD_Glue; ssarray[j++] = NULL;
 
8671
 
 
8672
    ssgcd[i].gd.pos.x = 10; ssgcd[i].gd.pos.y = ssgcd[i-2].gd.pos.y+26;
 
8673
    sslabel[i].text = (unichar_t *) _("Pos");
 
8674
    sslabel[i].text_is_1byte = true;
 
8675
    ssgcd[i].gd.label = &sslabel[i];
 
8676
    ssgcd[i].gd.flags = gg_visible | gg_enabled;
 
8677
    ssarray[j++] = &ssgcd[i];
 
8678
    ssgcd[i++].creator = GLabelCreate;
 
8679
    ssarray[j++] = GCD_Glue;
 
8680
 
 
8681
    ssgcd[i].gd.pos.x = 160; ssgcd[i].gd.pos.y = ssgcd[i-1].gd.pos.y-6;
 
8682
    ssgcd[i].gd.pos.width = 50;
 
8683
    ssgcd[i].gd.flags = gg_visible | gg_enabled;
 
8684
        /* set later */
 
8685
    ssgcd[i].gd.cid = CID_StrikeoutPos;
 
8686
    ssarray[j++] = &ssgcd[i];
 
8687
    ssgcd[i++].creator = GTextFieldCreate;
 
8688
    ssarray[j++] = GCD_Glue; ssarray[j++] = NULL;
 
8689
 
 
8690
    ssarray[j++] = GCD_Glue; ssarray[j++] = GCD_Glue; ssarray[j++] = GCD_Glue; ssarray[j++] = GCD_Glue;
 
8691
 
 
8692
    ssarray[j++] = NULL; ssarray[j++] = NULL;
 
8693
 
 
8694
    memset(ssbox,0,sizeof(ssbox));
 
8695
    ssbox[0].gd.flags = gg_enabled|gg_visible;
 
8696
    ssbox[0].gd.u.boxelements = ssarray;
 
8697
    ssbox[0].creator = GHVBoxCreate;
 
8698
/******************************************************************************/
 
8699
    memset(&panlabel,0,sizeof(panlabel));
 
8700
    memset(&pangcd,0,sizeof(pangcd));
 
8701
 
 
8702
    i = j = 0;
 
8703
 
 
8704
    pangcd[i].gd.pos.x = 5; pangcd[i].gd.pos.y = 5;
 
8705
    panlabel[i].text = (unichar_t *) S_("PanoseUse|Default");
 
8706
    panlabel[i].text_is_1byte = true;
 
8707
    pangcd[i].gd.label = &panlabel[i];
 
8708
    pangcd[i].gd.flags = gg_visible | gg_enabled;
 
8709
        /* value set later */
 
8710
    pangcd[i].gd.cid = CID_PanDefault;
 
8711
    /*pangcd[i].gd.popup_msg = pangcd[i-1].gd.popup_msg;*/
 
8712
    pangcd[i].gd.handle_controlevent = GFI_PanoseDefault;
 
8713
    panarray[j++] = &pangcd[i];
 
8714
    pangcd[i++].creator = GCheckBoxCreate;
 
8715
    panarray[j++] = GCD_Glue; panarray[j++] = NULL;
 
8716
 
 
8717
    pangcd[i].gd.pos.x = 20; pangcd[i].gd.pos.y = pangcd[i-1].gd.pos.y+14+4;
 
8718
    panlabel[i].text = (unichar_t *) S_("Panose|_Family");
 
8719
    panlabel[i].text_is_1byte = true;
 
8720
    panlabel[i].text_in_resource = true;
 
8721
    pangcd[i].gd.label = &panlabel[i];
 
8722
    pangcd[i].gd.cid = CID_PanFamilyLab;
 
8723
    pangcd[i].gd.flags = gg_visible | gg_enabled;
 
8724
    panarray[j++] = &pangcd[i];
 
8725
    pangcd[i++].creator = GLabelCreate;
 
8726
 
 
8727
    pangcd[i].gd.pos.x = 100; pangcd[i].gd.pos.y = pangcd[i-1].gd.pos.y-6; pangcd[i].gd.pos.width = 120;
 
8728
    pangcd[i].gd.flags = gg_visible | gg_enabled;
 
8729
    pangcd[i].gd.cid = CID_PanFamily;
 
8730
    pangcd[i].gd.u.list = panfamily;
 
8731
    panarray[j++] = &pangcd[i];
 
8732
    pangcd[i++].creator = GListButtonCreate;
 
8733
    panarray[j++] = NULL;
 
8734
 
 
8735
    pangcd[i].gd.pos.x = 20; pangcd[i].gd.pos.y = pangcd[i-1].gd.pos.y+26+5;
 
8736
    panlabel[i].text = (unichar_t *) _("_Serifs");
 
8737
    panlabel[i].text_is_1byte = true;
 
8738
    panlabel[i].text_in_resource = true;
 
8739
    pangcd[i].gd.label = &panlabel[i];
 
8740
    pangcd[i].gd.cid = CID_PanSerifsLab;
 
8741
    pangcd[i].gd.flags = gg_visible | gg_enabled;
 
8742
    panarray[j++] = &pangcd[i];
 
8743
    pangcd[i++].creator = GLabelCreate;
 
8744
 
 
8745
    pangcd[i].gd.pos.x = 100; pangcd[i].gd.pos.y = pangcd[i-1].gd.pos.y-6; pangcd[i].gd.pos.width = 120;
 
8746
    pangcd[i].gd.flags = gg_visible | gg_enabled;
 
8747
    pangcd[i].gd.cid = CID_PanSerifs;
 
8748
    pangcd[i].gd.u.list = panserifs;
 
8749
    panarray[j++] = &pangcd[i];
 
8750
    pangcd[i++].creator = GListButtonCreate;
 
8751
    panarray[j++] = NULL;
 
8752
 
 
8753
    pangcd[i].gd.pos.x = 20; pangcd[i].gd.pos.y = pangcd[i-1].gd.pos.y+26+5;
 
8754
    panlabel[i].text = (unichar_t *) S_("Panose|_Weight");
 
8755
    panlabel[i].text_is_1byte = true;
 
8756
    panlabel[i].text_in_resource = true;
 
8757
    pangcd[i].gd.label = &panlabel[i];
 
8758
    pangcd[i].gd.cid = CID_PanWeightLab;
 
8759
    pangcd[i].gd.flags = gg_visible | gg_enabled;
 
8760
    panarray[j++] = &pangcd[i];
 
8761
    pangcd[i++].creator = GLabelCreate;
 
8762
 
 
8763
    pangcd[i].gd.pos.x = 100; pangcd[i].gd.pos.y = pangcd[i-1].gd.pos.y-6; pangcd[i].gd.pos.width = 120;
 
8764
    pangcd[i].gd.flags = gg_visible | gg_enabled;
 
8765
    pangcd[i].gd.cid = CID_PanWeight;
 
8766
    pangcd[i].gd.u.list = panweight;
 
8767
    panarray[j++] = &pangcd[i];
 
8768
    pangcd[i++].creator = GListButtonCreate;
 
8769
    panarray[j++] = NULL;
 
8770
 
 
8771
    pangcd[i].gd.pos.x = 20; pangcd[i].gd.pos.y = pangcd[i-1].gd.pos.y+26+5;
 
8772
    panlabel[i].text = (unichar_t *) _("_Proportion");
 
8773
    panlabel[i].text_is_1byte = true;
 
8774
    panlabel[i].text_in_resource = true;
 
8775
    pangcd[i].gd.label = &panlabel[i];
 
8776
    pangcd[i].gd.cid = CID_PanPropLab;
 
8777
    pangcd[i].gd.flags = gg_visible | gg_enabled;
 
8778
    panarray[j++] = &pangcd[i];
 
8779
    pangcd[i++].creator = GLabelCreate;
 
8780
 
 
8781
    pangcd[i].gd.pos.x = 100; pangcd[i].gd.pos.y = pangcd[i-1].gd.pos.y-6; pangcd[i].gd.pos.width = 120;
 
8782
    pangcd[i].gd.flags = gg_visible | gg_enabled;
 
8783
    pangcd[i].gd.cid = CID_PanProp;
 
8784
    pangcd[i].gd.u.list = panprop;
 
8785
    panarray[j++] = &pangcd[i];
 
8786
    pangcd[i++].creator = GListButtonCreate;
 
8787
    panarray[j++] = NULL;
 
8788
 
 
8789
    pangcd[i].gd.pos.x = 20; pangcd[i].gd.pos.y = pangcd[i-1].gd.pos.y+26+5;
 
8790
    panlabel[i].text = (unichar_t *) _("_Contrast");
 
8791
    panlabel[i].text_is_1byte = true;
 
8792
    panlabel[i].text_in_resource = true;
 
8793
    pangcd[i].gd.label = &panlabel[i];
 
8794
    pangcd[i].gd.cid = CID_PanContrastLab;
 
8795
    pangcd[i].gd.flags = gg_visible | gg_enabled;
 
8796
    panarray[j++] = &pangcd[i];
 
8797
    pangcd[i++].creator = GLabelCreate;
 
8798
 
 
8799
    pangcd[i].gd.pos.x = 100; pangcd[i].gd.pos.y = pangcd[i-1].gd.pos.y-6; pangcd[i].gd.pos.width = 120;
 
8800
    pangcd[i].gd.flags = gg_visible | gg_enabled;
 
8801
    pangcd[i].gd.cid = CID_PanContrast;
 
8802
    pangcd[i].gd.u.list = pancontrast;
 
8803
    panarray[j++] = &pangcd[i];
 
8804
    pangcd[i++].creator = GListButtonCreate;
 
8805
    panarray[j++] = NULL;
 
8806
 
 
8807
    pangcd[i].gd.pos.x = 20; pangcd[i].gd.pos.y = pangcd[i-1].gd.pos.y+26+5;
 
8808
    panlabel[i].text = (unichar_t *) _("Stroke _Variation");
 
8809
    panlabel[i].text_is_1byte = true;
 
8810
    panlabel[i].text_in_resource = true;
 
8811
    pangcd[i].gd.label = &panlabel[i];
 
8812
    pangcd[i].gd.cid = CID_PanStrokeVarLab;
 
8813
    pangcd[i].gd.flags = gg_visible | gg_enabled;
 
8814
    panarray[j++] = &pangcd[i];
 
8815
    pangcd[i++].creator = GLabelCreate;
 
8816
 
 
8817
    pangcd[i].gd.pos.x = 100; pangcd[i].gd.pos.y = pangcd[i-1].gd.pos.y-6; pangcd[i].gd.pos.width = 120;
 
8818
    pangcd[i].gd.flags = gg_visible | gg_enabled;
 
8819
    pangcd[i].gd.cid = CID_PanStrokeVar;
 
8820
    pangcd[i].gd.u.list = panstrokevar;
 
8821
    panarray[j++] = &pangcd[i];
 
8822
    pangcd[i++].creator = GListButtonCreate;
 
8823
    panarray[j++] = NULL;
 
8824
 
 
8825
    pangcd[i].gd.pos.x = 20; pangcd[i].gd.pos.y = pangcd[i-1].gd.pos.y+26+5;
 
8826
    panlabel[i].text = (unichar_t *) _("_Arm Style");
 
8827
    panlabel[i].text_is_1byte = true;
 
8828
    panlabel[i].text_in_resource = true;
 
8829
    pangcd[i].gd.label = &panlabel[i];
 
8830
    pangcd[i].gd.cid = CID_PanArmStyleLab;
 
8831
    pangcd[i].gd.flags = gg_visible | gg_enabled;
 
8832
    panarray[j++] = &pangcd[i];
 
8833
    pangcd[i++].creator = GLabelCreate;
 
8834
 
 
8835
    pangcd[i].gd.pos.x = 100; pangcd[i].gd.pos.y = pangcd[i-1].gd.pos.y-6; pangcd[i].gd.pos.width = 120;
 
8836
    pangcd[i].gd.flags = gg_visible | gg_enabled;
 
8837
    pangcd[i].gd.cid = CID_PanArmStyle;
 
8838
    pangcd[i].gd.u.list = panarmstyle;
 
8839
    panarray[j++] = &pangcd[i];
 
8840
    pangcd[i++].creator = GListButtonCreate;
 
8841
    panarray[j++] = NULL;
 
8842
 
 
8843
    pangcd[i].gd.pos.x = 20; pangcd[i].gd.pos.y = pangcd[i-1].gd.pos.y+26+5;
 
8844
    panlabel[i].text = (unichar_t *) _("_Letterform");
 
8845
    panlabel[i].text_is_1byte = true;
 
8846
    panlabel[i].text_in_resource = true;
 
8847
    pangcd[i].gd.label = &panlabel[i];
 
8848
    pangcd[i].gd.cid = CID_PanLetterformLab;
 
8849
    pangcd[i].gd.flags = gg_visible | gg_enabled;
 
8850
    panarray[j++] = &pangcd[i];
 
8851
    pangcd[i++].creator = GLabelCreate;
 
8852
 
 
8853
    pangcd[i].gd.pos.x = 100; pangcd[i].gd.pos.y = pangcd[i-1].gd.pos.y-6; pangcd[i].gd.pos.width = 120;
 
8854
    pangcd[i].gd.flags = gg_visible | gg_enabled;
 
8855
    pangcd[i].gd.cid = CID_PanLetterform;
 
8856
    pangcd[i].gd.u.list = panletterform;
 
8857
    panarray[j++] = &pangcd[i];
 
8858
    pangcd[i++].creator = GListButtonCreate;
 
8859
    panarray[j++] = NULL;
 
8860
 
 
8861
    pangcd[i].gd.pos.x = 20; pangcd[i].gd.pos.y = pangcd[i-1].gd.pos.y+26+5;
 
8862
    panlabel[i].text = (unichar_t *) _("_Midline");
 
8863
    panlabel[i].text_is_1byte = true;
 
8864
    panlabel[i].text_in_resource = true;
 
8865
    pangcd[i].gd.label = &panlabel[i];
 
8866
    pangcd[i].gd.cid = CID_PanMidLineLab;
 
8867
    pangcd[i].gd.flags = gg_visible | gg_enabled;
 
8868
    panarray[j++] = &pangcd[i];
 
8869
    pangcd[i++].creator = GLabelCreate;
 
8870
 
 
8871
    pangcd[i].gd.pos.x = 100; pangcd[i].gd.pos.y = pangcd[i-1].gd.pos.y-6; pangcd[i].gd.pos.width = 120;
 
8872
    pangcd[i].gd.flags = gg_visible | gg_enabled;
 
8873
    pangcd[i].gd.cid = CID_PanMidLine;
 
8874
    pangcd[i].gd.u.list = panmidline;
 
8875
    panarray[j++] = &pangcd[i];
 
8876
    pangcd[i++].creator = GListButtonCreate;
 
8877
    panarray[j++] = NULL;
 
8878
 
 
8879
    pangcd[i].gd.pos.x = 20; pangcd[i].gd.pos.y = pangcd[i-1].gd.pos.y+26+5;
 
8880
    panlabel[i].text = (unichar_t *) _("_X-Height");
 
8881
    panlabel[i].text_is_1byte = true;
 
8882
    panlabel[i].text_in_resource = true;
 
8883
    pangcd[i].gd.label = &panlabel[i];
 
8884
    pangcd[i].gd.cid = CID_PanXHeightLab;
 
8885
    pangcd[i].gd.flags = gg_visible | gg_enabled;
 
8886
    panarray[j++] = &pangcd[i];
 
8887
    pangcd[i++].creator = GLabelCreate;
 
8888
 
 
8889
    pangcd[i].gd.pos.x = 100; pangcd[i].gd.pos.y = pangcd[i-1].gd.pos.y-6; pangcd[i].gd.pos.width = 120;
 
8890
    pangcd[i].gd.flags = gg_visible | gg_enabled;
 
8891
    pangcd[i].gd.cid = CID_PanXHeight;
 
8892
    pangcd[i].gd.u.list = panxheight;
 
8893
    panarray[j++] = &pangcd[i];
 
8894
    pangcd[i++].creator = GListButtonCreate;
 
8895
    panarray[j++] = NULL;
 
8896
 
 
8897
    panarray[j++] = GCD_Glue; panarray[j++] = GCD_Glue;
 
8898
 
 
8899
    panarray[j++] = NULL; panarray[j++] = NULL;
 
8900
 
 
8901
    memset(panbox,0,sizeof(panbox));
 
8902
    panbox[0].gd.flags = gg_enabled|gg_visible;
 
8903
    panbox[0].gd.u.boxelements = panarray;
 
8904
    panbox[0].creator = GHVBoxCreate;
 
8905
/******************************************************************************/
 
8906
 
 
8907
    memset(&vagcd,0,sizeof(vagcd));
 
8908
    memset(&vaspects,'\0',sizeof(vaspects));
 
8909
 
 
8910
    i = 0;
 
8911
    vaspects[i].text = (unichar_t *) _("Misc.");
 
8912
    vaspects[i].text_is_1byte = true;
 
8913
    vaspects[i++].gcd = vbox;
 
8914
 
 
8915
    vaspects[i].text = (unichar_t *) _("Metrics");
 
8916
    vaspects[i].text_is_1byte = true;
 
8917
    vaspects[i++].gcd = metbox;
 
8918
 
 
8919
    vaspects[i].text = (unichar_t *) _("Sub/Super");
 
8920
    vaspects[i].text_is_1byte = true;
 
8921
    vaspects[i++].gcd = ssbox;
 
8922
 
 
8923
    vaspects[i].text = (unichar_t *) _("Panose");
 
8924
    vaspects[i].text_is_1byte = true;
 
8925
    vaspects[i++].gcd = panbox;
 
8926
 
 
8927
    vagcd[0].gd.pos.x = 4; vagcd[0].gd.pos.y = 6;
 
8928
    vagcd[0].gd.pos.width = 252;
 
8929
    vagcd[0].gd.pos.height = 300;
 
8930
    vagcd[0].gd.u.tabs = vaspects;
 
8931
    vagcd[0].gd.flags = gg_visible | gg_enabled;
 
8932
    /*vagcd[0].gd.handle_controlevent = GFI_TTFAspectChange;*/
 
8933
    vagcd[0].gd.cid = CID_TTFTabs;
 
8934
    vagcd[0].creator = GTabSetCreate;
 
8935
 
 
8936
/******************************************************************************/
 
8937
    memset(&gaspboxes,0,sizeof(gaspboxes));
 
8938
    memset(&gaspgcd,0,sizeof(gaspgcd));
 
8939
    memset(&gasplabel,0,sizeof(gasplabel));
 
8940
    memset(&gaspgcd_def,0,sizeof(gaspgcd_def));
 
8941
 
 
8942
    GaspMatrixInit(&gaspmi,d);
 
8943
 
 
8944
    i = j = 0;
 
8945
 
 
8946
    gasplabel[i].text = (unichar_t *) S_("Gasp|_Version");
 
8947
    gasplabel[i].text_is_1byte = true;
 
8948
    gasplabel[i].text_in_resource = true;
 
8949
    gaspgcd[i].gd.label = &gasplabel[i];
 
8950
    gaspgcd[i].gd.flags = gg_visible | gg_enabled;
 
8951
    gaspharray[j++] = &gaspgcd[i];
 
8952
    gaspgcd[i++].creator = GLabelCreate;
 
8953
 
 
8954
    gaspgcd[i].gd.flags = gg_visible | gg_enabled;
 
8955
    gaspgcd[i].gd.cid = CID_GaspVersion;
 
8956
    gaspgcd[i].gd.label = &gaspversions[sf->gasp_version];
 
8957
    gaspgcd[i].gd.u.list = gaspversions;
 
8958
    gaspharray[j++] = &gaspgcd[i];
 
8959
    gaspgcd[i].gd.handle_controlevent = GFI_GaspVersion;
 
8960
    gaspgcd[i++].creator = GListButtonCreate;
 
8961
    gaspharray[j++] = GCD_HPad10;
 
8962
 
 
8963
    gasplabel[i].text = (unichar_t *) _("Optimized For Cleartype");
 
8964
    gasplabel[i].text_is_1byte = true;
 
8965
    gasplabel[i].text_in_resource = true;
 
8966
    gaspgcd[i].gd.label = &gasplabel[i];
 
8967
    gaspgcd[i].gd.flags = gg_visible | gg_enabled | gg_utf8_popup;
 
8968
    gaspgcd[i].gd.cid = CID_HeadClearType;
 
8969
    if ( sf->head_optimized_for_cleartype )
 
8970
        gaspgcd[i].gd.flags |= gg_cb_on;
 
8971
    gaspgcd[i].gd.popup_msg = (unichar_t *) _("Actually a bit in the 'head' table.\nIf unset then certain East Asian fonts will not be hinted");
 
8972
    gaspharray[j++] = &gaspgcd[i];
 
8973
    gaspgcd[i++].creator = GCheckBoxCreate;
 
8974
    gaspharray[j++] = NULL;
 
8975
 
 
8976
    gaspboxes[2].gd.flags = gg_enabled|gg_visible;
 
8977
    gaspboxes[2].gd.u.boxelements = gaspharray;
 
8978
    gaspboxes[2].creator = GHBoxCreate;
 
8979
 
 
8980
    gaspvarray[0] = &gaspboxes[2];
 
8981
 
 
8982
    gaspgcd[i].gd.pos.width = 300; gaspgcd[i].gd.pos.height = 200;
 
8983
    gaspgcd[i].gd.flags = gg_enabled | gg_visible | gg_utf8_popup;
 
8984
    gaspgcd[i].gd.cid = CID_Gasp;
 
8985
    gaspgcd[i].gd.u.matrix = &gaspmi;
 
8986
    gaspgcd[i].gd.popup_msg = (unichar_t *) _(
 
8987
        "The 'gasp' table gives you control over when grid-fitting and\n"
 
8988
        "anti-aliased rasterizing are done.\n"
 
8989
        "The table consists of an (ordered) list of pixel sizes each with\n"
 
8990
        "a set of flags. Those flags apply to all pixel sizes bigger than\n"
 
8991
        "the previous table entry but less than or equal to the current.\n"
 
8992
        "The list must be terminated with a pixel size of 65535.\n"
 
8993
        "Version 1 of the table contains two additional flags that\n"
 
8994
        "apply to MS's ClearType rasterizer.\n\n"
 
8995
        "The 'gasp' table only applies to truetype fonts.");
 
8996
    gaspgcd[i].data = d;
 
8997
    gaspgcd[i].creator = GMatrixEditCreate;
 
8998
    gaspvarray[1] = &gaspgcd[i];
 
8999
    gaspvarray[2] = NULL;
 
9000
 
 
9001
    gaspboxes[0].gd.flags = gg_enabled|gg_visible;
 
9002
    gaspboxes[0].gd.u.boxelements = gaspvarray;
 
9003
    gaspboxes[0].creator = GVBoxCreate;
 
9004
 
 
9005
    gaspgcd_def[0].gd.flags = gg_visible | gg_enabled;
 
9006
    gasplabel[4].text = (unichar_t *) S_("Gasp|_Default");
 
9007
    gasplabel[4].text_is_1byte = true;
 
9008
    gasplabel[4].text_in_resource = true;
 
9009
    gaspgcd_def[0].gd.label = &gasplabel[4];
 
9010
    gaspgcd_def[0].gd.handle_controlevent = Gasp_Default;
 
9011
    gaspgcd_def[0].creator = GButtonCreate;
 
9012
/******************************************************************************/
 
9013
    memset(&tnlabel,0,sizeof(tnlabel));
 
9014
    memset(&tngcd,0,sizeof(tngcd));
 
9015
    memset(&tnboxes,0,sizeof(tnboxes));
 
9016
 
 
9017
    TNMatrixInit(&mi,d);
 
9018
 
 
9019
    tngcd[0].gd.pos.x = 5; tngcd[0].gd.pos.y = 6;
 
9020
    tngcd[0].gd.flags = gg_visible | gg_enabled;
 
9021
    tnlabel[0].text = (unichar_t *) _("Sort By:");
 
9022
    tnlabel[0].text_is_1byte = true;
 
9023
    tngcd[0].gd.label = &tnlabel[0];
 
9024
    tngcd[0].creator = GLabelCreate;
 
9025
    tnharray[0] = &tngcd[0];
 
9026
 
 
9027
    tngcd[1].gd.pos.x = 50; tngcd[1].gd.pos.y = tngcd[0].gd.pos.y-4;
 
9028
    tngcd[1].gd.flags = gg_enabled | gg_visible;
 
9029
    tngcd[1].gd.cid = CID_TNLangSort;
 
9030
    tnlabel[1].text = (unichar_t *) _("_Language");
 
9031
    tnlabel[1].text_is_1byte = true;
 
9032
    tnlabel[1].text_in_resource = true;
 
9033
    tngcd[1].gd.label = &tnlabel[1];
 
9034
    tngcd[1].creator = GRadioCreate;
 
9035
    tngcd[1].gd.handle_controlevent = GFI_SortBy;
 
9036
    tnharray[1] = &tngcd[1];
 
9037
 
 
9038
    tngcd[2].gd.pos.x = 120; tngcd[2].gd.pos.y = tngcd[1].gd.pos.y;
 
9039
    tngcd[2].gd.flags = gg_visible | gg_enabled | gg_rad_continueold;
 
9040
    tngcd[2].gd.cid = CID_TNStringSort;
 
9041
    tnlabel[2].text = (unichar_t *) _("_String Type");
 
9042
    tnlabel[2].text_is_1byte = true;
 
9043
    tnlabel[2].text_in_resource = true;
 
9044
    tngcd[2].gd.label = &tnlabel[2];
 
9045
    tngcd[2].creator = GRadioCreate;
 
9046
    tngcd[2].gd.handle_controlevent = GFI_SortBy;
 
9047
    tnharray[2] = &tngcd[2];
 
9048
 
 
9049
    tngcd[3].gd.pos.x = 195; tngcd[3].gd.pos.y = tngcd[1].gd.pos.y;
 
9050
    tngcd[3].gd.flags = gg_visible | gg_enabled | gg_cb_on | gg_rad_continueold;
 
9051
    tnlabel[3].text = (unichar_t *) S_("SortingScheme|Default");
 
9052
    tnlabel[3].text_is_1byte = true;
 
9053
    tngcd[3].gd.label = &tnlabel[3];
 
9054
    tngcd[3].creator = GRadioCreate;
 
9055
    tngcd[3].gd.handle_controlevent = GFI_SortBy;
 
9056
    tnharray[3] = &tngcd[3]; tnharray[4] = GCD_Glue; tnharray[5] = NULL;
 
9057
 
 
9058
    tngcd[4].gd.pos.x = 10; tngcd[4].gd.pos.y = tngcd[1].gd.pos.y+14;
 
9059
    tngcd[4].gd.pos.width = 300; tngcd[4].gd.pos.height = 200;
 
9060
    tngcd[4].gd.flags = gg_enabled | gg_visible | gg_utf8_popup;
 
9061
    tngcd[4].gd.cid = CID_TNames;
 
9062
    tngcd[4].gd.u.matrix = &mi;
 
9063
    tngcd[4].gd.popup_msg = (unichar_t *) _(
 
9064
        "To create a new name, left click on the <New> button, and select a locale.\n"
 
9065
        "To change the locale, left click on it.\n"
 
9066
        "To change the string type, left click on it.\n"
 
9067
        "To change the text, left click in it and then type.\n"
 
9068
        "To delete a name, right click on the name & select Delete from the menu.\n"
 
9069
        "To associate or disassocate a truetype name to its postscript equivalent\n"
 
9070
        "right click and select the appropriate menu item." );
 
9071
    tngcd[4].data = d;
 
9072
    tngcd[4].creator = GMatrixEditCreate;
 
9073
 
 
9074
    tngcd[5].gd.flags = gg_visible | gg_enabled | gg_utf8_popup;
 
9075
/* GT: when translating this please leave the "SIL Open Font License" in */
 
9076
/* GT: English (possibly translating it in parentheses). I believe there */
 
9077
/* GT: are legal reasons for this. */
 
9078
/* GT: So "A\303\261adir SIL Open Font License (licencia de fuentes libres)" */
 
9079
    tnlabel[5].text = (unichar_t *) S_("Add SIL ");
 
9080
    tnlabel[5].image_precedes = false;
 
9081
    tnlabel[5].image = &OFL_logo;
 
9082
    tnlabel[5].text_is_1byte = true;
 
9083
    tnlabel[5].text_in_resource = true;
 
9084
    tngcd[5].gd.label = &tnlabel[5];
 
9085
    tngcd[5].gd.handle_controlevent = GFI_AddOFL;
 
9086
    tngcd[5].gd.popup_msg = (unichar_t *) _(
 
9087
        "The SIL Open Font License (OFL) is designed for free/libre/open font projects.\n"
 
9088
        "Most other FLOSS licenses are designed for conventional software and are problematic for fonts.\n"
 
9089
        "The OFL is a community-approved license and is well-suited for releasing fonts to be freely \n"
 
9090
        "used, studied, copied, modified, embedded, merged and distributed while maintaining artistic integrity.\n"
 
9091
        "You are encouraged you to use it if you can.\n"
 
9092
        "\n"
 
9093
        "For more details about the OFL - and the corresponding FAQ - see http://scripts.sil.org/OFL \n"
 
9094
        "\n"
 
9095
        "Simply press this button to add the OFL metadata to your font.\n"
 
9096
        "\n");
 
9097
    tngcd[5].creator = GButtonCreate;
 
9098
 
 
9099
    tngcd[6].gd.flags = gg_visible | gg_enabled | gg_utf8_popup;
 
9100
    tnlabel[6].text = (unichar_t *) S_("OFL website");
 
9101
    tnlabel[6].text_is_1byte = true;
 
9102
    tnlabel[6].text_in_resource = true;
 
9103
    tngcd[6].gd.label = &tnlabel[6];
 
9104
    tngcd[6].gd.handle_controlevent = GFI_HelpOFL;
 
9105
    tngcd[6].gd.popup_msg = (unichar_t *) _(
 
9106
        "\n"
 
9107
        "Click here to go to http://scripts.sil.org/OFL \n"
 
9108
        "to get all the details about the Open Font License \n"
 
9109
        "and to read the corresponding FAQ. \n"
 
9110
        "\n");
 
9111
    tngcd[6].creator = GButtonCreate;
 
9112
    tnharray2[0] = &tngcd[5]; tnharray2[1] = &tngcd[6]; tnharray2[2] = GCD_Glue; tnharray2[3] = NULL;
 
9113
    tnvarray[0] = &tnboxes[2]; tnvarray[1] = &tngcd[4]; tnvarray[2] = &tnboxes[3]; tnvarray[3] = NULL;
 
9114
 
 
9115
    tnboxes[0].gd.flags = gg_enabled|gg_visible;
 
9116
    tnboxes[0].gd.u.boxelements = tnvarray;
 
9117
    tnboxes[0].creator = GVBoxCreate;
 
9118
 
 
9119
    tnboxes[2].gd.flags = gg_enabled|gg_visible;
 
9120
    tnboxes[2].gd.u.boxelements = tnharray;
 
9121
    tnboxes[2].creator = GHBoxCreate;
 
9122
 
 
9123
    tnboxes[3].gd.flags = gg_enabled|gg_visible;
 
9124
    tnboxes[3].gd.u.boxelements = tnharray2;
 
9125
    tnboxes[3].creator = GHBoxCreate;
 
9126
/******************************************************************************/
 
9127
    memset(&comlabel,0,sizeof(comlabel));
 
9128
    memset(&comgcd,0,sizeof(comgcd));
 
9129
 
 
9130
    comgcd[0].gd.pos.x = 10; comgcd[0].gd.pos.y = 10;
 
9131
    comgcd[0].gd.pos.width = ngcd[11].gd.pos.width; comgcd[0].gd.pos.height = 230;
 
9132
    comgcd[0].gd.flags = gg_visible | gg_enabled | gg_textarea_wrap;
 
9133
    comgcd[0].gd.cid = CID_Comment;
 
9134
    comlabel[0].text = (unichar_t *) sf->comments;
 
9135
    comlabel[0].text_is_1byte = true;
 
9136
    if ( comlabel[0].text==NULL ) comlabel[0].text = (unichar_t *) "";
 
9137
    comgcd[0].gd.label = &comlabel[0];
 
9138
    comgcd[0].creator = GTextAreaCreate;
 
9139
 
 
9140
    comarray[0] = &comgcd[0]; comarray[1] = NULL;
 
9141
    memset(combox,0,sizeof(combox));
 
9142
    combox[0].gd.flags = gg_enabled|gg_visible;
 
9143
    combox[0].gd.u.boxelements = comarray;
 
9144
    combox[0].creator = GHBoxCreate;
 
9145
 
 
9146
/******************************************************************************/
 
9147
    memset(&mklabel,0,sizeof(mklabel));
 
9148
    memset(&mkgcd,0,sizeof(mkgcd));
 
9149
 
 
9150
    mkgcd[0].gd.pos.x = 10; mkgcd[0].gd.pos.y = 10;
 
9151
    mkgcd[0].gd.pos.width = ngcd[15].gd.pos.width; mkgcd[0].gd.pos.height = 200;
 
9152
    mkgcd[0].gd.flags = gg_visible | gg_enabled;
 
9153
    mkgcd[0].gd.cid = CID_MarkClasses;
 
9154
    mkgcd[0].gd.u.list = MarkClassesList(sf);
 
9155
    mkgcd[0].gd.handle_controlevent = GFI_MarkSelChanged;
 
9156
    mkgcd[0].creator = GListCreate;
 
9157
 
 
9158
    mkgcd[1].gd.pos.x = 10; mkgcd[1].gd.pos.y = mkgcd[0].gd.pos.y+mkgcd[0].gd.pos.height+4;
 
9159
    mkgcd[1].gd.pos.width = -1;
 
9160
    mkgcd[1].gd.flags = gg_visible | gg_enabled;
 
9161
/* GT: See the long comment at "Property|New" */
 
9162
/* GT: The msgstr should contain a translation of "_New...", ignore "Mark|" */
 
9163
    mklabel[1].text = (unichar_t *) S_("Mark|_New...");
 
9164
    mklabel[1].text_is_1byte = true;
 
9165
    mklabel[1].text_in_resource = true;
 
9166
    mkgcd[1].gd.label = &mklabel[1];
 
9167
    mkgcd[1].gd.cid = CID_MarkNew;
 
9168
    mkgcd[1].gd.handle_controlevent = GFI_MarkNew;
 
9169
    mkgcd[1].creator = GButtonCreate;
 
9170
 
 
9171
    mkgcd[2].gd.pos.x = -10; mkgcd[2].gd.pos.y = mkgcd[1].gd.pos.y;
 
9172
    mkgcd[2].gd.pos.width = -1;
 
9173
    mkgcd[2].gd.flags = gg_visible;
 
9174
    mklabel[2].text = (unichar_t *) _("_Edit...");
 
9175
    mklabel[2].text_is_1byte = true;
 
9176
    mklabel[2].text_in_resource = true;
 
9177
    mkgcd[2].gd.label = &mklabel[2];
 
9178
    mkgcd[2].gd.cid = CID_MarkEdit;
 
9179
    mkgcd[2].gd.handle_controlevent = GFI_MarkEdit;
 
9180
    mkgcd[2].creator = GButtonCreate;
 
9181
 
 
9182
    mkarray[0] = &mkgcd[0]; mkarray[1] = &mkbox[2]; mkarray[2] = NULL;
 
9183
    mkarray2[0] = &mkgcd[1]; mkarray2[1] = GCD_Glue; mkarray2[2] = &mkgcd[2];
 
9184
     mkarray2[3] = NULL;
 
9185
    memset(mkbox,0,sizeof(mkbox));
 
9186
    mkbox[0].gd.flags = gg_enabled|gg_visible;
 
9187
    mkbox[0].gd.u.boxelements = mkarray;
 
9188
    mkbox[0].creator = GVBoxCreate;
 
9189
 
 
9190
    mkbox[2].gd.flags = gg_enabled|gg_visible;
 
9191
    mkbox[2].gd.u.boxelements = mkarray2;
 
9192
    mkbox[2].creator = GHBoxCreate;
 
9193
/******************************************************************************/
 
9194
    memset(&txlabel,0,sizeof(txlabel));
 
9195
    memset(&txgcd,0,sizeof(txgcd));
 
9196
 
 
9197
    k=0;
 
9198
    txlabel[k].text = (unichar_t *) U_("\316\244\316\265\316\247 General");
 
9199
    txlabel[k].text_is_1byte = true;
 
9200
    txgcd[k].gd.label = &txlabel[k];
 
9201
    txgcd[k].gd.pos.x = 10; txgcd[k].gd.pos.y = 10;
 
9202
    txgcd[k].gd.flags = gg_visible | gg_enabled;
 
9203
    txgcd[k].gd.cid = CID_TeXText;
 
9204
    txgcd[k].gd.handle_controlevent = GFI_TeXChanged;
 
9205
    txgcd[k++].creator = GRadioCreate;
 
9206
 
 
9207
    txlabel[k].text = (unichar_t *) U_("\316\244\316\265\316\247 Math Symbol");
 
9208
    txlabel[k].text_is_1byte = true;
 
9209
    txgcd[k].gd.label = &txlabel[k];
 
9210
    txgcd[k].gd.pos.x = 80; txgcd[k].gd.pos.y = txgcd[k-1].gd.pos.y;
 
9211
    txgcd[k].gd.flags = gg_visible | gg_enabled | gg_rad_continueold;
 
9212
    txgcd[k].gd.cid = CID_TeXMathSym;
 
9213
    txgcd[k].gd.handle_controlevent = GFI_TeXChanged;
 
9214
    txgcd[k++].creator = GRadioCreate;
 
9215
 
 
9216
    txlabel[k].text = (unichar_t *) U_("\316\244\316\265\316\247 Math Extension");
 
9217
    txlabel[k].text_is_1byte = true;
 
9218
    txgcd[k].gd.label = &txlabel[k];
 
9219
    txgcd[k].gd.pos.x = 155; txgcd[k].gd.pos.y = txgcd[k-1].gd.pos.y;
 
9220
    txgcd[k].gd.flags = gg_visible | gg_enabled | gg_rad_continueold;
 
9221
    txgcd[k].gd.cid = CID_TeXMathExt;
 
9222
    txgcd[k].gd.handle_controlevent = GFI_TeXChanged;
 
9223
    txgcd[k++].creator = GRadioCreate;
 
9224
 
 
9225
    for ( i=j=0; texparams[i]!=0; ++i ) {
 
9226
        txlabel[k].text = (unichar_t *) texparams[i];
 
9227
        txlabel[k].text_is_1byte = true;
 
9228
        txgcd[k].gd.label = &txlabel[k];
 
9229
        txgcd[k].gd.pos.x = 10; txgcd[k].gd.pos.y = txgcd[k-2].gd.pos.y+26;
 
9230
        txgcd[k].gd.flags = gg_visible | gg_enabled | gg_utf8_popup;
 
9231
        txgcd[k].gd.popup_msg = (unichar_t *) texpopups[i];
 
9232
        txarray2[j++] = &txgcd[k];
 
9233
        txgcd[k++].creator = GLabelCreate;
 
9234
 
 
9235
        txgcd[k].gd.pos.x = 70; txgcd[k].gd.pos.y = txgcd[k-1].gd.pos.y-4;
 
9236
        txgcd[k].gd.flags = gg_visible | gg_enabled;
 
9237
        txgcd[k].gd.cid = CID_TeX + i;
 
9238
        txarray2[j++] = &txgcd[k];
 
9239
        txgcd[k++].creator = GTextFieldCreate;
 
9240
        txarray2[j++] = GCD_Glue;
 
9241
        txarray2[j++] = NULL;
 
9242
    }
 
9243
    txgcd[k-2].gd.cid = CID_TeXExtraSpLabel;
 
9244
    txarray2[j++] = NULL;
 
9245
 
 
9246
/* GT: More Parameters */
 
9247
    txlabel[k].text = (unichar_t *) _("More Params");
 
9248
    txlabel[k].text_is_1byte = true;
 
9249
    txgcd[k].gd.label = &txlabel[k];
 
9250
    txgcd[k].gd.pos.x = 20; txgcd[k].gd.pos.y = txgcd[k-1].gd.pos.y+26;
 
9251
    txgcd[k].gd.flags = gg_visible | gg_enabled;
 
9252
    txgcd[k].gd.handle_controlevent = GFI_MoreParams;
 
9253
    txgcd[k].gd.cid = CID_MoreParams;
 
9254
    txgcd[k++].creator = GButtonCreate;
 
9255
 
 
9256
    txarray[0] = &txbox[2]; txarray[1] = &txbox[3]; txarray[2] = &txbox[4]; txarray[3] = GCD_Glue; txarray[4] = NULL;
 
9257
    txarray3[0] = &txgcd[0]; txarray3[1] = GCD_Glue; txarray3[2] = &txgcd[1];
 
9258
     txarray3[3] = GCD_Glue; txarray3[4] = &txgcd[2]; txarray3[5] = NULL;
 
9259
    txarray4[0] = GCD_Glue; txarray4[1] = &txgcd[k-1];
 
9260
     txarray4[2] = txarray4[3] = txarray4[4] = GCD_Glue; txarray4[5] = NULL;
 
9261
    memset(txbox,0,sizeof(txbox));
 
9262
    txbox[0].gd.flags = gg_enabled|gg_visible;
 
9263
    txbox[0].gd.u.boxelements = txarray;
 
9264
    txbox[0].creator = GVBoxCreate;
 
9265
 
 
9266
    txbox[2].gd.flags = gg_enabled|gg_visible;
 
9267
    txbox[2].gd.u.boxelements = txarray3;
 
9268
    txbox[2].creator = GHBoxCreate;
 
9269
 
 
9270
    txbox[3].gd.flags = gg_enabled|gg_visible;
 
9271
    txbox[3].gd.u.boxelements = txarray2;
 
9272
    txbox[3].creator = GHVBoxCreate;
 
9273
 
 
9274
    txbox[4].gd.flags = gg_enabled|gg_visible;
 
9275
    txbox[4].gd.u.boxelements = txarray4;
 
9276
    txbox[4].creator = GHBoxCreate;
 
9277
/******************************************************************************/
 
9278
    memset(&szlabel,0,sizeof(szlabel));
 
9279
    memset(&szgcd,0,sizeof(szgcd));
 
9280
 
 
9281
    k=0;
 
9282
 
 
9283
    szlabel[k].text = (unichar_t *) _("De_sign Size:");
 
9284
    szlabel[k].text_is_1byte = true;
 
9285
    szlabel[k].text_in_resource = true;
 
9286
    szgcd[k].gd.label = &szlabel[k];
 
9287
    szgcd[k].gd.pos.x = 10; szgcd[k].gd.pos.y = 9;
 
9288
    szgcd[k].gd.flags = gg_visible | gg_enabled | gg_utf8_popup;
 
9289
    szgcd[k].gd.popup_msg = (unichar_t *) _("The size (in points) for which this face was designed");
 
9290
    szgcd[k++].creator = GLabelCreate;
 
9291
 
 
9292
    sprintf(dszbuf, "%.1f", sf->design_size/10.0);
 
9293
    szlabel[k].text = (unichar_t *) dszbuf;
 
9294
    szlabel[k].text_is_1byte = true;
 
9295
    szgcd[k].gd.label = &szlabel[k];
 
9296
    szgcd[k].gd.pos.x = 70; szgcd[k].gd.pos.y = szgcd[k-1].gd.pos.y-4;
 
9297
    szgcd[k].gd.pos.width = 60;
 
9298
    szgcd[k].gd.flags = gg_visible | gg_enabled;
 
9299
    szgcd[k].gd.cid = CID_DesignSize;
 
9300
    szgcd[k++].creator = GTextFieldCreate;
 
9301
 
 
9302
    szlabel[k].text = (unichar_t *) S_("Size|Points");
 
9303
    szlabel[k].text_is_1byte = true;
 
9304
    szgcd[k].gd.label = &szlabel[k];
 
9305
    szgcd[k].gd.pos.x = 134; szgcd[k].gd.pos.y = szgcd[k-2].gd.pos.y;
 
9306
    szgcd[k].gd.flags = gg_visible | gg_enabled | gg_utf8_popup;
 
9307
    szgcd[k].gd.popup_msg = (unichar_t *) _("The size (in points) for which this face was designed");
 
9308
    szgcd[k++].creator = GLabelCreate;
 
9309
 
 
9310
    szlabel[k].text = (unichar_t *) _("Design Range");
 
9311
    szlabel[k].text_is_1byte = true;
 
9312
    szgcd[k].gd.label = &szlabel[k];
 
9313
    szgcd[k].gd.pos.x = 14; szgcd[k].gd.pos.y = szgcd[k-2].gd.pos.y+24;
 
9314
    szgcd[k].gd.flags = gg_visible | gg_enabled | gg_utf8_popup;
 
9315
    szgcd[k].gd.popup_msg = (unichar_t *) _("The range of sizes (in points) to which this face applies.\nLower bound is exclusive, upper bound is inclusive.");
 
9316
    szgcd[k++].creator = GLabelCreate;
 
9317
 
 
9318
    szgcd[k].gd.pos.x = 8; szgcd[k].gd.pos.y = GDrawPointsToPixels(NULL,szgcd[k-1].gd.pos.y+6);
 
9319
    szgcd[k].gd.pos.width = pos.width-32; szgcd[k].gd.pos.height = GDrawPointsToPixels(NULL,36);
 
9320
    szgcd[k].gd.flags = gg_enabled | gg_visible | gg_pos_in_pixels;
 
9321
    szgcd[k++].creator = GGroupCreate;
 
9322
 
 
9323
    szlabel[k].text = (unichar_t *) _("_Bottom:");
 
9324
    szlabel[k].text_is_1byte = true;
 
9325
    szlabel[k].text_in_resource = true;
 
9326
    szgcd[k].gd.label = &szlabel[k];
 
9327
    szgcd[k].gd.pos.x = 14; szgcd[k].gd.pos.y = szgcd[k-2].gd.pos.y+18;
 
9328
    szgcd[k].gd.flags = gg_visible | gg_enabled | gg_utf8_popup;
 
9329
    szgcd[k].gd.popup_msg = (unichar_t *) _("The range of sizes (in points) to which this face applies.\nLower bound is exclusive, upper bound is inclusive.");
 
9330
    szgcd[k++].creator = GLabelCreate;
 
9331
 
 
9332
    sprintf(dsbbuf, "%.1f", sf->design_range_bottom/10.0);
 
9333
    szlabel[k].text = (unichar_t *) dsbbuf;
 
9334
    szlabel[k].text_is_1byte = true;
 
9335
    szgcd[k].gd.label = &szlabel[k];
 
9336
    szgcd[k].gd.pos.x = 70; szgcd[k].gd.pos.y = szgcd[k-1].gd.pos.y-4;
 
9337
    szgcd[k].gd.pos.width = 60;
 
9338
    szgcd[k].gd.flags = gg_visible | gg_enabled;
 
9339
    szgcd[k].gd.cid = CID_DesignBottom;
 
9340
    szgcd[k++].creator = GTextFieldCreate;
 
9341
 
 
9342
    szlabel[k].text = (unichar_t *) _("_Top:");
 
9343
    szlabel[k].text_is_1byte = true;
 
9344
    szlabel[k].text_in_resource = true;
 
9345
    szgcd[k].gd.label = &szlabel[k];
 
9346
    szgcd[k].gd.pos.x = 140; szgcd[k].gd.pos.y = szgcd[k-2].gd.pos.y;
 
9347
    szgcd[k].gd.flags = gg_visible | gg_enabled | gg_utf8_popup;
 
9348
    szgcd[k].gd.popup_msg = (unichar_t *) _("The range of sizes (in points) to which this face applies.\nLower bound is exclusive, upper bound is inclusive.");
 
9349
    szgcd[k++].creator = GLabelCreate;
 
9350
 
 
9351
    sprintf(dstbuf, "%.1f", sf->design_range_top/10.0);
 
9352
    szlabel[k].text = (unichar_t *) dstbuf;
 
9353
    szlabel[k].text_is_1byte = true;
 
9354
    szgcd[k].gd.label = &szlabel[k];
 
9355
    szgcd[k].gd.pos.x = 180; szgcd[k].gd.pos.y = szgcd[k-1].gd.pos.y-4;
 
9356
    szgcd[k].gd.pos.width = 60;
 
9357
    szgcd[k].gd.flags = gg_visible | gg_enabled;
 
9358
    szgcd[k].gd.cid = CID_DesignTop;
 
9359
    szgcd[k++].creator = GTextFieldCreate;
 
9360
 
 
9361
    szlabel[k].text = (unichar_t *) _("Style _ID:");
 
9362
    szlabel[k].text_is_1byte = true;
 
9363
    szlabel[k].text_in_resource = true;
 
9364
    szgcd[k].gd.label = &szlabel[k];
 
9365
    szgcd[k].gd.pos.x = 14; szgcd[k].gd.pos.y = GDrawPixelsToPoints(NULL,szgcd[k-5].gd.pos.y+szgcd[k-5].gd.pos.height)+10;
 
9366
    szgcd[k].gd.flags = gg_visible | gg_enabled | gg_utf8_popup;
 
9367
    szgcd[k].gd.popup_msg = (unichar_t *) _("This is an identifying number shared by all members of\nthis font family with the same style (I.e. 10pt Bold and\n24pt Bold would have the same id, but 10pt Italic would not");
 
9368
    szgcd[k++].creator = GLabelCreate;
 
9369
 
 
9370
    sprintf(sibuf, "%d", sf->fontstyle_id);
 
9371
    szlabel[k].text = (unichar_t *) sibuf;
 
9372
    szlabel[k].text_is_1byte = true;
 
9373
    szgcd[k].gd.label = &szlabel[k];
 
9374
    szgcd[k].gd.pos.x = 70; szgcd[k].gd.pos.y = szgcd[k-1].gd.pos.y-4;
 
9375
    szgcd[k].gd.pos.width = 60;
 
9376
    szgcd[k].gd.flags = gg_visible | gg_enabled;
 
9377
    szgcd[k].gd.cid = CID_StyleID;
 
9378
    szgcd[k++].creator = GTextFieldCreate;
 
9379
 
 
9380
    szlabel[k].text = (unichar_t *) _("Style Name:");
 
9381
    szlabel[k].text_is_1byte = true;
 
9382
    szgcd[k].gd.label = &szlabel[k];
 
9383
    szgcd[k].gd.pos.x = 14; szgcd[k].gd.pos.y = szgcd[k-2].gd.pos.y+22;
 
9384
    szgcd[k].gd.flags = gg_visible | gg_enabled | gg_utf8_popup;
 
9385
    szgcd[k].gd.popup_msg = (unichar_t *) _("This provides a set of names used to identify the\nstyle of this font. Names may be translated into multiple\nlanguages (English is required, others are optional)\nAll fonts with the same Style ID should share this name.");
 
9386
    szgcd[k++].creator = GLabelCreate;
 
9387
 
 
9388
    szgcd[k].gd.pos.x = 10; szgcd[k].gd.pos.y = szgcd[k-1].gd.pos.y+14;
 
9389
    szgcd[k].gd.pos.width = ngcd[15].gd.pos.width; szgcd[k].gd.pos.height = 100;
 
9390
    szgcd[k].gd.flags = gg_visible | gg_enabled | gg_list_alphabetic;
 
9391
    szgcd[k].gd.cid = CID_StyleName;
 
9392
    szgcd[k].gd.handle_controlevent = GFI_StyleNameSelChanged;
 
9393
    szgcd[k++].creator = GListCreate;
 
9394
 
 
9395
    szgcd[k].gd.pos.x = 10; szgcd[k].gd.pos.y = szgcd[k-1].gd.pos.y+szgcd[k-1].gd.pos.height+4;
 
9396
    szgcd[k].gd.pos.width = -1;
 
9397
    szgcd[k].gd.flags = gg_visible | gg_enabled;
 
9398
    szlabel[k].text = (unichar_t *) S_("StyleName|_New...");
 
9399
    szlabel[k].text_is_1byte = true;
 
9400
    szlabel[k].text_in_resource = true;
 
9401
    szgcd[k].gd.label = &szlabel[k];
 
9402
    szgcd[k].gd.cid = CID_StyleNameNew;
 
9403
    szgcd[k].gd.handle_controlevent = GFI_StyleNameNew;
 
9404
    szgcd[k++].creator = GButtonCreate;
 
9405
 
 
9406
    szgcd[k].gd.pos.x = 20+GIntGetResource(_NUM_Buttonsize)*100/GIntGetResource(_NUM_ScaleFactor);
 
9407
    szgcd[k].gd.pos.y = szgcd[k-1].gd.pos.y;
 
9408
    szgcd[k].gd.pos.width = -1;
 
9409
    szgcd[k].gd.flags = gg_visible;
 
9410
    szlabel[k].text = (unichar_t *) _("_Delete");
 
9411
    szlabel[k].text_is_1byte = true;
 
9412
    szlabel[k].text_in_resource = true;
 
9413
    szgcd[k].gd.label = &szlabel[k];
 
9414
    szgcd[k].gd.cid = CID_StyleNameDel;
 
9415
    szgcd[k].gd.handle_controlevent = GFI_StyleNameDel;
 
9416
    szgcd[k++].creator = GButtonCreate;
 
9417
 
 
9418
    szgcd[k].gd.pos.x = 10 + 2*(10+GIntGetResource(_NUM_Buttonsize)*100/GIntGetResource(_NUM_ScaleFactor));
 
9419
    szgcd[k].gd.pos.y = szgcd[k-1].gd.pos.y;
 
9420
    szgcd[k].gd.pos.width = -1;
 
9421
    szgcd[k].gd.flags = gg_visible;
 
9422
    szlabel[k].text = (unichar_t *) _("_Edit...");
 
9423
    szlabel[k].text_is_1byte = true;
 
9424
    szlabel[k].text_in_resource = true;
 
9425
    szgcd[k].gd.label = &szlabel[k];
 
9426
    szgcd[k].gd.cid = CID_StyleNameRename;
 
9427
    szgcd[k].gd.handle_controlevent = GFI_StyleNameRename;
 
9428
    szgcd[k++].creator = GButtonCreate;
 
9429
 
 
9430
    szarray[0] = &szbox[2];
 
9431
    szarray[1] = &szbox[3];
 
9432
    szarray[2] = &szbox[4];
 
9433
    szarray[3] = &szgcd[11];
 
9434
    szarray[4] = &szgcd[12];
 
9435
    szarray[5] = &szbox[5];
 
9436
    szarray[6] = NULL;
 
9437
 
 
9438
    szarray2[0] = &szgcd[0]; szarray2[1] = &szgcd[1]; szarray2[2] = &szgcd[2]; szarray2[3] = GCD_Glue; szarray2[4] = NULL;
 
9439
    szarray3[0] = &szgcd[5]; szarray3[1] = &szgcd[6]; szarray3[2] = &szgcd[7]; szarray3[3] = &szgcd[8]; szarray3[4] = GCD_Glue; szarray3[5] = NULL;
 
9440
     szarray3[6] = NULL;
 
9441
    szarray4[0] = &szgcd[9]; szarray4[1] = &szgcd[10]; szarray4[2] = GCD_Glue; szarray4[3] = NULL;
 
9442
    szarray5[0] = &szgcd[13]; szarray5[1] = GCD_Glue;
 
9443
     szarray5[2] = &szgcd[14]; szarray5[3] = GCD_Glue;
 
9444
     szarray5[4] = &szgcd[15]; szarray5[5] = NULL;
 
9445
 
 
9446
    memset(szbox,0,sizeof(szbox));
 
9447
    szbox[0].gd.flags = gg_enabled|gg_visible;
 
9448
    szbox[0].gd.u.boxelements = szarray;
 
9449
    szbox[0].creator = GVBoxCreate;
 
9450
 
 
9451
    szbox[2].gd.flags = gg_enabled|gg_visible;
 
9452
    szbox[2].gd.u.boxelements = szarray2;
 
9453
    szbox[2].creator = GHBoxCreate;
 
9454
 
 
9455
    szbox[3].gd.flags = gg_enabled|gg_visible;
 
9456
    szbox[3].gd.label = (GTextInfo *) &szgcd[3];
 
9457
    szbox[3].gd.u.boxelements = szarray3;
 
9458
    szbox[3].creator = GHVGroupCreate;
 
9459
 
 
9460
    szbox[4].gd.flags = gg_enabled|gg_visible;
 
9461
    szbox[4].gd.u.boxelements = szarray4;
 
9462
    szbox[4].creator = GHBoxCreate;
 
9463
 
 
9464
    szbox[5].gd.flags = gg_enabled|gg_visible;
 
9465
    szbox[5].gd.u.boxelements = szarray5;
 
9466
    szbox[5].creator = GHBoxCreate;
 
9467
 
 
9468
/******************************************************************************/
 
9469
    memset(&mcgcd,0,sizeof(mcgcd));
 
9470
    memset(&mclabel,'\0',sizeof(mclabel));
 
9471
 
 
9472
    k=0;
 
9473
    mclabel[k].text = (unichar_t *) _("Mac Style Set:");
 
9474
    mclabel[k].text_is_1byte = true;
 
9475
    mcgcd[k].gd.label = &mclabel[k];
 
9476
    mcgcd[k].gd.pos.x = 10; mcgcd[k].gd.pos.y = 7;
 
9477
    mcgcd[k].gd.flags = gg_visible | gg_enabled;
 
9478
    mcgcd[k++].creator = GLabelCreate;
 
9479
 
 
9480
    mclabel[k].text = (unichar_t *) _("Automatic");
 
9481
    mclabel[k].text_is_1byte = true;
 
9482
    mcgcd[k].gd.label = &mclabel[k];
 
9483
    mcgcd[k].gd.pos.x = 10; mcgcd[k].gd.pos.y = 20;
 
9484
    mcgcd[k].gd.flags = (sf->macstyle==-1) ? (gg_visible | gg_enabled | gg_cb_on) : (gg_visible | gg_enabled);
 
9485
    mcgcd[k].gd.cid = CID_MacAutomatic;
 
9486
    mcgcd[k].gd.handle_controlevent = GFI_MacAutomatic;
 
9487
    mcgcd[k++].creator = GRadioCreate;
 
9488
 
 
9489
    mcgcd[k].gd.pos.x = 90; mcgcd[k].gd.pos.y = 20;
 
9490
    mcgcd[k].gd.flags = (sf->macstyle!=-1) ? (gg_visible | gg_enabled | gg_cb_on | gg_rad_continueold) : (gg_visible | gg_enabled | gg_rad_continueold);
 
9491
    mcgcd[k].gd.handle_controlevent = GFI_MacAutomatic;
 
9492
    mcgcd[k++].creator = GRadioCreate;
 
9493
 
 
9494
    mcgcd[k].gd.pos.x = 110; mcgcd[k].gd.pos.y = 20;
 
9495
    mcgcd[k].gd.pos.width = 120; mcgcd[k].gd.pos.height = 7*12+10;
 
9496
    mcgcd[k].gd.flags = (sf->macstyle==-1) ? (gg_visible | gg_list_multiplesel) : (gg_visible | gg_enabled | gg_list_multiplesel);
 
9497
    mcgcd[k].gd.cid = CID_MacStyles;
 
9498
    mcgcd[k].gd.u.list = macstyles;
 
9499
    mcgcd[k++].creator = GListCreate;
 
9500
 
 
9501
    mclabel[k].text = (unichar_t *) _("FOND Name:");
 
9502
    mclabel[k].text_is_1byte = true;
 
9503
    mcgcd[k].gd.label = &mclabel[k];
 
9504
    mcgcd[k].gd.pos.x = 10; mcgcd[k].gd.pos.y = mcgcd[k-1].gd.pos.y + mcgcd[k-1].gd.pos.height+8;
 
9505
    mcgcd[k].gd.flags = gg_visible | gg_enabled;
 
9506
    mcgcd[k++].creator = GLabelCreate;
 
9507
 
 
9508
    mclabel[k].text = (unichar_t *) sf->fondname;
 
9509
    mclabel[k].text_is_1byte = true;
 
9510
    mcgcd[k].gd.label = sf->fondname==NULL ? NULL : &mclabel[k];
 
9511
    mcgcd[k].gd.pos.x = 90; mcgcd[k].gd.pos.y = mcgcd[k-1].gd.pos.y - 4;
 
9512
    mcgcd[k].gd.flags = gg_visible | gg_enabled;
 
9513
    mcgcd[k].gd.cid = CID_MacFOND;
 
9514
    mcgcd[k++].creator = GTextFieldCreate;
 
9515
 
 
9516
 
 
9517
    mcs = MacStyleCode(sf,NULL);
 
9518
    for ( i=0; macstyles[i].text!=NULL; ++i )
 
9519
        macstyles[i].selected = (mcs&(int) (intpt) macstyles[i].userdata)? 1 : 0;
 
9520
 
 
9521
    mcarray[0] = &mcgcd[0]; mcarray[1] = GCD_Glue; mcarray[2] = NULL;
 
9522
    mcarray[3] = &mcbox[2]; mcarray[4] = &mcgcd[3]; mcarray[5] = NULL;
 
9523
    mcarray[6] = &mcgcd[4]; mcarray[7] = &mcgcd[5]; mcarray[8] = NULL;
 
9524
    mcarray[9] = GCD_Glue; mcarray[10] = GCD_Glue; mcarray[11] = NULL;
 
9525
    mcarray[12] = NULL;
 
9526
    mcarray2[0] = &mcgcd[1]; mcarray2[1] = &mcgcd[2]; mcarray2[2] = NULL;
 
9527
    mcarray2[3] = GCD_Glue; mcarray2[4] = GCD_Glue; mcarray2[5] = NULL;
 
9528
    mcarray2[6] = NULL;
 
9529
 
 
9530
    memset(mcbox,0,sizeof(mcbox));
 
9531
    mcbox[0].gd.flags = gg_enabled|gg_visible;
 
9532
    mcbox[0].gd.u.boxelements = mcarray;
 
9533
    mcbox[0].creator = GHVBoxCreate;
 
9534
 
 
9535
    mcbox[2].gd.flags = gg_enabled|gg_visible;
 
9536
    mcbox[2].gd.u.boxelements = mcarray2;
 
9537
    mcbox[2].creator = GHVBoxCreate;
 
9538
 
 
9539
/******************************************************************************/
 
9540
    memset(&lksubgcd,0,sizeof(lksubgcd));
 
9541
    memset(&lkgcd,0,sizeof(lkgcd));
 
9542
    memset(&lkaspects,'\0',sizeof(lkaspects));
 
9543
    memset(&lkbox,'\0',sizeof(lkbox));
 
9544
    memset(&lkbuttonsgcd,'\0',sizeof(lkbuttonsgcd));
 
9545
    memset(&lkbuttonslabel,'\0',sizeof(lkbuttonslabel));
 
9546
 
 
9547
    LookupSetup(&d->tables[0],sf->gsub_lookups);
 
9548
    LookupSetup(&d->tables[1],sf->gpos_lookups);
 
9549
 
 
9550
    i=0;
 
9551
    lkbuttonsarray[i] = &lkbuttonsgcd[i];
 
9552
    lkbuttonsgcd[i].gd.flags = gg_visible | gg_utf8_popup ;
 
9553
    lkbuttonsgcd[i].gd.popup_msg = (unichar_t *) _("Moves the currently selected lookup to be first in the lookup ordering\nor moves the currently selected subtable to be first in its lookup.");
 
9554
    lkbuttonslabel[i].text = (unichar_t *) _("_Top");
 
9555
    lkbuttonslabel[i].text_is_1byte = true;
 
9556
    lkbuttonslabel[i].text_in_resource = true;
 
9557
    lkbuttonsgcd[i].gd.label = &lkbuttonslabel[i];
 
9558
    lkbuttonsgcd[i].gd.cid = CID_LookupTop;
 
9559
    lkbuttonsgcd[i].gd.handle_controlevent = GFI_LookupOrder;
 
9560
    lkbuttonsgcd[i++].creator = GButtonCreate;
 
9561
 
 
9562
    lkbuttonsarray[i] = &lkbuttonsgcd[i];
 
9563
    lkbuttonsgcd[i].gd.flags = gg_visible | gg_utf8_popup ;
 
9564
    lkbuttonsgcd[i].gd.popup_msg = (unichar_t *) _("Moves the currently selected lookup before the previous lookup\nor moves the currently selected subtable before the previous subtable.");
 
9565
    lkbuttonslabel[i].text = (unichar_t *) _("_Up");
 
9566
    lkbuttonslabel[i].text_is_1byte = true;
 
9567
    lkbuttonslabel[i].text_in_resource = true;
 
9568
    lkbuttonsgcd[i].gd.label = &lkbuttonslabel[i];
 
9569
    lkbuttonsgcd[i].gd.cid = CID_LookupUp;
 
9570
    lkbuttonsgcd[i].gd.handle_controlevent = GFI_LookupOrder;
 
9571
    lkbuttonsgcd[i++].creator = GButtonCreate;
 
9572
 
 
9573
    lkbuttonsarray[i] = &lkbuttonsgcd[i];
 
9574
    lkbuttonsgcd[i].gd.flags = gg_visible | gg_utf8_popup ;
 
9575
    lkbuttonsgcd[i].gd.popup_msg = (unichar_t *) _("Moves the currently selected lookup after the next lookup\nor moves the currently selected subtable after the next subtable.");
 
9576
    lkbuttonslabel[i].text = (unichar_t *) _("_Down");
 
9577
    lkbuttonslabel[i].text_is_1byte = true;
 
9578
    lkbuttonslabel[i].text_in_resource = true;
 
9579
    lkbuttonsgcd[i].gd.label = &lkbuttonslabel[i];
 
9580
    lkbuttonsgcd[i].gd.cid = CID_LookupDown;
 
9581
    lkbuttonsgcd[i].gd.handle_controlevent = GFI_LookupOrder;
 
9582
    lkbuttonsgcd[i++].creator = GButtonCreate;
 
9583
 
 
9584
    lkbuttonsarray[i] = &lkbuttonsgcd[i];
 
9585
    lkbuttonsgcd[i].gd.flags = gg_visible | gg_utf8_popup ;
 
9586
    lkbuttonsgcd[i].gd.popup_msg = (unichar_t *) _("Moves the currently selected lookup to the end of the lookup chain\nor moves the currently selected subtable to be the last subtable in the lookup");
 
9587
    lkbuttonslabel[i].text = (unichar_t *) _("_Bottom");
 
9588
    lkbuttonslabel[i].text_is_1byte = true;
 
9589
    lkbuttonslabel[i].text_in_resource = true;
 
9590
    lkbuttonsgcd[i].gd.label = &lkbuttonslabel[i];
 
9591
    lkbuttonsgcd[i].gd.cid = CID_LookupBottom;
 
9592
    lkbuttonsgcd[i].gd.handle_controlevent = GFI_LookupOrder;
 
9593
    lkbuttonsgcd[i++].creator = GButtonCreate;
 
9594
 
 
9595
    lkbuttonsarray[i] = &lkbuttonsgcd[i];
 
9596
    lkbuttonsgcd[i].gd.flags = gg_visible | gg_utf8_popup ;
 
9597
    lkbuttonsgcd[i].gd.popup_msg = (unichar_t *) _("Sorts the lookups in a default ordering based on feature tags");
 
9598
    lkbuttonslabel[i].text = (unichar_t *) _("_Sort");
 
9599
    lkbuttonslabel[i].text_is_1byte = true;
 
9600
    lkbuttonslabel[i].text_in_resource = true;
 
9601
    lkbuttonsgcd[i].gd.label = &lkbuttonslabel[i];
 
9602
    lkbuttonsgcd[i].gd.cid = CID_LookupSort;
 
9603
    lkbuttonsgcd[i].gd.handle_controlevent = GFI_LookupSort;
 
9604
    lkbuttonsgcd[i++].creator = GButtonCreate;
 
9605
 
 
9606
    lkbuttonsarray[i] = &lkbuttonsgcd[i];
 
9607
    lkbuttonsgcd[i].gd.flags = gg_visible | gg_enabled ;
 
9608
    lkbuttonsgcd[i++].creator = GLineCreate;
 
9609
 
 
9610
    lkbuttonsarray[i] = &lkbuttonsgcd[i];
 
9611
    lkbuttonsgcd[i].gd.flags = gg_visible | gg_enabled | gg_utf8_popup ;
 
9612
    lkbuttonsgcd[i].gd.popup_msg = (unichar_t *) _("Adds a new lookup after the selected lookup\nor at the start of the lookup list if nothing is selected.");
 
9613
    lkbuttonslabel[i].text = (unichar_t *) _("Add _Lookup");
 
9614
    lkbuttonslabel[i].text_is_1byte = true;
 
9615
    lkbuttonslabel[i].text_in_resource = true;
 
9616
    lkbuttonsgcd[i].gd.label = &lkbuttonslabel[i];
 
9617
    lkbuttonsgcd[i].gd.cid = CID_AddLookup;
 
9618
    lkbuttonsgcd[i].gd.handle_controlevent = GFI_LookupAddLookup;
 
9619
    lkbuttonsgcd[i++].creator = GButtonCreate;
 
9620
 
 
9621
    lkbuttonsarray[i] = &lkbuttonsgcd[i];
 
9622
    lkbuttonsgcd[i].gd.flags = gg_visible | gg_utf8_popup ;
 
9623
    lkbuttonsgcd[i].gd.popup_msg = (unichar_t *) _("Adds a new lookup subtable after the selected subtable\nor at the start of the lookup if nothing is selected.");
 
9624
    lkbuttonslabel[i].text = (unichar_t *) _("Add Sub_table");
 
9625
    lkbuttonslabel[i].text_is_1byte = true;
 
9626
    lkbuttonslabel[i].text_in_resource = true;
 
9627
    lkbuttonsgcd[i].gd.label = &lkbuttonslabel[i];
 
9628
    lkbuttonsgcd[i].gd.cid = CID_AddSubtable;
 
9629
    lkbuttonsgcd[i].gd.handle_controlevent = GFI_LookupAddSubtable;
 
9630
    lkbuttonsgcd[i++].creator = GButtonCreate;
 
9631
 
 
9632
    lkbuttonsarray[i] = &lkbuttonsgcd[i];
 
9633
    lkbuttonsgcd[i].gd.flags = gg_visible | gg_utf8_popup ;
 
9634
    lkbuttonsgcd[i].gd.popup_msg = (unichar_t *) _("Edits a lookup or lookup subtable.");
 
9635
    lkbuttonslabel[i].text = (unichar_t *) _("Edit _Metadata");
 
9636
    lkbuttonslabel[i].text_is_1byte = true;
 
9637
    lkbuttonslabel[i].text_in_resource = true;
 
9638
    lkbuttonsgcd[i].gd.label = &lkbuttonslabel[i];
 
9639
    lkbuttonsgcd[i].gd.cid = CID_EditMetadata;
 
9640
    lkbuttonsgcd[i].gd.handle_controlevent = GFI_LookupEditMetadata;
 
9641
    lkbuttonsgcd[i++].creator = GButtonCreate;
 
9642
 
 
9643
    lkbuttonsarray[i] = &lkbuttonsgcd[i];
 
9644
    lkbuttonsgcd[i].gd.flags = gg_visible | gg_utf8_popup ;
 
9645
    lkbuttonsgcd[i].gd.popup_msg = (unichar_t *) _("Edits the transformations in a lookup subtable.");
 
9646
    lkbuttonslabel[i].text = (unichar_t *) _("_Edit Data");
 
9647
    lkbuttonslabel[i].text_is_1byte = true;
 
9648
    lkbuttonslabel[i].text_in_resource = true;
 
9649
    lkbuttonsgcd[i].gd.label = &lkbuttonslabel[i];
 
9650
    lkbuttonsgcd[i].gd.cid = CID_EditSubtable;
 
9651
    lkbuttonsgcd[i].gd.handle_controlevent = GFI_LookupEditSubtableContents;
 
9652
    lkbuttonsgcd[i++].creator = GButtonCreate;
 
9653
 
 
9654
    lkbuttonsarray[i] = &lkbuttonsgcd[i];
 
9655
    lkbuttonsgcd[i].gd.flags = gg_visible | gg_utf8_popup ;
 
9656
    lkbuttonsgcd[i].gd.popup_msg = (unichar_t *) _("Deletes any selected lookups and their subtables, or deletes any selected subtables.\nThis will also delete any transformations associated with those subtables.");
 
9657
    lkbuttonslabel[i].text = (unichar_t *) _("De_lete");
 
9658
    lkbuttonslabel[i].text_is_1byte = true;
 
9659
    lkbuttonslabel[i].text_in_resource = true;
 
9660
    lkbuttonsgcd[i].gd.label = &lkbuttonslabel[i];
 
9661
    lkbuttonsgcd[i].gd.cid = CID_DeleteLookup;
 
9662
    lkbuttonsgcd[i].gd.handle_controlevent = GFI_LookupDeleteLookup;
 
9663
    lkbuttonsgcd[i++].creator = GButtonCreate;
 
9664
 
 
9665
    lkbuttonsarray[i] = &lkbuttonsgcd[i];
 
9666
    lkbuttonsgcd[i].gd.flags = gg_visible | gg_utf8_popup ;
 
9667
    lkbuttonsgcd[i].gd.popup_msg = (unichar_t *) _("Merges two selected (and compatible) lookups into one,\nor merges two selected subtables of a lookup into one");
 
9668
    lkbuttonslabel[i].text = (unichar_t *) _("_Merge");
 
9669
    lkbuttonslabel[i].text_is_1byte = true;
 
9670
    lkbuttonslabel[i].text_in_resource = true;
 
9671
    lkbuttonsgcd[i].gd.label = &lkbuttonslabel[i];
 
9672
    lkbuttonsgcd[i].gd.cid = CID_MergeLookup;
 
9673
    lkbuttonsgcd[i].gd.handle_controlevent = GFI_LookupMergeLookup;
 
9674
    lkbuttonsgcd[i++].creator = GButtonCreate;
 
9675
 
 
9676
    lkbuttonsarray[i] = &lkbuttonsgcd[i];
 
9677
    lkbuttonsgcd[i].gd.flags = gg_visible | gg_utf8_popup ;
 
9678
    lkbuttonsgcd[i].gd.popup_msg = (unichar_t *) _("Reverts the lookup list to its original condition.\nBut any changes to subtable data will remain.");
 
9679
    lkbuttonslabel[i].text = (unichar_t *) _("_Revert");
 
9680
    lkbuttonslabel[i].text_is_1byte = true;
 
9681
    lkbuttonslabel[i].text_in_resource = true;
 
9682
    lkbuttonsgcd[i].gd.label = &lkbuttonslabel[i];
 
9683
    lkbuttonsgcd[i].gd.cid = CID_RevertLookups;
 
9684
    lkbuttonsgcd[i].gd.handle_controlevent = GFI_LookupRevertLookup;
 
9685
    lkbuttonsgcd[i++].creator = GButtonCreate;
 
9686
 
 
9687
    lkbuttonsarray[i] = &lkbuttonsgcd[i];
 
9688
    lkbuttonsgcd[i].gd.flags = gg_visible | gg_utf8_popup ;
 
9689
    lkbuttonsgcd[i].gd.popup_msg = (unichar_t *) _("Imports a lookup (and all its subtables) from another font.");
 
9690
    lkbuttonslabel[i].text = (unichar_t *) _("_Import");
 
9691
    lkbuttonslabel[i].text_is_1byte = true;
 
9692
    lkbuttonslabel[i].text_in_resource = true;
 
9693
    lkbuttonsgcd[i].gd.label = &lkbuttonslabel[i];
 
9694
    lkbuttonsgcd[i].gd.cid = CID_ImportLookups;
 
9695
    lkbuttonsgcd[i].gd.handle_controlevent = GFI_LookupImportLookup;
 
9696
    lkbuttonsgcd[i++].creator = GButtonCreate;
 
9697
    lkbuttonsarray[i] = GCD_Glue;
 
9698
    lkbuttonsarray[i+1] = NULL;
 
9699
 
 
9700
    for ( i=0; i<2; ++i ) {
 
9701
        lkaspects[i].text = (unichar_t *) (i?"GPOS":"GSUB");
 
9702
        lkaspects[i].text_is_1byte = true;
 
9703
        lkaspects[i].gcd = &lkbox[2*i];
 
9704
 
 
9705
        lksubgcd[i][0].gd.pos.x = 10; lksubgcd[i][0].gd.pos.y = 10;
 
9706
        lksubgcd[i][0].gd.pos.width = ngcd[15].gd.pos.width;
 
9707
        lksubgcd[i][0].gd.pos.height = 150;
 
9708
        lksubgcd[i][0].gd.flags = gg_visible | gg_enabled;
 
9709
        lksubgcd[i][0].gd.u.drawable_e_h = i ? gposlookups_e_h : gsublookups_e_h;
 
9710
        lksubgcd[i][0].gd.cid = CID_LookupWin+i;
 
9711
        lksubgcd[i][0].creator = GDrawableCreate;
 
9712
 
 
9713
        lksubgcd[i][1].gd.pos.x = 10; lksubgcd[i][1].gd.pos.y = 10;
 
9714
        lksubgcd[i][1].gd.pos.height = 150;
 
9715
        lksubgcd[i][1].gd.flags = gg_visible | gg_enabled | gg_sb_vert;
 
9716
        lksubgcd[i][1].gd.cid = CID_LookupVSB+i;
 
9717
        lksubgcd[i][1].gd.handle_controlevent = LookupsVScroll;
 
9718
        lksubgcd[i][1].creator = GScrollBarCreate;
 
9719
 
 
9720
        lksubgcd[i][2].gd.pos.x = 10; lksubgcd[i][2].gd.pos.y = 10;
 
9721
        lksubgcd[i][2].gd.pos.width = 150;
 
9722
        lksubgcd[i][2].gd.flags = gg_visible | gg_enabled;
 
9723
        lksubgcd[i][2].gd.cid = CID_LookupHSB+i;
 
9724
        lksubgcd[i][2].gd.handle_controlevent = LookupsHScroll;
 
9725
        lksubgcd[i][2].creator = GScrollBarCreate;
 
9726
 
 
9727
        lksubgcd[i][3].gd.pos.x = 10; lksubgcd[i][3].gd.pos.y = 10;
 
9728
        lksubgcd[i][3].gd.pos.width = lksubgcd[i][3].gd.pos.height = _GScrollBar_Width;
 
9729
        lksubgcd[i][3].gd.flags = gg_visible | gg_enabled | gg_tabset_nowindow;
 
9730
        lksubgcd[i][3].creator = GDrawableCreate;
 
9731
 
 
9732
        lkarray[i][0] = &lksubgcd[i][0]; lkarray[i][1] = &lksubgcd[i][1]; lkarray[i][2] = NULL;
 
9733
        lkarray[i][3] = &lksubgcd[i][2]; lkarray[i][4] = &lksubgcd[i][3]; lkarray[i][5] = NULL;
 
9734
        lkarray[i][6] = NULL;
 
9735
 
 
9736
        lkbox[2*i].gd.flags = gg_enabled|gg_visible;
 
9737
        lkbox[2*i].gd.u.boxelements = lkarray[i];
 
9738
        lkbox[2*i].creator = GHVBoxCreate;
 
9739
    }
 
9740
 
 
9741
    lkaspects[0].selected = true;
 
9742
 
 
9743
    lkgcd[0].gd.pos.x = 4; lkgcd[0].gd.pos.y = 10;
 
9744
    lkgcd[0].gd.pos.width = 250;
 
9745
    lkgcd[0].gd.pos.height = 260;
 
9746
    lkgcd[0].gd.u.tabs = lkaspects;
 
9747
    lkgcd[0].gd.flags = gg_visible | gg_enabled;
 
9748
    lkgcd[0].gd.cid = CID_Lookups;
 
9749
    lkgcd[0].gd.handle_controlevent = GFI_LookupAspectChange;
 
9750
    lkgcd[0].creator = GTabSetCreate;
 
9751
 
 
9752
    lkharray[0] = &lkgcd[0]; lkharray[1] = &lkbox[4]; lkharray[2] = NULL;
 
9753
 
 
9754
    lkbox[4].gd.flags = gg_enabled|gg_visible;
 
9755
    lkbox[4].gd.u.boxelements = lkbuttonsarray;
 
9756
    lkbox[4].creator = GVBoxCreate;
 
9757
 
 
9758
    lkbox[5].gd.flags = gg_enabled|gg_visible;
 
9759
    lkbox[5].gd.u.boxelements = lkharray;
 
9760
    lkbox[5].creator = GHBoxCreate;
 
9761
    
 
9762
 
 
9763
/******************************************************************************/
 
9764
    memset(&mfgcd,0,sizeof(mfgcd));
 
9765
    memset(&mflabel,'\0',sizeof(mflabel));
 
9766
    memset(mfbox,0,sizeof(mfbox));
 
9767
 
 
9768
    GCDFillMacFeat(mfgcd,mflabel,250,sf->features, false, mfbox, mfarray);
 
9769
/******************************************************************************/
 
9770
 
 
9771
    memset(&dlabel,0,sizeof(dlabel));
 
9772
    memset(&dgcd,0,sizeof(dgcd));
 
9773
 
 
9774
    dlabel[0].text = (unichar_t *) _("Creation Date:");
 
9775
    dlabel[0].text_is_1byte = true;
 
9776
    dlabel[0].text_in_resource = true;
 
9777
    dgcd[0].gd.label = &dlabel[0];
 
9778
    dgcd[0].gd.pos.x = 12; dgcd[0].gd.pos.y = 6+6; 
 
9779
    dgcd[0].gd.flags = gg_visible | gg_enabled;
 
9780
    dgcd[0].creator = GLabelCreate;
 
9781
 
 
9782
    t = sf->creationtime;
 
9783
    tm = localtime(&t);
 
9784
    strftime(createtime,sizeof(createtime),"%c",tm);
 
9785
    tmpcreatetime = def2u_copy(createtime);
 
9786
    dgcd[1].gd.pos.x = 115; dgcd[1].gd.pos.y = dgcd[0].gd.pos.y;
 
9787
    dgcd[1].gd.flags = gg_visible | gg_enabled;
 
9788
    dlabel[1].text = tmpcreatetime;
 
9789
    dgcd[1].gd.label = &dlabel[1];
 
9790
    dgcd[1].creator = GLabelCreate;
 
9791
 
 
9792
    dlabel[2].text = (unichar_t *) _("Modification Date:");
 
9793
    dlabel[2].text_is_1byte = true;
 
9794
    dlabel[2].text_in_resource = true;
 
9795
    dgcd[2].gd.label = &dlabel[2];
 
9796
    dgcd[2].gd.pos.x = 12; dgcd[2].gd.pos.y = dgcd[0].gd.pos.y+14; 
 
9797
    dgcd[2].gd.flags = gg_visible | gg_enabled;
 
9798
    dgcd[2].creator = GLabelCreate;
 
9799
 
 
9800
    t = sf->modificationtime;
 
9801
    tm = localtime(&t);
 
9802
    strftime(modtime,sizeof(modtime),"%c",tm);
 
9803
    tmpmodtime = def2u_copy(modtime);
 
9804
    dgcd[3].gd.pos.x = 115; dgcd[3].gd.pos.y = dgcd[2].gd.pos.y;
 
9805
    dgcd[3].gd.flags = gg_visible | gg_enabled;
 
9806
    dlabel[3].text = tmpmodtime;
 
9807
    dgcd[3].gd.label = &dlabel[3];
 
9808
    dgcd[3].creator = GLabelCreate;
 
9809
 
 
9810
    darray[0] = &dgcd[0]; darray[1] = &dgcd[1]; darray[2] = NULL;
 
9811
    darray[3] = &dgcd[2]; darray[4] = &dgcd[3]; darray[5] = NULL;
 
9812
    darray[6] = GCD_Glue; darray[7] = GCD_Glue; darray[8] = NULL;
 
9813
    darray[9] = NULL;
 
9814
 
 
9815
    memset(dbox,0,sizeof(dbox));
 
9816
    dbox[0].gd.flags = gg_enabled|gg_visible;
 
9817
    dbox[0].gd.u.boxelements = darray;
 
9818
    dbox[0].creator = GHVBoxCreate;
 
9819
/******************************************************************************/
 
9820
 
 
9821
    memset(&ulabel,0,sizeof(ulabel));
 
9822
    memset(&ugcd,0,sizeof(ugcd));
 
9823
 
 
9824
    ulabel[0].text = (unichar_t *) _("Include Empty Blocks");
 
9825
    ulabel[0].text_is_1byte = true;
 
9826
    ulabel[0].text_in_resource = true;
 
9827
    ugcd[0].gd.label = &ulabel[0];
 
9828
    ugcd[0].gd.pos.x = 12; ugcd[0].gd.pos.y = 10; 
 
9829
    ugcd[0].gd.flags = gg_visible | gg_enabled;
 
9830
    ugcd[0].gd.handle_controlevent = GFI_UnicodeEmptiesChange;
 
9831
    ugcd[0].gd.cid = CID_UnicodeEmpties;
 
9832
    ugcd[0].creator = GCheckBoxCreate;
 
9833
 
 
9834
    ugcd[1].gd.pos.x = 12; ugcd[1].gd.pos.y = 30;
 
9835
    ugcd[1].gd.pos.width = ngcd[15].gd.pos.width;
 
9836
    ugcd[1].gd.pos.height = 200;
 
9837
    ugcd[1].gd.flags = gg_visible | gg_enabled | gg_utf8_popup;
 
9838
    ugcd[1].gd.cid = CID_Unicode;
 
9839
    ugcd[1].gd.handle_controlevent = GFI_UnicodeRangeChange;
 
9840
    ugcd[1].gd.popup_msg = (unichar_t *) _("Click on a range to select characters in that range.\nDouble click on a range to see characters that should be\nin the range but aren't.");
 
9841
    ugcd[1].creator = GListCreate;
 
9842
 
 
9843
    uarray[0] = &ugcd[0]; uarray[1] = &ugcd[1]; uarray[2] = NULL;
 
9844
 
 
9845
    memset(ubox,0,sizeof(ubox));
 
9846
    ubox[0].gd.flags = gg_enabled|gg_visible;
 
9847
    ubox[0].gd.u.boxelements = uarray;
 
9848
    ubox[0].creator = GVBoxCreate;
 
9849
 
 
9850
/******************************************************************************/
 
9851
 
 
9852
    memset(&mlabel,0,sizeof(mlabel));
 
9853
    memset(&mgcd,0,sizeof(mgcd));
 
9854
    memset(&aspects,'\0',sizeof(aspects));
 
9855
 
 
9856
    i = 0;
 
9857
 
 
9858
    aspects[i].text = (unichar_t *) _("Names");
 
9859
    d->old_aspect = 0;
 
9860
    aspects[i].text_is_1byte = true;
 
9861
    aspects[i++].gcd = nb;
 
9862
 
 
9863
    aspects[i].text = (unichar_t *) _("General");
 
9864
    aspects[i].text_is_1byte = true;
 
9865
    aspects[i++].gcd = psb;
 
9866
 
 
9867
    aspects[i].text = (unichar_t *) _("PS UID");
 
9868
    aspects[i].text_is_1byte = true;
 
9869
    aspects[i++].gcd = xub;
 
9870
 
 
9871
    d->private_aspect = i;
 
9872
    aspects[i].text = (unichar_t *) _("PS Private");
 
9873
    aspects[i].text_is_1byte = true;
 
9874
    aspects[i++].gcd = ppbox;
 
9875
 
 
9876
    d->ttfv_aspect = i;
 
9877
    aspects[i].text = (unichar_t *) _("OS/2");
 
9878
    if ( sf->cidmaster!=NULL ) aspects[i].disabled = true;
 
9879
    aspects[i].text_is_1byte = true;
 
9880
    aspects[i++].gcd = vagcd;
 
9881
 
 
9882
    d->tn_aspect = i;
 
9883
    if ( sf->cidmaster!=NULL ) aspects[i].disabled = true;
 
9884
    aspects[i].text = (unichar_t *) _("TTF Names");
 
9885
    aspects[i].text_is_1byte = true;
 
9886
    aspects[i++].gcd = tnboxes;
 
9887
 
 
9888
    if ( sf->cidmaster!=NULL ) aspects[i].disabled = true;
 
9889
    aspects[i].text = (unichar_t *) _("Grid Fitting");
 
9890
    aspects[i].text_is_1byte = true;
 
9891
    aspects[i++].gcd = gaspboxes;
 
9892
 
 
9893
    d->tx_aspect = i;
 
9894
/* xgettext won't use non-ASCII messages */
 
9895
    aspects[i].text = (unichar_t *) U_("\316\244\316\265\316\247");     /* Tau epsilon Chi, in greek */
 
9896
    aspects[i].text_is_1byte = true;
 
9897
    aspects[i++].gcd = txbox;
 
9898
 
 
9899
    if ( sf->cidmaster!=NULL ) aspects[i].disabled = true;
 
9900
    aspects[i].text = (unichar_t *) _("Size");
 
9901
    aspects[i].text_is_1byte = true;
 
9902
    aspects[i++].gcd = szbox;
 
9903
 
 
9904
    aspects[i].text = (unichar_t *) _("Comment");
 
9905
    aspects[i].text_is_1byte = true;
 
9906
    aspects[i++].gcd = combox;
 
9907
 
 
9908
    if ( sf->cidmaster!=NULL ) aspects[i].disabled = true;
 
9909
    aspects[i].text = (unichar_t *) _("Mark Classes");
 
9910
    aspects[i].text_is_1byte = true;
 
9911
    aspects[i++].gcd = mkbox;
 
9912
 
 
9913
/* GT: OpenType GPOS/GSUB lookups */
 
9914
    if ( sf->cidmaster!=NULL ) aspects[i].disabled = true;
 
9915
    aspects[i].text = (unichar_t *) S_("OpenType|Lookups");
 
9916
    aspects[i].text_is_1byte = true;
 
9917
    aspects[i++].gcd = &lkbox[5];
 
9918
 
 
9919
    aspects[i].text = (unichar_t *) _("Mac");
 
9920
    aspects[i].text_is_1byte = true;
 
9921
    aspects[i++].gcd = mcbox;
 
9922
 
 
9923
    aspects[i].text = (unichar_t *) _("Mac Features");
 
9924
    aspects[i].text_is_1byte = true;
 
9925
    aspects[i++].gcd = mfbox;
 
9926
 
 
9927
#ifndef FONTFORGE_CONFIG_INFO_HORIZONTAL
 
9928
    aspects[i].text = (unichar_t *) _("Dates");
 
9929
    aspects[i].text_is_1byte = true;
 
9930
    aspects[i++].gcd = dbox;
 
9931
 
 
9932
    d->unicode_aspect = i;
 
9933
    aspects[i].text = (unichar_t *) _("Unicode Ranges");
 
9934
    aspects[i].text_is_1byte = true;
 
9935
    aspects[i++].gcd = ubox;
 
9936
#endif
 
9937
 
 
9938
    aspects[defaspect].selected = true;
 
9939
 
 
9940
    mgcd[0].gd.pos.x = 4; mgcd[0].gd.pos.y = 6;
 
9941
    mgcd[0].gd.u.tabs = aspects;
 
9942
#ifndef FONTFORGE_CONFIG_INFO_HORIZONTAL
 
9943
    mgcd[0].gd.flags = gg_visible | gg_enabled | gg_tabset_vert;
 
9944
    mgcd[0].gd.pos.width = 260+85;
 
9945
    mgcd[0].gd.pos.height = 325;
 
9946
#else
 
9947
    mgcd[0].gd.flags = gg_visible | gg_enabled;
 
9948
    mgcd[0].gd.pos.width = 260;
 
9949
    mgcd[0].gd.pos.height = 325;
 
9950
#endif
 
9951
    mgcd[0].gd.handle_controlevent = GFI_AspectChange;
 
9952
    mgcd[0].gd.cid = CID_Tabs;
 
9953
    mgcd[0].creator = GTabSetCreate;
 
9954
 
 
9955
    mgcd[1].gd.pos.x = 30-3; mgcd[1].gd.pos.y = GDrawPixelsToPoints(NULL,pos.height)-35-3;
 
9956
    mgcd[1].gd.pos.width = -1; mgcd[1].gd.pos.height = 0;
 
9957
    mgcd[1].gd.flags = gg_visible | gg_enabled | gg_but_default;
 
9958
    mlabel[1].text = (unichar_t *) _("_OK");
 
9959
    mlabel[1].text_is_1byte = true;
 
9960
    mlabel[1].text_in_resource = true;
 
9961
    mgcd[1].gd.label = &mlabel[1];
 
9962
    mgcd[1].gd.handle_controlevent = GFI_OK;
 
9963
    mgcd[1].gd.cid = CID_OK;
 
9964
    mgcd[1].creator = GButtonCreate;
 
9965
 
 
9966
    mgcd[2].gd.pos.x = -30; mgcd[2].gd.pos.y = mgcd[1].gd.pos.y+3;
 
9967
    mgcd[2].gd.pos.width = -1; mgcd[2].gd.pos.height = 0;
 
9968
    mgcd[2].gd.flags = gg_visible | gg_enabled | gg_but_cancel;
 
9969
    mlabel[2].text = (unichar_t *) _("_Cancel");
 
9970
    mlabel[2].text_is_1byte = true;
 
9971
    mlabel[2].text_in_resource = true;
 
9972
    mgcd[2].gd.label = &mlabel[2];
 
9973
    mgcd[2].gd.handle_controlevent = GFI_Cancel;
 
9974
    mgcd[2].gd.cid = CID_Cancel;
 
9975
    mgcd[2].creator = GButtonCreate;
 
9976
 
 
9977
    mgcd[3].gd.pos.x = 2; mgcd[3].gd.pos.y = 2;
 
9978
    mgcd[3].gd.pos.width = pos.width-4; mgcd[3].gd.pos.height = pos.height-4;
 
9979
    mgcd[3].gd.flags = gg_enabled | gg_visible | gg_pos_in_pixels;
 
9980
    mgcd[3].gd.cid = CID_MainGroup;
 
9981
    mgcd[3].creator = GGroupCreate;
 
9982
 
 
9983
    marray2[0] = marray2[2] = marray2[3] = marray2[4] = marray2[6] = GCD_Glue; marray2[7] = NULL;
 
9984
    marray2[1] = &mgcd[1]; marray2[5] = &mgcd[2];
 
9985
 
 
9986
    marray[0] = &mgcd[0]; marray[1] = NULL;
 
9987
    marray[2] = &mb2; marray[3] = NULL;
 
9988
    marray[4] = GCD_Glue; marray[5] = NULL;
 
9989
    marray[6] = NULL;
 
9990
 
 
9991
    memset(mb,0,sizeof(mb));
 
9992
    mb[0].gd.pos.x = mb[0].gd.pos.y = 2;
 
9993
    mb[0].gd.flags = gg_enabled|gg_visible;
 
9994
    mb[0].gd.u.boxelements = marray;
 
9995
    mb[0].creator = GHVBoxCreate;
 
9996
 
 
9997
    memset(&mb2,0,sizeof(mb2));
 
9998
    mb2.gd.flags = gg_enabled|gg_visible;
 
9999
    mb2.gd.u.boxelements = marray2;
 
10000
    mb2.creator = GHBoxCreate;
 
10001
 
 
10002
    GGadgetsCreate(gw,mb);
 
10003
    GMatrixEditSetNewText(tngcd[4].ret,S_("TrueTypeName|New"));
 
10004
    GGadgetSelectOneListItem(gaspgcd[0].ret,sf->gasp_version);
 
10005
    GMatrixEditSetNewText(gaspgcd[3].ret,S_("gaspTableEntry|New"));
 
10006
    GMatrixEditAddButtons(gaspgcd[3].ret,gaspgcd_def);
 
10007
    if ( sf->gasp_version==0 ) {
 
10008
        GMatrixEditEnableColumn(gaspgcd[3].ret,3,false);
 
10009
        GMatrixEditEnableColumn(gaspgcd[3].ret,4,false);
 
10010
    }
 
10011
    GHVBoxSetExpandableCol(gaspboxes[2].ret,2);
 
10012
    GHVBoxSetExpandableRow(gaspboxes[0].ret,1);
 
10013
 
 
10014
    GHVBoxSetExpandableRow(mb[0].ret,0);
 
10015
    GHVBoxSetExpandableCol(mb2.ret,gb_expandgluesame);
 
10016
 
 
10017
    GHVBoxSetExpandableCol(nb[0].ret,1);
 
10018
    GHVBoxSetExpandableRow(nb[0].ret,7);
 
10019
    GHVBoxSetExpandableCol(nb2.ret,1);
 
10020
    GHVBoxSetExpandableCol(nb3.ret,1);
 
10021
 
 
10022
    GHVBoxSetExpandableCol(xub[0].ret,1);
 
10023
    GHVBoxSetExpandableRow(xub[0].ret,3);
 
10024
 
 
10025
    GHVBoxSetExpandableRow(psb[0].ret,psrow);
 
10026
    GHVBoxSetExpandableCol(psb2[0].ret,3);
 
10027
    GHVBoxSetExpandableCol(psb2[1].ret,1);
 
10028
    GHVBoxSetExpandableCol(psb2[2].ret,1);
 
10029
 
 
10030
    GHVBoxSetExpandableRow(ppbox[0].ret,0);
 
10031
    GHVBoxSetExpandableCol(ppbox[2].ret,gb_samesize);
 
10032
 
 
10033
    GHVBoxSetExpandableRow(vbox[0].ret,gb_expandglue);
 
10034
    GHVBoxSetExpandableCol(vbox[0].ret,1);
 
10035
    GHVBoxSetExpandableCol(vbox[2].ret,gb_expandglue);
 
10036
 
 
10037
    GHVBoxSetExpandableRow(metbox[0].ret,10);
 
10038
    GHVBoxSetExpandableCol(metbox[0].ret,1);
 
10039
 
 
10040
    GHVBoxSetExpandableRow(ssbox[0].ret,gb_expandglue);
 
10041
    GHVBoxSetExpandableCol(ssbox[0].ret,gb_expandglue);
 
10042
 
 
10043
    GHVBoxSetExpandableRow(panbox[0].ret,gb_expandglue);
 
10044
    GHVBoxSetExpandableCol(panbox[0].ret,1);
 
10045
 
 
10046
    GHVBoxSetExpandableRow(mkbox[0].ret,0);
 
10047
    GHVBoxSetExpandableCol(mkbox[2].ret,gb_expandglue);
 
10048
 
 
10049
    GHVBoxSetExpandableRow(txbox[0].ret,gb_expandglue);
 
10050
    GHVBoxSetExpandableCol(txbox[2].ret,gb_expandglue);
 
10051
    GHVBoxSetExpandableCol(txbox[3].ret,gb_expandglue);
 
10052
    GHVBoxSetExpandableCol(txbox[4].ret,gb_expandglue);
 
10053
 
 
10054
    GHVBoxSetExpandableRow(szbox[0].ret,4);
 
10055
    GHVBoxSetPadding(szbox[2].ret,6,2);
 
10056
    GHVBoxSetExpandableCol(szbox[2].ret,gb_expandglue);
 
10057
    GHVBoxSetPadding(szbox[3].ret,6,2);
 
10058
    GHVBoxSetExpandableCol(szbox[3].ret,gb_expandglue);
 
10059
    GHVBoxSetPadding(szbox[4].ret,6,2);
 
10060
    GHVBoxSetExpandableCol(szbox[4].ret,gb_expandglue);
 
10061
    GHVBoxSetExpandableCol(szbox[5].ret,gb_expandglue);
 
10062
 
 
10063
    GHVBoxSetExpandableRow(tnboxes[0].ret,1);
 
10064
    GHVBoxSetExpandableCol(tnboxes[2].ret,gb_expandglue);
 
10065
    GHVBoxSetExpandableCol(tnboxes[3].ret,gb_expandglue);
 
10066
 
 
10067
    GHVBoxSetExpandableRow(mcbox[0].ret,gb_expandglue);
 
10068
    GHVBoxSetExpandableCol(mcbox[0].ret,1);
 
10069
    GHVBoxSetExpandableRow(mcbox[2].ret,gb_expandglue);
 
10070
 
 
10071
    GHVBoxSetExpandableRow(mfbox[0].ret,0);
 
10072
    GHVBoxSetExpandableRow(mfbox[2].ret,gb_expandglue);
 
10073
 
 
10074
    GHVBoxSetExpandableRow(dbox[0].ret,gb_expandglue);
 
10075
    GHVBoxSetExpandableCol(dbox[0].ret,1);
 
10076
 
 
10077
    GHVBoxSetExpandableRow(ubox[0].ret,1);
 
10078
 
 
10079
    GHVBoxSetExpandableCol(lkbox[0].ret,0);
 
10080
    GHVBoxSetExpandableRow(lkbox[0].ret,0);
 
10081
    GHVBoxSetPadding(lkbox[0].ret,0,0);
 
10082
    GHVBoxSetExpandableCol(lkbox[2].ret,0);
 
10083
    GHVBoxSetExpandableRow(lkbox[2].ret,0);
 
10084
    GHVBoxSetPadding(lkbox[2].ret,0,0);
 
10085
    GHVBoxSetExpandableRow(lkbox[4].ret,gb_expandglue);
 
10086
    GHVBoxSetExpandableCol(lkbox[5].ret,0);
 
10087
 
 
10088
    GFI_LookupEnableButtons(d,true);
 
10089
    GFI_LookupEnableButtons(d,false);
 
10090
 
 
10091
    memset(&rq,0,sizeof(rq));
 
10092
    rq.family_name = sans;
 
10093
    rq.point_size = 12;
 
10094
    rq.weight = 400;
 
10095
    d->font = GDrawInstanciateFont(GDrawGetDisplayOfWindow(gw),&rq);
 
10096
    GDrawFontMetrics(d->font,&as,&ds,&ld);
 
10097
    d->as = as; d->fh = as+ds;
 
10098
 
 
10099
    GTextInfoListFree(namelistnames);
 
10100
    GTextInfoListFree(pgcd[0].gd.u.list);
 
10101
 
 
10102
    for ( i=0; i<mi.initial_row_cnt; ++i )
 
10103
        free( mi.matrix_data[3*i+2].u.md_str );
 
10104
    free( mi.matrix_data );
 
10105
 
 
10106
    free(tmpcreatetime);
 
10107
    free(tmpmodtime);
 
10108
 
 
10109
    GHVBoxFitWindow(mb[0].ret);
 
10110
#if 0
 
10111
    if ( GTabSetGetTabLines(mgcd[0].ret)>3 ) {
 
10112
        int offset = (GTabSetGetTabLines(mgcd[0].ret)-2)*GDrawPointsToPixels(NULL,20);
 
10113
        GDrawResize(gw,pos.width,pos.height+offset);
 
10114
    }
 
10115
#endif
 
10116
 
 
10117
    GWidgetIndicateFocusGadget(ngcd[1].ret);
 
10118
    ProcessListSel(d);
 
10119
    GFI_AspectChange(mgcd[0].ret,NULL);
 
10120
    GFI_InitMarkClasses(d);
 
10121
    GGadgetSetList(GWidgetGetControl(gw,CID_StyleName),StyleNames(sf->fontstyle_name),false);
 
10122
 
 
10123
    GWidgetHidePalettes();
 
10124
    GDrawSetVisible(gw,true);
 
10125
 
 
10126
    if ( sync ) {
 
10127
        while ( !d->done )
 
10128
            GDrawProcessOneEvent(NULL);
 
10129
    }
 
10130
}
 
10131
 
 
10132
void FontMenuFontInfo(void *_fv) {
 
10133
    FontInfo( ((FontView *) _fv)->sf,-1,false);
 
10134
}
 
10135
 
 
10136
void FontInfoDestroy(SplineFont *sf) {
 
10137
    if ( sf->fontinfo )
 
10138
        GFI_CancelClose( (struct gfi_data *) (sf->fontinfo) );
 
10139
}
 
10140
#endif          /* FONTFORGE_CONFIG_NO_WINDOWING_UI */
 
10141
 
 
10142
 
 
10143
void FontInfoInit(void) {
 
10144
    static int done = false;
 
10145
    int i, j;
 
10146
    static GTextInfo *needswork[] = {
 
10147
        macstyles, widthclass, weightclass, fstype, pfmfamily, ibmfamily,
 
10148
        panfamily, panserifs, panweight, panprop, pancontrast, panstrokevar,
 
10149
        panarmstyle, panletterform, panmidline, panxheight, mslanguages,
 
10150
        ttfnameids, interpretations, gridfit, antialias, os2versions,
 
10151
        NULL
 
10152
    };
 
10153
#ifndef FONTFORGE_CONFIG_NO_WINDOWING_UI
 
10154
    static char **needswork2[] = { texparams, texpopups,
 
10155
        mathparams, mathpopups, extparams, extpopups,
 
10156
    NULL };
 
10157
#endif
 
10158
    if ( done )
 
10159
return;
 
10160
    done = true;
 
10161
#ifndef _NO_PYTHON
 
10162
    scriptingSaveEnglishNames(ttfnameids,mslanguages);
 
10163
#endif
 
10164
    for ( j=0; needswork[j]!=NULL; ++j ) {
 
10165
        for ( i=0; needswork[j][i].text!=NULL; ++i )
 
10166
            needswork[j][i].text = (unichar_t *) S_((char *) needswork[j][i].text);
 
10167
    }
 
10168
#ifndef FONTFORGE_CONFIG_NO_WINDOWING_UI
 
10169
    for ( j=0; needswork2[j]!=NULL; ++j ) {
 
10170
        for ( i=0; needswork2[j][i]!=NULL; ++i )
 
10171
            needswork2[j][i] = _(needswork2[j][i]);
 
10172
    }
 
10173
 
 
10174
    ci[0].title = S_(ci[0].title);
 
10175
    ci[1].title = S_(ci[1].title);
 
10176
    ci[2].title = S_(ci[2].title);
 
10177
 
 
10178
    gaspci[0].title = S_(gaspci[0].title);
 
10179
    gaspci[1].title = S_(gaspci[1].title);
 
10180
    gaspci[2].title = S_(gaspci[2].title);
 
10181
    gaspci[3].title = S_(gaspci[3].title);
 
10182
    gaspci[4].title = S_(gaspci[4].title);
 
10183
#endif
 
10184
}