Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Set font height as float, instead of integer

Tags:

java

swt

Is there a way to specify the font size as a float/double instead of integer. I am creating my font as:

Font font = new Font(shell.getDisplay(), "CormorantGaramond",14, SWT.NULL);

where 14 is the font size in points. But the constructor only accept an integer, which I find odd when the font size is specified in points and not pixel. Is there a way to specify font size as a non integer value. (It is a ttf font, if that matter).

like image 734
MTilsted Avatar asked Aug 03 '17 16:08

MTilsted


1 Answers

It seems that currently (Eclipse Platform Mars 4.5) there is no platform-independent way to set the font height using the value of the float type.

Reference: org.eclipse.swt.graphics.FontData (Eclipse Platform API Specification) - Help - Eclipse Platform.

like image 117
Sergey Vyacheslavovich Brunov Avatar answered Sep 16 '22 13:09

Sergey Vyacheslavovich Brunov