Wrong default font on Linux when bitstream vera is installed

Hi,

On Ubuntu 21.10, if the ttf-bitstream-vera package is installed, then “Bitstream Vera” is selected by JUCE as the default sans serif font. However JUCE picks the bold+italic version, instead of the regular one.

How to reproduce: compile and launch the DemoRunner from develop branch, all text is bold and italic.

Same issue on Mint linux, when ttf-bitstream-vera is installed, the default font is italic (but not bold…). I’ll be blacklisting vera from the list of default fonts in juce_linux_Fonts.cpp , but is it that package that is broken, or is it a bug in the juce font handling code ?

ttf-bitstream-vera is installed as a dependency when one installs matplotlib so it should be not so rare…

This is known issue and has been fixed, it will be available soon.

Thanks !

This patch should fix the issue:

1 Like

Unfortunately, this commit breaks Projucer running without any font installed eg in headless (CI) mode.
To reproduce:

rename /etc/fonts/fonts.conf to /etc/fonts/fonts.conf_
start Projucer
segmentation fault

Previous version starts without text.
As workaround install fontconfig fonts-config and some font bitstream-vera-fonts

And here is backtrace:

Program received signal SIGSEGV, Segmentation fault.
0x00000000007ba636 in juce::String::String (this=0x7fffffffcbe8, other=...) at ../../../../modules/juce_core/text/juce_String.cpp:250
250     String::String (const String& other) noexcept   : text (other.text)
(gdb) bt
#0  0x00000000007ba636 in juce::String::String (this=0x7fffffffcbe8, other=...) at ../../../../modules/juce_core/text/juce_String.cpp:250
#1  0x000000000090cbf7 in juce::DefaultFontInfo::pickBestFont<juce::DefaultFontInfo::Characteristics const (&) [6]> (names=..., choicesArray=...) at ../../../../modules/juce_graphics/native/juce_linux_Fonts.cpp:165
#2  0x0000000000901fb8 in juce::DefaultFontInfo::getDefaultSansSerifFontCharacteristics () at ../../../../modules/juce_graphics/native/juce_linux_Fonts.cpp:179
#3  0x0000000000901c29 in juce::DefaultFontInfo::DefaultFontInfo (this=0xfe1aa0 <juce::Font::getDefaultTypefaceForFont(juce::Font const&)::defaultInfo>) at ../../../../modules/juce_graphics/native/juce_linux_Fonts.cpp:130
#4  0x00000000008f5172 in juce::Font::getDefaultTypefaceForFont (font=...) at ../../../../modules/juce_graphics/native/juce_linux_Fonts.cpp:216
#5  0x000000000099270f in juce::LookAndFeel::getTypefaceForFont (this=0x1096e40, font=...) at ../../../../modules/juce_gui_basics/lookandfeel/juce_LookAndFeel.cpp:133
#6  0x000000000099191c in juce::getTypefaceForFontFromLookAndFeel (font=...) at ../../../../modules/juce_gui_basics/lookandfeel/juce_LookAndFeel.cpp:31
#7  0x00000000008fd3a5 in juce::TypefaceCache::findTypefaceFor (this=0x1096720, font=...) at ../../../../modules/juce_graphics/fonts/juce_Font.cpp:128
#8  0x00000000008fdd64 in juce::Font::SharedFontInternal::getTypefacePtr (this=0x1099260, f=...) at ../../../../modules/juce_graphics/fonts/juce_Font.cpp:270
#9  0x00000000008ee084 in juce::Font::getTypefacePtr (this=0x7fffffffd2b8) at ../../../../modules/juce_graphics/fonts/juce_Font.cpp:501
#10 0x00000000008eed8c in juce::Font::getStringWidthFloat (this=0x7fffffffd2b8, text=...) at ../../../../modules/juce_graphics/fonts/juce_Font.cpp:739
#11 0x0000000000b3eacc in juce::CodeEditorComponent::setFont (this=0x7fffffffd1b0, newFont=...) at ../../../../modules/juce_gui_extra/code_editor/juce_CodeEditorComponent.cpp:1681
#12 0x0000000000b38a4b in juce::CodeEditorComponent::CodeEditorComponent (this=0x7fffffffd1b0, doc=..., tokeniser=0x7fffffffd6e0) at ../../../../modules/juce_gui_extra/code_editor/juce_CodeEditorComponent.cpp:485
#13 0x000000000073f759 in AppearanceSettings::AppearanceSettings (this=0x1096668, updateAppWhenChanged=true) at ../../Source/Settings/jucer_AppearanceSettings.cpp:36
#14 0x0000000000745354 in StoredSettings::StoredSettings (this=0x1096630) at ../../Source/Settings/jucer_StoredSettings.cpp:43
#15 0x00000000004b31bc in std::make_unique<StoredSettings> () at /usr/include/c++/11/bits/unique_ptr.h:962
#16 0x00000000004632e6 in ProjucerApplication::initialise (this=0x1092320, commandLine=...) at ../../Source/Application/jucer_Application.cpp:67
#17 0x000000000086119c in juce::JUCEApplicationBase::initialiseApp (this=0x1092320) at ../../../../modules/juce_events/messages/juce_ApplicationBase.cpp:297
#18 0x00000000009f1f90 in juce::JUCEApplication::initialiseApp (this=0x1092320) at ../../../../modules/juce_gui_basics/application/juce_Application.cpp:92
#19 0x0000000000861057 in juce::JUCEApplicationBase::main () at ../../../../modules/juce_events/messages/juce_ApplicationBase.cpp:256
#20 0x0000000000860f98 in juce::JUCEApplicationBase::main (argc=1, argv=0x7fffffffdae8) at ../../../../modules/juce_events/messages/juce_ApplicationBase.cpp:240
#21 0x000000000046d508 in main (argc=1, argv=0x7fffffffdae8) at ../../Source/Application/jucer_Main.cpp:48

Thanks for reporting, I think this should be fixed here:

fixed, thanks!