IRC Logs

Log of #ghostscript at irc.freenode.net.

Search:
 <<<Back 1 day (to 2016/07/12)20160713 
tor8 Robin_Watts: sebras: (for the logs) javascript doesn't have inheritance like in java, which is why I haven't made PDFDocument a subclass of Document.09:48.48 
  I don't really see a pressing need for it either, even though it looks better, in use it wouldn't make much difference09:49.09 
  in javascript bindings, a "pointer" to native data is typed; and these types don't have subclasses09:49.54 
  sebras: in Font_newNative, you move the name = GetStringUTFChars into the try block (for some unknown reason), but don't add fz_var(name).10:04.56 
  sebras: jstring jstring, does that even work?10:07.36 
  I went with jtype var_ for a reason :)10:07.56 
  same issue with Text_showString, Image_newNativeFromFile, and several others10:09.08 
  oh, I see what you did there10:10.14 
  you're fz_try so you can fz_throw so you can jni_rethrow... if GetSTringUTFChars fails, call jni_throw() and return early instead10:12.45 
  zebras: several comments in the irc log10:14.50 
zebras tor8: I moved it inside the try block because we presumably and to have jni_rethrow or jni_throw create a java exception.10:16.01 
  Previously I'm not sure that happened.10:16.11 
tor8 zebras: previously we failed silently, so doing something is right.10:16.24 
  but assigning inside a try block and reading in the catch/always NEEDS MUST HAVE a fz_var10:16.42 
zebras I've been looking in this log not the private one (yet).10:16.48 
tor8 however, you don't need to move it inside the fz_try block at all10:16.56 
  because you can just signal a JVM error and return, without needing to contort to throw a fitz exception only to convert it back to a JVM exception10:17.15 
zebras How?10:17.39 
tor8 name = GetStringUTFChars(); if (!name) { jni_throw(env, "cannot convert to C string"); return 0; } or something like that in10:18.04 
  jni_throw just wraps a (*env)->ThrowNew call10:18.37 
zebras Some functions were using the j-prefix some the _-suffix. I wanted all to use the same and then my code to follow the pattern.10:18.52 
  Tor8: will fix code accordingly.10:19.26 
tor8 zebras: yeah, I got collisions with type names using 'j' prefixes that Robin had started out by using, so went with _ suffix for the new code I wrote10:19.27 
  did not fix the old code at the time though10:19.33 
zebras I might as well tidy a bit while I'm at it.10:20.02 
tor8 zebras: I'm surprised 'jstring jstring' actually compiles...10:20.10 
  I guess I don't know C as well as I thought...10:20.29 
zebras It does. :)10:20.35 
  I guess types and identifiers do not share namespace.10:20.53 
tor8 typedef is horribly hacky10:21.03 
zebras Also note the added writeLines in Buffer.10:21.10 
tor8 I knew 'struct jstring jstring' would work, but thought typedef would mess with the symbol table and return a different token for the parser10:21.36 
  zebras: fz_new_buffer(0) will use its own default buffer size10:23.00 
  zebras: oh, varargsy stuff in java?!10:23.18 
zebras Yes!10:23.32 
  It is simply treated as an object array10:23.49 
  But the types I the array is limited to one.10:24.07 
tor8 uhm, in writeLines you do GetStringUTFChars and if that fails you jni_rethrow (but you have no fitz exception to rethrow)10:24.36 
  should be jni_throw10:24.41 
zebras Yeah I got that now10:25.05 
tor8 huh, so String... foo gets automatically converted to a String[] array when calling?10:25.56 
zebras Yes.10:26.23 
tor8 ouch. that's not going to be fast, but then again, it's convenient and doesn't need any bytecode changes to implement10:26.53 
zebras And the types of what is put in the varargs must be Strung (or null)10:26.59 
  Nope.10:27.10 
  Not sure when the types are checked but the compiler certainly checks it at least.10:27.46 
  Ok. But in general it looks ok?10:28.31 
tor8 zebras: yes, it's on the right path :)10:28.56 
zebras No, actually the paths are wrong.... ;)10:34.23 
Robin_Watts tor8: From my experience of Actionscript, which is also ECMAscript based, that DOES have inheritance, using prototype fields.10:59.12 
  Does that not carry over into js ?10:59.18 
tor8 prototype chains are not inheritance.10:59.41 
  and you can trivially abuse 'this' pointers and methods in javascript, to call methods from other objects on other objects11:00.08 
Robin_Watts tor8: It's the closest as gets.11:01.29 
tor8 I can do it, by adding a second round of checks for "fz_document" typed userdata pointers and converting when calling a PDFDocument method,11:01.34 
  and explicitly accepting "pdf_document" typed userdata in Document methods11:01.52 
Robin_Watts If I'm following what you're saying, that will mean that you can pdf specific methods on a Document, and it'll throw an error.11:03.53 
  Using prototype chains would mean that you couldn't call the method in the first place, I think (or you'd get a non-existent method error or something)11:04.34 
tor8 Robin_Watts: PDFDocument.prototype.addObject.call(a_fitz_document, obj)11:05.41 
  it's trivial to rebind the 'this' pointer in java to be anything on anything11:06.08 
Robin_Watts tor8: Suppose you have a Document object doc.11:06.08 
tor8 pdfdoc.addObject.call(docdoc)11:06.26 
Robin_Watts doc.genericmethod(doc) works.11:06.37 
tor8 the 'call' method on functions allows to call it with any 'this' object (taken from the first argument of call)11:06.55 
Robin_Watts doc.pdfspecificmethod(doc) will only work if doc is a pdfspecifc thing.11:07.04 
  tor8: right, so you need to check the 'this;' type.11:07.18 
tor8 Robin_Watts: yeah, but only if *created* as a pdfspecific thing11:07.21 
Robin_Watts tor8: Right, that's my point, I think.11:07.44 
tor8 if we create it as a genericdoc, but it is a pdf document and can be casted with pdf_specifics, that won't happen unless we hard code special cases for it11:07.53 
Robin_Watts whenever you create a 'doc', it should be created as the appropriate subclass and downcasted to a doc.11:08.10 
tor8 so it will only work if you either do doc = new PDFDocument() or call doc.toPDF()11:08.25 
  the latter, doing the equivalent of calling pdf_specifics11:08.48 
  fz_new_document always creates a fz_document11:09.07 
  are you saying to in JS and JNI code always check pdf_specifics after creating a fz_document and creating a PDFDocument instead if so?11:09.36 
