This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

Bug 236506 - Printing to HTML does not produce monospace font.
Summary: Printing to HTML does not produce monospace font.
Status: RESOLVED WONTFIX
Alias: None
Product: editor
Classification: Unclassified
Component: Painting & Printing (show other bugs)
Version: 7.4
Hardware: PC Mac OS X
: P3 normal with 1 vote (vote)
Assignee: Miloslav Metelka
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2013-09-28 23:17 UTC by leesdolphin
Modified: 2016-07-07 07:27 UTC (History)
2 users (show)

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description leesdolphin 2013-09-28 23:17:04 UTC
When printing to HTML(File>Print to HTML), the output font is not monospaced.

This appears to be a small typo in the output format. The CSS uses `font-family: Monospaced` when the font family should be `font-family: Monospace`(No `d`).
Comment 1 leesdolphin 2013-09-28 23:22:58 UTC
Sorry, forgot to add these

Steps to Reproduce:

Create a java file(any one) and then go File>Print to HTML. Open it in the browser and the font will not be monospaced.

Expected Result:

The font is monospaced.

Netbeans & OS Information:

Product Version: NetBeans IDE 7.4 Beta (Build 201307092200)
Java: 1.7.0_21; Java HotSpot(TM) 64-Bit Server VM 23.21-b01
Runtime: Java(TM) SE Runtime Environment 1.7.0_21-b12
System: Mac OS X version 10.8.5 running on x86_64; UTF-8; en_US (nb)
Comment 2 Jiri Prox 2013-09-30 06:18:17 UTC
reproducible
Comment 3 leesdolphin 2013-10-08 01:21:09 UTC
The problem appears to be fixable on line 342 of `main/editor/src/org/netbeans/modules/editor/HtmlPrintContainer.java`. As to a fix I'm not sure how that should be implemented.
Comment 4 stevensrmiller 2014-04-21 16:00:15 UTC
Problem persists in NetBeans 8.0 (Build 201403101706).
Comment 5 ruol 2014-07-18 23:19:55 UTC
My understanding is that the Netbeans "Monospaced font" is *not* an actual font installed on the system.  Rather, Netbeans "Monospaced font" maps to some actual installed system fixed-spaced font.

#ISSUE# The "Print to HTML" generates CSS for a "Monospaced" named font which is *not* installed on the system.

body {... font-family: Monospaced} /* FAIL: "named" system font not found */

#POSSIBLE CONFUSION# "Monospaced" vs. "monospace"

If Netbeans generated CSS standard family "monospace" instead of the specific font name "Monospace" then, the resulting HTML would use the system default for the family.

body {... font-family: monospace} /* PASS: uses system default fixed-space font */

#WORKAROUND# Set Netbeans font preferences.

If Netbeans > Preferences > Fonts & Colors are specifically set to a system font other than Monospaced, then the specific font is published to the "Print to HTML" File.

body {.. font-family: Bitstream Vera Sans Mono} /* PASS: named installed font */

#SECONDARY ISSUE# 
When I set the default inherited font to "Bitstream Vera Sans Mono", then "Bitstream Vera Sans Mono" would pass through to *most* of the CSS specifications.

However, some code elements such as .keyword-directive {color: #0000e6} remained without any font specification.  This sub-case displayed as a the default system proportional-spaced font!

.keyword-directive {color: #0000e6} /* defaulted to proportional-spaced font! */

#SECONDARY WORKAROUND #
So, in the end, I had to use Netbeans > Preferences > Fonts & Colors to override the inherited default 'Bitstream Vera Sans Mono' with 'Menlo' in specific cases.  "Print to HTML" would then also add in fonts for the specific override cases.

body {... font-family: Bitstream Vera Sans Mono} /* PASS: named installed font */
.keyword-directive {... font-family: Menlo} /* PASS: named installed font */

#IMPORTANT COMPOUND WORKAROUND NOTE#
Replacing "Monospaced" primary default with "Bitstream Vera Sans Mono", and then overriding specific cases with "Menlo" works visually OK because these two particular fonts have the same fixed spacing for the same point size.
Comment 6 bnowak1 2015-09-18 22:12:07 UTC
Monospaced is not a correct CSS attribute for font family!  please fix this, as it is really annoying to have to go in and edit the css after the fact!  Below workarounds are fine, but a more robust solution should be sought.  Perhaps inserting the system mapped "monospace" default font into the css output?
Comment 7 Martin Balin 2016-07-07 07:27:24 UTC
This old bug may not be relevant anymore. If you can still reproduce it in 8.2 development builds please reopen this issue.

Thanks for your cooperation,
NetBeans IDE 8.2 Release Boss