JavaFX modify font using CSS without displacing text - css

I want to easily change my application's font using CSS.
This is what I do to change it:
.root{
-fx-font-family: "Courier New";
}
The font's are changed but all the elements are displaced (I guess it's because of the new font's size).
How can I keep the fonts with the same position and size when changing the font?
Even the textareas are narrower...
I attach two pictures with the difference.
Thanks in advance.

Related

Setting font size in webvtt without css styling?

In an attempt to convert a ttml file into a webvtt file, I've been trying to set a font size in cues, but without css styling. For instance, instead of:
WEBVTT
STYLE
::cue {
font-size: 80%
}
I would like to have the font size attribute to appear in the cues:
00:00:00.000 --> 00:00:4.000 font-size: 80%
This is sized at 80%
I've tried using size: 80%, but apparently that's unrelated to font size.
Is there any way this could be accomplished?
Thanks in advance
The settings that can be specified on the cue are specified at:
https://www.w3.org/TR/webvtt1/#cue-settings
and those that can be specified on text within the cure are at:
https://www.w3.org/TR/webvtt1/#caption-text
Font size is not one of them.

Change content assist font size only

For a while now I am looking for a solution to increase selected components font sizes in Eclipse IDE. This is due to the fact, that this IDE is completely unusable on high DPI monitor (unless one is a hawk).
In this answer ( Change Project Explorer tree view font size in Eclipse Oxygen ) I have found how to increase the font size of the project explorer and the outline:
.MPart Tree {
font-family: Consolas;
font-size: 14;
}
Now I am looking for a way to increase the font of context assist. This simple solution wont do:
* {
font-size: 14;
font-family: Hack;
}
It does increase all possible fonts in the editor, but it also forces this font size everywhere. For example, If I change the font of the editor (by doing ctrl - or ctrl shift +), then click away somewhere, the editor font will detrimentally go back to the set font in the css file. I believe this is somehow bugged. So the only way for me now is to increase the content assist font only. Is there a css tag for that? How to do this?

Change font of WordPress theme "Zerif Lite"

I'm having trouble changing the font on a website I built using the WordPress theme Zerif Lite.
The page itself is (REMOVED LINK) - I want to change the font in the "testimonial" section or as its displayed there: "Teenused".
That weird font in the bottom of every box (a.client-name)
I have tried so far:
Custom CSS plugin - it lets me only change the font size, when I set new font there, it won't change anything.
Changed the theme's CSS files, also no luck there.
Will appreciate any kind of help.
You can change the font by targeting the correct selector, which is: .feedback-box .client-info .client-name. The current font is called Homemade Apple and is declared in the main theme's CSS file (style.css) at line 2797:
.feedback-box .client-info .client-name {
font-family: 'Homemade Apple', serif;
color: #404040;
}
Simply change that to your desired font, for example:
.feedback-box .client-info .client-name {
font-family: 'Montserrat', sans-serif;
color: #404040;
}
Have you try to add an !important rule to your CSS. It's either that or verify the load order from your styles.
When it comes down to a CSS style, the reason it may not be aplying is because there is another more specific selector, try adding parent selector to your rules, or it could also be that the theme's rules are loading after your rules and replacing them.
One last thing to check, when dealing with fonts: make sure your browser have access to and knows the font. If it does not finds it, it will just replace it with another one, without any warning.

How to set custom fonts in JavaFX Scene Builder using CSS

I'm making a GUI in JavaFX Scene Builder and would like all text (Labels, Text Fields, Comboboxes) to use the same font. The problem is it's a custom font that likely won't be on every client's computer.
I've tried CSS:
#font-face {
font-family: DIN;
src: url(DIN.tff);
}
.text {
-fx-font-family: DIN;
-fx-font-style: bold;
}
Saved the above code to file Font.css and tried applying it to each GUI element through Scene Builder's JavaFX CSS fields, but it's not working.
Have I made a mistake in the CSS? Or is there a better way to go about this? I'd prefer not to have to load the font and set it for every element in the Java code itself if I don't have to.
Make sure to use Font.loadFont to actually load the font on application startup. Then you should be able to use the font from CSS. Be careful to use the font's name, not the font file's name. That's a common mistake.
I have used the following before to load and use a custom font:
Font.loadFont(getClass().getResourceAsStream("/resources/fonts/marck.ttf"), 14);
and:
-fx-font-family: "Marck Script";
FYI: the quotes are only needed if the name contains a space.

Increasing the font size of a button

I have an application made in struts 1.2 and it will be accessed by Desktop browser as well as Android browser. The layout of the DEsktop browser is fine but having problems with the layout in Android browser. Somehow I managed to do the UI look and feel changes but stuck with the button font.
Below is the code I wrote for the button:
<html:submit property="action" value="Login" style="width: 150px;height: 80px;"></html:submit>
The button appearence is fine but the font of the button i.e. Login is very small. I tried adding the font: 100px; in the style attribute but it did not worked.
Any suggestions on how to increase the font size of the submit button text?
Please let me know about this.
Regards,
The font property value must be either a single keyword indicating a system font or contain at least font size and font family, as in font: 100% Calibri. If you wish to set the font size only, do not use the font shorthand but the specific property font-size, e.g. font-size: 30px.
font css attribute isn't what you want.. Use font-size: 100px instead.
In fact with font you can specify multiple font related attributes. Documentation

Resources