MantisBT - Open CASCADE
View Issue Details
0030334Open CASCADE[OCCT] OCCT:Visualizationpublic2018-11-02 14:272019-05-06 15:37
[OCCT] 7.4.0 
0030334: Visualization - missing fonts are not properly reported by Font_FontMgr::FindFont()
- Font is not changed after changing font after -font
- The inscription is beyond the limits of the face (see attached picture)

Found on test case demo samples pencil
No tags attached.
duplicate of 0030439closed bugmaster Visualization - extend fonts search within Font_FontMgr::FindFont() on Linux 
png pencil.png (13,478) 2018-11-02 14:28
png pensil_OK.png (9,293) 2019-01-16 00:16
Issue History
2018-11-02 14:27bugmasterNew Issue
2018-11-02 14:27bugmasterAssigned To => apn
2018-11-02 14:28bugmasterDescription Updatedbug_revision_view_page.php?rev_id=20294#r20294
2018-11-02 14:28bugmasterFile Added: pencil.png
2018-11-02 14:29bugmasterAssigned Toapn => abv
2018-11-02 14:30bugmasterDescription Updatedbug_revision_view_page.php?rev_id=20295#r20295
2019-01-10 21:26kgvNote Added: 0081735
2019-01-10 21:26kgvStatusnew => feedback
2019-01-10 21:27kgvNote Edited: 0081735bug_revision_view_page.php?bugnote_id=81735#r20539
2019-01-10 21:28kgvCategoryOCCT:DRAW => OCCT:Visualization
2019-01-10 21:28kgvSummary-font option of command text2brep works incorrectly on Linux platform when applied to the face => Visualization - missing fonts are not properly reported by Font_FontMgr::FindFont()
2019-01-10 23:13kgvRelationship addedrelated to 0030439
2019-01-16 00:16kgvFile Added: pensil_OK.png
2019-01-21 10:58kgvResolutionopen => duplicate
2019-01-21 10:58kgvRelationship replacedduplicate of 0030439
2019-04-30 14:57kgvNote Added: 0084076
2019-04-30 14:57kgvAssigned Toabv => bugmaster
2019-04-30 14:57kgvNote Edited: 0084076bug_revision_view_page.php?bugnote_id=84076#r21121
2019-05-06 15:37bugmasterStatusfeedback => closed

2019-01-10 21:26   
(edited on: 2019-01-10 21:27)
There are two issues:
1. text2brep never returns FALSE for unknown font, because historically font manager returns the following 2 fallbacks:
// Requested family name not found -> search for any font family with given aspect and height
// The last resort: trying to use ANY font available in the system

so that error will occur ONLY if font manager is completely empty.
Without any warning.

2. Modern Linux distributions might ignore X11 fonts registration (probably in attempt to go for Wayland, etc.),
so that the list of registered fonts detected by OCCT is very poor on not customized system (Xubuntu 18.04):
Draw[22]> vfont
Courier 10 Pitch regular /usr/share/fonts/X11/Type1/c0419bt_.pfb
Courier 10 Pitch italic /usr/share/fonts/X11/Type1/c0582bt_.pfb
Courier 10 Pitch bold /usr/share/fonts/X11/Type1/c0583bt_.pfb
Courier 10 Pitch bolditalic /usr/share/fonts/X11/Type1/c0611bt_.pfb
Bitstream Charter bold /usr/share/fonts/X11/Type1/c0632bt_.pfb
Bitstream Charter bolditalic /usr/share/fonts/X11/Type1/c0633bt_.pfb
Bitstream Charter regular /usr/share/fonts/X11/Type1/c0648bt_.pfb
Bitstream Charter italic /usr/share/fonts/X11/Type1/c0649bt_.pfb

while system actually has more fonts installed in standard folders.

It seems that problem 2 can be solved by relaxing conditions on Linux and reusing font searching code already used for macOS and Android.

The problem 1 is more difficult to fix, because if fallbacks will be removed from Font_FontMgr::FindFont(), then it should be moved to other places calling Font_FontMgr::FindFont() or otherwise text will not be displayed at all. Font_FontMgr::FindFont() can be extended with extra flag defining if fallback should be provided or not, but this would look confusing.

Alternatively, we may just emit Error messages within Font_FontMgr::FindFont(), so that fallback will be still provided, but user will be able to see that something going wrong.

2019-04-30 14:57   
Dear bugmaster.

Please close as duplicate of 0030439.