Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 8591756

Browse files
authored
Merge pull request #20527 from anntzer/dt
Factor out DEBUG_TRUETYPE checks in ttconv, & removals of unused defs.
2 parents 9351d73 + 3f76ee4 commit 8591756

File tree

4 files changed

+6
-68
lines changed

4 files changed

+6
-68
lines changed

extern/ttconv/pprdrv.h

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,12 @@ class TTException
8181
#define DEBUG_TRUETYPE /* truetype fonts, conversion to Postscript */
8282
#endif
8383

84+
#if DEBUG_TRUETYPE
85+
#define debug(...) printf(__VA_ARGS__)
86+
#else
87+
#define debug(...)
88+
#endif
89+
8490
/* Do not change anything below this line. */
8591

8692
enum font_type_enum

extern/ttconv/pprdrv_tt.cpp

Lines changed: 0 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -121,10 +121,7 @@ BYTE *GetTable(struct TTFONT *font, const char *name)
121121
{
122122
BYTE *ptr;
123123
ULONG x;
124-
125-
#ifdef DEBUG_TRUETYPE
126124
debug("GetTable(file,font,\"%s\")",name);
127-
#endif
128125

129126
/* We must search the table directory. */
130127
ptr = font->offset_table + 12;
@@ -142,9 +139,7 @@ BYTE *GetTable(struct TTFONT *font, const char *name)
142139

143140
try
144141
{
145-
#ifdef DEBUG_TRUETYPE
146142
debug("Loading table \"%s\" from offset %d, %d bytes",name,offset,length);
147-
#endif
148143

149144
if ( fseek( font->file, (long)offset, SEEK_SET ) )
150145
{
@@ -200,10 +195,7 @@ void Read_name(struct TTFONT *font)
200195
int platform; /* Current platform id */
201196
int nameid; /* name id, */
202197
int offset,length; /* offset and length of string. */
203-
204-
#ifdef DEBUG_TRUETYPE
205198
debug("Read_name()");
206-
#endif
207199

208200
table_ptr = NULL;
209201

@@ -235,11 +227,8 @@ void Read_name(struct TTFONT *font)
235227
nameid = getUSHORT(ptr2+6);
236228
length = getUSHORT(ptr2+8);
237229
offset = getUSHORT(ptr2+10);
238-
239-
#ifdef DEBUG_TRUETYPE
240230
debug("platform %d, encoding %d, language 0x%x, name %d, offset %d, length %d",
241231
platform,encoding,language,nameid,offset,length);
242-
#endif
243232

244233
/* Copyright notice */
245234
if ( platform == 1 && nameid == 0 )
@@ -248,10 +237,7 @@ void Read_name(struct TTFONT *font)
248237
strncpy(font->Copyright,(const char*)strings+offset,length);
249238
font->Copyright[length]='\0';
250239
replace_newlines_with_spaces(font->Copyright);
251-
252-
#ifdef DEBUG_TRUETYPE
253240
debug("font->Copyright=\"%s\"",font->Copyright);
254-
#endif
255241
continue;
256242
}
257243

@@ -264,10 +250,7 @@ void Read_name(struct TTFONT *font)
264250
strncpy(font->FamilyName,(const char*)strings+offset,length);
265251
font->FamilyName[length]='\0';
266252
replace_newlines_with_spaces(font->FamilyName);
267-
268-
#ifdef DEBUG_TRUETYPE
269253
debug("font->FamilyName=\"%s\"",font->FamilyName);
270-
#endif
271254
continue;
272255
}
273256

@@ -280,10 +263,7 @@ void Read_name(struct TTFONT *font)
280263
strncpy(font->Style,(const char*)strings+offset,length);
281264
font->Style[length]='\0';
282265
replace_newlines_with_spaces(font->Style);
283-
284-
#ifdef DEBUG_TRUETYPE
285266
debug("font->Style=\"%s\"",font->Style);
286-
#endif
287267
continue;
288268
}
289269

@@ -296,10 +276,7 @@ void Read_name(struct TTFONT *font)
296276
strncpy(font->FullName,(const char*)strings+offset,length);
297277
font->FullName[length]='\0';
298278
replace_newlines_with_spaces(font->FullName);
299-
300-
#ifdef DEBUG_TRUETYPE
301279
debug("font->FullName=\"%s\"",font->FullName);
302-
#endif
303280
continue;
304281
}
305282

@@ -312,10 +289,7 @@ void Read_name(struct TTFONT *font)
312289
strncpy(font->Version,(const char*)strings+offset,length);
313290
font->Version[length]='\0';
314291
replace_newlines_with_spaces(font->Version);
315-
316-
#ifdef DEBUG_TRUETYPE
317292
debug("font->Version=\"%s\"",font->Version);
318-
#endif
319293
continue;
320294
}
321295

@@ -328,10 +302,7 @@ void Read_name(struct TTFONT *font)
328302
strncpy(font->PostName,(const char*)strings+offset,length);
329303
font->PostName[length]='\0';
330304
replace_newlines_with_spaces(font->PostName);
331-
332-
#ifdef DEBUG_TRUETYPE
333305
debug("font->PostName=\"%s\"",font->PostName);
334-
#endif
335306
continue;
336307
}
337308

