| 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 <algorithm> | 7 #include <algorithm> |
| 8 #include <limits> | 8 #include <limits> |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| (...skipping 299 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 310 AltFontFamily* found = (AltFontFamily*)FXSYS_bsearch( | 310 AltFontFamily* found = (AltFontFamily*)FXSYS_bsearch( |
| 311 fontName.c_str(), g_AltFontFamilies, | 311 fontName.c_str(), g_AltFontFamilies, |
| 312 sizeof g_AltFontFamilies / sizeof(AltFontFamily), sizeof(AltFontFamily), | 312 sizeof g_AltFontFamilies / sizeof(AltFontFamily), sizeof(AltFontFamily), |
| 313 CompareFontFamilyString); | 313 CompareFontFamilyString); |
| 314 return found ? CFX_ByteString(found->m_pFontFamily) : fontName; | 314 return found ? CFX_ByteString(found->m_pFontFamily) : fontName; |
| 315 } | 315 } |
| 316 | 316 |
| 317 CFX_ByteString ParseStyle(const FX_CHAR* pStyle, int iLen, int iIndex) { | 317 CFX_ByteString ParseStyle(const FX_CHAR* pStyle, int iLen, int iIndex) { |
| 318 CFX_ByteTextBuf buf; | 318 CFX_ByteTextBuf buf; |
| 319 if (!iLen || iLen <= iIndex) { | 319 if (!iLen || iLen <= iIndex) { |
| 320 return buf.GetByteString(); | 320 return buf.AsStringC(); |
| 321 } | 321 } |
| 322 while (iIndex < iLen) { | 322 while (iIndex < iLen) { |
| 323 if (pStyle[iIndex] == ',') { | 323 if (pStyle[iIndex] == ',') { |
| 324 break; | 324 break; |
| 325 } | 325 } |
| 326 buf.AppendChar(pStyle[iIndex]); | 326 buf.AppendChar(pStyle[iIndex]); |
| 327 ++iIndex; | 327 ++iIndex; |
| 328 } | 328 } |
| 329 return buf.GetByteString(); | 329 return buf.AsStringC(); |
| 330 } | 330 } |
| 331 | 331 |
| 332 int32_t GetStyleType(const CFX_ByteString& bsStyle, FX_BOOL bRevert) { | 332 int32_t GetStyleType(const CFX_ByteString& bsStyle, FX_BOOL bRevert) { |
| 333 int32_t iLen = bsStyle.GetLength(); | 333 int32_t iLen = bsStyle.GetLength(); |
| 334 if (!iLen) { | 334 if (!iLen) { |
| 335 return -1; | 335 return -1; |
| 336 } | 336 } |
| 337 int iSize = sizeof(g_FontStyles) / sizeof(FX_FontStyle); | 337 int iSize = sizeof(g_FontStyles) / sizeof(FX_FontStyle); |
| 338 const FX_FontStyle* pStyle = NULL; | 338 const FX_FontStyle* pStyle = NULL; |
| 339 for (int i = iSize - 1; i >= 0; --i) { | 339 for (int i = iSize - 1; i >= 0; --i) { |
| (...skipping 1304 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1644 int PDF_GetStandardFontName(CFX_ByteString* name) { | 1644 int PDF_GetStandardFontName(CFX_ByteString* name) { |
| 1645 AltFontName* found = static_cast<AltFontName*>( | 1645 AltFontName* found = static_cast<AltFontName*>( |
| 1646 FXSYS_bsearch(name->c_str(), g_AltFontNames, FX_ArraySize(g_AltFontNames), | 1646 FXSYS_bsearch(name->c_str(), g_AltFontNames, FX_ArraySize(g_AltFontNames), |
| 1647 sizeof(AltFontName), CompareString)); | 1647 sizeof(AltFontName), CompareString)); |
| 1648 if (!found) | 1648 if (!found) |
| 1649 return -1; | 1649 return -1; |
| 1650 | 1650 |
| 1651 *name = g_Base14FontNames[found->m_Index]; | 1651 *name = g_Base14FontNames[found->m_Index]; |
| 1652 return found->m_Index; | 1652 return found->m_Index; |
| 1653 } | 1653 } |
| OLD | NEW |