MantisBT
Mantis Bug Tracker Workflow

View Issue Details Jump to Notes ] Related Changesets ] Issue History ] Print ]
IDProjectCategoryView StatusDate SubmittedLast Update
0026298Open CASCADE[OCCT] OCCT:Visualizationpublic2015-06-01 13:012016-04-20 15:49
Reporterapl 
Assigned Tobugmaster 
PrioritynormalSeverityfeature 
StatusclosedResolutionfixed 
PlatformWindowsOSOS Version
Product Version[OCCT] 6.9.0 
Target Version[OCCT] 7.0.0Fixed in Version[OCCT] 7.0.0 
Summary0026298: Visualization, OpenGl_Text - make font resolution configurable
DescriptionOn Windows the pangram "The quick brown fox ..." drawn in V3d viewer looks tiny comparing to what you can see in default font browsing utility.

This issue can be solved by setting font's resolution in OpenGl_Text to 96 dpi (see attached images). This looks to be the default resolution for Windows. It is proposed to change the OpenGl_Text's resolution accordingly and check that this solution will be also acceptable for Linux.

The OpenGl_Text's font resolution should be then made application interface dependant. It is proposed to provide API to scale the resolution against it base (96 dpi) by a coefficient passed from application level. That could be a part of 0025350.
Steps To Reproduce
pload ALL
vinit
vsetcolorbg 255 255 255
vdrawtext t "The quick brown fox jumps over the lazy dog" -font Courier -height 12 -color 0 
0 0
TagsNo tags attached.
Test case number3rdparty fonts C1
Attached Filespng file icon image_now.png (2,687 bytes) 2015-06-01 13:02
png file icon image_96dpi.png (3,376 bytes) 2015-06-01 13:02
png file icon browser.png (26,047 bytes) 2015-06-01 13:03
png file icon windows_msoffice_notepad_occt.png (1,310 bytes) 2015-06-01 14:39
png file icon linux_libreoffice_gedit_occt.png (2,131 bytes) 2015-06-01 14:40
png file icon osx_xcode_textedit_occt.png (5,514 bytes) 2015-06-01 14:40

- Relationships
related to 0025350closedbugmaster Community Visualization - provide a dpi-scaling ratio for V3d_View 
related to 0024776closedkgv Open CASCADE Visualization - inherit OpenGl_View from Graphic3d_CView 

-  Notes
(0041786)
kgv (developer)
2015-06-01 14:49

As can be seen on attached screenshots, the behavior of native applications is platform dependent:
- Windows, uses 96 as default
- Linux, uses 96 as default on modern systems
- OS X, still uses 72 as default

It is unclean if we would like to:
- provide behavior consistent across systems (e.g. provide visually identical result), or
- provide platform-dependent result (e.g. vary presentation)
(0044888)
git (administrator)
2015-08-31 15:43

Branch CR26298 has been created by isk.

SHA-1: 7ce6661de2eff6d28892fe3c2ad99df27c18e1fa


Detailed log of new commits:

Author: isk
Date: Mon Aug 31 14:02:40 2015 +0300

    0026298: Visualization, OpenGl_Text - make font resolution configurable
(0044957)
git (administrator)
2015-09-02 12:16

Branch CR26298 has been updated by isk.

SHA-1: e3480b2cd84cf7dffa2c17eca39adb25fb05b6a1


Detailed log of new commits:

Author: isk
Date: Wed Sep 2 12:11:12 2015 +0300

    Scale factor of font resolution is property of view.

(0044963)
git (administrator)
2015-09-02 13:34

Branch CR26298 has been updated by isk.

SHA-1: 4024b39165d7b439b6d30c8fd662c279dd397c01


Detailed log of new commits:

Author: isk
Date: Wed Sep 2 13:31:33 2015 +0300

    Use integer resolution instead of scale factor.

(0045142)
git (administrator)
2015-09-07 15:18

Branch CR26298_1 has been created by isk.

SHA-1: eadd1a7b07e924b0290071e467e9f134d7c902f3


