B4J Question fx.GetAllFontFamilies doesn't give all the font families

xulihang

Active Member
Licensed User
Longtime User
Using fx.GetAllFontFamilies, I got the following list of font families which does not include the Source Han Sans font I installed on a Windows 10 machine (https://github.com/adobe-fonts/source-han-sans/):

B4X:
Arial
Arial Black
Bad Script
Calibri
Calibri Light
Cambria
Cambria Math
Candara
Candara Light
Comic Sans MS
Consolas
Constantia
Corbel
Corbel Light
Courier New
DengXian
DengXian Light
Ebrima
FangSong
Franklin Gothic Medium
Gabriola
Gadugi
Georgia
HoloLens MDL2 Assets
Impact
Ink Free
Javanese Text
KaiTi
Leelawadee UI
Leelawadee UI Semilight
Lucida Bright
Lucida Console
Lucida Sans
Lucida Sans Typewriter
Lucida Sans Unicode
MS Gothic
MS Mincho
MS PGothic
MS PMincho
MS UI Gothic
MT Extra
MV Boli
Malgun Gothic
Malgun Gothic Semilight
Marlett
Meiryo
Meiryo UI
Miama Nueva
Microsoft Himalaya
Microsoft JhengHei
Microsoft JhengHei Light
Microsoft JhengHei UI
Microsoft JhengHei UI Light
Microsoft New Tai Lue
Microsoft PhagsPa
Microsoft Sans Serif
Microsoft Tai Le
Microsoft YaHei
Microsoft YaHei Light
Microsoft YaHei UI
Microsoft YaHei UI Light
Microsoft Yi Baiti
MingLiU-ExtB
MingLiU_HKSCS-ExtB
Mongolian Baiti
Monospaced
Myanmar Text
NSimSun
Nirmala UI
Nirmala UI Semilight
PMingLiU-ExtB
Palatino Linotype
Pecita
SansSerif
Segoe MDL2 Assets
Segoe Print
Segoe Script
Segoe UI
Segoe UI Black
Segoe UI Emoji
Segoe UI Historic
Segoe UI Light
Segoe UI Semibold
Segoe UI Semilight
Segoe UI Symbol
Serif
SimHei
SimSun
SimSun-ExtB
Sitka Banner
Sitka Display
Sitka Heading
Sitka Small
Sitka Subheading
Sitka Text
Sylfaen
Symbol
System
Tahoma
Times New Roman
Trebuchet MS
UD Digi Kyokasho N-B
UD Digi Kyokasho N-R
UD Digi Kyokasho NK-B
UD Digi Kyokasho NK-R
UD Digi Kyokasho NP-B
UD Digi Kyokasho NP-R
Verdana
Webdings
Wingdings
Yu Gothic
Yu Gothic Light
Yu Gothic Medium
Yu Gothic UI
Yu Gothic UI Light
Yu Gothic UI Semibold
Yu Gothic UI Semilight
Yu Mincho
Yu Mincho Demibold
Yu Mincho Light
ZDingbats

Using java.awt.GraphicsEnvironment.getAvailableFontFamilyNames, I got the following list which is more complete:

B4X:
Arial
Arial Black
Bad Script
Bahnschrift
BIZ UDGothic
BIZ UDMincho Medium
BIZ UDPGothic
BIZ UDPMincho Medium
Calibri
Calibri Light
Cambria
Cambria Math
Candara
Candara Light
Comic Sans MS
Consolas
Constantia
Corbel
Corbel Light
Courier New
DengXian
DengXian Light
Dialog
DialogInput
Ebrima
FangSong
Franklin Gothic Medium
Gabriola
Gadugi
Georgia
HoloLens MDL2 Assets
Impact
Ink Free
Javanese Text
KaiTi
Leelawadee UI
Leelawadee UI Semilight
Lucida Bright
Lucida Console
Lucida Sans
Lucida Sans Typewriter
Lucida Sans Unicode
Malgun Gothic
Malgun Gothic Semilight
Marlett
Meiryo
Meiryo UI
Miama Nueva
Microsoft Himalaya
Microsoft JhengHei
Microsoft JhengHei Light
Microsoft JhengHei UI
Microsoft JhengHei UI Light
Microsoft New Tai Lue
Microsoft PhagsPa
Microsoft Sans Serif
Microsoft Tai Le
Microsoft YaHei UI
Microsoft YaHei UI Light
Microsoft Yi Baiti
MingLiU-ExtB
MingLiU_HKSCS-ExtB
Mongolian Baiti
Monospaced
MS Gothic
MS Mincho
MS PGothic
MS PMincho
MS UI Gothic
MT Extra
MV Boli
Myanmar Text
Nirmala UI
Nirmala UI Semilight
Noto Sans S Chinese Black
Noto Sans S Chinese Bold
Noto Sans S Chinese DemiLight
Noto Sans S Chinese Light
Noto Sans S Chinese Medium
Noto Sans S Chinese Regular
Noto Sans S Chinese Thin
NSimSun
Palatino Linotype
Pecita
PMingLiU-ExtB
SansSerif
Segoe MDL2 Assets
Segoe Print
Segoe Script
Segoe UI
Segoe UI Black
Segoe UI Emoji
Segoe UI Historic
Segoe UI Light
Segoe UI Semibold
Segoe UI Semilight
Segoe UI Symbol
Serif
SimHei
SimSun
SimSun-ExtB
Sitka Banner
Sitka Display
Sitka Heading
Sitka Small
Sitka Subheading
Sitka Text
Source Han Sans SC
Source Han Sans SC ExtraLight
Source Han Sans SC Heavy
Source Han Sans SC Light
Source Han Sans SC Medium
Source Han Sans SC Normal
Sylfaen
Symbol
Tahoma
Times New Roman
Trebuchet MS
UD Digi Kyokasho N-B
UD Digi Kyokasho N-R
UD Digi Kyokasho NK-B
UD Digi Kyokasho NK-R
UD Digi Kyokasho NP-B
UD Digi Kyokasho NP-R
Verdana
Webdings
Wingdings
Yu Gothic
Yu Gothic Light
Yu Gothic Medium
Yu Gothic UI
Yu Gothic UI Light
Yu Gothic UI Semibold
Yu Gothic UI Semilight
Yu Mincho
Yu Mincho Demibold
Yu Mincho Light
ZDingbats

Java code:

Java:
    public static void getLocalFontFamily(){
        GraphicsEnvironment ge=GraphicsEnvironment.getLocalGraphicsEnvironment();
        String [] fontName=ge.getAvailableFontFamilyNames();
        
        for(int i=0;i<fontName.length;i++){
            System.out.println(fontName[i]);
        }
    }
 

Sandman

Expert
Licensed User
I made a quick diff for you, perhaps there's some common thing between the added/missing fonts that can explain it? (Like, are the missing ones installed in some other dir? Or are they in another format? Something like that.)

Bottom list has these extra:
B4X:
Bahnschrift
BIZ UDGothic
BIZ UDMincho Medium
BIZ UDPGothic
BIZ UDPMincho Medium
Dialog
DialogInput
Noto Sans S Chinese Black
Noto Sans S Chinese Bold
Noto Sans S Chinese DemiLight
Noto Sans S Chinese Light
Noto Sans S Chinese Medium
Noto Sans S Chinese Regular
Noto Sans S Chinese Thin
Source Han Sans SC
Source Han Sans SC ExtraLight
Source Han Sans SC Heavy
Source Han Sans SC Light
Source Han Sans SC Medium
Source Han Sans SC Normal

And bottom list is missing:
B4X:
Microsoft YaHei
Microsoft YaHei Light
System
 
Upvote 0

xulihang

Active Member
Licensed User
Longtime User
Yes. I tried setting font with the family name and this works.
 
Upvote 0

xulihang

Active Member
Licensed User
Longtime User
perhaps there's some common thing between the added/missing fonts that can explain it?

I can see the newly installed Chinese fonts cannot be listed.

The problem may be related to the opreating system, it works fine on my laptop, but it is incomplete on a newer version of win10.
 
Upvote 0
Top