vendredi 10 avril 2015

JavaFX WebView can't show Kartuli characters on some widnows 7 installations

I'm using JavaFX WebView to show a web page in a java application. The application has been localized to the Georgian language Kartuli, and so have the web page. In test the web page sometimes show the Kartuli characters without problems on Windows 7. But for some (still windows 7) it does not, it only shows squares instead of the characters, as if the character is not found in the font. I have been trying to find out why this is happening but google turned up nothing. I then created a minimal java implementation that replicates the problem. And it is the same, it works for some but not for others and all have windows 7.


The implementation is:



import javafx.application.Application;
import javafx.scene.Scene;
import javafx.scene.layout.Region;
import javafx.scene.paint.Color;
import javafx.scene.web.WebEngine;
import javafx.scene.web.WebView;
import javafx.stage.Stage;


public class Main extends Application {
private Scene scene;

@Override public void start(Stage stage) {
stage.setTitle("Web View");
scene = new Scene(new Browser(),750,500, Color.web("#666970"));
stage.setScene(scene);
stage.show();
}

public static void main(String[] args){
launch(args);
}
}

class Browser extends Region {
final WebView browser = new WebView();
final WebEngine webEngine = browser.getEngine();

public Browser() {

getStyleClass().add("browser");

String indexHtmlURL = Browser.class.getResource("index.html").toExternalForm();
webEngine.load(indexHtmlURL);

getChildren().add(browser);
}

@Override protected double computePrefWidth(double height) {
return 750;
}

@Override protected double computePrefHeight(double width) {
return 500;
}
}


Index.html:



<!DOCTYPE html>
<html lang="en">
<head>
<meta http-equiv="X-UA-Compatible" content="IE=edge"/>
<meta charset="utf-8">
<title>Kartuli Test</title>
<meta name="description" content="">
</head>
<body>
<p>ალითააეი</p>
<p>&#4304;&#4314;&#4312;&#4311;&#4304;&#4304;&#4308;&#4312;</p>
</body>
</html>


Do anyone have an idea on what I'm doing wrong or what's missing.


Aucun commentaire:

Enregistrer un commentaire