Detailed log of new commits:

Author: isk
Date: Mon Sep 7 15:13:12 2015 +0300

    0026298: Visualization, OpenGl_Text - make font resolution configurable.
    Add static const variable for manage resolution of a font by default.
    OpenGl_Text::FontKey contain a resolution of a font.
    Add resolution of a font and corresponding setter and getter in *_View classes.
    Add the new draw command 'vfontres', that sets a new resolution of fonts.
(0045145)
isk (developer)
2015-09-07 15:22

Dear Kirill,
Please review the branch CR26298_1.
(0045713)
kgv (developer)
2015-09-16 14:38

Dear Ilya,

please rebase your patch on patch for 0024776.
(0045991)
git (administrator)
2015-09-22 12:27

Branch CR26298_1 has been updated forcibly by isk.

SHA-1: 026daa3b3f08b0bf8d8700ce20e6ba5ba6529dc5
(0046073)
isk (developer)
2015-09-24 08:27

Dear Kirill,
Please review the branch CR26298_1.
(0046093)
git (administrator)
2015-09-24 16:02

Branch CR26298_1 has been updated by isk.

SHA-1: 2a796834db474974772840975ff75ac49f538fd6


Detailed log of new commits:

Author: isk
Date: Thu Sep 24 16:01:48 2015 +0300

    Move variable 'resolution' from Graphic3d_CView to Graphic3d_RenderingParams.
    Drop redundant variables from OpenGl_Workspace.
    Drop StringSize() method from OpenGl_Text.
    Update FontKey() and FindFont() methods of OpenGl_Text.
    Update OpenGl_GraphicDriver::TextSize() method.

(0046151)
git (administrator)
2015-09-25 17:21

Branch CR26298_1 has been updated forcibly by isk.

SHA-1: 44e87ecf3f72c0f4bcc3dd4539b68620238be46a
(0046177)
kgv (developer)
2015-09-25 21:11

--- a/src/Graphic3d/Graphic3d_RenderingParams.hxx
+++ b/src/Graphic3d/Graphic3d_RenderingParams.hxx
+#include <Font_FTFont.hxx>

please remove this include here and in other places.
Try to move constant THE_DEFAULT_RESOLUTION to another place.
It might be reasonable to make theResolution in Font_FTFont::Init() non-optional parameter.
-                             const unsigned int        theResolution = 72);
+                             const unsigned int        theResolution = THE_DEFAULT_RESOLUTION);


