Custom Font not working - javafx

I created an application which uses a custom font and it used to work for some reason. Now it doesn't recognize the font I included in the jar and it renders the text using the default font.
I really don't get it. When I run the application from Netbeans everything is OK.
Any ideas? I cleared the Java cache and everything but no luck. I am running JRE 1.6.0_20.
I even tried this guy's example and it does not work. It actually shows squares because of the font not found.
I hope someone has the solution.

JavaFX caches the fonts, so you must register the font before any use of the javafx.scene.text.Font class. Once you use the javafx Font classes, the system fonts are cached and it is never consulted again. Also, this is an AWT specific mechanism and will not work on platforms that support PRISM, like JavaFX-TV.

Related

Use of Ant Design Icons While Offline

I am working on a reactJS application that uses ant design for the UI. Recently we released this application to production where the computers are pretty locked down. This application is an intranet application and these computers have no internet access. So, because of that, the ant design icons on the modals were showing up as empty boxes. I did some digging and saw that the icons are using CSS classes.
For example, this is the CSS class for the red error "X" on the error modal:
.anticon-cross-circle:before
{
content:"\E62E"
}
I'm not too familiar with the CSS content attribute so I went to www.w3schools.com and read up on it a bit and tested this particular content value on their Try It page for this attribute and I got the empty box that I got in my production environment.
Does anyone know what needs to be done to import these icons into my project so that they can be used offline?
Thanks
What I think is happening is that Ant Design is defining the CSS font definition with a URL to the corresponding font-file. Since the computers are offline, it cannot find those definitions.
In the documentation I see that they also provide SVG Icons, which should work completely offline. I think this is worth a try. The steps to implement this can be found here and it should be available from version 3.9.0: https://ant.design/components/icon/#SVG-icons
Have you tried downloading the icon library into your project folder?
https://github.com/ant-design/ant-design-icons/tree/master/packages/icons-react. Looks like they have assigned their own codes to their own icons so you'll need to have them offline.
You will nessd the css file tabler-icons.css and the woff file tabler-icons.woff and assign a font-family named tabler-icons within your style.css using #font-face

I am trying to update Font Awesome from 5.0.6 to to 5.8.1, but I am getting blank squares

Somewhere in my site I have there folders:
(...)/font-awesome/5.0.6/css/
(...)/font-awesome/5.0.6/webfonts/
(...)/font-awesome/5.8.1/css/
(...)/font-awesome/5.8.1/webfonts/
If I include file font-awesome/5.0.6/css/fontawesome-all.min.css, Font Awesome works.
If I include file font-awesome/5.8.1/css/fontawesome.min.css, Font Awesome shows blank squares instead of icons.
It is most likely not due to cache as I've cleared the browser cache and .css cache files.
I remember that in the past, when integrating Font Awesome into a website, I was required to manually change some relative URLs inside the library, but that, if I remember well, was with Font Awesome 4.
I feel however like I'm missing some installation step. I just can't remember since it was "so long ago".
Do you download the .zip file instead of a single all.min.css file?
If not, then download the .zip file, unzip it, and link the main CSS file inside the header.
On the other hand, you can use the CDN link they provide:
<link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.8.1/css/all.css" integrity="sha384-50oBUHEmvpQ+1lW4y57PTFmhCaXp0ML5d60M1M7uH2+nqUivzIebhndOJK28anvf" crossorigin="anonymous">
Both work perfectly.
Considering the last release note there are some big changes done from 5.0 to 5.8:
Heads Up! This Release Has Breaking Changes
In a recent version, we fixed some issues with using our OTF and TTF font files on mobile projects. The naming, font weight, and version have been modified to be more compatible and stable going forward.
After upgrading your copies of our desktop files, you may need to set the typeface of your text layers again. After doing that, we also recommend double-checking that icons are showing up as expected in your documents. Running into trouble? Get in touch with us and we'll help you out.
You probably need to follow the links there in order to fix your issues:
Install the Ligature-based Font Files
I also advise you to upgrade slowly to a lower version because actually you are moving by the 7 version and it will difficult to know the real issue. So start moving to 5.1 then 5.2 and so on until you find which version is the culprit.
Releases ยท FortAwesome/Font-Awesome
Follow Upgrading Guide for more details about the upgrade between versions.
I found what the issue was. It's something that is specific to my site/application.
I minify most of my .css files using a PHP library then merge them using a homemade library (only the second library is homemade).
Then because, the resulting .css file isn't in the same locations. Links to webfonts get broken. That was the step I was forgetting: making all the relative ../webfont links semi-relative instead.
Everything works perfectly now.

Modifying a Chrome Extension broke the extension

I have the rikaikun japanese translator and i made changes to the css folder, it runs good but after 2 seconds it tells me that the extension could be broken. How can i keep these simple css changes without breaking the extension? (I Modified the color values on the css file)
I copied the contents of the extension and loaded it again to chrome on development mode, now it doesn't crash.

Change Drupal font Site-Wide?

There are a few pretty impressive font apps out there. My favourite is Font your Face (http://drupal.org/project/fontyourface). Only problem is it only allows for you to use existing sources. i.e.
Typekit.com
Google Font API
KERNEST
Font Squirrel
Common fonts -- fonts already available in most browsers
Is there any way to add a "source" that is effectively grabbing files off the server? I want to be able to upload my own fonts.
We've had good luck with webfonts, though we're not using any Drupal modules, just adding them to the theme using CSS.
The #font-your-face module now includes a local fonts module that does exactly what you've described here.

Adobe AIR font embedding suddenly stopped working right

I am completely stumped right now. I am working on an AIR application, everything was working perfectly, I did some small changes to code (completely unrelated to fonts, components or anything of this kind) when suddenly, during testing, I am flooded with hundreds of warning: incompatible embedded font errors. I didn't change any project settings, didn't make any framework update, I tried Clean and restating Flash Builder.
Now, I am working on a project which uses modules and both MX (only Datagrid) and Spark components, so I am using two versions of font:
#font-face {
src:url("/assets/font/helvetica.otf");
fontFamily: "Helvetica";
embedAsCFF: true;
}
[...]
[Embed(source="../assets/font/helvetica_3.otf", fontFamily="Helvetica_2",
embedAsCFF="false", mimeType="application/x-font")]
private var _font_:Class;
As you can guess, Helvetica is for Spark components while the other one is for MX. Two curious errors:
warning: incompatible embedded font 'Helvetica' specified for spark.components::Label (countdown) . This component requires that the embedded font be declared with embedAsCff=true Isn't it already?
warning: incompatible embedded font 'Helvetica_2' specified for mx.controls.dataGridClasses::DataGridItemRenderer (DataGridItemRenderer501) . This component requires that the embedded font be declared with embedAsCff=false. Isn't it already too?!
These errors relate to MODULES which I import into the project (yes, my own). Text in the main air app works more or less fine (Diacritic characters are not displayed anymore). I am using additionally these command line parameters:
-isolate-styles=false (So skins and ANYTHING is actually applied to the modules, without it there are no errors, but modules have no styles)
-keep-all-type-selectors=true (Removing this doesn't help anyway)
Anyone had similar problem and managed to find the cause? I tried to undo last changes I made but without avail...
Update:
Well, weird enough I found the source of problem. In one of the module's components I imported class which is also imported by Main app, which resulted in problem. The funny thing is, it worked fine until I cloned the component to make a similar one, which isn't even imported to ANY of the modules yet. Once again Flex proved it's weirdness.

Resources