user3595714
user3595714

Reputation: 143

Arabic Font in Webview Javafx

Why arabic text in webview JavaFX is not connected?

I use this code

         WebView myweb = new WebView();
         final WebEngine webengine = myweb.getEngine();   
         InputStream is = Main.class.getResourceAsStream("Farhood.ttf");

         Font arabicFont =  Font.loadFont(is,10);
         webengine.loadContent("<h1  style=\"font-family:Farhood;\">بِسْمِ اللَّهِ الرَّحْمَٰنِ الرَّحِيمِ</h1><h1  style=\"font-family:Farhood;\">ِﻢﻳِﺣَّﺮﻟﺍ ِﻥَٰﻡْﺣَّﺮﻟﺍ ِﻩَّﻠﻟﺍ ِﻡْﺳِﺑ</h1>");
         children.add(myweb);  

and this result

https://i.sstatic.net/5hIbX.png

Upvotes: 2

Views: 806

Answers (2)

Mike Emery
Mike Emery

Reputation: 837

I'm seeing this also. Arabic words have little gaps with all fonts. Same html in browser looks fine (chrome, firefox). Adjusting the font size makes the gaps appear and disappear depending on size. Labels do this too...

Bonus: webview word wrap sometimes splits up arabic words in the middle!

Edit: running java 1.8.0_25 on Ubuntu 14.04

Upvotes: 0

Haryanto
Haryanto

Reputation: 649

Use JRE8, supports Arabic text, and supports the @font-face css

http://www.oracle.com/technetwork/java/javase/downloads/jre8-downloads-2133155.html

Upvotes: 1

Related Questions