IRC Logs

Log of #ghostscript at irc.freenode.net.

Search:
 <<<Back 1 day (to 2012/08/14)2012/08/15 
prince3176 hi ala06:01.13 
  i need help in mupdf06:02.09 
  any body help me06:02.49 
sebras tor8: an untested PNG patch over at sebras/master11:27.25 
aksr some of my pdf files are displayed in some strange symbols, i mean the entire document. If I try them in acroread (acrobat), they are displayed correctly, what could be the fault? 11:38.07 
  i could upload pdf for testing purposes11:38.57 
chrisl aksr: My guess would be that fonts (or more probably CIDFonts) are not embedded in the file, so you're relying on whatever (CID)fonts happen to be available - which differs between interpreters11:39.56 
aksr chrisl: you think it's font's fault?11:41.03 
  how then acroread displays them correctly?11:41.26 
  (i don't understand :))11:41.42 
robin_watts_mac aksr: A 'well formed' PDF would have all the font details within it.11:42.00 
aksr yes..?11:42.11 
robin_watts_mac It's probable that your PDF is not well-formed, and just mentions some fonts by name.11:42.25 
chrisl aksr: If acroread happens to have a matching CIDFont installed, it will work as expected - this is the reason the spec *stringly* advises CIDFonts should be embedded11:42.32 
aksr so, there is no way to fix this, right?11:42.51 
robin_watts_mac Unless those EXACT fonts, with those exact names are found, the pdf viewer has to guess.11:43.02 
chrisl aksr: what interpreter are you using?11:43.11 
robin_watts_mac Acrobat and gs both use different guessing rules (they aren't well documented)11:43.19 
  For CID fonts it's even worse.11:43.35 
aksr i tried to open it via acrobat and gs(view)11:43.46 
  via acrobat is fine11:43.52 
  second-not11:43.58 
chrisl And what platform?11:44.01 
robin_watts_mac The fix is to ensure that whoever makes your PDFs makes them properly.11:44.03 
aksr linux11:44.05 
  it's a book i downloaded from the *net11:44.20 
chrisl A legit download, or something less so?11:44.46 
aksr If you mean, did I pay for it-no.11:45.11 
  :)11:45.13 
  Can I, somehow, fix this?11:45.43 
  I mean to modify the pdf somehow ..11:45.53 
chrisl Okay, can you post it somewhere, as you suggested?11:46.08 
aksr Of course.11:46.16 
  Just a second.11:47.34 
aksr now waits ...11:53.22 
  chrisl: https://anonfiles.com/file/3791ca2d0beb1dff06e5b5ad4054fe0f11:53.54 
  good?11:53.58 
chrisl getting it now.......11:54.16 
aksr ;)11:54.18 
chrisl aksr: hmm, not what I was expecting :-(11:56.00 
aksr try it with acroread11:56.34 
kens Lots of embedded type 1 subsets11:57.29 
  But Symbol si not embedded11:57.35 
chrisl Yeh, but seems like lots of non-Symbol stuff is messed up11:58.35 
kens So I see, that's fairly weird11:58.51 
  Page 2 is using BOPORM2 as teh font11:59.24 
chrisl FWIW, poppler has similar output to ours.....12:00.57 
aksr chrisl: yes.12:01.06 
kens So does MuPDF12:01.23 
aksr yes i tried gsview, mupdf, poppler etc.12:01.43 
  acro and foxit get it right12:02.05 
kens THe text looks sane enough:12:02.27 
  29.888 0 0 29.888 257.835 563.587 Tm12:02.28 
  (T) Tj12:02.28 
  17.933 0 0 17.933 277.203 563.587 Tm12:02.28 
  (rigonometric) Tj12:02.28 
  29.888 0 0 29.888 413.185 563.587 Tm12:02.28 
  (D) Tj12:02.28 
  17.933 0 0 17.933 437.613 563.587 Tm12:02.29 
  (elights) Tj12:02.29 
  Hmm, the Encoding only supplied a Diffrences array, I wonder if we are using a different default encoding12:03.50 
chrisl If we weren't applying the differences, we'd have a *lot* of files not working.12:04.37 
kens No what I mean is the basic encoding to which the DIffrences are applied12:04.51 
  The ENcoding dictioanry only seems to specify a Differences, not an Encoding12:05.09 
chrisl looks up PDFRM.....12:06.16 
kens We seem to be 'out by one' for the text on page 212:06.18 
  T->U, r->s, i->h etc12:06.36 
chrisl Oh, lord more symbolic vs non-symbolic nonsense :-(12:08.22 
kens Yes, I was just reading that12:08.33 
  BUt we don't need to worry about it because hte font is built in12:08.55 
  and rtherefore we should be using the built-in fonts base encoding12:09.05 
  Want to bet Acrobat does 'something else ' ?12:09.23 
  Going to have to decipher the type 1 font stream12:09.41 
  Type 1C font....12:10.38 
chrisl Hmm, font "Uses the Adobe Standard Roman Character Set: True".....12:11.20 
kens Which is presumably StandardEncoding, which should be fine12:11.37 
chrisl Unless, the font's encoding *isn't* StandardEncoding.....12:11.59 
kens Have you used cffdisasm on it ?12:12.11 
chrisl No12:12.18 
kens OK I'm still pulling the binary stream out12:12.26 
  Umm I have it deciphered, I just can't remember how to use teh Encoding in a CFF gtont :-(12:14.38 
kens heads for the type 2 spec12:15.06 
  Both Charset and Encoding are format 012:16.29 
  This does not look like a standard encoding to me12:17.28 
aksr Are you still sure it's font's fault?12:17.37 
kens Still looking, but it seems likely12:17.50 
  Or more accuratley Acrobat is not following the specification12:18.02 
  "/A is code 63"12:18.14 
  And hsould be 65, so that is out byb 112:18.46 
  2*12:18.48 
  B = 65, C = 66, D = 67 etc12:19.11 
  All out by one, just as expected12:19.26 
  So the font is *not* using a standard encoding, but Acrobat is applying one. I very strongly suspect teh PDF creation tool has created a mangled subset font, tried it on Acrobat @oh look it works' and that's the problem.12:20.09 
  I'm going to try fixing some of the font and see what happens12:20.59 
  cffasm doesn't liek the font, so I'm giving up12:25.15 
  In my opinion Ghostscritp et al are following the spec, Acrobat isn't (its ignoring teh Encoding in the built-in font, when it is not specified by the PDF file, but a Differences array is present). Whether ww choose to emulate it is up to chrisl and alexcher12:27.43 
aksr hm.12:28.24 
chrisl It's not obvious to me what Acrobat is using - hacking our PDF interpreter to apply the Differences to StandardEncoding doesn't *seem* to work :-(12:29.03 
kens It looks like STandardEncoding ought to work12:29.41 
  THe few pieces of text I've looked at seem to be 'ASCII'12:29.56 
robin_watts_mac how come mupdf gets it right ?12:31.24 
kens It doesn't12:31.33 
robin_watts_mac Oh, ok. That's much easier to believe :)12:31.47 
kens Of course, it depends what you mean by 'right' :-)12:32.11 
  It matches GS, not Acrobat12:32.22 
robin_watts_mac matching gs is fine. Had we been matching acrobat, then that's always harder to explain.12:33.07 
kens Hmm, no wtha's odd....12:33.11 
  page 3 comes out 'correct'12:33.18 
robin_watts_mac OK. Lunch over. Heading to the pool. ttyl.12:33.30 
kens enjoy robin_watts_mac12:33.42 
robin_watts_mac ta12:33.46 
kens chrisl here's an interesting thing.12:36.58 
  If I add '/StandardEncoding' to the Encoding dict in object 586 0, Acrobat shows *exactly* the same problems we do12:37.32 
  On page 312:37.38 
  and on other pages too12:38.04 
chrisl Yeh, I'm actually struggling to find where (if!) we get the encoding from a Type1C font in order to apply the differences to it12:38.37 
kens THat might be the problem then, we aren't applying it and Acrobat is. Or something12:39.02 
  By adding /BaseEncoding /StandarEncoding to the PDF file ,I believe I am preventing Acrobat looking up the Encoding in the CFF font.12:39.37 
  THe modified file displays exactly the same using GS and MuPDF which suggests to me they are not applying the actual encoding12:41.04 
  (in the font)12:41.10 
chrisl Yeh, let me debug our PDF interpreter a bit more......12:41.34 
kens Going to try modifying the Differences array12:41.35 
  Huh, made no difference to GS or Acrobat :-(12:45.26 
  I'll leave it with you chris12:45.34 
chrisl Er, hmm, I just "properly hacked" our PDF interp to use StandardEncoding for these fonts, and got the "correct" output - color me confused.....12:45.57 
kens I guess I'm puzzled then.12:46.14 
  Maybe I misread the Differences array12:46.28 
  Certainly, what you say is what I thought was going on12:46.46 
chrisl Ho, *torrential* rain here.....12:47.18 
kens Oh, bet that's heading my way :-(12:47.32 
chrisl aksr: do you have other files like this, or is this the only problem?12:48.05 
aksr I think I encountered one (or more) but I don't now their name chrisl 12:48.43 
  I'll look for them. ;)12:48.51 
  As soon as I find you them, you'll be informed!12:49.10 
  s/now/know now12:49.53 
  chrisl: so, you succeeded or..?12:50.56 
chrisl aksr: I can get that file to come out legibly - I can say with confidence what Acrobat is *not* following the spec, but I cannot say what Acrobat *is* doing, for sure12:52.06 
aksr hm.12:52.32 
chrisl aksr: what I was thinking was that if this was the only file with the problem, I can give you a fixed version of the file.12:53.42 
aksr i would love that and if can show me what to fix for other ones?12:54.23 
chrisl aksr: they way I "fixed" it was to use Ghostscript's pdfwrite device with a hack in the PDF interpreter......12:55.23 
aksr ok...12:56.08 
  that isn't a fast way, is it chrisl?12:57.52 
chrisl It didn't take long - but you do lose some metadata from the file12:58.35 
aksr chrisl: what then i need to do?13:03.08 
chrisl aksr: do you know where the Postscript resources are stored for GS on your distribution?13:03.44 
aksr yes?13:06.12 
chrisl OKay, so I'll put together a patch for you to apply, give me a minute13:06.43 
aksr chrisl: /usr/share/ghostscript/9.06/Resource/?13:10.20 
  here ↑?13:10.29 
chrisl aksr: yes. What I *strongly* suggest is that you create a directory somewhere in your user area, and copy the contents of /usr/share/ghostscript/9.06/Resource/Init into that - it should *not* have the string "resource" or similar in the path13:11.45 
aksr i planned that ;)13:12.12 
chrisl You can then tell Ghostscript to search *your* directory (as well as the default) for its init files by giving it teh "-I<path>" option13:13.07 
aksr ;)13:13.59 
chrisl aksr: once you have your own set of GS init files, you can apply this patch: http://www.ghostscript.com/~chrisl/cff-encoding.patch13:14.19 
aksr chrisl: with what should I apply this patch?13:15.54 
  diff patch13:16.08 
chrisl patch13:16.18 
aksr or manually :P13:16.19 
chrisl has a better idea.....13:19.00 
  aksr: here's the whole file: http://www.ghostscript.com/~chrisl/pdf_font.ps13:20.04 
  No patching required13:20.12 
aksr chrisl: ok, thank you.13:24.14 
  when/if i find other files, you'll be informed. ;)13:24.34 
chrisl aksr: could you do me a favour and create a bug (attaching that PDF) at: http://bugs.ghostscript.com/13:26.03 
aksr chrisl: of course13:27.22 
  i'm not sure about pdf, though.13:27.34 
  since it's copyright13:27.42 
  you have it, right?13:27.49 
  keep it.13:27.55 
  do i must create an account?13:28.57 
chrisl Yes, you need an account.13:29.08 
aksr ok.13:29.12 
  chrisl: http://bugs.ghostscript.com/show_bug.cgi?id=69327913:38.07 
  good?13:38.08 
chrisl aksr: that's fine, sure. Now you'll get notification when I finalise a proper fix (I've reassigned it to me).13:39.23 
aksr chrisl: good.13:39.35 
  ;)13:39.37 
  chrisl: just one more question ..13:40.35 
  something like this:13:40.39 
  gs -I~/Resource/ Eli_Maor-Trigonometric_Delights.pdf13:40.41 
chrisl Well, I did specifically say *not* to have the string "resource" (or similar) in the path..... I used "gs_init/"13:41.40 
aksr gs -I~/gs_init/ Eli_Maor-Trigonometric_Delights.pdf13:44.30 
chrisl Hmm, should work - maybe leave off the trailing "/"13:45.12 
aksr chrisl: well, it isn't working.. 13:47.00 
  i copied pdf_font.ps to gs_init/Init13:47.24 
chrisl Oh, and Init is a directory?13:47.39 
aksr yes13:47.53 
  i use arch linux13:48.01 
  it's in off. repo13:48.12 
chrisl Okay, so the parameter is -I~/gs_init/Init13:48.19 
aksr chrisl: i pointed/copied the whole Resource directory13:49.48 
  it should point to the Init inside Resoruse ;)13:50.02 
  *Resource13:50.07 
