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

Side by Side Diff: fpdfsdk/src/fsdk_mgr.cpp

Issue 1243953004: Re-land else-after-returns (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@master
Patch Set: Created 5 years, 5 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 | « fpdfsdk/src/fsdk_baseform.cpp ('k') | fpdfsdk/src/fsdk_rendercontext.cpp » ('j') | 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 "../../public/fpdf_ext.h" 7 #include "../../public/fpdf_ext.h"
8 #include "../../third_party/base/nonstd_unique_ptr.h" 8 #include "../../third_party/base/nonstd_unique_ptr.h"
9 #include "../include/fsdk_define.h" 9 #include "../include/fsdk_define.h"
10 #include "../include/fsdk_mgr.h" 10 #include "../include/fsdk_mgr.h"
(...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after
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 739 matching lines...) Expand 10 before | Expand all | Expand 10 after
931 m_bOnWidget = TRUE; 926 m_bOnWidget = TRUE;
932 if(!m_bEnterWidget) 927 if(!m_bEnterWidget)
933 { 928 {
934 m_bEnterWidget = TRUE; 929 m_bEnterWidget = TRUE;
935 m_bExitWidget = FALSE; 930 m_bExitWidget = FALSE;
936 pAnnotHandlerMgr->Annot_OnMouseEnter(this, pFXAnnot,nFlag); 931 pAnnotHandlerMgr->Annot_OnMouseEnter(this, pFXAnnot,nFlag);
937 } 932 }
938 pAnnotHandlerMgr->Annot_OnMouseMove(this, pFXAnnot, nFlag, point); 933 pAnnotHandlerMgr->Annot_OnMouseMove(this, pFXAnnot, nFlag, point);
939 return TRUE; 934 return TRUE;
940 } 935 }
941 else 936 if(m_bOnWidget)
942 { 937 {
943 if(m_bOnWidget) 938 m_bOnWidget = FALSE;
939 m_bExitWidget = TRUE;
940 m_bEnterWidget = FALSE;
941 if(m_CaptureWidget)
944 { 942 {
945 m_bOnWidget = FALSE; 943 pAnnotHandlerMgr->Annot_OnMouseExit(this, m_CaptureWidget, nFlag);
946 m_bExitWidget = TRUE; 944 m_CaptureWidget = NULL;
947 m_bEnterWidget = FALSE;
948 if(m_CaptureWidget)
949 {
950 pAnnotHandlerMgr->Annot_OnMouseExit(this, m_CaptureWidget, nFlag );
951 m_CaptureWidget = NULL;
952 }
953 } 945 }
954 return FALSE;
955 } 946 }
956 947 return FALSE;
957 return FALSE;;
958 } 948 }
959 949
960 FX_BOOL CPDFSDK_PageView::OnMouseWheel(double deltaX, double deltaY,const CPDF_P oint& point, int nFlag) 950 FX_BOOL CPDFSDK_PageView::OnMouseWheel(double deltaX, double deltaY,const CPDF_P oint& point, int nFlag)
961 { 951 {
962 if(CPDFSDK_Annot* pAnnot = GetFXWidgetAtPoint(point.x, point.y)) 952 if(CPDFSDK_Annot* pAnnot = GetFXWidgetAtPoint(point.x, point.y))
963 { 953 {
964 CPDFDoc_Environment* pEnv = m_pSDKDoc->GetEnv(); 954 CPDFDoc_Environment* pEnv = m_pSDKDoc->GetEnv();
965 CPDFSDK_AnnotHandlerMgr* pAnnotHandlerMgr = pEnv->GetAnnotHandlerMgr(); 955 CPDFSDK_AnnotHandlerMgr* pAnnotHandlerMgr = pEnv->GetAnnotHandlerMgr();
966 ASSERT(pAnnotHandlerMgr); 956 ASSERT(pAnnotHandlerMgr);
967 return pAnnotHandlerMgr->Annot_OnMouseWheel(this, pAnnot, nFlag, (int)de ltaY, point); 957 return pAnnotHandlerMgr->Annot_OnMouseWheel(this, pAnnot, nFlag, (int)de ltaY, point);
(...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after
1094 return NULL; 1084 return NULL;
1095 1085
1096 for(int i=0; i<m_fxAnnotArray.GetSize(); i++) 1086 for(int i=0; i<m_fxAnnotArray.GetSize(); i++)
1097 { 1087 {
1098 CPDFSDK_Annot* pAnnot = (CPDFSDK_Annot*)m_fxAnnotArray.GetAt(i); 1088 CPDFSDK_Annot* pAnnot = (CPDFSDK_Annot*)m_fxAnnotArray.GetAt(i);
1099 if(pAnnot == pFocusAnnot) 1089 if(pAnnot == pFocusAnnot)
1100 return pAnnot; 1090 return pAnnot;
1101 } 1091 }
1102 return NULL; 1092 return NULL;
1103 } 1093 }
OLDNEW
« no previous file with comments | « fpdfsdk/src/fsdk_baseform.cpp ('k') | fpdfsdk/src/fsdk_rendercontext.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698