| 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 "xfa/include/fxfa/xfa_fontmgr.h" | 7 #include "xfa/include/fxfa/xfa_fontmgr.h" |
| 8 | 8 |
| 9 #include <algorithm> | 9 #include <algorithm> |
| 10 | 10 |
| (...skipping 1942 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1953 } else if (bsDRName.Find("Oblique") > 0) { | 1953 } else if (bsDRName.Find("Oblique") > 0) { |
| 1954 iDifferLength -= 7; | 1954 iDifferLength -= 7; |
| 1955 } else { | 1955 } else { |
| 1956 bItalicFont = FALSE; | 1956 bItalicFont = FALSE; |
| 1957 } | 1957 } |
| 1958 if (bItalic ^ bItalicFont) { | 1958 if (bItalic ^ bItalicFont) { |
| 1959 return FALSE; | 1959 return FALSE; |
| 1960 } | 1960 } |
| 1961 if (iDifferLength > 1) { | 1961 if (iDifferLength > 1) { |
| 1962 CFX_ByteString bsDRTailer = bsDRName.Right(iDifferLength); | 1962 CFX_ByteString bsDRTailer = bsDRName.Right(iDifferLength); |
| 1963 if (bsDRTailer.Equal("MT") || bsDRTailer.Equal("PSMT") || | 1963 if (bsDRTailer == "MT" || bsDRTailer == "PSMT" || |
| 1964 bsDRTailer.Equal("Regular") || bsDRTailer.Equal("Reg")) { | 1964 bsDRTailer == "Regular" || bsDRTailer == "Reg") { |
| 1965 return TRUE; | 1965 return TRUE; |
| 1966 } | 1966 } |
| 1967 if (bBoldFont || bItalicFont) { | 1967 if (bBoldFont || bItalicFont) { |
| 1968 return FALSE; | 1968 return FALSE; |
| 1969 } | 1969 } |
| 1970 FX_BOOL bMatch = FALSE; | 1970 FX_BOOL bMatch = FALSE; |
| 1971 switch (bsPsName.GetAt(iPsLen - 1)) { | 1971 switch (bsPsName.GetAt(iPsLen - 1)) { |
| 1972 case 'L': { | 1972 case 'L': { |
| 1973 if (bsDRName.Right(5).Equal("Light")) { | 1973 if (bsDRName.Right(5) == "Light") { |
| 1974 bMatch = TRUE; | 1974 bMatch = TRUE; |
| 1975 } | 1975 } |
| 1976 } break; | 1976 } break; |
| 1977 case 'R': { | 1977 case 'R': { |
| 1978 if (bsDRName.Right(7).Equal("Regular") || | 1978 if (bsDRName.Right(7) == "Regular" || bsDRName.Right(3) == "Reg") { |
| 1979 bsDRName.Right(3).Equal("Reg")) { | |
| 1980 bMatch = TRUE; | 1979 bMatch = TRUE; |
| 1981 } | 1980 } |
| 1982 } break; | 1981 } break; |
| 1983 case 'M': { | 1982 case 'M': { |
| 1984 if (bsDRName.Right(5).Equal("Medium")) { | 1983 if (bsDRName.Right(5) == "Medium") { |
| 1985 bMatch = TRUE; | 1984 bMatch = TRUE; |
| 1986 } | 1985 } |
| 1987 } break; | 1986 } break; |
| 1988 default: | 1987 default: |
| 1989 break; | 1988 break; |
| 1990 } | 1989 } |
| 1991 return bMatch; | 1990 return bMatch; |
| 1992 } | 1991 } |
| 1993 } | 1992 } |
| 1994 return TRUE; | 1993 return TRUE; |
| (...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2074 CXFA_PDFFontMgr* pMgr = NULL; | 2073 CXFA_PDFFontMgr* pMgr = NULL; |
| 2075 m_PDFFontMgrArray.GetNextAssoc(ps, (void*&)hDoc, (void*&)pMgr); | 2074 m_PDFFontMgrArray.GetNextAssoc(ps, (void*&)hDoc, (void*&)pMgr); |
| 2076 delete pMgr; | 2075 delete pMgr; |
| 2077 } | 2076 } |
| 2078 m_PDFFontMgrArray.RemoveAll(); | 2077 m_PDFFontMgrArray.RemoveAll(); |
| 2079 m_FontMap.clear(); | 2078 m_FontMap.clear(); |
| 2080 } | 2079 } |
| 2081 void CXFA_FontMgr::SetDefFontMgr(CXFA_DefFontMgr* pFontMgr) { | 2080 void CXFA_FontMgr::SetDefFontMgr(CXFA_DefFontMgr* pFontMgr) { |
| 2082 m_pDefFontMgr = pFontMgr; | 2081 m_pDefFontMgr = pFontMgr; |
| 2083 } | 2082 } |
| OLD | NEW |