From: kgv Date: Wed, 14 Apr 2021 11:10:40 +0000 (+0300) Subject: 0031678: Visualization - add option enabling hinting for textured fonts X-Git-Url: http://git.dev.opencascade.org/gitweb/?a=commitdiff_plain;h=c03d23a788fade033d64c2664d7c480b8cba0458;p=occt-copy.git 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. (cherry picked from commit d37aef5ccf1bcbf0f3b11f45d3a6d73ad29ecde4) # Conflicts: # src/Font/Font_FTFont.cxx # src/PrsDim/PrsDim_Dimension.cxx # tests/opengl/data/text/A2 # tests/opengl/data/text/A8 # Conflicts: # src/Font/Font_FTFont.cxx # src/PrsDim/PrsDim_Dimension.cxx --- diff --git a/src/ViewerTest/ViewerTest_ViewerCommands.cxx b/src/ViewerTest/ViewerTest_ViewerCommands.cxx index 19741a1280..a82e876282 100644 --- a/src/ViewerTest/ViewerTest_ViewerCommands.cxx +++ b/src/ViewerTest/ViewerTest_ViewerCommands.cxx @@ -11745,6 +11745,107 @@ static Standard_Integer VRenderParams (Draw_Interpretor& theDI, 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)