Qt
Internal/Contributor docs for the Qt SDK. Note: These are NOT official API docs; those are found at https://doc.qt.io/
Loading...
Searching...
No Matches
cfx_stockfontarray.cpp
Go to the documentation of this file.
1// Copyright 2017 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/fpdfapi/font/cfx_stockfontarray.h"
8
9#include <iterator>
10#include <utility>
11
12#include "core/fpdfapi/font/cpdf_font.h"
13#include "core/fpdfapi/parser/cpdf_dictionary.h"
14#include "third_party/base/check_op.h"
15
17
19 for (size_t i = 0; i < std::size(m_StockFonts); ++i) {
20 if (m_StockFonts[i]) {
21 // Ensure m_StockFonts[i]'s dict is cleared before releasing what
22 // may be the last reference to it.
23 RetainPtr<CPDF_Dictionary> destroy =
24 m_StockFonts[i]->GetMutableFontDict();
25 m_StockFonts[i]->ClearFontDict();
26 }
27 }
28}
29
31 CFX_FontMapper::StandardFont index) const {
32 CHECK_LT(index, std::size(m_StockFonts));
33 return m_StockFonts[index];
34}
35
37 RetainPtr<CPDF_Font> pFont) {
38 if (index < std::size(m_StockFonts))
39 m_StockFonts[index] = std::move(pFont);
40}
void SetFont(CFX_FontMapper::StandardFont index, RetainPtr< CPDF_Font > pFont)
RetainPtr< CPDF_Font > GetFont(CFX_FontMapper::StandardFont index) const