chrisl You need to specify the path to the Postscript files13:50.35 
aksr is there a way to recompile it, to see it normally in other viewers?13:50.41 
chrisl gs -I~/gs_init/Init -sDEVICE=pdfwrite -o out.pdf Eli_Maor-Trigonometric_Delights.pdf13:51.17 
  Should give you a file called out.pdf which views correctly in other viewers13:51.39 
  But that patch causes all kind of mayhem with out regression tests :-(13:53.07 
aksr chrisl: ok, it works13:53.59 
  but reports many errors/warnings13:54.07 
chrisl Hmm, I don't get any errors or warnings13:54.38 
aksr is there a efficient way to edit metadata?13:54.40 
chrisl No13:54.50 
aksr ok13:56.18 
  chrisl: thank you very much!13:56.28 
chrisl aksr: thanks for find yet another case of Adobe failing to follow its own spec!13:56.54 
aksr :D13:57.19 
  i'll report everything worth reporting ;)13:57.36 
  bye13:57.41 
  chrisl: notice on page 2214:04.14 
  triangle in acro14:04.19 
  there isn't any after conversion14:04.27 
  you can compare versions14:04.38 
chrisl Well, assuming he means a pyramid - it is there when I convert it......14:08.22 
sebras tor8 Robin_Watts: I got word from zeniko that he desires to be patch attributed as zeniko and not Zeniko. just so you know. :)14:08.53 
kens chrisl the only triangle I can see on page 22 is the diagram14:09.40 
chrisl kens: me too - of course, does he mean "Page 22" or the 22nd page in the file?14:10.10 
kens THey are the same :-)14:10.22 
chrisl No, Page 22 of teh book is the 37th page in the PDF14:10.42 
kens Or possibly he means the 22nd page in the pages array14:10.47 
  Which has a number of triangles14:11.29 
  TBH the acrobat display on page 7 (22nd page) does not look correct to me14:11.59 
  "means to find a number such taht 250 times equals 180."14:12.25 
  I'm sure those blanks shouldn't be blank14:12.38 
