Bad font names from FontMgr

Going deep in overlayer DrawText problem, I found that the font list in my system, got from OSD_FontMgr, is this one :
book
demibold
book
demibold
light
demibold
light
demibold
medium
medium
bold
regular
bold
medium
bold
bold
bold
bold
medium
medium
regular
bold
regular
bold
regular
bold
regular
bold
regular
medium
regular
medium
regular
bold
regular
bold
regular
bold
medium
bold
medium
bold
demi
lucidabright
lucidabright
lucidasans
lucidasans
lucidasans
lucidasans
bold
bold
bold
bold
book
book
book
book
medium

Which, IMHO, has nothing to do with true font names.....
My system is Ubuntu Linux 64 bit.

Being not able to find any font, then, the overlayer DrawText grabs the first available font with first available size, which is obviously wrong.

Massimo Del Fedele's picture

Digging a bit more, in

void OSD_FontMgr::InitFontDataBase() {

replacing a line :

// In current implementation use fonts with ISO-8859-1 coding page.
// OCCT not give to manage coding page by means of programm interface.
// TODO: make high level interface for
// choosing necessary coding page.
TCollection_AsciiString aXLFD;
---> HERE Standard_Integer leftXLFD = aLine.SearchFromEnd(" ");
Standard_Integer rightXLFD = aLine.Length();
if( leftXLFD && rightXLFD )
aXLFD.AssignCat(aLine.SubString( leftXLFD + 1, rightXLFD ) );

with
// In current implementation use fonts with ISO-8859-1 coding page.
// OCCT not give to manage coding page by means of programm interface.
// TODO: make high level interface for
// choosing necessary coding page.
TCollection_AsciiString aXLFD;
--->HERE Standard_Integer leftXLFD = aLine.Search(" -");
Standard_Integer rightXLFD = aLine.Length();
if( leftXLFD && rightXLFD )
aXLFD.AssignCat(aLine.SubString( leftXLFD + 1, rightXLFD ) );

Does the trick and makes OSD grab the right font names.
That one solves all my overlayer DrawText problems.

Max

Massimo Del Fedele's picture

Btw, for completness, here the fonts grabbed from X after the patch :

urw gothic l
urw gothic l
urw gothic l
urw gothic l
urw bookman l
urw bookman l
urw bookman l
urw bookman l
courier 10 pitch
courier 10 pitch
courier 10 pitch
century schoolbook l
century schoolbook l
century schoolbook l
century schoolbook l
courier 10 pitch
bitstream charter
bitstream charter
bitstream charter
bitstream charter
nimbus sans l
nimbus sans l
nimbus sans l
nimbus sans l
nimbus sans l
nimbus sans l
nimbus sans l
nimbus sans l
nimbus roman no9 l
Nimbus Roman No9 L
nimbus roman no9 l
nimbus roman no9 l
nimbus mono l
nimbus mono l
nimbus mono l
nimbus mono l
urw palladio l
urw palladio l
urw palladio l
urw palladio l
urw chancery l
lucida bright
lucida bright
lucidabright
lucidabright
lucidasans
lucidasans
lucidasans
lucidasans
lucidasans typewriter
lucidasans typewriter
lucidasans typewriter
lucidasans typewriter
lucidasans typewriter
lucidasans typewriter
lucidasans typewriter
lucidasans typewriter

I don't know why some are repeated; I guess they're variants of faces.

Max