Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Archived » BIRT » Load font by relative path instead of full path for birt 3.7.2
Load font by relative path instead of full path for birt 3.7.2 [message #856330] Wed, 25 April 2012 15:12 Go to next message
zubin Missing name is currently offline zubin Missing nameFriend
Messages: 32
Registered: July 2009
Member
I use custom fontsCondfig.xml in reports/. Can I configure fontsConfig.xml to load fonts from relative path or from jars?

for example

Here is folder structure.
reports/fontsConfig.xml
reports/fonts/fonta.ttf.

If i use full path on my system, it works fine, but it doesn't work if i use relative path:

likes:

<font-paths>
<path path="fonts"/>
</font-paths>
Config2:

<font-paths>
<path path="classpath:reports/fonts"/>
</font-paths>

thanks,
Re: Load font by relative path instead of full path for birt 3.7.2 [message #856458 is a reply to message #856330] Wed, 25 April 2012 17:21 Go to previous messageGo to next message
Jason Weathersby is currently offline Jason WeathersbyFriend
Messages: 9167
Registered: July 2009
Senior Member

I believe the path entry has to be a full path. I did notice when the
font manager is created it looks for embedded fonts with the following
function:

protected String getEmbededFontPath( )
{
Bundle bundle = Platform
.getBundle( "org.eclipse.birt.report.engine.fonts" ); //$NON-NLS-1$
if ( bundle == null )
{
return null;
}
Path path = new Path( "/fonts" ); //$NON-NLS-1$

URL fileURL = FileLocator.find( bundle, path, null );
..
..


May be worth trying creating a bundle to hold a fonts directory with
fonts. In the designer the plugin is already there.

Jason

On 4/25/2012 11:12 AM, zubin Mising name wrote:
> I use custom fontsCondfig.xml in reports/. Can I configure
> fontsConfig.xml to load fonts from relative path or from jars?
>
> for example
>
> Here is folder structure.
> reports/fontsConfig.xml
> reports/fonts/fonta.ttf.
>
> If i use full path on my system, it works fine, but it doesn't work if i
> use relative path:
>
> likes:
>
> <font-paths>
> <path path="fonts"/>
> </font-paths>
> Config2:
>
> <font-paths>
> <path path="classpath:reports/fonts"/>
> </font-paths>
>
> thanks,
Re: Load font by relative path instead of full path for birt 3.7.2 [message #856598 is a reply to message #856458] Wed, 25 April 2012 20:33 Go to previous messageGo to next message
zubin Missing name is currently offline zubin Missing nameFriend
Messages: 32
Registered: July 2009
Member
thanks, jason. it sad to know that it doesn't support relative path. I will try what you suggestion above by adding fonts in the org.eclipse.birt.report.engine.fonts bundle.
Re: Load font by relative path instead of full path for birt 3.7.2 [message #882747 is a reply to message #856598] Thu, 07 June 2012 05:21 Go to previous messageGo to next message
Arghya Dutta is currently offline Arghya DuttaFriend
Messages: 1
Registered: May 2012
Junior Member
Does this work on BIRT 3.7.0 ? How can I load fonts to the Birt Engine at runtime ?
Re: Load font by relative path instead of full path for birt 3.7.2 [message #883105 is a reply to message #882747] Thu, 07 June 2012 21:16 Go to previous messageGo to next message
Jason Weathersby is currently offline Jason WeathersbyFriend
Messages: 9167
Registered: July 2009
Senior Member

Have you seen this thread?
http://www.eclipse.org/forums/index.php/t/273579/

The fontsConfig.xml controls font configuration. Alternatively you can
specify a system property for the fonts dir. If you are using the
report engine api you can specify an alternative fontsConfig.xml in the
EngineConfig.setFontConfig method.

Jason

On 6/7/2012 1:21 AM, Arghya Dutta wrote:
> Does this work on BIRT 3.7.0 ? How can I load fonts to the Birt Engine
> at runtime ?
Re: Load font by relative path instead of full path for birt 3.7.2 [message #892388 is a reply to message #856458] Thu, 28 June 2012 02:37 Go to previous messageGo to next message
M H is currently offline M HFriend
Messages: 5
Registered: June 2012
Junior Member
Hi Jason,

I'm facing the same issue here. I need to package the fonts in my ear, thus I need relative path.

Regarding your suggestion to add font folder in the bundle org.eclipse.birt.report.engine.fonts:

As far as I know, with 3.7.2 we don't need the plugin directory anymore.
If we want to add the bundle entry in the plugin, how I am supposed to instruct BIRT to load the fonts from the bundle?

I'm trying to put plugin and configuration folder in WEB-INF and then try to start the engine and calling
PlatformServletContext platformCtx = new PlatformServletContext(servletCtx);
config.setPlatformContext(platformCtx);
Re: Load font by relative path instead of full path for birt 3.7.2 [message #892389 is a reply to message #856458] Thu, 28 June 2012 02:40 Go to previous messageGo to next message
M H is currently offline M HFriend
Messages: 5
Registered: June 2012
Junior Member
sorry that I accidentally deleted..so continue ..


I know with 3.7.2 we don't need these lines, but I'm supposed this is the way how to get BIRT reading the plugins? or no?
However, I'm having nullpointerexception there so not able to startup the engine.

Please help.
Re: Load font by relative path instead of full path for birt 3.7.2 [message #892592 is a reply to message #892389] Thu, 28 June 2012 16:03 Go to previous messageGo to next message
Jason Weathersby is currently offline Jason WeathersbyFriend
Messages: 9167
Registered: July 2009
Senior Member

BIRT 3.7.2 has both an OSGi and POJO runtime. If you are using the POJO
runtime the fontsconfig is jarred up in the
org.eclipse.birt.runtime_version.jar. If you use the OSGi runtime you
will have the plugins and configuration directories. POJO runtime is
the default and recommended runtime. Take a look at this bugzilla entry:
https://bugs.eclipse.org/bugs/show_bug.cgi?id=347431

Jason

On 6/27/2012 10:40 PM, Mastura Hanafiah wrote:
> sorry that I accidentally deleted..so continue ..
>
>
> I know with 3.7.2 we don't need these lines, but I'm supposed this is
> the way how to get BIRT reading the plugins? or no?
> However, I'm having nullpointerexception there so not able to startup
> the engine.
>
> Please help.
Re: Load font by relative path instead of full path for birt 3.7.2 [message #892829 is a reply to message #892592] Sat, 30 June 2012 03:24 Go to previous messageGo to next message
M H is currently offline M HFriend
Messages: 5
Registered: June 2012
Junior Member
Thank you Jason. I believe that the method registerJavaFonts() is already in FontMappingManagerFactory.java

If I define the font property directories as system property using "birt.font.dirs" as the key, when actually it will be called?
Actually I have tried to define the custom directories, but whenever I call the report it always looking for the font paths defined in fontsConfig.xml and do not take the font directories that I have defined.

Just before I called the IRunAndRenderTask run method, I check System.getProperty("birt.font.dirs"), it did return the directory that I have defined.

Anything that I missed here?




Re: Load font by relative path instead of full path for birt 3.7.2 [message #892990 is a reply to message #892829] Mon, 02 July 2012 08:45 Go to previous messageGo to next message
M H is currently offline M HFriend
Messages: 5
Registered: June 2012
Junior Member
Hi Jason,
Besides my question on the font custom directory, I also want to know whether it is possible to use OSGi in 3.7. Is there any guide on this? I tried this one and put plugins and configuration directories, also take all libs from 3.7 (I download from 3.7 osgi), then when startup I have error CannotStartupOSGIPlatform.

Re: Load font by relative path instead of full path for birt 3.7.2 [message #893148 is a reply to message #892990] Mon, 02 July 2012 22:13 Go to previous messageGo to next message
Jason Weathersby is currently offline Jason WeathersbyFriend
Messages: 9167
Registered: July 2009
Senior Member

I am not certain why the system property is not working but I have added
a comment to the bugzilla entry for this.
https://bugs.eclipse.org/bugs/show_bug.cgi?id=347431

Have you tried this?
EngineConfig.setFontConfig(URL)

The URL should point to a file that has similar format to existing
fontsConfig.xml file.

If you want to use the OSGi runtime remove all of the POJO runtime and
download the OSGi runtime for your version. I believe this was first
made available in 3.7.2
http://birtworld.blogspot.com/2012/03/birt-372-new-features.html

Once you download it only include the libs in the reportengine/lib
directory in your classpath. Look at this wiki page:
http://wiki.eclipse.org/Servlet_Example_%28BIRT%29_2.1

While it has older versions the setup is pretty much the same if you are
going to use an OSGi runtime.

Jason

On 7/2/2012 4:45 AM, M H wrote:
> Hi Jason, Besides my question on the font custom directory, I also want
> to know whether it is possible to use OSGi in 3.7. Is there any guide on
> this? I tried this one and put plugins and configuration directories,
> also take all libs from 3.7 (I download from 3.7 osgi), then when
> startup I have error CannotStartupOSGIPlatform.
>
>
Re: Load font by relative path instead of full path for birt 3.7.2 [message #893621 is a reply to message #893148] Thu, 05 July 2012 00:02 Go to previous messageGo to next message
M H is currently offline M HFriend
Messages: 5
Registered: June 2012
Junior Member
Hi Jason,
I solved the problem now by using the osgi runtime, and put some missing jars for org.eclipse.datatools.*..jar from the designer plugins.
I had error earlier (before putting all the missing jars) like "Cannot find or process the ODA data source extension configuration..."
So I tried to copied the missing jar, and errors are all gone.
Does the osgi package miss any jars?


I did not try on EngineConfig.setFontConfig(URL) because my customer does not like the idea on putting the fonts separately.

So, I guess it is fine for now..
Re: Load font by relative path instead of full path for birt 3.7.2 [message #893803 is a reply to message #893621] Thu, 05 July 2012 14:21 Go to previous message
Jason Weathersby is currently offline Jason WeathersbyFriend
Messages: 9167
Registered: July 2009
Senior Member

If you are using the osgi runtime all the required jars for it should be
in the runtime/reportengine/lib directory.

Jason

On 7/4/2012 8:02 PM, M H wrote:
> Hi Jason, I solved the problem now by using the osgi runtime, and put
> some missing jars for org.eclipse.datatools.*..jar from the designer
> plugins.
> I had error earlier (before putting all the missing jars) like "Cannot
> find or process the ODA data source extension configuration..."
> So I tried to copied the missing jar, and errors are all gone.
> Does the osgi package miss any jars?
>
>
> I did not try on EngineConfig.setFontConfig(URL) because my customer
> does not like the idea on putting the fonts separately.
> So, I guess it is fine for now..
>
Previous Topic:Using BIRT Parameter with LIKE
Next Topic:Change Table Group interval in script
Goto Forum:
  


Current Time: Fri Mar 29 09:49:21 GMT 2024

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

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

Back to the top