chrisl Well, all the triangles I can find seem to be there.....14:13.52 
kens I cna't really comment abou thte triangles since I don't have a 'converted' file. I was just noting a problem with the so called 'correct' Acrobat display14:14.26 
chrisl Those seem to glyphs missing from the font (or encoding) which is also interesting.....14:15.32 
kens Yeah, that's what I was thinking14:15.42 
chrisl It's a p*ss poor excuse for a PDF, whatever way you look at it....14:16.44 
kens The font is I'm sure not what they intended14:17.42 
chrisl I think the entire file is not what they intended - but it sorta, just about works in Acrobat if you don't look too closely, so good enough :-(14:22.29 
kens I think they key point there is 'if you don't look too closely'....14:22.52 
  I wonder if Acrobat only ifgnores the font Encoding if its a CFF font....14:23.36 
chrisl The patch I threw together only does it for Type 2 fonts14:24.30 
kens Was just thinking aloud really14:25.11 
chrisl kens: it would make (some?) sense if it treated CFF fonts as "opaque" entities....14:26.00 
kens Yeah, they don't have an easy ENcoding, you have to assemble it yourself from the Encoding adn Charset dicts14:26.25 
  I bet Acrbat thinks that's too much like hard work14:26.52 
chrisl Well, I certainly don't intend to faff about making a PDF with a Type1 font to try it14:30.33 
kens I'm inclined to agree14:30.59 
  Ditalking of specs, did you see that Office 13 will finally support the Open XML document standard ?14:31.20 
