~ubuntu-branches/ubuntu/precise/libxfont/precise-updates

« back to all changes in this revision

Viewing changes to src/Speedo/set_trns.c

  • Committer: Bazaar Package Importer
  • Author(s): Bryce Harrington
  • Date: 2007-07-18 16:46:59 UTC
  • mto: This revision was merged to the branch mainline in revision 15.
  • Revision ID: james.westby@ubuntu.com-20070718164659-hbs3149rix062etp
Tags: upstream-1.3.0
ImportĀ upstreamĀ versionĀ 1.3.0

Show diffs side-by-side

added added

removed removed

Lines of Context:
113
113
type_tcb(ptcb); /* Reclassify transformation types */
114
114
}
115
115
 
116
 
FUNCTION ufix8 FONTFAR *skip_interpolation_table(
117
 
GDECL
118
 
ufix8 FONTFAR *pointer,  /* Pointer to next byte in char data */
119
 
ufix8    format)    /* Character format byte */
120
 
{
121
 
fix15 i,n;
122
 
ufix8 intsize[9];
123
 
 
124
 
intsize[0] = 1;
125
 
intsize[1] = 2;
126
 
intsize[2] = 3;
127
 
intsize[3] = 1;
128
 
intsize[4] = 2;
129
 
intsize[5] = 1;
130
 
intsize[6] = 2;
131
 
intsize[7] = 0;
132
 
intsize[8] = 0;
133
 
 
134
 
n =  ((format & BIT6)? (fix15)NEXT_BYTE(pointer): 0);
135
 
n += ((format & BIT7)? (fix15)NEXT_BYTE(pointer): 0);
136
 
for (i = 0; i < n; i++)          /* For each entry in int table ... */
137
 
    {
138
 
    format = NEXT_BYTE(pointer); /* Read format byte */
139
 
    if (format & BIT7)           /* Short Start/End point spec? */
140
 
        {
141
 
        pointer++;               /* Skip Start/End point byte */
142
 
        }
143
 
    else
144
 
        {
145
 
        pointer += intsize[format & 0x7];  /* Skip Start point spec */
146
 
        pointer += intsize[(format >> 3) & 0x7]; /* Skip End point spec */
147
 
        }
148
 
    }
149
 
return pointer;
150
 
}
151
 
FUNCTION ufix8 FONTFAR *skip_control_zone(
152
 
GDECL
153
 
ufix8 FONTFAR *pointer,  /* Pointer to next byte in char data */
154
 
ufix8    format)    /* Character format byte */
155
 
{
156
 
fix15    i,n;
157
 
ufix16   tmpufix16;
158
 
 
159
 
n = sp_globals.no_X_orus + sp_globals.no_Y_orus - 2;
160
 
for (i = 0; i < n; i++)          /* For each entry in control table ... */
161
 
    {
162
 
    if (format & BIT4)
163
 
        pointer++;               /* Skip short form From/To fields */
164
 
    else
165
 
        pointer += 2;            /* Skip FROM and TO fields */
166
 
    /* skip constraints field */
167
 
    NEXT_BYTES (pointer, tmpufix16);
168
 
 
169
 
    }
170
 
return pointer;
171
 
}
172
116
 
173
 
#if INCL_RULES
174
 
#else
175
 
