从 Eclipse 打印时如何更改字体大小?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/7634906/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-19 17:05:35  来源:igfitidea点击:

How do I change the font size when printing from Eclipse?

eclipseprintingfont-size

提问by bos

Sometimes I'd like to print my code and read it during lunch. In Eclipse I'm using 10pt Helvetica font, but printing at this size is a waste of paper I think. I changed to font size 6pt, and the print was perfect; fully readable and paper saving.

有时我想打印我的代码并在午餐时阅读。在 Eclipse 中,我使用 10pt Helvetica 字体,但我认为以这种尺寸打印是浪费纸张。我把字体改成了6pt,打印完美;完全可读和节省纸张。

However, coding in 6pt font is very hard and stressing for my eyes, so I cannot keep the setting. Also, changing font size everytime I print is a pain.

但是,使用 6pt 字体进行编码非常困难并且对我的眼睛造成压力,因此我无法保留该设置。此外,每次打印时更改字体大小都很痛苦。

Is there a way to keep 10pt for my editor AND have the printer run at 6pt, at the same time?

有没有办法为我的编辑器保留 10pt,同时让打印机以 6pt 运行?

采纳答案by Christopher Bruns

The mismatch of screen font size with printed font size is supposed to be fixedin Eclipse version 3.7 (Indigo). Perhaps you need a newer version of eclipse.

应该在 Eclipse 3.7 版 (Indigo) 中修复屏幕字体大小与打印字体大小不匹配的问题。也许您需要更新版本的 eclipse。

回答by solsson

I ended up changing the paper size to A5 and printing to PDF, then printing the PDF to A4.

我最终将纸张尺寸更改为 A5 并打印为 PDF,然后将 PDF 打印为 A4。

回答by hradac

Give this a try:
Go to preferences > appearance > colors and fontsthen select 'basic'. In that drop down select 'text font'. Click 'edit' make your changes and print. When you're done you may want to change it back by clicking reset.

试试这个:
转到preferences > appearance > colors and fonts然后选择“基本”。在该下拉列表中选择“文本字体”。单击“编辑”进行更改并打印。完成后,您可能希望通过单击重置将其更改回来。

I found this information in two places
1: http://blog.alagad.com/2007/06/15/changing-the-font-size-in-eclipse/
2: http://people.reed.edu/~jerry/121/handouts/04a-eclipse-printing.pdf[PDF]

我在两个地方找到了这个信息
1:http: //blog.alagad.com/2007/06/15/changed-the-font-size-in-eclipse/
2:http: //people.reed.edu/~ jerry/121/handouts/04a-eclipse-printing.pdf[PDF]

回答by Allen

This question was awhile back but I found a work-around to the original question posted. When I select File-Print then a Print menu options comes up (every print menu options is different depending on the OS. This is on a Macbook) I scaled the size of the printing down. Works great to read and more importantly, save trees!:-) Scaling the printing of source code

这个问题已经有一段时间了,但我找到了解决原始问题的方法。当我选择 File-Print 然后一个 Print 菜单选项出现(每个打印菜单选项因操作系统而异。这是在 Macbook 上)我缩小了打印的大小。非常适合阅读,更重要的是,可以节省树木!:-)缩放源代码的打印

回答by Anders A

I tried scaling printout to 50-75% and it works for me also: Large font on screen but small font to fit all in less amount of paper

我尝试将打印输出缩放到 50-75%,它也适用于我:屏幕上的大字体但小字体以适应更少的纸张

回答by Eclipsed

The best workaround I've found is to copy-and-paste the entire program into a text editor where one cantweak the page/font settings (I use gedit) and print from there. A pain, but less so than changing the font size within Eclipse.

我发现的最佳解决方法是将整个程序复制并粘贴到文本编辑器中,在那里可以调整页面/字体设置(我使用 gedit)并从那里打印。痛苦,但不如在 Eclipse 中更改字体大小那么痛苦。

回答by Tamias

Using Mars.1 Release (4.5.1) I still see this as a problem. I tried the scaling in the printer dialog as suggested by Allen and Eclipsed, and my Brother printer under Windows used just as much paper, using same page breaks, leaving white space at bottom of each page.

