Hello,
I have been trying (for years now) to improve the font anti-aliasing in Javafx. I have read several times that there are 3 ways to change the font anti-aliasing:
CSS (gray / lcd)
Jar Arguments (true/false)
Code properties (true/false)
The problem is that regardless of what I do, it actually never changes anything when I run the program. I know that it's always false using this function:
which returns this:
Now, if I change the " -fx-font-smoothing-type" in CSS and preview my CSS in SceneBuilder, I can see it changing.
To illustrate the problem, please see this example:
Left is SceneBuilder, Right is the jar ran:
We can see that sceneBuilder has the "LCD" antialiasing applied (Which spills some RGB colors), but my JAR is always "GRAY" antialiasing:
Anyone has an idea why I can't change my jar to "LCD" ? I'm using Java 11.
Thanks for your help
(Edit: the screenshots are not very obvious, I think the jpeg compression actually did a smoothing on top)
I have been trying (for years now) to improve the font anti-aliasing in Javafx. I have read several times that there are 3 ways to change the font anti-aliasing:
CSS (gray / lcd)
B4X:
.text{
-fx-font-smoothing-type: gray;
}
B4X:
-Dprism.lcdtext=false
B4X:
System.setProperty("prism.lcdtext", "false");
The problem is that regardless of what I do, it actually never changes anything when I run the program. I know that it's always false using this function:
B4X:
Sub getAllSystemProperties
' Declare the javaobject and init the class
Dim JO As JavaObject
JO.InitializeStatic("java.lang.System")
' Get the system properties into one object
Dim objProperties As Object = JO.RunMethod("getProperties", Null)
' Convert the properties object into a list of strings
Dim s As String = objProperties
s.SubString(1)
Dim l As List
l = Regex.Split(", ", s)
l.Sort(True)
' List the properties
For i = 0 To l.Size - 1
Log(l.Get(i))
Next
End Sub
Prism pipeline init order: d3d sw
Using Double Precision Marlin Rasterizer
Using dirty region optimizations
Not using texture mask for primitives
Not forcing power of 2 sizes for textures
Using hardware CLAMP_TO_ZERO mode
Opting in for HiDPI pixel scaling
Prism pipeline name = com.sun.prism.d3d.D3DPipeline
Loading D3D native library ...
succeeded.
D3DPipelineManager: Created D3D9Ex device
Direct3D initialization succeeded
(X) Got class = class com.sun.prism.d3d.D3DPipeline
Initialized prism pipeline: com.sun.prism.d3d.D3DPipeline
Maximum supported texture size: 16384
Maximum texture size clamped to 4096
OS Information:
Windows 7 build 7601
D3D Driver Information:
NVIDIA GeForce GTX 1080
\\.\DISPLAY2
Driver nvd3dumx.dll, version 26.21.14.3086
Pixel Shader version 3.0
Device : ven_10DE, dev_1B80, subsys_859B1043
Max Multisamples supported: 4
vsync: true vpipe: true
Waiting for debugger to connect...
Program started.
awt.toolkit=sun.awt.windows.WToolkit
file.encoding=UTF-8
file.separator=\
java.awt.graphicsenv=sun.awt.Win32GraphicsEnvironment
java.awt.printerjob=sun.awt.windows.WPrinterJob
java.class.path=C:\Program Files (x86)\Anywhere Software\B4J\libraries\jDebug.jar;C:\Program Files (x86)\Anywhere Software\B4J\libraries\jcore.jar;C:\Program Files (x86)\Anywhere Software\B4J\libraries\jfx.jar;C:\Program Files (x86)\Anywhere Software\B4J\libraries\javaobject.jar;C:\Program Files (x86)\Anywhere Software\B4J\libraries\json.jar;;bin\classes\;bin/classes/;../;b4xlibs
java.class.version=55.0
java.home=C:\Program Files\Java\jdk-11.0.1\jdk-11.0.1
java.io.tmpdir=C:\Users\xxx\AppData\Local\Temp\
java.library.path=xxx
java.runtime.name=OpenJDK Runtime Environment
java.runtime.version=11.0.1+13
java.specification.name=Java Platform API Specification
java.specification.vendor=Oracle Corporation
java.vendor.url.bug=http://bugreport.java.com/bugreport/
java.vendor.url=http://java.oracle.com/
java.vendor.version=18.9
java.vendor=Oracle Corporation
java.version.date=2018-10-16
java.version=11.0.1
java.vm.compressedOopsMode=Zero based
java.vm.info=mixed mode
java.vm.name=OpenJDK 64-Bit Server VM
java.vm.specification.name=Java Virtual Machine Specification
java.vm.specification.vendor=Oracle Corporation
java.vm.specification.version=11
java.vm.vendor=Oracle Corporation
java.vm.version=11.0.1+13}
javafx.runtime.version=11.0.1+1
javafx.version=11.0.1
jdk.debug=release
jdk.module.path=C:\Program Files\Java\jdk-11.0.1\jdk-11.0.1\bin\..\javafx\lib
line.separator=
os.arch=amd64
os.name=Windows 7
os.version=6.1
path.separator=;
prism.lcdtext=false
prism.verbose=true
sun.arch.data.model=64
sun.boot.library.path=C:\Program Files\Java\jdk-11.0.1\jdk-11.0.1\bin
sun.cpu.endian=little
sun.cpu.isalist=amd64
sun.desktop=windows
sun.io.unicode.encoding=UnicodeLittle
sun.java.command=b4j.example.main
sun.java.launcher=SUN_STANDARD
sun.jnu.encoding=Cp1252
sun.management.compiler=HotSpot 64-Bit Tiered Compilers
sun.os.patch.level=Service Pack 1
user.country=GB
user.dir=M:\B4j\Tests\TestAntialiasing\Objects
user.home=C:\Users\jo
user.language=en
user.name=xx
user.script=
user.timezone=
user.variant=
{java.specification.version=11
new alphas with length = 4096
QuantumRenderer: shutdown
Now, if I change the " -fx-font-smoothing-type" in CSS and preview my CSS in SceneBuilder, I can see it changing.
To illustrate the problem, please see this example:
Left is SceneBuilder, Right is the jar ran:
We can see that sceneBuilder has the "LCD" antialiasing applied (Which spills some RGB colors), but my JAR is always "GRAY" antialiasing:
Anyone has an idea why I can't change my jar to "LCD" ? I'm using Java 11.
Thanks for your help
(Edit: the screenshots are not very obvious, I think the jpeg compression actually did a smoothing on top)
Last edited: