{
// Get width and height of text
Handle(Prs3d_TextAspect) anAsp = myDrawer->TextAspect();
+ const Graphic3d_RenderingParams& aRendParams = GetContext()->CurrentViewer()->DefaultRenderingParams();
Font_FTFontParams aFontParams;
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(),
anAsp->Aspect()->GetTextFontAspect(),
Font_FTFont.hxx
Font_FTLibrary.cxx
Font_FTLibrary.hxx
+Font_Hinting.hxx
Font_NameOfFont.hxx
Font_NListOfSystemFont.hxx
Font_Rect.hxx
myBuffer = theData;
myFontPath = theFileName;
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())
{
Message::SendTrace ("FreeType library is unavailable");
#ifdef HAVE_FREETYPE
FT_Vector aKern;
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
(void )theUCharNext;
return 0.0f;
#define _Font_FTFont_H__
#include <Font_FontAspect.hxx>
+#include <Font_Hinting.hxx>
#include <Font_Rect.hxx>
#include <Font_StrictLevel.hxx>
#include <Font_UnicodeSubset.hxx>
{
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()
+ 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 IsSingleStrokeFont; //!< single-stroke (one-line) font, FALSE by default
//! 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.
Font_FTFontParams (unsigned int thePointSize,
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)
//! Initialize fallback font.
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:
Handle(Font_FTLibrary) myFTLib; //!< handle to the FT library object
--- /dev/null
+// 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
#ifndef _Graphic3d_RenderingParams_HeaderFile
#define _Graphic3d_RenderingParams_HeaderFile
+#include <Font_Hinting.hxx>
#include <Graphic3d_AspectText3d.hxx>
#include <Graphic3d_TransformPers.hxx>
#include <Graphic3d_RenderTransparentMethod.hxx>
: Method (Graphic3d_RM_RASTERIZATION),
ShadingModel (Graphic3d_TOSM_FRAGMENT),
TransparencyMethod (Graphic3d_RTM_BLEND_UNORDERED),
+ Resolution (THE_DEFAULT_RESOLUTION),
+ FontHinting (Font_Hinting_Off),
LineFeather (1.0f),
// PBR parameters
PbrEnvPow2Size (9),
StatsNbFrames (1),
StatsMaxChartTime (0.1f),
CollectedStats (PerfCounters_Basic),
- ToShowStats (Standard_False),
- //
- Resolution (THE_DEFAULT_RESOLUTION)
+ ToShowStats (Standard_False)
{
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));
{
return Resolution / static_cast<Standard_ShortReal> (THE_DEFAULT_RESOLUTION);
}
-
+
//! Dumps the content of me into the stream
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_TypeOfShadingModel ShadingModel; //!< specified default shading model, Graphic3d_TOSM_FRAGMENT by default
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
+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 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_Boolean ToEnableDepthPrepass; //!< enables/disables depth pre-pass, False 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_Integer SamplesPerPixel; //!< number of samples per pixel (SPP)
Standard_Integer RaytracingDepth; //!< maximum ray-tracing depth, 3 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
+public: //! @name VR / stereoscopic parameters
+
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;
Anaglyph AnaglyphFilter; //!< filter for anaglyph output, Anaglyph_RedCyan_Optimized 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
+public: //! @name on-screen display parameters
+
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
Graphic3d_Vec2i ChartSize; //!< chart size in pixels, (-1, -1) by default which means that chart will occupy a portion of viewport
//! 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)
- 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
OpenGl_Aspects aTextAspect;
TCollection_ExtendedString anExtText = theText;
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);
}
//=======================================================================
const OpenGl_Aspects& theTextAspect,
const Standard_ShortReal theHeight,
const unsigned int theResolution,
+ const Font_Hinting theFontHinting,
Standard_ShortReal& theWidth,
Standard_ShortReal& theAscent,
Standard_ShortReal& theDescent)
theWidth = 0.0f;
theAscent = 0.0f;
theDescent = 0.0f;
- const TCollection_AsciiString aFontKey = FontKey (theTextAspect, (Standard_Integer)theHeight, theResolution);
- Handle(OpenGl_Font) aFont = FindFont (theCtx, theTextAspect, (Standard_Integer)theHeight, theResolution, aFontKey);
+ const TCollection_AsciiString aFontKey = FontKey (theTextAspect, (Standard_Integer)theHeight, theResolution, theFontHinting);
+ Handle(OpenGl_Font) aFont = FindFont (theCtx, theTextAspect, (Standard_Integer)theHeight, theResolution, theFontHinting, aFontKey);
if (aFont.IsNull() || !aFont->IsValid())
{
return;
*aTextAspect,
theWorkspace->TextColor(),
theWorkspace->TextSubtitleColor(),
- aCtx->Resolution());
+ aCtx->Resolution(),
+ theWorkspace->View()->RenderingParams().FontHinting);
// restore aspects
if (!aPrevTexture.IsNull())
// =======================================================================
void OpenGl_Text::Render (const Handle(OpenGl_Context)& theCtx,
const OpenGl_Aspects& theTextAspect,
- unsigned int theResolution) const
+ unsigned int theResolution,
+ Font_Hinting theFontHinting) const
{
#if !defined(GL_ES_VERSION_2_0)
const Standard_Integer aPrevPolygonMode = theCtx->SetPolygonMode (GL_FILL);
render (theCtx, theTextAspect,
theTextAspect.Aspect()->ColorRGBA(),
theTextAspect.Aspect()->ColorSubTitleRGBA(),
- theResolution);
+ theResolution,
+ theFontHinting);
#if !defined(GL_ES_VERSION_2_0)
theCtx->SetPolygonMode (aPrevPolygonMode);
// =======================================================================
TCollection_AsciiString OpenGl_Text::FontKey (const OpenGl_Aspects& theAspect,
Standard_Integer theHeight,
- unsigned int theResolution)
+ unsigned int theResolution,
+ Font_Hinting theFontHinting)
{
const Font_FontAspect anAspect = theAspect.Aspect()->TextFontAspect() != Font_FA_Undefined
? theAspect.Aspect()->TextFontAspect()
: Font_FA_Regular;
const TCollection_AsciiString& aFont = !theAspect.Aspect()->TextFont().IsNull() ? theAspect.Aspect()->TextFont()->String() : THE_DEFAULT_FONT;
- return aFont
- + TCollection_AsciiString(":") + Standard_Integer(anAspect)
- + TCollection_AsciiString(":") + Standard_Integer(theResolution)
- + TCollection_AsciiString(":") + theHeight;
+
+ char aSuff[64];
+ Sprintf (aSuff, ":%d:%d:%d:%d",
+ Standard_Integer(anAspect),
+ Standard_Integer(theResolution),
+ theHeight,
+ Standard_Integer(theFontHinting));
+ return aFont + aSuff;
}
// =======================================================================
const OpenGl_Aspects& theAspect,
Standard_Integer theHeight,
unsigned int theResolution,
+ Font_Hinting theFontHinting,
const TCollection_AsciiString& theKey)
{
Handle(OpenGl_Font) aFont;
Font_FTFontParams aParams;
aParams.PointSize = theHeight;
aParams.Resolution = theResolution;
+ aParams.FontHinting = theFontHinting;
if (Handle(Font_FTFont) aFontFt = Font_FTFont::FindAndCreate (aFontName, anAspect, aParams, Font_StrictLevel_Any))
{
aFont = new OpenGl_Font (aFontFt, theKey);
const OpenGl_Aspects& theTextAspect,
const OpenGl_Vec4& theColorText,
const OpenGl_Vec4& theColorSubs,
- unsigned int theResolution) const
+ unsigned int theResolution,
+ Font_Hinting theFontHinting) const
{
if (myText->Text().IsEmpty() && myText->TextFormatter().IsNull())
{
// Note that using difference resolution in different Views in same Viewer
// 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()
&& !myFont->ResourceKey().IsEqual (aFontKey))
{
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()
|| !myFont->WasInitialized())
//! Create key for shared resource
Standard_EXPORT static TCollection_AsciiString FontKey (const OpenGl_Aspects& theAspect,
Standard_Integer theHeight,
- unsigned int theResolution);
+ unsigned int theResolution,
+ Font_Hinting theFontHinting);
//! Find shared resource for specified font or initialize new one
Standard_EXPORT static Handle(OpenGl_Font) FindFont (const Handle(OpenGl_Context)& theCtx,
const OpenGl_Aspects& theAspect,
Standard_Integer theHeight,
unsigned int theResolution,
+ Font_Hinting theFontHinting,
const TCollection_AsciiString& theKey);
//! Compute text width
const OpenGl_Aspects& theTextAspect,
const Standard_ShortReal theHeight,
const unsigned int theResolution,
+ const Font_Hinting theFontHinting,
Standard_ShortReal& theWidth,
Standard_ShortReal& theAscent,
Standard_ShortReal& theDescent);
//! Perform rendering
Standard_EXPORT void Render (const Handle(OpenGl_Context)& theCtx,
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
Standard_EXPORT virtual void DumpJson (Standard_OStream& theOStream, Standard_Integer theDepth = -1) const Standard_OVERRIDE;
const OpenGl_Aspects& theTextAspect,
const OpenGl_Vec4& theColorText,
const OpenGl_Vec4& theColorSubs,
- unsigned int theResolution) const;
+ unsigned int theResolution,
+ Font_Hinting theFontHinting) const;
protected:
#include <PrsDim.hxx>
#include <PrsDim_DimensionOwner.hxx>
#include <Adaptor3d_Curve.hxx>
+#include <AIS_InteractiveContext.hxx>
#include <BRepAdaptor_Curve.hxx>
#include <BRepAdaptor_Surface.hxx>
#include <BRepBndLib.hxx>
#include <TopoDS.hxx>
#include <TopoDS_Edge.hxx>
#include <TopoDS_Vertex.hxx>
+#include <V3d_Viewer.hxx>
#include <Units.hxx>
#include <Units_UnitsDictionary.hxx>
#include <UnitsAPI.hxx>
// default text margin and resolution
static const Standard_Real THE_3D_TEXT_MARGIN = 0.1;
- static const unsigned int THE_2D_TEXT_RESOLUTION = 72;
// default selection priorities
static const Standard_Integer THE_NEUTRAL_SEL_PRIORITY = 5;
{
// Text width for 1:1 scale 2D case
Font_FTFontParams aFontParams;
+ const Graphic3d_RenderingParams& aRendParams = GetContext()->CurrentViewer()->DefaultRenderingParams();
aFontParams.PointSize = (unsigned int )aTextAspect->Height();
- aFontParams.Resolution = THE_2D_TEXT_RESOLUTION;
- if (Handle(Font_FTFont) aFont = Font_FTFont::FindAndCreate (aTextAspect->Aspect()->Font(), aTextAspect->Aspect()->GetTextFontAspect(), aFontParams, Font_StrictLevel_Any))
+ aFontParams.Resolution = aRendParams.Resolution;
+ 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; )
{
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")
{
if (toPrint)
"\n\t\t: Should be applied taking into account GPU hardware capabilities and performance."
"\n\t\t: Common parameters:"
"\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: [-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: -msaa Specifies number of samples for 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: -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: -alphaToCoverage Enables/disables alpha to coverage (needs MSAA)."
"\n\t\t: -oit Enables/disables order-independent transparency (OIT) rendering;"
puts "============"
-puts "OCC21091"
-puts "OCC21450"
+puts "0024387: Draw the text with different fonts"
puts "============"
puts ""
vdrawtext OC17 OpenCascade -pos -200 -200 100 -color MAGENTA -halign left -valign bottom -angle 010 -zoom 0 -height 15 -aspect regular -font sans-serif
vdrawtext OC18 OpenCascade -pos -200 -200 150 -color CYAN -halign left -valign bottom -angle 010 -zoom 0 -height 15 -aspect regular -font serif
-vdrawtext OC19 OpenCascade -pos -200 -200 200 -color YELLOW -halign left -valign bottom -angle 010 -zoom 0 -height 15 -aspect italic -font serif
-vdrawtext OC20 OpenCascade -pos -200 -200 250 -color 00FF05 -halign left -valign bottom -angle 010 -zoom 0 -height 15 -aspect bolditalic -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
+vdrawtext OC19 OpenCascade -pos -200 -200 200 -color YELLOW -halign left -valign bottom -angle 010 -zoom 0 -height 15 -aspect italic -font serif
+vdrawtext OC20 OpenCascade -pos -200 -200 250 -color 00FF05 -halign left -valign bottom -angle 010 -zoom 0 -height 15 -aspect bolditalic -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
-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
vdump $imagedir/${casename}_sensitive.png
puts "============"
-puts "OCC24387"
+puts "0021091: Draw the text with different fonts"
puts "============"
puts ""
-#################################################
-# Draw the text with different fonts.
-#################################################
pload TOPTEST VISUALIZATION
vinit View1
vdrawtext OC21 OpenCascade -pos -200 -200 300 -color FF0005 -halign left -valign bottom -angle 010 -zoom 0 -height 15 -aspect regular -font Arial
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