Robin_Watts I'm still feeling my way here.11:09.54 
  in C, we do doc = fz_open_document(filename) and if filename is a pdf, it returns a pdf_document cast to be a fz_document.11:10.27 
  so in js, or java, if we do doc = new Document(filename) and filename is a pdf, then I would expect to get a PDFDocument back, downcast to a Document.11:11.16 
  but I could then do instanceof(doc) to see if it was really a PDF file underlying it.11:11.38 
tor8 s/downcast/upcast/ I believe11:12.01 
Robin_Watts Does that make sense, or am I babbling more incoherently than usual.11:12.03 
tor8 downcasting is making it more specific11:12.08 
  (and hence confusing me)11:12.25 
Robin_Watts Apologies. I always get that wrong.11:12.50 
tor8 are you wanting to be able to call doc = new PDFDocument() and use the doc as a generic Document?11:13.05 
  and do pdfdoc = pdf_specifics(doc) and use pdfdoc as if it also were a Document11:13.41 
Robin_Watts tor8: I'm not convinced that pdf_specifics should exist in the java code.11:15.05 
tor8 what we have now allows both down and upcasting, but not using the PDFDocument in place of a Document11:15.09 
Robin_Watts instanceof is the standard java way to work.11:15.27 
tor8 Robin_Watts: then we need to hack the Document constructor to return a subclass... I don't think that'll work11:15.39 
Robin_Watts What Document constructor?11:16.11 
  if you do doc = new Document() then you always get a Document.11:16.23 
tor8 doc = new Document("foo.pdf")11:16.26 
Robin_Watts if you do doc = Document.openFile("foo.pdf") then you can get a PDFDocument {up,down}casted to a Document11:16.58 
  cos the implementation of Document.openFile can call new Document or new PDFDocument as required.11:17.30 
  And that's a perfectly java thing to do.11:17.38 
tor8 yeah, factory methods are the only way to do it11:19.04 
deekej Hello guys! I work at Red Hat and our internal Coverity Scan have found possible issue (more like a warning) in ghostscript-9.07, which has not been fixed yet in latest upstream version. Do you have any special mailing list for bug-reports?11:19.12 
tor8 in java11:19.32 
deekej Or do you prefer entering the issue in your bugzilla?11:19.36 
Robin_Watts deekej: if you can reproduce the bug in 9.19, then please open a bug on bugs.ghostscript.com11:19.47 
tor8 Robin_Watts: I rather like the pdf_specifics equivalent in terms of how it is used though11:20.10 
Robin_Watts tor8: But it's not java.11:20.19 
  In C we do: pdf_doc = pdf_specifics(doc); if (pdf_doc == NULL) not a pdf file...11:21.28 
tor8 Robin_Watts: though, ideally, a viewer shouldn't need to know or care that it's a pdf document in the first place...11:21.50 
  except that annotations can't be edited on any other document type11:22.01 
  and that's how we know11:22.07 
Robin_Watts In Java we do: if (doc instanceof PDFDocument) { pdf_doc = (PDFDocument)doc; ... }11:22.28 
tor8 exactly the same thing, different syntax11:22.49 
Robin_Watts Right.11:22.57 
  But using the first one is a "surprise" for the java programmer, and hence less good.11:23.16 
tor8 allowing the second one also necessitates hacking around with factory methods rather than just a plain constructor though, so moving the surprise elsewhere11:24.04 
  we'd have to make the Document constructor private11:24.23 
Robin_Watts Factory methods are not a surprise. They are bog standard.11:24.32 
  Yes, we'd need to make that constructor private.11:24.55 
  (or non public at least)11:25.31 
  I don't have enough js experience to know if this applies to js too, but I suspect with prototype chains it might.11:27.17 
tor8 a constructor in JS can return anything11:27.45 
Robin_Watts Our overriding aim should be to make the 'most native' appearing API in each language, I think.11:28.01 
tor8 but it would make sense to mirror the interfaces, so it'd be doc = Document.openFile()11:28.05 
  and then it'd be either a Document or PDFDocument when returned11:28.12 
  and all the methods would need to be able to automatically cast (and throw type errors) between fz_document and pdf_document11:28.35 
deekej Robin_Watts: hmm, looking more into the code, the warning from CovScan is false positive, because gx_set_device_color_1() from base/gscolor.c:214 always returns value '0'11:28.50 
tor8 the problem is there's nothing preventing JS to call new Document() and what'll that end up doing?11:29.19 
Robin_Watts deekej: we use coverity ourselves.11:29.31 
tor8 I think JS and Java are similar enough that we shouldn't make them behave differently enough11:29.33 
Robin_Watts The latest versions are MUCH improved.11:29.39 
deekej ah, ok :)11:30.08 
Robin_Watts deekej: If you're genuinely worried about code stablility then the easiest thing would be for you to stop using code that's 5 years old :)11:30.13 
deekej Robin_Watts: well, I'm all up for continuos development and integration :D However, our customers require "stability" :)11:31.04 
Robin_Watts deekej: We do 2 releases a year.11:31.30 
  And we have commercial customers, so the public APIs don't change each time. It would be an invisible update to your users, generally.11:32.20 
  I could understand you not taking every release, but to worry about silly things like running coverity, when you aren't staying relatively current strikes me as bonkers, I'm afraid.11:33.29 
deekej Ah, don't take me wrong. I didn't realize you use coverity as well, so I just wanted to point out to a potential problem in case you didn't know about it yet. :)11:35.04 
Robin_Watts tor8: You mean there is no concept of private/public in JS, so we have to have a public Document constructor ?11:35.13 
  deekej: Yeah, we used Coverity a while ago, then we dropped it for a bit, now we're back using it again, together with a whole host of other such tools.11:36.01 
  The results aren't public, yet.11:36.11 
deekej ok :) I'm sorry for wasting your time.11:36.23 
Robin_Watts But the plan is that they should be soon.11:36.25 
  No worries!11:36.27 
  But seriously, please consider updating.11:36.40 
  It would help us immensely because it'd cut down on the number of "Hey your code is broken" "Please try the latest version" "Oh, it works" interactions we go through :)11:37.23 
