View Issue Details

IDProjectCategoryView StatusLast Update
0026298Open CASCADEOCCT:Visualizationpublic2016-04-20 15:49
ReporteraplAssigned Tobugmaster  
PrioritynormalSeverityfeature 
Status closedResolutionfixed 
PlatformWindows 
Product Version6.9.0 
Target Version7.0.0Fixed in Version7.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 Files

  • image_now.png (2,687 bytes)
  • image_96dpi.png (3,376 bytes)
  • browser.png (26,047 bytes)
  • windows_msoffice_notepad_occt.png (1,310 bytes)
  • linux_libreoffice_gedit_occt.png (2,131 bytes)
  • osx_xcode_textedit_occt.png (5,514 bytes)

Relationships

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

Activities

apl

2015-06-01 13:02

developer  

image_now.png (2,687 bytes)

apl

2015-06-01 13:02

developer  

image_96dpi.png (3,376 bytes)

apl

2015-06-01 13:03

developer  

browser.png (26,047 bytes)

kgv

2015-06-01 14:39

developer  

windows_msoffice_notepad_occt.png (1,310 bytes)

kgv

2015-06-01 14:40

developer  

linux_libreoffice_gedit_occt.png (2,131 bytes)

kgv

2015-06-01 14:40

developer  

osx_xcode_textedit_occt.png (5,514 bytes)

kgv

2015-06-01 14:49

developer   ~0041786

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)

git

2015-08-31 15:43

administrator   ~0044888

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

git

2015-09-02 12:16

administrator   ~0044957

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.

git

2015-09-02 13:34

administrator   ~0044963

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.

git

2015-09-07 15:18

administrator   ~0045142

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.

isk

2015-09-07 15:22

developer   ~0045145

Dear Kirill,
Please review the branch CR26298_1.

kgv

2015-09-16 14:38

developer   ~0045713

Dear Ilya,

please rebase your patch on patch for 0024776.

git

2015-09-22 12:27

administrator   ~0045991

Branch CR26298_1 has been updated forcibly by isk.

SHA-1: 026daa3b3f08b0bf8d8700ce20e6ba5ba6529dc5

isk

2015-09-24 08:27

developer   ~0046073

Dear Kirill,
Please review the branch CR26298_1.

git

2015-09-24 16:02

administrator   ~0046093

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.

git

2015-09-25 17:21

administrator   ~0046151

Branch CR26298_1 has been updated forcibly by isk.

SHA-1: 44e87ecf3f72c0f4bcc3dd4539b68620238be46a

kgv

2015-09-25 21:11

developer   ~0046177

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

git

2015-09-28 17:34

administrator   ~0046223

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.

git

2015-09-28 17:34

administrator   ~0046224

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.

isk

2015-09-28 17:35

developer   ~0046225

Dear Kirill,
Please review the branch CR26298_2.

kgv

2015-09-28 17:45

developer   ~0046227

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

git

2015-09-29 12:13

administrator   ~0046247

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.

git

2015-09-29 15:06

administrator   ~0046262

Branch CR26298_2 has been updated forcibly by isk.

SHA-1: f22c3995ef7bd385884962d9c5772df7fd0d209c

kgv

2015-09-29 16:48

developer   ~0046279

Please test the patch in branch CR26298_2.

mkv

2015-09-30 14:47

tester   ~0046323

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.

git

2015-10-16 16:14

administrator   ~0046879

Branch CR26298 has been deleted by kgv.

SHA-1: 4024b39165d7b439b6d30c8fd662c279dd397c01

git

2015-10-16 16:17

administrator   ~0046893

Branch CR26298_1 has been deleted by kgv.

SHA-1: bc06e9748d1fd412bc3c7bee038146938e7528cc

git

2015-10-16 16:17

administrator   ~0046894

Branch CR26298_2 has been deleted by kgv.

SHA-1: f22c3995ef7bd385884962d9c5772df7fd0d209c

Related Changesets

occt: master 4b1c8733

2015-09-29 09:17:58

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.
Affected Issues
0026298
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-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
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 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
2016-04-20 15:44 aiv Fixed in Version => 7.0.0
2016-04-20 15:49 aiv Status verified => closed