0

I have created a Birt report in which I defined a Segoeuii font-family to the text it works fine in windows but when it come of Unix OS it change all the fonts to the Times new Roman it is somehow because the font is not present in the Unix file system and Birt does not register the font that is not in the file system so we need to register the fonts first so using FontFactory I register the font and than set this font in the property but still it displaying Times new Roman .
Here is my code.

public void testCode() {
    URL font = Thread.currentThread().getContextClassLoader().getResource("segoeuii.ttf"); // getResourceAsStream("segoeuii.ttf");
    TextItemHandle text = (TextItemHandle) designHandle.findElement("TextProbingAttacks");
    FontFactory.register(font.toString(), "test_font");
    Font myfont = FontFactory.getFont("test_font");
    try {
        text.setProperty("fontFamily", myfont);
    } catch (SemanticException e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
    }
}
Root
  • 955
  • 1
  • 16
  • 39

1 Answers1

0

You need to install fonts in Unix OS.

For example, if you use Ubuntu (linux OS) then

sudo apt-get install ttf-mscorefonts-installer

Restart your eclipse all Microsoft fonts will reflect in your BIRT report perspective

Thirumal
  • 8,280
  • 11
  • 53
  • 103
  • But after some time I figured out it `Birt` is just showing `Times new Roman` whether the font is in filesystem or not. This problem is with the Unix specifically Ubuntu 14.04. – Root May 04 '16 at 06:33
  • And registering the font fulfill this need of installing fonts on the system because in some cases in production environment we don't have access of the system. – Root May 04 '16 at 08:05