OLD | NEW |
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_render/render_int.h" | 7 #include "core/fpdfapi/fpdf_render/render_int.h" |
8 | 8 |
9 #include "core/fpdfapi/fpdf_font/cpdf_cidfont.h" | 9 #include "core/fpdfapi/fpdf_font/cpdf_cidfont.h" |
10 #include "core/fpdfapi/fpdf_font/cpdf_type3char.h" | 10 #include "core/fpdfapi/fpdf_font/cpdf_type3char.h" |
(...skipping 11 matching lines...) Expand all Loading... |
22 #include "core/fpdfapi/fpdf_render/include/cpdf_renderoptions.h" | 22 #include "core/fpdfapi/fpdf_render/include/cpdf_renderoptions.h" |
23 #include "core/fpdfapi/fpdf_render/include/cpdf_textrenderer.h" | 23 #include "core/fpdfapi/fpdf_render/include/cpdf_textrenderer.h" |
24 #include "core/include/fxge/fx_ge.h" | 24 #include "core/include/fxge/fx_ge.h" |
25 | 25 |
26 CPDF_Type3Cache::~CPDF_Type3Cache() { | 26 CPDF_Type3Cache::~CPDF_Type3Cache() { |
27 for (const auto& pair : m_SizeMap) { | 27 for (const auto& pair : m_SizeMap) { |
28 delete pair.second; | 28 delete pair.second; |
29 } | 29 } |
30 m_SizeMap.clear(); | 30 m_SizeMap.clear(); |
31 } | 31 } |
32 CFX_GlyphBitmap* CPDF_Type3Cache::LoadGlyph(FX_DWORD charcode, | 32 CFX_GlyphBitmap* CPDF_Type3Cache::LoadGlyph(uint32_t charcode, |
33 const CFX_Matrix* pMatrix, | 33 const CFX_Matrix* pMatrix, |
34 FX_FLOAT retinaScaleX, | 34 FX_FLOAT retinaScaleX, |
35 FX_FLOAT retinaScaleY) { | 35 FX_FLOAT retinaScaleY) { |
36 _CPDF_UniqueKeyGen keygen; | 36 _CPDF_UniqueKeyGen keygen; |
37 keygen.Generate( | 37 keygen.Generate( |
38 4, FXSYS_round(pMatrix->a * 10000), FXSYS_round(pMatrix->b * 10000), | 38 4, FXSYS_round(pMatrix->a * 10000), FXSYS_round(pMatrix->b * 10000), |
39 FXSYS_round(pMatrix->c * 10000), FXSYS_round(pMatrix->d * 10000)); | 39 FXSYS_round(pMatrix->c * 10000), FXSYS_round(pMatrix->d * 10000)); |
40 CFX_ByteStringC FaceGlyphsKey(keygen.m_Key, keygen.m_KeyLen); | 40 CFX_ByteStringC FaceGlyphsKey(keygen.m_Key, keygen.m_KeyLen); |
41 CPDF_Type3Glyphs* pSizeCache; | 41 CPDF_Type3Glyphs* pSizeCache; |
42 auto it = m_SizeMap.find(FaceGlyphsKey); | 42 auto it = m_SizeMap.find(FaceGlyphsKey); |
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
123 } else { | 123 } else { |
124 if (_IsScanLine8bpp(pBuf + line * pitch, width)) { | 124 if (_IsScanLine8bpp(pBuf + line * pitch, width)) { |
125 return line; | 125 return line; |
126 } | 126 } |
127 } | 127 } |
128 line += line_step; | 128 line += line_step; |
129 } | 129 } |
130 return -1; | 130 return -1; |
131 } | 131 } |
132 CFX_GlyphBitmap* CPDF_Type3Cache::RenderGlyph(CPDF_Type3Glyphs* pSize, | 132 CFX_GlyphBitmap* CPDF_Type3Cache::RenderGlyph(CPDF_Type3Glyphs* pSize, |
133 FX_DWORD charcode, | 133 uint32_t charcode, |
134 const CFX_Matrix* pMatrix, | 134 const CFX_Matrix* pMatrix, |
135 FX_FLOAT retinaScaleX, | 135 FX_FLOAT retinaScaleX, |
136 FX_FLOAT retinaScaleY) { | 136 FX_FLOAT retinaScaleY) { |
137 const CPDF_Type3Char* pChar = m_pFont->LoadChar(charcode); | 137 const CPDF_Type3Char* pChar = m_pFont->LoadChar(charcode); |
138 if (!pChar || !pChar->m_pBitmap) | 138 if (!pChar || !pChar->m_pBitmap) |
139 return nullptr; | 139 return nullptr; |
140 | 140 |
141 CFX_DIBitmap* pBitmap = pChar->m_pBitmap; | 141 CFX_DIBitmap* pBitmap = pChar->m_pBitmap; |
142 CFX_Matrix image_matrix, text_matrix; | 142 CFX_Matrix image_matrix, text_matrix; |
143 image_matrix = pChar->m_ImageMatrix; | 143 image_matrix = pChar->m_ImageMatrix; |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
185 pGlyph->m_Top = -top; | 185 pGlyph->m_Top = -top; |
186 pGlyph->m_Bitmap.TakeOver(pResBitmap); | 186 pGlyph->m_Bitmap.TakeOver(pResBitmap); |
187 delete pResBitmap; | 187 delete pResBitmap; |
188 return pGlyph; | 188 return pGlyph; |
189 } | 189 } |
190 void _CPDF_UniqueKeyGen::Generate(int count, ...) { | 190 void _CPDF_UniqueKeyGen::Generate(int count, ...) { |
191 va_list argList; | 191 va_list argList; |
192 va_start(argList, count); | 192 va_start(argList, count); |
193 for (int i = 0; i < count; i++) { | 193 for (int i = 0; i < count; i++) { |
194 int p = va_arg(argList, int); | 194 int p = va_arg(argList, int); |
195 ((FX_DWORD*)m_Key)[i] = p; | 195 ((uint32_t*)m_Key)[i] = p; |
196 } | 196 } |
197 va_end(argList); | 197 va_end(argList); |
198 m_KeyLen = count * sizeof(FX_DWORD); | 198 m_KeyLen = count * sizeof(uint32_t); |
199 } | 199 } |
200 FX_BOOL CPDF_RenderStatus::ProcessText(const CPDF_TextObject* textobj, | 200 FX_BOOL CPDF_RenderStatus::ProcessText(const CPDF_TextObject* textobj, |
201 const CFX_Matrix* pObj2Device, | 201 const CFX_Matrix* pObj2Device, |
202 CFX_PathData* pClippingPath) { | 202 CFX_PathData* pClippingPath) { |
203 if (textobj->m_nChars == 0) { | 203 if (textobj->m_nChars == 0) { |
204 return TRUE; | 204 return TRUE; |
205 } | 205 } |
206 int text_render_mode = textobj->m_TextState.GetObject()->m_TextMode; | 206 int text_render_mode = textobj->m_TextState.GetObject()->m_TextMode; |
207 if (text_render_mode == 3) { | 207 if (text_render_mode == 3) { |
208 return TRUE; | 208 return TRUE; |
(...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
327 public: | 327 public: |
328 CPDF_RefType3Cache(CPDF_Type3Font* pType3Font) { | 328 CPDF_RefType3Cache(CPDF_Type3Font* pType3Font) { |
329 m_dwCount = 0; | 329 m_dwCount = 0; |
330 m_pType3Font = pType3Font; | 330 m_pType3Font = pType3Font; |
331 } | 331 } |
332 ~CPDF_RefType3Cache() { | 332 ~CPDF_RefType3Cache() { |
333 while (m_dwCount--) { | 333 while (m_dwCount--) { |
334 ReleaseCachedType3(m_pType3Font); | 334 ReleaseCachedType3(m_pType3Font); |
335 } | 335 } |
336 } | 336 } |
337 FX_DWORD m_dwCount; | 337 uint32_t m_dwCount; |
338 CPDF_Type3Font* m_pType3Font; | 338 CPDF_Type3Font* m_pType3Font; |
339 }; | 339 }; |
340 FX_BOOL CPDF_RenderStatus::ProcessType3Text(const CPDF_TextObject* textobj, | 340 FX_BOOL CPDF_RenderStatus::ProcessType3Text(const CPDF_TextObject* textobj, |
341 const CFX_Matrix* pObj2Device) { | 341 const CFX_Matrix* pObj2Device) { |
342 CPDF_Type3Font* pType3Font = textobj->m_TextState.GetFont()->AsType3Font(); | 342 CPDF_Type3Font* pType3Font = textobj->m_TextState.GetFont()->AsType3Font(); |
343 for (int j = 0; j < m_Type3FontCache.GetSize(); j++) { | 343 for (int j = 0; j < m_Type3FontCache.GetSize(); j++) { |
344 if (m_Type3FontCache.GetAt(j) == pType3Font) | 344 if (m_Type3FontCache.GetAt(j) == pType3Font) |
345 return TRUE; | 345 return TRUE; |
346 } | 346 } |
347 CFX_Matrix dCTM = m_pDevice->GetCTM(); | 347 CFX_Matrix dCTM = m_pDevice->GetCTM(); |
348 FX_FLOAT sa = FXSYS_fabs(dCTM.a); | 348 FX_FLOAT sa = FXSYS_fabs(dCTM.a); |
349 FX_FLOAT sd = FXSYS_fabs(dCTM.d); | 349 FX_FLOAT sd = FXSYS_fabs(dCTM.d); |
350 CFX_Matrix text_matrix; | 350 CFX_Matrix text_matrix; |
351 textobj->GetTextMatrix(&text_matrix); | 351 textobj->GetTextMatrix(&text_matrix); |
352 CFX_Matrix char_matrix = pType3Font->GetFontMatrix(); | 352 CFX_Matrix char_matrix = pType3Font->GetFontMatrix(); |
353 FX_FLOAT font_size = textobj->m_TextState.GetFontSize(); | 353 FX_FLOAT font_size = textobj->m_TextState.GetFontSize(); |
354 char_matrix.Scale(font_size, font_size); | 354 char_matrix.Scale(font_size, font_size); |
355 FX_ARGB fill_argb = GetFillArgb(textobj, TRUE); | 355 FX_ARGB fill_argb = GetFillArgb(textobj, TRUE); |
356 int fill_alpha = FXARGB_A(fill_argb); | 356 int fill_alpha = FXARGB_A(fill_argb); |
357 int device_class = m_pDevice->GetDeviceClass(); | 357 int device_class = m_pDevice->GetDeviceClass(); |
358 FXTEXT_GLYPHPOS* pGlyphAndPos = NULL; | 358 FXTEXT_GLYPHPOS* pGlyphAndPos = NULL; |
359 if (device_class == FXDC_DISPLAY) { | 359 if (device_class == FXDC_DISPLAY) { |
360 pGlyphAndPos = FX_Alloc(FXTEXT_GLYPHPOS, textobj->m_nChars); | 360 pGlyphAndPos = FX_Alloc(FXTEXT_GLYPHPOS, textobj->m_nChars); |
361 } else if (fill_alpha < 255) { | 361 } else if (fill_alpha < 255) { |
362 return FALSE; | 362 return FALSE; |
363 } | 363 } |
364 CPDF_RefType3Cache refTypeCache(pType3Font); | 364 CPDF_RefType3Cache refTypeCache(pType3Font); |
365 FX_DWORD* pChars = textobj->m_pCharCodes; | 365 uint32_t* pChars = textobj->m_pCharCodes; |
366 if (textobj->m_nChars == 1) { | 366 if (textobj->m_nChars == 1) { |
367 pChars = (FX_DWORD*)(&textobj->m_pCharCodes); | 367 pChars = (uint32_t*)(&textobj->m_pCharCodes); |
368 } | 368 } |
369 for (int iChar = 0; iChar < textobj->m_nChars; iChar++) { | 369 for (int iChar = 0; iChar < textobj->m_nChars; iChar++) { |
370 FX_DWORD charcode = pChars[iChar]; | 370 uint32_t charcode = pChars[iChar]; |
371 if (charcode == (FX_DWORD)-1) { | 371 if (charcode == (uint32_t)-1) { |
372 continue; | 372 continue; |
373 } | 373 } |
374 CPDF_Type3Char* pType3Char = pType3Font->LoadChar(charcode); | 374 CPDF_Type3Char* pType3Char = pType3Font->LoadChar(charcode); |
375 if (!pType3Char) { | 375 if (!pType3Char) { |
376 continue; | 376 continue; |
377 } | 377 } |
378 CFX_Matrix matrix = char_matrix; | 378 CFX_Matrix matrix = char_matrix; |
379 matrix.e += iChar ? textobj->m_pCharPos[iChar - 1] : 0; | 379 matrix.e += iChar ? textobj->m_pCharPos[iChar - 1] : 0; |
380 matrix.Concat(text_matrix); | 380 matrix.Concat(text_matrix); |
381 matrix.Concat(*pObj2Device); | 381 matrix.Concat(*pObj2Device); |
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
494 m_pDevice->SetBitMask(&bitmap, rect.left, rect.top, fill_argb); | 494 m_pDevice->SetBitMask(&bitmap, rect.left, rect.top, fill_argb); |
495 FX_Free(pGlyphAndPos); | 495 FX_Free(pGlyphAndPos); |
496 } | 496 } |
497 return TRUE; | 497 return TRUE; |
498 } | 498 } |
499 class CPDF_CharPosList { | 499 class CPDF_CharPosList { |
500 public: | 500 public: |
501 CPDF_CharPosList(); | 501 CPDF_CharPosList(); |
502 ~CPDF_CharPosList(); | 502 ~CPDF_CharPosList(); |
503 void Load(int nChars, | 503 void Load(int nChars, |
504 FX_DWORD* pCharCodes, | 504 uint32_t* pCharCodes, |
505 FX_FLOAT* pCharPos, | 505 FX_FLOAT* pCharPos, |
506 CPDF_Font* pFont, | 506 CPDF_Font* pFont, |
507 FX_FLOAT font_size); | 507 FX_FLOAT font_size); |
508 FXTEXT_CHARPOS* m_pCharPos; | 508 FXTEXT_CHARPOS* m_pCharPos; |
509 FX_DWORD m_nChars; | 509 uint32_t m_nChars; |
510 }; | 510 }; |
511 | 511 |
512 CPDF_CharPosList::CPDF_CharPosList() { | 512 CPDF_CharPosList::CPDF_CharPosList() { |
513 m_pCharPos = NULL; | 513 m_pCharPos = NULL; |
514 } | 514 } |
515 CPDF_CharPosList::~CPDF_CharPosList() { | 515 CPDF_CharPosList::~CPDF_CharPosList() { |
516 FX_Free(m_pCharPos); | 516 FX_Free(m_pCharPos); |
517 } | 517 } |
518 void CPDF_CharPosList::Load(int nChars, | 518 void CPDF_CharPosList::Load(int nChars, |
519 FX_DWORD* pCharCodes, | 519 uint32_t* pCharCodes, |
520 FX_FLOAT* pCharPos, | 520 FX_FLOAT* pCharPos, |
521 CPDF_Font* pFont, | 521 CPDF_Font* pFont, |
522 FX_FLOAT FontSize) { | 522 FX_FLOAT FontSize) { |
523 m_pCharPos = FX_Alloc(FXTEXT_CHARPOS, nChars); | 523 m_pCharPos = FX_Alloc(FXTEXT_CHARPOS, nChars); |
524 m_nChars = 0; | 524 m_nChars = 0; |
525 CPDF_CIDFont* pCIDFont = pFont->AsCIDFont(); | 525 CPDF_CIDFont* pCIDFont = pFont->AsCIDFont(); |
526 FX_BOOL bVertWriting = pCIDFont && pCIDFont->IsVertWriting(); | 526 FX_BOOL bVertWriting = pCIDFont && pCIDFont->IsVertWriting(); |
527 for (int iChar = 0; iChar < nChars; iChar++) { | 527 for (int iChar = 0; iChar < nChars; iChar++) { |
528 FX_DWORD CharCode = | 528 uint32_t CharCode = |
529 nChars == 1 ? (FX_DWORD)(uintptr_t)pCharCodes : pCharCodes[iChar]; | 529 nChars == 1 ? (uint32_t)(uintptr_t)pCharCodes : pCharCodes[iChar]; |
530 if (CharCode == (FX_DWORD)-1) { | 530 if (CharCode == (uint32_t)-1) { |
531 continue; | 531 continue; |
532 } | 532 } |
533 FX_BOOL bVert = FALSE; | 533 FX_BOOL bVert = FALSE; |
534 FXTEXT_CHARPOS& charpos = m_pCharPos[m_nChars++]; | 534 FXTEXT_CHARPOS& charpos = m_pCharPos[m_nChars++]; |
535 if (pCIDFont) { | 535 if (pCIDFont) { |
536 charpos.m_bFontStyle = pCIDFont->IsFontStyleFromCharCode(CharCode); | 536 charpos.m_bFontStyle = pCIDFont->IsFontStyleFromCharCode(CharCode); |
537 } | 537 } |
538 charpos.m_GlyphIndex = pFont->GlyphFromCharCode(CharCode, &bVert); | 538 charpos.m_GlyphIndex = pFont->GlyphFromCharCode(CharCode, &bVert); |
539 #if _FXM_PLATFORM_ == _FXM_PLATFORM_APPLE_ | 539 #if _FXM_PLATFORM_ == _FXM_PLATFORM_APPLE_ |
540 charpos.m_ExtGID = pFont->GlyphFromCharCodeExt(CharCode); | 540 charpos.m_ExtGID = pFont->GlyphFromCharCodeExt(CharCode); |
(...skipping 27 matching lines...) Expand all Loading... |
568 charpos.m_OriginX += | 568 charpos.m_OriginX += |
569 pCIDFont->CIDTransformToFloat(pTransform[4]) * FontSize; | 569 pCIDFont->CIDTransformToFloat(pTransform[4]) * FontSize; |
570 charpos.m_OriginY += | 570 charpos.m_OriginY += |
571 pCIDFont->CIDTransformToFloat(pTransform[5]) * FontSize; | 571 pCIDFont->CIDTransformToFloat(pTransform[5]) * FontSize; |
572 charpos.m_bGlyphAdjust = TRUE; | 572 charpos.m_bGlyphAdjust = TRUE; |
573 } | 573 } |
574 } | 574 } |
575 } | 575 } |
576 FX_BOOL CPDF_TextRenderer::DrawTextPath(CFX_RenderDevice* pDevice, | 576 FX_BOOL CPDF_TextRenderer::DrawTextPath(CFX_RenderDevice* pDevice, |
577 int nChars, | 577 int nChars, |
578 FX_DWORD* pCharCodes, | 578 uint32_t* pCharCodes, |
579 FX_FLOAT* pCharPos, | 579 FX_FLOAT* pCharPos, |
580 CPDF_Font* pFont, | 580 CPDF_Font* pFont, |
581 FX_FLOAT font_size, | 581 FX_FLOAT font_size, |
582 const CFX_Matrix* pText2User, | 582 const CFX_Matrix* pText2User, |
583 const CFX_Matrix* pUser2Device, | 583 const CFX_Matrix* pUser2Device, |
584 const CFX_GraphStateData* pGraphState, | 584 const CFX_GraphStateData* pGraphState, |
585 FX_ARGB fill_argb, | 585 FX_ARGB fill_argb, |
586 FX_ARGB stroke_argb, | 586 FX_ARGB stroke_argb, |
587 CFX_PathData* pClippingPath, | 587 CFX_PathData* pClippingPath, |
588 int nFlag) { | 588 int nFlag) { |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
622 const CFX_Matrix* pMatrix, | 622 const CFX_Matrix* pMatrix, |
623 const CFX_ByteString& str, | 623 const CFX_ByteString& str, |
624 FX_ARGB fill_argb, | 624 FX_ARGB fill_argb, |
625 FX_ARGB stroke_argb, | 625 FX_ARGB stroke_argb, |
626 const CFX_GraphStateData* pGraphState, | 626 const CFX_GraphStateData* pGraphState, |
627 const CPDF_RenderOptions* pOptions) { | 627 const CPDF_RenderOptions* pOptions) { |
628 int nChars = pFont->CountChar(str, str.GetLength()); | 628 int nChars = pFont->CountChar(str, str.GetLength()); |
629 if (nChars == 0) { | 629 if (nChars == 0) { |
630 return; | 630 return; |
631 } | 631 } |
632 FX_DWORD charcode; | 632 uint32_t charcode; |
633 int offset = 0; | 633 int offset = 0; |
634 FX_DWORD* pCharCodes; | 634 uint32_t* pCharCodes; |
635 FX_FLOAT* pCharPos; | 635 FX_FLOAT* pCharPos; |
636 if (nChars == 1) { | 636 if (nChars == 1) { |
637 charcode = pFont->GetNextChar(str, str.GetLength(), offset); | 637 charcode = pFont->GetNextChar(str, str.GetLength(), offset); |
638 pCharCodes = (FX_DWORD*)(uintptr_t)charcode; | 638 pCharCodes = (uint32_t*)(uintptr_t)charcode; |
639 pCharPos = NULL; | 639 pCharPos = NULL; |
640 } else { | 640 } else { |
641 pCharCodes = FX_Alloc(FX_DWORD, nChars); | 641 pCharCodes = FX_Alloc(uint32_t, nChars); |
642 pCharPos = FX_Alloc(FX_FLOAT, nChars - 1); | 642 pCharPos = FX_Alloc(FX_FLOAT, nChars - 1); |
643 FX_FLOAT cur_pos = 0; | 643 FX_FLOAT cur_pos = 0; |
644 for (int i = 0; i < nChars; i++) { | 644 for (int i = 0; i < nChars; i++) { |
645 pCharCodes[i] = pFont->GetNextChar(str, str.GetLength(), offset); | 645 pCharCodes[i] = pFont->GetNextChar(str, str.GetLength(), offset); |
646 if (i) { | 646 if (i) { |
647 pCharPos[i - 1] = cur_pos; | 647 pCharPos[i - 1] = cur_pos; |
648 } | 648 } |
649 cur_pos += pFont->GetCharWidthF(pCharCodes[i]) * font_size / 1000; | 649 cur_pos += pFont->GetCharWidthF(pCharCodes[i]) * font_size / 1000; |
650 } | 650 } |
651 } | 651 } |
(...skipping 14 matching lines...) Expand all Loading... |
666 } | 666 } |
667 } | 667 } |
668 | 668 |
669 if (nChars > 1) { | 669 if (nChars > 1) { |
670 FX_Free(pCharCodes); | 670 FX_Free(pCharCodes); |
671 FX_Free(pCharPos); | 671 FX_Free(pCharPos); |
672 } | 672 } |
673 } | 673 } |
674 FX_BOOL CPDF_TextRenderer::DrawNormalText(CFX_RenderDevice* pDevice, | 674 FX_BOOL CPDF_TextRenderer::DrawNormalText(CFX_RenderDevice* pDevice, |
675 int nChars, | 675 int nChars, |
676 FX_DWORD* pCharCodes, | 676 uint32_t* pCharCodes, |
677 FX_FLOAT* pCharPos, | 677 FX_FLOAT* pCharPos, |
678 CPDF_Font* pFont, | 678 CPDF_Font* pFont, |
679 FX_FLOAT font_size, | 679 FX_FLOAT font_size, |
680 const CFX_Matrix* pText2Device, | 680 const CFX_Matrix* pText2Device, |
681 FX_ARGB fill_argb, | 681 FX_ARGB fill_argb, |
682 const CPDF_RenderOptions* pOptions) { | 682 const CPDF_RenderOptions* pOptions) { |
683 CFX_FontCache* pCache = | 683 CFX_FontCache* pCache = |
684 pFont->m_pDocument ? pFont->m_pDocument->GetRenderData()->GetFontCache() | 684 pFont->m_pDocument ? pFont->m_pDocument->GetRenderData()->GetFontCache() |
685 : NULL; | 685 : NULL; |
686 CPDF_CharPosList CharPosList; | 686 CPDF_CharPosList CharPosList; |
687 CharPosList.Load(nChars, pCharCodes, pCharPos, pFont, font_size); | 687 CharPosList.Load(nChars, pCharCodes, pCharPos, pFont, font_size); |
688 int FXGE_flags = 0; | 688 int FXGE_flags = 0; |
689 if (pOptions) { | 689 if (pOptions) { |
690 FX_DWORD dwFlags = pOptions->m_Flags; | 690 uint32_t dwFlags = pOptions->m_Flags; |
691 if (dwFlags & RENDER_CLEARTYPE) { | 691 if (dwFlags & RENDER_CLEARTYPE) { |
692 FXGE_flags |= FXTEXT_CLEARTYPE; | 692 FXGE_flags |= FXTEXT_CLEARTYPE; |
693 if (dwFlags & RENDER_BGR_STRIPE) { | 693 if (dwFlags & RENDER_BGR_STRIPE) { |
694 FXGE_flags |= FXTEXT_BGR_STRIPE; | 694 FXGE_flags |= FXTEXT_BGR_STRIPE; |
695 } | 695 } |
696 } | 696 } |
697 if (dwFlags & RENDER_NOTEXTSMOOTH) { | 697 if (dwFlags & RENDER_NOTEXTSMOOTH) { |
698 FXGE_flags |= FXTEXT_NOSMOOTH; | 698 FXGE_flags |= FXTEXT_NOSMOOTH; |
699 } | 699 } |
700 if (dwFlags & RENDER_PRINTGRAPHICTEXT) { | 700 if (dwFlags & RENDER_PRINTGRAPHICTEXT) { |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
743 if (pFont->m_pDocument) { | 743 if (pFont->m_pDocument) { |
744 pCache = pFont->m_pDocument->GetRenderData()->GetFontCache(); | 744 pCache = pFont->m_pDocument->GetRenderData()->GetFontCache(); |
745 } else { | 745 } else { |
746 pCache = CFX_GEModule::Get()->GetFontCache(); | 746 pCache = CFX_GEModule::Get()->GetFontCache(); |
747 } | 747 } |
748 CFX_FaceCache* pFaceCache = pCache->GetCachedFace(&pFont->m_Font); | 748 CFX_FaceCache* pFaceCache = pCache->GetCachedFace(&pFont->m_Font); |
749 FX_FONTCACHE_DEFINE(pCache, &pFont->m_Font); | 749 FX_FONTCACHE_DEFINE(pCache, &pFont->m_Font); |
750 CPDF_CharPosList CharPosList; | 750 CPDF_CharPosList CharPosList; |
751 CharPosList.Load(textobj->m_nChars, textobj->m_pCharCodes, | 751 CharPosList.Load(textobj->m_nChars, textobj->m_pCharCodes, |
752 textobj->m_pCharPos, pFont, font_size); | 752 textobj->m_pCharPos, pFont, font_size); |
753 for (FX_DWORD i = 0; i < CharPosList.m_nChars; i++) { | 753 for (uint32_t i = 0; i < CharPosList.m_nChars; i++) { |
754 FXTEXT_CHARPOS& charpos = CharPosList.m_pCharPos[i]; | 754 FXTEXT_CHARPOS& charpos = CharPosList.m_pCharPos[i]; |
755 const CFX_PathData* pPath = pFaceCache->LoadGlyphPath( | 755 const CFX_PathData* pPath = pFaceCache->LoadGlyphPath( |
756 &pFont->m_Font, charpos.m_GlyphIndex, charpos.m_FontCharWidth); | 756 &pFont->m_Font, charpos.m_GlyphIndex, charpos.m_FontCharWidth); |
757 if (!pPath) { | 757 if (!pPath) { |
758 continue; | 758 continue; |
759 } | 759 } |
760 CPDF_PathObject path; | 760 CPDF_PathObject path; |
761 path.m_GraphState = textobj->m_GraphState; | 761 path.m_GraphState = textobj->m_GraphState; |
762 path.m_ColorState = textobj->m_ColorState; | 762 path.m_ColorState = textobj->m_ColorState; |
763 CFX_Matrix matrix; | 763 CFX_Matrix matrix; |
764 if (charpos.m_bGlyphAdjust) | 764 if (charpos.m_bGlyphAdjust) |
765 matrix.Set(charpos.m_AdjustMatrix[0], charpos.m_AdjustMatrix[1], | 765 matrix.Set(charpos.m_AdjustMatrix[0], charpos.m_AdjustMatrix[1], |
766 charpos.m_AdjustMatrix[2], charpos.m_AdjustMatrix[3], 0, 0); | 766 charpos.m_AdjustMatrix[2], charpos.m_AdjustMatrix[3], 0, 0); |
767 matrix.Concat(font_size, 0, 0, font_size, charpos.m_OriginX, | 767 matrix.Concat(font_size, 0, 0, font_size, charpos.m_OriginX, |
768 charpos.m_OriginY); | 768 charpos.m_OriginY); |
769 path.m_Path.New()->Append(pPath, &matrix); | 769 path.m_Path.New()->Append(pPath, &matrix); |
770 path.m_Matrix = *pTextMatrix; | 770 path.m_Matrix = *pTextMatrix; |
771 path.m_bStroke = bStroke; | 771 path.m_bStroke = bStroke; |
772 path.m_FillType = bFill ? FXFILL_WINDING : 0; | 772 path.m_FillType = bFill ? FXFILL_WINDING : 0; |
773 path.CalcBoundingBox(); | 773 path.CalcBoundingBox(); |
774 ProcessPath(&path, pObj2Device); | 774 ProcessPath(&path, pObj2Device); |
775 } | 775 } |
776 } | 776 } |
OLD | NEW |