Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit cd37119

Browse files
committed
Un-static-ify FreeType font transforms.
Static initializers are only applied the first time, so any subsequent calls with alternate hinting_factor would use the first value. FreeType copies the matrix values into an internal structure, so these do not really need to be static.
1 parent 0f4d99e commit cd37119

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

src/ft2font.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -515,7 +515,7 @@ FT2Font::FT2Font(FT_Open_Args &open_args, long hinting_factor_) : image(), face(
515515
face->face_flags |= FT_FACE_FLAG_EXTERNAL_STREAM;
516516
}
517517

518-
static FT_Matrix transform = { 65536 / hinting_factor, 0, 0, 65536 };
518+
FT_Matrix transform = { 65536 / hinting_factor, 0, 0, 65536 };
519519
FT_Set_Transform(face, &transform, 0);
520520
}
521521

@@ -548,7 +548,7 @@ void FT2Font::set_size(double ptsize, double dpi)
548548
{
549549
int error = FT_Set_Char_Size(
550550
face, (long)(ptsize * 64), 0, (unsigned int)(dpi * hinting_factor), (unsigned int)dpi);
551-
static FT_Matrix transform = { 65536 / hinting_factor, 0, 0, 65536 };
551+
FT_Matrix transform = { 65536 / hinting_factor, 0, 0, 65536 };
552552
FT_Set_Transform(face, &transform, 0);
553553

554554
if (error) {

0 commit comments

Comments
 (0)