deekej To be honest, I would prefer the update. The problem is some of our policies for older RHEL releases. Generally, more older the release, more likely it will not get a rebase.11:37.35 
Robin_Watts Sure, but new releases should get new versions, IMAO.11:37.54 
tor8 Robin_Watts: correct. everything in JS is public.11:38.46 
deekej I alone can't do much about it. :-/ Anyway, at some point in the future, RHEL8 will be forking from some release of Fedora. I will make sure there will be stable latest release of ghostscript there. :)11:38.56 
Robin_Watts deekej: Thanks.11:39.16 
  tor8: hmm. That scares the pants of me then. How can you ever be sure that the native data pointers are of a particular type?11:40.32 
  Or are the native pointers not accessible from the language side ?11:40.53 
tor8 they are hidden from the language side, but nothing prevents you from doing tricks to call them with the "wrong" methods.11:42.31 
  hence all native pointers are associated with a type internally in JS bindings11:42.43 
Robin_Watts tor8: Right.11:42.51 
tor8 so you can check that they are of the correct type before trying to use them11:42.55 
Robin_Watts tor8: So we can do the same stuff that java does, but we need to have additional runtime checking in the native layers.11:43.54 
tor8 you create a javascript object of the "userdata" class (the "classes" in JS are object, array, function, boolean, number, string, date, etc)11:44.15 
Robin_Watts If you try and call a pdf method with a non pdf doc, then throwing an exception seems reasonable.11:44.17 
tor8 and the JS classes have *nothing* to do with the prototype chains11:44.29 
Robin_Watts No, but the methods which you can call on an object DO have to do with the prototype chains, right?11:45.11 
tor8 the prototype chains are used to look up missing properties on an object11:45.27 
  which tend to be used to implement object oriented inheritance chains, but can also be used for other things11:45.42 
  doc.loadPage() will try to find a "loadPage" property on the doc object, can't find it so it goes looking through the prototype chain11:46.13 
Robin_Watts Right.11:46.22 
tor8 and there is some voodoo to set the internal prototype property of an object (which is invisible from the JS language) when calling constructors11:47.06 
Robin_Watts so while you can't fish.pedal() you can spoof it by Human.pedal(fish).11:47.15 
  tor8: Yeah, this all brings back memories of the AS interpreter I did for Picsels flash player.11:47.39 
tor8 doc = new Document() is roughly equivalent to doc = Object.create(Document.prototype)11:47.40 
  but also calls the function called "Document" to initialize the object11:47.55 
Robin_Watts Given javascripts ability to allow such calls to be spoofed, presumably your always having to check the userdata type anyway in the implementation ?11:48.41 
  s/your/you're/11:48.52 
tor8 Robin_Watts: correct. in mujs I have a function: void *js_touserdata(object, type_tag) which checks the native pointer type tag and throws a type error if they don't match11:49.28 
Robin_Watts tor8: Right.11:49.38 
  So, I reckon it *is* possible to do away with reflecting pdf_specifics into the languages, and we *should* do so, in favour of {up,down}casted objects.11:50.27 
tor8 Robin_Watts: with javascripts dynamically typed nature, the pdf methods would always be accessible on a doc object if it was a pdf11:51.26 
  no up/downcasting in javascript11:51.42 
Robin_Watts tor8: That sounds ideal.11:51.56 
tor8 but throw massive 'undefined' errors if you try to call a pdf method on a non-pdf document11:52.18 
  I worry about JS newbies coming in and wondering why their code that used to work fails when fed an XPS document :)11:52.35 
Robin_Watts So in javascript the done thing is to test for a particular method being present to see if it's an object of a particular type, I think.11:52.51 
tor8 there is an 'instanceof' operator in JS, which checks the prototype chain11:53.15 
  but it's hardly of any use11:53.21 
Robin_Watts tor8: Well, the errors being thrown should give them a hint :)11:53.26 
tor8 I *think* I would prefer that if you call new PDFDocument you can use it as a Document, but not the other way around11:54.32 
  downcasting is an *ugly* hack no matter how you look at it11:55.20 
Robin_Watts tor8: But normally you are passed a stream or a file, and you open it.11:55.21 
  You don't know the type. You know the type by what the open call gives you.11:55.51 
tor8 I'm thinking of the case where you are creating a new PDF document (or editing an old one) and want to present it using the normal fitz document viewer stuff11:55.57 
Robin_Watts tor8: Right, if you want to create a NEW PDF Document, then you call new PDFDocument.11:56.20 
tor8 the other case (which is what pdf_specifics does) is to detect and hard code special cases for PDF documents in the viewer11:56.35 
Robin_Watts (or a factory method like Document.newOfType(type))11:56.55 
  (but new PDFDocument is probably nicer)11:57.11 
tor8 Robin_Watts: hm. we *could* make Document not be a function, so you can't call it (but it still has methods and a 'prototype' object, as if it were) but that feels wrong somehow11:58.01 
  for JS I added Document.toPDF and PDFDocument.toDocument to do the type casting11:58.42 
  to help a little bit with the type safety11:58.59 
  but I haven't found a use for it in any of the examples I can come up with11:59.30 
  except for upcasting to a Document to render the PDF document you're creating/editing12:00.07 
  generally you know you're doing stuff with PDF, in which case you just create a PDFDocument12:00.29 
  but when creating/editing stuff from a script, you generally want to save the PDF not draw it :)12:01.23 
Robin_Watts tor8: yeah.12:02.31 
  What the hell is a PDF "Layer"?12:02.43 
  Is that optional content ?12:02.52 
tor8 Robin_Watts: I think that's related to the optional content groups you can toggle on and off as a "layer"12:03.08 
Robin_Watts ok. that makes sense, thanks.12:03.19 
  tor8: http://git.ghostscript.com/?p=user/robin/mupdf.git;a=commitdiff;h=3f361e35265e6f5f50b6f92c14d7b352a228596b12:16.05 
tor8 Robin_Watts: LGTM12:16.42 
Robin_Watts ta.12:30.33 
kens2 tor8 ping12:50.37 
Robin_Watts tor8: http://editorconfig.org/12:53.36 
tor8 kens: yes?12:54.57 
kens tor8 I think the problem with teh XPS file is that, for rendering, setting text rendering mode doesn't actually do anything.12:55.21 
  Whereas for pdfwrite, it does12:55.29 
