1 // Copyright 2019 The PDFium Authors 2 // Use of this source code is governed by a BSD-style license that can be 3 // found in the LICENSE file. 4 5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com 6 7 #include "core/fxge/scoped_font_transform.h" 8 9 #include <utility> 10 11 namespace { 12 ResetTransform(FT_Face face)13void ResetTransform(FT_Face face) { 14 FT_Matrix matrix; 15 matrix.xx = 0x10000L; 16 matrix.xy = 0; 17 matrix.yx = 0; 18 matrix.yy = 0x10000L; 19 FT_Set_Transform(face, &matrix, 0); 20 } 21 22 } // namespace 23 ScopedFontTransform(RetainPtr<CFX_Face> face,FT_Matrix * matrix)24ScopedFontTransform::ScopedFontTransform(RetainPtr<CFX_Face> face, 25 FT_Matrix* matrix) 26 : m_Face(std::move(face)) { 27 FT_Set_Transform(m_Face->GetRec(), matrix, 0); 28 } 29 ~ScopedFontTransform()30ScopedFontTransform::~ScopedFontTransform() { 31 ResetTransform(m_Face->GetRec()); 32 } 33