summaryrefslogtreecommitdiff
path: root/Build/source/texk/dvipsk/loadfont.c
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2010-03-28 18:10:43 +0000
committerKarl Berry <karl@freefriends.org>2010-03-28 18:10:43 +0000
commit549a764cf19a1f244d773ab70965eadeef67d5a8 (patch)
treec90c4d213a075a429e17379467eac19282617252 /Build/source/texk/dvipsk/loadfont.c
parent1cf5d119a011d9d22145848f7177f3124f7e776c (diff)
dynamically concatenate more error strings
git-svn-id: svn://tug.org/texlive/trunk@17591 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Build/source/texk/dvipsk/loadfont.c')
-rw-r--r--Build/source/texk/dvipsk/loadfont.c47
1 files changed, 24 insertions, 23 deletions
diff --git a/Build/source/texk/dvipsk/loadfont.c b/Build/source/texk/dvipsk/loadfont.c
index ebd3416378a..31e8e60a150 100644
--- a/Build/source/texk/dvipsk/loadfont.c
+++ b/Build/source/texk/dvipsk/loadfont.c
@@ -8,6 +8,7 @@
#endif
#ifdef KPATHSEA
#include <kpathsea/c-pathmx.h>
+#include <kpathsea/concatn.h>
#include <kpathsea/tex-glyph.h>
#include <kpathsea/tex-make.h>
#include <kpathsea/lib.h>
@@ -26,7 +27,7 @@
*/
#include "protos_add.h"
-char errbuf[512] ;
+char errbuf[1000];
int lastresortsizes[40] ;
/*
* Now we have some routines to get stuff from the PK file.
@@ -37,8 +38,8 @@ char name[MAXPATHLEN] ;
void
badpk(const char *s)
{
- (void)sprintf(errbuf,"! Bad PK file %s: %s",name,s) ;
- error(errbuf);
+ char *msg = concatn ("! Bad PK file ", name, ": ", s);
+ error(msg);
}
shalfword
@@ -133,21 +134,19 @@ pkopen(register fontdesctype *fd)
#ifdef KPATHSEA
char *this_name = concat (d, n);
- pkfile=pksearch(this_name, READBIN, fd->dpi, &name_ret, &dpi_ret);
+ pkfile = pksearch(this_name, READBIN, fd->dpi, &name_ret, &dpi_ret);
- if (!pkfile || !FILESTRCASEEQ (this_name, name_ret))
- {
- if (!pkfile)
- (void)sprintf(errbuf,
- "Font %s%s not found, characters will be left blank.",
- fd->area, n) ;
- else
- sprintf(errbuf, "Font %s%s not found, using %s instead.",
- fd->area, n, name_ret) ;
- dontmakefont = 1;
- error(errbuf) ;
- }
- else if (!kpse_bitmap_tolerance ((double) dpi_ret, (double) fd->dpi))
+ if (!pkfile || !FILESTRCASEEQ (this_name, name_ret)) {
+ char *msg = concatn ("Font ", fd->area, n, " not found; ");
+ /* wasting some memory */
+ if (!pkfile)
+ msg = concat (msg, "characters will be left blank.");
+ else
+ msg = concat3 (msg, "using ", name_ret);
+ dontmakefont = 1;
+ error (msg);
+
+ } else if (!kpse_bitmap_tolerance ((double) dpi_ret, (double) fd->dpi))
{
fd->loadeddpi = dpi_ret ;
fd->alreadyscaled = 0 ;
@@ -358,16 +357,18 @@ loadfont(register fontdesctype *curfnt)
for(i=pkbyte(); i>0; i--)
(void)pkbyte() ;
k = (integer)(alpha * (real)pkquad()) ;
- if (k > curfnt->designsize + fsizetol ||
- k < curfnt->designsize - fsizetol) {
- (void)sprintf(errbuf,"Design size mismatch in font %s", curfnt->name) ;
- error(errbuf) ;
+ if (k > curfnt->designsize + fsizetol
+ || k < curfnt->designsize - fsizetol) {
+ char *msg = concat ("Design size mismatch in font ", curfnt->name);
+ error (msg);
+ free (msg);
}
k = pkquad() ;
if (k && curfnt->checksum)
if (k!=curfnt->checksum) {
- (void)sprintf(errbuf,"Checksum mismatch in font %s", curfnt->name) ;
- error(errbuf) ;
+ char *msg = concat ("Checksum mismatch in font ", curfnt->name);
+ error (msg);
+ free (msg);
}
k = pkquad() ; /* assume that hppp is correct in the PK file */
k = pkquad() ; /* assume that vppp is correct in the PK file */