42 #define PK_CMD_START 240
52 #define PK_DYN_F(x) (((x) >> 4) & 0xf)
53 #define PK_PACKED(x) (PK_DYN_F(x) != 14)
100 kpse_glyph_file_type type;
103 if(pk_auto_generate == 0) {
104 kpse_set_program_enabled(kpse_pk_format, 1, kpse_src_cmdline);
105 pk_auto_generate = 1;
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;
120 kpse_glyph_file_type type;
123 if(pk_auto_generate) {
124 kpse_set_program_enabled(kpse_pk_format, 0, kpse_src_cmdline);
125 pk_auto_generate = 0;
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;
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) +
192 #define ROUND(x,y) (((x) + (y) - 1) / (y))
210 for(i = 0; i < h; i++) {
214 for(j = 0; j < w; j++) {
219 if(currch & (1 << bitpos))
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"));
320 if(((flags >> 4) & 0xf) == 14)
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;
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)