mirror of
https://git.dev.opencascade.org/repos/occt.git
synced 2025-04-16 10:08:36 +03:00
0024555: Visualization - the same text is rendered with shift at second time
Font_FTFont::loadGlyph() - use the same flags as RenderGlyph(), FT_LOAD_NO_HINTING has been missed. Test cases for issue CR24555
This commit is contained in:
parent
f1b811561b
commit
f5600b5c5f
@ -29,6 +29,7 @@ Font_FTFont::Font_FTFont (const Handle(Font_FTLibrary)& theFTLib)
|
|||||||
: myFTLib (theFTLib),
|
: myFTLib (theFTLib),
|
||||||
myFTFace (NULL),
|
myFTFace (NULL),
|
||||||
myPointSize (0),
|
myPointSize (0),
|
||||||
|
myLoadFlags (FT_LOAD_NO_HINTING | FT_LOAD_TARGET_NORMAL),
|
||||||
myUChar (0)
|
myUChar (0)
|
||||||
{
|
{
|
||||||
if (myFTLib.IsNull())
|
if (myFTLib.IsNull())
|
||||||
@ -131,7 +132,7 @@ bool Font_FTFont::loadGlyph (const Standard_Utf32Char theUChar)
|
|||||||
myGlyphImg.Clear();
|
myGlyphImg.Clear();
|
||||||
myUChar = 0;
|
myUChar = 0;
|
||||||
if (theUChar == 0
|
if (theUChar == 0
|
||||||
|| FT_Load_Char (myFTFace, theUChar, FT_LOAD_TARGET_NORMAL) != 0
|
|| FT_Load_Char (myFTFace, theUChar, myLoadFlags) != 0
|
||||||
|| myFTFace->glyph == NULL)
|
|| myFTFace->glyph == NULL)
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
@ -150,7 +151,7 @@ bool Font_FTFont::RenderGlyph (const Standard_Utf32Char theUChar)
|
|||||||
myGlyphImg.Clear();
|
myGlyphImg.Clear();
|
||||||
myUChar = 0;
|
myUChar = 0;
|
||||||
if (theUChar == 0
|
if (theUChar == 0
|
||||||
|| FT_Load_Char (myFTFace, theUChar, FT_LOAD_RENDER | FT_LOAD_NO_HINTING | FT_LOAD_TARGET_NORMAL) != 0
|
|| FT_Load_Char (myFTFace, theUChar, myLoadFlags | FT_LOAD_RENDER) != 0
|
||||||
|| myFTFace->glyph == NULL
|
|| myFTFace->glyph == NULL
|
||||||
|| myFTFace->glyph->format != FT_GLYPH_FORMAT_BITMAP)
|
|| myFTFace->glyph->format != FT_GLYPH_FORMAT_BITMAP)
|
||||||
{
|
{
|
||||||
|
@ -205,6 +205,7 @@ protected:
|
|||||||
FT_Face myFTFace; //!< FT face object
|
FT_Face myFTFace; //!< FT face object
|
||||||
NCollection_String myFontPath; //!< font path
|
NCollection_String myFontPath; //!< font path
|
||||||
unsigned int myPointSize; //!< point size set by FT_Set_Char_Size
|
unsigned int myPointSize; //!< point size set by FT_Set_Char_Size
|
||||||
|
FT_Int32 myLoadFlags; //!< default load flags
|
||||||
|
|
||||||
Image_PixMap myGlyphImg; //!< cached glyph plane
|
Image_PixMap myGlyphImg; //!< cached glyph plane
|
||||||
FT_Vector myKernAdvance; //!< buffer variable
|
FT_Vector myKernAdvance; //!< buffer variable
|
||||||
|
36
tests/bugs/vis/bug24555
Executable file
36
tests/bugs/vis/bug24555
Executable file
@ -0,0 +1,36 @@
|
|||||||
|
puts "============"
|
||||||
|
puts "OCC24555"
|
||||||
|
puts "============"
|
||||||
|
puts ""
|
||||||
|
#######################################################################
|
||||||
|
# Visualization - the same text is rendered with shift at second time
|
||||||
|
#######################################################################
|
||||||
|
|
||||||
|
vinit
|
||||||
|
vclear
|
||||||
|
vaxo
|
||||||
|
vdrawtext "This program" 0 0 0 0 255 0 0 0 0 0 50 1 Arial
|
||||||
|
|
||||||
|
vdrawtext "This program" 0 0 0 255 0 0 0 0 0 0 50 1 Arial
|
||||||
|
|
||||||
|
set x 346
|
||||||
|
set y 190
|
||||||
|
|
||||||
|
set R 0
|
||||||
|
set G 0.9843137264251709
|
||||||
|
set B 0
|
||||||
|
|
||||||
|
decho off
|
||||||
|
set catch_status 0
|
||||||
|
if { [catch {QAGetPixelColor $x $y $R $G $B} catch_result] } {
|
||||||
|
set catch_status 1
|
||||||
|
}
|
||||||
|
decho on
|
||||||
|
|
||||||
|
if {${catch_status} == 0} {
|
||||||
|
puts "Error : color is bad"
|
||||||
|
} else {
|
||||||
|
puts "OK : color is good"
|
||||||
|
}
|
||||||
|
|
||||||
|
set only_screen 1
|
Loading…
x
Reference in New Issue
Block a user