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

Skip to content

Commit cc1f776

Browse files
authored
Merge pull request #19931 from anntzer/ttconv
Remove now unused patches to ttconv.
2 parents f650bf8 + 7dcac08 commit cc1f776

File tree

3 files changed

+24
-111
lines changed

3 files changed

+24
-111
lines changed

extern/ttconv/pprdrv.h

Lines changed: 0 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -48,20 +48,6 @@ class TTStreamWriter
4848
virtual void putline(const char* a);
4949
};
5050

51-
class TTDictionaryCallback
52-
{
53-
private:
54-
// Private copy and assignment
55-
TTDictionaryCallback& operator=(const TTStreamWriter& other);
56-
TTDictionaryCallback(const TTStreamWriter& other);
57-
58-
public:
59-
TTDictionaryCallback() { }
60-
virtual ~TTDictionaryCallback() { }
61-
62-
virtual void add_pair(const char* key, const char* value) = 0;
63-
};
64-
6551
void replace_newlines_with_spaces(char* a);
6652

6753
/*
@@ -102,12 +88,9 @@ enum font_type_enum
10288
PS_TYPE_3 = 3,
10389
PS_TYPE_42 = 42,
10490
PS_TYPE_42_3_HYBRID = 43,
105-
PDF_TYPE_3 = -3
10691
};
10792

10893
/* routines in pprdrv_tt.c */
10994
void insert_ttfont(const char *filename, TTStreamWriter& stream, font_type_enum target_type, std::vector<int>& glyph_ids);
11095

111-
void get_pdf_charprocs(const char *filename, std::vector<int>& glyph_ids, TTDictionaryCallback& dict);
112-
11396
/* end of file */

extern/ttconv/pprdrv_tt.cpp

