Skip to main content



      Home
Home » Eclipse Projects » Remote Application Platform (RAP) » ClientFileLoader of fonts as registered resource(Fonts registered as resources and loaded with ClientFileLoader not available)
ClientFileLoader of fonts as registered resource [message #1755739] Tue, 07 March 2017 05:49 Go to next message
Eclipse UserFriend
If I use RAP 3.1's ClientFileLoader to load a font, it works OK for a remote web font, such as this:

ClientFileLoader loader = RWT.getClient().getService(ClientFileLoader.class);
loader.requireCss("https://fonts.googleapis.com/css?family=Lobster");

I can then use the font "Lobster" in setFont methods and it works OK.

However, if I download the same font and include the TTF file as a resource within my application, registering the resource, the ClientFileLoader seems to work OK (at least doesn't hang), but the font does not appear:

ClientFileLoader loader = RWT.getClient().getService(ClientFileLoader.class);
loader.requireCss(resourceName);

...where resourceName is from getLocation from a ResourceManager register method - I know these work OK for other resource types... values start with "rwt-resources/..." as I'd expect.

This is important for applications designed to work on an internal network, with no internet access, so I need to be able to support loading of such fonts as static resources like this.

Related to this is that if I supply a URL to requireCss which doesn't exist, it just hangs the application... is this normal? Not a major problem, as I should only be calling it for URLs that are valid, but in principle, should it hang like that?

I'm guessing I need to point ClientFileLoader to some definition file of the font rather than directly at a TTF file, but what, and how should it look?

Thanks, John

[Updated on: Tue, 07 March 2017 07:14] by Moderator

Re: ClientFileLoader of fonts as registered resource [message #1755775 is a reply to message #1755739] Tue, 07 March 2017 16:23 Go to previous messageGo to next message
Eclipse UserFriend
I would start by looking at the content of that CSS file, https://fonts.googleapis.com/css?family=Lobster
You can see it's a plain CSS file that defines fonts from WOFF files.

You'll need to host the CSS file and the woff files.
Re: ClientFileLoader of fonts as registered resource [message #1755967 is a reply to message #1755775] Thu, 09 March 2017 10:38 Go to previous message
Eclipse UserFriend
Thanks Chris.
I know nothing about WOFF files at the moment, so all new. I was hoping that I could just host the TTF file somehow, but it seems it is much more involved than this.
John

Previous Topic:eclipse RAP + chartjs
Next Topic:Can not load pdf in Chrome
Goto Forum:
  


Current Time: Wed Jul 23 22:06:23 EDT 2025

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

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

Back to the top