tor8 kens: ohhhh12:55.50 
kens If you aren't using pdfwrite, you need to manually do a 'charpath stroke' if you want to do fake emboldening12:55.56 
tor8 so we're setting linewidth with the wrong scale12:56.03 
kens Well, taht's less clear.12:56.11 
  The code uses 0.02 * font_scale, and font_scale is gigantic12:56.25 
  Presumably becuase teh CTM is small, and it doesn't take that into account12:56.49 
  However, in addition to text_rendering_mode only working for pdfwrite, you also need to se the stroke colour if you *do* use it12:57.20 
  Which is why we stroke in black not red12:57.27 
  The stroke colour never gets set.12:57.36 
  SO currently pdfwrite is honouring what the XPS interpreter does, but rendering is imply ignoring the synthetic bold12:58.05 
  I'm not quite sure yet how to tackle this. I'm going to have a look at what zcharpath does and see if I can use that12:58.42 
  Then I'll need to try and figure out why the line width is quite so huge12:59.21 
  I may need some help with this....13:00.02 
tor8 kens: mupdf does something similar, but uses freetype to do the emboldening rather than stroking on top13:03.43 
kens Ummm..... Not sure how I could do that13:04.05 
tor8 Robin_Watts: that'd be swell13:05.17 
kens I'm going to start by seeing if I can get a 'charpath' like thing to work, then calling stroke, then continuing with the fill ed text13:05.21 
Robin_Watts tor8: Looks like VS, Emacs, vim can all use it.13:05.44 
  not clear that Android Studio can though.13:05.51 
  But Android Studio is a fork of IntelliJ, and that can use it I think, so maybe.13:06.16 
  Might be worth a fiddle.13:06.24 
tor8 Robin_Watts: I already set .gitattributes for whether tabs or spaces are to be used13:10.58 
  but hardly anybody seems to be able to run scripts/gitsetup.sh to configure the git hooks to enforce it13:11.35 
  Robin_Watts: which, if everybody had set it, would automatically fix indentation when commiting13:15.34 
Robin_Watts I dislike the idea of stuff magically fiddling with my files.13:16.26 
tor8 Robin_Watts: it doesn't fiddle the files, just the actual commit13:16.40 
  so if you commit with 'wrong' whitespace, you'll end up with whitespace diffs in your workspace instead13:16.54 
  so the commit has gone in with the right whitespace, but your workspace still has the wrong whitespace13:17.11 
Robin_Watts tor8: Right, so what I commit isn't what I committed. I dislike that (but less)13:17.30 
tor8 and if you use 'git gui' you'll see red highlights where whitespace errors are13:17.32 
  even before you commit13:17.42 
Robin_Watts foods.13:17.56 
tor8 and git gui (and gitk) also show missing newlines at the end of files, etc13:18.03 
HenryStiles kens: what if we skip the emboldening for pdfwrite? I hate to see hours spent on this.13:27.15 
kens Well we could, but it doesn't work for rendering either right now13:27.35 
  If it worked correctly for rendering I believe pdfwrite would work fine13:27.48 
HenryStiles kens: okay then I guess it it's worth some time13:28.13 
  not bullish on XPS ;-)13:28.35 
kens Agreed13:28.42 
  But it is wrong (rendering) and it is a customer report13:28.53 
  Looks like 'all' I need to do is run the text twice, and add some special sauce flags for the stroke case13:29.37 
HenryStiles kens: if that doesn't work it can be done with the XL emboldening code which just creates an image13:32.13 
kens HenryStiles : if you think it would be faster that way, maybe you should take a poke at it ?13:32.39 
  Since there's a solution which works and you understnad it13:32.59 
  This is an investigation for me13:33.11 
HenryStiles kens: sure I'll look at it13:33.17 
kens OK I'll leave it to you then, no complaits from me :)13:33.33 
HenryStiles reassign it13:33.55 
kens Righto13:33.59 
  I'll stick some text in the thread to explain it13:34.17 
Robin_Watts tor8: Apparently AS does support .editorconfig by default, so it's looking like a good option.14:01.53 
tor8 Robin_Watts: fab. I've also added a nasty evil hook to to mupdf.git to reject pushes with bad whitespace in the commits.14:02.34 
Robin_Watts tor8: cool.14:02.45 
Harac Hi everyone, i use gs to convert .ps files to pbm with high resolution (36k dpi) and i noticed that dots appear at regular interval inside white spaces.14:03.41 
  Has anyone had solution to make them disappear ?14:03.45 
kens Probably your white is not exactly white14:04.10 
  But without seeing a (simple) example nobody can possibly help you14:05.07 
Harac ok i put an example here http://dl.telecom-bretagne.eu/get?k=b63IQzrlBNu4yQ5f14614:21.10 
kens Well its certainly very hard to tell what the colour should be since it uses Separation colour dpace14:30.43 
  What version of Ghostscript are you using for this ?14:34.30 
  Harac : ^^14:34.56 
Harac I used first 9.05 and then i try 9.1914:35.22 
  There is a way to ignore separation color space ?14:35.53 
kens Well hardly no14:37.30 
Harac ^^14:37.41 
kens If you ignored it, then the colour would be wrong14:37.41 
  However the output I get is *considerably* different to what you posted14:38.03 
Harac i just need black and white14:38.09 
  show me what you got 14:39.05 
kens Well, this looks like a rendering problem, not my field14:40.31 
  Probably caused by the 'unusually large' resolution14:40.57 
Harac :'(14:41.11 
kens We use fixed precision 32-bit arithemtic internally an it wouldn't surprise me to find that such a high resolution is causing some kind of error.14:41.51 
  Hmm, actually.....14:42.16 
  THat may not be true14:42.23 
Harac 'unusually large' resolution ^^ 36kpdi is so common :D14:45.42 
Robin_Watts tor8: http://git.ghostscript.com/?p=user/robin/mupdf.git;a=commitdiff;h=fea3e4836337cc6eaa037ed66f073f19b061e16a14:48.36 
  kens: If it's a rendering problem (probably overflow in a matrix calculation), feel free to throw it at me.14:49.06 
kens Robin_Watts : I'm not convinced14:49.17 
tor8 Robin_Watts: platform/android/example/mupdf/src/main/AndroidManifest.xml is that a genuine syntax error I see?14:49.36 
kens The PostScript is seriously complicated and does all sorts of hack things with PostScript. It is, of course, produced by an Adobe applicationh14:49.53 
Robin_Watts tor8: Looks broken to me.14:51.04 
Harac I had the same results with a .ps file generated by inkscape for a simple draw.14:51.18 
  The shape of black dots change some times.14:52.02 
