I'm trying to build a instant messaging application using JavaFX. I want to implement emoji support by using unicode however, when using a font such as Google's Noto Color Emoji the emoji's only appear as greyscale. like so:
I've applied the font like so and can confirm that it is loading correctly.
#font-face {
font-family: 'Noto Color Emoji';
src: url('/fonts/NotoColorEmoji.ttf');
}
.message-widget-font {
-fx-font-family: Noto Color Emoji;
}
Applying the CSS to the Text object:
messageText.getStyleClass().add("message-widget-font");
Is there a way to get the emoji's to have colour?
Related
How I can add borders around specifically selected text in a text view like this?
I have recelerview in the activity and the data showing in picture is get from server using API, the API send data wrap with HTML tags like
"<div style=“border:2px solid red;padding: 5px;border-radius: 25px;”>the ground.</div>"
But the border tag is not supported by either Android nor iOS. I need to find a way to show border on both iOS and Android. If I need to communicate with a web team for a change I can do this, but any help will be appreciated.
Note: we cannot use Webview, because we need to perform some other operation on each text row.
Check the following line of code. I think this piece of code helpful for you:
<div style="border:3px; border-style:solid; border-color:#000000; padding: 1em;">the ground.</div>
If you want get border in your text, set your html like this
<div style="border:2px; border-style:solid; border-color: red; padding: 1em ; display: inline-block; border-radius: 25px;">the ground.</div>
But, i don't think that TextView can show css, in my experience i've using web view to do that.. Furthermore, my suggest if you don't want to use webview just set bold to specific word
I have developed my site using a theme (HTML, CSS, JavaScript).
But the Blog Title is using default link color.
I have tried many ways to use the Title color, but I became unsuccessful to do that.
How can I change the Title color?
Title color is disabled
Title is using Default link color
You can override the css properties using !important.
So, the following change might help:
.header-logo h1 {
color: #065445 !important;
font-size: 30px;
line-height: 1.4em;
}
Apply color property to "a" tag, not on h1. You can either use the following ways:
inline-CSS to impose this color to the title.
Use !important with color property of CSS.
.header-logo h1 a{
color: #065445 !important;
}
I'm going to lose my mind now. I am unable to connect my font in css styles for a label in my javafx project. I just don't know what the matter is, the stylesheet is connected correctly, because I can change the color of the label. I put the font file in the same directory as the stylesheet, tried even specifying the absolute path. Nothing works. What am I doing wrong?
Java 11, JavaFX 16.
And yes, I checked all the titles and the name of the font. Everything matches
CSS
#font-face {
src: url("Lobster-Regular.ttf");
}
.label {
-fx-font-family: "Lobster";
}
FXML:
<Label id="main_label" layoutX="237.0" layoutY="47.0" stylesheets="#styles/lable.css" text="Test" textFill="WHITE">
</Label>
enter image description here
I'm trying to load an html file that contains the circled bullet symbol: ⦿. It's showing up fine for API 29 but doesn't seem to be working for API 21. Is there a workaround for lower APIs to fix this issue?
If it might help anyone with the same/similar issue, what I did was inject #font face with fallback fonts inside my html file and specified the order in which I wanted the fonts to load - "Times New Roman" being the primary font I chose followed by "CODE2000" in case the primary font had missing glyphs. And if there were any missing glyphs still, it would fallback to an available serif font. So here, I wanted "Times New Roman" to be my primary font, but since it did not support the circled bullet glyph in API 21, a reserve font supporting the circled bullet glyph was added which fixed the issue for me.
<style>
#font-face {
font-family: 'Times New Roman';
src: url('file:///android_asset/fonts/Times New Roman.ttf');
}
#font-face {
font-family: 'Code2000';
src: url('file:///android_asset/fonts/CODE2000.TTF');
}
body { font-family: 'Times New Roman', 'CODE2000', serif; }
</style>
I want to style the font of the CalendarTimeTextField Popup control using a CSS File.
The following entry doesn't work for me:
.CalendarTimeTextFieldSkin_popup {
-fx-text-fill: white;
-fx-font-style: italic;
}
Setting the font-type works, changing text color doesn't.
Thanks for supporting me
GGK
The text is rendered with a Text node (https://docs.oracle.com/javafx/2/api/javafx/scene/doc-files/cssref.html#text) so use -fx-fill and/or -fx-stroke.