diff options
author | Nicolas Pena <npm@chromium.org> | 2017-05-26 14:38:03 -0400 |
---|---|---|
committer | Chromium commit bot <commit-bot@chromium.org> | 2017-05-26 18:52:27 +0000 |
commit | 169b30187bf5798a6106b5ab16288c9d86861f8b (patch) | |
tree | 19aa282b55c43eda4f8ebf1a8fd70acf6296aad0 /core/fpdfapi/font/cpdf_font.cpp | |
parent | f677e18c985646c4ae1c5ec36445cdbf6bf78a6a (diff) | |
download | pdfium-169b30187bf5798a6106b5ab16288c9d86861f8b.tar.xz |
Use proper file names in core/fpdfapi/font
This CL splits up font_int.h into files by classes. It also renames the
unittests to match the class being tested. Finally, it renames the ttgsubtable
files to match the class name.
Change-Id: I6187caa9e82d12b9a66e955113fe327d52042ae0
Reviewed-on: https://pdfium-review.googlesource.com/6090
Reviewed-by: Tom Sepez <tsepez@chromium.org>
Commit-Queue: Nicolás Peña <npm@chromium.org>
Diffstat (limited to 'core/fpdfapi/font/cpdf_font.cpp')
-rw-r--r-- | core/fpdfapi/font/cpdf_font.cpp | 25 |
1 files changed, 24 insertions, 1 deletions
diff --git a/core/fpdfapi/font/cpdf_font.cpp b/core/fpdfapi/font/cpdf_font.cpp index 1a7fb60b0b..1faa4ec4be 100644 --- a/core/fpdfapi/font/cpdf_font.cpp +++ b/core/fpdfapi/font/cpdf_font.cpp @@ -15,7 +15,6 @@ #include "core/fpdfapi/font/cpdf_truetypefont.h" #include "core/fpdfapi/font/cpdf_type1font.h" #include "core/fpdfapi/font/cpdf_type3font.h" -#include "core/fpdfapi/font/font_int.h" #include "core/fpdfapi/page/cpdf_docpagedata.h" #include "core/fpdfapi/page/cpdf_pagemodule.h" #include "core/fpdfapi/parser/cpdf_array.h" @@ -477,3 +476,27 @@ CFX_Font* CPDF_Font::GetFontFallback(int position) { return nullptr; return m_FontFallbacks[position].get(); } + +// static +int CPDF_Font::TT2PDF(int m, FXFT_Face face) { + int upm = FXFT_Get_Face_UnitsPerEM(face); + if (upm == 0) + return m; + return pdfium::base::checked_cast<int>( + (static_cast<double>(m) * 1000 + upm / 2) / upm); +} + +// static +bool CPDF_Font::FT_UseTTCharmap(FXFT_Face face, + int platform_id, + int encoding_id) { + auto** pCharMap = FXFT_Get_Face_Charmaps(face); + for (int i = 0; i < FXFT_Get_Face_CharmapCount(face); i++) { + if (FXFT_Get_Charmap_PlatformID(pCharMap[i]) == platform_id && + FXFT_Get_Charmap_EncodingID(pCharMap[i]) == encoding_id) { + FXFT_Set_Charmap(face, pCharMap[i]); + return true; + } + } + return false; +} |