Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(833)

Side by Side Diff: core/fxge/ge/cfx_unicodeencoding.cpp

Issue 2260533002: Refactor fx_font part 2 (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@master
Patch Set: Created 4 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(Empty)
1 // Copyright 2016 PDFium Authors. All rights reserved.
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/include/cfx_unicodeencoding.h"
8
9 #include "core/fxge/include/fx_font.h"
10 #include "core/fxge/include/fx_freetype.h"
11
12 CFX_UnicodeEncoding::CFX_UnicodeEncoding(CFX_Font* pFont) : m_pFont(pFont) {}
13
14 CFX_UnicodeEncoding::~CFX_UnicodeEncoding() {}
15
16 uint32_t CFX_UnicodeEncoding::GlyphFromCharCode(uint32_t charcode) {
17 FXFT_Face face = m_pFont->GetFace();
18 if (!face)
19 return charcode;
20
21 if (FXFT_Select_Charmap(face, FXFT_ENCODING_UNICODE) == 0)
22 return FXFT_Get_Char_Index(face, charcode);
23
24 if (m_pFont->GetSubstFont() &&
25 m_pFont->GetSubstFont()->m_Charset == FXFONT_SYMBOL_CHARSET) {
26 uint32_t index = 0;
27 if (FXFT_Select_Charmap(face, FXFT_ENCODING_MS_SYMBOL) == 0)
28 index = FXFT_Get_Char_Index(face, charcode);
29 if (!index && !FXFT_Select_Charmap(face, FXFT_ENCODING_APPLE_ROMAN))
30 return FXFT_Get_Char_Index(face, charcode);
31 }
32 return charcode;
33 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698