Robin_Watts Harac: The simpler the file you can get us, the more likely we will be inclined to investigate it. :)14:52.36 
kens2 Harac I don't have the time right now to totally debug your PostScript program. Itas really quite complicated, generated by Illustrator, the content is simple.14:52.48 
  Oh apparently its 'Adobe Graohics Manager' not Illustrator14:53.17 
  But anyway14:53.20 
  I'd suggest not using a Separation colour space and see what happens14:53.32 
  Other than that its going to take one of us with PostScript programming background to sit down and work out exactly what the program is doing. THat will take some time14:54.04 
kens Robin_Watts : Harac it 'looks like' the pixels are at regular intervas, so I'm inclined to think this is a halftoning thing. I see the problem at 20000 dpi, but not 10000. I'm inclined to think its an overflow in the halftone logic somethwere, but its not my area.15:00.33 
  And at that I have to go back to XPS15:01.28 
Harac Ok, I will try differents things but for now i must leave15:08.42 
  thank you for your support15:08.51 
  bye15:09.17 
kens bye15:09.21 
Robin_Watts tor8: http://git.ghostscript.com/?p=user/robin/mupdf.git;a=commitdiff;h=ff7608ffe1b0030ada5ace05ed328ace276e34bc15:38.13 
  (2 commits on there ready to go, I mentioned the other one earlier, but didn't see a reply)15:39.08 
sebras agh! I accidentally ended up with a few lines of changes in a commit that shouldn't be there. I'd really want to to git subtract -p file.c right now. :-p15:51.25 
  because I want to keep the commit message.15:51.43 
Robin_Watts sebras: dead easy.15:56.36 
  Run: git gui.15:56.42 
  And select "amend last commit"15:56.51 
sebras Robin_Watts: and without git gui?15:56.58 
Robin_Watts Do you want to remove just a few lines? or whole files?15:57.30 
sebras whole file. and ideally i'd like the changes to go back to the working directory/index15:58.07 
  is the commit message saved if I do git reset HEAD^15:58.32 
Robin_Watts sebras: I have an alias "git unstage"15:58.55 
  that does "reset HEAD --"15:59.04 
kens Can't you just copy/paste the commit message into a file somewhere ?15:59.05 
sebras kens: that's cheating!15:59.17 
kens :-D15:59.37 
Robin_Watts so: git rebase -i HEAD~1015:59.59 
  Hmm. maybe not.16:00.21 
  sebras: Are you really without git gui?16:00.40 
  What platform?16:00.51 
sebras Robin_Watts: no I don't think git reset HEAD -- would do.16:00.53 
  Robin_Watts: I'm on linux, but it seems like a basic operation. so I must be missing something.16:01.17 
Robin_Watts sudo apt-get install git-gui16:02.46 
sebras Robin_Watts: ha!16:04.55 
Robin_Watts You can git reset or git reset --mixed or something, but honestly, when git gui is so easy...16:06.28 
  This is pretty much the only thing I use git gui for.16:08.11 
sebras yes, but it annoys me to have to resort to git gui _only_ for this operation.16:08.30 
  it seems as if git commit -c rev maybe useful.16:08.44 
  then I can git reset HEAD^; git ad all-other-files; git commit -c rev-of-original-commit; git add Makefile; git commit -m pretty-message16:09.25 
Robin_Watts As i say, you can do it with judicious git resetting, but you run the risk of finger trouble and losing data.16:09.53 
sebras commit -c picks up the commit message of another commit and let's you edit it and commit (-C if you don't want to edit)16:09.54 
  Robin_Watts: that risk is there with rm to. :)16:10.19 
  too16:10.22 
Robin_Watts tor8, sebras: 3 commits on robin/master16:20.51 
  sebras: So, bug 696892... you've done some investigation into it.16:29.48 
sebras Robin_Watts: with my limited knowledge of this I think the look good, the business change in DocView I can't vouche for at all though.16:30.34 
  Robin_Watts: yes, the crash.16:31.07 
Robin_Watts sebras: Sorry, it's just the first 3 commits on my repo.16:31.14 
  The 3 "Fix" commits16:31.30 
sebras oh, I read the thre last ones. d'oh.16:31.49 
Robin_Watts doc->resources is supposed to be a cache of all the resources in the doc I think, to avoid us loading fonts several times.16:32.19 
  Nothing ever sets doc->resources.16:32.28 
sebras Robin_Watts: ah, when I was debugging that I assumed that it was the page's resources.16:34.10 
Robin_Watts sebras: That would be page->resources.16:34.19 
sebras Robin_Watts: right, of course.16:34.31 
Robin_Watts So I think the bug is that we need to initialise it to be an empty dict.16:34.37 
sebras Robin_Watts: what about the fact that the content stream appears to refer to the name of the font from the page's resource dictionary rather than the annotations' resource dictionary?16:35.20 
  Robin_Watts: or did I get that wrong too?16:35.28 
Robin_Watts sebras: I haven't thought about that. It wouldn't surprise me if the file was wrong.16:35.49 
sebras Robin_Watts: I think it is. but there might be an implementation note or something somewhere.16:37.06 
Robin_Watts Ah, this is setting an annotations appearance stream.16:37.38 
  i.e. synthesising it on load. That makes sense. I was trying to figure out why we were in the pdf output device!16:37.59 
sebras Robin_Watts: Re: the 3 commits. the first two look ok to me. reviewing the third one requires omnipotence so I'll leave that to someone else. :)16:39.17 
Robin_Watts sebras: It doesn't require omnipotence, cos I'd certainly fail.16:40.17 
  I just copied it from the bug :)16:40.23 
  But thanks!16:40.54 
sebras the knockout groupy, blendmodey thing? yes... yes it does. 16:41.35 
  I'd need to relearn what knockout means and how it correlates with blendmodes, then think about how mupdf actually implements this and then try to figure what is wrong (if anything) with the patch.16:42.42 
  not a 3min job, for me.16:43.08 
Robin_Watts sebras: Oh, again, we were disagreeing on what the "first two" are :)16:44.55 
  which means I just pushed the wrong two.16:45.14 
  never mind, the cluster passes, I think it's right, and it fixes the bug. Tor8 can berate me if it fails later.16:45.34 
  sebras: And fred is talking to you on #artifex (just in case you didn't see it)16:46.05 
sebras 1072077 and 3f361e3 are ok. those are the first two commits on robin/master that was not on origin/master16:46.09 
Robin_Watts sebras: They are too :)16:46.37 
  I suspect you haven't fetched from origin for a while.16:47.14 
