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

Side by Side Diff: core/fpdfapi/fpdf_font/fpdf_font_cid.cpp

Issue 1828673002: Fix build on win/clang (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@master
Patch Set: Created 4 years, 9 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 PDFium Authors. All rights reserved. 1 // Copyright 2014 PDFium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com 5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
6 6
7 #include "core/fpdfapi/fpdf_font/font_int.h" 7 #include "core/fpdfapi/fpdf_font/font_int.h"
8 8
9 #include "core/fpdfapi/fpdf_cmaps/cmap_int.h" 9 #include "core/fpdfapi/fpdf_cmaps/cmap_int.h"
10 #include "core/fpdfapi/fpdf_font/ttgsubtable.h" 10 #include "core/fpdfapi/fpdf_font/ttgsubtable.h"
(...skipping 280 matching lines...) Expand 10 before | Expand all | Expand 10 after
291 case CIDSET_JAPAN1: 291 case CIDSET_JAPAN1:
292 case CIDSET_KOREA1: 292 case CIDSET_KOREA1:
293 return true; 293 return true;
294 294
295 default: 295 default:
296 return false; 296 return false;
297 } 297 }
298 } 298 }
299 299
300 #if _FXM_PLATFORM_ != _FXM_PLATFORM_WINDOWS_ 300 #if _FXM_PLATFORM_ != _FXM_PLATFORM_WINDOWS_
301
301 FX_DWORD EmbeddedCharcodeFromUnicode(const FXCMAP_CMap* pEmbedMap, 302 FX_DWORD EmbeddedCharcodeFromUnicode(const FXCMAP_CMap* pEmbedMap,
302 CIDSet charset, 303 CIDSet charset,
303 FX_WCHAR unicode) { 304 FX_WCHAR unicode) {
304 if (!IsValidEmbeddedCharcodeFromUnicodeCharset(charset)) 305 if (!IsValidEmbeddedCharcodeFromUnicodeCharset(charset))
305 return 0; 306 return 0;
306 307
307 CPDF_FontGlobals* pFontGlobals = 308 CPDF_FontGlobals* pFontGlobals =
308 CPDF_ModuleMgr::Get()->GetPageModule()->GetFontGlobals(); 309 CPDF_ModuleMgr::Get()->GetPageModule()->GetFontGlobals();
309 const uint16_t* pCodes = pFontGlobals->m_EmbeddedToUnicodes[charset].m_pMap; 310 const uint16_t* pCodes = pFontGlobals->m_EmbeddedToUnicodes[charset].m_pMap;
310 if (!pCodes) 311 if (!pCodes)
311 return 0; 312 return 0;
312 313
313 int nCodes = pFontGlobals->m_EmbeddedToUnicodes[charset].m_Count; 314 int nCodes = pFontGlobals->m_EmbeddedToUnicodes[charset].m_Count;
314 for (int i = 0; i < nCodes; ++i) { 315 for (int i = 0; i < nCodes; ++i) {
315 if (pCodes[i] == unicode) { 316 if (pCodes[i] == unicode) {
316 FX_DWORD CharCode = FPDFAPI_CharCodeFromCID(pEmbedMap, i); 317 FX_DWORD CharCode = FPDFAPI_CharCodeFromCID(pEmbedMap, i);
317 if (CharCode != 0) { 318 if (CharCode != 0) {
318 return CharCode; 319 return CharCode;
319 } 320 }
320 } 321 }
321 } 322 }
322 return 0; 323 return 0;
323 } 324 }
324 #endif // _FXM_PLATFORM_ != _FXM_PLATFORM_WINDOWS_
325 325
326 FX_WCHAR EmbeddedUnicodeFromCharcode(const FXCMAP_CMap* pEmbedMap, 326 FX_WCHAR EmbeddedUnicodeFromCharcode(const FXCMAP_CMap* pEmbedMap,
327 CIDSet charset, 327 CIDSet charset,
328 FX_DWORD charcode) { 328 FX_DWORD charcode) {
329 if (!IsValidEmbeddedCharcodeFromUnicodeCharset(charset)) 329 if (!IsValidEmbeddedCharcodeFromUnicodeCharset(charset))
330 return 0; 330 return 0;
331 331
332 uint16_t cid = FPDFAPI_CIDFromCharCode(pEmbedMap, charcode); 332 uint16_t cid = FPDFAPI_CIDFromCharCode(pEmbedMap, charcode);
333 if (cid == 0) 333 if (cid == 0)
334 return 0; 334 return 0;
335 335
336 CPDF_FontGlobals* pFontGlobals = 336 CPDF_FontGlobals* pFontGlobals =
337 CPDF_ModuleMgr::Get()->GetPageModule()->GetFontGlobals(); 337 CPDF_ModuleMgr::Get()->GetPageModule()->GetFontGlobals();
338 const uint16_t* pCodes = pFontGlobals->m_EmbeddedToUnicodes[charset].m_pMap; 338 const uint16_t* pCodes = pFontGlobals->m_EmbeddedToUnicodes[charset].m_pMap;
339 if (!pCodes) 339 if (!pCodes)
340 return 0; 340 return 0;
341 341
342 if (cid < pFontGlobals->m_EmbeddedToUnicodes[charset].m_Count) 342 if (cid < pFontGlobals->m_EmbeddedToUnicodes[charset].m_Count)
343 return pCodes[cid]; 343 return pCodes[cid];
344 return 0; 344 return 0;
345 } 345 }
346 346
347 #endif // _FXM_PLATFORM_ != _FXM_PLATFORM_WINDOWS_
348
347 void FT_UseCIDCharmap(FXFT_Face face, int coding) { 349 void FT_UseCIDCharmap(FXFT_Face face, int coding) {
348 int encoding; 350 int encoding;
349 switch (coding) { 351 switch (coding) {
350 case CIDCODING_GB: 352 case CIDCODING_GB:
351 encoding = FXFT_ENCODING_GB2312; 353 encoding = FXFT_ENCODING_GB2312;
352 break; 354 break;
353 case CIDCODING_BIG5: 355 case CIDCODING_BIG5:
354 encoding = FXFT_ENCODING_BIG5; 356 encoding = FXFT_ENCODING_BIG5;
355 break; 357 break;
356 case CIDCODING_JIS: 358 case CIDCODING_JIS:
(...skipping 1312 matching lines...) Expand 10 before | Expand all | Expand 10 after
1669 1671
1670 const uint8_t* CPDF_CIDFont::GetCIDTransform(uint16_t CID) const { 1672 const uint8_t* CPDF_CIDFont::GetCIDTransform(uint16_t CID) const {
1671 if (m_Charset != CIDSET_JAPAN1 || m_pFontFile) 1673 if (m_Charset != CIDSET_JAPAN1 || m_pFontFile)
1672 return nullptr; 1674 return nullptr;
1673 1675
1674 const struct CIDTransform* found = (const struct CIDTransform*)FXSYS_bsearch( 1676 const struct CIDTransform* found = (const struct CIDTransform*)FXSYS_bsearch(
1675 &CID, g_Japan1_VertCIDs, FX_ArraySize(g_Japan1_VertCIDs), 1677 &CID, g_Japan1_VertCIDs, FX_ArraySize(g_Japan1_VertCIDs),
1676 sizeof(g_Japan1_VertCIDs[0]), CompareCIDTransform); 1678 sizeof(g_Japan1_VertCIDs[0]), CompareCIDTransform);
1677 return found ? &found->a : nullptr; 1679 return found ? &found->a : nullptr;
1678 } 1680 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698