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

Skip to content

Remove now unused patches to ttconv. #19931

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Apr 13, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 0 additions & 17 deletions extern/ttconv/pprdrv.h
Original file line number Diff line number Diff line change
Expand Up @@ -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);

/*
Expand Down Expand Up @@ -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<int>& glyph_ids);

void get_pdf_charprocs(const char *filename, std::vector<int>& glyph_ids, TTDictionaryCallback& dict);

/* end of file */
35 changes: 1 addition & 34 deletions extern/ttconv/pprdrv_tt.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1336,8 +1336,7 @@ void read_font(const char *filename, font_type_enum target_type, std::vector<int
/* If we are generating a Type 3 font, we will need to */
/* have the 'loca' and 'glyf' tables arround while */
/* we are generating the CharStrings. */
if (font.target_type == PS_TYPE_3 || font.target_type == PDF_TYPE_3 ||
font.target_type == PS_TYPE_42_3_HYBRID)
if (font.target_type == PS_TYPE_3 || font.target_type == PS_TYPE_42_3_HYBRID)
{
BYTE *ptr; /* We need only one value */
ptr = GetTable(&font, "hhea");
Expand Down Expand Up @@ -1401,38 +1400,6 @@ void insert_ttfont(const char *filename, TTStreamWriter& stream,

} /* end of insert_ttfont() */

class StringStreamWriter : public TTStreamWriter
{
std::ostringstream oss;

public:
void write(const char* a)
{
oss << a;
}

std::string str()
{
return oss.str();
}
};

void get_pdf_charprocs(const char *filename, std::vector<int>& glyph_ids, TTDictionaryCallback& dict)
{
struct TTFONT font;

read_font(filename, PDF_TYPE_3, glyph_ids, font);

for (std::vector<int>::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),
Expand Down
83 changes: 23 additions & 60 deletions extern/ttconv/pprdrv_tt2.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -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('{');
Expand All @@ -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;
Expand Down Expand Up @@ -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);
}

/*
Expand Down Expand Up @@ -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]);
}

/*
Expand Down Expand Up @@ -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 ");
}

}
Expand Down Expand Up @@ -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 );
Expand Down Expand Up @@ -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),
Expand Down