@@ -487,6 +488,7 @@ void OpenGl_GraphicDriver::TextSize (const Standard_CString   theText,
+  aTextParam.FontResolution = Font_FTFont::THE_DEFAULT_RESOLUTION;

this does not look like a correct fix since colorscale is expected to create the labels with view-specific resolution.

+    Handle(Font_FTFont) aFont = new Font_FTFont();
+    if (aFont->Init (aRequestedFont->FontPath()->ToCString(), aTextParam.Height, aTextParam.FontResolution))

+    {

this might be unreasonably expensive.

+protected: //! @name auxiliary methods for sharing resource.
+  //! Create key for shared resource
+  Standard_EXPORT TCollection_AsciiString FontKey (const OpenGl_AspectText& theAspect) const;
+
+  //! Find shared resource for specified font or initialize new one
+  Standard_EXPORT Handle(OpenGl_Font) FindFont (const Handle(OpenGl_Context)&  theCtx

names for protected methods should start from lower case.

+void V3d_View::SetResolution (const unsigned int theResolution)
+unsigned int V3d_View::Resolution() const

redundant methods.

+  theCommands.Add("vfontres",

vresolution with better description?

-  OpenGl_TextParam   myParams;
+  mutable OpenGl_TextParam myParams;
...
+  myParams.FontResolution = theWorkspace->View()->RenderingParams().Resolution;
...
-Handle(OpenGl_Font) OpenGl_Text::FindFont (const Handle(OpenGl_Context)& theCtx,
-                                           const OpenGl_AspectText&      theAspect,
-                                           const Standard_Integer        theHeight,
-                                           const TCollection_AsciiString theKey)
+Handle(OpenGl_Font) OpenGl_Text::FindFont (const Handle(OpenGl_Context)&  theCtx,
+                                           const OpenGl_AspectText&       theAspect,
+                                           const TCollection_AsciiString& theKey) const

theses changes do not look very reasonable.
Passing FontResolution as argument would make more sense.
(0046223)
git (administrator)
2015-09-28 17:34

Branch CR26298_1 has been updated by isk.

SHA-1: 36bdccc815965d30e23d8110ec3ab4b370d2a73a


Detailed log of new commits:

Author: isk
Date: Mon Sep 28 17:34:27 2015 +0300

    Move THE_DEFAULT_RESOLUTION from Font_FTFont to Graphic3d_RenderingParams.
    Add a new parameter (Resolution) to Graphic3d_GraphicDriver::TextSize() method (and to OpenGl_GraphicDrive::TextSize()).
    Drop FontResolution field from OpenGl_TextParam.
    Return OpenGl_Text::StringSize() method.
    Add a new parameter (Resolution) to OpenGl_Text::Render() and to OpenGl_Text::render() methods.
    Drop redundant methods from V3d_View.

(0046224)
git (administrator)
2015-09-28 17:34

Branch CR26298_2 has been created by isk.

SHA-1: b580dc8ec71df91ddea542849d51d2c7adb988c7


Detailed log of new commits:

Author: isk
Date: Mon Sep 28 17:26:10 2015 +0300

    0026298: Visualization, OpenGl_Text - make font resolution configurable.
    Add THE_DEFAULT_RESOLUTION static const parameter to Graphic3d_RenderingParams.
    Add resolution to Graphic3d_RenderingParams.
    Drop redundant variables from OpenGl_Workspace.
    Add a new parameter to Graphic3d_GraphicDriver::TextSize method (and to OpenGl_GraphicDriver).
    Add a new parameter to OpenGl_Text::Render() and to OpenGl_Text::render() methods.
    OpenGl_Text::FontKey() considers a resolution (PPI) now.
    Add the new draw command 'vresolution', that sets a pixel density.
(0046225)
isk (developer)
2015-09-28 17:35

Dear Kirill,
Please review the branch CR26298_2.
(0046227)
kgv (developer)
2015-09-28 17:45

+static Standard_Integer VResolution (Draw_Interpretor& theDI,

sorry for confusion - the command for rendering parameters already exists (vrenderparams) and should be extended instead of creating new command.
(0046247)
git (administrator)
2015-09-29 12:13

Branch CR26298_1 has been updated by isk.

SHA-1: bc06e9748d1fd412bc3c7bee038146938e7528cc


Detailed log of new commits:

Author: isk
Date: Tue Sep 29 12:13:41 2015 +0300

    Drop 'VResolution' draw-command and update 'VRenderParams' draw-command.

(0046262)
git (administrator)
2015-09-29 15:06

Branch CR26298_2 has been updated forcibly by isk.

SHA-1: f22c3995ef7bd385884962d9c5772df7fd0d209c
(0046279)
kgv (developer)
2015-09-29 16:48

Please test the patch in branch CR26298_2.
(0046323)
mkv (tester)
2015-09-30 14:47

Dear BugMaster,
Branch CR26298_2 from occt git-repository (and master from products git-repository) was compiled on Linux, MacOS and Windows platforms and tested on Release mode.
SHA-1: f22c3995ef7bd385884962d9c5772df7fd0d209c

Number of compiler warnings:

occt component :
Linux: 13 (13 on master)
Windows: 0 (0 on master)

products component :
Linux: 39 (39 on master)
Windows: 0 (0 on master)

Regressions/Differences/Improvements:
No regressions/differences

Testing cases:
http://occt-tests/CR26298-2-master-occt-64/Debian70-64/3rdparty/fonts/C1.html [^]
http://occt-tests/CR26298-2-master-occt-64/Windows-64-VC10/3rdparty/fonts/C1.html [^]
3rdparty fonts C1: OK

Testing on Linux:
occt component :
Total MEMORY difference: 93320074 / 93327239 [-0.01%]
Total CPU difference: 19694.5199999993 / 19849.459999999235 [-0.78%]
products component :
Total MEMORY difference: 26237562 / 26309508 [-0.27%]
Total CPU difference: 7182.109999999996 / 7199.699999999998 [-0.24%]

Testing on Windows:
occt component :
Total MEMORY difference: 57929067 / 57932622 [-0.01%]
Total CPU difference: 17828.4494841988 / 17727.080034399078 [+0.57%]
products component :
Total MEMORY difference: 17137085 / 17140676 [-0.02%]
Total CPU difference: 5653.226638399968 / 5623.134045499962 [+0.54%]

There are no differences in images found by testdiff.
(0046879)
git (administrator)
2015-10-16 16:14

Branch CR26298 has been deleted by kgv.

SHA-1: 4024b39165d7b439b6d30c8fd662c279dd397c01
(0046893)
git (administrator)
2015-10-16 16:17

Branch CR26298_1 has been deleted by kgv.

SHA-1: bc06e9748d1fd412bc3c7bee038146938e7528cc
(0046894)
git (administrator)
2015-10-16 16:17

Branch CR26298_2 has been deleted by kgv.

SHA-1: f22c3995ef7bd385884962d9c5772df7fd0d209c

- Related Changesets
occt: master 4b1c8733
Timestamp: 2015-09-29 09:17:58
Author: isk
Committer: bugmaster
Details ] Diff ]
0026298: Visualization, OpenGl_Text - make font resolution configurable.
Add THE_DEFAULT_RESOLUTION static const parameter to Graphic3d_RenderingParams.
Add resolution to Graphic3d_RenderingParams.
Drop redundant variables from OpenGl_Workspace.
Add a new parameter to Graphic3d_GraphicDriver::TextSize method (and to OpenGl_GraphicDriver).
Add a new parameter to OpenGl_Text::Render() and to OpenGl_Text::render() methods.
OpenGl_Text::FontKey() considers a resolution (PPI) now.
Add a new argument '-resolution' (sets a pixel density) in the 'VRenderParams' draw-command.
mod - src/AIS/AIS_ColorScale.cxx Diff ] File ]
mod - src/Font/Font_FTFont.hxx Diff ] File ]
mod - src/Graphic3d/Graphic3d_GraphicDriver.hxx Diff ] File ]
mod - src/Graphic3d/Graphic3d_RenderingParams.hxx Diff ] File ]
mod - src/OpenGl/OpenGl_GraphicDriver.cxx Diff ] File ]
mod - src/OpenGl/OpenGl_GraphicDriver.hxx Diff ] File ]
mod - src/OpenGl/OpenGl_Text.cxx Diff ] File ]
mod - src/OpenGl/OpenGl_Text.hxx Diff ] File ]
mod - src/OpenGl/OpenGl_Workspace.cxx Diff ] File ]
mod - src/OpenGl/OpenGl_Workspace.hxx Diff ] File ]
mod - src/ViewerTest/ViewerTest_ViewerCommands.cxx Diff ] File ]
add - tests/3rdparty/fonts/C1 Diff ] File ]