sebras Robin_Watts: aw, crap... no, I just fetched your repo.16:47.54 
Robin_Watts sebras: Never mind. It'll all come out in the wash.16:48.14 
  tor8, sebras, mvrhel_laptop, fred: http://git.ghostscript.com/?p=user/robin/mupdf.git;a=commitdiff;h=ab770bef466d03bfcabef6d4429efc1e8d50557f17:23.48 
  and http://git.ghostscript.com/?p=user/robin/mupdf.git;a=commitdiff;h=21e188013cc9535c8e8615d58a4afa3bca65f54417:24.01 
  and http://git.ghostscript.com/?p=user/robin/mupdf.git;a=commitdiff;h=ed8501ed7f52ba96cbdf12594340e629ab99beef17:42.07 
  tor8: ping18:11.35 
  and http://git.ghostscript.com/?p=user/robin/mupdf.git;a=commitdiff;h=8180a756b188436ed55945886d26749aed9d1e6e18:40.41 
sebras Robin_Watts: hm... you're changing the fz_new_stext_page() interface also being called in android/viewer/jni/mupdf.c, ios/Classes/MuPageViewNormal.m, ios/common.m and java/mupdf_native.c. None of which you upate.18:58.43 
Robin_Watts grep didn't find that.18:59.31 
  It did, I'm just blind.19:00.10 
  Will fix, thanks.19:00.17 
sebras Robin_Watts: you check the input arguments list and page in the same commit and return NULL in case these are NULL. is that a better approach than fz_throw()?19:01.12 
Robin_Watts sebras: Getting a NULL list back if you pass a NULL page in seems reasonable to me.19:01.43 
  everything *should* cope with being passed NULLs.19:02.04 
sebras Robin_Watts: well.. fz_throw() is also coping, in a way.19:02.21 
  Robin_Watts: I guess it comes down to whether you view it as a programming error or normal operation.19:02.45 
Robin_Watts indeed. It's a judgement call.19:03.37 
sebras Robin_Watts: maybe we have more of those cases in the codebase than I realize. :)19:04.29 
Robin_Watts People can't have got NULL for page or list from our functions. They would throw an error.19:04.38 
sebras Robin_Watts: since fredross-perry was asking about it. can I trouble you with a re-review?19:04.46 
  Robin_Watts: that would be for the three commits on sebras/master19:05.18 
Robin_Watts I'm thinking that if they HAVE got NULL it's probably because they caught that error and cleaned up earlier. I wouldn't want to make their life harder by throwing more errors.19:05.19 
  Sure. Looking now.19:05.27 
sebras Robin_Watts: and those are the _only_ three commits, there's no first involved here. :)19:05.43 
Robin_Watts actually, give me 2 mins.19:05.43 
sebras Robin_Watts: np, I'll just write some chinese characters while waiting (test tomorrow! eeep!)19:06.25 
Robin_Watts Ok, updated commit online. If I'd stopped midway, I'd have cocked up.19:09.26 
  (more than usual)19:09.31 
  Ugh. The jblah -> blah_ is horrible.19:10.20 
  jstring conflicts with jstring? Then use jstr and str.19:10.54 
  Changing pointer in Device to be private breaks AndroidDrawDevice19:13.16 
  We could keep it private and have a protected setPointer(long ptr) { pointer = long ptr; }19:14.00 
sebras oh, so the subclasses aren't speculative, they already exist!19:15.10 
Robin_Watts sebras: Yes.19:15.33 
  public DisplayList(pointer p) should still be private :)19:15.57 
  so should public Document(long p)19:17.27 
  and PDFDocument(long p)19:17.48 
fredross-perry guys I am out for a bit this afternoon, I'll check back in a while.19:18.48 
Robin_Watts I can't believe that public PDFObject(long p, PDFDocument d) { is right either. Under no circumstances should "long pointers" be in the public API.19:19.09 
sebras Robin_Watts: well, I use the PDFDocument pointer to tell the PDFObject that this is the Java object you belong to19:19.53 
Robin_Watts sebras: And where is that called from?19:20.19 
sebras Robin_Watts: using that reference I can then let PDFObject.put() and friends create e.g. newName() on the fly19:20.23 
Robin_Watts Ah, you only ever call that from the JNI, right?19:21.47 
  Then it can be private.19:22.00 
  the JNI can call private methods without any problem.19:22.17 
sebras Robin_Watts: no, from the Java code in PDFObject.java19:23.46 
Robin_Watts Having the PDFObject pointer member be private means that it can only be used from within PDFObject, or from within the JNI.19:25.04 
sebras Robin_Watts: if I call it from within the JNI-bindings it wouldn't suffice to have PDFObject.putDictionary() and PDFObject.putArray()... I'd need to have one for each pair of types of input arguments.19:25.05 
Robin_Watts a) Where other than the PDFObject and the JNI do you ever use the PDFObject pointer variable ?19:25.48 
sebras Robin_Watts: I'm talking about the PDFObject.PDFDocument reference and you are talking about the PDFObject.pointer. is that why we aren't agreeing?19:26.00 
Robin_Watts sebras: I'm confused as to how we got there.19:26.57 
sebras Robin_Watts: :)19:27.06 
Robin_Watts So, my objection to this code was that public PDFObject(long p, PDFDocument d) should be private.19:27.37 
  As far as I can tell, the only place you ever call that from is the JNI.19:28.00 
sebras Robin_Watts: ah, so same issue as the others. yeah, that constructor is only called from within the JNI.19:29.02 
Robin_Watts sebras: Right, so just make it private, and we're all happy.19:29.19 
sebras ...and let's not talk about it ever again. ;)19:29.37 
Robin_Watts Now, I need to think about the PDFObject having a PDFDocument pointer...19:29.53 
  s/pointer/reference/19:30.05 
  Every pdf_obj has a pdf_doc anyway. Why do we need to have that in the java too ?19:31.02 
sebras Robin_Watts: because in the java code I want to be able to build new PDFObjects in the PDFObject.put() method on the fly.19:31.32 
  Robin_Watts: and only PDFDocument knows how to create objects.19:31.50 
  Robin_Watts: I _could_ do this in the JNI-code, but then the list of PDFObject.put() functions wouch each translate to a unique native JNI-function.19:32.49 
