View Issue Details

IDProjectCategoryView StatusLast Update
0032680CommunityOCCT:Visualizationpublic2021-11-27 15:05
ReporterFrancoisLauzon Assigned Tosmoskvin  
Status verifiedResolutionfixed 
PlatformWindows 10OSWindows 10 
Product Version7.4.0 
Target Version7.7.0 
Summary0032680: Visualization, AIS_TextLabel - Bold FontAspect doesn't work
DescriptionOCCT Version 7.6.0 and build with MSVC 2019 64 bits (I couldn't select those in the options)

The font aspect Font_FontAspect_Bold is not working anymore. Italic and regular aspect is still working. This was working fine in OCC 7.5.0.

Steps To Reproduce    Using the simple example below, text1 and text2 are identical (one should be bold), and text3 only appear in italic

    opencascade::handle<AIS_TextLabel> text1=new AIS_TextLabel;
    text1->SetFontAspect(Font_FontAspect_Regular );

    opencascade::handle<AIS_TextLabel> text2=new AIS_TextLabel;
    text2->SetFontAspect(Font_FontAspect_Bold );

    opencascade::handle<AIS_TextLabel> text3=new AIS_TextLabel;
    text3->SetFontAspect(Font_FA_BoldItalic );
TagsNo tags attached.
Test case numberN/A

Attached Files

  • Screenshot 2021-11-21 215135.png (2,654 bytes)


child of 0030439 closedbugmaster Open CASCADE Visualization - extend fonts search within Font_FontMgr::FindFont() on Linux 



2021-11-22 05:52


Screenshot 2021-11-21 215135.png (2,654 bytes)


2021-11-22 11:01

administrator   ~0105343

Branch CR32680 has been created by kgv.

SHA-1: ce7a1c969cbb3ff44291837fe9a5628d347d5d8f

Detailed log of new commits:

Author: kgv
Date: Mon Nov 22 11:01:37 2021 +0300

    0032680: Visualization, AIS_TextLabel - Bold FontAspect doesn't work
    Prs3d_TextAspect now sets Font_NOF_SERIF as default font
    instead of confusig Font_NOF_ASCII_TRIPLEX (Times-Bold).
    Therefore, default font now uses regular aspect, not bold.
    Command vdrawtext does no more set "Courier" font by default.


2021-11-22 11:11

developer   ~0105344

Last edited: 2021-11-22 11:14

> This was working fine in OCC 7.5.0.
I cannot confirm this case was working in 7.5.0 - the behavior has been changed since 7.4.0 (caused by 0030439 improvement).

The reason is that Prs3d_TextAspect constructor sets Font_NOF_ASCII_TRIPLEX font by default which has confusing notion - it includes both font family ("Times") and aspect ("Bold") at once.

Since 7.4.0 such legacy font definition ignores aspect modifiers for such kind definitions and discourage their usage, but accidentally it was still used by Prs3d_TextAspect default constructor.

It will be necessary to change default font within Prs3d_TextAspect to solve the issue, which will unfortunately change behavior of applications relying on default values.

As for your use case, you may add AIS_TextLabel::SetFont() to your code to solve the issue (it is preferred to specify desired font anyway):
    opencascade::handle<AIS_TextLabel> text2=new AIS_TextLabel();


2021-11-22 12:31

developer   ~0105347

Patch is ready for review
- OCCT: branch CR32680.


2021-11-22 15:57

developer   ~0105353

The patch was reviewed without remarks


2021-11-24 02:42

reporter   ~0105388

You're right Kirill, using font Font_NOF_SERIF work as expected.
I was using another font and the problem was somewhere else (with the font itself and the way OCC load those fonts in the font database).

On my side by fixing the font (renaming the Styles/SubFamily from DIN-Italic to Italic for the D-DIN font) also fix my problem. Otherwise the Font_FontMgr::GetInstance()->CheckFont() method ended up returning a FontName() of "d-din din-" for the Italic (D-DIN-Italic.ttf) and Bold (D-DIN-Bold.ttf) version of the font and those fonts where not considered the same as the normal (D-DIN.ttf) version which was given a FontName() of "d-din".


2021-11-27 14:24

administrator   ~0105464

Combination -
OCCT branch : IR-2021-11-26
master SHA - 4a837ecec21bfe24d9c224c4b59aa9779156f297
Products branch : IR-2021-11-26 SHA - 5da5872bffc6c1fa745ee5e33ac09c4fffd349b4
was compiled on Linux, MacOS and Windows platforms and tested in optimize mode.

Number of compiler warnings:
No new/fixed warnings

No regressions/differences

CPU differences:
Total CPU difference: 18390.380000000398 / 18549.650000000624 [-0.86%]
Total CPU difference: 11648.280000000103 / 11661.570000000122 [-0.11%]
Total CPU difference: 19927.859375 / 19945.046875 [-0.09%]
Total CPU difference: 13059.03125 / 13091.625 [-0.25%]

Image differences :
No differences that require special attention

Memory differences :
No differences that require special attention


2021-11-27 15:05

administrator   ~0105487

Branch CR32680 has been deleted by mnt.

SHA-1: ce7a1c969cbb3ff44291837fe9a5628d347d5d8f

Related Changesets

occt: master 3bbcf114

2021-11-22 08:01:37


Committer: smoskvin Details Diff
0032680: Visualization, AIS_TextLabel - Bold FontAspect doesn't work

Prs3d_TextAspect now sets Font_NOF_SERIF as default font
instead of confusig Font_NOF_ASCII_TRIPLEX (Times-Bold).
Therefore, default font now uses regular aspect, not bold.

Command vdrawtext does no more set "Courier" font by default.
Affected Issues
mod - src/Prs3d/Prs3d_TextAspect.cxx Diff File
mod - src/ViewerTest/ViewerTest_ObjectCommands.cxx Diff File

Issue History

Date Modified Username Field Change
2021-11-22 05:52 FrancoisLauzon New Issue
2021-11-22 05:52 FrancoisLauzon Assigned To => kgv
2021-11-22 05:52 FrancoisLauzon File Added: Screenshot 2021-11-21 215135.png
2021-11-22 09:47 kgv Summary AIS_TextLabel Bold FontAspect not working. => Visualization, AIS_TextLabel - Bold FontAspect doesn't work
2021-11-22 10:49 kgv Test case number => N/A
2021-11-22 10:49 kgv Product Version 7.5.3 => 7.4.0
2021-11-22 10:49 kgv Target Version => 7.7.0
2021-11-22 10:51 kgv Relationship added child of 0030439
2021-11-22 11:01 git Note Added: 0105343
2021-11-22 11:11 kgv Note Added: 0105344
2021-11-22 11:14 kgv Note Edited: 0105344
2021-11-22 12:31 kgv Note Added: 0105347
2021-11-22 12:31 kgv Assigned To kgv => osa
2021-11-22 12:31 kgv Status new => resolved
2021-11-22 15:57 osa Note Added: 0105353
2021-11-22 15:57 osa Assigned To osa => bugmaster
2021-11-22 15:57 osa Status resolved => reviewed
2021-11-24 02:42 FrancoisLauzon Note Added: 0105388
2021-11-27 14:24 smoskvin Note Added: 0105464
2021-11-27 14:24 smoskvin Status reviewed => tested
2021-11-27 14:52 smoskvin Changeset attached => occt master 3bbcf114
2021-11-27 14:52 smoskvin Assigned To bugmaster => smoskvin
2021-11-27 14:52 smoskvin Status tested => verified
2021-11-27 14:52 smoskvin Resolution open => fixed
2021-11-27 15:05 git Note Added: 0105487