Display#loadFont on gtk-linux [message #758550] |
Wed, 23 November 2011 11:10  |
Eclipse User |
|
|
|
Hi,
I'm using swt-3.7.1-gtk-linux-x86.jar on Ubuntu 11.04.
In my app I need to use phonetic characters (Doulos SIL, TTF), which had worked fine with Swing. My strategy with SWT was to
- pack the .ttf font file into the App's jar
- get TTF from jar as stream
- write it into a temporary file (in user's home)
- load font locally with Display#loadFont
This last step doesn't work.
#1 The loaded file is not in the Display#getFontList.
The code below prints the lists' sizes -- which are identical.
#2 Display#loadFont returns true for any (nonsense) strings.
// The temporary font file is "/home/me/DoulosSILR.ttf".
FontData[] fd1 = display.getFontList(null, true/*scalable*/);
System.out.println(fd1.length);
if(display.loadFont(fontFile.getAbsolutePath())){
FontData[] fd2 = display.getFontList(null, true/*scalable*/);
System.out.println(fd2.length);
}
I tried to debug the process. I got till the native method:
public static final native boolean _FcConfigAppFontAddFile(int /*long*/ config, byte[] file);
This method is preceded by a call to
ClassLoader#FindNative
with runtime argument:
Java_org_eclipse_swt_internal_gtk_OS__1FcConfigAppFontAddFile
Any ideas?
[Updated on: Wed, 23 November 2011 11:13] by Moderator
|
|
|
|
Re: Display#loadFont on gtk-linux [message #759090 is a reply to message #759005] |
Sat, 26 November 2011 03:57  |
Eclipse User |
|
|
|
Thank you!
You are right.
(1) if I remove the first Display#getFontList call, the second one will include the loaded font
(2) even if the loaded font is not in the list returned by Display#getFontList,
the font can be created (new Font(...)) and it displays correctly in the app
I will proceed with the bug report.
Thanks again.
|
|
|
Powered by
FUDForum. Page generated in 0.03967 seconds