mirror of
https://git.dev.opencascade.org/repos/occt.git
synced 2025-04-10 18:51:21 +03:00
0031678: Visualization - add option enabling hinting for textured fonts
Added new rendering parameter Graphic3d_RenderingParams::FontHinting allowing to enable/disable hinting (default is no hinting preserving old behavior). Command vrenderparams has been extended with arguments -fontHinting.
This commit is contained in:
parent
75e1b51170
commit
d37aef5ccf
@ -404,9 +404,11 @@ Standard_Boolean AIS_TextLabel::calculateLabelParams (const gp_Pnt& thePosition,
|
|||||||
{
|
{
|
||||||
// Get width and height of text
|
// Get width and height of text
|
||||||
Handle(Prs3d_TextAspect) anAsp = myDrawer->TextAspect();
|
Handle(Prs3d_TextAspect) anAsp = myDrawer->TextAspect();
|
||||||
|
const Graphic3d_RenderingParams& aRendParams = GetContext()->CurrentViewer()->DefaultRenderingParams();
|
||||||
Font_FTFontParams aFontParams;
|
Font_FTFontParams aFontParams;
|
||||||
aFontParams.PointSize = (unsigned int) anAsp->Height();
|
aFontParams.PointSize = (unsigned int) anAsp->Height();
|
||||||
aFontParams.Resolution = GetContext()->CurrentViewer()->DefaultRenderingParams().Resolution;
|
aFontParams.Resolution = aRendParams.Resolution;
|
||||||
|
aFontParams.FontHinting = aRendParams.FontHinting;
|
||||||
|
|
||||||
Handle(Font_FTFont) aFont = Font_FTFont::FindAndCreate (anAsp->Aspect()->Font(),
|
Handle(Font_FTFont) aFont = Font_FTFont::FindAndCreate (anAsp->Aspect()->Font(),
|
||||||
anAsp->Aspect()->GetTextFontAspect(),
|
anAsp->Aspect()->GetTextFontAspect(),
|
||||||
|
@ -7,6 +7,7 @@ Font_FTFont.cxx
|
|||||||
Font_FTFont.hxx
|
Font_FTFont.hxx
|
||||||
Font_FTLibrary.cxx
|
Font_FTLibrary.cxx
|
||||||
Font_FTLibrary.hxx
|
Font_FTLibrary.hxx
|
||||||
|
Font_Hinting.hxx
|
||||||
Font_NameOfFont.hxx
|
Font_NameOfFont.hxx
|
||||||
Font_NListOfSystemFont.hxx
|
Font_NListOfSystemFont.hxx
|
||||||
Font_Rect.hxx
|
Font_Rect.hxx
|
||||||
|
@ -96,6 +96,26 @@ bool Font_FTFont::Init (const Handle(NCollection_Buffer)& theData,
|
|||||||
myBuffer = theData;
|
myBuffer = theData;
|
||||||
myFontPath = theFileName;
|
myFontPath = theFileName;
|
||||||
myFontParams = theParams;
|
myFontParams = theParams;
|
||||||
|
|
||||||
|
// manage hinting style
|
||||||
|
if ((theParams.FontHinting & Font_Hinting_Light) != 0
|
||||||
|
&& (theParams.FontHinting & Font_Hinting_Normal) != 0)
|
||||||
|
{
|
||||||
|
throw Standard_ProgramError ("Font_FTFont, Light and Normal hinting styles are mutually exclusive");
|
||||||
|
}
|
||||||
|
setLoadFlag (FT_LOAD_TARGET_LIGHT, (theParams.FontHinting & Font_Hinting_Light) != 0);
|
||||||
|
setLoadFlag (FT_LOAD_NO_HINTING, (theParams.FontHinting & Font_Hinting_Normal) == 0
|
||||||
|
&& (theParams.FontHinting & Font_Hinting_Light) == 0);
|
||||||
|
|
||||||
|
// manage native / autohinting
|
||||||
|
if ((theParams.FontHinting & Font_Hinting_ForceAutohint) != 0
|
||||||
|
&& (theParams.FontHinting & Font_Hinting_NoAutohint) != 0)
|
||||||
|
{
|
||||||
|
throw Standard_ProgramError ("Font_FTFont, ForceAutohint and NoAutohint are mutually exclusive");
|
||||||
|
}
|
||||||
|
setLoadFlag (FT_LOAD_FORCE_AUTOHINT, (theParams.FontHinting & Font_Hinting_ForceAutohint) != 0);
|
||||||
|
setLoadFlag (FT_LOAD_NO_AUTOHINT, (theParams.FontHinting & Font_Hinting_NoAutohint) != 0);
|
||||||
|
|
||||||
if (!myFTLib->IsValid())
|
if (!myFTLib->IsValid())
|
||||||
{
|
{
|
||||||
Message::SendTrace ("FreeType library is unavailable");
|
Message::SendTrace ("FreeType library is unavailable");
|
||||||
@ -597,7 +617,8 @@ float Font_FTFont::AdvanceX (Standard_Utf32Char theUCharNext) const
|
|||||||
#ifdef HAVE_FREETYPE
|
#ifdef HAVE_FREETYPE
|
||||||
FT_Vector aKern;
|
FT_Vector aKern;
|
||||||
getKerning (aKern, myUChar, theUCharNext);
|
getKerning (aKern, myUChar, theUCharNext);
|
||||||
return myWidthScaling * fromFTPoints<float> (myActiveFTFace->glyph->advance.x + aKern.x);
|
return myWidthScaling * fromFTPoints<float> (myActiveFTFace->glyph->advance.x + aKern.x
|
||||||
|
+ myActiveFTFace->glyph->lsb_delta - myActiveFTFace->glyph->rsb_delta);
|
||||||
#else
|
#else
|
||||||
(void )theUCharNext;
|
(void )theUCharNext;
|
||||||
return 0.0f;
|
return 0.0f;
|
||||||
|
@ -17,6 +17,7 @@
|
|||||||
#define _Font_FTFont_H__
|
#define _Font_FTFont_H__
|
||||||
|
|
||||||
#include <Font_FontAspect.hxx>
|
#include <Font_FontAspect.hxx>
|
||||||
|
#include <Font_Hinting.hxx>
|
||||||
#include <Font_Rect.hxx>
|
#include <Font_Rect.hxx>
|
||||||
#include <Font_StrictLevel.hxx>
|
#include <Font_StrictLevel.hxx>
|
||||||
#include <Font_UnicodeSubset.hxx>
|
#include <Font_UnicodeSubset.hxx>
|
||||||
@ -37,16 +38,26 @@ struct Font_FTFontParams
|
|||||||
{
|
{
|
||||||
unsigned int PointSize; //!< face size in points (1/72 inch)
|
unsigned int PointSize; //!< face size in points (1/72 inch)
|
||||||
unsigned int Resolution; //!< resolution of the target device in dpi for FT_Set_Char_Size()
|
unsigned int Resolution; //!< resolution of the target device in dpi for FT_Set_Char_Size()
|
||||||
|
Font_Hinting FontHinting; //!< request hinting (exclude FT_LOAD_NO_HINTING flag), Font_Hinting_Off by default;
|
||||||
|
//! hinting improves readability of thin text on low-resolution screen,
|
||||||
|
//! but adds distortions to original font depending on font family and font library version
|
||||||
bool ToSynthesizeItalic; //!< generate italic style (e.g. for font family having no italic style); FALSE by default
|
bool ToSynthesizeItalic; //!< generate italic style (e.g. for font family having no italic style); FALSE by default
|
||||||
bool IsSingleStrokeFont; //!< single-stroke (one-line) font, FALSE by default
|
bool IsSingleStrokeFont; //!< single-stroke (one-line) font, FALSE by default
|
||||||
|
|
||||||
//! Empty constructor.
|
//! Empty constructor.
|
||||||
Font_FTFontParams() : PointSize (0), Resolution (72u), ToSynthesizeItalic (false), IsSingleStrokeFont (false) {}
|
Font_FTFontParams()
|
||||||
|
: PointSize (0), Resolution (72u),
|
||||||
|
FontHinting (Font_Hinting_Off),
|
||||||
|
ToSynthesizeItalic (false),
|
||||||
|
IsSingleStrokeFont (false) {}
|
||||||
|
|
||||||
//! Constructor.
|
//! Constructor.
|
||||||
Font_FTFontParams (unsigned int thePointSize,
|
Font_FTFontParams (unsigned int thePointSize,
|
||||||
unsigned int theResolution)
|
unsigned int theResolution)
|
||||||
: PointSize (thePointSize), Resolution (theResolution), ToSynthesizeItalic (false), IsSingleStrokeFont (false) {}
|
: PointSize (thePointSize), Resolution (theResolution),
|
||||||
|
FontHinting (Font_Hinting_Off),
|
||||||
|
ToSynthesizeItalic (false),
|
||||||
|
IsSingleStrokeFont (false) {}
|
||||||
};
|
};
|
||||||
|
|
||||||
DEFINE_STANDARD_HANDLE(Font_FTFont, Standard_Transient)
|
DEFINE_STANDARD_HANDLE(Font_FTFont, Standard_Transient)
|
||||||
@ -359,6 +370,19 @@ protected:
|
|||||||
//! Initialize fallback font.
|
//! Initialize fallback font.
|
||||||
Standard_EXPORT bool findAndInitFallback (Font_UnicodeSubset theSubset);
|
Standard_EXPORT bool findAndInitFallback (Font_UnicodeSubset theSubset);
|
||||||
|
|
||||||
|
//! Enable/disable load flag.
|
||||||
|
void setLoadFlag (int32_t theFlag, bool theToEnable)
|
||||||
|
{
|
||||||
|
if (theToEnable)
|
||||||
|
{
|
||||||
|
myLoadFlags |= theFlag;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
myLoadFlags &= ~theFlag;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
|
||||||
Handle(Font_FTLibrary) myFTLib; //!< handle to the FT library object
|
Handle(Font_FTLibrary) myFTLib; //!< handle to the FT library object
|
||||||
|
29
src/Font/Font_Hinting.hxx
Normal file
29
src/Font/Font_Hinting.hxx
Normal file
@ -0,0 +1,29 @@
|
|||||||
|
// Copyright (c) 2021 OPEN CASCADE SAS
|
||||||
|
//
|
||||||
|
// This file is part of Open CASCADE Technology software library.
|
||||||
|
//
|
||||||
|
// This library is free software; you can redistribute it and/or modify it under
|
||||||
|
// the terms of the GNU Lesser General Public License version 2.1 as published
|
||||||
|
// by the Free Software Foundation, with special exception defined in the file
|
||||||
|
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
|
||||||
|
// distribution for complete text of the license and disclaimer of any warranty.
|
||||||
|
//
|
||||||
|
// Alternatively, this file may be used under the terms of Open CASCADE
|
||||||
|
// commercial license or contractual agreement.
|
||||||
|
|
||||||
|
#ifndef _Font_Hinting_HeaderFile
|
||||||
|
#define _Font_Hinting_HeaderFile
|
||||||
|
|
||||||
|
//! Enumeration defining font hinting options.
|
||||||
|
enum Font_Hinting
|
||||||
|
{
|
||||||
|
// hinting style
|
||||||
|
Font_Hinting_Off = 0x00, //!< no hinting (FT_LOAD_NO_HINTING)
|
||||||
|
Font_Hinting_Normal = 0x01, //!< default hinting (FT_LOAD_TARGET_NORMAL)
|
||||||
|
Font_Hinting_Light = 0x02, //!< light hinting (FT_LOAD_TARGET_LIGHT)
|
||||||
|
// native/autohinting flags
|
||||||
|
Font_Hinting_ForceAutohint = 0x10, //!< prefer autohinting over native hinting (FT_LOAD_FORCE_AUTOHINT)
|
||||||
|
Font_Hinting_NoAutohint = 0x20, //!< disallow autohinting (FT_LOAD_NO_AUTOHINT)
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif // _Font_Hinting_HeaderFile
|
@ -16,6 +16,7 @@
|
|||||||
#ifndef _Graphic3d_RenderingParams_HeaderFile
|
#ifndef _Graphic3d_RenderingParams_HeaderFile
|
||||||
#define _Graphic3d_RenderingParams_HeaderFile
|
#define _Graphic3d_RenderingParams_HeaderFile
|
||||||
|
|
||||||
|
#include <Font_Hinting.hxx>
|
||||||
#include <Graphic3d_AspectText3d.hxx>
|
#include <Graphic3d_AspectText3d.hxx>
|
||||||
#include <Graphic3d_TransformPers.hxx>
|
#include <Graphic3d_TransformPers.hxx>
|
||||||
#include <Graphic3d_RenderTransparentMethod.hxx>
|
#include <Graphic3d_RenderTransparentMethod.hxx>
|
||||||
@ -97,6 +98,8 @@ public:
|
|||||||
: Method (Graphic3d_RM_RASTERIZATION),
|
: Method (Graphic3d_RM_RASTERIZATION),
|
||||||
ShadingModel (Graphic3d_TOSM_FRAGMENT),
|
ShadingModel (Graphic3d_TOSM_FRAGMENT),
|
||||||
TransparencyMethod (Graphic3d_RTM_BLEND_UNORDERED),
|
TransparencyMethod (Graphic3d_RTM_BLEND_UNORDERED),
|
||||||
|
Resolution (THE_DEFAULT_RESOLUTION),
|
||||||
|
FontHinting (Font_Hinting_Off),
|
||||||
LineFeather (1.0f),
|
LineFeather (1.0f),
|
||||||
// PBR parameters
|
// PBR parameters
|
||||||
PbrEnvPow2Size (9),
|
PbrEnvPow2Size (9),
|
||||||
@ -154,9 +157,7 @@ public:
|
|||||||
StatsNbFrames (1),
|
StatsNbFrames (1),
|
||||||
StatsMaxChartTime (0.1f),
|
StatsMaxChartTime (0.1f),
|
||||||
CollectedStats (PerfCounters_Basic),
|
CollectedStats (PerfCounters_Basic),
|
||||||
ToShowStats (Standard_False),
|
ToShowStats (Standard_False)
|
||||||
//
|
|
||||||
Resolution (THE_DEFAULT_RESOLUTION)
|
|
||||||
{
|
{
|
||||||
const Graphic3d_Vec4 aZero (0.0f, 0.0f, 0.0f, 0.0f);
|
const Graphic3d_Vec4 aZero (0.0f, 0.0f, 0.0f, 0.0f);
|
||||||
AnaglyphLeft .SetRow (0, Graphic3d_Vec4 (1.0f, 0.0f, 0.0f, 0.0f));
|
AnaglyphLeft .SetRow (0, Graphic3d_Vec4 (1.0f, 0.0f, 0.0f, 0.0f));
|
||||||
@ -185,14 +186,24 @@ public:
|
|||||||
//! Dumps the content of me into the stream
|
//! Dumps the content of me into the stream
|
||||||
Standard_EXPORT void DumpJson (Standard_OStream& theOStream, Standard_Integer theDepth = -1) const;
|
Standard_EXPORT void DumpJson (Standard_OStream& theOStream, Standard_Integer theDepth = -1) const;
|
||||||
|
|
||||||
public:
|
public: //! @name general parameters
|
||||||
|
|
||||||
Graphic3d_RenderingMode Method; //!< specifies rendering mode, Graphic3d_RM_RASTERIZATION by default
|
Graphic3d_RenderingMode Method; //!< specifies rendering mode, Graphic3d_RM_RASTERIZATION by default
|
||||||
Graphic3d_TypeOfShadingModel ShadingModel; //!< specified default shading model, Graphic3d_TOSM_FRAGMENT by default
|
Graphic3d_TypeOfShadingModel ShadingModel; //!< specified default shading model, Graphic3d_TOSM_FRAGMENT by default
|
||||||
Graphic3d_RenderTransparentMethod TransparencyMethod; //!< specifies rendering method for transparent graphics
|
Graphic3d_RenderTransparentMethod TransparencyMethod; //!< specifies rendering method for transparent graphics
|
||||||
Standard_ShortReal LineFeather; //!< line feater width in pixels (> 0.0), 1.0 by default;
|
unsigned int Resolution; //!< Pixels density (PPI), defines scaling factor for parameters like text size
|
||||||
|
//! (when defined in screen-space units rather than in 3D) to be properly displayed
|
||||||
|
//! on device (screen / printer). 72 is default value.
|
||||||
|
//! Note that using difference resolution in different Views in same Viewer
|
||||||
|
//! will lead to performance regression (for example, text will be recreated every time).
|
||||||
|
Font_Hinting FontHinting; //!< enables/disables text hinting within textured fonts, Font_Hinting_Off by default;
|
||||||
|
//! hinting improves readability of thin text on low-resolution screen,
|
||||||
|
//! but adds distortions to original font depending on font family and font library version
|
||||||
|
Standard_ShortReal LineFeather; //!< line feather width in pixels (> 0.0), 1.0 by default;
|
||||||
//! high values produce blurred results, small values produce sharp (aliased) edges
|
//! high values produce blurred results, small values produce sharp (aliased) edges
|
||||||
|
|
||||||
|
public: //! @name rendering resolution parameters
|
||||||
|
|
||||||
Standard_Integer PbrEnvPow2Size; //!< size of IBL maps side can be calculated as 2^PbrEnvPow2Size (> 0), 9 by default
|
Standard_Integer PbrEnvPow2Size; //!< size of IBL maps side can be calculated as 2^PbrEnvPow2Size (> 0), 9 by default
|
||||||
Standard_Integer PbrEnvSpecMapNbLevels; //!< number of levels used in specular IBL map (> 1), 6 by default
|
Standard_Integer PbrEnvSpecMapNbLevels; //!< number of levels used in specular IBL map (> 1), 6 by default
|
||||||
Standard_Integer PbrEnvBakingDiffNbSamples; //!< number of samples used in Monte-Carlo integration during diffuse IBL map's
|
Standard_Integer PbrEnvBakingDiffNbSamples; //!< number of samples used in Monte-Carlo integration during diffuse IBL map's
|
||||||
@ -211,6 +222,8 @@ public:
|
|||||||
Standard_Boolean ToEnableDepthPrepass; //!< enables/disables depth pre-pass, False by default
|
Standard_Boolean ToEnableDepthPrepass; //!< enables/disables depth pre-pass, False by default
|
||||||
Standard_Boolean ToEnableAlphaToCoverage; //!< enables/disables alpha to coverage, True by default
|
Standard_Boolean ToEnableAlphaToCoverage; //!< enables/disables alpha to coverage, True by default
|
||||||
|
|
||||||
|
public: //! @name Ray-Tracing/Path-Tracing parameters
|
||||||
|
|
||||||
Standard_Boolean IsGlobalIlluminationEnabled; //!< enables/disables global illumination effects (path tracing)
|
Standard_Boolean IsGlobalIlluminationEnabled; //!< enables/disables global illumination effects (path tracing)
|
||||||
Standard_Integer SamplesPerPixel; //!< number of samples per pixel (SPP)
|
Standard_Integer SamplesPerPixel; //!< number of samples per pixel (SPP)
|
||||||
Standard_Integer RaytracingDepth; //!< maximum ray-tracing depth, 3 by default
|
Standard_Integer RaytracingDepth; //!< maximum ray-tracing depth, 3 by default
|
||||||
@ -239,6 +252,8 @@ public:
|
|||||||
Standard_ShortReal Exposure; //!< exposure value used for tone mapping (path tracing), 0.0 by default
|
Standard_ShortReal Exposure; //!< exposure value used for tone mapping (path tracing), 0.0 by default
|
||||||
Standard_ShortReal WhitePoint; //!< white point value used in filmic tone mapping (path tracing), 1.0 by default
|
Standard_ShortReal WhitePoint; //!< white point value used in filmic tone mapping (path tracing), 1.0 by default
|
||||||
|
|
||||||
|
public: //! @name VR / stereoscopic parameters
|
||||||
|
|
||||||
Graphic3d_StereoMode StereoMode; //!< stereoscopic output mode, Graphic3d_StereoMode_QuadBuffer by default
|
Graphic3d_StereoMode StereoMode; //!< stereoscopic output mode, Graphic3d_StereoMode_QuadBuffer by default
|
||||||
Standard_ShortReal HmdFov2d; //!< sharp field of view range in degrees for displaying on-screen 2D elements, 30.0 by default;
|
Standard_ShortReal HmdFov2d; //!< sharp field of view range in degrees for displaying on-screen 2D elements, 30.0 by default;
|
||||||
Anaglyph AnaglyphFilter; //!< filter for anaglyph output, Anaglyph_RedCyan_Optimized by default
|
Anaglyph AnaglyphFilter; //!< filter for anaglyph output, Anaglyph_RedCyan_Optimized by default
|
||||||
@ -247,6 +262,8 @@ public:
|
|||||||
Standard_Boolean ToReverseStereo; //!< flag to reverse stereo pair, FALSE by default
|
Standard_Boolean ToReverseStereo; //!< flag to reverse stereo pair, FALSE by default
|
||||||
Standard_Boolean ToMirrorComposer; //!< if output device is an external composer - mirror rendering results in window in addition to sending frame to composer, TRUE by default
|
Standard_Boolean ToMirrorComposer; //!< if output device is an external composer - mirror rendering results in window in addition to sending frame to composer, TRUE by default
|
||||||
|
|
||||||
|
public: //! @name on-screen display parameters
|
||||||
|
|
||||||
Handle(Graphic3d_TransformPers) StatsPosition; //!< location of stats, upper-left position by default
|
Handle(Graphic3d_TransformPers) StatsPosition; //!< location of stats, upper-left position by default
|
||||||
Handle(Graphic3d_TransformPers) ChartPosition; //!< location of stats chart, upper-right position by default
|
Handle(Graphic3d_TransformPers) ChartPosition; //!< location of stats chart, upper-right position by default
|
||||||
Graphic3d_Vec2i ChartSize; //!< chart size in pixels, (-1, -1) by default which means that chart will occupy a portion of viewport
|
Graphic3d_Vec2i ChartSize; //!< chart size in pixels, (-1, -1) by default which means that chart will occupy a portion of viewport
|
||||||
@ -265,11 +282,6 @@ public:
|
|||||||
//! note that counters specified within CollectedStats will be updated nevertheless
|
//! note that counters specified within CollectedStats will be updated nevertheless
|
||||||
//! of visibility of widget managed by ToShowStats flag (e.g. stats can be retrieved by application for displaying using other methods)
|
//! of visibility of widget managed by ToShowStats flag (e.g. stats can be retrieved by application for displaying using other methods)
|
||||||
|
|
||||||
unsigned int Resolution; //!< Pixels density (PPI), defines scaling factor for parameters like text size
|
|
||||||
//! (when defined in screen-space units rather than in 3D) to be properly displayed
|
|
||||||
//! on device (screen / printer). 72 is default value.
|
|
||||||
//! Note that using difference resolution in different Views in same Viewer
|
|
||||||
//! will lead to performance regression (for example, text will be recreated every time).
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // _Graphic3d_RenderingParams_HeaderFile
|
#endif // _Graphic3d_RenderingParams_HeaderFile
|
||||||
|
@ -651,7 +651,9 @@ void OpenGl_GraphicDriver::TextSize (const Handle(Graphic3d_CView)& theView,
|
|||||||
OpenGl_Aspects aTextAspect;
|
OpenGl_Aspects aTextAspect;
|
||||||
TCollection_ExtendedString anExtText = theText;
|
TCollection_ExtendedString anExtText = theText;
|
||||||
NCollection_String aText (anExtText.ToExtString());
|
NCollection_String aText (anExtText.ToExtString());
|
||||||
OpenGl_Text::StringSize(aCtx, aText, aTextAspect, aHeight, theView->RenderingParams().Resolution, theWidth, theAscent, theDescent);
|
OpenGl_Text::StringSize (aCtx, aText, aTextAspect, aHeight,
|
||||||
|
theView->RenderingParams().Resolution, theView->RenderingParams().FontHinting,
|
||||||
|
theWidth, theAscent, theDescent);
|
||||||
}
|
}
|
||||||
|
|
||||||
//=======================================================================
|
//=======================================================================
|
||||||
|
@ -262,6 +262,7 @@ void OpenGl_Text::StringSize (const Handle(OpenGl_Context)& theCtx,
|
|||||||
const OpenGl_Aspects& theTextAspect,
|
const OpenGl_Aspects& theTextAspect,
|
||||||
const Standard_ShortReal theHeight,
|
const Standard_ShortReal theHeight,
|
||||||
const unsigned int theResolution,
|
const unsigned int theResolution,
|
||||||
|
const Font_Hinting theFontHinting,
|
||||||
Standard_ShortReal& theWidth,
|
Standard_ShortReal& theWidth,
|
||||||
Standard_ShortReal& theAscent,
|
Standard_ShortReal& theAscent,
|
||||||
Standard_ShortReal& theDescent)
|
Standard_ShortReal& theDescent)
|
||||||
@ -269,8 +270,8 @@ void OpenGl_Text::StringSize (const Handle(OpenGl_Context)& theCtx,
|
|||||||
theWidth = 0.0f;
|
theWidth = 0.0f;
|
||||||
theAscent = 0.0f;
|
theAscent = 0.0f;
|
||||||
theDescent = 0.0f;
|
theDescent = 0.0f;
|
||||||
const TCollection_AsciiString aFontKey = FontKey (theTextAspect, (Standard_Integer)theHeight, theResolution);
|
const TCollection_AsciiString aFontKey = FontKey (theTextAspect, (Standard_Integer)theHeight, theResolution, theFontHinting);
|
||||||
Handle(OpenGl_Font) aFont = FindFont (theCtx, theTextAspect, (Standard_Integer)theHeight, theResolution, aFontKey);
|
Handle(OpenGl_Font) aFont = FindFont (theCtx, theTextAspect, (Standard_Integer)theHeight, theResolution, theFontHinting, aFontKey);
|
||||||
if (aFont.IsNull() || !aFont->IsValid())
|
if (aFont.IsNull() || !aFont->IsValid())
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
@ -348,7 +349,8 @@ void OpenGl_Text::Render (const Handle(OpenGl_Workspace)& theWorkspace) const
|
|||||||
*aTextAspect,
|
*aTextAspect,
|
||||||
theWorkspace->TextColor(),
|
theWorkspace->TextColor(),
|
||||||
theWorkspace->TextSubtitleColor(),
|
theWorkspace->TextSubtitleColor(),
|
||||||
aCtx->Resolution());
|
aCtx->Resolution(),
|
||||||
|
theWorkspace->View()->RenderingParams().FontHinting);
|
||||||
|
|
||||||
// restore aspects
|
// restore aspects
|
||||||
if (!aPrevTexture.IsNull())
|
if (!aPrevTexture.IsNull())
|
||||||
@ -369,7 +371,8 @@ void OpenGl_Text::Render (const Handle(OpenGl_Workspace)& theWorkspace) const
|
|||||||
// =======================================================================
|
// =======================================================================
|
||||||
void OpenGl_Text::Render (const Handle(OpenGl_Context)& theCtx,
|
void OpenGl_Text::Render (const Handle(OpenGl_Context)& theCtx,
|
||||||
const OpenGl_Aspects& theTextAspect,
|
const OpenGl_Aspects& theTextAspect,
|
||||||
unsigned int theResolution) const
|
unsigned int theResolution,
|
||||||
|
Font_Hinting theFontHinting) const
|
||||||
{
|
{
|
||||||
#if !defined(GL_ES_VERSION_2_0)
|
#if !defined(GL_ES_VERSION_2_0)
|
||||||
const Standard_Integer aPrevPolygonMode = theCtx->SetPolygonMode (GL_FILL);
|
const Standard_Integer aPrevPolygonMode = theCtx->SetPolygonMode (GL_FILL);
|
||||||
@ -379,7 +382,8 @@ void OpenGl_Text::Render (const Handle(OpenGl_Context)& theCtx,
|
|||||||
render (theCtx, theTextAspect,
|
render (theCtx, theTextAspect,
|
||||||
theTextAspect.Aspect()->ColorRGBA(),
|
theTextAspect.Aspect()->ColorRGBA(),
|
||||||
theTextAspect.Aspect()->ColorSubTitleRGBA(),
|
theTextAspect.Aspect()->ColorSubTitleRGBA(),
|
||||||
theResolution);
|
theResolution,
|
||||||
|
theFontHinting);
|
||||||
|
|
||||||
#if !defined(GL_ES_VERSION_2_0)
|
#if !defined(GL_ES_VERSION_2_0)
|
||||||
theCtx->SetPolygonMode (aPrevPolygonMode);
|
theCtx->SetPolygonMode (aPrevPolygonMode);
|
||||||
@ -535,16 +539,21 @@ void OpenGl_Text::drawText (const Handle(OpenGl_Context)& theCtx,
|
|||||||
// =======================================================================
|
// =======================================================================
|
||||||
TCollection_AsciiString OpenGl_Text::FontKey (const OpenGl_Aspects& theAspect,
|
TCollection_AsciiString OpenGl_Text::FontKey (const OpenGl_Aspects& theAspect,
|
||||||
Standard_Integer theHeight,
|
Standard_Integer theHeight,
|
||||||
unsigned int theResolution)
|
unsigned int theResolution,
|
||||||
|
Font_Hinting theFontHinting)
|
||||||
{
|
{
|
||||||
const Font_FontAspect anAspect = theAspect.Aspect()->TextFontAspect() != Font_FA_Undefined
|
const Font_FontAspect anAspect = theAspect.Aspect()->TextFontAspect() != Font_FA_Undefined
|
||||||
? theAspect.Aspect()->TextFontAspect()
|
? theAspect.Aspect()->TextFontAspect()
|
||||||
: Font_FA_Regular;
|
: Font_FA_Regular;
|
||||||
const TCollection_AsciiString& aFont = !theAspect.Aspect()->TextFont().IsNull() ? theAspect.Aspect()->TextFont()->String() : THE_DEFAULT_FONT;
|
const TCollection_AsciiString& aFont = !theAspect.Aspect()->TextFont().IsNull() ? theAspect.Aspect()->TextFont()->String() : THE_DEFAULT_FONT;
|
||||||
return aFont
|
|
||||||
+ TCollection_AsciiString(":") + Standard_Integer(anAspect)
|
char aSuff[64];
|
||||||
+ TCollection_AsciiString(":") + Standard_Integer(theResolution)
|
Sprintf (aSuff, ":%d:%d:%d:%d",
|
||||||
+ TCollection_AsciiString(":") + theHeight;
|
Standard_Integer(anAspect),
|
||||||
|
Standard_Integer(theResolution),
|
||||||
|
theHeight,
|
||||||
|
Standard_Integer(theFontHinting));
|
||||||
|
return aFont + aSuff;
|
||||||
}
|
}
|
||||||
|
|
||||||
// =======================================================================
|
// =======================================================================
|
||||||
@ -555,6 +564,7 @@ Handle(OpenGl_Font) OpenGl_Text::FindFont (const Handle(OpenGl_Context)& theCtx,
|
|||||||
const OpenGl_Aspects& theAspect,
|
const OpenGl_Aspects& theAspect,
|
||||||
Standard_Integer theHeight,
|
Standard_Integer theHeight,
|
||||||
unsigned int theResolution,
|
unsigned int theResolution,
|
||||||
|
Font_Hinting theFontHinting,
|
||||||
const TCollection_AsciiString& theKey)
|
const TCollection_AsciiString& theKey)
|
||||||
{
|
{
|
||||||
Handle(OpenGl_Font) aFont;
|
Handle(OpenGl_Font) aFont;
|
||||||
@ -575,6 +585,7 @@ Handle(OpenGl_Font) OpenGl_Text::FindFont (const Handle(OpenGl_Context)& theCtx,
|
|||||||
Font_FTFontParams aParams;
|
Font_FTFontParams aParams;
|
||||||
aParams.PointSize = theHeight;
|
aParams.PointSize = theHeight;
|
||||||
aParams.Resolution = theResolution;
|
aParams.Resolution = theResolution;
|
||||||
|
aParams.FontHinting = theFontHinting;
|
||||||
if (Handle(Font_FTFont) aFontFt = Font_FTFont::FindAndCreate (aFontName, anAspect, aParams, Font_StrictLevel_Any))
|
if (Handle(Font_FTFont) aFontFt = Font_FTFont::FindAndCreate (aFontName, anAspect, aParams, Font_StrictLevel_Any))
|
||||||
{
|
{
|
||||||
aFont = new OpenGl_Font (aFontFt, theKey);
|
aFont = new OpenGl_Font (aFontFt, theKey);
|
||||||
@ -658,7 +669,8 @@ void OpenGl_Text::render (const Handle(OpenGl_Context)& theCtx,
|
|||||||
const OpenGl_Aspects& theTextAspect,
|
const OpenGl_Aspects& theTextAspect,
|
||||||
const OpenGl_Vec4& theColorText,
|
const OpenGl_Vec4& theColorText,
|
||||||
const OpenGl_Vec4& theColorSubs,
|
const OpenGl_Vec4& theColorSubs,
|
||||||
unsigned int theResolution) const
|
unsigned int theResolution,
|
||||||
|
Font_Hinting theFontHinting) const
|
||||||
{
|
{
|
||||||
if (myText->Text().IsEmpty() && myText->TextFormatter().IsNull())
|
if (myText->Text().IsEmpty() && myText->TextFormatter().IsNull())
|
||||||
{
|
{
|
||||||
@ -667,7 +679,7 @@ void OpenGl_Text::render (const Handle(OpenGl_Context)& theCtx,
|
|||||||
|
|
||||||
// Note that using difference resolution in different Views in same Viewer
|
// Note that using difference resolution in different Views in same Viewer
|
||||||
// will lead to performance regression (for example, text will be recreated every time).
|
// will lead to performance regression (for example, text will be recreated every time).
|
||||||
const TCollection_AsciiString aFontKey = FontKey (theTextAspect, (Standard_Integer)myText->Height(), theResolution);
|
const TCollection_AsciiString aFontKey = FontKey (theTextAspect, (Standard_Integer)myText->Height(), theResolution, theFontHinting);
|
||||||
if (!myFont.IsNull()
|
if (!myFont.IsNull()
|
||||||
&& !myFont->ResourceKey().IsEqual (aFontKey))
|
&& !myFont->ResourceKey().IsEqual (aFontKey))
|
||||||
{
|
{
|
||||||
@ -677,7 +689,7 @@ void OpenGl_Text::render (const Handle(OpenGl_Context)& theCtx,
|
|||||||
|
|
||||||
if (myFont.IsNull())
|
if (myFont.IsNull())
|
||||||
{
|
{
|
||||||
myFont = FindFont (theCtx, theTextAspect, (Standard_Integer)myText->Height(), theResolution, aFontKey);
|
myFont = FindFont (theCtx, theTextAspect, (Standard_Integer)myText->Height(), theResolution, theFontHinting, aFontKey);
|
||||||
}
|
}
|
||||||
if (myFont.IsNull()
|
if (myFont.IsNull()
|
||||||
|| !myFont->WasInitialized())
|
|| !myFont->WasInitialized())
|
||||||
|
@ -82,13 +82,15 @@ public: //! @name methods for compatibility with layers
|
|||||||
//! Create key for shared resource
|
//! Create key for shared resource
|
||||||
Standard_EXPORT static TCollection_AsciiString FontKey (const OpenGl_Aspects& theAspect,
|
Standard_EXPORT static TCollection_AsciiString FontKey (const OpenGl_Aspects& theAspect,
|
||||||
Standard_Integer theHeight,
|
Standard_Integer theHeight,
|
||||||
unsigned int theResolution);
|
unsigned int theResolution,
|
||||||
|
Font_Hinting theFontHinting);
|
||||||
|
|
||||||
//! Find shared resource for specified font or initialize new one
|
//! Find shared resource for specified font or initialize new one
|
||||||
Standard_EXPORT static Handle(OpenGl_Font) FindFont (const Handle(OpenGl_Context)& theCtx,
|
Standard_EXPORT static Handle(OpenGl_Font) FindFont (const Handle(OpenGl_Context)& theCtx,
|
||||||
const OpenGl_Aspects& theAspect,
|
const OpenGl_Aspects& theAspect,
|
||||||
Standard_Integer theHeight,
|
Standard_Integer theHeight,
|
||||||
unsigned int theResolution,
|
unsigned int theResolution,
|
||||||
|
Font_Hinting theFontHinting,
|
||||||
const TCollection_AsciiString& theKey);
|
const TCollection_AsciiString& theKey);
|
||||||
|
|
||||||
//! Compute text width
|
//! Compute text width
|
||||||
@ -97,6 +99,7 @@ public: //! @name methods for compatibility with layers
|
|||||||
const OpenGl_Aspects& theTextAspect,
|
const OpenGl_Aspects& theTextAspect,
|
||||||
const Standard_ShortReal theHeight,
|
const Standard_ShortReal theHeight,
|
||||||
const unsigned int theResolution,
|
const unsigned int theResolution,
|
||||||
|
const Font_Hinting theFontHinting,
|
||||||
Standard_ShortReal& theWidth,
|
Standard_ShortReal& theWidth,
|
||||||
Standard_ShortReal& theAscent,
|
Standard_ShortReal& theAscent,
|
||||||
Standard_ShortReal& theDescent);
|
Standard_ShortReal& theDescent);
|
||||||
@ -104,7 +107,8 @@ public: //! @name methods for compatibility with layers
|
|||||||
//! Perform rendering
|
//! Perform rendering
|
||||||
Standard_EXPORT void Render (const Handle(OpenGl_Context)& theCtx,
|
Standard_EXPORT void Render (const Handle(OpenGl_Context)& theCtx,
|
||||||
const OpenGl_Aspects& theTextAspect,
|
const OpenGl_Aspects& theTextAspect,
|
||||||
unsigned int theResolution = Graphic3d_RenderingParams::THE_DEFAULT_RESOLUTION) const;
|
unsigned int theResolution = Graphic3d_RenderingParams::THE_DEFAULT_RESOLUTION,
|
||||||
|
Font_Hinting theFontHinting = Font_Hinting_Off) const;
|
||||||
|
|
||||||
//! Dumps the content of me into the stream
|
//! Dumps the content of me into the stream
|
||||||
Standard_EXPORT virtual void DumpJson (Standard_OStream& theOStream, Standard_Integer theDepth = -1) const Standard_OVERRIDE;
|
Standard_EXPORT virtual void DumpJson (Standard_OStream& theOStream, Standard_Integer theDepth = -1) const Standard_OVERRIDE;
|
||||||
@ -151,7 +155,8 @@ private:
|
|||||||
const OpenGl_Aspects& theTextAspect,
|
const OpenGl_Aspects& theTextAspect,
|
||||||
const OpenGl_Vec4& theColorText,
|
const OpenGl_Vec4& theColorText,
|
||||||
const OpenGl_Vec4& theColorSubs,
|
const OpenGl_Vec4& theColorSubs,
|
||||||
unsigned int theResolution) const;
|
unsigned int theResolution,
|
||||||
|
Font_Hinting theFontHinting) const;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
|
||||||
|
@ -18,6 +18,7 @@
|
|||||||
#include <PrsDim.hxx>
|
#include <PrsDim.hxx>
|
||||||
#include <PrsDim_DimensionOwner.hxx>
|
#include <PrsDim_DimensionOwner.hxx>
|
||||||
#include <Adaptor3d_Curve.hxx>
|
#include <Adaptor3d_Curve.hxx>
|
||||||
|
#include <AIS_InteractiveContext.hxx>
|
||||||
#include <BRepAdaptor_Curve.hxx>
|
#include <BRepAdaptor_Curve.hxx>
|
||||||
#include <BRepAdaptor_Surface.hxx>
|
#include <BRepAdaptor_Surface.hxx>
|
||||||
#include <BRepBndLib.hxx>
|
#include <BRepBndLib.hxx>
|
||||||
@ -67,6 +68,7 @@
|
|||||||
#include <TopoDS.hxx>
|
#include <TopoDS.hxx>
|
||||||
#include <TopoDS_Edge.hxx>
|
#include <TopoDS_Edge.hxx>
|
||||||
#include <TopoDS_Vertex.hxx>
|
#include <TopoDS_Vertex.hxx>
|
||||||
|
#include <V3d_Viewer.hxx>
|
||||||
#include <Units.hxx>
|
#include <Units.hxx>
|
||||||
#include <Units_UnitsDictionary.hxx>
|
#include <Units_UnitsDictionary.hxx>
|
||||||
#include <UnitsAPI.hxx>
|
#include <UnitsAPI.hxx>
|
||||||
@ -82,7 +84,6 @@ namespace
|
|||||||
|
|
||||||
// default text margin and resolution
|
// default text margin and resolution
|
||||||
static const Standard_Real THE_3D_TEXT_MARGIN = 0.1;
|
static const Standard_Real THE_3D_TEXT_MARGIN = 0.1;
|
||||||
static const unsigned int THE_2D_TEXT_RESOLUTION = 72;
|
|
||||||
|
|
||||||
// default selection priorities
|
// default selection priorities
|
||||||
static const Standard_Integer THE_NEUTRAL_SEL_PRIORITY = 5;
|
static const Standard_Integer THE_NEUTRAL_SEL_PRIORITY = 5;
|
||||||
@ -329,9 +330,14 @@ TCollection_ExtendedString PrsDim_Dimension::GetValueString (Standard_Real& theW
|
|||||||
{
|
{
|
||||||
// Text width for 1:1 scale 2D case
|
// Text width for 1:1 scale 2D case
|
||||||
Font_FTFontParams aFontParams;
|
Font_FTFontParams aFontParams;
|
||||||
|
const Graphic3d_RenderingParams& aRendParams = GetContext()->CurrentViewer()->DefaultRenderingParams();
|
||||||
aFontParams.PointSize = (unsigned int )aTextAspect->Height();
|
aFontParams.PointSize = (unsigned int )aTextAspect->Height();
|
||||||
aFontParams.Resolution = THE_2D_TEXT_RESOLUTION;
|
aFontParams.Resolution = aRendParams.Resolution;
|
||||||
if (Handle(Font_FTFont) aFont = Font_FTFont::FindAndCreate (aTextAspect->Aspect()->Font(), aTextAspect->Aspect()->GetTextFontAspect(), aFontParams, Font_StrictLevel_Any))
|
aFontParams.FontHinting = aRendParams.FontHinting;
|
||||||
|
if (Handle(Font_FTFont) aFont = Font_FTFont::FindAndCreate (aTextAspect->Aspect()->Font(),
|
||||||
|
aTextAspect->Aspect()->GetTextFontAspect(),
|
||||||
|
aFontParams,
|
||||||
|
Font_StrictLevel_Any))
|
||||||
{
|
{
|
||||||
for (NCollection_Utf8Iter anIter = anUTFString.Iterator(); *anIter != 0; )
|
for (NCollection_Utf8Iter anIter = anUTFString.Iterator(); *anIter != 0; )
|
||||||
{
|
{
|
||||||
|
@ -11757,6 +11757,107 @@ static Standard_Integer VRenderParams (Draw_Interpretor& theDI,
|
|||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
else if (aFlag == "-fonthinting"
|
||||||
|
|| aFlag == "-fonthint")
|
||||||
|
{
|
||||||
|
if (toPrint)
|
||||||
|
{
|
||||||
|
if ((aParams.FontHinting & Font_Hinting_Normal) != 0)
|
||||||
|
{
|
||||||
|
theDI << "normal" << " ";
|
||||||
|
}
|
||||||
|
else if ((aParams.FontHinting & Font_Hinting_Normal) != 0)
|
||||||
|
{
|
||||||
|
theDI << "light" << " ";
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
theDI << "off" << " ";
|
||||||
|
}
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
else if (anArgIter + 1 >= theArgNb)
|
||||||
|
{
|
||||||
|
theDI << "Syntax error at '" << theArgVec[anArgIter] << "'";
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
TCollection_AsciiString aHintStyle (theArgVec[++anArgIter]);
|
||||||
|
aHintStyle.LowerCase();
|
||||||
|
if (aHintStyle == "normal"
|
||||||
|
|| aHintStyle == "on"
|
||||||
|
|| aHintStyle == "1")
|
||||||
|
{
|
||||||
|
aParams.FontHinting = Font_Hinting(aParams.FontHinting & ~Font_Hinting_Light);
|
||||||
|
aParams.FontHinting = Font_Hinting(aParams.FontHinting | Font_Hinting_Normal);
|
||||||
|
}
|
||||||
|
else if (aHintStyle == "light")
|
||||||
|
{
|
||||||
|
aParams.FontHinting = Font_Hinting(aParams.FontHinting & ~Font_Hinting_Normal);
|
||||||
|
aParams.FontHinting = Font_Hinting(aParams.FontHinting | Font_Hinting_Light);
|
||||||
|
}
|
||||||
|
else if (aHintStyle == "no"
|
||||||
|
|| aHintStyle == "off"
|
||||||
|
|| aHintStyle == "0")
|
||||||
|
{
|
||||||
|
aParams.FontHinting = Font_Hinting(aParams.FontHinting & ~Font_Hinting_Normal);
|
||||||
|
aParams.FontHinting = Font_Hinting(aParams.FontHinting & ~Font_Hinting_Light);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
theDI << "Syntax error at '" << theArgVec[anArgIter] << "'";
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (aFlag == "-fontautohinting"
|
||||||
|
|| aFlag == "-fontautohint")
|
||||||
|
{
|
||||||
|
if (toPrint)
|
||||||
|
{
|
||||||
|
if ((aParams.FontHinting & Font_Hinting_ForceAutohint) != 0)
|
||||||
|
{
|
||||||
|
theDI << "force" << " ";
|
||||||
|
}
|
||||||
|
else if ((aParams.FontHinting & Font_Hinting_NoAutohint) != 0)
|
||||||
|
{
|
||||||
|
theDI << "disallow" << " ";
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
theDI << "auto" << " ";
|
||||||
|
}
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
else if (anArgIter + 1 >= theArgNb)
|
||||||
|
{
|
||||||
|
theDI << "Syntax error at '" << theArgVec[anArgIter] << "'";
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
TCollection_AsciiString aHintStyle (theArgVec[++anArgIter]);
|
||||||
|
aHintStyle.LowerCase();
|
||||||
|
if (aHintStyle == "force")
|
||||||
|
{
|
||||||
|
aParams.FontHinting = Font_Hinting(aParams.FontHinting & ~Font_Hinting_NoAutohint);
|
||||||
|
aParams.FontHinting = Font_Hinting(aParams.FontHinting | Font_Hinting_ForceAutohint);
|
||||||
|
}
|
||||||
|
else if (aHintStyle == "disallow"
|
||||||
|
|| aHintStyle == "no")
|
||||||
|
{
|
||||||
|
aParams.FontHinting = Font_Hinting(aParams.FontHinting & ~Font_Hinting_ForceAutohint);
|
||||||
|
aParams.FontHinting = Font_Hinting(aParams.FontHinting | Font_Hinting_NoAutohint);
|
||||||
|
}
|
||||||
|
else if (aHintStyle == "auto")
|
||||||
|
{
|
||||||
|
aParams.FontHinting = Font_Hinting(aParams.FontHinting & ~Font_Hinting_ForceAutohint);
|
||||||
|
aParams.FontHinting = Font_Hinting(aParams.FontHinting & ~Font_Hinting_NoAutohint);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
theDI << "Syntax error at '" << theArgVec[anArgIter] << "'";
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
else if (aFlag == "-depthprepass")
|
else if (aFlag == "-depthprepass")
|
||||||
{
|
{
|
||||||
if (toPrint)
|
if (toPrint)
|
||||||
@ -15023,7 +15124,9 @@ void ViewerTest::ViewerCommands(Draw_Interpretor& theCommands)
|
|||||||
"\n\t\t: Should be applied taking into account GPU hardware capabilities and performance."
|
"\n\t\t: Should be applied taking into account GPU hardware capabilities and performance."
|
||||||
"\n\t\t: Common parameters:"
|
"\n\t\t: Common parameters:"
|
||||||
"\n\t\t: vrenderparams [-raster] [-shadingModel {unlit|facet|gouraud|phong|pbr|pbr_facet}=gouraud]"
|
"\n\t\t: vrenderparams [-raster] [-shadingModel {unlit|facet|gouraud|phong|pbr|pbr_facet}=gouraud]"
|
||||||
"\n\t\t: [-msaa 0..8=0] [-rendScale scale=1] [-resolution value=72]"
|
"\n\t\t: [-msaa 0..8=0] [-rendScale scale=1]"
|
||||||
|
"\n\t\t: [-resolution value=72] [-fontHinting {off|normal|light}=off]"
|
||||||
|
"\n\t\t: [-fontAutoHinting {auto|force|disallow}=auto]"
|
||||||
"\n\t\t: [-oit {off|0.0-1.0}=off]"
|
"\n\t\t: [-oit {off|0.0-1.0}=off]"
|
||||||
"\n\t\t: [-shadows {on|off}=on] [-shadowMapResolution value=1024] [-shadowMapBias value=0.005]"
|
"\n\t\t: [-shadows {on|off}=on] [-shadowMapResolution value=1024] [-shadowMapBias value=0.005]"
|
||||||
"\n\t\t: [-depthPrePass {on|off}=off] [-alphaToCoverage {on|off}=on]"
|
"\n\t\t: [-depthPrePass {on|off}=off] [-alphaToCoverage {on|off}=on]"
|
||||||
@ -15034,6 +15137,8 @@ void ViewerTest::ViewerCommands(Draw_Interpretor& theCommands)
|
|||||||
"\n\t\t: -msaa Specifies number of samples for MSAA."
|
"\n\t\t: -msaa Specifies number of samples for MSAA."
|
||||||
"\n\t\t: -rendScale Rendering resolution scale factor (supersampling, alternative to MSAA)."
|
"\n\t\t: -rendScale Rendering resolution scale factor (supersampling, alternative to MSAA)."
|
||||||
"\n\t\t: -resolution Sets new pixels density (PPI) used as text scaling factor."
|
"\n\t\t: -resolution Sets new pixels density (PPI) used as text scaling factor."
|
||||||
|
"\n\t\t: -fontHinting Enables/disables font hinting for better readability on low-resolution screens."
|
||||||
|
"\n\t\t: -fontAutoHinting Manages font autohinting."
|
||||||
"\n\t\t: -lineFeather Sets line feather factor while displaying mesh edges."
|
"\n\t\t: -lineFeather Sets line feather factor while displaying mesh edges."
|
||||||
"\n\t\t: -alphaToCoverage Enables/disables alpha to coverage (needs MSAA)."
|
"\n\t\t: -alphaToCoverage Enables/disables alpha to coverage (needs MSAA)."
|
||||||
"\n\t\t: -oit Enables/disables order-independent transparency (OIT) rendering;"
|
"\n\t\t: -oit Enables/disables order-independent transparency (OIT) rendering;"
|
||||||
|
@ -1,6 +1,5 @@
|
|||||||
puts "============"
|
puts "============"
|
||||||
puts "OCC21091"
|
puts "0024387: Draw the text with different fonts"
|
||||||
puts "OCC21450"
|
|
||||||
puts "============"
|
puts "============"
|
||||||
puts ""
|
puts ""
|
||||||
|
|
||||||
@ -69,7 +68,17 @@ vdrawtext OC20 OpenCascade -pos -200 -200 250 -color 00FF05 -halign left -vali
|
|||||||
vdrawtext OC21 OpenCascade -pos -200 -200 300 -color FF0005 -halign left -valign bottom -angle 010 -zoom 0 -height 15 -aspect regular -font monospace
|
vdrawtext OC21 OpenCascade -pos -200 -200 300 -color FF0005 -halign left -valign bottom -angle 010 -zoom 0 -height 15 -aspect regular -font monospace
|
||||||
|
|
||||||
vglinfo
|
vglinfo
|
||||||
vdump $imagedir/${casename}.png
|
vrenderparams -fontHinting normal
|
||||||
|
vbackground -color WHITE
|
||||||
|
vdump ${imagedir}/${test_image}_white_hinted.png
|
||||||
|
vbackground -color BLACK
|
||||||
|
vdump ${imagedir}/${test_image}_hinted.png
|
||||||
|
|
||||||
|
vrenderparams -fontHinting off
|
||||||
|
vbackground -color WHITE
|
||||||
|
vdump ${imagedir}/${test_image}_white.png
|
||||||
|
vbackground -color BLACK
|
||||||
|
vdump ${imagedir}/${test_image}.png
|
||||||
|
|
||||||
vsensdis
|
vsensdis
|
||||||
vdump $imagedir/${casename}_sensitive.png
|
vdump $imagedir/${casename}_sensitive.png
|
||||||
|
@ -1,10 +1,7 @@
|
|||||||
puts "============"
|
puts "============"
|
||||||
puts "OCC24387"
|
puts "0021091: Draw the text with different fonts"
|
||||||
puts "============"
|
puts "============"
|
||||||
puts ""
|
puts ""
|
||||||
#################################################
|
|
||||||
# Draw the text with different fonts.
|
|
||||||
#################################################
|
|
||||||
|
|
||||||
pload TOPTEST VISUALIZATION
|
pload TOPTEST VISUALIZATION
|
||||||
vinit View1
|
vinit View1
|
||||||
@ -67,4 +64,14 @@ vdrawtext OC20 OpenCascade -pos -200 -200 250 -color 00FF05 -halign left -valig
|
|||||||
vdrawtext OC21 OpenCascade -pos -200 -200 300 -color FF0005 -halign left -valign bottom -angle 010 -zoom 0 -height 15 -aspect regular -font Arial
|
vdrawtext OC21 OpenCascade -pos -200 -200 300 -color FF0005 -halign left -valign bottom -angle 010 -zoom 0 -height 15 -aspect regular -font Arial
|
||||||
|
|
||||||
vglinfo
|
vglinfo
|
||||||
vdump $imagedir/${casename}.png
|
vrenderparams -fontHinting normal
|
||||||
|
vbackground -color WHITE
|
||||||
|
vdump ${imagedir}/${test_image}_white_hinted.png
|
||||||
|
vbackground -color BLACK
|
||||||
|
vdump ${imagedir}/${test_image}_hinted.png
|
||||||
|
|
||||||
|
vrenderparams -fontHinting off
|
||||||
|
vbackground -color WHITE
|
||||||
|
vdump ${imagedir}/${test_image}_white.png
|
||||||
|
vbackground -color BLACK
|
||||||
|
vdump ${imagedir}/${test_image}.png
|
||||||
|
Loading…
x
Reference in New Issue
Block a user