Chromium Code Reviews| 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 369 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 380 break; | 380 break; |
| 381 } | 381 } |
| 382 return 0; | 382 return 0; |
| 383 } | 383 } |
| 384 | 384 |
| 385 int32_t GetSimilarValue(int weight, | 385 int32_t GetSimilarValue(int weight, |
| 386 FX_BOOL bItalic, | 386 FX_BOOL bItalic, |
| 387 int pitch_family, | 387 int pitch_family, |
| 388 FX_DWORD style) { | 388 FX_DWORD style) { |
| 389 int32_t iSimilarValue = 0; | 389 int32_t iSimilarValue = 0; |
| 390 if ((style & FXFONT_BOLD) == (weight > 400)) { | 390 if (((style & FXFONT_BOLD) != 0) == (weight > 400)) { |
|
Tom Sepez
2016/03/11 00:30:29
again, !!
Wei Li
2016/03/11 04:11:36
Done.
| |
| 391 iSimilarValue += 16; | 391 iSimilarValue += 16; |
| 392 } | 392 } |
| 393 if ((style & FXFONT_ITALIC) == bItalic) { | 393 if (((style & FXFONT_ITALIC) != 0) == bItalic) { |
| 394 iSimilarValue += 16; | 394 iSimilarValue += 16; |
| 395 } | 395 } |
| 396 if ((style & FXFONT_SERIF) == (pitch_family & FXFONT_FF_ROMAN)) { | 396 if (((style & FXFONT_SERIF) != 0) == |
| 397 ((pitch_family & FXFONT_FF_ROMAN) != 0)) { | |
|
Tom Sepez
2016/03/11 00:30:29
Ooops. FXFONT_FF_ROMAN is (1 << 4), and FXFONT_SE
Wei Li
2016/03/11 04:11:36
Acknowledged.
| |
| 397 iSimilarValue += 16; | 398 iSimilarValue += 16; |
| 398 } | 399 } |
| 399 if ((style & FXFONT_SCRIPT) == (pitch_family & FXFONT_FF_SCRIPT)) { | 400 if (((style & FXFONT_SCRIPT) != 0) == |
|
Tom Sepez
2016/03/11 00:30:29
FXFONT_SCRIPT is 8, FXFONT_FF_SCRIPT is (4 << 4).
Wei Li
2016/03/11 04:11:36
Acknowledged.
| |
| 401 ((pitch_family & FXFONT_FF_SCRIPT) != 0)) { | |
| 400 iSimilarValue += 8; | 402 iSimilarValue += 8; |
| 401 } | 403 } |
| 402 if ((style & FXFONT_FIXED_PITCH) == (pitch_family & FXFONT_FF_FIXEDPITCH)) { | 404 if (((style & FXFONT_FIXED_PITCH) != 0) == |
|
Tom Sepez
2016/03/11 00:30:29
check this too.
Anyway, I think your changes more
Wei Li
2016/03/11 04:11:36
Acknowledged.
| |
| 405 ((pitch_family & FXFONT_FF_FIXEDPITCH) != 0)) { | |
| 403 iSimilarValue += 8; | 406 iSimilarValue += 8; |
| 404 } | 407 } |
| 405 return iSimilarValue; | 408 return iSimilarValue; |
| 406 } | 409 } |
| 407 | 410 |
| 408 } // namespace | 411 } // namespace |
| 409 | 412 |
| 410 CFX_SubstFont::CFX_SubstFont() { | 413 CFX_SubstFont::CFX_SubstFont() { |
| 411 m_ExtHandle = NULL; | 414 m_ExtHandle = NULL; |
| 412 m_Charset = 0; | 415 m_Charset = 0; |
| (...skipping 1200 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1613 int PDF_GetStandardFontName(CFX_ByteString* name) { | 1616 int PDF_GetStandardFontName(CFX_ByteString* name) { |
| 1614 AltFontName* found = static_cast<AltFontName*>( | 1617 AltFontName* found = static_cast<AltFontName*>( |
| 1615 FXSYS_bsearch(name->c_str(), g_AltFontNames, FX_ArraySize(g_AltFontNames), | 1618 FXSYS_bsearch(name->c_str(), g_AltFontNames, FX_ArraySize(g_AltFontNames), |
| 1616 sizeof(AltFontName), CompareString)); | 1619 sizeof(AltFontName), CompareString)); |
| 1617 if (!found) | 1620 if (!found) |
| 1618 return -1; | 1621 return -1; |
| 1619 | 1622 |
| 1620 *name = g_Base14FontNames[found->m_Index]; | 1623 *name = g_Base14FontNames[found->m_Index]; |
| 1621 return found->m_Index; | 1624 return found->m_Index; |
| 1622 } | 1625 } |
| OLD | NEW |