blob: 76626b30b18cdbb54a41a484dc6f40699e781b92 [file] [log] [blame]
kumarashishg826308d2023-06-23 13:21:22 +00001// Copyright 2019 The PDFium Authors
Haibo Huang49cc9302020-04-27 16:14:24 -07002// 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
11namespace {
12
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
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
30ScopedFontTransform::~ScopedFontTransform() {
31 ResetTransform(m_Face->GetRec());
32}