[Logo] Enterprise Client Community
  [Search] Search   [Recent Topics] Recent Topics   [Members]  Member Listing   [Groups] Back to home page 
[Register] Register / 
[Login] Login 
Risc: Fontawesome icons in button image tag?  XML
Forum Index -> Development Go to Page: 1, 2 Next 
Author Message
msailer

Power User

Joined: 22/06/2015 12:17:44
Messages: 112
Offline

Hi,

is it possible to use fontawesome icons in the setImage tag of a BUTTONNode or do we need to use the AWESOMEFONTICONNode?
CaptainCasa

Power User
[Avatar]

Joined: 21/11/2007 12:23:06
Messages: 5519
Offline

...my recommended way: use the SVG version of awesome font icons. Is this an option for you?

Regards, Björn

PS: there is a way where the awesome font icon is converted to a PNG on server side, but this is something I would NOT recommend anymore to do...


Björn Müller, CaptainCasa GmbH
msailer

Power User

Joined: 22/06/2015 12:17:44
Messages: 112
Offline

Yes that's what we're currently doing. Just thought it might work this way Thanks!
CaptainCasa

Power User
[Avatar]

Joined: 21/11/2007 12:23:06
Messages: 5519
Offline

...additional info:

1. There is an SVG icon colorinzing/sizing tool part of the CaptainCasa toolset (take a look at one of the left rounded buttons)
2. Please assign a size to SVG icons. There might be some problems in IE10/11. You may assign a size by naming the icon "/harry_16x16.svg", that's the "cheapest" way... ;-)

Rgeards, Björn

Björn Müller, CaptainCasa GmbH
rspiller

Power User

Joined: 20/04/2012 07:37:01
Messages: 59
Offline

What I was doing on some elements is to set its font to the fontawesome-Font and then insert the copied UTF-8 "icon" as text.

This way you can have a vectorized icon without doing extra SVG-Stuff.

Why I prefer it this way: the fontawesome font is already loaded inside the browser while a SVG may need extra processing (HTTP/Servlet).

Unfortunately this works only in none mixed scenarios. So ICON + TEXT (like a button) is not working. Since it would share its font.

Or you have to do the icon by CSS classes. Which I did not try yet.
heyl

Power User

Joined: 10/01/2008 09:41:55
Messages: 267
Location: Ettlingen
Offline

Hi,

we tried the SVG notation "/images.iconssvg.heartbeat.#800000.16x16.ccsvg" exactly like in demo workspace "SVG Images - Coloring and Sizing" but it does not display the icon.
We don't know what is wrong there. We checked everything, path is correct, we even removed our overwrite of riscbutton style, etc.

Tried on Firefox and Chrome. It does not display the image at all.

Best regards
Frauke
CaptainCasa

Power User
[Avatar]

Joined: 21/11/2007 12:23:06
Messages: 5519
Offline

...please check web.xml:

Code:
   <servlet-mapping>
     <servlet-name>DynamicImageServlet</servlet-name>
     <url-pattern>*.ccsvg</url-pattern>
   </servlet-mapping>
 


maybe this is missing?

Regards, Björn

Björn Müller, CaptainCasa GmbH
msailer

Power User

Joined: 22/06/2015 12:17:44
Messages: 112
Offline

With that servlet mapping the images are now displayed when we use that notation but not colored. Is there another switch we need to have for coloring?
CaptainCasa

Power User
[Avatar]

Joined: 21/11/2007 12:23:06
Messages: 5519
Offline

...the coloring might depend from the icon library. We tested SVG icons grom AwesomeFont and also some produced from SAP-icon-font. The icons must be falt without coloring information in the path. (At the ende the servlet does some quite sutpid inserting of color tags.)

Could you please attach one of your icons to this post?

Regards, Björn

Björn Müller, CaptainCasa GmbH
msailer

Power User

Joined: 22/06/2015 12:17:44
Messages: 112
Offline

I tested it with this one: https://fontawesome.com/icons/plus?style=solid
CaptainCasa

Power User
[Avatar]

Joined: 21/11/2007 12:23:06
Messages: 5519
Offline

Hi,

I checked the icon's svg:

Code:
 <svg aria-hidden="true" data-prefix="fas" data-icon="plus"
     class="svg-inline--fa fa-plus fa-w-14" role="img"
     xmlns="http://www.w3.org/2000/svg" viewBox="0 0 448 512">
     <path fill="currentColor"
 


The "currentColor" is overriding the color that we add to the icon's SVG within our servlet processing. If you remove it from the SVG then it works fine. We will also add a special "hook" into out servelt processing, checking for "currentColor"...

The way we get our list of SVG icons is by downloading the whole awesomefont-package and then there is a folder structure:

Code:
 <dir>
   advanced-options
     raw-svg
       brands
         *.svg
       regular
         *.svg
       solid
         *.svg
 


Regards, Björn


Björn Müller, CaptainCasa GmbH
msailer

Power User

Joined: 22/06/2015 12:17:44
Messages: 112
Offline

Ah ok that's why. Thank you for the efforts! We'll try that!
CaptainCasa

Power User
[Avatar]

Joined: 21/11/2007 12:23:06
Messages: 5519
Offline

...just see: they changed the directory structure in the newest version (mine was 5.04, current one is 5.20)... - but the SVG icons are directly usable from there.

The link + copyright info is here: https://fontawesome.com/how-to-use/on-the-web/setup/hosting-font-awesome-yourself

Regards, Björn


Björn Müller, CaptainCasa GmbH
heyl

Power User

Joined: 10/01/2008 09:41:55
Messages: 267
Location: Ettlingen
Offline

Hi,

the SVG icons do not work with the "old" JNLP client.
Does anybody know a workaround for that?

Best regards
Frauke

Code:
 Nov 05, 2018 1:02:06 PM org.apache.catalina.core.StandardWrapperValve invoke
 SCHWERWIEGEND: Servlet.service() for servlet [DynamicImageServlet] in context with path [/prime_explorer] threw exception [Servlet execution threw an exception] with root cause
 java.lang.Error: Problem processing dynamic image: /prime_explorer/images.fa.regular.power-off.@color_white@.@icon_size@.ccsvg
 	at org.eclnt.jsfserver.util.DynamicImageServlet.doPost(DynamicImageServlet.java:83)
 	at org.eclnt.jsfserver.util.DynamicImageServlet.doGet(DynamicImageServlet.java:25)
 	at javax.servlet.http.HttpServlet.service(HttpServlet.java:635)
 	at javax.servlet.http.HttpServlet.service(HttpServlet.java:742)
 

CaptainCasa

Power User
[Avatar]

Joined: 21/11/2007 12:23:06
Messages: 5519
Offline

Hi Frauke,

just to confirm: you are right: SVGs are not rendered in the Swing client.

I currently can only imagine some workaround in which the .svg is converted to .png at server side via servlet, and the Swing client automatically addresses the servlet when loading the image.

We could update the image loader in the Swing client correspondingly.

Regards, Björn

Björn Müller, CaptainCasa GmbH
 
Forum Index -> Development Go to Page: 1, 2 Next 
Go to:   
Powered by JForum 2.1.6 © JForum Team