ClientFileLoader of fonts as registered resource [message #1755739] |
Tue, 07 March 2017 10:49 |
|
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
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.03410 seconds