View Issue Details

IDProjectCategoryView StatusLast Update
0032680CommunityOCCT:Visualizationpublic2021-11-27 15:05
ReporterFrancoisLauzon Assigned Tosmoskvin  
PrioritynormalSeverityminor 
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->SetText("TEST1");
    text1->SetPosition(gp_Pnt(5,5,5));
    text1->SetFontAspect(Font_FontAspect_Regular );
    myContext->Display(text1,true);

    opencascade::handle<AIS_TextLabel> text2=new AIS_TextLabel;
    text2->SetText("TEST2");
    text2->SetPosition(gp_Pnt(10,10,10));
    text2->SetFontAspect(Font_FontAspect_Bold );
    myContext->Display(text2,true);

    opencascade::handle<AIS_TextLabel> text3=new AIS_TextLabel;
    text3->SetText("TEST3");
    text3->SetPosition(gp_Pnt(10,-10,-10));
    text3->SetFontAspect(Font_FA_BoldItalic );
    myContext->Display(text3,true);
TagsNo tags attached.
Test case numberN/A

Attached Files

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

Relationships

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

Activities

FrancoisLauzon

2021-11-22 05:52

reporter  

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

git

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.

kgv

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();
    text2->SetFont(Font_NOF_SERIF);
    text2->SetText("TEST2");


kgv

2021-11-22 12:31

developer   ~0105347

Patch is ready for review
- OCCT: branch CR32680.

http://jenkins-test-12.nnov.opencascade.com:8080/view/CR32680-master-KGV/

osa

2021-11-22 15:57

developer   ~0105353

The patch was reviewed without remarks

FrancoisLauzon

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".

smoskvin

2021-11-27 14:24

administrator   ~0105464

Combination -
OCCT branch : IR-2021-11-26
master SHA - 4a837ecec21bfe24d9c224c4b59aa9779156f297
49e51745631c52b6c452c65adae4d6dfa21a1b1e
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

Regressions/Differences/Improvements:
No regressions/differences

CPU differences:
Debian80-64:
OCCT
Total CPU difference: 18390.380000000398 / 18549.650000000624 [-0.86%]
Products
Total CPU difference: 11648.280000000103 / 11661.570000000122 [-0.11%]
Windows-64-VC14:
OCCT
Total CPU difference: 19927.859375 / 19945.046875 [-0.09%]
Products
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

git

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

kgv


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
0032680
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