FULL PRODUCT VERSION :
java version "1.8.0_60"
Java(TM) SE Runtime Environment (build 1.8.0_60-b27)
Java HotSpot(TM) 64-Bit Server VM (build 25.60-b23, mixed mode)
ADDITIONAL OS VERSION INFORMATION :
Windows 7 Professional 64-bit
A DESCRIPTION OF THE PROBLEM :
In a javafx.scene.web.HTMLEditor, if you select the font family you want _before_ selecting text, then insert text, that text does not get styled with the selected font. (This may be working as designed.) But then if you position the cursor, the font family does not change to match the style of the font where the cursor has been positioned. If you select the text and try to set the font family, the style of the text does not change, since that font family is already selected. If you select an _unwanted_ font, then go back to the desired font, that works OK and finally sets the font to the desired style. And after that, when the cursor is positioned in the text, the font family changes to the one that matches the style of the text. The other attributes, such as font size and weight, appear to work as expected when positioning the cursor or selecting text.
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
Compile and run the test case below. In the drop down box, select the font family and size you want before selecting any text. Then select any text and try to change the font family to that same desired font. You _can_ try changing the font size.
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
Positioning the cursor or selecting text changes the font family that is selected, like it does for the font size and weight. You can select text and change the font family. Also, just changing the size should change the font style to match both the font family and size selected.
ACTUAL -
Positioning the cursor does not change the font family that is selected. Selecting text and trying to set the font family doesn't work. Setting the font size changes the font size OK, but does not set the text to the selected font family. The only way you can get it to change the font family is to select an _undesired_ font family first, then change it back.
REPRODUCIBILITY :
This bug can be reproduced always.
---------- BEGIN SOURCE ----------
import javafx.scene.web.HTMLEditor;
public class TestHTMLEditor
extends javafx.application.Application
{
static final String sampleText = "<?xml version=\"1.0\" encoding=\"UTF-8\"?><!DOCTYPE html><html xmlns=\"http://www.w3.org/1999/xhtml\"><html><head><title>Lorem Ipsum Text</title></head><body><h2 style=\"text-align: center\">Lorem Ipsum</h2><p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed at ante. Mauris eleifend, quam a vulputate dictum, massa quam dapibus leo, egetvulputate orci purus ut lorem. In fringilla mi in ligula. Pellentesque aliquam quam vel dolor. Nunc adipiscing. Sed quam odio, tempus ac, aliquam molestie, varius ac, tellus. Vestibulum ut nulla aliquam risus rutrum interdum. Pellentesque lorem. Curabitur sit amet erat quis risus feugiat viverra. Pellentesque augue justo, sagittis et, lacinia at, venenatis non, arcu. Nunc nec libero. In cursus dictum risus. Etiam tristique nisl a nulla. Ut a orci. Curabitur dolor nunc, egestas at, accumsan at, malesuada nec, magna.</p><p>Nulla facilisi. Nunc volutpat. Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia Curae; Ut sit amet orci vel mauris blandit vehicula. Nullam quis enim. Integer dignissim viverra velit. Curabitur in odio. In hac habitasse platea dictumst. Ut consequat, tellus eu volutpat varius, justo orci elementum dolor, sed imperdiet nulla tellus ut diam. Vestibulum ipsum ante, malesuada quis, tempus ac, placerat sit amet, elit.</p><p>Sed eget turpis a pede tempor malesuada. Vivamus quis mi at leo pulvinar hendrerit. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Pellentesque aliquet lacus vitae pede. Nullam mollis dolor ac nisi. Phasellus sit amet urna. Praesent pellentesque sapien sed lacus. Donec lacinia odio in odio. In sit amet elit. Maecenas gravida interdum urna. Integer pretium, arcu vitae imperdiet facilisis, elit tellus tempor nisi, vel feugiat ante velit sit amet mauris. Vivamus arcu. Integer pharetra magna ac lacus. Aliquam vitae sapien in nibh vehicula auctor. Suspendisse leo mauris, pulvinar sed, tempor et, consequat ac, lacus. Proin velit. Nulla semper lobortis mauris. Duis urna erat, ornare et, imperdiet eu, suscipit sit amet, massa. Nulla nulla nisi, pellentesque at, egestas quis, fringilla eu, diam.</p><p>Donec semper, sem nec tristique tempus, justo neque commodo nisl, ut gravida sem tellus suscipit nunc. Aliquam erat volutpat. Ut tincidunt pretium elit. Aliquam pulvinar. Nulla cursus. Suspendisse potenti. Etiam condimentum hendrerit felis. Duis iaculis aliquam enim. Donec dignissim augue vitae orci. Curabitur luctus felis a metus. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. In varius neque at enim. Suspendisse massa nulla, viverra in, bibendum vitae, tempor quis, lorem.</p><p>Donec dapibus orci sit amet elit. Maecenas rutrum ultrices lectus. Aliquam suscipit, lacus a iaculis adipiscing, eros orci pellentesque nisl, non pharetra dolor urna nec dolor. Integer cursus dolor vel magna. Integer ultrices feugiat sem. Proin nec nibh. Duis eu dui quis nunc sagittis lobortis. Fusce pharetra, enim ut sodales luctus, lectus arcu rhoncus purus, in fringilla augue elit vel lacus. In hac habitasse platea dictumst. Aliquam erat volutpat. Fusce iaculis elit id tellus. Ut accumsan malesuada turpis. Suspendisse potenti. Vestibulum lacus augue, lobortis mattis, laoreet in, varius at, nisi. Nunc gravida. Phasellus faucibus. In hac habitasse platea dictumst. Integer tempor lacus eget lectus. Praesent fringilla augue fringilla dui.</p></body></html>";
public static void main(String[] args) { launch(args); }
public void start(javafx.stage.Stage stage) {
HTMLEditor ed = new HTMLEditor();
ed.setHtmlText(sampleText);
stage.setScene(new javafx.scene.Scene(ed));
stage.show();
}
}
---------- END SOURCE ----------
CUSTOMER SUBMITTED WORKAROUND :
Either before or after selecting text, select a different font family first, then select the desired font family with the text selected.
java version "1.8.0_60"
Java(TM) SE Runtime Environment (build 1.8.0_60-b27)
Java HotSpot(TM) 64-Bit Server VM (build 25.60-b23, mixed mode)
ADDITIONAL OS VERSION INFORMATION :
Windows 7 Professional 64-bit
A DESCRIPTION OF THE PROBLEM :
In a javafx.scene.web.HTMLEditor, if you select the font family you want _before_ selecting text, then insert text, that text does not get styled with the selected font. (This may be working as designed.) But then if you position the cursor, the font family does not change to match the style of the font where the cursor has been positioned. If you select the text and try to set the font family, the style of the text does not change, since that font family is already selected. If you select an _unwanted_ font, then go back to the desired font, that works OK and finally sets the font to the desired style. And after that, when the cursor is positioned in the text, the font family changes to the one that matches the style of the text. The other attributes, such as font size and weight, appear to work as expected when positioning the cursor or selecting text.
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
Compile and run the test case below. In the drop down box, select the font family and size you want before selecting any text. Then select any text and try to change the font family to that same desired font. You _can_ try changing the font size.
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
Positioning the cursor or selecting text changes the font family that is selected, like it does for the font size and weight. You can select text and change the font family. Also, just changing the size should change the font style to match both the font family and size selected.
ACTUAL -
Positioning the cursor does not change the font family that is selected. Selecting text and trying to set the font family doesn't work. Setting the font size changes the font size OK, but does not set the text to the selected font family. The only way you can get it to change the font family is to select an _undesired_ font family first, then change it back.
REPRODUCIBILITY :
This bug can be reproduced always.
---------- BEGIN SOURCE ----------
import javafx.scene.web.HTMLEditor;
public class TestHTMLEditor
extends javafx.application.Application
{
static final String sampleText = "<?xml version=\"1.0\" encoding=\"UTF-8\"?><!DOCTYPE html><html xmlns=\"http://www.w3.org/1999/xhtml\"><html><head><title>Lorem Ipsum Text</title></head><body><h2 style=\"text-align: center\">Lorem Ipsum</h2><p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed at ante. Mauris eleifend, quam a vulputate dictum, massa quam dapibus leo, egetvulputate orci purus ut lorem. In fringilla mi in ligula. Pellentesque aliquam quam vel dolor. Nunc adipiscing. Sed quam odio, tempus ac, aliquam molestie, varius ac, tellus. Vestibulum ut nulla aliquam risus rutrum interdum. Pellentesque lorem. Curabitur sit amet erat quis risus feugiat viverra. Pellentesque augue justo, sagittis et, lacinia at, venenatis non, arcu. Nunc nec libero. In cursus dictum risus. Etiam tristique nisl a nulla. Ut a orci. Curabitur dolor nunc, egestas at, accumsan at, malesuada nec, magna.</p><p>Nulla facilisi. Nunc volutpat. Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia Curae; Ut sit amet orci vel mauris blandit vehicula. Nullam quis enim. Integer dignissim viverra velit. Curabitur in odio. In hac habitasse platea dictumst. Ut consequat, tellus eu volutpat varius, justo orci elementum dolor, sed imperdiet nulla tellus ut diam. Vestibulum ipsum ante, malesuada quis, tempus ac, placerat sit amet, elit.</p><p>Sed eget turpis a pede tempor malesuada. Vivamus quis mi at leo pulvinar hendrerit. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Pellentesque aliquet lacus vitae pede. Nullam mollis dolor ac nisi. Phasellus sit amet urna. Praesent pellentesque sapien sed lacus. Donec lacinia odio in odio. In sit amet elit. Maecenas gravida interdum urna. Integer pretium, arcu vitae imperdiet facilisis, elit tellus tempor nisi, vel feugiat ante velit sit amet mauris. Vivamus arcu. Integer pharetra magna ac lacus. Aliquam vitae sapien in nibh vehicula auctor. Suspendisse leo mauris, pulvinar sed, tempor et, consequat ac, lacus. Proin velit. Nulla semper lobortis mauris. Duis urna erat, ornare et, imperdiet eu, suscipit sit amet, massa. Nulla nulla nisi, pellentesque at, egestas quis, fringilla eu, diam.</p><p>Donec semper, sem nec tristique tempus, justo neque commodo nisl, ut gravida sem tellus suscipit nunc. Aliquam erat volutpat. Ut tincidunt pretium elit. Aliquam pulvinar. Nulla cursus. Suspendisse potenti. Etiam condimentum hendrerit felis. Duis iaculis aliquam enim. Donec dignissim augue vitae orci. Curabitur luctus felis a metus. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. In varius neque at enim. Suspendisse massa nulla, viverra in, bibendum vitae, tempor quis, lorem.</p><p>Donec dapibus orci sit amet elit. Maecenas rutrum ultrices lectus. Aliquam suscipit, lacus a iaculis adipiscing, eros orci pellentesque nisl, non pharetra dolor urna nec dolor. Integer cursus dolor vel magna. Integer ultrices feugiat sem. Proin nec nibh. Duis eu dui quis nunc sagittis lobortis. Fusce pharetra, enim ut sodales luctus, lectus arcu rhoncus purus, in fringilla augue elit vel lacus. In hac habitasse platea dictumst. Aliquam erat volutpat. Fusce iaculis elit id tellus. Ut accumsan malesuada turpis. Suspendisse potenti. Vestibulum lacus augue, lobortis mattis, laoreet in, varius at, nisi. Nunc gravida. Phasellus faucibus. In hac habitasse platea dictumst. Integer tempor lacus eget lectus. Praesent fringilla augue fringilla dui.</p></body></html>";
public static void main(String[] args) { launch(args); }
public void start(javafx.stage.Stage stage) {
HTMLEditor ed = new HTMLEditor();
ed.setHtmlText(sampleText);
stage.setScene(new javafx.scene.Scene(ed));
stage.show();
}
}
---------- END SOURCE ----------
CUSTOMER SUBMITTED WORKAROUND :
Either before or after selecting text, select a different font family first, then select the desired font family with the text selected.
- duplicates
-
JDK-8133833 JavaFX HTMLEditor Font Family should not default to a platform-specific font.
-
- Resolved
-