View Issue Details

IDProjectCategoryView StatusLast Update
0030911Open CASCADEOCCT:Visualizationpublic2021-12-17 18:41
Reporternds Assigned Toabv 
PrioritynormalSeverityintegration request 
Status closedResolutionfixed 
Product Version6.7.0 
Target Version7.5.0Fixed in Version7.5.0 
Summary0030911: Visualization - Font_BRepFont using as a usual Standard_Transient
DescriptionIn a custom development we have some text manager, which decides what font should be used depending on the application option. It is either Font_FTFont or Font_BRepFont.

We have limitations in using Font_BRepFont:
- it has a protected inheritance of Font_FTFont(Standard_Transient), so is not possible to have it as a handle. So, we may not have one pointer to type and do cast to one or another type.
- there is no implementation FindAndCreate for it.

It's proposed to make it public inherited class of Font_FTFont and implement create method.
TagsNo tags attached.
Test case numberNot required

Relationships

child of 0024181 closedbugmaster Open CASCADE Text to BRep functionality 

Activities

git

2019-08-22 08:36

administrator   ~0086394

Branch CR30911 has been created by nds.

SHA-1: a84e833bb035b7ba7440b539d39fde73b359faa3


Detailed log of new commits:

Author: nds
Date: Thu Aug 22 08:33:14 2019 +0300

    0030911: Visualization - Font_BRepFont using as a usual Standard_Transient

kgv

2019-08-22 10:03

developer   ~0086399

-class Font_BRepFont : protected Font_FTFont
+class Font_BRepFont : public Font_FTFont

The purpose of protected inheritance here is hiding visibility of Font_FTFont methods, which should not be used by Font_BRepFont users to avoid getting unexpected results.

If this leads to making a Handle of Font_BRepFont, then this should be either fixed by adding visibility to necessary methods (preserving "protected Font_FTFont") or by hiding visibility of most Font_FTFont methods (changing to "public Font_FTFont")/

git

2019-08-22 12:27

administrator   ~0086410

Branch CR30911_1 has been created by nds.

SHA-1: 7c7433abcc8308db4179b0d9bc45ccf111dc7618


Detailed log of new commits:

Author: nds
Date: Thu Aug 22 12:24:26 2019 +0300

    0030911: Visualization - Font_BRepFont using as a usual Standard_Transient

nds

2019-08-22 12:34

developer   ~0086412

Dear Kirill,

please have a look at proposed modifications. What is your opinion, might it be useful in OCCT?

The modifications has additionally API change of Font_BRepFont:
recommendation of using FindAndCreate instead of own FindAndInit.

