From bfe6d26dae79728ac4c2bab3358bc0aa7fe9bdf8 Mon Sep 17 00:00:00 2001 From: kramm Date: Sat, 22 Feb 2003 18:54:34 +0000 Subject: [PATCH] fix for some truetype fonts. --- pdf2swf/SWFOutputDev.cc | 26 ++++++++++++++++++++++++-- 1 file changed, 24 insertions(+), 2 deletions(-) diff --git a/pdf2swf/SWFOutputDev.cc b/pdf2swf/SWFOutputDev.cc index 251cd04..66df8cc 100644 --- a/pdf2swf/SWFOutputDev.cc +++ b/pdf2swf/SWFOutputDev.cc @@ -965,8 +965,30 @@ char*SWFOutputDev::writeEmbeddedFontToFile(XRef*ref, GfxFont*font) refObj.fetch(ref, &strObj); refObj.free(); strObj.streamReset(); - while ((c = strObj.streamGetChar()) != EOF) { - fputc(c, f); + int f4[4]; + char f4c[4]; + int t; + for(t=0;t<4;t++) { + f4[t] = strObj.streamGetChar(); + f4c[t] = (char)f4[t]; + if(f4[t] == EOF) + break; + } + if(t==4) { + if(!strncmp(f4c, "true", 4)) { + /* some weird TTF fonts don't start with 0,1,0,0 but with "true". + Change this on the fly */ + f4[0] = f4[2] = f4[3] = 0; + f4[1] = 1; + } + fputc(f4[0], f); + fputc(f4[1], f); + fputc(f4[2], f); + fputc(f4[3], f); + + while ((c = strObj.streamGetChar()) != EOF) { + fputc(c, f); + } } strObj.streamClose(); strObj.free(); -- 1.7.10.4