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

Side by Side Diff: core/fxge/ge/cfx_font.cpp

Issue 2323793003: Refactor CPDF_Document (Closed)
Patch Set: Comments Created 4 years, 3 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
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 "core/fxge/include/fx_font.h" 7 #include "core/fxge/include/fx_font.h"
8 8
9 #include "core/fpdfapi/fpdf_font/include/cpdf_font.h" 9 #include "core/fpdfapi/fpdf_font/include/cpdf_font.h"
10 #include "core/fxge/ge/fx_text_int.h" 10 #include "core/fxge/ge/fx_text_int.h"
(...skipping 428 matching lines...) Expand 10 before | Expand all | Expand 10 after
439 (FXFT_Get_Glyph_HoriBearingY(m_Face) - FXFT_Get_Glyph_Height(m_Face)) * 439 (FXFT_Get_Glyph_HoriBearingY(m_Face) - FXFT_Get_Glyph_Height(m_Face)) *
440 1000 / em; 440 1000 / em;
441 bbox.right = 441 bbox.right =
442 (FXFT_Get_Glyph_HoriBearingX(m_Face) + FXFT_Get_Glyph_Width(m_Face)) * 442 (FXFT_Get_Glyph_HoriBearingX(m_Face) + FXFT_Get_Glyph_Width(m_Face)) *
443 1000 / em; 443 1000 / em;
444 bbox.bottom = (FXFT_Get_Glyph_HoriBearingY(m_Face)) * 1000 / em; 444 bbox.bottom = (FXFT_Get_Glyph_HoriBearingY(m_Face)) * 1000 / em;
445 } 445 }
446 return TRUE; 446 return TRUE;
447 } 447 }
448 448
449 FX_BOOL CFX_Font::IsItalic() const { 449 bool CFX_Font::IsItalic() const {
450 if (!m_Face) 450 if (!m_Face)
451 return FALSE; 451 return false;
452 452
453 FX_BOOL ret = FXFT_Is_Face_Italic(m_Face) == FXFT_STYLE_FLAG_ITALIC; 453 bool ret = FXFT_Is_Face_Italic(m_Face) == FXFT_STYLE_FLAG_ITALIC;
Lei Zhang 2016/09/09 21:27:49 This can be: if (FXFT_Is_Face_Italic(m_Face) == F
npm 2016/09/12 14:47:27 Done.
454 if (!ret) { 454 if (!ret) {
455 CFX_ByteString str(FXFT_Get_Face_Style_Name(m_Face)); 455 CFX_ByteString str(FXFT_Get_Face_Style_Name(m_Face));
456 str.MakeLower(); 456 str.MakeLower();
457 if (str.Find("italic") != -1) 457 if (str.Find("italic") != -1)
458 ret = TRUE; 458 ret = true;
459 } 459 }
460 return ret; 460 return ret;
461 } 461 }
462 462
463 FX_BOOL CFX_Font::IsBold() const { 463 bool CFX_Font::IsBold() const {
464 if (!m_Face) 464 if (!m_Face)
465 return FALSE; 465 return false;
466 return FXFT_Is_Face_Bold(m_Face) == FXFT_STYLE_FLAG_BOLD; 466 return FXFT_Is_Face_Bold(m_Face) == FXFT_STYLE_FLAG_BOLD;
467 } 467 }
468 468
469 FX_BOOL CFX_Font::IsFixedWidth() const { 469 bool CFX_Font::IsFixedWidth() const {
470 if (!m_Face) 470 if (!m_Face)
471 return FALSE; 471 return false;
472 return FXFT_Is_Face_fixedwidth(m_Face); 472 return FXFT_Is_Face_fixedwidth(m_Face) != 0;
473 } 473 }
474 474
475 CFX_ByteString CFX_Font::GetPsName() const { 475 CFX_ByteString CFX_Font::GetPsName() const {
476 if (!m_Face) 476 if (!m_Face)
477 return CFX_ByteString(); 477 return CFX_ByteString();
478 478
479 CFX_ByteString psName = FXFT_Get_Postscript_Name(m_Face); 479 CFX_ByteString psName = FXFT_Get_Postscript_Name(m_Face);
480 if (psName.IsEmpty()) 480 if (psName.IsEmpty())
481 psName = "Untitled"; 481 psName = "Untitled";
482 return psName; 482 return psName;
(...skipping 175 matching lines...) Expand 10 before | Expand all | Expand 10 after
658 params.m_pPoints = pPath->GetPoints(); 658 params.m_pPoints = pPath->GetPoints();
659 params.m_CurX = params.m_CurY = 0; 659 params.m_CurX = params.m_CurY = 0;
660 params.m_CoordUnit = 64 * 64.0; 660 params.m_CoordUnit = 64 * 64.0;
661 FXFT_Outline_Decompose(FXFT_Get_Glyph_Outline(m_Face), &funcs, &params); 661 FXFT_Outline_Decompose(FXFT_Get_Glyph_Outline(m_Face), &funcs, &params);
662 Outline_CheckEmptyContour(&params); 662 Outline_CheckEmptyContour(&params);
663 pPath->TrimPoints(params.m_PointCount); 663 pPath->TrimPoints(params.m_PointCount);
664 if (params.m_PointCount) 664 if (params.m_PointCount)
665 pPath->GetPoints()[params.m_PointCount - 1].m_Flag |= FXPT_CLOSEFIGURE; 665 pPath->GetPoints()[params.m_PointCount - 1].m_Flag |= FXPT_CLOSEFIGURE;
666 return pPath; 666 return pPath;
667 } 667 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698