Lines changed: 1 addition & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -1336,8 +1336,7 @@ void read_font(const char *filename, font_type_enum target_type, std::vector<int
13361336
/* If we are generating a Type 3 font, we will need to */
13371337
/* have the 'loca' and 'glyf' tables arround while */
13381338
/* we are generating the CharStrings. */
1339-
if (font.target_type == PS_TYPE_3 || font.target_type == PDF_TYPE_3 ||
1340-
font.target_type == PS_TYPE_42_3_HYBRID)
1339+
if (font.target_type == PS_TYPE_3 || font.target_type == PS_TYPE_42_3_HYBRID)
13411340
{
13421341
BYTE *ptr; /* We need only one value */
13431342
ptr = GetTable(&font, "hhea");
@@ -1401,38 +1400,6 @@ void insert_ttfont(const char *filename, TTStreamWriter& stream,
14011400

14021401
} /* end of insert_ttfont() */
14031402

1404-
class StringStreamWriter : public TTStreamWriter
1405-
{
1406-
std::ostringstream oss;
1407-
1408-
public:
1409-
void write(const char* a)
1410-
{
1411-
oss << a;
1412-
}
1413-
1414-
std::string str()
1415-
{
1416-
return oss.str();
1417-
}
1418-
};
1419-
1420-
void get_pdf_charprocs(const char *filename, std::vector<int>& glyph_ids, TTDictionaryCallback& dict)
1421-
{
1422-
struct TTFONT font;
1423-
1424-
read_font(filename, PDF_TYPE_3, glyph_ids, font);
1425-
1426-
for (std::vector<int>::const_iterator i = glyph_ids.begin();
1427-
i != glyph_ids.end(); ++i)
1428-
{
1429-
StringStreamWriter writer;
1430-
tt_type3_charproc(writer, &font, *i);
1431-
const char* name = ttfont_CharStrings_getname(&font, *i);
1432-
dict.add_pair(name, writer.str().c_str());
1433-
}
1434-
}
1435-
14361403
TTFONT::TTFONT() :
14371404
file(NULL),
14381405
PostName(NULL),

extern/ttconv/pprdrv_tt2.cpp

Lines changed: 23 additions & 60 deletions
Original file line numberDiff line numberDiff line change
@@ -60,8 +60,6 @@ class GlyphToType3
6060

6161
int stack_depth; /* A book-keeping variable for keeping track of the depth of the PS stack */
6262

63-
bool pdf_mode;
64-
6563
void load_char(TTFONT* font, BYTE *glyph);
6664
void stack(TTStreamWriter& stream, int new_elem);
6765
void stack_end(TTStreamWriter& stream);
@@ -111,9 +109,8 @@ double area(FWord *x, FWord *y, int n);
111109
*/
112110
void GlyphToType3::stack(TTStreamWriter& stream, int new_elem)
113111
{
114-
if ( !pdf_mode && num_pts > 25 ) /* Only do something of we will */
112+
if ( num_pts > 25 ) /* Only do something of we will have a log of points. */
115113
{
116-
/* have a log of points. */
117114
if (stack_depth == 0)
118115
{
119116
stream.put_char('{');
@@ -132,7 +129,7 @@ void GlyphToType3::stack(TTStreamWriter& stream, int new_elem)
132129

133130
void GlyphToType3::stack_end(TTStreamWriter& stream) /* called at end */
134131
{
135-
if ( !pdf_mode && stack_depth )
132+
if ( stack_depth )
136133
{
137134
stream.puts("}_e");
138135
stack_depth=0;
@@ -238,19 +235,17 @@ void GlyphToType3::PSConvert(TTStreamWriter& stream)
238235

239236
/* Now, we can fill the whole thing. */
240237
stack(stream, 1);
241-
stream.puts( pdf_mode ? "f" : "_cl" );
238+
stream.puts("_cl");
242239
} /* end of PSConvert() */
243240

244241
void GlyphToType3::PSMoveto(TTStreamWriter& stream, int x, int y)
245242
{
246-
stream.printf(pdf_mode ? "%d %d m\n" : "%d %d _m\n",
247-
x, y);
243+
stream.printf("%d %d _m\n", x, y);
248244
}
249245

250246
void GlyphToType3::PSLineto(TTStreamWriter& stream, int x, int y)
251247
{
252-
stream.printf(pdf_mode ? "%d %d l\n" : "%d %d _l\n",
253-
x, y);
248+
stream.printf("%d %d _l\n", x, y);
254249
}
255250

256251
/*
@@ -278,9 +273,9 @@ void GlyphToType3::PSCurveto(TTStreamWriter& stream,
278273
cy[1] = (sy[2]+2*sy[1])/3;
279274
cx[2] = sx[2];
280275
cy[2] = sy[2];
281-
stream.printf("%d %d %d %d %d %d %s\n",
276+
stream.printf("%d %d %d %d %d %d _c\n",
282277
(int)cx[0], (int)cy[0], (int)cx[1], (int)cy[1],
283-
(int)cx[2], (int)cy[2], pdf_mode ? "c" : "_c");
278+
(int)cx[2], (int)cy[2]);
284279
}
285280

286281
/*
@@ -464,50 +459,27 @@ void GlyphToType3::do_composite(TTStreamWriter& stream, struct TTFONT *font, BYT
464459
(int)flags,arg1,arg2);
465460
#endif
466461

467-
if (pdf_mode)
462+
/* If we have an (X,Y) shift and it is non-zero, */
463+
/* translate the coordinate system. */
464+
if ( flags & ARGS_ARE_XY_VALUES )
468465
{
469-
if ( flags & ARGS_ARE_XY_VALUES )
470-
{
471-
/* We should have been able to use 'Do' to reference the
472-
subglyph here. However, that doesn't seem to work with
473-
xpdf or gs (only acrobat), so instead, this just includes
474-
the subglyph here inline. */
475-
stream.printf("q 1 0 0 1 %d %d cm\n", topost(arg1), topost(arg2));
476-
}
477-
else
478-
{
479-
stream.printf("%% unimplemented shift, arg1=%d, arg2=%d\n",arg1,arg2);
480-
}
481-
GlyphToType3(stream, font, glyphIndex, true);
482-
if ( flags & ARGS_ARE_XY_VALUES )
483-
{
484-
stream.printf("\nQ\n");
485-
}
466+
if ( arg1 != 0 || arg2 != 0 )
467+
stream.printf("gsave %d %d translate\n", topost(arg1), topost(arg2) );
486468
}
487469
else
488470
{
489-
/* If we have an (X,Y) shif and it is non-zero, */
490-
/* translate the coordinate system. */
491-
if ( flags & ARGS_ARE_XY_VALUES )
492-
{
493-
if ( arg1 != 0 || arg2 != 0 )
494-
stream.printf("gsave %d %d translate\n", topost(arg1), topost(arg2) );
495-
}
496-
else
497-
{
498-
stream.printf("%% unimplemented shift, arg1=%d, arg2=%d\n",arg1,arg2);
499-
}
471+
stream.printf("%% unimplemented shift, arg1=%d, arg2=%d\n",arg1,arg2);
472+
}
500473

501-
/* Invoke the CharStrings procedure to print the component. */
502-
stream.printf("false CharStrings /%s get exec\n",
503-
ttfont_CharStrings_getname(font,glyphIndex));
474+
/* Invoke the CharStrings procedure to print the component. */
475+
stream.printf("false CharStrings /%s get exec\n",
476+
ttfont_CharStrings_getname(font, glyphIndex));
504477

505-
/* If we translated the coordinate system, */
506-
/* put it back the way it was. */
507-
if ( flags & ARGS_ARE_XY_VALUES && (arg1 != 0 || arg2 != 0) )
508-
{
509-
stream.puts("grestore ");
510-
}
478+
/* If we translated the coordinate system, */
479+
/* put it back the way it was. */
480+
if ( flags & ARGS_ARE_XY_VALUES && (arg1 != 0 || arg2 != 0) )
481+
{
482+
stream.puts("grestore ");
511483
}
512484

513485
}
@@ -559,7 +531,6 @@ GlyphToType3::GlyphToType3(TTStreamWriter& stream, struct TTFONT *font, int char
559531
ycoor = NULL;
560532
epts_ctr = NULL;
561533
stack_depth = 0;
562-
pdf_mode = font->target_type < 0;
563534

564535
/* Get a pointer to the data. */
565536
glyph = find_glyph_data( font, charindex );
@@ -610,15 +581,7 @@ GlyphToType3::GlyphToType3(TTStreamWriter& stream, struct TTFONT *font, int char
610581
/* Execute setcachedevice in order to inform the font machinery */
611582
/* of the character bounding box and advance width. */
612583
stack(stream, 7);
613-
if (pdf_mode)
614-
{
615-
if (!embedded) {
616-
stream.printf("%d 0 %d %d %d %d d1\n",
617-
topost(advance_width),
618-
topost(llx), topost(lly), topost(urx), topost(ury) );
619-
}
620-
}
621-
else if (font->target_type == PS_TYPE_42_3_HYBRID)
584+
if (font->target_type == PS_TYPE_42_3_HYBRID)
622585
{
623586
stream.printf("pop gsave .001 .001 scale %d 0 %d %d %d %d setcachedevice\n",
624587
topost(advance_width),

0 commit comments

Comments
 (0)