@@ -343,10 +314,7 @@ void Read_name(struct TTFONT *font)
343314
utf16be_to_ascii(font->PostName, (char *)strings+offset, length);
344315
font->PostName[length/2]='\0';
345316
replace_newlines_with_spaces(font->PostName);
346-
347-
#ifdef DEBUG_TRUETYPE
348317
debug("font->PostName=\"%s\"",font->PostName);
349-
#endif
350318
continue;
351319
}
352320

@@ -358,10 +326,7 @@ void Read_name(struct TTFONT *font)
358326
strncpy(font->Trademark,(const char*)strings+offset,length);
359327
font->Trademark[length]='\0';
360328
replace_newlines_with_spaces(font->Trademark);
361-
362-
#ifdef DEBUG_TRUETYPE
363329
debug("font->Trademark=\"%s\"",font->Trademark);
364-
#endif
365330
continue;
366331
}
367332
}
@@ -677,10 +642,7 @@ void sfnts_glyf_table(TTStreamWriter& stream, struct TTFONT *font, ULONG oldoffs
677642
ULONG total=0; /* running total of bytes written to table */
678643
int x;
679644
bool loca_is_local=false;
680-
681-
#ifdef DEBUG_TRUETYPE
682645
debug("sfnts_glyf_table(font,%d)", (int)correct_total_length);
683-
#endif
684646

685647
if (font->loca_table == NULL)
686648
{
@@ -709,10 +671,7 @@ void sfnts_glyf_table(TTStreamWriter& stream, struct TTFONT *font, ULONG oldoffs
709671
length = getULONG( font->loca_table + ((x+1) * 4) );
710672
length -= off;
711673
}
712-
713-
#ifdef DEBUG_TRUETYPE
714674
debug("glyph length=%d",(int)length);
715-
#endif
716675

717676
/* Start new string if necessary. */
718677
sfnts_new_table( stream, (int)length );
@@ -847,12 +806,10 @@ void ttfont_sfnts(TTStreamWriter& stream, struct TTFONT *font)
847806
sfnts_pputUSHORT(stream, 3); /* entrySelector */
848807
sfnts_pputUSHORT(stream, 81); /* rangeShift */
849808
}
850-
#ifdef DEBUG_TRUETYPE
851809
else
852810
{
853811
debug("only %d tables selected",count);
854812
}
855-
#endif
856813

857814
/* Now, emmit the table directory. */
858815
for (x=0; x < 9; x++)
@@ -885,10 +842,7 @@ void ttfont_sfnts(TTStreamWriter& stream, struct TTFONT *font)
885842
{
886843
continue;
887844
}
888-
889-
#ifdef DEBUG_TRUETYPE
890845
debug("emmiting table '%s'",table_names[x]);
891-
#endif
892846

893847
/* 'glyf' table gets special treatment */
894848
if ( strcmp(table_names[x],"glyf")==0 )
@@ -1278,9 +1232,7 @@ void read_font(const char *filename, font_type_enum target_type, std::vector<int
12781232

12791233
/* Determine how many directory entries there are. */
12801234
font.numTables = getUSHORT( font.offset_table + 4 );
1281-
#ifdef DEBUG_TRUETYPE
12821235
debug("numTables=%d",(int)font.numTables);
1283-
#endif
12841236

12851237
/* Expand the memory block to hold the whole thing. */
12861238
font.offset_table = (BYTE*)realloc( font.offset_table, sizeof(BYTE) * (12 + font.numTables * 16) );
@@ -1301,9 +1253,7 @@ void read_font(const char *filename, font_type_enum target_type, std::vector<int
13011253
font.MfrRevision = getFixed( ptr + 4 ); /* font revision number */
13021254
font.unitsPerEm = getUSHORT( ptr + 18 );
13031255
font.HUPM = font.unitsPerEm / 2;
1304-
#ifdef DEBUG_TRUETYPE
13051256
debug("unitsPerEm=%d",(int)font.unitsPerEm);
1306-
#endif
13071257
font.llx = topost2( getFWord( ptr + 36 ) ); /* bounding box info */
13081258
font.lly = topost2( getFWord( ptr + 38 ) );
13091259
font.urx = topost2( getFWord( ptr + 40 ) );

extern/ttconv/pprdrv_tt2.cpp

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -89,12 +89,6 @@ struct FlaggedPoint
8989
FlaggedPoint(Flag flag_, FWord x_, FWord y_): flag(flag_), x(x_), y(y_) {};
9090
};
9191

92-
double area(FWord *x, FWord *y, int n);
93-
#define sqr(x) ((x)*(x))
94-
95-
#define NOMOREINCTR -1
96-
#define NOMOREOUTCTR -1
97-
9892
/*
9993
** This routine is used to break the character
10094
** procedure up into a number of smaller

extern/ttconv/ttutil.cpp

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -14,18 +14,6 @@
1414
#include <cstdlib>
1515
#include "pprdrv.h"
1616

17-
#if DEBUG_TRUETYPE
18-
void debug(const char *format, ... )
19-
{
20-
va_list arg_list;
21-
va_start(arg_list, format);
22-
23-
printf(format, arg_list);
24-
25-
va_end(arg_list);
26-
}
27-
#endif
28-
2917
#define PRINTF_BUFFER_SIZE 512
3018
void TTStreamWriter::printf(const char* format, ...)
3119
{

0 commit comments

Comments
 (0)