This is not obligate modification, but seems to be more universal way of both kind of font creation and reusing. (FindAndInit was introduced recently within #30663)

kgv

2019-09-04 16:21

developer   ~0086738

Last edited: 2019-09-04 16:22

I don't have any objections allowing to use Handle(Font_BRepFont), but as discussed - protected inheritance should not be simply removed since it was done for hiding base class API intentionally.

There might be no reason forcing usage of Handle(Font_BRepFont) in existing code, although the change shouldn't affect performance, since Font_BRepFont is quite a heavy object.

git

2020-09-25 01:47

administrator   ~0095296

Branch CR30911_2 has been created by nds.

SHA-1: 645bb8fd77d0e6acb92cfa12a89f271276819e70


Detailed log of new commits:

Author: nds
Date: Fri Sep 25 01:50:05 2020 +0300

    0030911: Visualization - Font_BRepFont using as a usual Standard_Transient
    
    - Font_IFont interface is introduced to provide common necessary interface for fonts;
    - Font_FTFont/StdPrs_BRepFont inherit Font_IFont;
    - Font_FTFont Outline is implemented to obtain the contour needed in StdPrs_BRepFont;
    - StdPrs_BRepFont implements FindAndCreate;
    - StdPrs_BRepFont stores Font_FTFont as an internal field;
    - StdPrs_BRepFont the RenderGlyph is renamed into RenderGlyphShape.

kgv

2020-09-25 11:35

developer   ~0095311

-float Font_FTFont::Descender() const
+Standard_ShortReal Font_FTFont::Descender() const
 {
-  return float(myFTFace->descender) * (float(myFTFace->size->metrics.y_ppem) / float(myFTFace->units_per_EM));
+  return Standard_ShortReal(myFTFace->descender)
+      * (Standard_ShortReal(myFTFace->size->metrics.y_ppem)
+       / Standard_ShortReal(myFTFace->units_per_EM));

Please revert these changes.
There is no reason to prefer Standard_ShortReal over float here.

+#include <ftimage.h>

FreeType headers were not included within Font_FTFont.hxx intentionally - see comment at the top of file.

+  DEFINE_STANDARD_RTTI_INLINE(Font_IFont, Standard_Transient)

Please use DEFINE_STANDARD_RTTIEXT when possible.

+  //! Render specified glyph into internal buffer (bitmap).
+  Standard_EXPORT virtual bool RenderGlyph (const Standard_Utf32Char theChar) Standard_OVERRIDE;

Please move to `protected` section.

-  Standard_Real AdvanceX (const Standard_Utf32Char theUCharNext)
+  virtual Standard_ShortReal AdvanceX (const Standard_Utf32Char theUCharNext) const Standard_OVERRIDE
   {
-    return myScaleUnits * Standard_Real(Font_FTFont::AdvanceX (theUCharNext));
+    return Standard_ShortReal(myScaleUnits) * myFTFont->AdvanceX (theUCharNext);
   }

Why single precision floating point is considered enough for creating a TopoDS_Shape, which uses double precision?

git

2020-09-25 14:57

administrator   ~0095320

Branch CR30911_3 has been created by nds.

SHA-1: a4347851dc987a2b6ee3ef7cbdfba34c75ba1053


Detailed log of new commits:

Author: nds
Date: Fri Sep 25 15:00:43 2020 +0300

    0030911: Visualization - Font_BRepFont using as a usual Standard_Transient
    
    - StdPrs_BRepFont inherits Standard_Transient;
    - StdPrs_BRepFont contains Font_FTFont in internal field;
    - StdPrs_BRepFont implements FindAndCreate;

nds

2020-09-25 14:59

developer   ~0095321

Dear Kirill,
could you please check patch on CR30911_3 branch.

Now, brep font inherits Standard_Transient.

kgv

2020-09-25 15:31

developer   ~0095327

Please raise the patch
- OCCT branch: CR30911_3.

git

2020-09-25 18:14

administrator   ~0095338

Branch CR30911_3 has been updated forcibly by nds.

SHA-1: c8a1119a9783b12e7ffeb577874e5afade383c06

bugmaster

2020-09-27 12:04

administrator   ~0095356

Crashes of pmivis tests:
http://jenkins-test-12.nnov.opencascade.com/view/CR30911-CR30911-nds/view/COMPARE/

I tried to take it to IR-2020-09-25 and I got the same problems

git

2020-09-28 07:15

administrator   ~0095430

Branch CR30911_3 has been updated forcibly by nds.

SHA-1: 5bb41cb2bce7615ab95f6520640a5dc6e0b46fbc

git

2020-09-28 18:13

administrator   ~0095448

Branch CR30911_3 has been updated by nds.

SHA-1: e2e4e2eff9bfd0bcae2771352a632ea015ed870c


Detailed log of new commits:

Author: nds
Date: Mon Sep 28 18:16:17 2020 +0300

    0030911: Visualization - Font_BRepFont using as a usual Standard_Transient
    
    - StdPrs_BRepFont inherits Standard_Transient;
    - StdPrs_BRepFont contains Font_FTFont in internal field;
    - StdPrs_BRepFont implements FindAndCreate;

git

2020-09-28 18:24

administrator   ~0095449

Branch CR30911_4 has been created by nds.

SHA-1: 12f833fd06402b8b35fa481cbdb6a22c8ae71df1


Detailed log of new commits:

Author: nds
Date: Fri Sep 25 15:00:43 2020 +0300

    0030911: Visualization - Font_BRepFont using as a usual Standard_Transient
    
    - StdPrs_BRepFont inherits Standard_Transient;
    - StdPrs_BRepFont contains Font_FTFont in internal field;
    - StdPrs_BRepFont implements FindAndCreate;

nds

2020-09-28 20:24

developer   ~0095452

Dear Kirill,
it's corrected, please review.
Jenkins job: http://jenkins-test-12.nnov.opencascade.com/view/CR30911-CR30911-nds/

OCCT: CR30911_4
products: CR30911_4

Thank you for help, Natalia

kgv

2020-09-30 12:46

developer   ~0095488

I have no remarks to the patch.

bugmaster

2020-10-03 14:03

administrator   ~0095628

Combination -
OCCT branch : IR-2020-10-02
master SHA - 6522304c17181a09fa831c040219d611dc44b94a
a206de37fbfa0bf71bd534ae47192bbec23b8522
Products branch : IR-2020-10-02 SHA - d9c364e1137eed3249e5a05befa860c708f243c0
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: 18085.050000000083 / 18057.60000000009 [+0.15%]
Products
Total CPU difference: 12174.620000000117 / 12124.200000000114 [+0.42%]
Windows-64-VC14:
OCCT
Total CPU difference: 19713.125 / 19772.65625 [-0.30%]
Products
Total CPU difference: 13533.8125 / 13527.921875 [+0.04%]


Image differences :
No differences that require special attention

Memory differences :
No differences that require special attention

git

2020-10-03 14:38

administrator   ~0095656

Branch CR30911_4 has been deleted by inv.

SHA-1: 12f833fd06402b8b35fa481cbdb6a22c8ae71df1

git

2020-10-03 14:38

administrator   ~0095657

Branch CR30911_3 has been deleted by inv.

SHA-1: e2e4e2eff9bfd0bcae2771352a632ea015ed870c

git

2020-10-03 14:39

administrator   ~0095666

Branch CR30911_2 has been deleted by inv.

SHA-1: 645bb8fd77d0e6acb92cfa12a89f271276819e70

git

2020-10-03 14:39

administrator   ~0095678

Branch CR30911_1 has been deleted by inv.

SHA-1: 7c7433abcc8308db4179b0d9bc45ccf111dc7618

git

2020-10-03 14:39

administrator   ~0095679

Branch CR30911 has been deleted by inv.

SHA-1: a84e833bb035b7ba7440b539d39fde73b359faa3

Related Changesets

occt: master ac5b3cbc

2020-09-25 12:00:43

abv


Committer: abv Details Diff
0030911: Visualization - Font_BRepFont using as a usual Standard_Transient

- StdPrs_BRepFont inherits Standard_Transient;
- StdPrs_BRepFont contains Font_FTFont in internal field;
- StdPrs_BRepFont implements FindAndCreate;
Affected Issues
0030911
mod - src/Font/Font_FTFont.cxx Diff File
mod - src/Font/Font_FTFont.hxx Diff File
mod - src/StdPrs/StdPrs_BRepFont.cxx Diff File
mod - src/StdPrs/StdPrs_BRepFont.hxx Diff File
mod - src/StdPrs/StdPrs_BRepTextBuilder.cxx Diff File

occt-products: master b31a7940

2020-09-28 07:12:21

nds

Details Diff
0030911: Visualization - Font_BRepFont using as a usual Standard_Transient Affected Issues
0030911
mod - diff Diff File
mod - diff Diff File

Issue History

Date Modified Username Field Change
2019-08-22 08:34 nds New Issue
2019-08-22 08:34 nds Assigned To => kgv
2019-08-22 08:36 git Note Added: 0086394
2019-08-22 10:03 kgv Note Added: 0086399
2019-08-22 12:27 git Note Added: 0086410
2019-08-22 12:34 nds Note Added: 0086412
2019-09-04 16:18 kgv Assigned To kgv => nds
2019-09-04 16:18 kgv Product Version => 7.3.0
2019-09-04 16:18 kgv Target Version 7.4.0 => 7.5.0
2019-09-04 16:19 kgv Relationship added child of 0024181
2019-09-04 16:19 kgv Product Version 7.3.0 => 6.7.0
2019-09-04 16:21 kgv Note Added: 0086738
2019-09-04 16:22 kgv Note Edited: 0086738
2020-09-21 17:34 kgv Target Version 7.5.0 => 7.6.0
2020-09-25 01:47 git Note Added: 0095296
2020-09-25 11:35 kgv Note Added: 0095311
2020-09-25 12:41 kgv Severity minor => integration request
2020-09-25 14:57 git Note Added: 0095320
2020-09-25 14:59 nds Note Added: 0095321
2020-09-25 14:59 nds Assigned To nds => kgv
2020-09-25 14:59 nds Status new => resolved
2020-09-25 14:59 nds Target Version 7.6.0 => 7.5.0
2020-09-25 15:31 kgv Note Added: 0095327
2020-09-25 15:31 kgv Assigned To kgv => bugmaster
2020-09-25 15:31 kgv Status resolved => reviewed
2020-09-25 18:14 git Note Added: 0095338
2020-09-27 12:04 bugmaster Note Added: 0095356
2020-09-27 12:04 bugmaster Assigned To bugmaster => nds
2020-09-27 12:04 bugmaster Status reviewed => assigned
2020-09-28 07:15 git Note Added: 0095430
2020-09-28 18:13 git Note Added: 0095448
2020-09-28 18:24 git Note Added: 0095449
2020-09-28 20:24 nds Note Added: 0095452
2020-09-28 20:24 nds Assigned To nds => kgv
2020-09-28 20:24 nds Status assigned => resolved
2020-09-30 12:46 kgv Note Added: 0095488
2020-09-30 12:46 kgv Assigned To kgv => bugmaster
2020-09-30 12:46 kgv Status resolved => reviewed
2020-10-03 12:53 bugmaster Test case number => Not required
2020-10-03 14:03 bugmaster Note Added: 0095628
2020-10-03 14:03 bugmaster Status reviewed => tested
2020-10-03 14:05 abv Changeset attached => occt master ac5b3cbc
2020-10-03 14:05 abv Assigned To bugmaster => abv
2020-10-03 14:05 abv Status tested => verified
2020-10-03 14:05 abv Resolution open => fixed
2020-10-03 14:38 git Note Added: 0095656
2020-10-03 14:38 git Note Added: 0095657
2020-10-03 14:39 git Note Added: 0095666
2020-10-03 14:39 git Note Added: 0095678
2020-10-03 14:39 git Note Added: 0095679
2020-12-02 16:40 emo Fixed in Version => 7.5.0
2020-12-02 17:12 emo Status verified => closed
2021-12-17 18:41 nds Changeset attached => occt-products master b31a7940