diff options
Diffstat (limited to 'org.eclipse.jface.text/src/org/eclipse/jface/internal/text/html/HTMLPrinter.java')
-rw-r--r-- | org.eclipse.jface.text/src/org/eclipse/jface/internal/text/html/HTMLPrinter.java | 22 |
1 files changed, 11 insertions, 11 deletions
diff --git a/org.eclipse.jface.text/src/org/eclipse/jface/internal/text/html/HTMLPrinter.java b/org.eclipse.jface.text/src/org/eclipse/jface/internal/text/html/HTMLPrinter.java index 1e49e72a36b..5fc2cea8c0a 100644 --- a/org.eclipse.jface.text/src/org/eclipse/jface/internal/text/html/HTMLPrinter.java +++ b/org.eclipse.jface.text/src/org/eclipse/jface/internal/text/html/HTMLPrinter.java @@ -35,7 +35,7 @@ public class HTMLPrinter { private static volatile RGB BG_COLOR_RGB= new RGB(255, 255, 225); // RGB value of info bg color on WindowsXP private static volatile RGB FG_COLOR_RGB= new RGB(0, 0, 0); // RGB value of info fg color on WindowsXP - + private static final String UNIT; // See https://bugs.eclipse.org/bugs/show_bug.cgi?id=155993 static { UNIT= Util.isMac() ? "px" : "pt"; //$NON-NLS-1$//$NON-NLS-2$ @@ -68,7 +68,7 @@ public class HTMLPrinter { BG_COLOR_RGB= display.getSystemColor(SWT.COLOR_INFO_BACKGROUND).getRGB(); FG_COLOR_RGB= display.getSystemColor(SWT.COLOR_INFO_FOREGROUND).getRGB(); } - + private static void installColorUpdater(final Display display) { display.addListener(SWT.Settings, new Listener() { @Override @@ -77,7 +77,7 @@ public class HTMLPrinter { } }); } - + private static String replace(String text, char c, String s) { int previous= 0; @@ -102,10 +102,10 @@ public class HTMLPrinter { * Escapes reserved HTML characters in the given string. * <p> * <b>Warning:</b> Does not preserve whitespace. - * + * * @param content the input string * @return the string with escaped characters - * + * * @see #convertToHTMLContentWithWhitespace(String) for use in browsers * @see #addPreFormatted(StringBuffer, String) for rendering with an {@link HTML2TextReader} */ @@ -125,7 +125,7 @@ public class HTMLPrinter { * @param content the input string * @return the processed string - * + * * @see #addPreFormatted(StringBuffer, String) * @see #convertToHTMLContent(String) * @since 3.7 @@ -137,7 +137,7 @@ public class HTMLPrinter { content= replace(content, '>', ">"); //$NON-NLS-1$ return "<span style='white-space:pre'>" + content + "</span>"; //$NON-NLS-1$ //$NON-NLS-2$ } - + public static String read(Reader rd) { StringBuffer buffer= new StringBuffer(); @@ -226,7 +226,7 @@ public class HTMLPrinter { private static void appendStyleSheet(StringBuffer buffer, String styleSheet, RGB fgRGB, RGB bgRGB) { if (styleSheet == null) return; - + // workaround for https://bugs.eclipse.org/318243 StringBuffer fg= new StringBuffer(); appendColor(fg, fgRGB); @@ -317,10 +317,10 @@ public class HTMLPrinter { * <b>Warning:</b> This starts a new paragraph when rendered in a browser, but * it doesn't starts a new paragraph when rendered with a {@link HTML2TextReader} * (e.g. in a {@link DefaultInformationControl} that renders simple HTML). - * + * * @param buffer the output buffer * @param preFormatted the string that should be rendered with whitespace preserved - * + * * @see #convertToHTMLContent(String) * @see #convertToHTMLContentWithWhitespace(String) * @since 3.7 @@ -363,7 +363,7 @@ public class HTMLPrinter { boolean italic= (fontData.getStyle() & SWT.ITALIC) != 0; String size= Integer.toString(fontData.getHeight()) + UNIT; String family= "'" + fontData.getName() + "',sans-serif"; //$NON-NLS-1$ //$NON-NLS-2$ - + styles= styles.replaceFirst("(html\\s*\\{.*(?:\\s|;)font-size:\\s*)\\d+pt(\\;?.*\\})", "$1" + size + "$2"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ styles= styles.replaceFirst("(html\\s*\\{.*(?:\\s|;)font-weight:\\s*)\\w+(\\;?.*\\})", "$1" + (bold ? "bold" : "normal") + "$2"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$ styles= styles.replaceFirst("(html\\s*\\{.*(?:\\s|;)font-style:\\s*)\\w+(\\;?.*\\})", "$1" + (italic ? "italic" : "normal") + "$2"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$ |