- Issue History
Date Modified Username Field Change
2015-06-01 13:01 apl New Issue
2015-06-01 13:01 apl Assigned To => kgv
2015-06-01 13:02 apl File Added: image_now.png
2015-06-01 13:02 apl File Added: image_96dpi.png
2015-06-01 13:02 apl File Added: browser.png
2015-06-01 13:03 apl File Deleted: browser.png
2015-06-01 13:03 apl File Added: browser.png
2015-06-01 13:04 apl Relationship added related to 0025350
2015-06-01 14:39 kgv File Added: windows_msoffice_notepad_occt.png
2015-06-01 14:40 kgv File Added: linux_libreoffice_gedit_occt.png
2015-06-01 14:40 kgv File Added: osx_xcode_textedit_occt.png
2015-06-01 14:49 kgv Note Added: 0041786
2015-06-17 12:02 apl Relationship added related to 0026343
2015-08-25 09:35 kgv Assigned To kgv => isk
2015-08-25 09:35 kgv Status new => assigned
2015-08-25 09:35 kgv Target Version 7.1.0 => 7.0.0
2015-08-25 09:35 kgv Summary Visualization, OpenGl_Text - Default font resolution => Visualization, OpenGl_Text - make font resolution configurable
2015-08-25 09:35 kgv Steps to Reproduce Updated View Revisions
2015-08-31 15:43 git Note Added: 0044888
2015-09-02 12:16 git Note Added: 0044957
2015-09-02 13:34 git Note Added: 0044963
2015-09-07 15:18 git Note Added: 0045142
2015-09-07 15:22 isk Note Added: 0045145
2015-09-07 15:22 isk Assigned To isk => kgv
2015-09-07 15:22 isk Status assigned => resolved
2015-09-16 14:37 kgv Relationship added related to 0024776
2015-09-16 14:38 kgv Note Added: 0045713
2015-09-16 14:38 kgv Assigned To kgv => isk
2015-09-16 14:38 kgv Status resolved => assigned
2015-09-22 12:27 git Note Added: 0045991
2015-09-24 08:27 isk Note Added: 0046073
2015-09-24 08:27 isk Assigned To isk => kgv
2015-09-24 08:27 isk Status assigned => resolved
2015-09-24 11:32 kgv Assigned To kgv => isk
2015-09-24 11:32 kgv Status resolved => assigned
2015-09-24 16:02 git Note Added: 0046093
2015-09-25 17:21 git Note Added: 0046151
2015-09-25 21:11 kgv Note Added: 0046177
2015-09-28 12:59 san Relationship added duplicate of 0026728
2015-09-28 17:34 git Note Added: 0046223
2015-09-28 17:34 git Note Added: 0046224
2015-09-28 17:35 isk Note Added: 0046225
2015-09-28 17:35 isk Assigned To isk => kgv
2015-09-28 17:35 isk Status assigned => resolved
2015-09-28 17:45 kgv Note Added: 0046227
2015-09-28 17:45 kgv Assigned To kgv => isk
2015-09-28 17:45 kgv Status resolved => assigned
2015-09-29 12:13 git Note Added: 0046247
2015-09-29 15:06 git Note Added: 0046262
2015-09-29 16:34 isk Assigned To isk => kgv
2015-09-29 16:34 isk Status assigned => resolved
2015-09-29 16:48 kgv Note Added: 0046279
2015-09-29 16:48 kgv Assigned To kgv => bugmaster
2015-09-29 16:48 kgv Severity minor => feature
2015-09-29 16:48 kgv Status resolved => reviewed
2015-09-29 17:04 apv Assigned To bugmaster => apv
2015-09-30 14:47 mkv Note Added: 0046323
2015-09-30 14:47 mkv Assigned To apv => bugmaster
2015-09-30 14:47 mkv Status reviewed => tested
2015-09-30 14:48 mkv Test case number => 3rdparty fonts C1
2015-10-02 14:56 bugmaster Changeset attached => occt master 4b1c8733
2015-10-02 14:56 bugmaster Status tested => verified
2015-10-02 14:56 bugmaster Resolution open => fixed
2015-10-16 16:14 git Note Added: 0046879
2015-10-16 16:17 git Note Added: 0046893
2015-10-16 16:17 git Note Added: 0046894
2015-10-28 15:58 aba Relationship added related to 0026821
2016-04-20 15:44 aiv Fixed in Version => 7.0.0
2016-04-20 15:49 aiv Status verified => closed


Copyright © 2000 - 2020 MantisBT Team
Powered by Mantis Bugtracker