Bug 364883 - inconsistent Display#getFontList with Display#loadFont
Summary: inconsistent Display#getFontList with Display#loadFont
Status: CLOSED WORKSFORME
Alias: None
Product: Platform
Classification: Eclipse Project
Component: SWT (show other bugs)
Version: 3.7.1   Edit
Hardware: PC Linux
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: Platform-SWT-Inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords: triaged
Depends on:
Blocks:
 
Reported: 2011-11-26 04:08 EST by andzsinszan CLA
Modified: 2018-11-30 11:41 EST (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description andzsinszan CLA 2011-11-26 04:08:58 EST
(1) Display#getFontList doesn't show changes after Display#loadFont successfully loads fonts.
(2) Display#loadFont always returns true. Even for non-existing files.

Ubuntu 11.04.
swt-3.7.1-gtk-linux-x86.jar 

[code]
import java.io.File;

import org.eclipse.swt.graphics.FontData;
import org.eclipse.swt.widgets.Display;

public class FontBug {
  public static void main(String[] args) {
    Display display = new Display();
// TTF Font from : http://scripts.sil.org/cms/scripts/page.php?site_id=nrsi&id=DoulosSIL_download
    File fontFile = new File("/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);
    }
    System.out.println(display.loadFont("this will return true too"));
  }
}

[/code]


The problem may be around:

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
Comment 1 Eric Williams CLA 2018-11-30 11:41:41 EST
The download link in your snippet is dead, also Ubuntu 11.04 is quite old and no longer supported. Please reopen this ticket with a working font link if the issue is reproducible on a supported target environment.