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_unicodeencoding.cpp
Go to the documentation of this file.
1// Copyright 2016 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/cfx_unicodeencoding.h"
8
9#include "core/fxcrt/fx_codepage.h"
10#include "core/fxge/cfx_font.h"
11#include "core/fxge/cfx_substfont.h"
12#include "core/fxge/fx_font.h"
13#include "core/fxge/fx_fontencoding.h"
14
17
19
20uint32_t CFX_UnicodeEncoding::GlyphFromCharCode(uint32_t charcode) {
21 RetainPtr<CFX_Face> face = m_pFont->GetFace();
22 if (!face)
23 return charcode;
24
25 if (face->SelectCharMap(fxge::FontEncoding::kUnicode)) {
26 return face->GetCharIndex(charcode);
27 }
28
29 if (m_pFont->GetSubstFont() &&
30 m_pFont->GetSubstFont()->m_Charset == FX_Charset::kSymbol) {
31 uint32_t index = 0;
32 if (face->SelectCharMap(fxge::FontEncoding::kSymbol)) {
33 index = face->GetCharIndex(charcode);
34 }
35 if (!index && face->SelectCharMap(fxge::FontEncoding::kAppleRoman)) {
36 return face->GetCharIndex(charcode);
37 }
38 }
39 return charcode;
40}
virtual uint32_t GlyphFromCharCode(uint32_t charcode)
CFX_UnicodeEncoding(const CFX_Font *pFont)
virtual ~CFX_UnicodeEncoding()