chrisl Oh, I thought they'd done that a while back14:32.25 
kens No, they supported the 'transitional' format, which includes all the old Word formats...14:33.10 
  Not only for writing, but also for reading. SO MS Office couldn't open files in teh format that MS forced through the standards process14:33.35 
chrisl So is this XML format the default file format for Office 13, or a "save as"/export thing?14:35.09 
kens I think its the default, but you can still save in old formats14:35.32 
chrisl I was just wondering if it's likely to gain traction outside of MS....14:36.53 
kens I think OPenOffice/LibreOffice already support it :-)14:37.49 
chrisl But they use the other XML document standard by default, don't they?14:38.57 
kens chrisl I'm not sure about that, not my field14:39.16 
chrisl It's not something I pay a lot of attention to....14:40.41 
kens Me neither, but I have more confidence in teh OpenOffice people supporting an ISO standard than MS :-)14:41.13 
  I do remember MS forcing the spec through the ratification process.14:41.39 
  Its only taken them 7 years to get to the point of actually adopting it14:41.52 
chrisl Well, maybe they realised that XML doesn't fix every problem!14:42.21 
kens sounds too sensible to me14:44.37 
henrys chrisl, tor8:can we put up mupdf 1.1 yet?15:24.54 
  on the gs downloads page?15:25.06 