使用 Mars.1 Release (4.5.1) 我仍然认为这是一个问题。我按照 Allen 和 Eclipsed 的建议尝试了打印机对话框中的缩放,我的 Brother 打印机在 Windows 下使用了同样多的纸张,使用相同的分页符,在每页底部留下空白。

So do an experiment with a small selection before trying this. Your mileage may vary.

所以在尝试之前先做一个小选择的实验。你的旅费可能会改变。

I'm almost ashamed to admit it, but, so that I could get colors, and preview before printing, I ended up pasting into Microsoft Word and printing from there.

我几乎不敢承认这一点,但是,为了在打印前获取颜色和预览,我最终粘贴到 Microsoft Word 中并从那里打印。

回答by Pooh

I agree, Eclipse should have a 'Print font' setting.

我同意,Eclipse 应该有一个“打印字体”设置。

This solution is late, but works so well, that I'm posting it anyway.

这个解决方案来晚了,但效果很好,所以我还是要发布它。

However, I have found a pretty good solution for me: format for Ledger (11x17) but scale to Letter (8.5x11). This is essentially 6 pt, which gets me 116 lines down, 140 cols across, in Portrait mode.

但是,我为我找到了一个很好的解决方案:格式为 Ledger (11x17) 但缩放为 Letter (8.5x11)。这基本上是 6 pt,在纵向模式下,它使我向下 116 行,跨 140 列。

I like this so much, that for personal work, I have tweaked Eclipse to assume a 120 column print margin. Here's how:

我非常喜欢这个,为了个人工作,我调整了 Eclipse 以假设 120 列打印边距。就是这样:

  • Set Editing font to Consolas 10 pt. (This is my preference, however it doesn't make much difference, as you will see. (Window > Preferences > General > Appearance > Colors and Fonts > Basic > Text Font)
  • Set Print margin at 120 characters. (Window > Preferences > General > Editors > Text Editors > Show print margin > Print margin column 120)
  • Set code style formatter's line wrapping to 120 characters. (Window > Preferences > Java > Code Style > Formatter > Active Profile > [your custom profile name] Edit > Line Wrapping > Maximum line width > 120).
  • 将编辑字体设置为 Consolas 10 pt。(这是我的偏好,但是正如您将看到的,它没有太大区别。(窗口 > 首选项 > 常规 > 外观 > 颜色和字体 > 基本 > 文本字体)
  • 将打印边距设置为 120 个字符。(窗口 > 首选项 > 常规 > 编辑器 > 文本编辑器 > 显示打印边距 > 打印边距列 120)
  • 将代码样式格式化程序的换行设置为 120 个字符。(窗口 > 首选项 > Java > 代码样式 > 格式化程序 > 活动配置文件 > [您的自定义配置文件名称] 编辑 > 换行 > 最大线宽 > 120)。

The details of how you select the Paper size to format for, vary by printer. For me, it is done from File > Print... > Preferences > Basic > Paper Size > Ledger.

如何选择要格式化的纸张尺寸的详细信息因打印机而异。对我来说,它是通过文件 > 打印... > 首选项 > 基本 > 纸张尺寸 > 分类帐完成的。

Likewise, selecting page scaling is a printer preference. For me, it is File > Print... > Preferences > Advanced > Scaling > Fit to Paper Size > Letter.

同样,选择页面缩放是打印机首选项。对我来说,它是文件 > 打印... > 首选项 > 高级 > 缩放 > 适合纸张大小 > Letter。

回答by Jonathan Mason

I had a similar problem, and was given the following by a colleague. The following should be entered on the command line:

我遇到了类似的问题,一位同事给出了以下内容。应在命令行中输入以下内容:

  • To check default font: query default.print.font
  • To change font temporarily: print.font "Courier New-10"
  • To change font permanently: default.print.font "Courier New-8"
  • 要检查默认字体: query default.print.font
  • 临时更改字体: print.font "Courier New-10"
  • 要永久更改字体: default.print.font "Courier New-8"

Hope it helps

希望能帮助到你