summaryrefslogtreecommitdiff
path: root/backend/dvi/mdvi-lib
diff options
context:
space:
mode:
Diffstat (limited to 'backend/dvi/mdvi-lib')
-rw-r--r--backend/dvi/mdvi-lib/afmparse.c494
-rw-r--r--backend/dvi/mdvi-lib/afmparse.h122
-rw-r--r--backend/dvi/mdvi-lib/bitmap.c126
-rw-r--r--backend/dvi/mdvi-lib/bitmap.h10
-rw-r--r--backend/dvi/mdvi-lib/color.c10
-rw-r--r--backend/dvi/mdvi-lib/color.h2
-rw-r--r--backend/dvi/mdvi-lib/common.c20
-rw-r--r--backend/dvi/mdvi-lib/dviread.c264
-rw-r--r--backend/dvi/mdvi-lib/files.c12
-rw-r--r--backend/dvi/mdvi-lib/font.c56
-rw-r--r--backend/dvi/mdvi-lib/fontmap.c140
-rw-r--r--backend/dvi/mdvi-lib/fontsrch.c22
-rw-r--r--backend/dvi/mdvi-lib/gf.c26
-rw-r--r--backend/dvi/mdvi-lib/hash.c30
-rw-r--r--backend/dvi/mdvi-lib/mdvi.h32
-rw-r--r--backend/dvi/mdvi-lib/pagesel.c64
-rw-r--r--backend/dvi/mdvi-lib/paper.c8
-rw-r--r--backend/dvi/mdvi-lib/pk.c52
-rw-r--r--backend/dvi/mdvi-lib/setup.c4
-rw-r--r--backend/dvi/mdvi-lib/sp-epsf.c34
-rw-r--r--backend/dvi/mdvi-lib/special.c30
-rw-r--r--backend/dvi/mdvi-lib/sysdeps.h4
-rw-r--r--backend/dvi/mdvi-lib/t1.c92
-rw-r--r--backend/dvi/mdvi-lib/tfm.c24
-rw-r--r--backend/dvi/mdvi-lib/tfmfile.c72
-rw-r--r--backend/dvi/mdvi-lib/tt.c66
-rw-r--r--backend/dvi/mdvi-lib/util.c52
-rw-r--r--backend/dvi/mdvi-lib/vf.c34
28 files changed, 951 insertions, 951 deletions
diff --git a/backend/dvi/mdvi-lib/afmparse.c b/backend/dvi/mdvi-lib/afmparse.c
index f90e5575..f8d840b7 100644
--- a/backend/dvi/mdvi-lib/afmparse.c
+++ b/backend/dvi/mdvi-lib/afmparse.c
@@ -2,25 +2,25 @@
* (C) 1988, 1989, 1990 by Adobe Systems Incorporated. All rights reserved.
*
* This file may be freely copied and redistributed as long as:
- * 1) This entire notice continues to be included in the file,
+ * 1) This entire notice continues to be included in the file,
* 2) If the file has been modified in any way, a notice of such
* modification is conspicuously indicated.
*
* PostScript, Display PostScript, and Adobe are registered trademarks of
* Adobe Systems Incorporated.
- *
+ *
* ************************************************************************
* THE INFORMATION BELOW IS FURNISHED AS IS, IS SUBJECT TO CHANGE WITHOUT
* NOTICE, AND SHOULD NOT BE CONSTRUED AS A COMMITMENT BY ADOBE SYSTEMS
- * INCORPORATED. ADOBE SYSTEMS INCORPORATED ASSUMES NO RESPONSIBILITY OR
- * LIABILITY FOR ANY ERRORS OR INACCURACIES, MAKES NO WARRANTY OF ANY
- * KIND (EXPRESS, IMPLIED OR STATUTORY) WITH RESPECT TO THIS INFORMATION,
- * AND EXPRESSLY DISCLAIMS ANY AND ALL WARRANTIES OF MERCHANTABILITY,
+ * INCORPORATED. ADOBE SYSTEMS INCORPORATED ASSUMES NO RESPONSIBILITY OR
+ * LIABILITY FOR ANY ERRORS OR INACCURACIES, MAKES NO WARRANTY OF ANY
+ * KIND (EXPRESS, IMPLIED OR STATUTORY) WITH RESPECT TO THIS INFORMATION,
+ * AND EXPRESSLY DISCLAIMS ANY AND ALL WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR PARTICULAR PURPOSES AND NONINFRINGEMENT OF THIRD PARTY RIGHTS.
* ************************************************************************
*/
-/*
+/*
* modified for MDVI:
* - some names changed to avoid conflicts with T1lib
* - changed to ANSI C prototypes, as used by MDVI
@@ -28,13 +28,13 @@
*/
/* parseAFM.c
- *
+ *
* This file is used in conjuction with the parseAFM.h header file.
* This file contains several procedures that are used to parse AFM
* files. It is intended to work with an application program that needs
* font metric information. The program can be used as is by making a
* procedure call to "parseFile" (passing in the expected parameters)
- * and having it fill in a data structure with the data from the
+ * and having it fill in a data structure with the data from the
* AFM file, or an application developer may wish to customize this
* code.
*
@@ -70,7 +70,7 @@
#include <math.h>
#include "afmparse.h"
#undef VERSION
-
+
#define lineterm EOL /* line terminating character */
#define normalEOF 1 /* return code from parsing routines used only */
/* in this module */
@@ -88,39 +88,39 @@
static char *ident = NULL; /* storage buffer for keywords */
-/* "shorts" for fast case statement
+/* "shorts" for fast case statement
* The values of each of these enumerated items correspond to an entry in the
- * table of strings defined below. Therefore, if you add a new string as
+ * table of strings defined below. Therefore, if you add a new string as
* new keyword into the keyStrings table, you must also add a corresponding
* parseKey AND it MUST be in the same position!
*
* IMPORTANT: since the sorting algorithm is a binary search, the strings of
- * keywords must be placed in lexicographical order, below. [Therefore, the
- * enumerated items are not necessarily in lexicographical order, depending
- * on the name chosen. BUT, they must be placed in the same position as the
- * corresponding key string.] The NOPE shall remain in the last position,
- * since it does not correspond to any key string, and it is used in the
+ * keywords must be placed in lexicographical order, below. [Therefore, the
+ * enumerated items are not necessarily in lexicographical order, depending
+ * on the name chosen. BUT, they must be placed in the same position as the
+ * corresponding key string.] The NOPE shall remain in the last position,
+ * since it does not correspond to any key string, and it is used in the
* "recognize" procedure to calculate how many possible keys there are.
*/
enum parseKey {
- ASCENDER, CHARBBOX, CODE, COMPCHAR, CAPHEIGHT, COMMENT,
- DESCENDER, ENCODINGSCHEME, ENDCHARMETRICS, ENDCOMPOSITES,
- ENDFONTMETRICS, ENDKERNDATA, ENDKERNPAIRS, ENDTRACKKERN,
- FAMILYNAME, FONTBBOX, FONTNAME, FULLNAME, ISFIXEDPITCH,
- ITALICANGLE, KERNPAIR, KERNPAIRXAMT, LIGATURE, CHARNAME,
- NOTICE, COMPCHARPIECE, STARTCHARMETRICS, STARTCOMPOSITES,
- STARTFONTMETRICS, STARTKERNDATA, STARTKERNPAIRS,
- STARTTRACKKERN, TRACKKERN, UNDERLINEPOSITION,
+ ASCENDER, CHARBBOX, CODE, COMPCHAR, CAPHEIGHT, COMMENT,
+ DESCENDER, ENCODINGSCHEME, ENDCHARMETRICS, ENDCOMPOSITES,
+ ENDFONTMETRICS, ENDKERNDATA, ENDKERNPAIRS, ENDTRACKKERN,
+ FAMILYNAME, FONTBBOX, FONTNAME, FULLNAME, ISFIXEDPITCH,
+ ITALICANGLE, KERNPAIR, KERNPAIRXAMT, LIGATURE, CHARNAME,
+ NOTICE, COMPCHARPIECE, STARTCHARMETRICS, STARTCOMPOSITES,
+ STARTFONTMETRICS, STARTKERNDATA, STARTKERNPAIRS,
+ STARTTRACKKERN, TRACKKERN, UNDERLINEPOSITION,
UNDERLINETHICKNESS, VERSION, XYWIDTH, XWIDTH, WEIGHT, XHEIGHT,
NOPE } ;
-/* keywords for the system:
+/* keywords for the system:
* This a table of all of the current strings that are vaild AFM keys.
* Each entry can be referenced by the appropriate parseKey value (an
- * enumerated data type defined above). If you add a new keyword here,
+ * enumerated data type defined above). If you add a new keyword here,
* a corresponding parseKey MUST be added to the enumerated data type
- * defined above, AND it MUST be added in the same position as the
+ * defined above, AND it MUST be added in the same position as the
* string is in this table.
*
* IMPORTANT: since the sorting algorithm is a binary search, the keywords
@@ -130,36 +130,36 @@ enum parseKey {
static char *keyStrings[] = {
"Ascender", "B", "C", "CC", "CapHeight", "Comment",
- "Descender", "EncodingScheme", "EndCharMetrics", "EndComposites",
- "EndFontMetrics", "EndKernData", "EndKernPairs", "EndTrackKern",
- "FamilyName", "FontBBox", "FontName", "FullName", "IsFixedPitch",
- "ItalicAngle", "KP", "KPX", "L", "N",
- "Notice", "PCC", "StartCharMetrics", "StartComposites",
- "StartFontMetrics", "StartKernData", "StartKernPairs",
- "StartTrackKern", "TrackKern", "UnderlinePosition",
+ "Descender", "EncodingScheme", "EndCharMetrics", "EndComposites",
+ "EndFontMetrics", "EndKernData", "EndKernPairs", "EndTrackKern",
+ "FamilyName", "FontBBox", "FontName", "FullName", "IsFixedPitch",
+ "ItalicAngle", "KP", "KPX", "L", "N",
+ "Notice", "PCC", "StartCharMetrics", "StartComposites",
+ "StartFontMetrics", "StartKernData", "StartKernPairs",
+ "StartTrackKern", "TrackKern", "UnderlinePosition",
"UnderlineThickness", "Version", "W", "WX", "Weight", "XHeight",
NULL };
-
-/*************************** PARSING ROUTINES **************/
-
+
+/*************************** PARSING ROUTINES **************/
+
/*************************** token *************************/
/* A "AFM File Conventions" tokenizer. That means that it will
* return the next token delimited by white space. See also
- * the `linetoken' routine, which does a similar thing but
+ * the `linetoken' routine, which does a similar thing but
* reads all tokens until the next end-of-line.
*/
-
+
static char *token(FILE *stream)
{
int ch, idx;
/* skip over white space */
- while ((ch = fgetc(stream)) == ' ' || ch == lineterm ||
+ while ((ch = fgetc(stream)) == ' ' || ch == lineterm ||
ch == ',' || ch == '\t' || ch == ';');
-
+
idx = 0;
- while (ch != EOF && ch != ' ' && ch != lineterm
+ while (ch != EOF && ch != ' ' && ch != lineterm
&& ch != '\t' && ch != ':' && ch != ';' && idx < (MAX_NAME - 1))
{
ident[idx++] = ch;
@@ -170,7 +170,7 @@ static char *token(FILE *stream)
if (idx >= 1 && ch != ':' ) ungetc(ch, stream);
if (idx < 1 ) ident[idx++] = ch; /* single-character token */
ident[idx] = 0;
-
+
return(ident); /* returns pointer to the token */
} /* token */
@@ -187,15 +187,15 @@ static char *linetoken(FILE *stream)
{
int ch, idx;
- while ((ch = fgetc(stream)) == ' ' || ch == '\t' );
-
+ while ((ch = fgetc(stream)) == ' ' || ch == '\t' );
+
idx = 0;
while (ch != EOF && ch != lineterm && idx < (MAX_NAME - 1))
{
ident[idx++] = ch;
ch = fgetc(stream);
} /* while */
-
+
ungetc(ch, stream);
ident[idx] = 0;
@@ -207,7 +207,7 @@ static char *linetoken(FILE *stream)
/*************************** recognize *************************/
/* This function tries to match a string to a known list of
- * valid AFM entries (check the keyStrings array above).
+ * valid AFM entries (check the keyStrings array above).
* "ident" contains everything from white space through the
* next space, tab, or ":" character.
*
@@ -231,7 +231,7 @@ static enum parseKey recognize(char *ident)
if (found) return (enum parseKey) midpoint;
else return NOPE;
-
+
} /* recognize */
@@ -240,32 +240,32 @@ static enum parseKey recognize(char *ident)
/* This function is called by "parseFile". It will parse the AFM File
* up to the "StartCharMetrics" keyword, which essentially marks the
* end of the Global Font Information and the beginning of the character
- * metrics information.
+ * metrics information.
*
* If the caller of "parseFile" specified that it wanted the Global
* Font Information (as defined by the "AFM File Specification"
- * document), then that information will be stored in the returned
+ * document), then that information will be stored in the returned
* data structure.
*
- * Any Global Font Information entries that are not found in a
+ * Any Global Font Information entries that are not found in a
* given file, will have the usual default initialization value
* for its type (i.e. entries of type int will be 0, etc).
*
- * This function returns an error code specifying whether there was
- * a premature EOF or a parsing error. This return value is used by
+ * This function returns an error code specifying whether there was
+ * a premature EOF or a parsing error. This return value is used by
* parseFile to determine if there is more file to parse.
*/
-
+
static BOOL parseGlobals(FILE *fp, GlobalFontInfo *gfi)
-{
+{
BOOL cont = TRUE, save = (gfi != NULL);
int error = ok;
register char *keyword;
-
+
while (cont)
{
keyword = token(fp);
-
+
if (keyword == NULL)
/* Have reached an early and unexpected EOF. */
/* Set flag and stop parsing */
@@ -273,15 +273,15 @@ static BOOL parseGlobals(FILE *fp, GlobalFontInfo *gfi)
error = earlyEOF;
break; /* get out of loop */
}
- if (!save)
+ if (!save)
/* get tokens until the end of the Global Font info section */
/* without saving any of the data */
- switch (recognize(keyword))
- {
+ switch (recognize(keyword))
+ {
case STARTCHARMETRICS:
cont = FALSE;
break;
- case ENDFONTMETRICS:
+ case ENDFONTMETRICS:
cont = FALSE;
error = normalEOF;
break;
@@ -308,20 +308,20 @@ static BOOL parseGlobals(FILE *fp, GlobalFontInfo *gfi)
break;
case ENCODINGSCHEME:
keyword = token(fp);
- gfi->encodingScheme = (char *)
+ gfi->encodingScheme = (char *)
malloc(strlen(keyword) + 1);
strcpy(gfi->encodingScheme, keyword);
- break;
+ break;
case FULLNAME:
keyword = linetoken(fp);
gfi->fullName = (char *) malloc(strlen(keyword) + 1);
strcpy(gfi->fullName, keyword);
- break;
- case FAMILYNAME:
+ break;
+ case FAMILYNAME:
keyword = linetoken(fp);
gfi->familyName = (char *) malloc(strlen(keyword) + 1);
strcpy(gfi->familyName, keyword);
- break;
+ break;
case WEIGHT:
keyword = token(fp);
gfi->weight = (char *) malloc(strlen(keyword) + 1);
@@ -336,13 +336,13 @@ static BOOL parseGlobals(FILE *fp, GlobalFontInfo *gfi)
keyword = token(fp);
if (MATCH(keyword, False))
gfi->isFixedPitch = 0;
- else
+ else
gfi->isFixedPitch = 1;
- break;
+ break;
case UNDERLINEPOSITION:
keyword = token(fp);
gfi->underlinePosition = atoi(keyword);
- break;
+ break;
case UNDERLINETHICKNESS:
keyword = token(fp);
gfi->underlineThickness = atoi(keyword);
@@ -351,12 +351,12 @@ static BOOL parseGlobals(FILE *fp, GlobalFontInfo *gfi)
keyword = token(fp);
gfi->version = (char *) malloc(strlen(keyword) + 1);
strcpy(gfi->version, keyword);
- break;
+ break;
case NOTICE:
keyword = linetoken(fp);
gfi->notice = (char *) malloc(strlen(keyword) + 1);
strcpy(gfi->notice, keyword);
- break;
+ break;
case FONTBBOX:
keyword = token(fp);
gfi->fontBBox.llx = atoi(keyword);
@@ -396,10 +396,10 @@ static BOOL parseGlobals(FILE *fp, GlobalFontInfo *gfi)
break;
} /* switch */
} /* while */
-
+
return(error);
-
-} /* parseGlobals */
+
+} /* parseGlobals */
@@ -409,26 +409,26 @@ static BOOL parseGlobals(FILE *fp, GlobalFontInfo *gfi)
/* Unmapped character codes are (at Adobe Systems) assigned the
* width of the space character (if one exists) else they get the
* value of 250 ems. This function initializes all entries in the
- * char widths array to have this value. Then any mapped character
- * codes will be replaced with the width of the appropriate character
+ * char widths array to have this value. Then any mapped character
+ * codes will be replaced with the width of the appropriate character
* when parsing the character metric section.
-
+
* This function parses the Character Metrics Section looking
* for a space character (by comparing character names). If found,
* the width of the space character will be used to initialize the
- * values in the array of character widths.
+ * values in the array of character widths.
*
* Before returning, the position of the read/write pointer of the
* file is reset to be where it was upon entering this function.
*/
-
+
static int initializeArray(FILE *fp, int *cwi)
-{
+{
BOOL cont = TRUE, found = FALSE;
long opos = ftell(fp);
int code = 0, width = 0, i = 0, error = 0;
register char *keyword;
-
+
while (cont)
{
keyword = token(fp);
@@ -448,67 +448,67 @@ static int initializeArray(FILE *fp, int *cwi)
case XWIDTH:
width = atoi(token(fp));
break;
- case CHARNAME:
+ case CHARNAME:
keyword = token(fp);
if (MATCH(keyword, Space))
- {
+ {
cont = FALSE;
found = TRUE;
- }
- break;
+ }
+ break;
case ENDCHARMETRICS:
cont = FALSE;
- break;
+ break;
case ENDFONTMETRICS:
cont = FALSE;
error = normalEOF;
break;
case NOPE:
- default:
+ default:
error = parseError;
break;
} /* switch */
} /* while */
-
+
if (!found)
width = 250;
-
+
for (i = 0; i < 256; ++i)
cwi[i] = width;
-
+
fseek(fp, opos, 0);
-
+
return(error);
-
-} /* initializeArray */
+
+} /* initializeArray */
#endif /* unused */
/************************* parseCharWidths **************************/
/* This function is called by "parseFile". It will parse the AFM File
- * up to the "EndCharMetrics" keyword. It will save the character
+ * up to the "EndCharMetrics" keyword. It will save the character
* width info (as opposed to all of the character metric information)
* if requested by the caller of parseFile. Otherwise, it will just
* parse through the section without saving any information.
*
- * If data is to be saved, parseCharWidths is passed in a pointer
+ * If data is to be saved, parseCharWidths is passed in a pointer
* to an array of widths that has already been initialized by the
* standard value for unmapped character codes. This function parses
* the Character Metrics section only storing the width information
* for the encoded characters into the array using the character code
* as the index into that array.
*
- * This function returns an error code specifying whether there was
- * a premature EOF or a parsing error. This return value is used by
+ * This function returns an error code specifying whether there was
+ * a premature EOF or a parsing error. This return value is used by
* parseFile to determine if there is more file to parse.
*/
-
+
static int parseCharWidths(FILE *fp, int *cwi)
-{
+{
BOOL cont = TRUE, save = (cwi != NULL);
int pos = 0, error = ok;
register char *keyword;
-
+
while (cont)
{
keyword = token(fp);
@@ -519,19 +519,19 @@ static int parseCharWidths(FILE *fp, int *cwi)
error = earlyEOF;
break; /* get out of loop */
}
- if (!save)
+ if (!save)
/* get tokens until the end of the Char Metrics section without */
/* saving any of the data*/
- switch (recognize(keyword))
- {
+ switch (recognize(keyword))
+ {
case ENDCHARMETRICS:
cont = FALSE;
- break;
+ break;
case ENDFONTMETRICS:
cont = FALSE;
error = normalEOF;
break;
- default:
+ default:
break;
} /* switch */
else
@@ -558,15 +558,15 @@ static int parseCharWidths(FILE *fp, int *cwi)
break;
case ENDCHARMETRICS:
cont = FALSE;
- break;
+ break;
case ENDFONTMETRICS:
cont = FALSE;
error = normalEOF;
break;
case CHARNAME: /* eat values (so doesn't cause parseError) */
- keyword = token(fp);
+ keyword = token(fp);
break;
- case CHARBBOX:
+ case CHARBBOX:
keyword = token(fp); keyword = token(fp);
keyword = token(fp); keyword = token(fp);
break;
@@ -574,15 +574,15 @@ static int parseCharWidths(FILE *fp, int *cwi)
keyword = token(fp); keyword = token(fp);
break;
case NOPE:
- default:
+ default:
error = parseError;
break;
} /* switch */
} /* while */
-
+
return(error);
-
-} /* parseCharWidths */
+
+} /* parseCharWidths */
/************************* parseCharMetrics ************************/
@@ -594,21 +594,21 @@ static int parseCharWidths(FILE *fp, int *cwi)
* parseCharMetrics is passed in a pointer to an array of records
* to hold information on a per character basis. This function
* parses the Character Metrics section storing all character
- * metric information for the ALL characters (mapped and unmapped)
+ * metric information for the ALL characters (mapped and unmapped)
* into the array.
*
- * This function returns an error code specifying whether there was
- * a premature EOF or a parsing error. This return value is used by
+ * This function returns an error code specifying whether there was
+ * a premature EOF or a parsing error. This return value is used by
* parseFile to determine if there is more file to parse.
*/
-
+
static int parseCharMetrics(FILE *fp, FontInfo *fi)
-{
+{
BOOL cont = TRUE, firstTime = TRUE;
int error = ok, count = 0;
register CharMetricInfo *temp = fi->cmi;
register char *keyword;
-
+
while (cont)
{
keyword = token(fp);
@@ -621,10 +621,10 @@ static int parseCharMetrics(FILE *fp, FontInfo *fi)
{
case COMMENT:
keyword = linetoken(fp);
- break;
+ break;
case CODE:
if (count < fi->numOfChars)
- {
+ {
if (firstTime) firstTime = FALSE;
else temp++;
temp->code = atoi(token(fp));
@@ -639,16 +639,16 @@ static int parseCharMetrics(FILE *fp, FontInfo *fi)
case XYWIDTH:
temp->wx = atoi(token(fp));
temp->wy = atoi(token(fp));
- break;
- case XWIDTH:
+ break;
+ case XWIDTH:
temp->wx = atoi(token(fp));
break;
- case CHARNAME:
+ case CHARNAME:
keyword = token(fp);
temp->name = (char *) malloc(strlen(keyword) + 1);
strcpy(temp->name, keyword);
- break;
- case CHARBBOX:
+ break;
+ case CHARBBOX:
temp->charBBox.llx = atoi(token(fp));
temp->charBBox.lly = atoi(token(fp));
temp->charBBox.urx = atoi(token(fp));
@@ -657,14 +657,14 @@ static int parseCharMetrics(FILE *fp, FontInfo *fi)
case LIGATURE: {
Ligature **tail = &(temp->ligs);
Ligature *node = *tail;
-
+
if (*tail != NULL)
{
while (node->next != NULL)
node = node->next;
- tail = &(node->next);
+ tail = &(node->next);
}
-
+
*tail = (Ligature *) calloc(1, sizeof(Ligature));
keyword = token(fp);
(*tail)->succ = (char *) malloc(strlen(keyword) + 1);
@@ -675,52 +675,52 @@ static int parseCharMetrics(FILE *fp, FontInfo *fi)
break; }
case ENDCHARMETRICS:
cont = FALSE;;
- break;
- case ENDFONTMETRICS:
+ break;
+ case ENDFONTMETRICS:
cont = FALSE;
error = normalEOF;
- break;
+ break;
case NOPE:
default:
- error = parseError;
- break;
+ error = parseError;
+ break;
} /* switch */
} /* while */
-
+
if ((error == ok) && (count != fi->numOfChars))
error = parseError;
-
+
return(error);
-
-} /* parseCharMetrics */
+
+} /* parseCharMetrics */
/************************* parseTrackKernData ***********************/
-/* This function is called by "parseFile". It will parse the AFM File
+/* This function is called by "parseFile". It will parse the AFM File
* up to the "EndTrackKern" or "EndKernData" keywords. It will save the
* track kerning data if requested by the caller of parseFile.
*
* parseTrackKernData is passed in a pointer to the FontInfo record.
- * If data is to be saved, the FontInfo record will already contain
+ * If data is to be saved, the FontInfo record will already contain
* a valid pointer to storage for the track kerning data.
*
- * This function returns an error code specifying whether there was
- * a premature EOF or a parsing error. This return value is used by
+ * This function returns an error code specifying whether there was
+ * a premature EOF or a parsing error. This return value is used by
* parseFile to determine if there is more file to parse.
*/
-
+
static int parseTrackKernData(FILE *fp, FontInfo *fi)
-{
+{
BOOL cont = TRUE, save = (fi->tkd != NULL);
int pos = 0, error = ok, tcount = 0;
register char *keyword;
-
+
while (cont)
{
keyword = token(fp);
-
+
if (keyword == NULL)
{
error = earlyEOF;
@@ -789,40 +789,40 @@ static int parseTrackKernData(FILE *fp, FontInfo *fi)
break;
} /* switch */
} /* while */
-
+
if (error == ok && tcount != fi->numOfTracks)
error = parseError;
-
+
return(error);
-
-} /* parseTrackKernData */
+
+} /* parseTrackKernData */
/************************* parsePairKernData ************************/
-/* This function is called by "parseFile". It will parse the AFM File
+/* This function is called by "parseFile". It will parse the AFM File
* up to the "EndKernPairs" or "EndKernData" keywords. It will save
* the pair kerning data if requested by the caller of parseFile.
*
* parsePairKernData is passed in a pointer to the FontInfo record.
- * If data is to be saved, the FontInfo record will already contain
+ * If data is to be saved, the FontInfo record will already contain
* a valid pointer to storage for the pair kerning data.
*
- * This function returns an error code specifying whether there was
- * a premature EOF or a parsing error. This return value is used by
+ * This function returns an error code specifying whether there was
+ * a premature EOF or a parsing error. This return value is used by
* parseFile to determine if there is more file to parse.
*/
-
+
static int parsePairKernData(FILE *fp, FontInfo *fi)
-{
+{
BOOL cont = TRUE, save = (fi->pkd != NULL);
int pos = 0, error = ok, pcount = 0;
register char *keyword;
-
+
while (cont)
{
keyword = token(fp);
-
+
if (keyword == NULL)
{
error = earlyEOF;
@@ -856,11 +856,11 @@ static int parsePairKernData(FILE *fp, FontInfo *fi)
if (pcount < fi->numOfPairs)
{
keyword = token(fp);
- fi->pkd[pos].name1 = (char *)
+ fi->pkd[pos].name1 = (char *)
malloc(strlen(keyword) + 1);
strcpy(fi->pkd[pos].name1, keyword);
keyword = token(fp);
- fi->pkd[pos].name2 = (char *)
+ fi->pkd[pos].name2 = (char *)
malloc(strlen(keyword) + 1);
strcpy(fi->pkd[pos].name2, keyword);
keyword = token(fp);
@@ -879,11 +879,11 @@ static int parsePairKernData(FILE *fp, FontInfo *fi)
if (pcount < fi->numOfPairs)
{
keyword = token(fp);
- fi->pkd[pos].name1 = (char *)
+ fi->pkd[pos].name1 = (char *)
malloc(strlen(keyword) + 1);
strcpy(fi->pkd[pos].name1, keyword);
keyword = token(fp);
- fi->pkd[pos].name2 = (char *)
+ fi->pkd[pos].name2 = (char *)
malloc(strlen(keyword) + 1);
strcpy(fi->pkd[pos].name2, keyword);
keyword = token(fp);
@@ -910,39 +910,39 @@ static int parsePairKernData(FILE *fp, FontInfo *fi)
break;
} /* switch */
} /* while */
-
+
if (error == ok && pcount != fi->numOfPairs)
error = parseError;
-
+
return(error);
-
-} /* parsePairKernData */
+
+} /* parsePairKernData */
/************************* parseCompCharData **************************/
-/* This function is called by "parseFile". It will parse the AFM File
- * up to the "EndComposites" keyword. It will save the composite
+/* This function is called by "parseFile". It will parse the AFM File
+ * up to the "EndComposites" keyword. It will save the composite
* character data if requested by the caller of parseFile.
*
- * parseCompCharData is passed in a pointer to the FontInfo record, and
+ * parseCompCharData is passed in a pointer to the FontInfo record, and
* a boolean representing if the data should be saved.
*
* This function will create the appropriate amount of storage for
* the composite character data and store a pointer to the storage
* in the FontInfo record.
*
- * This function returns an error code specifying whether there was
- * a premature EOF or a parsing error. This return value is used by
+ * This function returns an error code specifying whether there was
+ * a premature EOF or a parsing error. This return value is used by
* parseFile to determine if there is more file to parse.
*/
-
+
static int parseCompCharData(FILE *fp, FontInfo *fi)
-{
+{
BOOL cont = TRUE, firstTime = TRUE, save = (fi->ccd != NULL);
int pos = 0, j = 0, error = ok, ccount = 0, pcount = 0;
register char *keyword;
-
+
while (cont)
{
keyword = token(fp);
@@ -990,7 +990,7 @@ static int parseCompCharData(FILE *fp, FontInfo *fi)
pcount = 0;
if (firstTime) firstTime = FALSE;
else pos++;
- fi->ccd[pos].ccName = (char *)
+ fi->ccd[pos].ccName = (char *)
malloc(strlen(keyword) + 1);
strcpy(fi->ccd[pos].ccName, keyword);
keyword = token(fp);
@@ -1010,7 +1010,7 @@ static int parseCompCharData(FILE *fp, FontInfo *fi)
if (pcount < fi->ccd[pos].numOfPieces)
{
keyword = token(fp);
- fi->ccd[pos].pieces[j].pccName = (char *)
+ fi->ccd[pos].pieces[j].pccName = (char *)
malloc(strlen(keyword) + 1);
strcpy(fi->ccd[pos].pieces[j].pccName, keyword);
keyword = token(fp);
@@ -1035,23 +1035,23 @@ static int parseCompCharData(FILE *fp, FontInfo *fi)
break;
} /* switch */
} /* while */
-
+
if (error == ok && ccount != fi->numOfComps)
error = parseError;
-
+
return(error);
-
-} /* parseCompCharData */
+
+} /* parseCompCharData */
-/*************************** 'PUBLIC' FUNCTION ********************/
+/*************************** 'PUBLIC' FUNCTION ********************/
/*************************** parseFile *****************************/
-/* parseFile is the only 'public' procedure available. It is called
+/* parseFile is the only 'public' procedure available. It is called
* from an application wishing to get information from an AFM file.
* The caller of this function is responsible for locating and opening
* an AFM file and handling all errors associated with that task.
@@ -1061,43 +1061,43 @@ static int parseCompCharData(FILE *fp, FontInfo *fi)
* the data requested filled in), and a mask specifying which
* data from the AFM File should be saved in the FontInfo structure.
*
- * The file will be parsed and the requested data will be stored in
+ * The file will be parsed and the requested data will be stored in
* a record of type FontInfo (refer to ParseAFM.h).
*
- * parseFile returns an error code as defined in parseAFM.h.
+ * parseFile returns an error code as defined in parseAFM.h.
*
- * The position of the read/write pointer associated with the file
+ * The position of the read/write pointer associated with the file
* pointer upon return of this function is undefined.
*/
extern int afm_parse_file(FILE *fp, FontInfo **fi, FLAGS flags)
{
-
+
int code = ok; /* return code from each of the parsing routines */
int error = ok; /* used as the return code from this function */
-
- register char *keyword; /* used to store a token */
-
-
- /* storage data for the global variable ident */
- ident = (char *) calloc(MAX_NAME, sizeof(char));
- if (ident == NULL) {error = storageProblem; return(error);}
-
+
+ register char *keyword; /* used to store a token */
+
+
+ /* storage data for the global variable ident */
+ ident = (char *) calloc(MAX_NAME, sizeof(char));
+ if (ident == NULL) {error = storageProblem; return(error);}
+
(*fi) = (FontInfo *) calloc(1, sizeof(FontInfo));
- if ((*fi) == NULL) {error = storageProblem; return(error);}
-
- if (flags & P_G)
+ if ((*fi) == NULL) {error = storageProblem; return(error);}
+
+ if (flags & P_G)
{
(*fi)->gfi = (GlobalFontInfo *) calloc(1, sizeof(GlobalFontInfo));
- if ((*fi)->gfi == NULL) {error = storageProblem; return(error);}
+ if ((*fi)->gfi == NULL) {error = storageProblem; return(error);}
}
-
+
/* The AFM File begins with Global Font Information. This section */
- /* will be parsed whether or not information should be saved. */
- code = parseGlobals(fp, (*fi)->gfi);
-
+ /* will be parsed whether or not information should be saved. */
+ code = parseGlobals(fp, (*fi)->gfi);
+
if (code < 0) error = code;
-
+
/* The Global Font Information is followed by the Character Metrics */
/* section. Which procedure is used to parse this section depends on */
/* how much information should be saved. If all of the metrics info */
@@ -1105,25 +1105,25 @@ extern int afm_parse_file(FILE *fp, FontInfo **fi, FLAGS flags)
/* is wanted, parseCharWidths is called. parseCharWidths will also */
/* be called in the case that no character data is to be saved, just */
/* to parse through the section. */
-
+
if ((code != normalEOF) && (code != earlyEOF))
{
(*fi)->numOfChars = atoi(token(fp));
if (flags & (P_M ^ P_W))
{
- (*fi)->cmi = (CharMetricInfo *)
+ (*fi)->cmi = (CharMetricInfo *)
calloc((*fi)->numOfChars, sizeof(CharMetricInfo));
if ((*fi)->cmi == NULL) {error = storageProblem; return(error);}
- code = parseCharMetrics(fp, *fi);
+ code = parseCharMetrics(fp, *fi);
}
else
{
if (flags & P_W)
- {
- (*fi)->cwi = (int *) calloc(256, sizeof(int));
- if ((*fi)->cwi == NULL)
+ {
+ (*fi)->cwi = (int *) calloc(256, sizeof(int));
+ if ((*fi)->cwi == NULL)
{
- error = storageProblem;
+ error = storageProblem;
return(error);
}
}
@@ -1131,15 +1131,15 @@ extern int afm_parse_file(FILE *fp, FontInfo **fi, FLAGS flags)
code = parseCharWidths(fp, (*fi)->cwi);
} /* else */
} /* if */
-
+
if ((error != earlyEOF) && (code < 0)) error = code;
-
+
/* The remaining sections of the AFM are optional. This code will */
/* look at the next keyword in the file to determine what section */
/* is next, and then allocate the appropriate amount of storage */
/* for the data (if the data is to be saved) and call the */
/* appropriate parsing routine to parse the section. */
-
+
while ((code != normalEOF) && (code != earlyEOF))
{
keyword = token(fp);
@@ -1161,11 +1161,11 @@ extern int afm_parse_file(FILE *fp, FontInfo **fi, FLAGS flags)
if (flags & P_T)
{
(*fi)->numOfTracks = atoi(keyword);
- (*fi)->tkd = (TrackKernData *)
+ (*fi)->tkd = (TrackKernData *)
calloc((*fi)->numOfTracks, sizeof(TrackKernData));
- if ((*fi)->tkd == NULL)
+ if ((*fi)->tkd == NULL)
{
- error = storageProblem;
+ error = storageProblem;
return(error);
}
} /* if */
@@ -1176,11 +1176,11 @@ extern int afm_parse_file(FILE *fp, FontInfo **fi, FLAGS flags)
if (flags & P_P)
{
(*fi)->numOfPairs = atoi(keyword);
- (*fi)->pkd = (PairKernData *)
+ (*fi)->pkd = (PairKernData *)
calloc((*fi)->numOfPairs, sizeof(PairKernData));
- if ((*fi)->pkd == NULL)
+ if ((*fi)->pkd == NULL)
{
- error = storageProblem;
+ error = storageProblem;
return(error);
}
} /* if */
@@ -1189,18 +1189,18 @@ extern int afm_parse_file(FILE *fp, FontInfo **fi, FLAGS flags)
case STARTCOMPOSITES:
keyword = token(fp);
if (flags & P_C)
- {
+ {
(*fi)->numOfComps = atoi(keyword);
- (*fi)->ccd = (CompCharData *)
+ (*fi)->ccd = (CompCharData *)
calloc((*fi)->numOfComps, sizeof(CompCharData));
- if ((*fi)->ccd == NULL)
+ if ((*fi)->ccd == NULL)
{
- error = storageProblem;
+ error = storageProblem;
return(error);
}
} /* if */
- code = parseCompCharData(fp, *fi);
- break;
+ code = parseCompCharData(fp, *fi);
+ break;
case ENDFONTMETRICS:
code = normalEOF;
break;
@@ -1209,17 +1209,17 @@ extern int afm_parse_file(FILE *fp, FontInfo **fi, FLAGS flags)
code = parseError;
break;
} /* switch */
-
+
if ((error != earlyEOF) && (code < 0)) error = code;
-
+
} /* while */
-
+
if ((error != earlyEOF) && (code < 0)) error = code;
-
+
if (ident != NULL) { free(ident); ident = NULL; }
-
+
return(error);
-
+
} /* parseFile */
/* added for MDVI: this function was copied from `parseAFMclient.c' */
@@ -1229,7 +1229,7 @@ void afm_free_fontinfo(FontInfo *fi)
if (fi != NULL)
{
if (fi->gfi != NULL)
- {
+ {
free(fi->gfi->afmVersion); fi->gfi->afmVersion = NULL;
free(fi->gfi->fontName); fi->gfi->fontName = NULL;
free(fi->gfi->fullName); fi->gfi->fullName = NULL;
@@ -1240,16 +1240,16 @@ void afm_free_fontinfo(FontInfo *fi)
free(fi->gfi->encodingScheme); fi->gfi->encodingScheme = NULL;
free(fi->gfi); fi->gfi = NULL;
}
-
+
if (fi->cwi != NULL)
{ free(fi->cwi); fi->cwi = NULL; }
if (fi->cmi != NULL)
- {
+ {
int i = 0;
CharMetricInfo *temp = fi->cmi;
Ligature *node = temp->ligs;
-
+
for (i = 0; i < fi->numOfChars; ++i)
{
for (node = temp->ligs; node != NULL; node = node->next)
@@ -1257,47 +1257,47 @@ void afm_free_fontinfo(FontInfo *fi)
free(node->succ); node->succ = NULL;
free(node->lig); node->lig = NULL;
}
-
+
free(temp->name); temp->name = NULL;
temp++;
}
-
+
free(fi->cmi); fi->cmi = NULL;
}
if (fi->tkd != NULL)
{ free(fi->tkd); fi->tkd = NULL; }
-
+
if (fi->pkd != NULL)
- {
+ {
free(fi->pkd->name1); fi->pkd->name1 = NULL;
free(fi->pkd->name2); fi->pkd->name2 = NULL;
free(fi->pkd); fi->pkd = NULL;
}
if (fi->ccd != NULL)
- {
+ {
int i = 0, j = 0;
CompCharData *ccd = fi->ccd;
-
+
for (i = 0; i < fi->numOfComps; ++i)
{
for (j = 0; j < ccd[i].numOfPieces; ++j)
{
- free(ccd[i].pieces[j].pccName);
+ free(ccd[i].pieces[j].pccName);
ccd[i].pieces[j].pccName = NULL;
}
-
+
free(ccd[i].ccName); ccd[i].ccName = NULL;
}
-
+
free(fi->ccd); fi->ccd = NULL;
}
-
+
free(fi);
- } /* if */
-
+ } /* if */
+
} /* afm_free_fontinfo */
#endif /* WITH_AFM_FILES */
diff --git a/backend/dvi/mdvi-lib/afmparse.h b/backend/dvi/mdvi-lib/afmparse.h
index 6cce780c..164c3567 100644
--- a/backend/dvi/mdvi-lib/afmparse.h
+++ b/backend/dvi/mdvi-lib/afmparse.h
@@ -3,20 +3,20 @@
* (C) 1988, 1989 by Adobe Systems Incorporated. All rights reserved.
*
* This file may be freely copied and redistributed as long as:
- * 1) This entire notice continues to be included in the file,
+ * 1) This entire notice continues to be included in the file,
* 2) If the file has been modified in any way, a notice of such
* modification is conspicuously indicated.
*
* PostScript, Display PostScript, and Adobe are registered trademarks of
* Adobe Systems Incorporated.
- *
+ *
* ************************************************************************
* THE INFORMATION BELOW IS FURNISHED AS IS, IS SUBJECT TO CHANGE WITHOUT
* NOTICE, AND SHOULD NOT BE CONSTRUED AS A COMMITMENT BY ADOBE SYSTEMS
- * INCORPORATED. ADOBE SYSTEMS INCORPORATED ASSUMES NO RESPONSIBILITY OR
- * LIABILITY FOR ANY ERRORS OR INACCURACIES, MAKES NO WARRANTY OF ANY
- * KIND (EXPRESS, IMPLIED OR STATUTORY) WITH RESPECT TO THIS INFORMATION,
- * AND EXPRESSLY DISCLAIMS ANY AND ALL WARRANTIES OF MERCHANTABILITY,
+ * INCORPORATED. ADOBE SYSTEMS INCORPORATED ASSUMES NO RESPONSIBILITY OR
+ * LIABILITY FOR ANY ERRORS OR INACCURACIES, MAKES NO WARRANTY OF ANY
+ * KIND (EXPRESS, IMPLIED OR STATUTORY) WITH RESPECT TO THIS INFORMATION,
+ * AND EXPRESSLY DISCLAIMS ANY AND ALL WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR PARTICULAR PURPOSES AND NONINFRINGEMENT OF THIRD PARTY RIGHTS.
* ************************************************************************
*/
@@ -27,23 +27,23 @@
* Together these files provide the functionality to parse Adobe Font
* Metrics files and store the information in predefined data structures.
* It is intended to work with an application program that needs font metric
- * information. The program can be used as is by making a procedure call to
+ * information. The program can be used as is by making a procedure call to
* parse an AFM file and have the data stored, or an application developer
- * may wish to customize the code.
+ * may wish to customize the code.
*
- * This header file defines the data structures used as well as the key
+ * This header file defines the data structures used as well as the key
* strings that are currently recognized by this version of the AFM parser.
- * This program is based on the document "Adobe Font Metrics Files,
+ * This program is based on the document "Adobe Font Metrics Files,
* Specification Version 2.0".
*
* AFM files are separated into distinct sections of different data. Because
* of this, the parseAFM program can parse a specified file to only save
- * certain sections of information based on the application's needs. A record
+ * certain sections of information based on the application's needs. A record
* containing the requested information will be returned to the application.
- *
+ *
* AFM files are divided into five sections of data:
* 1) The Global Font Information
- * 2) The Character Metrics Information
+ * 2) The Character Metrics Information
* 3) The Track Kerning Data
* 4) The Pair-Wise Kerning Data
* 5) The Composite Character Data
@@ -52,22 +52,22 @@
* of what other sections are requested. In addition, in recognizing that
* many applications will want ONLY the x-width of characters and not all
* of the other character metrics information, there is a way to receive
- * only the width information so as not to pay the storage cost for the
- * unwanted data. An application should never request both the
- * "quick and dirty" char metrics (widths only) and the Character Metrics
- * Information since the Character Metrics Information will contain all
+ * only the width information so as not to pay the storage cost for the
+ * unwanted data. An application should never request both the
+ * "quick and dirty" char metrics (widths only) and the Character Metrics
+ * Information since the Character Metrics Information will contain all
* of the character widths as well.
- *
- * There is a procedure in parseAFM.c, called parseFile, that can be
+ *
+ * There is a procedure in parseAFM.c, called parseFile, that can be
* called from any application wishing to get information from the AFM File.
* This procedure expects 3 parameters: a vaild file descriptor, a pointer
- * to a (FontInfo *) variable (for which space will be allocated and then
+ * to a (FontInfo *) variable (for which space will be allocated and then
* will be filled in with the data requested), and a mask specifying
* which data from the AFM File should be saved in the FontInfo structure.
- *
+ *
* The flags that can be used to set the appropriate mask are defined below.
- * In addition, several commonly used masks have already been defined.
- *
+ * In addition, several commonly used masks have already been defined.
+ *
* History:
* original: DSM Thu Oct 20 17:39:59 PDT 1988
* modified: DSM Mon Jul 3 14:17:50 PDT 1989
@@ -99,25 +99,25 @@
#define P_C 0x20 /* 0010 0000 */ /* Composite Char Info */
/* Commonly used flags */
-#define P_GW (P_G | P_W)
+#define P_GW (P_G | P_W)
#define P_GM (P_G | P_M)
#define P_GMP (P_G | P_M | P_P)
-#define P_GMK (P_G | P_M | P_P | P_T)
+#define P_GMK (P_G | P_M | P_P | P_T)
#define P_ALL (P_G | P_M | P_P | P_T | P_C)
/* Possible return codes from the parseFile procedure.
- *
+ *
* ok means there were no problems parsing the file.
*
* parseError means that there was some kind of parsing error, but the
* parser went on. This could include problems like the count for any given
* section does not add up to how many entries there actually were, or
* there was a key that was not recognized. The return record may contain
- * vaild data or it may not.
+ * vaild data or it may not.
*
* earlyEOF means that an End of File was encountered before expected. This
* may mean that the AFM file had been truncated, or improperly formed.
- *
+ *
* storageProblem means that there were problems allocating storage for
* the data structures that would have contained the AFM data.
*/
@@ -128,15 +128,15 @@
/************************* TYPES *********************************/
/* Below are all of the data structure definitions. These structures
- * try to map as closely as possible to grouping and naming of data
+ * try to map as closely as possible to grouping and naming of data
* in the AFM Files.
*/
-/* Bounding box definition. Used for the Font BBox as well as the
+/* Bounding box definition. Used for the Font BBox as well as the
* Character BBox.
*/
typedef struct
-{
+{
int llx; /* lower left x-position */
int lly; /* lower left y-position */
int urx; /* upper right x-position */
@@ -144,12 +144,12 @@ typedef struct
} BBox;
/* Global Font information.
- * The key that each field is associated with is in comments. For an
+ * The key that each field is associated with is in comments. For an
* explanation about each key and its value please refer to the AFM
- * documentation (full title & version given above).
+ * documentation (full title & version given above).
*/
typedef struct
-{
+{
char *afmVersion; /* key: StartFontMetrics */
char *fontName; /* key: FontName */
char *fullName; /* key: FullName */
@@ -178,15 +178,15 @@ typedef struct _t_ligature
struct _t_ligature *next;
} Ligature;
-/* Character Metric Information. This structure is used only if ALL
+/* Character Metric Information. This structure is used only if ALL
* character metric information is requested. If only the character
* widths is requested, then only an array of the character x-widths
* is returned.
*
- * The key that each field is associated with is in comments. For an
- * explanation about each key and its value please refer to the
+ * The key that each field is associated with is in comments. For an
+ * explanation about each key and its value please refer to the
* Character Metrics section of the AFM documentation (full title
- * & version given above).
+ * & version given above).
*/
typedef struct
{
@@ -199,19 +199,19 @@ typedef struct
} CharMetricInfo;
/* Track kerning data structure.
- * The fields of this record are the five values associated with every
+ * The fields of this record are the five values associated with every
* TrackKern entry.
- *
- * For an explanation about each value please refer to the
+ *
+ * For an explanation about each value please refer to the
* Track Kerning section of the AFM documentation (full title
- * & version given above).
+ * & version given above).
*/
-typedef struct
+typedef struct
{
- int degree;
- float minPtSize,
- minKernAmt,
- maxPtSize,
+ int degree;
+ float minPtSize,
+ minKernAmt,
+ maxPtSize,
maxKernAmt;
} TrackKernData;
@@ -219,11 +219,11 @@ typedef struct
* The fields of this record are the four values associated with every
* KP entry. For KPX entries, the yamt will be zero.
*
- * For an explanation about each value please refer to the
+ * For an explanation about each value please refer to the
* Pair Kerning section of the AFM documentation (full title
- * & version given above).
+ * & version given above).
*/
-typedef struct
+typedef struct
{
char *name1;
char *name2;
@@ -234,10 +234,10 @@ typedef struct
/* PCC is a piece of a composite character. This is a sub structure of a
* compCharData described below.
* These fields will be filled in with the values from the key PCC.
- *
- * For an explanation about each key and its value please refer to the
+ *
+ * For an explanation about each key and its value please refer to the
* Composite Character section of the AFM documentation (full title
- * & version given above).
+ * & version given above).
*/
typedef struct
{
@@ -246,15 +246,15 @@ typedef struct
deltay;
} Pcc;
-/* Composite Character Information data structure.
+/* Composite Character Information data structure.
* The fields ccName and numOfPieces are filled with the values associated
* with the key CC. The field pieces points to an array (size = numOfPieces)
* of information about each of the parts of the composite character. That
* array is filled in with the values from the key PCC.
- *
- * For an explanation about each key and its value please refer to the
+ *
+ * For an explanation about each key and its value please refer to the
* Composite Character section of the AFM documentation (full title
- * & version given above).
+ * & version given above).
*/
typedef struct
{
@@ -270,9 +270,9 @@ typedef struct
* parseFile function.
*/
typedef struct
-{
+{
GlobalFontInfo *gfi; /* ptr to a GlobalFontInfo record */
- int *cwi; /* ptr to 256 element array of just char widths */
+ int *cwi; /* ptr to 256 element array of just char widths */
int numOfChars; /* number of entries in char metrics array */
CharMetricInfo *cmi; /* ptr to char metrics array */
int numOfTracks; /* number to entries in track kerning array */
@@ -289,7 +289,7 @@ typedef struct
*
* "fp" should be a valid file pointer to an AFM file.
*
- * "fi" is a pointer to a pointer to a FontInfo record sturcture
+ * "fi" is a pointer to a pointer to a FontInfo record sturcture
* (defined above). Storage for the FontInfo structure will be
* allocated in parseFile and the structure will be filled in
* with the requested data from the AFM File.
@@ -301,7 +301,7 @@ typedef struct
* The possible return codes from parseFile are defined above.
*/
-extern int afm_parse_file __PROTO((FILE *, FontInfo **, FLAGS));
+extern int afm_parse_file __PROTO((FILE *, FontInfo **, FLAGS));
extern void afm_free_fontinfo __PROTO((FontInfo *));
#endif /* _MDVI_PARSEAFM_H */
diff --git a/backend/dvi/mdvi-lib/bitmap.c b/backend/dvi/mdvi-lib/bitmap.c
index 4417a75b..de1de6a7 100644
--- a/backend/dvi/mdvi-lib/bitmap.c
+++ b/backend/dvi/mdvi-lib/bitmap.c
@@ -48,7 +48,7 @@ static BmUnit bit_masks[] = {
#define SHOW_OP_DATA (DEBUGGING(BITMAP_OPS) && DEBUGGING(BITMAP_DATA))
#endif
-/*
+/*
* Some useful macros to manipulate bitmap data
* SEGMENT(m,n) = bit mask for a segment of `m' contiguous bits
* starting at column `n'. These macros assume that
@@ -118,7 +118,7 @@ static Uchar bit_swap[] = {
};
-/*
+/*
* next we have three bitmap functions to convert bitmaps in LSB bit order
* with 8, 16 and 32 bits per unit, to our internal format. The differences
* are minimal, but writing a generic function to handle all unit sizes is
@@ -132,8 +132,8 @@ BITMAP *bitmap_convert_lsb8(Uchar *bits, int w, int h, int stride)
Uchar *unit;
register Uchar *curr;
int bytes;
-
- DEBUG((DBG_BITMAP_OPS, "convert LSB %dx%d@8 -> bitmap\n", w, h));
+
+ DEBUG((DBG_BITMAP_OPS, "convert LSB %dx%d@8 -> bitmap\n", w, h));
bm = bitmap_alloc_raw(w, h);
@@ -141,14 +141,14 @@ BITMAP *bitmap_convert_lsb8(Uchar *bits, int w, int h, int stride)
bytes = ROUND(w, 8);
unit = (Uchar *)bm->data;
curr = bits;
- /* we try to do this as fast as we can */
+ /* we try to do this as fast as we can */
for(i = 0; i < h; i++) {
#ifdef WORD_LITTLE_ENDIAN
memcpy(unit, curr, bytes);
curr += stride;
#else
int j;
-
+
for(j = 0; j < bytes; curr++, j++)
unit[j] = bit_swap[*curr];
cur += stride - bytes;
@@ -168,7 +168,7 @@ BITMAP *bitmap_convert_msb8(Uchar *data, int w, int h, int stride)
Uchar *curr;
int i;
int bytes;
-
+
bm = bitmap_alloc(w, h);
bytes = ROUND(w, 8);
unit = (Uchar *)bm->data;
@@ -176,7 +176,7 @@ BITMAP *bitmap_convert_msb8(Uchar *data, int w, int h, int stride)
for(i = 0; i < h; i++) {
#ifdef WORD_LITTLE_ENDIAN
int j;
-
+
for(j = 0; j < bytes; curr++, j++)
unit[j] = bit_swap[*curr];
curr += stride - bytes;
@@ -197,7 +197,7 @@ BITMAP *bitmap_copy(BITMAP *bm)
{
BITMAP *nb = bitmap_alloc(bm->width, bm->height);
- DEBUG((DBG_BITMAP_OPS, "copy %dx%d\n", bm->width, bm->height));
+ DEBUG((DBG_BITMAP_OPS, "copy %dx%d\n", bm->width, bm->height));
memcpy(nb->data, bm->data, bm->height * bm->stride);
return nb;
}
@@ -205,7 +205,7 @@ BITMAP *bitmap_copy(BITMAP *bm)
BITMAP *bitmap_alloc(int w, int h)
{
BITMAP *bm;
-
+
bm = xalloc(BITMAP);
bm->width = w;
bm->height = h;
@@ -214,14 +214,14 @@ BITMAP *bitmap_alloc(int w, int h)
bm->data = (BmUnit *)mdvi_calloc(h, bm->stride);
else
bm->data = NULL;
-
+
return bm;
}
BITMAP *bitmap_alloc_raw(int w, int h)
{
BITMAP *bm;
-
+
bm = xalloc(BITMAP);
bm->width = w;
bm->height = h;
@@ -230,7 +230,7 @@ BITMAP *bitmap_alloc_raw(int w, int h)
bm->data = (BmUnit *)mdvi_malloc(h * bm->stride);
else
bm->data = NULL;
-
+
return bm;
}
@@ -250,7 +250,7 @@ void bitmap_print(FILE *out, BITMAP *bm)
};
int sub;
- a = bm->data;
+ a = bm->data;
fprintf(out, " ");
if(bm->width > 10) {
putchar('0');
@@ -292,10 +292,10 @@ void bitmap_set_col(BITMAP *bm, int row, int col, int count, int state)
{
BmUnit *ptr;
BmUnit mask;
-
+
ptr = __bm_unit_ptr(bm, col, row);
mask = FIRSTMASKAT(col);
-
+
while(count-- > 0) {
if(state)
*ptr |= mask;
@@ -306,7 +306,7 @@ void bitmap_set_col(BITMAP *bm, int row, int col, int count, int state)
}
}
-/*
+/*
* to use this function you should first make sure that
* there is room for `count' bits in the scanline
*
@@ -333,11 +333,11 @@ void bitmap_paint_bits(BmUnit *ptr, int n, int count)
*ptr++ = bit_masks[BITMAP_BITS];
/* paint the tail */
- if(count > 0)
+ if(count > 0)
*ptr |= SEGMENT(count, 0);
}
-/*
+/*
* same as paint_bits but clears pixels instead of painting them. Written
* as a separate function for efficiency reasons.
*/
@@ -365,7 +365,7 @@ void bitmap_clear_bits(BmUnit *ptr, int n, int count)
void bitmap_set_row(BITMAP *bm, int row, int col, int count, int state)
{
BmUnit *ptr;
-
+
ptr = __bm_unit_ptr(bm, col, row);
if(state)
bitmap_paint_bits(ptr, col & (BITMAP_BITS-1), count);
@@ -388,13 +388,13 @@ void bitmap_flip_horizontally(BITMAP *bm)
nb.height = bm->height;
nb.stride = bm->stride;
nb.data = mdvi_calloc(bm->height, bm->stride);
-
+
fptr = bm->data;
tptr = __bm_unit_ptr(&nb, nb.width-1, 0);
for(h = 0; h < bm->height; h++) {
BmUnit *fline, *tline;
-
- fline = fptr;
+
+ fline = fptr;
tline = tptr;
fmask = FIRSTMASK;
tmask = FIRSTMASKAT(nb.width-1);
@@ -434,13 +434,13 @@ void bitmap_flip_vertically(BITMAP *bm)
nb.height = bm->height;
nb.stride = bm->stride;
nb.data = mdvi_calloc(bm->height, bm->stride);
-
+
fptr = bm->data;
tptr = __bm_unit_ptr(&nb, 0, nb.height-1);
for(h = 0; h < bm->height; h++) {
BmUnit *fline, *tline;
-
- fline = fptr;
+
+ fline = fptr;
tline = tptr;
fmask = FIRSTMASK;
for(w = 0; w < bm->width; w++) {
@@ -470,18 +470,18 @@ void bitmap_flip_diagonally(BITMAP *bm)
BmUnit *fptr, *tptr;
BmUnit fmask, tmask;
int w, h;
-
+
nb.width = bm->width;
nb.height = bm->height;
nb.stride = bm->stride;
nb.data = mdvi_calloc(bm->height, bm->stride);
-
+
fptr = bm->data;
tptr = __bm_unit_ptr(&nb, nb.width-1, nb.height-1);
for(h = 0; h < bm->height; h++) {
BmUnit *fline, *tline;
-
- fline = fptr;
+
+ fline = fptr;
tline = tptr;
fmask = FIRSTMASK;
tmask = FIRSTMASKAT(nb.width-1);
@@ -516,19 +516,19 @@ void bitmap_rotate_clockwise(BITMAP *bm)
BmUnit *fptr, *tptr;
BmUnit fmask, tmask;
int w, h;
-
+
nb.width = bm->height;
nb.height = bm->width;
nb.stride = BM_BYTES_PER_LINE(&nb);
nb.data = mdvi_calloc(nb.height, nb.stride);
-
+
fptr = bm->data;
tptr = __bm_unit_ptr(&nb, nb.width - 1, 0);
-
+
tmask = FIRSTMASKAT(nb.width-1);
for(h = 0; h < bm->height; h++) {
BmUnit *fline, *tline;
-
+
fmask = FIRSTMASK;
fline = fptr;
tline = tptr;
@@ -556,7 +556,7 @@ void bitmap_rotate_clockwise(BITMAP *bm)
mdvi_free(bm->data);
bm->data = nb.data;
bm->width = nb.width;
- bm->height = nb.height;
+ bm->height = nb.height;
bm->stride = nb.stride;
if(SHOW_OP_DATA)
bitmap_print(stderr, bm);
@@ -568,19 +568,19 @@ void bitmap_rotate_counter_clockwise(BITMAP *bm)
BmUnit *fptr, *tptr;
BmUnit fmask, tmask;
int w, h;
-
+
nb.width = bm->height;
nb.height = bm->width;
nb.stride = BM_BYTES_PER_LINE(&nb);
nb.data = mdvi_calloc(nb.height, nb.stride);
-
+
fptr = bm->data;
tptr = __bm_unit_ptr(&nb, 0, nb.height - 1);
tmask = FIRSTMASK;
for(h = 0; h < bm->height; h++) {
BmUnit *fline, *tline;
-
+
fmask = FIRSTMASK;
fline = fptr;
tline = tptr;
@@ -608,7 +608,7 @@ void bitmap_rotate_counter_clockwise(BITMAP *bm)
mdvi_free(bm->data);
bm->data = nb.data;
bm->width = nb.width;
- bm->height = nb.height;
+ bm->height = nb.height;
bm->stride = nb.stride;
if(SHOW_OP_DATA)
bitmap_print(stderr, bm);
@@ -620,16 +620,16 @@ void bitmap_flip_rotate_clockwise(BITMAP *bm)
BmUnit *fptr, *tptr;
BmUnit fmask, tmask;
int w, h;
-
+
nb.width = bm->height;
nb.height = bm->width;
nb.stride = BM_BYTES_PER_LINE(&nb);
nb.data = mdvi_calloc(nb.height, nb.stride);
-
+
fptr = bm->data;
tptr = __bm_unit_ptr(&nb, nb.width-1, nb.height-1);
- tmask = FIRSTMASKAT(nb.width-1);
+ tmask = FIRSTMASKAT(nb.width-1);
for(h = 0; h < bm->height; h++) {
BmUnit *fline, *tline;
@@ -659,7 +659,7 @@ void bitmap_flip_rotate_clockwise(BITMAP *bm)
mdvi_free(bm->data);
bm->data = nb.data;
bm->width = nb.width;
- bm->height = nb.height;
+ bm->height = nb.height;
bm->stride = nb.stride;
if(SHOW_OP_DATA)
bitmap_print(stderr, bm);
@@ -671,16 +671,16 @@ void bitmap_flip_rotate_counter_clockwise(BITMAP *bm)
BmUnit *fptr, *tptr;
BmUnit fmask, tmask;
int w, h;
-
+
nb.width = bm->height;
nb.height = bm->width;
nb.stride = BM_BYTES_PER_LINE(&nb);
nb.data = mdvi_calloc(nb.height, nb.stride);
-
+
fptr = bm->data;
tptr = nb.data;
tmask = FIRSTMASK;
-
+
for(h = 0; h < bm->height; h++) {
BmUnit *fline, *tline;
@@ -711,7 +711,7 @@ void bitmap_flip_rotate_counter_clockwise(BITMAP *bm)
mdvi_free(bm->data);
bm->data = nb.data;
bm->width = nb.width;
- bm->height = nb.height;
+ bm->height = nb.height;
bm->stride = nb.stride;
if(SHOW_OP_DATA)
bitmap_print(stderr, bm);
@@ -751,7 +751,7 @@ void bitmap_transform(BITMAP *map, DviOrientation orient)
/*
* Count the number of non-zero bits in a box of dimensions w x h, starting
* at column `step' in row `data'.
- *
+ *
* Shamelessly stolen from xdvi.
*/
static int do_sample(BmUnit *data, int stride, int step, int w, int h)
@@ -760,7 +760,7 @@ static int do_sample(BmUnit *data, int stride, int step, int w, int h)
int shift, n;
int bits_left;
int wid;
-
+
ptr = data + step / BITMAP_BITS;
end = bm_offset(data, h * stride);
shift = FIRSTSHIFTAT(step);
@@ -800,17 +800,17 @@ static int do_sample(BmUnit *data, int stride, int step, int w, int h)
return n;
}
-void mdvi_shrink_box(DviContext *dvi, DviFont *font,
+void mdvi_shrink_box(DviContext *dvi, DviFont *font,
DviFontChar *pk, DviGlyph *dest)
{
int x, y, z;
DviGlyph *glyph;
int hs, vs;
-
+
hs = dvi->params.hshrink;
vs = dvi->params.vshrink;
glyph = &pk->glyph;
-
+
x = (int)glyph->x / hs;
if((int)glyph->x - x * hs > 0)
x++;
@@ -844,15 +844,15 @@ void mdvi_shrink_glyph(DviContext *dvi, DviFont *font,
int x, y;
int w, h;
int hs, vs;
-
+
hs = dvi->params.hshrink;
vs = dvi->params.vshrink;
-
+
min_sample = vs * hs * dvi->params.density / 100;
glyph = &pk->glyph;
oldmap = (BITMAP *)glyph->data;
-
+
x = (int)glyph->x / hs;
init_cols = (int)glyph->x - x * hs;
if(init_cols <= 0)
@@ -910,7 +910,7 @@ void mdvi_shrink_glyph(DviContext *dvi, DviFont *font,
old_ptr = bm_offset(old_ptr, rows * old_stride);
rows_left -= rows;
rows = vs;
- }
+ }
DEBUG((DBG_BITMAPS, "shrink_glyph: (%dw,%dh,%dx,%dy) -> (%dw,%dh,%dx,%dy)\n",
glyph->w, glyph->h, glyph->x, glyph->y,
dest->w, dest->h, dest->x, dest->y));
@@ -939,10 +939,10 @@ void mdvi_shrink_glyph_grey(DviContext *dvi, DviFont *font,
hs = dvi->params.hshrink;
vs = dvi->params.vshrink;
dev = &dvi->device;
-
+
glyph = &pk->glyph;
map = (BITMAP *)glyph->data;
-
+
x = (int)glyph->x / hs;
init_cols = (int)glyph->x - x * hs;
if(init_cols <= 0)
@@ -960,18 +960,18 @@ void mdvi_shrink_glyph_grey(DviContext *dvi, DviFont *font,
}
h = y + ROUND((int)glyph->h - cols, vs) + 1;
ASSERT(w && h);
-
+
/* before touching anything, do this */
image = dev->create_image(dev->device_data, w, h, BITMAP_BITS);
if(image == NULL) {
mdvi_shrink_glyph(dvi, font, pk, dest);
return;
}
-
+
/* save these colors */
pk->fg = MDVI_CURRFG(dvi);
pk->bg = MDVI_CURRBG(dvi);
-
+
samplemax = vs * hs;
npixels = samplemax + 1;
pixels = get_color_table(&dvi->device, npixels, pk->fg, pk->bg,
@@ -982,7 +982,7 @@ void mdvi_shrink_glyph_grey(DviContext *dvi, DviFont *font,
colortab[1] = pk->bg;
pixels = &colortab[0];
}
-
+
/* setup the new glyph */
dest->data = image;
dest->x = x;
@@ -1021,7 +1021,7 @@ void mdvi_shrink_glyph_grey(DviContext *dvi, DviFont *font,
rows = vs;
y++;
}
-
+
for(; y < h; y++) {
for(x = 0; x < w; x++)
dev->put_pixel(image, x, y, pixels[0]);
diff --git a/backend/dvi/mdvi-lib/bitmap.h b/backend/dvi/mdvi-lib/bitmap.h
index 4d98fecd..7b722bb4 100644
--- a/backend/dvi/mdvi-lib/bitmap.h
+++ b/backend/dvi/mdvi-lib/bitmap.h
@@ -54,7 +54,7 @@ typedef struct {
#define __bm_unit_ptr(b,x,y) \
bm_offset((b)->data, (y) * (b)->stride + \
((x) / BITMAP_BITS) * BITMAP_BYTES)
-
+
#define __bm_unit(b,x,y) __bm_unit_ptr((b), (x), (y))[0]
#define BM_GETPIXEL(b,x,y) __bm_unit((b), (x), (y))
@@ -91,7 +91,7 @@ typedef struct {
}
}
/* end of sample code */
-#endif
+#endif
/* bitmaps are stored in native byte order */
#ifdef WORD_BIG_ENDIAN
@@ -116,9 +116,9 @@ extern BITMAP *bitmap_alloc __PROTO((int, int));
extern BITMAP *bitmap_alloc_raw __PROTO((int, int));
extern void bitmap_destroy __PROTO((BITMAP *));
-/*
- * set_row(bm, row, col, count, state):
- * sets `count' pixels to state `onoff', starting from pixel
+/*
+ * set_row(bm, row, col, count, state):
+ * sets `count' pixels to state `onoff', starting from pixel
* at position (col, row). All pixels must lie in the same
* row.
*/
diff --git a/backend/dvi/mdvi-lib/color.c b/backend/dvi/mdvi-lib/color.c
index c28107fd..ef6036a9 100644
--- a/backend/dvi/mdvi-lib/color.c
+++ b/backend/dvi/mdvi-lib/color.c
@@ -47,7 +47,7 @@ void mdvi_push_color(DviContext *dvi, Ulong fg, Ulong bg)
void mdvi_pop_color(DviContext *dvi)
{
Ulong fg, bg;
-
+
if(dvi->color_top == 0)
return;
dvi->color_top--;
@@ -81,7 +81,7 @@ static int cc_entries;
/* create a color table */
-Ulong *get_color_table(DviDevice *dev,
+Ulong *get_color_table(DviDevice *dev,
int nlevels, Ulong fg, Ulong bg, double gamma, int density)
{
ColorCache *cc, *tofree;
@@ -109,7 +109,7 @@ Ulong *get_color_table(DviDevice *dev,
DEBUG((DBG_DEVICE, "Adding color table to cache (fg=%lu, bg=%lu, n=%d)\n",
fg, bg, nlevels));
-
+
/* no entry was found in the cache, create a new one */
if(cc_entries < CCSIZE) {
cc = &color_cache[cc_entries++];
@@ -119,7 +119,7 @@ Ulong *get_color_table(DviDevice *dev,
mdvi_free(cc->pixels);
}
pixels = xnalloc(Ulong, nlevels);
- status = dev->alloc_colors(dev->device_data,
+ status = dev->alloc_colors(dev->device_data,
pixels, nlevels, fg, bg, gamma, density);
if(status < 0) {
mdvi_free(pixels);
@@ -132,5 +132,5 @@ Ulong *get_color_table(DviDevice *dev,
cc->nlevels = nlevels;
cc->pixels = pixels;
cc->hits = 1;
- return pixels;
+ return pixels;
}
diff --git a/backend/dvi/mdvi-lib/color.h b/backend/dvi/mdvi-lib/color.h
index 35b2f923..cbc3c0ef 100644
--- a/backend/dvi/mdvi-lib/color.h
+++ b/backend/dvi/mdvi-lib/color.h
@@ -22,7 +22,7 @@
#include "common.h"
-extern Ulong *get_color_table(DviDevice *dev,
+extern Ulong *get_color_table(DviDevice *dev,
int nlevels, Ulong fg, Ulong bg, double gamma, int density);
extern void mdvi_set_color __PROTO((DviContext *, Ulong, Ulong));
diff --git a/backend/dvi/mdvi-lib/common.c b/backend/dvi/mdvi-lib/common.c
index 97b34b56..847a307d 100644
--- a/backend/dvi/mdvi-lib/common.c
+++ b/backend/dvi/mdvi-lib/common.c
@@ -25,8 +25,8 @@
long fsgetn(FILE *p, size_t n)
{
long v;
-
- v = fgetbyte(p);
+
+ v = fgetbyte(p);
if(v & 0x80)
v -= 0x100;
while(--n > 0)
@@ -37,7 +37,7 @@ long fsgetn(FILE *p, size_t n)
Ulong fugetn(FILE *p, size_t n)
{
Ulong v;
-
+
v = fgetbyte(p);
while(--n > 0)
v = (v << 8) | fgetbyte(p);
@@ -47,7 +47,7 @@ Ulong fugetn(FILE *p, size_t n)
long msgetn(const Uchar *p, size_t n)
{
long v = (long)*p++;
-
+
if(v & 0x80)
v -= 0x100;
while(--n > 0)
@@ -68,7 +68,7 @@ char *read_string(FILE *in, int s, char *buffer, size_t len)
{
int n;
char *str;
-
+
n = fugetn(in, s ? s : 1);
if((str = buffer) == NULL || n + 1 > len)
str = mdvi_malloc(n + 1);
@@ -83,7 +83,7 @@ char *read_string(FILE *in, int s, char *buffer, size_t len)
size_t read_bcpl(FILE *in, char *buffer, size_t maxlen, size_t wanted)
{
size_t i;
-
+
i = (int)fuget1(in);
if(maxlen && i > maxlen)
i = maxlen;
@@ -99,7 +99,7 @@ char *read_alloc_bcpl(FILE *in, size_t maxlen, size_t *size)
{
size_t i;
char *buffer;
-
+
i = (size_t)fuget1(in);
if(maxlen && i > maxlen)
i = maxlen;
@@ -121,7 +121,7 @@ void buff_free(Buffer *buf)
{
if(buf->data)
mdvi_free(buf->data);
- buff_init(buf);
+ buff_init(buf);
}
void buff_init(Buffer *buf)
@@ -149,7 +149,7 @@ char *buff_gets(Buffer *buf, size_t *length)
char *ptr;
char *ret;
size_t len;
-
+
ptr = strchr(buf->data, '\n');
if(ptr == NULL)
return NULL;
@@ -163,6 +163,6 @@ char *buff_gets(Buffer *buf, size_t *length)
}
ret[len] = 0;
if(length) *length = len;
- return ret;
+ return ret;
}
diff --git a/backend/dvi/mdvi-lib/dviread.c b/backend/dvi/mdvi-lib/dviread.c
index d0143205..c1cb21f6 100644
--- a/backend/dvi/mdvi-lib/dviread.c
+++ b/backend/dvi/mdvi-lib/dviread.c
@@ -53,37 +53,37 @@ DVICMDDEF(undefined);
DVICMDDEF(unexpected);
static const DviCommand dvi_commands[] = {
- set_char, set_char, set_char, set_char,
- set_char, set_char, set_char, set_char,
- set_char, set_char, set_char, set_char,
- set_char, set_char, set_char, set_char,
- set_char, set_char, set_char, set_char,
- set_char, set_char, set_char, set_char,
- set_char, set_char, set_char, set_char,
- set_char, set_char, set_char, set_char,
- set_char, set_char, set_char, set_char,
- set_char, set_char, set_char, set_char,
- set_char, set_char, set_char, set_char,
- set_char, set_char, set_char, set_char,
- set_char, set_char, set_char, set_char,
- set_char, set_char, set_char, set_char,
- set_char, set_char, set_char, set_char,
- set_char, set_char, set_char, set_char,
- set_char, set_char, set_char, set_char,
- set_char, set_char, set_char, set_char,
- set_char, set_char, set_char, set_char,
- set_char, set_char, set_char, set_char,
- set_char, set_char, set_char, set_char,
- set_char, set_char, set_char, set_char,
- set_char, set_char, set_char, set_char,
- set_char, set_char, set_char, set_char,
- set_char, set_char, set_char, set_char,
- set_char, set_char, set_char, set_char,
- set_char, set_char, set_char, set_char,
- set_char, set_char, set_char, set_char,
- set_char, set_char, set_char, set_char,
- set_char, set_char, set_char, set_char,
- set_char, set_char, set_char, set_char,
+ set_char, set_char, set_char, set_char,
+ set_char, set_char, set_char, set_char,
+ set_char, set_char, set_char, set_char,
+ set_char, set_char, set_char, set_char,
+ set_char, set_char, set_char, set_char,
+ set_char, set_char, set_char, set_char,
+ set_char, set_char, set_char, set_char,
+ set_char, set_char, set_char, set_char,
+ set_char, set_char, set_char, set_char,
+ set_char, set_char, set_char, set_char,
+ set_char, set_char, set_char, set_char,
+ set_char, set_char, set_char, set_char,
+ set_char, set_char, set_char, set_char,
+ set_char, set_char, set_char, set_char,
+ set_char, set_char, set_char, set_char,
+ set_char, set_char, set_char, set_char,
+ set_char, set_char, set_char, set_char,
+ set_char, set_char, set_char, set_char,
+ set_char, set_char, set_char, set_char,
+ set_char, set_char, set_char, set_char,
+ set_char, set_char, set_char, set_char,
+ set_char, set_char, set_char, set_char,
+ set_char, set_char, set_char, set_char,
+ set_char, set_char, set_char, set_char,
+ set_char, set_char, set_char, set_char,
+ set_char, set_char, set_char, set_char,
+ set_char, set_char, set_char, set_char,
+ set_char, set_char, set_char, set_char,
+ set_char, set_char, set_char, set_char,
+ set_char, set_char, set_char, set_char,
+ set_char, set_char, set_char, set_char,
set_char, set_char, set_char, set_char, /* 0 - 127 */
set_char, set_char, set_char, set_char, /* 128 - 131 */
set_rule, /* 132 */
@@ -122,7 +122,7 @@ static const DviCommand dvi_commands[] = {
unexpected, /* 247 (PRE) */
unexpected, /* 248 (POST) */
unexpected, /* 249 (POST_POST) */
- undefined, undefined, undefined,
+ undefined, undefined, undefined,
undefined, undefined, undefined /* 250 - 255 */
};
@@ -172,7 +172,7 @@ static void dummy_dev_set_color(void *a, Ulong b, Ulong c)
static void dvierr(DviContext *dvi, const char *format, ...)
{
va_list ap;
-
+
va_start(ap, format);
fprintf(stderr, "%s[%d]: Error: ",
dvi->filename, dvi->currpage);
@@ -183,7 +183,7 @@ static void dvierr(DviContext *dvi, const char *format, ...)
static void dviwarn(DviContext *dvi, const char *format, ...)
{
va_list ap;
-
+
fprintf(stderr, "%s[%d]: Warning: ",
dvi->filename, dvi->currpage);
va_start(ap, format);
@@ -195,15 +195,15 @@ static void dviwarn(DviContext *dvi, const char *format, ...)
((d)->buffer.pos + (n) > (d)->buffer.length)
static int get_bytes(DviContext *dvi, size_t n)
-{
- /*
+{
+ /*
* caller wants to read `n' bytes from dvi->buffer + dvi->pos.
- * Make sure there is enough data to satisfy the request
+ * Make sure there is enough data to satisfy the request
*/
if(NEEDBYTES(dvi, n)) {
size_t required;
int newlen;
-
+
if(dvi->buffer.frozen || dvi->in == NULL || feof(dvi->in)) {
/* this is EOF */
dviwarn(dvi, _("unexpected EOF\n"));
@@ -251,7 +251,7 @@ static int get_bytes(DviContext *dvi, size_t n)
static int dskip(DviContext *dvi, long offset)
{
ASSERT(offset > 0);
-
+
if(NEEDBYTES(dvi, offset) && get_bytes(dvi, offset) == -1)
return -1;
dvi->buffer.pos += offset;
@@ -283,8 +283,8 @@ static long dugetn(DviContext *dvi, size_t n)
{
long val;
- if(NEEDBYTES(dvi, n) && get_bytes(dvi, n) == -1)
- return -1;
+ if(NEEDBYTES(dvi, n) && get_bytes(dvi, n) == -1)
+ return -1;
val = mugetn(dvi->buffer.data + dvi->buffer.pos, n);
dvi->buffer.pos += n;
return val;
@@ -292,8 +292,8 @@ static long dugetn(DviContext *dvi, size_t n)
static long dtell(DviContext *dvi)
{
- return dvi->depth ?
- dvi->buffer.pos :
+ return dvi->depth ?
+ dvi->buffer.pos :
ftell(dvi->in) - dvi->buffer.length + dvi->buffer.pos;
}
@@ -321,7 +321,7 @@ static void dviprint(DviContext *dvi, const char *command, int sub, const char *
{
int i;
va_list ap;
-
+
printf("%s: ", dvi->filename);
for(i = 0; i < dvi->depth; i++)
printf(" ");
@@ -341,7 +341,7 @@ static void dviprint(DviContext *dvi, const char *command, int sub, const char *
int mdvi_find_tex_page(DviContext *dvi, int tex_page)
{
int i;
-
+
for(i = 0; i < dvi->npages; i++)
if(dvi->pagemap[i][1] == tex_page)
return i;
@@ -373,7 +373,7 @@ static int sort_dvi_down(const void *p1, const void *p2)
void mdvi_sort_pages(DviContext *dvi, DviPageSort type)
{
int (*sortfunc) __PROTO((const void *, const void *));
-
+
switch(type) {
case MDVI_PAGE_SORT_UP:
sortfunc = sort_up;
@@ -395,7 +395,7 @@ void mdvi_sort_pages(DviContext *dvi, DviPageSort type)
sortfunc = NULL;
break;
}
-
+
if(sortfunc)
qsort(dvi->pagemap, dvi->npages, sizeof(PageNum), sortfunc);
}
@@ -411,7 +411,7 @@ static DviFontRef *define_font(DviContext *dvi, int op)
int n;
char *name;
DviFontRef *ref;
-
+
arg = dugetn(dvi, op - DVI_FNT_DEF1 + 1);
checksum = duget4(dvi);
scale = duget4(dvi);
@@ -439,7 +439,7 @@ static char *opendvi(const char *name)
{
int len;
char *file;
-
+
len = strlen(name);
/* if file ends with .dvi and it exists, that's it */
if(len >= 4 && STREQ(name+len-4, ".dvi")) {
@@ -447,7 +447,7 @@ static char *opendvi(const char *name)
if(access(name, R_OK) == 0)
return mdvi_strdup(name);
}
-
+
/* try appending .dvi */
file = mdvi_malloc(len + 5);
strcpy(file, name);
@@ -468,7 +468,7 @@ int mdvi_reload(DviContext *dvi, DviParams *np)
{
DviContext *newdvi;
DviParams *pars;
-
+
/* close our file */
if(dvi->in) {
fclose(dvi->in);
@@ -476,8 +476,8 @@ int mdvi_reload(DviContext *dvi, DviParams *np)
}
pars = np ? np : &dvi->params;
- DEBUG((DBG_DVI, "%s: reloading\n", dvi->filename));
-
+ DEBUG((DBG_DVI, "%s: reloading\n", dvi->filename));
+
/* load it again */
newdvi = mdvi_init_context(pars, dvi->pagesel, dvi->filename);
if(newdvi == NULL) {
@@ -508,7 +508,7 @@ int mdvi_reload(DviContext *dvi, DviParams *np)
if(dvi->fileid) mdvi_free(dvi->fileid);
dvi->fileid = newdvi->fileid;
-
+
dvi->dvi_page_w = newdvi->dvi_page_w;
dvi->dvi_page_h = newdvi->dvi_page_h;
@@ -517,25 +517,25 @@ int mdvi_reload(DviContext *dvi, DviParams *np)
dvi->npages = newdvi->npages;
if(dvi->currpage > dvi->npages-1)
dvi->currpage = 0;
-
+
mdvi_free(dvi->stack);
dvi->stack = newdvi->stack;
dvi->stacksize = newdvi->stacksize;
/* remove fonts that are not being used anymore */
font_free_unused(&dvi->device);
-
- mdvi_free(newdvi->filename);
+
+ mdvi_free(newdvi->filename);
mdvi_free(newdvi);
DEBUG((DBG_DVI, "%s: reload successful\n", dvi->filename));
if(dvi->device.refresh)
dvi->device.refresh(dvi, dvi->device.device_data);
-
+
return 0;
}
-/* function to change parameters ia DVI context
+/* function to change parameters ia DVI context
* The DVI context is modified ONLY if this function is successful */
int mdvi_configure(DviContext *dvi, DviParamCode option, ...)
{
@@ -543,12 +543,12 @@ int mdvi_configure(DviContext *dvi, DviParamCode option, ...)
int reset_all;
int reset_font;
DviParams np;
-
+
va_start(ap, option);
reset_font = 0;
reset_all = 0;
- np = dvi->params; /* structure copy */
+ np = dvi->params; /* structure copy */
while(option != MDVI_PARAM_LAST) {
switch(option) {
case MDVI_SET_DPI:
@@ -613,7 +613,7 @@ int mdvi_configure(DviContext *dvi, DviParamCode option, ...)
option = va_arg(ap, DviParamCode);
}
va_end(ap);
-
+
/* check that all values make sense */
if(np.dpi <= 0 || np.vdpi <= 0)
return -1;
@@ -624,11 +624,11 @@ int mdvi_configure(DviContext *dvi, DviParamCode option, ...)
if(np.hshrink < 1 || np.vshrink < 1)
return -1;
if(np.hdrift < 0 || np.vdrift < 0)
- return -1;
+ return -1;
if(np.fg == np.bg)
return -1;
- /*
+ /*
* If the dpi or the magnification change, we basically have to reload
* the DVI file again from scratch.
*/
@@ -650,7 +650,7 @@ int mdvi_configure(DviContext *dvi, DviParamCode option, ...)
if(reset_font) {
font_reset_chain_glyphs(&dvi->device, dvi->fonts, reset_font);
}
- dvi->params = np;
+ dvi->params = np;
if((reset_font & MDVI_FONTSEL_GLYPH) && dvi->device.refresh) {
dvi->device.refresh(dvi, dvi->device.device_data);
return 0;
@@ -659,8 +659,8 @@ int mdvi_configure(DviContext *dvi, DviParamCode option, ...)
return 1;
}
/*
- * Read the initial data from the DVI file. If something is wrong with the
- * file, we just spit out an error message and refuse to load the file,
+ * Read the initial data from the DVI file. If something is wrong with the
+ * file, we just spit out an error message and refuse to load the file,
* without giving any details. This makes sense because DVI files are ok
* 99.99% of the time, and dvitype(1) can be used to check the other 0.01%.
*/
@@ -677,7 +677,7 @@ DviContext *mdvi_init_context(DviParams *par, DviPageSpec *spec, const char *fil
/*
* 1. Open the file and initialize the DVI context
- */
+ */
filename = opendvi(file);
if(filename == NULL) {
@@ -695,13 +695,13 @@ DviContext *mdvi_init_context(DviParams *par, DviPageSpec *spec, const char *fil
dvi->pagemap = NULL;
dvi->filename = filename;
dvi->stack = NULL;
- dvi->modtime = get_mtime(fileno(p));
+ dvi->modtime = get_mtime(fileno(p));
dvi->buffer.data = NULL;
dvi->pagesel = spec;
dvi->in = p; /* now we can use the dget*() functions */
- /*
- * 2. Read the preamble, extract scaling information, and
+ /*
+ * 2. Read the preamble, extract scaling information, and
* setup the DVI parameters.
*/
@@ -710,7 +710,7 @@ DviContext *mdvi_init_context(DviParams *par, DviPageSpec *spec, const char *fil
if((arg = fuget1(p)) != DVI_ID) {
mdvi_error(_("%s: unsupported DVI format (version %u)\n"),
file, arg);
- goto error; /* jump to the end of this routine,
+ goto error; /* jump to the end of this routine,
* where we handle errors */
}
/* get dimensions */
@@ -721,8 +721,8 @@ DviContext *mdvi_init_context(DviParams *par, DviPageSpec *spec, const char *fil
/* check that these numbers make sense */
if(!dvi->num || !dvi->den || !dvi->dvimag)
goto bad_dvi;
-
- dvi->params.mag =
+
+ dvi->params.mag =
(par->mag > 0 ? par->mag : (double)dvi->dvimag / 1000.0);
dvi->params.hdrift = par->hdrift;
dvi->params.vdrift = par->vdrift;
@@ -764,7 +764,7 @@ DviContext *mdvi_init_context(DviParams *par, DviPageSpec *spec, const char *fil
fread(dvi->fileid, 1, n, p);
dvi->fileid[n] = 0;
DEBUG((DBG_DVI, "%s: %s\n", filename, dvi->fileid));
-
+
/*
* 3. Read postamble, extract page information (number of
* pages, dimensions) and stack depth.
@@ -772,7 +772,7 @@ DviContext *mdvi_init_context(DviParams *par, DviPageSpec *spec, const char *fil
/* jump to the end of the file */
if(fseek(p, (long)-1, SEEK_END) == -1)
- goto error;
+ goto error;
for(n = 0; (op = fuget1(p)) == DVI_TRAILER; n++)
if(fseek(p, (long)-2, SEEK_CUR) < 0)
break;
@@ -795,7 +795,7 @@ DviContext *mdvi_init_context(DviParams *par, DviPageSpec *spec, const char *fil
dvi->npages = fuget2(p);
DEBUG((DBG_DVI, "%s: from postamble: stack depth %d, %d page%s\n",
filename, dvi->stacksize, dvi->npages, dvi->npages > 1 ? "s" : ""));
-
+
/*
* 4. Process font definitions.
*/
@@ -803,7 +803,7 @@ DviContext *mdvi_init_context(DviParams *par, DviPageSpec *spec, const char *fil
/* process font definitions */
dvi->nfonts = 0;
dvi->fontmap = NULL;
- /*
+ /*
* CAREFUL: here we need to use the dvi->buffer, but it might leave the
* the file cursor in the wrong position after reading fonts (because of
* buffering). It's ok, though, because after the font definitions we read
@@ -812,7 +812,7 @@ DviContext *mdvi_init_context(DviParams *par, DviPageSpec *spec, const char *fil
*/
while((op = duget1(dvi)) != DVI_POST_POST) {
DviFontRef *ref;
-
+
if(op == DVI_NOOP)
continue;
else if(op < DVI_FNT_DEF1 || op > DVI_FNT_DEF4)
@@ -826,7 +826,7 @@ DviContext *mdvi_init_context(DviParams *par, DviPageSpec *spec, const char *fil
}
/* we don't need the buffer anymore */
dreset(dvi);
-
+
if(op != DVI_POST_POST)
goto bad_dvi;
font_finish_definitions(dvi);
@@ -840,14 +840,14 @@ DviContext *mdvi_init_context(DviParams *par, DviPageSpec *spec, const char *fil
dvi->pagemap = xnalloc(PageNum, dvi->npages);
memzero(dvi->pagemap, sizeof(PageNum) * dvi->npages);
-
+
n = dvi->npages - 1;
pagecount = n;
while(offset != -1) {
int i;
PageNum page;
- fseek(p, offset, SEEK_SET);
+ fseek(p, offset, SEEK_SET);
op = fuget1(p);
if(op != DVI_BOP || n < 0)
goto bad_dvi;
@@ -875,7 +875,7 @@ DviContext *mdvi_init_context(DviParams *par, DviPageSpec *spec, const char *fil
DEBUG((DBG_DVI, "%d of %d pages selected\n",
dvi->npages - pagecount, dvi->npages));
dvi->npages -= pagecount;
- memmove(dvi->pagemap, &dvi->pagemap[pagecount],
+ memmove(dvi->pagemap, &dvi->pagemap[pagecount],
dvi->npages * sizeof(PageNum));
}
@@ -934,7 +934,7 @@ void mdvi_destroy_context(DviContext *dvi)
mdvi_free(dvi->buffer.data);
if(dvi->color_stack)
mdvi_free(dvi->color_stack);
-
+
mdvi_free(dvi);
}
@@ -955,13 +955,13 @@ static int mdvi_run_macro(DviContext *dvi, Uchar *macro, size_t len)
int opcode;
int oldtop;
- dvi->depth++;
+ dvi->depth++;
push(dvi, DVI_PUSH);
dvi->pos.w = 0;
dvi->pos.x = 0;
dvi->pos.y = 0;
dvi->pos.z = 0;
-
+
/* save our state */
curr = dvi->currfont;
fonts = dvi->fonts;
@@ -982,7 +982,7 @@ static int mdvi_run_macro(DviContext *dvi, Uchar *macro, size_t len)
break;
}
if(opcode != DVI_EOP)
- dviwarn(dvi, _("%s: vf macro had errors\n"),
+ dviwarn(dvi, _("%s: vf macro had errors\n"),
curr->ref->fontname);
if(dvi->stacktop != oldtop)
dviwarn(dvi, _("%s: stack not empty after vf macro\n"),
@@ -1005,7 +1005,7 @@ int mdvi_dopage(DviContext *dvi, int pageno)
int ppi;
int reloaded = 0;
-again:
+again:
if(dvi->in == NULL) {
/* try reopening the file */
dvi->in = fopen(dvi->filename, "rb");
@@ -1017,7 +1017,7 @@ again:
}
DEBUG((DBG_FILES, "reopen(%s) -> Ok\n", dvi->filename));
}
-
+
/* check if we need to reload the file */
if(!reloaded && get_mtime(fileno(dvi->in)) > dvi->modtime) {
mdvi_reload(dvi, &dvi->params);
@@ -1025,20 +1025,20 @@ again:
reloaded = 1;
goto again;
}
-
+
if(pageno < 0 || pageno > dvi->npages-1) {
mdvi_error(_("%s: page %d out of range\n"),
dvi->filename, pageno);
return -1;
}
-
+
fseek(dvi->in, (long)dvi->pagemap[pageno][0], SEEK_SET);
if((op = fuget1(dvi->in)) != DVI_BOP) {
mdvi_error(_("%s: bad offset at page %d\n"),
dvi->filename, pageno+1);
return -1;
}
-
+
/* skip bop */
fseek(dvi->in, (long)44, SEEK_CUR);
@@ -1048,7 +1048,7 @@ again:
dvi->stacktop = 0;
dvi->currpage = pageno;
dvi->curr_layer = 0;
-
+
if(dvi->buffer.data && !dvi->buffer.frozen)
mdvi_free(dvi->buffer.data);
@@ -1062,7 +1062,7 @@ again:
/* reset color stack */
mdvi_reset_color(dvi);
#endif
-
+
/* set max horizontal and vertical drift (from dvips) */
if(dvi->params.hdrift < 0) {
ppi = dvi->params.dpi / dvi->params.hshrink; /* shrunk pixels per inch */
@@ -1085,13 +1085,13 @@ again:
dvi->params.thinsp = FROUND(0.025 * dvi->params.dpi / dvi->params.conv);
dvi->params.vsmallsp = FROUND(0.025 * dvi->params.vdpi / dvi->params.vconv);
-
+
/* execute all the commands in the page */
while((op = duget1(dvi)) != DVI_EOP) {
if(dvi_commands[op](dvi, op) < 0)
break;
}
-
+
fflush(stdout);
fflush(stderr);
if(op != DVI_EOP)
@@ -1104,7 +1104,7 @@ again:
static int inline move_vertical(DviContext *dvi, int amount)
{
int rvv;
-
+
dvi->pos.v += amount;
rvv = vpixel_round(dvi, dvi->pos.v);
if(!dvi->params.vdrift)
@@ -1113,7 +1113,7 @@ static int inline move_vertical(DviContext *dvi, int amount)
return rvv;
else {
int newvv;
-
+
newvv = dvi->pos.vv + vpixel_round(dvi, amount);
if(rvv - newvv > dvi->params.vdrift)
return rvv - dvi->params.vdrift;
@@ -1121,13 +1121,13 @@ static int inline move_vertical(DviContext *dvi, int amount)
return rvv + dvi->params.vdrift;
else
return newvv;
- }
+ }
}
static int inline move_horizontal(DviContext *dvi, int amount)
{
int rhh;
-
+
dvi->pos.h += amount;
rhh = pixel_round(dvi, dvi->pos.h);
if(!dvi->params.hdrift)
@@ -1136,7 +1136,7 @@ static int inline move_horizontal(DviContext *dvi, int amount)
return rhh;
else {
int newhh;
-
+
newhh = dvi->pos.hh + pixel_round(dvi, amount);
if(rhh - newhh > dvi->params.hdrift)
return rhh - dvi->params.hdrift;
@@ -1144,7 +1144,7 @@ static int inline move_horizontal(DviContext *dvi, int amount)
return rhh + dvi->params.hdrift;
else
return newhh;
- }
+ }
}
static void inline fix_after_horizontal(DviContext *dvi)
@@ -1167,7 +1167,7 @@ static void inline fix_after_horizontal(DviContext *dvi)
(b) > 0 ? (b) : -(b), (c)
static void draw_shrink_rule (DviContext *dvi, int x, int y, Uint w, Uint h, int f)
-{
+{
Ulong fg, bg;
fg = dvi->curr_fg;
@@ -1176,11 +1176,11 @@ static void draw_shrink_rule (DviContext *dvi, int x, int y, Uint w, Uint h, int
mdvi_push_color (dvi, fg, bg);
dvi->device.draw_rule(dvi, x, y, w, h, f);
mdvi_pop_color (dvi);
-
+
return;
}
-/*
+/*
* The only commands that actually draw something are:
* set_char, set_rule
*/
@@ -1189,7 +1189,7 @@ static void draw_box(DviContext *dvi, DviFontChar *ch)
{
DviGlyph *glyph = NULL;
int x, y, w, h;
-
+
if(!MDVI_GLYPH_UNSET(ch->shrunk.data))
glyph = &ch->shrunk;
else if(!MDVI_GLYPH_UNSET(ch->grey.data))
@@ -1237,7 +1237,7 @@ static void draw_box(DviContext *dvi, DviFontChar *ch)
y = h - y;
break;
}
-
+
draw_shrink_rule(dvi, dvi->pos.hh - x, dvi->pos.vv - y, w, h, 1);
}
@@ -1248,7 +1248,7 @@ int set_char(DviContext *dvi, int opcode)
int hh;
DviFontChar *ch;
DviFont *font;
-
+
if(opcode < 128)
num = opcode;
else
@@ -1263,18 +1263,18 @@ int set_char(DviContext *dvi, int opcode)
/* try to display something anyway */
ch = FONTCHAR(font, num);
if(!glyph_present(ch)) {
- dviwarn(dvi,
- _("requested character %d does not exist in `%s'\n"),
+ dviwarn(dvi,
+ _("requested character %d does not exist in `%s'\n"),
num, font->fontname);
return 0;
}
draw_box(dvi, ch);
} else if(dvi->curr_layer <= dvi->params.layer) {
if(ISVIRTUAL(font))
- mdvi_run_macro(dvi, (Uchar *)font->private +
+ mdvi_run_macro(dvi, (Uchar *)font->private +
ch->offset, ch->width);
else if(ch->width && ch->height)
- dvi->device.draw_glyph(dvi, ch,
+ dvi->device.draw_glyph(dvi, ch,
dvi->pos.hh, dvi->pos.vv);
}
if(opcode >= DVI_PUT1 && opcode <= DVI_PUT4) {
@@ -1292,7 +1292,7 @@ int set_char(DviContext *dvi, int opcode)
dvi->pos.hh = hh;
fix_after_horizontal(dvi);
}
-
+
return 0;
}
@@ -1300,11 +1300,11 @@ int set_rule(DviContext *dvi, int opcode)
{
Int32 a, b;
int h, w;
-
+
a = dsget4(dvi);
b = dsget4(dvi); w = rule_round(dvi, b);
if(a > 0 && b > 0) {
- h = vrule_round(dvi, a);
+ h = vrule_round(dvi, a);
SHOWCMD((dvi, opcode == DVI_SET_RULE ? "setrule" : "putrule", -1,
"width %d, height %d (%dx%d pixels)\n",
b, a, w, h));
@@ -1314,11 +1314,11 @@ int set_rule(DviContext *dvi, int opcode)
draw_shrink_rule(dvi,
dvi->pos.hh, dvi->pos.vv - h + 1, w, h, 1);
}
- } else {
+ } else {
SHOWCMD((dvi, opcode == DVI_SET_RULE ? "setrule" : "putrule", -1,
"(moving left only, by %d)\n", b));
}
-
+
if(opcode == DVI_SET_RULE) {
dvi->pos.h += b;
dvi->pos.hh += w;
@@ -1345,7 +1345,7 @@ int push(DviContext *dvi, int opcode)
memcpy(&dvi->stack[dvi->stacktop], &dvi->pos, sizeof(DviState));
SHOWCMD((dvi, "push", -1,
"level %d: (h=%d,v=%d,w=%d,x=%d,y=%d,z=%d,hh=%d,vv=%d)\n",
- dvi->stacktop,
+ dvi->stacktop,
dvi->pos.h, dvi->pos.v, dvi->pos.w, dvi->pos.x,
dvi->pos.y, dvi->pos.z, dvi->pos.hh, dvi->pos.vv));
dvi->stacktop++;
@@ -1361,7 +1361,7 @@ int pop(DviContext *dvi, int opcode)
memcpy(&dvi->pos, &dvi->stack[dvi->stacktop-1], sizeof(DviState));
SHOWCMD((dvi, "pop", -1,
"level %d: (h=%d,v=%d,w=%d,x=%d,y=%d,z=%d,hh=%d,vv=%d)\n",
- dvi->stacktop,
+ dvi->stacktop,
dvi->pos.h, dvi->pos.v, dvi->pos.w, dvi->pos.x,
dvi->pos.y, dvi->pos.z, dvi->pos.hh, dvi->pos.vv));
dvi->stacktop--;
@@ -1372,7 +1372,7 @@ int move_right(DviContext *dvi, int opcode)
{
Int32 arg;
int h, hh;
-
+
arg = dsgetn(dvi, opcode - DVI_RIGHT1 + 1);
h = dvi->pos.h;
hh = move_horizontal(dvi, arg);
@@ -1387,7 +1387,7 @@ int move_down(DviContext *dvi, int opcode)
{
Int32 arg;
int v, vv;
-
+
arg = dsgetn(dvi, opcode - DVI_DOWN1 + 1);
v = dvi->pos.v;
vv = move_vertical(dvi, arg);
@@ -1401,7 +1401,7 @@ int move_down(DviContext *dvi, int opcode)
int move_w(DviContext *dvi, int opcode)
{
int h, hh;
-
+
if(opcode != DVI_W0)
dvi->pos.w = dsgetn(dvi, opcode - DVI_W0);
h = dvi->pos.h;
@@ -1416,13 +1416,13 @@ int move_w(DviContext *dvi, int opcode)
int move_x(DviContext *dvi, int opcode)
{
int h, hh;
-
+
if(opcode != DVI_X0)
dvi->pos.x = dsgetn(dvi, opcode - DVI_X0);
h = dvi->pos.h;
hh = move_horizontal(dvi, dvi->pos.x);
SHOWCMD((dvi, "x", opcode - DVI_X0,
- "%d h:=%d%c%d=%d, hh:=%d\n",
+ "%d h:=%d%c%d=%d, hh:=%d\n",
dvi->pos.x, DBGSUM(h, dvi->pos.x, dvi->pos.h), hh));
dvi->pos.hh = hh;
return 0;
@@ -1431,13 +1431,13 @@ int move_x(DviContext *dvi, int opcode)
int move_y(DviContext *dvi, int opcode)
{
int v, vv;
-
+
if(opcode != DVI_Y0)
dvi->pos.y = dsgetn(dvi, opcode - DVI_Y0);
v = dvi->pos.v;
vv = move_vertical(dvi, dvi->pos.y);
SHOWCMD((dvi, "y", opcode - DVI_Y0,
- "%d h:=%d%c%d=%d, hh:=%d\n",
+ "%d h:=%d%c%d=%d, hh:=%d\n",
dvi->pos.y, DBGSUM(v, dvi->pos.y, dvi->pos.v), vv));
dvi->pos.vv = vv;
return 0;
@@ -1452,7 +1452,7 @@ int move_z(DviContext *dvi, int opcode)
v = dvi->pos.v;
vv = move_vertical(dvi, dvi->pos.z);
SHOWCMD((dvi, "z", opcode - DVI_Z0,
- "%d h:=%d%c%d=%d, hh:=%d\n",
+ "%d h:=%d%c%d=%d, hh:=%d\n",
dvi->pos.z, DBGSUM(v, dvi->pos.z, dvi->pos.v), vv));
dvi->pos.vv = vv;
return 0;
@@ -1462,7 +1462,7 @@ int sel_font(DviContext *dvi, int opcode)
{
DviFontRef *ref;
int ndx;
-
+
ndx = opcode - DVI_FNT_NUM0;
if(dvi->depth)
ref = font_find_flat(dvi, ndx);
@@ -1484,7 +1484,7 @@ int sel_fontn(DviContext *dvi, int opcode)
{
Int32 arg;
DviFontRef *ref;
-
+
arg = dugetn(dvi, opcode - DVI_FNT1 + 1);
if(dvi->depth)
ref = font_find_flat(dvi, arg);
@@ -1495,7 +1495,7 @@ int sel_fontn(DviContext *dvi, int opcode)
return -1;
}
SHOWCMD((dvi, "fnt", opcode - DVI_FNT1 + 1,
- "current font is %s (id %d)\n",
+ "current font is %s (id %d)\n",
ref->ref->fontname, arg));
dvi->currfont = ref;
return 0;
@@ -1505,7 +1505,7 @@ int special(DviContext *dvi, int opcode)
{
char *s;
Int32 arg;
-
+
arg = dugetn(dvi, opcode - DVI_XXX1 + 1);
if (arg <= 0) {
dvierr(dvi, _("malformed special length\n"));
@@ -1525,7 +1525,7 @@ int def_font(DviContext *dvi, int opcode)
{
DviFontRef *ref;
Int32 arg;
-
+
arg = dugetn(dvi, opcode - DVI_FNT_DEF1 + 1);
if(dvi->depth)
ref = font_find_flat(dvi, arg);
diff --git a/backend/dvi/mdvi-lib/files.c b/backend/dvi/mdvi-lib/files.c
index b7065068..fd88be69 100644
--- a/backend/dvi/mdvi-lib/files.c
+++ b/backend/dvi/mdvi-lib/files.c
@@ -26,13 +26,13 @@
char *dgets(Dstring *dstr, FILE *in)
{
char buffer[256];
-
+
dstr->length = 0;
if(feof(in))
return NULL;
while(fgets(buffer, 256, in) != NULL) {
int len = strlen(buffer);
-
+
if(buffer[len-1] == '\n') {
dstring_append(dstr, buffer, len - 1);
break;
@@ -49,21 +49,21 @@ char *dgets(Dstring *dstr, FILE *in)
const char *file_basename(const char *filename)
{
const char *ptr = strrchr(filename, '/');
-
+
return (ptr ? ptr + 1 : filename);
}
const char *file_extension(const char *filename)
{
const char *ptr = strchr(file_basename(filename), '.');
-
+
return (ptr ? ptr + 1 : NULL);
}
int file_readable(const char *filename)
{
int status = (access(filename, R_OK) == 0);
-
+
DEBUG((DBG_FILES, "file_redable(%s) -> %s\n",
filename, status ? "Yes" : "No"));
return status;
@@ -72,7 +72,7 @@ int file_readable(const char *filename)
int file_exists(const char *filename)
{
int status = (access(filename, F_OK) == 0);
-
+
DEBUG((DBG_FILES, "file_exists(%s) -> %s\n",
filename, status ? "Yes" : "No"));
return status;
diff --git a/backend/dvi/mdvi-lib/font.c b/backend/dvi/mdvi-lib/font.c
index 2f655df0..56e7bae4 100644
--- a/backend/dvi/mdvi-lib/font.c
+++ b/backend/dvi/mdvi-lib/font.c
@@ -48,7 +48,7 @@ int font_reopen(DviFont *font)
static int load_font_file(DviParams *params, DviFont *font)
{
int status;
-
+
if(SEARCH_DONE(font->search))
return -1;
if(font->in == NULL && font_reopen(font) < 0)
@@ -73,7 +73,7 @@ static int load_font_file(DviParams *params, DviFont *font)
void font_drop_one(DviFontRef *ref)
{
DviFont *font;
-
+
font = ref->ref;
mdvi_free(ref);
/* drop all children */
@@ -82,7 +82,7 @@ void font_drop_one(DviFontRef *ref)
ref->ref->links--;
}
if(--font->links == 0) {
- /*
+ /*
* this font doesn't have any more references, but
* we still keep it around in case a virtual font
* requests it.
@@ -104,7 +104,7 @@ void font_drop_one(DviFontRef *ref)
void font_drop_chain(DviFontRef *head)
{
DviFontRef *ptr;
-
+
for(; (ptr = head); ) {
head = ptr->next;
font_drop_one(ptr);
@@ -116,15 +116,15 @@ int font_free_unused(DviDevice *dev)
DviFont *font, *next;
int count = 0;
- DEBUG((DBG_FONTS, "destroying unused fonts\n"));
+ DEBUG((DBG_FONTS, "destroying unused fonts\n"));
for(font = (DviFont *)fontlist.head; font; font = next) {
DviFontRef *ref;
-
+
next = font->next;
if(font->links)
continue;
count++;
- DEBUG((DBG_FONTS, "removing unused %s font `%s'\n",
+ DEBUG((DBG_FONTS, "removing unused %s font `%s'\n",
TYPENAME(font), font->fontname));
listh_remove(&fontlist, LIST(font));
if(font->in)
@@ -164,7 +164,7 @@ font_reference(
DviFont *font;
DviFontRef *ref;
DviFontRef *subfont_ref;
-
+
/* see if there is a font with the same characteristics */
for(font = (DviFont *)fontlist.head; font; font = font->next) {
if(strcmp(name, font->fontname) == 0
@@ -210,7 +210,7 @@ void font_transform_glyph(DviOrientation orient, DviGlyph *g)
{
BITMAP *map;
int x, y;
-
+
map = (BITMAP *)g->data;
if(MDVI_GLYPH_ISEMPTY(map))
map = NULL;
@@ -240,7 +240,7 @@ void font_transform_glyph(DviOrientation orient, DviGlyph *g)
g->y = x;
SWAPINT(g->w, g->h);
break;
- case MDVI_ORIENT_RM90:
+ case MDVI_ORIENT_RM90:
if(map) bitmap_rotate_clockwise(map);
y = g->h - g->y;
x = g->x;
@@ -303,7 +303,7 @@ static int load_one_glyph(DviContext *dvi, DviFont *font, int code)
/* check if we have to scale it */
if(!font->finfo->scalable && font->hdpi != font->vdpi) {
int hs, vs, d;
-
+
/* we scale it ourselves */
d = Max(font->hdpi, font->vdpi);
hs = d / font->hdpi;
@@ -311,8 +311,8 @@ static int load_one_glyph(DviContext *dvi, DviFont *font, int code)
if(ch->width && ch->height && (hs > 1 || vs > 1)) {
int h, v;
DviGlyph glyph;
-
- DEBUG((DBG_FONTS,
+
+ DEBUG((DBG_FONTS,
"%s: scaling glyph %d to resolution %dx%d\n",
font->fontname, code, font->hdpi, font->vdpi));
h = dvi->params.hshrink;
@@ -336,10 +336,10 @@ static int load_one_glyph(DviContext *dvi, DviFont *font, int code)
ch->glyph.w = glyph.w;
ch->glyph.h = glyph.h;
}
-
+
}
font_transform_glyph(dvi->params.orientation, &ch->glyph);
-
+
return 0;
}
@@ -351,7 +351,7 @@ again:
/* if we have not loaded the font yet, do so now */
if(!font->chars && load_font_file(&dvi->params, font) < 0)
return NULL;
-
+
/* get the unscaled glyph, maybe loading it from disk */
ch = FONTCHAR(font, code);
if(!ch || !glyph_present(ch))
@@ -371,16 +371,16 @@ again:
font->finfo->getglyph == NULL ||
(dvi->params.hshrink == 1 && dvi->params.vshrink == 1))
return ch;
-
+
/* If the glyph is empty, we just need to shrink the box */
if(ch->missing || MDVI_GLYPH_ISEMPTY(ch->glyph.data)) {
if(MDVI_GLYPH_UNSET(ch->shrunk.data))
mdvi_shrink_box(dvi, font, ch, &ch->shrunk);
return ch;
} else if(MDVI_ENABLED(dvi, MDVI_PARAM_ANTIALIASED)) {
- if(ch->grey.data &&
+ if(ch->grey.data &&
!MDVI_GLYPH_ISEMPTY(ch->grey.data) &&
- ch->fg == dvi->curr_fg &&
+ ch->fg == dvi->curr_fg &&
ch->bg == dvi->curr_bg)
return ch;
if(ch->grey.data &&
@@ -424,12 +424,12 @@ void font_reset_font_glyphs(DviDevice *dev, DviFont *font, int what)
{
int i;
DviFontChar *ch;
-
+
if(what & MDVI_FONTSEL_GLYPH)
- what |= MDVI_FONTSEL_BITMAP|MDVI_FONTSEL_GREY;
+ what |= MDVI_FONTSEL_BITMAP|MDVI_FONTSEL_GREY;
if(font->subfonts) {
DviFontRef *ref;
-
+
for(ref = font->subfonts; ref; ref = ref->next)
font_reset_font_glyphs(dev, ref->ref, what);
}
@@ -447,12 +447,12 @@ void font_reset_font_glyphs(DviDevice *dev, DviFont *font, int what)
}
if((what & MDVI_FONTSEL_GLYPH) && font->finfo->reset)
font->finfo->reset(font);
-}
+}
void font_reset_chain_glyphs(DviDevice *dev, DviFontRef *head, int what)
{
DviFontRef *ref;
-
+
for(ref = head; ref; ref = ref->next)
font_reset_font_glyphs(dev, ref->ref, what);
}
@@ -466,7 +466,7 @@ void font_finish_definitions(DviContext *dvi)
{
int count;
DviFontRef **map, *ref;
-
+
/* first get rid of unused fonts */
font_free_unused(&dvi->device);
@@ -485,7 +485,7 @@ void font_finish_definitions(DviContext *dvi)
DviFontRef *font_find_flat(DviContext *dvi, Int32 id)
{
DviFontRef *ref;
-
+
for(ref = dvi->fonts; ref; ref = ref->next)
if(ref->fontid == id)
break;
@@ -496,13 +496,13 @@ DviFontRef *font_find_mapped(DviContext *dvi, Int32 id)
{
int lo, hi, n;
DviFontRef **map;
-
+
/* do a binary search */
lo = 0; hi = dvi->nfonts;
map = dvi->fontmap;
while(lo < hi) {
int sign;
-
+
n = (hi + lo) >> 1;
sign = (map[n]->fontid - id);
if(sign == 0)
diff --git a/backend/dvi/mdvi-lib/fontmap.c b/backend/dvi/mdvi-lib/fontmap.c
index 20537c85..553b49da 100644
--- a/backend/dvi/mdvi-lib/fontmap.c
+++ b/backend/dvi/mdvi-lib/fontmap.c
@@ -61,7 +61,7 @@ static int fontmaps_loaded = 0;
#define ENC_HASH_SIZE 31
#define PSMAP_HASH_SIZE 57
-/* this hash table should be big enough to
+/* this hash table should be big enough to
* hold (ideally) one glyph name per bucket */
#define ENCNAME_HASH_SIZE 131 /* most TeX fonts have 128 glyphs */
@@ -70,7 +70,7 @@ static DviEncoding *tex_text_encoding = NULL;
static DviEncoding *default_encoding = NULL;
/* we keep two hash tables for encodings: one for their base files (e.g.
- * "8r.enc"), and another one for their names (e.g. "TeXBase1Encoding") */
+ * "8r.enc"), and another one for their names (e.g. "TeXBase1Encoding") */
static DviHashTable enctable = MDVI_EMPTY_HASH_TABLE;
static DviHashTable enctable_file = MDVI_EMPTY_HASH_TABLE;
@@ -104,7 +104,7 @@ static void ps_init_default_paths __PROTO((void));
static int mdvi_set_default_encoding __PROTO((const char *name));
static int mdvi_init_fontmaps __PROTO((void));
-/*
+/*
* What we do here is allocate one block large enough to hold the entire
* file (these files are small) minus the leading comments. This is much
* better than allocating up to 256 tiny strings per encoding vector. */
@@ -116,7 +116,7 @@ static int read_encoding(DviEncoding *enc)
char *name;
char *next;
struct stat st;
-
+
ASSERT(enc->private == NULL);
in = fopen(enc->filename, "rb");
@@ -153,7 +153,7 @@ static int read_encoding(DviEncoding *enc)
curr = 0;
next = name = NULL;
- DEBUG((DBG_FMAP, "%s: reading encoding vector\n", enc->name));
+ DEBUG((DBG_FMAP, "%s: reading encoding vector\n", enc->name));
for(line = enc->private; *line && curr < 256; line = next) {
SKIPSP(line);
if(*line == ']') {
@@ -176,13 +176,13 @@ static int read_encoding(DviEncoding *enc)
/* got a name */
if(*next) *next++ = 0;
-
+
if(*name == '/')
name++;
enc->vector[curr] = name;
/* add it to the hash table */
if(!STREQ(name, ".notdef")) {
- mdvi_hash_add(&enc->nametab, MDVI_KEY(name),
+ mdvi_hash_add(&enc->nametab, MDVI_KEY(name),
Int2Ptr(curr + 1), MDVI_HASH_REPLACE);
}
curr++;
@@ -200,7 +200,7 @@ static int read_encoding(DviEncoding *enc)
static DviEncoding *find_encoding(const char *name)
{
- return (DviEncoding *)(encodings.count ?
+ return (DviEncoding *)(encodings.count ?
mdvi_hash_lookup(&enctable, MDVI_KEY(name)) : NULL);
}
@@ -249,15 +249,15 @@ static DviEncoding *register_encoding(const char *basefile, int replace)
DEBUG((DBG_FMAP, "%s: already there\n", basefile));
return enc; /* no error */
}
- }
+ }
/* try our own files first */
- filename = kpse_find_file(basefile,
+ filename = kpse_find_file(basefile,
kpse_program_text_format, 0);
/* then try the system-wide ones */
if(filename == NULL)
- filename = kpse_find_file(basefile,
+ filename = kpse_find_file(basefile,
kpse_tex_ps_header_format, 0);
if(filename == NULL)
filename = kpse_find_file(basefile,
@@ -272,7 +272,7 @@ static DviEncoding *register_encoding(const char *basefile, int replace)
mdvi_free(filename);
return NULL;
}
-
+
/* just lookup the name of the encoding */
name = NULL;
dstring_init(&input);
@@ -297,13 +297,13 @@ static DviEncoding *register_encoding(const char *basefile, int replace)
offset = ftell(in);
fclose(in);
if(name == NULL || *name == 0) {
- DEBUG((DBG_FMAP,
+ DEBUG((DBG_FMAP,
"%s: could not determine name of encoding\n",
basefile));
mdvi_free(filename);
return NULL;
}
-
+
/* check if the encoding is already there */
enc = find_encoding(name);
if(enc == tex_text_encoding) {
@@ -347,9 +347,9 @@ static DviEncoding *register_encoding(const char *basefile, int replace)
dstring_reset(&input);
if(default_encoding == NULL)
default_encoding = enc;
- mdvi_hash_add(&enctable, MDVI_KEY(enc->name),
+ mdvi_hash_add(&enctable, MDVI_KEY(enc->name),
enc, MDVI_HASH_UNCHECKED);
- mdvi_hash_add(&enctable_file, MDVI_KEY(mdvi_strdup(basefile)),
+ mdvi_hash_add(&enctable_file, MDVI_KEY(mdvi_strdup(basefile)),
enc, MDVI_HASH_REPLACE);
listh_prepend(&encodings, LIST(enc));
DEBUG((DBG_FMAP, "%s: encoding `%s' registered\n",
@@ -377,7 +377,7 @@ DviEncoding *mdvi_request_encoding(const char *name)
if(enc->nametab.nkeys == 0) {
int i;
- DEBUG((DBG_FMAP, "%s: rehashing\n", enc->name));
+ DEBUG((DBG_FMAP, "%s: rehashing\n", enc->name));
for(i = 0; i < 256; i++) {
if(enc->vector[i] == NULL)
continue;
@@ -404,7 +404,7 @@ void mdvi_release_encoding(DviEncoding *enc, int should_free)
int mdvi_encode_glyph(DviEncoding *enc, const char *name)
{
void *data;
-
+
data = mdvi_hash_lookup(&enc->nametab, MDVI_KEY(name));
if(data == NULL)
return -1;
@@ -420,7 +420,7 @@ int mdvi_encode_glyph(DviEncoding *enc, const char *name)
static void parse_spec(DviFontMapEnt *ent, char *spec)
{
char *arg, *command;
-
+
/* this is a ridiculously simple parser, and recognizes only
* things of the form <argument> <command>. Of these, only
* command=SlantFont, ExtendFont and ReEncodeFont are handled */
@@ -429,16 +429,16 @@ static void parse_spec(DviFontMapEnt *ent, char *spec)
if(*spec) *spec++ = 0;
command = getword(spec, " \t", &spec);
if(*spec) *spec++ = 0;
- if(!arg || !command)
+ if(!arg || !command)
continue;
if(STREQ(command, "SlantFont")) {
double x = 10000 * strtod(arg, 0);
-
- /* SFROUND evaluates arguments twice */
+
+ /* SFROUND evaluates arguments twice */
ent->slant = SFROUND(x);
} else if(STREQ(command, "ExtendFont")) {
double x = 10000 * strtod(arg, 0);
-
+
ent->extend = SFROUND(x);
} else if(STREQ(command, "ReEncodeFont")) {
if(ent->encoding)
@@ -485,13 +485,13 @@ DviFontMapEnt *mdvi_load_fontmap(const char *file)
}
if(in == NULL)
return NULL;
-
+
ent = NULL;
listh_init(&list);
dstring_init(&input);
last_encoding = NULL;
last_encfile = NULL;
-
+
while((ptr = dgets(&input, in)) != NULL) {
char *font_file;
char *tex_name;
@@ -502,12 +502,12 @@ DviFontMapEnt *mdvi_load_fontmap(const char *file)
lineno++;
SKIPSP(ptr);
-
+
/* we skip what dvips does */
- if(*ptr <= ' ' || *ptr == '*' || *ptr == '#' ||
+ if(*ptr <= ' ' || *ptr == '*' || *ptr == '#' ||
*ptr == ';' || *ptr == '%')
continue;
-
+
font_file = NULL;
tex_name = NULL;
ps_name = NULL;
@@ -522,14 +522,14 @@ DviFontMapEnt *mdvi_load_fontmap(const char *file)
}
while(*ptr) {
char *hdr_name = NULL;
-
+
while(*ptr && *ptr <= ' ')
ptr++;
if(*ptr == 0)
break;
if(*ptr == '"') {
char *str;
-
+
str = getstring(ptr, " \t", &ptr);
if(*ptr) *ptr++ = 0;
parse_spec(ent, str);
@@ -557,7 +557,7 @@ DviFontMapEnt *mdvi_load_fontmap(const char *file)
if(hdr_name) {
const char *ext = file_extension(hdr_name);
-
+
if(is_encoding || (ext && STRCEQ(ext, "enc")))
vec_name = hdr_name;
else
@@ -576,7 +576,7 @@ DviFontMapEnt *mdvi_load_fontmap(const char *file)
/* if we have an encoding file, register it */
if(ent->encfile) {
- /* register_encoding is smart enough not to load the
+ /* register_encoding is smart enough not to load the
* same file twice */
if(!last_encfile || !STREQ(last_encfile, ent->encfile)) {
last_encfile = ent->encfile;
@@ -584,7 +584,7 @@ DviFontMapEnt *mdvi_load_fontmap(const char *file)
}
enc = last_encoding;
}
- if(ent->encfile && enc){
+ if(ent->encfile && enc){
if(ent->encoding && !STREQ(ent->encoding, enc->name)) {
mdvi_warning(
_("%s: %d: [%s] requested encoding `%s' does not match vector `%s'\n"),
@@ -593,15 +593,15 @@ DviFontMapEnt *mdvi_load_fontmap(const char *file)
} else if(!ent->encoding)
ent->encoding = mdvi_strdup(enc->name);
}
-
+
/* add it to the list */
/*print_ent(ent);*/
listh_append(&list, LIST(ent));
ent = NULL;
}
- dstring_reset(&input);
+ dstring_reset(&input);
fclose(in);
-
+
return (DviFontMapEnt *)list.head;
}
@@ -629,7 +629,7 @@ void mdvi_install_fontmap(DviFontMapEnt *head)
for(ent = head; ent; ent = next) {
/* add all the entries, overriding old ones */
DviFontMapEnt *old;
-
+
old = (DviFontMapEnt *)
mdvi_hash_remove(&maptable, MDVI_KEY(ent->fontname));
if(old != NULL) {
@@ -639,7 +639,7 @@ void mdvi_install_fontmap(DviFontMapEnt *head)
free_ent(old);
}
next = ent->next;
- mdvi_hash_add(&maptable, MDVI_KEY(ent->fontname),
+ mdvi_hash_add(&maptable, MDVI_KEY(ent->fontname),
ent, MDVI_HASH_UNCHECKED);
listh_append(&fontmaps, LIST(ent));
}
@@ -650,7 +650,7 @@ static void init_static_encoding()
DviEncoding *encoding;
int i;
- DEBUG((DBG_FMAP, "installing static TeX text encoding\n"));
+ DEBUG((DBG_FMAP, "installing static TeX text encoding\n"));
encoding = xalloc(DviEncoding);
encoding->private = "";
encoding->filename = "";
@@ -671,7 +671,7 @@ static void init_static_encoding()
mdvi_hash_create(&enctable, ENC_HASH_SIZE);
mdvi_hash_create(&enctable_file, ENC_HASH_SIZE);
enctable_file.hash_free = file_hash_free;
- mdvi_hash_add(&enctable, MDVI_KEY(encoding->name),
+ mdvi_hash_add(&enctable, MDVI_KEY(encoding->name),
encoding, MDVI_HASH_UNCHECKED);
listh_prepend(&encodings, LIST(encoding));
tex_text_encoding = encoding;
@@ -720,7 +720,7 @@ static int mdvi_init_fontmaps(void)
/* create the fontmap hash table */
mdvi_hash_create(&maptable, MAP_HASH_SIZE);
-
+
/* get the name of our configuration file */
config = kpse_cnf_get("mdvi-config");
if(config == NULL)
@@ -738,13 +738,13 @@ static int mdvi_init_fontmaps(void)
dstring_init(&input);
while((line = dgets(&input, in)) != NULL) {
char *arg, *map_file;
-
+
SKIPSP(line);
if(*line < ' ' || *line == '#' || *line == '%')
continue;
if(STRNEQ(line, "fontmap", 7)) {
DviFontMapEnt *ent;
-
+
arg = getstring(line + 7, " \t", &line); *line = 0;
DEBUG((DBG_FMAP, "%s: loading fontmap\n", arg));
ent = mdvi_load_fontmap(arg);
@@ -756,7 +756,7 @@ static int mdvi_init_fontmaps(void)
if(ent == NULL)
mdvi_warning(_("%s: could not load fontmap\n"), arg);
else {
- DEBUG((DBG_FMAP,
+ DEBUG((DBG_FMAP,
"%s: installing fontmap\n", arg));
mdvi_install_fontmap(ent);
count++;
@@ -804,7 +804,7 @@ int mdvi_query_fontmap(DviFontMapInfo *info, const char *fontname)
DviFontMapEnt *ent;
if(!fontmaps_loaded && mdvi_init_fontmaps() < 0)
- return -1;
+ return -1;
ent = (DviFontMapEnt *)mdvi_hash_lookup(&maptable, MDVI_KEY(fontname));
if(ent == NULL)
@@ -815,14 +815,14 @@ int mdvi_query_fontmap(DviFontMapInfo *info, const char *fontname)
info->extend = ent->extend;
info->slant = ent->slant;
info->fullfile = ent->fullfile;
-
- return 0;
+
+ return 0;
}
int mdvi_add_fontmap_file(const char *name, const char *fullpath)
{
DviFontMapEnt *ent;
-
+
if(!fontmaps_loaded && mdvi_init_fontmaps() < 0)
return -1;
ent = (DviFontMapEnt *)mdvi_hash_lookup(&maptable, MDVI_KEY(name));
@@ -856,13 +856,13 @@ void mdvi_flush_encodings(void)
if(tex_text_encoding->nametab.buckets)
mdvi_hash_reset(&tex_text_encoding->nametab, 0);
mdvi_hash_reset(&enctable, 0);
- mdvi_hash_reset(&enctable_file, 0);
+ mdvi_hash_reset(&enctable_file, 0);
}
void mdvi_flush_fontmaps(void)
{
DviFontMapEnt *ent;
-
+
if(!fontmaps_loaded)
return;
@@ -885,7 +885,7 @@ void ps_init_default_paths(void)
ASSERT(psinitialized == 0);
kppath = getenv("GS_LIB");
- kfpath = getenv("GS_FONTPATH");
+ kfpath = getenv("GS_FONTPATH");
if(kppath != NULL)
pslibdir = kpse_path_expand(kppath);
@@ -904,7 +904,7 @@ int mdvi_ps_read_fontmap(const char *name)
Dstring dstr;
char *line;
int count = 0;
-
+
if(!psinitialized)
ps_init_default_paths();
if(pslibdir)
@@ -918,17 +918,17 @@ int mdvi_ps_read_fontmap(const char *name)
return -1;
}
dstring_init(&dstr);
-
+
while((line = dgets(&dstr, in)) != NULL) {
char *name;
char *mapname;
const char *ext;
PSFontMap *ps;
-
+
SKIPSP(line);
/* we're looking for lines of the form
* /FONT-NAME (fontfile)
- * /FONT-NAME /FONT-ALIAS
+ * /FONT-NAME /FONT-ALIAS
*/
if(*line != '/')
continue;
@@ -936,12 +936,12 @@ int mdvi_ps_read_fontmap(const char *name)
if(*line) *line++ = 0;
mapname = getword(line, " \t", &line);
if(*line) *line++ = 0;
-
+
if(!name || !mapname || !*name)
continue;
if(*mapname == '(') {
char *end;
-
+
mapname++;
for(end = mapname; *end && *end != ')'; end++);
*end = 0;
@@ -960,7 +960,7 @@ int mdvi_ps_read_fontmap(const char *name)
if(ps != NULL) {
if(STREQ(ps->mapname, mapname))
continue;
- DEBUG((DBG_FMAP,
+ DEBUG((DBG_FMAP,
"(ps) replacing font `%s' (%s) by `%s'\n",
name, ps->mapname, mapname));
mdvi_free(ps->mapname);
@@ -984,7 +984,7 @@ int mdvi_ps_read_fontmap(const char *name)
}
fclose(in);
dstring_reset(&dstr);
-
+
DEBUG((DBG_FMAP, "(ps) %s: %d PostScript fonts registered\n",
fullname, count));
return 0;
@@ -993,7 +993,7 @@ int mdvi_ps_read_fontmap(const char *name)
void mdvi_ps_flush_fonts(void)
{
PSFontMap *map;
-
+
if(!psinitialized)
return;
DEBUG((DBG_FMAP, "(ps) flushing PS font map (%d) entries\n",
@@ -1037,11 +1037,11 @@ char *mdvi_ps_find_font(const char *psname)
/* is it an alias? */
smap = map;
while(recursion_limit-- > 0 && smap && *smap->mapname == '/')
- smap = (PSFontMap *)mdvi_hash_lookup(&pstable,
+ smap = (PSFontMap *)mdvi_hash_lookup(&pstable,
MDVI_KEY(smap->mapname + 1));
if(smap == NULL) {
if(recursion_limit == 0)
- DEBUG((DBG_FMAP,
+ DEBUG((DBG_FMAP,
"(ps) %s: possible loop in PS font map\n",
psname));
return NULL;
@@ -1055,7 +1055,7 @@ char *mdvi_ps_find_font(const char *psname)
filename = NULL;
if(filename)
map->fullname = mdvi_strdup(filename);
-
+
return filename;
}
@@ -1071,7 +1071,7 @@ char *mdvi_ps_find_font(const char *psname)
* cache, so the next time it will be found at the first step (when we look
* up NAME.afm).
*
- * The name `_ps_' in this function is not meant to imply that it can be
+ * The name `_ps_' in this function is not meant to imply that it can be
* used for Type1 fonts only. It should be usable for TrueType fonts as well.
*
* The returned metric info is subjected to the same caching mechanism as
@@ -1094,7 +1094,7 @@ TFMInfo *mdvi_ps_get_metrics(const char *fontname)
double efactor;
double sfactor;
- DEBUG((DBG_FMAP, "(ps) %s: looking for metric data\n", fontname));
+ DEBUG((DBG_FMAP, "(ps) %s: looking for metric data\n", fontname));
info = get_font_metrics(fontname, DviFontAny, NULL);
if(info != NULL)
return info;
@@ -1102,7 +1102,7 @@ TFMInfo *mdvi_ps_get_metrics(const char *fontname)
/* query the fontmap */
if(mdvi_query_fontmap(&map, fontname) < 0 || !map.psname)
return NULL;
-
+
/* get the PS font */
psfont = mdvi_ps_find_font(map.psname);
if(psfont == NULL)
@@ -1140,9 +1140,9 @@ TFMInfo *mdvi_ps_get_metrics(const char *fontname)
if(info == NULL || (!map.extend && !map.slant))
return info;
- /*
- * transform the data as prescribed -- keep in mind that `info'
- * points to CACHED data, so we're modifying the metric cache
+ /*
+ * transform the data as prescribed -- keep in mind that `info'
+ * points to CACHED data, so we're modifying the metric cache
* in place.
*/
@@ -1174,6 +1174,6 @@ TFMInfo *mdvi_ps_get_metrics(const char *fontname)
ch->right = TRANSFORM(ch->right, ch->height);
}
}
-
+
return info;
}
diff --git a/backend/dvi/mdvi-lib/fontsrch.c b/backend/dvi/mdvi-lib/fontsrch.c
index 8ebaa5ca..77cd8704 100644
--- a/backend/dvi/mdvi-lib/fontsrch.c
+++ b/backend/dvi/mdvi-lib/fontsrch.c
@@ -72,7 +72,7 @@ static int initialized = 0;
static void init_font_classes(void)
{
int i;
-
+
for(i = 0; i < MAX_CLASS; i++)
listh_init(&font_classes[i]);
initialized = 1;
@@ -88,7 +88,7 @@ char **mdvi_list_font_class(int klass)
char **list;
int i, n;
DviFontClass *fc;
-
+
if(klass == -1)
klass = MAX_CLASS-1;
if(klass < 0 || klass >= MAX_CLASS)
@@ -137,7 +137,7 @@ int mdvi_unregister_font_type(const char *name, int klass)
if(klass == -1)
klass = MAX_CLASS - 1;
-
+
if(klass >= 0 && klass < MAX_CLASS) {
k = klass;
LIST_FOREACH(fc, DviFontClass, &font_classes[k]) {
@@ -154,12 +154,12 @@ int mdvi_unregister_font_type(const char *name, int klass)
}
} else
return -1;
-
+
if(fc == NULL || fc->links)
return -1;
/* remove it */
listh_remove(&font_classes[k], LIST(fc));
-
+
/* and destroy it */
mdvi_free(fc->info.name);
mdvi_free(fc);
@@ -171,9 +171,9 @@ static char *lookup_font(DviFontClass *ptr, const char *name, Ushort *h, Ushort
char *filename;
/*
- * If the font type registered a function to do the lookup, use that.
+ * If the font type registered a function to do the lookup, use that.
* Otherwise we use kpathsea.
- */
+ */
if(ptr->info.lookup)
filename = ptr->info.lookup(name, h, v);
else if(ptr->info.kpse_type <= kpse_any_glyph_format) {
@@ -208,7 +208,7 @@ char *mdvi_lookup_font(DviFontSearch *search)
if(search->id < 0)
return NULL;
-
+
if(search->curr == NULL) {
/* this is the initial search */
name = search->wanted_name;
@@ -312,7 +312,7 @@ metrics:
search->id = -1;
search->actual_name = NULL;
-
+
/* tough luck, nothing found */
return NULL;
}
@@ -322,7 +322,7 @@ DviFont *mdvi_add_font(const char *name, Int32 sum,
int hdpi, int vdpi, Int32 scale)
{
DviFont *font;
-
+
font = xalloc(DviFont);
font->fontname = mdvi_strdup(name);
SEARCH_INIT(font->search, font->fontname, hdpi, vdpi);
@@ -354,7 +354,7 @@ int mdvi_font_retry(DviParams *params, DviFont *font)
/* try the search again */
char *filename;
- ASSERT(font->search.curr != NULL);
+ ASSERT(font->search.curr != NULL);
/* we won't be using this class anymore */
font->search.curr->links--;
diff --git a/backend/dvi/mdvi-lib/gf.c b/backend/dvi/mdvi-lib/gf.c
index 00607ff6..d890e156 100644
--- a/backend/dvi/mdvi-lib/gf.c
+++ b/backend/dvi/mdvi-lib/gf.c
@@ -88,7 +88,7 @@ static int gf_read_bitmap(FILE *p, DviFontChar *ch)
Int32 par;
BmUnit *line;
BITMAP *map;
-
+
fseek(p, (long)ch->offset, SEEK_SET);
op = fuget1(p);
if(op == GF_BOC) {
@@ -106,7 +106,7 @@ static int gf_read_bitmap(FILE *p, DviFontChar *ch)
min_m = fuget1(p); /* this is max_m - min_m */
max_m = fuget1(p);
min_n = fuget1(p); /* this is max_n - min_n */
- max_n = fuget1(p);
+ max_n = fuget1(p);
min_m = max_m - min_m;
min_n = max_n - min_n;
} else {
@@ -136,18 +136,18 @@ static int gf_read_bitmap(FILE *p, DviFontChar *ch)
DEBUG((DBG_BITMAPS, "(gf) reading character %d\n", ch->code));
while((op = fuget1(p)) != GF_EOC) {
Int32 n;
-
+
if(feof(p))
break;
if(op == GF_PAINT0) {
DEBUG((DBG_BITMAPS, "(gf) Paint0 %s -> %s\n",
- COLOR(paint_switch), COLOR(!paint_switch)));
+ COLOR(paint_switch), COLOR(!paint_switch)));
paint_switch = !paint_switch;
} else if(op <= GF_PAINT3) {
if(op < GF_PAINT1)
par = op;
else
- par = fugetn(p, op - GF_PAINT1 + 1);
+ par = fugetn(p, op - GF_PAINT1 + 1);
if(y >= ch->height || x + par >= ch->width)
goto toobig;
/* paint everything between columns x and x + par - 1 */
@@ -159,14 +159,14 @@ static int gf_read_bitmap(FILE *p, DviFontChar *ch)
paint_switch = !paint_switch;
x += par;
} else if(op >= GF_NEW_ROW_0 && op <= GF_NEW_ROW_MAX) {
- y++;
+ y++;
line = bm_offset(line, bpl);
x = op - GF_NEW_ROW_0;
paint_switch = BLACK;
DEBUG((DBG_BITMAPS, "(gf) new_row_%d\n", x));
} else switch(op) {
case GF_SKIP0:
- y++;
+ y++;
line = bm_offset(line, bpl);
x = 0;
paint_switch = WHITE;
@@ -264,7 +264,7 @@ static int gf_load_font(DviParams *unused, DviFont *font)
/* now read character locators in postamble */
if(fseek(p, (long)-1, SEEK_END) == -1)
return -1;
-
+
n = 0;
while((op = fuget1(p)) == GF_TRAILER) {
if(fseek(p, (long)-2, SEEK_CUR) < 0)
@@ -306,7 +306,7 @@ static int gf_load_font(DviParams *unused, DviFont *font)
DviFontChar *ch;
int cc;
- /* get the character code */
+ /* get the character code */
cc = fuget1(p);
if(cc < loc)
loc = cc;
@@ -342,11 +342,11 @@ static int gf_load_font(DviParams *unused, DviFont *font)
ch->grey.data = NULL;
ch->flags = 0;
ch->loaded = 0;
- }
+ }
if(op != GF_POST_POST)
goto badgf;
-
+
if(loc > 0 || hic < 255) {
/* shrink to optimal size */
memmove(font->chars, font->chars + loc,
@@ -373,11 +373,11 @@ error:
static int gf_font_get_glyph(DviParams *params, DviFont *font, int code)
{
DviFontChar *ch;
-
+
if(code < font->loc || code > font->hic || !font->chars)
return -1;
ch = &font->chars[code - font->loc];
-
+
if(!ch->loaded) {
if(ch->offset == 0)
return -1;
diff --git a/backend/dvi/mdvi-lib/hash.c b/backend/dvi/mdvi-lib/hash.c
index d359e3c8..3327fa58 100644
--- a/backend/dvi/mdvi-lib/hash.c
+++ b/backend/dvi/mdvi-lib/hash.c
@@ -33,7 +33,7 @@ static Ulong hash_string(DviHashKey key)
{
Uchar *p;
Ulong h, g;
-
+
for(h = 0, p = (Uchar *)key; *p; p++) {
h = (h << 4UL) + *p;
if((g = h & 0xf0000000L) != 0) {
@@ -41,7 +41,7 @@ static Ulong hash_string(DviHashKey key)
h ^= g;
}
}
-
+
return h;
}
@@ -63,7 +63,7 @@ void mdvi_hash_init(DviHashTable *hash)
void mdvi_hash_create(DviHashTable *hash, int size)
{
int i;
-
+
hash->nbucks = size;
hash->buckets = xnalloc(DviHashBucket *, size);
for(i = 0; i < size; i++)
@@ -78,9 +78,9 @@ static DviHashBucket *hash_find(DviHashTable *hash, DviHashKey key)
{
Ulong hval;
DviHashBucket *buck;
-
+
hval = (hash->hash_func(key) % hash->nbucks);
-
+
for(buck = hash->buckets[hval]; buck; buck = buck->next)
if(hash->hash_comp(buck->key, key) == 0)
break;
@@ -92,7 +92,7 @@ int mdvi_hash_add(DviHashTable *hash, DviHashKey key, void *data, int rep)
{
DviHashBucket *buck = NULL;
Ulong hval;
-
+
if(rep != MDVI_HASH_UNCHECKED) {
buck = hash_find(hash, key);
if(buck != NULL) {
@@ -112,11 +112,11 @@ int mdvi_hash_add(DviHashTable *hash, DviHashKey key, void *data, int rep)
hash->buckets[hval] = buck;
hash->nkeys++;
}
-
+
/* save key and data */
buck->key = key;
buck->data = data;
-
+
return 0;
}
@@ -131,10 +131,10 @@ static DviHashBucket *hash_remove(DviHashTable *hash, DviHashKey key)
{
DviHashBucket *buck, *last;
Ulong hval;
-
+
hval = hash->hash_func(key);
hval %= hash->nbucks;
-
+
for(last = NULL, buck = hash->buckets[hval]; buck; buck = buck->next) {
if(hash->hash_comp(buck->key, key) == 0)
break;
@@ -167,10 +167,10 @@ void *mdvi_hash_remove_ptr(DviHashTable *hash, DviHashKey key)
DviHashBucket *buck, *last;
Ulong hval;
void *ptr;
-
+
hval = hash->hash_func(key);
hval %= hash->nbucks;
-
+
for(last = NULL, buck = hash->buckets[hval]; buck; buck = buck->next) {
if(buck->key == key)
break;
@@ -192,20 +192,20 @@ void *mdvi_hash_remove_ptr(DviHashTable *hash, DviHashKey key)
int mdvi_hash_destroy_key(DviHashTable *hash, DviHashKey key)
{
DviHashBucket *buck = hash_remove(hash, key);
-
+
if(buck == NULL)
return -1;
if(hash->hash_free)
hash->hash_free(buck->key, buck->data);
mdvi_free(buck);
- return 0;
+ return 0;
}
void mdvi_hash_reset(DviHashTable *hash, int reuse)
{
int i;
DviHashBucket *buck;
-
+
/* remove all keys in the hash table */
for(i = 0; i < hash->nbucks; i++) {
for(; (buck = hash->buckets[i]); ) {
diff --git a/backend/dvi/mdvi-lib/mdvi.h b/backend/dvi/mdvi-lib/mdvi.h
index 37664a76..a05f9278 100644
--- a/backend/dvi/mdvi-lib/mdvi.h
+++ b/backend/dvi/mdvi-lib/mdvi.h
@@ -62,34 +62,34 @@ typedef Ulong DviColor;
typedef enum {
FALSE = 0,
- TRUE = 1
+ TRUE = 1
} DviBool;
#include "hash.h"
#include "paper.h"
-/*
+/*
* information about a page:
* pagenum[0] = offset to BOP
* pagenum[1], ..., pagenum[10] = TeX \counters
*/
typedef long PageNum[11];
-/* this structure contains the platform-specific information
+/* this structure contains the platform-specific information
* required to interpret a DVI file */
-typedef void (*DviGlyphDraw) __PROTO((DviContext *context,
+typedef void (*DviGlyphDraw) __PROTO((DviContext *context,
DviFontChar *glyph,
int x, int y));
typedef void (*DviRuleDraw) __PROTO((DviContext *context,
- int x, int y,
+ int x, int y,
Uint width, Uint height, int fill));
typedef int (*DviColorScale) __PROTO((void *device_data,
- Ulong *pixels,
+ Ulong *pixels,
int npixels,
- Ulong foreground,
+ Ulong foreground,
Ulong background,
double gamma,
int density));
@@ -104,7 +104,7 @@ typedef void (*DviDevDestroy) __PROTO((void *data));
typedef void (*DviRefresh) __PROTO((DviContext *dvi, void *device_data));
typedef void (*DviSetColor) __PROTO((void *device_data, Ulong, Ulong));
typedef void (*DviPSDraw) __PROTO((DviContext *context,
- const char *filename,
+ const char *filename,
int x, int y,
Uint width, Uint height));
@@ -155,7 +155,7 @@ struct _DviGlyph {
void *data; /* bitmap or XImage */
};
-typedef void (*DviFontShrinkFunc)
+typedef void (*DviFontShrinkFunc)
__PROTO((DviContext *, DviFont *, DviFontChar *, DviGlyph *));
typedef int (*DviFontLoadFunc) __PROTO((DviParams *, DviFont *));
typedef int (*DviFontGetGlyphFunc) __PROTO((DviParams *, DviFont *, int));
@@ -351,7 +351,7 @@ struct _DviState {
int w;
int x;
int y;
- int z;
+ int z;
};
struct _DviColorPair {
@@ -415,7 +415,7 @@ struct _DviRange {
};
-typedef void (*DviSpecialHandler)
+typedef void (*DviSpecialHandler)
__PROTO((DviContext *dvi, const char *prefix, const char *arg));
#define RANGE_HAS_LOWER(x) \
@@ -433,7 +433,7 @@ typedef void (*DviSpecialHandler)
#define MDVI_PARAM_SHOWUNDEF 8
#define MDVI_PARAM_DELAYFONTS 16
-/*
+/*
* The FALLBACK priority class is reserved for font formats that
* contain no glyph information and are to be used as a last
* resort (e.g. TFM, AFM)
@@ -553,10 +553,10 @@ extern void mdvi_flush_specials __PROTO((void));
#define glyph_present(x) ((x) && (x)->offset)
/* create a reference to a font */
-extern DviFontRef *font_reference __PROTO((DviParams *params,
- Int32 dvi_id,
- const char *font_name,
- Int32 checksum,
+extern DviFontRef *font_reference __PROTO((DviParams *params,
+ Int32 dvi_id,
+ const char *font_name,
+ Int32 checksum,
int xdpi,
int ydpi,
Int32 scale_factor));
diff --git a/backend/dvi/mdvi-lib/pagesel.c b/backend/dvi/mdvi-lib/pagesel.c
index 5a153955..82c59a37 100644
--- a/backend/dvi/mdvi-lib/pagesel.c
+++ b/backend/dvi/mdvi-lib/pagesel.c
@@ -47,7 +47,7 @@ DviRange *mdvi_parse_range(const char *format, DviRange *limit, int *nitems, cha
char * text;
DviRange one;
DviRange *range;
-
+
quoted = (*format == '{');
if(quoted) format++;
@@ -59,7 +59,7 @@ DviRange *mdvi_parse_range(const char *format, DviRange *limit, int *nitems, cha
lower = 0;
upper = 0;
type = MDVI_RANGE_UNBOUNDED;
-
+
if(limit) {
switch(limit->type) {
case MDVI_RANGE_BOUNDED:
@@ -96,7 +96,7 @@ DviRange *mdvi_parse_range(const char *format, DviRange *limit, int *nitems, cha
int this_type;
int lower_given = 0;
int upper_given = 0;
-
+
if(*cp == 0 || *cp == '.' || (*cp == '}' && quoted))
done = 1;
else if(*cp != ',')
@@ -109,7 +109,7 @@ DviRange *mdvi_parse_range(const char *format, DviRange *limit, int *nitems, cha
f = lower;
t = upper;
s = 1;
-
+
p = strchr(text, ':');
if(p) *p++ = 0;
if(*text) {
@@ -165,7 +165,7 @@ finish:
one.to = t;
one.from = f;
one.step = s;
-
+
if(curr == size) {
size += 8;
range = mdvi_realloc(range, size * sizeof(DviRange));
@@ -174,7 +174,7 @@ finish:
*cp = ch;
text = cp + 1;
}
- if(done)
+ if(done)
cp--;
if(quoted && *cp == '}')
cp++;
@@ -189,7 +189,7 @@ finish:
DviPageSpec *mdvi_parse_page_spec(const char *format)
{
- /*
+ /*
* a page specification looks like this:
* '{'RANGE_SPEC'}' for a DVI spec
* '{'RANGE_SPEC'}' '.' ... for a TeX spec
@@ -199,7 +199,7 @@ DviPageSpec *mdvi_parse_page_spec(const char *format)
int count;
int i;
char *ptr;
-
+
spec = xnalloc(struct _DviPageSpec *, 11);
for(i = 0; i < 11; i++)
spec[i] = NULL;
@@ -214,7 +214,7 @@ DviPageSpec *mdvi_parse_page_spec(const char *format)
}
} else
range = NULL;
-
+
if(*format == 'D' || *format == 'd' || *ptr != '.')
i = 0;
else
@@ -226,13 +226,13 @@ DviPageSpec *mdvi_parse_page_spec(const char *format)
spec[i]->nranges = count;
} else
spec[i] = NULL;
-
+
if(*ptr != '.') {
if(*ptr)
mdvi_warning(_("garbage after DVI page specification ignored\n"));
return spec;
}
-
+
for(i++; *ptr == '.' && i <= 10; i++) {
ptr++;
if(*ptr == '*') {
@@ -240,7 +240,7 @@ DviPageSpec *mdvi_parse_page_spec(const char *format)
range = NULL;
} else {
char *end;
-
+
range = mdvi_parse_range(ptr, NULL, &count, &end);
if(end == ptr) {
if(range) mdvi_free(range);
@@ -255,13 +255,13 @@ DviPageSpec *mdvi_parse_page_spec(const char *format)
} else
spec[i] = NULL;
}
-
+
if(i > 10)
mdvi_warning(_("more than 10 counters in page specification\n"));
else if(*ptr)
mdvi_warning(_("garbage after TeX page specification ignored\n"));
-
- return spec;
+
+ return spec;
}
/* returns non-zero if the given page is included by `spec' */
@@ -269,11 +269,11 @@ int mdvi_page_selected(DviPageSpec *spec, PageNum page, int dvipage)
{
int i;
int not_found;
-
+
if(spec == NULL)
return 1;
if(spec[0]) {
- not_found = mdvi_in_range(spec[0]->ranges,
+ not_found = mdvi_in_range(spec[0]->ranges,
spec[0]->nranges, dvipage);
if(not_found < 0)
return 0;
@@ -281,7 +281,7 @@ int mdvi_page_selected(DviPageSpec *spec, PageNum page, int dvipage)
for(i = 1; i <= 10; i++) {
if(spec[i] == NULL)
continue;
- not_found = mdvi_in_range(spec[i]->ranges,
+ not_found = mdvi_in_range(spec[i]->ranges,
spec[i]->nranges, (int)page[i]);
if(not_found < 0)
return 0;
@@ -292,7 +292,7 @@ int mdvi_page_selected(DviPageSpec *spec, PageNum page, int dvipage)
void mdvi_free_page_spec(DviPageSpec *spec)
{
int i;
-
+
for(i = 0; i < 11; i++)
if(spec[i]) {
mdvi_free(spec[i]->ranges);
@@ -304,7 +304,7 @@ void mdvi_free_page_spec(DviPageSpec *spec)
int mdvi_in_range(DviRange *range, int nitems, int value)
{
DviRange *r;
-
+
for(r = range; r < range + nitems; r++) {
int cond;
@@ -330,7 +330,7 @@ int mdvi_in_range(DviRange *range, int nitems, int value)
return (r - range);
break;
case MDVI_RANGE_UPPER:
- if(value == r->to)
+ if(value == r->to)
return (r - range);
if(r->step < 0)
cond = (value > r->to);
@@ -352,12 +352,12 @@ int mdvi_range_length(DviRange *range, int nitems)
{
int count = 0;
DviRange *r;
-
+
for(r = range; r < range + nitems; r++) {
int n;
if(r->type != MDVI_RANGE_BOUNDED)
- return -2;
+ return -2;
n = (r->to - r->from) / r->step;
if(n < 0)
n = 0;
@@ -395,7 +395,7 @@ int main()
#if 0
char buf[256];
DviRange limit;
-
+
limit.from = 0;
limit.to = 100;
limit.step = 2;
@@ -405,7 +405,7 @@ int main()
char *end;
int count;
int i;
-
+
printf("Range> "); fflush(stdout);
if(fgets(buf, 256, stdin) == NULL)
break;
@@ -419,20 +419,20 @@ int main()
printf("range is empty\n");
continue;
}
-
+
for(i = 0; i < count; i++) {
- printf("Range %d (%d elements):\n",
+ printf("Range %d (%d elements):\n",
i, mdvi_range_length(&range[i], 1));
print_range(&range[i]);
}
if(end && *end)
printf("Tail: [%s]\n", end);
- printf("range has %d elements\n",
+ printf("range has %d elements\n",
mdvi_range_length(range, count));
#if 1
while(1) {
int v;
-
+
printf("Value: "); fflush(stdout);
if(fgets(buf, 256, stdin) == NULL)
break;
@@ -455,7 +455,7 @@ int main()
#else
DviPageSpec *spec;
char buf[256];
-
+
while(1) {
printf("Spec> "); fflush(stdout);
if(fgets(buf, 256, stdin) == NULL)
@@ -469,13 +469,13 @@ int main()
printf("no spec parsed\n");
else {
int i;
-
+
printf("spec = ");
for(i = 0; i < 11; i++) {
printf("Counter %d:\n", i);
if(spec[i]) {
int k;
-
+
for(k = 0; k < spec[i]->nranges; k++)
print_range(&spec[i]->ranges[k]);
} else
diff --git a/backend/dvi/mdvi-lib/paper.c b/backend/dvi/mdvi-lib/paper.c
index 42cbcd3f..7ba454ab 100644
--- a/backend/dvi/mdvi-lib/paper.c
+++ b/backend/dvi/mdvi-lib/paper.c
@@ -75,7 +75,7 @@ static const DviPaperSpec papers[] = {
{"ledger", "17in", "11in"},
{"note", "7.5in", "10in"},
{"tabloid", "11in", "17in"},
- {"statement", "5.5in", "8.5in"},
+ {"statement", "5.5in", "8.5in"},
{0, 0, 0}
};
@@ -111,7 +111,7 @@ int mdvi_get_paper_size(const char *name, DviPaper *paper)
paper->name = _("custom");
return 0;
}
-
+
for(sp = &papers[0]; sp->name; sp++) {
if(!sp->width || !sp->height) {
paper->pclass = str2class(sp->name);
@@ -132,10 +132,10 @@ DviPaperSpec *mdvi_get_paper_specs(DviPaperClass pclass)
int i;
int first, count;
DviPaperSpec *spec, *ptr;
-
+
first = -1;
count = 0;
- if(pclass == MDVI_PAPER_CLASS_ANY ||
+ if(pclass == MDVI_PAPER_CLASS_ANY ||
pclass == MDVI_PAPER_CLASS_CUSTOM) {
first = 0;
count = (sizeof(papers) / sizeof(papers[0])) - 3;
diff --git a/backend/dvi/mdvi-lib/pk.c b/backend/dvi/mdvi-lib/pk.c
index 1b42a319..5e8da5bb 100644
--- a/backend/dvi/mdvi-lib/pk.c
+++ b/backend/dvi/mdvi-lib/pk.c
@@ -112,7 +112,7 @@ static char *pk_lookup(const char *name, Ushort *hdpi, Ushort *vdpi)
} else if(filename) {
*hdpi = *vdpi = type.dpi;
}
- return filename;
+ return filename;
}
static char *pk_lookupn(const char *name, Ushort *hdpi, Ushort *vdpi)
@@ -132,7 +132,7 @@ static char *pk_lookupn(const char *name, Ushort *hdpi, Ushort *vdpi)
} else if(filename) {
*hdpi = *vdpi = type.dpi;
}
- return filename;
+ return filename;
}
static inline int pk_get_nyb(FILE *p, pkread *pk)
@@ -140,10 +140,10 @@ static inline int pk_get_nyb(FILE *p, pkread *pk)
unsigned t;
int nb;
char c;
-
+
t = c = pk->currbyte;
nb = pk->nybpos;
-
+
switch(nb) {
case 0:
c = pk->currbyte = fuget1(p);
@@ -157,7 +157,7 @@ static inline int pk_get_nyb(FILE *p, pkread *pk)
return (t & 0xf);
}
-/*
+/*
* this is a bit cumbersome because we have to pass around
* the `pkread' data...
*/
@@ -165,7 +165,7 @@ static int pk_packed_num(FILE *p, pkread *pkr, int *repeat)
{
int i, j;
int dyn_f = pkr->dyn_f;
-
+
i = pk_get_nyb(p, pkr);
if(i == 0) {
do {
@@ -174,12 +174,12 @@ static int pk_packed_num(FILE *p, pkread *pkr, int *repeat)
} while(j == 0);
while(i-- > 0)
j = (j << 4) + pk_get_nyb(p, pkr);
- return (j - 15 + ((13 - dyn_f) << 4) +
+ return (j - 15 + ((13 - dyn_f) << 4) +
dyn_f);
} else if(i <= dyn_f)
return i;
else if(i < 14)
- return ((i - dyn_f - 1) << 4) +
+ return ((i - dyn_f - 1) << 4) +
pk_get_nyb(p, pkr) + dyn_f + 1;
else {
*repeat = 1;
@@ -198,7 +198,7 @@ static BITMAP *get_bitmap(FILE *p, int w, int h, int flags)
BITMAP *bm;
int bitpos;
int currch;
-
+
flags = 0; /* shut up that compiler */
bitpos = -1;
if((bm = bitmap_alloc(w, h)) == NULL)
@@ -209,7 +209,7 @@ static BITMAP *get_bitmap(FILE *p, int w, int h, int flags)
currch = 0;
for(i = 0; i < h; i++) {
BmUnit mask;
-
+
mask = FIRSTMASK;
for(j = 0; j < w; j++) {
if(bitpos < 0) {
@@ -238,7 +238,7 @@ static BITMAP *get_packed(FILE *p, int w, int h, int flags)
int repeat_count;
int paint;
pkread pkr;
-
+
pkr.nybpos = 0;
pkr.currbyte = 0;
pkr.dyn_f = PK_DYN_F(flags);
@@ -253,7 +253,7 @@ static BITMAP *get_packed(FILE *p, int w, int h, int flags)
w, h, flags));
while(row < h) {
int i = 0;
-
+
count = pk_packed_num(p, &pkr, &i);
if(i > 0) {
if(repeat_count)
@@ -261,11 +261,11 @@ static BITMAP *get_packed(FILE *p, int w, int h, int flags)
repeat_count, i);
repeat_count = i;
}
-
+
if(count >= inrow) {
Uchar *r, *t;
BmUnit *a, mask;
-
+
/* first finish current row */
if(paint)
bitmap_set_row(bm, row, w - inrow, inrow, paint);
@@ -369,11 +369,11 @@ static int pk_load_font(DviParams *unused, DviFont *font)
fuget4(p);
fuget4(p);
if(feof(p))
- goto badpk;
+ goto badpk;
/* now start reading the font */
loc = 256; hic = -1; maxch = 256;
-
+
/* initialize alpha and beta for TFM width computation */
TFMPREPARE(font->scale, z, alpha, beta);
@@ -389,7 +389,7 @@ static int pk_load_font(DviParams *unused, DviFont *font)
#ifndef NODEBUG
char *t;
int n;
-
+
i = fugetn(p, flag_byte - PK_X1 + 1);
if(i < 256)
t = &s[0];
@@ -428,7 +428,7 @@ static int pk_load_font(DviParams *unused, DviFont *font)
int x, y;
int offset;
long tfm;
-
+
switch(flag_byte & 0x7) {
case 7:
pl = fuget4(p);
@@ -438,13 +438,13 @@ static int pk_load_font(DviParams *unused, DviFont *font)
fsget4(p); /* skip dx */
fsget4(p); /* skip dy */
w = fuget4(p);
- h = fuget4(p);
+ h = fuget4(p);
x = fsget4(p);
y = fsget4(p);
break;
case 4:
case 5:
- case 6:
+ case 6:
pl = (flag_byte % 4) * 65536 + fuget2(p);
cc = fuget1(p);
offset = ftell(p) + pl;
@@ -484,7 +484,7 @@ static int pk_load_font(DviParams *unused, DviFont *font)
if(cc > hic)
hic = cc;
if(cc > maxch) {
- font->chars = xresize(font->chars,
+ font->chars = xresize(font->chars,
DviFontChar, cc + 16);
for(i = maxch; i < cc + 16; i++)
font->chars[i].offset = 0;
@@ -523,13 +523,13 @@ static int pk_load_font(DviParams *unused, DviFont *font)
/* resize font char data */
if(loc > 0 || hic < maxch-1) {
- memmove(font->chars, font->chars + loc,
+ memmove(font->chars, font->chars + loc,
(hic - loc + 1) * sizeof(DviFontChar));
font->chars = xresize(font->chars,
DviFontChar, hic - loc + 1);
}
font->loc = loc;
- font->hic = hic;
+ font->hic = hic;
return 0;
badpk:
@@ -547,7 +547,7 @@ static int pk_font_get_glyph(DviParams *params, DviFont *font, int code)
if((ch = FONTCHAR(font, code)) == NULL)
return -1;
-
+
if(ch->offset == 0)
return -1;
DEBUG((DBG_GLYPHS, "(pk) loading glyph for character %d (%dx%d) in font `%s'\n",
@@ -561,11 +561,11 @@ static int pk_font_get_glyph(DviParams *params, DviFont *font, int code)
ch->glyph.w = ch->width;
ch->glyph.h = ch->height;
ch->glyph.data = NULL;
- return 0;
+ return 0;
}
if(fseek(font->in, ch->offset, SEEK_SET) == -1)
return -1;
- ch->glyph.data = get_char(font->in,
+ ch->glyph.data = get_char(font->in,
ch->width, ch->height, ch->flags);
if(ch->glyph.data) {
/* restore original settings */
diff --git a/backend/dvi/mdvi-lib/setup.c b/backend/dvi/mdvi-lib/setup.c
index ba0c545d..881bed50 100644
--- a/backend/dvi/mdvi-lib/setup.c
+++ b/backend/dvi/mdvi-lib/setup.c
@@ -25,7 +25,7 @@
#include "mdvi.h"
#include "private.h"
-void mdvi_init_kpathsea(const char *program,
+void mdvi_init_kpathsea(const char *program,
const char *mfmode, const char *font, int dpi,
const char *texmfcnf)
{
@@ -33,7 +33,7 @@ void mdvi_init_kpathsea(const char *program,
/* Stop meaningless output generation. */
kpse_make_tex_discard_errors = FALSE;
-
+
p = strrchr(program, '/');
p = (p ? p + 1 : program);
kpse_set_program_name(program, p);
diff --git a/backend/dvi/mdvi-lib/sp-epsf.c b/backend/dvi/mdvi-lib/sp-epsf.c
index 4f1b49cb..104c955b 100644
--- a/backend/dvi/mdvi-lib/sp-epsf.c
+++ b/backend/dvi/mdvi-lib/sp-epsf.c
@@ -53,7 +53,7 @@ typedef struct {
void epsf_special __PROTO((DviContext *dvi, char *prefix, char *arg));
/* Note: the given strings are modified in place */
-static char *parse_epsf_special(EpsfBox *box, char **ret,
+static char *parse_epsf_special(EpsfBox *box, char **ret,
char *prefix, char *arg)
{
static struct {
@@ -90,11 +90,11 @@ static char *parse_epsf_special(EpsfBox *box, char **ret,
double vsize;
double hscale;
double vscale;
-
+
/* this special has the form
* ["]file.ps["] [key=valye]*
*/
-
+
/* scan the filename */
while(*arg == ' ' || *arg == '\t')
arg++;
@@ -116,7 +116,7 @@ static char *parse_epsf_special(EpsfBox *box, char **ret,
value[i] = atof(keys[i].value);
present[i] = 0;
}
-
+
buff_init(&buffer);
buff_add(&buffer, "@beginspecial ", 0);
@@ -128,13 +128,13 @@ static char *parse_epsf_special(EpsfBox *box, char **ret,
while(*ptr == ' ' || *ptr == '\t')
ptr++;
keyname = ptr;
-
+
/* get the whole key=value pair */
for(; *ptr && *ptr != ' ' && *ptr != '\t'; ptr++);
-
+
if(*ptr) *ptr++ = 0;
/* now we shouldn't touch `ptr' anymore */
-
+
/* now work on this pair */
p = strchr(keyname, '=');
if(p == NULL)
@@ -174,18 +174,18 @@ static char *parse_epsf_special(EpsfBox *box, char **ret,
}
if(val)
value[i] = atof(val);
-
+
/* put the argument */
buff_add(&buffer, val, 0);
buff_add(&buffer, " @", 2);
buff_add(&buffer, keyname, 0);
buff_add(&buffer, " ", 1);
-
+
/* remember that this option was given */
present[i] = 0xff;
}
buff_add(&buffer, " @setspecial", 0);
-
+
/* now compute the bounding box (code comes from dvips) */
originx = 0;
originy = 0;
@@ -193,7 +193,7 @@ static char *parse_epsf_special(EpsfBox *box, char **ret,
vscale = 1;
hsize = 0;
vsize = 0;
-
+
if(present[HSIZE])
hsize = value[HSIZE];
if(present[VSIZE])
@@ -220,7 +220,7 @@ static char *parse_epsf_special(EpsfBox *box, char **ret,
vscale = value[RHI] / (10.0 * vsize);
}
}
-
+
box->ox = originx;
box->oy = originy;
box->bw = hsize * hscale;
@@ -228,7 +228,7 @@ static char *parse_epsf_special(EpsfBox *box, char **ret,
box->angle = value[ANGLE];
*ret = buffer.data;
-
+
return filename;
}
@@ -243,7 +243,7 @@ void epsf_special(DviContext *dvi, char *prefix, char *arg)
int w, h;
double xf, vf;
struct stat buf;
-
+
file = parse_epsf_special(&box, &special, prefix, arg);
if (file != NULL)
mdvi_free (special);
@@ -272,7 +272,7 @@ void epsf_special(DviContext *dvi, char *prefix, char *arg)
if (tmp) { /* Document directory */
int path_len = strlen (dvi->filename) - strlen (tmp + 1);
int file_len = strlen (file);
-
+
psfile = mdvi_malloc (path_len + file_len + 1);
psfile[0] = '\0';
strncat (psfile, dvi->filename, path_len);
@@ -287,7 +287,7 @@ void epsf_special(DviContext *dvi, char *prefix, char *arg)
mdvi_free (psfile);
}
-
+
psfile = mdvi_build_path_from_cwd (file);
if (stat (psfile, &buf) == 0) { /* Current working dir */
dvi->device.draw_ps (dvi, psfile, x, y, w, h);
@@ -297,7 +297,7 @@ void epsf_special(DviContext *dvi, char *prefix, char *arg)
}
mdvi_free (psfile);
-
+
psfile = kpse_find_pict (file);
if (psfile) { /* kpse */
dvi->device.draw_ps (dvi, psfile, x, y, w, h);
diff --git a/backend/dvi/mdvi-lib/special.c b/backend/dvi/mdvi-lib/special.c
index e4832544..e1f1a618 100644
--- a/backend/dvi/mdvi-lib/special.c
+++ b/backend/dvi/mdvi-lib/special.c
@@ -39,7 +39,7 @@ typedef struct _DviSpecial {
#endif
DviSpecialHandler handler;
} DviSpecial;
-
+
static ListHead specials = {NULL, NULL, 0};
#define SPECIAL(x) \
@@ -65,7 +65,7 @@ static void register_builtin_specials(void)
{
int i;
- ASSERT(registered_builtins == 0);
+ ASSERT(registered_builtins == 0);
registered_builtins = 1;
for(i = 0; i < NSPECIALS; i++)
mdvi_register_special(
@@ -79,7 +79,7 @@ static void register_builtin_specials(void)
static DviSpecial *find_special_prefix(const char *prefix)
{
DviSpecial *sp;
-
+
/* should have a hash table here, but I'm so lazy */
for(sp = (DviSpecial *)specials.head; sp; sp = sp->next) {
if(STRCEQ(sp->prefix, prefix))
@@ -88,7 +88,7 @@ static DviSpecial *find_special_prefix(const char *prefix)
return sp;
}
-int mdvi_register_special(const char *label, const char *prefix,
+int mdvi_register_special(const char *label, const char *prefix,
const char *regex, DviSpecialHandler handler, int replace)
{
DviSpecial *sp;
@@ -127,9 +127,9 @@ int mdvi_register_special(const char *label, const char *prefix,
sp->label = mdvi_strdup(label);
sp->plen = strlen(prefix);
if(newsp)
- listh_prepend(&specials, LIST(sp));
- DEBUG((DBG_SPECIAL,
- "New \\special handler `%s' with prefix `%s'\n",
+ listh_prepend(&specials, LIST(sp));
+ DEBUG((DBG_SPECIAL,
+ "New \\special handler `%s' with prefix `%s'\n",
label, prefix));
return 0;
}
@@ -137,8 +137,8 @@ int mdvi_register_special(const char *label, const char *prefix,
int mdvi_unregister_special(const char *prefix)
{
DviSpecial *sp;
-
- sp = find_special_prefix(prefix);
+
+ sp = find_special_prefix(prefix);
if(sp == NULL)
return -1;
mdvi_free(sp->prefix);
@@ -156,7 +156,7 @@ int mdvi_unregister_special(const char *prefix)
int mdvi_do_special(DviContext *dvi, char *string)
{
char *prefix;
- char *ptr;
+ char *ptr;
DviSpecial *sp;
if(!registered_builtins) {
@@ -170,7 +170,7 @@ int mdvi_do_special(DviContext *dvi, char *string)
string++;
DEBUG((DBG_SPECIAL, "Looking for a handler for `%s'\n", string));
-
+
/* now try to find a match */
ptr = string;
for(sp = (DviSpecial *)specials.head; sp; sp = sp->next) {
@@ -193,13 +193,13 @@ int mdvi_do_special(DviContext *dvi, char *string)
/* extract the prefix */
if(ptr == string) {
prefix = NULL;
- DEBUG((DBG_SPECIAL,
+ DEBUG((DBG_SPECIAL,
"REGEX match with `%s' (arg `%s')\n",
sp->label, ptr));
} else {
if(*ptr) *ptr++ = 0;
prefix = string;
- DEBUG((DBG_SPECIAL,
+ DEBUG((DBG_SPECIAL,
"PREFIX match with `%s' (prefix `%s', arg `%s')\n",
sp->label, prefix, ptr));
}
@@ -213,8 +213,8 @@ int mdvi_do_special(DviContext *dvi, char *string)
void mdvi_flush_specials(void)
{
DviSpecial *sp, *list;
-
-
+
+
for(list = (DviSpecial *)specials.head; (sp = list); ) {
list = sp->next;
if(sp->prefix) mdvi_free(sp->prefix);
diff --git a/backend/dvi/mdvi-lib/sysdeps.h b/backend/dvi/mdvi-lib/sysdeps.h
index c77d7651..3955c0dd 100644
--- a/backend/dvi/mdvi-lib/sysdeps.h
+++ b/backend/dvi/mdvi-lib/sysdeps.h
@@ -18,7 +18,7 @@
#ifndef _SYSDEP_H
#define _SYSDEP_H 1
-/*
+/*
* The purpose of this file is to define symbols that describe the
* system-dependent features we use. Namely, byte order, native integer
* types of various sizes, and safe pointer<->integer conversion.
@@ -75,7 +75,7 @@ typedef short Int16;
#endif /* SIZEOF_INT != 2 */
#endif /* SIZEOF_SHORT != 2 */
-/*
+/*
* An integer type to convert to and from pointers safely. All we do here is
* look for an integer type with the same size as a pointer.
*/
diff --git a/backend/dvi/mdvi-lib/t1.c b/backend/dvi/mdvi-lib/t1.c
index d63f055c..12bb01fa 100644
--- a/backend/dvi/mdvi-lib/t1.c
+++ b/backend/dvi/mdvi-lib/t1.c
@@ -16,7 +16,7 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
-/*
+/*
* Type1 font support for MDVI
*
* We use T1lib only as a rasterizer, not to draw glyphs.
@@ -37,7 +37,7 @@ typedef struct t1info {
struct t1info *next;
struct t1info *prev;
char *fontname; /* (short) name of this font */
- int t1id; /* T1lib's id for this font */
+ int t1id; /* T1lib's id for this font */
int hasmetrics; /* have we processed this font? */
TFMInfo *tfminfo; /* TFM data is shared */
DviFontMapInfo mapinfo;
@@ -47,7 +47,7 @@ typedef struct t1info {
static void t1_font_remove __PROTO((T1Info *));
static int t1_load_font __PROTO((DviParams *, DviFont *));
static int t1_font_get_glyph __PROTO((DviParams *, DviFont *, int));
-static void t1_font_shrink_glyph
+static void t1_font_shrink_glyph
__PROTO((DviContext *, DviFont *, DviFontChar *, DviGlyph *));
static void t1_free_data __PROTO((DviFont *));
static void t1_reset_font __PROTO((DviFont *));
@@ -79,10 +79,10 @@ static int t1lib_ydpi = -1;
static ListHead t1fonts = {NULL, NULL, 0};
static DviHashTable t1hash;
-/* Type1 fonts need their own `lookup' function. Here is how it works:
+/* Type1 fonts need their own `lookup' function. Here is how it works:
* First we try to find the font by its given name. If that fails, we
* query the font maps. A typical font map entry may contain the line
- *
+ *
* ptmr8rn Times-Roman ".82 ExtendFont TeXBase1Encoding ReEncodeFont" <8r.enc <ptmr
*
* which means: If you're looking for the font `ptmr8rn' load `Times-Roman'
@@ -112,13 +112,13 @@ char *t1_lookup_font(const char *name, Ushort *hdpi, Ushort *vdpi)
return filename;
}
- DEBUG((DBG_TYPE1, "(t1) %s: not found, querying font maps\n", name));
+ DEBUG((DBG_TYPE1, "(t1) %s: not found, querying font maps\n", name));
/* now query the fontmap */
if(mdvi_query_fontmap(&info, name) < 0) {
/* it's not there either */
return NULL;
}
-
+
/* check what we got */
if(info.fullfile) {
DEBUG((DBG_TYPE1, "(t1) %s: found `%s' (cached)\n",
@@ -126,15 +126,15 @@ char *t1_lookup_font(const char *name, Ushort *hdpi, Ushort *vdpi)
/* this is a cached lookup */
return mdvi_strdup(info.fullfile);
}
-
+
/* no file associated to this font? */
if(info.fontfile == NULL)
return info.psname ? mdvi_ps_find_font(info.psname) : NULL;
-
+
/* let's extract the extension */
ext = file_extension(info.fontfile);
if(ext && !STREQ(ext, "pfa") && !STREQ(ext, "pfb")) {
- DEBUG((DBG_TYPE1,
+ DEBUG((DBG_TYPE1,
"(t1) %s: associated name `%s' is not Type1\n",
name, info.fontfile));
/* it's not a Type1 font */
@@ -160,7 +160,7 @@ char *t1_lookup_font(const char *name, Ushort *hdpi, Ushort *vdpi)
DEBUG((DBG_TYPE1, "(t1) %s: not found\n", name));
return NULL;
}
-
+
DEBUG((DBG_TYPE1, "(t1) %s: found as `%s'\n", name, filename));
/* got it! let's remember this */
mdvi_add_fontmap_file(name, filename);
@@ -178,7 +178,7 @@ static void t1_reset_resolution(int xdpi, int ydpi)
nfonts = T1_Get_no_fonts();
#else
nfonts = T1_GetNoFonts();
-#endif
+#endif
for(i = 0; i < nfonts; i++)
T1_DeleteAllSizes(i);
@@ -186,7 +186,7 @@ static void t1_reset_resolution(int xdpi, int ydpi)
if(T1_SetDeviceResolutions((float)xdpi, (float)ydpi) < 0)
mdvi_warning(_("(t1) failed to reset device resolution\n"));
else
- DEBUG((DBG_TYPE1,
+ DEBUG((DBG_TYPE1,
"(t1) reset successful, new resolution is (%d, %d)\n",
xdpi, ydpi));
t1lib_xdpi = xdpi;
@@ -196,7 +196,7 @@ static void t1_reset_resolution(int xdpi, int ydpi)
static void t1_reset_font(DviFont *font)
{
T1Info *info = (T1Info *)font->private;
-
+
if(info == NULL)
return;
DEBUG((DBG_FONTS, "(t1) resetting font `%s'\n", font->fontname));
@@ -215,19 +215,19 @@ static void t1_transform_font(T1Info *info)
mdvi_warning(_("%s: could not encode font\n"), info->fontname);
}
if(info->mapinfo.slant) {
- DEBUG((DBG_TYPE1, "(t1) %s: slanting by %.3f\n",
+ DEBUG((DBG_TYPE1, "(t1) %s: slanting by %.3f\n",
info->fontname,
MDVI_FMAP_SLANT(&info->mapinfo)));
- T1_SlantFont(info->t1id,
+ T1_SlantFont(info->t1id,
MDVI_FMAP_SLANT(&info->mapinfo));
}
if(info->mapinfo.extend) {
DEBUG((DBG_TYPE1, "(t1) %s: extending by %.3f\n",
info->fontname,
MDVI_FMAP_EXTEND(&info->mapinfo)));
- T1_ExtendFont(info->t1id,
+ T1_ExtendFont(info->t1id,
MDVI_FMAP_EXTEND(&info->mapinfo));
- }
+ }
}
/* if this function is called, we really need this font */
@@ -257,7 +257,7 @@ static int t1_really_load_font(DviParams *params, DviFont *font, T1Info *info)
* data for it */
info->tfminfo = mdvi_ps_get_metrics(info->fontname);
if(info->tfminfo == NULL) {
- DEBUG((DBG_FONTS,
+ DEBUG((DBG_FONTS,
"(t1) %s: no metric data, font ignored\n",
info->fontname));
goto t1_error;
@@ -274,7 +274,7 @@ static int t1_really_load_font(DviParams *params, DviFont *font, T1Info *info)
if(old && old->t1id != -1) {
/* let's take advantage of T1lib's font sharing */
t1id = T1_CopyFont(old->t1id);
- DEBUG((DBG_TYPE1, "(t1) %s -> %d (CopyFont)\n",
+ DEBUG((DBG_TYPE1, "(t1) %s -> %d (CopyFont)\n",
info->fontname, t1id));
copied = 1;
} else {
@@ -287,7 +287,7 @@ static int t1_really_load_font(DviParams *params, DviFont *font, T1Info *info)
goto t1_error;
info->t1id = t1id;
- /*
+ /*
* a minor optimization: If the old font in the hash table has
* not been loaded yet, replace it by this one, so we can use
* CopyFont later.
@@ -296,7 +296,7 @@ static int t1_really_load_font(DviParams *params, DviFont *font, T1Info *info)
DEBUG((DBG_TYPE1, "(t1) font `%s' exchanged in hash table\n",
info->fontname));
mdvi_hash_remove(&t1hash, (unsigned char *)old->fontname);
- mdvi_hash_add(&t1hash, (unsigned char *)info->fontname,
+ mdvi_hash_add(&t1hash, (unsigned char *)info->fontname,
info, MDVI_HASH_UNCHECKED);
}
@@ -323,7 +323,7 @@ static int t1_really_load_font(DviParams *params, DviFont *font, T1Info *info)
/* get the scaled characters metrics */
get_tfm_chars(params, font, info->tfminfo, 0);
info->hasmetrics = 1;
-
+
DEBUG((DBG_TYPE1, "(t1) font `%s' really-loaded\n", info->fontname));
return 0;
@@ -331,7 +331,7 @@ t1_error:
/* some error does not allows us to use this font. We need to reset
* the font structure, so the font system can try to read this
* font in a different class */
-
+
/* first destroy the private data */
t1_font_remove(info);
/* now reset all chars -- this is the important part */
@@ -365,7 +365,7 @@ static int init_t1lib(DviParams *params)
mdvi_hash_init(&t1hash);
DEBUG((DBG_TYPE1, "(t1) t1lib %s initialized -- resolution is (%d, %d), pad is %d bits\n",
T1_GetLibIdent(), params->dpi, params->vdpi, T1_GetBitmapPad()));
- t1lib_initialized = 1;
+ t1lib_initialized = 1;
t1lib_xdpi = params->dpi;
t1lib_ydpi = params->vdpi;
return 0;
@@ -375,7 +375,7 @@ static int t1_load_font(DviParams *params, DviFont *font)
{
T1Info *info;
int i;
-
+
if(t1lib_initialized < 0)
return -1;
else if(t1lib_initialized == 0 && init_t1lib(params) < 0)
@@ -389,7 +389,7 @@ static int t1_load_font(DviParams *params, DviFont *font)
info = xalloc(T1Info);
- /*
+ /*
* mark the font as `unregistered' with T1lib. It will
* be added when we actually use it
*/
@@ -405,15 +405,15 @@ static int t1_load_font(DviParams *params, DviFont *font)
info->mapinfo.extend = 0;
info->mapinfo.slant = 0;
info->encoding = NULL;
-
+
/* create the hash table if we have not done so yet */
if(t1hash.nbucks == 0)
mdvi_hash_create(&t1hash, T1_HASH_SIZE);
- mdvi_hash_add(&t1hash, (unsigned char *) info->fontname, info, MDVI_HASH_UNIQUE);
+ mdvi_hash_add(&t1hash, (unsigned char *) info->fontname, info, MDVI_HASH_UNIQUE);
listh_append(&t1fonts, LIST(info));
font->private = info;
-
+
/* reset everything */
font->chars = xnalloc(DviFontChar, 256);
font->loc = 0;
@@ -426,7 +426,7 @@ static int t1_load_font(DviParams *params, DviFont *font)
font->chars[i].shrunk.data = NULL;
font->chars[i].grey.data = NULL;
}
-
+
return 0;
}
@@ -438,7 +438,7 @@ static int t1_load_font(DviParams *params, DviFont *font)
static inline BITMAP *t1_glyph_bitmap(GLYPH *glyph)
{
int w, h, pad;
-
+
w = GLYPH_WIDTH(glyph);
h = GLYPH_HEIGHT(glyph);
@@ -455,12 +455,12 @@ static void t1_font_shrink_glyph(DviContext *dvi, DviFont *font, DviFontChar *ch
GLYPH *glyph;
T1Info *info;
T1_TMATRIX matrix;
-
+
info = (T1Info *)font->private;
ASSERT(info != NULL);
DEBUG((DBG_TYPE1, "(t1) shrinking glyph for character %d in `%s' (%d,%d)\n",
- ch->code, font->fontname, ch->width, ch->height));
+ ch->code, font->fontname, ch->width, ch->height));
size = (double)font->scale / (dvi->params.tfm_conv * 0x100000);
size = 72.0 * size / 72.27;
matrix.cxx = 1.0/(double)dvi->params.hshrink;
@@ -477,7 +477,7 @@ static void t1_font_shrink_glyph(DviContext *dvi, DviFont *font, DviFontChar *ch
#ifndef NODEBUG
if(DEBUGGING(BITMAP_DATA)) {
- DEBUG((DBG_BITMAP_DATA,
+ DEBUG((DBG_BITMAP_DATA,
"(t1) %s: t1_shrink_glyph(%d): (%dw,%dh,%dx,%dy) -> (%dw,%dh,%dx,%dy)\n",
ch->glyph.w, ch->glyph.h, ch->glyph.x, ch->glyph.y,
dest->w, dest->h, dest->x, dest->y));
@@ -497,11 +497,11 @@ static int t1_font_get_glyph(DviParams *params, DviFont *font, int code)
double size;
T1_TMATRIX matrix;
int dpi;
-
+
ASSERT(info != NULL);
if(!info->hasmetrics && t1_really_load_font(params, font, info) < 0)
return -1;
- ch = FONTCHAR(font, code);
+ ch = FONTCHAR(font, code);
if(!ch || !glyph_present(ch))
return -1;
ch->loaded = 1;
@@ -522,7 +522,7 @@ static int t1_font_get_glyph(DviParams *params, DviFont *font, int code)
size = 72.0 * size / 72.27;
dpi = Max(font->hdpi, font->vdpi);
- /* we don't want the glyph to be cached twice (once by us, another by
+ /* we don't want the glyph to be cached twice (once by us, another by
* T1lib), so we use an identity matrix to tell T1lib not to keep the
* glyph around */
matrix.cxx = (double)font->hdpi / dpi;
@@ -545,21 +545,21 @@ static int t1_font_get_glyph(DviParams *params, DviFont *font, int code)
ch->glyph.w = GLYPH_WIDTH(glyph);
ch->glyph.h = GLYPH_HEIGHT(glyph);
- /* let's also fix the glyph's origin
+ /* let's also fix the glyph's origin
* (which is not contained in the TFM) */
ch->x = ch->glyph.x;
ch->y = ch->glyph.y;
/* let's fix these too */
ch->width = ch->glyph.w;
ch->height = ch->glyph.h;
-
+
return 0;
}
static void t1_font_remove(T1Info *info)
{
T1Info *old;
-
+
/* first remove it from our list */
listh_remove(&t1fonts, LIST(info));
@@ -567,13 +567,13 @@ static void t1_font_remove(T1Info *info)
old = (T1Info *)mdvi_hash_lookup(&t1hash, (unsigned char *)info->fontname);
if(old == info) {
mdvi_hash_remove(&t1hash, (unsigned char *) info->fontname);
- /* go through the list and see if there is another
+ /* go through the list and see if there is another
* font with this name */
for(old = (T1Info *)t1fonts.head; old; old = old->next)
if(STREQ(old->fontname, info->fontname))
break;
if(old != NULL)
- mdvi_hash_add(&t1hash, (unsigned char *) old->fontname, old,
+ mdvi_hash_add(&t1hash, (unsigned char *) old->fontname, old,
MDVI_HASH_UNCHECKED);
}
/* release our encoding vector */
@@ -603,17 +603,17 @@ static void t1_free_data(DviFont *font)
/* called after all the glyphs are destroyed */
if(font->private == NULL) {
- /* this is perfectly normal, it just means the font has
+ /* this is perfectly normal, it just means the font has
* not been requested by MDVI yet */
return;
}
-
+
/* destroy this data */
t1_font_remove((T1Info *)font->private);
font->private = NULL;
- /*
+ /*
* if this is the last T1 font, reset the T1 library
* It is important that we do this, because this is will be called
* when the resolution or the magnification changes.
diff --git a/backend/dvi/mdvi-lib/tfm.c b/backend/dvi/mdvi-lib/tfm.c
index f37de0be..f87140d2 100644
--- a/backend/dvi/mdvi-lib/tfm.c
+++ b/backend/dvi/mdvi-lib/tfm.c
@@ -74,7 +74,7 @@ DviFontInfo afm_font_info = {
#define TYPENAME(font) \
((font)->search.info ? (font)->search.info : "none")
-/*
+/*
* Although it does not seem that way, this conversion is independent of the
* shrinking factors, within roundoff (that's because `conv' and `vconv'
* have already been scaled by hshrink and vshrink, repsectively). We
@@ -91,14 +91,14 @@ int get_tfm_chars(DviParams *params, DviFont *font, TFMInfo *info, int loaded)
int n;
DviFontChar *ch;
TFMChar *ptr;
-
+
n = info->hic - info->loc + 1;
if(n != FONT_GLYPH_COUNT(font)) {
font->chars = mdvi_realloc(font->chars,
n * sizeof(DviFontChar));
}
font->loc = info->loc;
- font->hic = info->hic;
+ font->hic = info->hic;
ch = font->chars;
ptr = info->chars;
@@ -120,14 +120,14 @@ int get_tfm_chars(DviParams *params, DviFont *font, TFMInfo *info, int loaded)
c = TFMSCALE(z, ptr->height, alpha, beta);
d = TFMSCALE(z, ptr->depth, alpha, beta);
- /* now convert to unscaled pixels */
+ /* now convert to unscaled pixels */
ch->width = XCONV(b - a);
ch->height = YCONV(c - d);
if(ch->height < 0) ch->height = -ch->height;
ch->x = XCONV(a);
ch->y = YCONV(c);
/*
- * the offset is not used, but we might as well set it to
+ * the offset is not used, but we might as well set it to
* something meaningful (and it MUST be non-zero)
*/
ch->flags = 0;
@@ -173,10 +173,10 @@ static int tfm_load_font(DviParams *params, DviFont *font)
tfm = get_font_metrics(font->fontname, type, font->filename);
if(tfm == NULL)
return -1;
-
+
if(tfm->checksum && font->checksum && tfm->checksum != font->checksum) {
mdvi_warning(_("%s: Checksum mismatch (got %u, expected %u)\n"),
- font->fontname, (unsigned)tfm->checksum,
+ font->fontname, (unsigned)tfm->checksum,
(unsigned)font->checksum);
}
font->checksum = tfm->checksum;
@@ -185,17 +185,17 @@ static int tfm_load_font(DviParams *params, DviFont *font)
font->hic = 0;
font->chars = NULL;
get_tfm_chars(params, font, tfm, 1);
-
+
/* free everything */
free_font_metrics(tfm);
-
+
return 0;
}
static int tfm_font_get_glyph(DviParams *params, DviFont *font, int code)
{
DviFontChar *ch;
-
+
ch = FONTCHAR(font, code);
if(!glyph_present(ch))
return -1;
@@ -203,9 +203,9 @@ static int tfm_font_get_glyph(DviParams *params, DviFont *font, int code)
ch->glyph.y = ch->y;
ch->glyph.w = ch->width;
ch->glyph.h = ch->height;
- /*
+ /*
* This has two purposes: (1) avoid unnecessary calls to this function,
- * and (2) detect when the glyph data for a TFM font is actually used
+ * and (2) detect when the glyph data for a TFM font is actually used
* (we'll get a SEGV). Any occurrence of that is a bug.
*/
ch->glyph.data = MDVI_GLYPH_EMPTY;
diff --git a/backend/dvi/mdvi-lib/tfmfile.c b/backend/dvi/mdvi-lib/tfmfile.c
index c23d9fe0..f7ba251f 100644
--- a/backend/dvi/mdvi-lib/tfmfile.c
+++ b/backend/dvi/mdvi-lib/tfmfile.c
@@ -51,7 +51,7 @@ static DviHashTable tfmhash;
static inline void swap_array(Uint32 *ptr, int n)
{
Uint32 i;
-
+
while(n-- > 0) {
i = *ptr;
*ptr++ = ((i & 0xff000000) >> 24)
@@ -80,7 +80,7 @@ int afm_load_file(const char *filename, TFMInfo *info)
int status;
CharMetricInfo *cm;
FILE *in;
-
+
in = fopen(filename, "rb");
if(in == NULL)
return -1;
@@ -91,7 +91,7 @@ int afm_load_file(const char *filename, TFMInfo *info)
mdvi_error(_("%s: Error reading AFM data\n"), filename);
return -1;
}
-
+
/* aim high */
info->chars = xnalloc(TFMChar, 256);
info->loc = 256;
@@ -106,7 +106,7 @@ int afm_load_file(const char *filename, TFMInfo *info)
for(cm = fi->cmi; cm < fi->cmi + fi->numOfChars; cm++) {
int code;
TFMChar *ch;
-
+
code = cm->code;
if(code < 0 || code > 255)
continue; /* ignore it */
@@ -179,7 +179,7 @@ int tfm_load_file(const char *filename, TFMInfo *info)
/* allocate a word-aligned buffer to hold the file */
size = 4 * ROUND(st.st_size, 4);
if(size != st.st_size)
- mdvi_warning(_("Warning: TFM file `%s' has suspicious size\n"),
+ mdvi_warning(_("Warning: TFM file `%s' has suspicious size\n"),
filename);
tfm = (Uchar *)mdvi_malloc(size);
if(fread(tfm, st.st_size, 1, in) != 1)
@@ -190,12 +190,12 @@ int tfm_load_file(const char *filename, TFMInfo *info)
/* not a checksum, but serves a similar purpose */
checksum = 0;
-
+
ptr = tfm;
/* get the counters */
lf = muget2(ptr);
lh = muget2(ptr); checksum += 6 + lh;
- bc = muget2(ptr);
+ bc = muget2(ptr);
ec = muget2(ptr); checksum += ec - bc + 1;
nw = muget2(ptr); checksum += nw;
nh = muget2(ptr); checksum += nh;
@@ -213,7 +213,7 @@ int tfm_load_file(const char *filename, TFMInfo *info)
heights = cb; cb += nh;
depths = cb;
- if(widths[0] || heights[0] || depths[0] ||
+ if(widths[0] || heights[0] || depths[0] ||
checksum != lf || bc - 1 > ec || ec > 255 || ne > 256)
goto bad_tfm;
@@ -250,7 +250,7 @@ int tfm_load_file(const char *filename, TFMInfo *info)
ptr += n;
}
/* now we don't read from `ptr' anymore */
-
+
info->loc = bc;
info->hic = ec;
info->type = DviFontTFM;
@@ -285,7 +285,7 @@ int tfm_load_file(const char *filename, TFMInfo *info)
/* free everything */
mdvi_free(tfm);
-
+
return 0;
bad_tfm:
@@ -293,7 +293,7 @@ bad_tfm:
error:
if(tfm) mdvi_free(tfm);
if(in) fclose(in);
- return -1;
+ return -1;
}
static int ofm1_load_file(FILE *in, TFMInfo *info)
@@ -309,7 +309,7 @@ static int ofm1_load_file(FILE *in, TFMInfo *info)
Int32 *depths;
TFMChar *tch;
TFMChar *end;
-
+
lh = fuget4(in);
bc = fuget4(in);
ec = fuget4(in);
@@ -355,16 +355,16 @@ static int ofm1_load_file(FILE *in, TFMInfo *info)
/* jump to the beginning of the char-info table */
fseek(in, 4L*nco, SEEK_SET);
- size = ec - bc + 1;
+ size = ec - bc + 1;
info->loc = bc;
info->hic = ec;
info->chars = xnalloc(TFMChar, size);
end = info->chars + size;
-
+
for(tch = info->chars, i = 0; i < ncw; i++) {
TFMChar ch;
int nr;
-
+
/* in the characters we store the actual indices */
ch.advance = fuget2(in);
ch.height = fuget1(in);
@@ -383,7 +383,7 @@ static int ofm1_load_file(FILE *in, TFMInfo *info)
memcpy(tch++, &ch, sizeof(TFMChar));
if(tch == end)
goto bad_tfm;
- }
+ }
/* I wish we were done, but we aren't */
@@ -406,7 +406,7 @@ static int ofm1_load_file(FILE *in, TFMInfo *info)
if(widths[0] || heights[0] || depths[0])
goto bad_tfm;
-
+
/* now fix the characters */
size = ec - bc + 1;
for(tch = info->chars; tch < end; tch++) {
@@ -451,7 +451,7 @@ static int ofm_load_file(const char *filename, TFMInfo *info)
/* not a checksum, but serves a similar purpose */
checksum = 0;
-
+
/* get the counters */
/* get file level */
olevel = fsget2(in);
@@ -459,7 +459,7 @@ static int ofm_load_file(const char *filename, TFMInfo *info)
goto bad_tfm;
olevel = fsget2(in);
if(olevel != 0) {
- DEBUG((DBG_FONTS, "(mt) reading Level-1 OFM file `%s'\n",
+ DEBUG((DBG_FONTS, "(mt) reading Level-1 OFM file `%s'\n",
filename));
/* we handle level-1 files separately */
if(ofm1_load_file(in, info) < 0)
@@ -471,7 +471,7 @@ static int ofm_load_file(const char *filename, TFMInfo *info)
nwords = 14;
lf = fuget4(in); checksum = nwords;
lh = fuget4(in); checksum += lh;
- bc = fuget4(in);
+ bc = fuget4(in);
ec = fuget4(in); checksum += 2 * (ec - bc + 1);
nw = fuget4(in); checksum += nw;
nh = fuget4(in); checksum += nh;
@@ -482,7 +482,7 @@ static int ofm_load_file(const char *filename, TFMInfo *info)
checksum += 2*fuget4(in); /* skip extensible recipe count */
checksum += fuget4(in); /* skip # of font parameters */
- /* I have found several .ofm files that seem to have the
+ /* I have found several .ofm files that seem to have the
* font-direction word missing, so we try to detect that here */
if(checksum == lf + 1) {
DEBUG((DBG_FONTS, "(mt) font direction missing in `%s'\n",
@@ -553,12 +553,12 @@ static int ofm_load_file(const char *filename, TFMInfo *info)
}
/* from this point on, no error checking is done */
-
+
/* we don't need this anymore */
fclose(in);
/* now we don't read from `ptr' anymore */
-
+
info->loc = bc;
info->hic = ec;
info->type = DviFontTFM;
@@ -589,13 +589,13 @@ static int ofm_load_file(const char *filename, TFMInfo *info)
bad_tfm:
mdvi_error(_("%s: File corrupted, or not a TFM file\n"), filename);
fclose(in);
- return -1;
+ return -1;
}
char *lookup_font_metrics(const char *name, int *type)
{
char *file;
-
+
switch(*type) {
#ifndef WITH_AFM_FILES
case DviFontAny:
@@ -617,7 +617,7 @@ char *lookup_font_metrics(const char *name, int *type)
#ifdef WITH_AFM_FILES
case DviFontAFM:
file = kpse_find_file(name, kpse_afm_format, 0);
- break;
+ break;
case DviFontAny:
file = kpse_find_file(name, kpse_afm_format, 0);
*type = DviFontAFM;
@@ -634,8 +634,8 @@ char *lookup_font_metrics(const char *name, int *type)
return file;
}
-/*
- * The next two functions are just wrappers for the font metric loaders,
+/*
+ * The next two functions are just wrappers for the font metric loaders,
* and use the pool of TFM data
*/
@@ -652,9 +652,9 @@ TFMInfo *get_font_metrics(const char *short_name, int type, const char *filename
TFMPool *tfm = NULL;
int status;
char *file;
-
+
if(tfmpool.count) {
- tfm = (TFMPool *)mdvi_hash_lookup(&tfmhash,
+ tfm = (TFMPool *)mdvi_hash_lookup(&tfmhash,
MDVI_KEY(short_name));
if(tfm != NULL) {
DEBUG((DBG_FONTS, "(mt) reusing metric file `%s' (%d links)\n",
@@ -693,11 +693,11 @@ TFMInfo *get_font_metrics(const char *short_name, int type, const char *filename
return NULL;
}
tfm->short_name = mdvi_strdup(short_name);
-
+
/* add it to the pool */
if(tfmpool.count == 0)
mdvi_hash_create(&tfmhash, TFM_HASH_SIZE);
- mdvi_hash_add(&tfmhash, MDVI_KEY(tfm->short_name),
+ mdvi_hash_add(&tfmhash, MDVI_KEY(tfm->short_name),
tfm, MDVI_HASH_UNCHECKED);
listh_prepend(&tfmpool, LIST(tfm));
tfm->links = 1;
@@ -719,7 +719,7 @@ void free_font_metrics(TFMInfo *info)
if(tfm == NULL)
return;
if(--tfm->links > 0) {
- DEBUG((DBG_FONTS, "(mt) %s not removed, still in use\n",
+ DEBUG((DBG_FONTS, "(mt) %s not removed, still in use\n",
tfm->short_name));
return;
}
@@ -729,16 +729,16 @@ void free_font_metrics(TFMInfo *info)
listh_remove(&tfmpool, LIST(tfm));
mdvi_free(tfm->short_name);
mdvi_free(tfm->tfminfo.chars);
- mdvi_free(tfm);
+ mdvi_free(tfm);
}
void flush_font_metrics(void)
{
TFMPool *ptr;
-
+
for(; (ptr = (TFMPool *)tfmpool.head); ) {
tfmpool.head = LIST(ptr->next);
-
+
mdvi_free(ptr->short_name);
mdvi_free(ptr->tfminfo.chars);
mdvi_free(ptr);
diff --git a/backend/dvi/mdvi-lib/tt.c b/backend/dvi/mdvi-lib/tt.c
index e85d8e70..28ce3204 100644
--- a/backend/dvi/mdvi-lib/tt.c
+++ b/backend/dvi/mdvi-lib/tt.c
@@ -51,7 +51,7 @@ static int tt_load_font __PROTO((DviParams *, DviFont *));
static int tt_font_get_glyph __PROTO((DviParams *, DviFont *, int));
static void tt_free_data __PROTO((DviFont *));
static void tt_reset_font __PROTO((DviFont *));
-static void tt_shrink_glyph
+static void tt_shrink_glyph
__PROTO((DviContext *, DviFont *, DviFontChar *, DviGlyph *));
static void tt_font_remove __PROTO((FTInfo *));
@@ -97,14 +97,14 @@ static void tt_encode_font(DviFont *font, FTInfo *info)
{
TT_Face_Properties prop;
int i;
-
+
if(TT_Get_Face_Properties(info->face, &prop))
return;
-
+
for(i = 0; i < prop.num_Glyphs; i++) {
char *string;
int ndx;
-
+
if(TT_Get_PS_Name(info->face, i, &string))
continue;
ndx = mdvi_encode_glyph(info->encoding, string);
@@ -127,9 +127,9 @@ static int tt_really_load_font(DviParams *params, DviFont *font, FTInfo *info)
TT_CharMap cmap;
TT_Face_Properties props;
int map_found;
-
+
DEBUG((DBG_TT, "(tt) really_load_font(%s)\n", info->fontname));
-
+
/* get the point size */
point_size = (double)font->scale / (params->tfm_conv * 0x100000);
point_size = 72.0 * point_size / 72.27;
@@ -142,7 +142,7 @@ static int tt_really_load_font(DviParams *params, DviFont *font, FTInfo *info)
info->hasmetrics = 1;
return 0;
}
-
+
/* load the face */
DEBUG((DBG_TT, "(tt) loading new face `%s'\n",
info->fontname));
@@ -152,11 +152,11 @@ static int tt_really_load_font(DviParams *params, DviFont *font, FTInfo *info)
info->fontname, TT_ErrToString18(status));
return -1;
}
-
+
/* create a new instance of this face */
status = TT_New_Instance(info->face, &info->instance);
if(status) {
- mdvi_warning(_("(tt) %s: could not create face: %s\n"),
+ mdvi_warning(_("(tt) %s: could not create face: %s\n"),
info->fontname, TT_ErrToString18(status));
TT_Close_Face(info->face);
return -1;
@@ -165,12 +165,12 @@ static int tt_really_load_font(DviParams *params, DviFont *font, FTInfo *info)
/* create a glyph */
status = TT_New_Glyph(info->face, &info->glyph);
if(status) {
- mdvi_warning(_("(tt) %s: could not create glyph: %s\n"),
+ mdvi_warning(_("(tt) %s: could not create glyph: %s\n"),
info->fontname, TT_ErrToString18(status));
goto tt_error;
}
- /*
+ /*
* We'll try to find a Unicode charmap. It's not that important that we
* actually find one, especially if the fontmap files are installed
* properly, but it's good to have some predefined behaviour
@@ -180,14 +180,14 @@ static int tt_really_load_font(DviParams *params, DviFont *font, FTInfo *info)
map_found = -1;
for(i = 0; map_found < 0 && i < props.num_CharMaps; i++) {
TT_UShort pid, eid;
-
+
TT_Get_CharMap_ID(info->face, i, &pid, &eid);
switch(pid) {
case TT_PLATFORM_APPLE_UNICODE:
map_found = i;
break;
case TT_PLATFORM_ISO:
- if(eid == TT_ISO_ID_7BIT_ASCII ||
+ if(eid == TT_ISO_ID_7BIT_ASCII ||
eid == TT_ISO_ID_8859_1)
map_found = 1;
break;
@@ -205,7 +205,7 @@ static int tt_really_load_font(DviParams *params, DviFont *font, FTInfo *info)
DEBUG((DBG_TT, "(tt) %s: using charmap #%d\n",
info->fontname, map_found));
TT_Get_CharMap(info->face, map_found, &cmap);
-
+
DEBUG((DBG_TT, "(tt) %s: Set_Char_Size(%.2f, %d, %d)\n",
font->fontname, point_size, font->hdpi, font->vdpi));
status = TT_Set_Instance_Resolutions(info->instance,
@@ -215,7 +215,7 @@ static int tt_really_load_font(DviParams *params, DviFont *font, FTInfo *info)
info->fontname, TT_ErrToString18(status));
goto tt_error;
}
- status = TT_Set_Instance_CharSize(info->instance,
+ status = TT_Set_Instance_CharSize(info->instance,
FROUND(point_size * 64));
if(status) {
error(_("(tt) %s: could not set point size: %s\n"),
@@ -234,7 +234,7 @@ static int tt_really_load_font(DviParams *params, DviFont *font, FTInfo *info)
if(info->encoding != NULL) {
TT_Post post;
-
+
status = TT_Load_PS_Names(info->face, &post);
if(status) {
mdvi_warning(_("(tt) %s: could not load PS name table\n"),
@@ -245,7 +245,7 @@ static int tt_really_load_font(DviParams *params, DviFont *font, FTInfo *info)
}
/* get the metrics. If this fails, it's not fatal, but certainly bad */
- info->tfminfo = get_font_metrics(info->fontname,
+ info->tfminfo = get_font_metrics(info->fontname,
info->fmftype, info->fmfname);
if(info->tfminfo == NULL) {
@@ -269,7 +269,7 @@ static int tt_really_load_font(DviParams *params, DviFont *font, FTInfo *info)
font->chars[i - font->loc].code = TT_Char_Index(cmap, i);
}
- info->loaded = 1;
+ info->loaded = 1;
info->hasmetrics = 1;
return 0;
@@ -285,10 +285,10 @@ static int tt_load_font(DviParams *params, DviFont *font)
{
int i;
FTInfo *info;
-
+
if(!initialized && init_freetype() < 0)
return -1;
-
+
if(font->in != NULL) {
fclose(font->in);
font->in = NULL;
@@ -297,7 +297,7 @@ static int tt_load_font(DviParams *params, DviFont *font)
info = xalloc(FTInfo);
memzero(info, sizeof(FTInfo));
- info->fmftype = DviFontAny; /* any metrics type will do */
+ info->fmftype = DviFontAny; /* any metrics type will do */
info->fmfname = lookup_font_metrics(font->fontname, &info->fmftype);
info->fontname = font->fontname;
info->hasmetrics = 0;
@@ -320,17 +320,17 @@ static int tt_load_font(DviParams *params, DviFont *font)
font->chars[i].shrunk.data = NULL;
font->chars[i].grey.data = NULL;
}
-
+
if(info->fmfname == NULL)
mdvi_warning(_("(tt) %s: no font metric data\n"), font->fontname);
-
+
listh_append(&ttfonts, LIST(info));
font->private = info;
return 0;
}
-static int tt_get_bitmap(DviParams *params, DviFont *font,
+static int tt_get_bitmap(DviParams *params, DviFont *font,
int code, double xscale, double yscale, DviGlyph *glyph)
{
TT_Outline outline;
@@ -379,18 +379,18 @@ static int tt_get_bitmap(DviParams *params, DviFont *font,
raster.size = h * raster.cols;
raster.flow = TT_Flow_Down;
raster.bitmap = mdvi_calloc(h, raster.cols);
-
+
TT_Translate_Outline(&outline, -bbox.xMin, -bbox.yMin);
TT_Get_Outline_Bitmap(tt_handle, &outline, &raster);
glyph->data = bitmap_convert_msb8(raster.bitmap, w, h, ROUND(w, 8));
TT_Done_Outline(&outline);
mdvi_free(raster.bitmap);
-
+
return 0;
tt_error:
if(have_outline)
TT_Done_Outline(&outline);
- return -1;
+ return -1;
}
static int tt_font_get_glyph(DviParams *params, DviFont *font, int code)
@@ -400,7 +400,7 @@ static int tt_font_get_glyph(DviParams *params, DviFont *font, int code)
int error;
double xs, ys;
int dpi;
-
+
ASSERT(info != NULL);
if(!info->hasmetrics && tt_really_load_font(params, font, info) < 0)
return -1;
@@ -420,11 +420,11 @@ static int tt_font_get_glyph(DviParams *params, DviFont *font, int code)
(double)font->hdpi / dpi,
(double)font->vdpi / dpi,
&ch->glyph);
- if(error)
+ if(error)
goto missing;
ch->x = ch->glyph.x;
ch->y = ch->glyph.y;
-
+
return 0;
missing:
@@ -452,10 +452,10 @@ static void tt_shrink_glyph(DviContext *dvi, DviFont *font, DviFontChar *ch, Dvi
static void tt_reset_font(DviFont *font)
{
FTInfo *info = (FTInfo *)font->private;
-
+
if(info == NULL)
return;
- info->hasmetrics = 0;
+ info->hasmetrics = 0;
}
static void tt_font_remove(FTInfo *info)
@@ -483,7 +483,7 @@ static void tt_free_data(DviFont *font)
{
if(font->private == NULL)
return;
-
+
tt_font_remove((FTInfo *)font->private);
if(initialized && ttfonts.count == 0) {
DEBUG((DBG_TT, "(tt) last font removed -- closing FreeType\n"));
diff --git a/backend/dvi/mdvi-lib/util.c b/backend/dvi/mdvi-lib/util.c
index 349d273a..15b53f13 100644
--- a/backend/dvi/mdvi-lib/util.c
+++ b/backend/dvi/mdvi-lib/util.c
@@ -85,7 +85,7 @@ int mdvi_set_logstream(FILE *file)
int mdvi_set_loglevel(int level)
{
int old = _mdvi_log_level;
-
+
_mdvi_log_level = level;
return old;
}
@@ -96,7 +96,7 @@ Uint32 _mdvi_debug_mask = 0;
void __debug(int mask, const char *format, ...)
{
va_list ap;
-
+
va_start(ap, format);
if(_mdvi_debug_mask & mask) {
if(!DEBUGGING(SILENT)) {
@@ -118,7 +118,7 @@ void __debug(int mask, const char *format, ...)
void mdvi_message(const char *format, ...)
{
va_list ap;
-
+
va_start(ap, format);
if(_mdvi_log_level >= LOG_INFO) {
fprintf(stderr, "%s: ", program_name);
@@ -135,10 +135,10 @@ void mdvi_message(const char *format, ...)
void mdvi_crash(const char *format, ...)
{
va_list ap;
-
+
va_start(ap, format);
- fprintf(stderr, "%s: %s: ",
- program_name,
+ fprintf(stderr, "%s: %s: ",
+ program_name,
gettext(messages[(int)time(NULL) % NMSGS]));
vfprintf(stderr, format, ap);
#ifndef __GNUC__
@@ -154,7 +154,7 @@ void mdvi_crash(const char *format, ...)
void mdvi_error(const char *format, ...)
{
va_list ap;
-
+
va_start(ap, format);
fprintf(stderr, _("%s: Error: "), program_name);
vfprintf(stderr, format, ap);
@@ -170,7 +170,7 @@ void mdvi_error(const char *format, ...)
void mdvi_warning(const char *format, ...)
{
va_list ap;
-
+
va_start(ap, format);
fprintf(stderr, _("%s: Warning: "), program_name);
vfprintf(stderr, format, ap);
@@ -186,7 +186,7 @@ void mdvi_warning(const char *format, ...)
void mdvi_fatal(const char *format, ...)
{
va_list ap;
-
+
va_start(ap, format);
fprintf(stderr, _("%s: Fatal: "), program_name);
vfprintf(stderr, format, ap);
@@ -207,7 +207,7 @@ void mdvi_fatal(const char *format, ...)
void *mdvi_malloc(size_t nelems)
{
void *ptr = malloc(nelems);
-
+
if(ptr == NULL)
mdvi_fatal(_("out of memory allocating %u bytes\n"),
(unsigned)nelems);
@@ -217,19 +217,19 @@ void *mdvi_malloc(size_t nelems)
void *mdvi_realloc(void *data, size_t newsize)
{
void *ptr;
-
+
if(newsize == 0)
mdvi_crash(_("attempted to reallocate with zero size\n"));
ptr = realloc(data, newsize);
if(ptr == NULL)
mdvi_fatal(_("failed to reallocate %u bytes\n"), (unsigned)newsize);
- return ptr;
+ return ptr;
}
void *mdvi_calloc(size_t nmemb, size_t size)
{
void *ptr;
-
+
if(nmemb == 0)
mdvi_crash(_("attempted to callocate 0 members\n"));
if(size == 0)
@@ -253,7 +253,7 @@ char *mdvi_strdup(const char *string)
{
int length;
char *ptr;
-
+
length = strlen(string) + 1;
ptr = (char *)mdvi_malloc(length);
memcpy(ptr, string, length);
@@ -272,7 +272,7 @@ char *mdvi_strndup(const char *string, size_t length)
{
int n;
char *ptr;
-
+
n = strlen(string);
if(n > length)
n = length;
@@ -284,7 +284,7 @@ char *mdvi_strndup(const char *string, size_t length)
void *mdvi_memdup(const void *data, size_t length)
{
void *ptr = mdvi_malloc(length);
-
+
memcpy(ptr, data, length);
return ptr;
}
@@ -339,7 +339,7 @@ char *mdvi_build_path_from_cwd (const char *path)
buf = mdvi_realloc (buf, strlen (buf) + strlen (path) + 2);
strcat (buf, "/");
strncat (buf, path, strlen (path));
-
+
return buf;
}
@@ -349,9 +349,9 @@ double unit2pix_factor(const char *spec)
double factor;
const char *p, *q;
static const char *units = "incmmmmtptpcddccspbpftydcs";
-
+
val = 0.0;
-
+
for(p = spec; *p >= '0' && *p <= '9'; p++)
val = 10.0 * val + (double)(*p - '0');
if(*p == '.') {
@@ -389,14 +389,14 @@ double unit2pix_factor(const char *spec)
int unit2pix(int dpi, const char *spec)
{
double factor = unit2pix_factor(spec);
-
+
return (int)(factor * dpi + 0.5);
}
Ulong get_mtime(int fd)
{
struct stat st;
-
+
if(fstat(fd, &st) == 0)
return (Ulong)st.st_mtime;
return 0;
@@ -419,7 +419,7 @@ char *getword(char *string, const char *delim, char **end)
{
char *ptr;
char *word;
-
+
/* skip leading delimiters */
for(ptr = string; *ptr && strchr(delim, *ptr); ptr++);
@@ -438,10 +438,10 @@ char *getstring(char *string, const char *delim, char **end)
char *ptr;
char *word;
int quoted = 0;
-
+
/* skip leading delimiters */
for(ptr = string; *ptr && strchr(delim, *ptr); ptr++);
-
+
if(ptr == NULL)
return NULL;
quoted = (*ptr == '"');
@@ -456,7 +456,7 @@ char *getstring(char *string, const char *delim, char **end)
static long pow2(size_t n)
{
long x = 8; /* don't bother allocating less than this */
-
+
while(x < n)
x <<= 1L;
return x;
@@ -487,7 +487,7 @@ int dstring_append(Dstring *dstr, const char *string, int len)
dstr->data = mdvi_malloc(8);
dstr->data[0] = 0;
}
-
+
return dstr->length;
}
diff --git a/backend/dvi/mdvi-lib/vf.c b/backend/dvi/mdvi-lib/vf.c
index a5ae3bbe..5fa5e451 100644
--- a/backend/dvi/mdvi-lib/vf.c
+++ b/backend/dvi/mdvi-lib/vf.c
@@ -68,11 +68,11 @@ static int vf_load_font(DviParams *params, DviFont *font)
int nchars;
int loc, hic;
DviFontRef *last;
-
+
macros = NULL;
msize = mlen = 0;
p = font->in;
-
+
if(fuget1(p) != 247 || fuget1(p) != 202)
goto badvf;
mlen = fuget1(p);
@@ -84,14 +84,14 @@ static int vf_load_font(DviParams *params, DviFont *font)
} else if(!font->checksum)
font->checksum = checksum;
font->design = fuget4(p);
-
+
/* read all the fonts in the preamble */
last = NULL;
/* initialize alpha, beta and z for TFM width computation */
TFMPREPARE(font->scale, z, alpha, beta);
- op = fuget1(p);
+ op = fuget1(p);
while(op >= DVI_FNT_DEF1 && op <= DVI_FNT_DEF4) {
DviFontRef *ref;
Int32 scale, design;
@@ -101,9 +101,9 @@ static int vf_load_font(DviParams *params, DviFont *font)
int hdpi;
int vdpi;
char *name;
-
+
/* process fnt_def commands */
-
+
id = fugetn(p, op - DVI_FNT_DEF1 + 1);
checksum = fuget4(p);
scale = fuget4(p);
@@ -121,13 +121,13 @@ static int vf_load_font(DviParams *params, DviFont *font)
fread(name, 1, n, p);
name[n] = 0;
DEBUG((DBG_FONTS, "(vf) %s: defined font `%s' at %.1fpt (%dx%d dpi)\n",
- font->fontname, name,
+ font->fontname, name,
(double)scale / (params->tfm_conv * 0x100000), hdpi, vdpi));
/* get the font */
ref = font_reference(params, id, name, checksum, hdpi, vdpi, scale);
if(ref == NULL) {
- mdvi_error(_("(vf) %s: could not load font `%s'\n"),
+ mdvi_error(_("(vf) %s: could not load font `%s'\n"),
font->fontname, name);
goto error;
}
@@ -139,12 +139,12 @@ static int vf_load_font(DviParams *params, DviFont *font)
ref->next = NULL;
op = fuget1(p);
}
-
+
if(op >= DVI_FNT_DEF1 && op <= DVI_FNT_DEF4)
goto error;
/* This function correctly reads both .vf and .ovf files */
-
+
font->chars = xnalloc(DviFontChar, 256);
for(i = 0; i < 256; i++)
font->chars[i].offset = 0;
@@ -155,7 +155,7 @@ static int vf_load_font(DviParams *params, DviFont *font)
int pl;
Int32 cc;
Int32 tfm;
-
+
if(op == 242) {
pl = fuget4(p);
cc = fuget4(p);
@@ -176,7 +176,7 @@ static int vf_load_font(DviParams *params, DviFont *font)
if(hic < 0 || cc > hic)
hic = cc;
if(cc >= nchars) {
- font->chars = xresize(font->chars,
+ font->chars = xresize(font->chars,
DviFontChar, cc + 16);
for(i = nchars; i < cc + 16; i++)
font->chars[i].offset = 0;
@@ -187,7 +187,7 @@ static int vf_load_font(DviParams *params, DviFont *font)
font->fontname, cc);
goto error;
}
-
+
DEBUG((DBG_GLYPHS, "(vf) %s: defined character %d (macro length %d)\n",
font->fontname, cc, pl));
font->chars[cc].width = pl + 1;
@@ -215,8 +215,8 @@ static int vf_load_font(DviParams *params, DviFont *font)
macros = xresize(macros, Uchar, mlen);
msize = mlen;
}
-
- DEBUG((DBG_FONTS|DBG_GLYPHS,
+
+ DEBUG((DBG_FONTS|DBG_GLYPHS,
"(vf) %s: macros use %d bytes\n", font->fontname, msize));
if(loc > 0 || hic < nchars-1) {
@@ -230,7 +230,7 @@ static int vf_load_font(DviParams *params, DviFont *font)
font->private = macros;
return 0;
-
+
badvf:
mdvi_error(_("%s: File corrupted, or not a VF file.\n"), font->fontname);
error:
@@ -243,5 +243,5 @@ error:
static void vf_free_macros(DviFont *font)
{
- mdvi_free(font->private);
+ mdvi_free(font->private);
}