Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    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 10:49 Go to next message
John Gymer is currently offline John GymerFriend
Messages: 279
Registered: November 2012
Location: UK
Senior Member
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


---
Just because you can doesn't mean you should

[Updated on: Tue, 07 March 2017 12:14]

Report message to a moderator

Re: ClientFileLoader of fonts as registered resource [message #1755775 is a reply to message #1755739] Tue, 07 March 2017 21:23 Go to previous messageGo to next message
Chris Fairhall is currently offline Chris FairhallFriend
Messages: 221
Registered: February 2011
Senior Member
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 15:38 Go to previous message
John Gymer is currently offline John GymerFriend
Messages: 279
Registered: November 2012
Location: UK
Senior Member
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



---
Just because you can doesn't mean you should
Previous Topic:eclipse RAP + chartjs
Next Topic:Can not load pdf in Chrome
Goto Forum:
  


Current Time: Thu Apr 25 22:13:43 GMT 2024

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

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

Back to the top