0

I have applied a custom font named of file "digital-7.ttf", the name inside digital-7. the approches works correctly in scenebuilder, but when I start the application the custom font does not work at all. the font file located at resource's folder /font/digital-7.ttf. I don't know what exactly causes the problem since the css file is applied correctly.

Here the css file:

@font-face {
    src: url('/font/digital-7.ttf');
}

.text {    
    -fx-font-size: 30px;    
}

#lblTotal {    
    -fx-font-family: 'Digital-7';
    -fx-font-size: 60px;
    -fx-text-fill: greenyellow;    
}

#testId {
    -fx-font-family: 'Digital-7';
    -fx-text-fill: red;
    -fx-font-size: 60px;
}

#lblDate,#lblTitle {
    -fx-font-family: 'Digital-7';
    -fx-font-size: 60px;
}

#blackscreen {
    -fx-background-color: black;
    -fx-padding: 5px;    
}

#comptoirRoot {
    -fx-background-color: #ffffff;
}

.table-view:focused .table-row-cell:filled:focused {
    -fx-background-color: greenyellow;
}
abdou amer
  • 819
  • 2
  • 16
  • 43
  • Is your code modular? – Slaw Oct 03 '18 at 16:35
  • No, it just compiles – abdou amer Oct 03 '18 at 18:21
  • So you don't have a `module-info` in your code and you don't use the modulepath? – Slaw Oct 03 '18 at 19:31
  • yes i don't create module-info file ! – abdou amer Oct 03 '18 at 20:52
  • Sorry for asking twice; your response left me unsure if you understood my question. Unfortunately, I only had an idea of what the issue could be if you were using modules. Without modules, I have no idea. – Slaw Oct 03 '18 at 20:54
  • okay, let's try it, even though i'm not using modules capability. – abdou amer Oct 03 '18 at 21:10
  • hmm ... don't know if some kind of automatic default font-name building from the source is expected to work, but even if so, it might get confused by the difference of lower/uppercase first letter. You might try to explicitly add a font-name to the font-face rule as done in https://stackoverflow.com/questions/16855677/how-to-embed-ttf-fonts-is-javafx-2-2 (and other examples) It's a long shot, not personal experience in this area ;) – kleopatra Oct 04 '18 at 10:28

0 Answers0