OLD | NEW |
1 // Copyright 2016 PDFium Authors. All rights reserved. | 1 // Copyright 2016 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/fxge/cfx_renderdevice.h" | 7 #include "core/fxge/cfx_renderdevice.h" |
8 | 8 |
9 #include "core/fxcrt/fx_safe_types.h" | 9 #include "core/fxcrt/fx_safe_types.h" |
10 #include "core/fxge/cfx_facecache.h" | 10 #include "core/fxge/cfx_facecache.h" |
(...skipping 836 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
847 CFX_Matrix char2device; | 847 CFX_Matrix char2device; |
848 CFX_Matrix text2Device; | 848 CFX_Matrix text2Device; |
849 if (pText2Device) { | 849 if (pText2Device) { |
850 char2device = *pText2Device; | 850 char2device = *pText2Device; |
851 text2Device = *pText2Device; | 851 text2Device = *pText2Device; |
852 } | 852 } |
853 char2device.Scale(font_size, -font_size); | 853 char2device.Scale(font_size, -font_size); |
854 if (FXSYS_fabs(char2device.a) + FXSYS_fabs(char2device.b) > 50 * 1.0f || | 854 if (FXSYS_fabs(char2device.a) + FXSYS_fabs(char2device.b) > 50 * 1.0f || |
855 ((m_DeviceClass == FXDC_PRINTER) && | 855 ((m_DeviceClass == FXDC_PRINTER) && |
856 !(text_flags & FXTEXT_PRINTIMAGETEXT))) { | 856 !(text_flags & FXTEXT_PRINTIMAGETEXT))) { |
857 if (pFont->GetFace() || | 857 if (pFont->GetFace()) { |
858 (pFont->GetSubstFont()->m_SubstFlags & FXFONT_SUBST_GLYPHPATH)) { | |
859 int nPathFlags = | 858 int nPathFlags = |
860 (text_flags & FXTEXT_NOSMOOTH) == 0 ? 0 : FXFILL_NOPATHSMOOTH; | 859 (text_flags & FXTEXT_NOSMOOTH) == 0 ? 0 : FXFILL_NOPATHSMOOTH; |
861 return DrawTextPath(nChars, pCharPos, pFont, font_size, pText2Device, | 860 return DrawTextPath(nChars, pCharPos, pFont, font_size, pText2Device, |
862 nullptr, nullptr, fill_color, 0, nullptr, nPathFlags); | 861 nullptr, nullptr, fill_color, 0, nullptr, nPathFlags); |
863 } | 862 } |
864 } | 863 } |
865 int anti_alias = FXFT_RENDER_MODE_MONO; | 864 int anti_alias = FXFT_RENDER_MODE_MONO; |
866 bool bNormal = false; | 865 bool bNormal = false; |
867 if ((text_flags & FXTEXT_NOSMOOTH) == 0) { | 866 if ((text_flags & FXTEXT_NOSMOOTH) == 0) { |
868 if (m_DeviceClass == FXDC_DISPLAY && m_bpp > 1) { | 867 if (m_DeviceClass == FXDC_DISPLAY && m_bpp > 1) { |
869 if (!CFX_GEModule::Get()->GetFontMgr()->FTLibrarySupportsHinting()) { | 868 if (!CFX_GEModule::Get()->GetFontMgr()->FTLibrarySupportsHinting()) { |
870 // Some Freetype implementations (like the one packaged with Fedora) do | 869 // Some Freetype implementations (like the one packaged with Fedora) do |
871 // not support hinting due to patents 6219025, 6239783, 6307566, | 870 // not support hinting due to patents 6219025, 6239783, 6307566, |
872 // 6225973, 6243070, 6393145, 6421054, 6282327, and 6624828; the latest | 871 // 6225973, 6243070, 6393145, 6421054, 6282327, and 6624828; the latest |
873 // one expires 10/7/19. This makes LCD antialiasing very ugly, so we | 872 // one expires 10/7/19. This makes LCD antialiasing very ugly, so we |
874 // instead fall back on NORMAL antialiasing. | 873 // instead fall back on NORMAL antialiasing. |
875 anti_alias = FXFT_RENDER_MODE_NORMAL; | 874 anti_alias = FXFT_RENDER_MODE_NORMAL; |
876 } else if ((m_RenderCaps & (FXRC_ALPHA_OUTPUT | FXRC_CMYK_OUTPUT))) { | 875 } else if ((m_RenderCaps & (FXRC_ALPHA_OUTPUT | FXRC_CMYK_OUTPUT))) { |
877 anti_alias = FXFT_RENDER_MODE_LCD; | 876 anti_alias = FXFT_RENDER_MODE_LCD; |
878 bNormal = true; | 877 bNormal = true; |
879 } else if (m_bpp < 16) { | 878 } else if (m_bpp < 16) { |
880 anti_alias = FXFT_RENDER_MODE_NORMAL; | 879 anti_alias = FXFT_RENDER_MODE_NORMAL; |
881 } else { | 880 } else { |
882 anti_alias = FXFT_RENDER_MODE_LCD; | 881 anti_alias = FXFT_RENDER_MODE_LCD; |
883 | 882 |
884 bool bClearType = false; | 883 bool bClearType = false; |
885 if (pFont->GetFace() || | 884 if (pFont->GetFace()) |
886 (pFont->GetSubstFont()->m_SubstFlags & FXFONT_SUBST_CLEARTYPE)) { | |
887 bClearType = !!(text_flags & FXTEXT_CLEARTYPE); | 885 bClearType = !!(text_flags & FXTEXT_CLEARTYPE); |
888 } | |
889 bNormal = !bClearType; | 886 bNormal = !bClearType; |
890 } | 887 } |
891 } | 888 } |
892 } | 889 } |
893 std::vector<FXTEXT_GLYPHPOS> glyphs(nChars); | 890 std::vector<FXTEXT_GLYPHPOS> glyphs(nChars); |
894 CFX_Matrix matrixCTM = GetCTM(); | 891 CFX_Matrix matrixCTM = GetCTM(); |
895 FX_FLOAT scale_x = FXSYS_fabs(matrixCTM.a); | 892 FX_FLOAT scale_x = FXSYS_fabs(matrixCTM.a); |
896 FX_FLOAT scale_y = FXSYS_fabs(matrixCTM.d); | 893 FX_FLOAT scale_y = FXSYS_fabs(matrixCTM.d); |
897 CFX_Matrix deviceCtm = char2device; | 894 CFX_Matrix deviceCtm = char2device; |
898 deviceCtm.Concat(scale_x, 0, 0, scale_y, 0, 0); | 895 deviceCtm.Concat(scale_x, 0, 0, scale_y, 0, 0); |
(...skipping 173 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1072 fill_color, stroke_color, fill_mode, | 1069 fill_color, stroke_color, fill_mode, |
1073 FXDIB_BLEND_NORMAL)) { | 1070 FXDIB_BLEND_NORMAL)) { |
1074 return FALSE; | 1071 return FALSE; |
1075 } | 1072 } |
1076 } | 1073 } |
1077 if (pClippingPath) | 1074 if (pClippingPath) |
1078 pClippingPath->Append(&TransformedPath, pUser2Device); | 1075 pClippingPath->Append(&TransformedPath, pUser2Device); |
1079 } | 1076 } |
1080 return TRUE; | 1077 return TRUE; |
1081 } | 1078 } |
OLD | NEW |