Robin_Watts sebras: Yes.19:32.59 
sebras Robin_Watts: does what I write make sense to you?19:33.02 
Robin_Watts That would be my preferred solution.19:33.06 
sebras Robin_Watts: ok, good. I'm having trouble forming coherent thoughts about this over here. :)19:33.24 
  Robin_Watts: why?19:33.30 
  Robin_Watts: I'd like to keep the interface as narrow as possible19:33.40 
  Robin_Watts: repeating the same code in the JNI-interface would be to what end..?19:33.59 
  with minor changes of course.19:34.08 
Robin_Watts You only need to have it in 1 plage.19:34.15 
  1 place.19:34.17 
sebras I'm not sure I understand.19:34.35 
  _which_ do I only need to have in one place? the PDFDocument reference?19:34.53 
Robin_Watts Let's take put(String name, PDFObject obj) as an example.19:34.58 
  That's supposed to put a new name/object pair into 'this' dict, right?19:35.37 
sebras I'd need to have a public native putDictionaryFirstArgumentIsAStringSecondArgumentIsAnObject()19:35.50 
  and for put(String name, boolean b) it need a public native putDictionaryFirstArgumentIsAStringSecondArgumentIsABoolean)19:36.17 
  right?19:36.19 
  yes, you are right. it is mean to introduce a new name/val pair in the dict.19:36.47 
Robin_Watts If you push everything into the jni, yes.19:36.47 
  But we might be able to avoid it. Thinking.19:36.57 
sebras Robin_Watts: isn't that what you're asking me to do?19:37.02 
Robin_Watts Currently you call pdf.newName(name), which relies on you knowing pdf.19:37.16 
  Instead call a static thing Pdf.newName(name, obj)19:37.40 
sebras Robin_Watts: indeed. an alternative could be to figure out the type on the JNI-side.19:37.44 
Robin_Watts That can be a jni method.19:38.04 
  and it can find out the required pdf_doc pointer from the obj within the jni.19:38.23 
sebras Robin_Watts: and obj would then refer to the dictionary?19:38.43 
  Robin_Watts: and not the value (which will be created later).19:38.54 
Robin_Watts It's effectively "make me a new name in the same file as this object"19:38.58 
  I'm going to have to run, sorry.19:39.26 
sebras Robin_Watts: ok. I see what you're saying, but am still not convinced why it is better. sorry. :)19:39.52 
Robin_Watts Having java references between objects has bitten us in the past.19:39.57 
  It can screw up the finalisation.19:40.04 
  That's why I'd really prefer to avoid it whenever possible.19:40.14 
  We ought to discuss this with tor8. Especially cos I want to whinge violently about the j -> _ thing. That's just horrid.19:41.06 
  but I really do have to go- sorry.19:41.14 
sebras aha! that may be a good reason!19:41.56 
  tor8 (for the logs): if you'd like to chime in on this matter please do. in the meantime I'll try to sort out the private stuff.19:42.39 
Robin_Watts sebras: back, for a bit at least.19:59.31 
  We may be OK in this case, but I wouldn't want to swear to it.20:00.15 
  I think my personal preference, in terms of what will look neatest and clearest, would be to have public void put(String name, PDFObject obj) call nativePutStrObj20:02.02 
  In your existing code, you do: putDictionary(pdf.newName(name), obj);20:03.47 
  pdf.newName is a JNI call, that has to make a fz_name, then calls back to a java constructor to make a java PDFObject object. Then that java PDFObject is fed to another JNI call, for the fz_name to be extracted from it, and then the PDFObject is destroyed.20:06.15 
  We gain nothing (except wasted time) by making that PDFObject.20:06.33 
  Far better to just make a single JNI call, where we can make the fz_name and add it to the dict directly no need to make any calls back to java constructors.20:07.30 
  public void put(String name, PDFObject obj) { nativePutStrObj(name, obj.private); }20:08.26 
  That makes the code really simple.20:08.43 
sebras but reapted for each combination of types.20:16.18 
  Robin_Watts: so about 15 JNI-bindings instead of one.20:16.49 
Robin_Watts Yes, but all built from lego.20:17.07 
sebras Robin_Watts: well, building legos was what I thought I was doing now. combining them into bigger pieces.20:17.33 
  Robin_Watts: oh well, I'll fix that tomorrow.20:17.40 
  Robin_Watts: its 3am over here and I have a test tomorrow.20:17.58 
Robin_Watts sure. Have a good one.20:18.09 
  This stuff always takes ages to think about.20:18.21 
  The other idea that occurred to me, is whether we can fudge something so that the java objects are a proper reflection of the PDF ones.20:18.46 
sebras Robin_Watts: yeah, but I'm a bit bothered about having fredross-perry waiting for me. :-/20:18.56 
Robin_Watts I am tempted to suggest that fred should go ahead and we'll rebase your stuff. I don't think it'll be hard.20:19.24 
sebras Robin_Watts: like a JNI-bindings generator?20:19.27 
fredross-perry no I've got other things. Not waiting. Just want to move the sources at a conventient time.20:19.33 
sebras Robin_Watts: well, he'll be using the interface I'm adding as well.20:19.52 
  fredross-perry: ok. good to hear. :)20:20.05 
Robin_Watts sebras: No, I mean like if we have a pdf dictionary << /A /B /C false >>20:20.20 
  and that has a PDFObject java equivalent "obj", can we get it so that we can do "obj.A" ?20:20.57 
  I think that kind of thing can be done in JS, but probably not in java.20:21.15 
fredross-perry Do you mean dynamically define fields as well as their values?20:30.53 
sebras fredross-perry: that's how I interpret what Robin_Watts is writing.20:32.48 
fredross-perry I'm not sure how you'd do that for java. But if you implemented some sort of dictionary under the hood, then you could (in Java) do things like obj.getValue("someKey"), which is sematically the same.20:33.49 
  The interwebs say "It also does not help too much to have a new field that is not known at compile-time, because you cannot compile anything against it. If you are going to use reflection to access it, you might as well use a Map in the first place."20:36.53 
sebras fredross-perry: I guess it depends on whether objects can add/remove fields dynamically. maybe the can, using reflection, but I have no idea about the speed of those.20:37.20 
  fredross-perry: ok, that settles it I guess.20:37.47 
  fredross-perry: PDFObject.get(String) is there already, and a corresponding PDFObject(String, PDFObject)20:38.11 
  fredross-perry: so that ought to be what you need for dictionaries I guess.20:38.29 
  ok. need to sleep.20:39.44 
  4:40am.20:39.51 
