summaryrefslogtreecommitdiff
path: root/Build/source/texk/dvipsk/download.c
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2020-01-11 23:45:23 +0000
committerKarl Berry <karl@freefriends.org>2020-01-11 23:45:23 +0000
commit05c80cfe06a972990fde7671eb559ff735c7506c (patch)
treef78de2eb3541356dd07eeafcd82eec99f6f14010 /Build/source/texk/dvipsk/download.c
parent32013f736fb33d38e83843850e8e9d787b8475f0 (diff)
bitmap font encoding support from Tom Rokicki
git-svn-id: svn://tug.org/texlive/trunk@53372 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Build/source/texk/dvipsk/download.c')
-rw-r--r--Build/source/texk/dvipsk/download.c75
1 files changed, 46 insertions, 29 deletions
diff --git a/Build/source/texk/dvipsk/download.c b/Build/source/texk/dvipsk/download.c
index cd71ce1e5d3..131c49250b3 100644
--- a/Build/source/texk/dvipsk/download.c
+++ b/Build/source/texk/dvipsk/download.c
@@ -22,45 +22,55 @@ static unsigned char dummyend[8] = { 252 };
* We have a routine that downloads an individual character.
*/
static int lastccout;
+quarterword *unpack_bb(chardesctype *c, integer *cwidth, integer *cheight,
+ integer *xoff, integer *yoff) {
+ quarterword *p = c->packptr;
+ halfword cmd = *p++;
+ if (cmd & 4) {
+ if ((cmd & 7) == 7) {
+ *cwidth = getlong(p);
+ *cheight = getlong(p + 4);
+ *xoff = getlong(p + 8);
+ *yoff = getlong(p + 12);
+ p += 16;
+ } else {
+ *cwidth = p[0] * 256 + p[1];
+ *cheight = p[2] * 256 + p[3];
+ *xoff = p[4] * 256 + p[5];
+ if (*xoff > 32767)
+ *xoff -= 65536 ;
+ *yoff = p[6] * 256 + p[7];
+ if (*xoff > 32767)
+ *xoff -= 65536 ;
+ p += 8;
+ }
+ } else {
+ *cwidth = *p++;
+ *cheight = *p++;
+ *xoff = *p++;
+ *yoff = *p++;
+ if (*xoff > 127)
+ *xoff -= 256;
+ if (*yoff > 127)
+ *yoff -= 256;
+ }
+ return p ;
+}
static void
downchar(chardesctype *c, shalfword cc)
{
register long i, j;
- register halfword cheight, cwidth;
+ integer cheight, cwidth;
register long k;
register quarterword *p;
register halfword cmd;
- register shalfword xoff, yoff;
+ integer xoff, yoff;
halfword wwidth = 0;
register long len;
int smallchar;
- p = c->packptr;
- cmd = *p++;
- if (cmd & 4) {
- if ((cmd & 7) == 7) {
- cwidth = getlong(p);
- cheight = getlong(p + 4);
- xoff = getlong(p + 8);
- yoff = getlong(p + 12);
- p += 16;
- } else {
- cwidth = p[0] * 256 + p[1];
- cheight = p[2] * 256 + p[3];
- xoff = p[4] * 256 + p[5]; /* N.B.: xoff, yoff are signed halfwords */
- yoff = p[6] * 256 + p[7];
- p += 8;
- }
- } else {
- cwidth = *p++;
- cheight = *p++;
- xoff = *p++;
- yoff = *p++;
- if (xoff > 127)
- xoff -= 256;
- if (yoff > 127)
- yoff -= 256;
- }
+ cmd = *(c->packptr) ;
+ p = unpack_bb(c, &cwidth, &cheight, &xoff, &yoff) ;
if (c->flags & BIGCHAR)
smallchar = 0;
else
@@ -289,6 +299,11 @@ download(charusetype *p, int psfont)
newline();
fprintf(bitfile, "%%DVIPSBitmapFont: %s %s %g %d\n", name+1, curfnt->name,
fontscale, numcc);
+ double scale = fontscale * DPI / 72.0 ;
+ int seq = -1 ;
+ if (encodetype3)
+ seq = downloadbmencoding(curfnt->name, scale,
+ curfnt->llx, curfnt->lly, curfnt->urx, curfnt->ury) ;
cmdout(name);
numout((integer)numcc);
numout((integer)maxcc + 1);
@@ -324,7 +339,9 @@ download(charusetype *p, int psfont)
}
}
cmdout("E");
- newline();
+ newline() ;
+ if (seq >= 0)
+ finishbitmapencoding(name, scale) ;
fprintf(bitfile, "%%EndDVIPSBitmapFont\n");
}