Log of #mupdf at irc.freenode.net.

 <<<Back 1 day (to 2021/02/21)Fwd 1 day (to 2021/02/23)>>>20210222 
artifexirc-bot <Robin_Watts> The best way to do it is to rerender the page at the required size each time.00:51.55 
  <Robin_Watts> In our Android viewer at least, we scale the page so that it just fits within the screen, and render it there. That gives us a base image we can use.00:53.11 
  <Robin_Watts> Whenever we zoom the page, we scale the relevant section from that image and display that - so we can get pretty instant screen update. We then queue an update on the background thread to render the real section of the page that we need at the ideal DPI.00:54.35 
  <Robin_Watts> For panning, we fill in the 'exposed' areas around the edges of the screen with scaled bits from that image, and then request a proper upgrade on the background thread as you'd expect.00:55.27 
  <Robin_Watts> So, we only ever need to hold 2 bitmaps, both no larger than the screen.00:55.56 
  <Robin_Watts> and people always get fast feedback as they zoom/pan and get the ideal rendering shortly afterwards.00:56.50 
macwinne_ Thanks!06:52.10 
  Also, curious, if using MuPDF wasm in the browser vs on the server should somehow render a PNG at the same DPI differently? I feel like the text being rendered in the WASM running in the browser is sharper.. Even though it's just using the DrawAsPNG..06:53.18 
artifexirc-bot <Robin_Watts> The code running in the browser renders at the ideal dpi every time.10:08.23 
  <Robin_Watts> I'm not sure what you mean by "on the server" cos none of our examples do that.10:08.42 
  <Robin_Watts> but I could imagine that a simple system doing that would just draw one bitmap and then scale it, so yes, anything that involves scaling will be less sharp.10:09.15 
  <paulgardiner> I'm looking at adding back the function to create an appearance stream from a display list using the pdf-write device. Back when the previous version of that function existed, we didn't handle the adding of fonts to resources very well (as far as I remember). I see that we now have a function add_required_fonts that performs that task for associated calls to write_string. I'm wondering if the pdf-write device has been updated to do 13:42.43 
  <ator> pdf-write adds fonts automatically13:51.20 
  <ator> the pdf_new_pdf_device takes a resources pdf_obj and a fz_buffer, that it fills out with all the necessary resources and content stream13:52.31 
  <paulgardiner> Awesome.13:56.54 
  <ator> pdf_page_write is a wrapper for that which creates the objects too13:57.36 
  <ator> not sure which is the right one to use, you'll have to experiment13:57.45 
  <ator> (or add a pdf_xobject_write but with a better name)13:58.02 
  <paulgardiner> At the moment, I'm creating an empty dict as the resource, passing that into pdf_new_pdf_device, running the display list and then passing the resource also to pdf_new_xobject.13:59.55 
  <paulgardiner> What you've just said suggests that may work as is. I'll take a look at pdf_page_write. If nothing else, I can check out if there's any more preparation to the resource dictionary required.14:02.09 
  <ator> @paulgardiner that should work (pdf_page_write does the exact same thing)14:02.42 
  <ator> you shouldn't have to prep the resource dictionary at all14:02.56 
  <ator> other than making sure it exists14:03.01 
  <paulgardiner> That's really neat.14:03.32 
  <paulgardiner> pdf_page_write also shows me how to set up ctm, but what should the mediabox be in this case? Is it just the annot bounding box?14:12.04 
  <ator> it should probably match the annot Rect, yes14:12.34 
  <ator> annots have a couple of weird transformations going on, but if you match the Rect and the XObject BBox and make sure the XObject Matrix are identity14:13.52 
  <ator> then you can use page coordinates14:13.55 
  <ator> otherwise it does some funky adjusting so the Annot Rect fits the XObject BBox14:14.24 
  <paulgardiner> Ah yes. I remember that now14:14.27 
macwinne_ thanks Robin.. Yes, it turns out the scaling fuzziness was due to Chrome.. i added image-rendering: -webkit-optimize-contrast; to the style sheet and it looks sharper now..15:15.52 
  does the MuPDF search functionality do anything more fancy than extract text from PDF and do a string match to find the hits?15:17.02 
artifexirc-bot <KenSharp> .ne wonders why macwinner is echoing, is the bot messed up ?15:18.18 
macwinne_ sorry, echoing where?15:22.37 
artifexirc-bot <KenSharp> Over here in Discord, every message is coming out twice15:29.09 
  <KenSharp> But only from you on IRC, which makes me think its the IRC bot15:29.24 
ator macwinne_: that's exactly what the string search does17:19.09 
artifexirc-bot <KenSharp> Hmm now ator is echoing20:08.43 
 <<<Back 1 day (to 2021/02/21)Forward 1 day (to 2021/02/23)>>> 
ghostscript.com #ghostscript