#include <config.h>
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <string.h>
#include <math.h>
#include "mdvi.h"
#include "private.h"
Go to the source code of this file.
|
static int pk_load_font | __PROTO ((DviParams *, DviFont *)) |
|
static int pk_font_get_glyph | __PROTO ((DviParams *, DviFont *, int)) |
|
static char *pk_lookup | __PROTO ((const char *, Ushort *, Ushort *)) |
|
static char * | pk_lookup (const char *name, Ushort *hdpi, Ushort *vdpi) |
|
static char * | pk_lookupn (const char *name, Ushort *hdpi, Ushort *vdpi) |
|
static int | pk_get_nyb (FILE *p, pkread *pk) |
|
static int | pk_packed_num (FILE *p, pkread *pkr, int *repeat) |
|
static BITMAP * | get_bitmap (FILE *p, int w, int h, int flags) |
|
static BITMAP * | get_packed (FILE *p, int w, int h, int flags) |
|
static BITMAP * | get_char (FILE *p, int w, int h, int flags) |
|
static int | pk_load_font (DviParams *unused, DviFont *font) |
|
static int | pk_font_get_glyph (DviParams *params, DviFont *font, int code) |
|
Definition at line 42 of file pk.c.
#define PK_DYN_F |
( |
|
x) | |
(((x) >> 4) & 0xf) |
Definition at line 52 of file pk.c.
Definition at line 41 of file pk.c.
Definition at line 49 of file pk.c.
#define PK_PACKED |
( |
|
x) | |
(PK_DYN_F(x) != 14) |
Definition at line 53 of file pk.c.
Definition at line 48 of file pk.c.
Definition at line 50 of file pk.c.
Definition at line 43 of file pk.c.
Definition at line 44 of file pk.c.
Definition at line 45 of file pk.c.
Definition at line 46 of file pk.c.
Definition at line 47 of file pk.c.
#define ROUND |
( |
|
x, |
|
|
|
y |
|
) |
| (((x) + (y) - 1) / (y)) |
Definition at line 192 of file pk.c.
static BITMAP* get_bitmap |
( |
FILE * |
p, |
|
|
int |
w, |
|
|
int |
h, |
|
|
int |
flags |
|
) |
| |
|
static |
Definition at line 194 of file pk.c.
210 for(i = 0; i < h; i++) {
214 for(j = 0; j < w; j++) {
219 if(currch & (1 << bitpos))
static BITMAP* get_char |
( |
FILE * |
p, |
|
|
int |
w, |
|
|
int |
h, |
|
|
int |
flags |
|
) |
| |
|
static |
Definition at line 317 of file pk.c.
320 if(((flags >> 4) & 0xf) == 14)
static BITMAP* get_packed |
( |
FILE * |
p, |
|
|
int |
w, |
|
|
int |
h, |
|
|
int |
flags |
|
) |
| |
|
static |
Definition at line 233 of file pk.c.
245 paint = !!(flags & 0x8);
260 fprintf(stderr,
"second repeat count for this row (had %d and got %d)\n",
274 while(repeat_count-- > 0) {
309 if(row != h || inrow != w) {
310 mdvi_error(
_(
"Bad PK file: More bits than required\n"));
Definition at line 544 of file pk.c.
548 if((ch =
FONTCHAR(font, code)) == NULL)
553 DEBUG((
DBG_GLYPHS,
"(pk) loading glyph for character %d (%dx%d) in font `%s'\n",
566 if(fseek(font->
in, ch->
offset, SEEK_SET) == -1)
static int pk_get_nyb |
( |
FILE * |
p, |
|
|
pkread * |
pk |
|
) |
| |
|
inlinestatic |
Definition at line 138 of file pk.c.
Definition at line 327 of file pk.c.
343 for(i = 0; i < 256; i++)
352 for(loc = 0; loc < i; loc++)
357 fseek(in, (
long)i, SEEK_CUR);
364 mdvi_warning(
_(
"%s: checksum mismatch (expected %u, got %u)\n"),
375 loc = 256; hic = -1; maxch = 256;
398 for(n = 0; n < i; n++)
432 switch(flag_byte & 0x7) {
436 offset = ftell(p) + pl;
448 pl = (flag_byte % 4) * 65536 +
fuget2(p);
450 offset = ftell(p) + pl;
460 pl = (flag_byte % 4) * 256 +
fuget1(p);
462 offset = ftell(p) + pl;
477 if (cc < 0 || cc > 65536) {
489 for(i = maxch; i < cc + 16; i++)
509 fseek(p, (
long)offset, SEEK_SET);
513 mdvi_error(
_(
"%s: unexpected end of file (no postamble)\n"),
517 while((flag_byte =
fuget1(p)) != EOF) {
519 mdvi_error(
_(
"invalid PK file! (junk in postamble)\n"));
525 if(loc > 0 || hic < maxch-1) {
540 font->
loc = font->
hic = 0;
static char* pk_lookup |
( |
const char * |
name, |
|
|
Ushort * |
hdpi, |
|
|
Ushort * |
vdpi |
|
) |
| |
|
static |
Definition at line 98 of file pk.c.
100 kpse_glyph_file_type type;
104 kpse_set_program_enabled(kpse_pk_format, 1, kpse_src_cmdline);
107 filename = kpse_find_glyph(
name,
Max(*hdpi, *vdpi),
108 kpse_pk_format, &type);
109 if(filename && type.source == kpse_glyph_source_fallback) {
112 }
else if(filename) {
113 *hdpi = *vdpi = type.dpi;
static char* pk_lookupn |
( |
const char * |
name, |
|
|
Ushort * |
hdpi, |
|
|
Ushort * |
vdpi |
|
) |
| |
|
static |
Definition at line 118 of file pk.c.
120 kpse_glyph_file_type type;
124 kpse_set_program_enabled(kpse_pk_format, 0, kpse_src_cmdline);
127 filename = kpse_find_glyph(
name,
Max(*hdpi, *vdpi),
128 kpse_pk_format, &type);
129 if(filename && type.source == kpse_glyph_source_fallback) {
132 }
else if(filename) {
133 *hdpi = *vdpi = type.dpi;
static int pk_packed_num |
( |
FILE * |
p, |
|
|
pkread * |
pkr, |
|
|
int * |
repeat |
|
) |
| |
|
static |
Definition at line 164 of file pk.c.
167 int dyn_f = pkr->
dyn_f;
177 return (j - 15 + ((13 - dyn_f) << 4) +
179 }
else if(i <= dyn_f)
182 return ((i - dyn_f - 1) << 4) +
Definition at line 58 of file pk.c.
Initial value:= {
"PK",
0,
NULL,
NULL,
kpse_pk_format,
NULL
}
Definition at line 70 of file pk.c.
Initial value:= {
"PKN",
0,
NULL,
NULL,
kpse_pk_format,
NULL
}
Definition at line 84 of file pk.c.