From 7dcac08570e3532952d22a9dc40beccd60039916 Mon Sep 17 00:00:00 2001 From: Antony Lee Date: Sat, 10 Apr 2021 13:50:54 +0200 Subject: [PATCH] Remove now unused patches to ttconv. TTDictionaryCallback, StringStreamWriter, get_pdf_charprocs, and pdf_mode were added in 7a10b51. --- extern/ttconv/pprdrv.h | 17 -------- extern/ttconv/pprdrv_tt.cpp | 35 +-------------- extern/ttconv/pprdrv_tt2.cpp | 83 ++++++++++-------------------------- 3 files changed, 24 insertions(+), 111 deletions(-) diff --git a/extern/ttconv/pprdrv.h b/extern/ttconv/pprdrv.h index 39e81fee7f0c..ea7d338ef351 100644 --- a/extern/ttconv/pprdrv.h +++ b/extern/ttconv/pprdrv.h @@ -48,20 +48,6 @@ class TTStreamWriter virtual void putline(const char* a); }; -class TTDictionaryCallback -{ -private: - // Private copy and assignment - TTDictionaryCallback& operator=(const TTStreamWriter& other); - TTDictionaryCallback(const TTStreamWriter& other); - -public: - TTDictionaryCallback() { } - virtual ~TTDictionaryCallback() { } - - virtual void add_pair(const char* key, const char* value) = 0; -}; - void replace_newlines_with_spaces(char* a); /* @@ -102,12 +88,9 @@ enum font_type_enum PS_TYPE_3 = 3, PS_TYPE_42 = 42, PS_TYPE_42_3_HYBRID = 43, - PDF_TYPE_3 = -3 }; /* routines in pprdrv_tt.c */ void insert_ttfont(const char *filename, TTStreamWriter& stream, font_type_enum target_type, std::vector& glyph_ids); -void get_pdf_charprocs(const char *filename, std::vector& glyph_ids, TTDictionaryCallback& dict); - /* end of file */ diff --git a/extern/ttconv/pprdrv_tt.cpp b/extern/ttconv/pprdrv_tt.cpp index 934215470808..ae6179d7d1d0 100644 --- a/extern/ttconv/pprdrv_tt.cpp +++ b/extern/ttconv/pprdrv_tt.cpp @@ -1336,8 +1336,7 @@ void read_font(const char *filename, font_type_enum target_type, std::vector& glyph_ids, TTDictionaryCallback& dict) -{ - struct TTFONT font; - - read_font(filename, PDF_TYPE_3, glyph_ids, font); - - for (std::vector::const_iterator i = glyph_ids.begin(); - i != glyph_ids.end(); ++i) - { - StringStreamWriter writer; - tt_type3_charproc(writer, &font, *i); - const char* name = ttfont_CharStrings_getname(&font, *i); - dict.add_pair(name, writer.str().c_str()); - } -} - TTFONT::TTFONT() : file(NULL), PostName(NULL), diff --git a/extern/ttconv/pprdrv_tt2.cpp b/extern/ttconv/pprdrv_tt2.cpp index 058bc005348b..3654c441008c 100644 --- a/extern/ttconv/pprdrv_tt2.cpp +++ b/extern/ttconv/pprdrv_tt2.cpp @@ -60,8 +60,6 @@ class GlyphToType3 int stack_depth; /* A book-keeping variable for keeping track of the depth of the PS stack */ - bool pdf_mode; - void load_char(TTFONT* font, BYTE *glyph); void stack(TTStreamWriter& stream, int new_elem); void stack_end(TTStreamWriter& stream); @@ -111,9 +109,8 @@ double area(FWord *x, FWord *y, int n); */ void GlyphToType3::stack(TTStreamWriter& stream, int new_elem) { - if ( !pdf_mode && num_pts > 25 ) /* Only do something of we will */ + if ( num_pts > 25 ) /* Only do something of we will have a log of points. */ { - /* have a log of points. */ if (stack_depth == 0) { stream.put_char('{'); @@ -132,7 +129,7 @@ void GlyphToType3::stack(TTStreamWriter& stream, int new_elem) void GlyphToType3::stack_end(TTStreamWriter& stream) /* called at end */ { - if ( !pdf_mode && stack_depth ) + if ( stack_depth ) { stream.puts("}_e"); stack_depth=0; @@ -238,19 +235,17 @@ void GlyphToType3::PSConvert(TTStreamWriter& stream) /* Now, we can fill the whole thing. */ stack(stream, 1); - stream.puts( pdf_mode ? "f" : "_cl" ); + stream.puts("_cl"); } /* end of PSConvert() */ void GlyphToType3::PSMoveto(TTStreamWriter& stream, int x, int y) { - stream.printf(pdf_mode ? "%d %d m\n" : "%d %d _m\n", - x, y); + stream.printf("%d %d _m\n", x, y); } void GlyphToType3::PSLineto(TTStreamWriter& stream, int x, int y) { - stream.printf(pdf_mode ? "%d %d l\n" : "%d %d _l\n", - x, y); + stream.printf("%d %d _l\n", x, y); } /* @@ -278,9 +273,9 @@ void GlyphToType3::PSCurveto(TTStreamWriter& stream, cy[1] = (sy[2]+2*sy[1])/3; cx[2] = sx[2]; cy[2] = sy[2]; - stream.printf("%d %d %d %d %d %d %s\n", + stream.printf("%d %d %d %d %d %d _c\n", (int)cx[0], (int)cy[0], (int)cx[1], (int)cy[1], - (int)cx[2], (int)cy[2], pdf_mode ? "c" : "_c"); + (int)cx[2], (int)cy[2]); } /* @@ -464,50 +459,27 @@ void GlyphToType3::do_composite(TTStreamWriter& stream, struct TTFONT *font, BYT (int)flags,arg1,arg2); #endif - if (pdf_mode) + /* If we have an (X,Y) shift and it is non-zero, */ + /* translate the coordinate system. */ + if ( flags & ARGS_ARE_XY_VALUES ) { - if ( flags & ARGS_ARE_XY_VALUES ) - { - /* We should have been able to use 'Do' to reference the - subglyph here. However, that doesn't seem to work with - xpdf or gs (only acrobat), so instead, this just includes - the subglyph here inline. */ - stream.printf("q 1 0 0 1 %d %d cm\n", topost(arg1), topost(arg2)); - } - else - { - stream.printf("%% unimplemented shift, arg1=%d, arg2=%d\n",arg1,arg2); - } - GlyphToType3(stream, font, glyphIndex, true); - if ( flags & ARGS_ARE_XY_VALUES ) - { - stream.printf("\nQ\n"); - } + if ( arg1 != 0 || arg2 != 0 ) + stream.printf("gsave %d %d translate\n", topost(arg1), topost(arg2) ); } else { - /* If we have an (X,Y) shif and it is non-zero, */ - /* translate the coordinate system. */ - if ( flags & ARGS_ARE_XY_VALUES ) - { - if ( arg1 != 0 || arg2 != 0 ) - stream.printf("gsave %d %d translate\n", topost(arg1), topost(arg2) ); - } - else - { - stream.printf("%% unimplemented shift, arg1=%d, arg2=%d\n",arg1,arg2); - } + stream.printf("%% unimplemented shift, arg1=%d, arg2=%d\n",arg1,arg2); + } - /* Invoke the CharStrings procedure to print the component. */ - stream.printf("false CharStrings /%s get exec\n", - ttfont_CharStrings_getname(font,glyphIndex)); + /* Invoke the CharStrings procedure to print the component. */ + stream.printf("false CharStrings /%s get exec\n", + ttfont_CharStrings_getname(font, glyphIndex)); - /* If we translated the coordinate system, */ - /* put it back the way it was. */ - if ( flags & ARGS_ARE_XY_VALUES && (arg1 != 0 || arg2 != 0) ) - { - stream.puts("grestore "); - } + /* If we translated the coordinate system, */ + /* put it back the way it was. */ + if ( flags & ARGS_ARE_XY_VALUES && (arg1 != 0 || arg2 != 0) ) + { + stream.puts("grestore "); } } @@ -559,7 +531,6 @@ GlyphToType3::GlyphToType3(TTStreamWriter& stream, struct TTFONT *font, int char ycoor = NULL; epts_ctr = NULL; stack_depth = 0; - pdf_mode = font->target_type < 0; /* Get a pointer to the data. */ glyph = find_glyph_data( font, charindex ); @@ -610,15 +581,7 @@ GlyphToType3::GlyphToType3(TTStreamWriter& stream, struct TTFONT *font, int char /* Execute setcachedevice in order to inform the font machinery */ /* of the character bounding box and advance width. */ stack(stream, 7); - if (pdf_mode) - { - if (!embedded) { - stream.printf("%d 0 %d %d %d %d d1\n", - topost(advance_width), - topost(llx), topost(lly), topost(urx), topost(ury) ); - } - } - else if (font->target_type == PS_TYPE_42_3_HYBRID) + if (font->target_type == PS_TYPE_42_3_HYBRID) { stream.printf("pop gsave .001 .001 scale %d 0 %d %d %d %d setcachedevice\n", topost(advance_width),