xref: /aosp_15_r20/external/pdfium/core/fxge/scoped_font_transform.h (revision 3ac0a46f773bac49fa9476ec2b1cf3f8da5ec3a4)
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 #ifndef CORE_FXGE_SCOPED_FONT_TRANSFORM_H_
8 #define CORE_FXGE_SCOPED_FONT_TRANSFORM_H_
9 
10 #include "core/fxcrt/fx_memory.h"
11 #include "core/fxcrt/retain_ptr.h"
12 #include "core/fxge/cfx_face.h"
13 #include "core/fxge/freetype/fx_freetype.h"
14 
15 // Sets the given transform on the font, and resets it to the identity when it
16 // goes out of scope.
17 class ScopedFontTransform {
18  public:
19   FX_STACK_ALLOCATED();
20 
21   ScopedFontTransform(RetainPtr<CFX_Face> face, FT_Matrix* matrix);
22   ~ScopedFontTransform();
23 
24  private:
25   RetainPtr<CFX_Face> m_Face;
26 };
27 
28 #endif  // CORE_FXGE_SCOPED_FONT_TRANSFORM_H_
29