This week's book giveaways are in the Cloud and AI/ML forums.
We're giving away four copies each of Cloud Native Patterns and Natural Language Processing and have the authors on-line!
See this thread and this one for details.
Win a copy of Cloud Native PatternsE this week in the Cloud forum
or Natural Language Processing in the AI/ML forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Devaka Cooray
  • Liutauras Vilda
  • Jeanne Boyarsky
  • Bear Bibeault
Sheriffs:
  • Paul Clapham
  • Knute Snortum
  • Rob Spoor
Saloon Keepers:
  • Tim Moores
  • Ron McLeod
  • Piet Souris
  • Stephan van Hulst
  • Carey Brown
Bartenders:
  • Tim Holloway
  • Frits Walraven
  • Ganesh Patekar

Huge newline size for custom font

 
Greenhorn
Posts: 18
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello,

I am using a custom font I downloaded in my JavaFX interface, called Diablo

//ItemOutput is a text area

itemOutput.setFont(Font.font("Diablo", 10));

And i'm getting a massive vertical size, when I call a new line there's a huge space between the lines, but the text is tiny.

I put the font file into this directory C:\Program Files\Java\jre1.8.0_181\lib\fonts

Ive attached a picture with the font file, and you can see the massive text cursor next to the character.
fontproblem.png
[Thumbnail for fontproblem.png]
font file opened in notepad, javafx pane with text output
 
Marshal
Posts: 65005
246
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Don't know. Pease heck whether that font has such problems elsewhere. Please post some code where you set the font, its metrics, etc.
 
John McAlpine
Greenhorn
Posts: 18
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Here I've tried a different but similar font, and tried implementing it in a slightly different way, but I have the same problem
fontproblem.png
[Thumbnail for fontproblem.png]
 
Sheriff
Posts: 6108
157
Eclipse IDE Postgres Database VI Editor Chrome Java Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Could you post all of the FXML file that produced that window?  I suspect something's wrong with the way you defined the TestArea, especially if you get the same results with another font.

(Note: you posted this in the Swing forum.  We have a dedicated JavaFX forum which I moved this thread to.)
 
John McAlpine
Greenhorn
Posts: 18
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thank you for moving the thread, the text output seems to work fine with a regular font
fontproblem3.png
[Thumbnail for fontproblem3.png]
 
John McAlpine
Greenhorn
Posts: 18
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I guess I should add that I used javaFX scene builder 1.1 to create the window and it's my first time doing any of this
 
Knute Snortum
Sheriff
Posts: 6108
157
Eclipse IDE Postgres Database VI Editor Chrome Java Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The latest version of Scene Builder is 10 (I think they skipped some versions to keep inline with Java).  It looks like you're using Java 1.8 so be sure to compile your FXML with that version of JavaFX (1.8).  I believe the highest version of Scene Builder for Java 1.8 is 8.5.0.  Here's the URL for that:

https://gluonhq.com/products/scene-builder/

Have you tried using the fonts in other programs to see if they work properly?  Like maybe MS Word?
 
John McAlpine
Greenhorn
Posts: 18
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Knute Snortum wrote:The latest version of Scene Builder is 10 (I think they skipped some versions to keep inline with Java).  It looks like you're using Java 1.8 so be sure to compile your FXML with that version of JavaFX (1.8).  I believe the highest version of Scene Builder for Java 1.8 is 8.5.0.  Here's the URL for that:

https://gluonhq.com/products/scene-builder/

Have you tried using the fonts in other programs to see if they work properly?  Like maybe MS Word?



Thank you for your reply

Alright, I've updated Scene builder, and I tried a few things. The font I need works in another program (open office) but after updating scene builder I still have the same problem. I tried using scenebuilder to set the font and still encountered a similar output. I downloaded a newer different font called seaside and it seems to work, I'm not sure what to try next

fontproblems4.png
[Thumbnail for fontproblems4.png]
 
Knute Snortum
Sheriff
Posts: 6108
157
Eclipse IDE Postgres Database VI Editor Chrome Java Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I set up a little test and I can confirm that the Diablo font does have that weird behavior in a TextArea.  I'm going to try fiddling some more.
 
John McAlpine
Greenhorn
Posts: 18
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I had the same problem with Diablo Light, Diablo Heavy, and a font named Exocet, I ended up finding a  font that is somewhat close to what I want and it works. I would be interested in finding out what the problem was if you come to a solution
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!