mvrhel_laptop Robin_Watts: not sure if someone already told you but those commits lgtm20:52.29 
mvrhel_mac Robin_Watts are you around?22:03.20 
Robin_Watts hi22:32.53 
ghostbot Welcome to #ghostscript, the channel for Ghostscript and MuPDF. If you have a question, please ask it, don't ask to ask it. Do be prepared to wait for a reply as devs will check the logs and reply when they come on line.22:32.53 
Robin_Watts mvrhel_mac: Thanks for the review.22:33.19 
mvrhel_mac oh hi Robin_Watts 22:38.21 
  can you add mvrhel_mac to artifex channel?22:38.35 
  also there is a simple commit on my repos22:38.41 
tor8 sebras: Robin_Watts: for the PDFObject get/put stuff, I was going to say add an obj.getBoundDocument() function but then you'll create a new wrapper object for each call22:39.43 
Robin_Watts tor8: Yeah.22:40.03 
tor8 you could do it with passing the native pointers to a static (private) PDFDocument.newName(docPtr, String)22:40.35 
  so it'd call PDFDocument.newName(obj.getBoundDocumentPointer(), string)22:40.51 
Robin_Watts Yes.22:41.06 
  but if you're doing that, you might as well do it in the jni.22:41.17 
mvrhel_mac bbiaw22:41.52 
tor8 oh, yes. of course.22:42.01 
  the 15 jni bindings make most sense22:42.23 
  and just use java's polymorphism to pick the appropriate native function22:43.00 
Robin_Watts tor8: Yeah.22:43.43 
tor8 re: the j- prefix or _ suffix, I prefer the _ suffix (ugly, but you should not use the _ more than once) and less risk of confusing it with the JNI typedef'd types22:43.45 
  but if you and/or sebras absolutely hate it, I'm easy22:43.56 
Robin_Watts tor8: The problem is we DO use both the jfoo and foo regularly.22:44.12 
  (I think).22:44.28 
  I could live with obj_j and obj ?22:44.48 
tor8 oh, yeah. for the strings. never for the wrapped native pointer objects.22:44.53 
Robin_Watts or Jobj and obj22:44.57 
tor8 nah, rather jobj than any of those22:45.03 
Robin_Watts but _ vanishes when I read things.22:45.19 
tor8 or wobj (for wrapped obj)22:45.20 
  Robin_Watts: fair enough rationale, if it makes it hard for you to read then away it goes!22:45.36 
Robin_Watts I could live with wobj in preference to obj_22:45.37 
tor8 wobj or jobj, I'm happy either way.22:45.47 
Robin_Watts I use obj_ and obj when I get a void *obj_ and then cast it to get obj.22:46.10 
  And I don't mind the fact they look the same, cos they are the same pointer.22:46.22 
  mvrhel: For the logs: See http://twiki.ghostscript.com/do/view/Ghostscript/IrcSetup22:46.49 
tor8 Robin_Watts: yeah, that was the approach I was thinking of with the java wrapper being the obj_, and the real actual used argument once the pointer is extracted is obj22:47.00 
Robin_Watts mvrhel: Have you registered mvrhel_mac ?22:47.04 
  tor8: But they aren't the same pointer.22:47.20 
tor8 the jstring variables should be named other than 'string' ... jfilename and filename or jneedle and needle, etc22:47.39 
Robin_Watts yes, indeed.22:47.48 
tor8 and that would remove my main objection22:47.48 
Robin_Watts jstring jstring is just insane :)22:47.58 
tor8 let's just go with 'j' prefix and no insanities like that :)22:48.07 
Robin_Watts perfect, thanks.22:48.13 
  Poor sebras :(22:48.19 
tor8 he's good with vim and regexes, it shouldn't take him more than 5 minutes22:48.29 
  I've seen him work vim, this sort of thing is trivial for his wizardry level ;)22:49.15 
  but yes, we do yank his chain about :)22:49.29 
  Robin_Watts: I've got a bunch of whitespace cleaning commits on tor/master but some of those may conflict with fred's work unless he can rebase and fix whitespace without getting git into a twist22:52.27 
  libmupdf.vcproj has two pdf-resources.c entries, I suspect a merge conflict gone wrong somewhere22:53.44 
Robin_Watts Do we need to update ios and android with fz_close_device ?22:54.04 
  (and gsview ?)22:54.15 
tor8 Robin_Watts: only for text search/extraction devices22:54.21 
  the draw device is be safe22:54.33 
  but I think it would be good form to do so22:54.37 
Robin_Watts I might be tempted to split your whitespace fix commit into 2.22:55.18 
  One for java stuff, and one for non java stuff.22:55.26 
tor8 Robin_Watts: fair enough.22:55.38 
Robin_Watts Then we can get everything except the java stuff in, and check with fred for the java?22:55.39 
tor8 agreed.22:55.46 
Robin_Watts Those 4 commits look good.22:55.48 
tor8 I'll split the whitespace and push the non-java part then22:56.05 
Robin_Watts I'll have a quick look at the close_device thing.22:56.25 
tor8 Robin_Watts: source/fitz/util.c:307:57: warning: incompatible pointer types passing 'fz_rect **' (aka 'struct fz_rect_s **') to parameter of type 'fz_rect *' (aka 'struct fz_rect_s *'); remove & [-Wincompatible-pointer-types]23:05.38 
  text = fz_new_stext_page(ctx, fz_bound_page(ctx, page, &mediabox));23:05.38 
  CC build/debug/fitz/output.o23:05.38 
  ^~~~~~~~~23:05.38 
  include/mupdf/fitz/document.h:247:65: note: passing argument to parameter 'rect' here23:05.41 
  fz_rect *fz_bound_page(fz_context *ctx, fz_page *page, fz_rect *rect);23:05.43 
Robin_Watts eh?23:06.26 
tor8 Robin_Watts: first commit on tor/master23:06.53 
Robin_Watts tor8: crap. Ta.23:07.27 
  great, thanks.23:08.02 
  ios fix on robin/master23:11.26 
  And an android fix for the existing viewer.23:14.38 
  will need to update the JNI properly for close_device too. Will do that tomorrow.23:14.55 
tor8 Robin_Watts: great, thanks. LGTM.23:16.47 
 Forward 1 day (to 2016/07/14)>>> 
ghostscript.com
Search: