| 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 "../../public/fpdf_ext.h" | 7 #include "../../public/fpdf_ext.h" |
| 8 #include "../include/fsdk_define.h" | 8 #include "../include/fsdk_define.h" |
| 9 #include "../include/fpdfxfa/fpdfxfa_doc.h" | 9 #include "../include/fpdfxfa/fpdfxfa_doc.h" |
| 10 #include "../include/fpdfxfa/fpdfxfa_page.h" | 10 #include "../include/fpdfxfa/fpdfxfa_page.h" |
| (...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 134 } | 134 } |
| 135 | 135 |
| 136 CFX_ByteString CFX_SystemHandler::GetNativeTrueTypeFont(int32_t nCharset) | 136 CFX_ByteString CFX_SystemHandler::GetNativeTrueTypeFont(int32_t nCharset) |
| 137 { | 137 { |
| 138 return ""; | 138 return ""; |
| 139 } | 139 } |
| 140 | 140 |
| 141 FX_BOOL CFX_SystemHandler::FindNativeTrueTypeFont(int32_t nCharset, CFX_ByteStri
ng sFontFaceName) | 141 FX_BOOL CFX_SystemHandler::FindNativeTrueTypeFont(int32_t nCharset, CFX_ByteStri
ng sFontFaceName) |
| 142 { | 142 { |
| 143 CFX_FontMgr* pFontMgr = CFX_GEModule::Get()->GetFontMgr(); | 143 CFX_FontMgr* pFontMgr = CFX_GEModule::Get()->GetFontMgr(); |
| 144 // FXFT_Face nFace = pFontMgr->FindSubstFont(sFontFaceName,TRUE,0,0,0,0,NULL); | |
| 145 // FXFT_Face nFace = pFontMgr->m_pBuiltinMapper->FindSubstFont(sFontFaceName,T
RUE,0,0,0,0,NULL); | |
| 146 | |
| 147 if(pFontMgr) | 144 if(pFontMgr) |
| 148 { | 145 { |
| 149 CFX_FontMapper* pFontMapper = pFontMgr->m_pBuiltinMapper; | 146 CFX_FontMapper* pFontMapper = pFontMgr->m_pBuiltinMapper; |
| 150 if(pFontMapper) | 147 if(pFontMapper) |
| 151 { | 148 { |
| 152 int nSize = pFontMapper->m_InstalledTTFonts.GetSize(); | 149 int nSize = pFontMapper->m_InstalledTTFonts.GetSize(); |
| 153 if(nSize ==0) | 150 if(nSize ==0) |
| 154 { | 151 { |
| 155 pFontMapper->LoadInstalledFonts(); | 152 pFontMapper->LoadInstalledFonts(); |
| 156 nSize = pFontMapper->m_InstalledTTFonts.GetSize(); | 153 nSize = pFontMapper->m_InstalledTTFonts.GetSize(); |
| 157 } | 154 } |
| 158 | 155 |
| 159 for(int i=0; i<nSize; i++) | 156 for(int i=0; i<nSize; i++) |
| 160 { | 157 { |
| 161 if(pFontMapper->m_InstalledTTFonts[i].Compare(sFontFaceName)) | 158 if(pFontMapper->m_InstalledTTFonts[i].Compare(sFontFaceName)) |
| 162 return TRUE; | 159 return TRUE; |
| 163 } | 160 } |
| 164 } | 161 } |
| 165 | 162 |
| 166 } | 163 } |
| 167 | 164 |
| 168 return FALSE; | 165 return FALSE; |
| 169 // pFontMgr->m_FaceMap.Lookup(sFontFaceName,pFont); | |
| 170 // return (pFont!=NULL); | |
| 171 } | 166 } |
| 172 | 167 |
| 173 static int CharSet2CP(int charset) | 168 static int CharSet2CP(int charset) |
| 174 { | 169 { |
| 175 if(charset == 128) | 170 if (charset == 128) |
| 176 return 932; | 171 return 932; |
| 177 else if(charset == 134) | 172 if (charset == 134) |
| 178 return 936; | 173 return 936; |
| 179 else if(charset == 129) | 174 if (charset == 129) |
| 180 return 949; | 175 return 949; |
| 181 else if(charset == 136) | 176 if (charset == 136) |
| 182 return 950; | 177 return 950; |
| 183 return 0; | 178 return 0; |
| 184 } | 179 } |
| 185 CPDF_Font* CFX_SystemHandler::AddNativeTrueTypeFontToPDF(CPDF_Document* pDoc, CF
X_ByteString sFontFaceName, | 180 CPDF_Font* CFX_SystemHandler::AddNativeTrueTypeFontToPDF(CPDF_Document* pDoc, CF
X_ByteString sFontFaceName, |
| 186 uint8_t nCharset) | 181 uint8_t nCharset) |
| 187 { | 182 { |
| 188 if(pDoc) | 183 if(pDoc) |
| 189 { | 184 { |
| 190 CFX_Font* pFXFont = new CFX_Font(); | 185 CFX_Font* pFXFont = new CFX_Font(); |
| 191 pFXFont->LoadSubst(sFontFaceName,TRUE,0,0,0,CharSet2CP(nCharset),FALSE); | 186 pFXFont->LoadSubst(sFontFaceName,TRUE,0,0,0,CharSet2CP(nCharset),FALSE); |
| (...skipping 892 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1084 m_bOnWidget = TRUE; | 1079 m_bOnWidget = TRUE; |
| 1085 if(!m_bEnterWidget) | 1080 if(!m_bEnterWidget) |
| 1086 { | 1081 { |
| 1087 m_bEnterWidget = TRUE; | 1082 m_bEnterWidget = TRUE; |
| 1088 m_bExitWidget = FALSE; | 1083 m_bExitWidget = FALSE; |
| 1089 pAnnotHandlerMgr->Annot_OnMouseEnter(this, pFXAnnot,nFlag); | 1084 pAnnotHandlerMgr->Annot_OnMouseEnter(this, pFXAnnot,nFlag); |
| 1090 } | 1085 } |
| 1091 pAnnotHandlerMgr->Annot_OnMouseMove(this, pFXAnnot, nFlag, point); | 1086 pAnnotHandlerMgr->Annot_OnMouseMove(this, pFXAnnot, nFlag, point); |
| 1092 return TRUE; | 1087 return TRUE; |
| 1093 } | 1088 } |
| 1094 else | 1089 if(m_bOnWidget) |
| 1095 { | 1090 { |
| 1096 if(m_bOnWidget) | 1091 m_bOnWidget = FALSE; |
| 1092 m_bExitWidget = TRUE; |
| 1093 m_bEnterWidget = FALSE; |
| 1094 if(m_CaptureWidget) |
| 1097 { | 1095 { |
| 1098 m_bOnWidget = FALSE; | 1096 pAnnotHandlerMgr->Annot_OnMouseExit(this, m_CaptureWidget, nFlag); |
| 1099 m_bExitWidget = TRUE; | 1097 m_CaptureWidget = NULL; |
| 1100 m_bEnterWidget = FALSE; | |
| 1101 if(m_CaptureWidget) | |
| 1102 { | |
| 1103 pAnnotHandlerMgr->Annot_OnMouseExit(this, m_CaptureWidget, nFlag
); | |
| 1104 m_CaptureWidget = NULL; | |
| 1105 } | |
| 1106 } | 1098 } |
| 1107 return FALSE; | |
| 1108 } | 1099 } |
| 1109 | 1100 return FALSE; |
| 1110 return FALSE;; | |
| 1111 } | 1101 } |
| 1112 | 1102 |
| 1113 FX_BOOL CPDFSDK_PageView::OnMouseWheel(double deltaX, double deltaY,const CPDF_P
oint& point, int nFlag) | 1103 FX_BOOL CPDFSDK_PageView::OnMouseWheel(double deltaX, double deltaY,const CPDF_P
oint& point, int nFlag) |
| 1114 { | 1104 { |
| 1115 if(CPDFSDK_Annot* pAnnot = GetFXWidgetAtPoint(point.x, point.y)) | 1105 if(CPDFSDK_Annot* pAnnot = GetFXWidgetAtPoint(point.x, point.y)) |
| 1116 { | 1106 { |
| 1117 CPDFDoc_Environment* pEnv = m_pSDKDoc->GetEnv(); | 1107 CPDFDoc_Environment* pEnv = m_pSDKDoc->GetEnv(); |
| 1118 CPDFSDK_AnnotHandlerMgr* pAnnotHandlerMgr = pEnv->GetAnnotHandlerMgr(); | 1108 CPDFSDK_AnnotHandlerMgr* pAnnotHandlerMgr = pEnv->GetAnnotHandlerMgr(); |
| 1119 ASSERT(pAnnotHandlerMgr); | 1109 ASSERT(pAnnotHandlerMgr); |
| 1120 return pAnnotHandlerMgr->Annot_OnMouseWheel(this, pAnnot, nFlag, (int)de
ltaY, point); | 1110 return pAnnotHandlerMgr->Annot_OnMouseWheel(this, pAnnot, nFlag, (int)de
ltaY, point); |
| (...skipping 166 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1287 return NULL; | 1277 return NULL; |
| 1288 | 1278 |
| 1289 for(int i=0; i<m_fxAnnotArray.GetSize(); i++) | 1279 for(int i=0; i<m_fxAnnotArray.GetSize(); i++) |
| 1290 { | 1280 { |
| 1291 CPDFSDK_Annot* pAnnot = (CPDFSDK_Annot*)m_fxAnnotArray.GetAt(i); | 1281 CPDFSDK_Annot* pAnnot = (CPDFSDK_Annot*)m_fxAnnotArray.GetAt(i); |
| 1292 if(pAnnot == pFocusAnnot) | 1282 if(pAnnot == pFocusAnnot) |
| 1293 return pAnnot; | 1283 return pAnnot; |
| 1294 } | 1284 } |
| 1295 return NULL; | 1285 return NULL; |
| 1296 } | 1286 } |
| OLD | NEW |