Go Down

Topic: IDE Code Printout is Unusable (Read 612 times) previous topic - next topic

BrendaEM

There's no way to get a printout or a PDF of the code.

Adobe Acrobat and Microsoft PDF both do this, and I suspect that seeing that other people are having problems, too.

See that attachment to see what we get.



pert

#1
Jul 13, 2019, 10:58 pm Last Edit: Jul 13, 2019, 10:59 pm by pert Reason: Embed image
There's no way to get a printout or a PDF of the code.
Your screenshot proves that statement to be incorrect.

See that attachment to see what we get.
BrendaEM's Printout.jpg:


It's certainly not pretty, but that's because you have the font size set ridiculously huge. Here's how my PDF turned out:

It looks perfectly fine to me.

BrendaEM

Is there a print font size setting, anywhere?
I don't see print font setting in the GUI.
I don't see print font setting in the settings.
I certainly didn't change the printer font settings.
What's printing out is much larger than what I see on the screen.

Perhaps this thread is also related.
https://forum.arduino.cc/index.php?topic=39861.0

I am glad it's working for you.

pert

What do you have File > Preferences > Editor font size set to?

BrendaEM

#4
Jul 20, 2019, 03:16 am Last Edit: Jul 20, 2019, 03:28 am by BrendaEM
Why should it matter what the editor screen font size is?
I am printing, and/or outputting to a file.

Though, to answer your question, it's 17.

If the two are somehow linked, that would be a bad design, because it would leave people in a trial-and-error process for printing, which would vary from screen to screen.

Although, point sizes are strange units, we as computer users know how big a typeface would be on a page.

Further, my screen being at 2880x1620, that if I made my screen font small enough that it might be able to print at 12 point--the font on the screen would be unreadable.

This is why screen font sizes and print font sizes are otherwise not linked.

If the two are linked, it's a design flaw, or a bug.

pert

#5
Jul 20, 2019, 05:53 am Last Edit: Jul 20, 2019, 05:54 am by pert Reason: Add bullet points to the list
Why should it matter what the editor screen font size is?
I am printing, and/or outputting to a file.
You're printing to a .pdf file, not a text file. When you do that, it will create a .pdf file that looks just the same as the pages coming out of your printer would. So of course the font size matters. Haven't you noticed that if you change the font size in a file, the text size also changes when you print that file?

If you wanted the output as pure text, well the sketch already is pure text. Just open it in a text editor.

Further, my screen being at 2880x1620, that if I made my screen font small enough that it might be able to print at 12 point--the font on the screen would be unreadable.
I suspect this is the key. The Arduino IDE does automatic scaling of the IDE on high resolution monitors by default. So the font size in effect it way larger than 17.

Try this:
  • File > Preferences
  • Uncheck the box next to Interface scale > Automatic. Warning: this is going to make the Arduino IDE interface smaller.
  • Close all Arduino IDE windows.
  • Start the Arduino IDE
  • Try printing to a file again.


I'm guessing you'll find the printed file is now as expected. I don't own a high resolution monitor so I can't say whether this is a normal behavior for auto scaling applications or whether the Arduino IDE should be outputting the file at 100% interface scale, rather than the 200% or whatever it's automatically choosing for your display.

This is why screen font sizes and print font sizes are otherwise not linked.
Wut? They sure are in my universe. I've never seen an application that allows you to set a different font size for printing. You can sometimes change print scale.

westfw

What we probably want is for the printed size to match the actual on-screen size, which seems to be what a lot of programs do.

Quote
The Arduino IDE does automatic scaling of the IDE on high resolution monitors
Ah!  That sounds like a thing that would have a reasonably easy patch...

Of course, it would also be nice if there was a color printout option.  Although the whole "text pallet vs print pallet" thing comes into play :-(
("copy as html" seems to do a pretty good job.  And if I read the resulting html in a browser and THEN print to a .pdf, it looks good.)

(gee... it looks like the common print APIs don't have much in between "plain text" and "full WYSIWYG multi-font application-rendered print output."  Sigh.)



westfw

#7
Jul 27, 2019, 02:12 am Last Edit: Jul 28, 2019, 06:54 am by westfw
So I've looked at this some more.
Even with the default font size and preferences, the "print" dialog prints especially huge.  Whether or not you have the automatic font scaling turned on.  It does get even huger when you increase the font size, but it also appears pretty broken by default.

It MIGHT be trying to print at "actual screen size" or something?  But it's not really that close to that, either.

And I can't find anything that Arduino is doing to cause this.  The print code is pretty trivial, essentially:
Code: [Select]
      printerJob.setPrintable(getCurrentTab().getTextArea(), pageFormat);
pageFormat is things like page size and landscape vs portrait.
the TextArea and its font seem pretty boring (at least, as much as is set up to print):

Code: [Select]
     [exec] CurrentTab Font size: java.awt.Font[family=Monaco,name=Monaco,style=plain,size=12]
     [exec] Scale Factor: 100
     [exec] processing.app.syntax.SketchTextArea[editor,
          0, 0, 1058x646,
          layout=javax.swing.plaf.basic.BasicTextUI$UpdateHandler,
          alignmentX=0.0,
          alignmentY=0.0,
          border=javax.swing.plaf.basic.BasicBorders$MarginBorder@9ddb69c,
          flags=16777512,
          maximumSize=,
          minimumSize=,
          preferredSize=,
          caretColor=java.awt.Color[r=51,g=51,b=0],
          disabledTextColor=javax.swing.plaf.ColorUIResource[r=128,g=128,b=128],
          editable=true,
          margin=javax.swing.plaf.InsetsUIResource[top=0,left=0,bottom=0,right=0],
          selectedTextColor=,
          selectionColor=java.awt.Color[r=255,g=204,b=0],
          colums=0,
          columWidth=0,
          rows=0,
          rowHeight=0,
          word=true,
          wrap=false]


So I have no idea where control of this might be hiding.  :-(
Someone more familiar with Java's print capabilities can feel free to chime in...
("Oh, Java programmers never actually print anything!")

Edit:
Hmm.  It turns out that even on a "normal" windows laptop (15inch 1366x768 display), printing will produce output with unreasonably large fonts.  So perhaps something other than the HD Scaling stuff is to blame...


Go Up