Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Standard Widget Toolkit (SWT) » Display#loadFont on gtk-linux(possible bug)
Display#loadFont on gtk-linux [message #758550] Wed, 23 November 2011 16:10 Go to next message
andzsinszan is currently offline andzsinszanFriend
Messages: 32
Registered: August 2011
Member
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 16:13]

Report message to a moderator

Re: Display#loadFont on gtk-linux [message #759005 is a reply to message #758550] Fri, 25 November 2011 14:56 Go to previous messageGo to next message
Lakshmi P ShanmugamFriend
Messages: 279
Registered: July 2009
Location: India
Senior Member
Hi,

If I remove the first call to display.getFontList() in your snippet --> FontData[] fd1 = display.getFontList(null, true/*scalable*/), the font seems to load fine and shows up display.getFontList(). Can you try it out and see if it works for you?
Please open a report for this bug here --> https://bugs.eclipse.org/bugs/enter_bug.cgi?product=Platform&component=SWT .

Thanks!


Lakshmi P Shanmugam
Re: Display#loadFont on gtk-linux [message #759090 is a reply to message #759005] Sat, 26 November 2011 08:57 Go to previous message
andzsinszan is currently offline andzsinszanFriend
Messages: 32
Registered: August 2011
Member
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.



Previous Topic:Linux Lotus Notes parent window unresponsive
Next Topic:converting swt to awt image transparency problem
Goto Forum:
  


Current Time: Thu Mar 28 12:18:52 GMT 2024

Powered by FUDForum. Page generated in 0.06587 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top