chrisl henrys: to the best of my knowledge, it's not released yet15:26.05 
henrys right the candidate is out but it's not released. I guess the question was more for tor8.15:28.08 
tor8 henrys: candidate is out, a few important patches in the pipe.15:30.11 
  going to build and upload final release tomorrow if all goes well15:30.40 
henrys okay great15:33.42 
paulgardiner tor8: do you have my android commits for the 1.1 release, or is that not an issue?16:23.05 
tor8 paulgardiner: I am planning on taking on the commits on paul/master for 1.1, yes16:37.51 
sebras tor8: I can feel the pressure...17:28.52 
mvrhel_laptop switched IRC clients. Chatzilla was giving me issues17:45.51 
  bbiaw18:07.33 
lesshaste hi18:34.22 
ghostbot hello18:34.22 
lesshaste is it possible to invert the colours of a pdf using ghostscript?18:34.33 
  I really just mean swap black and white18:34.38 
alexcher lesshaste: yes, there are many ways to do this. Please give more details.18:45.57 
  lesshaste: What's the type of your output file.18:47.23 
lesshaste pdf18:49.58 
  alexcher: ^^18:56.13 
alexcher lesshaste: I'd recommend to redefine setgray operator to invert the color.18:56.27 
lesshaste how does one do that?18:56.40 
alexcher lesshaste: If you have images in the file, there's more work to do.18:57.11 
lesshaste I don't18:57.32 
alexcher lesshaste: let me do a few experiments.18:57.46 
lesshaste thanks18:57.51 
alexcher lesshaste: Is the source a PDF file ?18:58.42 
lesshaste yes18:58.51 
alexcher lesshaste: Do you want black background ?18:59.20 
lesshaste yes18:59.32 
  alexcher: too hard?19:22.24 