FUNCTION ufix8 FONTFAR *plaid_tcb(
 
117
static FUNCTION ufix8 FONTFAR *read_oru_table(
176
118
GDECL
177
 
ufix8 FONTFAR *pointer,  /* Pointer to next byte in char data */
178
 
ufix8    format)    /* Character format byte */
179
 
/* 
180
 
 * Called by make_simp_char() and make_comp_char() to set up the controlled
181
 
 * coordinate table and skip all other intelligent scaling rules embedded
182
 
 * in the character data.
183
 
 * Updates pointer to first byte after plaid data.
184
 
 * This is used only if intelligent scaling is not supported in the
185
 
 * configuration definitions.
 
119
ufix8 FONTFAR *pointer)   /* Pointer to first byte in controlled coord table */
 
120
/*
 
121
 * Called by plaid_tcb() to read the controlled coordinate table from the
 
122
 * character data in the font. 
 
123
 * Updates the pointer to the byte following the controlled coordinate
 
124
 * data.
186
125
 */
187
126
{
188
 
fix15  i, n;
189
 
 
190
 
 
191
 
 
192
 
sp_globals.no_X_orus = (format & BIT2)?
193
 
    (fix15)NEXT_BYTE(pointer):
194
 
    0;
195
 
sp_globals.no_Y_orus = (format & BIT3)?
196
 
    (fix15)NEXT_BYTE(pointer):
197
 
    0;
198
 
pointer = read_oru_table(pointer);        /* Updates no_X/Y/orus */
199
 
sp_globals.Y_edge_org = sp_globals.no_X_orus;
200
 
 
201
 
/* Skip over control zone table */
202
 
pointer = skip_control_zone(pointer,format);
203
 
 
204
 
/* Skip over interpolation table */
205
 
pointer = skip_interpolation_table(pointer,format);
206
 
return pointer;
207
 
}
 
127
fix15    i, j, k, n;
 
128
boolean  zero_not_in;
 
129
boolean  zero_added;
 
130
fix15    oru;
 
131
 
 
132
fix15    pos;
 
133
 
 
134
i = 0;
 
135
n = sp_globals.no_X_orus;
 
136
pos = sp_globals.tcb.xpos;
 
137
for (j = 0; ; j++)
 
138
    {
 
139
    zero_not_in = TRUE;
 
140
    zero_added = FALSE;
 
141
    for (k = 0; k < n; k++)
 
142
        {
 
143
        oru = NEXT_WORD(pointer);
 
144
        if (zero_not_in && (oru >= 0)) /* First positive oru value? */
 
145
            {
 
146
            sp_plaid.pix[i] = pos;        /* Insert position in pix array */
 
147
            if (oru != 0)        /* Zero oru value omitted? */
 
148
                {
 
149
                sp_plaid.orus[i++] = 0;   /* Insert zero value in oru array */
 
150
                zero_added = TRUE; /* Remember to increment size of array */
 
151
                }
 
152
            zero_not_in = FALSE; /* Inhibit further testing for zero ins */
 
153
            }
 
154
        sp_plaid.orus[i++] = oru;         /* Add specified oru value to array */
 
155
        }
 
156
    if (zero_not_in)             /* All specified oru values negative? */
 
157
        {
 
158
        sp_plaid.pix[i] = pos;            /* Insert position in pix array */
 
159
        sp_plaid.orus[i++] = 0;           /* Add zero oru value */
 
160
        zero_added = TRUE;       /* Remember to increment size of array */
 
161
        }
 
162
    if (j)                       /* Both X and Y orus read? */
 
163
        break;
 
164
    if (zero_added)                                 
 
165
        sp_globals.no_X_orus++;             /* Increment X array size */
 
166
    n = sp_globals.no_Y_orus;               /* Prepare to read Y oru values */
 
167
    pos = sp_globals.tcb.ypos;
 
168
    }
 
169
if (zero_added)                  /* Zero Y oru value added to array? */
 
170
    sp_globals.no_Y_orus++;                 /* Increment Y array size */
 
171
 
 
172
#if DEBUG
 
173
printf("\nX ORUS\n");
 
174
n = sp_globals.no_X_orus;
 
175
for (i = 0; i < n; i++)
 
176
    {
 
177
    printf("%2d %4d\n", i, sp_plaid.orus[i]);
 
178
    }
 
179
printf("\nY ORUS\n");
 
180
n = sp_globals.no_Y_orus;
 
181
for (i = 0; i < n; i++)
 
182
    {
 
183
    printf("%2d %4d\n", i, sp_plaid.orus[i + sp_globals.no_X_orus]);
 
184
    }
208
185
#endif
209
 
 
210
 
#if INCL_RULES
 
186
 
 
187
return pointer;             /* Update pointer */
 
188
}
 
189
 
211
190
FUNCTION ufix8 FONTFAR *plaid_tcb(
212
191
GDECL
213
192
ufix8 FONTFAR *pointer,  /* Pointer to next byte in char data */
266
245
 
267
246
return pointer;
268
247
}
269
 
#endif
270
 
 
271
 
#if INCL_RULES
 
248
 
272
249
FUNCTION static void sp_constr_update()
273
250
GDECL
274
251
/*
437
414
#endif
438
415
 
439
416
}
440
 
#endif
441
417
 
442
 
FUNCTION ufix8 FONTFAR *read_oru_table(
443
 
GDECL
444
 
ufix8 FONTFAR *pointer)   /* Pointer to first byte in controlled coord table */
445
 
