Swing create font

I have some custom components with an extended method paintComponent(Graphics g). Some components drawString()use a method from an object Graphics g. I want to define custom fonts for such strings.

I have * .ttf files with true font definitions. I have a css file with styles that defines fonts like:

.rosTexLogoTitle {
   -fx-font: bold 20pt 'Tahoma Bold';
   -fx-text-fill: #246db6;
   -fx-font-weight: heavybold;
   -fx-padding: 0 10 0 0

I want to define all properties from css in my java class, or maybe there is a way to use styles directly from css files (not necessary).

I tried to create a font using the constructor with the Map parameter:

public Font(Map<? extends Attribute, ?> attributes) {
}

But I did not succeed. I can create my own font with Font.createFont(style, path)and then get it to set the size. Color can be set in Graphics.setColor(). But I can’t install "Tahoma Bold".

+5
2

; .ttf.

, , .ttf. , Arial :

arialbd.ttf - Weight "Bold"
arialbi.ttf - Weight "Bold", Slant "Italic"
ariali.ttf  - Slant "Italic"
arial.ttf   - Plain version
+2

.ttf? createFont (style, File) ,

u sun.awt.Win32GraphicsEnvironment.getAvailableFontFamilyNames()

+1