Surrogate pair characters are rendered incorrectly or not rendered on the following program.
Note: A font file mingliub.ttf (Windows font file) must be installed on the OS (Windows, MacOSX).
import javafx.application.Application;
import javafx.scene.Scene;
import javafx.scene.web.WebView;
import javafx.stage.Stage;
public class Main extends Application {
public final static void main(String[] arguments) {
Application.launch(arguments);
}
@Override
public void start(Stage stage) throws Exception {
WebView webView = new WebView();
webView.getEngine().loadContent("<!DOCTYPE html>\n<html><head></head><body><p style=\"font-family:PMingLiU-ExtB;font-size:200%;text-decoration:underline;\">𠀀</p></body></html>");
webView.setPrefSize(800, 600);
Scene scene = new Scene(webView);
stage.setScene(scene);
stage.sizeToScene();
stage.show();
}
}
The text part "𠀀" is for a character "������" in CJK Unified Ideographs Extension B.
In the case of "𠀀" ... any are not rendered.
In the case of "������" ... six "?" characters with underline are rendered.
In the case of "��" ... two "?" characters with underline are rendered.
In the case of "a𠀀" ... "a" and "������" are rendered. "a" is with underline, but "������" is not with underline. And "a" is selectable, but "������" is not selectable.
In the case of "𠀀a" ... "������" and "a" are rendered. The left half of "������" is with underline, and the rest is not with underline, and "a" is not with underline The underline part is selectable and "a" appears on the selecting.
In the case of "𠀀aa" ... "������" and "aa" are rendered. "������" is with underline, "aa" is not with underline. "������" is selectable, but "aa" appears on the selecting.
Note: On using HTMLEditor instead of WebView, the same characters and underlines are displayed. The cursor moving (and displaying) is incorrectly. But Ctrl+C is valid, and I can copy the character "������" and paste into the clipboard.
Note2: On Java 8 Build b108 (on MacOSX), these problems seem to be not appeared. On Java 7, will they be fixed?