/*
446
 
 * Called by plaid_tcb() to read the controlled coordinate table from the
447
 
 * character data in the font. 
448
 
 * Updates the pointer to the byte following the controlled coordinate
449
 
 * data.
450
 
 */
451
 
{
452
 
fix15    i, j, k, n;
453
 
boolean  zero_not_in;
454
 
boolean  zero_added;
455
 
fix15    oru;
456
 
 
457
 
#if INCL_RULES
458
 
fix15    pos;
459
 
#endif
460
 
 
461
 
i = 0;
462
 
n = sp_globals.no_X_orus;
463
 
#if INCL_RULES
464
 
pos = sp_globals.tcb.xpos;
465
 
#endif
466
 
for (j = 0; ; j++)
467
 
    {
468
 
    zero_not_in = TRUE;
469
 
    zero_added = FALSE;
470
 
    for (k = 0; k < n; k++)
471
 
        {
472
 
        oru = NEXT_WORD(pointer);
473
 
        if (zero_not_in && (oru >= 0)) /* First positive oru value? */
474
 
            {
475
 
#if INCL_RULES
476
 
            sp_plaid.pix[i] = pos;        /* Insert position in pix array */
477
 
#endif
478
 
            if (oru != 0)        /* Zero oru value omitted? */
479
 
                {
480
 
                sp_plaid.orus[i++] = 0;   /* Insert zero value in oru array */
481
 
                zero_added = TRUE; /* Remember to increment size of array */
482
 
                }
483
 
            zero_not_in = FALSE; /* Inhibit further testing for zero ins */
484
 
            }
485
 
        sp_plaid.orus[i++] = oru;         /* Add specified oru value to array */
486
 
        }
487
 
    if (zero_not_in)             /* All specified oru values negative? */
488
 
        {
489
 
#if INCL_RULES
490
 
        sp_plaid.pix[i] = pos;            /* Insert position in pix array */
491
 
#endif
492
 
        sp_plaid.orus[i++] = 0;           /* Add zero oru value */
493
 
        zero_added = TRUE;       /* Remember to increment size of array */
494
 
        }
495
 
    if (j)                       /* Both X and Y orus read? */
496
 
        break;
497
 
    if (zero_added)                                 
498
 
        sp_globals.no_X_orus++;             /* Increment X array size */
499
 
    n = sp_globals.no_Y_orus;               /* Prepare to read Y oru values */
500
 
#if INCL_RULES
501
 
    pos = sp_globals.tcb.ypos;
502
 
#endif
503
 
    }
504
 
if (zero_added)                  /* Zero Y oru value added to array? */
505
 
    sp_globals.no_Y_orus++;                 /* Increment Y array size */
506
 
 
507
 
#if DEBUG
508
 
printf("\nX ORUS\n");
509
 
n = sp_globals.no_X_orus;
510
 
for (i = 0; i < n; i++)
511
 
    {
512
 
    printf("%2d %4d\n", i, sp_plaid.orus[i]);
513
 
    }
514
 
printf("\nY ORUS\n");
515
 
n = sp_globals.no_Y_orus;
516
 
for (i = 0; i < n; i++)
517
 
    {
518
 
    printf("%2d %4d\n", i, sp_plaid.orus[i + sp_globals.no_X_orus]);
519
 
    }
520
 
#endif
521
 
 
522
 
return pointer;             /* Update pointer */
523
 
}
524
418
#if INCL_SQUEEZING || INCL_ISW
525
419
FUNCTION static void calculate_x_pix(
526
420
GDECL
921
815
}
922
816
#endif
923
817
 
924
 
#if INCL_RULES
925
818
FUNCTION static ufix8 FONTFAR *sp_setup_pix_table(
926
819
GDECL
927
820
ufix8 FONTFAR *pointer,   /* Pointer to first byte in control zone table */
1149
1042
 
1150
1043
return pointer;
1151
1044
}
1152
 
#endif
1153
1045
 
1154
1046
 
1155
 
#if INCL_RULES
1156
1047
FUNCTION static ufix8 FONTFAR *sp_setup_int_table(
1157
1048
GDECL
1158
1049
ufix8 FONTFAR *pointer,   /* Pointer to first byte in interpolation zone table */
1307
1198
 
1308
1199
return pointer;
1309
1200
}
1310
 
#endif
1311
1201
#if INCL_ISW
1312
1202
FUNCTION fix31 compute_isw_scale()
1313
1203
GDECL