alexcher lesshaste: wait a little19:22.35 
lesshaste k19:22.56 
alexcher lesshaste: First, you need -dDELAYBIND option to enable modifications, e.g19:26.52 
  ~/ghostpdl/gs/debugbin/gs -dDELAYBIND -sDEVICE=pdfwrite -o OUT.pdf inv.ps INPUT.pdf19:27.20 
  inv.ps is a PS file that does redefinitions.19:27.48 
  /setgray {1 exch sub setgray} .bind def19:28.42 
  /old currentpagedevice /BeginPage get def19:28.43 
  /new {gsave 0 systemdict /setgray get exec clippath fill grestore} .bind def19:28.45 
  <</BeginPage { //old exec //new exec } .bind >> setpagedevice19:28.46 
  .bindnow19:28.48 
  lesshaste: that's all for now19:29.17 
lesshaste oh19:29.50 
  thanks.. this needs a blog post as it's non-trivial!19:29.58 
  or to be put on a wiki somewhere19:30.29 
pipitas alexcher: I tested your recent suggestion in this #channel to invert black/white for a PDF. I tried it like this: 20:13.03 
  gs -dDELAYBIND -o inverted.pdf -sDEVICE=pdfwrite -c "/setgray {1 exch sub setgray} .bind def /old {currentpagedevice /BeginPage get} .bind def /new {gsave 0 systemdict /setgray get exec clippath fill grestore} .bind def <</BeginPage {//old exec //new exec} .bind>> setpagedevice" -f input.pdf20:13.17 
  It works… but it doesn't invert :-)20:13.41 
alexcher pipitas: .bindnow is nissing20:14.47 
  pipitas: .bindnow is missing20:14.52 
pipitas Thanks for the hint, alexcher!20:15.24 
alexcher pipitas: besides, this hack only inverts colors set bt setgray .20:16.36 
lesshaste pipitas: did it work for you?20:49.03 
pipitas lesshaste: yes… provided the "colors" are defined by 'setgray'. I tested with a PDF created with this command: 21:12.07 
  gs -o noninverted.pdf -sDEVICE=pdfwrite -g5950x700 -c "/Helvetica findfont 48 scalefont setfont 10 10 moveto .7 setgray (Helvetica) show showpage"21:12.11 
  lesshaste: I also tested with http://www.adobe.com/content/dam/Adobe/en/devnet/acrobat/pdfs/PDF32000_2008.pdf21:13.27 
  lesshaste: My command to invert was: 21:14.07 
  gs -dDELAYBIND -o inverted.pdf -sDEVICE=pdfwrite -c "/setgray {1 exch sub setgray} .bind def /old {currentpagedevice /BeginPage get} .bind def /new {gsave 0 systemdict /setgray get exec clippath fill grestore} .bind def <</BeginPage {//old exec //new exec} .bind>> setpagedevice .bindnow" -f input.pdf21:14.22 
lesshaste ok21:37.44 
sebras paulgardiner: http://www.mass.gov/hed/undersecretary-barbara-anthony-statement-on-uber-technologies.pdf23:51.17 
  paulgardiner: this pdf consistently crashes the version of mupdf/android you sent me.23:51.41 
  E/AndroidRuntime(19902): Caused by: java.lang.ArithmeticException: divide by zero23:54.28 
  E/AndroidRuntime(19902): at com.artifex.mupdf.MuPDFActivity.createUI(MuPDFActivity.java:309)23:54.31 
  and there we have it. if core.countPages() returns 1 then smax will be 0 which causes a division by zero.23:54.59 
  tor8: just to be overly clear -- there is a slight problem with one of the patches over at paul/master.23:55.23 
 Forward 1 day (to 2012/08/16)>>> 
ghostscript.com
Search: